changeset 17577:c702371ff6df classdef

maint: periodic merge of default to classdef
author John W. Eaton <jwe@octave.org>
date Sat, 05 Oct 2013 11:22:09 -0400
parents 20d1b911b4e7 (current diff) 387ecd448b30 (diff)
children a98902bda11a
files build-aux/mkinstalldirs doc/doxyhtml/Doxygen.cfg libinterp/Makefile.am libinterp/corefcn/action-container.h libinterp/corefcn/load-path.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/pt-jit.cc libinterp/corefcn/symtab.cc libinterp/corefcn/symtab.h libinterp/corefcn/unwind-prot.cc libinterp/corefcn/unwind-prot.h libinterp/dldfcn/eigs.cc libinterp/dldfcn/urlwrite.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-usr-fcn.cc libinterp/octave.cc libinterp/parse-tree/lex.h libinterp/parse-tree/lex.ll libinterp/parse-tree/module.mk libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/parse.h libinterp/parse-tree/pt-check.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-id.h libinterp/parse-tree/pt-pr-code.cc liboctave/util/base-list.h liboctave/util/regexp.cc liboctave/util/regexp.h scripts/general/isequalwithequalnans.m scripts/mkinstalldirs scripts/plot/__gnuplot_drawnow__.m scripts/plot/__plt_get_axis_arg__.m scripts/plot/allchild.m scripts/plot/ancestor.m scripts/plot/area.m scripts/plot/axes.m scripts/plot/axis.m scripts/plot/bar.m scripts/plot/barh.m scripts/plot/box.m scripts/plot/caxis.m scripts/plot/cla.m scripts/plot/clabel.m scripts/plot/clf.m scripts/plot/close.m scripts/plot/closereq.m scripts/plot/colorbar.m scripts/plot/colstyle.m scripts/plot/comet.m scripts/plot/comet3.m scripts/plot/compass.m scripts/plot/contour.m scripts/plot/contour3.m scripts/plot/contourc.m scripts/plot/contourf.m scripts/plot/copyobj.m scripts/plot/cylinder.m scripts/plot/daspect.m scripts/plot/diffuse.m scripts/plot/ellipsoid.m scripts/plot/errorbar.m scripts/plot/ezcontour.m scripts/plot/ezcontourf.m scripts/plot/ezmesh.m scripts/plot/ezmeshc.m scripts/plot/ezplot.m scripts/plot/ezplot3.m scripts/plot/ezpolar.m scripts/plot/ezsurf.m scripts/plot/ezsurfc.m scripts/plot/feather.m scripts/plot/figure.m scripts/plot/fill.m scripts/plot/findall.m scripts/plot/findfigs.m scripts/plot/findobj.m scripts/plot/fplot.m scripts/plot/gca.m scripts/plot/gcbf.m scripts/plot/gcbo.m scripts/plot/gcf.m scripts/plot/gco.m scripts/plot/ginput.m scripts/plot/gnuplot_binary.in scripts/plot/graphics_toolkit.m scripts/plot/grid.m scripts/plot/gtext.m scripts/plot/guidata.m scripts/plot/guihandles.m scripts/plot/hdl2struct.m scripts/plot/hggroup.m scripts/plot/hidden.m scripts/plot/hist.m scripts/plot/hold.m scripts/plot/isfigure.m scripts/plot/ishghandle.m scripts/plot/ishold.m scripts/plot/isocolors.m scripts/plot/isonormals.m scripts/plot/isosurface.m scripts/plot/isprop.m scripts/plot/legend.m scripts/plot/line.m scripts/plot/linkprop.m scripts/plot/loglog.m scripts/plot/loglogerr.m scripts/plot/mesh.m scripts/plot/meshc.m scripts/plot/meshgrid.m scripts/plot/meshz.m scripts/plot/ndgrid.m scripts/plot/newplot.m scripts/plot/orient.m scripts/plot/pareto.m scripts/plot/patch.m scripts/plot/pbaspect.m scripts/plot/pcolor.m scripts/plot/peaks.m scripts/plot/pie.m scripts/plot/pie3.m scripts/plot/plot.m scripts/plot/plot3.m scripts/plot/plotmatrix.m scripts/plot/plotyy.m scripts/plot/polar.m scripts/plot/print.m scripts/plot/printd.m scripts/plot/private/__actual_axis_position__.m scripts/plot/private/__add_datasource__.m scripts/plot/private/__add_default_menu__.m scripts/plot/private/__axes_limits__.m scripts/plot/private/__axis_label__.m scripts/plot/private/__bar__.m scripts/plot/private/__clabel__.m scripts/plot/private/__color_str_rgb__.m scripts/plot/private/__contour__.m scripts/plot/private/__default_plot_options__.m scripts/plot/private/__errcomm__.m scripts/plot/private/__errplot__.m scripts/plot/private/__ezplot__.m scripts/plot/private/__file_filter__.m scripts/plot/private/__fltk_file_filter__.m scripts/plot/private/__fltk_ginput__.m scripts/plot/private/__fltk_print__.m scripts/plot/private/__getlegenddata__.m scripts/plot/private/__ghostscript__.m scripts/plot/private/__gnuplot_get_var__.m scripts/plot/private/__gnuplot_ginput__.m scripts/plot/private/__gnuplot_has_feature__.m scripts/plot/private/__gnuplot_has_terminal__.m scripts/plot/private/__gnuplot_open_stream__.m scripts/plot/private/__gnuplot_print__.m scripts/plot/private/__gnuplot_version__.m scripts/plot/private/__go_draw_axes__.m scripts/plot/private/__go_draw_figure__.m scripts/plot/private/__interp_cube__.m scripts/plot/private/__is_function__.m scripts/plot/private/__line__.m scripts/plot/private/__marching_cube__.m scripts/plot/private/__next_line_color__.m scripts/plot/private/__next_line_style__.m scripts/plot/private/__patch__.m scripts/plot/private/__pie__.m scripts/plot/private/__plt__.m scripts/plot/private/__pltopt__.m scripts/plot/private/__print_parse_opts__.m scripts/plot/private/__quiver__.m scripts/plot/private/__scatter__.m scripts/plot/private/__stem__.m scripts/plot/private/__tight_eps_bbox__.m scripts/plot/private/__uigetdir_fltk__.m scripts/plot/private/__uigetfile_fltk__.m scripts/plot/private/__uiobject_split_args__.m scripts/plot/private/__uiputfile_fltk__.m scripts/plot/quiver.m scripts/plot/quiver3.m scripts/plot/rectangle.m scripts/plot/refresh.m scripts/plot/refreshdata.m scripts/plot/ribbon.m scripts/plot/rose.m scripts/plot/saveas.m scripts/plot/scatter.m scripts/plot/scatter3.m scripts/plot/semilogx.m scripts/plot/semilogxerr.m scripts/plot/semilogy.m scripts/plot/semilogyerr.m scripts/plot/shading.m scripts/plot/shg.m scripts/plot/shrinkfaces.m scripts/plot/slice.m scripts/plot/sombrero.m scripts/plot/specular.m scripts/plot/sphere.m scripts/plot/stairs.m scripts/plot/stem.m scripts/plot/stem3.m scripts/plot/stemleaf.m scripts/plot/struct2hdl.m scripts/plot/subplot.m scripts/plot/surf.m scripts/plot/surface.m scripts/plot/surfc.m scripts/plot/surfl.m scripts/plot/surfnorm.m scripts/plot/tetramesh.m scripts/plot/text.m scripts/plot/title.m scripts/plot/trimesh.m scripts/plot/triplot.m scripts/plot/trisurf.m scripts/plot/uicontextmenu.m scripts/plot/uicontrol.m scripts/plot/uigetdir.m scripts/plot/uigetfile.m scripts/plot/uimenu.m scripts/plot/uipanel.m scripts/plot/uipushtool.m scripts/plot/uiputfile.m scripts/plot/uiresume.m scripts/plot/uitoggletool.m scripts/plot/uitoolbar.m scripts/plot/uiwait.m scripts/plot/view.m scripts/plot/waitbar.m scripts/plot/waitforbuttonpress.m scripts/plot/waterfall.m scripts/plot/whitebg.m scripts/plot/xlabel.m scripts/plot/xlim.m scripts/plot/ylabel.m scripts/plot/ylim.m scripts/plot/zlabel.m scripts/plot/zlim.m test/Makefile.am test/classes/classes.tst
diffstat 1127 files changed, 63753 insertions(+), 52940 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Thu Sep 12 21:08:07 2013 -0400
+++ b/.hgsubstate	Sat Oct 05 11:22:09 2013 -0400
@@ -1,1 +1,1 @@
-5a51fb7777a9950502965a043a70bd6ca5e0498b gnulib-hg
+6057744acd2c71c069a4b171c5fe1ff0d86c9e5f gnulib-hg
--- a/.hgtags	Thu Sep 12 21:08:07 2013 -0400
+++ b/.hgtags	Sat Oct 05 11:22:09 2013 -0400
@@ -78,3 +78,5 @@
 b29b10fbb7448cdfe29322446e1a589e7fe1a40a release-3-6-4
 4e50bd2946d8563d3e201cc04b3ba0720c991b06 ss-3-7-4
 608e307b49149b32a6d09c2f06493d04d3af9be4 ss-3-7-5
+3a9efb68272df556dccb84c87933dd8238e88902 ss-3-7-6
+cc13924a4266fb0359f59fabdce11071e6051d48 ss-3-7-7
--- a/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -42,7 +42,6 @@
   bootstrap.conf \
   build-aux/find-files-with-tests.sh \
   build-aux/mk-opts.pl \
-  build-aux/mkinstalldirs \
   build-aux/move-if-change \
   build-aux/OctJavaQry.class \
   etc/NEWS.1 \
@@ -146,6 +145,10 @@
   NEWS \
   CITATION
 
+doxyhtml:
+	$(MAKE) -C doc/doxyhtml doxyhtml
+.PHONY: doxyhtml
+
 DIRS_TO_MAKE = \
   $(localfcnfiledir) \
   $(localapifcnfiledir) \
--- a/NEWS	Thu Sep 12 21:08:07 2013 -0400
+++ b/NEWS	Sat Oct 05 11:22:09 2013 -0400
@@ -17,6 +17,16 @@
 Summary of important user-visible changes for version 3.8:
 ---------------------------------------------------------
 
+ ** Octave now uses OpenGL graphics by default with FLTK widgets.  If
+    OpenGL libraries or FLTK widgets are not available when Octave is
+    built, gnuplot is used.  You may also choose to use gnuplot for
+    graphics by executing the command
+
+      graphics_toolkit ("gnuplot")
+
+    Adding this command to your ~/.octaverc file will set the default
+    for each session.
+
  ** Octave now supports nested functions with scoping rules that are
     compatible with Matlab.  A nested function is one declared and defined
     within the body of another function.  The nested function is only
@@ -43,6 +53,67 @@
       endfunction
     endfunction
 
+ ** Line continuations inside character strings have changed.
+
+    The sequence '...' is no longer recognized as a line continuation
+    inside a character string.  A backslash '\' followed by a newline
+    character is no longer recognized as a line continuation inside
+    single-quoted character strings.  Inside double-quoted character
+    strings, a backslash followed by a newline character is still
+    recognized as a line continuation, but the backslash character must
+    be followed *immediately* by the newline character.  No whitespace or
+    end-of-line comment may appear between them.
+
+ ** Backslash as a continuation marker outside of double-quoted strings
+    is now deprecated.
+
+    Using '\' as a continuation marker outside of double quoted strings
+    is now deprecated and will be removed from a future version of
+    Octave.  When that is done, the behavior of
+
+      (a \
+       b)
+
+    will be consistent with other binary operators.
+
+ ** Redundant terminal comma accepted by parser
+
+    A redundant terminal comma is now accepted in matrix
+    definitions which allows writing code such as 
+
+    [a,...
+     b,...
+     c,...
+    ] = deal (1,2,3)
+
+ ** Octave now has limited support for named exceptions
+
+    The following syntax is now accepted:
+
+      try
+        statements
+      catch exception-id
+        statements
+      end
+
+    The exception-id is a structure with the fields "message" and
+    "identifier".  For example
+
+      try
+        error ("Octave:error-id", "error message");
+      catch myerr
+        printf ("identifier: %s\n", myerr.identifier);
+        printf ("message:    %s\n", myerr.message);
+      end_try_catch
+
+    When classdef-style classes are added to Octave, the exception-id
+    will become an MException object.
+
+ ** Warning IDs renamed:
+
+    Octave:array-as-scalar => Octave:array-to-scalar
+    Octave:array-as-vector => Octave:array-to-vector
+
  ** 'emptymatch', 'noemptymatch' options added to regular expressions.
 
     With this addition Octave now accepts the entire set of Matlab options
@@ -67,20 +138,34 @@
     expression would have searched for a literal '\' followed by 't' and
     replaced the two characters with the sequence '\', 'n'.
 
- ** Redundant terminal comma accepted by parser
+ ** A TeX parser has been implemented for the FLTK toolkit and is the default
+    for any text object including titles and axis labels.  The TeX parser is
+    supported only for display on a monitor, not for printing.
 
-    A redundant terminal comma is now accepted in matrix
-    definitions which allows writing code such as 
+    A quick summary of features:
 
-    [a,...
-     b,...
-     c,...
-    ] = deal (1,2,3)
+    Code         Feature     Example             Comment
+    -----------------------------------------------------------------
+    _            subscript   H_2O                formula for water
+    ^            exponent    y=x^2               formula for parabola
+    \char        symbol      \beta               Greek symbol beta
+    \fontname    font        \fontname{Arial}    set Arial font
+    \fontsize    fontsize    \fontsize{16}       set fontsize 16
+    \color[rgb]  fontcolor   \color[rgb]{1 0 1}  set magenta color 
+    \bf          bold        \bfBold Text        bold font
+    \it          italic      \itItalic Text      italic font
+    \sl          slanted     \slOblique Text     slanted font
+    \rm          normal      \bfBold\rmNormal    normal font
+    {}           group       {\bf Bold}Normal    group objects
+                             e^{i*\pi} = -1      complex example
 
- ** Warning IDs renamed:
+ ** The m-files in the plot directory have been overhauled.
 
-    Octave:array-as-scalar => Octave:array-to-scalar
-    Octave:array-as-vector => Octave:array-to-vector
+    The plot functions now produce output that is nearly visually compatible
+    with Matlab.  Plot performance has also increased, dramatically for some
+    functions such as comet and waitbar.  Finally, the documentation for most
+    functions has been updated so it should be clearer both how to use a
+    function and when a function is appropriate.
 
  ** The m-files in the image directory have been overhauled.
 
@@ -94,6 +179,28 @@
     colormap depending on the image class (integer images have a -1 offset to
     the colormap row number).
 
+ ** The imread and imwrite functions have been completely rewritten.
+
+    The main changes relate to the alpha channel, support for reading and
+    writing of floating point images, implemented writing of indexed images,
+    and appending images to multipage image files.
+
+    The issues that may arise due to backwards incompatibility are:
+
+      * imwrite no longer interprets a length of 2 or 4 in the third dimension
+        as grayscale or RGB with alpha channel (a length of 4 will be saved
+        as a CMYK image).  Alpha channel must be passed as separate argument.
+
+      * imread will always return the colormap indexes when reading an indexed
+        image, even if the colormap is not requested as output.
+
+      * transparency values are now inverted from previous Octave versions
+        (0 is for completely transparent instead of completely opaque).
+
+    In addition, the function imformats has been implemented to expand
+    reading and writing of images of different formats through imread
+    and imwrite.
+
  ** The colormap function now provides new options--"list", "register",
     and "unregister"--to list all available colormap functions, and to
     add or remove a function name from the list of known colormap
@@ -125,11 +232,11 @@
        [1,2] = 3
       }
 
-    (2) By default, Matlab treats consecutive delimiters are as a single
+    (2) By default, Matlab treats consecutive delimiters as a single
     delimiter.  By default, Octave's legacy behavior was to return an
     empty string for the part between the delmiters.
 
-    Where the legacy behavior is desired, the call to strsplit() may be
+    Where legacy behavior is desired, the call to strsplit() may be
     replaced by ostrsplit(), which is Octave's original implementation of
     strsplit().
 
@@ -148,8 +255,13 @@
     In addition two new error functions erfi (imaginary error function) and
     dawson (scaled imaginary error function) have been added.
 
- ** The default name of the Octave crash dump file is now called
-    octave-workspace instead of octave-core.
+ ** The glpk function has been modified to reflect changes in the GLPK
+    library.  The "round" and "itcnt" options have been removed.  The
+    "relax" option has been replaced by the "rtest" option.  The numeric
+    values of error codes and of some options have also changed.
+
+ ** The default name of the Octave crash dump file is now 
+    "octave-workspace" instead of "octave-core".
 
  ** A citation command has been added to display information on how to
     cite Octave and packages in publications.  The package system will
@@ -176,19 +288,23 @@
 
  ** Other new functions added in 3.8.0:
 
-      base64_decode               ellipke         lines      
-      base64_encode               erfcinv         polyeig                   
-      betaincinv                  erfi            readline_re_read_init_file
-      built_in_docstrings_file    expint          readline_read_init_file 
-      cmpermute                   findfigs        rgbplot               
-      cmunique                    fminsearch      save_default_options  
-      colorcube                   gallery         shrinkfaces           
-      copyobj                     gco             splinefit             
-      dawson                      hdl2struct      stemleaf           
-      dblist                      history_save    strjoin             
-      debug_jit                   importdata      struct2hdl          
-      doc_cache_create            iscolormap      tetramesh           
-      ellipj                      jit_enable      waterfall  
+      atan2d                     erfi             lines
+      base64_decode              expint           linsolve
+      base64_encode              findfigs         missing_component_hook
+      betaincinv                 flintmax         polyeig
+      built_in_docstrings_file   fminsearch       prefdir
+      cmpermute                  gallery          preferences
+      cmunique                   gco              readline_re_read_init_file
+      colorcube                  hdl2struct       readline_read_init_file
+      copyobj                    history_save     rgbplot
+      dawson                     imformats        save_default_options
+      dblist                     importdata       shrinkfaces
+      debug_jit                  isaxes           splinefit
+      desktop                    iscolormap       stemleaf
+      doc_cache_create           isequaln         strjoin
+      ellipj                     jit_debug        struct2hdl
+      ellipke                    jit_enable       tetramesh
+      erfcinv                    jit_startcnt     waterfall
 
  ** Deprecated functions.
 
@@ -207,12 +323,13 @@
 
       default_save_options    java_set                  
       gen_doc_cache           java_unsigned_conversion  
-      java_convert_matrix     javafields                
-      java_debug              javamethods               
-      java_get                re_read_readline_init_file
-      java_invoke             read_readline_init_file   
-      java_new                saving_history            
-      
+      isequalwithequalnans    javafields                
+      java_convert_matrix     javamethods               
+      java_debug              re_read_readline_init_file
+      java_get                read_readline_init_file   
+      java_invoke             saving_history            
+      java_new           
+
     The following keywords have been deprecated in Octave 3.8 and will
     be removed from Octave 3.12 (or whatever version is the second major
     release after 3.8):
@@ -226,6 +343,11 @@
       CC_VERSION  (now GCC_VERSION)
       CXX_VERSION (now GXX_VERSION)
 
+    The internal class <Octave_map> has been deprecated in Octave 3.8 and will
+    be removed from Octave 3.12 (or whatever version is the second major
+    release after 3.8).  Replacement classes are <octave_map> (struct array)
+    or <octave_scalar_map> for a single structure.
+
 Summary of important user-visible changes for version 3.6:
 ---------------------------------------------------------
 
--- a/bootstrap	Thu Sep 12 21:08:07 2013 -0400
+++ b/bootstrap	Sat Oct 05 11:22:09 2013 -0400
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2012-07-19.14; # UTC
+scriptversion=2013-08-15.22; # UTC
 
 # Bootstrap this package from checked-out sources.
 
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -140,20 +140,21 @@
 "wget --mirror -nd -q -np -A.po -P '%s' \
  http://translationproject.org/latest/%s/"
 
+# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
+# fall back to the package name (1st argument with munging)
 extract_package_name='
-  /^AC_INIT(/{
-     /.*,.*,.*, */{
-       s///
-       s/[][]//g
-       s/)$//
+  /^AC_INIT(\[*/{
+     s///
+     /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
+       s//\1/
+       s/[],)].*//
        p
        q
      }
-     s/AC_INIT(\[*//
-     s/]*,.*//
+     s/[],)].*//
      s/^GNU //
      y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
-     s/[^A-Za-z0-9_]/-/g
+     s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
      p
   }
 '
@@ -205,10 +206,8 @@
 # default.
 bootstrap_sync=false
 
-# Don't use git to update gnulib sources. We keep gnulib under a
-# Mercurial subrepository instead
-use_git=false
-GNULIB_SRCDIR=gnulib-hg
+# Use git to update gnulib sources
+use_git=true
 
 # find_tool ENVVAR NAMES...
 # -------------------------
@@ -225,27 +224,21 @@
   find_tool_names=$@
   eval "find_tool_res=\$$find_tool_envvar"
   if test x"$find_tool_res" = x; then
-    for i
-    do
+    for i; do
       if ($i --version </dev/null) >/dev/null 2>&1; then
-       find_tool_res=$i
-       break
+        find_tool_res=$i
+        break
       fi
     done
-  else
-    find_tool_error_prefix="\$$find_tool_envvar: "
   fi
-  test x"$find_tool_res" != x \
-    || die "one of these is required: $find_tool_names"
-  ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
-    || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
+  if test x"$find_tool_res" = x; then
+    warn_ "one of these is required: $find_tool_names;"
+    die   "alternatively set $find_tool_envvar to a compatible tool"
+  fi
   eval "$find_tool_envvar=\$find_tool_res"
   eval "export $find_tool_envvar"
 }
 
-# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
-find_tool SHA1SUM sha1sum gsha1sum shasum
-
 # Override the default configuration, if necessary.
 # Make sure that bootstrap.conf is sourced from the current directory
 # if we were invoked as "sh bootstrap".
@@ -257,12 +250,12 @@
 # Extra files from gnulib, which override files from other sources.
 test -z "${gnulib_extra_files}" && \
   gnulib_extra_files="
-        $build_aux/install-sh
-        $build_aux/mdate-sh
-        $build_aux/texinfo.tex
-        $build_aux/depcomp
-        $build_aux/config.guess
-        $build_aux/config.sub
+        build-aux/install-sh
+        build-aux/mdate-sh
+        build-aux/texinfo.tex
+        build-aux/depcomp
+        build-aux/config.guess
+        build-aux/config.sub
         doc/INSTALL
 "
 
@@ -308,34 +301,34 @@
   die "Bootstrapping from a non-checked-out distribution is risky."
 fi
 
-# Ensure that lines starting with ! sort last, per gitignore conventions
-# for whitelisting exceptions after a more generic blacklist pattern.
-sort_patterns() {
-  sort -u "$@" | sed '/^!/ {
-    H
-    d
-  }
-  $ {
-    P
-    x
-    s/^\n//
-  }' | sed '/^$/d'
+# Strip blank and comment lines to leave significant entries.
+gitignore_entries() {
+  sed '/^#/d; /^$/d' "$@"
 }
 
-# If $STR is not already on a line by itself in $FILE, insert it,
-# sorting the new contents of the file and replacing $FILE with the result.
-insert_sorted_if_absent() {
+# If $STR is not already on a line by itself in $FILE, insert it at the start.
+# Entries are inserted at the start of the ignore list to ensure existing
+# entries starting with ! are not overridden.  Such entries support
+# whitelisting exceptions after a more generic blacklist pattern.
+insert_if_absent() {
   file=$1
   str=$2
   test -f $file || touch $file
-  echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
-    || { echo "$str" | sort_patterns - $file > $file.bak \
-      && mv $file.bak $file; } \
-    || die "insert_sorted_if_absent $file $str: failed"
+  test -r $file || die "Error: failed to read ignore file: $file"
+  duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
+  if [ "$duplicate_entries" ] ; then
+    die "Error: Duplicate entries in $file: " $duplicate_entries
+  fi
+  linesold=$(gitignore_entries $file | wc -l)
+  linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
+  if [ $linesold != $linesnew ] ; then
+    { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
+      || die "insert_if_absent $file $str: failed"
+  fi
 }
 
 # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
-# insert_sorted_if_absent.
+# insert_if_absent.
 insert_vc_ignore() {
   vc_ignore_file="$1"
   pattern="$2"
@@ -346,7 +339,7 @@
     # .gitignore entry.
     pattern=$(echo "$pattern" | sed s,^,/,);;
   esac
-  insert_sorted_if_absent "$vc_ignore_file" "$pattern"
+  insert_if_absent "$vc_ignore_file" "$pattern"
 }
 
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
@@ -470,7 +463,7 @@
     if [ "$req_ver" = "-" ]; then
       # Merely require app to exist; not all prereq apps are well-behaved
       # so we have to rely on $? rather than get_version.
-      $app --version >/dev/null 2>&1
+      $app --version >/dev/null 2>&1 </dev/null
       if [ 126 -le $? ]; then
         warn_ "Error: '$app' not found"
         ret=1
@@ -504,6 +497,12 @@
   # can't depend on column -t
 }
 
+# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
+# Also find the compatible sha1 utility on the BSDs
+if test x"$SKIP_PO" = x; then
+  find_tool SHA1SUM sha1sum gsha1sum shasum sha1
+fi
+
 use_libtool=0
 # We'd like to use grep -E, to see if any of LT_INIT,
 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
@@ -552,7 +551,7 @@
 echo "$0: Bootstrapping from checked-out $package sources..."
 
 # See if we can use gnulib's git-merge-changelog merge driver.
-if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
+if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
   if git config merge.merge-changelog.driver >/dev/null ; then
     :
   elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
@@ -575,13 +574,17 @@
   test -f .gitmodules && git config --file .gitmodules "$@"
 }
 
-gnulib_path=$(git_modules_config submodule.gnulib.path)
-test -z "$gnulib_path" && gnulib_path=gnulib
+if $use_git; then
+  gnulib_path=$(git_modules_config submodule.gnulib.path)
+  test -z "$gnulib_path" && gnulib_path=gnulib
+fi
 
-# Get gnulib files.
+# Get gnulib files.  Populate $GNULIB_SRCDIR, possibly updating a
+# submodule, for use in the rest of the script.
 
 case ${GNULIB_SRCDIR--} in
 -)
+  # Note that $use_git is necessarily true in this case.
   if git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
     git submodule init || exit $?
@@ -602,8 +605,8 @@
   GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
-  # Use GNULIB_SRCDIR as a reference.
-  if test -d "$GNULIB_SRCDIR"/.git && \
+  # Use GNULIB_SRCDIR directly or as a reference.
+  if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
     if git submodule -h|grep -- --reference > /dev/null; then
@@ -629,12 +632,19 @@
   ;;
 esac
 
+# $GNULIB_SRCDIR now points to the version of gnulib to use, and
+# we no longer need to use git or $gnulib_path below here.
+
 if $bootstrap_sync; then
   cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
     echo "$0: updating bootstrap and restarting..."
+    case $(sh -c 'echo "$1"' -- a) in
+      a) ignored=--;;
+      *) ignored=ignored;;
+    esac
     exec sh -c \
       'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
-      -- "$GNULIB_SRCDIR/build-aux/bootstrap" \
+      $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
       "$0" "$@" --no-bootstrap-sync
   }
 fi
@@ -682,11 +692,10 @@
     cksum_file="$ref_po_dir/$po.s1"
     if ! test -f "$cksum_file" ||
         ! test -f "$po_dir/$po.po" ||
-        ! $SHA1SUM -c --status "$cksum_file" \
-            < "$new_po" > /dev/null; then
+        ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
       echo "$me: updated $po_dir/$po.po..."
       cp "$new_po" "$po_dir/$po.po" \
-          && $SHA1SUM < "$new_po" > "$cksum_file"
+          && $SHA1SUM < "$new_po" > "$cksum_file" || return
     fi
   done
 }
@@ -891,20 +900,21 @@
   -depth \( -name '*.m4' -o -name '*.[ch]' \) \
   -type l -xtype l -delete > /dev/null 2>&1
 
+# Invoke autoreconf with --force --install to ensure upgrades of tools
+# such as ylwrap.
+AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
+
 # Some systems (RHEL 5) are using ancient autotools, for which the
 # --no-recursive option had not been invented.  Detect that lack and
 # omit the option when it's not supported.  FIXME in 2017: remove this
 # hack when RHEL 5 autotools are updated, or when they become irrelevant.
-no_recursive=
 case $($AUTORECONF --help) in
-  *--no-recursive*) no_recursive=--no-recursive;;
+  *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
 esac
 
 # Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
-echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
-    "$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
-AUTOPOINT=true LIBTOOLIZE=true \
-    $AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
+echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
+AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
   || die "autoreconf failed"
 
 # Get some extra files from gnulib, overriding existing files.
--- a/bootstrap.conf	Thu Sep 12 21:08:07 2013 -0400
+++ b/bootstrap.conf	Sat Oct 05 11:22:09 2013 -0400
@@ -49,6 +49,7 @@
   link
   lstat
   malloc-gnu
+  mbrtowc
   mkdir
   mkfifo
   mkostemp
@@ -143,11 +144,14 @@
 gnulib_name="libgnu"
 source_base="libgnu"
 
-## Use --foreign since we auto-generate the AUTHORS file and the default
-## --gnu strictness level doesn't like it if the AUTHORS file is missing.
+# Don't use git to update gnulib sources. We keep gnulib under a
+# Mercurial subrepository instead.
+use_git=false
+GNULIB_SRCDIR=gnulib-hg
 
-AUTOMAKE="automake --foreign --warnings=no-portability"
-export AUTOMAKE
+# Don't check for translations since we don't have any in Octave yet.
+# This avoids the need for sha1sum or compatible utility in bootstrap.
+SKIP_PO=true
 
 bootstrap_post_import_hook ()
 {
--- a/build-aux/mk-opts.pl	Thu Sep 12 21:08:07 2013 -0400
+++ b/build-aux/mk-opts.pl	Sat Oct 05 11:22:09 2013 -0400
@@ -240,7 +240,7 @@
     }
 }
 
-#FIXME: What does this routine do?  And can it be simpler to understand?
+## FIXME: What does this routine do?  And can it be simpler to understand?
 sub get_min_match_len_info
 {
   my ($i, $j, $k);
@@ -924,7 +924,7 @@
 
   for (my $i = 0; $i < $OPT_NUM; $i++)
     {
-      print '@item \"', $NAME[$i], '\"\n\\', "\n";
+      print '@item @qcode{\"', $NAME[$i], '\"}\n\\', "\n";
       print $DOC_ITEM[$i] if $DOC_ITEM[$i];
     }
 
--- a/build-aux/mkinstalldirs	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-
-scriptversion=2009-04-28.21; # UTC
-
-# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain.
-#
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-nl='
-'
-IFS=" ""	$nl"
-errstatus=0
-dirmode=
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
-
-Create each directory DIR (with mode MODE, if specified), including all
-leading file name components.
-
-Report bugs to <bug-automake@gnu.org>."
-
-# process command line arguments
-while test $# -gt 0 ; do
-  case $1 in
-    -h | --help | --h*)         # -h for help
-      echo "$usage"
-      exit $?
-      ;;
-    -m)                         # -m PERM arg
-      shift
-      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
-      dirmode=$1
-      shift
-      ;;
-    --version)
-      echo "$0 $scriptversion"
-      exit $?
-      ;;
-    --)                         # stop option processing
-      shift
-      break
-      ;;
-    -*)                         # unknown option
-      echo "$usage" 1>&2
-      exit 1
-      ;;
-    *)                          # first non-opt arg
-      break
-      ;;
-  esac
-done
-
-for file
-do
-  if test -d "$file"; then
-    shift
-  else
-    break
-  fi
-done
-
-case $# in
-  0) exit 0 ;;
-esac
-
-# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
-# mkdir -p a/c at the same time, both will detect that a is missing,
-# one will create a, then the other will try to create a and die with
-# a "File exists" error.  This is a problem when calling mkinstalldirs
-# from a parallel make.  We use --version in the probe to restrict
-# ourselves to GNU mkdir, which is thread-safe.
-case $dirmode in
-  '')
-    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-      echo "mkdir -p -- $*"
-      exec mkdir -p -- "$@"
-    else
-      # On NextStep and OpenStep, the `mkdir' command does not
-      # recognize any option.  It will interpret all options as
-      # directories to create, and then abort because `.' already
-      # exists.
-      test -d ./-p && rmdir ./-p
-      test -d ./--version && rmdir ./--version
-    fi
-    ;;
-  *)
-    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
-       test ! -d ./--version; then
-      echo "mkdir -m $dirmode -p -- $*"
-      exec mkdir -m "$dirmode" -p -- "$@"
-    else
-      # Clean up after NextStep and OpenStep mkdir.
-      for d in ./-m ./-p ./--version "./$dirmode";
-      do
-        test -d $d && rmdir $d
-      done
-    fi
-    ;;
-esac
-
-for file
-do
-  case $file in
-    /*) pathcomp=/ ;;
-    *)  pathcomp= ;;
-  esac
-  oIFS=$IFS
-  IFS=/
-  set fnord $file
-  shift
-  IFS=$oIFS
-
-  for d
-  do
-    test "x$d" = x && continue
-
-    pathcomp=$pathcomp$d
-    case $pathcomp in
-      -*) pathcomp=./$pathcomp ;;
-    esac
-
-    if test ! -d "$pathcomp"; then
-      echo "mkdir $pathcomp"
-
-      mkdir "$pathcomp" || lasterr=$?
-
-      if test ! -d "$pathcomp"; then
-	errstatus=$lasterr
-      else
-	if test ! -z "$dirmode"; then
-	  echo "chmod $dirmode $pathcomp"
-	  lasterr=
-	  chmod "$dirmode" "$pathcomp" || lasterr=$?
-
-	  if test ! -z "$lasterr"; then
-	    errstatus=$lasterr
-	  fi
-	fi
-      fi
-    fi
-
-    pathcomp=$pathcomp/
-  done
-done
-
-exit $errstatus
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
--- a/configure.ac	Thu Sep 12 21:08:07 2013 -0400
+++ b/configure.ac	Sat Oct 05 11:22:09 2013 -0400
@@ -19,13 +19,13 @@
 ### <http://www.gnu.org/licenses/>.
 
 AC_PREREQ([2.62])
-AC_INIT([GNU Octave], [3.7.5], [http://octave.org/bugs.html], [octave])
+AC_INIT([GNU Octave], [3.7.7+], [http://octave.org/bugs.html], [octave])
 
 dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
 OCTAVE_VERSION="$PACKAGE_VERSION"
 OCTAVE_API_VERSION_NUMBER="48"
 OCTAVE_API_VERSION="api-v$OCTAVE_API_VERSION_NUMBER+"
-OCTAVE_RELEASE_DATE="2013-05-14"
+OCTAVE_RELEASE_DATE="2013-09-23"
 OCTAVE_COPYRIGHT="Copyright (C) 2013 John W. Eaton and others."
 AC_SUBST(OCTAVE_VERSION)
 AC_SUBST(OCTAVE_API_VERSION_NUMBER)
@@ -41,7 +41,11 @@
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.11 tar-ustar])
+AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability -Wno-override tar-ustar subdir-objects])
+
+## Add the option to enable silent rules, available since Automake 1.11
+## and included by default starting with Automake 1.13.
+AM_SILENT_RULES
 
 OCTAVE_CANONICAL_HOST
 
@@ -712,7 +716,7 @@
   AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
 fi
 
-### Check for the LLVM library
+ ### Check for the LLVM library
 
 build_jit=no
 AC_ARG_ENABLE([jit],
@@ -742,6 +746,7 @@
 
     save_CPPFLAGS="$CPPFLAGS"
     save_CXXFLAGS="$CXXFLAGS"
+    save_LDFLAGS="$LDFLAGS"
 
     ## Use -isystem if available because we don't want to see warnings in LLVM
     LLVM_INCLUDE_FLAG=-I
@@ -753,7 +758,11 @@
     LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
     LLVM_CXXFLAGS=
     LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
-    LLVM_LIBS=`$LLVM_CONFIG --libs`
+
+
+    LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
+    LLVM_SO=LLVM-`$LLVM_CONFIG --version`
+    AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"], [LLVM_LIBS=`$LLVM_CONFIG --libs`])
 
     dnl
     dnl Define some extra flags that LLVM requires in order to include headers.
@@ -766,9 +775,33 @@
     AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [
       warn_llvm=
       XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"])
+
+    have_function_h=no
+    AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
+                     [have_function_h=yes; break])
+    if test $have_function_h = no; then
+      warn_llvm="Missing LLVM file Function.h.  JIT compiler is disabled."
+    fi
+    have_irbuilder_h=no
+    AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
+                      llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
+    if test $have_irbuilder_h = no; then
+      warn_llvm="Missing LLVM file IRBuilder.h.  JIT compiler is disabled."
+    fi
+    have_llvm_data_h=no
+    AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
+                      llvm/DataLayout.h], [have_llvm_data_h=yes; break])
+    if test $have_llvm_data_h = no; then
+      warn_llvm="Missing LLVM file TargetData.h.  JIT compiler is disabled."
+    fi
+
+    OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
+    OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
+    OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
     AC_LANG_POP(C++)
     CPPFLAGS="$save_CPPFLAGS"
     CXXFLAGS="$save_CXXFLAGS"
+    LDFLAGS="$save_LDFLAGS"
   fi
 
   if test -z "$warn_llvm"; then
@@ -863,7 +896,12 @@
 LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
 OCTAVE_CHECK_LIB(glpk, GLPK,
   [GLPK library not found.  The glpk function for solving linear programs will be disabled.],
-  [glpk/glpk.h glpk.h], [_glp_lpx_simplex])
+  [glpk/glpk.h glpk.h], [glp_simplex], [], [],
+  [warn_glpk=
+   OCTAVE_CHECK_LIB_GLPK_OK(
+    [TEXINFO_GLPK="@set HAVE_GLPK"
+    AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])],
+    [warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])])
 LIBS="$save_LIBS"
 CPPFLAGS="$save_CPPFLAGS"
 
@@ -1041,6 +1079,10 @@
       AC_MSG_RESULT(yes)
       AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.])
       XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS"
+      save_LIBS="$LIBS"
+      LIBS="$FT2_LIBS $LIBS"
+      AC_CHECK_FUNCS([FT_Reference_Face])
+      LIBS="$save_LIBS"
     else
       AC_MSG_RESULT(no)
       warn_freetype="FreeType library not found.  Native graphics will be disabled."
@@ -1928,7 +1970,7 @@
 AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h])
 AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h])
 AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h])
-AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h ])
+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
 AC_CHECK_HEADERS([sys/select.h sys/utsname.h termcap.h])
 
 ## C++ headers
@@ -2040,7 +2082,7 @@
 dnl These checks define/undefine HAVE_FUNCNAME in config.h.
 dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround.
 dnl Use multiple AC_CHECKs to avoid line continuations '\' in list
-AC_CHECK_FUNCS([canonicalize_file_name dup2])
+AC_CHECK_FUNCS([canonicalize_file_name ctermid dup2])
 AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork])
 AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam])
 AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid])
@@ -2527,6 +2569,7 @@
         JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32"
       fi
       JAVA_LIBS=-ladvapi32
+      LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
     ;;
     *)
       if test -n "$JAVA_CPPFLAGS"; then
@@ -2601,7 +2644,7 @@
   if test $build_gui = yes; then
     AC_CHECK_TOOLS(MOC, [moc-qt5 moc-qt4 moc])
     AC_CHECK_TOOLS(UIC, [uic-qt5 uic-qt4 uic])
-    AC_CHECK_TOOLS(RCC, [rcc])
+    AC_CHECK_TOOLS(RCC, [rcc-qt5 rcc-qt4 rcc])
     AC_CHECK_TOOLS(LRELEASE, [lrelease-qt5 lrelease-qt4 lrelease])
     if test -n "$MOC" && test -n "$UIC" && test -n "$RCC" && test -n "$LRELEASE"; then
       AC_DEFINE(HAVE_QT, 1, 
@@ -2613,6 +2656,14 @@
   fi
 
   if test $build_gui = yes; then
+    OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL
+    if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then
+      AC_MSG_WARN([QAbstractItemModel::beginResetModel() not found -- disabling GUI])
+      build_gui=no
+    fi
+  fi
+
+  if test $build_gui = yes; then
     OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT
   fi
 
@@ -2712,6 +2763,7 @@
   Makefile 
   doc/Makefile
   doc/doxyhtml/Makefile
+  doc/doxyhtml/Doxyfile
   doc/icons/Makefile
   doc/interpreter/Makefile
   doc/liboctave/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/doxyhtml/Doxyfile.in	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,317 @@
+# -*- mode: conf; -*-
+
+# Doxyfile for Doxygen 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for GNU Octave.
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the
+# config file that follow. We don't use anything but ASCII, but
+# there's no problem using UTF-8 from now on
+
+DOXYFILE_ENCODING      = UTF-8
+
+# Who we are. :-)
+
+PROJECT_NAME           = "GNU Octave"
+
+PROJECT_BRIEF          =  "A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab"
+
+# The public stable API version (unrelated to the internal API
+# version).
+
+PROJECT_NUMBER         = @PACKAGE_VERSION@
+
+# Our logo!
+
+PROJECT_LOGO           = @top_srcdir@/doc/icons/octave-logo.png
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+
+OUTPUT_DIRECTORY       = @abs_top_builddir@/doc
+
+# Create 4096 sub-directories (in 2 levels) under the output directory
+# of each output format and will distribute the generated files over
+# these directories. Enabling this option is useful for us, since
+# feeding doxygen a huge amount of source files would put all
+# generated files in the same directory would otherwise cause
+# performance problems for the file system.
+
+CREATE_SUBDIRS         = YES
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written.
+
+OUTPUT_LANGUAGE        = English
+
+# Include brief member descriptions after the members that are listed
+# in the file and class documentation (similar to JavaDoc). Set to NO
+# to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# Prepend the brief description of a member or function before the
+# detailed description. Note: if both HIDE_UNDOC_MEMBERS and
+# BRIEF_MEMBER_DESC are set to NO, the brief descriptions will be
+# completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# Show inherited members as if they were part of the current class
+
+INLINE_INHERITED_MEMB  = YES
+
+# Prepend the full path before files name in the file list and in the
+# header files.
+
+FULL_PATH_NAMES        = YES
+
+# Remove from the full path names the absolute prefix
+
+STRIP_FROM_PATH        = @top_srcdir@
+
+# Interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description (without needing the @brief
+# command).
+
+JAVADOC_AUTOBRIEF      = YES
+
+# Interpret the first line (until the first dot) of a Qt-style comment
+# as the brief descriptio (without needing the \brief command).
+
+QT_AUTOBRIEF           = NO
+
+# Undocumented member inherits the documentation from any documented
+# member that it re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+# We shouldn't have any tabs in the source code to begin with, however.
+
+TAB_SIZE               = 2
+
+# Figure out C++ stdlib classes without needing to parse those files.
+
+BUILTIN_STL_SUPPORT    = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# Assume all entities in documentation are documented, even if no
+# documentation was available.
+
+EXTRACT_ALL            = YES
+
+# Include all private members of a class.
+
+EXTRACT_PRIVATE        = YES
+
+# Include  all static members of a file.
+
+EXTRACT_STATIC         = YES
+
+# Include classes (and structs) defined locally in source files in the
+# documentation.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# We have very few namespaces, so show the ones we have
+
+SHOW_NAMESPACES        = YES
+
+# We don't use namespaces, but if we did, this would extract the
+# anonymous one.
+
+EXTRACT_ANON_NSPACES   = YES
+
+# Hide internal docs, those with the \internal command.
+
+INTERNAL_DOCS          = NO
+
+# Case-sensitive filenames
+
+CASE_SENSE_NAMES       = YES
+
+# List include files with double quotes in the documentation rather
+# than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = YES
+
+# Show members alphabetically
+
+SORT_MEMBER_DOCS       = YES
+
+# Also sort the brief descriptions
+
+SORT_BRIEF_DOCS        = YES
+
+# Put ctors first.
+
+SORT_MEMBERS_CTORS_1ST = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# On by default, but let's be explicit
+
+ENABLE_PREPROCESSING   = YES
+
+# Expand all macros
+
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = NO
+
+# So that features that are behind #ifdef HAVE_FOO macros get processed by Doxygen
+
+PREDEFINED = HAVE_ARPACK=1          \
+             HAVE_CHOLMOD=1         \
+             HAVE_CCOLAMD=1         \
+             HAVE_CURL=1            \
+             HAVE_CXSPARSE=1        \
+             HAVE_FFTW=1            \
+             HAVE_FFTW3=1           \
+             HAVE_FFTW3F=1          \
+             HAVE_FFTW3F_THREADS=1  \
+             HAVE_FFTW3_THREADS=1   \
+             HAVE_FREETYPE=1        \
+             HAVE_GLPK=1            \
+             HAVE_HDF5=1            \
+             HAVE_LLVM=1            \
+             HAVE_MAGICK=1          \
+             HAVE_OPENMP=1          \
+             HAVE_PCRE_H=1          \
+             HAVE_PCRE_COMPILE=1    \
+             HAVE_QHULL=1           \
+             HAVE_QRUPDATE=1        \
+             HAVE_QRUPDATE_LUU=1    \
+             HAVE_QT=1              \
+             HAVE_UMFPACK=1         \
+             HAVE_X_WINDOWS=1       \
+             HAVE_ZLIB=1
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# Which directories contain Octave source code
+
+INPUT                  = @top_srcdir@/src/ @top_srcdir@/liboctave/
+INPUT                 += @top_srcdir@/libinterp @top_srcdir@/libgui
+
+# Search subdirectories for input.
+
+RECURSIVE              = YES
+
+# Our examples.
+
+EXAMPLE_PATH           = @top_srcdir@/examples/
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# There are no extra C++ files in the examples subdir
+
+EXAMPLE_RECURSIVE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# Generate a list of source files will be generated.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Don't hide the special Doxygen comment blocks
+
+STRIP_CODE_COMMENTS    = NO
+
+# For each documented function, list all documented functions
+# referencing it.
+
+REFERENCED_BY_RELATION = YES
+
+# For each documented function all documented entities called/used by
+# that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# References link to documentation, not source code.
+
+REFERENCES_LINK_SOURCE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# Generate HTML
+
+GENERATE_HTML          = YES
+
+# i.e. @abs_top_builddir@/doc/doxyhtml
+
+HTML_OUTPUT            = doxyhtml
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# No LaTeX
+
+GENERATE_LATEX         = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# Show undocumented relations
+
+HIDE_UNDOC_RELATIONS   = NO
+
+# Use dot from graphviz to generate class diagrams.
+
+HAVE_DOT               = YES
+
+# Remove intermediate dot files.
+
+DOT_CLEANUP            = YES
+
+# Some of our dependency graphs are really huge...
+
+DOT_GRAPH_MAX_NODES    = 100
\ No newline at end of file
--- a/doc/doxyhtml/Doxygen.cfg	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-# -*- mode: conf; -*-
-
-# Doxyfile for Doxygen 1.7.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for GNU Octave.
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the
-# config file that follow. We don't use anything but ASCII, but
-# there's no problem using UTF-8 from now on
-
-DOXYFILE_ENCODING      = UTF-8
-
-# Who we are. :-)
-
-PROJECT_NAME           = "GNU Octave"
-
-# The public stable API version (unrelated to the internal API
-# version).
-
-PROJECT_NUMBER         = 3.7
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-
-OUTPUT_DIRECTORY       = doc/
-
-# Create 4096 sub-directories (in 2 levels) under the output directory
-# of each output format and will distribute the generated files over
-# these directories. Enabling this option is useful for us, since
-# feeding doxygen a huge amount of source files would put all
-# generated files in the same directory would otherwise cause
-# performance problems for the file system.
-
-CREATE_SUBDIRS         = YES
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written.
-
-OUTPUT_LANGUAGE        = English
-
-# Include brief member descriptions after the members that are listed
-# in the file and class documentation (similar to JavaDoc). Set to NO
-# to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# Prepend the brief description of a member or function before the
-# detailed description. Note: if both HIDE_UNDOC_MEMBERS and
-# BRIEF_MEMBER_DESC are set to NO, the brief descriptions will be
-# completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# Show inherited members as if they were part of the current class
-
-INLINE_INHERITED_MEMB  = YES
-
-# Prepend the full path before files name in the file list and in the
-# header files.
-
-FULL_PATH_NAMES        = YES
-
-# Interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description (without needing the @brief
-# command).
-
-JAVADOC_AUTOBRIEF      = YES
-
-# Interpret the first line (until the first dot) of a Qt-style comment
-# as the brief descriptio (without needing the \brief command).
-
-QT_AUTOBRIEF           = NO
-
-# Undocumented member inherits the documentation from any documented
-# member that it re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-# We shouldn't have any tabs in the source code to begin with, however.
-
-TAB_SIZE               = 2
-
-# Figure out C++ stdlib classes without needing to parse those files.
-
-BUILTIN_STL_SUPPORT    = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# Assume all entities in documentation are documented, even if no
-# documentation was available.
-
-EXTRACT_ALL            = YES
-
-# Include all private members of a class.
-
-EXTRACT_PRIVATE        = YES
-
-# Include  all static members of a file.
-
-EXTRACT_STATIC         = YES
-
-# Include classes (and structs) defined locally in source files in the
-# documentation.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# We don't use namespaces, but if we did, this would extract the
-# anonymous one.
-
-EXTRACT_ANON_NSPACES   = YES
-
-# Hide internal docs, those with the \internal command.
-
-INTERNAL_DOCS          = NO
-
-# Case-sensitive filenames
-
-CASE_SENSE_NAMES       = YES
-
-# List include files with double quotes in the documentation rather
-# than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES   = YES
-
-# Show members alphabetically
-
-SORT_MEMBER_DOCS       = YES
-
-# Also sort the brief descriptions
-
-SORT_BRIEF_DOCS        = YES
-
-# Put ctors first.
-
-SORT_MEMBERS_CTORS_1ST = YES
-
-# Show which directories the file is in.
-
-SHOW_DIRECTORIES       = YES
-
-# We don't have namespaces, so don't show them.
-
-SHOW_NAMESPACES        = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# Which directories contain Octave source code
-
-INPUT                  = src/ liboctave/ libinterp/
-
-# Search subdirectories for input.
-
-RECURSIVE              = YES
-
-# Our examples.
-
-EXAMPLE_PATH           = examples/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS       =
-
-# There are no extra C++ files in the examples subdir
-
-EXAMPLE_RECURSIVE      = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# Generate a list of source files will be generated.
-
-SOURCE_BROWSER         = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# For each documented function, list all documented functions
-# referencing it.
-
-REFERENCED_BY_RELATION = YES
-
-# For each documented function all documented entities called/used by
-# that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# References link to documenation, not source code.
-
-REFERENCES_LINK_SOURCE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# Generate HTML
-
-GENERATE_HTML          = YES
-
-# i.e. doc/doxyhtml
-
-HTML_OUTPUT            = doxyhtml
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# No LaTeX
-
-GENERATE_LATEX         = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# Show undocumented relations
-
-HIDE_UNDOC_RELATIONS   = NO
-
-# Use dot from graphviz to generate class diagrams.
-
-HAVE_DOT               = YES
-
-# Remove intermediate dot files.
-
-DOT_CLEANUP            = YES
-
--- a/doc/doxyhtml/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/doxyhtml/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -21,12 +21,12 @@
 include $(top_srcdir)/build-aux/common.mk
 
 doxyhtml:
-	cd ../..; doxygen doc/doxyhtml/Doxygen.cfg 
+	doxygen Doxyfile
 
 EXTRA_DIST = \
-  Doxygen.cfg \
+  Doxyfile.in \
   Makefile.am \
   README
 
 maintainer-clean-local:
-	rm -rf `ls | $(GREP) -v Doxygen.cfg | $(GREP) -v Makefile.am | $(GREP) -v Makefile.in | $(GREP) -v README`
+	rm -rf `ls | $(GREP) -v Doxyfile | $(GREP) -v Makefile.am | $(GREP) -v Makefile.in | $(GREP) -v README`
--- a/doc/interpreter/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -30,7 +30,7 @@
 TEXMFCNF := "..$(PATH_SEPARATOR)$(srcdir)/..$(PATH_SEPARATOR)$(TEXMFCNF)$(PATH_SEPARATOR)"
 export TEXMFCNF
 
-dist_man1_MANS = \
+dist_man_MANS = \
   mkoctfile.1 \
   octave-config.1 \
   octave.1
@@ -225,19 +225,19 @@
 		cp $(srcdir)/contributors.texi contributors.texi; \
 		touch -r $(srcdir)/contributors.texi contributors.texi; \
 	fi
-	-$(MAKEINFO) -D AUTHORSONLY \
+	-$(MAKEINFO) -D AUTHORSONLY -I $(srcdir) \
 	  --no-validate --no-headers --no-split --output AUTHORS $<
 	mv AUTHORS ../../AUTHORS
 
 ../../BUGS: bugs.texi
 	rm -f BUGS
-	-$(MAKEINFO) -D BUGSONLY \
+	-$(MAKEINFO) -D BUGSONLY -I $(srcdir) \
 	  --no-validate --no-headers --no-split --output BUGS $<
 	mv BUGS ../../BUGS
 
 ../../INSTALL.OCTAVE: install.texi
 	rm -f INSTALL
-	-$(MAKEINFO) -D INSTALLONLY \
+	-$(MAKEINFO) -D INSTALLONLY -I $(srcdir) \
 	  --no-validate --no-headers --no-split --output INSTALL $<
 	mv INSTALL ../../INSTALL.OCTAVE
 
--- a/doc/interpreter/arith.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/arith.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -34,14 +34,14 @@
 
 @menu
 * Exponents and Logarithms::
-* Complex Arithmetic::          
-* Trigonometry::                
-* Sums and Products::           
-* Utility Functions::           
-* Special Functions::           
+* Complex Arithmetic::
+* Trigonometry::
+* Sums and Products::
+* Utility Functions::
+* Special Functions::
 * Rational Approximations::
 * Coordinate Transformations::
-* Mathematical Constants::      
+* Mathematical Constants::
 @end menu
 
 @node Exponents and Logarithms
@@ -190,6 +190,7 @@
 @DOCSTRING(asind)
 @DOCSTRING(acosd)
 @DOCSTRING(atand)
+@DOCSTRING(atan2d)
 @DOCSTRING(asecd)
 @DOCSTRING(acscd)
 @DOCSTRING(acotd)
@@ -311,7 +312,7 @@
 
 @DOCSTRING(legendre)
 
-@anchor{docXgammaln}
+@anchor{XREFgammaln}
 @DOCSTRING(lgamma)
 
 @node Rational Approximations
--- a/doc/interpreter/basics.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/basics.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -25,13 +25,13 @@
 from your shell.
 
 @menu
-* Invoking Octave from the Command Line::             
-* Quitting Octave::             
-* Getting Help::                
-* Command Line Editing::        
-* Errors::                      
-* Executable Octave Programs::  
-* Comments::                    
+* Invoking Octave from the Command Line::
+* Quitting Octave::
+* Getting Help::
+* Command Line Editing::
+* Errors::
+* Executable Octave Programs::
+* Comments::
 @end menu
 
 @node Invoking Octave from the Command Line
@@ -52,8 +52,8 @@
 shorter equivalent).
 
 @menu
-* Command Line Options::        
-* Startup Files::               
+* Command Line Options::
+* Startup Files::
 @end menu
 
 @node Command Line Options
@@ -154,7 +154,7 @@
 @cindex @code{-i}
 Force interactive behavior.  This can be useful for running Octave via a
 remote shell command or inside an Emacs shell buffer.  For another way
-to run Octave within Emacs, see @ref{Emacs Octave Support}.
+to run Octave within Emacs, @pxref{Emacs Octave Support}.
 
 @item --line-editing
 @cindex @code{--line-editing}
@@ -272,8 +272,8 @@
 @noindent
 Note that this does not enable the @code{Octave:matlab-incompatible}
 warning, which you might want if you want to be told about writing code
-that works in Octave but not @sc{matlab} (@pxref{docXwarning},
-@pxref{docXwarning_ids}).
+that works in Octave but not @sc{matlab} (@pxref{XREFwarning,,warning},
+@ref{XREFwarning_ids,,warning_ids}).
 
 @item  --verbose
 @itemx -V
@@ -484,14 +484,14 @@
 
 
 @menu
-* Cursor Motion::               
-* Killing and Yanking::         
-* Commands For Text::           
-* Commands For Completion::     
-* Commands For History::        
-* Customizing readline::        
-* Customizing the Prompt::      
-* Diary and Echo Commands::     
+* Cursor Motion::
+* Killing and Yanking::
+* Commands For Text::
+* Commands For Completion::
+* Commands For History::
+* Customizing readline::
+* Customizing the Prompt::
+* Diary and Echo Commands::
 @end menu
 
 @node Cursor Motion
@@ -530,7 +530,7 @@
 @item C-l
 Clear the screen, reprinting the current line at the top.
 
-@item C-_
+@item  C-_
 @itemx C-/
 Undo the last action.  You can undo all the way back to an empty line.
 
@@ -610,7 +610,7 @@
 for quickly correcting typing mistakes.
 
 @table @kbd
-@item C-q
+@item  C-q
 @itemx C-v
 Add the next character that you type to the line verbatim.  This is
 how to insert things like @kbd{C-q} for example.
@@ -678,7 +678,7 @@
 list.
 
 @table @kbd
-@item @key{LFD}
+@item  @key{LFD}
 @itemx @key{RET}
 Accept the current line regardless of where the cursor is.  If the line is
 non-empty, add it to the history list.  If the line was a history
@@ -1047,7 +1047,7 @@
 @menu
 * Single Line Comments::
 * Block Comments::
-* Comments and the Help System::                    
+* Comments and the Help System::
 @end menu
 
 @node Single Line Comments
@@ -1099,8 +1099,8 @@
 @end example
 
 @noindent
-will produce a very quick countdown from '3' to 'Blast Off' as the
-lines "@code{disp (2);}" and "@code{disp (1);}" won't be executed.
+will produce a very quick countdown from @qcode{'3'} to @qcode{"Blast Off"} as
+the lines "@code{disp (2);}" and "@code{disp (1);}" won't be executed.
 
 The block comment markers must appear alone as the only characters on a line
 (excepting whitespace) in order to be parsed correctly.
--- a/doc/interpreter/bugs.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/bugs.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -52,8 +52,8 @@
 
 @menu
 * Actual Bugs::                 Bugs we will fix later.
-* Reporting Bugs::              
-* Service::                     
+* Reporting Bugs::
+* Service::
 @end menu
 
 @node Actual Bugs
@@ -105,7 +105,7 @@
 information that makes it possible to fix the bug.
 
 @menu
-* Bug Criteria::                
+* Bug Criteria::
 * Bug Tracker::        Where to submit your bug report.
 * Bug Reporting::      How to report a bug effectively.
 * Sending Patches::    How to send a patch for Octave.
--- a/doc/interpreter/container.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/container.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -372,9 +372,9 @@
 @subsection Creating Structures
 @cindex dynamic naming
 
-Besides the index operator ".", Octave can use dynamic naming "(var)" or the
-@code{struct} function to create structures.  Dynamic naming uses the string
-value of a variable as the field name.  For example:
+Besides the index operator @qcode{"."}, Octave can use dynamic naming
+@qcode{"(var)"} or the @code{struct} function to create structures.  Dynamic
+naming uses the string value of a variable as the field name.  For example:
 
 @example
 @group
@@ -410,7 +410,7 @@
 
 @noindent
 The warning id @code{Octave:matlab-incompatible} can be enabled to warn
-about this usage.  @xref{docXwarning_ids}.
+about this usage.  @xref{XREFwarning_ids,,warning_ids}.
 
 More realistically, all of the functions that operate on strings can be used
 to build the correct field name before it is entered into the data structure.
@@ -484,12 +484,12 @@
      @result{} ans =
         @{
           field1 =
-        
+
         @{
           [1,1] =  1
           [1,2] = one
         @}
-        
+
           field2 =  2
         @}
 @end group
@@ -529,7 +529,8 @@
 The simplest way to process data in a structure is within a @code{for}
 loop (@pxref{Looping Over Structure Elements}).  A similar effect can be
 achieved with the @code{structfun} function, where a user defined
-function is applied to each field of the structure.  @xref{docXstructfun}.
+function is applied to each field of the structure.
+@xref{XREFstructfun,,structfun}.
 
 Alternatively, to process the data in a structure, the structure might
 be converted to another type of container before being treated.
@@ -586,7 +587,7 @@
 c@{1:2@}
      @result{} ans = a string
      @result{} ans =
-          
+
                0.593993   0.627732
                0.377037   0.033643
 @end group
@@ -600,14 +601,14 @@
 @group
 c@{3@} = 3
      @result{} c =
-         
+
          @{
            [1,1] = a string
            [1,2] =
-         
+
               0.593993   0.627732
               0.377037   0.033643
-         
+
            [1,3] =  3
          @}
 @end group
@@ -639,7 +640,7 @@
 @DOCSTRING(iscell)
 
 @node Creating Cell Arrays
-@subsection Creating Cell Array
+@subsection Creating Cell Arrays
 
 The introductory example (@pxref{Basic Usage of Cell Arrays}) showed
 how to create a cell array containing currently available variables.
@@ -655,7 +656,7 @@
 @group
 c = cell (2,2)
      @result{} c =
-         
+
          @{
            [1,1] = [](0x0)
            [2,1] = [](0x0)
@@ -683,11 +684,10 @@
 @end example
 
 @noindent
-As can be seen, the @ref{docXsize, @code{size}} function also works
+As can be seen, the @ref{XREFsize,,size} function also works
 for cell arrays.  As do other functions describing the size of an
-object, such as @ref{docXlength, @code{length}}, @ref{docXnumel,
-@code{numel}}, @ref{docXrows, @code{rows}}, and @ref{docXcolumns,
-@code{columns}}.
+object, such as @ref{XREFlength,,length}, @ref{XREFnumel,, numel},
+@ref{XREFrows,,rows}, and @ref{XREFcolumns,,columns}.
 
 @DOCSTRING(cell)
 
@@ -907,7 +907,7 @@
 is to iterate through it using one or more @code{for} loops.  The same
 idea can be implemented more easily through the use of the @code{cellfun}
 function that calls a user-specified function on all elements of a cell
-array.  @xref{docXcellfun}.
+array.  @xref{XREFcellfun,,cellfun}.
 
 An alternative is to convert the data to a different container, such as
 a matrix or a data structure.  Depending on the data this is possible
--- a/doc/interpreter/contrib.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/contrib.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -355,7 +355,7 @@
 @noindent
 The function name should start in column 1, and multi-line argument
 lists should be aligned on the first char after the open parenthesis.
-You should put a space after the left open parenthesis and after commas,
+You should put a space before the left open parenthesis and after commas,
 for both function definitions and function calls.
 
 Recommended indent is 2 spaces.  When indenting, indent the statement
--- a/doc/interpreter/contributors.in	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/contributors.in	Sat Oct 05 11:22:09 2013 -0400
@@ -42,9 +42,9 @@
 Michael Creel
 Jeff Cunningham
 Martin Dalecki
+Jacob Dawid
 Jorge Barros de Abreu
 Carlo de Falco
-Jacob Dawid
 Thomas D. Dean
 Philippe Defert
 Bill Denney
@@ -75,6 +75,7 @@
 Klaus Gebhardt
 Driss Ghaddab
 Nicolo Giorgetti
+Arun Giridhar
 Michael D. Godfrey
 Michael Goffioul
 Glenn Golden
@@ -140,6 +141,7 @@
 Piotr Krzyzanowski
 Volker Kuhlmann
 Tetsuro Kurita
+Philipp Kutin
 Miroslaw Kwasniak
 Rafael Laboissiere
 Kai Labusch
@@ -159,21 +161,21 @@
 Massimo Lorenzin
 Emil Lucretiu
 Hoxide Ma
+Colin Macdonald
 James Macnicol
 Jens-Uwe Mager
-Colin Macdonald
 Rob Mahurin
+Alexander Mamonov
 Ricardo Marranita
 Orestes Mas
 Axel Mathéi
 Makoto Matsumoto
 Tatsuro Matsuoka
+Christoph Mayer
 Laurent Mazet
 G. D. McBain
-Alexander Mamonov
-Christoph Mayer
+Ronald van der Meer
 Júlio Hoffimann Mendes
-Ronald van der Meer
 Thorsten Meyer
 Petr Mikulik
 Mike Miller
@@ -222,11 +224,13 @@
 Joshua Redstone
 Lukas Reichlin
 Michael Reifenberger
+Jens Restemeier
 Anthony Richardson
 Jason Riedy
 E. Joshua Rigler
 Petter Risholm
 Matthew W. Roberts
+Peter Rosin
 Andrew Ross
 Fabio Rossi
 Mark van Rossum
@@ -272,23 +276,24 @@
 John Swensen
 Daisuke Takago
 Ariel Tankus
+Falk Tannhäuser
+Duncan Temple Lang
 Matthew Tenny
+Kris Thielemans
 Georg Thimm
-Duncan Temple Lang
-Kris Thielemans
 Olaf Till
 Christophe Tournery
 Thomas Treichl
 Karsten Trulsen
 Frederick Umminger
 Utkarsh Upadhyay
-Daniel Wagenaar
 Stefan van der Walt
 Peter Van Wieren
 James R. Van Zandt
 Risto Vanhanen
 Gregory Vanuxem
 Ivana Varekova
+Daniel Wagenaar
 Thomas Walter
 Andreas Weber
 Olaf Weber
--- a/doc/interpreter/data.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/data.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -35,9 +35,9 @@
 @DOCSTRING(typeinfo)
 
 @menu
-* Built-in Data Types::         
-* User-defined Data Types::     
-* Object Sizes::                
+* Built-in Data Types::
+* User-defined Data Types::
+* Object Sizes::
 @end menu
 
 @node Built-in Data Types
@@ -70,11 +70,11 @@
 @DOCSTRING(bitunpack)
 
 @menu
-* Numeric Objects::             
-* Missing Data::                
-* String Objects::              
-* Data Structure Objects::      
-* Cell Array Objects::          
+* Numeric Objects::
+* Missing Data::
+* String Objects::
+* Data Structure Objects::
+* Cell Array Objects::
 @end menu
 
 @node Numeric Objects
--- a/doc/interpreter/debug.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/debug.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -43,7 +43,7 @@
 @section Entering Debug Mode
 
 There are two basic means of interrupting the execution of an Octave
-script.  These are breakpoints @pxref{Breakpoints}, discussed in the next
+script.  These are breakpoints (@pxref{Breakpoints}), discussed in the next
 section and interruption based on some condition.
 
 Octave supports three means to stop execution based on the values set in
@@ -241,8 +241,8 @@
 @node Profiler Example
 @section Profiler Example
 
-Below, we will give a short example of a profiler session.  See also
-@ref{Profiling} for the documentation of the profiler functions in
+Below, we will give a short example of a profiler session.
+@xref{Profiling}, for the documentation of the profiler functions in
 detail.  Consider the code:
 
 @example
--- a/doc/interpreter/diagperm.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/diagperm.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -16,19 +16,19 @@
 @c along with Octave; see the file COPYING.  If not, see
 @c <http://www.gnu.org/licenses/>.
 
-@node Diagonal and Permutation Matrices 
+@node Diagonal and Permutation Matrices
 @chapter Diagonal and Permutation Matrices
 
 @menu
-* Basic Usage::          Creation and Manipulation of Diagonal and Permutation Matrices
-* Matrix Algebra::       Linear Algebra with Diagonal and Permutation Matrices
+* Basic Usage::          Creation and Manipulation of Diagonal/Permutation Matrices
+* Matrix Algebra::       Linear Algebra with Diagonal/Permutation Matrices
 * Function Support::     Functions That Are Aware of These Matrices
-* Example Code::         Some Examples of Usage
-* Zeros Treatment::      The Differences in Treatment of Zero Elements
+* Example Code::         Examples of Usage
+* Zeros Treatment::      Differences in Treatment of Zero Elements
 @end menu
 
 @node Basic Usage
-@section Creating and Manipulating Diagonal and Permutation Matrices
+@section Creating and Manipulating Diagonal/Permutation Matrices
 
 A diagonal matrix is defined as a matrix that has zero entries outside the main
 diagonal; that is, 
@@ -210,7 +210,7 @@
 be very cheap.
 
 @node Matrix Algebra
-@section Linear Algebra with Diagonal and Permutation Matrices
+@section Linear Algebra with Diagonal/Permutation Matrices
 
 As has been already said, diagonal and permutation matrices make it
 possible to use efficient algorithms while preserving natural linear
@@ -413,7 +413,7 @@
 making it possible to conveniently obtain the permutation indices.
 
 @node Example Code
-@section Some Examples of Usage
+@section Examples of Usage
 
 The following can be used to solve a linear system @code{A*x = b}
 using the pivoted LU@tie{}factorization:
@@ -436,8 +436,7 @@
 @end example
 
 @noindent
-The same can also be accomplished with broadcasting
-(@pxref{Broadcasting}):
+The same can also be accomplished with broadcasting (@pxref{Broadcasting}):
 
 @example
 @group
@@ -477,7 +476,7 @@
 
 
 @node Zeros Treatment
-@section The Differences in Treatment of Zero Elements
+@section Differences in Treatment of Zero Elements
 
 Making diagonal and permutation matrices special matrix objects in their own
 right and the consequent usage of smarter algorithms for certain operations
--- a/doc/interpreter/diffeq.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/diffeq.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -24,8 +24,8 @@
 All solvers are based on reliable ODE routines written in Fortran.
 
 @menu
-* Ordinary Differential Equations::  
-* Differential-Algebraic Equations::  
+* Ordinary Differential Equations::
+* Differential-Algebraic Equations::
 @end menu
 
 @cindex differential equations
--- a/doc/interpreter/doccheck/aspell-octave.en.pws	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/doccheck/aspell-octave.en.pws	Sat Oct 05 11:22:09 2013 -0400
@@ -29,6 +29,7 @@
 arpack
 ascii
 Ashok
+ast
 async
 atan
 Attr
@@ -53,6 +54,7 @@
 backends
 bartlett
 BaseValue
+basevalue
 Bateman
 BDF
 bdf
@@ -126,6 +128,7 @@
 chol
 Cholesky
 cholmod
+chromaticity
 chrominance
 cindex
 circ
@@ -136,11 +139,14 @@
 Clenshaw
 CLI
 clim
+climmode
 cloglog
+closerequestfcn
 clubsuit
 CMatrix
 cmd
 cmember
+CMYK
 cntrl
 codebases
 cof
@@ -151,6 +157,7 @@
 colormap
 colormaps
 ColorOrder
+colororder
 colperm
 Comint
 Commandline
@@ -183,7 +190,10 @@
 cumprod
 cumsum
 cURL
+CurrentAxes
+CurrentFigure
 CurrentObject
+currentpoint
 Cuthill
 cxsparse
 Cygwin
@@ -195,6 +205,7 @@
 dataset
 datasets
 datasource
+datenum
 datestr
 datestrings
 davis
@@ -226,6 +237,7 @@
 Dobkin
 docstrings
 dOmega
+doNotSpecify
 dotall
 dotexceptnewline
 Downarrow
@@ -240,6 +252,8 @@
 dx
 dy
 EastOutside
+edgecolor
+Ei
 EIDORS
 eigenpairs
 eigenvector
@@ -275,12 +289,14 @@
 errorbars
 errordlg
 ErrorHandler
+ESC
 Esmond
 et
 etree
 etreeplot
 eval
 Executables
+Exif
 exitflag
 expcdf
 expinv
@@ -330,12 +346,15 @@
 Frobenius
 Fs
 FSF
+fullpath
+fullpathext
 FunValCheck
 gamcdf
 gaminv
 gampdf
 gamrnd
 Gautschi
+gca
 gcbo
 GCC
 gcd
@@ -346,6 +365,7 @@
 geoinv
 geopdf
 geornd
+geotagging
 geq
 gesdd
 gesvd
@@ -387,6 +407,7 @@
 Hackbusch
 Hadamard
 Haddad
+HandleVisibility
 Hankel
 Hanning
 hardcode
@@ -427,6 +448,7 @@
 Hypergeometric
 hypergeometric
 IEC
+ieee
 IEEE
 ifelse
 ifft
@@ -457,6 +479,7 @@
 inv
 involutory
 ipermute
+isdir
 ishandle
 ishghandle
 isolines
@@ -473,6 +496,7 @@
 Jacobians
 javaaddpath
 javamem
+jbig
 JIT
 jpeg
 JPEG
@@ -481,8 +505,10 @@
 JVM's
 Kac
 Kahan
+kendall
 keybindings
 keypress
+keypressfcn
 Kolmogorov
 kolmogorov
 Konrod
@@ -505,6 +531,7 @@
 ldivide
 ldots
 le
+leaveInPlace
 Leftarrow
 leftarrow
 Leftrightarrow
@@ -527,6 +554,8 @@
 linesearch
 linespec
 linespoints
+linestyle
+linewidth
 linkprop
 listdlg
 ListSize
@@ -562,6 +591,8 @@
 lx
 ly
 lz
+lzma
+lzw
 Magnus
 Mahalanobis
 makefile
@@ -570,6 +601,10 @@
 Mandriva
 MANOVA
 manova
+markeredgecolor
+markerfacecolor
+markersize
+markerstyle
 Marsaglia
 Maschhoff
 matchcase
@@ -583,6 +618,7 @@
 McNemar's
 meansq
 Mendelsohn
+menubars
 Mersenne
 meshgrid
 meshgridded
@@ -624,6 +660,7 @@
 multi
 multibyte
 multiline
+multipage
 multipledelimsasone
 MultiSelect
 mxArray
@@ -647,6 +684,7 @@
 Neudecker
 Neumann
 NeXT
+NextPlot
 nfev
 nfft
 Ng
@@ -688,6 +726,7 @@
 OpenGL
 oplus
 Oppenheim
+Ord
 oregonator
 Orthogonalize
 oslash
@@ -697,13 +736,16 @@
 overridable
 paperorientation
 paperposition
+PaperPosition
 papersize
 paperunits
+PaperUnits
 parseparams
 Parter
 pbm
 PBM
 PBMplus
+pc
 pcg
 PCG
 pchip
@@ -714,6 +756,7 @@
 pcx
 pdf
 PDF
+pearson
 pentadiagonal
 periodogram
 perp
@@ -737,6 +780,8 @@
 polyeig
 polyfit
 polyval
+pos
+POSDEF
 POSIX
 postorder
 PostScript
@@ -796,6 +841,7 @@
 rdivide
 Readline
 readline
+RECT
 recursing
 Redheffer
 reentrant
@@ -806,6 +852,7 @@
 ren
 renderer
 repelems
+replacechildren
 repmat
 resampled
 resampling
@@ -814,6 +861,8 @@
 resized
 resnorm
 resparsify
+restoreBG
+restorePrevious
 RET
 returnonerror
 rfloor
@@ -822,6 +871,7 @@
 Riccati
 Rightarrow
 rightarrow
+rle
 rline
 rmdir
 RMS
@@ -896,6 +946,7 @@
 Stallman
 startup
 Startup
+statinfo
 stdnormal
 stdout
 Stegun
@@ -941,6 +992,7 @@
 subsref
 substring
 substrings
+subwindows
 SuiteSparse
 sumsq
 SunOS
@@ -977,6 +1029,7 @@
 tif
 Tikhonov
 TikZ
+Timestamp
 tinv
 Tisseur
 Tisseur's
@@ -988,16 +1041,21 @@
 TolX
 toolkits
 Toolkits
+toplevel
 tp
 tpdf
 traceback
+TRANSA
 trapz
 treatasempty
 treelayout
 treeplot
 tridiagonal
+trimesh
 triplot
 trnd
+truecolor
+TrueColor
 Tsang
 Tukey
 tuples
@@ -1008,6 +1066,7 @@
 ub
 UB
 uchar
+UHESS
 UID
 uimenu
 uint
@@ -1020,6 +1079,7 @@
 unary
 uncomment
 Uncomments
+unconvertible
 unformatted
 unidcdf
 unidinv
@@ -1034,6 +1094,8 @@
 Uninstall
 uninstalled
 univariate
+unix
+unnorm
 unnormalized
 unpadded
 unpermuted
@@ -1072,6 +1134,7 @@
 warndlg
 Wathen
 WAV
+WayPoints
 wblcdf
 wblinv
 wblpdf
@@ -1092,9 +1155,13 @@
 Wildcards
 wildcards
 Wilks
+windowbuttondownfcn
+windowbuttonmotionfcn
+windowbuttonupfcn
 windowstyle
 WinRand
 WIPO
+wireframe
 wp
 wspace
 xb
--- a/doc/interpreter/emacs.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/emacs.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -44,10 +44,10 @@
 or suggestions on using EOS.
 
 @menu
-* Installing EOS::              
-* Using Octave Mode::           
-* Running Octave from Within Emacs::  
-* Using the Emacs Info Reader for Octave::  
+* Installing EOS::
+* Using Octave Mode::
+* Running Octave from Within Emacs::
+* Using the Emacs Info Reader for Octave::
 @end menu
 
 @node Installing EOS
@@ -251,7 +251,7 @@
 @samp{,} (@code{Info-index-next}) command of the Info reader.
 
 The variable @code{octave-help-files} is a list of files to search
-through and defaults to @code{'("octave")}.  If there is also an Octave
+through and defaults to @qcode{'("octave")}.  If there is also an Octave
 Local Guide with corresponding info file, say, @file{octave-LG}, you can
 have @code{octave-help} search both files by 
 @lisp
@@ -390,7 +390,7 @@
 
 This will start Octave in a special buffer the name of which is
 specified by the variable @code{inferior-octave-buffer} and defaults to
-@code{"*Inferior Octave*"}.  From within this buffer, you can
+@qcode{"*Inferior Octave*"}.  From within this buffer, you can
 interact with the inferior Octave process `as usual', i.e., by entering
 Octave commands at the prompt.  The buffer is in Inferior Octave mode,
 which is derived from the standard Comint mode, a major mode for
@@ -456,7 +456,7 @@
 The variable @code{inferior-octave-startup-args} can be used for
 specifying command lines arguments to be passed to Octave on startup
 as a list of strings.  For example, to suppress the startup message and
-use `traditional' mode, set this to @code{'("-q" "--traditional")}.
+use `traditional' mode, set this to @qcode{'("-q" "--traditional")}.
 You can also specify a startup file of Octave commands to be loaded on
 startup; note that these commands will not produce any visible output
 in the process buffer.  Which file to use is controlled by the variable
--- a/doc/interpreter/errors.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/errors.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -185,8 +185,8 @@
 as will be shown in the next example.  To assign an ID to an error,
 simply call @code{error} with two string arguments, where the first
 is the identification string, and the second is the actual error.  Note
-that error IDs are in the format "NAMESPACE:ERROR-NAME".  The namespace
-"Octave" is used for Octave's own errors.  Any other string is available
+that error IDs are in the format @qcode{"NAMESPACE:ERROR-NAME"}.  The namespace
+@qcode{"Octave"} is used for Octave's own errors.  Any other string is available
 as a namespace for user's own errors.
 
 The next example counts indexing errors.  The errors are caught using the
@@ -330,9 +330,9 @@
 as will be described in the next section.  To assign an ID to a warning,
 simply call @code{warning} with two string arguments, where the first
 is the identification string, and the second is the actual warning.  Note
-that warning IDs are in the format "NAMESPACE:WARNING-NAME".  The namespace
-"Octave" is used for Octave's own warnings.  Any other string is available
-as a namespace for user's own warnings.
+that warning IDs are in the format @qcode{"NAMESPACE:WARNING-NAME"}.  The
+namespace @qcode{"Octave"} is used for Octave's own warnings.  Any other string
+is available as a namespace for user's own warnings.
 
 @DOCSTRING(warning)
 
@@ -348,7 +348,7 @@
 
 The @code{warning} function also allows you to control which warnings
 are actually printed to the screen.  If the @code{warning} function
-is called with a string argument that is either @code{"on"} or @code{"off"}
+is called with a string argument that is either @qcode{"on"} or @qcode{"off"}
 all warnings will be enabled or disabled.
 
 It is also possible to enable and disable individual warnings through
--- a/doc/interpreter/eval.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/eval.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -79,8 +79,8 @@
 functions and should not be taken too seriously.  In addition to using a
 more robust algorithm, any serious code would check the number and type
 of all the arguments, ensure that the supplied function really was a
-function, etc.  @xref{Predicates for Numeric Objects}, for example,
-for a list of predicates for numeric objects, and see @ref{Status of
+function, etc.  @xref{Predicates for Numeric Objects},
+for a list of predicates for numeric objects, and @pxref{Status of
 Variables}, for a description of the @code{exist} function.
 
 @DOCSTRING(feval)
@@ -135,7 +135,7 @@
 
 @noindent
 Here, @samp{caller} is the @code{create_data} function and @code{name1}
-is the string @code{"x"}, which evaluates simply as the value of @code{x}.
+is the string @qcode{"x"}, which evaluates simply as the value of @code{x}.
 
 You later want to load the values back from @code{mydata}
 in a different context:
--- a/doc/interpreter/expr.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/expr.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -32,14 +32,14 @@
 combinations of these with various operators.
 
 @menu
-* Index Expressions::           
-* Calling Functions::           
-* Arithmetic Ops::              
-* Comparison Ops::              
-* Boolean Expressions::         
-* Assignment Ops::              
-* Increment Ops::               
-* Operator Precedence::         
+* Index Expressions::
+* Calling Functions::
+* Arithmetic Ops::
+* Comparison Ops::
+* Boolean Expressions::
+* Assignment Ops::
+* Increment Ops::
+* Operator Precedence::
 @end menu
 
 @node Index Expressions
@@ -385,8 +385,8 @@
 expressions.  See also @ref{Index Expressions}, and @ref{Assignment Ops}.
 
 @menu
-* Call by Value::               
-* Recursion::                   
+* Call by Value::
+* Recursion::
 @end menu
 
 @node Call by Value
@@ -433,7 +433,7 @@
 @noindent
 you should not think of the argument as being ``the variable
 @code{foo}.''  Instead, think of the argument as the string value,
-@code{"bar"}.
+@qcode{"bar"}.
 
 Even though Octave uses pass-by-value semantics for function arguments,
 values are not copied unnecessarily.  For example,
@@ -583,7 +583,7 @@
 Element-by-element left division.  Each element of @var{y} is divided
 by each corresponding element of @var{x}.
 
-@item @var{x} ^ @var{y}
+@item  @var{x} ^ @var{y}
 @itemx @var{x} ** @var{y}
 @opindex **
 @opindex ^
@@ -597,7 +597,7 @@
 
 The implementation of this operator needs to be improved.
 
-@item @var{x} .^ @var{y}
+@item  @var{x} .^ @var{y}
 @itemx @var{x} .** @var{y}
 @opindex .**
 @opindex .^
@@ -759,7 +759,7 @@
 @opindex >
 True if @var{x} is greater than @var{y}.
 
-@item @var{x} != @var{y}
+@item  @var{x} != @var{y}
 @itemx @var{x} ~= @var{y}
 @opindex !=
 @opindex ~=
@@ -796,7 +796,7 @@
 
 @DOCSTRING(isequal)
 
-@DOCSTRING(isequalwithequalnans)
+@DOCSTRING(isequaln)
 
 @opindex <=
 @DOCSTRING(le)
@@ -823,8 +823,8 @@
 @cindex not operator
 
 @menu
-* Element-by-element Boolean Operators::  
-* Short-circuit Boolean Operators::  
+* Element-by-element Boolean Operators::
+* Short-circuit Boolean Operators::
 @end menu
 
 @node Element-by-element Boolean Operators
@@ -863,7 +863,7 @@
 Elements of the result are true if either of the corresponding elements
 of @var{boolean1} or @var{boolean2} is true.
 
-@item ! @var{boolean}
+@item  ! @var{boolean}
 @itemx ~ @var{boolean}
 @opindex ~
 @opindex !
@@ -1043,7 +1043,7 @@
 The @samp{=} sign is called an @dfn{assignment operator}.
 
 Assignments can store string values also.  For example, the following
-expression would store the value @code{"this food is good"} in the
+expression would store the value @qcode{"this food is good"} in the
 variable @code{message}:
 
 @example
--- a/doc/interpreter/external.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/external.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -104,9 +104,9 @@
 bridge to hardware resources which often have device drivers written in C.
 
 @menu
-* Oct-Files::                   
-* Mex-Files::                   
-* Standalone Programs::         
+* Oct-Files::
+* Mex-Files::
+* Standalone Programs::
 @end menu
 
 @node Oct-Files
@@ -116,19 +116,19 @@
 @cindex oct
 
 @menu
-* Getting Started with Oct-Files::  
-* Matrices and Arrays in Oct-Files::  
-* Character Strings in Oct-Files::  
-* Cell Arrays in Oct-Files::    
-* Structures in Oct-Files::  
-* Sparse Matrices in Oct-Files::  
-* Accessing Global Variables in Oct-Files::  
-* Calling Octave Functions from Oct-Files::  
-* Calling External Code from Oct-Files::  
-* Allocating Local Memory in Oct-Files::  
-* Input Parameter Checking in Oct-Files::  
-* Exception and Error Handling in Oct-Files::  
-* Documentation and Test of Oct-Files::  
+* Getting Started with Oct-Files::
+* Matrices and Arrays in Oct-Files::
+* Character Strings in Oct-Files::
+* Cell Arrays in Oct-Files::
+* Structures in Oct-Files::
+* Sparse Matrices in Oct-Files::
+* Accessing Global Variables in Oct-Files::
+* Calling Octave Functions from Oct-Files::
+* Calling External Code from Oct-Files::
+* Allocating Local Memory in Oct-Files::
+* Input Parameter Checking in Oct-Files::
+* Exception and Error Handling in Oct-Files::
+* Documentation and Test of Oct-Files::
 @c * Application Programming Interface for Oct-Files::  
 @end menu
 
@@ -305,8 +305,8 @@
 a resemblance to functions that exist in the interpreter.  A selection of
 useful methods include
 
-@deftypefn  Method T& {operator ()} (octave_idx_type)
-@deftypefnx Method T& elem (octave_idx_type)
+@deftypefn  {Method} {T&} operator () (octave_idx_type)
+@deftypefnx {Method} {T&} elem (octave_idx_type)
 The @code{()} operator or @code{elem} method allow the values of the
 matrix or array to be read or set.  These can take a single argument,
 which is of type @code{octave_idx_type}, that is the index into the matrix or
@@ -319,30 +319,30 @@
 circumstances the user might prefer to access the data of the array or
 matrix directly through the @nospell{fortran_vec} method discussed below.
 
-@deftypefn Method octave_idx_type numel (void) const
+@deftypefn {Method} {} octave_idx_type numel (void) const
 The total number of elements in the matrix or array.
 @end deftypefn
 
-@deftypefn Method size_t byte_size (void) const
+@deftypefn {Method} {size_t} byte_size (void) const
 The number of bytes used to store the matrix or array.
 @end deftypefn
 
-@deftypefn Method dim_vector dims (void) const
+@deftypefn {Method} {dim_vector} dims (void) const
 The dimensions of the matrix or array in value of type dim_vector.
 @end deftypefn
 
-@deftypefn Method int ndims (void) const
+@deftypefn {Method} {int} ndims (void) const
 The number of dimensions of the matrix or array.  Matrices are 2-D,
 but arrays can be N-dimensional.
 @end deftypefn
 
-@deftypefn Method void resize (const dim_vector&)
+@deftypefn {Method} {void} resize (const dim_vector&)
 A method taking either an argument of type @code{dim_vector}, or in the
 case of a matrix two arguments of type @code{octave_idx_type} defining
 the number of rows and columns in the matrix.
 @end deftypefn
 
-@deftypefn Method T* fortran_vec (void)
+@deftypefn {Method} {T*} fortran_vec (void)
 This method returns a pointer to the underlying data of the matrix or
 array so that it can be manipulated directly, either within Octave or by
 an external library.
@@ -357,9 +357,7 @@
 @w{@code{DEFUN_DLD}} function is as follows
 
 @example
-@group
 @EXAMPLEFILE(addtwomatrices.cc)
-@end group
 @end example
 
 To avoid segmentation faults causing Octave to abort this function
@@ -484,9 +482,7 @@
 example is
 
 @example
-@group
 @EXAMPLEFILE(celldemo.cc)
-@end group
 @end example
 
 Note that cell arrays are used less often in standard oct-files and so
@@ -584,13 +580,13 @@
 more similar to Octave's @code{Matrix} class than its @code{NDArray} class.
 
 @menu
-* Array and Sparse Differences::  
-* Creating Sparse Matrices in Oct-Files::  
-* Using Sparse Matrices in Oct-Files::  
+* Array and Sparse Class Differences::
+* Creating Sparse Matrices in Oct-Files::
+* Using Sparse Matrices in Oct-Files::
 @end menu
 
-@node Array and Sparse Differences
-@subsubsection The Differences between the Array and Sparse Classes
+@node Array and Sparse Class Differences
+@subsubsection Array and Sparse Class Differences
 
 The number of elements in a sparse matrix is considered to be the number
 of non-zero elements rather than the product of the dimensions.  Therefore
@@ -616,7 +612,7 @@
 The use of @code{numel} should therefore be avoided useless it is known
 it won't overflow.
 
-Extreme care must be take with the elem method and the "()" operator,
+Extreme care must be take with the elem method and the @qcode{"()"} operator,
 which perform basically the same function.  The reason is that if a
 sparse object is non-const, then Octave will assume that a
 request for a zero element in a sparse matrix is in fact a request
@@ -1201,7 +1197,7 @@
 
 The documentation of an oct-file is the fourth string parameter of the
 @w{@code{DEFUN_DLD}} macro.  This string can be formatted in the same manner
-as the help strings for user functions (@ref{Documentation Tips}),
+as the help strings for user functions (@pxref{Documentation Tips}),
 however there are some issue that are particular to the formatting of
 help strings within oct-files.
 
@@ -1231,7 +1227,7 @@
 character on the line.
 
 Octave also includes the ability to embed test and demonstration
-code for a function within the code itself (@ref{Test and Demo Functions}).
+code for a function within the code itself (@pxref{Test and Demo Functions}).
 This can be used from within oct-files (or in fact any file) with
 certain provisos.  First, the test and demo functions of Octave look
 for @code{%!} as the first two characters of a line to identify test
@@ -1274,13 +1270,13 @@
 be written with the oct-file interface previously discussed.
 
 @menu
-* Getting Started with Mex-Files::  
-* Working with Matrices and Arrays in Mex-Files::  
-* Character Strings in Mex-Files::  
-* Cell Arrays with Mex-Files::  
-* Structures with Mex-Files::  
-* Sparse Matrices with Mex-Files::  
-* Calling Other Functions in Mex-Files::  
+* Getting Started with Mex-Files::
+* Working with Matrices and Arrays in Mex-Files::
+* Character Strings in Mex-Files::
+* Cell Arrays with Mex-Files::
+* Structures with Mex-Files::
+* Sparse Matrices with Mex-Files::
+* Calling Other Functions in Mex-Files::
 @c * Application Programming Interface for Mex-Files::  
 @end menu
 
@@ -1307,9 +1303,9 @@
 
 The first line @code{#include "mex.h"} makes available all of the definitions
 necessary for a mex-file.  One important difference between Octave and
-@sc{matlab} is that the header file @code{"matrix.h"} is implicitly included
-through the inclusion of @code{"mex.h"}.  This is necessary to avoid a conflict
-with the Octave file @code{"Matrix.h"} for operating systems and compilers that
+@sc{matlab} is that the header file @qcode{"matrix.h"} is implicitly included
+through the inclusion of @qcode{"mex.h"}.  This is necessary to avoid a conflict
+with the Octave file @qcode{"Matrix.h"} for operating systems and compilers that
 don't distinguish between filenames in upper and lower case.
 
 The entry point into the mex-file is defined by @code{mexFunction}.  The
@@ -1517,9 +1513,7 @@
 as shown below.
 
 @example
-@group
 @EXAMPLEFILE(mycell.c)
-@end group
 @end example
 
 @noindent
@@ -1617,23 +1611,23 @@
     b =
     @{
       this =
-    
+
       (,
         [1] = this1
         [2] = this2
         [3] = this3
         [4] = this4
       ,)
-    
+
       that =
-    
+
       (,
         [1] = that1
         [2] = that2
         [3] = that3
         [4] = that4
       ,)
-    
+
     @}
 @end example
 
@@ -1737,9 +1731,7 @@
 @file{liboctave.so}.
 
 @example
-@group
 @EXAMPLEFILE(standalone.cc)
-@end group
 @end example
 
 @noindent
@@ -1766,9 +1758,7 @@
 seen in the code
 
 @example
-@group
 @EXAMPLEFILE(embedded.cc)
-@end group
 @end example
 
 @noindent
--- a/doc/interpreter/func.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/func.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -30,18 +30,18 @@
 
 @menu
 * Introduction to Function and Script Files::
-* Defining Functions::          
-* Multiple Return Values::      
-* Variable-length Argument Lists::  
-* Ignoring Arguments::  
-* Variable-length Return Lists::  
-* Returning from a Function::   
-* Default Arguments::   
-* Function Files::              
-* Script Files::                
-* Function Handles Inline Functions and Anonymous Functions::
+* Defining Functions::
+* Multiple Return Values::
+* Variable-length Argument Lists::
+* Ignoring Arguments::
+* Variable-length Return Lists::
+* Returning from a Function::
+* Default Arguments::
+* Function Files::
+* Script Files::
+* Function Handles Anonymous Functions Inline Functions::
 * Commands::
-* Organization of Functions::   
+* Organization of Functions::
 @end menu
 
 @node Introduction to Function and Script Files
@@ -114,7 +114,7 @@
 @end example
 
 The @code{printf} statement (@pxref{Input and Output}) simply tells
-Octave to print the string @code{"\a"}.  The special character @samp{\a}
+Octave to print the string @qcode{"\a"}.  The special character @samp{\a}
 stands for the alert character (ASCII 7).  @xref{Strings}.
 
 Once this function is defined, you can ask Octave to evaluate it by
@@ -325,7 +325,7 @@
 
 It is possible to use the @code{nthargout} function to obtain only some
 of the return values or several at once in a cell array.
-@ref{Cell Array Objects}
+@xref{Cell Array Objects}.
 
 @DOCSTRING(nthargout)
 
@@ -402,7 +402,7 @@
 
 @DOCSTRING(nargoutchk)
 
-@anchor{docXvarargin} @anchor{docXvarargout}
+@anchor{XREFvarargin} @anchor{XREFvarargout}
 @node Variable-length Argument Lists
 @section Variable-length Argument Lists
 @cindex variable-length argument lists
@@ -737,7 +737,7 @@
 running Octave, you can improve performance by calling
 @code{ignore_function_time_stamp ("all")}, so that Octave will
 ignore the time stamps for all function files.  Passing
-@code{"system"} to this function resets the default behavior.
+@qcode{"system"} to this function resets the default behavior.
 
 @c FIXME -- note about time stamps on files in NFS environments?
 
@@ -1150,7 +1150,7 @@
 A function that has been defined on the command-line.
 
 @item Autoload function
-A function that is marked as autoloaded with @xref{docXautoload}.
+A function that is marked as autoloaded with @xref{XREFautoload,,autoload}.
 
 @item A Function on the Path
 A function that can be found on the users load-path.  There can also be
@@ -1266,11 +1266,11 @@
 
 @DOCSTRING(source)
 
-@node Function Handles Inline Functions and Anonymous Functions
-@section Function Handles, Inline Functions, and Anonymous Functions
+@node Function Handles Anonymous Functions Inline Functions
+@section Function Handles, Anonymous Functions, Inline Functions
 @cindex handle, function handles
+@cindex anonymous functions
 @cindex inline, inline functions
-@cindex anonymous functions
 
 It can be very convenient store a function in a variable so that it
 can be passed to a different function.  For example, a function that
--- a/doc/interpreter/geometryimages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/geometryimages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,20 +26,19 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d" typ];
   endif
 
   if (! __have_feature__ ("QHULL")
-      && (strcmp (nm, "voronoi") || strcmp (nm, "griddata")
-          || strcmp (nm, "convhull") || strcmp (nm, "delaunay")
-          || strcmp (nm, "triplot")))
-    sombreroimage (nm, typ);
+      && any (strcmp (nm, {"voronoi", "griddata", "convhull", "delaunay", ...
+                           "triplot"})))
+    sombreroimage (nm, typ, d_typ);
   elseif (strcmp (typ, "txt"))
     image_as_txt (nm);
   elseif (strcmp (nm, "voronoi"))
-    rand("state",9);
-    x = rand(10,1);
-    y = rand(10,1);
+    rand ("state", 9);
+    x = rand (10, 1);
+    y = rand (10, 1);
     tri = delaunay (x, y);
     [vx, vy] = voronoi (x, y, tri);
     triplot (tri, x, y, "b");
@@ -47,34 +46,34 @@
     plot (vx, vy, "r");
     [r, c] = tri2circ (tri(end,:), x, y);
     pc = [-1:0.01:1];
-    xc = r * sin(pi*pc) + c(1);
-    yc = r * cos(pi*pc) + c(2);
+    xc = r * sin (pi*pc) + c(1);
+    yc = r * cos (pi*pc) + c(2);
     plot (xc, yc, "g-", "LineWidth", 3);
     axis([0, 1, 0, 1]);
     legend ("Delaunay Triangulation", "Voronoi Diagram");
-    print (cstrcat (nm, ".", typ), d_typ)    
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "triplot"))
     rand ("state", 2)
     x = rand (20, 1);
     y = rand (20, 1);
     tri = delaunay (x, y);
     triplot (tri, x, y);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "griddata"))
-    rand("state",1);
-    x=2*rand(1000,1)-1;
-    y=2*rand(size(x))-1;
-    z=sin(2*(x.^2+y.^2));
-    [xx,yy]=meshgrid(linspace(-1,1,32));
-    griddata(x,y,z,xx,yy);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    rand ("state", 1);
+    x = 2 * rand (1000,1) - 1;
+    y = 2 * rand (size (x)) - 1;
+    z = sin (2 * (x.^2 + y.^2));
+    [xx,yy] = meshgrid (linspace (-1,1,32));
+    griddata (x,y,z,xx,yy);
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "convhull"))
     x = -3:0.05:3;
     y = abs (sin (x));
     k = convhull (x, y);
-    plot (x(k),y(k),'r-',x,y,'b+');
+    plot (x(k),y(k),'r-', x,y,'b+');
     axis ([-3.05, 3.05, -0.05, 1.05]);
-    print (cstrcat (nm, ".", typ), d_typ) 
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "delaunay"))
     rand ("state", 1);
     x = rand (1, 10);
@@ -83,8 +82,8 @@
     X = [ x(T(:,1)); x(T(:,2)); x(T(:,3)); x(T(:,1)) ];
     Y = [ y(T(:,1)); y(T(:,2)); y(T(:,3)); y(T(:,1)) ];
     axis ([0, 1, 0, 1]);
-    plot(X, Y, "b", x, y, "r*");
-    print (cstrcat (nm, ".", typ), d_typ) 
+    plot (X,Y,"b", x,y,"r*");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "inpolygon"))
     randn ("state", 2);
     x = randn (100, 1);
@@ -92,9 +91,9 @@
     vx = cos (pi * [-1 : 0.1: 1]);
     vy = sin (pi * [-1 : 0.1 : 1]);
     in = inpolygon (x, y, vx, vy);
-    plot(vx, vy, x(in), y(in), "r+", x(!in), y(!in), "bo");
+    plot (vx, vy, x(in), y(in), "r+", x(!in), y(!in), "bo");
     axis ([-2, 2, -2, 2]);
-    print (cstrcat (nm, ".", typ), d_typ) 
+    print ([nm "." typ], d_typ);
   else
     error ("unrecognized plot requested");
   endif
@@ -129,7 +128,7 @@
   set (f, "visible", "off");
 endfunction
 
-function sombreroimage (nm, typ)
+function sombreroimage (nm, typ, d_typ)
   if (strcmp (typ, "txt"))
     fid = fopen (sprintf ("%s.txt", nm), "wt");
     fputs (fid, "+-----------------------------+\n");
@@ -141,28 +140,20 @@
   else ## if (!strcmp (typ, "txt"))
 
     hide_output ();
-    if (strcmp (typ, "eps"))
-      d_typ = "-depsc2";
-    else
-      d_typ = cstrcat ("-d", typ);
-    endif
 
-    x = y = linspace (-8, 8, 41)';
-    [xx, yy] = meshgrid (x, y);
-    r = sqrt (xx .^ 2 + yy .^ 2) + eps;
-    z = sin (r) ./ r;
+    [x, y, z] = sombrero ();
     unwind_protect
       mesh (x, y, z);
       title ("Sorry, graphics not available because octave was\\ncompiled without the QHULL library.");
     unwind_protect_cleanup
-      print (cstrcat (nm, ".", typ), d_typ);
+      print ([nm "." typ], d_typ);
       hide_output ();
     end_unwind_protect
   endif
 endfunction
 
 ## generate something for the texinfo @image command to process
-function image_as_txt(nm)
+function image_as_txt (nm)
   fid = fopen (sprintf ("%s.txt", nm), "wt");
   fputs (fid, "\n");
   fputs (fid, "+---------------------------------+\n");
@@ -170,3 +161,4 @@
   fputs (fid, "+---------------------------------+\n");
   fclose (fid);
 endfunction
+
--- a/doc/interpreter/grammar.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/grammar.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -25,8 +25,8 @@
 Octave's language.
 
 @menu
-* Keywords::                    
-* Parser::                    
+* Keywords::
+* Parser::
 @end menu
 
 @node Keywords
@@ -78,9 +78,9 @@
 @DOCSTRING(remove_input_event_hook)
 
 Finally, when the parser cannot identify an input token it calls a particular
-function to handle this.  By default, this is the function "unimplemented"
-which makes suggestions about possible Octave substitutes for @sc{matlab}
-functions.
+function to handle this.  By default, this is the internal function
+@qcode{"__unimplemented__"} which makes suggestions about possible Octave
+substitutes for @sc{matlab} functions.
 
 @DOCSTRING(missing_function_hook)
 
--- a/doc/interpreter/gui.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/gui.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -36,10 +36,10 @@
 preferences.
 
 @menu
-* I/O Dialogs::       
-* Progress Bar::       
-* GUI Utility Functions::       
-* User-Defined Preferences::       
+* I/O Dialogs::
+* Progress Bar::
+* GUI Utility Functions::
+* User-Defined Preferences::
 @end menu
 
 @node I/O Dialogs
@@ -81,13 +81,17 @@
 @node User-Defined Preferences
 @section User-Defined Preferences
 
+@DOCSTRING(getpref)
+
+@DOCSTRING(setpref)
+
 @DOCSTRING(addpref)
 
-@DOCSTRING(getpref)
+@DOCSTRING(rmpref)
 
 @DOCSTRING(ispref)
 
-@DOCSTRING(rmpref)
+@DOCSTRING(prefdir)
 
-@DOCSTRING(setpref)
+@DOCSTRING(preferences)
 
--- a/doc/interpreter/image.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/image.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,7 @@
 @node Image Processing
 @chapter Image Processing
 
-Since an image basically is a matrix Octave is a very powerful
+Since an image is basically a matrix, Octave is a very powerful
 environment for processing and analyzing images.  To illustrate
 how easy it is to do image processing in Octave, the following
 example will load an image, smooth it by a 5-by-5 averaging filter,
@@ -38,20 +38,19 @@
 and @code{Dy} contains the partial spatial derivatives of the image.
 
 @menu
-* Loading and Saving Images::   
-* Displaying Images::           
-* Representing Images::         
-* Plotting on top of Images::   
-* Color Conversion::            
+* Loading and Saving Images::
+* Displaying Images::
+* Representing Images::
+* Plotting on top of Images::
+* Color Conversion::
 @end menu
 
 @node Loading and Saving Images
 @section Loading and Saving Images
 
 The first step in most image processing tasks is to load an image
-into Octave.  This is done using the @code{imread} function, which uses the
-@code{GraphicsMagick} library for reading.  This means a vast number of image
-formats is supported.  The @code{imwrite} function is the corresponding function
+into Octave which is done with the @code{imread} function.
+The @code{imwrite} function is the corresponding function
 for writing images to the disk.
 
 In summary, most image processing code will follow the structure of this code
@@ -77,6 +76,30 @@
 
 @DOCSTRING(imfinfo)
 
+By default, Octave's image IO functions (@code{imread}, @code{imwrite},
+and @code{imfinfo}) use the @code{GraphicsMagick} library for their
+operations.  This means a vast number of image formats is supported
+but considering the large amount of image formats in science and
+its commonly closed nature, it is impossible to have a library
+capable of reading them all.  Because of this, the function
+@code{imformats} keeps a configurable list of available formats,
+their extensions, and what functions should the image IO functions
+use.  This allows to expand Octave's image IO capabilities by
+creating functions aimed at acting on specific file formats.
+
+While it would be possible to call the extra functions directly,
+properly configuring Octave with @code{imformats} allows to keep a
+consistent code that is abstracted from file formats.
+
+It is important to note that a file format is not actually defined by its
+file extension and that @code{GraphicsMagick} is capable to read and write
+more file formats than the ones listed by @code{imformats}.  What this
+means is that even with an incorrect or missing extension the image may
+still be read correctly, and that even unlisted formats are not necessarily
+unsupported.
+
+@DOCSTRING(imformats)
+
 @node Displaying Images
 @section Displaying Images
 
@@ -181,7 +204,7 @@
 @DOCSTRING(gmap40)
 
 The following three functions modify the existing colormap rather than
-replace it.   
+replace it.
 
 @DOCSTRING(brighten)
 
--- a/doc/interpreter/install.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/install.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -25,6 +25,7 @@
 @end ifclear
 
 @ifset INSTALLONLY
+@include macros.texi
 
 This file documents the installation of Octave.
 
@@ -179,7 +180,7 @@
 @table @asis
 @item BLAS
 Basic Linear Algebra Subroutine library
-(@url{http://www.netlib.org/blas}).  Accelerated BLAS libraries such as
+(@url{http://www.netlib.org/blas}).  Accelerated @sc{blas} libraries such as
 ATLAS (@url{http://math-atlas.sourceforge.net}) are recommeded for
 better performance.
 
@@ -205,7 +206,7 @@
 @table @asis
 @item ARPACK
 Library for the solution of large-scale eigenvalue problems
-(@url{http://forge.scilab.org/index.php/p/arpack-ng}).  ARPACK is
+(@url{http://forge.scilab.org/index.php/p/arpack-ng}).  @sc{arpack} is
 required to provide the functions @code{eigs} and @code{svds}.
 
 @item cURL
@@ -247,7 +248,7 @@
 
 @item HDF5
 Library for manipulating portable data files
-(@url{http://www.hdfgroup.org/HDF5}).  HDF5 is required for Octave's
+(@url{http://www.hdfgroup.org/HDF5}).  @sc{hdf5} is required for Octave's
 @code{load} and @code{save} commands to read and write HDF data files.
 
 @item LLVM
@@ -383,7 +384,7 @@
 
 @item --with-magick=<lib>
 Select the library to use for image I/O@.  The two possible values are
-"GraphicsMagick" (default) or "ImageMagick".
+@qcode{"GraphicsMagick"} (default) or @qcode{"ImageMagick"}.
 
 @item --with-sepchar=<char>
 Use <char> as the path separation character.  This option can help when
@@ -517,7 +518,7 @@
 known problems below to see if there is a workaround or solution for
 your problem.  If not,
 @ifclear INSTALLONLY
-see @ref{Trouble},
+@pxref{Trouble},
 @end ifclear
 @ifset INSTALLONLY
 see the file BUGS
@@ -569,7 +570,7 @@
 @end table
 @end itemize
 
-@node Compiling Octave with 64-bit Indexing  
+@node Compiling Octave with 64-bit Indexing
 @section Compiling Octave with 64-bit Indexing
 
 Note: the following only applies to systems that have 64-bit pointers.
@@ -1064,7 +1065,7 @@
 @env{CFLAGS}, @env{CXXFLAGS}, @env{FFLAGS}, and @env{LDFLAGS}.  Passing
 them as options to the configure script also records them in the
 @file{config.status} file.  By default, @env{CPPFLAGS} and @env{LDFLAGS}
-are empty, @env{CFLAGS} and @env{CXXFLAGS} are set to @code{"-g -O"} and
-@env{FFLAGS} is set to @code{"-O"}.
+are empty, @env{CFLAGS} and @env{CXXFLAGS} are set to @qcode{"-g -O"} and
+@env{FFLAGS} is set to @qcode{"-O"}.
 
 @end itemize
--- a/doc/interpreter/interp.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/interp.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -29,18 +29,18 @@
 
 Octave supports several methods for one-dimensional interpolation, most
 of which are described in this section.  @ref{Polynomial Interpolation}
-and @ref{Interpolation on Scattered Data} describe further methods.
+and @ref{Interpolation on Scattered Data} describe additional methods.
 
 @DOCSTRING(interp1)
 
 There are some important differences between the various interpolation
-methods.  The 'spline' method enforces that both the first and second
+methods.  The @qcode{"spline"} method enforces that both the first and second
 derivatives of the interpolated values have a continuous derivative,
 whereas the other methods do not.  This means that the results of the
-'spline' method are generally smoother.  If the function to be
-interpolated is in fact smooth, then 'spline' will give excellent
+@qcode{"spline"} method are generally smoother.  If the function to be
+interpolated is in fact smooth, then @qcode{"spline"} will give excellent
 results.  However, if the function to be evaluated is in some manner
-discontinuous, then 'pchip' interpolation might give better results.
+discontinuous, then @qcode{"pchip"} interpolation might give better results.
 
 This can be demonstrated by the code
 
@@ -51,16 +51,16 @@
 ti =-2:0.025:2;
 dti = 0.025;
 y = sign (t);
-ys = interp1 (t,y,ti,'spline');
-yp = interp1 (t,y,ti,'pchip');
+ys = interp1 (t,y,ti,"spline");
+yp = interp1 (t,y,ti,"pchip");
 ddys = diff (diff (ys)./dti) ./ dti;
 ddyp = diff (diff (yp)./dti) ./ dti;
 figure (1);
 plot (ti,ys,'r-', ti,yp,'g-');
-legend ('spline', 'pchip', 4);
+legend ("spline", "pchip", 4);
 figure (2);
 plot (ti,ddys,'r+', ti,ddyp,'g*');
-legend ('spline', 'pchip');
+legend ("spline", "pchip");
 @end group
 @end example
 
@@ -71,13 +71,13 @@
 
 @float Figure,fig:interpderiv1
 @center @image{interpderiv1,4in}
-@caption{Comparison of 'pchip' and 'spline' interpolation methods for a 
+@caption{Comparison of @qcode{"pchip"} and @qcode{"spline"} interpolation methods for a 
 step function}
 @end float
 
 @float Figure,fig:interpderiv2
 @center @image{interpderiv2,4in}
-@caption{Comparison of the second derivative of the 'pchip' and 'spline' 
+@caption{Comparison of the second derivative of the @qcode{"pchip"} and @qcode{"spline"} 
 interpolation methods for a step function}
 @end float
 @end ifnotinfo
@@ -107,9 +107,9 @@
 ti = t(1) + [0 : k-1]*dt*n/k;
 y = sin (4*t + 0.3) .* cos (3*t - 0.1);
 yp = sin (4*ti + 0.3) .* cos (3*ti - 0.1);
-plot (ti, yp, 'g', ti, interp1 (t, y, ti, 'spline'), 'b', ...
-      ti, interpft (y, k), 'c', t, y, 'r+');
-legend ('sin(4t+0.3)cos(3t-0.1', 'spline', 'interpft', 'data');
+plot (ti, yp, "g", ti, interp1 (t, y, ti, "spline"), "b", ...
+      ti, interpft (y, k), "c", t, y, 'r+');
+legend ('sin(4t+0.3)cos(3t-0.1', "spline", "interpft", "data");
 @end group
 @end example
 
@@ -128,9 +128,8 @@
 @end float
 @end ifnotinfo
 
-In additional the support function @code{spline} and @code{lookup} that
+In addition, the support functions @code{spline} and @code{lookup} that
 underlie the @code{interp1} function can be called directly.
-@ref{Finding Elements and Checking Conditions}
 
 @DOCSTRING(spline)
 
@@ -149,12 +148,11 @@
 
 A significant difference between @code{interpn} and the other two
 multi-dimensional interpolation functions is the fashion in which the
-dimensions are treated.  For @code{interp2} and @code{interp3}, the 'y'
-axis is considered to be the columns of the matrix, whereas the 'x'
-axis corresponds to the rows of the array.  As Octave indexes arrays in
-column major order, the first dimension of any array is the columns, and
-so @code{interpn} effectively reverses the 'x' and 'y' dimensions. 
-Consider the example,
+dimensions are treated.  For @code{interp2} and @code{interp3}, the y-axis is
+considered to be the columns of the matrix, whereas the x-axis corresponds to
+the rows of the array.  As Octave indexes arrays in column major order, the
+first dimension of any array is the columns, and so @code{interpn} effectively
+reverses the 'x' and 'y' dimensions.  Consider the example,
 
 @example
 @group
@@ -164,9 +162,9 @@
 v = f (xx,yy,zz);
 xi = yi = zi = -1:0.1:1;
 [xxi, yyi, zzi] = meshgrid (xi, yi, zi);
-vi = interp3 (x, y, z, v, xxi, yyi, zzi, 'spline');
+vi = interp3 (x, y, z, v, xxi, yyi, zzi, "spline");
 [xxi, yyi, zzi] = ndgrid (xi, yi, zi);
-vi2 = interpn (x, y, z, v, xxi, yyi, zzi, 'spline');
+vi2 = interpn (x, y, z, v, xxi, yyi, zzi, "spline");
 mesh (zi, yi, squeeze (vi2(1,:,:)));
 @end group
 @end example
--- a/doc/interpreter/interpimages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/interpimages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,7 +26,7 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d", typ];
   endif
 
   if (strcmp (typ, "txt"))
@@ -37,10 +37,10 @@
     ti = t(1) + [0 : k-1]*dt*n/k;
     y = sin (4*t + 0.3) .* cos (3*t - 0.1);
     yp = sin (4*ti + 0.3) .* cos (3*ti - 0.1);
-    plot (ti, yp, 'g', ti, interp1(t, y, ti, 'spline'), 'b', ...
-          ti, interpft (y, k), 'c', t, y, 'r+');
-    legend ('sin(4t+0.3)cos(3t-0.1)','spline','interpft','data');
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (ti, yp, "g", ti, interp1 (t, y, ti, "spline"), "b", ...
+          ti, interpft (y, k), "c", t, y, "r+");
+    legend ("sin(4t+0.3)cos(3t-0.1)", "spline", "interpft", "data");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "interpn"))
     x = y = z = -1:1;
     f = @(x,y,z) x.^2 - y - z.^2;
@@ -48,31 +48,31 @@
     v = f (xx,yy,zz);
     xi = yi = zi = -1:0.1:1;
     [xxi, yyi, zzi] = ndgrid (xi, yi, zi);
-    vi = interpn(x, y, z, v, xxi, yyi, zzi, 'spline');
+    vi = interpn (x, y, z, v, xxi, yyi, zzi, "spline");
     mesh (zi, yi, squeeze (vi(1,:,:)));
-    print (cstrcat (nm, ".", typ), d_typ)
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "interpderiv1"))
     t = -2:2;
     dt = 1;
     ti =-2:0.025:2;
     dti = 0.025;
-    y = sign(t);
-    ys = interp1(t,y,ti,'spline');
-    yp = interp1(t,y,ti,'pchip');
-    plot (ti, ys,'r-', ti, yp,'g-');
-    legend('spline','pchip', 4);
-    print (cstrcat (nm, ".", typ), d_typ)
+    y = sign (t);
+    ys = interp1 (t,y,ti,"spline");
+    yp = interp1 (t,y,ti,"pchip");
+    plot (ti, ys,"r-", ti, yp,"g-");
+    legend ("spline","pchip", 4);
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "interpderiv2"))
     t = -2:2;
     dt = 1;
     ti =-2:0.025:2;
     dti = 0.025;
-    y = sign(t);
-    ddys = diff(diff(interp1(t,y,ti,'spline'))./dti)./dti;
-    ddyp = diff(diff(interp1(t,y,ti,'pchip'))./dti)./dti;
-    plot (ti(2:end-1),ddys,'r*', ti(2:end-1),ddyp,'g+');
-    legend('spline','pchip');
-    print (cstrcat (nm, ".", typ), d_typ)
+    y = sign (t);
+    ddys = diff (diff (interp1 (t,y,ti,"spline"))./dti)./dti;
+    ddyp = diff (diff (interp1 (t,y,ti,"pchip"))./dti)./dti;
+    plot (ti(2:end-1),ddys,"r*", ti(2:end-1),ddyp,"g+");
+    legend ("spline", "pchip");
+    print ([nm "." typ], d_typ);
   endif
   hide_output ();  
 endfunction
@@ -103,3 +103,4 @@
   fputs (fid, "+---------------------------------+\n");
   fclose (fid);
 endfunction
+
--- a/doc/interpreter/intro.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/intro.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -29,7 +29,7 @@
 GNU Octave is freely redistributable software.  You may redistribute 
 it and/or modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation.  The GPL is included in 
-this manual in @ref{Copying}.
+this manual, @pxref{Copying}.
 
 This manual provides comprehensive documentation on how to install, 
 run, use, and extend GNU Octave.  Additional chapters describe how 
@@ -38,9 +38,9 @@
 This document corresponds to Octave version @value{VERSION}.
 
 @menu
-* Running Octave::              
-* Simple Examples::             
-* Conventions::                 
+* Running Octave::
+* Simple Examples::
+* Conventions::
 @end menu
 
 @node Running Octave
@@ -374,7 +374,7 @@
 on the line, etc.
 
 A complete description of the command line editing capability is given
-in this manual in @ref{Command Line Editing}.
+in this manual, @pxref{Command Line Editing}.
 
 @subsection Help and Documentation
 
@@ -410,7 +410,7 @@
 text of the printed manual from within Octave normally uses a separate
 program called Info.  When you invoke Info you will be put into a menu
 driven program that contains the entire Octave manual.  Help for using
-Info is provided in this manual in @ref{Getting Help}.
+Info is provided in this manual, @pxref{Getting Help}.
 
 @node Conventions
 @section Conventions
@@ -419,11 +419,11 @@
 manual.  You may want to skip this section and refer back to it later.
 
 @menu
-* Fonts::                       
-* Evaluation Notation::         
-* Printing Notation::           
-* Error Messages::              
-* Format of Descriptions::      
+* Fonts::
+* Evaluation Notation::
+* Printing Notation::
+* Error Messages::
+* Format of Descriptions::
 @end menu
 
 @node Fonts
@@ -532,23 +532,22 @@
 @subsection Format of Descriptions
 @cindex description format
 
-Functions, commands, and variables are described in this manual in a 
+Functions and commands are described in this manual in a 
 uniform format.  The first line of a description contains the name of
 the item followed by its arguments, if any.
 @ifnottex
-The category---function, variable, or whatever---appears at the
+The category---function, command, or whatever---appears at the
 beginning of the line.
 @end ifnottex
 @iftex
-The category---function, variable, or whatever---is printed next to the
+The category---function, command, or whatever---is printed next to the
 right margin.
 @end iftex
 The description follows on succeeding lines, sometimes with examples.
 
 @menu
-* A Sample Function Description::  
-* A Sample Command Description::  
-* A Sample Variable Description::  
+* A Sample Function Description::
+* A Sample Command Description::
 @end menu
 
 @node A Sample Function Description
@@ -643,27 +642,3 @@
 printed and the working directory is not changed.
 @end deftypefn
 
-@node A Sample Variable Description
-@subsubsection A Sample Variable Description
-@cindex variable descriptions
-
-A @dfn{variable} is a name that can hold a value.  Although any variable
-can be set by the user, @dfn{built-in variables} typically exist
-specifically so that users can change them to alter the way Octave
-behaves (built-in variables are also sometimes called @dfn{user
-options}).  Ordinary variables and built-in variables are described
-using a format like that for functions except that there are no
-arguments.
-
-Here is a description of the imaginary variable
-@code{do_what_i_mean_not_what_i_say}.
-
-@defvr {Built-in Variable} do_what_i_mean_not_what_i_say
-If the value of this variable is nonzero, Octave will do what you
-actually wanted, even if you have typed a completely different and
-meaningless list of commands.
-@end defvr
-
-Other variable descriptions have the same format, but `Built-in
-Variable' is replaced by `Variable', for ordinary variables, or
-`Constant' for symbolic constants whose values cannot be changed.
--- a/doc/interpreter/io.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/io.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -26,8 +26,8 @@
 after the C standard library are also provided by Octave.
 
 @menu
-* Basic Input and Output::      
-* C-Style I/O Functions::       
+* Basic Input and Output::
+* C-Style I/O Functions::
 @end menu
 
 @node Basic Input and Output
@@ -36,9 +36,9 @@
 @c We could use a two-line introduction here...
 
 @menu
-* Terminal Output::             
-* Terminal Input::              
-* Simple File I/O::             
+* Terminal Output::
+* Terminal Input::
+* Simple File I/O::
 @end menu
 
 @node Terminal Output
@@ -284,25 +284,25 @@
 @DOCSTRING(stderr)
 
 @menu
-* Opening and Closing Files::   
-* Simple Output::               
-* Line-Oriented Input::         
-* Formatted Output::            
-* Output Conversion for Matrices::  
-* Output Conversion Syntax::    
-* Table of Output Conversions::  
-* Integer Conversions::         
+* Opening and Closing Files::
+* Simple Output::
+* Line-Oriented Input::
+* Formatted Output::
+* Output Conversion for Matrices::
+* Output Conversion Syntax::
+* Table of Output Conversions::
+* Integer Conversions::
 * Floating-Point Conversions::
-* Other Output Conversions::    
-* Formatted Input::             
-* Input Conversion Syntax::     
-* Table of Input Conversions::  
-* Numeric Input Conversions::   
-* String Input Conversions::    
-* Binary I/O::                  
-* Temporary Files::             
-* EOF and Errors::              
-* File Positioning::            
+* Other Output Conversions::
+* Formatted Input::
+* Input Conversion Syntax::
+* Table of Input Conversions::
+* Numeric Input Conversions::
+* String Input Conversions::
+* Binary I/O::
+* Temporary Files::
+* EOF and Errors::
+* File Positioning::
 @end menu
 
 @node Opening and Closing Files
@@ -702,8 +702,8 @@
 followed by a digit.
 
 The following flags can be used to modify the behavior:
+@c Not @samp so we can have ' ' as an item.
 
-@c Not @samp so we can have ' ' as an item.
 @table @asis
 @item @samp{-}
 Left-justify the result in the field.  Normally the result is
@@ -977,9 +977,9 @@
 @end example
 
 @noindent
-with the conversion @samp{%10c} produces @code{" hello, wo"}, but
+with the conversion @samp{%10c} produces @qcode{" hello, wo"}, but
 reading the same input with the conversion @samp{%10s} produces
-@code{"hello,"}.
+@qcode{"hello,"}.
 
 @node Binary I/O
 @subsection Binary I/O
@@ -1008,7 +1008,7 @@
 
 @DOCSTRING(tmpnam)
 
-@node EOF and Errors, File Positioning, Temporary Files, C-Style I/O Functions
+@node EOF and Errors
 @subsection End of File and Errors
 
 Once a file has been opened its status can be acquired.  As an example
--- a/doc/interpreter/java.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/java.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -145,13 +145,13 @@
 * How to make Java classes available?::
 * How to create an instance of a Java class?::
 * How can I handle memory limitations?::
-* Which @TeX{} symbols are implemented in the dialog functions?::
+* Which @TeX{} symbols are implemented in dialog functions?::
 @end menu
 
 @c ------------------------------------------------------------------------
 @node How to distinguish between Octave and Matlab?
 @subsection How to distinguish between Octave and Matlab?
-@anchor{docXFAQ}
+@anchor{XREFFAQ}
 @c - index -
 @cindex Octave and @sc{matlab}, how to distinguish between
 @c - index -
@@ -234,7 +234,7 @@
 @item Finally, Octave looks for a next occurrence of file
 @file{javaclasspath.txt} in the m-files directory where Octave Java functions 
 live.  This is where @file{javaclasspath.m} resides, usually something like
-@file{@env{OCTAVE_HOME}/share/octave/@env{OCTAVE_VERSION}/m/java/}.  You can
+@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}.  You can
 find this directory by executing the command
 
 @example
@@ -316,7 +316,7 @@
 In order to execute Java code Octave creates a Java Virtual Machine (JVM).
 Such a JVM allocates a fixed amount of initial memory and may expand this pool
 up to a fixed maximum memory limit.  The default values depend on the Java
-version (see @ref{docXjavamem,,javamem}).  The memory pool is shared by all
+version (@pxref{XREFjavamem,,javamem}).  The memory pool is shared by all
 Java objects running in the JVM@.  This strict memory limit is intended mainly
 to avoid that runaway applications inside web browsers or in enterprise servers
 can consume all memory and crash the system.  When the maximum memory limit is
@@ -330,7 +330,7 @@
 The directory where the Java options file is located is specified by the
 environment variable @w{@env{OCTAVE_JAVA_DIR}}.  If unset the directory where
 @file{javaclasspath.m} resides is used instead (typically
-@file{@env{OCTAVE_HOME}/share/octave/@env{OCTAVE_VERSION}/m/java/}).  You can
+@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}).  You can
 find this directory by executing
 
 @example
@@ -385,8 +385,8 @@
 @seealso{javamem}
 
 @c ------------------------------------------------------------------------
-@node Which @TeX{} symbols are implemented in the dialog functions?
-@subsection Which @TeX{} symbols are implemented in the dialog functions?
+@node Which @TeX{} symbols are implemented in dialog functions?
+@subsection Which @TeX{} symbols are implemented in dialog functions?
 @c - index -
 @cindex symbols, translation table
 @cindex @TeX{} symbols, translation table
--- a/doc/interpreter/linalg.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/linalg.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -26,9 +26,9 @@
 
 @menu
 * Techniques Used for Linear Algebra::
-* Basic Matrix Functions::      
-* Matrix Factorizations::       
-* Functions of a Matrix::       
+* Basic Matrix Functions::
+* Matrix Factorizations::
+* Functions of a Matrix::
 * Specialized Solvers::
 @end menu
 
@@ -96,6 +96,8 @@
 
 @DOCSTRING(inv)
 
+@DOCSTRING(linsolve)
+
 @DOCSTRING(matrix_type)
 
 @DOCSTRING(norm)
--- a/doc/interpreter/macros.texi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/macros.texi	Sat Oct 05 11:22:09 2013 -0400
@@ -16,12 +16,27 @@
 @c along with Octave; see the file COPYING.  If not, see
 @c <http://www.gnu.org/licenses/>.
 
-@c FIXME -- someday, we might replace this with @backslashchar, which
-@c has been added to Texinfo.
+@c The following macro marks words that aspell should ignore during
+@c spellchecking.  Within Texinfo it has no effect as it merely replaces
+@c the macro call with the argument itself.
+
+@macro nospell {arg}
+\arg\
+@end macro
 
-@macro xbackslashchar
-\\
+@c The following macro works around the Info/plain text expansion of @code{XXX}
+@c which is `XXX'.  This looks particularly bad when the macro body is 
+@c single or double-quoted text, such as a property value `"position"'
+@ifinfo
+@macro qcode{arg}
+\arg\
 @end macro
+@end ifinfo
+@ifnotinfo
+@macro qcode{arg}
+@code{\arg\}
+@end macro
+@end ifnotinfo
 
 @c The following macro is used for the on-line help system, but we don't
 @c want lots of `See also: foo, bar, and baz' strings cluttering the
@@ -30,7 +45,7 @@
 @c
 @c Implementation Note:
 @c For TeX, @vskip produces a nice separation.
-@c For Texinfo '@sp 1' should work, but in practice produces ugly results
+@c For Texinfo, '@sp 1' should work, but in practice produces ugly results
 @c for HTML.  We use a simple blank line to produce the correct behavior. 
 
 @macro seealso {args}
@@ -40,34 +55,34 @@
 @ifnottex
 
 @end ifnottex
-@ifinfo
-@noindent
-See also: \args\.
-@end ifinfo
 @ifnotinfo
 @noindent
 @strong{See also:} \args\.
 @end ifnotinfo
-@end macro
-
-@c The following macro marks words that aspell should ignore during
-@c spellchecking.  Within Texinfo it has no effect as it merely replaces
-@c the macro call with the argument itself.
-
-@macro nospell {arg}
-\arg\
+@ifinfo
+@noindent
+See also: \args\.
+@end ifinfo
 @end macro
 
 @c The following macro works around a situation where the Info/plain text
 @c expansion of the @code{XXX} macro is `XXX'.  The use of the apostrophe
 @c can be confusing if the code segment itself ends with a transpose operator.
 @ifinfo
-@macro xcode{arg}
+@macro tcode{arg}
 \arg\
 @end macro
 @end ifinfo
 @ifnotinfo
-@macro xcode{arg}
+@macro tcode{arg}
 @code{\arg\}
 @end macro
 @end ifnotinfo
+
+@c FIXME: someday, when Texinfo 5.X is standard, we might replace this with
+@c @backslashchar, which is a new addition to Texinfo.
+
+@macro xbackslashchar
+\\
+@end macro
+
--- a/doc/interpreter/matrix.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/matrix.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -27,10 +27,10 @@
 lower-triangular parts, or sort the columns of a matrix.
 
 @menu
-* Finding Elements and Checking Conditions::  
-* Rearranging Matrices::        
-* Special Utility Matrices::    
-* Famous Matrices::             
+* Finding Elements and Checking Conditions::
+* Rearranging Matrices::
+* Special Utility Matrices::
+* Famous Matrices::
 @end menu
 
 @node Finding Elements and Checking Conditions
@@ -77,7 +77,7 @@
 @DOCSTRING(common_size)
 
 @DOCSTRING(find)
-        
+
 @DOCSTRING(lookup)
 
 If you wish to check if a variable exists at all, instead of properties
@@ -124,7 +124,7 @@
 
 @DOCSTRING(nth_element)
 
-@anchor{docXtriu}
+@anchor{XREFtriu}
 @DOCSTRING(tril)
 
 @DOCSTRING(vec)
@@ -174,7 +174,7 @@
 
 The generators operate in the new or old style together, it is not
 possible to mix the two.  Initializing any generator with
-@code{"state"} or @code{"seed"} causes the others to switch to the
+@qcode{"state"} or @qcode{"seed"} causes the others to switch to the
 same style for future calls.
 
 The state of each generator is independent and calls to different
@@ -208,7 +208,7 @@
 
 @noindent
 produce equivalent results.  When the generators are initialized in
-the old style with @code{"seed"} only @code{rand} and @code{randn} are
+the old style with @qcode{"seed"} only @code{rand} and @code{randn} are
 independent, because the old @code{rande}, @code{randg} and
 @code{randp} generators make calls to @code{rand} and @code{randn}.
 
--- a/doc/interpreter/mk_doc_cache.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/mk_doc_cache.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 docstrings_files = args(2:end);
 
 ## Special character used as break between DOCSTRINGS
-doc_delim = char (31);
+doc_delim = char (0x1d);
 
 ## Read the contents of all the DOCSTRINGS files into TEXT.
 ## It is more efficient to fork to shell for makeinfo only once on large data
@@ -48,11 +48,23 @@
     endif
   endif
 endfor
-text = [text{:}, doc_delim];
+text = [text{:}];
+
+## Strip Texinfo marker
+text = regexprep (text, "-\\*- texinfo -\\*-[ \t]*[\r\n]*", "");
 
-## Strip Texinfo markers and docstring separators.
-text = regexprep (text, "-\\*- texinfo -\\*-[ \t]*[\r\n]*", "");
-text = strrep (text, '@', "@@");
+## Add keywords and operators
+other_docstrings = [__keywords__; __operators__];
+for i = 1 : numel (other_docstrings)
+  name = other_docstrings{i};
+  ## Special handling of block comment operators such as '#{'
+  esc_name = regexprep (name, '([{}])', '@$1');
+  text = [text doc_delim esc_name get_help_text(name) "\n"];
+endfor
+text(end+1) = doc_delim;
+
+## Double '@' symbol for Texinfo
+text = strrep (text, [doc_delim "@"], [doc_delim "@@"]);
 
 ## Write data to temporary file for input to makeinfo
 [fid, name, msg] = mkstemp ("octave_doc_XXXXXX", true);
--- a/doc/interpreter/munge-texi.pl	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/munge-texi.pl	Sat Oct 05 11:22:09 2013 -0400
@@ -6,7 +6,7 @@
 $top_srcdir = shift (@ARGV);
 
 # Constant patterns
-$doc_delim = qr/^\c_/;
+$doc_delim = qr/^\x{1d}/;
 $tex_delim = qr/\Q-*- texinfo -*-\E/;
 $comment_line = qr/^\s*(?:$|#)/;
 # Pre-declare hash size for efficiency
@@ -61,7 +61,7 @@
     }
 
     $func =~ s/^@/@@/;   # Texinfo uses @@ to produce '@'
-    $docstring =~ s/^$tex_delim$/\@anchor{docX$func}/m;
+    $docstring =~ s/^$tex_delim$/\@anchor{XREF$func}/m;
     print $docstring,"\n";
 
     next TXI_LINE;
@@ -110,7 +110,7 @@
       foreach $func (split (/,/, $func_list))
       {
         $func =~ s/^@/@@/;   # Texinfo uses @@ to produce '@'
-        $repl .= "\@ref{docX$func,,$func}, ";
+        $repl .= "\@ref{XREF$func,,$func}, ";
       }
       substr($repl,-2) = "";   # Remove last ', ' 
       $_ = "\@seealso{$repl}$rest_of_line";
--- a/doc/interpreter/nonlin.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/nonlin.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,7 @@
 
 @menu
 * Solvers::
-* Minimizers::          
+* Minimizers::
 @end menu
 
 @node Solvers
--- a/doc/interpreter/numbers.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/numbers.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -29,7 +29,7 @@
 (exponential) notation, or a complex number.  Note that by default numeric
 constants are represented within Octave in double-precision floating
 point format (complex constants are stored as pairs of double-precision
-floating point values).  It is however possible to represent real
+floating point values).  It is, however, possible to represent real
 integers as described in @ref{Integer Data Types}.  Here are some
 examples of real-valued numeric constants, which all have the same
 value:
@@ -93,9 +93,9 @@
 * Single Precision Data Types::
 * Integer Data Types::
 * Bit Manipulations::
-* Logical Values:: 
+* Logical Values::
 * Promotion and Demotion of Data Types::
-* Predicates for Numeric Objects::  
+* Predicates for Numeric Objects::
 @end menu
 
 @node Matrices
@@ -304,7 +304,7 @@
 @DOCSTRING(fixed_point_format)
 
 @menu
-* Empty Matrices::              
+* Empty Matrices::
 @end menu
 
 @node Empty Matrices
@@ -359,7 +359,7 @@
 
 Empty matrices may also be used in assignment statements as a convenient
 way to delete rows or columns of matrices.
-@xref{Assignment Ops, ,Assignment Expressions}.
+@xref{Assignment Ops,,Assignment Expressions}.
 
 When Octave parses a matrix expression, it examines the elements of the
 list to determine whether they are all constants.  If they are, it
@@ -546,6 +546,8 @@
 
 @DOCSTRING(intmin)
 
+@DOCSTRING(flintmax)
+
 @menu
 * Integer Arithmetic::
 @end menu
@@ -616,10 +618,10 @@
 
 @DOCSTRING(bitmax)
 
-This is the double precision version of the functions @code{intmax},
+This is the double precision version of the function @code{intmax},
 previously discussed.
 
-Octave also includes the basic bitwise 'and', 'or' and 'exclusive or'
+Octave also includes the basic bitwise 'and', 'or', and 'exclusive or'
 operators.
 
 @DOCSTRING(bitand)
@@ -839,4 +841,4 @@
 
 If instead of knowing properties of variables, you wish to know which
 variables are defined and to gather other information about the
-workspace itself, see @ref{Status of Variables}.
+workspace itself, @pxref{Status of Variables}.
--- a/doc/interpreter/octave.texi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/octave.texi	Sat Oct 05 11:22:09 2013 -0400
@@ -17,6 +17,7 @@
 % <http://www.gnu.org/licenses/>.
 
 \input texinfo
+
 @setfilename octave.info
 
 @include macros.texi
@@ -30,10 +31,14 @@
 @end format
 @end ifinfo
 
-@c Settings for printing on 8-1/2 by 11 inch paper:
-@c -----------------------------------------------
+@c Settings for printing on 8-1/2 by 11 inch paper (default):
+@c --------------------------------------------------------
 
 @setchapternewpage odd
+@c Fix TOC margins for printed manual
+@tex
+{\globaldefs = 1 \contentsrightmargin = 0pt}
+@end tex
 
 @c Settings for small book format:
 @c ------------------------------
@@ -101,6 +106,7 @@
 @author John W. Eaton
 @author David Bateman
 @author S@o{}ren Hauberg
+@author Rik Wehbring
 @page
 @vskip 0pt plus 1filll
 Copyright @copyright{} 1996, 1997, 1999, 2000, 2001, 2002, 2005, 2006,
@@ -141,54 +147,54 @@
 @c ------------------------------------------------------------------------
 
 @menu
-* Preface::                     
+* Preface::
 * Introduction::                A brief introduction to Octave.
-* Getting Started::             
-* Data Types::                  
-* Numeric Data Types::          
-* Strings::                     
-* Data Containers::             
-* Variables::                   
-* Expressions::                 
-* Evaluation::                  
+* Getting Started::
+* Data Types::
+* Numeric Data Types::
+* Strings::
+* Data Containers::
+* Variables::
+* Expressions::
+* Evaluation::
 * Statements::                  Looping and program flow control.
-* Functions and Scripts::       
-* Errors and Warnings::              
+* Functions and Scripts::
+* Errors and Warnings::
 * Debugging::
-* Input and Output::            
-* Plotting::                    
-* Matrix Manipulation::         
-* Arithmetic::                  
+* Input and Output::
+* Plotting::
+* Matrix Manipulation::
+* Arithmetic::
 * Linear Algebra::
 * Vectorization and Faster Code Execution::
 * Nonlinear Equations::
 * Diagonal and Permutation Matrices::
 * Sparse Matrices::
-* Numerical Integration::                  
-* Differential Equations::      
-* Optimization::                
-* Statistics::                  
-* Sets::                        
-* Polynomial Manipulations::    
+* Numerical Integration::
+* Differential Equations::
+* Optimization::
+* Statistics::
+* Sets::
+* Polynomial Manipulations::
 * Interpolation::
 * Geometry::
-* Signal Processing::           
-* Image Processing::            
-* Audio Processing::            
-* Object Oriented Programming::            
-* GUI Development::            
-* System Utilities::            
+* Signal Processing::
+* Image Processing::
+* Audio Processing::
+* Object Oriented Programming::
+* GUI Development::
+* System Utilities::
 * Java Interface:: 
 * Packages:: 
 * External Code Interface::
 * Test and Demo Functions::
-* Tips and Standards::                        
+* Tips and Standards::
 * Contributing Guidelines::
 * Obsolete Functions::
 * Trouble::                     If you have trouble installing Octave.
 * Installation::                How to configure, compile and install Octave.
-* Emacs Octave Support::                       
-* Grammar and Parser::                     
+* Emacs Octave Support::
+* Grammar and Parser::
 * Copying::                     The GNU General Public License.
 * Concept Index::               An item for each concept.
 * Function Index::              An item for each documented function.
@@ -199,76 +205,75 @@
 
 Preface
 
-* Acknowledgements::            
+* Acknowledgements::
 * Citing Octave in Publications::
-* How You Can Contribute to Octave::  
-* Distribution::                
+* How You Can Contribute to Octave::
+* Distribution::
 
 Introduction
 
-* Running Octave::              
-* Simple Examples::             
-* Conventions::                 
+* Running Octave::
+* Simple Examples::
+* Conventions::
 
 Conventions
 
-* Fonts::                       
-* Evaluation Notation::         
-* Printing Notation::           
-* Error Messages::              
-* Format of Descriptions::      
+* Fonts::
+* Evaluation Notation::
+* Printing Notation::
+* Error Messages::
+* Format of Descriptions::
 
 Format of Descriptions
 
-* A Sample Function Description::  
-* A Sample Command Description::  
-* A Sample Variable Description::  
+* A Sample Function Description::
+* A Sample Command Description::
 
 Getting Started
 
-* Invoking Octave from the Command Line::             
-* Quitting Octave::             
-* Getting Help::                
-* Command Line Editing::        
-* Errors::                      
-* Executable Octave Programs::  
-* Comments::                    
+* Invoking Octave from the Command Line::
+* Quitting Octave::
+* Getting Help::
+* Command Line Editing::
+* Errors::
+* Executable Octave Programs::
+* Comments::
 
 Invoking Octave from the Command Line
 
-* Command Line Options::        
-* Startup Files::               
+* Command Line Options::
+* Startup Files::
 
 Command Line Editing
 
-* Cursor Motion::               
-* Killing and Yanking::         
-* Commands For Text::           
-* Commands For Completion::     
-* Commands For History::        
-* Customizing readline::        
-* Customizing the Prompt::      
-* Diary and Echo Commands::     
+* Cursor Motion::
+* Killing and Yanking::
+* Commands For Text::
+* Commands For Completion::
+* Commands For History::
+* Customizing readline::
+* Customizing the Prompt::
+* Diary and Echo Commands::
 
 Comments
 
 * Single Line Comments::
 * Block Comments::
-* Comments and the Help System::                    
+* Comments and the Help System::
 
 Data Types
 
-* Built-in Data Types::         
-* User-defined Data Types::     
-* Object Sizes::                
+* Built-in Data Types::
+* User-defined Data Types::
+* Object Sizes::
 
 Built-in Data Types
 
-* Numeric Objects::             
-* Missing Data::                
-* String Objects::              
-* Data Structure Objects::      
-* Cell Array Objects::          
+* Numeric Objects::
+* Missing Data::
+* String Objects::
+* Data Structure Objects::
+* Cell Array Objects::
 
 Numeric Data Types
 
@@ -277,13 +282,13 @@
 * Single Precision Data Types::
 * Integer Data Types::
 * Bit Manipulations::
-* Logical Values:: 
+* Logical Values::
 * Promotion and Demotion of Data Types::
-* Predicates for Numeric Objects::  
+* Predicates for Numeric Objects::
 
 Matrices
 
-* Empty Matrices::              
+* Empty Matrices::
 
 Integer Data Types
 
@@ -293,16 +298,16 @@
 
 * Escape Sequences in String Constants::
 * Character Arrays::
-* Creating Strings:: 
-* Comparing Strings::           
-* Manipulating Strings::     
-* String Conversions::          
-* Character Class Functions::   
+* Creating Strings::
+* Comparing Strings::
+* Manipulating Strings::
+* String Conversions::
+* Character Class Functions::
 
 Creating Strings
 
-* Concatenating Strings:: 
-* Conversion of Numerical Data to Strings::
+* Concatenating Strings::
+* Converting Numerical Data to Strings::
 
 Data Containers
 
@@ -333,20 +338,20 @@
 
 Variables
 
-* Global Variables::            
-* Persistent Variables::        
-* Status of Variables::         
+* Global Variables::
+* Persistent Variables::
+* Status of Variables::
 
 Expressions
 
-* Index Expressions::           
-* Calling Functions::           
-* Arithmetic Ops::              
-* Comparison Ops::              
-* Boolean Expressions::         
-* Assignment Ops::              
-* Increment Ops::               
-* Operator Precedence::         
+* Index Expressions::
+* Calling Functions::
+* Arithmetic Ops::
+* Comparison Ops::
+* Boolean Expressions::
+* Assignment Ops::
+* Increment Ops::
+* Operator Precedence::
 
 Index Expressions
 
@@ -354,13 +359,13 @@
 
 Calling Functions
 
-* Call by Value::               
-* Recursion::                   
+* Call by Value::
+* Recursion::
 
 Boolean Expressions
 
-* Element-by-element Boolean Operators::  
-* Short-circuit Boolean Operators::  
+* Element-by-element Boolean Operators::
+* Short-circuit Boolean Operators::
 
 Evaluation
 
@@ -369,40 +374,40 @@
 
 Statements
 
-* The if Statement::            
-* The switch Statement::        
-* The while Statement::         
-* The do-until Statement::      
-* The for Statement::           
-* The break Statement::         
-* The continue Statement::      
-* The unwind_protect Statement::  
-* The try Statement::           
-* Continuation Lines::          
+* The if Statement::
+* The switch Statement::
+* The while Statement::
+* The do-until Statement::
+* The for Statement::
+* The break Statement::
+* The continue Statement::
+* The unwind_protect Statement::
+* The try Statement::
+* Continuation Lines::
 
 The switch Statement
 
-* Notes for the C Programmer::  
+* Notes for the C Programmer::
 
 The for Statement
 
-* Looping Over Structure Elements::  
+* Looping Over Structure Elements::
 
 Functions and Scripts
 
 * Introduction to Function and Script Files::
-* Defining Functions::          
-* Multiple Return Values::      
-* Variable-length Argument Lists::  
-* Ignoring Arguments::  
-* Variable-length Return Lists::  
-* Returning from a Function::   
-* Default Arguments::   
-* Function Files::              
-* Script Files::                
-* Function Handles Inline Functions and Anonymous Functions::
+* Defining Functions::
+* Multiple Return Values::
+* Variable-length Argument Lists::
+* Ignoring Arguments::
+* Variable-length Return Lists::
+* Returning from a Function::
+* Default Arguments::
+* Function Files::
+* Script Files::
+* Function Handles Anonymous Functions Inline Functions::
 * Commands::
-* Organization of Functions::   
+* Organization of Functions::
 
 Function Files
 
@@ -414,7 +419,7 @@
 * Function Locking::
 * Function Precedence::
 
-Function Handles Inline Functions and Anonymous Functions
+Function Handles Anonymous Functions Inline Functions
 
 * Function Handles::
 * Anonymous Functions::
@@ -448,14 +453,14 @@
 
 Input and Output
 
-* Basic Input and Output::      
-* C-Style I/O Functions::       
+* Basic Input and Output::
+* C-Style I/O Functions::
 
 Basic Input and Output
 
-* Terminal Output::             
-* Terminal Input::              
-* Simple File I/O::             
+* Terminal Output::
+* Terminal Input::
+* Simple File I/O::
 
 Terminal Output
 
@@ -467,131 +472,130 @@
 
 C-Style I/O Functions
 
-* Opening and Closing Files::   
-* Simple Output::               
-* Line-Oriented Input::         
-* Formatted Output::            
-* Output Conversion for Matrices::  
-* Output Conversion Syntax::    
-* Table of Output Conversions::  
-* Integer Conversions::         
+* Opening and Closing Files::
+* Simple Output::
+* Line-Oriented Input::
+* Formatted Output::
+* Output Conversion for Matrices::
+* Output Conversion Syntax::
+* Table of Output Conversions::
+* Integer Conversions::
 * Floating-Point Conversions::
-* Other Output Conversions::    
-* Formatted Input::             
-* Input Conversion Syntax::     
-* Table of Input Conversions::  
-* Numeric Input Conversions::   
-* String Input Conversions::    
-* Binary I/O::                  
-* Temporary Files::             
-* EOF and Errors::              
-* File Positioning::            
+* Other Output Conversions::
+* Formatted Input::
+* Input Conversion Syntax::
+* Table of Input Conversions::
+* Numeric Input Conversions::
+* String Input Conversions::
+* Binary I/O::
+* Temporary Files::
+* EOF and Errors::
+* File Positioning::
 
 Plotting
 
-* Introduction to Plotting::    
-* High-Level Plotting::         
-* Graphics Data Structures::    
-* Advanced Plotting::           
+* Introduction to Plotting::
+* High-Level Plotting::
+* Graphics Data Structures::
+* Advanced Plotting::
 
 High-Level Plotting
 
-* Two-Dimensional Plots::       
-* Three-Dimensional Plots::  
-* Plot Annotations::            
-* Multiple Plots on One Page::  
-* Multiple Plot Windows::       
-* Use of axis@comma{} line@comma{} and patch Functions::
+* Two-Dimensional Plots::
+* Three-Dimensional Plots::
+* Plot Annotations::
+* Multiple Plots on One Page::
+* Multiple Plot Windows::
 * Manipulation of Plot Windows::
 * Use of the @code{interpreter} Property::
-* Printing and Saving Plots::              
-* Interacting with Plots::      
-* Test Plotting Functions::     
+* Printing and Saving Plots::
+* Interacting with Plots::
+* Test Plotting Functions::
 
 Two-Dimensional Plots
 
-* Axis Configuration::  
-* Two-dimensional Function Plotting::  
-* Two-dimensional Geometric Shapes::  
+* Axis Configuration::
+* Two-dimensional Function Plotting::
+* Two-dimensional Geometric Shapes::
 
 Three-Dimensional Plots
 
 * Aspect Ratio::
-* Three-dimensional Function Plotting::  
-* Three-dimensional Geometric Shapes::  
+* Three-dimensional Function Plotting::
+* Three-dimensional Geometric Shapes::
 
 Graphics Data Structures
 
-* Introduction to Graphics Structures::  
-* Graphics Objects::            
-* Graphics Object Properties::  
-* Searching Properties::        
-* Managing Default Properties::  
+* Introduction to Graphics Structures::
+* Graphics Objects::
+* Graphics Object Properties::
+* Searching Properties::
+* Managing Default Properties::
 
 Graphics Object Properties
 
-* Root Figure Properties::      
-* Figure Properties::           
-* Axes Properties::             
-* Line Properties::             
-* Text Properties::             
-* Image Properties::            
-* Patch Properties::            
-* Surface Properties::          
+* Root Figure Properties::
+* Figure Properties::
+* Axes Properties::
+* Line Properties::
+* Text Properties::
+* Image Properties::
+* Patch Properties::
+* Surface Properties::
 
 Advanced Plotting
 
-* Colors::                      
-* Line Styles::                 
-* Marker Styles::               
-* Callbacks::                   
+* Colors::
+* Line Styles::
+* Marker Styles::
+* Callbacks::
 * Application-defined Data::
-* Object Groups::               
-* Graphics Toolkits::           
+* Object Groups::
+* Graphics Toolkits::
 
 Object Groups
 
-* Data Sources in Object Groups::  
-* Area Series::                 
-* Bar Series::                  
-* Contour Groups::              
-* Error Bar Series::            
-* Line Series::                 
-* Quiver Group::                
-* Scatter Group::               
-* Stair Group::                 
-* Stem Series::                 
-* Surface Group::               
+* Data Sources in Object Groups::
+* Area Series::
+* Bar Series::
+* Contour Groups::
+* Error Bar Series::
+* Line Series::
+* Quiver Group::
+* Scatter Group::
+* Stair Group::
+* Stem Series::
+* Surface Group::
 
 Graphics Toolkits
 
-* Customizing Toolkit Behavior::    
+* Customizing Toolkit Behavior::
 
 Matrix Manipulation
 
-* Finding Elements and Checking Conditions::  
-* Rearranging Matrices::        
-* Special Utility Matrices::    
-* Famous Matrices::             
+* Finding Elements and Checking Conditions::
+* Rearranging Matrices::
+* Special Utility Matrices::
+* Famous Matrices::
 
 Arithmetic
 
 * Exponents and Logarithms::
-* Complex Arithmetic::          
-* Trigonometry::                
-* Sums and Products::           
-* Utility Functions::           
-* Special Functions::           
+* Complex Arithmetic::
+* Trigonometry::
+* Sums and Products::
+* Utility Functions::
+* Special Functions::
 * Rational Approximations::
 * Coordinate Transformations::
-* Mathematical Constants::      
+* Mathematical Constants::
 
 Linear Algebra
 
 * Techniques Used for Linear Algebra::
-* Basic Matrix Functions::      
-* Matrix Factorizations::       
-* Functions of a Matrix::       
+* Basic Matrix Functions::
+* Matrix Factorizations::
+* Functions of a Matrix::
 * Specialized Solvers::
 
 Vectorization and Faster Code Execution
@@ -607,15 +611,15 @@
 Nonlinear Equations
 
 * Solvers::
-* Minimizers::          
+* Minimizers::
 
 Diagonal and Permutation Matrices
 
-* Basic Usage::          Creation and Manipulation of Diagonal and Permutation Matrices
-* Matrix Algebra::       Linear Algebra with Diagonal and Permutation Matrices
+* Basic Usage::          Creation and Manipulation of Diagonal/Permutation Matrices
+* Matrix Algebra::       Linear Algebra with Diagonal/Permutation Matrices
 * Function Support::     Functions That Are Aware of These Matrices
-* Example Code::         Some Examples of Usage
-* Zeros Treatment::      The Differences in Treatment of Zero Elements
+* Example Code::         Examples of Usage
+* Zeros Treatment::      Differences in Treatment of Zero Elements
 
 Basic Usage
 
@@ -649,37 +653,37 @@
 
 Operators and Functions
 
-* Sparse Functions::            
-* Return Types of Operators and Functions::  
-* Mathematical Considerations::  
+* Sparse Functions::
+* Return Types of Operators and Functions::
+* Mathematical Considerations::
 
 Numerical Integration
 
-* Functions of One Variable:: 
-* Orthogonal Collocation::      
-* Functions of Multiple Variables:: 
+* Functions of One Variable::
+* Orthogonal Collocation::
+* Functions of Multiple Variables::
 
 Differential Equations
 
-* Ordinary Differential Equations::  
-* Differential-Algebraic Equations::  
+* Ordinary Differential Equations::
+* Differential-Algebraic Equations::
 
 Optimization
 
-* Linear Programming::       
-* Quadratic Programming::       
-* Nonlinear Programming::       
-* Linear Least Squares::        
+* Linear Programming::
+* Quadratic Programming::
+* Nonlinear Programming::
+* Linear Least Squares::
 
 Statistics
 
 * Descriptive Statistics::
-* Basic Statistical Functions:: 
-* Statistical Plots:: 
-* Correlation and Regression Analysis::                      
-* Distributions::     
-* Tests::                       
-* Random Number Generation::          
+* Basic Statistical Functions::
+* Statistical Plots::
+* Correlation and Regression Analysis::
+* Distributions::
+* Tests::
+* Random Number Generation::
 
 Sets
 
@@ -713,11 +717,11 @@
 
 Image Processing
 
-* Loading and Saving Images::   
-* Displaying Images::           
-* Representing Images::         
-* Plotting on top of Images::   
-* Color Conversion::            
+* Loading and Saving Images::
+* Displaying Images::
+* Representing Images::
+* Plotting on top of Images::
+* Color Conversion::
 
 Object Oriented Programming
 
@@ -740,24 +744,24 @@
 
 GUI Development
 
-* I/O Dialogs::       
-* Progress Bar::       
-* GUI Utility Functions::       
-* User-Defined Preferences::       
+* I/O Dialogs::
+* Progress Bar::
+* GUI Utility Functions::
+* User-Defined Preferences::
 
 System Utilities
 
-* Timing Utilities::            
-* Filesystem Utilities::        
+* Timing Utilities::
+* Filesystem Utilities::
 * File Archiving Utilities::
 * Networking Utilities::
-* Controlling Subprocesses::    
-* Process ID Information::      
-* Environment Variables::       
-* Current Working Directory::   
-* Password Database Functions::  
-* Group Database Functions::    
-* System Information::          
+* Controlling Subprocesses::
+* Process ID Information::
+* Environment Variables::
+* Current Working Directory::
+* Password Database Functions::
+* Group Database Functions::
+* System Information::
 * Hashing Functions::
 
 Networking Utilities
@@ -778,58 +782,58 @@
 * How to make Java classes available?::
 * How to create an instance of a Java class?::
 * How can I handle memory limitations?::
-* Which @TeX{} symbols are implemented in the dialog functions?::
+* Which @TeX{} symbols are implemented in dialog functions?::
 
 Packages
 
-* Installing and Removing Packages::  
-* Using Packages::              
-* Administrating Packages::     
-* Creating Packages::           
+* Installing and Removing Packages::
+* Using Packages::
+* Administrating Packages::
+* Creating Packages::
 
 Creating Packages
 
-* The DESCRIPTION File::        
-* The INDEX File::              
-* PKG_ADD and PKG_DEL Directives::  
+* The DESCRIPTION File::
+* The INDEX File::
+* PKG_ADD and PKG_DEL Directives::
 
 External Code Interface
 
-* Oct-Files::                   
-* Mex-Files::                   
-* Standalone Programs::         
+* Oct-Files::
+* Mex-Files::
+* Standalone Programs::
 
 Oct-Files
 
-* Getting Started with Oct-Files::  
-* Matrices and Arrays in Oct-Files::  
-* Character Strings in Oct-Files::  
-* Cell Arrays in Oct-Files::    
-* Structures in Oct-Files::  
-* Sparse Matrices in Oct-Files::  
-* Accessing Global Variables in Oct-Files::  
-* Calling Octave Functions from Oct-Files::  
-* Calling External Code from Oct-Files::  
-* Allocating Local Memory in Oct-Files::  
-* Input Parameter Checking in Oct-Files::  
-* Exception and Error Handling in Oct-Files::  
-* Documentation and Test of Oct-Files::  
+* Getting Started with Oct-Files::
+* Matrices and Arrays in Oct-Files::
+* Character Strings in Oct-Files::
+* Cell Arrays in Oct-Files::
+* Structures in Oct-Files::
+* Sparse Matrices in Oct-Files::
+* Accessing Global Variables in Oct-Files::
+* Calling Octave Functions from Oct-Files::
+* Calling External Code from Oct-Files::
+* Allocating Local Memory in Oct-Files::
+* Input Parameter Checking in Oct-Files::
+* Exception and Error Handling in Oct-Files::
+* Documentation and Test of Oct-Files::
 
 Sparse Matrices in Oct-Files
 
-* Array and Sparse Differences::  
-* Creating Sparse Matrices in Oct-Files::  
-* Using Sparse Matrices in Oct-Files::  
+* Array and Sparse Class Differences::
+* Creating Sparse Matrices in Oct-Files::
+* Using Sparse Matrices in Oct-Files::
 
 Mex-Files
 
-* Getting Started with Mex-Files::  
-* Working with Matrices and Arrays in Mex-Files::  
-* Character Strings in Mex-Files::  
-* Cell Arrays with Mex-Files::  
-* Structures with Mex-Files::  
-* Sparse Matrices with Mex-Files::  
-* Calling Other Functions in Mex-Files::  
+* Getting Started with Mex-Files::
+* Working with Matrices and Arrays in Mex-Files::
+* Character Strings in Mex-Files::
+* Cell Arrays with Mex-Files::
+* Structures with Mex-Files::
+* Sparse Matrices with Mex-Files::
+* Calling Other Functions in Mex-Files::
 
 Test and Demo Functions
 
@@ -856,12 +860,12 @@
 Trouble
 
 * Actual Bugs::                 Bugs we will fix later.
-* Reporting Bugs::              
-* Service::                     
+* Reporting Bugs::
+* Service::
 
 Reporting Bugs
 
-* Bug Criteria::                
+* Bug Criteria::
 * Bug Tracker::        Where to submit your bug report.
 * Bug Reporting::      How to report a bug effectively.
 * Sending Patches::    How to send a patch for Octave.
@@ -881,15 +885,15 @@
 
 Emacs Octave Support
 
-* Installing EOS::              
-* Using Octave Mode::           
-* Running Octave from Within Emacs::  
-* Using the Emacs Info Reader for Octave::  
+* Installing EOS::
+* Using Octave Mode::
+* Running Octave from Within Emacs::
+* Using the Emacs Info Reader for Octave::
 
 Grammar and Parser
 
-* Keywords::                    
-* Parser::                    
+* Keywords::
+* Parser::
 
 @end detailmenu
 @end menu
--- a/doc/interpreter/oop.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/oop.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -94,9 +94,7 @@
 our polynomial might look like
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/polynomial.m)
-@end group
 @end example
 
 Note that the return value of the constructor must be the output of
@@ -177,9 +175,7 @@
 An example of a display method for the polynomial class might be
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/display.m)
-@end group
 @end example
 
 @noindent
@@ -195,9 +191,7 @@
 all of the properties of the class.  For example:
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/get.m)
-@end group
 @end example
 
 @noindent
@@ -205,9 +199,7 @@
 object to modify, and then take property/value pairs to be modified. 
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/set.m)
-@end group
 @end example
 
 @noindent
@@ -276,15 +268,13 @@
 
 @DOCSTRING(subsref)
 
-For example we might decide that indexing with "()" evaluates the
-polynomial and indexing with "@{@}" returns the @var{n}-th coefficient (of
-@var{n}-th power).  In this case the @code{subsref} method of our polynomial
-class might look like
+For example we might decide that indexing with @qcode{"()"} evaluates the
+polynomial and indexing with @qcode{"@{@}"} returns the @var{n}-th coefficient
+(of @var{n}-th power).  In this case the @code{subsref} method of our
+polynomial class might look like
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/subsref.m)
-@end group
 @end example
 
 The equivalent functionality for subscripted assignments uses the 
@@ -640,21 +630,19 @@
 @end example
 
 @noindent
-That mixes an object of the class "double" with an object of the class
-"polynomial".  In this case we like to ensure that the return type of
-the above is of the type "polynomial" and so we use the
+That mixes an object of the class @qcode{"double"} with an object of the class
+@qcode{"polynomial"}.  In this case we like to ensure that the return type of
+the above is of the type @qcode{"polynomial"} and so we use the
 @code{superiorto} function in the class constructor.  In particular our
 polynomial class constructor would be modified to be
 
 @example
-@group
 @EXAMPLEFILE(@polynomial/polynomial_superiorto.m)
-@end group
 @end example
 
 Note that user classes always have higher precedence than built-in
 Octave types.  So in fact marking our polynomial class higher than the 
-"double" class is in fact not necessary.
+@qcode{"double"} class is in fact not necessary.
 
 When faced with two objects that have the same precedence, Octave will use the
 method of the object that appears first on the list of arguments.
@@ -692,9 +680,7 @@
 FIRfilter.m in the class directory.
 
 @example
-@group
 @EXAMPLEFILE(@FIRfilter/FIRfilter.m)
-@end group
 @end example
 
 As before, the leading comments provide command-line documentation for
@@ -758,12 +744,10 @@
 to access the fields.  The @code{subsref} method may be used for both.
 
 @example
-@group
 @EXAMPLEFILE(@FIRfilter/subsref.m)
-@end group
 @end example
 
-The "()" case allows us to filter data using the polynomial provided
+The @qcode{"()"} case allows us to filter data using the polynomial provided
 to the constructor.
 
 @example
@@ -781,7 +765,7 @@
 @end group
 @end example
 
-The "." case allows us to view the contents of the polynomial field.
+The @qcode{"."} case allows us to view the contents of the polynomial field.
 
 @example
 @group
@@ -819,9 +803,7 @@
 constructor for this case might be
 
 @example
-@group
 @EXAMPLEFILE(@FIRfilter/FIRfilter_aggregation.m)
-@end group
 @end example
 
 For our example, the remaining class methods remain unchanged.
--- a/doc/interpreter/optim.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/optim.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -25,10 +25,10 @@
 Minimization.
 
 @menu
-* Linear Programming::       
-* Quadratic Programming::       
-* Nonlinear Programming::       
-* Linear Least Squares::        
+* Linear Programming::
+* Quadratic Programming::
+* Nonlinear Programming::
+* Linear Least Squares::
 @end menu
 
 @c @cindex linear programming
--- a/doc/interpreter/package.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/package.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -71,7 +71,7 @@
 
 @noindent
 In this case only version 1.0.0 of the @code{image} package is
-installed.  The '*' character next to the package name shows that the
+installed.  The @qcode{'*'} character next to the package name shows that the
 image package is loaded and ready for use.
 
 It is possible to remove a package from the system using the
@@ -217,7 +217,7 @@
 This is an optional file describing old entries from the @file{NEWS} file.
 
 @cindex PKG_ADD
-@anchor{docXPKG_ADD}
+@anchor{XREFPKG_ADD}
 @item package/PKG_ADD
 An optional file that includes commands that are run when the package
 is added to the users path.  Note that @w{@code{PKG_ADD}} directives in the
@@ -242,7 +242,7 @@
 directives.
 
 @cindex PKG_DEL
-@anchor{docXPKG_DEL}
+@anchor{XREFPKG_DEL}
 @item package/PKG_DEL
 An optional file that includes commands that are run when the package
 is removed from the users path.  Note that @w{@code{PKG_DEL}} directives in
@@ -469,7 +469,7 @@
 @end itemize
 
 @noindent
-The format can be summarized with the following example.
+The format can be summarized with the following example:
 
 @example
 @group
@@ -571,6 +571,7 @@
 @noindent
 In both cases @code{some_octave_command} should be replaced by the
 command that should be placed in the @w{@code{PKG_ADD}} file.
-@w{@code{PKG_DEL}} directives work in the same way, except the @w{@code{PKG_ADD}}
-keyword is replaced with @w{@code{PKG_DEL}} and the commands get added
-to the @w{@code{PKG_DEL}} file.
+@w{@code{PKG_DEL}} directives work in the same way, except the
+@w{@code{PKG_ADD}} keyword is replaced with @w{@code{PKG_DEL}} and the commands
+get added to the @w{@code{PKG_DEL}} file.
+
--- a/doc/interpreter/plot.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/plot.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -22,10 +22,10 @@
 @cindex graphics
 
 @menu
-* Introduction to Plotting::    
-* High-Level Plotting::         
-* Graphics Data Structures::    
-* Advanced Plotting::           
+* Introduction to Plotting::
+* High-Level Plotting::
+* Graphics Data Structures::
+* Advanced Plotting::
 @end menu
 
 @node Introduction to Plotting
@@ -34,8 +34,8 @@
 Earlier versions of Octave provided plotting through the use of
 gnuplot.  This capability is still available.  But, a newer plotting
 capability is provided by access to OpenGL@.  Which plotting system
-is used is controlled by the @code{graphics_toolkit} function.  (See
-@ref{Graphics Toolkits}.)
+is used is controlled by the @code{graphics_toolkit} function.
+@xref{Graphics Toolkits}.
 
 The function call @code{graphics_toolkit ("fltk")} selects the
 FLTK/OpenGL system, and @code{graphics_toolkit ("gnuplot")} selects the
@@ -57,26 +57,25 @@
 and @ref{Advanced Plotting}.
 
 @menu
-* Two-Dimensional Plots::       
-* Three-Dimensional Plots::  
-* Plot Annotations::            
-* Multiple Plots on One Page::  
-* Multiple Plot Windows::       
-* Use of axis@comma{} line@comma{} and patch Functions::
+* Two-Dimensional Plots::
+* Three-Dimensional Plots::
+* Plot Annotations::
+* Multiple Plots on One Page::
+* Multiple Plot Windows::
 * Manipulation of Plot Windows::
 * Use of the @code{interpreter} Property::
-* Printing and Saving Plots::              
-* Interacting with Plots::      
-* Test Plotting Functions::     
+* Printing and Saving Plots::
+* Interacting with Plots::
+* Test Plotting Functions::
 @end menu
 
 @node Two-Dimensional Plots
 @subsection Two-Dimensional Plots
 
 @menu
-* Axis Configuration::  
-* Two-dimensional Function Plotting::  
-* Two-dimensional Geometric Shapes::  
+* Axis Configuration::
+* Two-dimensional Function Plotting::
+* Two-dimensional Geometric Shapes::
 @end menu
 
 The @code{plot} function allows you to create simple x-y plots with
@@ -253,8 +252,11 @@
 The @code{xlim}, @code{ylim}, and @code{zlim} functions may be used to
 get or set individual axis limits.  Each has the same form.
 
-@anchor{docXylim}
-@anchor{docXzlim}
+@c Add cross-references and function index entries for other limit functions.
+@anchor{XREFylim}
+@anchor{XREFzlim}
+@findex ylim
+@findex zlim
 @DOCSTRING(xlim)
 
 @node Two-dimensional Function Plotting
@@ -396,16 +398,16 @@
 
 @menu
 * Aspect Ratio::
-* Three-dimensional Function Plotting::  
-* Three-dimensional Geometric Shapes::  
+* Three-dimensional Function Plotting::
+* Three-dimensional Geometric Shapes::
 @end menu
 
 @node Aspect Ratio
 @subsubsection Aspect Ratio
 
 For three-dimensional plots the aspect ratio can be set for data with
-@code{daspect} and for the plot box with @code{pbaspect}.  
-See @ref{Axis Configuration} for controlling the x-, y-, and z-limits for
+@code{daspect} and for the plot box with @code{pbaspect}.
+@xref{Axis Configuration}, for controlling the x-, y-, and z-limits for
 plotting.
 
 @DOCSTRING(daspect)
@@ -464,8 +466,8 @@
 
 See @ref{Text Properties} for the properties that you can set.
 
-@anchor{docXylabel}
-@anchor{docXzlabel}
+@anchor{XREFylabel}
+@anchor{XREFzlabel}
 @DOCSTRING(xlabel)
 
 @DOCSTRING(clabel)
@@ -523,23 +525,6 @@
 
 @DOCSTRING(figure)
 
-@node Use of axis@comma{} line@comma{} and patch Functions
-@subsection Use of axis@comma{} line@comma{} and patch Functions
-
-You can create axes, line, and patch objects directly using the
-@code{axes}, @code{line}, and @code{patch} functions.  These objects
-become children of the current axes object.
-
-@DOCSTRING(axes)
-
-@DOCSTRING(line)
-
-@DOCSTRING(patch)
-
-@DOCSTRING(fill)
-
-@DOCSTRING(surface)
-
 @node Manipulation of Plot Windows
 @subsection Manipulation of Plot Windows
 
@@ -603,16 +588,16 @@
 @subsection Use of the @code{interpreter} Property
 
 All text objects, including titles, labels, legends, and text, include
-the property 'interpreter', this property determines the manner in which
+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 'none', then no rendering occurs.  At this point the 'latex'
-option is not implemented and so the 'latex' interpreter also does not
-interpret the text.
-
-The 'tex' option implements a subset of @TeX{} functionality in the
+is set to @qcode{"none"}, then no rendering occurs.  At this point the
+@qcode{"latex"} option is not implemented and so the @qcode{"latex"}
+interpreter also does not interpret the text.
+
+The @qcode{"tex"} option implements a subset of @TeX{} functionality in the
 rendering of the text.  This allows the insertion of special characters
 such as Greek or mathematical symbols within the text.  The special
-characters are also inserted with a code starting with the back-slash
+characters are also inserted with a code starting with the backslash
 (\) character, as in the table @ref{tab:extended}.
 
 In addition, the formatting of the text can be changed within the string
@@ -633,7 +618,7 @@
 @end example
 
 @noindent
-where the character 'a' will not appear in a bold font.  Note that to
+where the character @qcode{'a'} will not appear in a bold font.  Note that to
 avoid having Octave interpret the backslash characters in the strings,
 the strings should be in single quotes.
 
@@ -645,178 +630,251 @@
 use @tab
 @end multitable
 
-Finally, the superscript and subscripting can be controlled with the '^'
-and '_' characters.  If the '^' or '_' is followed by a @{ character,
-then all of the block surrounded by the @{ @} pair is super- or
-sub-scripted.  Without the @{ @} pair, only the character immediately
-following the '^' or '_' is super- or sub-scripted.
+Finally, the superscript and subscripting can be controlled with the @qcode{'^'}
+and @qcode{'_'} characters.  If the @qcode{'^'} or @qcode{'_'} is followed by a
+@{ character, then all of the block surrounded by the @{ @} pair is super- or
+sub-scripted.  Without the @{ @} pair, only the character immediately following
+the @qcode{'^'} or @qcode{'_'} is super- or sub-scripted.
 
 @float Table,tab:extended
 @tex
 \vskip 6pt
-{\hbox to \hsize {\hfill\vbox{\offinterlineskip \tabskip=0pt
+\newdimen\cola \cola=78pt
+\newdimen\colb \colb=78pt
+\newdimen\colc \colc=78pt
+\def\symtable#1#2#3{
+\hbox to \hsize {\hfill\vbox{\offinterlineskip \tabskip=0pt
+\hskip36pt #1
+\vskip6pt
 \halign{
-\vrule height2.0ex depth1.ex width 0.6pt #\tabskip=0.3em &
-# \hfil & \vrule # & # \hfil & # \vrule &
-# \hfil & \vrule # & # \hfil & # \vrule &
-# \hfil & \vrule # & # \hfil & # \vrule
+\vrule height2.0ex depth1.ex width 0.6pt #2\tabskip=0.3em &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule
 width 0.6pt \tabskip=0pt\cr
 \noalign{\hrule height 0.6pt}
 & Code && Sym && Code && Sym && Code && Sym &\cr
 \noalign{\hrule}
-& $\backslash$forall    && $\forall$
-&& $\backslash$exists   && $\exists$
-&& $\backslash$ni       && $\ni$       &\cr
-& $\backslash$cong      && $\cong$
-&& $\backslash$Delta    && $\Delta$
-&& $\backslash$Phi      && $\Phi$      &\cr
-& $\backslash$Gamma     && $\Gamma$
-&& $\backslash$vartheta && $\vartheta$
-&& $\backslash$Lambda   && $\Lambda$   &\cr
-& $\backslash$Pi        && $\Pi$
-&& $\backslash$Theta    && $\Theta$
-&& $\backslash$Sigma    && $\Sigma$    &\cr
-& $\backslash$varsigma  && $\varsigma$
-&& $\backslash$Omega    && $\Omega$
-&& $\backslash$Xi       && $\Xi$       &\cr
-& $\backslash$Psi       && $\Psi$
-&& $\backslash$perp     && $\perp$
-&& $\backslash$alpha    && $\alpha$    &\cr
-& $\backslash$beta      && $\beta$
-&& $\backslash$chi      && $\chi$
-&& $\backslash$delta    && $\delta$    &\cr
-& $\backslash$epsilon   && $\epsilon$
-&& $\backslash$phi      && $\phi$
-&& $\backslash$gamma    && $\gamma$    &\cr
-& $\backslash$eta       && $\eta$
-&& $\backslash$iota     && $\iota$
-&& $\backslash$varphi   && $\varphi$   &\cr
-& $\backslash$kappa     && $\kappa$
-&& $\backslash$lambda   && $\lambda$
-&& $\backslash$mu       && $\mu$       &\cr
-& $\backslash$nu        && $\nu$
-&& $\backslash$o        && $\o$
-&& $\backslash$pi       && $\pi$       &\cr
-& $\backslash$theta     && $\theta$
-&& $\backslash$rho      && $\rho$
-&& $\backslash$sigma    && $\sigma$    &\cr
-& $\backslash$tau       && $\tau$
-&& $\backslash$upsilon  && $\upsilon$
-&& $\backslash$varpi    && $\varpi$    &\cr
-& $\backslash$omega     && $\omega$
-&& $\backslash$xi       && $\xi$
-&& $\backslash$psi      && $\psi$      &\cr
-& $\backslash$zeta      && $\zeta$
-&& $\backslash$sim      && $\sim$
-&& $\backslash$Upsilon  && $\Upsilon$  &\cr
-& $\backslash$prime     && $\prime$
-&& $\backslash$leq      && $\leq$
-&& $\backslash$infty    && $\infty$    &\cr
-& $\backslash$clubsuit  && $\clubsuit$
-&& $\backslash$diamondsuit    && $\diamondsuit$
-&& $\backslash$heartsuit      && $\heartsuit$     &\cr
-& $\backslash$spadesuit       && $\spadesuit$
-&& $\backslash$leftrightarrow && $\leftrightarrow$
-&& $\backslash$leftarrow      && $\leftarrow$     &\cr
-& $\backslash$uparrow         && $\uparrow$
-&& $\backslash$rightarrow     && $\rightarrow$
-&& $\backslash$downarrow      && $\downarrow$     &\cr
-& $\backslash$circ      && $\circ$
-&& $\backslash$pm       && $\pm$
-&& $\backslash$geq      && $\geq$      &\cr
-& $\backslash$times     && $\times$
-&& $\backslash$propto   && $\propto$
-&& $\backslash$partial  && $\partial$  &\cr
-& $\backslash$bullet    && $\bullet$
-&& $\backslash$div      && $\div$
-&& $\backslash$neq      && $\neq$      &\cr
-& $\backslash$equiv     && $\equiv$
-&& $\backslash$approx   && $\approx$
-&& $\backslash$ldots    && $\ldots$ &\cr
-& $\backslash$mid       && $\mid$
-&& $\backslash$aleph    && $\aleph$
-&& $\backslash$Im       && $\Im$ &\cr
-& $\backslash$Re        && $\Re$
-&& $\backslash$wp       && $\wp$
-&& $\backslash$otimes   && $\otimes$ &\cr
-& $\backslash$oplus     && $\oplus$
-&& $\backslash$oslash   && $\oslash$
-&& $\backslash$cap      && $\cap$ &\cr
-& $\backslash$cup       && $\cup$
-&& $\backslash$supset   && $\supset$
-&& $\backslash$supseteq && $\supseteq$ &\cr
-& $\backslash$subset    && $\subset$
-&& $\backslash$subseteq && $\subseteq$
-&& $\backslash$in       && $\in$ &\cr
-& $\backslash$notin     && $\notin$
-&& $\backslash$angle    && $\angle$
-&& $\backslash$bigtriangledown && $\bigtriangledown$ &\cr
-& $\backslash$langle    && $\langle$
-&& $\backslash$rangle   && $\rangle$
-&& $\backslash$nabla    && $\nabla$    &\cr
-& $\backslash$prod      && $\prod$
-&& $\backslash$surd     && $\surd$
-&& $\backslash$cdot     && $\cdot$     &\cr
-& $\backslash$neg       && $\neg$
-&& $\backslash$wedge    && $\wedge$
-&& $\backslash$vee      && $\vee$      &\cr
-& $\backslash$Leftrightarrow && $\Leftrightarrow$
-&& $\backslash$Leftarrow     && $\Leftarrow$
-&& $\backslash$Uparrow       && $\Uparrow$           &\cr
-& $\backslash$Rightarrow     && $\Rightarrow$
-&& $\backslash$Downarrow     && $\Downarrow$
-&& $\backslash$diamond  && $\diamond$  &\cr
-& $\backslash$copyright && $\copyright$
-&& $\backslash$rfloor   && $\rfloor$
-&& $\backslash$lceil    && $\lceil$    &\cr
-& $\backslash$lfloor    && $\lfloor$
-&& $\backslash$rceil    && $\rceil$
-&& $\backslash$int      && $\int$      &\cr
+#3
 \noalign{\hrule height 0.6pt}
-}}\hfill}}
+}
+}\hfill}}
+\hoffset72pt
+\symtable{Greek Lowercase Letters} {#}
+{& \hbox to \cola{$\backslash$alpha }    && $\alpha$
+&& \hbox to \colb{$\backslash$beta }     && $\beta$
+&& \hbox to \colc{$\backslash$gamma}     && $\gamma$     &\cr
+& $\backslash$delta      && $\delta$
+&& $\backslash$epsilon   && $\epsilon$
+&& $\backslash$zeta      && $\zeta$      &\cr
+& $\backslash$eta        && $\eta$
+&& $\backslash$theta     && $\theta$
+&& $\backslash$vartheta  && $\vartheta$  &\cr
+& $\backslash$iota       && $\iota$
+&& $\backslash$kappa     && $\kappa$
+&& $\backslash$lambda    && $\lambda$    &\cr
+& $\backslash$mu         && $\mu$
+&& $\backslash$nu        && $\nu$
+&& $\backslash$xi        && $\xi$        &\cr
+& $\backslash$o          && $o$
+&& $\backslash$pi        && $\pi$
+&& $\backslash$varpi     && $\varpi$     &\cr
+& $\backslash$rho        && $\rho$
+&& $\backslash$sigma     && $\sigma$
+&& $\backslash$varsigma  && $\varsigma$  &\cr
+& $\backslash$tau        && $\tau$
+&& $\backslash$upsilon   && $\upsilon$
+&& $\backslash$phi       && $\phi$       &\cr
+& $\backslash$chi        && $\chi$
+&& $\backslash$psi       && $\psi$
+&& $\backslash$omega     && $\omega$     &\cr}
+\vskip12pt
+\symtable{Greek Uppercase Letters} {#}
+{& \hbox to \cola{$\backslash$Gamma}   && $\Gamma$
+&& \hbox to \colb{$\backslash$Delta}   && $\Delta$
+&& \hbox to \colc{$\backslash$Theta}   && $\Theta$      &\cr
+& $\backslash$Lambda   && $\Lambda$
+&& $\backslash$Xi      && $\Xi$
+&& $\backslash$Pi      && $\Pi$         &\cr
+& $\backslash$Sigma    && $\Sigma$
+&& $\backslash$Upsilon && $\Upsilon$
+&& $\backslash$Phi     && $\Phi$        &\cr
+& $\backslash$Psi      && $\Psi$
+&& $\backslash$Omega   && $\Omega$
+&&    &&       &\cr}
+\vskip12pt
+\symtable{Misc Symbols Type Ord} {#}
+{& \hbox to \cola{$\backslash$aleph}       && $\aleph$
+&& \hbox to \colb{$\backslash$wp}          && $\wp$
+&& \hbox to \colc{$\backslash$Re}          && $\Re$      &\cr
+& $\backslash$Im           && $\Im$
+&& $\backslash$partial     && $\partial$
+&& $\backslash$infty       && $\infty$       &\cr
+& $\backslash$prime        && $\prime$
+&& $\backslash$nabla       && $\nabla$
+&& $\backslash$surd        && $\surd$        &\cr
+& $\backslash$angle        && $\angle$
+&& $\backslash$forall      && $\forall$
+&& $\backslash$exists      && $\exists$      &\cr
+& $\backslash$neg          && $\neg$
+&& $\backslash$clubsuit    && $\clubsuit$
+&& $\backslash$diamondsuit && $\diamondsuit$ &\cr
+& $\backslash$heartsuit    && $\heartsuit$
+&& $\backslash$spadesuit   && $\spadesuit$
+&&    &&       &\cr}
+\vskip12pt
+\symtable{``Large'' Operators} {#}
+{& \hbox to \cola{$\backslash$int}   && $\int$
+&& \hbox to \colb{}   &&
+&& \hbox to \colc{}   &&       &\cr}
+\vskip12pt
+\symtable{Binary operators} {#}
+{& \hbox to \cola{$\backslash$pm}     && $\pm$
+&& \hbox to \colb{$\backslash$cdot}   && $\cdot$
+&& \hbox to \colc{$\backslash$times}  && $\times$      &\cr
+& $\backslash$ast     && $\ast$
+&& $\backslash$circ   && $\circ$
+&& $\backslash$bullet && $\bullet$     &\cr
+& $\backslash$div     && $\div$
+&& $\backslash$cap    && $\cap$
+&& $\backslash$cup    && $\cup$        &\cr
+& $\backslash$vee     && $\vee$
+&& $\backslash$wedge  && $\wedge$
+&& $\backslash$oplus  && $\oplus$      &\cr
+& $\backslash$otimes  && $\otimes$
+&& $\backslash$oslash && $\oslash$
+&&    &&      &\cr}
 @end tex
 @ifnottex
-@multitable @columnfractions .125 .25 .25 .25 .125
-@item @tab  \forall     @tab  \exists     @tab  \ni      @tab
-@item @tab  \cong       @tab  \Delta      @tab  \Phi     @tab
-@item @tab  \Gamma      @tab  \vartheta   @tab  \Lambda  @tab
-@item @tab  \Pi         @tab  \Theta      @tab  \Sigma   @tab
-@item @tab  \varsigma   @tab  \Omega      @tab  \Xi      @tab
-@item @tab  \Psi        @tab  \perp       @tab  \alpha   @tab
-@item @tab  \beta       @tab  \chi        @tab  \delta   @tab
-@item @tab  \epsilon    @tab  \phi        @tab  \gamma   @tab
-@item @tab  \eta        @tab  \iota       @tab  \varphi  @tab
-@item @tab  \kappa      @tab  \lambda     @tab  \mu      @tab
-@item @tab  \nu         @tab  \o          @tab  \pi      @tab
-@item @tab  \theta      @tab  \rho        @tab  \sigma   @tab
-@item @tab  \tau        @tab  \upsilon    @tab  \varpi   @tab
-@item @tab  \omega      @tab  \xi         @tab  \psi     @tab
-@item @tab  \zeta       @tab  \sim        @tab  \Upsilon @tab
-@item @tab  \prime      @tab  \leq        @tab  \infty   @tab
-@item @tab  \clubsuit   @tab  \diamondsuit    @tab  \heartsuit  @tab
-@item @tab  \spadesuit  @tab  \leftrightarrow @tab  \leftarrow  @tab
-@item @tab  \uparrow    @tab  \rightarrow @tab  \downarrow @tab
-@item @tab  \circ       @tab \pm          @tab  \geq     @tab
-@item @tab  \times      @tab  \propto     @tab  \partial @tab
-@item @tab  \bullet     @tab \div         @tab  \neq     @tab
-@item @tab  \equiv      @tab  \approx     @tab  \ldots   @tab
-@item @tab  \mid        @tab  \aleph      @tab  \Im      @tab
-@item @tab  \Re         @tab \wp          @tab  \otimes  @tab
-@item @tab  \oplus      @tab \oslash      @tab  \cap     @tab
-@item @tab  \cup        @tab   \supset    @tab  \supseteq @tab
-@item @tab  \subset     @tab \subseteq    @tab  \in      @tab
-@item @tab  \notin      @tab \angle       @tab  \bigrightriangledown @tab
-@item @tab  \langle     @tab  \rangle     @tab  \nabla   @tab
-@item @tab  \prod       @tab \surd        @tab  \cdot    @tab
-@item @tab  \neg        @tab  \wedge      @tab \vee      @tab
-@item @tab  \Leftrightarrow @tab \Leftarrow @tab \Uparrow @tab
-@item @tab  \Rightarrow @tab \Downarrow   @tab \diamond  @tab
-@item @tab  \copyright  @tab  \lfloor     @tab  \lceil   @tab
-@item @tab  \rfloor     @tab  \rceil      @tab  \int     @tab
+@multitable @columnfractions .25 .25 .25 .25
+@item Greek Lowercase Letters
+@item @tab  \alpha      @tab  \beta        @tab  \gamma
+@item @tab  \delta      @tab  \epsilon     @tab  \zeta
+@item @tab  \eta        @tab  \theta       @tab  \vartheta
+@item @tab  \iota       @tab  \kappa       @tab  \lambda
+@item @tab  \mu         @tab  \nu          @tab  \xi
+@item @tab  \o          @tab  \pi          @tab  \varpi
+@item @tab  \rho        @tab  \sigma       @tab  \varsigma
+@item @tab  \tau        @tab  \upsilon     @tab  \phi
+@item @tab  \chi        @tab  \psi         @tab  \omega
+@item Greek Uppercase Letters
+@item @tab  \Gamma      @tab  \Delta       @tab  \Theta
+@item @tab  \Lambda     @tab  \Xi          @tab  \Pi
+@item @tab  \Sigma      @tab  \Upsilon     @tab  \Phi
+@item @tab  \Psi        @tab  \Omega       @tab
+@item Misc Symbols Type Ord
+@item @tab  \aleph      @tab  \wp          @tab  \Re
+@item @tab  \Im         @tab  \partial     @tab  \infty
+@item @tab  \prime      @tab  \nabla       @tab  \surd
+@item @tab  \angle      @tab  \forall      @tab  \exists
+@item @tab  \neg        @tab  \clubsuit    @tab  \diamondsuit
+@item @tab  \heartsuit  @tab  \spadesuit   @tab
+@item ``Large'' Operators
+@item @tab  \int
+@item Binary Operators
+@item @tab  \pm         @tab  \cdot        @tab  \times
+@item @tab  \ast        @tab  \circ        @tab  \bullet
+@item @tab  \div        @tab  \cap         @tab  \cup
+@item @tab  \vee        @tab  \wedge       @tab  \oplus
+@item @tab  \otimes     @tab  \oslash      @tab
+@item Relations
+@item @tab  \leq        @tab  \subset      @tab  \subseteq
+@item @tab  \in         @tab  \geq         @tab  \supset
+@item @tab  \supseteq   @tab  \ni          @tab  \mid
+@item @tab  \equiv      @tab  \sim         @tab  \approx
+@item @tab  \cong       @tab  \propto      @tab  \perp
+@item Arrows
+@item @tab  \leftarrow  @tab  \Leftarrow   @tab  \rightarrow
+@item @tab  \Rightarrow @tab  \leftrightarrow @tab  \uparrow
+@item @tab  \downarrow  @tab               @tab
+@item Openings and Closings
+@item @tab  \lfloor     @tab  \langle      @tab  \lceil
+@item @tab  \rfloor     @tab  \rangle      @tab  \rceil
+@item Alternate Names
+@item @tab  \neq
+@item Other
+@item @tab  \ldots      @tab  \0          @tab  \copyright
+@item @tab  \deg
 @end multitable
 @end ifnottex
 @caption{Available special characters in @TeX{} mode}
 @end float
+@float
+@tex
+\vskip 6pt
+\newdimen\cola \cola=78pt
+\newdimen\colb \colb=78pt
+\newdimen\colc \colc=78pt
+\def\symtable#1#2#3{\hbox to \hsize {\hfill\vbox{\offinterlineskip \tabskip=0pt
+\hskip36pt #1
+\vskip6pt
+\halign{
+\vrule height2.0ex depth1.ex width 0.6pt #2\tabskip=0.3em &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
+#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule
+width 0.6pt \tabskip=0pt\cr
+\noalign{\hrule height 0.6pt}
+& Code && Sym && Code && Sym && Code && Sym &\cr
+\noalign{\hrule}
+#3
+\noalign{\hrule height 0.6pt}
+}
+}\hfill}}
+\hoffset72pt
+\vskip12pt
+\symtable{Relations} {#}
+{& \hbox to \cola{$\backslash$leq}      && $\leq$
+&& \hbox to \colb{$\backslash$subset}   && $\subset$
+&& \hbox to \colc{$\backslash$subseteq} && $\subseteq$    &\cr
+& $\backslash$in        && $\in$
+&& $\backslash$geq      && $\geq$
+&& $\backslash$supset   && $\supset$      &\cr
+& $\backslash$supseteq  && $\supseteq$
+&& $\backslash$ni       && $\ni$
+&& $\backslash$mid      && $\mid$         &\cr
+& $\backslash$equiv     && $\equiv$
+&& $\backslash$sim      && $\sim$
+&& $\backslash$approx   && $\approx$      &\cr
+& $\backslash$cong      && $\cong$
+&& $\backslash$propto   && $\propto$
+&& $\backslash$perp     && $\perp$        &\cr}
+\vskip12pt
+\symtable{Arrows} {#}
+{& \hbox to \cola{$\backslash$leftarrow}      && $\leftarrow$
+&& \hbox to \colb{$\backslash$Leftarrow}      && $\Leftarrow$
+&& \hbox to \colc{$\backslash$rightarrow}     && $\rightarrow$      &\cr
+& $\backslash$Rightarrow      && $\Rightarrow$
+&& $\backslash$leftrightarrow && $\leftrightarrow$
+&& $\backslash$uparrow        && $\uparrow$         &\cr
+& $\backslash$downarrow       && $\downarrow$
+&&   && 
+&&   &&       &\cr}
+\vskip12pt
+\symtable{Openings and Closings} {#}
+{& \hbox to \cola{$\backslash$lfloor   }    && $\lfloor$
+&& \hbox to \colb{$\backslash$langle   }    && $\langle$
+&& \hbox to \colc{$\backslash$lceil    }    && $\lceil$      &\cr
+& $\backslash$rfloor    && $\rfloor$
+&& $\backslash$rangle   && $\rangle$
+&& $\backslash$rceil    && $\rceil$      &\cr}
+\vskip12pt
+\symtable{Alternate Names} {#}
+{& \hbox to \cola{$\backslash$neq}   && $\neq$
+&& \hbox to \colb{}   && 
+&& \hbox to \colc{}   &&   &\cr}
+\vskip12pt
+\symtable{Other (not in Appendix F Tables)} {#}
+{& \hbox to \cola{$\backslash$ldots}     && $\ldots$
+&& \hbox to \colb{$\backslash$0}         && $\oslash$
+&& \hbox to \colc{$\backslash$copyright} && $\copyright$      &\cr
+& $\backslash$deg        && $^\circ$
+&&    &&  
+&&    &&       &\cr}
+\vskip12pt
+\hskip36pt Table 15.1: Available special characters in \TeX\ mode (cont.)
+@end tex
+@end float
 
 A complete example showing the capabilities of the extended text is
 
@@ -903,17 +961,17 @@
 @cindex graphics data structures
 
 @menu
-* Introduction to Graphics Structures::  
-* Graphics Objects::            
-* Graphics Object Properties::  
-* Searching Properties::        
-* Managing Default Properties::  
+* Introduction to Graphics Structures::
+* Graphics Objects::
+* Graphics Object Properties::
+* Searching Properties::
+* Managing Default Properties::
 @end menu
 
 @node Introduction to Graphics Structures
 @subsection Introduction to Graphics Structures
 @cindex introduction to graphics structures
-@anchor{docXgraphics structures}
+@anchor{XREFgraphics structures}
 
 The graphics functions use pointers, which are of class graphics_handle, in
 order to address the data structures which control graphical displays.  A
@@ -933,7 +991,7 @@
 @code{contourf}, @code{contour3}, @code{surf}, @code{mesh}, @code{surfc},
 @code{meshc}, @code{errorbar}, @code{quiver}, @code{quiver3}, @code{scatter},
 @code{scatter3}, @code{stair}, @code{stem}, @code{stem3} each return a handle
-as documented in @ref{docXdatasources,, Data Sources}.
+as documented in @ref{XREFdatasources,,Data Sources}.
 
 
 The graphics objects are arranged in a hierarchy:
@@ -950,9 +1008,9 @@
 @code{surface}, and @code{image} objects.
 
 Graphics handles may be distinguished from function handles
-(@ref{Function Handles}) by means of the function @code{ishandle}.
-@code{ishandle} returns true if its argument is a handle of a graphics object. 
-In addition, the figure object may be tested using @code{isfigure}. 
+(@pxref{Function Handles}) by means of the function @code{ishandle}.
+@code{ishandle} returns true if its argument is a handle of a graphics object.
+In addition, the figure object may be tested using @code{isfigure}.
 @code{isfigure} returns true only if its argument is a handle of a figure.  The
 @code{whos} function can be used to show the object type of each currently
 defined graphics handle.  (Note: this is not true today, but it is, I hope,
@@ -965,8 +1023,8 @@
 properties of graphics objects.  In addition, the @code{get} command may be
 used to obtain property names.
 
-For example, the property "type" of the graphics object pointed to by the
-graphics handle h may be displayed by:
+For example, the property @qcode{"type"} of the graphics object pointed to by
+the graphics handle h may be displayed by:
 
 @example
 get (h, "type")
@@ -977,7 +1035,7 @@
 allowed properties are wanted they may be displayed by:
 @code{get (h, "")}.
 
-Thus, for example,
+Thus, for example:
 
 @smallexample
 h = figure ();
@@ -1001,7 +1059,7 @@
 color                 paperposition        windowbuttondownfcn
 colormap              paperpositionmode    windowbuttonmotionfcn
 createfcn             papersize            windowbuttonupfcn
-currentaxes           papertype            windowbuttonwheelfcn
+currentaxes           papertype            windowscrollwheelfcn
 currentcharacter      paperunits           windowstyle
 currentobject         parent               wvisual
 currentpoint          pointer              wvisualmode
@@ -1016,7 +1074,7 @@
 @code{get (0, "")}.
 
 The uses of @code{get} and @code{set} are further explained in
-@ref{docXget,,get}, @ref{docXset,,set}.
+@ref{XREFget,,get}, @ref{XREFset,,set}.
 
 @DOCSTRING(isprop)
 
@@ -1024,8 +1082,8 @@
 @subsection Graphics Objects
 @cindex graphics objects
 
-The hierarchy of graphics objects was explained above.  (See 
-@ref{Introduction to Graphics Structures}.  Here the
+The hierarchy of graphics objects was explained above.
+@xref{Introduction to Graphics Structures}.  Here the
 specific objects are described, and the properties contained in
 these objects are discussed.  Keep in mind that
 graphics objects are always referenced by @dfn{handle}.
@@ -1077,16 +1135,36 @@
 @c @end group
 @end table
 
+@subsubsection Creating Graphics Objects
+@cindex creating graphics objects
+
+You can create axes, line, patch, and surface objects directly using the
+@code{axes}, @code{line}, @code{patch}, @code{fill}, and @code{surface}
+functions.  These objects become children of the current axes object.
+
+@DOCSTRING(axes)
+
+@DOCSTRING(line)
+
+@DOCSTRING(patch)
+
+@DOCSTRING(fill)
+
+@DOCSTRING(surface)
+
 @subsubsection Handle Functions
 @cindex handle functions
 
-To determine whether a variable is a graphics object index or a figure
-index, use the functions @code{ishandle} and @code{isfigure}.
+To determine whether a variable is a graphics object index, or an index
+to an axes or figure, use the functions @code{ishandle}, @code{isaxes}, and
+@code{isfigure}.
 
 @DOCSTRING(ishandle)
 
 @DOCSTRING(ishghandle)
 
+@DOCSTRING(isaxes)
+
 @DOCSTRING(isfigure)
 
 The function @code{gcf} returns an index to the current figure object,
@@ -1175,9 +1253,9 @@
 Figures can be printed or saved in many graphics formats with @code{print} and
 @code{saveas}.  Occasionally, however, it may be useful to save the original
 Octave handle graphic directly so that further modifications can be made such
-as modifying a title or legend.  
-
-This can be accomplished with the following functions by 
+as modifying a title or legend.
+
+This can be accomplished with the following functions by
 
 @example
 @group
@@ -1200,14 +1278,14 @@
 @cindex graphics object properties
 
 @menu
-* Root Figure Properties::      
-* Figure Properties::           
-* Axes Properties::             
-* Line Properties::             
-* Text Properties::             
-* Image Properties::            
-* Patch Properties::            
-* Surface Properties::          
+* Root Figure Properties::
+* Figure Properties::
+* Axes Properties::
+* Line Properties::
+* Text Properties::
+* Image Properties::
+* Patch Properties::
+* Surface Properties::
 @end menu
 
 In this Section the object properties are discussed in detail, starting
@@ -1221,13 +1299,13 @@
 The @code{root figure} properties are:
 
 @table @code
-@item __modified__  
---- Values: "on," "off"
+@item __modified__
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item __myhandle__
 
-@item beingdeleted  
---- Values: "on," "off"
+@item beingdeleted
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item busyaction
 
@@ -1238,7 +1316,7 @@
 @item children
 
 @item clipping
- --- Values: "on," "off"
+ --- Values: @qcode{"on"}, @qcode{"off"}
 
 @item createfcn
 
@@ -1246,14 +1324,14 @@
 
 @item deletefcn
 
-@item handlevisibility  
---- Values: "on," "off"
+@item handlevisibility
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item hittest
---- Values: "on," "off"
-
-@item interruptible  
---- Values: "on," "off"
+--- Values: @qcode{"on"}, @qcode{"off"}
+
+@item interruptible
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item parent
 
@@ -1271,8 +1349,8 @@
 
 @item screenpixelsperinch
 
-@item showhiddenhandles  
---- Values: "on," "off"
+@item showhiddenhandles
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item tag
 
@@ -1294,7 +1372,7 @@
 The @code{figure} properties are:
 
 @table @code
-@item __graphics_toolkit__  
+@item __graphics_toolkit__
 --- The graphics toolkit currently in use.
 
 @item __enhanced__
@@ -1307,8 +1385,8 @@
 
 @item alphamap
 
-@item beingdeleted 
---- Values: "on," "off"
+@item beingdeleted
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item busyaction
 
@@ -1318,9 +1396,9 @@
 Handle to children.
 
 @item clipping
---- Values: "on," "off"
-
-@item closerequestfcn 
+--- Values: @qcode{"on"}, @qcode{"off"}
+
+@item closerequestfcn
 --- Handle of function to call on close.
 
 @item color
@@ -1332,7 +1410,7 @@
 
 @item createfcn
 
-@item currentaxes 
+@item currentaxes
 Handle to graphics object of current axes.
 
 @item currentcharacter
@@ -1342,36 +1420,36 @@
 @item currentpoint
 Holds the coordinates of the point over which the mouse pointer was when
 the mouse button was pressed.  If a mouse callback function is defined,
-@code{"currentpoint"} holds the coordinates of the point over which the
+@qcode{"currentpoint"} holds the coordinates of the point over which the
 mouse pointer is when the function gets called.
 
 @item deletefcn
 
-@item dockcontrols 
---- Values: "on," "off"
-
-@item doublebuffer 
---- Values: "on," "off"
+@item dockcontrols
+--- Values: @qcode{"on"}, @qcode{"off"}
+
+@item doublebuffer
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item filename
 
-@item handlevisibility 
---- Values: "on," "off"
+@item handlevisibility
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item hittest
 
 @item integerhandle
 
-@item interruptible 
---- Values: "on," "off"
+@item interruptible
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item inverthardcopy
 
 @item keypressfcn
-see @code{"keypressfcn"}
+see @qcode{"keypressfcn"}
 
 @item keyreleasefcn
-With @code{"keypressfcn"}, The keyboard callback functions.  These
+With @qcode{"keypressfcn"}, the keyboard callback functions.  These
 callback functions get called when a key is pressed/released
 respectively.  The functions are called with two input arguments.  The
 first argument holds the handle of the calling figure.  The second
@@ -1386,8 +1464,8 @@
 
 @item Modifier
 A cell array containing strings representing the modifiers pressed with
-the key.  Possible values are @code{"shift"}, @code{"alt"}, and
-@code{"control"}.
+the key.  Possible values are @qcode{"shift"}, @qcode{"alt"}, and
+@qcode{"control"}.
 @end table
 
 @item menubar
@@ -1399,21 +1477,21 @@
 @item nextplot
 May be one of
 
-@table @code
-@item "new"
-
-@item "add"
-
-@item "replace"
-
-@item "replacechildren"
+@table @asis
+@item @qcode{"new"}
+
+@item @qcode{"add"}
+
+@item @qcode{"replace"}
+
+@item @qcode{"replacechildren"}
 @end table
 
 @item numbertitle
 
 @item paperorientation
-Indicates the orientation for printing.  Either @code{"landscape"} or
-@code{"portrait"}.
+Indicates the orientation for printing.  Either @qcode{"landscape"} or
+@qcode{"portrait"}.
 
 @item paperposition
 
@@ -1443,8 +1521,8 @@
 
 @item selected
 
-@item selectionhighlight 
---- Values: "on," "off"
+@item selectionhighlight
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item selectiontype
 
@@ -1459,22 +1537,22 @@
 @item userdata
 
 @item visible
-Either @code{"on"} or @code{"off"} to toggle display of the figure.
+Either @qcode{"on"} or @qcode{"off"} to toggle display of the figure.
 
 @item windowbuttondownfcn
-See @code{"windowbuttonupfcn"}
+See @qcode{"windowbuttonupfcn"}
 
 @item windowbuttonmotionfcn
-See @code{"windowbuttonupfcn"}
+See @qcode{"windowbuttonupfcn"}
 
 @item windowbuttonupfcn
-With @code{"windowbuttondownfcn"} and @code{"windowbuttonmotionfcn"},
-The mouse callback functions.  These callback functions get called when
+With @qcode{"windowbuttondownfcn"} and @qcode{"windowbuttonmotionfcn"},
+the mouse callback functions.  These callback functions get called when
 the mouse button is pressed, dragged, and released respectively.  When
-these callback functions are called, the @code{"currentpoint"} property
+these callback functions are called, the @qcode{"currentpoint"} property
 holds the current coordinates of the cursor.
 
-@item windowbuttonwheelfcn
+@item windowscrollwheelfcn
 
 @item windowstyle
 
@@ -1511,8 +1589,8 @@
 @item beingdeleted
 
 @item box
-Box surrounding axes. 
---- Values: "on," "off"
+Box surrounding axes.
+--- Values: @qcode{"on"}, @qcode{"off"}
 
 @item busyaction
 
@@ -1540,10 +1618,10 @@
 Two-element vector defining the limits for the c axis of
 an image.  See @code{pcolor} property.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item climmode
-Either @code{"manual"} or @code{"auto"}.
+Either @qcode{"manual"} or @qcode{"auto"}.
 
 @item clipping
 
@@ -1556,7 +1634,7 @@
 @item currentpoint
 Holds the coordinates of the point over which the mouse pointer was when
 the mouse button was pressed.  If a mouse callback function is defined,
-@code{"currentpoint"} holds the coordinates of the point over which the
+@qcode{"currentpoint"} holds the coordinates of the point over which the
 mouse pointer is when the function gets called.
 
 @item dataaspectratio
@@ -1565,10 +1643,10 @@
 2]} causes the length of one unit as displayed on the y-axis to be the
 same as the length of 2 units on the x-axis.  Setting
 @code{dataaspectratio} also forces the @code{dataaspectratiomode}
-property to be set to @code{"manual"}.
-
-@item dataaspectratiomode 
-Either @code{"manual"} or @code{"auto"}.
+property to be set to @qcode{"manual"}.
+
+@item dataaspectratiomode
+Either @qcode{"manual"} or @qcode{"auto"}.
 
 @item deletefcn
 
@@ -1605,14 +1683,12 @@
 @item nextplot
 May be one of
 
-@table @code
-@item "new"
-
-@item "add"
-
-@item "replace"
-
-@item "replacechildren"
+@table @asis
+@item @qcode{"add"}
+
+@item @qcode{"replace"}
+
+@item @qcode{"replacechildren"}
 @end table
 
 @item outerposition
@@ -1670,7 +1746,7 @@
 A three element vector specifying the view point for three-dimensional plots.
 
 @item visible
-Either @code{"on"} or @code{"off"} to toggle display of the axes.
+Either @qcode{"on"} or @qcode{"off"} to toggle display of the axes.
 
 @item x_normrendertransform
 
@@ -1682,16 +1758,16 @@
 
 @item x_viewtransform
 
-@item xaxislocation 
-Either @code{"top"} or @code{"bottom"}.
+@item xaxislocation
+Either @qcode{"top"} or @qcode{"bottom"}.
 
 @item xcolor
 
 @item xdir
-Either @code{"forward"} or @code{"reverse"}.
+Either @qcode{"forward"} or @qcode{"reverse"}.
 
 @item xgrid
-Either @code{"on"} or @code{"off"} to toggle display of grid lines.
+Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
 
 @item xlabel
 Indices to text objects for the axes labels.
@@ -1699,44 +1775,44 @@
 @item xlim
 Two-element vector defining the limits for the x-axis.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item xlimmode
-Either @code{"manual"} or @code{"auto"}.
-
-@item xminorgrid 
-Either @code{"on"} or @code{"off"} to toggle display of minor grid lines.
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item xminorgrid
+Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
 
 @item xminortick
 
 @item xscale
-Either @code{"linear"} or @code{"log"}.
+Either @qcode{"linear"} or @qcode{"log"}.
 
 @item xtick
 Set position of tick marks.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item xticklabel
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
-
-@item xticklabelmode 
-Either @code{"manual"} or @code{"auto"}.
-
-@item xtickmode 
-Either @code{"manual"} or @code{"auto"}.
-
-@item yaxislocation 
-Either @code{"left"} or @code{"right"}
+property to be set to @qcode{"manual"}.
+
+@item xticklabelmode
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item xtickmode
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item yaxislocation
+Either @qcode{"left"} or @qcode{"right"}
 
 @item ycolor
 
 @item ydir
-Either @code{"forward"} or @code{"reverse"}.
+Either @qcode{"forward"} or @qcode{"reverse"}.
 
 @item ygrid
-Either @code{"on"} or @code{"off"} to toggle display of grid lines.
+Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
 
 @item ylabel
 Indices to text objects for the axes labels.
@@ -1744,41 +1820,41 @@
 @item ylim
 Two-element vectors defining the limits for the x, y, and z axes and the
 Setting one of these properties also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item ylimmode
-Either @code{"manual"} or @code{"auto"}.
-
-@item yminorgrid 
-Either @code{"on"} or @code{"off"} to toggle display of minor grid lines.
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item yminorgrid
+Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
 
 @item yminortick
 
 @item yscale
-Either @code{"linear"} or @code{"log"}.
+Either @qcode{"linear"} or @qcode{"log"}.
 
 @item ytick
 Set position of tick marks.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item yticklabel
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
-
-@item yticklabelmode 
-Either @code{"manual"} or @code{"auto"}.
-
-@item ytickmode 
-Either @code{"manual"} or @code{"auto"}.
+property to be set to @qcode{"manual"}.
+
+@item yticklabelmode
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item ytickmode
+Either @qcode{"manual"} or @qcode{"auto"}.
 
 @item zcolor
 
 @item zdir
-Either @code{"forward"} or @code{"reverse"}.
+Either @qcode{"forward"} or @qcode{"reverse"}.
 
 @item zgrid
-Either @code{"on"} or @code{"off"} to toggle display of grid lines.
+Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
 
 @item zlabel
 Indices to text objects for the axes labels.
@@ -1786,33 +1862,33 @@
 @item zlim
 Two-element vector defining the limits for z-axis.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
+property to be set to @qcode{"manual"}.
 
 @item zlimmode
-Either @code{"manual"} or @code{"auto"}.
-
-@item zminorgrid 
-Either @code{"on"} or @code{"off"} to toggle display of minor grid lines.
+Either @qcode{"manual"} or @qcode{"auto"}.
+
+@item zminorgrid
+Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
 
 @item zminortick
 
 @item zscale
-Either @code{"linear"} or @code{"log"}.
+Either @qcode{"linear"} or @qcode{"log"}.
 
 @item ztick
 Set position of tick marks.
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
-
-@item zticklabel 
+property to be set to @qcode{"manual"}.
+
+@item zticklabel
 Setting this property also forces the corresponding mode
-property to be set to @code{"manual"}.
-
-@item zticklabelmode 
-Either @code{"manual"} or @code{"auto"}.
+property to be set to @qcode{"manual"}.
+
+@item zticklabelmode
+Either @qcode{"manual"} or @qcode{"auto"}.
 
 @item ztickmode
-Either @code{"manual"} or @code{"auto"}.
+Either @qcode{"manual"} or @qcode{"auto"}.
 
 @end table
 
@@ -1860,7 +1936,7 @@
 @item ldata
 The lower errorbar in the y direction to be plotted.
 
-@item linestyle
+@item  linestyle
 @itemx linewidth
 @xref{Line Styles}.
 
@@ -1968,8 +2044,8 @@
 @item erasemode
 
 @item fontangle
-Flag whether the font is italic or normal.  Valid values are 'normal',
-'italic' and 'oblique'.
+Flag whether the font is italic or normal.  Valid values are @qcode{"normal"},
+@qcode{"italic"}, and @qcode{"oblique"}.
 
 @item fontname
 The font used for the text.
@@ -1980,19 +2056,19 @@
 @item fontunits
 
 @item fontweight
-Flag whether the font is bold, etc.  Valid values are 'normal', 'bold',
-'demi' or 'light'.
+Flag whether the font is bold, etc.  Valid values are @qcode{"normal"},
+@qcode{"bold"}, @qcode{"demi"}, or @qcode{"light"}.
 
 @item handlevisibility
 
 @item hittest
 
 @item horizontalalignment
-May be @code{"left"}, @code{"center"}, or @code{"right"}.
+May be @qcode{"left"}, @qcode{"center"}, or @qcode{"right"}.
 
 @item interpreter
-Determines how the text is rendered.  Valid values are 'none', 'tex' or
-'latex'.
+Determines how the text is rendered.  Valid values are @qcode{"none"},
+@qcode{"tex"}, or @qcode{"latex"}.
 
 @item interruptible
 
@@ -2024,7 +2100,7 @@
 @item uicontextmenu
 
 @item units
-May be @code{"normalized"} or @code{"graph"}.
+May be @qcode{"normalized"} or @qcode{"graph"}.
 
 @item userdata
 
@@ -2435,8 +2511,8 @@
 Although default values may be set for any object, they are set in
 parent objects and apply to child objects, of the specified object type.
 For example, setting the default @code{color} property of @code{line}
-objects to "green", for the @code{root} object, will result in all
-@code{line} objects inheriting the @code{color} "green" as the default
+objects to @qcode{"green"}, for the @code{root} object, will result in all
+@code{line} objects inheriting the @code{color} @qcode{"green"} as the default
 value.
 
 @example
@@ -2484,7 +2560,7 @@
 from the global root figure parent object.
 
 To remove a user-defined default setting, set the default property to
-the value @code{"remove"}.  For example,
+the value @qcode{"remove"}.  For example,
 
 @example
 set (gca (), "defaultlinecolor", "remove");
@@ -2497,7 +2573,7 @@
 
 @DOCSTRING(reset)
 
-Getting the @code{"default"} property of an object returns a list of
+Getting the @qcode{"default"} property of an object returns a list of
 user-defined defaults set for the object.  For example,
 
 @example
@@ -2523,13 +2599,13 @@
 
 
 @menu
-* Colors::                      
-* Line Styles::                 
-* Marker Styles::               
-* Callbacks::                   
+* Colors::
+* Line Styles::
+* Marker Styles::
+* Callbacks::
 * Application-defined Data::
-* Object Groups::               
-* Graphics Toolkits::           
+* Object Groups::
+* Graphics Toolkits::
 @end menu
 
 
@@ -2539,9 +2615,9 @@
 @cindex colors, graphics
 
 Colors may be specified as RGB triplets with values ranging from zero to
-one, or by name.  Recognized color names include @code{"blue"},
-@code{"black"}, @code{"cyan"}, @code{"green"}, @code{"magenta"},
-@code{"red"}, @code{"white"}, and @code{"yellow"}.
+one, or by name.  Recognized color names include @qcode{"blue"},
+@qcode{"black"}, @qcode{"cyan"}, @qcode{"green"}, @qcode{"magenta"},
+@qcode{"red"}, @qcode{"white"}, and @qcode{"yellow"}.
 
 @node Line Styles
 @subsection Line Styles
@@ -2567,7 +2643,7 @@
 @item "-."
 A dash-dot line.
 
-@item "none"
+@item @qcode{"none"}
 No line.  Points will still be marked using the current Marker Style.
 @end table
 
@@ -2586,14 +2662,14 @@
 @table @code
 @item marker
 A character indicating a plot marker to be place at each data point, or
-@code{"none"}, meaning no markers should be displayed.
+@qcode{"none"}, meaning no markers should be displayed.
 
 @item markeredgecolor
-The color of the edge around the marker, or @code{"auto"}, meaning that
+The color of the edge around the marker, or @qcode{"auto"}, meaning that
 the edge color is the same as the face color.  @xref{Colors}.
 
 @item markerfacecolor
-The color of the marker, or @code{"none"} to indicate that the marker
+The color of the marker, or @qcode{"none"} to indicate that the marker
 should not be filled.  @xref{Colors}.
 
 @item markersize
@@ -2681,7 +2757,7 @@
 function described below.
 
 @node Application-defined Data
-@subsection Application-defined Data 
+@subsection Application-defined Data
 @cindex application-defined data
 
 Octave has a provision for attaching application-defined data to a graphics
@@ -2824,23 +2900,23 @@
 corresponding hggroup elements.
 
 @menu
-* Data Sources in Object Groups::  
-* Area Series::                 
-* Bar Series::                  
-* Contour Groups::              
-* Error Bar Series::            
-* Line Series::                 
-* Quiver Group::                
-* Scatter Group::               
-* Stair Group::                 
-* Stem Series::                 
-* Surface Group::               
+* Data Sources in Object Groups::
+* Area Series::
+* Bar Series::
+* Contour Groups::
+* Error Bar Series::
+* Line Series::
+* Quiver Group::
+* Scatter Group::
+* Stair Group::
+* Stem Series::
+* Surface Group::
 @end menu
 
 @node Data Sources in Object Groups
 @subsubsection Data Sources in Object Groups
 @cindex data sources in object groups
-@anchor{docXdatasources}
+@anchor{XREFdatasources}
 All of the group objects contain data source parameters.  There are
 string parameters that contain an expression that is evaluated to update
 the relevant data property of the group when the @code{refreshdata}
@@ -2848,7 +2924,7 @@
 
 @DOCSTRING(refreshdata)
 
-@anchor{docXlinkdata}
+@anchor{XREFlinkdata}
 @c add the description of the linkdata function here when it is written
 @c remove the explicit anchor when you add the corresponding @DOCSTRING
 @c command
@@ -2866,23 +2942,23 @@
 @item basevalue
 The value where the base of the area plot is drawn.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the edge of the patch objects making up the
 areas.  @xref{Line Styles}.
 
-@item edgecolor
+@item  edgecolor
 @itemx facecolor
-The line and fill color of the patch objects making up the areas. 
+The line and fill color of the patch objects making up the areas.
 @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 The x and y coordinates of the original columns of the data passed to
 @code{area} prior to the cumulative summation used in the @code{area}
 function.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 Data source variables.
 @end table
@@ -2897,12 +2973,12 @@
 The properties of the bar series are
 
 @table @code
-@item showbaseline
+@item  showbaseline
 @itemx baseline
 @itemx basevalue
 The property @code{showbaseline} flags whether the baseline of the bar
-series is displayed (default is "on").  The handle of the graphics object
-representing the baseline is given by the @code{baseline} property and
+series is displayed (default is @qcode{"on"}).  The handle of the graphics
+object representing the baseline is given by the @code{baseline} property and
 the y-value of the baseline by the @code{basevalue} property.
 
 Changes to any of these property are propagated to the other members of
@@ -2910,24 +2986,24 @@
 properties of the base line itself are propagated to the members of the
 corresponding bar series.
 
-@item barwidth
+@item  barwidth
 @itemx barlayout
 @itemx horizontal
 The property @code{barwidth} is the width of the bar corresponding to
 the @var{width} variable passed to @code{bar} or @var{barh}.  Whether the
-bar series is "grouped" or "stacked" is determined by the
+bar series is @qcode{"grouped"} or @qcode{"stacked"} is determined by the
 @code{barlayout} property and whether the bars are horizontal or
 vertical by the @code{horizontal} property.
 
 Changes to any of these property are propagated to the other members of
 the bar series.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the edge of the patch objects making up the
 bars.  @xref{Line Styles}.
 
-@item edgecolor
+@item  edgecolor
 @itemx facecolor
 The line and fill color of the patch objects making up the bars.  @xref{Colors}.
 
@@ -2938,7 +3014,7 @@
 @item ydata
 The y value of the bars in the @code{hggroup}.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 Data source variables.
 @end table
@@ -2959,37 +3035,37 @@
 create the contours of the plot.
 
 @item fill
-A radio property that can have the values "on" or "off" that flags whether the
-contours to plot are to be filled.
-
-@item zlevelmode
+A radio property that can have the values @qcode{"on"} or @qcode{"off"} that
+flags whether the contours to plot are to be filled.
+
+@item  zlevelmode
 @itemx zlevel
-The radio property @code{zlevelmode} can have the values "none", "auto" or
-"manual".  When its value is "none" there is no z component to the plotted
-contours.  When its value is "auto" the z value of the plotted contours is
-at the same value as the contour itself.  If the value is "manual", then the
-z value at which to plot the contour is determined by the @code{zlevel}
-property.
-
-@item levellistmode
+The radio property @code{zlevelmode} can have the values @qcode{"none"},
+@qcode{"auto"}, or @qcode{"manual"}.  When its value is @qcode{"none"} there is
+no z component to the plotted contours.  When its value is @qcode{"auto"} the z
+value of the plotted contours is at the same value as the contour itself.  If
+the value is @qcode{"manual"}, then the z value at which to plot the contour is
+determined by the @code{zlevel} property.
+
+@item  levellistmode
 @itemx levellist
 @itemx levelstepmode
 @itemx levelstep
-If @code{levellistmode} is "manual", then the levels at which to plot the
-contours is determined by @code{levellist}.  If @code{levellistmode} is
-set to "auto", then the distance between contours is determined by
-@code{levelstep}.  If both @code{levellistmode} and @code{levelstepmode}
-are set to "auto", then there are assumed to be 10 equal spaced contours.
-
-@item textlistmode
+If @code{levellistmode} is @qcode{"manual"}, then the levels at which to plot
+the contours is determined by @code{levellist}.  If @code{levellistmode} is set
+to @qcode{"auto"}, then the distance between contours is determined by
+@code{levelstep}.  If both @code{levellistmode} and @code{levelstepmode} are
+set to @qcode{"auto"}, then there are assumed to be 10 equal spaced contours.
+
+@item  textlistmode
 @itemx textlist
 @itemx textstepmode
 @itemx textstep
-If @code{textlistmode} is "manual", then the labeled contours
+If @code{textlistmode} is @qcode{"manual"}, then the labeled contours
 is determined by @code{textlist}.  If @code{textlistmode} is set to
-"auto", then the distance between labeled contours is determined by
+@qcode{"auto"}, then the distance between labeled contours is determined by
 @code{textstep}.  If both @code{textlistmode} and @code{textstepmode}
-are set to "auto", then there are assumed to be 10 equal spaced
+are set to @qcode{"auto"}, then there are assumed to be 10 equal spaced
 labeled contours.
 
 @item showtext
@@ -3006,16 +3082,16 @@
 The properties of the contour lines.  The properties @code{linewidth} and
 @code{linestyle} are similar to the corresponding properties for lines.  The
 property @code{linecolor} is a color property (@pxref{Colors}), that can also
-have the values of "none" or "auto".  If @code{linecolor} is "none", then no
-contour line is drawn.  If @code{linecolor} is "auto" then the line color is
-determined by the colormap.
-
-@item xdata
+have the values of @qcode{"none"} or @qcode{"auto"}.  If @code{linecolor} is
+@qcode{"none"}, then no contour line is drawn.  If @code{linecolor} is
+@qcode{"auto"} then the line color is determined by the colormap.
+
+@item  xdata
 @itemx ydata
 @itemx zdata
 The original x, y, and z data of the contour lines.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 Data source variables.
@@ -3032,21 +3108,21 @@
 
 @table @code
 @item color
-The RGB color or color name of the line objects of the error bars. 
+The RGB color or color name of the line objects of the error bars.
 @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the line objects of the error bars.  @xref{Line
 Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the markers on the error bars.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx ldata
 @itemx udata
@@ -3054,7 +3130,7 @@
 @itemx xudata
 The original x, y, l, u, xl, xu data of the error bars.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx ldatasource
 @itemx udatasource
@@ -3076,22 +3152,22 @@
 @item color
 The RGB color or color name of the line objects.  @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the line objects.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the markers.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx zdata
 The original x, y and z data.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 Data source variables.
@@ -3109,7 +3185,7 @@
 properties of the quiver series are
 
 @table @code
-@item autoscale
+@item  autoscale
 @itemx autoscalefactor
 Flag whether the length of the arrows is scaled or defined directly from
 the @var{u}, @var{v} and @var{w} data.  If the arrow length is flagged
@@ -3126,27 +3202,27 @@
 @item color
 The RGB color or color name of the line objects of the quiver.  @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the line objects of the quiver.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the marker objects at the original of the
 arrows.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx zdata
 The origins of the values of the vector field.
 
-@item udata
+@item  udata
 @itemx vdata
 @itemx wdata
 The values of the vector field to plot.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 @itemx udatasource
@@ -3169,12 +3245,12 @@
 @item linewidth
 The line width of the line objects of the points.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 The line and fill color of the markers of the points.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx zdata
 The original x, y and z data of the stems.
@@ -3187,7 +3263,7 @@
 The size data for the points of the plot.  Each point can its own size or a
 unique size can be specified.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 @itemx cdatasource
@@ -3208,21 +3284,21 @@
 @item color
 The RGB color or color name of the line objects of the stairs.  @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the line objects of the stairs.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the markers on the stairs.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 The original x and y data of the stairs.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 Data source variables.
 @end table
@@ -3238,11 +3314,11 @@
 are
 
 @table @code
-@item showbaseline
+@item  showbaseline
 @itemx baseline
 @itemx basevalue
 The property @code{showbaseline} flags whether the baseline of the
-stem series is displayed (default is "on").  The handle of the graphics
+stem series is displayed (default is @qcode{"on"}).  The handle of the graphics
 object representing the baseline is given by the @code{baseline}
 property and the y-value (or z-value for @code{stem3}) of the baseline
 by the @code{basevalue} property.
@@ -3255,22 +3331,22 @@
 @item color
 The RGB color or color name of the line objects of the stems.  @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the line objects of the stems.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the markers on the stems.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx zdata
 The original x, y and z data of the stems.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 Data source variables.
@@ -3291,26 +3367,26 @@
 @item edgecolor
 
 @item facecolor
-The RGB color or color name of the edges or faces of the surface. 
+The RGB color or color name of the edges or faces of the surface.
 @xref{Colors}.
 
-@item linewidth
+@item  linewidth
 @itemx linestyle
 The line width and style of the lines on the surface.  @xref{Line Styles}.
 
-@item marker
+@item  marker
 @itemx markeredgecolor
 @itemx markerfacecolor
 @itemx markersize
 The line and fill color of the markers on the surface.  @xref{Colors}.
 
-@item xdata
+@item  xdata
 @itemx ydata
 @itemx zdata
 @itemx cdata
 The original x, y, z and c data.
 
-@item xdatasource
+@item  xdatasource
 @itemx ydatasource
 @itemx zdatasource
 @itemx cdatasource
@@ -3331,7 +3407,7 @@
 @DOCSTRING(register_graphics_toolkit)
 
 @menu
-* Customizing Toolkit Behavior::    
+* Customizing Toolkit Behavior::
 @end menu
 
 @node Customizing Toolkit Behavior
--- a/doc/interpreter/plotimages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/plotimages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,7 +26,7 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d", typ];
   endif
 
   if (strcmp(typ , "txt"))
@@ -34,11 +34,17 @@
   elseif (strcmp (nm, "plot"))
     x = -10:0.1:10;
     plot (x, sin (x));
-    print (cstrcat (nm, ".", typ), d_typ)    
+    xlabel ("x");
+    ylabel ("sin (x)");
+    title ("Simple 2-D Plot");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "hist"))
     rand ("state", 2);
     hist (randn (10000, 1), 30);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    xlabel ("Value");
+    ylabel ("Count");
+    title ("Histogram of 10,000 normally distributed random numbers");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "errorbar"))
     rand ("state", 2);
     x = 0:0.1:10;
@@ -47,32 +53,47 @@
     yu = 0.1 .* rand (size (x));
     errorbar (x, sin (x), yl, yu);
     axis ([0, 10, -1.1, 1.1]);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    xlabel ("x");
+    ylabel ("sin (x)");
+    title ("Errorbar plot of sin (x)");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "polar"))
     polar (0:0.1:10*pi, 0:0.1:10*pi);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    title ("Example polar plot from 0 to 10*pi");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "mesh"))
     tx = ty = linspace (-8, 8, 41)';
     [xx, yy] = meshgrid (tx, ty);
     r = sqrt (xx .^ 2 + yy .^ 2) + eps;
     tz = sin (r) ./ r;
     mesh (tx, ty, tz);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    xlabel ("tx");
+    ylabel ("ty");
+    zlabel ("tz");
+    title ("3-D Sombrero plot");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "plot3"))
     t = 0:0.1:10*pi;
     r = linspace (0, 1, numel (t));
     z = linspace (0, 1, numel (t));
     plot3 (r.*sin(t), r.*cos(t), z);
-    print (cstrcat (nm, ".", typ), d_typ)    
+    xlabel ("r.*sin (t)");
+    ylabel ("r.*cos (t)");
+    zlabel ("z");
+    title ("plot3 display of 3-D helix");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "extended"))
     x = 0:0.01:3;
-    plot(x,erf(x));
+    plot (x,erf(x));
     hold on;
-    plot(x,x,"r");
-    axis([0, 3, 0, 1]);
-    text(0.65, 0.6175, cstrcat('\leftarrow x = {2/\surd\pi {\fontsize{16}',
-      '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175'))
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x,x,"r");
+    axis ([0, 3, 0, 1]);
+    text (0.65, 0.6175, ['\leftarrow x = {2/\surd\pi {\fontsize{16}' ...
+          '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175']);
+    xlabel ("x");
+    ylabel ("erf (x)");
+    title ("erf (x) with text annotation");
+    print ([nm "." typ], d_typ);
   else
     error ("unrecognized plot requested");
   endif
--- a/doc/interpreter/preface.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/preface.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -63,10 +63,10 @@
 you may have.
 
 @menu
-* Acknowledgements::            
+* Acknowledgements::
 * Citing Octave in Publications::
-* How You Can Contribute to Octave::  
-* Distribution::                
+* How You Can Contribute to Octave::
+* Distribution::
 @end menu
 
 @node Acknowledgements
--- a/doc/interpreter/quad.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/quad.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -24,9 +24,9 @@
 1-dimensional integration problems.
 
 @menu
-* Functions of One Variable:: 
-* Orthogonal Collocation::      
-* Functions of Multiple Variables:: 
+* Functions of One Variable::
+* Orthogonal Collocation::
+* Functions of Multiple Variables::
 @end menu
 
 @node Functions of One Variable
@@ -134,9 +134,10 @@
 is reasonably accurate (to see why, examine what happens to the result
 if you move the lower bound to 0.1, then 0.01, then 0.001, etc.).
 
-The function "f" can be the string name of a function, a function handle, or
-an inline function.  These options make it quite easy to do integration
-without having to fully define a function in an m-file.  For example:
+The function @qcode{"f"} can be the string name of a function, a function
+handle, or an inline function.  These options make it quite easy to do
+integration without having to fully define a function in an m-file.  For
+example:
 
 @example
 @group
--- a/doc/interpreter/signal.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/signal.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -19,18 +19,23 @@
 @node Signal Processing
 @chapter Signal Processing
 
-
 This chapter describes the signal processing and fast Fourier
 transform functions available in Octave.  Fast Fourier transforms are
 computed with the @sc{fftw} or @sc{fftpack} libraries depending on how
 Octave is built.
- 
-
-
-@DOCSTRING(detrend)
 
 @DOCSTRING(fft)
 
+@DOCSTRING(ifft)
+
+@DOCSTRING(fft2)
+
+@DOCSTRING(ifft2)
+
+@DOCSTRING(fftn)
+
+@DOCSTRING(ifftn)
+
 Octave uses the @sc{fftw} libraries to perform FFT computations.  When Octave
 starts up and initializes the @sc{fftw} libraries, they read a system wide
 file (on a Unix system, it is typically @file{/etc/fftw/wisdom}) that
@@ -45,16 +50,6 @@
 
 @DOCSTRING(fftw)
 
-@DOCSTRING(ifft)
-
-@DOCSTRING(fft2)
-
-@DOCSTRING(ifft2)
-
-@DOCSTRING(fftn)
-
-@DOCSTRING(ifftn)
-
 @DOCSTRING(fftconv)
 
 @DOCSTRING(fftfilt)
@@ -71,7 +66,7 @@
 
 @DOCSTRING(unwrap)
 
-@c FIXME -- someone needs to organize these...
+@c FIXME: someone needs to organize these ...
 
 @DOCSTRING(arch_fit)
 
@@ -87,6 +82,8 @@
 
 @DOCSTRING(blackman)
 
+@DOCSTRING(detrend)
+
 @DOCSTRING(diffpara)
 
 @DOCSTRING(durbinlevinson)
@@ -107,10 +104,6 @@
 
 @DOCSTRING(periodogram)
 
-@DOCSTRING(rectangle_lw)
-
-@DOCSTRING(rectangle_sw)
-
 @DOCSTRING(sinetone)
 
 @DOCSTRING(sinewave)
@@ -125,8 +118,5 @@
 
 @DOCSTRING(synthesis)
 
-@DOCSTRING(triangle_lw)
+@DOCSTRING(yulewalker)
 
-@DOCSTRING(triangle_sw)
-
-@DOCSTRING(yulewalker)
--- a/doc/interpreter/sparse.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/sparse.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,7 @@
 @set htmltex
 @end iftex
 
-@node Sparse Matrices 
+@node Sparse Matrices
 @chapter Sparse Matrices
 
 @menu
@@ -34,7 +34,7 @@
 @end menu
 
 @node Basics
-@section The Creation and Manipulation of Sparse Matrices
+@section Creation and Manipulation of Sparse Matrices
 
 The size of mathematical problems that can be treated at any particular
 time is generally limited by the available computing resources.  Both,
@@ -307,12 +307,11 @@
 
 The above problem of memory reallocation can be avoided in
 oct-files.  However, the construction of a sparse matrix from an oct-file
-is more complex than can be discussed here, and
-you are referred to chapter @ref{External Code Interface}, to have
-a full description of the techniques involved.
+is more complex than can be discussed here.  @xref{External Code Interface},
+for a full description of the techniques involved.
 
 @node Information
-@subsection Finding out Information about Sparse Matrices
+@subsection Finding Information about Sparse Matrices
 
 There are a number of functions that allow information concerning
 sparse matrices to be obtained.  The most basic of these is
@@ -342,7 +341,7 @@
 
 When solving linear equations involving sparse matrices Octave
 determines the means to solve the equation based on the type of the
-matrix as discussed in @ref{Sparse Linear Algebra}.  Octave probes the
+matrix (@pxref{Sparse Linear Algebra}).  Octave probes the
 matrix type when the div (/) or ldiv (\) operator is first used with
 the matrix and then caches the type.  However the @dfn{matrix_type}
 function can be used to determine the type of the sparse matrix prior
@@ -443,9 +442,9 @@
 @subsection Basic Operators and Functions on Sparse Matrices
 
 @menu
-* Sparse Functions::            
-* Return Types of Operators and Functions::  
-* Mathematical Considerations::  
+* Sparse Functions::
+* Return Types of Operators and Functions::
+* Mathematical Considerations::
 @end menu
 
 @node Sparse Functions
@@ -505,7 +504,7 @@
 details.
 
 @node Return Types of Operators and Functions
-@subsubsection The Return Types of Operators and Functions
+@subsubsection Return Types of Operators and Functions
 
 The two basic reasons to use sparse matrices are to reduce the memory 
 usage and to not have to do calculations on zero elements.  The two are
@@ -574,8 +573,8 @@
 same manner as there full counterparts.  However, there are certain differences
 and especially differences with other products sparse implementations.
 
-Firstly, the "./" and ".^" operators must be used with care.  Consider what
-the examples
+Firstly, the @qcode{"./"} and @qcode{".^"} operators must be used with care. 
+Consider what the examples
 
 @example
 @group
@@ -856,7 +855,7 @@
 @DOCSTRING(svds)
 
 @node Iterative Techniques
-@section Iterative Techniques applied to sparse matrices
+@section Iterative Techniques Applied to Sparse Matrices
 
 The left division @code{\} and right division @code{/} operators,
 discussed in the previous section, use direct solvers to resolve a
@@ -877,7 +876,7 @@
 @DOCSTRING(luinc)
 
 @node Real Life Example
-@section Real Life Example of the use of Sparse Matrices
+@section Real Life Example using Sparse Matrices
 
 A common application for sparse matrices is in the solution of Finite
 Element Models.  Finite element models allow numerical solution of
--- a/doc/interpreter/sparseimages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/sparseimages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,7 +26,7 @@
   if (__have_feature__ ("COLAMD")
       && __have_feature__ ("CHOLMOD")
       && __have_feature__ ("UMFPACK"))
-    if (strcmp(typ,"txt"))
+    if (strcmp (typ,"txt"))
       txtimages (nm, 15, typ);
     else
       if (strcmp (nm, "gplot"))
@@ -62,20 +62,20 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d" typ];
   endif
 
   A = sparse ([2,6,1,3,2,4,3,5,4,6,1,5],
               [1,1,2,2,3,3,4,4,5,5,6,6], 1, 6, 6);
   xy = [0,4,8,6,4,2;5,0,5,7,5,7]';
-  gplot (A, xy)
-  print (cstrcat (nm, ".", typ), d_typ)
+  gplot (A, xy);
+  print ([nm "." typ], d_typ);
   hide_output ();
 endfunction
 
-function txtimages(nm, n, typ)
-  a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ...
-      sparse(ceil([1:n]/2),1:n,1,n,n);
+function txtimages (nm, n, typ)
+  a = 10*speye (n) + sparse (1:n,ceil([1:n]/2),1,n,n) + ...
+      sparse (ceil ([1:n]/2),1:n,1,n,n);
   if (strcmp (nm, "gplot") || strcmp (nm, "grid"))
     fid = fopen (sprintf ("%s.txt", nm), "wt");
     fputs (fid, "\n");
@@ -84,51 +84,49 @@
     fputs (fid, "+---------------------------------+\n");
     fclose (fid);
   elseif (strcmp (nm, "spmatrix"))
-    printsparse(a,cstrcat("spmatrix.",typ));
+    printsparse (a, ["spmatrix." typ]);
   else
-    if (__have_feature__ ("COLAMD")
-        && __have_feature__ ("CHOLMOD"))
+    if (__have_feature__ ("COLAMD") && __have_feature__ ("CHOLMOD"))
       if (strcmp (nm, "spchol"))
-        r1 = chol(a);
-        printsparse(r1,cstrcat("spchol.",typ));
+        r1 = chol (a);
+        printsparse (r1, ["spchol." typ]);
       elseif (strcmp (nm, "spcholperm"))
-        [r2,p2,q2]=chol(a);
-        printsparse(r2,cstrcat("spcholperm.",typ));
+        [r2,p2,q2] = chol (a);
+        printsparse(r2, ["spcholperm." typ]);
       endif
       ## printf("Text NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2));
     endif
   endif
 endfunction
 
-function otherimages(nm, n, typ)
+function otherimages (nm, n, typ)
   hide_output ();
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d" typ];
   endif
 
-  a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ...
-      sparse(ceil([1:n]/2),1:n,1,n,n);
+  a = 10*speye (n) + sparse (1:n,ceil([1:n]/2),1,n,n) + ...
+      sparse (ceil ([1:n]/2),1:n,1,n,n);
   if (strcmp (nm, "spmatrix"))
-    spy(a);
-    axis("ij")
-    print(cstrcat("spmatrix.",typ), d_typ)
+    spy (a);
+    axis ("ij");
+    print (["spmatrix." typ], d_typ);
     hide_output ();
   else
-    if (__have_feature__ ("COLAMD")
-        && __have_feature__ ("CHOLMOD"))
+    if (__have_feature__ ("COLAMD") && __have_feature__ ("CHOLMOD"))
       if (strcmp (nm, "spchol"))
-        r1 = chol(a);
-        spy(r1);
-        axis("ij")
-        print(cstrcat("spchol.",typ), d_typ)
+        r1 = chol (a);
+        spy (r1);
+        axis ("ij");
+        print (["spchol." typ], d_typ);
         hide_output ();
       elseif (strcmp (nm, "spcholperm"))
-        [r2,p2,q2]=chol(a);
-        spy(r2);
-        axis("ij")
-        print(cstrcat("spcholperm.",typ), d_typ)
+        [r2,p2,q2] = chol (a);
+        spy (r2);
+        axis ("ij");
+        print (["spcholperm." typ], d_typ);
         hide_output ();
       endif
       ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2));
@@ -136,42 +134,42 @@
   endif
 endfunction
 
-function printsparse(a, nm)
+function printsparse (a, nm)
   fid = fopen (nm,"wt");
   fputs (fid, "\n");
-  for i = 1:size(a,1)
-    if (rem(i,5) == 0)
+  for i = 1:rows (a)
+    if (rem (i,5) == 0)
       fprintf (fid,"         %2d - ", i);
     else
       fprintf (fid,"            | ");
     endif
-    for j = 1:size(a,2)
+    for j = 1:columns (a)
       if (a(i,j) == 0)
-        fprintf(fid,"  ")
+        fprintf (fid,"  ");
       else
-        fprintf(fid," *")
+        fprintf (fid," *");
       endif
     endfor
-    fprintf(fid,"\n")
+    fprintf (fid,"\n");
   endfor
-  fprintf(fid,"            |-");
-  for j=1:size(a,2)
-    if (rem(j,5)==0)
-      fprintf(fid,"-|");
+  fprintf (fid,"            |-");
+  for j = 1:columns (a)
+    if (rem (j,5) == 0)
+      fprintf (fid,"-|");
     else
-      fprintf(fid,"--");
+      fprintf (fid,"--");
     endif
   endfor
-  fprintf(fid,"\n")
-  fprintf(fid,"              ");
-  for j=1:size(a,2)
-    if (rem(j,5)==0)
-      fprintf(fid,"%2d",j);
+  fprintf (fid,"\n");
+  fprintf (fid,"              ");
+  for j = 1:columns (a)
+    if (rem (j,5) == 0)
+      fprintf (fid,"%2d",j);
     else
-      fprintf(fid,"  ");
+      fprintf (fid,"  ");
     endif
   endfor
-  fclose(fid);
+  fclose (fid);
 endfunction
 
 function femimages (nm, typ)
@@ -179,36 +177,36 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d" typ];
   endif
 
   if (__have_feature__ ("COLAMD")
       && __have_feature__ ("CHOLMOD")
       && __have_feature__ ("UMFPACK"))
     ## build a rectangle
-    node_y = [1;1.2;1.5;1.8;2]*ones(1,11);
-    node_x = ones(5,1)*[1,1.05,1.1,1.2,1.3,1.5,1.7,1.8,1.9,1.95,2];
+    node_y = [1;1.2;1.5;1.8;2] * ones (1,11);
+    node_x = ones (5,1) * [1,1.05,1.1,1.2,1.3,1.5,1.7,1.8,1.9,1.95,2];
     nodes = [node_x(:), node_y(:)];
 
-    [h,w] = size(node_x);
+    [h,w] = size (node_x);
     elems = [];
-    for idx = 1:w-1
+    for idx = 1 : w-1
       widx = (idx-1)*h;
       elems = [elems; widx+[(1:h-1);(2:h);h+(1:h-1)]']; 
       elems = [elems; widx+[(2:h);h+(2:h);h+(1:h-1)]']; 
     endfor
 
-    E = size(elems,1);  #No. of elements
-    N = size(nodes,1);  #No. of elements
-    D = size(elems,2);  #dimensions+1
+    E = size (elems,1);  # No. of elements
+    N = size (nodes,1);  # No. of elements
+    D = size (elems,2);  # dimensions+1
 
     ## Plot FEM Geometry
     elemx = elems(:,[1,2,3,1])';
-    xelems = reshape( nodes(elemx, 1), 4, E);
-    yelems = reshape( nodes(elemx, 2), 4, E);
+    xelems = reshape (nodes(elemx, 1), 4, E);
+    yelems = reshape (nodes(elemx, 2), 4, E);
 
     ## Set element conductivity
-    conductivity = [1*ones(1,16),2*ones(1,48),1*ones(1,16)];
+    conductivity = [1*ones(1,16), 2*ones(1,48), 1*ones(1,16)];
 
     ## Dirichlet boundary conditions
     D_nodes = [1:5, 51:55]; 
@@ -221,43 +219,41 @@
     N_value = [];
 
     ## Calculate connectivity matrix
-    C = sparse((1:D*E), reshape(elems',D*E,1),1, D*E, N);
+    C = sparse ((1:D*E), reshape (elems',D*E,1),1, D*E, N);
 
     ## Calculate stiffness matrix
-    Siidx = floor([0:D*E-1]'/D)*D*ones(1,D) + ones(D*E,1)*(1:D) ;
-    Sjidx = [1:D*E]'*ones(1,D);
-    Sdata = zeros(D*E,D);
-    dfact = prod(2:(D-1));
+    Siidx = floor ([0:D*E-1]'/D)*D*ones(1,D) + ones(D*E,1)*(1:D);
+    Sjidx = [1:D*E]'*ones (1,D);
+    Sdata = zeros (D*E,D);
+    dfact = prod (2:(D-1));
     for j = 1:E
-      a = inv([ ones(D,1), nodes( elems(j,:), : ) ]);
-      const = conductivity(j)*2/dfact/abs(det(a));
-      Sdata(D*(j-1)+(1:D),:)= const * a(2:D,:)'*a(2:D,:);
+      a = inv ([ ones(D,1), nodes( elems(j,:), : ) ]);
+      const = conductivity(j)*2/dfact/abs (det (a));
+      Sdata(D*(j-1)+(1:D),:) = const * a(2:D,:)'*a(2:D,:);
     endfor
 
     ## Element-wise system matrix
-    SE = sparse(Siidx,Sjidx,Sdata);
+    SE = sparse (Siidx,Sjidx,Sdata);
     ## Global system matrix
     S = C'* SE *C;
 
     ## Set Dirichlet boundary
-    V = zeros(N,1);
+    V = zeros (N,1);
     V(D_nodes) = D_value;
     idx = 1:N;
     idx(D_nodes) = [];
 
     ## Set Neumann boundary
-    Q = zeros(N,1);
+    Q = zeros (N,1);
     Q(N_nodes) = N_value; # FIXME
 
-    V(idx) = S(idx,idx)\( Q(idx) - S(idx,D_nodes)*V(D_nodes) );
+    V(idx) = S(idx,idx) \ ( Q(idx) - S(idx,D_nodes)*V(D_nodes) );
 
-    velems = reshape( V(elemx), 4, E);
-
-    sz = size(xelems,2);
+    velems = reshape (V(elemx), 4, E);
 
     plot3 (xelems, yelems, velems);
     view (10, 10);
-    print(cstrcat(nm,".",typ), d_typ)
+    print ([nm "." typ], d_typ);
     hide_output ();
   endif
 endfunction
@@ -281,25 +277,22 @@
     if (strcmp (typ, "eps"))
       d_typ = "-depsc2";
     else
-      d_typ = cstrcat ("-d", typ);
+      d_typ = ["-d" typ];
     endif
 
-    x = y = linspace (-8, 8, 41)';
-    [xx, yy] = meshgrid (x, y);
-    r = sqrt (xx .^ 2 + yy .^ 2) + eps;
-    z = sin (r) ./ r;
+    [x, y, z] = sombrero ();
     unwind_protect
       mesh (x, y, z);
       title ("Sorry, graphics are unavailable because Octave was\ncompiled without a sparse matrix implementation.");
     unwind_protect_cleanup
-      print (cstrcat (nm, ".", typ), d_typ);
+      print ([nm "." typ], d_typ);
       hide_output ();
     end_unwind_protect
   endif
 endfunction
 
 ## generate something for the texinfo @image command to process
-function image_as_txt(nm)
+function image_as_txt (nm)
   fid = fopen (sprintf ("%s.txt", nm), "wt");
   fputs (fid, "\n");
   fputs (fid, "+---------------------------------+\n");
@@ -307,3 +300,4 @@
   fputs (fid, "+---------------------------------+\n");
   fclose (fid);
 endfunction
+
--- a/doc/interpreter/splineimages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/splineimages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,7 +26,7 @@
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
   else
-    d_typ = cstrcat ("-d", typ);
+    d_typ = ["-d" typ];
   endif
 
   if (strcmp (typ, "txt"))
@@ -43,11 +43,11 @@
     xx = linspace (0, 2 * pi, 400);
     y1 = ppval (pp1, xx);
     y2 = ppval (pp2, xx);
-    plot (x, y, ".", xx, [y1; y2])
-    axis tight
-    ylim ([-2.5 2.5])
-    legend ("data", "41 breaks, 40 pieces", "11 breaks, 10 pieces")
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x, y, ".", xx, [y1; y2]);
+    axis tight;
+    ylim ([-2.5 2.5]);
+    legend ("data", "41 breaks, 40 pieces", "11 breaks, 10 pieces");
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "splinefit2")) ## Spline orders
     ## Data (200 points)
     x = 2 * pi * rand (1, 200);
@@ -65,11 +65,11 @@
     y3 = ppval (pp3, xx);
     y4 = ppval (pp4, xx);
     y5 = ppval (pp5, xx);
-    plot (x, y, ".", xx, [y1; y2; y3; y4; y5])
-    axis tight
-    ylim ([-2.5 2.5])
-    legend ({"data", "order 0", "order 1", "order 2", "order 3", "order 4"})
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x, y, ".", xx, [y1; y2; y3; y4; y5]);
+    axis tight;
+    ylim ([-2.5 2.5]);
+    legend ({"data", "order 0", "order 1", "order 2", "order 3", "order 4"});
+    print ([nm, "." typ], d_typ);
   elseif (strcmp (nm, "splinefit3"))
     ## Data (100 points)
     x = 2 * pi * [0, (rand (1, 98)), 1];
@@ -82,11 +82,11 @@
     xx = linspace (0, 2 * pi, 400);
     y1 = ppval (pp1, xx);
     y2 = ppval (pp2, xx);
-    plot (x, y, ".", xx, [y1; y2])
-    axis tight
-    ylim ([-2 3])
-    legend ({"data", "no constraints", "periodic"})
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x, y, ".", xx, [y1; y2]);
+    axis tight;
+    ylim ([-2 3]);
+    legend ({"data", "no constraints", "periodic"});
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "splinefit4"))
     ## Data (200 points)
     x = 2 * pi * rand (1, 200);
@@ -105,11 +105,11 @@
     xx = linspace (0, 2 * pi, 400);
     y1 = ppval (pp1, xx);
     y2 = ppval (pp2, xx);
-    plot (x, y, ".", xx, [y1; y2])
-    axis tight
-    ylim ([-1.5 1.5])
-    legend({"data", "clamped", "hinged periodic"})
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x, y, ".", xx, [y1; y2]);
+    axis tight;
+    ylim ([-1.5 1.5]);
+    legend({"data", "clamped", "hinged periodic"});
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "splinefit5"))
     ## Truncated data
     x = [0,  1,  2,  4,  8, 16, 24, 40, 56, 72, 80] / 80;
@@ -125,12 +125,12 @@
     ## Plot
     ss = linspace (0, s(end), 400);
     xyfit = ppval (pp, ss);
-    xyb = ppval(pp, pp.breaks);
-    plot (x, y, ".", xyfit(1,:), xyfit(2,:), "r", xyb(1,:), xyb(2,:), "ro")
-    legend ({"data", "spline", "breaks"})
-    axis tight
-    ylim ([0 0.1])
-    print (cstrcat (nm, ".", typ), d_typ)
+    xyb = ppval (pp, pp.breaks);
+    plot (x, y, ".", xyfit(1,:), xyfit(2,:), "r", xyb(1,:), xyb(2,:), "ro");
+    legend ({"data", "spline", "breaks"});
+    axis tight;
+    ylim ([0 0.1]);
+    print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "splinefit6"))
     ## Data
     x = linspace (0, 2*pi, 200);
@@ -148,12 +148,12 @@
     y1 = ppval (pp1, xx);
     y2 = ppval (pp2, xx);
     y3 = ppval (pp3, xx);
-    plot (x, y, ".", xx, [y1; y2; y3])
-    legend({"data with outliers","robust, beta = 0.25", ...
-            "robust, beta = 0.75", "no robust fitting"})
-    axis tight
-    ylim ([-2 2])
-    print (cstrcat (nm, ".", typ), d_typ)
+    plot (x, y, ".", xx, [y1; y2; y3]);
+    legend ({"data with outliers","robust, beta = 0.25", ...
+             "robust, beta = 0.75", "no robust fitting"});
+    axis tight;
+    ylim ([-2 2]);
+    print ([nm "." typ], d_typ);
   endif
   hide_output ();  
 endfunction
@@ -185,6 +185,7 @@
   fclose (fid);
 endfunction
 
+
 %!demo
 %! for s = 1:6
 %!   splineimages (sprintf ("splinefit##d", s), "pdf")
--- a/doc/interpreter/stats.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/stats.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -42,17 +42,17 @@
 
 It should be noted that the statistics functions don't test for data
 containing NaN, NA, or Inf.  These values need to be detected and dealt
-with explicitly.  See @ref{docXisnan,,isnan}, @ref{docXisna,,isna}, 
-@ref{docXisinf,,isinf}, @ref{docXisfinite,,isfinite}. 
+with explicitly.  See @ref{XREFisnan,,isnan}, @ref{XREFisna,,isna}, 
+@ref{XREFisinf,,isinf}, @ref{XREFisfinite,,isfinite}. 
 
 @menu
 * Descriptive Statistics::
-* Basic Statistical Functions:: 
-* Statistical Plots:: 
-* Correlation and Regression Analysis::                      
-* Distributions::     
-* Tests::                       
-* Random Number Generation::          
+* Basic Statistical Functions::
+* Statistical Plots::
+* Correlation and Regression Analysis::
+* Distributions::
+* Tests::
+* Random Number Generation::
 @end menu
 
 @node Descriptive Statistics
--- a/doc/interpreter/stmt.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/stmt.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -46,16 +46,16 @@
 @dfn{body} of a control statement.
 
 @menu
-* The if Statement::            
-* The switch Statement::        
-* The while Statement::         
-* The do-until Statement::      
-* The for Statement::           
-* The break Statement::         
-* The continue Statement::      
-* The unwind_protect Statement::  
-* The try Statement::           
-* Continuation Lines::          
+* The if Statement::
+* The switch Statement::
+* The while Statement::
+* The do-until Statement::
+* The for Statement::
+* The break Statement::
+* The continue Statement::
+* The unwind_protect Statement::
+* The try Statement::
+* Continuation Lines::
 @end menu
 
 @node The if Statement
@@ -259,7 +259,7 @@
 
 @example
 @group
-switch @var{expression}
+switch (@var{expression})
   case @var{label}
     @var{command_list}
   case @var{label}
@@ -288,7 +288,7 @@
 @example
 @group
 A = 7;
-switch A
+switch (A)
   case @{ 6, 7 @}
     printf ("variable is either 6 or 7\n");
   otherwise
@@ -328,7 +328,7 @@
 @end example
 
 @menu
-* Notes for the C Programmer::  
+* Notes for the C Programmer::
 @end menu
 
 @node Notes for the C Programmer
@@ -601,7 +601,7 @@
 something to do inside the loop.
 
 @menu
-* Looping Over Structure Elements::  
+* Looping Over Structure Elements::
 @end menu
 
 @node Looping Over Structure Elements
@@ -850,50 +850,55 @@
 @var{catch} statements are evaluated.  @xref{Errors and Warnings}, for more
 information about the @code{lasterr} function.
 
+@node Continuation Lines
+@section Continuation Lines
 @cindex continuation lines
 @cindex @code{...} continuation marker
 @cindex @code{\} continuation marker
 
-@node Continuation Lines
-@section Continuation Lines
-
 In the Octave language, most statements end with a newline character and
 you must tell Octave to ignore the newline character in order to
 continue a statement from one line to the next.  Lines that end with the
-characters @code{...} or @code{\} are joined with the following line
-before they are divided into tokens by Octave's parser.  For example,
-the lines
+characters @code{...} are joined with the following line before they are
+divided into tokens by Octave's parser.  For example, the lines
 
 @example
 @group
 x = long_variable_name ...
-    + longer_variable_name \
+    + longer_variable_name ...
     - 42
 @end group
 @end example
 
 @noindent
-form a single statement.  The backslash character on the second line
-above is interpreted as a continuation character, @emph{not} as a division
-operator.
+form a single statement.
 
-For continuation lines that do not occur inside string constants,
-whitespace and comments may appear between the continuation marker and
-the newline character.  For example, the statement
+Any text between the continuation marker and the newline character is
+ignored.  For example, the statement
 
 @example
 @group
-x = long_variable_name ...     # comment one
-    + longer_variable_name \   # comment two
-    - 42                       # last comment
+x = long_variable_name ...    # comment one
+    + longer_variable_name ...comment two
+    - 42                      # last comment
 @end group
 @end example
 
 @noindent
-is equivalent to the one shown above.  Inside string constants, the
-continuation marker must appear at the end of the line just before the
-newline character.
+is equivalent to the one shown above.
+
+Inside double-quoted string constants, the character @code{\} has to be
+used as continuation marker.  The @code{\} must appear at the end of the
+line just before the newline character:
 
+@example
+@group
+s = "This text starts in the first line \
+and is continued in the second line."
+@end group
+@end example
+
+@noindent
 Input that occurs inside parentheses can be continued to the next line
 without having to use a continuation marker.  For example, it is
 possible to write statements like
--- a/doc/interpreter/strings.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/strings.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -56,11 +56,11 @@
 @menu
 * Escape Sequences in String Constants::
 * Character Arrays::
-* Creating Strings:: 
-* Comparing Strings::           
-* Manipulating Strings::     
-* String Conversions::          
-* Character Class Functions::   
+* Creating Strings::
+* Comparing Strings::
+* Manipulating Strings::
+* String Conversions::
+* Character Class Functions::
 @end menu
 
 @node Escape Sequences in String Constants
@@ -119,21 +119,17 @@
 @item \v
 Represents a vertical tab, control-k, ASCII code 11.
 
-@c We don't do octal or hex this way yet.
-@c
-@c @item \@var{nnn}
-@c Represents the octal value @var{nnn}, where @var{nnn} are one to three
-@c digits between 0 and 7.  For example, the code for the ASCII ESC
-@c (escape) character is @samp{\033}.@refill
-@c 
-@c @item \x@var{hh}@dots{}
-@c Represents the hexadecimal value @var{hh}, where @var{hh} are hexadecimal
-@c digits (@samp{0} through @samp{9} and either @samp{A} through @samp{F} or
-@c @samp{a} through @samp{f}).  Like the same construct in @sc{ansi} C,
-@c the escape 
-@c sequence continues until the first non-hexadecimal digit is seen.  However,
-@c using more than two hexadecimal digits produces undefined results.  (The
-@c @samp{\x} escape sequence is not allowed in @sc{posix} @code{awk}.)@refill
+@item \@var{nnn}
+Represents the octal value @var{nnn}, where @var{nnn} are one to three
+digits between 0 and 7.  For example, the code for the ASCII ESC
+(escape) character is @samp{\033}.
+
+@item \x@var{hh}@dots{}
+Represents the hexadecimal value @var{hh}, where @var{hh} are hexadecimal
+digits (@samp{0} through @samp{9} and either @samp{A} through @samp{F} or
+@samp{a} through @samp{f}).  Like the same construct in @sc{ansi} C,
+the escape sequence continues until the first non-hexadecimal digit is seen.
+However, using more than two hexadecimal digits produces undefined results.
 @end table
 
 In a single-quoted string there is only one escape sequence: you may insert a
@@ -158,13 +154,13 @@
 @section Character Arrays
 
 The string representation used by Octave is an array of characters, so
-internally the string @nospell{"dddddddddd"} is actually a row vector of length
-10 containing the value 100 in all places (100 is the ASCII code of "d").  This
-lends itself to the obvious generalization to character matrices.  Using a
-matrix of characters, it is possible to represent a collection of same-length
-strings in one variable.  The convention used in Octave is that each row in a
-character matrix is a separate string, but letting each column represent a
-string is equally possible.
+internally the string @nospell{@qcode{"dddddddddd"}} is actually a row vector
+of length 10 containing the value 100 in all places (100 is the ASCII code of
+@qcode{"d"}).  This lends itself to the obvious generalization to character
+matrices.  Using a matrix of characters, it is possible to represent a
+collection of same-length strings in one variable.  The convention used in
+Octave is that each row in a character matrix is a separate string, but letting
+each column represent a string is equally possible.
 
 The easiest way to create a character matrix is to put several strings
 together into a matrix.
@@ -222,19 +218,36 @@
 @DOCSTRING(blanks)
 
 @menu
-* Concatenating Strings:: 
-* Conversion of Numerical Data to Strings::
+* Concatenating Strings::
+* Converting Numerical Data to Strings::
 @end menu
 
 @node Concatenating Strings
 @subsection Concatenating Strings
 
-It has been shown above that strings can be concatenated using matrix notation
-(@pxref{Strings}, @ref{Character Arrays}).  Apart from that, there are several
-functions to concatenate string objects: @code{char},
-@code{strvcat}, @code{strcat} and @code{cstrcat}.  In addition, the general
-purpose concatenation functions can be used: see @ref{docXcat,,cat},
-@ref{docXhorzcat,,horzcat} and @ref{docXvertcat,,vertcat}.
+Strings can be concatenated using matrix notation
+(@pxref{Strings}, @ref{Character Arrays}) which is often the most natural
+method.  For example:
+
+@example
+@group
+fullname = [fname ".txt"];
+email = ["<" user "@@" domain ">"];
+@end group
+@end example
+
+@noindent
+In each case it is easy to see what the final string will look like.  This
+method is also the most efficient.  When using matrix concatenation the parser
+immediately begins joining the strings without having to process
+the overhead of a function call and the input validation of the associated
+function.
+
+Nevertheless, there are several other functions for concatenating string
+objects which can be useful in specific circumstances: @code{char},
+@code{strvcat}, @code{strcat}, and @code{cstrcat}.  Finally, the general
+purpose concatenation functions can be used: see @ref{XREFcat,,cat},
+@ref{XREFhorzcat,,horzcat}, and @ref{XREFvertcat,,vertcat}.
 
 @itemize @bullet
 @item All string concatenation functions except @code{cstrcat}
@@ -275,8 +288,8 @@
 char ("orange", "green", "", "red")
     @result{} orange
        green 
-             
-       red   
+
+       red
 @end group
 
 @group
@@ -318,7 +331,7 @@
 @example
 @group
 strcat (["dir1";"directory2"], ["/";"/"], ["file1";"file2"])
-     @result{} dir1/file1      
+     @result{} dir1/file1
         directory2/file2
 @end group
 @group
@@ -342,8 +355,8 @@
 
 @DOCSTRING(cstrcat)
 
-@node Conversion of Numerical Data to Strings 
-@subsection Conversion of Numerical Data to Strings
+@node Converting Numerical Data to Strings
+@subsection Converting Numerical Data to Strings
 Apart from the string concatenation functions (@pxref{Concatenating Strings})
 which cast numerical data to the corresponding ASCII characters, there are
 several functions that format numerical data as strings.  @code{mat2str} and
@@ -351,7 +364,7 @@
 integer matrices.  @code{int2str} takes the real part of complex values and
 round fractional values to integer.  A more flexible way to format numerical
 data as strings is the @code{sprintf} function (@pxref{Formatted Output},
-@ref{docXsprintf}).
+@ref{XREFsprintf,,sprintf}).
 
 @DOCSTRING(mat2str)
 
--- a/doc/interpreter/system.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/system.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -26,17 +26,17 @@
 and even start other programs from the Octave prompt.
 
 @menu
-* Timing Utilities::            
-* Filesystem Utilities::        
+* Timing Utilities::
+* Filesystem Utilities::
 * File Archiving Utilities::
 * Networking Utilities::
-* Controlling Subprocesses::    
-* Process ID Information::      
-* Environment Variables::       
-* Current Working Directory::   
-* Password Database Functions::  
-* Group Database Functions::    
-* System Information::          
+* Controlling Subprocesses::
+* Process ID Information::
+* Environment Variables::
+* Current Working Directory::
+* Password Database Functions::
+* Group Database Functions::
+* System Information::
 * Hashing Functions::
 @end menu
 
@@ -121,7 +121,7 @@
 
 @DOCSTRING(is_leap_year)
 
-@anchor{docXtoc}
+@anchor{XREFtoc}
 @DOCSTRING(tic)
 
 @DOCSTRING(pause)
@@ -177,7 +177,7 @@
 
 @DOCSTRING(umask)
 
-@anchor{docXlstat}
+@anchor{XREFlstat}
 @DOCSTRING(stat)
 
 @DOCSTRING(S_ISBLK)
@@ -491,7 +491,7 @@
 @DOCSTRING(getgrent)
 
 @DOCSTRING(getgrgid)
-         
+
 @DOCSTRING(getgrnam)
 
 @DOCSTRING(setgrent)
--- a/doc/interpreter/tips.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/tips.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -352,7 +352,7 @@
 Help text in Texinfo format.  Code samples should be marked 
 like @@code@{sample of code@} and variables should be marked
 as @@var@{variable@}.
-@@seealso@{fn2@}
+@@seealso@{fn2, fn3@}
 @@end deftypefn
 @end group
 @end example
@@ -385,7 +385,13 @@
 All samples of code should be marked with this macro for the same
 reasons as the @@var macro.
 
-@item @@seealso@{function2@}
+@item  @nospell{@@qcode@{"sample_code"@}}
+@itemx @nospell{@@qcode@{'sample_code'@}}
+All samples of code which are quoted should use this more specialized macro.
+This happens frequently when discussing graphics properties such as "position"
+or options such as "on"/"off".
+
+@item @@seealso@{function2, function3@}
 This is a comma separated list of function names that allows cross
 referencing from one function documentation string to another.
 @end table
@@ -467,8 +473,8 @@
 The @code{@@group} block prevents the example from being split across a
 page boundary, while the @code{@@result@{@}} macro produces a right
 arrow signifying the result of a command.  If your example is larger than
-20 lines it is better NOT to use grouping so that a reasonable page boundary
-can be calculated.
+20 lines it is better @emph{NOT} to use grouping so that a reasonable page
+boundary can be calculated.
 
 In many cases a function has multiple ways in which it can be called,
 and the @code{@@deftypefnx} macro can be used to give alternatives.  For
@@ -556,14 +562,15 @@
 @@seealso@{bincoeff, perms@}
 @@end deftypefn
 @end example
+
 @noindent
 which demonstrates most of the concepts discussed above.
 @iftex
 This documentation string renders as
-
 @c Note: use the actual output of info below, rather than try and 
 @c reproduce it here to prevent it looking different from how it would
 @c appear with info.
+
 @example
  -- Function File: C = nchoosek (N, K)
  -- Function File: C = nchoosek (SET, K)
--- a/doc/interpreter/var.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/var.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -49,7 +49,7 @@
 A variable name is a valid expression by itself.  It represents the
 variable's current value.  Variables are given new values with
 @dfn{assignment operators} and @dfn{increment operators}.
-@xref{Assignment Ops, ,Assignment Expressions}.
+@xref{Assignment Ops,,Assignment Expressions}.
 
 There is one built-in variable with a special meaning.  The @code{ans} variable
 always contains the result of the last computation, where the output wasn't
@@ -72,9 +72,9 @@
 @DOCSTRING(namelengthmax)
 
 @menu
-* Global Variables::            
-* Persistent Variables::        
-* Status of Variables::         
+* Global Variables::
+* Persistent Variables::
+* Status of Variables::
 @end menu
 
 @node Global Variables
@@ -178,7 +178,7 @@
 @cindex persistent variables
 @cindex @code{persistent} statement
 @cindex variables, persistent
-@anchor{docXpersistent}
+@anchor{XREFpersistent}
 
 A variable that has been declared @dfn{persistent} within a function
 will retain its contents in memory between subsequent calls to the
@@ -299,8 +299,8 @@
 variable will be cleared by a simple @code{clear} command as the entire
 function definition will be removed from memory.  If you do not want
 a persistent variable to be removed from memory even if the function is
-cleared, you should use the @code{mlock} function as described in
-@xref{Function Locking}.
+cleared, you should use the @code{mlock} function
+(@pxref{Function Locking}).
 
 @node Status of Variables
 @section Status of Variables
--- a/doc/interpreter/vectorize.txi	Thu Sep 12 21:08:07 2013 -0400
+++ b/doc/interpreter/vectorize.txi	Sat Oct 05 11:22:09 2013 -0400
@@ -112,7 +112,7 @@
 @example
 @group
 for i = 1:n
-  if a(i) > 5
+  if (a(i) > 5)
     a(i) -= 20
   endif
 endfor
@@ -457,7 +457,7 @@
 that may have relied on matrices of different size producing an error.
 Due to how broadcasting changes semantics with older versions of Octave,
 by default Octave warns if a broadcasting operation is performed.  To
-disable this warning, refer to its ID (@pxref{docXwarning_ids}):
+disable this warning, refer to its ID (@pxref{XREFwarning_ids,,warning_ids}):
 
 @example
 warning ("off", "Octave:broadcast");
@@ -519,8 +519,8 @@
 statements into another language, compiling the new code segment into an
 executable, and then running the executable and collecting any results.  The
 process is not simple and there is a significant amount of work to perform for
-each step.  It can still make sense, however, if the loop counter is a
-large number.  Because Octave is an interpreted language every time through a
+each step.  It can still make sense, however, if the number of loop iterations
+is large.  Because Octave is an interpreted language every time through a
 loop Octave must parse the statements in the loop body before executing them.
 With a JIT compiler this is done just once when the body is translated to
 another language.
@@ -528,12 +528,16 @@
 The JIT compiler is a very new feature in Octave and not all valid Octave
 statements can currently be accelerated.  However, if no other technique
 is available it may be worth benchmarking the code with JIT enabled.  The
-function @code{jit_enable} is used to turn compilation on or off.  The function
-@code{debug_jit} is not likely to be of use to anyone not working directly on
-the implementation of the JIT compiler.
+function @code{jit_enable} is used to turn compilation on or off.  The
+function @code{jit_startcnt} sets the threshold for acceleration.  Loops
+with iteration counts above @code{jit_startcnt} will be accelerated.  The
+function @code{debug_jit} is not likely to be of use to anyone not working
+directly on the implementation of the JIT compiler.
 
 @DOCSTRING(jit_enable)
 
+@DOCSTRING(jit_startcnt)
+
 @DOCSTRING(debug_jit)
 
 @node Miscellaneous Techniques
@@ -602,7 +606,7 @@
 @group
 a = zeros (1000); # create a 1000x1000 matrix
 b = a(:,10:100);  # lazy slice
-a = []; # the original a array is still allocated
+a = []; # the original "a" array is still allocated
 c@{1@} = b; # b is reallocated at this point
 @end group
 @end example
@@ -670,7 +674,7 @@
 @item Use @code{ignore_function_time_stamp} when appropriate.
 If you are calling lots of functions, and none of them will need to change
 during your run, set the variable @code{ignore_function_time_stamp} to
-@code{"all"}.  This will stop Octave from checking the time stamp of a function
+@qcode{"all"}.  This will stop Octave from checking the time stamp of a function
 file to see if it has been updated while the program is being run.
 @end itemize
 
--- a/etc/HACKING	Thu Sep 12 21:08:07 2013 -0400
+++ b/etc/HACKING	Sat Oct 05 11:22:09 2013 -0400
@@ -271,6 +271,8 @@
 
     geometry         geometry algorithms
 
+    gui              User-Interface (UI) functions
+
     help             help subsystem functions
 
     image            image processing
@@ -318,15 +320,15 @@
 
     test_ .m         fixed tests for the interpreter
 
-    fntests.m        script to run function tests embedded in C++ and .m
-                     files
+    fntests.m        script to run function tests embedded in C++ and
+                     .m files
 
 ----
 John W. Eaton
 jwe@octave.org
 
+Last updated: Fri, 4 Oct 2013 16:58:52 PDT 
 
-Last updated: Wed, 15 May 2013 03:02:45 EDT
 
 
 ################################################################################
--- a/etc/OLD-ChangeLogs/scripts-ChangeLog	Thu Sep 12 21:08:07 2013 -0400
+++ b/etc/OLD-ChangeLogs/scripts-ChangeLog	Sat Oct 05 11:22:09 2013 -0400
@@ -6297,7 +6297,7 @@
 
 	* plot/grid.m: Document handle argument.
 
-2009-01-15  Peter L. S�ndergaard  <peter@sonderport.dk>
+2009-01-15  Peter L. Søndergaard  <peter@sonderport.dk>
 
 	* general/nargoutchk.m: Doc fix.
 	* general/nargchk.m: Improve compatibility.  New tests.
@@ -6503,7 +6503,7 @@
 	systems. Simplify & fix indexing. Use left division for step problem.
 	Fix output args.
 
-2008-12-13  Francesco Potort�  <pot@gnu.org>
+2008-12-13  Francesco Potortì  <pot@gnu.org>
 
 	* specfun/nchoosek.m: Check for input arguments, signal loss of
 	precision, correctly handle k==0 and k==n cases, add proper tests.
@@ -6592,7 +6592,7 @@
 2008-11-10  John W. Eaton  <jwe@octave.org>
 
 	* polynomial/spline.m: Delete debugging statements.  From
-	Sebastian Sch�ps <sebastian@schoeps.org>.
+	Sebastian Schöps <sebastian@schoeps.org>.
 
 2008-11-07  Thorsten Meyer  <thorsten.meyier@gmx.de>
 
--- a/examples/@FIRfilter/subsref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/examples/@FIRfilter/subsref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,5 +1,5 @@
 function out = subsref (f, x)
-  switch x.type
+  switch (x.type)
     case "()"
       n = f.polynomial;
       out = filter (n.poly, 1, x.subs{1});
--- a/examples/mysparse.c	Thu Sep 12 21:08:07 2013 -0400
+++ b/examples/mysparse.c	Sat Oct 05 11:22:09 2013 -0400
@@ -11,14 +11,14 @@
   double *pr2, *pi2;
   mwIndex *ir, *jc;
   mwIndex *ir2, *jc2;
-  
+
   if (nrhs != 1 || ! mxIsSparse (prhs[0]))
     mexErrMsgTxt ("ARG1 must be a sparse matrix");
 
   m = mxGetM (prhs[0]);
   n = mxGetN (prhs[0]);
   nz = mxGetNzmax (prhs[0]);
-  
+
   if (mxIsComplex (prhs[0]))
     {
       mexPrintf ("Matrix is %d-by-%d complex sparse matrix", m, n);
@@ -40,7 +40,7 @@
       pi2 = mxGetPi (v);
       ir2 = mxGetIr (v);
       jc2 = mxGetJc (v);
-      
+
       for (i = 0; i < nz; i++)
         {
           pr2[i] = 2 * pr[i];
@@ -72,7 +72,7 @@
       pbr2 = mxGetLogicals (v);
       ir2 = mxGetIr (v);
       jc2 = mxGetJc (v);
-      
+
       for (i = 0; i < nz; i++)
         {
           pbr2[i] = pbr[i];
@@ -102,7 +102,7 @@
       pr2 = mxGetPr (v);
       ir2 = mxGetIr (v);
       jc2 = mxGetJc (v);
-      
+
       for (i = 0; i < nz; i++)
         {
           pr2[i] = 2 * pr[i];
--- a/libgui/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -20,8 +20,6 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 MOC_CPPFLAGS =
 
 octlib_LTLIBRARIES = liboctgui.la
@@ -109,5 +107,6 @@
 	$(LRELEASE) -qm $@ $<
 
 DISTCLEANFILES = \
+  default-qt-settings \
   $(LOCALES)
 
--- a/libgui/languages/be_BY.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/be_BY.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,645 @@
         <source>persistent</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.cc" line="+64"/>
+        <source>foreground</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QTerminal</name>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.h" line="+116"/>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Clear All</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QWinTerminalImpl</name>
+    <message>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
+        <source>copied selection to clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerBatch</name>
+    <message>
+        <location filename="../../../qsci/qscilexerbatch.cpp" line="+179"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Label</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Hide command character</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>External command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Variable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerCPP</name>
+    <message>
+        <location filename="../../../qsci/qscilexercpp.cpp" line="+352"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc style C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc style C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>IDL UUID</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive IDL UUID</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Pre-processor block</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive pre-processor block</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Unclosed string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive unclosed string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C# verbatim string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C# verbatim string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaScript regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaScript regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc style C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc style C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Secondary keywords and identifiers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive secondary keywords and identifiers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc keyword error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc keyword error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Global classes and typedefs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive global classes and typedefs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C++ raw string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C++ raw string</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerDiff</name>
+    <message>
+        <location filename="../../../qsci/qscilexerdiff.cpp" line="+107"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Position</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Removed line</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Added line</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Changed line</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerMatlab</name>
+    <message>
+        <location filename="../../../qsci/qscilexermatlab.cpp" line="+138"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerPerl</name>
+    <message>
+        <location filename="../../../qsci/qscilexerperl.cpp" line="+333"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>POD</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Scalar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Array</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Hash</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Symbol table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Substitution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backticks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Data section</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Here document delimiter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backtick here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (q)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qq)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qx)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qr)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qw)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>POD verbatim</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Subroutine prototype</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Format identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Format body</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Translation</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Regular expression (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Substitution (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backticks (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted here document (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backtick here document (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qq, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qx, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qr, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciScintilla</name>
+    <message>
+        <location filename="../../../qsci/qsciscintilla.cpp" line="+4201"/>
+        <source>&amp;Undo</source>
+        <translation type="unfinished">&amp;Ðдрабіць</translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>&amp;Redo</source>
+        <translation type="unfinished">&amp;Паўтарыць</translation>
+    </message>
+    <message>
+        <location line="+6"/>
+        <source>Cu&amp;t</source>
+        <translation type="unfinished">Вы&amp;разаць</translation>
+    </message>
+    <message>
+        <location line="+5"/>
+        <source>&amp;Copy</source>
+        <translation type="unfinished">&amp;КапіÑваць</translation>
+    </message>
+    <message>
+        <location line="+6"/>
+        <source>&amp;Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+7"/>
+        <source>Select All</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>documentation_dock_widget</name>
@@ -58,19 +697,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation type="unfinished"></translation>
@@ -93,7 +732,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation type="unfinished">&amp;Ðовы файл</translation>
     </message>
@@ -108,12 +747,12 @@
         <translation type="unfinished">&amp;Захаваць файл</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation type="unfinished">Захаваць файл &amp;Ñк</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
@@ -143,17 +782,17 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation type="unfinished">&amp;ÐаÑÑ‚ÑƒÐ¿Ð½Ð°Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation type="unfinished">Па&amp;пÑÑ€ÑднÑÑ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation type="unfinished">&amp;ПаÑтавіць/прыбраць закладку</translation>
     </message>
@@ -193,27 +832,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <location line="+4"/>
+        <source>Close All</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <location line="+5"/>
-        <source>Close All</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+4"/>
         <source>Close Other Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation type="unfinished"></translation>
     </message>
@@ -228,12 +867,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;ЗмÑніць</translation>
     </message>
@@ -278,14 +917,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -293,7 +932,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -319,13 +958,13 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation type="unfinished"></translation>
     </message>
@@ -475,7 +1114,7 @@
     </message>
     <message>
         <location line="-10"/>
-        <source>Are you sre you want to delete
+        <source>Are you sure you want to delete
 </source>
         <translation type="unfinished"></translation>
     </message>
@@ -485,12 +1124,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation type="unfinished"></translation>
     </message>
@@ -585,7 +1224,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation type="unfinished"></translation>
     </message>
@@ -708,12 +1347,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -748,7 +1387,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+100"/>
+        <location line="+99"/>
         <source>Searching...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -761,7 +1400,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
@@ -774,7 +1413,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation type="unfinished">ÐглÑд Ñ– пошук па гіÑторыі загадаў.</translation>
     </message>
@@ -812,23 +1451,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation type="unfinished">Загрузіць праÑтору зменных</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation type="unfinished">Пра Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
@@ -838,7 +1477,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation type="unfinished"></translation>
     </message>
@@ -848,12 +1487,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -863,7 +1502,7 @@
         <translation type="unfinished">ВыйÑці</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;ЗмÑніць</translation>
     </message>
@@ -878,28 +1517,33 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -914,7 +1558,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation type="unfinished"></translation>
     </message>
@@ -959,7 +1603,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation type="unfinished"></translation>
     </message>
@@ -989,12 +1653,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1045,12 +1709,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation type="unfinished">ДакументацыÑ</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1059,39 +1723,25 @@
         <source>Report Bug</source>
         <translation type="unfinished">Паведаміць пра хібу</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <location line="+29"/>
-        <source>Unock widget</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_qscintilla</name>
@@ -1157,12 +1807,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Graphic  icons</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+39"/>
+        <location line="+46"/>
         <source>Editor</source>
         <translation type="unfinished">РÑдактар</translation>
     </message>
@@ -1272,12 +1917,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+46"/>
+        <location line="+45"/>
         <source>Font</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-745"/>
+        <location line="-744"/>
         <source>Show line numbers</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1297,7 +1942,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+548"/>
+        <location line="-72"/>
+        <source>Graphic icons</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+620"/>
         <source>emacs</source>
         <translation type="unfinished">emacs</translation>
     </message>
@@ -1317,7 +1967,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+102"/>
+        <location line="+101"/>
         <source>Font size</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1387,7 +2037,7 @@
         <translation type="unfinished">HttpProxy</translation>
     </message>
     <message>
-        <location line="-1108"/>
+        <location line="-1107"/>
         <source>Icon set for dock widgets</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1402,7 +2052,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1099"/>
+        <location line="+1098"/>
         <source>Socks5Proxy</source>
         <translation type="unfinished">Socks5Proxy</translation>
     </message>
@@ -1434,8 +2084,23 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-137"/>
-        <source>Difference to the defalt size</source>
+        <location line="-268"/>
+        <source>IBeam Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Block Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Underline Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+129"/>
+        <source>Difference to the default size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -1470,7 +2135,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1483,48 +2148,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation type="unfinished"></translation>
     </message>
--- a/libgui/languages/de_DE.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/de_DE.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -83,7 +83,7 @@
 <context>
     <name>QWinTerminalImpl</name>
     <message>
-        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1451"/>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
         <source>copied selection to clipboard</source>
         <translation>Auswahl in die Zwischenablage kopiert</translation>
     </message>
@@ -104,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation>Octave Editor</translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Octave Dateien (*.m);;Alle Dateien (*)</translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation>Kann die Datei &lt;b&gt;%1&lt;/b&gt; nicht zum Lesen öffnen:
@@ -142,7 +142,7 @@
         <translation>&amp;%1 %2</translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation>&amp;Neue Datei</translation>
     </message>
@@ -157,12 +157,12 @@
         <translation>Datei &amp;speichern</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation>Datei speichern &amp;als</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation>Drucken</translation>
     </message>
@@ -192,17 +192,17 @@
         <translation>Einfügen</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation>&amp;Nächstes Lesezeichen</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation>&amp;Voriges Lesezeichen</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation>&amp;Lesezeichen setzen</translation>
     </message>
@@ -242,34 +242,34 @@
         <translation>Kommentar &amp;entfernen</translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation>&amp;Zuletzt bearbeitete Dateien</translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation>S&amp;chließen</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+4"/>
         <source>Close All</source>
         <translation>Alle schließen</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+5"/>
         <source>Close Other Files</source>
         <translation>Andere Dokumente schließen</translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation>&amp;Suchen und Ersetzen</translation>
     </message>
     <message>
         <location line="+3"/>
         <source>Save File And Run</source>
-        <translation>Datei speichern und ausrühren</translation>
+        <translation>Datei speichern und ausführen</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -277,12 +277,12 @@
         <translation>&amp;Gehe zu Zeile</translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation>&amp;Datei</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editieren</translation>
     </message>
@@ -327,14 +327,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation>Octave Editor</translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -345,7 +345,7 @@
 %2</translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Octave Dateien (*.m);;All Files (*)</translation>
     </message>
@@ -375,14 +375,14 @@
 wurde gelöscht oder umbenannt. Soll die Datei jetzt gespeichert werden?%2</translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
-        <translation>Die Datei %1  konnte nicht zum Schrieben geöffnet werden:
+        <translation>Die Datei %1  konnte nicht zum Schreiben geöffnet werden:
 %2.</translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation>Die Datei %1 wurde von einer anderen Anwendung verändert. Soll der neue Inhalt geladen werden?</translation>
     </message>
@@ -437,7 +437,7 @@
     <message>
         <location line="+3"/>
         <source>Show Home directory</source>
-        <translation>Wechlse zum Heimatverzeichnis</translation>
+        <translation>Wechsle zum Heimatverzeichnis</translation>
     </message>
     <message>
         <location line="+10"/>
@@ -544,12 +544,12 @@
         <translation>Verzeichnis ist nicht leer und kann daher nicht gelöscht werden</translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation>Setze aktuelles Browser Verzeichnis</translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation>Neue Datei</translation>
     </message>
@@ -644,7 +644,7 @@
         <translation>In Auswah&amp;l suchen</translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation>Vom Ende suchen</translation>
     </message>
@@ -689,7 +689,7 @@
     <message>
         <location line="+2"/>
         <source>Enter the filename expression</source>
-        <translation>EIngabe eines Ausdrucks für den Dateinamen</translation>
+        <translation>Eingabe eines Ausdrucks für den Dateinamen</translation>
     </message>
     <message>
         <location line="+5"/>
@@ -729,7 +729,7 @@
     <message>
         <location line="+2"/>
         <source>Include matching directories in search results</source>
-        <translation>Auch Verzeichnisse berücksichitgen, die die Suchanfrage erfüllen</translation>
+        <translation>Auch Verzeichnisse berücksichtigen, die die Suchanfrage erfüllen</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -739,7 +739,7 @@
     <message>
         <location line="+2"/>
         <source>Set matching name is case insensitive</source>
-        <translation>Groß-/Kleinschriebung bei der Dateisuche ignorieren</translation>
+        <translation>Groß-/Kleinschreibung bei der Dateisuche ignorieren</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -767,12 +767,12 @@
         <translation>Groß-/Kleinschreibung beim Text beachten</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation>Suchergebnisse</translation>
     </message>
     <message>
-        <location line="+11"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation>Leerlauf.</translation>
     </message>
@@ -820,7 +820,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation>Dateiname</translation>
     </message>
@@ -833,7 +833,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation>Durchsuchen Sie die Befehlshistorie.</translation>
     </message>
@@ -871,23 +871,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation>Lade Arbeitsumgebung</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation>Ãœber Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation>&amp;Datei</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation>Neu</translation>
     </message>
@@ -897,7 +897,7 @@
         <translation>Skript</translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation>Funktion</translation>
     </message>
@@ -907,12 +907,12 @@
         <translation>Abbildung</translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation>Öffnen...</translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation>Einstellungen...</translation>
     </message>
@@ -922,7 +922,7 @@
         <translation>Beenden</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editieren</translation>
     </message>
@@ -937,28 +937,33 @@
         <translation>Kopieren</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation>Einfügen</translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation>Arbeitsumgebung speichern als</translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation>Arbeitsverzeichnis setzen</translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation>Zwischenablage leeren</translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation>Suche Dateien...</translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation>Befehlsfenster löschen</translation>
     </message>
@@ -973,14 +978,14 @@
         <translation>Arbeitsumgebung löschen</translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation>De&amp;bug</translation>
     </message>
     <message>
         <location line="+3"/>
         <source>Step</source>
-        <translation>EInzelschritt</translation>
+        <translation>Einzelschritt</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -995,7 +1000,7 @@
     <message>
         <location line="+4"/>
         <source>Continue</source>
-        <translation>Fortführen</translation>
+        <translation>Fortfahren</translation>
     </message>
     <message>
         <location line="+8"/>
@@ -1018,7 +1023,27 @@
         <translation>Fensterlayout auf Grundeinstellung zurücksetzen</translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation>Octave Pakete</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation>Code teilen</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation>Bei Octave mitwirken</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation>Ressourcen für Octave Entwickler</translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation>Auf der Festplatte</translation>
     </message>
@@ -1048,12 +1073,12 @@
         <translation>Verzeichnis suchen</translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation>Arbeitsumgebung laden</translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation>&amp;Fenster</translation>
     </message>
@@ -1104,12 +1129,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation>Dokumentation</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation>&amp;Hilfe</translation>
     </message>
@@ -1118,32 +1143,22 @@
         <source>Report Bug</source>
         <translation>Fehler melden</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation>Agora Webseite</translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation>Octave Forge Webseite</translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
-        <location line="+120"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation>Fenster lösen</translation>
     </message>
     <message>
-        <location line="-111"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation>Fenster verbergen</translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation>Fenster andocken</translation>
     </message>
@@ -1166,7 +1181,7 @@
     <message>
         <location line="+1"/>
         <source>The file %1 is shadowed by a file with the same name in the load path.  To debug the function you are editing, change to the directory %2.</source>
-        <translation>Die Datei %1 wird von einer gleichnamigen Datei im Suchpfad überdeckt. Um die editierte Funktion zu debuggen, in das Verzeichnis %2 gewechselt werden.</translation>
+        <translation>Die Datei %1 wird von einer gleichnamigen Datei im Suchpfad überdeckt. Um die editierte Funktion zu debuggen, muss in das Verzeichnis %2 gewechselt werden.</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -1224,7 +1239,7 @@
     <message>
         <location line="+27"/>
         <source>Do not show white spaces used for indentation</source>
-        <translation>Keine Leezeichen der Einrückung anzeigen</translation>
+        <translation>Keine Leerzeichen der Einrückung anzeigen</translation>
     </message>
     <message>
         <location line="+28"/>
@@ -1279,7 +1294,7 @@
     <message>
         <location line="+13"/>
         <source>Replace word by suggested one</source>
-        <translation>Wort durch Vorschalg ersetzen</translation>
+        <translation>Wort durch Vorschlag ersetzen</translation>
     </message>
     <message>
         <location line="+23"/>
@@ -1409,7 +1424,7 @@
     <message>
         <location line="+7"/>
         <source>Alternating row colors</source>
-        <translation>Alternierende Farben verwenden</translation>
+        <translation>Alternierende Farben für die Zeilen verwenden</translation>
     </message>
     <message>
         <location line="+21"/>
@@ -1506,7 +1521,7 @@
     <message>
         <location line="+129"/>
         <source>Difference to the default size</source>
-        <translation>Differenz zur Stnadgröße</translation>
+        <translation>Differenz zur Standardgröße</translation>
     </message>
     <message>
         <location line="+6"/>
@@ -1540,9 +1555,9 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
-        <translation>Suchbegriff eingeben und mit &apos;Enter&apos; die Scuhe starten</translation>
+        <translation>Suchbegriff eingeben und mit &apos;Enter&apos; die Suche starten</translation>
     </message>
     <message>
         <location line="+4"/>
@@ -1553,52 +1568,44 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation>Willkommen zu GNU Octave</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
-        <translation>Es scheint, dass Sie Octave-GUI das erste Mal auf diesem Computer ausführen, da die Konfigurationsdatei 
-~/.config/octave/qt-settings
-nicht gefunden wurde. Die Default-Konfiguration wird beim Fortfahren an diese Stelle kopiert. Wenn bestehende Einstellungen verwendet werden sollen, muss dieser Dialog geschlossen und  die vorhandene Datei an die oben angegebene Stelle kopiert werden. Eine vorhandene Konfigurationsdatei wird beim nächsten Start automatisch erkannt.
-
-Nach dem Programmstart können die Einstellungen im Menü &quot;Datei/Einstellungen&quot; angepasst werden.</translation>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation>Die grafische Nutzerschnittstelle von Octave wird offenbar das erste Mal gestartet. Ein Klick auf &apos;Beenden&apos; erstellt eine Standard-Konfigurationsdatei und startet Octave GUI.</translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
+        <translation>Die Konfigurationsdatei wid in __%1__ gespeichert. Wenn diese Datei existiert, erscheint dieser Dialog beim nächsten Start von Octave nicht mehr.</translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
-        <translation>Weiter</translation>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
+        <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Weitere Informationsquellen zu Octave:&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;Homepage &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; Online-Dokumentation als &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- oder &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-Dokument&lt;/li&gt;
+&lt;li&gt;Dokumentations-Browser von Octave GUI im Hilfe-Menü&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation>Zurück</translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation>Willkommen zu Octave!</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation>Dieses ist die Entwicklungsversion von Octave mit der ersten offiziellen GUI.</translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation>Die GUI von Octave wird offenbar das erste mal auf diesem Computer ausgeführt. Dieser Assistent erstellt beim Klick auf &apos;Beenden&apos; eine Standarkonfiguration und startet Octve-GUI.  </translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation>Beenden</translation>
     </message>
@@ -1633,7 +1640,7 @@
     <message>
         <location line="+107"/>
         <source>Right click to copy, rename, or display</source>
-        <translation>Rechtsklick zum Kopeiren, Umbenennen oder Anzeigen</translation>
+        <translation>Rechtsklick zum Kopieren, Umbenennen oder Anzeigen</translation>
     </message>
 </context>
 <context>
@@ -1661,12 +1668,12 @@
     <message>
         <location line="+8"/>
         <source>Only top-level symbols may be renamed.</source>
-        <translation>Nur Varaiblen auf höchster Ebene können umbenannt werden.</translation>
+        <translation>Nur Variablen auf höchster Ebene können umbenannt werden.</translation>
     </message>
     <message>
         <location line="+125"/>
         <source>View the variables in the active workspace.&lt;br&gt;</source>
-        <translation>Einsehen der Varaiblen der aktiven Arbeitsumgebung.&lt;br&gt;</translation>
+        <translation>Einsehen der Variablen der aktiven Arbeitsumgebung.&lt;br&gt;</translation>
     </message>
     <message>
         <location line="+1"/>
--- a/libgui/languages/en_US.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/en_US.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,52 @@
         <source>persistent</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.cc" line="+64"/>
+        <source>foreground</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QTerminal</name>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.h" line="+116"/>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Clear All</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QWinTerminalImpl</name>
+    <message>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
+        <source>copied selection to clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>documentation_dock_widget</name>
@@ -58,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation type="unfinished"></translation>
@@ -93,7 +139,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation type="unfinished"></translation>
     </message>
@@ -108,12 +154,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
@@ -143,17 +189,17 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation type="unfinished"></translation>
     </message>
@@ -193,27 +239,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <location line="+4"/>
+        <source>Close All</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <location line="+5"/>
-        <source>Close All</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+4"/>
         <source>Close Other Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation type="unfinished"></translation>
     </message>
@@ -228,12 +274,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation type="unfinished"></translation>
     </message>
@@ -278,14 +324,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -293,7 +339,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -319,13 +365,13 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation type="unfinished"></translation>
     </message>
@@ -475,7 +521,7 @@
     </message>
     <message>
         <location line="-10"/>
-        <source>Are you sre you want to delete
+        <source>Are you sure you want to delete
 </source>
         <translation type="unfinished"></translation>
     </message>
@@ -485,12 +531,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation type="unfinished"></translation>
     </message>
@@ -585,7 +631,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation type="unfinished"></translation>
     </message>
@@ -708,12 +754,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -748,7 +794,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+100"/>
+        <location line="+99"/>
         <source>Searching...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -761,7 +807,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
@@ -774,7 +820,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -812,23 +858,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
@@ -838,7 +884,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation type="unfinished"></translation>
     </message>
@@ -848,12 +894,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -863,7 +909,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation type="unfinished"></translation>
     </message>
@@ -878,28 +924,33 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -914,7 +965,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation type="unfinished"></translation>
     </message>
@@ -959,7 +1010,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation type="unfinished"></translation>
     </message>
@@ -989,12 +1060,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1045,12 +1116,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1059,39 +1130,25 @@
         <source>Report Bug</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <location line="+29"/>
-        <source>Unock widget</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_qscintilla</name>
@@ -1157,12 +1214,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Graphic  icons</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+39"/>
+        <location line="+46"/>
         <source>Editor</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1272,12 +1324,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+46"/>
+        <location line="+45"/>
         <source>Font</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-745"/>
+        <location line="-744"/>
         <source>Show line numbers</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1297,7 +1349,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+548"/>
+        <location line="-72"/>
+        <source>Graphic icons</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+620"/>
         <source>emacs</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1317,7 +1374,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+102"/>
+        <location line="+101"/>
         <source>Font size</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1387,7 +1444,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1108"/>
+        <location line="-1107"/>
         <source>Icon set for dock widgets</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1402,7 +1459,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1099"/>
+        <location line="+1098"/>
         <source>Socks5Proxy</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1434,8 +1491,23 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-137"/>
-        <source>Difference to the defalt size</source>
+        <location line="-268"/>
+        <source>IBeam Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Block Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Underline Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+129"/>
+        <source>Difference to the default size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -1470,7 +1542,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1483,48 +1555,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation type="unfinished"></translation>
     </message>
--- a/libgui/languages/es_ES.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/es_ES.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,52 @@
         <source>persistent</source>
         <translation>persistente</translation>
     </message>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.cc" line="+64"/>
+        <source>foreground</source>
+        <translation>primer plano</translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>background</source>
+        <translation>plano de fondo</translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>selection</source>
+        <translation>selección</translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>cursor</source>
+        <translation>cursor</translation>
+    </message>
+</context>
+<context>
+    <name>QTerminal</name>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.h" line="+116"/>
+        <source>Copy</source>
+        <translation>Copiar</translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Paste</source>
+        <translation>Pegar</translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Clear All</source>
+        <translation>Limpiar todo</translation>
+    </message>
+</context>
+<context>
+    <name>QWinTerminalImpl</name>
+    <message>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
+        <source>copied selection to clipboard</source>
+        <translation>selección copiada al portapapeles</translation>
+    </message>
 </context>
 <context>
     <name>documentation_dock_widget</name>
@@ -58,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation>Editor de Octave</translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Archivos de Octave (*.m);;Todos los archivos (*)</translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation>No se ha podido abrir el archivo %1 para su lectura:\n%2.</translation>
@@ -93,7 +139,7 @@
         <translation>&amp;%1 %2</translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation>Archivo &amp;nuevo</translation>
     </message>
@@ -108,12 +154,12 @@
         <translation>&amp;Guardar archivo</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation>Guardar archivo &amp;como</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation>Imprimir</translation>
     </message>
@@ -143,17 +189,17 @@
         <translation>Pegar</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation>&amp;Marcador siguiente</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation>Marcador &amp;anterior</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation>&amp;Alternar marcadores</translation>
     </message>
@@ -193,27 +239,27 @@
         <translation>&amp;Eliminar comentario</translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation>Archivos &amp;recientes</translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation>C&amp;errar</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+4"/>
         <source>Close All</source>
         <translation>Cerrar todo</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+5"/>
         <source>Close Other Files</source>
         <translation>Cerrar otros archivos</translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation>&amp;Buscar y reemplazar</translation>
     </message>
@@ -228,12 +274,12 @@
         <translation>&amp;Ir a línea</translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation>&amp;Archivo</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editar</translation>
     </message>
@@ -278,14 +324,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation>Editor de Octave</translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -293,7 +339,7 @@
         <translation>El archivo\n%1\n está a punto de ser cerrado pero ha sido modificado.\n%2</translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Archivos de Octave(*.m);;Todos los archivos(*)</translation>
     </message>
@@ -319,13 +365,13 @@
         <translation>Al parecer el archivo\n%1\n ha sido eliminado o renombrado.¿Desea guardarlo ahora?%2</translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation>No se ha podido abrir el archivo %1 para escritura:\n%2.</translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation>Al parecer el archivo \&apos;%1\&apos; ha sido modificado por otra aplicación. ¿Desea recargarlo?</translation>
     </message>
@@ -485,12 +531,12 @@
         <translation>No se puede eliminar un directorio que no esté vacio</translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation>Fijar directorio de explorador de archivos</translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation>Crear archivo</translation>
     </message>
@@ -585,7 +631,7 @@
         <translation>Buscar se&amp;lección</translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation>Buscar desde el final</translation>
     </message>
@@ -708,12 +754,12 @@
         <translation>Establecer distinción entre mayúsculas y minúsculas en el texto</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation>Resultados de la búsqueda</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation>Inactivo.</translation>
     </message>
@@ -748,7 +794,7 @@
         <translation>Contenido del archivo</translation>
     </message>
     <message>
-        <location line="+100"/>
+        <location line="+99"/>
         <source>Searching...</source>
         <translation>Buscando...</translation>
     </message>
@@ -761,7 +807,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation>Nombre de archivo</translation>
     </message>
@@ -774,7 +820,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation>Explorar y buscar en el historial de comandos.</translation>
     </message>
@@ -813,23 +859,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation>Cargar espacio de trabajo</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation>Acerca de Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation>&amp;Archivo</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation>Nuevo</translation>
     </message>
@@ -840,7 +886,7 @@
         <translation>Guión</translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation>Función</translation>
     </message>
@@ -850,12 +896,12 @@
         <translation>Figura</translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation>Abrir...</translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation>Preferencias...</translation>
     </message>
@@ -865,7 +911,7 @@
         <translation>Salir</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editar</translation>
     </message>
@@ -880,28 +926,33 @@
         <translation>Copiar</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation>Pegar</translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation>Guardar espacio de trabajo como</translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation>Fijar directorio de trabajo</translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation>Limpiar el Portapapeles</translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation>Buscar archivos...</translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation>Limpiar ventana de comandos</translation>
     </message>
@@ -916,7 +967,7 @@
         <translation>Limpiar espacio de trabajo</translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation>&amp;Depurar</translation>
     </message>
@@ -961,7 +1012,27 @@
         <translation>Reestablecer esquema de ventana predeterminado</translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation>Paquetes de Octave</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation>Compartir código</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation>Contribuir a octave</translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation>Recursos para el desarrollador de Octave</translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation>En disco</translation>
     </message>
@@ -991,12 +1062,12 @@
         <translation>Explorar directorios</translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation>Cargar espacio de trabajo</translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation>&amp;Ventana</translation>
     </message>
@@ -1047,12 +1118,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation>Documentación</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation>&amp;Ayuda</translation>
     </message>
@@ -1061,33 +1132,24 @@
         <source>Report Bug</source>
         <translation>Informar de fallo</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation>Visitar Agora</translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation>Visitar Octave Forge</translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translatorcomment>Uso &quot;widget&quot; por ser el término usual: http://es.wikipedia.org/wiki/Widget</translatorcomment>
         <translation>Desacoplar widget</translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translatorcomment>Uso &quot;widget&quot; por ser el término usual: http://es.wikipedia.org/wiki/Widget</translatorcomment>
         <translation>Ocultar widget</translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translatorcomment>Uso &quot;widget&quot; por ser el término usual: http://es.wikipedia.org/wiki/Widget</translatorcomment>
         <translation>Acoplar widget</translation>
@@ -1274,12 +1336,12 @@
         <translation>Colores de la terminal</translation>
     </message>
     <message>
-        <location line="+46"/>
+        <location line="+45"/>
         <source>Font</source>
         <translation>Tipo de fuente</translation>
     </message>
     <message>
-        <location line="-745"/>
+        <location line="-744"/>
         <source>Show line numbers</source>
         <translation>Mostrar numeros de línea</translation>
     </message>
@@ -1319,7 +1381,7 @@
         <translation>Cursor parpadeante</translation>
     </message>
     <message>
-        <location line="+102"/>
+        <location line="+101"/>
         <source>Font size</source>
         <translation>Tamaño de fuente</translation>
     </message>
@@ -1389,7 +1451,7 @@
         <translation>HttpProxy</translation>
     </message>
     <message>
-        <location line="-1108"/>
+        <location line="-1107"/>
         <source>Icon set for dock widgets</source>
         <translation>Ãconos para widget acoplados</translation>
     </message>
@@ -1404,7 +1466,7 @@
         <translation>Tamaño de ícono</translation>
     </message>
     <message>
-        <location line="+1099"/>
+        <location line="+1098"/>
         <source>Socks5Proxy</source>
         <translation>&quot;Socks5Proxy&quot;</translation>
     </message>
@@ -1436,7 +1498,22 @@
         <translation>Configuración del sistema</translation>
     </message>
     <message>
-        <location line="-137"/>
+        <location line="-268"/>
+        <source>IBeam Cursor</source>
+        <translation>cursor IBeam</translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Block Cursor</source>
+        <translation>cursor de bloque</translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Underline Cursor</source>
+        <translation>cursor subrayado</translation>
+    </message>
+    <message>
+        <location line="+129"/>
         <source>Difference to the default size</source>
         <translation>Diferencia con el tamaño predeterminado</translation>
     </message>
@@ -1472,7 +1549,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation>Escriba aquí y pulse la tecla de &apos;Retorno&apos; para buscar</translation>
     </message>
@@ -1485,53 +1562,44 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation>Bienvenido a GNU Octave</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
-        <translation> Al parecer ha iniciado Octave GUI por primera vez en su 
-  computadora/ordenador, ya que no se ha encontrado un archivo 
-  de configuración en &apos;~/.octave-gui&apos;. Este asistente lo guiará con los ajustes esenciales que 
-  debe hacer antes de empezar a usar Octave GUI. Si desea transferir su configuración hecha con anterioridad 
-  solamente cierre este diálogo y copie el archivo de configuración en su carpeta de inicio. La presencia de dicho archivo de configuración será detectada automáticamente y evitará esta ventana de asistencia.  
-  IMPORTANTE: Este asistente no es completamente funcional aún. Simplemente haga clic de inicio a fin y el asistente creará un archivo de configuración estándar. </translation>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation>Al parecer usted utiiza la interfase gráfica de Octave por primera vez en este ordenador.  Presione &apos;Finalizar&apos; para generar un archivo de configuración e iniciar Octave GUI.</translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
+        <translation>La configuración ha sido guardada en __%1__. Si ese archivo existe, usted no verá este diálogo cuando Octave inicie de nuevo.</translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
-        <translation>Siguiente</translation>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
+        <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Para mayor información acerca de Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visite &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; para obtener la documentación en linea como &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- o &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;como documento &lt;/span&gt;&lt;/a&gt;-pdf, o&lt;/li&gt;
+&lt;li&gt;abrir el navegador de documentación de Octave GUI con el menú de ayuda.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation>Anterior</translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation>¡Bienvenido a Octave!</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation>Esta es la versión en desarrollo de Octave con su primer GUI oficial.</translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation>Parece que ejecuta Octave GUI por primera vez en esta computadora/ordenador. Este asistente le ayudará a configurar la instalación del programa. Presione &quot;Terminar&quot; para escribir un archivo de configuración e iniciar Octave GUI. </translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation>Terminar</translation>
     </message>
--- a/libgui/languages/fr_FR.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/fr_FR.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -83,9 +83,9 @@
 <context>
     <name>QWinTerminalImpl</name>
     <message>
-        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1451"/>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
         <source>copied selection to clipboard</source>
-        <translation>sélection copiée vers le clipboard</translation>
+        <translation>sélection copiée vers le presse-papier</translation>
     </message>
 </context>
 <context>
@@ -104,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
-        <translation>Editeur d&apos;Octave</translation>
+        <translation>Éditeur d&apos;Octave</translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
-        <translation>Fichiers d&apos;Octave (*.);;Tous les fichiers (*)</translation>
+        <translation>Fichiers d&apos;Octave (*.m);;Tous les fichiers (*)</translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation>Impossible d&apos;ouvrir le fichier %1 pour lecture :
@@ -127,14 +127,14 @@
         <source>File not saved! A file with the selected name
 %1
 is already open in the editor</source>
-        <translation>Fichier non-enregistré! Un fichier avec le nom sélectionné
+        <translation>Fichier non-enregistré! Un fichier ayant le nom sélectionné
 %1
-est déjà ouvert dans l&apos;editeur</translation>
+est déjà ouvert dans l&apos;éditeur</translation>
     </message>
     <message>
         <location line="+28"/>
         <source>The associated file editor tab has disappeared.  It was likely closed by some means.</source>
-        <translation>L&apos;onglet editeur de fichier associé a disparu. Il a probablement été fermé par un moyen quelconque.</translation>
+        <translation>L&apos;onglet éditeur de fichier associé a disparu. Il a probablement été fermé par un moyen quelconque.</translation>
     </message>
     <message>
         <location line="+205"/>
@@ -142,14 +142,14 @@
         <translation>&amp;%1 %2</translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation>&amp;Nouveau</translation>
     </message>
     <message>
         <location line="+3"/>
         <source>&amp;Open File</source>
-        <translation>&amp;Ouvrir...</translation>
+        <translation>&amp;Ouvrir</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -157,14 +157,14 @@
         <translation>&amp;Enregistrer</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation>Enregistrer &amp;sous</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
-        <translation>&amp;Imprimer</translation>
+        <translation>Imprimer</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -174,7 +174,7 @@
     <message>
         <location line="+3"/>
         <source>&amp;Redo</source>
-        <translation>&amp;Refaire</translation>
+        <translation>&amp;Rétablir</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -189,20 +189,20 @@
     <message>
         <location line="+4"/>
         <source>Paste</source>
-        <translation>C&amp;oller</translation>
+        <translation>Coller</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation>Marque page &amp;suivant</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
-        <translation>Marque page &amp;precedent</translation>
+        <translation>Marque page &amp;précédent</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation>Basculer &amp;marque page</translation>
     </message>
@@ -219,7 +219,7 @@
     <message>
         <location line="+3"/>
         <source>Pre&amp;vious breakpoint</source>
-        <translation>Point d&apos;arrêt &amp;precendent</translation>
+        <translation>Point d&apos;arrêt &amp;précédent</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -242,27 +242,27 @@
         <translation>&amp;Décommenter</translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
-        <translation>Fichiers &amp;recents</translation>
+        <translation>Fichiers &amp;récents</translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation>&amp;Fermer</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+4"/>
         <source>Close All</source>
         <translation>Tout fermer</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+5"/>
         <source>Close Other Files</source>
         <translation>Fermer les autres fichiers</translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation>&amp;Rechercher et remplacer</translation>
     </message>
@@ -277,19 +277,19 @@
         <translation>&amp;Aller à la ligne</translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation>&amp;Fichier</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editer</translation>
     </message>
     <message>
         <location line="+21"/>
         <source>&amp;Debug</source>
-        <translation>&amp;Deboguer</translation>
+        <translation>&amp;Déboguer</translation>
     </message>
     <message>
         <location line="+9"/>
@@ -327,25 +327,25 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
-        <translation>Editeur d&apos;Octave</translation>
+        <translation>Éditeur d&apos;Octave</translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
 %2</source>
         <translation>Le fichier
 %1
-est en cours de fermeture, mais il à été modifié.
+est en cours de fermeture mais il a été modifié.
 %2</translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Fichiers d&apos;Octave (*.m);;Tous les fichiers (*)</translation>
     </message>
@@ -365,7 +365,7 @@
 Warning: The contents in the editor is modified!</source>
         <translation>
 
-Avertissement: Le contenu dans l&apos;editeur est modifié!</translation>
+Avertissement: Le contenu dans l&apos;éditeur est modifié!</translation>
     </message>
     <message>
         <location line="+7"/>
@@ -377,14 +377,14 @@
 a été supprimé ou rénommé. Voulez-vous l&apos;enregistrer maintenant ?%2</translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
-        <translation>Impossible d&apos;ouvrir le fichier %1 pour ecrire :
+        <translation>Impossible d&apos;ouvrir le fichier %1 pour écrire :
 %2.</translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation>Il semblerait que &apos;%1&apos; a été modifié par une autre application. Voulez-vous le récharger ?</translation>
     </message>
@@ -547,12 +547,12 @@
         <translation>Impossible de supprimer un répertoire qui n&apos;est pas vide</translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation>Définir le répertoire de l&apos;explorateur de fichiers</translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation>Créer un fichier</translation>
     </message>
@@ -591,7 +591,7 @@
     <message>
         <location line="+4"/>
         <source>Match &amp;case</source>
-        <translation>Respecter &amp;les majuscules/minuscules</translation>
+        <translation>Respecter &amp;la casse</translation>
     </message>
     <message>
         <location line="+1"/>
@@ -611,7 +611,7 @@
     <message>
         <location line="+1"/>
         <source>Find &amp;Previous</source>
-        <translation>Rechercher le &amp;precedant</translation>
+        <translation>Rechercher le &amp;précédent</translation>
     </message>
     <message>
         <location line="+1"/>
@@ -636,7 +636,7 @@
     <message>
         <location line="+1"/>
         <source>Regular E&amp;xpressions</source>
-        <translation>E&amp;xpressions regulières</translation>
+        <translation>E&amp;xpressions régulières</translation>
     </message>
     <message>
         <location line="+1"/>
@@ -649,7 +649,7 @@
         <translation>Recherche dans la sé&amp;lection</translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation>Rechercher depuis la fin</translation>
     </message>
@@ -666,7 +666,7 @@
     <message>
         <location line="+1"/>
         <source>%1 items replaced</source>
-        <translation>%1 instances remplacés</translation>
+        <translation>%1 instances remplacées</translation>
     </message>
     <message>
         <location line="+10"/>
@@ -676,7 +676,7 @@
     <message>
         <location line="+1"/>
         <source>No more matches found</source>
-        <translation>Aucune correspondance trouvée</translation>
+        <translation>Plus aucune correspondance trouvée</translation>
     </message>
 </context>
 <context>
@@ -719,7 +719,7 @@
     <message>
         <location line="+3"/>
         <source>Recurse directories</source>
-        <translation>Parcourir recursivement les sous-répertoires</translation>
+        <translation>Parcourir récursivement les sous-répertoires</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -739,12 +739,12 @@
     <message>
         <location line="+2"/>
         <source>Name case insensitive</source>
-        <translation>Nom insensible aux majuscules/minuscules</translation>
+        <translation>Nom insensible à la casse</translation>
     </message>
     <message>
         <location line="+2"/>
         <source>Set matching name is case insensitive</source>
-        <translation>Les noms concordant sont insensible aux majuscules/minuscules</translation>
+        <translation>Les noms concordant sont insensible à la casse</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -759,25 +759,25 @@
     <message>
         <location line="+4"/>
         <source>Text to match</source>
-        <translation>Texte concordant</translation>
+        <translation>Texte à rechercher</translation>
     </message>
     <message>
         <location line="+3"/>
         <source>Text case insensitive</source>
-        <translation>Texte insensible aux majuscules/minuscules</translation>
+        <translation>Texte insensible à la casse</translation>
     </message>
     <message>
         <location line="+2"/>
         <source>Set text content is case insensitive</source>
-        <translation>Le texte concordant est insensible aux majuscules/minuscules</translation>
+        <translation>Le texte recherché est insensible à la casse</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation>Résultats de la recherche</translation>
     </message>
     <message>
-        <location line="+11"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation>Inoccupé.</translation>
     </message>
@@ -789,7 +789,7 @@
     <message>
         <location line="+1"/>
         <source>Start search for matching files</source>
-        <translation>Démarrer la recherche pour les fichiers concordants</translation>
+        <translation>Démarrer la recherche des fichiers concordants</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -799,12 +799,12 @@
     <message>
         <location line="+1"/>
         <source>Stop searching</source>
-        <translation>Arreter la recherche</translation>
+        <translation>Arrêter la recherche</translation>
     </message>
     <message>
         <location line="+15"/>
         <source>File name/location</source>
-        <translation>Nom de fichier/chemin</translation>
+        <translation>Nom/Chemin de fichier</translation>
     </message>
     <message>
         <location line="+17"/>
@@ -825,9 +825,9 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
-        <translation>Fichier</translation>
+        <translation>Nom du fichier</translation>
     </message>
     <message>
         <location line="+1"/>
@@ -838,9 +838,9 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
-        <translation>Naviguer et rechercher le historique des commandes.</translation>
+        <translation>Naviguer et rechercher l&apos;historique des commandes.</translation>
     </message>
     <message>
         <location line="+23"/>
@@ -876,23 +876,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation>Charger l&apos;espace de travail</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation>À propos d&apos;Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation>&amp;Fichier</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation>Nouveau</translation>
     </message>
@@ -902,7 +902,7 @@
         <translation>Fichier de script</translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation>Fonction</translation>
     </message>
@@ -912,12 +912,12 @@
         <translation>Figure</translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation>Ouvrir...</translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation>Préférences...</translation>
     </message>
@@ -927,14 +927,14 @@
         <translation>Quitter</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editer</translation>
     </message>
     <message>
         <location line="+5"/>
         <source>Undo</source>
-        <translation>Defaire</translation>
+        <translation>Annuler</translation>
     </message>
     <message>
         <location line="+7"/>
@@ -942,28 +942,33 @@
         <translation>Copier</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation>Coller</translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation>Enregistrer l&apos;espace de travail sous</translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation>Définir le répertoire de travail</translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation>Rechercher des fichiers...</translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation>Nettoyer la fenêtre de commande</translation>
     </message>
@@ -978,9 +983,9 @@
         <translation>Nettoyer l&apos;espace de travail</translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
-        <translation>De&amp;boguer</translation>
+        <translation>Dé&amp;boguer</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -995,7 +1000,7 @@
     <message>
         <location line="+3"/>
         <source>Step out</source>
-        <translation>Executer jusqu&apos;à l&apos;instruction de retour</translation>
+        <translation>Exécuter jusqu&apos;à l&apos;instruction de retour</translation>
     </message>
     <message>
         <location line="+4"/>
@@ -1023,7 +1028,27 @@
         <translation>Rétablir la disposition par défaut des fenêtres</translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation>Installé localement</translation>
     </message>
@@ -1050,15 +1075,15 @@
     <message>
         <location line="+3"/>
         <source>Browse directories</source>
-        <translation>Naviguer les répertoires</translation>
+        <translation>Naviguer dans les répertoires</translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation>Charger l&apos;espace de travail</translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation>&amp;Fenêtre</translation>
     </message>
@@ -1080,7 +1105,7 @@
     <message>
         <location line="+3"/>
         <source>Show Editor</source>
-        <translation>Afficher l&apos;editeur</translation>
+        <translation>Afficher l&apos;éditeur</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -1105,49 +1130,40 @@
     <message>
         <location line="+3"/>
         <source>Editor</source>
-        <translation>Editeur</translation>
+        <translation>Éditeur</translation>
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation>Documentation</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation>&amp;Aide</translation>
     </message>
     <message>
         <location line="+7"/>
         <source>Report Bug</source>
-        <translation>Signaler un bug</translation>
-    </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation>Visiter Agora</translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation>Visiter Octave Forge</translation>
+        <translation>Signaler un bogue</translation>
     </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation>Détacher le widget</translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation>Cacher le widget</translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation>Attacher le widget</translation>
     </message>
@@ -1165,12 +1181,12 @@
     <message>
         <location filename="../src/octave-qt-link.cc" line="+270"/>
         <source>The file %1 does not exist in the load path.  To debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.</source>
-        <translation>Le fichier %1 n&apos;existe pas dans les chemins accessibles.  Pour déboguer la fonction que vous éditez, vous devez soit modifier le répertoire pour %2 ou ajouter le répertoire au chemin.</translation>
+        <translation>Le fichier %1 n&apos;existe pas dans les chemins accessibles. Pour déboguer la fonction que vous éditez, vous devez soit modifier le répertoire pour %2 ou ajouter le répertoire aux chemins accessibles.</translation>
     </message>
     <message>
         <location line="+1"/>
         <source>The file %1 is shadowed by a file with the same name in the load path.  To debug the function you are editing, change to the directory %2.</source>
-        <translation>Le fichier %1 est occulté par un fichier avec le même nom dans le chemin.  Pour déboguer la fonction que vous éditez, vous devez modifier le répertoire pour %2.</translation>
+        <translation>Le fichier %1 est occulté par un fichier du même nom dans les chemins accessibles. Pour déboguer la fonction que vous éditez, vous devez modifier le répertoire pour %2.</translation>
     </message>
     <message>
         <location line="+2"/>
@@ -1223,17 +1239,17 @@
     <message>
         <location line="+39"/>
         <source>Editor</source>
-        <translation>Editeur</translation>
+        <translation>Éditeur</translation>
     </message>
     <message>
         <location line="+16"/>
         <source>Show white space</source>
-        <translation>Montrer les espaces blancs</translation>
+        <translation>Montrer les espaces</translation>
     </message>
     <message>
         <location line="+27"/>
         <source>Do not show white spaces used for indentation</source>
-        <translation>Ne pas montrer les espaces blancs utilisés pour l&apos;indentation</translation>
+        <translation>Ne pas montrer les espaces utilisés pour l&apos;indentation</translation>
     </message>
     <message>
         <location line="+28"/>
@@ -1283,7 +1299,7 @@
     <message>
         <location line="+13"/>
         <source>Case sensitive</source>
-        <translation>Sensible au maj/minuscules</translation>
+        <translation>Sensible à la casse</translation>
     </message>
     <message>
         <location line="+13"/>
@@ -1293,17 +1309,17 @@
     <message>
         <location line="+23"/>
         <source>Match words in document</source>
-        <translation>Checher dans le document</translation>
+        <translation>Inclure les mots du document</translation>
     </message>
     <message>
         <location line="+61"/>
         <source>Restore editor tabs from previous session on startup</source>
-        <translation>Restaurer les onglets de la session precedente</translation>
+        <translation>Restaurer les onglets de la session précédente</translation>
     </message>
     <message>
         <location line="+47"/>
         <source>Use custom file editor</source>
-        <translation>Utiliser un editeur externe</translation>
+        <translation>Utiliser un éditeur externe</translation>
     </message>
     <message>
         <location line="+10"/>
@@ -1318,7 +1334,7 @@
     <message>
         <location line="+24"/>
         <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select font, font size (as difference to the default size), font decoration (bold, italic, underline), textcolor and background color (for the latter, the color pink (255,0,255) is a placeholder for the default background color)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
-        <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choisir le font, la taille (difference à la taille par défaut), le style (gras, italique, sous-ligné), la couleur du texte et la couleur du fond (dans ce cas, la couleur rose [255,0,255] designé la couleur de fond par défaut)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
+        <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choisir la police, la taille (différence avec à la taille par défaut), le style (gras, italique, souligné), la couleur du texte et du fond (pour ce dernier, la couleur rose [255,0,255] designe la couleur par défaut)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
     </message>
     <message>
         <location line="+76"/>
@@ -1333,7 +1349,7 @@
     <message>
         <location line="+45"/>
         <source>Font</source>
-        <translation>Font</translation>
+        <translation>Police</translation>
     </message>
     <message>
         <location line="-744"/>
@@ -1343,7 +1359,7 @@
     <message>
         <location line="+27"/>
         <source>Highlight current line</source>
-        <translation>Sous-ligner la ligne courante</translation>
+        <translation>Surligner la ligne courante</translation>
     </message>
     <message>
         <location line="+262"/>
@@ -1368,17 +1384,17 @@
     <message>
         <location line="+15"/>
         <source>Cursor type:</source>
-        <translation>Type de courseur :</translation>
+        <translation>Type de curseur :</translation>
     </message>
     <message>
         <location line="+23"/>
         <source>Cursor blinking</source>
-        <translation>Courseur clignotant</translation>
+        <translation>Curseur clignotant</translation>
     </message>
     <message>
         <location line="+101"/>
         <source>Font size</source>
-        <translation>Taille du font</translation>
+        <translation>Taille de police</translation>
     </message>
     <message>
         <location line="+35"/>
@@ -1433,7 +1449,7 @@
     <message>
         <location line="+45"/>
         <source>Use proxy server</source>
-        <translation>Serveur proxy</translation>
+        <translation>Utiliser un serveur proxy</translation>
     </message>
     <message>
         <location line="+10"/>
@@ -1453,7 +1469,7 @@
     <message>
         <location line="+7"/>
         <source>Language (requires restart)</source>
-        <translation>Langue (necessite un redemarrage)</translation>
+        <translation>Langue (nécessite un redémarrage)</translation>
     </message>
     <message>
         <location line="+7"/>
@@ -1463,12 +1479,12 @@
     <message>
         <location line="+1098"/>
         <source>Socks5Proxy</source>
-        <translation>Proxy Sock 5</translation>
+        <translation>Proxy Socks5</translation>
     </message>
     <message>
         <location line="-16"/>
         <source>Hostname:</source>
-        <translation>Nom du hote :</translation>
+        <translation>Nom de l&apos;hote :</translation>
     </message>
     <message>
         <location line="+54"/>
@@ -1510,7 +1526,7 @@
     <message>
         <location line="+129"/>
         <source>Difference to the default size</source>
-        <translation>Difference avecla taille par défaut</translation>
+        <translation>Différence avec la taille par défaut</translation>
     </message>
     <message>
         <location line="+6"/>
@@ -1538,15 +1554,15 @@
     <message>
         <location filename="../src/terminal-dock-widget.cc" line="+38"/>
         <source>Command Window</source>
-        <translation>Fenetre de commandes</translation>
+        <translation>Fenêtre de commandes</translation>
     </message>
 </context>
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
-        <translation>Entrez le texte ici et appuyez &apos;Entrée&apos; pour lancer la recherche</translation>
+        <translation>Entrez le texte ici et appuyez sur &apos;Entrée&apos; pour lancer la recherche</translation>
     </message>
     <message>
         <location line="+4"/>
@@ -1557,48 +1573,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
-        <translation>Bienvenu dans Octave</translation>
+        <translation>Bienvenu dans GNU Octave</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
-        <translation>Il semble que vous avez lancé Octave GUI pour la premiere fois sur cet ordinateur, puisque aucun fichier de configuration n&apos;a été trouvé au &apos;~/.octave-gui&apos;. Cet assistant va vous guider à travers les reglages necessaires avant de pouvoir utiliser Octave GUI. Si vous voulez transferer des reglages que vous avez déjà fait, fermez ce dialogue et copiez le fichier de configuration dans votre repertoire personnel. La presence de ce fichier va etre detecté et cet assistant ne s&apos;affichera plus. IMPORTANT : Cet assistant n&apos;est pas encore completement fonctionnel. Passez les pages jusqu&apos;à la fin et il va créer un fichier de configuration standard.</translation>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
-        <translation>Suivant</translation>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation>Precedent</translation>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation>Bienvenu dans Octave!</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation>Ceci est la version de developpement de Octave avec le premier GUI officiel.</translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation>Il semble que vous executez Octave GUI pour la premiere fois sur cet ordinateur. Cet assistant va vous aider a configurer ce logiciel. Appuyez sur &apos;Fin&apos; pour créer le fichier de configuration et lancer Octave GUI.</translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation>Fin</translation>
     </message>
@@ -1633,7 +1639,7 @@
     <message>
         <location line="+107"/>
         <source>Right click to copy, rename, or display</source>
-        <translation>Clique droit pour copier, renommer ou afficher</translation>
+        <translation>Cliquez droit pour copier, renommer ou afficher</translation>
     </message>
 </context>
 <context>
@@ -1661,7 +1667,7 @@
     <message>
         <location line="+8"/>
         <source>Only top-level symbols may be renamed.</source>
-        <translation>Seuls les variables de plus haut niveau peuvent etre renommés.</translation>
+        <translation>Seules les variables de plus haut niveau peuvent être renommées.</translation>
     </message>
     <message>
         <location line="+125"/>
--- a/libgui/languages/nl_NL.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/nl_NL.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -83,7 +83,7 @@
 <context>
     <name>QWinTerminalImpl</name>
     <message>
-        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1451"/>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
         <source>copied selection to clipboard</source>
         <translation type="unfinished">selectie naar klembord gekopieerd</translation>
     </message>
@@ -246,7 +246,7 @@
     <message>
         <location line="+3"/>
         <source>Identifier</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">Identifier</translation>
     </message>
     <message>
         <location line="+3"/>
@@ -697,19 +697,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation></translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished">Octave bestanden (*.m);;Alle bestanden (*)</translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation>Bestand %1 kon niet geopend worden om te lezen:
@@ -735,7 +735,7 @@
         <translation></translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation>&amp;Nieuw Bestand</translation>
     </message>
@@ -750,12 +750,12 @@
         <translation>Op&amp;slaan</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation>Opslaan &amp;als</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation type="unfinished">Afdrukken</translation>
     </message>
@@ -785,17 +785,17 @@
         <translation>Plakken</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation>Volge&amp;nde bladwijzer</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation>&amp;Vorige bladwijzer</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation>&amp;Bladwijzer invoegen</translation>
     </message>
@@ -835,27 +835,27 @@
         <translation type="unfinished">Zet om naar code</translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation type="unfinished">Recent geopend</translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation type="unfinished">Sluit bestand</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+4"/>
         <source>Close All</source>
         <translation type="unfinished">Alle bestanden sluiten</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+5"/>
         <source>Close Other Files</source>
         <translation type="unfinished">Andere bestanden sluiten</translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation>Zoek en Vervang</translation>
     </message>
@@ -870,12 +870,12 @@
         <translation type="unfinished">Ga naar regel</translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation>Bestand</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation>B&amp;ewerken</translation>
     </message>
@@ -920,14 +920,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation></translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -937,7 +937,7 @@
 dat gesloten moet worden is gewijzigd.</translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished">Octave bestanden (*.m);;Alle bestanden (*)</translation>
     </message>
@@ -968,14 +968,14 @@
 is gewist of hernoemd. Wil je het nu opslaan?</translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation>Kon bestand %1 niet openen om te schrijven:
 %2.</translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation>Het lijkt erop dat &apos;%1&apos; is gewijzigd door een ander programma. Wil je het opnieuw laden?</translation>
     </message>
@@ -1137,12 +1137,12 @@
         <translation type="unfinished">Kan geen niet-lege map wissen</translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation type="unfinished">Stel file browser map in</translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation type="unfinished">Maak nieuw bestand</translation>
     </message>
@@ -1239,7 +1239,7 @@
         <translation>In se&amp;lectie zoeken</translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation type="unfinished">vanaf einde terug zoeken</translation>
     </message>
@@ -1362,12 +1362,12 @@
         <translation type="unfinished">Tekst instellen op niet-hoofdlettergevoelig</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation type="unfinished">Zoekresultaten</translation>
     </message>
     <message>
-        <location line="+11"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation type="unfinished">Niet bezig.</translation>
     </message>
@@ -1415,7 +1415,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation type="unfinished">Bestandsnaam</translation>
     </message>
@@ -1428,7 +1428,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation type="unfinished">Bladeren en zoeken door de opdrachtgeschiedenis.</translation>
     </message>
@@ -1466,23 +1466,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation>Werkruimte laden</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation>Over Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation>Bestand</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation>Nieuw</translation>
     </message>
@@ -1492,7 +1492,7 @@
         <translation>Script</translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation>Functie</translation>
     </message>
@@ -1502,12 +1502,12 @@
         <translation>Figuur</translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation>Open...</translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation>Voorkeuren...</translation>
     </message>
@@ -1517,7 +1517,7 @@
         <translation>Afsluiten</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation>B&amp;ewerken</translation>
     </message>
@@ -1532,28 +1532,33 @@
         <translation>Kopiëren</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation>Plakken</translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation type="unfinished">Bewaar werkruimte als ...</translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation type="unfinished">Stel werkmap in</translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation>Zoek bestanden...</translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation>Veeg opdrachtvenster schoon</translation>
     </message>
@@ -1568,7 +1573,7 @@
         <translation>Wis werkruimte</translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation>De&amp;buggen</translation>
     </message>
@@ -1613,7 +1618,27 @@
         <translation type="unfinished">Stel oorspronkelijke window layout opnieuw in</translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation type="unfinished">Op schijf</translation>
     </message>
@@ -1643,12 +1668,12 @@
         <translation type="unfinished">Blader door mappen</translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation>Werkruimte laden</translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation>Venster</translation>
     </message>
@@ -1699,12 +1724,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation>Documentatie</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation>Hulp</translation>
     </message>
@@ -1713,31 +1738,22 @@
         <source>Report Bug</source>
         <translation>Probleem rapporteren</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation>Bezoek Agora</translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation>Bezoek Octave Forge</translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation type="unfinished">Widget laten zweven</translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation type="unfinished">Widget verbergen</translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation type="unfinished">Widget in venster opnemen</translation>
     </message>
@@ -2134,7 +2150,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation>Typ hier en druk op &apos;Enter&apos; om te zoeken</translation>
     </message>
@@ -2147,48 +2163,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation>Welkom bij GNU Octave</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
-        <translation>Het lijkt erop dat je de Octave GUI voor de eerste keer opstart op deze computer omdat er geen configuratiebestand in &apos;~/.octave-gui&apos; is gevonden. Deze wizard zal je begeleiden tijdens het instellen van de belangrijkste zaken voordat je de Octave GUI kan gebruiken. Wil je eerder gemaakte instellingen overzetten, sluit dan dit dialoogvenster en kopieer het configuratiebestand naar je home map. De aanwezigheid van het bestand zal automatisch gedetecteerd worden en deze wizard doen overslaan. BELANGRIJK: Deze wizard is nog niet volledig functioneel. Klik door tot het einde voor standaardinstellingen.</translation>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
-        <translation>Volgende</translation>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation>Vorige</translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation>Welkom bij Octave!</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation>Dit is de ontwikkelvariant van Octave met de eerste officiële GUI.</translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation>Het lijkt erop dat je de Octave GUI voor de eerste keer uitvoert op deze computer. Deze assistent zal je helpen het programma te configureren. Klik &apos;Voltooien&apos; om een configuratiebestand te maken en de Octave GUI te starten.</translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation>Voltooien</translation>
     </message>
--- a/libgui/languages/pt_BR.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/pt_BR.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -83,7 +83,7 @@
 <context>
     <name>QWinTerminalImpl</name>
     <message>
-        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1451"/>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
         <source>copied selection to clipboard</source>
         <translation type="unfinished"></translation>
     </message>
@@ -104,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation>Editor Octave</translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Scripts Octave (*.m);;Todos Arquivos (*)</translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation>Não foi possível abrir arquivo %1 para leitura: %2.</translation>
@@ -139,7 +139,7 @@
         <translation>&amp;%1 %2</translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation>&amp;Novo Arquivo</translation>
     </message>
@@ -154,12 +154,12 @@
         <translation>&amp;Salvar Arquivo</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation>Salvar Arquivo &amp;Como</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation>Imprimir</translation>
     </message>
@@ -189,17 +189,17 @@
         <translation>Co&amp;lar</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation>&amp;Próximo Marcador</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation>Marcardor &amp;Anterior</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation>Visualizar &amp;Marcador</translation>
     </message>
@@ -239,27 +239,27 @@
         <translation>&amp;Descomentar</translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation>Arquivos &amp;recentes</translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation>&amp;Fechar</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+4"/>
         <source>Close All</source>
         <translation>Fechar &amp;Todos</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+5"/>
         <source>Close Other Files</source>
         <translation>Fechar Outros Arquivos</translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation>Procurar e Substituir</translation>
     </message>
@@ -274,12 +274,12 @@
         <translation>Vá para Linha</translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation>&amp;Arquivo</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation>&amp;Editar</translation>
     </message>
@@ -324,14 +324,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation>Editor Octave</translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -342,7 +342,7 @@
 %2</translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation>Scripts Octave (*.m);; Todos Arquivos (*)</translation>
     </message>
@@ -374,14 +374,14 @@
 foi removido ou renomeado. Pretende salvá-lo agora?%2</translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation>Não foi possível abrir arquivo %1 para escrita:
 %2.</translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation>Parece que o arquivo &apos;%1&apos; foi modificado por outra aplicação. Deseja recarregá-lo?</translation>
     </message>
@@ -542,12 +542,12 @@
         <translation>Não é possível remover um diretório que não está vázio</translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation>Alterar diretório do navegador de arquivos</translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation>Criar Arquivo</translation>
     </message>
@@ -642,7 +642,7 @@
         <translation>Seleção de busca</translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation>Procurar do final</translation>
     </message>
@@ -765,12 +765,12 @@
         <translation>Altere se conteúdo do texto é insensível a caixa alta/baixa</translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation>Resultados de Busca</translation>
     </message>
     <message>
-        <location line="+11"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation>Ocupado.</translation>
     </message>
@@ -818,7 +818,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation>Nome do Arquivo</translation>
     </message>
@@ -831,7 +831,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation>Pesquise no histórico de comandos.</translation>
     </message>
@@ -869,23 +869,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation>Carregar ambiente de trabalho</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation>Sobre o Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation>Arquivo</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation>Novo</translation>
     </message>
@@ -895,7 +895,7 @@
         <translation>Script</translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation>Função</translation>
     </message>
@@ -905,12 +905,12 @@
         <translation>Figura</translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation>Abrir...</translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation>Preferências...</translation>
     </message>
@@ -920,7 +920,7 @@
         <translation>Sair</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation>Editar</translation>
     </message>
@@ -935,28 +935,33 @@
         <translation>Copiar</translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation>Colar</translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation>Salvar Ambiente de Trabalho como</translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation>Alterar diretório de trabalho</translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation>Encontrar Arquivos...</translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation>Limpar Janela de Comandos</translation>
     </message>
@@ -971,7 +976,7 @@
         <translation>Limpar Ambiente de Trabalho</translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation>Depurar</translation>
     </message>
@@ -1016,7 +1021,27 @@
         <translation>Recuperar Disposição de Janelas Padrão</translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation>No Disco</translation>
     </message>
@@ -1046,12 +1071,12 @@
         <translation>Procurar diretórios</translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation>Carregar ambiente de trabalho</translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation>&amp;Janela</translation>
     </message>
@@ -1102,12 +1127,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation>Documentação</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation>&amp;Ajuda</translation>
     </message>
@@ -1116,31 +1141,22 @@
         <source>Report Bug</source>
         <translation>Reportar Bug</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation>Visite Agora</translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation>Visite Octave Forge</translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation>Desacoplar widget</translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation>Esconder widget</translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation>Acoplar widget</translation>
     </message>
@@ -1537,7 +1553,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation>Digite aqui e pressione &apos;Enter&apos; para procurar</translation>
     </message>
@@ -1550,48 +1566,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation>Bem-vindo ao GNU Octave</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
-        <translation>Aparentemente o Octave GUI foi lançado pela primeira vez neste computador, já que nenhum arquivo de configuração foi encontrado em &apos;~/.octave-gui&apos;. Este tutorial irá guiá-lo para realizar configurações essenciais antes de utilizar o Octave. Se deseja transferir suas configurações definidas previamente, feche este diálogo e copie os arquivos para o local apropriado. IMPORTANT: Este tutorial não é totalmente funcional ainda. Simplesmente prossiga e configurações padrão serão criadas.</translation>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
-        <translation>Próximo</translation>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation>Anterior</translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation>Bem-vindo ao Octave!</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation>Esta é a versão de desenvolvimento do Octave com a primeira GUI oficial.</translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation>Você parece ter executado o Octave GUI pela primeira vez neste computador. Este assistente irá ajudá-lo. Clique &apos;Finalizar&apos; para escrever um arquivo de configuração padrão e lançar o Octave GUI.</translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation>Finalizar</translation>
     </message>
--- a/libgui/languages/ru_RU.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/ru_RU.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,52 @@
         <source>persistent</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.cc" line="+64"/>
+        <source>foreground</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QTerminal</name>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.h" line="+116"/>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Clear All</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QWinTerminalImpl</name>
+    <message>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
+        <source>copied selection to clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>documentation_dock_widget</name>
@@ -58,19 +104,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation type="unfinished"></translation>
@@ -93,7 +139,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation type="unfinished">Созд&amp;ать</translation>
     </message>
@@ -108,12 +154,12 @@
         <translation type="unfinished">&amp;Сохранить</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation type="unfinished">Сохранить &amp;как</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
@@ -143,17 +189,17 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation type="unfinished">С&amp;Ð»ÐµÐ´ÑƒÑŽÑ‰Ð°Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation type="unfinished">Пр&amp;ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation type="unfinished">&amp;УÑтановить/ÑнÑÑ‚ÑŒ закладку</translation>
     </message>
@@ -193,27 +239,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <location line="+4"/>
+        <source>Close All</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <location line="+5"/>
-        <source>Close All</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+4"/>
         <source>Close Other Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation type="unfinished"></translation>
     </message>
@@ -228,12 +274,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;Правка</translation>
     </message>
@@ -278,14 +324,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -293,7 +339,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -319,13 +365,13 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation type="unfinished"></translation>
     </message>
@@ -475,7 +521,7 @@
     </message>
     <message>
         <location line="-10"/>
-        <source>Are you sre you want to delete
+        <source>Are you sure you want to delete
 </source>
         <translation type="unfinished"></translation>
     </message>
@@ -485,12 +531,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation type="unfinished"></translation>
     </message>
@@ -585,7 +631,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation type="unfinished"></translation>
     </message>
@@ -708,12 +754,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -748,7 +794,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+100"/>
+        <location line="+99"/>
         <source>Searching...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -761,7 +807,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
@@ -774,7 +820,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation type="unfinished">ПроÑмотр и поиÑк в журнале выполненных команд.</translation>
     </message>
@@ -812,23 +858,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation type="unfinished">Загрузить облаÑÑ‚ÑŒ переменных</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation type="unfinished">Об Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
@@ -838,7 +884,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation type="unfinished"></translation>
     </message>
@@ -848,12 +894,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -863,7 +909,7 @@
         <translation type="unfinished">Выход</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;Правка</translation>
     </message>
@@ -878,28 +924,33 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -914,7 +965,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation type="unfinished"></translation>
     </message>
@@ -959,7 +1010,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation type="unfinished"></translation>
     </message>
@@ -989,12 +1060,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1045,12 +1116,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation type="unfinished">ДокументациÑ</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1059,39 +1130,25 @@
         <source>Report Bug</source>
         <translation type="unfinished">Сообщить об ошибке</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <location line="+29"/>
-        <source>Unock widget</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_qscintilla</name>
@@ -1157,12 +1214,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Graphic  icons</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+39"/>
+        <location line="+46"/>
         <source>Editor</source>
         <translation type="unfinished">Редактор</translation>
     </message>
@@ -1272,12 +1324,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+46"/>
+        <location line="+45"/>
         <source>Font</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-745"/>
+        <location line="-744"/>
         <source>Show line numbers</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1297,7 +1349,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+548"/>
+        <location line="-72"/>
+        <source>Graphic icons</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+620"/>
         <source>emacs</source>
         <translation type="unfinished">emacs</translation>
     </message>
@@ -1317,7 +1374,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+102"/>
+        <location line="+101"/>
         <source>Font size</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1387,7 +1444,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1108"/>
+        <location line="-1107"/>
         <source>Icon set for dock widgets</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1402,7 +1459,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1099"/>
+        <location line="+1098"/>
         <source>Socks5Proxy</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1434,8 +1491,23 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-137"/>
-        <source>Difference to the defalt size</source>
+        <location line="-268"/>
+        <source>IBeam Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Block Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Underline Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+129"/>
+        <source>Difference to the default size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -1470,7 +1542,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1483,48 +1555,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation type="unfinished"></translation>
     </message>
--- a/libgui/languages/uk_UA.ts	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/languages/uk_UA.ts	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,645 @@
         <source>persistent</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.cc" line="+64"/>
+        <source>foreground</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QTerminal</name>
+    <message>
+        <location filename="../qterminal/libqterminal/QTerminal.h" line="+116"/>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Clear All</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QWinTerminalImpl</name>
+    <message>
+        <location filename="../qterminal/libqterminal/win32/QWinTerminalImpl.cpp" line="+1527"/>
+        <source>copied selection to clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerBatch</name>
+    <message>
+        <location filename="../../../qsci/qscilexerbatch.cpp" line="+179"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Label</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Hide command character</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>External command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Variable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerCPP</name>
+    <message>
+        <location filename="../../../qsci/qscilexercpp.cpp" line="+352"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc style C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc style C comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>IDL UUID</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive IDL UUID</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Pre-processor block</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive pre-processor block</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Unclosed string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive unclosed string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C# verbatim string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C# verbatim string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaScript regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaScript regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc style C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc style C++ comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Secondary keywords and identifiers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive secondary keywords and identifiers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>JavaDoc keyword error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive JavaDoc keyword error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Global classes and typedefs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive global classes and typedefs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>C++ raw string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Inactive C++ raw string</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerDiff</name>
+    <message>
+        <location filename="../../../qsci/qscilexerdiff.cpp" line="+107"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Position</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Removed line</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Added line</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Changed line</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerMatlab</name>
+    <message>
+        <location filename="../../../qsci/qscilexermatlab.cpp" line="+138"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciLexerPerl</name>
+    <message>
+        <location filename="../../../qsci/qscilexerperl.cpp" line="+333"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>POD</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Scalar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Array</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Hash</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Symbol table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Regular expression</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Substitution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backticks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Data section</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Here document delimiter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Single-quoted here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backtick here document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (q)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qq)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qx)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qr)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qw)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>POD verbatim</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Subroutine prototype</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Format identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Format body</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted string (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Translation</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Regular expression (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Substitution (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backticks (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Double-quoted here document (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Backtick here document (interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qq, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qx, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Quoted string (qr, interpolated variable)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QsciScintilla</name>
+    <message>
+        <location filename="../../../qsci/qsciscintilla.cpp" line="+4201"/>
+        <source>&amp;Undo</source>
+        <translation type="unfinished">В&amp;ернути</translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>&amp;Redo</source>
+        <translation type="unfinished">П&amp;овторити</translation>
+    </message>
+    <message>
+        <location line="+6"/>
+        <source>Cu&amp;t</source>
+        <translation type="unfinished">Виріза&amp;ти</translation>
+    </message>
+    <message>
+        <location line="+5"/>
+        <source>&amp;Copy</source>
+        <translation type="unfinished">&amp;Копіювати</translation>
+    </message>
+    <message>
+        <location line="+6"/>
+        <source>&amp;Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+4"/>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+7"/>
+        <source>Select All</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>documentation_dock_widget</name>
@@ -58,19 +697,19 @@
 <context>
     <name>file_editor</name>
     <message>
-        <location filename="../src/m-editor/file-editor.cc" line="+294"/>
+        <location filename="../src/m-editor/file-editor.cc" line="+300"/>
         <location line="+49"/>
         <location line="+28"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-193"/>
+        <location line="-199"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+117"/>
+        <location line="+123"/>
         <source>Could not open file %1 for read:
 %2.</source>
         <translation type="unfinished"></translation>
@@ -93,7 +732,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+159"/>
+        <location line="+160"/>
         <source>&amp;New File</source>
         <translation type="unfinished">&amp;Створити</translation>
     </message>
@@ -108,12 +747,12 @@
         <translation type="unfinished">&amp;Зберегти</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Save File &amp;As</source>
         <translation type="unfinished">Зберегти &amp;Ñк</translation>
     </message>
     <message>
-        <location line="+4"/>
+        <location line="+3"/>
         <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
@@ -143,17 +782,17 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>&amp;Next Bookmark</source>
         <translation type="unfinished">До &amp;наÑтупної закладки</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Pre&amp;vious Bookmark</source>
         <translation type="unfinished">До &amp;попередньої закладки</translation>
     </message>
     <message>
-        <location line="+3"/>
+        <location line="+2"/>
         <source>Toggle &amp;Bookmark</source>
         <translation type="unfinished">Ð’&amp;Ñтановити/видалити закладку</translation>
     </message>
@@ -193,27 +832,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+73"/>
+        <location line="+63"/>
         <source>&amp;Recent Editor Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
+        <location line="+16"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <location line="+4"/>
+        <source>Close All</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <location line="+5"/>
-        <source>Close All</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+4"/>
         <source>Close Other Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-94"/>
+        <location line="-85"/>
         <source>&amp;Find and Replace</source>
         <translation type="unfinished"></translation>
     </message>
@@ -228,12 +867,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+63"/>
+        <location line="+53"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+35"/>
+        <location line="+36"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;Правка</translation>
     </message>
@@ -278,14 +917,14 @@
     <message>
         <location line="+4"/>
         <location line="+114"/>
-        <location line="+104"/>
+        <location line="+109"/>
         <location line="+66"/>
         <location line="+22"/>
         <source>Octave Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-305"/>
+        <location line="-310"/>
         <source>The file
 %1
 is about to be closed but has been modified.
@@ -293,7 +932,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+184"/>
+        <location line="+189"/>
         <source>Octave Files (*.m);;All Files (*)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -319,13 +958,13 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-192"/>
+        <location line="-197"/>
         <source>Could not open file %1 for write:
 %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+170"/>
+        <location line="+175"/>
         <source>It seems that &apos;%1&apos; has been modified by another application. Do you want to reload it?</source>
         <translation type="unfinished"></translation>
     </message>
@@ -475,7 +1114,7 @@
     </message>
     <message>
         <location line="-10"/>
-        <source>Are you sre you want to delete
+        <source>Are you sure you want to delete
 </source>
         <translation type="unfinished"></translation>
     </message>
@@ -485,12 +1124,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+128"/>
+        <location line="+131"/>
         <source>Set directory of file browser</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
+        <location line="+28"/>
         <source>Create File</source>
         <translation type="unfinished"></translation>
     </message>
@@ -585,7 +1224,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+61"/>
+        <location line="+71"/>
         <source>Search from end</source>
         <translation type="unfinished"></translation>
     </message>
@@ -708,12 +1347,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+11"/>
         <source>Search results</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
+        <location line="+14"/>
         <source>Idle.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -748,7 +1387,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+100"/>
+        <location line="+99"/>
         <source>Searching...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -761,7 +1400,7 @@
 <context>
     <name>find_files_model</name>
     <message>
-        <location filename="../src/find-files-model.cc" line="+29"/>
+        <location filename="../src/find-files-model.cc" line="+76"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
@@ -774,7 +1413,7 @@
 <context>
     <name>history_dock_widget</name>
     <message>
-        <location filename="../src/history-dock-widget.cc" line="+42"/>
+        <location filename="../src/history-dock-widget.cc" line="+43"/>
         <source>Browse and search the command history.</source>
         <translation type="unfinished">ПереглÑд Ñ– пошук Ñеред Ñ–Ñторії виконаних команд.</translation>
     </message>
@@ -812,23 +1451,23 @@
 <context>
     <name>main_window</name>
     <message>
-        <location filename="../src/main-window.cc" line="+155"/>
+        <location filename="../src/main-window.cc" line="+160"/>
         <source>Load Workspace</source>
         <translation type="unfinished">Завантажити облаÑÑ‚ÑŒ змінних</translation>
     </message>
     <message>
-        <location line="+355"/>
-        <location line="+769"/>
+        <location line="+388"/>
+        <location line="+835"/>
         <source>About Octave</source>
         <translation type="unfinished">Про Octave</translation>
     </message>
     <message>
-        <location line="-338"/>
+        <location line="-354"/>
         <source>&amp;File</source>
         <translation type="unfinished">&amp;Файл</translation>
     </message>
     <message>
-        <location line="+52"/>
+        <location line="+54"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
@@ -838,7 +1477,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
+        <location line="+3"/>
         <source>Function</source>
         <translation type="unfinished"></translation>
     </message>
@@ -848,12 +1487,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-55"/>
+        <location line="-58"/>
         <source>Open...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
+        <location line="+20"/>
         <source>Preferences...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -863,7 +1502,7 @@
         <translation type="unfinished">Вийти</translation>
     </message>
     <message>
-        <location line="+51"/>
+        <location line="+52"/>
         <source>&amp;Edit</source>
         <translation type="unfinished">&amp;Правка</translation>
     </message>
@@ -878,28 +1517,33 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
+        <location line="+6"/>
         <source>Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-895"/>
-        <location line="+817"/>
+        <location line="-982"/>
+        <location line="+902"/>
         <source>Save Workspace As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-602"/>
+        <location line="-655"/>
         <source>Set working directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+686"/>
+        <location line="+739"/>
+        <source>Clear Clipboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+5"/>
         <source>Find Files...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
+        <location line="+5"/>
         <source>Clear Command Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -914,7 +1558,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
+        <location line="+40"/>
         <source>De&amp;bug</source>
         <translation type="unfinished"></translation>
     </message>
@@ -959,7 +1603,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+106"/>
+        <location line="+77"/>
+        <source>Octave Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Share Code</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Contribute to Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+3"/>
+        <source>Octave Developer Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+32"/>
         <source>On Disk</source>
         <translation type="unfinished"></translation>
     </message>
@@ -989,12 +1653,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-392"/>
+        <location line="-412"/>
         <source>Load workspace</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+192"/>
+        <location line="+200"/>
         <source>&amp;Window</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1045,12 +1709,12 @@
     </message>
     <message>
         <location line="+3"/>
-        <location line="+108"/>
+        <location line="+120"/>
         <source>Documentation</source>
         <translation type="unfinished">ДокументаціÑ</translation>
     </message>
     <message>
-        <location line="-36"/>
+        <location line="-48"/>
         <source>&amp;Help</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1059,39 +1723,25 @@
         <source>Report Bug</source>
         <translation type="unfinished">Повідомити про помилку</translation>
     </message>
-    <message>
-        <location line="+6"/>
-        <source>Visit Agora</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-3"/>
-        <source>Visit Octave Forge</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_dock_widget</name>
     <message>
         <location filename="../src/octave-dock-widget.cc" line="+52"/>
+        <location line="+129"/>
         <source>Undock widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
+        <location line="-119"/>
         <source>Hide widget</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+82"/>
+        <location line="+86"/>
         <source>Dock widget</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <location line="+29"/>
-        <source>Unock widget</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>octave_qscintilla</name>
@@ -1157,12 +1807,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Graphic  icons</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+39"/>
+        <location line="+46"/>
         <source>Editor</source>
         <translation type="unfinished">Редактор</translation>
     </message>
@@ -1272,12 +1917,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+46"/>
+        <location line="+45"/>
         <source>Font</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-745"/>
+        <location line="-744"/>
         <source>Show line numbers</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1297,7 +1942,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+548"/>
+        <location line="-72"/>
+        <source>Graphic icons</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+620"/>
         <source>emacs</source>
         <translation type="unfinished">emacs</translation>
     </message>
@@ -1317,7 +1967,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+102"/>
+        <location line="+101"/>
         <source>Font size</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1387,7 +2037,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1108"/>
+        <location line="-1107"/>
         <source>Icon set for dock widgets</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1402,7 +2052,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1099"/>
+        <location line="+1098"/>
         <source>Socks5Proxy</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1434,8 +2084,23 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-137"/>
-        <source>Difference to the defalt size</source>
+        <location line="-268"/>
+        <source>IBeam Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Block Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+1"/>
+        <source>Underline Cursor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+129"/>
+        <source>Difference to the default size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -1470,7 +2135,7 @@
 <context>
     <name>webinfo</name>
     <message>
-        <location filename="../src/qtinfo/webinfo.cc" line="+78"/>
+        <location filename="../src/qtinfo/webinfo.cc" line="+80"/>
         <source>Type here and press &apos;Return&apos; to search</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1483,48 +2148,38 @@
 <context>
     <name>welcome_wizard</name>
     <message>
-        <location filename="../src/welcome-wizard.ui" line="+26"/>
+        <location filename="../src/welcome-wizard.ui" line="+29"/>
         <source>Welcome to GNU Octave</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at &apos;~/.octave-gui&apos;. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</source>
+        <location line="+20"/>
+        <source>You seem to be using the Octave graphical interface for the first  time on this computer.  Click &apos;Finish&apos; to write a configuration file  and launch Octave GUI. </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location line="+10"/>
+        <source>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <location line="+50"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <source>Next</source>
+        <location line="+10"/>
+        <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+52"/>
-        <location line="+52"/>
-        <location line="+87"/>
-        <source>Previous</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="-45"/>
+        <location line="-27"/>
         <source>Welcome to Octave!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This is the development version of Octave with the first official GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+10"/>
-        <source>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click &apos;Finish&apos; to write a configuration file and launch Octave GUI.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location line="+48"/>
+        <location line="+74"/>
         <source>Finish</source>
         <translation type="unfinished"></translation>
     </message>
--- a/libgui/qterminal/libqterminal/QTerminal.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/QTerminal.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -77,11 +77,10 @@
 
   // Set terminal font:
   QFont term_font = QFont ();
+  term_font.setStyleHint (QFont::TypeWriter);
   term_font.setFamily
     (settings->value ("terminal/fontName", "Courier New").toString ());
-
   term_font.setPointSize (settings->value ("terminal/fontSize", 10).toInt ());
-
   setTerminalFont (term_font);
 
   QString cursorType
--- a/libgui/qterminal/libqterminal/unix/Screen.cpp	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/unix/Screen.cpp	Sat Oct 05 11:22:09 2013 -0400
@@ -788,8 +788,8 @@
 
   lastPos = loc(cuX,cuY);
 
-  // check if selection is still valid.
-  checkSelection(cuX,cuY);
+  // clear selection on text input
+  clearSelection ();
 
   Character& currentChar = screenLines[cuY][cuX];
 
--- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Sat Oct 05 11:22:09 2013 -0400
@@ -319,6 +319,10 @@
   _gridLayout->setMargin(0);
 
   setLayout( _gridLayout );
+
+  connect (this, SIGNAL (set_global_shortcuts_signal (bool)),
+           parent->parent (), SLOT (set_global_shortcuts (bool)));
+
 }
 
 TerminalView::~TerminalView()
@@ -1058,6 +1062,8 @@
 
 void TerminalView::focusInEvent(QFocusEvent *focusEvent)
 {
+  emit set_global_shortcuts_signal (false);  // disable some shortcuts
+
   setBlinkingCursorState(true);
   updateImage();
   repaint();
@@ -1068,6 +1074,8 @@
 
 void TerminalView::focusOutEvent(QFocusEvent *focusEvent)
 {
+  emit set_global_shortcuts_signal (true);  // re-enable shortcuts
+
   // Force the cursor to be redrawn.
   _cursorBlinking = true;
   setBlinkingCursorState(false);
@@ -2267,9 +2275,6 @@
 
   if (text.isEmpty ())
     {
-      // FIXME -- interrupt is only appropriate here if CTRL-C is bound
-      // to the copy action.  How can we determine that?
-
       ::raise (SIGINT);
     }
   else
--- a/libgui/qterminal/libqterminal/unix/TerminalView.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/unix/TerminalView.h	Sat Oct 05 11:22:09 2013 -0400
@@ -476,6 +476,12 @@
 
    void tripleClicked( const QString& text );
 
+   /**
+    * Emitted when focus changes
+    */
+   void set_global_shortcuts_signal (bool);
+
+
 protected:
     virtual bool event( QEvent * );
 
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 #define WIN32_LEAN_AND_MEAN
-#define _WIN32_WINNT 0x0500 
+#if ! defined (_WIN32_WINNT) && ! defined (NTDDI_VERSION)
+#define _WIN32_WINNT 0x0500
+#endif
 #include <windows.h>
 #include <cstring>
 #include <csignal>
@@ -92,6 +94,68 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+static QString translateKey (QKeyEvent *ev)
+{
+  QString esc = "\x1b";
+  QString s;
+
+  if (ev->key () == Qt::Key_Delete)
+    s = esc + "[C\b";
+  else if (!ev->text ().isEmpty ())
+    s = ev->text ();
+  else
+    {
+
+      switch (ev->key ())
+        {
+        case Qt::Key_Up:
+          s = esc + "[A";
+          break;
+
+        case Qt::Key_Down:
+          s = esc + "[B";
+          break;
+
+        case Qt::Key_Right:
+          s = esc + "[C";
+          break;
+
+        case Qt::Key_Left:
+          s = esc + "[D";
+          break;
+
+        case Qt::Key_Home:
+          s = esc + "[H";
+          break;
+
+        case Qt::Key_End:
+          s = esc + "[F";
+          break;
+
+        case Qt::Key_Insert:
+          s = esc + "[2~";
+          break;
+
+        case Qt::Key_PageUp:
+          s = esc + "[5~";
+          break;
+
+        case Qt::Key_PageDown:
+          s = esc + "[6~";
+          break;
+
+        case Qt::Key_Escape:
+          s = esc;
+          break;
+
+        default:
+          break;
+        }
+    }
+
+  return s;
+}
+
 class QConsolePrivate
 {
   friend class QWinTerminalImpl;
@@ -1099,6 +1163,9 @@
 
 #define TEXT_CHUNK_SIZE 512
 
+  // clear any selection on inserting text
+  clearSelection();
+
   int len = s.length ();
   INPUT_RECORD events[TEXT_CHUNK_SIZE];
   DWORD nEvents = 0, written;
@@ -1162,6 +1229,10 @@
 QWinTerminalImpl::QWinTerminalImpl (QWidget* parent)
     : QTerminal (parent), d (new QConsolePrivate (this))
 {
+    installEventFilter (this);
+
+    connect (this, SIGNAL (set_global_shortcuts_signal (bool)),
+           parent, SLOT (set_global_shortcuts (bool)));
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -1290,27 +1361,6 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-bool QWinTerminalImpl::winEvent (MSG* msg, long* result)
-{
-  switch (msg->message)
-    {
-    case WM_KEYDOWN:
-    case WM_KEYUP:
-    //case WM_CHAR:
-      // Forward Win32 message to the console window
-      PostMessage (d->m_consoleWindow,
-                   msg->message,
-                   msg->wParam,
-                   msg->lParam);
-      result = 0;
-      return true;
-    default:
-      return false;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
 void QWinTerminalImpl::scrollValueChanged (int value)
 {
   d->setScrollValue (value);
@@ -1332,6 +1382,8 @@
 
 void QWinTerminalImpl::focusInEvent (QFocusEvent* event)
 {
+  emit set_global_shortcuts_signal (false);   // disable some shortcuts
+
   setBlinkingCursorState (true);
 
   QWidget::focusInEvent (event);
@@ -1339,6 +1391,8 @@
 
 void QWinTerminalImpl::focusOutEvent (QFocusEvent* event)
 {
+  emit set_global_shortcuts_signal (true);    // re-enable shortcuts
+
   // Force the cursor to be redrawn.
   d->m_cursorBlinking = true;
 
@@ -1347,8 +1401,28 @@
   QWidget::focusOutEvent (event);
 }
 
+bool QWinTerminalImpl::eventFilter (QObject *obj, QEvent * event)
+{
+  // if a keypress, filter out tab keys so that the next/prev tabbing is
+  // disabled - but we still need to pass along to the console .
+  if (event->type () == QEvent::KeyPress)
+  {
+    QKeyEvent* k = static_cast<QKeyEvent*>(event);
+    if (k->key () == Qt::Key_Tab)
+    {
+      sendText ("\t");
+      return true;
+    }
+  }
+  return false;
+}
+
 void QWinTerminalImpl::keyPressEvent (QKeyEvent* event)
 {
+  QString s = translateKey (event);
+  if (!s.isEmpty ())
+    sendText (s);
+
   if (d->m_hasBlinkingCursor)
     {
       d->m_blinkCursorTimer->start (d->BLINK_DELAY);
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h	Sat Oct 05 11:22:09 2013 -0400
@@ -70,6 +70,7 @@
 signals:
   void terminated (void);
   void titleChanged (const QString&);
+  void set_global_shortcuts_signal (bool);
 
 protected:
   void viewPaintEvent (QConsoleView*, QPaintEvent*);
@@ -80,12 +81,13 @@
   void focusInEvent (QFocusEvent*);
   void focusOutEvent (QFocusEvent*);
   void keyPressEvent (QKeyEvent*);
-  bool winEvent (MSG*, long*);
   virtual void start (void);
   void mouseMoveEvent (QMouseEvent *event);
   void mousePressEvent (QMouseEvent *event);
   void mouseReleaseEvent (QMouseEvent *event);
 
+  bool eventFilter(QObject *obj, QEvent *ev);
+
 private slots:
   void scrollValueChanged (int value);
   void monitorConsole (void);
--- a/libgui/src/dialog.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/dialog.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -420,7 +420,7 @@
   buttonCancel_clicked ();
 }
 
-FileDialog::FileDialog (const QStringList& filters, const QString& title,
+FileDialog::FileDialog (const QStringList& name_filters, const QString& title,
                         const QString& filename, const QString& dirname,
                         const QString& multimode)
   : QFileDialog()
@@ -456,7 +456,7 @@
       setAcceptMode (QFileDialog::AcceptOpen);
     }
 
-  setNameFilters (filters);
+  setNameFilters (name_filters);
 
   selectFile (filename);
   
@@ -493,8 +493,8 @@
 
   path = directory ().absolutePath ();
 
-  QStringList filters = nameFilters ();
-  idx = filters.indexOf (selectedNameFilter ()) + 1;
+  QStringList name_filters = nameFilters ();
+  idx = name_filters.indexOf (selectedNameFilter ()) + 1;
   
   // send the selected info
   emit finish_input (string_result, path, idx);
--- a/libgui/src/documentation-dock-widget.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/documentation-dock-widget.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -36,6 +36,9 @@
 
   _webinfo = new webinfo (this);
   setWidget (_webinfo);
+
+  connect (p, SIGNAL(show_doc_signal(const QString &)),
+   this, SLOT(showDoc(const QString &)));
 }
 
 void
@@ -48,3 +51,15 @@
 {
   _webinfo->pasteClipboard ();
 }
+void
+documentation_dock_widget::showDoc (const QString &name)
+{
+  // show the doc pane
+  if (!isVisible ())
+    setVisible (true);
+  setFocus ();
+  raise ();
+
+  _webinfo->load_ref (name);
+
+}
--- a/libgui/src/documentation-dock-widget.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/documentation-dock-widget.h	Sat Oct 05 11:22:09 2013 -0400
@@ -39,6 +39,7 @@
   void copyClipboard ();
   void pasteClipboard ();
 
+  void showDoc (const QString & name);
 private:
 
   webinfo *_webinfo;
--- a/libgui/src/files-dock-widget.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/files-dock-widget.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -636,7 +636,10 @@
 void
 files_dock_widget::popdownmenu_home (bool)
 {
-  QString dir = QDir::homePath ();
+  QString dir = qgetenv ("HOME");
+  if (dir.isEmpty())
+    dir = QDir::homePath ();
+  
   set_current_directory (dir);
 }
 
@@ -644,7 +647,8 @@
 files_dock_widget::popdownmenu_search_dir (bool)
 {
   QString dir = QFileDialog::getExistingDirectory
-    (this, tr ("Set directory of file browser"),_file_system_model->rootPath());
+    (this, tr ("Set directory of file browser"),_file_system_model->rootPath(),
+     QFileDialog::DontUseNativeDialog);
   set_current_directory (dir);
 }
 
--- a/libgui/src/find-files-dialog.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/find-files-dialog.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -96,7 +96,8 @@
   _content_case_check->setChecked (settings->value ("findfiles/content_case", false).toBool());
   _content_case_check->setToolTip (tr ("Set text content is case insensitive"));
   
-  find_files_model * model = new find_files_model ();
+  find_files_model * model = new find_files_model (this);
+
   _file_list = new QTableView;
   _file_list->setWordWrap (false);
   _file_list->setModel (model);
@@ -105,7 +106,10 @@
   _file_list->setSelectionMode(QAbstractItemView::SingleSelection);
   _file_list->setAlternatingRowColors(true);
   _file_list->setToolTip (tr ("Search results"));
+  _file_list->setSortingEnabled (true);
   _file_list->horizontalHeader ()->restoreState (settings->value ("findfiles/column_state").toByteArray ());
+  _file_list->horizontalHeader ()->setSortIndicatorShown (true);
+  _file_list->horizontalHeader ()->setClickable (true);
   _file_list->horizontalHeader ()->setStretchLastSection (true);
   _file_list->sortByColumn (
               settings->value ("findfiles/sort_files_by_column",0).toInt (),
--- a/libgui/src/find-files-model.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/find-files-model.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -22,12 +22,60 @@
 
 #include "find-files-model.h"
 #include <QFileIconProvider>
+#include <QtAlgorithms>
+
+class find_file_less_than
+{
+public:
+  find_file_less_than (int ord)
+  {
+    _sortorder = ord;
+  }
+  QVariant getValue (const QFileInfo &f) const
+  {
+     QVariant val;
+     int col = (_sortorder > 0) ? _sortorder : -_sortorder;
+
+     switch (col-1)
+       {
+         case 0:
+           val = QVariant (f.fileName());
+           break;
+
+         case 1:
+           val = QVariant (f.absolutePath());
+           break;
+
+         default:
+            break;
+        }
+     return val;
+  }
+  bool lessThan (const QVariant &left, const QVariant &right) const
+  {
+    return left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0;
+  }
+  bool operator () (const QFileInfo &left, const QFileInfo &right) const
+  {
+     QVariant leftval = getValue(left);
+     QVariant rightval = getValue(right);
+
+     if (_sortorder > 0)
+        return lessThan(leftval, rightval);
+     else
+        return ! lessThan(leftval, rightval);
+  }
+private:
+  int _sortorder;
+};
+
 
 find_files_model::find_files_model (QObject *p)
   : QAbstractListModel(p)
 {
   _columnNames.append (tr ("Filename"));
   _columnNames.append (tr ("Directory"));
+  _sortorder = 0;
 }
 
 find_files_model::~find_files_model ()
@@ -47,21 +95,29 @@
 void 
 find_files_model::addFile (const QFileInfo &info)
 {
-  beginInsertRows(QModelIndex(), _files.size(), _files.size() );
+  beginInsertRows (QModelIndex (), _files.size (), _files.size () );
+
+  QList<QFileInfo>::Iterator it; 
+  find_file_less_than less_than(_sortorder);
 
-  _files.append(info);
+  for (it=_files.begin ();it!=_files.end ();it++)
+    {
+      if (less_than (info, *it)) break;
+    }
 
-  endInsertRows(); 
+  _files.insert (it, info);
+
+  endInsertRows (); 
 }
 
 int 
-find_files_model::rowCount (const QModelIndex & p) const
+find_files_model::rowCount (const QModelIndex &) const
 {
   return _files.size();
 }
 
 int 
-find_files_model::columnCount (const QModelIndex & p) const
+find_files_model::columnCount (const QModelIndex &) const
 {
   return _columnNames.size ();
 }
@@ -113,6 +169,27 @@
     return QVariant ();
 }
 
+void
+find_files_model::sort (int column, Qt::SortOrder order)
+{
+  if(column >= 0)
+    {
+      if (order == Qt::DescendingOrder)
+        _sortorder = -(column+1);
+      else
+        _sortorder = column+1;
+    }
+  else
+    _sortorder = 0;
+
+  if (_sortorder != 0)
+    {
+      beginResetModel ();
+      qSort (_files.begin (), _files.end (), find_file_less_than (_sortorder));
+      endResetModel ();
+    }
+}
+
 QFileInfo 
 find_files_model::fileInfo (const QModelIndex & p) const
 {
--- a/libgui/src/find-files-model.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/find-files-model.h	Sat Oct 05 11:22:09 2013 -0400
@@ -50,11 +50,14 @@
   QVariant headerData (int section, Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const;
 
+  void sort (int column, Qt::SortOrder order=Qt::AscendingOrder);
+
   QFileInfo fileInfo (const QModelIndex & p) const;
   QIcon     fileIcon (const QModelIndex &p) const;
 private:
   QList<QFileInfo> _files;
   QStringList _columnNames;
+  int _sortorder;
 };
 
 #endif // find_files_model_h
--- a/libgui/src/history-dock-widget.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/history-dock-widget.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -28,6 +28,7 @@
 #include <QClipboard>
 #include <QVBoxLayout>
 #include <QMenu>
+#include <QScrollBar>
 
 #include "error.h"
 
@@ -104,11 +105,17 @@
   QItemSelectionModel *selectionModel = _history_list_view->selectionModel();
   QModelIndexList rows = selectionModel->selectedRows();
   QModelIndexList::iterator it;
-  for (it=rows.begin() ; it != rows.end(); it++) {
-    if ((*it).isValid()) {
-      text += (*it).data().toString()+"\n";
+  bool prev_valid_row = false;
+  for (it = rows.begin(); it != rows.end(); it++)
+    {
+      if ((*it).isValid())
+        {
+          if (prev_valid_row)
+            text += "\n";
+          text += (*it).data().toString();
+          prev_valid_row = true;
+        }
     }
-  }
   QApplication::clipboard()->setText(text);
 }
 
@@ -117,11 +124,11 @@
   QItemSelectionModel *selectionModel = _history_list_view->selectionModel();
   QModelIndexList rows = selectionModel->selectedRows();
   QModelIndexList::iterator it;
-  for (it=rows.begin() ; it != rows.end(); it++) {
-    if ((*it).isValid()) {
-      emit command_double_clicked ((*it).data().toString()+"\n");
+  for (it = rows.begin() ; it != rows.end(); it++)
+    {
+      if ((*it).isValid())
+        emit command_double_clicked ((*it).data().toString());
     }
-  }
 }
 
 void
@@ -131,10 +138,16 @@
   QItemSelectionModel *selectionModel = _history_list_view->selectionModel ();
   QModelIndexList rows = selectionModel->selectedRows ();
 
+  bool prev_valid_row = false;
   for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
     {
       if ((*it).isValid ())
-        text += (*it).data().toString() + "\n";
+        {
+          if (prev_valid_row)
+            text += "\n";
+          text += (*it).data().toString();
+          prev_valid_row = true;
+        }
     }
 
   if (text.length () > 0)
@@ -145,7 +158,7 @@
 void
 history_dock_widget::handle_double_click (QModelIndex modelIndex)
 {
-  emit command_double_clicked (modelIndex.data().toString()+"\n");
+  emit command_double_clicked (modelIndex.data().toString());
 }
 
 void
@@ -160,8 +173,16 @@
 {
   QStringList lst = _history_model->stringList ();
   lst.append (hist_entry);
+
+  QScrollBar *scroll_bar = _history_list_view->verticalScrollBar ();
+
+  bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
+
   _history_model->setStringList (lst);
-  _history_list_view->scrollToBottom ();
+
+  // Scroll if slider position at bottom.
+  if (at_bottom)
+    _history_list_view->scrollToBottom ();
 }
 
 void
@@ -186,11 +207,11 @@
 history_dock_widget::pasteClipboard ()
 {
   if(_filter_line_edit->hasFocus ())
-  {
-     QClipboard *clipboard = QApplication::clipboard ();
-     QString str =  clipboard->text ();
-     if (str.length() > 0)
-       _filter_line_edit->insert (str);
-  } 
+    {
+      QClipboard *clipboard = QApplication::clipboard ();
+      QString str =  clipboard->text ();
+      if (str.length() > 0)
+        _filter_line_edit->insert (str);
+    }
 }
 
--- a/libgui/src/m-editor/file-editor-tab.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1010,6 +1010,11 @@
   else
     fileDialog = new QFileDialog (this);
 
+  // Giving trouble under KDE (problem is related to Qt signal handling on unix,
+  // see https://bugs.kde.org/show_bug.cgi?id=260719 ,
+  // it had/has no effect on Windows, though)
+  fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
+
   if (!_file_name.isEmpty () && _file_name.at (_file_name.count () - 1) != '/')
     {
       fileDialog->selectFile (_file_name);
--- a/libgui/src/m-editor/file-editor.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -176,6 +176,12 @@
   // Create a NonModal message.
   QFileDialog *fileDialog = new QFileDialog (this);
   fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
+
+  // Giving trouble under KDE (problem is related to Qt signal handling on unix,
+  // see https://bugs.kde.org/show_bug.cgi?id=260719 ,
+  // it had/has no effect on Windows, though)
+  fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
+
   fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
   fileDialog->setViewMode (QFileDialog::Detail);
   fileDialog->setDirectory (ced);
@@ -668,6 +674,7 @@
             }
         }
     }
+    check_actions ();
 }
 
 void
@@ -738,21 +745,19 @@
   QAction *open_action = new QAction (QIcon (":/actions/icons/fileopen.png"),
                                       tr ("&Open File"), _tool_bar);
 
-  QAction *save_action = new QAction (QIcon (":/actions/icons/filesave.png"),
+  _save_action = new QAction (QIcon (":/actions/icons/filesave.png"),
                                       tr ("&Save File"), _tool_bar);
 
-  QAction *save_as_action
-    = new QAction (QIcon (":/actions/icons/filesaveas.png"),
-                   tr ("Save File &As"), _tool_bar);
+  _save_as_action = new QAction (QIcon (":/actions/icons/filesaveas.png"),
+                                tr ("Save File &As"), _tool_bar);
 
-  QAction *print_action
-    = new QAction ( QIcon (":/actions/icons/fileprint.png"),
-                    tr ("Print"), _tool_bar);
+  _print_action = new QAction ( QIcon (":/actions/icons/fileprint.png"),
+                                tr ("Print"), _tool_bar);
 
-  QAction *undo_action = new QAction (QIcon (":/actions/icons/undo.png"),
+  _undo_action = new QAction (QIcon (":/actions/icons/undo.png"),
                                       tr ("&Undo"), _tool_bar);
 
-  QAction *redo_action = new QAction (QIcon (":/actions/icons/redo.png"),
+  _redo_action = new QAction (QIcon (":/actions/icons/redo.png"),
                                       tr ("&Redo"), _tool_bar);
 
   _copy_action = new QAction (QIcon (":/actions/icons/editcopy.png"),
@@ -761,20 +766,17 @@
   _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"),
                               tr ("Cu&t"), _tool_bar);
 
-  QAction *paste_action
+  _paste_action
     = new QAction (QIcon (":/actions/icons/editpaste.png"),
                    tr ("Paste"), _tool_bar);
 
-  QAction *next_bookmark_action
-    = new QAction (tr ("&Next Bookmark"), _tool_bar);
+  _next_bookmark_action = new QAction (tr ("&Next Bookmark"), _tool_bar);
+
+  _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"), _tool_bar);
 
-  QAction *previous_bookmark_action
-    = new QAction (tr ("Pre&vious Bookmark"), _tool_bar);
+  _toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"), _tool_bar);
 
-  QAction *toggle_bookmark_action
-    = new QAction (tr ("Toggle &Bookmark"), _tool_bar);
-
-  QAction *remove_bookmark_action
+  _remove_bookmark_action
     = new QAction (tr ("&Remove All Bookmarks"), _tool_bar);
 
   QAction *next_breakpoint_action
@@ -790,19 +792,19 @@
     = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
                    tr ("&Remove All breakpoints"), _tool_bar);
 
-  QAction *comment_selection_action
+  _comment_selection_action
     = new QAction (tr ("&Comment"), _tool_bar);
 
-  QAction *uncomment_selection_action
+  _uncomment_selection_action
     = new QAction (tr ("&Uncomment"), _tool_bar);
 
-  QAction *find_action = new QAction (QIcon (":/actions/icons/search.png"),
+  _find_action = new QAction (QIcon (":/actions/icons/search.png"),
                                       tr ("&Find and Replace"), _tool_bar);
 
   _run_action = new QAction (QIcon (":/actions/icons/artsbuilderexecute.png"),
                              tr ("Save File And Run"), _tool_bar);
 
-  QAction *goto_line_action = new QAction (tr ("Go&to Line"), _tool_bar);
+  _goto_line_action = new QAction (tr ("Go&to Line"), _tool_bar);
 
   // the mru-list and an empty array of actions
   QSettings *settings = resource_manager::get_settings ();
@@ -817,46 +819,36 @@
   // some actions are disabled from the beginning
   _copy_action->setEnabled (false);
   _cut_action->setEnabled (false);
-  _run_action->setShortcut (Qt::ControlModifier+ Qt::Key_R);
+
   _run_action->setShortcutContext (Qt::WindowShortcut);
-  save_action->setShortcut (QKeySequence::Save);
-  save_action->setShortcutContext (Qt::WindowShortcut);
-  save_as_action->setShortcut (QKeySequence::SaveAs);
-  save_as_action->setShortcutContext (Qt::WindowShortcut);
+  _save_action->setShortcutContext (Qt::WindowShortcut);
+  _save_as_action->setShortcutContext (Qt::WindowShortcut);
 
-  print_action->setShortcut (QKeySequence::Print);
-  print_action->setShortcutContext (Qt::WindowShortcut);
+  _print_action->setShortcutContext (Qt::WindowShortcut);
 
-  next_bookmark_action->setShortcut (Qt::Key_F2);
-  next_bookmark_action->setShortcutContext (Qt::WindowShortcut);
-  previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2);
-  previous_bookmark_action->setShortcutContext (Qt::WindowShortcut);
-  toggle_bookmark_action->setShortcut (Qt::Key_F7);
-  toggle_bookmark_action->setShortcutContext (Qt::WindowShortcut);
-  comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_7);
-  comment_selection_action->setShortcutContext (Qt::WindowShortcut);
-  uncomment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_8);
-  uncomment_selection_action->setShortcutContext (Qt::WindowShortcut);
-  find_action->setShortcut (QKeySequence::Find);
-  find_action->setShortcutContext (Qt::WindowShortcut);
-  goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G);
-  goto_line_action->setShortcutContext (Qt::WindowShortcut);
+  _next_bookmark_action->setShortcutContext (Qt::WindowShortcut);
+  _previous_bookmark_action->setShortcutContext (Qt::WindowShortcut);
+  _toggle_bookmark_action->setShortcutContext (Qt::WindowShortcut);
+  _comment_selection_action->setShortcutContext (Qt::WindowShortcut);
+  _uncomment_selection_action->setShortcutContext (Qt::WindowShortcut);
+  _find_action->setShortcutContext (Qt::WindowShortcut);
+  _goto_line_action->setShortcutContext (Qt::WindowShortcut);
 
   // toolbar
   _tool_bar->addAction (new_action);
   _tool_bar->addAction (open_action);
-  _tool_bar->addAction (save_action);
-  _tool_bar->addAction (save_as_action);
+  _tool_bar->addAction (_save_action);
+  _tool_bar->addAction (_save_as_action);
   _tool_bar->addSeparator ();
-  _tool_bar->addAction (print_action);
+  _tool_bar->addAction (_print_action);
   _tool_bar->addSeparator ();
-  _tool_bar->addAction (undo_action);
-  _tool_bar->addAction (redo_action);
+  _tool_bar->addAction (_undo_action);
+  _tool_bar->addAction (_redo_action);
   _tool_bar->addAction (_copy_action);
   _tool_bar->addAction (_cut_action);
-  _tool_bar->addAction (paste_action);
+  _tool_bar->addAction (_paste_action);
   _tool_bar->addSeparator ();
-  _tool_bar->addAction (find_action);
+  _tool_bar->addAction (_find_action);
   _tool_bar->addAction (_run_action);
   _tool_bar->addSeparator ();
   _tool_bar->addAction (toggle_breakpoint_action);
@@ -876,49 +868,50 @@
   fileMenu->addMenu (_mru_file_menu);
 
   fileMenu->addSeparator ();
-  fileMenu->addAction (save_action);
-  fileMenu->addAction (save_as_action);
+  fileMenu->addAction (_save_action);
+  fileMenu->addAction (_save_as_action);
 
   fileMenu->addSeparator ();
-  fileMenu->addAction (QIcon::fromTheme("window-close",
-                                      QIcon (":/actions/icons/fileclose.png")),
-                       tr ("&Close"),
-                       this, SLOT (request_close_file (bool)),
-                             QKeySequence::Close);
-  fileMenu->addAction (QIcon::fromTheme("window-close",
+  _close_action =
+      fileMenu->addAction (QIcon::fromTheme("window-close",
+                                  QIcon (":/actions/icons/fileclose.png")),
+                       tr ("&Close"), this, SLOT (request_close_file (bool)));
+  _close_all_action =
+      fileMenu->addAction (QIcon::fromTheme("window-close",
                                       QIcon (":/actions/icons/fileclose.png")),
                        tr ("Close All"),
                        this, SLOT (request_close_all_files (bool)));
+  _close_others_action = 
   fileMenu->addAction (QIcon::fromTheme("window-close",
                                       QIcon (":/actions/icons/fileclose.png")),
                        tr ("Close Other Files"),
                        this, SLOT (request_close_other_files (bool)));
 
   fileMenu->addSeparator ();
-  fileMenu->addAction (print_action);
+  fileMenu->addAction (_print_action);
 
   _menu_bar->addMenu (fileMenu);
 
 
   QMenu *editMenu = new QMenu (tr ("&Edit"), _menu_bar);
-  editMenu->addAction (undo_action);
-  editMenu->addAction (redo_action);
+  editMenu->addAction (_undo_action);
+  editMenu->addAction (_redo_action);
   editMenu->addSeparator ();
   editMenu->addAction (_copy_action);
   editMenu->addAction (_cut_action);
-  editMenu->addAction (paste_action);
+  editMenu->addAction (_paste_action);
   editMenu->addSeparator ();
-  editMenu->addAction (find_action);
+  editMenu->addAction (_find_action);
   editMenu->addSeparator ();
-  editMenu->addAction (comment_selection_action);
-  editMenu->addAction (uncomment_selection_action);
+  editMenu->addAction (_comment_selection_action);
+  editMenu->addAction (_uncomment_selection_action);
   editMenu->addSeparator ();
-  editMenu->addAction (toggle_bookmark_action);
-  editMenu->addAction (next_bookmark_action);
-  editMenu->addAction (previous_bookmark_action);
-  editMenu->addAction (remove_bookmark_action);
+  editMenu->addAction (_toggle_bookmark_action);
+  editMenu->addAction (_next_bookmark_action);
+  editMenu->addAction (_previous_bookmark_action);
+  editMenu->addAction (_remove_bookmark_action);
   editMenu->addSeparator ();
-  editMenu->addAction (goto_line_action);
+  editMenu->addAction (_goto_line_action);
   _menu_bar->addMenu (editMenu);
 
   _debug_menu = new QMenu (tr ("&Debug"), _menu_bar);
@@ -934,6 +927,10 @@
   _run_menu->addAction (_run_action);
   _menu_bar->addMenu (_run_menu);
 
+  // shortcuts
+  set_shortcuts (true);
+
+  // layout
   QVBoxLayout *vbox_layout = new QVBoxLayout ();
   vbox_layout->addWidget (_menu_bar);
   vbox_layout->addWidget (_tool_bar);
@@ -942,6 +939,7 @@
   editor_widget->setLayout (vbox_layout);
   setWidget (editor_widget);
 
+  // signals
   connect (main_win (), SIGNAL (new_file_signal (const QString&)),
            this, SLOT (request_new_file (const QString&)));
 
@@ -954,10 +952,10 @@
   connect (open_action, SIGNAL (triggered ()),
            this, SLOT (request_open_file ()));
 
-  connect (undo_action, SIGNAL (triggered ()),
+  connect (_undo_action, SIGNAL (triggered ()),
            this, SLOT (request_undo ()));
 
-  connect (redo_action, SIGNAL (triggered ()),
+  connect (_redo_action, SIGNAL (triggered ()),
            this, SLOT (request_redo ()));
 
   connect (_copy_action, SIGNAL (triggered ()),
@@ -966,31 +964,31 @@
   connect (_cut_action, SIGNAL (triggered ()),
            this, SLOT (request_cut ()));
 
-  connect (paste_action, SIGNAL (triggered ()),
+  connect (_paste_action, SIGNAL (triggered ()),
            this, SLOT (request_paste ()));
 
-  connect (save_action, SIGNAL (triggered ()),
+  connect (_save_action, SIGNAL (triggered ()),
            this, SLOT (request_save_file ()));
 
-  connect (save_as_action, SIGNAL (triggered ()),
+  connect (_save_as_action, SIGNAL (triggered ()),
            this, SLOT (request_save_file_as ()));
 
-  connect (print_action, SIGNAL (triggered ()),
+  connect (_print_action, SIGNAL (triggered ()),
            this, SLOT (request_print_file ()));
 
   connect (_run_action, SIGNAL (triggered ()),
            this, SLOT (request_run_file ()));
 
-  connect (toggle_bookmark_action, SIGNAL (triggered ()),
+  connect (_toggle_bookmark_action, SIGNAL (triggered ()),
            this, SLOT (request_toggle_bookmark ()));
 
-  connect (next_bookmark_action, SIGNAL (triggered ()),
+  connect (_next_bookmark_action, SIGNAL (triggered ()),
            this, SLOT (request_next_bookmark ()));
 
-  connect (previous_bookmark_action, SIGNAL (triggered ()),
+  connect (_previous_bookmark_action, SIGNAL (triggered ()),
            this, SLOT (request_previous_bookmark ()));
 
-  connect (remove_bookmark_action, SIGNAL (triggered ()),
+  connect (_remove_bookmark_action, SIGNAL (triggered ()),
            this, SLOT (request_remove_bookmark ()));
 
   connect (toggle_breakpoint_action, SIGNAL (triggered ()),
@@ -1005,16 +1003,16 @@
   connect (remove_all_breakpoints_action, SIGNAL (triggered ()),
            this, SLOT (request_remove_breakpoint ()));
 
-  connect (comment_selection_action, SIGNAL (triggered ()),
+  connect (_comment_selection_action, SIGNAL (triggered ()),
            this, SLOT (request_comment_selected_text ()));
 
-  connect (uncomment_selection_action, SIGNAL (triggered ()),
+  connect (_uncomment_selection_action, SIGNAL (triggered ()),
            this, SLOT (request_uncomment_selected_text ()));
 
-  connect (find_action, SIGNAL (triggered ()),
+  connect (_find_action, SIGNAL (triggered ()),
            this, SLOT (request_find ()));
 
-  connect (goto_line_action, SIGNAL (triggered ()),
+  connect (_goto_line_action, SIGNAL (triggered ()),
            this, SLOT (request_goto_line ()));
 
   connect (_mru_file_menu, SIGNAL (triggered (QAction *)),
@@ -1041,6 +1039,8 @@
       for (int n = 0; n < sessionFileNames.count (); ++n)
         request_open_file (sessionFileNames.at (n));
     }
+
+    check_actions ();
 }
 
 void
@@ -1169,6 +1169,8 @@
            f, SLOT (do_breakpoint_marker (bool, const QWidget*, int)));
 
   _tab_widget->setCurrentWidget (f);
+
+  check_actions ();
 }
 
 void
@@ -1192,4 +1194,96 @@
   }
 }
 
+void
+file_editor::set_shortcuts (bool set)
+{
+  if (set)
+    {
+      _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_7);
+      _uncomment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_8);
+
+      _copy_action->setShortcut (QKeySequence::Copy);
+      _cut_action->setShortcut (QKeySequence::Cut);
+      _paste_action->setShortcut (QKeySequence::Paste);
+
+      _find_action->setShortcut (QKeySequence::Find);
+      _goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G);
+
+      _next_bookmark_action->setShortcut (Qt::Key_F2);
+      _previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2);
+      _toggle_bookmark_action->setShortcut (Qt::Key_F7);
+
+      _print_action->setShortcut (QKeySequence::Print);
+      _run_action->setShortcut (Qt::ControlModifier+ Qt::Key_R);
+
+      _save_action->setShortcut (QKeySequence::Save);
+      _save_as_action->setShortcut (QKeySequence::SaveAs);
+      _close_action->setShortcut (QKeySequence::Close);
+
+      _redo_action->setShortcut (QKeySequence::Redo);
+      _undo_action->setShortcut (QKeySequence::Undo);
+    }
+  else
+    {
+      QKeySequence no_key = QKeySequence ();
+
+      _comment_selection_action->setShortcut (no_key);
+      _uncomment_selection_action->setShortcut (no_key);
+
+      _copy_action->setShortcut (no_key);
+      _cut_action->setShortcut (no_key);
+      _paste_action->setShortcut (no_key);
+
+      _find_action->setShortcut (no_key);
+      _goto_line_action->setShortcut (no_key);
+
+      _next_bookmark_action->setShortcut (no_key);
+      _previous_bookmark_action->setShortcut (no_key);
+      _toggle_bookmark_action->setShortcut (no_key);
+
+      _print_action->setShortcut (no_key);
+      _run_action->setShortcut (no_key);
+
+      _save_action->setShortcut (no_key);
+      _save_as_action->setShortcut (no_key);
+      _close_action->setShortcut (no_key);
+
+      _redo_action->setShortcut (no_key);
+      _undo_action->setShortcut (no_key);
+    }
+}
+
+void
+file_editor::check_actions ()
+{
+  bool  have_tabs = _tab_widget->count () > 0;
+
+  _comment_selection_action->setEnabled (have_tabs);
+  _uncomment_selection_action->setEnabled (have_tabs);
+
+  _copy_action->setEnabled (have_tabs);
+  _cut_action->setEnabled (have_tabs);
+  _paste_action->setEnabled (have_tabs);
+
+  _find_action->setEnabled (have_tabs);
+  _goto_line_action->setEnabled (have_tabs);
+
+  _next_bookmark_action->setEnabled (have_tabs);
+  _previous_bookmark_action->setEnabled (have_tabs);
+  _toggle_bookmark_action->setEnabled (have_tabs);
+
+  _print_action->setEnabled (have_tabs);
+  _run_action->setEnabled (have_tabs);
+
+  _save_action->setEnabled (have_tabs);
+  _save_as_action->setEnabled (have_tabs);
+  _close_action->setEnabled (have_tabs);
+  _close_all_action->setEnabled (have_tabs);
+  _close_others_action->setEnabled (have_tabs && _tab_widget->count () > 1);
+
+  _undo_action->setEnabled (have_tabs);
+  _redo_action->setEnabled (have_tabs);
+}
+
+
 #endif
--- a/libgui/src/m-editor/file-editor.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/m-editor/file-editor.h	Sat Oct 05 11:22:09 2013 -0400
@@ -57,6 +57,7 @@
   void handle_enter_debug_mode (void);
   void handle_exit_debug_mode (void);
 
+  void check_actions (void);
 signals:
 
   void fetab_settings_changed (const QSettings *settings);
@@ -152,6 +153,10 @@
   // Tells the editor to react on changed settings.
   void notice_settings (const QSettings *settings);
 
+  // Tells the ditor to dis- or enable some shortcuts
+  void set_shortcuts (bool set_shortcuts);
+
+
 protected slots:
   void copyClipboard ();
   void pasteClipboard ();
@@ -178,10 +183,36 @@
   QMenuBar *_menu_bar;
   QToolBar *_tool_bar;
   QMenu *_debug_menu;
+
+  QAction *_comment_selection_action;
+  QAction *_uncomment_selection_action;
+
   QAction *_copy_action;
   QAction *_cut_action;
+  QAction *_paste_action;
+
+  QAction *_find_action;
+  QAction *_goto_line_action;
+
+  QAction *_next_bookmark_action;
+  QAction *_previous_bookmark_action;
+  QAction *_toggle_bookmark_action;
+  QAction * _remove_bookmark_action;
+
+  QAction *_print_action;
   QAction *_run_action;
+
+  QAction *_save_action;
+  QAction *_save_as_action;
+  QAction *_close_action;
+  QAction *_close_all_action;
+  QAction *_close_others_action;
+
+  QAction *_redo_action;
+  QAction *_undo_action;
+
   QTabWidget *_tab_widget;
+
   int _marker_breakpoint;
 
   enum { MaxMRUFiles = 10 };
--- a/libgui/src/m-editor/find-dialog.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/m-editor/find-dialog.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -158,7 +158,17 @@
   _find_next_button->setDefault (true);
   _find_result_available = false;
 
-  move (p->x() + p->frameGeometry ().width (), p->y());
+  // move to dialog to side of the parent if there is room on the desktop to do so.
+  QWidget * desktop = QApplication::desktop ();
+  int xp = p->x () + p->frameGeometry ().width ();
+  int yp=  p->y ();
+  if (desktop != 0 && sizeHint ().isValid ())
+    {
+      if (xp + sizeHint ().width () > desktop->width ())
+        xp = desktop->width () - sizeHint ().width ();
+    }
+
+  move (xp, yp);
 
 }
 
--- a/libgui/src/main-window.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/main-window.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -77,7 +77,11 @@
     workspace_window (new workspace_view (this)),
     find_files_dlg (0),
     _octave_main_thread (0),
-    _octave_qt_link (0)
+    _octave_qt_link (0),
+    _clipboard (QApplication::clipboard ()),
+    _cmd_queue (new QStringList ()),  // no command pending
+    _cmd_processing (1),
+    _cmd_queue_mutex ()
 {
   // We have to set up all our windows, before we finally launch octave.
   construct ();
@@ -103,6 +107,7 @@
     }
   delete _octave_main_thread;
   delete _octave_qt_link;
+  delete _cmd_queue;
 }
 
 bool
@@ -139,7 +144,7 @@
 main_window::handle_save_workspace_request (void)
 {
   QString file =
-    QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".");
+    QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".", 0, 0, QFileDialog::DontUseNativeDialog);
 
   if (! file.isEmpty ())
     octave_link::post_event (this, &main_window::save_workspace_callback,
@@ -152,7 +157,7 @@
   QString file = file_arg;
 
   if (file.isEmpty ())
-    file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".");
+    file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".", 0, 0, QFileDialog::DontUseNativeDialog);
 
   if (! file.isEmpty ())
     octave_link::post_event (this, &main_window::load_workspace_callback,
@@ -197,9 +202,7 @@
 void
 main_window::execute_command_in_terminal (const QString& command)
 {
-  octave_link::post_event (this, &main_window::execute_command_callback,
-                           command.toStdString ());
-
+  queue_command (command);
   focus_command_window ();
 }
 
@@ -210,6 +213,28 @@
 }
 
 void
+main_window::run_file_callback (const QFileInfo& info)
+{
+  QString dir = info.absolutePath ();
+  QString function_name = info.fileName ();
+  function_name.chop (info.suffix ().length () + 1);
+  if (octave_qt_link::file_in_path (info.absoluteFilePath ().toStdString (),
+                                    dir.toStdString ()))
+    queue_command (function_name);
+}
+
+void
+main_window::queue_command (QString command)
+{
+  _cmd_queue_mutex.lock ();
+  _cmd_queue->append (command);   // queue command
+  _cmd_queue_mutex.unlock ();
+
+  if (_cmd_processing.tryAcquire ())   // if callback is not processing, post event
+    octave_link::post_event (this, &main_window::execute_command_callback);
+}
+
+void
 main_window::handle_new_figure_request (void)
 {
   octave_link::post_event (this, &main_window::new_figure_callback);
@@ -218,25 +243,37 @@
 void
 main_window::open_online_documentation_page (void)
 {
-  QDesktopServices::openUrl (QUrl ("http://gnu.org/software/octave/doc/interpreter"));
+  QDesktopServices::openUrl (QUrl ("http://octave.org/doc/interpreter"));
 }
 
 void
 main_window::open_bug_tracker_page (void)
 {
-  QDesktopServices::openUrl (QUrl ("http://bugs.octave.org"));
+  QDesktopServices::openUrl (QUrl ("http://octave.org/bugs.html"));
 }
 
 void
-main_window::open_octave_forge_page (void)
+main_window::open_octave_packages_page (void)
 {
-  QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
+  QDesktopServices::openUrl (QUrl ("http://octave.org/packages.html"));
 }
 
 void
 main_window::open_agora_page (void)
 {
-  QDesktopServices::openUrl (QUrl ("http://agora.octave.org/"));
+  QDesktopServices::openUrl (QUrl ("http://agora.octave.org"));
+}
+
+void
+main_window::open_contribute_page (void)
+{
+  QDesktopServices::openUrl (QUrl ("http://octave.org/donate.html"));
+}
+
+void
+main_window::open_developer_page (void)
+{
+  QDesktopServices::openUrl (QUrl ("http://octave.org/get-involved.html"));
 }
 
 void
@@ -354,7 +391,7 @@
 main_window::browse_for_directory (void)
 {
   QString dir
-    = QFileDialog::getExistingDirectory (this, tr ("Set working directory"));
+    = QFileDialog::getExistingDirectory (this, tr ("Set working directory"), 0, QFileDialog::DontUseNativeDialog);
 
   set_current_working_directory (dir);
 
@@ -505,9 +542,11 @@
 void
 main_window::show_about_octave (void)
 {
-  QString message = OCTAVE_STARTUP_MESSAGE;
+  std::string message
+    = octave_name_version_copyright_copying_warranty_and_bugs (true);
 
-  QMessageBox::about (this, tr ("About Octave"), message);
+  QMessageBox::about (this, tr ("About Octave"),
+                      QString::fromStdString (message));
 }
 
 void
@@ -542,6 +581,8 @@
 void
 main_window::set_window_layout (QSettings *settings)
 {
+  QList<octave_dock_widget *> float_and_visible;
+
   // Restore the geometry of all dock-widgets
   foreach (octave_dock_widget *widget, dock_widget_list ())
     {
@@ -555,7 +596,7 @@
           if (floating)
             widget->make_window ();
           else if (! widget->parent ())  // should not be floating but is
-            widget->setParent (this);    // reparent
+            widget->make_widget (false); // no docking, just reparent
 
           // restore geometry
           QVariant val = settings->value (name);
@@ -564,12 +605,24 @@
           // make widget visible if desired
           bool visible = settings->value
               ("DockWidgets/" + name + "Visible", true).toBool ();
-          widget->setVisible (visible);
+          if (floating && visible)              // floating and visible
+            float_and_visible.append (widget);  // not show before main win
+          else
+            {
+              widget->make_widget ();
+              widget->setVisible (visible);       // not floating -> show
+            }
         }
     }
 
   restoreState (settings->value ("MainWindow/windowState").toByteArray ());
   restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
+  show ();  // main window is ready and can be shown (as first window)
+
+  // show floating widgets after main win to ensure "Octave" in central menu
+  foreach (octave_dock_widget *widget, float_and_visible)
+     widget->setVisible (true);
+
 }
 
 void
@@ -799,6 +852,9 @@
   connect (file_browser_window, SIGNAL (find_files_signal (const QString&)),
            this, SLOT (find_files (const QString&)));
 
+  connect (this, SIGNAL (set_widget_shortcuts_signal (bool)),
+           editor_window, SLOT (set_shortcuts (bool)));
+
   connect_uiwidget_links ();
 
   setWindowTitle ("Octave");
@@ -856,6 +912,9 @@
   set_current_working_directory (curr_dir.absolutePath ());
 
   octave_link::post_event (this, &main_window::resize_command_window_callback);
+
+  set_global_shortcuts (true);
+
 }
 
 void
@@ -907,6 +966,10 @@
   connect (_octave_qt_link, SIGNAL (exit_debugger_signal ()),
            this, SLOT (handle_exit_debugger ()));
 
+  connect (_octave_qt_link,
+           SIGNAL (show_preferences_signal (void)),
+           this, SLOT (process_settings_dialog_request ()));
+
 #ifdef HAVE_QSCINTILLA
   connect (_octave_qt_link,
            SIGNAL (edit_file_signal (const QString&)),
@@ -929,6 +992,10 @@
            this,
            SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int)));
 
+  connect (_octave_qt_link,
+           SIGNAL (show_doc_signal (const QString &)),
+           this, SLOT (handle_show_doc (const QString &)));
+
   connect (_workspace_model,
            SIGNAL (rename_variable (const QString&, const QString&)),
            this,
@@ -966,6 +1033,8 @@
   _open_action
     = file_menu->addAction (QIcon (":/actions/icons/fileopen.png"),
                             tr ("Open..."));
+  _open_action->setShortcutContext (Qt::ApplicationShortcut);
+
 
 #ifdef HAVE_QSCINTILLA
   file_menu->addMenu (editor_window->get_mru_menu ());
@@ -987,8 +1056,8 @@
 
   file_menu->addSeparator ();
 
-  QAction *exit_action = file_menu->addAction (tr ("Exit"));
-  exit_action->setShortcut (QKeySequence::Quit);
+  _exit_action = file_menu->addAction (tr ("Exit"));
+  _exit_action->setShortcutContext (Qt::ApplicationShortcut);
 
   connect (preferences_action, SIGNAL (triggered ()),
            this, SLOT (process_settings_dialog_request ()));
@@ -1004,7 +1073,7 @@
   connect (save_workspace_action, SIGNAL (triggered ()),
            this, SLOT (handle_save_workspace_request ()));
 
-  connect (exit_action, SIGNAL (triggered ()),
+  connect (_exit_action, SIGNAL (triggered ()),
            this, SLOT (close ()));
 }
 
@@ -1016,6 +1085,7 @@
   _new_script_action
     = new_menu->addAction (QIcon (":/actions/icons/filenew.png"),
                            tr ("Script"));
+  _new_script_action->setShortcutContext (Qt::ApplicationShortcut);
 
   QAction *new_function_action = new_menu->addAction (tr ("Function"));
   new_function_action->setEnabled (true);
@@ -1051,18 +1121,21 @@
   _copy_action
     = edit_menu->addAction (QIcon (":/actions/icons/editcopy.png"),
                             tr ("Copy"), this, SLOT (copyClipboard ()));
-  _copy_action->setShortcut (ctrl_shift + Qt::Key_C);
+  _copy_action->setShortcut (QKeySequence::Copy);
+
 
   _paste_action
     = edit_menu->addAction (QIcon (":/actions/icons/editpaste.png"),
                             tr ("Paste"), this, SLOT (pasteClipboard ()));
-  _paste_action->setShortcut (ctrl_shift + Qt::Key_V);
+  _paste_action->setShortcut (QKeySequence::Paste);
+
+  _clear_clipboard_action
+    = edit_menu->addAction (tr ("Clear Clipboard"), this,
+                            SLOT (clear_clipboard ()));
 
   edit_menu->addSeparator ();
 
-  QAction *find_files_action
-    = edit_menu->addAction (tr ("Find Files..."));
-  find_files_action->setShortcut (ctrl_shift + Qt::Key_F);
+  _find_files_action = edit_menu->addAction (tr ("Find Files..."));
 
   edit_menu->addSeparator ();
 
@@ -1075,7 +1148,7 @@
   QAction *clear_workspace_action
     = edit_menu->addAction (tr ("Clear Workspace"));
 
-  connect (find_files_action, SIGNAL (triggered()),
+  connect (_find_files_action, SIGNAL (triggered()),
            this, SLOT (find_files ()));
 
   connect (clear_command_window_action, SIGNAL (triggered ()),
@@ -1086,6 +1159,10 @@
 
   connect (clear_workspace_action, SIGNAL (triggered ()),
            this, SLOT (handle_clear_workspace_request ()));
+
+  connect (_clipboard, SIGNAL (changed (QClipboard::Mode)),
+           this, SLOT (clipboard_has_changed (QClipboard::Mode)));
+  clipboard_has_changed (QClipboard::Clipboard);
 }
 
 QAction *
@@ -1288,11 +1365,17 @@
   QAction *report_bug_action
     = help_menu->addAction (tr ("Report Bug"));
 
-  QAction *octave_forge_action
-    = help_menu->addAction (tr ("Visit Octave Forge"));
+  QAction *octave_packages_action
+    = help_menu->addAction (tr ("Octave Packages"));
 
   QAction *agora_action
-    = help_menu->addAction (tr ("Visit Agora"));
+    = help_menu->addAction (tr ("Share Code"));
+
+  QAction *contribute_action
+    = help_menu->addAction (tr ("Contribute to Octave"));
+
+  QAction *developer_action
+    = help_menu->addAction (tr ("Octave Developer Resources"));
 
   help_menu->addSeparator ();
 
@@ -1302,12 +1385,18 @@
   connect (report_bug_action, SIGNAL (triggered ()),
            this, SLOT (open_bug_tracker_page ()));
 
-  connect (octave_forge_action, SIGNAL (triggered ()),
-           this, SLOT (open_octave_forge_page ()));
+  connect (octave_packages_action, SIGNAL (triggered ()),
+           this, SLOT (open_octave_packages_page ()));
 
   connect (agora_action, SIGNAL (triggered ()),
            this, SLOT (open_agora_page ()));
 
+  connect (contribute_action, SIGNAL (triggered ()),
+           this, SLOT (open_contribute_page ()));
+
+  connect (developer_action, SIGNAL (triggered ()),
+           this, SLOT (open_developer_page ()));
+
   connect (about_octave_action, SIGNAL (triggered ()),
            this, SLOT (show_about_octave ()));
 }
@@ -1443,29 +1532,34 @@
 }
 
 void
-main_window::execute_command_callback (const std::string& command)
+main_window::execute_command_callback ()
 {
-  std::string pending_input = command_editor::get_current_line ();
+  bool repost = false;          // flag for reposting event for this callback
 
-  command_editor::set_initial_input (pending_input);
-
-  command_editor::replace_line (command);
-  command_editor::redisplay ();
+  if (!_cmd_queue->isEmpty ())  // list can not be empty here, just to make sure
+    {
+      std::string pending_input = command_editor::get_current_line ();
+      command_editor::set_initial_input (pending_input);
 
-  // We are executing inside the command editor event loop.  Force
-  // the current line to be returned for processing.
-  command_editor::interrupt ();
-}
+      _cmd_queue_mutex.lock (); // critical path
+      std::string command = _cmd_queue->takeFirst ().toStdString ();
+      if (_cmd_queue->isEmpty ())
+        _cmd_processing.release ();  // command queue empty, processing will stop
+      else
+        repost = true;          // not empty, repost at end
+      _cmd_queue_mutex.unlock ();
+
+      command_editor::replace_line (command);
 
-void
-main_window::run_file_callback (const QFileInfo& info)
-{
-  QString dir = info.absolutePath ();
-  QString function_name = info.fileName ();
-  function_name.chop (info.suffix ().length () + 1);
-  if (octave_qt_link::file_in_path (info.absoluteFilePath ().toStdString (),
-                                    dir.toStdString ()))
-    execute_command_callback (function_name.toStdString ());
+      command_editor::redisplay ();
+      // We are executing inside the command editor event loop.  Force
+      // the current line to be returned for processing.
+      command_editor::interrupt ();
+    }
+
+  if (repost)  // queue not empty, so repost event for further processing
+    octave_link::post_event (this, &main_window::execute_command_callback);
+
 }
 
 void
@@ -1571,4 +1665,64 @@
 
 }
 
+void
+main_window::set_global_shortcuts (bool set_shortcuts)
+{
+  if (set_shortcuts)
+    {
 
+      _open_action->setShortcut (QKeySequence::Open);
+      _new_script_action->setShortcut (QKeySequence::New);
+
+      _exit_action->setShortcut (QKeySequence::Quit);
+
+      _find_files_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_F);
+
+    }
+  else
+    {
+
+      QKeySequence no_key = QKeySequence ();
+
+      _open_action->setShortcut (no_key);
+      _new_script_action->setShortcut (no_key);
+
+      _exit_action->setShortcut (no_key);
+
+      _find_files_action->setShortcut (no_key);
+
+    }
+
+  emit set_widget_shortcuts_signal (set_shortcuts);
+}
+
+void
+main_window::handle_show_doc (const QString& file)
+{
+  doc_browser_window->setVisible (true);
+  emit show_doc_signal (file);
+}
+
+void
+main_window::clipboard_has_changed (QClipboard::Mode cp_mode)
+{
+  if (cp_mode == QClipboard::Clipboard)
+    {
+      if (_clipboard->text ().isEmpty ())
+        {
+          _paste_action->setEnabled (false);
+          _clear_clipboard_action->setEnabled (false);
+        }
+      else
+        {
+          _paste_action->setEnabled (true);
+          _clear_clipboard_action->setEnabled (true);
+        }
+    }
+}
+
+void
+main_window::clear_clipboard ()
+{
+  _clipboard->clear (QClipboard::Clipboard);
+}
--- a/libgui/src/main-window.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/main-window.h	Sat Oct 05 11:22:09 2013 -0400
@@ -36,6 +36,7 @@
 #include <QCloseEvent>
 #include <QToolButton>
 #include <QComboBox>
+#include <QSemaphore>
 
 // Editor includes
 #include "file-editor-interface.h"
@@ -82,6 +83,8 @@
   void new_file_signal (const QString&);
   void open_file_signal (const QString&);
 
+  void show_doc_signal (const QString&);
+
   void insert_debugger_pointer_signal (const QString& file, int line);
   void delete_debugger_pointer_signal (const QString& file, int line);
   void update_breakpoint_marker_signal (bool insert, const QString& file,
@@ -90,6 +93,8 @@
   void copyClipboard_signal (void);
   void pasteClipboard_signal (void);
 
+  void set_widget_shortcuts_signal (bool);
+
 public slots:
   void report_status_message (const QString& statusMessage);
   void handle_save_workspace_request (void);
@@ -104,8 +109,10 @@
   void open_file (const QString& file_name = QString ());
   void open_online_documentation_page (void);
   void open_bug_tracker_page (void);
-  void open_octave_forge_page (void);
+  void open_octave_packages_page (void);
   void open_agora_page (void);
+  void open_contribute_page (void);
+  void open_developer_page (void);
   void process_settings_dialog_request (void);
   void show_about_octave (void);
   void notice_settings (const QSettings *settings);
@@ -169,9 +176,20 @@
                                  const QString &dirname,
                                  const QString& multimode);
 
+  void handle_show_doc (const QString &file);
+
   // find files dialog 
   void find_files(const QString &startdir=QDir::currentPath());
   void find_files_finished(int);
+
+  // setting global shortcuts
+  void set_global_shortcuts (bool enable);
+
+  // handling the clipboard
+  void clipboard_has_changed (QClipboard::Mode);
+  void clear_clipboard ();
+
+
 protected:
   void closeEvent (QCloseEvent * closeEvent);
 
@@ -218,7 +236,7 @@
 
   void clear_history_callback (void);
 
-  void execute_command_callback (const std::string& command);
+  void execute_command_callback ();
   void run_file_callback (const QFileInfo& info);
 
   void new_figure_callback (void);
@@ -237,7 +255,8 @@
 
   void exit_callback (void);
 
-  // Data models.
+  void queue_command (QString command);  // Data models.
+
   workspace_model *_workspace_model;
 
   // Toolbars.
@@ -257,7 +276,9 @@
     list.append (static_cast<octave_dock_widget *> (history_window));
     list.append (static_cast<octave_dock_widget *> (file_browser_window));
     list.append (static_cast<octave_dock_widget *> (doc_browser_window));
+#ifdef HAVE_QSCINTILLA
     list.append (static_cast<octave_dock_widget *> (editor_window));
+#endif
     list.append (static_cast<octave_dock_widget *> (workspace_window));
     return list;
   }
@@ -276,8 +297,12 @@
 
   QAction *_copy_action;
   QAction *_paste_action;
+  QAction *_clear_clipboard_action;
   QAction *_undo_action;
 
+  QAction *_find_files_action;
+  QAction *_exit_action;
+
   // Toolbars.
   QComboBox *_current_directory_combo_box;
   static const int current_directory_width = 300;
@@ -292,8 +317,15 @@
 
   octave_qt_link *_octave_qt_link;
 
+  QClipboard *_clipboard;
+
   // Flag for closing whole application.
   bool _closing;
+
+  // semaphore to synchronize execution signals and related callback
+  QStringList *_cmd_queue;
+  QSemaphore   _cmd_processing;
+  QMutex       _cmd_queue_mutex;
 };
 
 #endif // MAINWINDOW_H
--- a/libgui/src/octave-dock-widget.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-dock-widget.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -55,6 +55,7 @@
   QToolButton *dock_button = new QToolButton (this);
   dock_button->setDefaultAction (_dock_action);
   dock_button->setFocusPolicy(Qt::NoFocus);
+  dock_button->setIconSize(QSize(12,12));
 
   QAction *close_action = new QAction
                    (QIcon (":/actions/icons/widget-close.png"), "", this );
@@ -64,6 +65,7 @@
   QToolButton *close_button = new QToolButton (this);
   close_button->setDefaultAction (close_action);
   close_button->setFocusPolicy(Qt::NoFocus);
+  close_button->setIconSize(QSize(12,12));
 
   QHBoxLayout *h_layout = new QHBoxLayout ();
   h_layout->addStretch (100);
@@ -152,7 +154,7 @@
 
 // dock the widget
 void
-octave_dock_widget::make_widget ()
+octave_dock_widget::make_widget (bool dock)
 {
   QSettings *settings = resource_manager::get_settings ();
 
@@ -161,14 +163,18 @@
                       saveGeometry ());
   settings->sync ();
 
-  // add widget to last saved docking area
-  int area = settings->value ("DockWidgets/" + objectName () + "_dock_area",
-                               Qt::TopDockWidgetArea).toInt ();
-  _parent->addDockWidget (static_cast<Qt::DockWidgetArea> (area), this);
+  if (dock)
+    { // add widget to last saved docking area (dock=true is default)
+      int area = settings->value ("DockWidgets/" + objectName () + "_dock_area",
+                                   Qt::TopDockWidgetArea).toInt ();
+      _parent->addDockWidget (static_cast<Qt::DockWidgetArea> (area), this);
 
-  // FIXME: restoreGeometry is ignored for docked widgets and its child widget
-  // restoreGeometry (settings->value
-  //        ("DockWidgets/" + objectName ()).toByteArray ());
+      // FIXME: restoreGeometry is ignored for docked widgets and its child widget
+      // restoreGeometry (settings->value
+      //        ("DockWidgets/" + objectName ()).toByteArray ());
+    }
+  else  // only reparent, no docking
+    setParent (_parent);
 
   // adjust the (un)dock icon
   _dock_action->setIcon (QIcon (":/actions/icons/widget-undock.png"));
--- a/libgui/src/octave-dock-widget.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-dock-widget.h	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,7 @@
 
   virtual void connect_visibility_changed (void);
   void make_window (void);
-  void make_widget (void);
+  void make_widget (bool dock=true);
   void set_title (const QString&);
 
 signals:
--- a/libgui/src/octave-gui.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-gui.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -38,8 +38,11 @@
 
 #include "lo-utils.h"
 #include "oct-env.h"
+#include "oct-syscalls.h"
 #include "syswait.h"
 
+#include "sighandlers.h"
+
 #include "welcome-wizard.h"
 #include "resource-manager.h"
 #include "main-window.h"
@@ -73,8 +76,7 @@
     {
       // Parent
 
-      // FIXME -- we should catch signals and pass them on to the child
-      // process in some way, possibly translating SIGINT to SIGTERM.
+      install_gui_driver_signal_handlers (pid);
 
       int status;
 
@@ -88,12 +90,20 @@
 }
 
 int
-octave_start_gui (int argc, char *argv[])
+octave_start_gui (int argc, char *argv[], bool fork)
 {
-  dissociate_terminal ();
+  if (fork)
+    dissociate_terminal ();
 
   QApplication application (argc, argv);
 
+  // install translators for the gui and qt text
+  QTranslator gui_tr, qt_tr, qsci_tr;
+  resource_manager::config_translators (&qt_tr,&qsci_tr,&gui_tr);
+  application.installTranslator (&qt_tr);
+  application.installTranslator (&qsci_tr);
+  application.installTranslator (&gui_tr);
+
   while (true)
     {
       if (resource_manager::is_first_run ())
@@ -104,13 +114,6 @@
         }
       else
         {
-          // install translators for the gui and qt text
-          QTranslator gui_tr, qt_tr, qsci_tr;
-          resource_manager::config_translators (&qt_tr,&qsci_tr,&gui_tr);
-          application.installTranslator (&qt_tr);
-          application.installTranslator (&qsci_tr);
-          application.installTranslator (&gui_tr);
-
           // update network-settings
           resource_manager::update_network_settings ();
 
@@ -123,13 +126,16 @@
 
           if (term.empty ())
             octave_env::putenv ("TERM", "xterm");
+#else
+          std::string term = octave_env::getenv ("TERM");
+
+          if (term.empty ())
+            octave_env::putenv ("TERM", "cygwin");
 #endif
 
           // create main window, read settings, and show window
           main_window w;
-          w.read_settings ();  // get widget settings after construction
-                               // but before showing
-          w.show ();
+          w.read_settings ();  // get widget settings and window layout
           w.focus_command_window ();
           w.connect_visibility_changed (); // connect signals for changes in
                                            // visibility not before w is shown
--- a/libgui/src/octave-gui.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-gui.h	Sat Oct 05 11:22:09 2013 -0400
@@ -23,6 +23,7 @@
 #if !defined (octave_octave_gui_h)
 #define octave_octave_gui_h 1
 
-extern OCTGUI_API int octave_start_gui (int argc, char **argv);
+extern OCTGUI_API int octave_start_gui (int argc, char **argv,
+                                        bool fork = true);
 
 #endif
--- a/libgui/src/octave-qt-link.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-qt-link.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -491,3 +491,17 @@
 
   return ok;
 }
+
+void
+octave_qt_link::do_show_preferences ()
+{
+  emit show_preferences_signal ();
+}
+
+void
+octave_qt_link::do_show_doc (const std::string& file)
+{
+  emit show_doc_signal (QString::fromStdString (file));
+}
+
+
--- a/libgui/src/octave-qt-link.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/octave-qt-link.h	Sat Oct 05 11:22:09 2013 -0400
@@ -121,6 +121,9 @@
 
   static bool file_in_path (const std::string& file, const std::string& dir);
 
+  void do_show_preferences (void);
+
+  void do_show_doc (const std::string& file);
 private:
 
   // No copying!
@@ -166,6 +169,10 @@
 
   void insert_debugger_pointer_signal (const QString&, int);
   void delete_debugger_pointer_signal (const QString&, int);
+
+  void show_preferences_signal (void);
+
+  void show_doc_signal (const QString &file);
 };
 
 #endif
--- a/libgui/src/qtinfo/parser.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/qtinfo/parser.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -179,9 +179,29 @@
 parser::get_next_node (QIODevice *io)
 {
   QString text;
+  QByteArray line, line_buffer;
+  char c;
+  int i;
+
   while (!io->atEnd ())
     {
-      QByteArray line = io->readLine ();
+      io->getChar (&c);
+      if (c)
+        { // first char is not equal 0
+          io->ungetChar (c);
+          line = io->readLine ();
+        }
+      else
+        { // 0 was read -> image -> text length changes
+          line_buffer = io->readLine ();  // image tag that is not needed
+          line = io->readLine ();         // firsts line of text message
+          for (i=1; i<line_buffer.size ()+6; i++)  // correct the size
+            line.insert (line.size ()-1,QByteArray(" "));   // by adding blanks
+        }
+
+      if (line.at (0) == '"' && line.size () == 5)  // end of image construct
+        line = " ";
+
       if (line.at(0) == 31)
         {
           break;
@@ -341,7 +361,9 @@
       info_to_html (text1);
       info_to_html (text2);
 
-      text = text1 + "<a name='" + anchor + "' /><img src=':/actions/icons/stop.png'>" + text2;
+      text = text1 + "<a name='" + anchor
+                   + "'/><img src=':/actions/icons/redled.png'><br>&nbsp;"
+                   + text2;
     }
   else
     {
@@ -371,7 +393,9 @@
   text.append (navigationLinks);
   text.prepend ("<html><body>\n");
   text.append ("</body></html>\n");
+
   return text;
+
 }
 
 void
@@ -592,3 +616,24 @@
   results.append ("</body></html>");
   return results;
 }
+
+QString 
+parser::find_ref (const QString &ref_name)
+{
+  QString text = "";
+
+  QHash<QString,node_position>::iterator it;
+  for (it=_ref_map.begin ();it!=_ref_map.end ();++it)
+    {
+      QString k = it.key ();
+      node_position p = it.value ();
+
+      if (k == "XREF" + ref_name)
+        {
+          // found ref, so return its name
+          text = "XREF" + ref_name;
+        }
+    }
+  return text;
+}
+
--- a/libgui/src/qtinfo/parser.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/qtinfo/parser.h	Sat Oct 05 11:22:09 2013 -0400
@@ -57,6 +57,8 @@
   QString search_node (const QString& node);
   QString global_search (const QString& text, int maxFounds);
 
+  QString find_ref (const QString &name);
+
   /** Checks if this node is reference. If node is reference, it will be returned its position
     * in text, else  it will be returned -1.
     */
--- a/libgui/src/qtinfo/webinfo.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/qtinfo/webinfo.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -93,6 +93,7 @@
   resize (500, 300);
 
   set_info_path (QString::fromStdString (Vinfo_file));
+
 }
 
 void
@@ -190,6 +191,24 @@
 }
 
 void
+webinfo::load_ref (const QString &ref_name)
+{
+  QString text = _parser.find_ref (ref_name);
+  if (text.length () > 0)
+    {
+      load_node (text);
+    }
+  else
+    {
+      // not found
+     load_node("Top");
+    }
+
+   if (_text_browser)
+     _text_browser->setFocus(); 
+}
+
+void
 webinfo::search ()
 {
   if (_search_check_box->isChecked ())
--- a/libgui/src/qtinfo/webinfo.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/qtinfo/webinfo.h	Sat Oct 05 11:22:09 2013 -0400
@@ -40,6 +40,8 @@
   webinfo (QWidget *parent = 0);
   void set_info_path (const QString& info_path);
   void load_node (const QString& node_name);
+ 
+  void load_ref (const QString &ref_name); 
 
 public slots:
   void link_clicked (const QUrl& link);
--- a/libgui/src/resource-manager.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/resource-manager.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -153,13 +153,28 @@
   return home_path;
 }
 
+QString
+resource_manager::do_get_settings_path (void)
+{
+  QDesktopServices desktopServices;
+  home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation);
+  QString settings_path = home_path + "/.config/octave/";
+  return settings_path;
+}
+
+QString
+resource_manager::do_get_settings_file (void)
+{
+  return do_get_settings_path ()  + "qt-settings";
+}
+
 void
 resource_manager::do_reload_settings (void)
 {
   QDesktopServices desktopServices;
   home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation);
-  QString settings_path = home_path + "/.config/octave/";
-  QString settings_file = settings_path + "qt-settings";
+  QString settings_path = do_get_settings_path ();
+  QString settings_file = do_get_settings_file ();
 
   if (!QFile::exists (settings_file))
     {
@@ -235,1564 +250,3 @@
 {
   return QTerminal::default_colors ();
 }
-
-const char*
-resource_manager::octave_keywords (void)
-{
-  return
-      ".nargin. "
-      "EDITOR "
-      "EXEC_PATH "
-      "F_DUPFD "
-      "F_GETFD "
-      "F_GETFL "
-      "F_SETFD "
-      "F_SETFL "
-      "I "
-      "IMAGE_PATH "
-      "Inf "
-      "J "
-      "NA "
-      "NaN "
-      "OCTAVE_HOME "
-      "OCTAVE_VERSION "
-      "O_APPEND "
-      "O_ASYNC "
-      "O_CREAT "
-      "O_EXCL "
-      "O_NONBLOCK "
-      "O_RDONLY "
-      "O_RDWR "
-      "O_SYNC "
-      "O_TRUNC "
-      "O_WRONLY "
-      "PAGER "
-      "PAGER_FLAGS "
-      "PS1 "
-      "PS2 "
-      "PS4 "
-      "P_tmpdir "
-      "SEEK_CUR "
-      "SEEK_END "
-      "SEEK_SET "
-      "SIG "
-      "S_ISBLK "
-      "S_ISCHR "
-      "S_ISDIR "
-      "S_ISFIFO "
-      "S_ISLNK "
-      "S_ISREG "
-      "S_ISSOCK "
-      "WCONTINUE "
-      "WCOREDUMP "
-      "WEXITSTATUS "
-      "WIFCONTINUED "
-      "WIFEXITED "
-      "WIFSIGNALED "
-      "WIFSTOPPED "
-      "WNOHANG "
-      "WSTOPSIG "
-      "WTERMSIG "
-      "WUNTRACED "
-      "__accumarray_max__ "
-      "__accumarray_min__ "
-      "__accumarray_sum__ "
-      "__accumdim_sum__ "
-      "__all_opts__ "
-      "__builtins__ "
-      "__calc_dimensions__ "
-      "__contourc__ "
-      "__current_scope__ "
-      "__delaunayn__ "
-      "__dispatch__ "
-      "__display_tokens__ "
-      "__dsearchn__ "
-      "__dump_symtab_info__ "
-      "__end__ "
-      "__error_text__ "
-      "__finish__ "
-      "__fltk_ginput__ "
-      "__fltk_print__ "
-      "__fltk_uigetfile__ "
-      "__ftp__ "
-      "__ftp_ascii__ "
-      "__ftp_binary__ "
-      "__ftp_close__ "
-      "__ftp_cwd__ "
-      "__ftp_delete__ "
-      "__ftp_dir__ "
-      "__ftp_mget__ "
-      "__ftp_mkdir__ "
-      "__ftp_mode__ "
-      "__ftp_mput__ "
-      "__ftp_pwd__ "
-      "__ftp_rename__ "
-      "__ftp_rmdir__ "
-      "__get__ "
-      "__glpk__ "
-      "__gnuplot_drawnow__ "
-      "__gnuplot_get_var__ "
-      "__gnuplot_ginput__ "
-      "__gnuplot_has_feature__ "
-      "__gnuplot_open_stream__ "
-      "__gnuplot_print__ "
-      "__gnuplot_version__ "
-      "__go_axes__ "
-      "__go_axes_init__ "
-      "__go_close_all__ "
-      "__go_delete__ "
-      "__go_draw_axes__ "
-      "__go_draw_figure__ "
-      "__go_execute_callback__ "
-      "__go_figure__ "
-      "__go_figure_handles__ "
-      "__go_handles__ "
-      "__go_hggroup__ "
-      "__go_image__ "
-      "__go_line__ "
-      "__go_patch__ "
-      "__go_surface__ "
-      "__go_text__ "
-      "__go_uimenu__ "
-      "__gud_mode__ "
-      "__image_pixel_size__ "
-      "__init_fltk__ "
-      "__isa_parent__ "
-      "__keywords__ "
-      "__lexer_debug_flag__ "
-      "__lin_interpn__ "
-      "__list_functions__ "
-      "__magick_finfo__ "
-      "__magick_format_list__ "
-      "__magick_read__ "
-      "__magick_write__ "
-      "__makeinfo__ "
-      "__marching_cube__ "
-      "__next_line_color__ "
-      "__next_line_style__ "
-      "__operators__ "
-      "__parent_classes__ "
-      "__parser_debug_flag__ "
-      "__pathorig__ "
-      "__pchip_deriv__ "
-      "__plt_get_axis_arg__ "
-      "__print_parse_opts__ "
-      "__qp__ "
-      "__request_drawnow__ "
-      "__sort_rows_idx__ "
-      "__strip_html_tags__ "
-      "__token_count__ "
-      "__unimplemented__ "
-      "__varval__ "
-      "__version_info__ "
-      "__voronoi__ "
-      "__which__ "
-      "abs "
-      "accumarray "
-      "accumdim "
-      "acos "
-      "acosd "
-      "acosh "
-      "acot "
-      "acotd "
-      "acoth "
-      "acsc "
-      "acscd "
-      "acsch "
-      "add_input_event_hook "
-      "addlistener "
-      "addpath "
-      "addproperty "
-      "addtodate "
-      "airy "
-      "all "
-      "allchild "
-      "allow_noninteger_range_as_index "
-      "amd "
-      "ancestor "
-      "and "
-      "angle "
-      "anova "
-      "ans "
-      "any "
-      "arch_fit "
-      "arch_rnd "
-      "arch_test "
-      "area "
-      "arg "
-      "argnames "
-      "argv "
-      "arma_rnd "
-      "arrayfun "
-      "asctime "
-      "asec "
-      "asecd "
-      "asech "
-      "asin "
-      "asind "
-      "asinh "
-      "assert "
-      "assignin "
-      "atan "
-      "atan2 "
-      "atand "
-      "atanh "
-      "atexit "
-      "autocor "
-      "autocov "
-      "autoload "
-      "autoreg_matrix "
-      "autumn "
-      "available_graphics_toolkits "
-      "axes "
-      "axis "
-      "balance "
-      "bar "
-      "barh "
-      "bartlett "
-      "bartlett_test "
-      "base2dec "
-      "beep "
-      "beep_on_error "
-      "bessel "
-      "besselh "
-      "besseli "
-      "besselj "
-      "besselk "
-      "bessely "
-      "beta "
-      "betacdf "
-      "betai "
-      "betainc "
-      "betainv "
-      "betaln "
-      "betapdf "
-      "betarnd "
-      "bicgstab "
-      "bicubic "
-      "bin2dec "
-      "bincoeff "
-      "binocdf "
-      "binoinv "
-      "binopdf "
-      "binornd "
-      "bitand "
-      "bitcmp "
-      "bitget "
-      "bitmax "
-      "bitor "
-      "bitpack "
-      "bitset "
-      "bitshift "
-      "bitunpack "
-      "bitxor "
-      "blackman "
-      "blanks "
-      "blkdiag "
-      "blkmm "
-      "bone "
-      "box "
-      "break "
-      "brighten "
-      "bsxfun "
-      "bug_report "
-      "builtin "
-      "bunzip2 "
-      "bzip2 "
-      "calendar "
-      "canonicalize_file_name "
-      "cart2pol "
-      "cart2sph "
-      "case "
-      "cast "
-      "cat "
-      "catch "
-      "cauchy_cdf "
-      "cauchy_inv "
-      "cauchy_pdf "
-      "cauchy_rnd "
-      "caxis "
-      "cbrt "
-      "ccolamd "
-      "cd "
-      "ceil "
-      "cell "
-      "cell2mat "
-      "cell2struct "
-      "celldisp "
-      "cellfun "
-      "cellidx "
-      "cellindexmat "
-      "cellslices "
-      "cellstr "
-      "center "
-      "cgs "
-      "char "
-      "chdir "
-      "chi2cdf "
-      "chi2inv "
-      "chi2pdf "
-      "chi2rnd "
-      "chisquare_test_homogeneity "
-      "chisquare_test_independence "
-      "chol "
-      "chol2inv "
-      "choldelete "
-      "cholinsert "
-      "cholinv "
-      "cholshift "
-      "cholupdate "
-      "chop "
-      "circshift "
-      "cla "
-      "clabel "
-      "class "
-      "clc "
-      "clear "
-      "clf "
-      "clg "
-      "clock "
-      "cloglog "
-      "close "
-      "closereq "
-      "colamd "
-      "colloc "
-      "colon "
-      "colorbar "
-      "colormap "
-      "colperm "
-      "colstyle "
-      "columns "
-      "comet "
-      "comet3 "
-      "comma "
-      "command_line_path "
-      "common_size "
-      "commutation_matrix "
-      "compan "
-      "compare_versions "
-      "compass "
-      "complement "
-      "completion_append_char "
-      "completion_matches "
-      "complex "
-      "computer "
-      "cond "
-      "condest "
-      "confirm_recursive_rmdir "
-      "conj "
-      "continue "
-      "contour "
-      "contour3 "
-      "contourc "
-      "contourf "
-      "contrast "
-      "conv "
-      "conv2 "
-      "convhull "
-      "convhulln "
-      "convn "
-      "cool "
-      "copper "
-      "copyfile "
-      "cor "
-      "cor_test "
-      "corrcoef "
-      "cos "
-      "cosd "
-      "cosh "
-      "cot "
-      "cotd "
-      "coth "
-      "cov "
-      "cplxpair "
-      "cputime "
-      "cquad "
-      "crash_dumps_octave_core "
-      "create_set "
-      "cross "
-      "csc "
-      "cscd "
-      "csch "
-      "cstrcat "
-      "csvread "
-      "csvwrite "
-      "csymamd "
-      "ctime "
-      "ctranspose "
-      "cummax "
-      "cummin "
-      "cumprod "
-      "cumsum "
-      "cumtrapz "
-      "curl "
-      "cut "
-      "cylinder "
-      "daspect "
-      "daspk "
-      "daspk_options "
-      "dasrt "
-      "dasrt_options "
-      "dassl "
-      "dassl_options "
-      "date "
-      "datenum "
-      "datestr "
-      "datetick "
-      "datevec "
-      "dbclear "
-      "dbcont "
-      "dbdown "
-      "dblquad "
-      "dbnext "
-      "dbquit "
-      "dbstack "
-      "dbstatus "
-      "dbstep "
-      "dbstop "
-      "dbtype "
-      "dbup "
-      "dbwhere "
-      "deal "
-      "deblank "
-      "debug "
-      "debug_on_error "
-      "debug_on_interrupt "
-      "debug_on_warning "
-      "dec2base "
-      "dec2bin "
-      "dec2hex "
-      "deconv "
-      "del2 "
-      "delaunay "
-      "delaunay3 "
-      "delaunayn "
-      "delete "
-      "dellistener "
-      "demo "
-      "det "
-      "detrend "
-      "diag "
-      "diary "
-      "diff "
-      "diffpara "
-      "diffuse "
-      "dir "
-      "discrete_cdf "
-      "discrete_inv "
-      "discrete_pdf "
-      "discrete_rnd "
-      "disp "
-      "dispatch "
-      "display "
-      "divergence "
-      "dlmread "
-      "dlmwrite "
-      "dmperm "
-      "dmult "
-      "do "
-      "do_braindead_shortcircuit_evaluation "
-      "do_string_escapes "
-      "doc "
-      "doc_cache_create "
-      "doc_cache_file "
-      "dos "
-      "dot "
-      "double "
-      "drawnow "
-      "dsearch "
-      "dsearchn "
-      "dump_prefs "
-      "dup2 "
-      "duplication_matrix "
-      "durbinlevinson "
-      "e "
-      "echo "
-      "echo_executing_commands "
-      "edit "
-      "edit_history "
-      "eig "
-      "eigs "
-      "ellipsoid "
-      "else "
-      "elseif "
-      "empirical_cdf "
-      "empirical_inv "
-      "empirical_pdf "
-      "empirical_rnd "
-      "end "
-      "end_try_catch "
-      "end_unwind_protect "
-      "endfor "
-      "endfunction "
-      "endgrent "
-      "endif "
-      "endpwent "
-      "endswitch "
-      "endwhile "
-      "eomday "
-      "eps "
-      "eq "
-      "erf "
-      "erfc "
-      "erfcx "
-      "erfinv "
-      "errno "
-      "errno_list "
-      "error "
-      "error_text "
-      "errorbar "
-      "etime "
-      "etree "
-      "etreeplot "
-      "eval "
-      "evalin "
-      "example "
-      "exec "
-      "exist "
-      "exit "
-      "exp "
-      "expcdf "
-      "expinv "
-      "expm "
-      "expm1 "
-      "exppdf "
-      "exprnd "
-      "eye "
-      "ezcontour "
-      "ezcontourf "
-      "ezmesh "
-      "ezmeshc "
-      "ezplot "
-      "ezplot3 "
-      "ezpolar "
-      "ezsurf "
-      "ezsurfc "
-      "f_test_regression "
-      "factor "
-      "factorial "
-      "fail "
-      "false "
-      "fcdf "
-      "fclear "
-      "fclose "
-      "fcntl "
-      "fdisp "
-      "feather "
-      "feof "
-      "ferror "
-      "feval "
-      "fflush "
-      "fft "
-      "fft2 "
-      "fftconv "
-      "fftfilt "
-      "fftn "
-      "fftshift "
-      "fftw "
-      "fgetl "
-      "fgets "
-      "fieldnames "
-      "figure "
-      "file_in_loadpath "
-      "file_in_path "
-      "fileattrib "
-      "filemarker "
-      "fileparts "
-      "fileread "
-      "filesep "
-      "fill "
-      "filter "
-      "filter2 "
-      "find "
-      "find_dir_in_path "
-      "findall "
-      "findobj "
-      "findstr "
-      "finite "
-      "finv "
-      "fix "
-      "fixed_point_format "
-      "flag "
-      "flipdim "
-      "fliplr "
-      "flipud "
-      "floor "
-      "fminbnd "
-      "fminunc "
-      "fmod "
-      "fnmatch "
-      "fopen "
-      "for "
-      "fork "
-      "format "
-      "formula "
-      "fpdf "
-      "fplot "
-      "fprintf "
-      "fputs "
-      "fractdiff "
-      "fread "
-      "freport "
-      "freqz "
-      "freqz_plot "
-      "frewind "
-      "frnd "
-      "fscanf "
-      "fseek "
-      "fskipl "
-      "fsolve "
-      "fstat "
-      "ftell "
-      "full "
-      "fullfile "
-      "func2str "
-      "function "
-      "functions "
-      "fwrite "
-      "fzero "
-      "gamcdf "
-      "gaminv "
-      "gamma "
-      "gammai "
-      "gammainc "
-      "gammaln "
-      "gampdf "
-      "gamrnd "
-      "gca "
-      "gcbf "
-      "gcbo "
-      "gcd "
-      "gcf "
-      "ge "
-      "genpath "
-      "genvarname "
-      "geocdf "
-      "geoinv "
-      "geopdf "
-      "geornd "
-      "get "
-      "get_first_help_sentence "
-      "get_help_text "
-      "get_help_text_from_file "
-      "getappdata "
-      "getegid "
-      "getenv "
-      "geteuid "
-      "getfield "
-      "getgid "
-      "getgrent "
-      "getgrgid "
-      "getgrnam "
-      "gethostname "
-      "getpgrp "
-      "getpid "
-      "getppid "
-      "getpwent "
-      "getpwnam "
-      "getpwuid "
-      "getrusage "
-      "getuid "
-      "ginput "
-      "givens "
-      "glob "
-      "global "
-      "glpk "
-      "glpkmex "
-      "gls "
-      "gmap40 "
-      "gmres "
-      "gmtime "
-      "gnuplot_binary "
-      "gplot "
-      "gradient "
-      "graphics_toolkit "
-      "gray "
-      "gray2ind "
-      "grid "
-      "griddata "
-      "griddata3 "
-      "griddatan "
-      "gt "
-      "gtext "
-      "gunzip "
-      "gzip "
-      "hadamard "
-      "hamming "
-      "hankel "
-      "hanning "
-      "help "
-      "hess "
-      "hex2dec "
-      "hex2num "
-      "hggroup "
-      "hidden "
-      "hilb "
-      "hist "
-      "histc "
-      "history "
-      "history_control "
-      "history_file "
-      "history_save "
-      "history_size "
-      "history_timestamp_format_string "
-      "hold "
-      "home "
-      "horzcat "
-      "hot "
-      "hotelling_test "
-      "hotelling_test_2 "
-      "housh "
-      "hsv "
-      "hsv2rgb "
-      "hurst "
-      "hygecdf "
-      "hygeinv "
-      "hygepdf "
-      "hygernd "
-      "hypot "
-      "i "
-      "idivide "
-      "if "
-      "ifelse "
-      "ifft "
-      "ifft2 "
-      "ifftn "
-      "ifftshift "
-      "ignore_function_time_stamp "
-      "imag "
-      "image "
-      "imagesc "
-      "imfinfo "
-      "imread "
-      "imshow "
-      "imwrite "
-      "ind2gray "
-      "ind2rgb "
-      "ind2sub "
-      "index "
-      "inf "
-      "inferiorto "
-      "info "
-      "info_file "
-      "info_program "
-      "inline "
-      "inpolygon "
-      "input "
-      "inputname "
-      "int16 "
-      "int2str "
-      "int32 "
-      "int64 "
-      "int8 "
-      "interp1 "
-      "interp1q "
-      "interp2 "
-      "interp3 "
-      "interpft "
-      "interpn "
-      "intersect "
-      "intmax "
-      "intmin "
-      "intwarning "
-      "inv "
-      "inverse "
-      "invhilb "
-      "ipermute "
-      "iqr "
-      "is_absolute_filename "
-      "is_duplicate_entry "
-      "is_global "
-      "is_leap_year "
-      "is_rooted_relative_filename "
-      "is_valid_file_id "
-      "isa "
-      "isalnum "
-      "isalpha "
-      "isappdata "
-      "isargout "
-      "isascii "
-      "isbool "
-      "iscell "
-      "iscellstr "
-      "ischar "
-      "iscntrl "
-      "iscolumn "
-      "iscommand "
-      "iscomplex "
-      "isdebugmode "
-      "isdefinite "
-      "isdeployed "
-      "isdigit "
-      "isdir "
-      "isempty "
-      "isequal "
-      "isequalwithequalnans "
-      "isfield "
-      "isfigure "
-      "isfinite "
-      "isfloat "
-      "isglobal "
-      "isgraph "
-      "ishandle "
-      "ishermitian "
-      "ishghandle "
-      "ishold "
-      "isieee "
-      "isindex "
-      "isinf "
-      "isinteger "
-      "iskeyword "
-      "isletter "
-      "islogical "
-      "islower "
-      "ismac "
-      "ismatrix "
-      "ismember "
-      "ismethod "
-      "isna "
-      "isnan "
-      "isnull "
-      "isnumeric "
-      "isobject "
-      "isocolors "
-      "isonormals "
-      "isosurface "
-      "ispc "
-      "isprime "
-      "isprint "
-      "isprop "
-      "ispunct "
-      "israwcommand "
-      "isreal "
-      "isrow "
-      "isscalar "
-      "issorted "
-      "isspace "
-      "issparse "
-      "issquare "
-      "isstr "
-      "isstrprop "
-      "isstruct "
-      "issymmetric "
-      "isunix "
-      "isupper "
-      "isvarname "
-      "isvector "
-      "isxdigit "
-      "j "
-      "jet "
-      "kbhit "
-      "kendall "
-      "keyboard "
-      "kill "
-      "kolmogorov_smirnov_cdf "
-      "kolmogorov_smirnov_test "
-      "kolmogorov_smirnov_test_2 "
-      "kron "
-      "kruskal_wallis_test "
-      "krylov "
-      "krylovb "
-      "kurtosis "
-      "laplace_cdf "
-      "laplace_inv "
-      "laplace_pdf "
-      "laplace_rnd "
-      "lasterr "
-      "lasterror "
-      "lastwarn "
-      "lchol "
-      "lcm "
-      "ldivide "
-      "le "
-      "legend "
-      "legendre "
-      "length "
-      "lgamma "
-      "license "
-      "lin2mu "
-      "line "
-      "link "
-      "linkprop "
-      "linspace "
-      "list "
-      "list_in_columns "
-      "list_primes "
-      "load "
-      "loadaudio "
-      "loadimage "
-      "loadobj "
-      "localtime "
-      "log "
-      "log10 "
-      "log1p "
-      "log2 "
-      "logical "
-      "logistic_cdf "
-      "logistic_inv "
-      "logistic_pdf "
-      "logistic_regression "
-      "logistic_rnd "
-      "logit "
-      "loglog "
-      "loglogerr "
-      "logm "
-      "logncdf "
-      "logninv "
-      "lognpdf "
-      "lognrnd "
-      "logspace "
-      "lookfor "
-      "lookup "
-      "lower "
-      "ls "
-      "ls_command "
-      "lsode "
-      "lsode_options "
-      "lsqnonneg "
-      "lstat "
-      "lt "
-      "lu "
-      "luinc "
-      "luupdate "
-      "magic "
-      "mahalanobis "
-      "make_absolute_filename "
-      "makeinfo_program "
-      "manova "
-      "mark_as_command "
-      "mark_as_rawcommand "
-      "mat2cell "
-      "mat2str "
-      "matlabroot "
-      "matrix_type "
-      "max "
-      "max_recursion_depth "
-      "mcnemar_test "
-      "md5sum "
-      "mean "
-      "meansq "
-      "median "
-      "menu "
-      "merge "
-      "mesh "
-      "meshc "
-      "meshgrid "
-      "meshz "
-      "methods "
-      "mex "
-      "mexext "
-      "mfilename "
-      "mgorth "
-      "min "
-      "minus "
-      "mislocked "
-      "missing_function_hook "
-      "mist "
-      "mkdir "
-      "mkfifo "
-      "mkoctfile "
-      "mkpp "
-      "mkstemp "
-      "mktime "
-      "mldivide "
-      "mlock "
-      "mod "
-      "mode "
-      "moment "
-      "more "
-      "most "
-      "movefile "
-      "mpoles "
-      "mpower "
-      "mrdivide "
-      "mtimes "
-      "mu2lin "
-      "munlock "
-      "namelengthmax "
-      "nan "
-      "nargchk "
-      "nargin "
-      "nargout "
-      "nargoutchk "
-      "native_float_format "
-      "nbincdf "
-      "nbininv "
-      "nbinpdf "
-      "nbinrnd "
-      "nchoosek "
-      "ndgrid "
-      "ndims "
-      "ne "
-      "newplot "
-      "news "
-      "nextpow2 "
-      "nfields "
-      "nnz "
-      "nonzeros "
-      "norm "
-      "normcdf "
-      "normest "
-      "norminv "
-      "normpdf "
-      "normrnd "
-      "not "
-      "now "
-      "nproc "
-      "nth_element "
-      "nthroot "
-      "ntsc2rgb "
-      "null "
-      "num2cell "
-      "num2hex "
-      "num2str "
-      "numel "
-      "nzmax "
-      "ocean "
-      "octave_config_info "
-      "octave_core_file_limit "
-      "octave_core_file_name "
-      "octave_core_file_options "
-      "octave_tmp_file_name "
-      "ols "
-      "onCleanup "
-      "onenormest "
-      "ones "
-      "optimget "
-      "optimize_subsasgn_calls "
-      "optimset "
-      "or "
-      "orderfields "
-      "orient "
-      "orth "
-      "otherwise "
-      "output_max_field_width "
-      "output_precision "
-      "pack "
-      "page_output_immediately "
-      "page_screen_output "
-      "paren "
-      "pareto "
-      "parseparams "
-      "pascal "
-      "patch "
-      "path "
-      "pathdef "
-      "pathsep "
-      "pause "
-      "pbaspect "
-      "pcg "
-      "pchip "
-      "pclose "
-      "pcolor "
-      "pcr "
-      "peaks "
-      "periodogram "
-      "perl "
-      "perms "
-      "permute "
-      "perror "
-      "persistent "
-      "pi "
-      "pie "
-      "pie3 "
-      "pink "
-      "pinv "
-      "pipe "
-      "pkg "
-      "planerot "
-      "playaudio "
-      "plot "
-      "plot3 "
-      "plotmatrix "
-      "plotyy "
-      "plus "
-      "poisscdf "
-      "poissinv "
-      "poisspdf "
-      "poissrnd "
-      "pol2cart "
-      "polar "
-      "poly "
-      "polyaffine "
-      "polyarea "
-      "polyder "
-      "polyderiv "
-      "polyfit "
-      "polygcd "
-      "polyint "
-      "polyout "
-      "polyreduce "
-      "polyval "
-      "polyvalm "
-      "popen "
-      "popen2 "
-      "postpad "
-      "pow2 "
-      "power "
-      "powerset "
-      "ppder "
-      "ppint "
-      "ppjumps "
-      "ppplot "
-      "ppval "
-      "pqpnonneg "
-      "prctile "
-      "prepad "
-      "primes "
-      "print "
-      "print_empty_dimensions "
-      "print_struct_array_contents "
-      "print_usage "
-      "printf "
-      "prism "
-      "probit "
-      "prod "
-      "program_invocation_name "
-      "program_name "
-      "prop_test_2 "
-      "putenv "
-      "puts "
-      "pwd "
-      "qp "
-      "qqplot "
-      "qr "
-      "qrdelete "
-      "qrinsert "
-      "qrshift "
-      "qrupdate "
-      "quad "
-      "quad_options "
-      "quadcc "
-      "quadgk "
-      "quadl "
-      "quadv "
-      "quantile "
-      "quit "
-      "quiver "
-      "quiver3 "
-      "qz "
-      "qzhess "
-      "rainbow "
-      "rand "
-      "rande "
-      "randg "
-      "randi "
-      "randn "
-      "randp "
-      "randperm "
-      "range "
-      "rank "
-      "ranks "
-      "rat "
-      "rats "
-      "rcond "
-      "rdivide "
-      "re_read_readline_init_file "
-      "readdir "
-      "readline_re_read_init_file "
-      "readline_read_init_file "
-      "readlink "
-      "real "
-      "reallog "
-      "realmax "
-      "realmin "
-      "realpow "
-      "realsqrt "
-      "record "
-      "rectangle "
-      "rectint "
-      "refresh "
-      "refreshdata "
-      "regexp "
-      "regexpi "
-      "regexprep "
-      "regexptranslate "
-      "rehash "
-      "rem "
-      "remove_input_event_hook "
-      "rename "
-      "repelems "
-      "replot "
-      "repmat "
-      "reset "
-      "reshape "
-      "residue "
-      "resize "
-      "restoredefaultpath "
-      "rethrow "
-      "return "
-      "rgb2hsv "
-      "rgb2ind "
-      "rgb2ntsc "
-      "ribbon "
-      "rindex "
-      "rmappdata "
-      "rmdir "
-      "rmfield "
-      "rmpath "
-      "roots "
-      "rose "
-      "rosser "
-      "rot90 "
-      "rotdim "
-      "round "
-      "roundb "
-      "rows "
-      "rref "
-      "rsf2csf "
-      "run "
-      "run_count "
-      "run_history "
-      "run_test "
-      "rundemos "
-      "runlength "
-      "runtests "
-      "save "
-      "save_default_options "
-      "save_header_format_string "
-      "save_precision "
-      "saveas "
-      "saveaudio "
-      "saveimage "
-      "saveobj "
-      "savepath "
-      "scanf "
-      "scatter "
-      "scatter3 "
-      "schur "
-      "sec "
-      "secd "
-      "sech "
-      "semicolon "
-      "semilogx "
-      "semilogxerr "
-      "semilogy "
-      "semilogyerr "
-      "set "
-      "setappdata "
-      "setaudio "
-      "setdiff "
-      "setenv "
-      "setfield "
-      "setgrent "
-      "setpwent "
-      "setstr "
-      "setxor "
-      "shading "
-      "shell_cmd "
-      "shg "
-      "shift "
-      "shiftdim "
-      "sighup_dumps_octave_core "
-      "sign "
-      "sign_test "
-      "sigterm_dumps_octave_core "
-      "silent_functions "
-      "sin "
-      "sinc "
-      "sind "
-      "sinetone "
-      "sinewave "
-      "single "
-      "sinh "
-      "size "
-      "size_equal "
-      "sizemax "
-      "sizeof "
-      "skewness "
-      "sleep "
-      "slice "
-      "sombrero "
-      "sort "
-      "sortrows "
-      "source "
-      "spalloc "
-      "sparse "
-      "sparse_auto_mutate "
-      "spatan2 "
-      "spaugment "
-      "spchol "
-      "spchol2inv "
-      "spcholinv "
-      "spconvert "
-      "spcumprod "
-      "spcumsum "
-      "spdet "
-      "spdiag "
-      "spdiags "
-      "spearman "
-      "spectral_adf "
-      "spectral_xdf "
-      "specular "
-      "speed "
-      "spencer "
-      "speye "
-      "spfind "
-      "spfun "
-      "sph2cart "
-      "sphcat "
-      "sphere "
-      "spinmap "
-      "spinv "
-      "spkron "
-      "splchol "
-      "spline "
-      "split "
-      "split_long_rows "
-      "splu "
-      "spmax "
-      "spmin "
-      "spones "
-      "spparms "
-      "spprod "
-      "spqr "
-      "sprand "
-      "sprandn "
-      "sprandsym "
-      "sprank "
-      "spring "
-      "sprintf "
-      "spstats "
-      "spsum "
-      "spsumsq "
-      "spvcat "
-      "spy "
-      "sqp "
-      "sqrt "
-      "sqrtm "
-      "squeeze "
-      "sscanf "
-      "stairs "
-      "stat "
-      "static "
-      "statistics "
-      "std "
-      "stderr "
-      "stdin "
-      "stdnormal_cdf "
-      "stdnormal_inv "
-      "stdnormal_pdf "
-      "stdnormal_rnd "
-      "stdout "
-      "stem "
-      "stem3 "
-      "stft "
-      "str2double "
-      "str2func "
-      "str2mat "
-      "str2num "
-      "strcat "
-      "strchr "
-      "strcmp "
-      "strcmpi "
-      "strerror "
-      "strfind "
-      "strftime "
-      "string_fill_char "
-      "strjust "
-      "strmatch "
-      "strncmp "
-      "strncmpi "
-      "strptime "
-      "strread "
-      "strrep "
-      "strsplit "
-      "strtok "
-      "strtrim "
-      "strtrunc "
-      "struct "
-      "struct2cell "
-      "struct_levels_to_print "
-      "structfun "
-      "strvcat "
-      "studentize "
-      "sub2ind "
-      "subplot "
-      "subsasgn "
-      "subsindex "
-      "subspace "
-      "subsref "
-      "substr "
-      "substruct "
-      "sum "
-      "summer "
-      "sumsq "
-      "superiorto "
-      "suppress_verbose_help_message "
-      "surf "
-      "surface "
-      "surfc "
-      "surfl "
-      "surfnorm "
-      "svd "
-      "svd_driver "
-      "svds "
-      "swapbytes "
-      "switch "
-      "syl "
-      "sylvester_matrix "
-      "symamd "
-      "symbfact "
-      "symlink "
-      "symrcm "
-      "symvar "
-      "synthesis "
-      "system "
-      "t_test "
-      "t_test_2 "
-      "t_test_regression "
-      "table "
-      "tan "
-      "tand "
-      "tanh "
-      "tar "
-      "tcdf "
-      "tempdir "
-      "tempname "
-      "terminal_size "
-      "test "
-      "test2 "
-      "test3 "
-      "text "
-      "textread "
-      "textscan "
-      "tic "
-      "tilde_expand "
-      "time "
-      "times "
-      "tinv "
-      "title "
-      "tmpfile "
-      "tmpnam "
-      "toascii "
-      "toc "
-      "toeplitz "
-      "tolower "
-      "toupper "
-      "tpdf "
-      "trace "
-      "transpose "
-      "trapz "
-      "treelayout "
-      "treeplot "
-      "tril "
-      "trimesh "
-      "triplequad "
-      "triplot "
-      "trisurf "
-      "triu "
-      "trnd "
-      "true "
-      "try "
-      "tsearch "
-      "tsearchn "
-      "type "
-      "typecast "
-      "typeinfo "
-      "u_test "
-      "uigetdir "
-      "uigetfile "
-      "uimenu "
-      "uint16 "
-      "uint32 "
-      "uint64 "
-      "uint8 "
-      "uiputfile "
-      "umask "
-      "uminus "
-      "uname "
-      "undo_string_escapes "
-      "unidcdf "
-      "unidinv "
-      "unidpdf "
-      "unidrnd "
-      "unifcdf "
-      "unifinv "
-      "unifpdf "
-      "unifrnd "
-      "union "
-      "unique "
-      "unix "
-      "unlink "
-      "unmark_command "
-      "unmark_rawcommand "
-      "unmkpp "
-      "unpack "
-      "untabify "
-      "untar "
-      "until "
-      "unwind_protect "
-      "unwind_protect_cleanup "
-      "unwrap "
-      "unzip "
-      "uplus "
-      "upper "
-      "urlread "
-      "urlwrite "
-      "usage "
-      "usleep "
-      "validatestring "
-      "values "
-      "vander "
-      "var "
-      "var_test "
-      "varargin "
-      "varargout "
-      "vec "
-      "vech "
-      "vectorize "
-      "ver "
-      "version "
-      "vertcat "
-      "view "
-      "voronoi "
-      "voronoin "
-      "waitforbuttonpress "
-      "waitpid "
-      "warning "
-      "warning_ids "
-      "warranty "
-      "wavread "
-      "wavwrite "
-      "wblcdf "
-      "wblinv "
-      "wblpdf "
-      "wblrnd "
-      "weekday "
-      "weibcdf "
-      "weibinv "
-      "weibpdf "
-      "weibrnd "
-      "welch_test "
-      "what "
-      "which "
-      "while "
-      "white "
-      "whitebg "
-      "who "
-      "whos "
-      "whos_line_format "
-      "wienrnd "
-      "wilcoxon_test "
-      "wilkinson "
-      "winter "
-      "xlabel "
-      "xlim "
-      "xor "
-      "yes_or_no "
-      "ylabel "
-      "ylim "
-      "yulewalker "
-      "z_test "
-      "z_test_2 "
-      "zeros "
-      "zip "
-      "zlabel "
-      "zlim ";
-  /*            "break case catch continue do else elseif end end_unwind_protect "
-              "endfor endfunction endif endswitch endwhile for function "
-              "global if otherwise persistent return switch try until "
-              "unwind_protect unwind_protect_cleanup while";
-  */
-}
--- a/libgui/src/resource-manager.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/resource-manager.h	Sat Oct 05 11:22:09 2013 -0400
@@ -54,6 +54,11 @@
     return instance_ok () ? instance->do_get_home_path () : QString ();
   }
 
+  static QString get_settings_file (void)
+  {
+    return instance_ok () ? instance->do_get_settings_file () : QString ();
+  }
+
   static void reload_settings (void)
   {
     if (instance_ok ())
@@ -81,8 +86,6 @@
     return instance_ok () ? instance->do_is_first_run () : true;
   }
 
-  static const char *octave_keywords (void);
-  
   static QString storage_class_chars (void) { return "afghip"; }
   static QStringList storage_class_names (void);
   static QList<QColor> storage_class_default_colors (void);
@@ -119,6 +122,10 @@
 
   QString do_get_home_path (void) const;
 
+  QString do_get_settings_file (void);
+
+  QString do_get_settings_path (void);
+
   void do_reload_settings (void);
 
   void do_set_settings (const QString& file);
--- a/libgui/src/welcome-wizard.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/welcome-wizard.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -25,37 +25,20 @@
 #endif
 
 #include "welcome-wizard.h"
+#include "resource-manager.h"
 #include "ui-welcome-wizard.h"
 
 welcome_wizard::welcome_wizard (QWidget *p)
   : QDialog (p), _ui (new Ui::welcome_wizard)
 {
   _ui->setupUi (this);
-  connect (_ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ()));
-
-  connect (_ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ()));
+  QString label_text = _ui->label_config_file->text ();
+  label_text.replace (QString ("__%1__"),
+                      resource_manager::get_settings_file ());
+  _ui->label_config_file->setText (label_text);
 }
 
 welcome_wizard::~welcome_wizard()
 {
   delete _ui;
 }
-
-void
-welcome_wizard::next ()
-{
-  _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () + 1);
-}
-
-void
-welcome_wizard::previous ()
-{
-  _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () - 1);
-}
-
--- a/libgui/src/welcome-wizard.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/welcome-wizard.h	Sat Oct 05 11:22:09 2013 -0400
@@ -38,8 +38,6 @@
   ~welcome_wizard ();
 
 public slots:
-  void next ();
-  void previous ();
 
 private:
   Ui::welcome_wizard *_ui;
--- a/libgui/src/welcome-wizard.ui	Thu Sep 12 21:08:07 2013 -0400
+++ b/libgui/src/welcome-wizard.ui	Sat Oct 05 11:22:09 2013 -0400
@@ -2,24 +2,27 @@
 <ui version="4.0">
  <class>welcome_wizard</class>
  <widget class="QDialog" name="welcome_wizard">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </rect>
   </property>
   <property name="minimumSize">
    <size>
-    <width>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </size>
   </property>
   <property name="maximumSize">
    <size>
-    <width>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </size>
   </property>
   <property name="windowTitle">
@@ -27,308 +30,96 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <widget class="QStackedWidget" name="stackedWidget">
-     <property name="currentIndex">
-      <number>4</number>
-     </property>
-     <widget class="QWidget" name="page">
-      <layout class="QVBoxLayout" name="verticalLayout">
+    <layout class="QVBoxLayout" name="verticalLayout_7">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="font">
+        <font>
+         <pointsize>20</pointsize>
+        </font>
+       </property>
+       <property name="text">
+        <string>Welcome to Octave!</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_4">
+       <property name="text">
+        <string>You seem to be using the Octave graphical interface for the first  time on this computer.  Click 'Finish' to write a configuration file  and launch Octave GUI. </string>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_config_file">
+       <property name="text">
+        <string>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</string>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
+       <property name="openExternalLinks">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_7">
        <item>
-        <widget class="QLabel" name="label">
-         <property name="text">
-          <string>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at '~/.octave-gui'. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignJustify|Qt::AlignVCenter</set>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer">
+        <spacer name="horizontalSpacer_5">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
-           <height>218</height>
+           <width>40</width>
+           <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QPushButton" name="nextButton1">
-           <property name="text">
-            <string>Next</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_2">
-      <layout class="QVBoxLayout" name="verticalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_3">
-         <item>
-          <spacer name="verticalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <item>
-            <widget class="QPushButton" name="previousButton2">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_2">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton2">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_3">
-      <layout class="QHBoxLayout" name="horizontalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_5">
-         <item>
-          <spacer name="verticalSpacer_3">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_3">
-           <item>
-            <widget class="QPushButton" name="previousButton3">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_3">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton3">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
+        <widget class="QPushButton" name="finishButton">
+         <property name="text">
+          <string>Finish</string>
+         </property>
+        </widget>
        </item>
       </layout>
-     </widget>
-     <widget class="QWidget" name="page_4">
-      <layout class="QHBoxLayout" name="horizontalLayout_6">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_6">
-         <item>
-          <spacer name="verticalSpacer_4">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_5">
-           <item>
-            <widget class="QPushButton" name="previousButton4">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_4">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton4">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_5">
-      <layout class="QHBoxLayout" name="horizontalLayout_8">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_7">
-         <item>
-          <widget class="QLabel" name="label_2">
-           <property name="font">
-            <font>
-             <pointsize>20</pointsize>
-            </font>
-           </property>
-           <property name="text">
-            <string>Welcome to Octave!</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>This is the development version of Octave with the first official GUI.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_4">
-           <property name="text">
-            <string>You seem to run Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click 'Finish' to write a configuration file and launch Octave GUI.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="verticalSpacer_5">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_7">
-           <item>
-            <widget class="QPushButton" name="previousButton5">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_5">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="finishButton">
-             <property name="text">
-              <string>Finish</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
--- a/libinterp/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -20,8 +20,6 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 ## Search local directories before those specified by the user.
 AM_CPPFLAGS = \
   -I$(top_srcdir)/liboctave/cruft/misc \
@@ -51,6 +49,9 @@
   corefcn/defaults.h \
   corefcn/graphics-props.cc \
   corefcn/graphics.h \
+  corefcn/oct-tex-lexer.cc \
+  corefcn/oct-tex-parser.cc \
+  corefcn/oct-tex-symbols.cc \
   operators/ops.cc \
   parse-tree/lex.cc \
   parse-tree/oct-gperf.h \
@@ -62,6 +63,9 @@
   builtins.cc
 
 BUILT_DISTFILES = \
+  corefcn/oct-tex-lexer.ll \
+  corefcn/oct-tex-parser.h \
+  corefcn/oct-tex-symbols.cc \
   parse-tree/oct-gperf.h \
   parse-tree/oct-parse.h \
   parse-tree/oct-parse.yy
@@ -96,7 +100,6 @@
   mkdefs \
   mkops \
   oct-conf.in.h \
-  parse-tree/oct-parse.in.yy \
   version.in.h \
   $(BUILT_DISTFILES)
 
@@ -121,10 +124,12 @@
 
 DIST_SRC = \
   octave.cc \
+  version.cc \
   $(OCTAVE_VALUE_SRC) \
   $(PARSE_TREE_SRC) \
   $(PARSER_SRC) \
-  $(COREFCN_SRC)
+  $(COREFCN_SRC) \
+  $(TEX_PARSER_SRC)
 
 noinst_LTLIBRARIES =
 
@@ -150,6 +155,7 @@
 
 liboctinterp_la_SOURCES = \
   octave.cc \
+  version.cc \
   $(OPERATORS_SRC) \
   $(TEMPLATE_INST_SRC)
 
@@ -175,6 +181,7 @@
   parse-tree/libparse-tree.la \
   parse-tree/libparser.la \
   corefcn/libcorefcn.la \
+  corefcn/libtex_parser.la \
   $(top_builddir)/liboctave/liboctave.la \
   $(LIBOCTINTERP_LINK_DEPS)
 
@@ -194,7 +201,7 @@
 ## Section for defining and creating DEF_FILES
 
 ULT_DIST_SRC := \
-  $(filter-out parse-tree/oct-parse.yy, $(DIST_SRC)) parse-tree/oct-parse.in.yy
+  $(filter-out corefcn/oct-tex-lexer.ll parse-tree/oct-parse.yy, $(DIST_SRC)) corefcn/oct-tex-lexer.in.ll parse-tree/oct-parse.in.yy
 
 SRC_DEF_FILES := $(shell $(srcdir)/find-defun-files.sh "$(srcdir)" $(ULT_DIST_SRC))
 
@@ -248,7 +255,7 @@
 ## though we don't want it.  It would be super awesome if automake
 ## would allow users to choose the header file extension.
 .yy.cc:
-	$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
+	$(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
 
 ## Special rules:
 ## Mostly for sources which must be built before rest of compilation.
@@ -316,7 +323,7 @@
 
 if AMCOND_ENABLE_DYNAMIC_LINKING
 install-oct:
-	$(top_srcdir)/build-aux/mkinstalldirs $(DESTDIR)$(octfiledir)
+	$(MKDIR_P) $(DESTDIR)$(octfiledir)
 	if [ -n "`cat $(DLDFCN_PKG_ADD_FILE)`" ]; then \
 	  $(INSTALL_DATA) $(DLDFCN_PKG_ADD_FILE) $(DESTDIR)$(octfiledir)/PKG_ADD; \
 	fi
@@ -357,6 +364,7 @@
 CLEANFILES = \
   $(DLDFCN_PKG_ADD_FILE) \
   corefcn/graphics-props.cc \
+  corefcn/oct-tex-parser.output \
   parse-tree/oct-parse.output
 
 DISTCLEANFILES = \
--- a/libinterp/corefcn/action-container.h	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
-/*
-
-Copyright (C) 1993-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_action_container_h)
-#define octave_action_container_h 1
-
-// This class allows registering actions in a list for later
-// execution, either explicitly or when the container goes out of
-// scope.
-
-// FIXME -- is there a better name for this class?
-
-class
-action_container
-{
-public:
-
-  // A generic unwind_protect element. Knows how to run itself and
-  // discard itself.  Also, contains a pointer to the next element.
-  class elem
-  {
-  public:
-    elem (void) { }
-
-    virtual void run (void) { }
-
-    virtual ~elem (void) { }
-
-    friend class action_container;
-
-  private:
-
-    // No copying!
-
-    elem (const elem&);
-
-    elem& operator = (const elem&);
-  };
-
-  // An element that merely runs a void (*)(void) function.
-
-  class fcn_elem : public elem
-  {
-  public:
-    fcn_elem (void (*fptr) (void))
-      : e_fptr (fptr) { }
-
-    void run (void) { e_fptr (); }
-
-  private:
-    void (*e_fptr) (void);
-  };
-
-  // An element that stores a variable of type T along with a void (*) (T)
-  // function pointer, and calls the function with the parameter.
-
-  template <class T>
-  class fcn_arg_elem : public elem
-  {
-  public:
-    fcn_arg_elem (void (*fcn) (T), T arg)
-      : e_fcn (fcn), e_arg (arg) { }
-
-    void run (void) { e_fcn (e_arg); }
-
-  private:
-
-    // No copying!
-
-    fcn_arg_elem (const fcn_arg_elem&);
-
-    fcn_arg_elem& operator = (const fcn_arg_elem&);
-
-    void (*e_fcn) (T);
-    T e_arg;
-  };
-
-  // An element that stores a variable of type T along with a
-  // void (*) (const T&) function pointer, and calls the function with
-  // the parameter.
-
-  template <class T>
-  class fcn_crefarg_elem : public elem
-  {
-  public:
-    fcn_crefarg_elem (void (*fcn) (const T&), const T& arg)
-      : e_fcn (fcn), e_arg (arg) { }
-
-    void run (void) { e_fcn (e_arg); }
-
-  private:
-    void (*e_fcn) (const T&);
-    T e_arg;
-  };
-
-  // An element for calling a member function.
-
-  template <class T>
-  class method_elem : public elem
-  {
-  public:
-    method_elem (T *obj, void (T::*method) (void))
-      : e_obj (obj), e_method (method) { }
-
-    void run (void) { (e_obj->*e_method) (); }
-
-  private:
-
-    T *e_obj;
-    void (T::*e_method) (void);
-
-    // No copying!
-
-    method_elem (const method_elem&);
-
-    method_elem operator = (const method_elem&);
-  };
-
-  // An element for calling a member function with a single argument
-
-  template <class T, class A>
-  class method_arg_elem : public elem
-  {
-  public:
-    method_arg_elem (T *obj, void (T::*method) (A), A arg)
-      : e_obj (obj), e_method (method), e_arg (arg) { }
-
-    void run (void) { (e_obj->*e_method) (e_arg); }
-
-  private:
-
-    T *e_obj;
-    void (T::*e_method) (A);
-    A e_arg;
-
-    // No copying!
-
-    method_arg_elem (const method_arg_elem&);
-
-    method_arg_elem operator = (const method_arg_elem&);
-  };
-
-  // An element for calling a member function with a single argument
-
-  template <class T, class A>
-  class method_crefarg_elem : public elem
-  {
-  public:
-    method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg)
-      : e_obj (obj), e_method (method), e_arg (arg) { }
-
-    void run (void) { (e_obj->*e_method) (e_arg); }
-
-  private:
-
-    T *e_obj;
-    void (T::*e_method) (const A&);
-    A e_arg;
-
-    // No copying!
-
-    method_crefarg_elem (const method_crefarg_elem&);
-
-    method_crefarg_elem operator = (const method_crefarg_elem&);
-  };
-
-  // An element that stores arbitrary variable, and restores it.
-
-  template <class T>
-  class restore_var_elem : public elem
-  {
-  public:
-    restore_var_elem (T& ref, const T& val)
-      : e_ptr (&ref), e_val (val) { }
-
-    void run (void) { *e_ptr = e_val; }
-
-  private:
-
-    // No copying!
-
-    restore_var_elem (const restore_var_elem&);
-
-    restore_var_elem& operator = (const restore_var_elem&);
-
-    T *e_ptr, e_val;
-  };
-
-  // Deletes a class allocated using new.
-
-  template <class T>
-  class delete_ptr_elem : public elem
-  {
-  public:
-    delete_ptr_elem (T *ptr)
-      : e_ptr (ptr) { }
-
-    void run (void) { delete e_ptr; }
-
-  private:
-
-    T *e_ptr;
-
-    // No copying!
-
-    delete_ptr_elem (const delete_ptr_elem&);
-
-    delete_ptr_elem operator = (const delete_ptr_elem&);
-  };
-
-  action_container (void) { }
-
-  virtual ~action_container (void) { }
-
-  virtual void add (elem *new_elem) = 0;
-
-  // Call to void func (void).
-  void add_fcn (void (*fcn) (void))
-  {
-    add (new fcn_elem (fcn));
-  }
-
-  // Call to void func (T).
-  template <class T>
-  void add_fcn (void (*action) (T), T val)
-  {
-    add (new fcn_arg_elem<T> (action, val));
-  }
-
-  // Call to void func (const T&).
-  template <class T>
-  void add_fcn (void (*action) (const T&), const T& val)
-  {
-    add (new fcn_crefarg_elem<T> (action, val));
-  }
-
-  // Call to T::method (void).
-  template <class T>
-  void add_method (T *obj, void (T::*method) (void))
-  {
-    add (new method_elem<T> (obj, method));
-  }
-
-  // Call to T::method (A).
-  template <class T, class A>
-  void add_method (T *obj, void (T::*method) (A), A arg)
-  {
-    add (new method_arg_elem<T, A> (obj, method, arg));
-  }
-
-  // Call to T::method (const A&).
-  template <class T, class A>
-  void add_method (T *obj, void (T::*method) (const A&), const A& arg)
-  {
-    add (new method_crefarg_elem<T, A> (obj, method, arg));
-  }
-
-  // Call to delete (T*).
-
-  template <class T>
-  void add_delete (T *obj)
-  {
-    add (new delete_ptr_elem<T> (obj));
-  }
-
-  // Protect any variable.
-  template <class T>
-  void protect_var (T& var)
-  {
-    add (new restore_var_elem<T> (var, var));
-  }
-
-  // Protect any variable, value given.
-  template <class T>
-  void protect_var (T& var, const T& val)
-  {
-    add (new restore_var_elem<T> (var, val));
-  }
-
-  operator bool (void) const { return ! empty (); }
-
-  virtual void run_first (void) = 0;
-
-  void run (size_t num)
-  {
-    if (num > size ())
-      num = size ();
-
-    for (size_t i = 0; i < num; i++)
-      run_first ();
-  }
-
-  void run (void) { run (size ()); }
-
-  virtual void discard_first (void) = 0;
-
-  void discard (size_t num)
-  {
-    if (num > size ())
-      num = size ();
-
-    for (size_t i = 0; i < num; i++)
-      discard_first ();
-  }
-
-  void discard (void) { discard (size ()); }
-
-  virtual size_t size (void) const = 0;
-
-  bool empty (void) const { return size () == 0; }
-
-private:
-
-  // No copying!
-
-  action_container (const action_container&);
-
-  action_container& operator = (const action_container&);
-};
-
-#endif
--- a/libinterp/corefcn/balance.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/balance.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -75,10 +75,10 @@
 The eigenvalue balancing option @var{opt} may be one of:\n\
 \n\
 @table @asis\n\
-@item \"noperm\", \"S\"\n\
+@item @qcode{\"noperm\"}, @qcode{\"S\"}\n\
 Scale only; do not permute.\n\
 \n\
-@item \"noscal\", \"P\"\n\
+@item @qcode{\"noscal\"}, @qcode{\"P\"}\n\
 Permute only; do not scale.\n\
 @end table\n\
 \n\
--- a/libinterp/corefcn/besselj.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/besselj.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -649,11 +649,10 @@
 }
 
 /*
-%! # Test values computed with GP/PARI version 2.3.3
-%!
+## Test values computed with GP/PARI version 2.3.3
 %!shared alpha, x, jx, yx, ix, kx, nix
 %!
-%! # Bessel functions, even order, positive and negative x
+%! ## Bessel functions, even order, positive and negative x
 %! alpha = 2;  x = 1.25;
 %! jx = 0.1710911312405234823613091417;
 %! yx = -1.193199310178553861283790424;
@@ -706,7 +705,7 @@
 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps)
 %!
-%! # Bessel functions, odd order, positive and negative x
+%! ## Bessel functions, odd order, positive and negative x
 %! alpha = 3;  x = 2.5;
 %! jx = 0.2166003910391135247666890035;
 %! yx = -0.7560554967536709968379029772;
@@ -761,7 +760,7 @@
 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps)
 %!
-%! # Bessel functions, fractional order, positive and negative x
+%! ## Bessel functions, fractional order, positive and negative x
 %!
 %! alpha = 3.5;  x = 2.75;
 %! jx = 0.1691636439842384154644784389;
@@ -819,7 +818,7 @@
 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps)
 %!
-%! # Bessel functions, even order, complex x
+%! ## Bessel functions, even order, complex x
 %!
 %! alpha = 2;  x = 1.25 + 3.625 * I;
 %! jx = -1.299533366810794494030065917 + 4.370833116012278943267479589*I;
@@ -855,7 +854,7 @@
 %!assert (besselh (-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps)
 %!
-%! # Bessel functions, odd order, complex x
+%! ## Bessel functions, odd order, complex x
 %!
 %! alpha = 3; x = 2.5 + 1.875 * I;
 %! jx = 0.1330721523048277493333458596 + 0.5386295217249660078754395597*I;
@@ -891,7 +890,7 @@
 %!assert (besselh (-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps)
 %!
-%! # Bessel functions, fractional order, complex x
+%! ## Bessel functions, fractional order, complex x
 %!
 %! alpha = 3.5;  x = 1.75 + 4.125 * I;
 %! jx = -3.018566131370455929707009100 - 0.7585648436793900607704057611*I;
@@ -913,7 +912,7 @@
 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps)
 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps)
 %!
-%!  nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I;
+%! nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I;
 %!
 %!assert (besselj (-alpha,x), yx, 100*eps)
 %!assert (bessely (-alpha,x), -jx, 100*eps)
--- a/libinterp/corefcn/bitfcns.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/bitfcns.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -24,6 +24,8 @@
 #include <config.h>
 #endif
 
+#include <limits>
+
 #include "str-vec.h"
 #include "quit.h"
 
@@ -38,6 +40,7 @@
 #include "ov-int32.h"
 #include "ov-int16.h"
 #include "ov-int8.h"
+#include "ov-float.h"
 #include "ov-scalar.h"
 #include "ov-re-mat.h"
 #include "ov-bool.h"
@@ -138,25 +141,55 @@
   if (nargin == 2)
     {
       if ((args(0).class_name () == octave_scalar::static_class_name ())
+          || (args(0).class_name () == octave_float_scalar::static_class_name ())
           || (args(0).class_name () == octave_bool::static_class_name ())
           || (args(1).class_name () == octave_scalar::static_class_name ())
+          || (args(1).class_name () == octave_float_scalar::static_class_name ())
           || (args(1).class_name () == octave_bool::static_class_name ()))
         {
           bool arg0_is_int = (args(0).class_name () !=
                               octave_scalar::static_class_name () &&
                               args(0).class_name () !=
+                              octave_float_scalar::static_class_name () &&
+                              args(0).class_name () !=
                               octave_bool::static_class_name ());
           bool arg1_is_int = (args(1).class_name () !=
                               octave_scalar::static_class_name () &&
                               args(1).class_name () !=
+                              octave_float_scalar::static_class_name () &&
+                              args(1).class_name () !=
                               octave_bool::static_class_name ());
+          bool arg0_is_float = args(0).class_name () ==
+                               octave_float_scalar::static_class_name ();
+          bool arg1_is_float = args(1).class_name () ==
+                               octave_float_scalar::static_class_name ();
 
           if (! (arg0_is_int || arg1_is_int))
             {
-              uint64NDArray x (args(0).array_value ());
-              uint64NDArray y (args(1).array_value ());
-              if (! error_state)
-                retval = bitopx (fname, x, y).array_value ();
+              if (! (arg0_is_float || arg1_is_float))
+                {
+                  uint64NDArray x (args(0).array_value ());
+                  uint64NDArray y (args(1).array_value ());
+                  if (! error_state)
+                    retval = bitopx (fname, x, y).array_value ();
+                }
+              else if (arg0_is_float && arg1_is_float)
+                {
+                  uint64NDArray x (args(0).float_array_value ());
+                  uint64NDArray y (args(1).float_array_value ());
+                  if (! error_state)
+                    retval = bitopx (fname, x, y).float_array_value ();
+                }
+              else
+                {
+                  int p = (arg0_is_float ? 1 : 0);
+                  int q = (arg0_is_float ? 0 : 1);
+
+                  uint64NDArray x (args(p).array_value ());
+                  uint64NDArray y (args(q).float_array_value ());
+                  if (! error_state)
+                    retval = bitopx (fname, x, y).float_array_value ();
+                }
             }
           else
             {
@@ -344,6 +377,13 @@
   return bitop ("bitxor", args);
 }
 
+template <typename T>
+static int64_t
+max_mantissa_value ()
+{
+  return (static_cast<int64_t> (1) << std::numeric_limits<T>::digits) - 1;
+}
+
 static int64_t
 bitshift (double a, int n, int64_t mask)
 {
@@ -543,16 +583,30 @@
         DO_SBITSHIFT (int64, nbits < 64 ? nbits : 64);
       else if (cname == "double")
         {
-          nbits = (nbits < 53 ? nbits : 53);
-          int64_t mask = 0x1FFFFFFFFFFFFFLL;
-          if (nbits < 53)
-            mask = mask >> (53 - nbits);
+          static const int bits_in_mantissa = std::numeric_limits<double>::digits;
+          nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
+          int64_t mask = max_mantissa_value<double> ();
+          if (nbits < bits_in_mantissa)
+            mask = mask >> (bits_in_mantissa - nbits);
           else if (nbits < 1)
             mask = 0;
-          int bits_in_type = 64;
+          int bits_in_type = sizeof (double) * std::numeric_limits<unsigned char>::digits;
           NDArray m = m_arg.array_value ();
           DO_BITSHIFT ( );
         }
+      else if (cname == "single")
+        {
+          static const int bits_in_mantissa = std::numeric_limits<float>::digits;
+          nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
+          int64_t mask = max_mantissa_value<float> ();
+          if (nbits < bits_in_mantissa)
+            mask = mask >> (bits_in_mantissa - nbits);
+          else if (nbits < 1)
+            mask = 0;
+          int bits_in_type = sizeof (float) * std::numeric_limits<unsigned char>::digits;
+          FloatNDArray m = m_arg.float_array_value ();
+          DO_BITSHIFT (Float);
+        }
       else
         error ("bitshift: not defined for %s objects", cname.c_str ());
     }
@@ -568,8 +622,11 @@
 @deftypefnx {Built-in Function} {} bitmax (\"double\")\n\
 @deftypefnx {Built-in Function} {} bitmax (\"single\")\n\
 Return the largest integer that can be represented within a floating point\n\
-value.  The default class is \"double\", but \"single\" is a valid option.\n\
-On IEEE-754 compatible systems, @code{bitmax} is @w{@math{2^{53} - 1}}.\n\
+value.  The default class is @qcode{\"double\"}, but @qcode{\"single\"} is a\n\
+valid option.  On IEEE-754 compatible systems, @code{bitmax} is\n\
+@w{@math{2^{53} - 1}} for @qcode{\"double\"} and @w{@math{2^{24} -1}} for\n\
+@qcode{\"single\"}.\n\
+@seealso{flintmax, intmax, realmax, realmin}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -585,15 +642,50 @@
     }
 
   if (cname == "double")
-    retval = (static_cast<double> (0x1FFFFFFFFFFFFFLL));
+    retval = (static_cast<double> (max_mantissa_value<double> ()));
   else if (cname == "single")
-    retval = (static_cast<double> (0xFFFFFFL));
+    retval = (static_cast<float> (max_mantissa_value<float> ()));
   else
     error ("bitmax: not defined for class '%s'", cname.c_str ());
 
   return retval;
 }
 
+DEFUN (flintmax, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} flintmax ()\n\
+@deftypefnx {Built-in Function} {} flintmax (\"double\")\n\
+@deftypefnx {Built-in Function} {} flintmax (\"single\")\n\
+Return the largest integer that can be represented consecutively in a\n\
+floating point value.  The default class is @qcode{\"double\"}, but\n\
+@qcode{\"single\"} is a valid option.  On IEEE-754 compatible systems,\n\
+@code{flintmax} is @w{@math{2^53}} for @qcode{\"double\"} and\n\
+@w{@math{2^24}} for @qcode{\"single\"}.\n\
+@seealso{bitmax, intmax, realmax, realmin}\n\
+@end deftypefn")
+{
+  octave_value retval;
+  std::string cname = "double";
+  int nargin = args.length ();
+
+  if (nargin == 1 && args(0).is_string ())
+    cname = args(0).string_value ();
+  else if (nargin != 0)
+    {
+      print_usage ();
+      return retval;
+    }
+
+  if (cname == "double")
+    retval = (static_cast<double> (max_mantissa_value<double> () + 1));
+  else if (cname == "single")
+    retval = (static_cast<float> (max_mantissa_value<float> () + 1));
+  else
+    error ("flintmax: not defined for class '%s'", cname.c_str ());
+
+  return retval;
+}
+
 DEFUN (intmax, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} intmax (@var{type})\n\
@@ -627,7 +719,7 @@
 @end table\n\
 \n\
 The default for @var{type} is @code{uint32}.\n\
-@seealso{intmin, bitmax}\n\
+@seealso{intmin, flintmax, bitmax}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -697,7 +789,7 @@
 @end table\n\
 \n\
 The default for @var{type} is @code{uint32}.\n\
-@seealso{intmax, bitmax}\n\
+@seealso{intmax, flintmax, bitmax}\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/libinterp/corefcn/bsxfun.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/bsxfun.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -773,12 +773,12 @@
 %% Test automatic bsxfun
 %
 %!test
-%! funs = {@plus, @minus, @times, @rdivide, @ldivide, @power, @max, @min, \
-%!         @rem, @mod, @atan2, @hypot, @eq, @ne, @lt, @le, @gt, @ge, \
+%! funs = {@plus, @minus, @times, @rdivide, @ldivide, @power, @max, @min, ...
+%!         @rem, @mod, @atan2, @hypot, @eq, @ne, @lt, @le, @gt, @ge, ...
 %!         @and, @or, @xor };
 %!
 %! float_types = {@single, @double};
-%! int_types = {@int8, @int16, @int32, @int64, \
+%! int_types = {@int8, @int16, @int32, @int64, ...
 %!              @uint8, @uint16, @uint32, @uint64};
 %!
 %! x = rand (3) * 10-5;
@@ -792,19 +792,19 @@
 %!       f_type = float_types{j};
 %!       i_type = int_types{k};
 %!
-%!         assert (bsxfun (fun, f_type (x), i_type (y)), \
+%!         assert (bsxfun (fun, f_type (x), i_type (y)), ...
 %!                 fun (f_type(x), i_type (y)));
-%!         assert (bsxfun (fun, f_type (y), i_type (x)), \
+%!         assert (bsxfun (fun, f_type (y), i_type (x)), ...
 %!                 fun (f_type(y), i_type (x)));
 %!
-%!         assert (bsxfun (fun, i_type (x), i_type (y)), \
+%!         assert (bsxfun (fun, i_type (x), i_type (y)), ...
 %!                 fun (i_type (x), i_type (y)));
-%!         assert (bsxfun (fun, i_type (y), i_type (x)), \
+%!         assert (bsxfun (fun, i_type (y), i_type (x)), ...
 %!                 fun (i_type (y), i_type (x)));
 %!
-%!         assert (bsxfun (fun, f_type (x), f_type (y)), \
+%!         assert (bsxfun (fun, f_type (x), f_type (y)), ...
 %!                 fun (f_type (x), f_type (y)));
-%!         assert (bsxfun (fun, f_type(y), f_type(x)), \
+%!         assert (bsxfun (fun, f_type(y), f_type(x)), ...
 %!                 fun (f_type (y), f_type (x)));
 %!     endfor
 %!   endfor
--- a/libinterp/corefcn/cellfun.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/cellfun.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -133,6 +133,13 @@
         result(count) = f_args.elem (count).is_bool_type ();
       retval(0) = result;
     }
+  else if (name == "isnumeric")
+    {
+      boolNDArray result (f_args.dims ());
+      for (octave_idx_type  count= 0; count < k; count++)
+        result(count) = f_args.elem (count).is_numeric_type ();
+      retval(0) = result;
+    }
   else if (name == "isreal")
     {
       boolNDArray result (f_args.dims ());
@@ -154,7 +161,7 @@
         result(count) = static_cast<double> (f_args.elem (count).ndims ());
       retval(0) = result;
     }
-  else if (name == "prodofsize" || name == "numel")
+  else if (name == "numel" || name == "prodofsize")
     {
       NDArray result (f_args.dims ());
       for (octave_idx_type count = 0; count < k; count++)
@@ -278,6 +285,9 @@
 @item islogical\n\
 Return 1 for logical elements.\n\
 \n\
+@item isnumeric\n\
+Return 1 for numeric elements.\n\
+\n\
 @item isreal\n\
 Return 1 for real elements.\n\
 \n\
@@ -287,7 +297,7 @@
 @item ndims\n\
 Return the number of dimensions of each element.\n\
 \n\
-@item numel\n\
+@item  numel\n\
 @itemx prodofsize\n\
 Return the number of elements contained within each cell element.  The\n\
 number is the product of the dimensions of the object at each cell element.\n\
@@ -337,10 +347,10 @@
 the input arguments.  Input arguments that are singleton (1x1) cells will be\n\
 automatically expanded to the size of the other arguments.\n\
 \n\
-If the parameter \"UniformOutput\" is set to true (the default), then the\n\
-function must return scalars which will be concatenated into the return\n\
-array(s).  If \"UniformOutput\" is false, the outputs are concatenated into a\n\
-cell array (or cell arrays).  For example:\n\
+If the parameter @qcode{\"UniformOutput\"} is set to true (the default),\n\
+then the function must return scalars which will be concatenated into the\n\
+return array(s).  If @qcode{\"UniformOutput\"} is false, the outputs are\n\
+concatenated into a cell array (or cell arrays).  For example:\n\
 \n\
 @example\n\
 @group\n\
@@ -350,8 +360,9 @@
 @end group\n\
 @end example\n\
 \n\
-Given the parameter \"ErrorHandler\", then @var{errfunc} defines a function\n\
-to call in case @var{func} generates an error.  The form of the function is\n\
+Given the parameter @qcode{\"ErrorHandler\"}, then @var{errfunc} defines a\n\
+function to call in case @var{func} generates an error.  The form of the\n\
+function is\n\
 \n\
 @example\n\
 function [@dots{}] = errfunc (@var{s}, @dots{})\n\
@@ -360,9 +371,9 @@
 @noindent\n\
 where there is an additional input argument to @var{errfunc} relative to\n\
 @var{func}, given by @var{s}.  This is a structure with the elements\n\
-'identifier', 'message' and 'index', giving respectively the error\n\
-identifier, the error message, and the index into the input arguments\n\
-of the element that caused the error.  For example:\n\
+@qcode{\"identifier\"}, @qcode{\"message\"} and @qcode{\"index\"}, giving\n\
+respectively the error identifier, the error message, and the index into the\n\
+input arguments of the element that caused the error.  For example:\n\
 \n\
 @example\n\
 @group\n\
@@ -778,7 +789,7 @@
 %! assert (A, [true, false, true, false]);
 
 %% First input argument can be the special string "isreal",
-%% "isempty", "islogical", "length", "ndims" or "prodofsize"
+%% "isempty", "islogical", "isnumeric", "length", "ndims" or "prodofsize"
 %!test
 %! A = cellfun ("isreal", {true, 0.1, {}, i*2, [], "abc"});
 %! assert (A, [true, true, false, false, true, true]);
@@ -789,6 +800,9 @@
 %! A = cellfun ("islogical", {true, 0.1, false, i*2, [], "abc"});
 %! assert (A, [true, false, true, false, false, false]);
 %!test
+%! A = cellfun ("isnumeric", {true, 0.1, false, i*2, [], "abc"});
+%! assert (A, [false, true, false, true, true, false]);
+%!test
 %! A = cellfun ("length", {true, 0.1, false, i*2, [], "abc"});
 %! assert (A, [1, 1, 1, 1, 0, 3]);
 %!test
@@ -803,7 +817,7 @@
 %! A = cellfun (@(x,y,z) x + y + z, {1, 1, 1}, {2, 2, 2}, {3, 4, 5});
 %! assert (A, [6, 7, 8]);
 %!test
-%! A = cellfun (@(x,y,z) x + y + z, {1, 1, 1}, {2, 2, 2}, {3, 4, 5}, \
+%! A = cellfun (@(x,y,z) x + y + z, {1, 1, 1}, {2, 2, 2}, {3, 4, 5}, ...
 %!              "UniformOutput", false);
 %! assert (A, {6, 7, 8});
 %!test %% Two input arguments of different types
@@ -824,20 +838,20 @@
 %! A = cellfun (@(x,y) x == y, {false, true}, {true, true});
 %! assert (A, [false, true]);
 %!test
-%! A = cellfun (@(x,y) x == y, {false; true}, {true; true}, \
+%! A = cellfun (@(x,y) x == y, {false; true}, {true; true}, ...
 %!              "UniformOutput", true);
 %! assert (A, [false; true]);
 %!test
 %! A = cellfun (@(x) x, {false, true; false, true}, "UniformOutput", false);
 %! assert (A, {false, true; false, true});
 %!test %% Three ouptut arguments of same type
-%! [A, B, C] = cellfun (@find, {true, false; false, true}, \
+%! [A, B, C] = cellfun (@find, {true, false; false, true}, ...
 %!                      "UniformOutput", false);
 %! assert (isequal (A, {true, []; [], true}));
 %! assert (isequal (B, {true, []; [], true}));
 %! assert (isequal (C, {true, []; [], true}));
 %!test
-%! A = cellfun (@(x,y) cell2str (x,y), {true}, {true}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {true}, {true}, ...
 %!              "ErrorHandler", @__cellfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -845,7 +859,7 @@
 %! assert (isempty (A.message), false);
 %! assert (A.index, 1);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = cellfun (@(x,y) cell2str (x,y), {true}, {true}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {true}, {true}, ...
 %!              "UniformOutput", true, "ErrorHandler", @__cellfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -858,7 +872,7 @@
 %! A = cellfun (@(x,y) x>y, {1.1, 4.2}, {3.1, 2+3*i});
 %! assert (A, [false, true]);
 %!test
-%! A = cellfun (@(x,y) x>y, {1.1, 4.2; 2, 4}, {3.1, 2; 2, 4+2*i}, \
+%! A = cellfun (@(x,y) x>y, {1.1, 4.2; 2, 4}, {3.1, 2; 2, 4+2*i}, ...
 %!              "UniformOutput", true);
 %! assert (A, [false, true; false, false]);
 %!test
@@ -871,7 +885,7 @@
 %! assert (isequal (B, {true, true; [], true}));
 %! assert (isequal (C, {10, 11; [], 12}));
 %!test
-%! A = cellfun (@(x,y) cell2str (x,y), {1.1, 4}, {3.1, 6}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {1.1, 4}, {3.1, 6}, ...
 %!              "ErrorHandler", @__cellfunerror);
 %! B = isfield (A(1), "message") && isfield (A(1), "index");
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
@@ -880,7 +894,7 @@
 %! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]);
 %! assert ([A(1).index, A(2).index], [1, 2]);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = cellfun (@(x,y) cell2str (x,y), {1.1, 4}, {3.1, 6}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {1.1, 4}, {3.1, 6}, ...
 %!              "UniformOutput", true, "ErrorHandler", @__cellfunerror);
 %! B = isfield (A(1), "message") && isfield (A(1), "index");
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
@@ -899,7 +913,7 @@
 %! A = cellfun (@(x,y) x:y, {"a", "d"}, {"c", "f"}, "UniformOutput", false);
 %! assert (A, {"abc", "def"});
 %!test
-%! A = cellfun (@(x,y) cell2str (x,y), {"a", "d"}, {"c", "f"}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {"a", "d"}, {"c", "f"}, ...
 %!              "ErrorHandler", @__cellfunerror);
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
 %! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]);
@@ -907,7 +921,7 @@
 %! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]);
 %! assert ([A(1).index, A(2).index], [1, 2]);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = cellfun (@(x,y) cell2str (x,y), {"a", "d"}, {"c", "f"}, \
+%! A = cellfun (@(x,y) cell2str (x,y), {"a", "d"}, {"c", "f"}, ...
 %!              "UniformOutput", true, "ErrorHandler", @__cellfunerror);
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
 %! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]);
@@ -925,15 +939,15 @@
 %! A = cellfun (@(x,y) x{1} < y{1}, {{1.1}, {4.2}}, {{3.1}, {2}});
 %! assert (A, [1, 0], 1e-16);
 %!test
-%! A = cellfun (@(x,y) x{1} < y{1}, {{1.1}; {4.2}}, {{3.1}; {2}}, \
+%! A = cellfun (@(x,y) x{1} < y{1}, {{1.1}; {4.2}}, {{3.1}; {2}}, ...
 %!              "UniformOutput", true);
 %! assert (A, [1; 0], 1e-16);
 %!test
-%! A = cellfun (@(x,y) x{1} < y{1}, {{1.1}, {4.2}}, {{3.1}, {2}}, \
+%! A = cellfun (@(x,y) x{1} < y{1}, {{1.1}, {4.2}}, {{3.1}, {2}}, ...
 %!              "UniformOutput", false);
 %! assert (A, {true, false});
 %!test
-%! A = cellfun (@(x,y) mat2str (x,y), {{1.1}, {4.2}}, {{3.1}, {2}}, \
+%! A = cellfun (@(x,y) mat2str (x,y), {{1.1}, {4.2}}, {{3.1}, {2}}, ...
 %!              "ErrorHandler", @__cellfunerror);
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
 %! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]);
@@ -941,7 +955,7 @@
 %! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]);
 %! assert ([A(1).index, A(2).index], [1, 2]);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = cellfun (@(x,y) mat2str (x,y), {{1.1}, {4.2}}, {{3.1}, {2}}, \
+%! A = cellfun (@(x,y) mat2str (x,y), {{1.1}, {4.2}}, {{3.1}, {2}}, ...
 %!              "UniformOutput", true, "ErrorHandler", @__cellfunerror);
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
 %! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]);
@@ -956,17 +970,17 @@
 %! assert (A, true);
 %!test
 %! a = struct ("a", 1, "b", 2);  b = struct ("a", 1, "b", 3);
-%! A = cellfun (@(x,y) (x.a == y.a) && (x.b < y.b) , {a}, {b}, \
+%! A = cellfun (@(x,y) (x.a == y.a) && (x.b < y.b) , {a}, {b}, ...
 %!              "UniformOutput", true);
 %! assert (A, true);
 %!test
 %! a = struct ("a", 1, "b", 2);  b = struct ("a", 1, "b", 3);
-%! A = cellfun (@(x,y) (x.a == y.a) && (x.b < y.b) , {a}, {b}, \
+%! A = cellfun (@(x,y) (x.a == y.a) && (x.b < y.b) , {a}, {b}, ...
 %!              "UniformOutput", false);
 %! assert (A, {true});
 %!test
 %! a = struct ("a", 1, "b", 2);  b = struct ("a", 1, "b", 3);
-%! A = cellfun (@(x,y) cell2str (x.a, y.a), {a}, {b}, \
+%! A = cellfun (@(x,y) cell2str (x.a, y.a), {a}, {b}, ...
 %!              "ErrorHandler", @__cellfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -975,7 +989,7 @@
 %! assert (A.index, 1);
 %!test %% Overwriting setting of "UniformOutput" true
 %! a = struct ("a", 1, "b", 2);  b = struct ("a", 1, "b", 3);
-%! A = cellfun (@(x,y) cell2str (x.a, y.a), {a}, {b}, \
+%! A = cellfun (@(x,y) cell2str (x.a, y.a), {a}, {b}, ...
 %!              "UniformOutput", true, "ErrorHandler", @__cellfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -989,6 +1003,7 @@
 %!assert (cellfun ("sin", {0,1}), sin ([0,1]))
 %!assert (cellfun ("isempty", {1,[]}), [false,true])
 %!assert (cellfun ("islogical", {false,pi}), [true,false])
+%!assert (cellfun ("isnumeric", {false,pi,struct()}), [false,true,false])
 %!assert (cellfun ("isreal", {1i,1}), [false,true])
 %!assert (cellfun ("length", {zeros(2,2),1}), [2,1])
 %!assert (cellfun ("prodofsize", {zeros(2,2),1}), [4,1])
@@ -1056,7 +1071,7 @@
 @end example\n\
 \n\
 If the parameter @var{val} after a further string input argument\n\
-\"UniformOutput\" is set @code{true} (the default), then the named\n\
+@qcode{\"UniformOutput\"} is set @code{true} (the default), then the named\n\
 function @var{func} must return a single element which then will be\n\
 concatenated into the return value and is of type matrix.  Otherwise,\n\
 if that parameter is set to @code{false}, then the outputs are\n\
@@ -1101,7 +1116,7 @@
 @end example\n\
 \n\
 If the parameter @var{errfunc} after a further string input argument\n\
-\"ErrorHandler\" is another string, a function handle, an inline\n\
+@qcode{\"ErrorHandler\"} is another string, a function handle, an inline\n\
 function, or an anonymous function, then @var{errfunc} defines a\n\
 function to call in the case that @var{func} generates an error.\n\
 The definition of the function must be of the form\n\
@@ -1113,11 +1128,11 @@
 @noindent\n\
 where there is an additional input argument to @var{errfunc}\n\
 relative to @var{func}, given by @var{s}.  This is a structure with\n\
-the elements \"identifier\", \"message\", and \"index\" giving,\n\
-respectively, the error identifier, the error message, and the index of\n\
-the array elements that caused the error.  The size of the output\n\
-argument of @var{errfunc} must have the same size as the output\n\
-argument of @var{func}, otherwise a real error is thrown.  For\n\
+the elements @qcode{\"identifier\"}, @qcode{\"message\"}, and\n\
+@qcode{\"index\"} giving, respectively, the error identifier, the error\n\
+message, and the index of the array elements that caused the error.  The\n\
+size of the output argument of @var{errfunc} must have the same size as the\n\
+output argument of @var{func}, otherwise a real error is thrown.  For\n\
 example:\n\
 \n\
 @example\n\
@@ -1545,7 +1560,7 @@
 %! assert (isequal (B, {true, []; [], true}));
 %! assert (isequal (C, {true, []; [], true}));
 %!test
-%! A = arrayfun (@(x,y) array2str (x,y), true, true, \
+%! A = arrayfun (@(x,y) array2str (x,y), true, true, ...
 %!               "ErrorHandler", @__arrayfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -1553,7 +1568,7 @@
 %! assert (isempty (A.message), false);
 %! assert (A.index, 1);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = arrayfun (@(x,y) array2str (x,y), true, true, "UniformOutput", true, \
+%! A = arrayfun (@(x,y) array2str (x,y), true, true, "UniformOutput", true, ...
 %!               "ErrorHandler", @__arrayfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -1578,7 +1593,7 @@
 %! assert (isequal (B, {true, true; [], true}));
 %! assert (isequal (C, {10, 11; [], 12}));
 %!test
-%! A = arrayfun (@(x,y) array2str (x,y), {1.1, 4}, {3.1, 6}, \
+%! A = arrayfun (@(x,y) array2str (x,y), {1.1, 4}, {3.1, 6}, ...
 %!               "ErrorHandler", @__arrayfunerror);
 %! B = isfield (A(1), "message") && isfield (A(1), "index");
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
@@ -1587,7 +1602,7 @@
 %! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]);
 %! assert ([A(1).index, A(2).index], [1, 2]);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = arrayfun (@(x,y) array2str (x,y), {1.1, 4}, {3.1, 6}, \
+%! A = arrayfun (@(x,y) array2str (x,y), {1.1, 4}, {3.1, 6}, ...
 %!               "UniformOutput", true, "ErrorHandler", @__arrayfunerror);
 %! B = isfield (A(1), "message") && isfield (A(1), "index");
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
@@ -1607,7 +1622,7 @@
 %! A = arrayfun (@(x,y) x:y, ["a", "d"], ["c", "f"], "UniformOutput", false);
 %! assert (A, {"abc", "def"});
 %!test
-%! A = arrayfun (@(x,y) cell2str (x,y), ["a", "d"], ["c", "f"], \
+%! A = arrayfun (@(x,y) cell2str (x,y), ["a", "d"], ["c", "f"], ...
 %!               "ErrorHandler", @__arrayfunerror);
 %! B = isfield (A(1), "identifier") && isfield (A(1), "message") && isfield (A(1), "index");
 %! assert (B, true);
@@ -1633,7 +1648,7 @@
 %! assert (isempty (A.message), false);
 %! assert (A.index, 1);
 %!test %% Overwriting setting of "UniformOutput" true
-%! A = arrayfun (@(x) mat2str(x), "a", "UniformOutput", true, \
+%! A = arrayfun (@(x) mat2str(x), "a", "UniformOutput", true, ...
 %!               "ErrorHandler", @__arrayfunerror);
 %! assert (isfield (A, "identifier"), true);
 %! assert (isfield (A, "message"), true);
@@ -1659,7 +1674,7 @@
 %! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]);
 %! assert ([A(1).index, A(2).index], [1, 2]);
 %!test
-%! A = arrayfun (@(x,y) num2str (x,y), {1.1, 4.2}, {3.1, 2}, \
+%! A = arrayfun (@(x,y) num2str (x,y), {1.1, 4.2}, {3.1, 2}, ...
 %!               "UniformOutput", true, "ErrorHandler", @__arrayfunerror);
 %! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]);
 %! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]);
@@ -2215,7 +2230,7 @@
       bool sparse = a.is_sparse_type ();
       if (sparse && nargin > 3)
         {
-          error ("mat2cell: sparse arguments only support 2D indexing");
+          error ("mat2cell: sparse arguments only support 2-D indexing");
           return retval;
         }
 
--- a/libinterp/corefcn/conv2.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/conv2.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -44,15 +44,15 @@
 values\n\
 \n\
 @table @asis\n\
-@item @var{shape} = \"full\"\n\
+@item @var{shape} = @qcode{\"full\"}\n\
 Return the full convolution.  (default)\n\
 \n\
-@item @var{shape} = \"same\"\n\
+@item @var{shape} = @qcode{\"same\"}\n\
 Return the central part of the convolution with the same size as @var{A}.\n\
 The central part of the convolution begins at the indices\n\
 @code{floor ([size(@var{B})/2] + 1)}.\n\
 \n\
-@item @var{shape} = \"valid\"\n\
+@item @var{shape} = @qcode{\"valid\"}\n\
 Return only the parts which do not include zero-padded edges.\n\
 The size of the result is @code{max (size (A) - size (B) + 1, 0)}.\n\
 @end table\n\
@@ -277,7 +277,7 @@
 %! y = ones (5);
 %! A = conv2 (x, y)(5:end-4,5:end-4);
 %! B = conv2 (x, y, "valid");
-%! assert (B, A); ## Yes, this test is for *exact* equivalence.
+%! assert (B, A);   # Yes, this test is for *exact* equivalence.
 
 
 %% Test input validation
@@ -299,15 +299,15 @@
 values\n\
 \n\
 @table @asis\n\
-@item @var{shape} = \"full\"\n\
+@item @var{shape} = @qcode{\"full\"}\n\
 Return the full convolution.  (default)\n\
 \n\
-@item @var{shape} = \"same\"\n\
+@item @var{shape} = @qcode{\"same\"}\n\
 Return central part of the convolution with the same size as @var{A}.\n\
 The central part of the convolution begins at the indices\n\
 @code{floor ([size(@var{B})/2] + 1)}.\n\
 \n\
-@item @var{shape} = \"valid\"\n\
+@item @var{shape} = @qcode{\"valid\"}\n\
 Return only the parts which do not include zero-padded edges.\n\
 The size of the result is @code{max (size (A) - size (B) + 1, 0)}.\n\
 @end table\n\
--- a/libinterp/corefcn/data.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/data.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1095,8 +1095,8 @@
 Cumulative sum of elements along dimension @var{dim}.  If @var{dim}\n\
 is omitted, it defaults to the first non-singleton dimension.\n\
 \n\
-See @code{sum} for an explanation of the optional parameters \"native\",\n\
-\"double\", and \"extra\".\n\
+See @code{sum} for an explanation of the optional parameters\n\
+@qcode{\"native\"}, @qcode{\"double\"}, and @qcode{\"extra\"}.\n\
 @seealso{sum, cumprod}\n\
 @end deftypefn")
 {
@@ -2375,10 +2375,13 @@
 DEFUN (length, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} length (@var{a})\n\
-Return the \"length\" of the object @var{a}.  For matrix objects, the\n\
-length is the number of rows or columns, whichever is greater (this\n\
-odd definition is used for compatibility with @sc{matlab}).\n\
-@seealso{size}\n\
+Return the length of the object @var{a}.\n\
+\n\
+The length is 0 for empty objects, 1 for scalars, and the number of elements\n\
+for vectors.  For matrix objects, the length is the number of rows or\n\
+columns, whichever is greater (this odd definition is used for compatibility\n\
+with @sc{matlab}).\n\
+@seealso{numel, size}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2671,9 +2674,9 @@
 Sum of elements along dimension @var{dim}.  If @var{dim} is\n\
 omitted, it defaults to the first non-singleton dimension.\n\
 \n\
-If the optional argument \"native\" is given, then the sum is performed\n\
-in the same type as the original argument, rather than in the default\n\
-double type.  For example:\n\
+If the optional argument @qcode{\"native\"} is given, then the sum is\n\
+performed in the same type as the original argument, rather than in the\n\
+default double type.  For example:\n\
 \n\
 @example\n\
 @group\n\
@@ -2684,13 +2687,13 @@
 @end group\n\
 @end example\n\
 \n\
-On the contrary, if \"double\" is given, the sum is performed in double\n\
-precision even for single precision inputs.\n\
-\n\
-For double precision inputs, \"extra\" indicates that a more accurate\n\
+On the contrary, if @qcode{\"double\"} is given, the sum is performed in\n\
+double precision even for single precision inputs.\n\
+\n\
+For double precision inputs, @qcode{\"extra\"} indicates that a more accurate\n\
 algorithm than straightforward summation is to be used.  For single precision\n\
-inputs, \"extra\" is the same as \"double\".  Otherwise, \"extra\" has no\n\
-effect.\n\
+inputs, @qcode{\"extra\"} is the same as @qcode{\"double\"}.  Otherwise,\n\
+@qcode{\"extra\"} has no effect.\n\
 @seealso{cumsum, sumsq, prod}\n\
 @end deftypefn")
 {
@@ -3970,7 +3973,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{isinf, NaN}\n\
 @end deftypefn")
 {
@@ -4029,7 +4032,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{isnan, Inf}\n\
 @end deftypefn")
 {
@@ -4078,7 +4081,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{log, exp, pi, I}\n\
 @end deftypefn")
 {
@@ -4119,7 +4122,7 @@
 the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{realmax, realmin, intmax, bitmax}\n\
 @end deftypefn")
 {
@@ -4243,7 +4246,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{e, I}\n\
 @end deftypefn")
 {
@@ -4276,13 +4279,13 @@
 for single precision.\n\
 \n\
 When called with no arguments, return a scalar with the value\n\
-@code{realmax (\"double\")}.\n\
+@code{realmax (@qcode{\"double\"})}.\n\
 When called with a single argument, return a square matrix with the dimension\n\
 specified.  When called with more than one scalar argument the first two\n\
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{realmin, intmax, bitmax, eps}\n\
 @end deftypefn")
 {
@@ -4310,13 +4313,13 @@
 for single precision.\n\
 \n\
 When called with no arguments, return a scalar with the value\n\
-@code{realmin (\"double\")}.\n\
+@code{realmin (@qcode{\"double\"})}.\n\
 When called with a single argument, return a square matrix with the dimension\n\
 specified.  When called with more than one scalar argument the first two\n\
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{realmax, intmin, eps}\n\
 @end deftypefn")
 {
@@ -4354,7 +4357,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{e, pi, log, exp}\n\
 @end deftypefn")
 {
@@ -4384,7 +4387,7 @@
 arguments are taken as the number of rows and columns and any further\n\
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
-either \"double\" or \"single\".\n\
+either @qcode{\"double\"} or @qcode{\"single\"}.\n\
 @seealso{isna}\n\
 @end deftypefn")
 {
@@ -4783,9 +4786,9 @@
 %! assert (size (x2) == [1, 10] && x2(1) == 1 && x2(10) == 2);
 %! assert (size (x3) == [1, 10] && x3(1) == 1 && x3(10) == -2);
 
-%assert (linspace ([1, 2; 3, 4], 5, 6), linspace (1, 5, 6))
-
-%assert (linspace (0, 1, []), 1)
+%! ##assert (linspace ([1, 2; 3, 4], 5, 6), linspace (1, 5, 6))
+
+%!assert (linspace (0, 1, []), 1)
 
 %!error linspace ()
 %!error linspace (1, 2, 3, 4)
@@ -5144,11 +5147,11 @@
 @item @var{p} = @code{2}\n\
 Largest singular value of @var{A}.\n\
 \n\
-@item @var{p} = @code{Inf} or @code{\"inf\"}\n\
+@item @var{p} = @code{Inf} or @qcode{\"inf\"}\n\
 @cindex infinity norm\n\
 Infinity norm, the largest row sum of the absolute values of @var{A}.\n\
 \n\
-@item @var{p} = @code{\"fro\"}\n\
+@item @var{p} = @qcode{\"fro\"}\n\
 @cindex Frobenius norm\n\
 Frobenius norm of @var{A}, @code{sqrt (sum (diag (@var{A}' * @var{A})))}.\n\
 \n\
@@ -5160,13 +5163,13 @@
 If @var{A} is a vector or a scalar:\n\
 \n\
 @table @asis\n\
-@item @var{p} = @code{Inf} or @code{\"inf\"}\n\
+@item @var{p} = @code{Inf} or @qcode{\"inf\"}\n\
 @code{max (abs (@var{A}))}.\n\
 \n\
 @item @var{p} = @code{-Inf}\n\
 @code{min (abs (@var{A}))}.\n\
 \n\
-@item @var{p} = @code{\"fro\"}\n\
+@item @var{p} = @qcode{\"fro\"}\n\
 Frobenius norm of @var{A}, @code{sqrt (sumsq (abs (A)))}.\n\
 \n\
 @item @var{p} = 0\n\
@@ -5179,10 +5182,10 @@
 the p-pseudonorm defined as above.\n\
 @end table\n\
 \n\
-If @var{opt} is the value @code{\"rows\"}, treat each row as a vector and\n\
+If @var{opt} is the value @qcode{\"rows\"}, treat each row as a vector and\n\
 compute its norm.  The result is returned as a column vector.\n\
-Similarly, if @var{opt} is @code{\"columns\"} or @code{\"cols\"} then compute\n\
-the norms of each column and return a row vector.\n\
+Similarly, if @var{opt} is @qcode{\"columns\"} or @qcode{\"cols\"} then\n\
+compute the norms of each column and return a row vector.\n\
 @seealso{cond, svd}\n\
 @end deftypefn")
 {
@@ -5213,29 +5216,53 @@
               // we've handled the last parameter, so act as if it was removed
               nargin --;
             }
-          else if (nargin > 1 && ! args(1).is_scalar_type ())
-            gripe_wrong_type_arg ("norm", args(1), true);
 
           if (! error_state)
             {
               octave_value p_arg = (nargin > 1) ? args(1) : octave_value (2);
-              switch (strflag)
+
+              if (p_arg.is_empty ())
+                p_arg = octave_value (2);
+              else if (p_arg.is_string ())
                 {
-                case sfmatrix:
-                  retval(0) = xnorm (x_arg, p_arg);
-                  break;
-                case sfcols:
-                  retval(0) = xcolnorms (x_arg, p_arg);
-                  break;
-                case sfrows:
-                  retval(0) = xrownorms (x_arg, p_arg);
-                  break;
-                case sffrob:
-                  retval(0) = xfrobnorm (x_arg);
-                  break;
-                case sfinf:
-                  retval(0) = xnorm (x_arg, octave_Inf);
-                  break;
+                  std::string str = p_arg.string_value ();
+                  if ((strflag == sfcols || strflag == sfrows))
+                    {
+                      if (str == "cols" || str == "columns" || str == "rows")
+                        error ("norm: invalid combination of options");
+                      else if (str == "fro")
+                        p_arg = octave_value (2);
+                      else if (str == "inf")
+                        p_arg = octave_Inf;
+                      else
+                        error ("norm: unrecognized option: %s", str.c_str ());
+                    }
+                  else
+                    error ("norm: invalid combination of options");
+                }
+              else if (! p_arg.is_scalar_type ())
+                gripe_wrong_type_arg ("norm", p_arg, true);
+
+              if (! error_state)
+                {
+                  switch (strflag)
+                    {
+                    case sfmatrix:
+                      retval(0) = xnorm (x_arg, p_arg);
+                      break;
+                    case sfcols:
+                      retval(0) = xcolnorms (x_arg, p_arg);
+                      break;
+                    case sfrows:
+                      retval(0) = xrownorms (x_arg, p_arg);
+                      break;
+                    case sffrob:
+                      retval(0) = xfrobnorm (x_arg);
+                      break;
+                    case sfinf:
+                      retval(0) = xnorm (x_arg, octave_Inf);
+                      break;
+                    }
                 }
             }
         }
@@ -5299,6 +5326,18 @@
 %!assert (norm (flo*m2,"fro"), single (sqrt (30)*flo), -eps ("single"))
 %!assert (norm (fhi*m2,"fro"), single (sqrt (30)*fhi), -eps ("single"))
 
+%!shared q
+%! q = rand (1e3, 3);
+%!assert (norm (q, 3, "rows"), sum (q.^3, 2).^(1/3), sqrt (eps));
+%!assert (norm (q, "fro", "rows"), sum (q.^2, 2).^(1/2), sqrt (eps));
+%!assert (norm (q, "fro", "rows"), sqrt (sumsq (q, 2)), sqrt (eps));
+%!assert (norm (q, "fro", "cols"), sqrt (sumsq (q, 1)), sqrt (eps));
+%!assert (norm (q, 3, "cols"), sum (q.^3, 1).^(1/3), sqrt (eps));
+%!assert (norm (q, "inf", "rows"), norm (q, Inf, "rows"));
+%!assert (norm (q, "inf", "cols"), norm (q, Inf, "cols"));
+%!assert (norm (q, [], "rows"), norm (q, 2, "rows"));
+%!assert (norm (q, [], "cols"), norm (q, 2, "cols"));
+
 %!test
 %! ## Test for norm returning NaN on sparse matrix (bug #30631)
 %! A = sparse (2,2); 
@@ -5333,7 +5372,7 @@
 DEFUN (uplus, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} uplus (@var{x})\n\
-This function and @w{@xcode{+ x}} are equivalent.\n\
+This function and @w{@tcode{+ x}} are equivalent.\n\
 @seealso{uminus, plus, minus}\n\
 @end deftypefn")
 {
@@ -5343,7 +5382,7 @@
 DEFUN (uminus, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} uminus (@var{x})\n\
-This function and @w{@xcode{- x}} are equivalent.\n\
+This function and @w{@tcode{- x}} are equivalent.\n\
 @seealso{uplus, minus}\n\
 @end deftypefn")
 {
@@ -5354,7 +5393,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} transpose (@var{x})\n\
 Return the transpose of @var{x}.\n\
-This function and @xcode{x.'} are equivalent.\n\
+This function and @tcode{x.'} are equivalent.\n\
 @seealso{ctranspose}\n\
 @end deftypefn")
 {
@@ -5385,7 +5424,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} ctranspose (@var{x})\n\
 Return the complex conjugate transpose of @var{x}.\n\
-This function and @xcode{x'} are equivalent.\n\
+This function and @tcode{x'} are equivalent.\n\
 @seealso{transpose}\n\
 @end deftypefn")
 {
@@ -5459,7 +5498,7 @@
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {} plus (@var{x}, @var{y})\n\
 @deftypefnx {Built-in Function} {} plus (@var{x1}, @var{x2}, @dots{})\n\
-This function and @w{@xcode{x + y}} are equivalent.\n\
+This function and @w{@tcode{x + y}} are equivalent.\n\
 If more arguments are given, the summation is applied\n\
 cumulatively from left to right:\n\
 \n\
@@ -5478,7 +5517,7 @@
 DEFUN (minus, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} minus (@var{x}, @var{y})\n\
-This function and @w{@xcode{x - y}} are equivalent.\n\
+This function and @w{@tcode{x - y}} are equivalent.\n\
 @seealso{plus, uminus}\n\
 @end deftypefn")
 {
@@ -5490,7 +5529,7 @@
 @deftypefn  {Built-in Function} {} mtimes (@var{x}, @var{y})\n\
 @deftypefnx {Built-in Function} {} mtimes (@var{x1}, @var{x2}, @dots{})\n\
 Return the matrix multiplication product of inputs.\n\
-This function and @w{@xcode{x * y}} are equivalent.\n\
+This function and @w{@tcode{x * y}} are equivalent.\n\
 If more arguments are given, the multiplication is applied\n\
 cumulatively from left to right:\n\
 \n\
@@ -5510,7 +5549,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} mrdivide (@var{x}, @var{y})\n\
 Return the matrix right division of @var{x} and @var{y}.\n\
-This function and @w{@xcode{x / y}} are equivalent.\n\
+This function and @w{@tcode{x / y}} are equivalent.\n\
 @seealso{mldivide, rdivide, plus, minus}\n\
 @end deftypefn")
 {
@@ -5521,7 +5560,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} mpower (@var{x}, @var{y})\n\
 Return the matrix power operation of @var{x} raised to the @var{y} power.\n\
-This function and @w{@xcode{x ^ y}} are equivalent.\n\
+This function and @w{@tcode{x ^ y}} are equivalent.\n\
 @seealso{power, mtimes, plus, minus}\n\
 @end deftypefn")
 {
@@ -5532,7 +5571,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} mldivide (@var{x}, @var{y})\n\
 Return the matrix left division of @var{x} and @var{y}.\n\
-This function and @w{@xcode{x @xbackslashchar{} y}} are equivalent.\n\
+This function and @w{@tcode{x @xbackslashchar{} y}} are equivalent.\n\
 @seealso{mrdivide, ldivide, rdivide}\n\
 @end deftypefn")
 {
@@ -5606,7 +5645,7 @@
 @deftypefn  {Built-in Function} {} times (@var{x}, @var{y})\n\
 @deftypefnx {Built-in Function} {} times (@var{x1}, @var{x2}, @dots{})\n\
 Return the element-by-element multiplication product of inputs.\n\
-This function and @w{@xcode{x .* y}} are equivalent.\n\
+This function and @w{@tcode{x .* y}} are equivalent.\n\
 If more arguments are given, the multiplication is applied\n\
 cumulatively from left to right:\n\
 \n\
@@ -5626,7 +5665,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} rdivide (@var{x}, @var{y})\n\
 Return the element-by-element right division of @var{x} and @var{y}.\n\
-This function and @w{@xcode{x ./ y}} are equivalent.\n\
+This function and @w{@tcode{x ./ y}} are equivalent.\n\
 @seealso{ldivide, mrdivide, times, plus}\n\
 @end deftypefn")
 {
@@ -5642,7 +5681,7 @@
 @code{realpow}, @code{realsqrt}, @code{cbrt}, or @code{nthroot} if a\n\
 real result is preferred.\n\
 \n\
-This function and @w{@xcode{x .^ y}} are equivalent.\n\
+This function and @w{@tcode{x .^ y}} are equivalent.\n\
 @seealso{mpower, realpow, realsqrt, cbrt, nthroot}\n\
 @end deftypefn")
 {
@@ -5653,7 +5692,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} ldivide (@var{x}, @var{y})\n\
 Return the element-by-element left division of @var{x} and @var{y}.\n\
-This function and @w{@xcode{x .@xbackslashchar{} y}} are equivalent.\n\
+This function and @w{@tcode{x .@xbackslashchar{} y}} are equivalent.\n\
 @seealso{rdivide, mldivide, times, plus}\n\
 @end deftypefn")
 {
@@ -5929,7 +5968,7 @@
 If the optional argument @var{dim} is given, then the matrix is sorted\n\
 along the dimension defined by @var{dim}.  The optional argument @code{mode}\n\
 defines the order in which the values will be sorted.  Valid values of\n\
-@code{mode} are \"ascend\" or \"descend\".\n\
+@code{mode} are @qcode{\"ascend\"} or @qcode{\"descend\"}.\n\
 \n\
 The @code{sort} function may also be used to produce a matrix\n\
 containing the original row indices of the elements in the sorted\n\
@@ -6322,11 +6361,11 @@
 @deftypefnx {Built-in Function} {} issorted (@var{a}, @var{mode})\n\
 @deftypefnx {Built-in Function} {} issorted (@var{a}, \"rows\", @var{mode})\n\
 Return true if the array is sorted according to @var{mode}, which\n\
-may be either \"ascending\", \"descending\", or \"either\".  By default,\n\
- @var{mode} is \"ascending\".  NaNs are treated in the same manner as\n\
-@code{sort}.\n\
-\n\
-If the optional argument \"rows\" is supplied, check whether\n\
+may be either @qcode{\"ascending\"}, @qcode{\"descending\"}, or\n\
+@qcode{\"either\"}.  By default,  @var{mode} is @qcode{\"ascending\"}.  NaNs\n\
+are treated in the same manner as @code{sort}.\n\
+\n\
+If the optional argument @qcode{\"rows\"} is supplied, check whether\n\
 the array is sorted by rows as output by the function @code{sortrows}\n\
 (with no options).\n\
 \n\
--- a/libinterp/corefcn/debug.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/debug.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -917,8 +917,8 @@
 \n\
 When called with no arguments in debugging mode, display the script file\n\
 currently being debugged.  An optional range specification can be used to\n\
-list only a portion of the file.  The special keyword \"end\" is a valid\n\
-line number specification for the last line of the file.\n\
+list only a portion of the file.  The special keyword @qcode{\"end\"} is a\n\
+valid line number specification for the last line of the file.\n\
 \n\
 When called with the name of a function, list that script file with line\n\
 numbers.\n\
@@ -1041,7 +1041,7 @@
 @deftypefn  {Command} {} dblist\n\
 @deftypefnx {Command} {} dblist @var{n}\n\
 In debugging mode, list @var{n} lines of the function being debugged\n\
-centered around the the current line to be executed.  If unspecified @var{n}\n\
+centered around the current line to be executed.  If unspecified @var{n}\n\
 defaults to 10 (+/- 5 lines)\n\
 @seealso{dbwhere, dbtype}\n\
 @end deftypefn")
--- a/libinterp/corefcn/defaults.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/defaults.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -474,11 +474,12 @@
 use with the @code{edit_history} command.  The default value is taken from\n\
 the environment variable @w{@env{EDITOR}} when Octave starts.  If the\n\
 environment variable is not initialized, @w{@env{EDITOR}} will be set to\n\
-@code{\"emacs\"}.\n\
+@qcode{\"emacs\"}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+\n\
 @seealso{edit_history}\n\
 @end deftypefn")
 {
@@ -508,9 +509,11 @@
 @w{@env{OCTAVE_EXEC_PATH}}, but that value can be overridden by\n\
 the command line argument @option{--exec-path PATH}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+\n\
+@seealso{IMAGE_PATH, OCTAVE_HOME}\n\
 @end deftypefn")
 {
   octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH);
@@ -541,9 +544,11 @@
 Query or set the internal variable that specifies a colon separated\n\
 list of directories in which to search for image files.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+\n\
+@seealso{EXEC_PATH, OCTAVE_HOME}\n\
 @end deftypefn")
 {
   return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGE_PATH);
@@ -565,6 +570,8 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} OCTAVE_HOME ()\n\
 Return the name of the top-level Octave installation directory.\n\
+\n\
+@seealso{EXEC_PATH, IMAGE_PATH}\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/libinterp/corefcn/dirfns.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/dirfns.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -94,11 +94,16 @@
 
 DEFUN (cd, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Command} {} cd dir\n\
-@deftypefnx {Command} {} chdir dir\n\
-Change the current working directory to @var{dir}.  If @var{dir} is\n\
-omitted, the current directory is changed to the user's home\n\
-directory.  For example,\n\
+@deftypefn  {Command} {} cd @var{dir}\n\
+@deftypefnx {Command} {} cd\n\
+@deftypefnx {Built-in Function} {@var{old_dir} =} cd @var{dir}\n\
+@deftypefnx {Command} {} chdir @dots{}\n\
+Change the current working directory to @var{dir}.\n\
+\n\
+If @var{dir} is omitted, the current directory is changed to the user's home\n\
+directory (@qcode{\"~\"}).\n\
+\n\
+For example,\n\
 \n\
 @example\n\
 cd ~/octave\n\
@@ -108,7 +113,13 @@
 changes the current working directory to @file{~/octave}.  If the\n\
 directory does not exist, an error message is printed and the working\n\
 directory is not changed.\n\
-@seealso{mkdir, rmdir, dir}\n\
+\n\
+@code{chdir} is an alias for @code{cd} and can be used in all of the same\n\
+calling formats.\n\
+\n\
+Compatibility Note: When called with no arguments, @sc{matlab} prints the\n\
+present working directory rather than changing to the user's home directory.\n\
+@seealso{pwd, mkdir, rmdir, dir, ls}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -120,30 +131,22 @@
   if (error_state)
     return retval;
 
+  if (nargout > 0)
+    retval = octave_value (octave_env::get_current_directory ());
+
   if (argc > 1)
     {
       std::string dirname = argv[1];
 
-      if (dirname.length () > 0
-          && ! octave_change_to_directory (dirname))
-        {
-          return retval;
-        }
+      if (dirname.length () > 0)
+        octave_change_to_directory (dirname);
     }
   else
     {
-      // Behave like Unixy shells for "cd" by itself, but be Matlab
-      // compatible if doing "current_dir = cd".
+      std::string home_dir = octave_env::get_home_directory ();
 
-      if (nargout == 0)
-        {
-          std::string home_dir = octave_env::get_home_directory ();
-
-          if (home_dir.empty () || ! octave_change_to_directory (home_dir))
-            return retval;
-        }
-      else
-        retval = octave_value (octave_env::get_current_directory ());
+      if (! home_dir.empty ())
+        octave_change_to_directory (home_dir);
     }
 
   return retval;
@@ -153,9 +156,10 @@
 
 DEFUN (pwd, , ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} pwd ()\n\
+@deftypefn  {Built-in Function} {} pwd ()\n\
+@deftypefnx {Built-in Function} {@var{dir} =} pwd ()\n\
 Return the current working directory.\n\
-@seealso{dir, ls}\n\
+@seealso{cd, dir, ls, mkdir, rmdir}\n\
 @end deftypefn")
 {
   return octave_value (octave_env::get_current_directory ());
@@ -163,14 +167,16 @@
 
 DEFUN (readdir, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{files}, @var{err}, @var{msg}] =} readdir (@var{dir})\n\
-Return names of the files in the directory @var{dir} as a cell array of\n\
-strings.  If an error occurs, return an empty cell array in @var{files}.\n\
+@deftypefn  {Built-in Function} {@var{files} =} readdir (@var{dir})\n\
+@deftypefnx {Built-in Function} {[@var{files}, @var{err}, @var{msg}] =} readdir (@var{dir})\n\
+Return the names of files in the directory @var{dir} as a cell array of\n\
+strings.\n\
 \n\
+If an error occurs, return an empty cell array in @var{files}.\n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
-@seealso{ls, dir, glob}\n\
+@seealso{ls, dir, glob, what}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -207,20 +213,24 @@
   return retval;
 }
 
-// FIXME -- should maybe also allow second arg to specify
-// mode?  OTOH, that might cause trouble with compatibility later...
+// FIXME: should maybe also allow second arg to specify mode?
+//        OTOH, that might cause trouble with compatibility later...
 
 DEFUNX ("mkdir", Fmkdir, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} mkdir (@var{dir})\n\
-@deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} mkdir (@var{parent}, @var{dir})\n\
+@deftypefn  {Built-in Function} {} mkdir @var{dir}\n\
+@deftypefnx {Built-in Function} {} mkdir (@var{parent}, @var{dir})\n\
+@deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} mkdir (@dots{})\n\
 Create a directory named @var{dir} in the directory @var{parent}.\n\
 \n\
-If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty\n\
-character strings.  Otherwise, @var{status} is 0, @var{msg} contains a\n\
-system-dependent error message, and @var{msgid} contains a unique\n\
-message identifier.\n\
-@seealso{rmdir}\n\
+If no @var{parent} directory is specified the present working directory is\n\
+used.\n\
+\n\
+If successful, @var{status} is 1, and @var{msg}, @var{msgid} are empty\n\
+character strings ("").  Otherwise, @var{status} is 0, @var{msg} contains a\n\
+system-dependent error message, and @var{msgid} contains a unique message\n\
+identifier.\n\
+@seealso{rmdir, pwd, cd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -295,18 +305,19 @@
 
 DEFUNX ("rmdir", Frmdir, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@var{dir})\n\
-@deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@var{dir}, \"s\")\n\
+@deftypefn  {Built-in Function} {} rmdir @var{dir}\n\
+@deftypefnx {Built-in Function} {} rmdir (@var{dir}, \"s\")\n\
+@deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@dots{})\n\
 Remove the directory named @var{dir}.\n\
 \n\
-If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty\n\
-character strings.  Otherwise, @var{status} is 0, @var{msg} contains a\n\
-system-dependent error message, and @var{msgid} contains a unique\n\
-message identifier.\n\
+If successful, @var{status} is 1, and @var{msg}, @var{msgid} are empty\n\
+character strings ("").  Otherwise, @var{status} is 0, @var{msg} contains a\n\
+system-dependent error message, and @var{msgid} contains a unique message\n\
+identifier.\n\
 \n\
-If the optional second parameter is supplied with value @code{\"s\"},\n\
+If the optional second parameter is supplied with value @qcode{\"s\"},\n\
 recursively remove all subdirectories as well.\n\
-@seealso{mkdir, confirm_recursive_rmdir}\n\
+@seealso{mkdir, confirm_recursive_rmdir, pwd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -369,13 +380,14 @@
 
 DEFUNX ("link", Flink, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} link (@var{old}, @var{new})\n\
+@deftypefn  {Built-in Function} {} link @var{old} @var{new}\n\
+@deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} link (@var{old}, @var{new})\n\
 Create a new link (also known as a hard link) to an existing file.\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
-@seealso{symlink}\n\
+@seealso{symlink, unlink, readlink, lstat}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -401,10 +413,9 @@
 
               int status = octave_link (from, to, msg);
 
-              retval(0) = status;
-
               if (status < 0)
                 retval(1) = msg;
+              retval(0) = status;
             }
         }
     }
@@ -416,13 +427,14 @@
 
 DEFUNX ("symlink", Fsymlink, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} symlink (@var{old}, @var{new})\n\
+@deftypefn  {Built-in Function} {} symlink @var{old} @var{new}\n\
+@deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} symlink (@var{old}, @var{new})\n\
 Create a symbolic link @var{new} which contains the string @var{old}.\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
-@seealso{link, readlink}\n\
+@seealso{link, unlink, readlink, lstat}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -448,10 +460,9 @@
 
               int status = octave_symlink (from, to, msg);
 
-              retval(0) = status;
-
               if (status < 0)
                 retval(1) = msg;
+              retval(0) = status;
             }
         }
     }
@@ -463,14 +474,15 @@
 
 DEFUNX ("readlink", Freadlink, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{result}, @var{err}, @var{msg}] =} readlink (@var{symlink})\n\
+@deftypefn  {Built-in Function} {} readlink @var{symlink}\n\
+@deftypefnx {Built-in Function} {[@var{result}, @var{err}, @var{msg}] =} readlink (@var{symlink})\n\
 Read the value of the symbolic link @var{symlink}.\n\
 \n\
 If successful, @var{result} contains the contents of the symbolic link\n\
-@var{symlink}, @var{err} is 0 and @var{msg} is an empty string.\n\
-Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
-system-dependent error message.\n\
-@seealso{link, symlink}\n\
+@var{symlink}, @var{err} is 0, and @var{msg} is an empty string.\n\
+Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent\n\
+error message.\n\
+@seealso{lstat, symlink, link, unlink, delete}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -506,13 +518,14 @@
 
 DEFUNX ("rename", Frename, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} rename (@var{old}, @var{new})\n\
+@deftypefn  {Built-in Function} {} rename @var{old} @var{new}\n\
+@deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} rename (@var{old}, @var{new})\n\
 Change the name of file @var{old} to @var{new}.\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
-@seealso{ls, dir}\n\
+@seealso{movefile, copyfile, ls, dir}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -538,10 +551,9 @@
 
               int status = octave_rename (from, to, msg);
 
-              retval(0) = status;
-
               if (status < 0)
                 retval(1) = msg;
+              retval(0) = status;
             }
         }
     }
@@ -571,9 +583,8 @@
 matches any of the enclosed characters.\n\
 @end table\n\
 \n\
-Tilde expansion\n\
-is performed on each of the patterns before looking for matching file\n\
-names.  For example:\n\
+Tilde expansion is performed on each of the patterns before looking for\n\
+matching file names.  For example:\n\
 \n\
 @example\n\
 ls\n\
@@ -597,7 +608,7 @@
         [2,1] = file2\n\
       @}\n\
 @end example\n\
-@seealso{ls, dir, readdir}\n\
+@seealso{ls, dir, readdir, what, fnmatch}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -628,7 +639,7 @@
 %! if (mkdir (tmpdir))
 %!   cwd = pwd;
 %!   cd (tmpdir);
-%!   if strcmp (canonicalize_file_name (pwd), canonicalize_file_name (tmpdir))
+%!   if (strcmp (canonicalize_file_name (pwd), canonicalize_file_name (tmpdir)))
 %!     a = 0;
 %!     for n = 1:5
 %!       save (filename{n}, "a");
@@ -656,7 +667,7 @@
 DEFUNX ("fnmatch", Ffnmatch, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} fnmatch (@var{pattern}, @var{string})\n\
-Return 1 or zero for each element of @var{string} that matches any of\n\
+Return true or false for each element of @var{string} that matches any of\n\
 the elements of the string array @var{pattern}, using the rules of\n\
 filename pattern matching.  For example:\n\
 \n\
@@ -666,6 +677,7 @@
      @result{} [ 1; 1; 0 ]\n\
 @end group\n\
 @end example\n\
+@seealso{glob, regexp}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -696,8 +708,8 @@
 @deftypefnx {Built-in Function} {} filesep (\"all\")\n\
 Return the system-dependent character used to separate directory names.\n\
 \n\
-If \"all\" is given, the function returns all valid file separators in\n\
-the form of a string.  The list of file separators is system-dependent.\n\
+If @qcode{\"all\"} is given, the function returns all valid file separators\n\
+in the form of a string.  The list of file separators is system-dependent.\n\
 It is @samp{/} (forward slash) under UNIX or @w{Mac OS X}, @samp{/} and\n\
 @samp{\\} (forward and backward slashes) under Windows.\n\
 @seealso{pathsep}\n\
@@ -780,9 +792,10 @@
 Query or set the internal variable that controls whether Octave\n\
 will ask for confirmation before recursively removing a directory tree.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+@seealso{rmdir}\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (confirm_recursive_rmdir);
--- a/libinterp/corefcn/dlmread.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/dlmread.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -173,14 +173,15 @@
 The @var{range} parameter may be a 4-element vector containing the upper\n\
 left and lower right corner @code{[@var{R0},@var{C0},@var{R1},@var{C1}]}\n\
 where the lowest index value is zero.  Alternatively, a spreadsheet style\n\
-range such as \"A2..Q15\" or \"T1:AA5\" can be used.  The lowest alphabetical\n\
-index 'A' refers to the first column.  The lowest row index is 1.\n\
+range such as @qcode{\"A2..Q15\"} or @qcode{\"T1:AA5\"} can be used.  The\n\
+lowest alphabetical index @qcode{'A'} refers to the first column.  The\n\
+lowest row index is 1.\n\
 \n\
 @var{file} should be a file name or file id given by @code{fopen}.  In the\n\
 latter case, the file is read until end of file is reached.\n\
 \n\
-The \"emptyvalue\" option may be used to specify the value used to fill empty\n\
-fields.  The default is zero.\n\
+The @qcode{\"emptyvalue\"} option may be used to specify the value used to\n\
+fill empty fields.  The default is zero.\n\
 @seealso{csvread, textscan, textread, dlmwrite}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/ellipj.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ellipj.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,6 @@
 /*
 
-// Author: Leopoldo Cerbaro <redbliss@libero.it>
+Copyright (C) 2013 Leopoldo Cerbaro <redbliss@libero.it>
 
 This file is part of Octave.
 
@@ -26,7 +26,7 @@
 
 #include "defun.h"
 #include "error.h"
-#include "lo-ieee.h"
+#include "lo-specfun.h"
 
 static void
 gripe_ellipj_arg (const char *arg)
@@ -34,106 +34,6 @@
   error ("ellipj: expecting scalar or matrix as %s argument", arg);
 }
 
-static void
-sncndn (double u, double m, double& sn, double& cn, double& dn, double& err)
-{
-  static const int Nmax = 16;
-  double m1, t=0, si_u, co_u, se_u, ta_u, b, c[Nmax], a[Nmax], phi;
-  int n, Nn, ii;
-
-  if (m < 0 || m > 1)
-    {
-      warning ("ellipj: expecting 0 <= m <= 1"); /* -lc- */
-      sn = cn = dn = lo_ieee_nan_value ();
-      return;
-    }
-
-  double sqrt_eps = sqrt (std::numeric_limits<double>::epsilon ());
-  if (m < sqrt_eps)
-    {
-      /*  # For small m, ( Abramowitz and Stegun, Section 16.13 ) */
-      si_u = sin (u);
-      co_u = cos (u);
-      t = 0.25*m*(u - si_u*co_u);
-      sn = si_u - t * co_u;
-      cn = co_u + t * si_u;
-      dn = 1 - 0.5*m*si_u*si_u;
-    }
-  else if ((1 - m) < sqrt_eps)
-    {
-      /*  For m1 = (1-m) small ( Abramowitz and Stegun, Section 16.15 ) */
-      m1 = 1 - m;
-      si_u = sinh (u);
-      co_u = cosh (u);
-      ta_u = tanh (u);
-      se_u = 1/co_u;
-      sn = ta_u + 0.25*m1*(si_u*co_u - u)*se_u*se_u;
-      cn = se_u - 0.25*m1*(si_u*co_u - u)*ta_u*se_u;
-      dn = se_u + 0.25*m1*(si_u*co_u + u)*ta_u*se_u;
-    }
-  else
-    {
-      /*
-      //  Arithmetic-Geometric Mean (AGM) algorithm
-      //    ( Abramowitz and Stegun, Section 16.4 )
-      */
-
-      a[0] = 1;
-      b    = sqrt (1 - m);
-      c[0] = sqrt (m);
-      for (n = 1; n < Nmax; ++n)
-        {
-          a[n] = (a[n - 1] + b)/2;
-          c[n] = (a[n - 1] - b)/2;
-          b = sqrt (a[n - 1]*b);
-          if (c[n]/a[n] < std::numeric_limits<double>::epsilon ()) break;
-        }
-      if (n >= Nmax - 1)
-        {
-          err = 1;
-          return;
-        }
-      Nn = n;
-      for (ii = 1; n > 0; ii = ii*2, --n) ; // ii = pow(2,Nn)
-      phi = ii*a[Nn]*u;
-      for (n = Nn; n > 0; --n)
-        {
-          t = phi;
-          phi = (asin ((c[n]/a[n])* sin (phi)) + phi)/2;
-        }
-      sn = sin (phi);
-      cn = cos (phi);
-      dn = cn/cos (t - phi);
-    }
-}
-
-static void
-sncndn (Complex& u, double m, Complex& sn, Complex& cn, Complex& dn,
-        double& err)
-{
-  double m1 = 1 - m, ss1, cc1, dd1;
-
-  sncndn (imag (u), m1, ss1, cc1, dd1, err);
-  if (real (u) == 0)
-    {
-      /* u is pure imag: Jacoby imag. transf. */
-      sn = Complex (0, ss1/cc1);
-      cn = 1/cc1;         //    cn.imag = 0;
-      dn = dd1/cc1;       //    dn.imag = 0;
-    }
-  else
-    {
-      /* u is generic complex */
-      double ss, cc, dd, ddd;
-
-      sncndn (real (u), m, ss, cc, dd, err);
-      ddd = cc1*cc1 + m*ss*ss*ss1*ss1;
-      sn = Complex (ss*dd1/ddd, cc*dd*ss1*cc1/ddd);
-      cn = Complex (cc*cc1/ddd, -ss*dd*ss1*dd1/ddd);
-      dn = Complex (dd*cc1*dd1/ddd, -m*ss*cc*ss1/ddd);
-    }
-}
-
 DEFUN (ellipj, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {[@var{sn}, @var{cn}, @var{dn}, @var{err}] =} ellipj (@var{u}, @var{m})\n\
@@ -146,13 +46,14 @@
 If @var{u} is a column vector and @var{m} is a row vector, the\n\
 results are matrices with @code{length (@var{u})} rows and\n\
 @code{length (@var{m})} columns.  Otherwise, @var{u} and\n\
-@var{m} must conform and the results will be the same size.\n\
+@var{m} must conform in size and the results will be the same size as the\n\
+inputs.\n\
 \n\
 The value of @var{u} may be complex.\n\
-The value of @var{m} must be 0 @leq{} m @leq{} 1.\n\
+The value of @var{m} must be 0 @leq{} @var{m} @leq{} 1.\n\
 \n\
-@var{tol} is currently ignored (@sc{matlab} uses this to allow faster,\n\
-less accurate approximation).\n\
+The optional input @var{tol} is currently ignored (@sc{matlab} uses this to\n\
+allow faster, less accurate approximation).\n\
 \n\
 If requested, @var{err} contains the following status information\n\
 and is the same size as the result.\n\
@@ -165,9 +66,11 @@
 Error---no computation, algorithm termination condition not met,\n\
 return @code{NaN}.\n\
 @end enumerate\n\
- Ref: Abramowitz, Milton and Stegun, Irene A\n\
-      Handbook of Mathematical Functions, Dover, 1965\n\
-      Chapter 16 (Sections 16.4, 16.13 and 16.15)\n\
+\n\
+Reference: Milton Abramowitz and Irene A Stegun,\n\
+@cite{Handbook of Mathematical Functions}, Chapter 16 (Sections 16.4, 16.13,\n\
+and 16.15), Dover, 1965.\n\
+\n\
 @seealso{ellipke}\n\
 @end deftypefn")
 {
@@ -197,7 +100,7 @@
       if (u_arg.is_scalar_type ())
         {
           if (u_arg.is_real_type ())
-            {  // u real
+            {  // u real, m scalar
               double u = args(0).double_value ();
 
               if (error_state)
@@ -205,65 +108,75 @@
                   gripe_ellipj_arg ("first");
                   return retval;
                 }
+
               double sn, cn, dn;
               double err = 0;
 
-              sncndn (u, m, sn, cn, dn, err);
-              retval (0) = sn;
-              retval (1) = cn;
-              retval (2) = dn;
-              if (nargout > 3) retval(3) =  err;
+              ellipj (u, m, sn, cn, dn, err);
+
+              if (nargout > 3)
+                retval(3) = err;
+              retval(2) = dn;
+              retval(1) = cn;
+              retval(0) = sn;
             }
           else
-            {  // u complex
+            {  // u complex, m scalar
               Complex u = u_arg.complex_value ();
 
               if (error_state)
                 {
-                  gripe_ellipj_arg ("second");
+                  gripe_ellipj_arg ("first");
                   return retval;
                 }
 
               Complex sn, cn, dn;
-              double err;
+              double err = 0;
 
-              sncndn (u, m, sn, cn, dn, err);
+              ellipj (u, m, sn, cn, dn, err);
 
-              retval (0) = sn;
-              retval (1) = cn;
-              retval (2) = dn;
-              if (nargout > 3) retval(3) = err;
+              if (nargout > 3)
+                retval(3) = err;
+              retval(2) = dn;
+              retval(1) = cn;
+              retval(0) = sn;
             }
         }
       else
-        {  /* u is matrix ( m is scalar ) */
-          ComplexMatrix u = u_arg.complex_matrix_value ();
-
+        {  // u is matrix, m is scalar
+          ComplexNDArray u = u_arg.complex_array_value ();
+          
           if (error_state)
             {
               gripe_ellipj_arg ("first");
               return retval;
             }
 
-          octave_idx_type nr = u.rows ();
-          octave_idx_type nc = u.cols ();
+          dim_vector sz_u = u.dims ();
 
-          ComplexMatrix sn (nr, nc), cn (nr, nc), dn (nr, nc);
-          Matrix err (nr, nc);
+          ComplexNDArray sn (sz_u), cn (sz_u), dn (sz_u);
+          NDArray err (sz_u);
 
-          for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = 0; i < nr; i++)
-              sncndn (u(i,j), m, sn(i,j), cn(i,j), dn(i,j), err(i,j));
+          const Complex *pu = u.data ();
+          Complex *psn = sn.fortran_vec ();
+          Complex *pcn = cn.fortran_vec ();
+          Complex *pdn = dn.fortran_vec ();
+          double *perr = err.fortran_vec ();
+          octave_idx_type nel = u.numel ();
 
-          retval (0) = sn;
-          retval (1) = cn;
-          retval (2) = dn;
-          if (nargout > 3) retval(3) = err;
+          for (octave_idx_type i = 0; i < nel; i++)
+            ellipj (pu[i], m, psn[i], pcn[i], pdn[i], perr[i]);
+
+          if (nargout > 3)
+            retval(3) = err;
+          retval(2) = dn;
+          retval(1) = cn;
+          retval(0) = sn;
         }
     }
   else
     {
-      Matrix m = args(1).matrix_value ();
+      NDArray m = args(1).array_value ();
 
       if (error_state)
         {
@@ -271,17 +184,12 @@
           return retval;
         }
 
-      octave_idx_type mr = m.rows ();
-      octave_idx_type mc = m.cols ();
+      dim_vector sz_m = m.dims ();
 
       if (u_arg.is_scalar_type ())
-        {    /* u is scalar */
-          octave_idx_type nr = m.rows ();
-          octave_idx_type nc = m.cols ();
-          Matrix err (nr, nc);
-
+        {  // u is scalar, m is array
           if (u_arg.is_real_type ())
-            {
+            {  // u is real scalar, m is array
               double u = u_arg.double_value ();
 
               if (error_state)
@@ -290,129 +198,176 @@
                   return retval;
                 }
 
-              Matrix sn (nr, nc), cn (nr, nc), dn (nr, nc);
-              for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = 0; i < nr; i++)
-                  sncndn (u, m(i,j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
+              NDArray sn (sz_m), cn (sz_m), dn (sz_m);
+              NDArray err (sz_m);
 
-              retval (0) = sn;
-              retval (1) = cn;
-              retval (2) = dn;
-              if (nargout > 3)  retval(3) = err;
+              const double *pm = m.data ();
+              double *psn = sn.fortran_vec ();
+              double *pcn = cn.fortran_vec ();
+              double *pdn = dn.fortran_vec ();
+              double *perr = err.fortran_vec ();
+              octave_idx_type nel = m.numel ();
+
+              for (octave_idx_type i = 0; i < nel; i++)
+                ellipj (u, pm[i], psn[i], pcn[i], pdn[i], perr[i]);
+
+              if (nargout > 3)
+                retval(3) = err;
+              retval(2) = dn;
+              retval(1) = cn;
+              retval(0) = sn;
             }
           else
-            {
+            {  // u is complex scalar, m is array
               Complex u = u_arg.complex_value ();
+
+              if (error_state)
+                {
+                  gripe_ellipj_arg ("first");
+                  return retval;
+                }
+
+              ComplexNDArray sn (sz_m), cn (sz_m), dn (sz_m);
+              NDArray err (sz_m);
+
+              const double *pm = m.data ();
+              Complex *psn = sn.fortran_vec ();
+              Complex *pcn = cn.fortran_vec ();
+              Complex *pdn = dn.fortran_vec ();
+              double *perr = err.fortran_vec ();
+              octave_idx_type nel = m.numel ();
+
+              for (octave_idx_type i = 0; i < nel; i++)
+                ellipj (u, pm[i], psn[i], pcn[i], pdn[i], perr[i]);
+
+              if (nargout > 3)
+                retval(3) = err;
+              retval(2) = dn;
+              retval(1) = cn;
+              retval(0) = sn;
+            }
+        }
+      else
+        {  // u is array, m is array
+          if (u_arg.is_real_type ())
+            {  // u is real array, m is array
+              NDArray u = u_arg.array_value ();
+
               if (error_state)
                 {
                   gripe_ellipj_arg ("first");
                   return retval;
                 }
 
-              ComplexMatrix sn (nr, nc), cn (nr, nc), dn (nr, nc);
-              for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = 0; i < nr; i++)
-                  sncndn (u, m(i,j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
-              retval (0) = sn;
-              retval (1) = cn;
-              retval (2) = dn;
-              if (nargout > 3)  retval(3) = err;
-            }
-        }
-      else
-        {    // u is matrix  (m is matrix)
-          if (u_arg.is_real_type ())
-            {  // u real matrix
+              dim_vector sz_u = u.dims ();
 
-              Matrix u = u_arg.matrix_value ();
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first ");
-                  return retval;
-                }
+              if (sz_u.length () == 2 && sz_m.length () == 2
+                  && sz_u(1) == 1 && sz_m(0) == 1)
+                {  // u is real column vector, m is row vector
+                  octave_idx_type ur = sz_u(0);
+                  octave_idx_type mc = sz_m(1);
+                  dim_vector sz_out (ur, mc);
 
-              octave_idx_type ur = u.rows ();
-              octave_idx_type uc = u.cols ();
+                  NDArray sn (sz_out), cn (sz_out), dn (sz_out);
+                  NDArray err (sz_out);
 
-              if (mr == 1 && uc == 1)
-                {  // u column, m row
-                  RowVector rm = m.row (0);
-                  ColumnVector cu = u.column (0);
-
-                  Matrix sn (ur, mc), cn (ur, mc), dn (ur, mc);
-                  Matrix err (ur,mc);
+                  const double *pu = u.data ();
+                  const double *pm = m.data ();
 
                   for (octave_idx_type j = 0; j < mc; j++)
                     for (octave_idx_type i = 0; i < ur; i++)
-                      sncndn (cu(i), rm(j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
+                      ellipj (pu[i], pm[j], sn(i,j), cn(i,j), dn(i,j), err(i,j));
 
-                  retval (0) = sn;
-                  retval (1) = cn;
-                  retval (2) = dn;
-                  if (nargout > 3)  retval(3) = err;
+                  if (nargout > 3)
+                    retval(3) = err;
+                  retval(2) = dn;
+                  retval(1) = cn;
+                  retval(0) = sn;
                 }
-              else if (ur == mr && uc == mc)
+              else if (sz_m == sz_u)
                 {
-                  Matrix sn (ur, mc), cn (ur, mc), dn (ur, mc);
-                  Matrix err (ur,mc);
+                  NDArray sn (sz_m), cn (sz_m), dn (sz_m);
+                  NDArray err (sz_m);
 
-                  for (octave_idx_type j = 0; j < uc; j++)
-                    for (octave_idx_type i = 0; i < ur; i++)
-                      sncndn (u(i,j), m(i,j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
+                  const double *pu = u.data ();
+                  const double *pm = m.data ();
+                  double *psn = sn.fortran_vec ();
+                  double *pcn = cn.fortran_vec ();
+                  double *pdn = dn.fortran_vec ();
+                  double *perr = err.fortran_vec ();
+                  octave_idx_type nel = m.numel ();
 
-                  retval (0) = sn;
-                  retval (1) = cn;
-                  retval (2) = dn;
-                  if (nargout > 3)  retval(3) = err;
+                  for (octave_idx_type i = 0; i < nel; i++)
+                    ellipj (pu[i], pm[i], psn[i], pcn[i], pdn[i], perr[i]);
+
+                  if (nargout > 3)
+                    retval(3) = err;
+                  retval(2) = dn;
+                  retval(1) = cn;
+                  retval(0) = sn;
                 }
               else
-                error ("u m invalid");
+                error ("ellipj: Invalid size combination for U and M");
             }
           else
-            {  // u complex matrix
-              ComplexMatrix u = u_arg.complex_matrix_value ();
+            {  // u is complex array, m is array
+              ComplexNDArray u = u_arg.complex_array_value ();
+
               if (error_state)
                 {
                   gripe_ellipj_arg ("second");
                   return retval;
                 }
 
-              octave_idx_type ur = u.rows ();
-              octave_idx_type uc = u.cols ();
+              dim_vector sz_u = u.dims ();
 
-              if (mr == 1 && uc == 1)
-                {
-                  RowVector rm = m.row (0);
-                  ComplexColumnVector cu = u.column (0);
+              if (sz_u.length () == 2 && sz_m.length () == 2
+                  && sz_u(1) == 1 && sz_m(0) == 1)
+                {  // u is complex column vector, m is row vector
+                  octave_idx_type ur = sz_u(0);
+                  octave_idx_type mc = sz_m(1);
+                  dim_vector sz_out (ur, mc);
 
-                  ComplexMatrix sn (ur, mc), cn (ur, mc), dn (ur, mc);
-                  Matrix err (ur,mc);
+                  ComplexNDArray sn (sz_out), cn (sz_out), dn (sz_out);
+                  NDArray err (sz_out);
+
+                  const Complex *pu = u.data ();
+                  const double  *pm = m.data ();
 
                   for (octave_idx_type j = 0; j < mc; j++)
                     for (octave_idx_type i = 0; i < ur; i++)
-                      sncndn (cu(i), rm(j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
+                      ellipj (pu[i], pm[j], sn(i,j), cn(i,j), dn(i,j), err(i,j));
 
-                  retval (0) = sn;
-                  retval (1) = cn;
-                  retval (2) = dn;
-                  if (nargout > 3)  retval(3) = err;
+                  if (nargout > 3)
+                    retval(3) = err;
+                  retval(2) = dn;
+                  retval(1) = cn;
+                  retval(0) = sn;
                 }
-              else if (ur == mr && uc == mc)
+              else if (sz_m == sz_u)
                 {
-                  ComplexMatrix sn (ur, mc), cn (ur, mc), dn (ur, mc);
-                  Matrix err (ur,mc);
+                  ComplexNDArray sn (sz_m), cn (sz_m), dn (sz_m);
+                  NDArray err (sz_m);
 
-                  for (octave_idx_type j = 0; j < uc; j++)
-                    for (octave_idx_type i = 0; i < ur; i++)
-                      sncndn (u(i,j), m(i,j), sn(i,j), cn(i,j), dn(i,j), err(i,j));
+                  const Complex *pu = u.data ();
+                  const double  *pm = m.data ();
+                  Complex *psn = sn.fortran_vec ();
+                  Complex *pcn = cn.fortran_vec ();
+                  Complex *pdn = dn.fortran_vec ();
+                  double *perr = err.fortran_vec ();
+                  octave_idx_type nel = m.numel ();
 
-                  retval (0) = sn;
-                  retval (1) = cn;
-                  retval (2) = dn;
-                  if (nargout > 3)  retval(3) = err;
+                  for (octave_idx_type i = 0; i < nel; i++)
+                    ellipj (pu[i], pm[i], psn[i], pcn[i], pdn[i], perr[i]);
+
+                  if (nargout > 3)
+                    retval(3) = err;
+                  retval(2) = dn;
+                  retval(1) = cn;
+                  retval(0) = sn;
                 }
               else
-                error ("u m invalid");
+                error ("ellipj: Invalid size combination for U and M");
             }
         }
     }  // m matrix
@@ -425,53 +380,52 @@
 
 %!demo
 %! N = 150;
-%! % m = [1-logspace(0,log(eps),N-1), 1]; ## m near 1
-%! % m = [0, logspace(log(eps),0,N-1)];   ## m near 0
-%!   m = linspace(0,1,N);                 ## m equally spaced
-%! u = linspace(-20,20,N);
-%! M = ones(length(u),1) * m;
-%! U = u' * ones(1, length(m));
-%! [sn, cn, dn] = ellipj(U,M);
+%! # m = [1-logspace(0,log(eps),N-1), 1]; # m near 1
+%! # m = [0, logspace(log(eps),0,N-1)];   # m near 0
+%!   m = linspace (0,1,N);                # m equally spaced
+%! u = linspace (-20, 20, N);
+%! M = ones (length (u), 1) * m;
+%! U = u' * ones (1, length (m));
+%! [sn, cn, dn] = ellipj (U,M);
 %!
-%! %% Plotting
-%! c = colormap(hot(64));
+%! ## Plotting
 %! data = {sn,cn,dn};
 %! dname = {"sn","cn","dn"};
 %! for i=1:3
-%!   subplot(1,3,i);
+%!   subplot (1,3,i);
 %!   data{i}(data{i} > 1) = 1;
 %!   data{i}(data{i} < -1) = -1;
-%!   image(m,u,32*data{i}+32);
-%!   title(dname{i});
-%! end
-%! colormap(c);
+%!   image (m,u,32*data{i}+32);
+%!   title (dname{i});
+%! endfor
+%! colormap (hot (64));
 
 %!demo
 %! N = 200;
-%! % m = [1-logspace(0,log(eps),N-1), 1]; ## m near 1
-%! % m = [0, logspace(log(eps),0,N-1)];   ## m near 0
-%!   m = linspace(0,1,N);                 ## m equally spaced
-%! u = linspace(0,20,5);
-%! M = ones(length(u),1) * m;
-%! U = u' * ones(1, length(m));
-%! [sn, cn, dn] = ellipj(U,M);
+%! # m = [1-logspace(0,log(eps),N-1), 1]; # m near 1
+%! # m = [0, logspace(log(eps),0,N-1)];   # m near 0
+%!   m = linspace (0,1,N);                # m equally spaced
+%! u = linspace (0,20,5);
+%! M = ones (length (u), 1) * m;
+%! U = u' * ones (1, length (m));
+%! [sn, cn, dn] = ellipj (U,M);
 %!
-%! %% Plotting
+%! ## Plotting
 %! data = {sn,cn,dn};
 %! dname = {"sn","cn","dn"};
 %! for i=1:3
-%!   subplot(1,3,i);
-%!   plot(m, data{i});
-%!   title(dname{i});
+%!   subplot (1,3,i);
+%!   plot (m, data{i});
+%!   title (dname{i});
 %!   grid on;
-%! end
+%! endfor
 */
 
 /*
 ## tests taken from inst/test_sncndn.m
 
 %!test
-%! k = (tan(pi/8.))^2; m = k*k;
+%! k = (tan(pi/8.))^2;  m = k*k;
 %! SN = [
 %! -1. + I * 0. ,  -0.8392965923 + 0. * I
 %! -1. + I * 0.2 ,  -0.8559363407 + 0.108250955 * I
@@ -848,9 +802,9 @@
 %!     ui =  y * 0.2;
 %!     ii = 1 + y + x*11;
 %!     [sn, cn, dn] = ellipj (ur + I * ui, m);
-%!     assert (SN (ii, 2), sn, tol);
-%!     assert (CN (ii, 2), cn, tol);
-%!     assert (DN (ii, 2), dn, tol);
+%!     assert (sn, SN(ii, 2), tol);
+%!     assert (cn, CN(ii, 2), tol);
+%!     assert (dn, DN(ii, 2), tol);
 %!   endfor
 %! endfor
 
@@ -858,61 +812,69 @@
 %!test
 %! u1 = pi/3; m1 = 0;
 %! res1 = [sin(pi/3), cos(pi/3), 1];
-%! [sn,cn,dn]=ellipj(u1,m1);
-%! assert([sn,cn,dn], res1, 10*eps);
+%! [sn,cn,dn] = ellipj (u1,m1);
+%! assert ([sn,cn,dn], res1, 10*eps);
 
 %!test
 %! u2 = log(2); m2 = 1;
 %! res2 = [ 3/5, 4/5, 4/5 ];
-%! [sn,cn,dn]=ellipj(u2,m2);
-%! assert([sn,cn,dn], res2, 10*eps);
+%! [sn,cn,dn] = ellipj (u2,m2);
+%! assert ([sn,cn,dn], res2, 10*eps);
 
 %!test
 %! u3 = log(2)*1i; m3 = 0;
 %! res3 = [3i/4,5/4,1];
-%! [sn,cn,dn]=ellipj(u3,m3);
-%! assert([sn,cn,dn], res3, 10*eps);
+%! [sn,cn,dn] = ellipj (u3,m3);
+%! assert ([sn,cn,dn], res3, 10*eps);
 
 %!test
-%! u4 = -1; m4 = tan(pi/8)^4;
+%! u4 = -1; m4 = tan (pi/8)^4;
 %! res4 = [-0.8392965923,0.5436738271,0.9895776106];
-%! [sn,cn,dn]=ellipj(u4, m4);
-%! assert([sn,cn,dn], res4, 1e-10);
+%! [sn,cn,dn] = ellipj (u4, m4);
+%! assert ([sn,cn,dn], res4, 1e-10);
 
 %!test
 %! u5 = -0.2 + 0.4i; m5 = tan(pi/8)^4;
 %! res5 = [ -0.2152524522 + 0.402598347i, ...
 %!           1.059453907  + 0.08179712295i, ...
 %!           1.001705496  + 0.00254669712i ];
-%! [sn,cn,dn]=ellipj(u5,m5);
-%! assert([sn,cn,dn], res5, 1e-9);
+%! [sn,cn,dn] = ellipj (u5,m5);
+%! assert ([sn,cn,dn], res5, 1e-9);
 
 %!test
 %! u6 = 0.2 + 0.6i; m6 = tan(pi/8)^4;
 %! res6 = [ 0.2369100139 + 0.624633635i, ...
 %!          1.16200643   - 0.1273503824i, ...
-%!          1.004913944 - 0.004334880912i ];
-%! [sn,cn,dn]=ellipj(u6,m6);
-%! assert([sn,cn,dn], res6, 1e-8);
+%!          1.004913944  - 0.004334880912i ];
+%! [sn,cn,dn] = ellipj (u6,m6);
+%! assert ([sn,cn,dn], res6, 1e-8);
 
 %!test
-%! u7 = 0.8 + 0.8i; m7 = tan(pi/8)^4;
+%! u7 = 0.8 + 0.8i; m7 = tan (pi/8)^4;
 %! res7 = [0.9588386397 + 0.6107824358i, ...
 %!         0.9245978896 - 0.6334016187i, ...
 %!         0.9920785856 - 0.01737733806i ];
-%! [sn,cn,dn]=ellipj(u7,m7);
-%! assert([sn,cn,dn], res7, 1e-10);
+%! [sn,cn,dn] = ellipj (u7,m7);
+%! assert ([sn,cn,dn], res7, 1e-10);
 
 %!test
-%! u=[0,pi/6,pi/4,pi/2]; m=0;
+%! u = [0,pi/6,pi/4,pi/2]; m=0;
 %! res = [0,1/2,1/sqrt(2),1;1,cos(pi/6),1/sqrt(2),0;1,1,1,1];
-%! [sn,cn,dn]=ellipj(u,m);
-%! assert([sn;cn;dn],res, 100*eps);
-%! [sn,cn,dn]=ellipj(u',0);
-%! assert([sn,cn,dn],res', 100*eps);
+%! [sn,cn,dn] = ellipj (u,m);
+%! assert ([sn;cn;dn], res, 100*eps);
+%! [sn,cn,dn] = ellipj (u',0);
+%! assert ([sn,cn,dn], res', 100*eps);
+
+## FIXME: need to check [real,complex]x[scalar,rowvec,colvec,matrix]x[u,m]
 
-## XXX FIXME XXX
-## need to check [real,complex]x[scalar,rowvec,colvec,matrix]x[u,m]
+## One test for u column vector x m row vector
+%!test
+%! u = [0,pi/6,pi/4,pi/2]';  m = [0 0 0 0];
+%! res = [0,1/2,1/sqrt(2),1;1,cos(pi/6),1/sqrt(2),0;1,1,1,1]';
+%! [sn,cn,dn] = ellipj (u,m);
+%! assert (sn, repmat (res(:,1), [1,4]), 100*eps);
+%! assert (cn, repmat (res(:,2), [1,4]), 100*eps);
+%! assert (dn, repmat (res(:,3), [1,4]), 100*eps);
 
 %!test
 %! ## Test Jacobi elliptic functions
@@ -921,27 +883,46 @@
 %! ## 1 February 2001
 %! u = [ 0.25; 0.25; 0.20; 0.20; 0.672; 0.5];
 %! m = [ 0.0;  1.0;  0.19; 0.81; 0.36;  0.9999999999];
-%! S = [ sin(0.25); tanh(0.25);
-%!  0.19842311013970879516;
-%!  0.19762082367187648571;
-%!  0.6095196917919021945;
-%!  0.4621171572617320908 ];
-%! C = [ cos(0.25); sech(0.25);
-%!  0.9801164570409401062;
-%!  0.9802785369736752032;
-%!  0.7927709286533560550;
-%!  0.8868188839691764094 ];
-%! D = [ 1.0;  sech(0.25);
-%!  0.9962526643271134302;
-%!  0.9840560289645665155;
-%!  0.9307281387786906491;
-%!  0.8868188839812167635 ];
-%! [sn,cn,dn] = ellipj(u,m);
-%! assert(sn,S,8*eps);
-%! assert(cn,C,8*eps);
-%! assert(dn,D,8*eps);
+%! S = [ sin(0.25);
+%!       tanh(0.25);
+%!       0.19842311013970879516;
+%!       0.19762082367187648571;
+%!       0.6095196917919021945;
+%!       0.4621171572617320908 ];
+%! C = [ cos(0.25);
+%!       sech(0.25);
+%!       0.9801164570409401062;
+%!       0.9802785369736752032;
+%!       0.7927709286533560550;
+%!       0.8868188839691764094 ];
+%! D = [ 1.0;
+%!       sech(0.25);
+%!       0.9962526643271134302;
+%!       0.9840560289645665155;
+%!       0.9307281387786906491;
+%!       0.8868188839812167635 ];
+%! [sn,cn,dn] = ellipj (u,m);
+%! assert (sn, S, 8*eps);
+%! assert (cn, C, 8*eps);
+%! assert (dn, D, 8*eps);
 
 %!error ellipj ()
 %!error ellipj (1)
 %!error ellipj (1,2,3,4)
+%!warning <expecting 0 <= M <= 1> ellipj (1,2);
+## FIXME: errors commented out untill lasterr() truly returns the last error.
+%!#error <expecting scalar or matrix as second argument> ellipj (1, "1")
+%!#error <expecting scalar or matrix as first argument> ellipj ("1", 1)
+%!#error <expecting scalar or matrix as first argument> ellipj ({1}, 1)
+%!#error <expecting scalar or matrix as first argument> ellipj ({1, 2}, 1)
+%!#error <expecting scalar or matrix as second argument> ellipj (1, {1, 2})
+%!#error <expecting scalar or matrix as first argument> ellipj ("1", [1, 2])
+%!#error <expecting scalar or matrix as first argument> ellipj ({1}, [1, 2])
+%!#error <expecting scalar or matrix as first argument> ellipj ({1}, [1, 2])
+%!#error <expecting scalar or matrix as first argument> ellipj ("1,2", [1, 2])
+%!#error <expecting scalar or matrix as first argument> ellipj ({1, 2}, [1, 2])
+%!error <Invalid size combination for U and M> ellipj ([1:4], [1:3])
+%!error <Invalid size combination for U and M> ellipj (complex (1:4,1:4), [1:3])
+
 */
+
--- a/libinterp/corefcn/error.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/error.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -830,10 +830,10 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} rethrow (@var{err})\n\
 Reissue a previous error as defined by @var{err}.  @var{err} is a structure\n\
-that must contain at least the 'message' and 'identifier' fields.  @var{err}\n\
-can also contain a field 'stack' that gives information on the assumed\n\
-location of the error.  Typically @var{err} is returned from\n\
-@code{lasterror}.\n\
+that must contain at least the @qcode{\"message\"} and @qcode{\"identifier\"}\n\
+fields.  @var{err} can also contain a field @qcode{\"stack\"} that gives\n\
+information on the assumed location of the error.  Typically @var{err} is\n\
+returned from @code{lasterror}.\n\
 @seealso{lasterror, lasterr, error}\n\
 @end deftypefn")
 {
@@ -1091,7 +1091,7 @@
 which will only stop execution if an error has been found.\n\
 \n\
 Implementation Note: For compatibility with @sc{matlab}, escape\n\
-sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\
+sequences (e.g., @qcode{\"\\n\"} => newline) are processed in @var{template}\n\
 regardless of whether @var{template} has been defined within single quotes\n\
 as long as there are two or more input arguments.\n\
 Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\
@@ -1235,17 +1235,17 @@
 \n\
 The optional message identifier allows users to enable or disable\n\
 warnings tagged by @var{id}.  A message identifier is of the form\n\
-\"NAMESPACE:WARNING-NAME\".  Octave's own warnings use the \"Octave\"\n\
-namespace (@pxref{docXwarning_ids}).  The special identifier @samp{\"all\"}\n\
+\"NAMESPACE:WARNING-NAME\".  Octave's own warnings use the @qcode{\"Octave\"}\n\
+namespace (@pxref{XREFwarning_ids}).  The special identifier @qcode{\"all\"}\n\
 may be used to set the state of all warnings.\n\
 \n\
-If the first argument is @samp{\"on\"} or @samp{\"off\"}, set the state\n\
-of a particular warning using the identifier @var{id}.  If the first\n\
-argument is @samp{\"query\"}, query the state of this warning instead.\n\
-If the identifier is omitted, a value of @samp{\"all\"} is assumed.  If\n\
-you set the state of a warning to @samp{\"error\"}, the warning named by\n\
-@var{id} is handled as if it were an error instead.  So, for example, the\n\
-following handles all warnings as errors:\n\
+If the first argument is @qcode{\"on\"} or @qcode{\"off\"},\n\
+set the state of a particular warning using the identifier @var{id}.  If the\n\
+first argument is @qcode{\"query\"}, query the state of this warning\n\
+instead.  If the identifier is omitted, a value of @qcode{\"all\"} is\n\
+assumed.  If you set the state of a warning to @qcode{\"error\"}, the\n\
+warning named by @var{id} is handled as if it were an error instead.  So,\n\
+for example, the following handles all warnings as errors:\n\
 \n\
 @example\n\
 @group\n\
@@ -1253,17 +1253,17 @@
 @end group\n\
 @end example\n\
 \n\
-If the state is @samp{\"on\"}, @samp{\"off\"}, or @samp{\"error\"}\n\
-and the third argument is @samp{\"local\"}, then the warning state\n\
+If the state is @qcode{\"on\"}, @qcode{\"off\"}, or @qcode{\"error\"}\n\
+and the third argument is @qcode{\"local\"}, then the warning state\n\
 will be set temporarily, until the end of the current function.\n\
 Changes to warning states that are set locally affect the current\n\
 function and all functions called from the current scope.  The\n\
 previous warning state is restored on return from the current\n\
-function.  The \"local\" option is ignored if used in the top-level\n\
+function.  The @qcode{\"local\"} option is ignored if used in the top-level\n\
 workspace.\n\
 \n\
 Implementation Note: For compatibility with @sc{matlab}, escape\n\
-sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\
+sequences (e.g., @qcode{\"\\n\"} => newline) are processed in @var{template}\n\
 regardless of whether @var{template} has been defined within single quotes\n\
 as long as there are two or more input arguments.\n\
 Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\
@@ -1654,29 +1654,29 @@
 arguments, return a structure containing the last error message and other\n\
 information related to this error.  The elements of the structure are:\n\
 \n\
-@table @asis\n\
-@item 'message'\n\
+@table @code\n\
+@item message\n\
 The text of the last error message\n\
 \n\
-@item 'identifier'\n\
+@item identifier\n\
 The message identifier of this error message\n\
 \n\
-@item 'stack'\n\
+@item stack\n\
 A structure containing information on where the message occurred.  This may\n\
 be an empty structure if the information cannot\n\
 be obtained.  The fields of the structure are:\n\
 \n\
-@table @asis\n\
-@item 'file'\n\
+@table @code\n\
+@item file\n\
 The name of the file where the error occurred\n\
 \n\
-@item 'name'\n\
+@item name\n\
 The name of function in which the error occurred\n\
 \n\
-@item 'line'\n\
+@item line\n\
 The line number at which the error occurred\n\
 \n\
-@item 'column'\n\
+@item column\n\
 An optional field with the column number at which the error occurred\n\
 @end table\n\
 @end table\n\
@@ -1685,8 +1685,8 @@
 as input.  Any fields of @var{err} that match those above are set while any\n\
 unspecified fields are initialized with default values.\n\
 \n\
-If @code{lasterror} is called with the argument \"reset\", all fields are\n\
-set to their default values.\n\
+If @code{lasterror} is called with the argument @qcode{\"reset\"}, all\n\
+fields are set to their default values.\n\
 @seealso{lasterr, error, lastwarn}\n\
 @end deftypefn")
 {
@@ -1956,9 +1956,9 @@
 Query or set the internal variable that controls whether Octave will try\n\
 to ring the terminal bell before printing an error message.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (beep_on_error);
@@ -1974,9 +1974,9 @@
 inhibit printing of the normal traceback message (you will only see\n\
 the top-level error message).\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{debug_on_warning, debug_on_interrupt}\n\
 @end deftypefn")
 {
@@ -1991,9 +1991,9 @@
 Query or set the internal variable that controls whether Octave will try\n\
 to enter the debugger when a warning is encountered.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{debug_on_error, debug_on_interrupt}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/file-io.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/file-io.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -647,14 +647,14 @@
 file.\n\
 @end table\n\
 \n\
-Append a \"t\" to the mode string to open the file in text mode or a\n\
-\"b\" to open in binary mode.  On Windows and Macintosh systems, text\n\
+Append a @qcode{\"t\"} to the mode string to open the file in text mode or a\n\
+@qcode{\"b\"} to open in binary mode.  On Windows and Macintosh systems, text\n\
 mode reading and writing automatically converts linefeeds to the\n\
 appropriate line end character for the system (carriage-return linefeed\n\
 on Windows, carriage-return on Macintosh).  The default if no mode is\n\
 specified is binary mode.\n\
 \n\
-Additionally, you may append a \"z\" to the mode string to open a\n\
+Additionally, you may append a @qcode{\"z\"} to the mode string to open a\n\
 gzipped file for reading or writing.  For this to be successful, you\n\
 must also open the file in binary mode.\n\
 \n\
@@ -670,15 +670,6 @@
 \n\
 @item ieee-le\n\
 IEEE little endian format.\n\
-\n\
-@item vaxd\n\
-VAX D floating format.\n\
-\n\
-@item vaxg\n\
-VAX G floating format.\n\
-\n\
-@item cray\n\
-Cray floating format.\n\
 @end table\n\
 \n\
 @noindent\n\
@@ -825,8 +816,10 @@
 The pointer is positioned @var{offset} characters from the @var{origin},\n\
 which may be one of the predefined variables @w{@code{SEEK_CUR}} (current\n\
 position), @w{@code{SEEK_SET}} (beginning), or @w{@code{SEEK_END}} (end of\n\
-file) or strings \"cof\", \"bof\" or \"eof\".  If @var{origin} is omitted,\n\
-@w{@code{SEEK_SET}} is assumed.  @var{offset} may be positive, negative, or zero but not all combinations of @var{origin} and @var{offset} can be realized.\n\
+file) or strings @qcode{\"cof\"}, @qcode{\"bof\"} or @qcode{\"eof\"}.  If\n\
+@var{origin} is omitted, @w{@code{SEEK_SET}} is assumed.  @var{offset} may\n\
+be positive, negative, or zero but not all combinations of @var{origin} and\n\
+@var{offset} can be realized.\n\
 \n\
 Return 0 on success and -1 on error.\n\
 @seealso{fskipl, frewind, ftell, fopen}\n\
@@ -1440,84 +1433,84 @@
 data to read and may be one of\n\
 \n\
 @table @asis\n\
-@item \"schar\"\n\
-@itemx \"signed char\"\n\
+@item  @qcode{\"schar\"}\n\
+@itemx @qcode{\"signed char\"}\n\
 Signed character.\n\
 \n\
-@item \"uchar\"\n\
-@itemx \"unsigned char\"\n\
+@item  @qcode{\"uchar\"}\n\
+@itemx @qcode{\"unsigned char\"}\n\
 Unsigned character.\n\
 \n\
-@item \"int8\"\n\
-@itemx \"integer*1\"\n\
+@item  @qcode{\"int8\"}\n\
+@itemx @qcode{\"integer*1\"}\n\
 \n\
 8-bit signed integer.\n\
 \n\
-@item \"int16\"\n\
-@itemx \"integer*2\"\n\
+@item  @qcode{\"int16\"}\n\
+@itemx @qcode{\"integer*2\"}\n\
 16-bit signed integer.\n\
 \n\
-@item \"int32\"\n\
-@itemx \"integer*4\"\n\
+@item  @qcode{\"int32\"}\n\
+@itemx @qcode{\"integer*4\"}\n\
 32-bit signed integer.\n\
 \n\
-@item \"int64\"\n\
-@itemx \"integer*8\"\n\
+@item  @qcode{\"int64\"}\n\
+@itemx @qcode{\"integer*8\"}\n\
 64-bit signed integer.\n\
 \n\
-@item \"uint8\"\n\
+@item @qcode{\"uint8\"}\n\
 8-bit unsigned integer.\n\
 \n\
-@item \"uint16\"\n\
+@item @qcode{\"uint16\"}\n\
 16-bit unsigned integer.\n\
 \n\
-@item \"uint32\"\n\
+@item @qcode{\"uint32\"}\n\
 32-bit unsigned integer.\n\
 \n\
-@item \"uint64\"\n\
+@item @qcode{\"uint64\"}\n\
 64-bit unsigned integer.\n\
 \n\
-@item \"single\"\n\
-@itemx \"float32\"\n\
-@itemx \"real*4\"\n\
+@item  @qcode{\"single\"}\n\
+@itemx @qcode{\"float32\"}\n\
+@itemx @qcode{\"real*4\"}\n\
 32-bit floating point number.\n\
 \n\
-@item \"double\"\n\
-@itemx \"float64\"\n\
-@itemx \"real*8\"\n\
+@item  @qcode{\"double\"}\n\
+@itemx @qcode{\"float64\"}\n\
+@itemx @qcode{\"real*8\"}\n\
 64-bit floating point number.\n\
 \n\
-@item \"char\"\n\
-@itemx \"char*1\"\n\
+@item  @qcode{\"char\"}\n\
+@itemx @qcode{\"char*1\"}\n\
 Single character.\n\
 \n\
-@item \"short\"\n\
+@item @qcode{\"short\"}\n\
 Short integer (size is platform dependent).\n\
 \n\
-@item \"int\"\n\
+@item @qcode{\"int\"}\n\
 Integer (size is platform dependent).\n\
 \n\
-@item \"long\"\n\
+@item @qcode{\"long\"}\n\
 Long integer (size is platform dependent).\n\
 \n\
-@item \"ushort\"\n\
-@itemx \"unsigned short\"\n\
+@item  @qcode{\"ushort\"}\n\
+@itemx @qcode{\"unsigned short\"}\n\
 Unsigned short integer (size is platform dependent).\n\
 \n\
-@item \"uint\"\n\
-@itemx \"unsigned int\"\n\
+@item  @qcode{\"uint\"}\n\
+@itemx @qcode{\"unsigned int\"}\n\
 Unsigned integer (size is platform dependent).\n\
 \n\
-@item \"ulong\"\n\
-@itemx \"unsigned long\"\n\
+@item  @qcode{\"ulong\"}\n\
+@itemx @qcode{\"unsigned long\"}\n\
 Unsigned long integer (size is platform dependent).\n\
 \n\
-@item \"float\"\n\
+@item @qcode{\"float\"}\n\
 Single precision floating point number (size is platform dependent).\n\
 @end table\n\
 \n\
 @noindent\n\
-The default precision is @code{\"uchar\"}.\n\
+The default precision is @qcode{\"uchar\"}.\n\
 \n\
 The @var{precision} argument may also specify an optional repeat\n\
 count.  For example, @samp{32*single} causes @code{fread} to read\n\
@@ -1553,7 +1546,7 @@
 for the file.  Valid values are\n\
 \n\
 @table @code\n\
-@item \"native\"\n\
+@item @qcode{\"native\"}\n\
 The format of the current machine.\n\
 \n\
 @item \"ieee-be\"\n\
@@ -1561,21 +1554,8 @@
 \n\
 @item \"ieee-le\"\n\
 IEEE little endian.\n\
-\n\
-@item \"vaxd\"\n\
-VAX D floating format.\n\
-\n\
-@item \"vaxg\"\n\
-VAX G floating format.\n\
-\n\
-@item \"cray\"\n\
-Cray floating format.\n\
 @end table\n\
 \n\
-@noindent\n\
-Conversions are currently only supported for @code{\"ieee-be\"} and\n\
-@code{\"ieee-le\"} formats.\n\
-\n\
 The data read from the file is returned in @var{val}, and the number of\n\
 values read is returned in @code{count}\n\
 @seealso{fwrite, fgets, fgetl, fscanf, fopen}\n\
@@ -1827,11 +1807,11 @@
 @var{mode} may be\n\
 \n\
 @table @code\n\
-@item \"r\"\n\
+@item @qcode{\"r\"}\n\
 The pipe will be connected to the standard output of the process, and\n\
 open for reading.\n\
 \n\
-@item \"w\"\n\
+@item @qcode{\"w\"}\n\
 The pipe will be connected to the standard input of the process, and\n\
 open for writing.\n\
 @end table\n\
@@ -1922,7 +1902,7 @@
 @deftypefnx {Built-in Function} {} tmpnam (@var{dir}, @var{prefix})\n\
 Return a unique temporary file name as a string.\n\
 \n\
-If @var{prefix} is omitted, a value of @code{\"oct-\"} is used.\n\
+If @var{prefix} is omitted, a value of @qcode{\"oct-\"} is used.\n\
 If @var{dir} is also omitted, the default directory for temporary files\n\
 is used.  If @var{dir} is provided, it must exist, otherwise the default\n\
 directory for temporary files is used.  Since the named file is not\n\
@@ -1964,7 +1944,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} tmpfile ()\n\
 Return the file ID corresponding to a new temporary file with a unique\n\
-name.  The file is opened in binary read/write (@code{\"w+b\"}) mode.\n\
+name.  The file is opened in binary read/write (@qcode{\"w+b\"}) mode.\n\
 The file will be deleted automatically when it is closed or when Octave\n\
 exits.\n\
 \n\
--- a/libinterp/corefcn/find.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/find.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -377,9 +377,10 @@
 If two inputs are given, @var{n} indicates the maximum number of\n\
 elements to find from the beginning of the matrix or vector.\n\
 \n\
-If three inputs are given, @var{direction} should be one of \"first\" or\n\
-\"last\", requesting only the first or last @var{n} indices, respectively.\n\
-However, the indices are always returned in ascending order.\n\
+If three inputs are given, @var{direction} should be one of\n\
+@qcode{\"first\"} or @qcode{\"last\"}, requesting only the first or last\n\
+@var{n} indices, respectively.  However, the indices are always returned in\n\
+ascending order.\n\
 \n\
 Note that this function is particularly useful for sparse matrices, as\n\
 it extracts the non-zero elements as vectors, which can then be used to\n\
--- a/libinterp/corefcn/gammainc.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/gammainc.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -66,8 +66,8 @@
 @var{a} must agree, and @code{gammainc} is applied element-by-element.\n\
 \n\
 By default the incomplete gamma function integrated from 0 to @var{x} is\n\
-computed.  If \"upper\" is given then the complementary function integrated\n\
-from @var{x} to infinity is calculated.  It should be noted that\n\
+computed.  If @qcode{\"upper\"} is given then the complementary function\n\
+integrated from @var{x} to infinity is calculated.  It should be noted that\n\
 \n\
 @example\n\
 gammainc (@var{x}, @var{a}) @equiv{} 1 - gammainc (@var{x}, @var{a}, \"upper\")\n\
--- a/libinterp/corefcn/gl-render.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/gl-render.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1600,6 +1600,9 @@
 
   i1 = i2 = j1 = j2 = 0;
 
+  if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
+    c = props.get_color_data ().array_value ();
+
   boolMatrix clip (z.dims (), false);
 
   for (int i = 0; i < zr; i++)
@@ -1613,12 +1616,11 @@
             j1 = j;
 
           clip(i,j) = is_nan_or_inf (x(i1,j), y(i,j1), z(i,j));
+          if (fc_mode == 1 || fc_mode == 2)
+            clip(i,j) |= (xisnan (c(i,j)) || xisinf (c(i,j)));
         }
     }
 
-  if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
-    c = props.get_color_data ().array_value ();
-
   if (fa_mode > 0 || ea_mode > 0)
     {
       // FIXME: implement alphadata conversion
@@ -3009,7 +3011,7 @@
 {
 #if HAVE_FREETYPE
   text_renderer.text_to_pixels (txt, pixels, bbox,
-                                halign, valign, rotation);
+                                halign, valign, rotation, "none");
 #endif
 }
 
--- a/libinterp/corefcn/graphics.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/graphics.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1927,22 +1927,6 @@
   return m;
 }
 
-graphics_handle::graphics_handle (const octave_value& a)
-  : val (octave_NaN)
-{
-  if (a.is_empty ())
-    /* do nothing */;
-  else
-    {
-      double tval = a.double_value ();
-
-      if (! error_state)
-        val = tval;
-      else
-        error ("invalid graphics handle");
-    }
-}
-
 // Set properties given as a cs-list of name, value pairs.
 
 void
@@ -1978,11 +1962,14 @@
 /*
 ## test set with name, value pairs
 %!test
-%! set (gcf, "visible", "off");
+%! hf = figure ("visible", "off");
 %! h = plot (1:10, 10:-1:1);
 %! set (h, "linewidth", 10, "marker", "x");
-%! assert (get (h, "linewidth"), 10);
-%! assert (get (h, "marker"), "x");
+%! lw = get (h, "linewidth");
+%! mk = get (h, "marker");
+%! close (hf);
+%! assert (lw, 10);
+%! assert (mk, "x");
 */
 
 // Set properties given in two cell arrays containing names and values.
@@ -2013,32 +2000,47 @@
 /*
 ## test set with cell array arguments
 %!test
-%! set (gcf, "visible", "off");
+%! hf = figure ("visible", "off");
 %! h = plot (1:10, 10:-1:1);
 %! set (h, {"linewidth", "marker"}, {10, "x"});
-%! assert (get (h, "linewidth"), 10);
-%! assert (get (h, "marker"), "x");
+%! lw = get (h, "linewidth");
+%! mk = get (h, "marker");
+%! close (hf);
+%! assert (lw, 10);
+%! assert (mk, "x");
 
 ## test set with multiple handles and cell array arguments
 %!test
-%! set (gcf, "visible", "off");
-%! h = plot (1:10, 10:-1:1, 1:10, 1:10);
-%! set (h, {"linewidth", "marker"}, {10, "x"; 5, "o"});
-%! assert (get (h, "linewidth"), {10; 5});
-%! assert (get (h, "marker"), {"x"; "o"});
-%! set (h, {"linewidth", "marker"}, {10, "x"});
-%! assert (get (h, "linewidth"), {10; 10});
-%! assert (get (h, "marker"), {"x"; "x"});
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10, 10:-1:1, 1:10, 1:10);
+%!   set (h, {"linewidth", "marker"}, {10, "x"; 5, "o"});
+%!   assert (get (h, "linewidth"), {10; 5});
+%!   assert (get (h, "marker"), {"x"; "o"});
+%!   set (h, {"linewidth", "marker"}, {10, "x"});
+%!   assert (get (h, "linewidth"), {10; 10});
+%!   assert (get (h, "marker"), {"x"; "x"});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect;
 
 %!error <set: number of graphics handles must match number of value rows>
-%! set (gcf, "visible", "off");
-%! h = plot (1:10, 10:-1:1, 1:10, 1:10);
-%! set (h, {"linewidth", "marker"}, {10, "x"; 5, "o"; 7, "."});
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10, 10:-1:1, 1:10, 1:10);
+%!   set (h, {"linewidth", "marker"}, {10, "x"; 5, "o"; 7, "."});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 
 %!error <set: number of names must match number of value columns>
-%! set (gcf, "visible", "off");
-%! h = plot (1:10, 10:-1:1, 1:10, 1:10);
-%! set (h, {"linewidth"}, {10, "x"; 5, "o"});
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10, 10:-1:1, 1:10, 1:10);
+%!   set (h, {"linewidth"}, {10, "x"; 5, "o"});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 */
 
 // Set properties given in a struct array
@@ -2061,27 +2063,34 @@
 /*
 ## test set ticklabels for compatibility
 %!test
-%! set (gcf (), "visible", "off");
+%! hf = figure ("visible", "off");
 %! set (gca (), "xticklabel", [0, 0.2, 0.4, 0.6, 0.8, 1]);
 %! xticklabel = get (gca (), "xticklabel");
+%! close (hf);
 %! assert (class (xticklabel), "char");
 %! assert (size (xticklabel), [6, 3]);
+
 %!test
-%! set (gcf (), "visible", "off");
+%! hf = figure ("visible", "off");
 %! set (gca (), "xticklabel", "0|0.2|0.4|0.6|0.8|1");
 %! xticklabel = get (gca (), "xticklabel");
+%! close (hf);
 %! assert (class (xticklabel), "char");
 %! assert (size (xticklabel), [6, 3]);
+
 %!test
-%! set (gcf (), "visible", "off");
+%! hf = figure ("visible", "off");
 %! set (gca (), "xticklabel", ["0 "; "0.2"; "0.4"; "0.6"; "0.8"; "1 "]);
 %! xticklabel = get (gca (), "xticklabel");
+%! close (hf);
 %! assert (class (xticklabel), "char");
 %! assert (size (xticklabel), [6, 3]);
+
 %!test
-%! set (gcf (), "visible", "off");
+%! hf = figure ("visible", "off");
 %! set (gca (), "xticklabel", {"0", "0.2", "0.4", "0.6", "0.8", "1"});
 %! xticklabel = get (gca (), "xticklabel");
+%! close (hf);
 %! assert (class (xticklabel), "cell");
 %! assert (size (xticklabel), [6, 1]);
 */
@@ -2089,40 +2098,47 @@
 /*
 ## test set with struct arguments
 %!test
-%! set (gcf, "visible", "off");
-%! h = plot (1:10, 10:-1:1);
-%! set (h, struct ("linewidth", 10, "marker", "x"));
-%! assert (get (h, "linewidth"), 10);
-%! assert (get (h, "marker"), "x");
-%! h = plot (1:10, 10:-1:1, 1:10, 1:10);
-%! set (h, struct ("linewidth", {5, 10}));
-%! assert (get (h, "linewidth"), {10; 10});
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10, 10:-1:1);
+%!   set (h, struct ("linewidth", 10, "marker", "x"));
+%!   assert (get (h, "linewidth"), 10);
+%!   assert (get (h, "marker"), "x");
+%!   h = plot (1:10, 10:-1:1, 1:10, 1:10);
+%!   set (h, struct ("linewidth", {5, 10}));
+%!   assert (get (h, "linewidth"), {10; 10});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
 ## test ordering
 %!test
 %! markchanged = @(h, foobar, name) set (h, "userdata", [get(h,"userdata"); {name}]);
-%! figure (1, "visible", "off")
-%! clf ();
-%! h = line ();
-%! set (h, "userdata", {});
-%! addlistener (h, "color", {markchanged, "color"});
-%! addlistener (h, "linewidth", {markchanged, "linewidth"});
-%! # "linewidth" first
-%! props.linewidth = 2;
-%! props.color = "r";
-%! set (h, props);
-%! assert (get (h, "userdata"), fieldnames (props));
-%! clear props
-%! clf ();
-%! h = line ();
-%! set (h, "userdata", {});
-%! addlistener (h, "color", {markchanged, "color"});
-%! addlistener (h, "linewidth", {markchanged, "linewidth"});
-%! # "color" first
-%! props.color = "r";
-%! props.linewidth = 2;
-%! set (h, props);
-%! assert (get (h, "userdata"), fieldnames (props));
-%! close (1);
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = line ();
+%!   set (h, "userdata", {});
+%!   addlistener (h, "color", {markchanged, "color"});
+%!   addlistener (h, "linewidth", {markchanged, "linewidth"});
+%!   ## "linewidth" first
+%!   props.linewidth = 2;
+%!   props.color = "r";
+%!   set (h, props);
+%!   assert (get (h, "userdata"), fieldnames (props));
+%!   clear props;
+%!   clf ();
+%!   h = line ();
+%!   set (h, "userdata", {});
+%!   addlistener (h, "color", {markchanged, "color"});
+%!   addlistener (h, "linewidth", {markchanged, "linewidth"});
+%!   ## "color" first
+%!   props.color = "r";
+%!   props.linewidth = 2;
+%!   set (h, props);
+%!   assert (get (h, "userdata"), fieldnames (props));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 */
 
 // Set a property to a value or to its (factory) default value.
@@ -2173,13 +2189,19 @@
 /*
 ## test setting of default values
 %!test
-%! set (gcf, "visible", "off");
-%! h = plot (1:10, 10:-1:1);
-%! set (0, "defaultlinelinewidth", 20);
-%! set (h, "linewidth", "default");
-%! assert (get (h, "linewidth"), 20);
-%! set (h, "linewidth", "factory");
-%! assert (get (h, "linewidth"), 0.5);
+%! old_lw = get (0, "defaultlinelinewidth");
+%! unwind_protect
+%!   hf = figure ("visible", "off");
+%!   h = plot (1:10, 10:-1:1);
+%!   set (0, "defaultlinelinewidth", 20);
+%!   set (h, "linewidth", "default");
+%!   assert (get (h, "linewidth"), 20);
+%!   set (h, "linewidth", "factory");
+%!   assert (get (h, "linewidth"), 0.5);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   set (0, "defaultlinelinewidth", old_lw);
+%! end_unwind_protect
 */
 
 static double
@@ -3125,19 +3147,24 @@
 
 /*
 %!test
-%! set (0, "units", "pixels");
-%! sz = get (0, "screensize") - [1, 1, 0, 0];
-%! dpi = get (0, "screenpixelsperinch");
-%! set (0, "units", "inches");
-%! assert (get (0, "screensize"), sz / dpi, 0.5 / dpi);
-%! set (0, "units", "centimeters");
-%! assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54);
-%! set (0, "units", "points");
-%! assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72);
-%! set (0, "units", "normalized");
-%! assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]);
-%! set (0, "units", "pixels");
-%! assert (get (0, "screensize"), sz + [1, 1, 0, 0]);
+%! old_units = get (0, "units");
+%! unwind_protect
+%!   set (0, "units", "pixels");
+%!   sz = get (0, "screensize") - [1, 1, 0, 0];
+%!   dpi = get (0, "screenpixelsperinch");
+%!   set (0, "units", "inches");
+%!   assert (get (0, "screensize"), sz / dpi, 0.5 / dpi);
+%!   set (0, "units", "centimeters");
+%!   assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54);
+%!   set (0, "units", "points");
+%!   assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72);
+%!   set (0, "units", "normalized");
+%!   assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]);
+%!   set (0, "units", "pixels");
+%!   assert (get (0, "screensize"), sz + [1, 1, 0, 0]);
+%! unwind_protect_cleanup
+%!   set (0, "units", old_units);
+%! end_unwind_protect
 */
 
 void
@@ -3745,27 +3772,34 @@
 
 /*
 %!test
-%! figure (1, "visible", "off");
-%! set (1, "paperunits", "inches");
-%! set (1, "papersize", [5, 4]);
-%! set (1, "paperunits", "points");
-%! assert (get (1, "papersize"), [5, 4] * 72, 1);
-%! papersize = get (gcf, "papersize");
-%! set (1, "papersize", papersize + 1);
-%! set (1, "papersize", papersize);
-%! assert (get (1, "papersize"), [5, 4] * 72, 1);
-%! close (1);
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   set (hf, "paperunits", "inches");
+%!   set (hf, "papersize", [5, 4]);
+%!   set (hf, "paperunits", "points");
+%!   assert (get (hf, "papersize"), [5, 4] * 72, 1);
+%!   papersize = get (hf, "papersize");
+%!   set (hf, "papersize", papersize + 1);
+%!   set (hf, "papersize", papersize);
+%!   assert (get (hf, "papersize"), [5, 4] * 72, 1);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
 %!test
-%! figure (1, "visible", "off");
-%! set (1, "paperunits", "inches");
-%! set (1, "papersize", [5, 4]);
-%! set (1, "paperunits", "centimeters");
-%! assert (get (1, "papersize"), [5, 4] * 2.54, 2.54/72);
-%! papersize = get (gcf, "papersize");
-%! set (1, "papersize", papersize + 1);
-%! set (1, "papersize", papersize);
-%! assert (get (1, "papersize"), [5, 4] * 2.54, 2.54/72);
-%! close (1);
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   set (hf, "paperunits", "inches");
+%!   set (hf, "papersize", [5, 4]);
+%!   set (hf, "paperunits", "centimeters");
+%!   assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72);
+%!   papersize = get (hf, "papersize");
+%!   set (hf, "papersize", papersize + 1);
+%!   set (hf, "papersize", papersize);
+%!   assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 */
 
 void
@@ -3789,25 +3823,29 @@
 
 /*
 %!test
-%! figure (1, "visible", false);
-%! tol = 100 * eps ();
-%! ## UPPER case and MiXed case is part of test and should not be changed.
-%! set (gcf (), "paperorientation", "PORTRAIT");
-%! set (gcf (), "paperunits", "inches");
-%! set (gcf (), "papertype", "USletter");
-%! assert (get (gcf (), "papersize"), [8.5, 11.0], tol);
-%! set (gcf (), "paperorientation", "Landscape");
-%! assert (get (gcf (), "papersize"), [11.0, 8.5], tol);
-%! set (gcf (), "paperunits", "centimeters");
-%! assert (get (gcf (), "papersize"), [11.0, 8.5] * 2.54, tol);
-%! set (gcf (), "papertype", "a4");
-%! assert (get (gcf (), "papersize"), [29.7, 21.0], tol);
-%! set (gcf (), "paperunits", "inches", "papersize", [8.5, 11.0]);
-%! assert (get (gcf (), "papertype"), "usletter");
-%! assert (get (gcf (), "paperorientation"), "portrait");
-%! set (gcf (), "papersize", [11.0, 8.5]);
-%! assert (get (gcf (), "papertype"), "usletter");
-%! assert (get (gcf (), "paperorientation"), "landscape");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   tol = 100 * eps ();
+%!   ## UPPER case and MiXed case is part of test and should not be changed.
+%!   set (hf, "paperorientation", "PORTRAIT");
+%!   set (hf, "paperunits", "inches");
+%!   set (hf, "papertype", "USletter");
+%!   assert (get (hf, "papersize"), [8.5, 11.0], tol);
+%!   set (hf, "paperorientation", "Landscape");
+%!   assert (get (hf, "papersize"), [11.0, 8.5], tol);
+%!   set (hf, "paperunits", "centimeters");
+%!   assert (get (hf, "papersize"), [11.0, 8.5] * 2.54, tol);
+%!   set (hf, "papertype", "a4");
+%!   assert (get (hf, "papersize"), [29.7, 21.0], tol);
+%!   set (hf, "paperunits", "inches", "papersize", [8.5, 11.0]);
+%!   assert (get (hf, "papertype"), "usletter");
+%!   assert (get (hf, "paperorientation"), "portrait");
+%!   set (hf, "papersize", [11.0, 8.5]);
+%!   assert (get (hf, "papertype"), "usletter");
+%!   assert (get (hf, "paperorientation"), "landscape");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
 */
 
 void
@@ -3833,13 +3871,20 @@
 
 /*
 %!test
-%! figure (1, "visible", false);
-%! set (0, "units", "pixels");
-%! rsz = get (0, "screensize");
-%! set (gcf (), "units", "pixels");
-%! fsz = get (gcf (), "position");
-%! set (gcf (), "units", "normalized");
-%! assert (get (gcf (), "position"), (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4]));
+%! hf = figure ("visible", "off");
+%! old_units = get (0, "units");
+%! unwind_protect
+%!   set (0, "units", "pixels");
+%!   rsz = get (0, "screensize");
+%!   set (gcf (), "units", "pixels");
+%!   fsz = get (gcf (), "position");
+%!   set (gcf (), "units", "normalized");
+%!   pos = get (gcf (), "position");
+%!   assert (pos, (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4]));
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   set (0, "units", old_units);
+%! end_unwind_protect
 */
 
 std::string
@@ -4006,228 +4051,90 @@
 void
 axes::properties::sync_positions (void)
 {
-  Matrix ref_linset = looseinset.get ().matrix_value ();
-  if (autopos_tag_is ("subplot"))
-    {
-      graphics_object parent_obj = gh_manager::get_object (get_parent ());
-      if (parent_obj.isa ("figure"))
-        {
-           // FIXME: temporarily changed units should be protected
-           //        from interrupts
-           std::string fig_units = parent_obj.get ("units").string_value ();
-           parent_obj.set ("units", "pixels");
-
-           Matrix ref_outbox = outerposition.get ().matrix_value ();
-           ref_outbox(2) += ref_outbox(0);
-           ref_outbox(3) += ref_outbox(1);
-
-           // Find those subplots that are left, right, bottom and top aligned
-           // with the current subplot
-           Matrix kids = parent_obj.get_properties ().get_children ();
-           std::vector<octave_value> aligned;
-           std::vector<bool> l_aligned, b_aligned, r_aligned, t_aligned;
-           for (octave_idx_type i = 0; i < kids.numel (); i++)
-             {
-               graphics_object go = gh_manager::get_object (kids(i));
-               if (go.isa ("axes"))
-                 {
-                   axes::properties& props =
-                     dynamic_cast<axes::properties&> (go.get_properties ());
-                   if (props.autopos_tag_is ("subplot"))
-                     {
-                       Matrix outpos = go.get ("outerposition").matrix_value ();
-                       bool l_align = (std::abs (outpos(0)-ref_outbox(0)) < 1e-15);
-                       bool b_align = (std::abs (outpos(1)-ref_outbox(1)) < 1e-15);
-                       bool r_align = (std::abs (outpos(0)+outpos(2)-ref_outbox(2)) < 1e-15);
-                       bool t_align = (std::abs (outpos(1)+outpos(3)-ref_outbox(3)) < 1e-15);
-                       if (l_align || b_align || r_align || t_align)
-                         {
-                           aligned.push_back (kids(i));
-                           l_aligned.push_back (l_align);
-                           b_aligned.push_back (b_align);
-                           r_aligned.push_back (r_align);
-                           t_aligned.push_back (t_align);
-                           // FIXME: the temporarily deleted tags should be
-                           //        protected from interrupts
-                           props.set_autopos_tag ("none");
-                         }
-                     }
-                 }
-             }
-           // Determine a minimum box which aligns the subplots
-           Matrix ref_box (1, 4, 0.);
-           ref_box(2) = 1.;
-           ref_box(3) = 1.;
-           for (size_t i = 0; i < aligned.size (); i++)
-             {
-               graphics_object go = gh_manager::get_object (aligned[i]);
-               axes::properties& props =
-                 dynamic_cast<axes::properties&> (go.get_properties ());
-               Matrix linset = props.get_looseinset ().matrix_value ();
-               if (l_aligned[i])
-                 linset(0) = std::min (0., linset(0)-0.01);
-               if (b_aligned[i])
-                 linset(1) = std::min (0., linset(1)-0.01);
-               if (r_aligned[i])
-                 linset(2) = std::min (0., linset(2)-0.01);
-               if (t_aligned[i])
-                 linset(3) = std::min (0., linset(3)-0.01);
-               props.set_looseinset (linset);
-               Matrix pos = props.get_position ().matrix_value ();
-               if (l_aligned[i])
-                 ref_box(0) = std::max (ref_box(0), pos(0));
-               if (b_aligned[i])
-                 ref_box(1) = std::max (ref_box(1), pos(1));
-               if (r_aligned[i])
-                 ref_box(2) = std::min (ref_box(2), pos(0)+pos(2));
-               if (t_aligned[i])
-                 ref_box(3) = std::min (ref_box(3), pos(1)+pos(3));
-             }
-           // Set common looseinset values for all aligned subplots and
-           // revert their tag values
-           for (size_t i = 0; i < aligned.size (); i++)
-             {
-               graphics_object go = gh_manager::get_object (aligned[i]);
-               axes::properties& props =
-                 dynamic_cast<axes::properties&> (go.get_properties ());
-               Matrix outpos = props.get_outerposition ().matrix_value ();
-               Matrix linset = props.get_looseinset ().matrix_value ();
-               if (l_aligned[i])
-                 linset(0) = (ref_box(0)-outpos(0))/outpos(2);
-               if (b_aligned[i])
-                 linset(1) = (ref_box(1)-outpos(1))/outpos(3);
-               if (r_aligned[i])
-                 linset(2) = (outpos(0)+outpos(2)-ref_box(2))/outpos(2);
-               if (t_aligned[i])
-                 linset(3) = (outpos(1)+outpos(3)-ref_box(3))/outpos(3);
-               props.set_looseinset (linset);
-               props.set_autopos_tag ("subplot");
-             }
-           parent_obj.set ("units", fig_units);
-        }
-    }
+  // First part is equivalent to `update_tightinset ()'
+  if (activepositionproperty.is ("position"))
+    update_position ();
   else
-    sync_positions (ref_linset);
-}
-
-void
-axes::properties::sync_positions (const Matrix& linset)
-{
-  Matrix pos = position.get ().matrix_value ();
-  Matrix outpos = outerposition.get ().matrix_value ();
-  double lratio = linset(0);
-  double bratio = linset(1);
-  double wratio = 1-linset(0)-linset(2);
-  double hratio = 1-linset(1)-linset(3);
-  if (activepositionproperty.is ("outerposition"))
-    {
-      pos = outpos;
-      pos(0) = outpos(0)+lratio*outpos(2);
-      pos(1) = outpos(1)+bratio*outpos(3);
-      pos(2) = wratio*outpos(2);
-      pos(3) = hratio*outpos(3);
-
-      position = pos;
-      update_transform ();
-      Matrix tightpos = calc_tightbox (pos);
-
-      double thrshldx = 0.005*outpos(2);
-      double thrshldy = 0.005*outpos(3);
-      double minsizex = 0.2*outpos(2);
-      double minsizey = 0.2*outpos(3);
-      bool updatex = true, updatey = true;
-      for (int i = 0; i < 10; i++)
-        {
-          double dt;
-          bool modified = false;
-          dt = outpos(0)+outpos(2)-tightpos(0)-tightpos(2);
-          if (dt < -thrshldx && updatex)
-            {
-              pos(2) += dt;
-              modified = true;
-            }
-          dt = outpos(1)+outpos(3)-tightpos(1)-tightpos(3);
-          if (dt < -thrshldy && updatey)
-            {
-              pos(3) += dt;
-              modified = true;
-            }
-          dt = outpos(0)-tightpos(0);
-          if (dt > thrshldx && updatex)
-            {
-              pos(0) += dt;
-              pos(2) -= dt;
-              modified = true;
-            }
-          dt = outpos(1)-tightpos(1);
-          if (dt > thrshldy && updatey)
-            {
-              pos(1) += dt;
-              pos(3) -= dt;
-              modified = true;
-            }
-
-          // Note: checking limit for minimum axes size
-          if (pos(2) < minsizex)
-            {
-              pos(0) -= 0.5*(minsizex-pos(2));
-              pos(2) = minsizex;
-              updatex = false;
-            }
-          if (pos(3) < minsizey)
-            {
-              pos(1) -= 0.5*(minsizey-pos(3));
-              pos(3) = minsizey;
-              updatey = false;
-            }
-
-          if (modified)
-            {
-              position = pos;
-              update_transform ();
-              tightpos = calc_tightbox (pos);
-            }
-          else
-            break;
-        }
-    }
-  else
-    {
-      update_transform ();
-
-      outpos(0) = pos(0)-pos(2)*lratio/wratio;
-      outpos(1) = pos(1)-pos(3)*bratio/hratio;
-      outpos(2) = pos(2)/wratio;
-      outpos(3) = pos(3)/hratio;
-
-      outerposition = calc_tightbox (outpos);
-    }
-
-  update_insets ();
-}
-
-void
-axes::properties::update_insets (void)
-{
+    update_outerposition ();
+  caseless_str old_units = get_units ();
+  set_units ("normalized");
   Matrix pos = position.get ().matrix_value ();
   Matrix outpos = outerposition.get ().matrix_value ();
   Matrix tightpos = calc_tightbox (pos);
-  // Determine the tightinset = axes_bbox - position
-  Matrix inset (1, 4, 1.0);
-  inset(0) = pos(0)-tightpos(0);
-  inset(1) = pos(1)-tightpos(1);
-  inset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
-  inset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
-  tightinset = inset;
-
-  // Determine the looseinset = outerposition - position
-  inset(0) = pos(0)-outpos(0);
-  inset(1) = pos(1)-outpos(1);
-  inset(2) = outpos(0)+outpos(2)-pos(0)-pos(2);
-  inset(3) = outpos(1)+outpos(3)-pos(1)-pos(3);
-  looseinset = inset;
-}
-
+  Matrix tinset (1, 4, 1.0);
+  tinset(0) = pos(0)-tightpos(0);
+  tinset(1) = pos(1)-tightpos(1);
+  tinset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
+  tinset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
+  tightinset = tinset;
+  set_units (old_units);
+  update_transform ();
+  if (activepositionproperty.is ("position"))
+    update_position ();
+  else
+    update_outerposition ();
+}
+
+/*
+%!testif HAVE_FLTK
+%! hf = figure ("visible", "off");
+%! graphics_toolkit (hf, "fltk");
+%! unwind_protect
+%!   subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1));
+%!   hax = findall (gcf (), "type", "axes");
+%!   positions = cell2mat (get (hax, "position"));
+%!   outerpositions = cell2mat (get (hax, "outerposition"));
+%!   looseinsets = cell2mat (get (hax, "looseinset"));
+%!   tightinsets = cell2mat (get (hax, "tightinset"));
+%!   subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1));
+%!   hax = findall (gcf (), "type", "axes");
+%!   assert (cell2mat (get (hax, "position")), positions, 1e-4);
+%!   assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4);
+%!   assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4);
+%!   assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+%!testif HAVE_FLTK
+%! hf = figure ("visible", "off");
+%! graphics_toolkit (hf, "fltk");
+%! fpos = get (hf, "position");
+%! unwind_protect
+%!   plot (rand (3))
+%!   position = get (gca, "position");
+%!   outerposition = get (gca, "outerposition");
+%!   looseinset = get (gca, "looseinset");
+%!   tightinset = get (gca, "tightinset");
+%!   set (hf, "position", [fpos(1:2), 2*fpos(3:4)])
+%!   set (hf, "position", fpos);
+%!   assert (get (gca, "outerposition"), outerposition, 0.001)
+%!   assert (get (gca, "position"), position, 0.001)
+%!   assert (get (gca, "looseinset"), looseinset, 0.001)
+%!   assert (get (gca, "tightinset"), tightinset, 0.001)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+%!testif HAVE_FLTK
+%! hf = figure ("visible", "off");
+%! graphics_toolkit (hf, "fltk");
+%! fpos = get (hf, "position");
+%! set (gca, "activepositionproperty", "position")
+%! unwind_protect
+%!   plot (rand (3))
+%!   position = get (gca, "position");
+%!   outerposition = get (gca, "outerposition");
+%!   looseinset = get (gca, "looseinset");
+%!   tightinset = get (gca, "tightinset");
+%!   set (hf, "position", [fpos(1:2), 2*fpos(3:4)])
+%!   set (hf, "position", fpos);
+%!   assert (get (gca, "position"), position, 0.001)
+%!   assert (get (gca, "outerposition"), outerposition, 0.001)
+%!   assert (get (gca, "looseinset"), looseinset, 0.001)
+%!   assert (get (gca, "tightinset"), tightinset, 0.001)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+*/
 
 void
 axes::properties::set_text_child (handle_property& hp,
@@ -4334,7 +4241,7 @@
 {
   box = "on";
   colororder = default_colororder ();
-  dataaspectratio = Matrix (1, 3, 1.0);
+  // Note: dataspectratio will be set through update_aspectratios
   dataaspectratiomode = "auto";
   layer = "bottom";
 
@@ -4348,10 +4255,13 @@
   cl(1) = 1;
   clim = cl;
 
+  alim = tlim;
+
   xlimmode = "auto";
   ylimmode = "auto";
   zlimmode = "auto";
   climmode = "auto";
+  alimmode = "auto";
 
   xgrid = "off";
   ygrid = "off";
@@ -4365,12 +4275,18 @@
   xtickmode = "auto";
   ytickmode = "auto";
   ztickmode = "auto";
+  xminortick = "off";
+  yminortick = "off";
+  zminortick = "off";
   xticklabel = "";
   yticklabel = "";
   zticklabel = "";
   xticklabelmode = "auto";
   yticklabelmode = "auto";
   zticklabelmode = "auto";
+
+  interpreter = "none";
+
   color = color_values ("white");
   xcolor = color_values ("black");
   ycolor = color_values ("black");
@@ -4384,44 +4300,53 @@
   yaxislocation = "left";
   xaxislocation = "bottom";
 
-  // Note: camera properties will be set through update_transform
+  Matrix tview (1, 2, 0.0);
+  tview(1) = 90;
+  view = tview;
+
+  __hold_all__ = "off";
+  nextplot = "replace";
+
+  ambientlightcolor = Matrix (1, 3, 1.0);
+
+  // Note: camera properties (not mode) will be set in update_transform
   camerapositionmode = "auto";
   cameratargetmode = "auto";
   cameraupvectormode = "auto";
   cameraviewanglemode = "auto";
-  plotboxaspectratio = Matrix (1, 3, 1.0);
+
   drawmode = "normal";
+
+  fontangle = "normal";
+  fontname = OCTAVE_DEFAULT_FONTNAME;
+  fontsize = 10;
+  fontunits = "points";
+  fontweight = "normal";
+
   gridlinestyle = ":";
   linestyleorder = "-";
   linewidth = 0.5;
   minorgridlinestyle = ":";
-  // Note: plotboxaspectratio will be set through update_aspectratiors
+
+  // Note: plotboxaspectratio will be set through update_aspectratios
   plotboxaspectratiomode = "auto";
   projection = "orthographic";
+
   tickdir = "in";
   tickdirmode = "auto";
   ticklength = default_axes_ticklength ();
+
   tightinset = Matrix (1, 4, 0.0);
 
   sx = "linear";
   sy = "linear";
   sz = "linear";
 
-  Matrix tview (1, 2, 0.0);
-  tview(1) = 90;
-  view = tview;
-
   visible = "on";
-  nextplot = "replace";
-
+
+  // Replace preserves Position and Units properties
   if (mode != "replace")
     {
-      fontangle = "normal";
-      fontname = OCTAVE_DEFAULT_FONTNAME;
-      fontsize = 10;
-      fontunits = "points";
-      fontweight = "normal";
-
       outerposition = default_axes_outerposition ();
       position = default_axes_position ();
       activepositionproperty = "outerposition";
@@ -4483,7 +4408,7 @@
   adopt (title.handle_value ());
 
   update_transform ();
-  update_insets ();
+  sync_positions ();
   override_defaults (obj);
 }
 
@@ -4689,7 +4614,7 @@
   double yo = ylimits(yd > 0 ? 0 : 1);
   double zo = zlimits(zd > 0 ? 0 : 1);
 
-  Matrix pb  = get_plotboxaspectratio ().matrix_value ();
+  Matrix pb = get_plotboxaspectratio ().matrix_value ();
 
   bool autocam = (camerapositionmode_is ("auto")
                   && cameratargetmode_is ("auto")
@@ -5491,8 +5416,7 @@
       double min_pos = octave_Inf;
       double max_neg = -octave_Inf;
       get_children_limits (minval, maxval, min_pos, max_neg, kids, limit_type);
-      if (!xisinf (minval) && !xisnan (minval)
-          && !xisinf (maxval) && !xisnan (maxval))
+      if (xfinite (minval) && xfinite (maxval))
         {
           limits(0) = minval;
           limits(1) = maxval;
@@ -5842,6 +5766,56 @@
     }
 }
 
+// Almost identical to convert_ticklabel_string but it only accepts
+// cellstr or string, not numeric input.
+static octave_value
+convert_linestyleorder_string (const octave_value& val)
+{
+  octave_value retval = val;
+
+  if (val.is_cellstr ())
+    {
+      // Always return a column vector for Matlab Compatibility
+      if (val.columns () > 1)
+        retval = val.reshape (dim_vector (val.numel (), 1));
+    }
+  else
+    {
+      string_vector sv;
+      if (val.is_string () && val.rows () == 1)
+        {
+          std::string valstr = val.string_value ();
+          std::istringstream iss (valstr);
+          std::string tmpstr;
+
+          // Split string with delimiter '|'
+          while (std::getline (iss, tmpstr, '|'))
+            sv.append (tmpstr);
+          
+          // If string ends with '|' Matlab appends a null string
+          if (*valstr.rbegin () == '|')
+            sv.append (std::string (""));
+        }
+      else
+        return retval;
+
+      charMatrix chmat (sv, ' ');
+
+      retval = octave_value (chmat);
+    }
+
+  return retval;
+}
+
+void
+axes::properties::set_linestyleorder (const octave_value& v)
+{
+  if (!error_state)
+    {
+      linestyleorder.set (convert_linestyleorder_string (v), false);
+    }
+}
+
 void
 axes::properties::set_units (const octave_value& v)
 {
@@ -5973,16 +5947,16 @@
                   const array_property& data)
 {
   double val = data.min_val ();
-  if (! (xisinf (val) || xisnan (val)) && val < min_val)
+  if (xfinite (val) && val < min_val)
     min_val = val;
   val = data.max_val ();
-  if (! (xisinf (val) || xisnan (val)) && val > max_val)
+  if (xfinite (val) && val > max_val)
     max_val = val;
   val = data.min_pos ();
-  if (! (xisinf (val) || xisnan (val)) && val > 0 && val < min_pos)
+  if (xfinite (val) && val > 0 && val < min_pos)
     min_pos = val;
   val = data.max_neg ();
-  if (! (xisinf (val) || xisnan (val)) && val < 0 && val > max_neg)
+  if (xfinite (val) && val < 0 && val > max_neg)
     max_neg = val;
 }
 */
@@ -6001,19 +5975,19 @@
           double val;
 
           val = m(0);
-          if (! (xisinf (val) || xisnan (val)) && val < min_val)
+          if (xfinite (val) && val < min_val)
             min_val = val;
 
           val = m(1);
-          if (! (xisinf (val) || xisnan (val)) && val > max_val)
+          if (xfinite (val) && val > max_val)
             max_val = val;
 
           val = m(2);
-          if (! (xisinf (val) || xisnan (val)) && val > 0 && val < min_pos)
+          if (xfinite (val) && val > 0 && val < min_pos)
             min_pos = val;
 
           val = m(3);
-          if (! (xisinf (val) || xisnan (val)) && val < 0 && val > max_neg)
+          if (xfinite (val) && val < 0 && val > max_neg)
             max_neg = val;
         }
     }
@@ -6352,7 +6326,7 @@
           label.erase (0, label.find_first_not_of (" "));
           label = label.substr (0, label.find_last_not_of (" ")+1);
 #ifdef HAVE_FREETYPE
-          ext = text_renderer.get_extent (label);
+          ext = text_renderer.get_extent (label, 0.0, "none");
           wmax = std::max (wmax, ext(0));
           hmax = std::max (hmax, ext(1));
 #else
@@ -6478,16 +6452,16 @@
   if (limits.numel () == 4) \
     { \
       val = limits(0); \
-      if (! (xisinf (val) || xisnan (val))) \
+      if (xfinite (val)) \
         min_val = val; \
       val = limits(1); \
-      if (! (xisinf (val) || xisnan (val))) \
+      if (xfinite (val)) \
         max_val = val; \
       val = limits(2); \
-      if (! (xisinf (val) || xisnan (val))) \
+      if (xfinite (val)) \
         min_pos = val; \
       val = limits(3); \
-      if (! (xisinf (val) || xisnan (val))) \
+      if (xfinite (val)) \
         max_neg = val; \
     } \
   else \
@@ -7077,6 +7051,8 @@
   xinitialize (xproperties.get_xlabel ());
   xinitialize (xproperties.get_ylabel ());
   xinitialize (xproperties.get_zlabel ());
+
+  xproperties.sync_positions ();
 }
 
 // ---------------------------------------------------------------------
@@ -7186,7 +7162,8 @@
   string_vector sv = string_prop.all_strings ();
 
   renderer.text_to_pixels (sv.join ("\n"), pixels, bbox,
-                           halign, valign, get_rotation ());
+                           halign, valign, get_rotation (),
+                           get_interpreter ());
   /* The bbox is relative to the text's position.
      We'll leave it that way, because get_position () does not return
      valid results when the text is first constructed.
@@ -7451,16 +7428,16 @@
   if (limits.numel () == 4)
     {
       val = limits(0);
-      if (! (xisinf (val) || xisnan (val)))
+      if (xfinite (val))
         min_val = val;
       val = limits(1);
-      if (! (xisinf (val) || xisnan (val)))
+      if (xfinite (val))
         max_val = val;
       val = limits(2);
-      if (! (xisinf (val) || xisnan (val)))
+      if (xfinite (val))
         min_pos = val;
       val = limits(3);
-      if (! (xisinf (val) || xisnan (val)))
+      if (xfinite (val))
         max_neg = val;
     }
   else
@@ -7631,7 +7608,7 @@
   // FIXME: parsed content should be cached for efficiency
   // FIXME: support multiline text
 
-  elt = text_parser_none ().parse (get_string_string ());
+  elt = text_parser::parse (get_string_string (), "none");
 #ifdef HAVE_FONTCONFIG
   text_renderer.set_font (get_fontname (),
                           get_fontweight (),
@@ -7639,6 +7616,7 @@
                           get_fontsize ());
 #endif
   box = text_renderer.get_extent (elt, 0);
+  delete elt;
 
   Matrix ext (1, 4, 0.0);
 
@@ -8447,10 +8425,11 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} ishandle (@var{h})\n\
 Return true if @var{h} is a graphics handle and false otherwise.\n\
+\n\
 @var{h} may also be a matrix of handles in which case a logical\n\
 array is returned that is true where the elements of @var{h} are\n\
 graphics handles and false where they are not.\n\
-@seealso{isfigure}\n\
+@seealso{isaxes, isfigure}\n\
 @end deftypefn")
 {
   gh_manager::auto_lock guard;
@@ -8522,9 +8501,10 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\
 Remove any defaults set for the handle @var{h}.  The default figure\n\
-properties of \"position\", \"units\", \"windowstyle\" and\n\
-\"paperunits\" and the default axes properties of \"position\" and \"units\"\n\
-are not reset.\n\
+properties of @qcode{\"position\"}, @qcode{\"units\"},\n\
+@qcode{\"windowstyle\"} and @qcode{\"paperunits\"} and the default axes\n\
+properties of @qcode{\"position\"} and @qcode{\"units\"} are not reset.\n\
+@seealso{cla, clf}\n\
 @end deftypefn")
 {
   int nargin = args.length ();
@@ -9108,25 +9088,27 @@
 
   if (go.isa ("surface"))
     nd = 3;
-
-  if ((go.isa ("line") || go.isa ("patch")) && ! go.get("zdata").is_empty ())
+  else if ((go.isa ("line") || go.isa ("patch"))
+            && ! go.get ("zdata").is_empty ())
     nd = 3;
-
-  Matrix kids = go.get_properties ().get_children ();
-
-  for (octave_idx_type i = 0; i < kids.length (); i++)
-    {
-      graphics_handle hnd = gh_manager::lookup (kids(i));
-
-      if (hnd.ok ())
-        {
-          const graphics_object& kid = gh_manager::get_object (hnd);
-
-          if (kid.valid_object ())
-            nd = calc_dimensions (kid);
-
-          if (nd == 3)
-            break;
+  else
+    {
+      Matrix kids = go.get_properties ().get_children ();
+
+      for (octave_idx_type i = 0; i < kids.length (); i++)
+        {
+          graphics_handle hnd = gh_manager::lookup (kids(i));
+
+          if (hnd.ok ())
+            {
+              const graphics_object& kid = gh_manager::get_object (hnd);
+
+              if (kid.valid_object ())
+                nd = calc_dimensions (kid);
+
+              if (nd == 3)
+                break;
+            }
         }
     }
 
@@ -9146,17 +9128,15 @@
 
   int nargin = args.length ();
 
-  if (nargin == 1)
-    {
-      double h = args(0).double_value ();
-
-      if (! error_state)
-        retval = calc_dimensions (gh_manager::get_object (h));
-      else
-        error ("__calc_dimensions__: expecting graphics handle as only argument");
-    }
+  if (nargin != 1)
+    print_usage ();
+
+  double h = args(0).double_value ();
+
+  if (! error_state)
+    retval = calc_dimensions (gh_manager::get_object (h));
   else
-    print_usage ();
+    error ("__calc_dimensions__: expecting graphics handle as only argument");
 
   return retval;
 }
@@ -9505,6 +9485,16 @@
 
 gtk_manager *gtk_manager::instance = 0;
 
+gtk_manager::gtk_manager (void)
+  : dtk (), available_toolkits (), loaded_toolkits ()
+{
+#if defined (HAVE_FLTK)
+  dtk = "fltk";
+#else
+  dtk = "gnuplot";
+#endif
+}
+
 void
 gtk_manager::create_instance (void)
 {
@@ -9606,7 +9596,7 @@
 @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\
 Update figure windows and their children.  The event queue is flushed and\n\
 any callbacks generated are executed.  With the optional argument\n\
-@code{\"expose\"}, only graphic objects are updated and no other events or\n\
+@qcode{\"expose\"}, only graphic objects are updated and no other events or\n\
 callbacks are processed.\n\
 The third calling form of @code{drawnow} is for debugging and is\n\
 undocumented.\n\
@@ -9791,6 +9781,7 @@
 @end group\n\
 @end example\n\
 \n\
+@seealso{addproperty, hggroup}\n\
 @end deftypefn")
 {
   gh_manager::auto_lock guard;
@@ -9983,6 +9974,7 @@
 @end group\n\
 @end example\n\
 \n\
+@seealso{addlistener, hggroup}\n\
 @end deftypefn")
 {
   gh_manager::auto_lock guard;
@@ -10211,11 +10203,12 @@
 @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\
 @deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\
 Suspend the execution of the current program until a condition is\n\
-satisfied on the graphics handle @var{h}.  While the program is suspended\n\
-graphics events are still being processed normally, allowing callbacks to\n\
-modify the state of graphics objects.  This function is reentrant and can be\n\
-called from a callback, while another @code{waitfor} call is pending at\n\
-top-level.\n\
+satisfied on the graphics handle @var{h}.\n\
+\n\
+While the program is suspended graphics events are still being processed\n\
+normally, allowing callbacks to modify the state of graphics objects.  This\n\
+function is reentrant and can be called from a callback, while another\n\
+@code{waitfor} call is pending at the top-level.\n\
 \n\
 In the first form, program execution is suspended until the graphics object\n\
 @var{h} is destroyed.  If the graphics handle is invalid, the function\n\
@@ -10242,7 +10235,7 @@
 @code{\\timeout} instead.\n\
 \n\
 In all cases, typing CTRL-C stops program execution immediately.\n\
-@seealso{isequal}\n\
+@seealso{waitforbuttonpress, isequal}\n\
 @end deftypefn")
 {
   if (args.length () > 0)
@@ -10410,7 +10403,7 @@
 
           // FIXME: There is still a "hole" in the following loop. The code
           //        assumes that an object handle is unique, which is a fair
-          //        assumptions, except for figures. If a figure is destroyed
+          //        assumption, except for figures. If a figure is destroyed
           //        then recreated with the same figure ID, within the same
           //        run of event hooks, then the figure destruction won't be
           //        caught and the loop will not stop. This is an unlikely
--- a/libinterp/corefcn/graphics.in.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/graphics.in.h	Sat Oct 05 11:22:09 2013 -0400
@@ -37,123 +37,23 @@
 #include <string>
 
 #include "caseless-str.h"
-#include "lo-ieee.h"
 
 #include "gripes.h"
+#include "oct-handle.h"
 #include "oct-map.h"
 #include "oct-mutex.h"
 #include "oct-refcount.h"
 #include "ov.h"
 #include "txt-eng-ft.h"
 
-// FIXME -- maybe this should be a configure option?
+// FIXME: maybe this should be a configure option?
 // Matlab defaults to "Helvetica", but that causes problems for many
 // gnuplot users.
 #if !defined (OCTAVE_DEFAULT_FONTNAME)
 #define OCTAVE_DEFAULT_FONTNAME "*"
 #endif
 
-// ---------------------------------------------------------------------
-
-class graphics_handle
-{
-public:
-  graphics_handle (void) : val (octave_NaN) { }
-
-  graphics_handle (const octave_value& a);
-
-  graphics_handle (int a) : val (a) { }
-
-  graphics_handle (double a) : val (a) { }
-
-  graphics_handle (const graphics_handle& a) : val (a.val) { }
-
-  graphics_handle& operator = (const graphics_handle& a)
-  {
-    if (&a != this)
-      val = a.val;
-
-    return *this;
-  }
-
-  ~graphics_handle (void) { }
-
-  double value (void) const { return val; }
-
-  octave_value as_octave_value (void) const
-  {
-    return ok () ? octave_value (val) : octave_value (Matrix ());
-  }
-
-  // Prefix increment/decrement operators.
-  graphics_handle& operator ++ (void)
-  {
-    ++val;
-    return *this;
-  }
-
-  graphics_handle& operator -- (void)
-  {
-    --val;
-    return *this;
-  }
-
-  // Postfix increment/decrement operators.
-  const graphics_handle operator ++ (int)
-  {
-    graphics_handle old_value = *this;
-    ++(*this);
-    return old_value;
-  }
-
-  const graphics_handle operator -- (int)
-  {
-    graphics_handle old_value = *this;
-    --(*this);
-    return old_value;
-  }
-
-  bool ok (void) const { return ! xisnan (val); }
-
-private:
-  double val;
-};
-
-inline bool
-operator == (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () == b.value ();
-}
-
-inline bool
-operator != (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () != b.value ();
-}
-
-inline bool
-operator < (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () < b.value ();
-}
-
-inline bool
-operator <= (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () <= b.value ();
-}
-
-inline bool
-operator >= (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () >= b.value ();
-}
-
-inline bool
-operator > (const graphics_handle& a, const graphics_handle& b)
-{
-  return a.value () > b.value ();
-}
+typedef octave_handle graphics_handle;
 
 // ---------------------------------------------------------------------
 
@@ -1483,7 +1383,7 @@
 
       if (validate (tmp))
         {
-          // FIXME -- should we check for actual data change?
+          // FIXME: should we check for actual data change?
           if (! is_equal (tmp))
             {
               data = tmp;
@@ -2361,10 +2261,7 @@
 
 private:
 
-  // FIXME -- default toolkit should be configurable.
-
-  gtk_manager (void)
-    : dtk ("gnuplot"), available_toolkits (), loaded_toolkits () { }
+  gtk_manager (void);
 
   ~gtk_manager (void) { }
 
@@ -2628,22 +2525,22 @@
 
   static property_list::pval_map_type factory_defaults (void);
 
-  // FIXME -- these functions should be generated automatically by the
-  // genprops.awk script.
+  // FIXME: these functions should be generated automatically by the
+  //        genprops.awk script.
   //
   // EMIT_BASE_PROPERTIES_GET_FUNCTIONS
 
+  virtual octave_value get_alim (void) const { return octave_value (); }
+  virtual octave_value get_clim (void) const { return octave_value (); }
   virtual octave_value get_xlim (void) const { return octave_value (); }
   virtual octave_value get_ylim (void) const { return octave_value (); }
   virtual octave_value get_zlim (void) const { return octave_value (); }
-  virtual octave_value get_clim (void) const { return octave_value (); }
-  virtual octave_value get_alim (void) const { return octave_value (); }
-
+
+  virtual bool is_aliminclude (void) const { return false; }
+  virtual bool is_climinclude (void) const { return false; }
   virtual bool is_xliminclude (void) const { return false; }
   virtual bool is_yliminclude (void) const { return false; }
   virtual bool is_zliminclude (void) const { return false; }
-  virtual bool is_climinclude (void) const { return false; }
-  virtual bool is_aliminclude (void) const { return false; }
 
   bool is_handle_visible (void) const;
 
@@ -2679,13 +2576,12 @@
     bool_property selectionhighlight , "on"
     string_property tag s , ""
     string_property type frs , ty
+    handle_property uicontextmenu , graphics_handle ()
     any_property userdata , Matrix ()
     bool_property visible , "on"
-    // additional (octave-specific) properties
+    // additional (Octave-specific) properties
     bool_property __modified__ s , "on"
     graphics_handle __myhandle__ fhrs , mh
-    // FIXME -- should this really be here?
-    handle_property uicontextmenu , graphics_handle ()
   END_PROPERTIES
 
 protected:
@@ -3110,11 +3006,17 @@
 
   operator bool (void) const { return rep->valid_object (); }
 
-  // FIXME -- these functions should be generated automatically by the
-  // genprops.awk script.
+  // FIXME: these functions should be generated automatically by the
+  //        genprops.awk script.
   //
   // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS
 
+  octave_value get_alim (void) const
+  { return get_properties ().get_alim (); }
+
+  octave_value get_clim (void) const
+  { return get_properties ().get_clim (); }
+
   octave_value get_xlim (void) const
   { return get_properties ().get_xlim (); }
 
@@ -3124,11 +3026,11 @@
   octave_value get_zlim (void) const
   { return get_properties ().get_zlim (); }
 
-  octave_value get_clim (void) const
-  { return get_properties ().get_clim (); }
-
-  octave_value get_alim (void) const
-  { return get_properties ().get_alim (); }
+  bool is_aliminclude (void) const
+  { return get_properties ().is_aliminclude (); }
+
+  bool is_climinclude (void) const
+  { return get_properties ().is_climinclude (); }
 
   bool is_xliminclude (void) const
   { return get_properties ().is_xliminclude (); }
@@ -3139,12 +3041,6 @@
   bool is_zliminclude (void) const
   { return get_properties ().is_zliminclude (); }
 
-  bool is_climinclude (void) const
-  { return get_properties ().is_climinclude (); }
-
-  bool is_aliminclude (void) const
-  { return get_properties ().is_aliminclude (); }
-
   bool is_handle_visible (void) const
   { return get_properties ().is_handle_visible (); }
 
@@ -3187,14 +3083,22 @@
     // See the genprops.awk script for an explanation of the
     // properties declarations.
 
-    // FIXME -- it seems strange to me that the diary, diaryfile,
-    // echo, format, formatspacing, language, and recursionlimit
-    // properties are here.  WTF do they have to do with graphics?
+    // FIXME: it seems strange to me that the diary, diaryfile,
+    // echo, errormessage, format, formatspacing, language, and
+    // recursionlimit properties are here.
+    // WTF do they have to do with graphics?
     // Also note that these properties (and the monitorpositions,
     // pointerlocation, and pointerwindow properties) are not yet used
     // by Octave, so setting them will have no effect, and changes
     // made elswhere (say, the diary or format functions) will not
     // cause these properties to be updated.
+    // ANSWER: Matlab defines these properties and uses them in
+    // the same way that Octave uses an internal static variable to
+    // keep track of state.  set (0, "echo", "on") is equivalent
+    // to Octave's echo ("on").  Maybe someday we can connect callbacks
+    // that actually call Octave's own functions for this.
+
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (root_figure, root)
       handle_property callbackobject Sr , graphics_handle ()
@@ -3203,12 +3107,14 @@
       bool_property diary , "off"
       string_property diaryfile , "diary"
       bool_property echo , "off"
-      radio_property format , "+|bank|bit|debug|hex|long|longe|longeng|longg|native-bit|native-hex|rational|{short}|shorte|shorteng|shortg"
-      radio_property formatspacing , "{loose}|compact"
+      string_property errormessage , ""
+      string_property fixedwidthfontname , "Courier"
+      radio_property format , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rational|{short}|shorte|shorteng|shortg"
+      radio_property formatspacing , "compact|{loose}"
       string_property language , "ascii"
       array_property monitorpositions , Matrix (1, 4, 0)
       array_property pointerlocation , Matrix (1, 2, 0)
-      double_property pointerwindow , 0.0
+      double_property pointerwindow r , 0.0
       double_property recursionlimit , 256.0
       double_property screendepth r , default_screendepth ()
       double_property screenpixelsperinch r , default_screenpixelsperinch ()
@@ -3393,17 +3299,15 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (figure)
-      any_property __plot_stream__ h , Matrix ()
-      bool_property __enhanced__ h , "on"
-      radio_property nextplot , "new|{add}|replacechildren|replace"
+      array_property alphamap , Matrix (64, 1, 1)
+      callback_property buttondownfcn , Matrix ()
       callback_property closerequestfcn , "closereq"
+      color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
+      array_property colormap , jet_colormap ()
       handle_property currentaxes S , graphics_handle ()
-      array_property colormap , jet_colormap ()
-      radio_property paperorientation U , "{portrait}|landscape|rotated"
-      color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
-      array_property alphamap , Matrix (64, 1, 1)
       string_property currentcharacter r , ""
       handle_property currentobject r , graphics_handle ()
       array_property currentpoint r , Matrix (2, 1, 0)
@@ -3417,13 +3321,15 @@
       radio_property menubar , "none|{figure}"
       double_property mincolormap , 64
       string_property name , ""
+      radio_property nextplot , "new|{add}|replacechildren|replace"
       bool_property numbertitle , "on"
       array_property outerposition s , Matrix (1, 4, -1.0)
-      radio_property paperunits Su , "{inches}|centimeters|normalized|points"
+      radio_property paperorientation U , "{portrait}|landscape|rotated"
       array_property paperposition , default_figure_paperposition ()
       radio_property paperpositionmode , "auto|{manual}"
       array_property papersize U , default_figure_papersize ()
       radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>"
+      radio_property paperunits Su , "{inches}|centimeters|normalized|points"
       radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"
       array_property pointershapecdata , Matrix (16, 16, 0)
       array_property pointershapehotspot , Matrix (1, 2, 0)
@@ -3438,16 +3344,20 @@
       callback_property windowbuttondownfcn , Matrix ()
       callback_property windowbuttonmotionfcn , Matrix ()
       callback_property windowbuttonupfcn , Matrix ()
-      callback_property windowbuttonwheelfcn , Matrix ()
+      callback_property windowkeypressfcn , Matrix ()
+      callback_property windowkeyreleasefcn , Matrix ()
+      callback_property windowscrollwheelfcn , Matrix ()
       radio_property windowstyle , "{normal}|modal|docked"
       string_property wvisual , ""
       radio_property wvisualmode , "{auto}|manual"
       string_property xdisplay , ""
       string_property xvisual , ""
       radio_property xvisualmode , "{auto}|manual"
-      callback_property buttondownfcn , Matrix ()
-      string_property __graphics_toolkit__ s , "gnuplot"
+      // Octave-specific properties
+      bool_property __enhanced__ h , "on"
+      string_property __graphics_toolkit__ s , gtk_manager::default_toolkit ()
       any_property __guidata__ h , Matrix ()
+      any_property __plot_stream__ h , Matrix ()
     END_PROPERTIES
 
   protected:
@@ -3662,6 +3572,8 @@
         update_axes_layout ();
       }
 
+    void sync_positions (void);
+
     void update_autopos (const std::string& elem_type);
     void update_xlabel_position (void);
     void update_ylabel_position (void);
@@ -3762,80 +3674,29 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
-
-    // properties which are not in matlab: interpreter
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (axes)
-      array_property position u , default_axes_position ()
+      radio_property activepositionproperty , "{outerposition}|position"
+      row_vector_property alim m , default_lim ()
+      radio_property alimmode , "{auto}|manual"
+      color_property ambientlightcolor , color_values (1, 1, 1)
       bool_property box , "on"
+      array_property cameraposition m , Matrix (1, 3, 0.0)
+      radio_property camerapositionmode , "{auto}|manual"
+      array_property cameratarget m , Matrix (1, 3, 0.0)
+      radio_property cameratargetmode , "{auto}|manual"
+      array_property cameraupvector m , Matrix ()
+      radio_property cameraupvectormode , "{auto}|manual"
+      double_property cameraviewangle m , 10.0
+      radio_property cameraviewanglemode , "{auto}|manual"
+      row_vector_property clim m , default_lim ()
+      radio_property climmode al , "{auto}|manual"
+      color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
       array_property colororder , default_colororder ()
+      array_property currentpoint , Matrix (2, 3, 0.0)
       array_property dataaspectratio mu , Matrix (1, 3, 1.0)
       radio_property dataaspectratiomode u , "{auto}|manual"
-      radio_property layer u , "{bottom}|top"
-      row_vector_property xlim mu , default_lim ()
-      row_vector_property ylim mu , default_lim ()
-      row_vector_property zlim mu , default_lim ()
-      row_vector_property clim m , default_lim ()
-      row_vector_property alim m , default_lim ()
-      radio_property xlimmode al , "{auto}|manual"
-      radio_property ylimmode al , "{auto}|manual"
-      radio_property zlimmode al , "{auto}|manual"
-      radio_property climmode al , "{auto}|manual"
-      radio_property alimmode    , "{auto}|manual"
-      handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
-      handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
-      handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
-      handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
-      bool_property xgrid , "off"
-      bool_property ygrid , "off"
-      bool_property zgrid , "off"
-      bool_property xminorgrid , "off"
-      bool_property yminorgrid , "off"
-      bool_property zminorgrid , "off"
-      row_vector_property xtick mu , default_axes_tick ()
-      row_vector_property ytick mu , default_axes_tick ()
-      row_vector_property ztick mu , default_axes_tick ()
-      radio_property xtickmode u , "{auto}|manual"
-      radio_property ytickmode u , "{auto}|manual"
-      radio_property ztickmode u , "{auto}|manual"
-      bool_property xminortick , "off"
-      bool_property yminortick , "off"
-      bool_property zminortick , "off"
-      // FIXME -- should be kind of string array.
-      any_property xticklabel S , ""
-      any_property yticklabel S , ""
-      any_property zticklabel S , ""
-      radio_property xticklabelmode u , "{auto}|manual"
-      radio_property yticklabelmode u , "{auto}|manual"
-      radio_property zticklabelmode u , "{auto}|manual"
-      radio_property interpreter , "tex|{none}|latex"
-      color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
-      color_property xcolor , color_values (0, 0, 0)
-      color_property ycolor , color_values (0, 0, 0)
-      color_property zcolor , color_values (0, 0, 0)
-      radio_property xscale alu , "{linear}|log"
-      radio_property yscale alu , "{linear}|log"
-      radio_property zscale alu , "{linear}|log"
-      radio_property xdir u , "{normal}|reverse"
-      radio_property ydir u , "{normal}|reverse"
-      radio_property zdir u , "{normal}|reverse"
-      radio_property yaxislocation u , "{left}|right|zero"
-      radio_property xaxislocation u , "{bottom}|top|zero"
-      array_property view u , Matrix ()
-      bool_property __hold_all__ h , "off"
-      radio_property nextplot , "new|add|replacechildren|{replace}"
-      array_property outerposition u , default_axes_outerposition ()
-      radio_property activepositionproperty , "{outerposition}|position"
-      color_property ambientlightcolor , color_values (1, 1, 1)
-      array_property cameraposition m , Matrix (1, 3, 0.0)
-      array_property cameratarget m , Matrix (1, 3, 0.0)
-      array_property cameraupvector m , Matrix ()
-      double_property cameraviewangle m , 10.0
-      radio_property camerapositionmode , "{auto}|manual"
-      radio_property cameratargetmode , "{auto}|manual"
-      radio_property cameraupvectormode , "{auto}|manual"
-      radio_property cameraviewanglemode , "{auto}|manual"
-      array_property currentpoint , Matrix (2, 3, 0.0)
       radio_property drawmode , "{normal}|fast"
       radio_property fontangle u , "{normal}|italic|oblique"
       string_property fontname u , OCTAVE_DEFAULT_FONTNAME
@@ -3843,18 +3704,76 @@
       radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels"
       radio_property fontweight u , "{normal}|light|demi|bold"
       radio_property gridlinestyle , "-|--|{:}|-.|none"
-      string_array_property linestyleorder , "-"
+      // NOTE: interpreter is not a Matlab axis property, but it makes
+      //       more sense to have it so that axis ticklabels can use it.
+      radio_property interpreter , "tex|{none}|latex"
+      radio_property layer u , "{bottom}|top"
+      // FIXME: should be kind of string array.
+      any_property linestyleorder S , "-"
       double_property linewidth , 0.5
       radio_property minorgridlinestyle , "-|--|{:}|-.|none"
+      radio_property nextplot , "add|replacechildren|{replace}"
+      array_property outerposition u , default_axes_outerposition ()
       array_property plotboxaspectratio mu , Matrix (1, 3, 1.0)
       radio_property plotboxaspectratiomode u , "{auto}|manual"
+      array_property position u , default_axes_position ()
       radio_property projection , "{orthographic}|perpective"
       radio_property tickdir mu , "{in}|out"
       radio_property tickdirmode u , "{auto}|manual"
       array_property ticklength u , default_axes_ticklength ()
       array_property tightinset r , Matrix (1, 4, 0.0)
-      // FIXME -- uicontextmenu should be moved here.
+      handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
+      // FIXME: uicontextmenu should be moved here.
       radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters"
+      array_property view u , Matrix ()
+      radio_property xaxislocation u , "{bottom}|top|zero"
+      color_property xcolor , color_values (0, 0, 0)
+      radio_property xdir u , "{normal}|reverse"
+      bool_property xgrid , "off"
+      handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
+      row_vector_property xlim mu , default_lim ()
+      radio_property xlimmode al , "{auto}|manual"
+      bool_property xminorgrid , "off"
+      bool_property xminortick , "off"
+      radio_property xscale alu , "{linear}|log"
+      row_vector_property xtick mu , default_axes_tick ()
+      // FIXME: should be kind of string array.
+      any_property xticklabel S , ""
+      radio_property xticklabelmode u , "{auto}|manual"
+      radio_property xtickmode u , "{auto}|manual"
+      radio_property yaxislocation u , "{left}|right|zero"
+      color_property ycolor , color_values (0, 0, 0)
+      radio_property ydir u , "{normal}|reverse"
+      bool_property ygrid , "off"
+      handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
+      row_vector_property ylim mu , default_lim ()
+      radio_property ylimmode al , "{auto}|manual"
+      bool_property yminorgrid , "off"
+      bool_property yminortick , "off"
+      radio_property yscale alu , "{linear}|log"
+      row_vector_property ytick mu , default_axes_tick ()
+      any_property yticklabel S , ""
+      radio_property yticklabelmode u , "{auto}|manual"
+      radio_property ytickmode u , "{auto}|manual"
+      color_property zcolor , color_values (0, 0, 0)
+      radio_property zdir u , "{normal}|reverse"
+      bool_property zgrid , "off"
+      handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
+      row_vector_property zlim mu , default_lim ()
+      radio_property zlimmode al , "{auto}|manual"
+      bool_property zminorgrid , "off"
+      bool_property zminortick , "off"
+      radio_property zscale alu , "{linear}|log"
+      row_vector_property ztick mu , default_axes_tick ()
+      any_property zticklabel S , ""
+      radio_property zticklabelmode u , "{auto}|manual"
+      radio_property ztickmode u , "{auto}|manual"
+      // Octave-specific properties
+      bool_property __hold_all__ h , "off"
+      // hidden properties for alignment of subplots
+      radio_property autopos_tag h , "{none}|subplot"
+      // hidden properties for inset
+      array_property looseinset hu , Matrix (1, 4, 0.0)
       // hidden properties for transformation computation
       array_property x_viewtransform h , Matrix (4, 4, 0.0)
       array_property x_projectiontransform h , Matrix (4, 4, 0.0)
@@ -3865,10 +3784,6 @@
       row_vector_property xmtick h , Matrix ()
       row_vector_property ymtick h , Matrix ()
       row_vector_property zmtick h , Matrix ()
-      // hidden properties for inset
-      array_property looseinset hu , Matrix (1, 4, 0.0)
-      // hidden properties for alignment of subplots
-      radio_property autopos_tag h , "{none}|subplot"
    END_PROPERTIES
 
   protected:
@@ -3991,24 +3906,85 @@
     void update_fontangle (void) { update_font (); }
     void update_fontweight (void) { update_font (); }
 
-    void sync_positions (const Matrix& linset);
-    void sync_positions (void);
-
-    void update_insets (void);
-
     void update_outerposition (void)
     {
       set_activepositionproperty ("outerposition");
-      sync_positions ();
+      caseless_str old_units = get_units ();
+      set_units ("normalized");
+      Matrix outerbox = outerposition.get ().matrix_value ();
+      Matrix innerbox = position.get ().matrix_value ();
+      Matrix linset = looseinset.get ().matrix_value ();
+      Matrix tinset = tightinset.get ().matrix_value ();
+      outerbox(2) = outerbox(2) + outerbox(0);
+      outerbox(3) = outerbox(3) + outerbox(1);
+      innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
+      innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
+      innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
+      innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
+      innerbox(2) = innerbox(2) - innerbox(0);
+      innerbox(3) = innerbox(3) - innerbox(1);
+      position = innerbox;
+      set_units (old_units);
+      update_transform ();
     }
 
     void update_position (void)
     {
       set_activepositionproperty ("position");
-      sync_positions ();
+      caseless_str old_units = get_units ();
+      set_units ("normalized");
+      Matrix outerbox = outerposition.get ().matrix_value ();
+      Matrix innerbox = position.get ().matrix_value ();
+      Matrix linset = looseinset.get ().matrix_value ();
+      Matrix tinset = tightinset.get ().matrix_value ();
+      innerbox(2) = innerbox(2) + innerbox(0);
+      innerbox(3) = innerbox(3) + innerbox(1);
+      outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
+      outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
+      outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
+      outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
+      outerbox(2) = outerbox(2) - outerbox(0);
+      outerbox(3) = outerbox(3) - outerbox(1);
+      outerposition = outerbox;
+      set_units (old_units);
+      update_transform ();
     }
 
-    void update_looseinset (void) { sync_positions (); }
+    void update_looseinset (void)
+      {
+        caseless_str old_units = get_units ();
+        set_units ("normalized");
+        Matrix innerbox = position.get ().matrix_value ();
+        innerbox(2) = innerbox(2) + innerbox(0);
+        innerbox(3) = innerbox(3) + innerbox(1);
+        Matrix outerbox = outerposition.get ().matrix_value ();
+        outerbox(2) = outerbox(2) + outerbox(0);
+        outerbox(3) = outerbox(3) + outerbox(1);
+        Matrix linset = looseinset.get ().matrix_value ();
+        Matrix tinset = tightinset.get ().matrix_value ();
+        if (activepositionproperty.is ("position"))
+          {
+            outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
+            outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
+            outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
+            outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
+            outerbox(2) = outerbox(2) - outerbox(0);
+            outerbox(3) = outerbox(3) - outerbox(1);
+            outerposition = outerbox;
+          }
+        else
+          {
+            innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
+            innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
+            innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
+            innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
+            innerbox(2) = innerbox(2) - innerbox(0);
+            innerbox(3) = innerbox(3) - innerbox(1);
+            position = innerbox;
+          }
+        set_units (old_units);
+        update_transform ();
+      }
 
     double calc_tick_sep (double minval, double maxval);
     void calc_ticks_and_lims (array_property& lims, array_property& ticks, array_property& mticks,
@@ -4145,7 +4121,7 @@
   {
     octave_value retval;
 
-    // FIXME -- finish this.
+    // FIXME: finish this.
     if (name.compare ("default", 7))
       retval = get_default (name.substr (7));
     else
@@ -4191,26 +4167,28 @@
   public:
     // See the genprops.awk script for an explanation of the
     // properties declarations.
-
-    // properties which are not in matlab: interpreter
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (line)
-      row_vector_property xdata u , default_data ()
-      row_vector_property ydata u , default_data ()
-      row_vector_property zdata u , Matrix ()
-      string_property xdatasource , ""
-      string_property ydatasource , ""
-      string_property zdatasource , ""
       color_property color , color_values (0, 0, 0)
+      string_property displayname , ""
+      radio_property erasemode , "{normal}|none|xor|background"
+      // FIXME: interpreter is not a property of Matlab line objects.
+      //        Octave uses this for legend() with the string displayname.
+      radio_property interpreter , "{tex}|none|latex"
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
+      radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
       color_property markeredgecolor , "{auto}|none"
       color_property markerfacecolor , "auto|{none}"
       double_property markersize , 6
-      radio_property interpreter , "{tex}|none|latex"
-      string_property displayname , ""
-      radio_property erasemode , "{normal}|none|xor|background"
+      row_vector_property xdata u , default_data ()
+      string_property xdatasource , ""
+      row_vector_property ydata u , default_data ()
+      string_property ydatasource , ""
+      row_vector_property zdata u , Matrix ()
+      string_property zdatasource , ""
+
       // hidden properties for limit computation
       row_vector_property xlim hlr , Matrix ()
       row_vector_property ylim hlr , Matrix ()
@@ -4293,28 +4271,29 @@
     // properties declarations.
 
     BEGIN_PROPERTIES (text)
-      text_label_property string u , ""
-      radio_property units u , "{data}|pixels|normalized|inches|centimeters|points"
-      array_property position smu , Matrix (1, 3, 0.0)
-      double_property rotation mu , 0
-      radio_property horizontalalignment mu , "{left}|center|right"
+      color_property backgroundcolor , "{none}"
       color_property color u , color_values (0, 0, 0)
+      string_property displayname , ""
+      color_property edgecolor , "{none}"
+      bool_property editing , "off"
+      radio_property erasemode , "{normal}|none|xor|background"
+      array_property extent rG , Matrix (1, 4, 0.0)
+      radio_property fontangle u , "{normal}|italic|oblique"
       string_property fontname u , OCTAVE_DEFAULT_FONTNAME
       double_property fontsize u , 10
-      radio_property fontangle u , "{normal}|italic|oblique"
+      radio_property fontunits , "inches|centimeters|normalized|{points}|pixels"
       radio_property fontweight u , "light|{normal}|demi|bold"
+      radio_property horizontalalignment mu , "{left}|center|right"
       radio_property interpreter u , "{tex}|none|latex"
-      color_property backgroundcolor , "{none}"
-      string_property displayname , ""
-      color_property edgecolor , "{none}"
-      radio_property erasemode , "{normal}|none|xor|background"
-      bool_property editing , "off"
-      radio_property fontunits , "inches|centimeters|normalized|{points}|pixels"
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
       double_property margin , 1
+      array_property position smu , Matrix (1, 3, 0.0)
+      double_property rotation mu , 0
+      text_label_property string u , ""
+      radio_property units u , "{data}|pixels|normalized|inches|centimeters|points"
       radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom"
-      array_property extent rG , Matrix (1, 4, 0.0)
+
       // hidden properties for limit computation
       row_vector_property xlim hlr , Matrix ()
       row_vector_property ylim hlr , Matrix ()
@@ -4426,6 +4405,11 @@
   class OCTINTERP_API properties : public base_properties
   {
   public:
+    bool is_aliminclude (void) const
+      { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
+    std::string get_aliminclude (void) const
+      { return aliminclude.current_value (); }
+
     bool is_climinclude (void) const
       { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
     std::string get_climinclude (void) const
@@ -4435,19 +4419,25 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (image)
+      array_property alphadata u , Matrix ()
+      radio_property alphadatamapping al , "none|direct|{scaled}"
+      array_property cdata u , Matrix ()
+      radio_property cdatamapping al , "scaled|{direct}"
+      radio_property erasemode , "{normal}|none|xor|background"
       row_vector_property xdata u , Matrix ()
       row_vector_property ydata u , Matrix ()
-      array_property cdata u , Matrix ()
-      radio_property cdatamapping al , "{scaled}|direct"
       // hidden properties for limit computation
+      row_vector_property alim hlr , Matrix ()
+      row_vector_property clim hlr , Matrix ()
       row_vector_property xlim hlr , Matrix ()
       row_vector_property ylim hlr , Matrix ()
-      row_vector_property clim hlr , Matrix ()
+      bool_property aliminclude hlg , "on"
+      bool_property climinclude hlg , "on"
       bool_property xliminclude hl , "on"
       bool_property yliminclude hl , "on"
-      bool_property climinclude hlg , "on"
     END_PROPERTIES
 
   protected:
@@ -4467,6 +4457,22 @@
       }
 
   private:
+    void update_alphadata (void)
+      {
+        if (alphadatamapping_is ("scaled"))
+          set_alim (alphadata.get_limits ());
+        else
+          alim = alphadata.get_limits ();
+      }
+
+    void update_cdata (void)
+      {
+        if (cdatamapping_is ("scaled"))
+          set_clim (cdata.get_limits ());
+        else
+          clim = cdata.get_limits ();
+      }
+
     void update_xdata (void)
     {
       Matrix limits = xdata.get_limits ();
@@ -4487,14 +4493,6 @@
       set_ylim (limits);
     }
 
-    void update_cdata (void)
-      {
-        if (cdatamapping_is ("scaled"))
-          set_clim (cdata.get_limits ());
-        else
-          clim = cdata.get_limits ();
-      }
-
     float pixel_size (octave_idx_type dim, const Matrix limits)
     {
       octave_idx_type l = dim - 1;
@@ -4553,64 +4551,69 @@
   public:
     octave_value get_color_data (void) const;
 
-    bool is_climinclude (void) const
-      { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
-    std::string get_climinclude (void) const
-      { return climinclude.current_value (); }
-
     bool is_aliminclude (void) const
       { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
     std::string get_aliminclude (void) const
       { return aliminclude.current_value (); }
 
+    bool is_climinclude (void) const
+      { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
+    std::string get_climinclude (void) const
+      { return climinclude.current_value (); }
+
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (patch)
-      array_property xdata u , Matrix ()
-      array_property ydata u , Matrix ()
-      array_property zdata u , Matrix ()
+      radio_property alphadatamapping l , "none|{scaled}|direct"
+      double_property ambientstrength , 0.3
+      radio_property backfacelighting , "unlit|lit|{reverselit}"
       array_property cdata u , Matrix ()
       radio_property cdatamapping l , "{scaled}|direct"
+      double_property diffusestrength , 0.6
+      string_property displayname , ""
+      double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
+      color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
+      radio_property edgelighting , "{none}|flat|gouraud|phong"
+      radio_property erasemode , "{normal}|background|xor|none"
+      double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
+      color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
+      radio_property facelighting , "{none}|flat|gouraud|phong"
       array_property faces , Matrix ()
       array_property facevertexalphadata , Matrix ()
       array_property facevertexcdata , Matrix ()
-      array_property vertices , Matrix ()
-      array_property vertexnormals , Matrix ()
-      radio_property normalmode , "{auto}|manual"
-      color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
-      double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
-      radio_property facelighting , "flat|{none}|gouraud|phong"
-      color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
-      double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
-      radio_property edgelighting , "{none}|flat|gouraud|phong"
-      radio_property backfacelighting , "{reverselit}|unlit|lit"
-      double_property ambientstrength , 0.3
-      double_property diffusestrength , 0.6
-      double_property specularstrength , 0.6
-      double_property specularexponent , 10.0
-      double_property specularcolorreflectance , 1.0
-      radio_property erasemode , "{normal}|background|xor|none"
+      // FIXME: interpreter is not a property of a Matlab patch.
+      //        Octave uses this for legend() with the string displayname.
+      radio_property interpreter , "{tex}|none|latex"
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
-      color_property markeredgecolor , "{auto}|none|flat"
-      color_property markerfacecolor , "auto|{none}|flat"
+      radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
+      //radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h"
+      color_property markeredgecolor , "none|{auto}|flat"
+      color_property markerfacecolor , "{none}|auto|flat"
       double_property markersize , 6
-      radio_property interpreter , "{tex}|none|latex"
-      string_property displayname , ""
-      radio_property alphadatamapping l , "none|{scaled}|direct"
+      radio_property normalmode , "{auto}|manual"
+      double_property specularcolorreflectance , 1.0
+      double_property specularexponent , 10.0
+      double_property specularstrength , 0.6
+      array_property vertexnormals , Matrix ()
+      array_property vertices , Matrix ()
+      array_property xdata u , Matrix ()
+      array_property ydata u , Matrix ()
+      array_property zdata u , Matrix ()
+
       // hidden properties for limit computation
+      row_vector_property alim hlr , Matrix ()
+      row_vector_property clim hlr , Matrix ()
       row_vector_property xlim hlr , Matrix ()
       row_vector_property ylim hlr , Matrix ()
       row_vector_property zlim hlr , Matrix ()
-      row_vector_property clim hlr , Matrix ()
-      row_vector_property alim hlr , Matrix ()
+      bool_property aliminclude hlg , "on"
+      bool_property climinclude hlg , "on"
       bool_property xliminclude hl , "on"
       bool_property yliminclude hl , "on"
       bool_property zliminclude hl , "on"
-      bool_property climinclude hlg , "on"
-      bool_property aliminclude hlg , "on"
     END_PROPERTIES
 
   protected:
@@ -4671,66 +4674,71 @@
   public:
     octave_value get_color_data (void) const;
 
-    bool is_climinclude (void) const
-      { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
-    std::string get_climinclude (void) const
-      { return climinclude.current_value (); }
-
     bool is_aliminclude (void) const
       { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
     std::string get_aliminclude (void) const
       { return aliminclude.current_value (); }
 
+    bool is_climinclude (void) const
+      { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
+    std::string get_climinclude (void) const
+      { return climinclude.current_value (); }
+
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (surface)
-      array_property xdata u , Matrix ()
-      array_property ydata u , Matrix ()
-      array_property zdata u , Matrix ()
-      array_property cdata u , Matrix ()
-      radio_property cdatamapping al , "{scaled}|direct"
-      string_property xdatasource , ""
-      string_property ydatasource , ""
-      string_property zdatasource , ""
-      string_property cdatasource , ""
-      color_property facecolor , "{flat}|none|interp|texturemap"
-      double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
-      color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
-      radio_property linestyle , "{-}|--|:|-.|none"
-      double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
-      color_property markeredgecolor , "{auto}|none"
-      color_property markerfacecolor , "auto|{none}"
-      double_property markersize , 6
-      radio_property interpreter , "{tex}|none|latex"
-      string_property displayname , ""
       array_property alphadata u , Matrix ()
       radio_property alphadatamapping l , "none|direct|{scaled}"
       double_property ambientstrength , 0.3
       radio_property backfacelighting , "unlit|lit|{reverselit}"
+      array_property cdata u , Matrix ()
+      radio_property cdatamapping al , "{scaled}|direct"
+      string_property cdatasource , ""
       double_property diffusestrength , 0.6
+      string_property displayname , ""
       double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
+      color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
       radio_property edgelighting , "{none}|flat|gouraud|phong"
       radio_property erasemode , "{normal}|none|xor|background"
+      double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap"))
+      color_property facecolor , "none|{flat}|interp|texturemap"
       radio_property facelighting , "{none}|flat|gouraud|phong"
+      // FIXME: interpreter is not a Matlab surface property
+      //        Octave uses this for legend() with the string displayname.
+      radio_property interpreter , "{tex}|none|latex"
+      radio_property linestyle , "{-}|--|:|-.|none"
+      double_property linewidth , 0.5
+      radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
+      //radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h"
+      color_property markeredgecolor , "none|{auto}|flat"
+      color_property markerfacecolor , "{none}|auto|flat"
+      double_property markersize , 6
       radio_property meshstyle , "{both}|row|column"
       radio_property normalmode u , "{auto}|manual"
       double_property specularcolorreflectance , 1
       double_property specularexponent , 10
       double_property specularstrength , 0.9
       array_property vertexnormals u , Matrix ()
+      array_property xdata u , Matrix ()
+      string_property xdatasource , ""
+      array_property ydata u , Matrix ()
+      string_property ydatasource , ""
+      array_property zdata u , Matrix ()
+      string_property zdatasource , ""
+
       // hidden properties for limit computation
+      row_vector_property alim hlr , Matrix ()
+      row_vector_property clim hlr , Matrix ()
       row_vector_property xlim hlr , Matrix ()
       row_vector_property ylim hlr , Matrix ()
       row_vector_property zlim hlr , Matrix ()
-      row_vector_property clim hlr , Matrix ()
-      row_vector_property alim hlr , Matrix ()
+      bool_property aliminclude hlg , "on"
+      bool_property climinclude hlg , "on"
       bool_property xliminclude hl , "on"
       bool_property yliminclude hl , "on"
       bool_property zliminclude hl , "on"
-      bool_property climinclude hlg , "on"
-      bool_property aliminclude hlg , "on"
     END_PROPERTIES
 
   protected:
@@ -4752,7 +4760,21 @@
       }
 
   private:
-    void update_normals (void);
+    void update_alphadata (void)
+      {
+        if (alphadatamapping_is ("scaled"))
+          set_alim (alphadata.get_limits ());
+        else
+          alim = alphadata.get_limits ();
+      }
+
+    void update_cdata (void)
+      {
+        if (cdatamapping_is ("scaled"))
+          set_clim (cdata.get_limits ());
+        else
+          clim = cdata.get_limits ();
+      }
 
     void update_xdata (void)
       {
@@ -4772,21 +4794,7 @@
         set_zlim (zdata.get_limits ());
       }
 
-    void update_cdata (void)
-      {
-        if (cdatamapping_is ("scaled"))
-          set_clim (cdata.get_limits ());
-        else
-          clim = cdata.get_limits ();
-      }
-
-    void update_alphadata (void)
-      {
-        if (alphadatamapping_is ("scaled"))
-          set_alim (alphadata.get_limits ());
-        else
-          alim = alphadata.get_limits ();
-      }
+    void update_normals (void);
 
     void update_normalmode (void)
       { update_normals (); }
@@ -4837,21 +4845,23 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (hggroup)
       string_property displayname , ""
       radio_property erasemode , "{normal}|none|xor|background"
+
       // hidden properties for limit computation
+      row_vector_property alim hr , Matrix ()
+      row_vector_property clim hr , Matrix ()
       row_vector_property xlim hr , Matrix ()
       row_vector_property ylim hr , Matrix ()
       row_vector_property zlim hr , Matrix ()
-      row_vector_property clim hr , Matrix ()
-      row_vector_property alim hr , Matrix ()
+      bool_property aliminclude h , "on"
+      bool_property climinclude h , "on"
       bool_property xliminclude h , "on"
       bool_property yliminclude h , "on"
       bool_property zliminclude h , "on"
-      bool_property climinclude h , "on"
-      bool_property aliminclude h , "on"
     END_PROPERTIES
 
   private:
@@ -4910,6 +4920,7 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uimenu)
       any_property __object__ , Matrix ()
@@ -4921,6 +4932,7 @@
       string_property label , ""
       double_property position , 9
       bool_property separator , "off"
+      // Octave-specific properties
       string_property fltk_label h , ""
     END_PROPERTIES
 
@@ -4959,6 +4971,7 @@
   public:
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uicontextmenu)
       any_property __object__ , Matrix ()
@@ -5010,6 +5023,7 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uicontrol)
       any_property __object__ , Matrix ()
@@ -5025,7 +5039,7 @@
       radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
       radio_property fontweight u , "light|{normal}|demi|bold"
       color_property foregroundcolor , color_values (0, 0, 0)
-      radio_property horizontalalignment , "{left}|center|right"
+      radio_property horizontalalignment , "left|{center}|right"
       callback_property keypressfcn , Matrix ()
       double_property listboxtop , 1
       double_property max , 1
@@ -5102,6 +5116,7 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uipanel)
       any_property __object__ , Matrix ()
@@ -5163,6 +5178,7 @@
   public:
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uitoolbar)
       any_property __object__ , Matrix ()
@@ -5251,6 +5267,7 @@
   public:
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uipushtool)
       any_property __object__ , Matrix ()
@@ -5301,6 +5318,7 @@
   public:
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (uitoggletool)
       any_property __object__ , Matrix ()
--- a/libinterp/corefcn/gripes.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/gripes.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -236,3 +236,11 @@
   warning_with_id ("Octave:matlab-incompatible",
                    "potential Matlab compatibility problem: comparing complex numbers");
 }
+
+void
+gripe_disabled_feature (const std::string& func, const std::string& feature,
+                        const std::string& pkg /*="Octave"*/)
+{
+  error ("%s: support for %s was disabled when %s was built",
+         func.c_str (), feature.c_str (), pkg.c_str ());
+}
--- a/libinterp/corefcn/gripes.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/gripes.h	Sat Oct 05 11:22:09 2013 -0400
@@ -127,4 +127,7 @@
 extern OCTINTERP_API void
 gripe_warn_complex_cmp (void);
 
+extern OCTINTERP_API void
+gripe_disabled_feature (const std::string& func, const std::string& feature,
+                        const std::string& pkg="Octave");
 #endif
--- a/libinterp/corefcn/help.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/help.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -641,8 +641,8 @@
 
   pair_type ("parfor",
     "-*- texinfo -*-\n\
-@deftypefn  {Keyword} {} for @var{i} = @var{range}\n\
-@deftypefnx {Keyword} {} for (@var{i} = @var{range}, @var{maxproc})\n\
+@deftypefn  {Keyword} {} parfor @var{i} = @var{range}\n\
+@deftypefnx {Keyword} {} parfor (@var{i} = @var{range}, @var{maxproc})\n\
 Begin a for loop that may execute in parallel.\n\
 \n\
 @example\n\
@@ -967,7 +967,7 @@
   if (file)
     {
       // Ignore header;
-      file.ignore (1000, 0x1f);
+      file.ignore (1000, 0x1d);
 
       if (file.gcount () == 1000)
         {
@@ -988,7 +988,7 @@
 
       while (! file.eof ())
         {
-          file.getline (buf, bufsize, 0x1f);
+          file.getline (buf, bufsize, 0x1d);
 
           std::string tmp (buf);
 
@@ -1066,8 +1066,8 @@
 Return the raw help text of function @var{name}.\n\
 \n\
 The raw help text is returned in @var{text} and the format in @var{format}\n\
-The format is a string which is one of @t{\"texinfo\"}, @t{\"html\"}, or\n\
-@t{\"plain text\"}.\n\
+The format is a string which is one of @qcode{\"texinfo\"},\n\
+@qcode{\"html\"}, or @qcode{\"plain text\"}.\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -1135,8 +1135,8 @@
 Return the raw help text from the file @var{fname}.\n\
 \n\
 The raw help text is returned in @var{text} and the format in @var{format}\n\
-The format is a string which is one of @t{\"texinfo\"}, @t{\"html\"}, or\n\
-@t{\"plain text\"}.\n\
+The format is a string which is one of @qcode{\"texinfo\"},\n\
+@qcode{\"html\"}, or @qcode{\"plain text\"}.\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -1398,9 +1398,9 @@
 @w{@env{OCTAVE_DOC_CACHE_FILE}}, or the command line argument\n\
 @samp{--doc-cache-file FNAME}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{doc_cache_create, lookfor, info_program, doc, help, makeinfo_program}\n\
 @end deftypefn")
 {
@@ -1422,9 +1422,9 @@
 @w{@env{OCTAVE_TEXI_MACROS_FILE}}, or the command line argument\n\
 @samp{--texi-macros-file FNAME}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{makeinfo_program}\n\
 @end deftypefn")
 {
@@ -1444,9 +1444,9 @@
 @w{@env{OCTAVE_INFO_FILE}}, or the command line argument\n\
 @samp{--info-file FNAME}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{info_program, doc, help, makeinfo_program}\n\
 @end deftypefn")
 {
@@ -1468,9 +1468,9 @@
 @w{@env{OCTAVE_INFO_PROGRAM}}, or the command line argument\n\
 @samp{--info-program NAME}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{info_file, doc, help, makeinfo_program}\n\
 @end deftypefn")
 {
@@ -1486,9 +1486,9 @@
 program that Octave runs to format help text containing\n\
 Texinfo markup commands.  The default value is @code{makeinfo}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{texi_macros_file, info_file, info_program, doc, help}\n\
 @end deftypefn")
 {
@@ -1504,9 +1504,9 @@
 will add additional help information to the end of the output from\n\
 the @code{help} command and usage messages for built-in commands.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (suppress_verbose_help_message);
--- a/libinterp/corefcn/hess.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/hess.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -60,6 +60,7 @@
 The Hessenberg decomposition is usually used as the first step in an\n\
 eigenvalue computation, but has other applications as well (see Golub,\n\
 Nash, and Van Loan, IEEE Transactions on Automatic Control, 1979).\n\
+@seealso{eig, chol, lu, qr, qz, schur, svd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
--- a/libinterp/corefcn/hex2num.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/hex2num.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -34,10 +34,11 @@
 
 DEFUN (hex2num, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {@var{n} =} hex2num (@var{s})\n\
+@deftypefn  {Built-in Function} {@var{n} =} hex2num (@var{s})\n\
+@deftypefnx {Built-in Function} {@var{n} =} hex2num (@var{s}, @var{class})\n\
 Typecast the 16 character hexadecimal character string to an IEEE 754\n\
 double precision number.  If fewer than 16 characters are given the\n\
-strings are right padded with '0' characters.\n\
+strings are right padded with @qcode{'0'} characters.\n\
 \n\
 Given a string matrix, @code{hex2num} treats each row as a separate\n\
 number.\n\
@@ -48,70 +49,142 @@
    @result{} [2.7183; 10.000]\n\
 @end group\n\
 @end example\n\
+\n\
+The optional argument @var{class} can be passed as the string\n\
+@qcode{\"single\"} to specify that the given string should be interpreted as\n\
+a single precision number.  In this case, @var{s} should be an 8 character\n\
+hexadecimal string.  For example: \n\
+\n\
+@example\n\
+@group\n\
+hex2num ([\"402df854\"; \"41200000\"], \"single\")\n\
+   @result{} [2.7183; 10.000]\n\
+@end group\n\
+@end example\n\
 @seealso{num2hex, hex2dec, dec2hex}\n\
 @end deftypefn")
 {
   int nargin = args.length ();
   octave_value retval;
 
-  if (nargin != 1)
+  if (nargin < 1 || nargin > 2)
     print_usage ();
+  else if (nargin == 2 && ! args(1).is_string ())
+    error ("hex2num: CLASS must be a string");
   else
     {
       const charMatrix cmat = args(0).char_matrix_value ();
+      std::string prec = (nargin == 2) ? args(1).string_value () : "double";
+      bool is_single = (prec == "single");
+      octave_idx_type nchars = (is_single) ? 8 : 16;
 
-      if (cmat.columns () > 16)
-        error ("hex2num: S must be no more than 16 characters");
+      if (cmat.columns () > nchars)
+        error ("hex2num: S must be no more than %d characters", nchars);
+      else if (prec != "double" && prec != "single")
+        error ("hex2num: CLASS must be either \"double\" or \"single\"");
       else if (! error_state)
         {
           octave_idx_type nr = cmat.rows ();
           octave_idx_type nc = cmat.columns ();
-          ColumnVector m (nr);
 
-          for (octave_idx_type i = 0; i < nr; i++)
+          if (is_single)
             {
-              union
-              {
-                uint64_t ival;
-                double dval;
-              } num;
+              FloatColumnVector m (nr);
 
-              num.ival = 0;
+              for (octave_idx_type i = 0; i < nr; i++)
+                {
+                  union
+                  {
+                    uint32_t ival;
+                    float dval;
+                  } num;
+
+                  num.ival = 0;
+
+                  for (octave_idx_type j = 0; j < nc; j++)
+                    {
+                      unsigned char ch = cmat.elem (i, j);
 
-              for (octave_idx_type j = 0; j < nc; j++)
-                {
-                  unsigned char ch = cmat.elem (i, j);
+                      if (isxdigit (ch))
+                        {
+                          num.ival <<= 4;
+                          if (ch >= 'a')
+                            num.ival += static_cast<uint32_t> (ch - 'a' + 10);
+                          else if (ch >= 'A')
+                            num.ival += static_cast<uint32_t> (ch - 'A' + 10);
+                          else
+                            num.ival += static_cast<uint32_t> (ch - '0');
+                        }
+                      else
+                        {
+                          error ("hex2num: illegal character found in string S");
+                          break;
+                        }
+                    }
 
-                  if (isxdigit (ch))
-                    {
-                      num.ival <<= 4;
-                      if (ch >= 'a')
-                        num.ival += static_cast<uint64_t> (ch - 'a' + 10);
-                      else if (ch >= 'A')
-                        num.ival += static_cast<uint64_t> (ch - 'A' + 10);
-                      else
-                        num.ival += static_cast<uint64_t> (ch - '0');
-                    }
+                  if (error_state)
+                    break;
                   else
                     {
-                      error ("hex2num: illegal character found in string S");
-                      break;
+                      if (nc < nchars)
+                        num.ival <<= (nchars - nc) * 4;
+
+                      m(i) = num.dval;
                     }
                 }
 
-              if (error_state)
-                break;
-              else
+              if (! error_state)
+                retval =  m;
+            }
+          else
+            {
+              ColumnVector m (nr);
+
+              for (octave_idx_type i = 0; i < nr; i++)
                 {
-                  if (nc < 16)
-                    num.ival <<= (16 - nc) * 4;
+                  union
+                  {
+                    uint64_t ival;
+                    double dval;
+                  } num;
+
+                  num.ival = 0;
+
+                  for (octave_idx_type j = 0; j < nc; j++)
+                    {
+                      unsigned char ch = cmat.elem (i, j);
 
-                  m(i) = num.dval;
+                      if (isxdigit (ch))
+                        {
+                          num.ival <<= 4;
+                          if (ch >= 'a')
+                            num.ival += static_cast<uint64_t> (ch - 'a' + 10);
+                          else if (ch >= 'A')
+                            num.ival += static_cast<uint64_t> (ch - 'A' + 10);
+                          else
+                            num.ival += static_cast<uint64_t> (ch - '0');
+                        }
+                      else
+                        {
+                          error ("hex2num: illegal character found in string S");
+                          break;
+                        }
+                    }
+
+                  if (error_state)
+                    break;
+                  else
+                    {
+                      if (nc < nchars)
+                        num.ival <<= (nchars - nc) * 4;
+
+                      m(i) = num.dval;
+                    }
                 }
+
+              if (! error_state)
+                retval =  m;
             }
-
-          if (! error_state)
-            retval =  m;
         }
     }
 
@@ -120,23 +193,36 @@
 
 /*
 %!assert (hex2num (["c00";"bff";"000";"3ff";"400"]), [-2:2]')
+%!assert (hex2num (["c00";"bf8";"000";"3f8";"400"], "single"), single([-2:2])')
 */
 
 DEFUN (num2hex, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {@var{s} =} num2hex (@var{n})\n\
-Typecast a double precision number or vector to a 16 character hexadecimal\n\
-string of the IEEE 754 representation of the number.  For example:\n\
+Typecast a double or single precision number or vector to a 8 or 16\n\
+character hexadecimal string of the IEEE 754 representation of the number.\n\
+For example:\n\
 \n\
 @example\n\
 @group\n\
-num2hex ([-1, 1, e, Inf, NaN, NA])\n\
+num2hex ([-1, 1, e, Inf])\n\
 @result{} \"bff0000000000000\n\
     3ff0000000000000\n\
     4005bf0a8b145769\n\
-    7ff0000000000000\n\
-    fff8000000000000\n\
-    7ff00000000007a2\"\n\
+    7ff0000000000000\"\n\
+@end group\n\
+@end example\n\
+\n\
+If the argument @var{n} is a single precision number or vector, the returned\n\
+string has a length of 8.  For example:\n\
+\n\
+@example\n\
+@group\n\
+num2hex (single ([-1, 1, e, Inf]))\n\
+@result{} \"bf800000\n\
+    3f800000\n\
+    402df854\n\
+    7f800000\"\n\
 @end group\n\
 @end example\n\
 @seealso{hex2num, hex2dec, dec2hex}\n\
@@ -147,14 +233,52 @@
 
   if (nargin != 1)
     print_usage ();
+  else if (args(0).is_single_type ())
+    {
+      const FloatColumnVector v (args(0).float_vector_value ());
+
+      if (! error_state)
+        {
+          octave_idx_type nchars = 8;
+          octave_idx_type nr = v.length ();
+          charMatrix m (nr, nchars);
+          const float *pv = v.fortran_vec ();
+
+          for (octave_idx_type i = 0; i < nr; i++)
+            {
+              union
+              {
+                uint32_t ival;
+                float dval;
+              } num;
+
+              num.dval = *pv++;
+
+              for (octave_idx_type j = 0; j < nchars; j++)
+                {
+                  unsigned char ch =
+                    static_cast<char> (num.ival >> ((nchars - 1 - j) * 4) & 0xF);
+                  if (ch >= 10)
+                    ch += 'a' - 10;
+                  else
+                    ch += '0';
+
+                  m.elem (i, j) = ch;
+                }
+            }
+
+          retval = m;
+        }
+    }
   else
     {
       const ColumnVector v (args(0).vector_value ());
 
       if (! error_state)
         {
+          octave_idx_type nchars = 16;
           octave_idx_type nr = v.length ();
-          charMatrix m (nr, 16);
+          charMatrix m (nr, nchars);
           const double *pv = v.fortran_vec ();
 
           for (octave_idx_type i = 0; i < nr; i++)
@@ -167,10 +291,10 @@
 
               num.dval = *pv++;
 
-              for (octave_idx_type j = 0; j < 16; j++)
+              for (octave_idx_type j = 0; j < nchars; j++)
                 {
                   unsigned char ch =
-                    static_cast<char> (num.ival >> ((15 - j) * 4) & 0xF);
+                    static_cast<char> (num.ival >> ((nchars - 1 - j) * 4) & 0xF);
                   if (ch >= 10)
                     ch += 'a' - 10;
                   else
@@ -189,4 +313,5 @@
 
 /*
 %!assert (num2hex (-2:2), ["c000000000000000";"bff0000000000000";"0000000000000000";"3ff0000000000000";"4000000000000000"])
+%!assert (num2hex (single (-2:2)), ["c0000000";"bf800000";"00000000";"3f800000";"40000000"])
 */
--- a/libinterp/corefcn/input.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/input.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -147,7 +147,7 @@
 void
 octave_base_reader::do_input_echo (const std::string& input_string) const
 {
-  int do_echo = LEXER->reading_script_file ?
+  int do_echo = (LEXER && LEXER->reading_script_file) ?
     (Vecho_executing_commands & ECHO_SCRIPTS)
       : (Vecho_executing_commands & ECHO_CMD_LINE) && ! forced_interactive;
 
@@ -272,9 +272,7 @@
     {
       if (! history_skip_auto_repeated_debugging_command)
         {
-          command_history::add (retval);
-
-          if (! command_history::ignoring_entries ())
+          if (command_history::add (retval))
             octave_link::append_history (retval);
         }
 
@@ -556,10 +554,10 @@
   VPS1 = prompt;
 
   if (! (interactive || forced_interactive)
-      || LEXER->reading_fcn_file
-      || LEXER->reading_classdef_file
-      || LEXER->reading_script_file
-      || LEXER->input_from_eval_string ())
+      || (LEXER && (LEXER->reading_fcn_file
+                    || LEXER->reading_classdef_file
+                    || LEXER->reading_script_file
+                    || LEXER->input_from_eval_string ())))
     {
       frame.protect_var (forced_interactive);
       forced_interactive = true;
@@ -741,7 +739,7 @@
 of values produced by the evaluation of the expression.\n\
 \n\
 If you are only interested in getting a literal string value, you can\n\
-call @code{input} with the character string @code{\"s\"} as the second\n\
+call @code{input} with the character string @qcode{\"s\"} as the second\n\
 argument.  This tells Octave to return the string entered by the user\n\
 directly, without evaluating it first.\n\
 \n\
@@ -1228,7 +1226,7 @@
 Query or set the primary prompt string.  When executing interactively,\n\
 Octave displays the primary prompt when it is ready to read a command.\n\
 \n\
-The default value of the primary prompt string is @code{\"\\s:\\#> \"}.\n\
+The default value of the primary prompt string is @qcode{\"\\s:\\#> \"}.\n\
 To change it, use a command like\n\
 \n\
 @example\n\
@@ -1251,9 +1249,9 @@
 @noindent\n\
 will give the default Octave prompt a red coloring.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{PS2, PS4}\n\
 @end deftypefn")
 {
@@ -1270,11 +1268,11 @@
 command.  For example, if you are typing a @code{for} loop that spans several\n\
 lines, Octave will print the secondary prompt at the beginning of\n\
 each line after the first.  The default value of the secondary prompt\n\
-string is @code{\"> \"}.\n\
+string is @qcode{\"> \"}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{PS1, PS4}\n\
 @end deftypefn")
 {
@@ -1288,12 +1286,12 @@
 @deftypefnx {Built-in Function} {} PS4 (@var{new_val}, \"local\")\n\
 Query or set the character string used to prefix output produced\n\
 when echoing commands is enabled.\n\
-The default value is @code{\"+ \"}.\n\
+The default value is @qcode{\"+ \"}.\n\
 @xref{Diary and Echo Commands}, for a description of echoing commands.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{echo, echo_executing_commands, PS1, PS2}\n\
 @end deftypefn")
 {
@@ -1307,11 +1305,11 @@
 @deftypefnx {Built-in Function} {} completion_append_char (@var{new_val}, \"local\")\n\
 Query or set the internal character variable that is appended to\n\
 successful command-line completion attempts.  The default\n\
-value is @code{\" \"} (a single space).\n\
+value is @qcode{\" \"} (a single space).\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (completion_append_char);
@@ -1342,9 +1340,9 @@
 The value of @code{echo_executing_commands} may be set by the @kbd{echo}\n\
 command or the command line option @option{--echo-commands}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (echo_executing_commands);
@@ -1417,9 +1415,9 @@
 @noindent\n\
 will set a breakpoint at the first line of the subfunction @code{mysubfunc}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   char tmp = Vfilemarker;
--- a/libinterp/corefcn/jit-ir.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/jit-ir.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -34,8 +34,13 @@
 
 #include "jit-ir.h"
 
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+#include <llvm/IR/BasicBlock.h>
+#include <llvm/IR/Instructions.h>
+#else
 #include <llvm/BasicBlock.h>
 #include <llvm/Instructions.h>
+#endif
 
 #include "error.h"
 
--- a/libinterp/corefcn/jit-typeinfo.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/jit-typeinfo.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -35,13 +35,30 @@
 #include "jit-typeinfo.h"
 
 #include <llvm/Analysis/Verifier.h>
+#include <llvm/ExecutionEngine/ExecutionEngine.h>
+
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+#include <llvm/IR/GlobalVariable.h>
+#include <llvm/IR/LLVMContext.h>
+#include <llvm/IR/Function.h>
+#include <llvm/IR/Instructions.h>
+#include <llvm/IR/Intrinsics.h>
+#else
 #include <llvm/GlobalVariable.h>
-#include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/LLVMContext.h>
 #include <llvm/Function.h>
 #include <llvm/Instructions.h>
 #include <llvm/Intrinsics.h>
+#endif
+
+#ifdef HAVE_LLVM_SUPPORT_IRBUILDER_H
 #include <llvm/Support/IRBuilder.h>
+#elif defined(HAVE_LLVM_IR_IRBUILDER_H)
+#include <llvm/IR/IRBuilder.h>
+#else
+#include <llvm/IRBuilder.h>
+#endif
+
 #include <llvm/Support/raw_os_ostream.h>
 
 #include "jit-ir.h"
@@ -579,10 +596,23 @@
                                           aname, module);
 
   if (sret ())
-    llvm_function->addAttribute (1, llvm::Attribute::StructRet);
+    {
+#ifdef FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES
+      llvm::AttrBuilder attr_builder;
+      attr_builder.addAttribute (llvm::Attributes::StructRet);
+      llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder);
+      llvm_function->addAttribute (1, attrs);
+#else
+      llvm_function->addAttribute (1, llvm::Attribute::StructRet);
+#endif
+    }
 
   if (call_conv == jit_convention::internal)
+#ifdef FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES
+    llvm_function->addFnAttr (llvm::Attributes::AlwaysInline);
+#else
     llvm_function->addFnAttr (llvm::Attribute::AlwaysInline);
+#endif
 }
 
 jit_function::jit_function (const jit_function& fn, jit_type *aresult,
@@ -685,7 +715,14 @@
 
   if (sret ())
     {
+#ifdef CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES
+      llvm::AttrBuilder attr_builder;
+      attr_builder.addAttribute(llvm::Attributes::StructRet);
+      llvm::Attributes attrs = llvm::Attributes::get(context, attr_builder); 
+      callinst->addAttribute (1, attrs);
+#else
       callinst->addAttribute (1, llvm::Attribute::StructRet);
+#endif
       ret = builder.CreateLoad (sret_mem);
     }
 
--- a/libinterp/corefcn/jit-util.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/jit-util.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -32,7 +32,12 @@
 
 #ifdef HAVE_LLVM
 
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+#include <llvm/IR/Value.h>
+#else
 #include <llvm/Value.h>
+#endif
+
 #include <llvm/Support/raw_os_ostream.h>
 
 std::ostream&
--- a/libinterp/corefcn/jit-util.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/jit-util.h	Sat Oct 05 11:22:09 2013 -0400
@@ -31,6 +31,10 @@
 
 #include <stdexcept>
 
+#if defined(HAVE_LLVM_IR_DATALAYOUT_H) || defined(HAVE_LLVM_DATALAYOUT_H)
+#define HAVE_LLVM_DATALAYOUT
+#endif
+
 // we don't want to include llvm headers here, as they require
 // __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS be defined in the entire
 // compilation unit
--- a/libinterp/corefcn/load-path.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/load-path.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -2319,8 +2319,8 @@
 @deftypefn  {Built-in Function} {} addpath (@var{dir1}, @dots{})\n\
 @deftypefnx {Built-in Function} {} addpath (@var{dir1}, @dots{}, @var{option})\n\
 Add named directories to the function search path.  If\n\
-@var{option} is \"-begin\" or 0 (the default), prepend the\n\
-directory name to the current path.  If @var{option} is \"-end\"\n\
+@var{option} is @qcode{\"-begin\"} or 0 (the default), prepend the\n\
+directory name to the current path.  If @var{option} is @qcode{\"-end\"}\n\
 or 1, append the directory name to the current path.\n\
 Directories added to the path must exist.\n\
 \n\
--- a/libinterp/corefcn/load-save.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/load-save.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -269,6 +269,20 @@
 
               if (! tmp.empty ())
                 retval = LS_ASCII;
+              else
+                {
+                  file.clear ();
+                  file.seekg (0, std::ios::beg);
+
+                  // FIXME -- looks_like_mat_ascii_file does not check to see
+                  // whether the file contains numbers.  It just skips comments and
+                  // checks for the same number of words on each line.  We may need
+                  // a better check here.  The best way to do that might be just
+                  // to try to read the file and see if it works.
+
+                  if (looks_like_mat_ascii_file (file, filename))
+                    retval = LS_MAT_ASCII;
+                }
             }
         }
     }
@@ -288,39 +302,36 @@
     return LS_HDF5;
 #endif /* HAVE_HDF5 */
 
-  std::ifstream file (fname.c_str ());
+#ifdef HAVE_ZLIB
+  use_zlib = check_gzip_magic (fname);
+#else
   use_zlib = false;
-
-  if (file)
-    {
-      retval = get_file_format (file, orig_fname);
-      file.close ();
-
-#ifdef HAVE_ZLIB
-      if (retval == LS_UNKNOWN && check_gzip_magic (fname))
-        {
-          gzifstream gzfile (fname.c_str ());
-          use_zlib = true;
-
-          if (gzfile)
-            {
-              retval = get_file_format (gzfile, orig_fname);
-              gzfile.close ();
-            }
-        }
 #endif
 
-      // FIXME -- looks_like_mat_ascii_file does not check to see
-      // whether the file contains numbers.  It just skips comments and
-      // checks for the same number of words on each line.  We may need
-      // a better check here.  The best way to do that might be just
-      // to try to read the file and see if it works.
-
-      if (retval == LS_UNKNOWN && looks_like_mat_ascii_file (fname))
-        retval = LS_MAT_ASCII;
+  if (! use_zlib)
+    {
+      std::ifstream file (fname.c_str ());
+      if (file)
+        {
+          retval = get_file_format (file, orig_fname);
+          file.close ();
+        }
+      else if (! quiet)
+        gripe_file_open ("load", orig_fname);
     }
-  else if (! quiet)
-    gripe_file_open ("load", orig_fname);
+#ifdef HAVE_ZLIB
+  else
+    {
+      gzifstream gzfile (fname.c_str ());
+      if (gzfile)
+        {
+          retval = get_file_format (gzfile, orig_fname);
+          gzfile.close ();
+        }
+      else if (! quiet)
+        gripe_file_open ("load", orig_fname);
+    }
+#endif
 
   return retval;
 }
@@ -617,7 +628,7 @@
 Octave can now support multi-dimensional HDF data and automatically\n\
 modifies variable names if they are invalid Octave identifiers.\n\
 \n\
-@item -mat\n\
+@item  -mat\n\
 @itemx -mat-binary\n\
 @itemx -6\n\
 @itemx -v6\n\
@@ -1315,6 +1326,8 @@
     {
       for (int i = argv_idx; i < argc; i++)
         {
+          if (argv[i] == "")
+            continue;  // Skip empty vars for Matlab compatibility
           if (! save_vars (os, argv[i], fmt, save_as_floats))
             warning ("save: no such variable '%s'", argv[i].c_str ());
         }
@@ -1509,20 +1522,20 @@
 Only use this format if you know that all the\n\
 values to be saved can be represented in single precision.\n\
 \n\
-@item -V7\n\
+@item  -V7\n\
 @itemx -v7\n\
 @itemx -7\n\
 @itemx -mat7-binary\n\
 Save the data in @sc{matlab}'s v7 binary data format.\n\
 \n\
-@item -V6\n\
+@item  -V6\n\
 @itemx -v6\n\
 @itemx -6\n\
 @itemx -mat\n\
 @itemx -mat-binary\n\
 Save the data in @sc{matlab}'s v6 binary data format.\n\
 \n\
-@item -V4\n\
+@item  -V4\n\
 @itemx -v4\n\
 @itemx -4\n\
 @itemx -mat4-binary\n\
@@ -1531,7 +1544,7 @@
 @item -text\n\
 Save the data in Octave's text data format.  (default).\n\
 \n\
-@item -zip\n\
+@item  -zip\n\
 @itemx -z\n\
 Use the gzip algorithm to compress the file.  This works equally on files\n\
 that are compressed with gzip outside of octave, and gzip can equally be\n\
@@ -1761,12 +1774,12 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} crash_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} crash_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-workspace\" if it\n\
+to save all current variables to the file @file{octave-workspace} if it\n\
 crashes or receives a hangup, terminate or similar signal.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{octave_core_file_limit, octave_core_file_name, octave_core_file_options}\n\
 @end deftypefn")
 {
@@ -1780,12 +1793,12 @@
 @deftypefnx {Built-in Function} {} save_default_options (@var{new_val}, \"local\")\n\
 Query or set the internal variable that specifies the default options\n\
 for the @code{save} command, and defines the default format.\n\
-Typical values include @code{\"-ascii\"}, @code{\"-text -zip\"}.\n\
+Typical values include @qcode{\"-ascii\"}, @qcode{\"-text -zip\"}.\n\
 The default value is @option{-text}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{save}\n\
 @end deftypefn")
 {
@@ -1806,9 +1819,9 @@
 size of the file.  If a text file format is used, then the file could\n\
 be much larger than the limit.  The default value is -1 (unlimited)\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_options}\n\
 @end deftypefn")
 {
@@ -1822,11 +1835,11 @@
 @deftypefnx {Built-in Function} {} octave_core_file_name (@var{new_val}, \"local\")\n\
 Query or set the internal variable that specifies the name of the file\n\
 used for saving data from the top-level workspace if Octave aborts.\n\
-The default value is @code{\"octave-workspace\"}\n\
+The default value is @qcode{\"octave-workspace\"}\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_options}\n\
 @end deftypefn")
 {
@@ -1844,9 +1857,9 @@
 options for the @code{save} function.  The default value is Octave's binary\n\
 format.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_limit}\n\
 @end deftypefn")
 {
@@ -1872,9 +1885,9 @@
 \"# Created by Octave VERSION, %a %b %d %H:%M:%S %Y %Z <USER@@HOST>\"\n\
 @end smallexample\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{strftime, save}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/ls-mat-ascii.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ls-mat-ascii.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -107,7 +107,7 @@
 }
 
 static void
-get_lines_and_columns (std::istream& is, 
+get_lines_and_columns (std::istream& is,
                        octave_idx_type& nr, octave_idx_type& nc,
                        const std::string& filename = std::string (),
                        bool quiet = false, bool check_numeric = false)
@@ -410,21 +410,14 @@
 }
 
 bool
-looks_like_mat_ascii_file (const std::string& filename)
+looks_like_mat_ascii_file (std::istream& is, const std::string& filename)
 {
   bool retval = false;
-
-  std::ifstream is (filename.c_str ());
+  octave_idx_type nr = 0;
+  octave_idx_type nc = 0;
 
-  if (is)
-    {
-      octave_idx_type nr = 0;
-      octave_idx_type nc = 0;
-
-      get_lines_and_columns (is, nr, nc, filename, true, true);
-
-      retval = (nr != 0 && nc != 0);
-    }
+  get_lines_and_columns (is, nr, nc, filename, true, true);
+  retval = (nr != 0 && nc != 0);
 
   return retval;
 }
--- a/libinterp/corefcn/ls-mat-ascii.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ls-mat-ascii.h	Sat Oct 05 11:22:09 2013 -0400
@@ -31,6 +31,6 @@
 save_mat_ascii_data (std::ostream& os, const octave_value& val_arg,
                      int precision, bool tabs = false);
 
-extern bool looks_like_mat_ascii_file (const std::string& filename);
+extern bool looks_like_mat_ascii_file (std::istream& is, const std::string& filename);
 
 #endif
--- a/libinterp/corefcn/ls-mat4.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ls-mat4.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -194,17 +194,8 @@
       break;
 
     case 2:
-      flt_fmt = oct_mach_info::flt_fmt_vax_d;
-      break;
-
     case 3:
-      flt_fmt = oct_mach_info::flt_fmt_vax_g;
-      break;
-
     case 4:
-      flt_fmt = oct_mach_info::flt_fmt_cray;
-      break;
-
     default:
       flt_fmt = oct_mach_info::flt_fmt_unknown;
       break;
@@ -228,18 +219,6 @@
       retval = 1;
       break;
 
-    case oct_mach_info::flt_fmt_vax_d:
-      retval = 2;
-      break;
-
-    case oct_mach_info::flt_fmt_vax_g:
-      retval = 3;
-      break;
-
-    case oct_mach_info::flt_fmt_cray:
-      retval = 4;
-      break;
-
     default:
       break;
     }
--- a/libinterp/corefcn/ls-mat5.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ls-mat5.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1960,7 +1960,7 @@
             {
               double tmp = val[i];
 
-              if (! (xisnan (tmp) || xisinf (tmp))
+              if (xfinite (tmp)
                   && fabs (tmp) > std::numeric_limits<float>::max ())
                 {
                   too_large_for_float = true;
--- a/libinterp/corefcn/ls-oct-ascii.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/ls-oct-ascii.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -367,7 +367,7 @@
 
   if (tc.is_real_matrix ())
     {
-      os << "# 3D data...\n"
+      os << "# 3-D data...\n"
          << "# type: matrix\n"
          << "# total rows: " << nr << "\n"
          << "# total columns: " << nc << "\n";
@@ -408,7 +408,7 @@
     }
   else
     {
-      ::error ("for now, I can only save real matrices in 3D format");
+      ::error ("for now, I can only save real matrices in 3-D format");
       fail = true;
     }
 
@@ -423,9 +423,9 @@
 Query or set the internal variable that specifies the number of\n\
 digits to keep when saving data in text format.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.\n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE_WITH_LIMITS (save_precision, -1,
--- a/libinterp/corefcn/lu.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/lu.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -125,10 +125,10 @@
 pivoting strategy and the second for the symmetric strategy.  By default,\n\
 the values defined by @code{spparms} are used ([0.1, 0.001]).\n\
 \n\
-Given the string argument \"vector\", @code{lu} returns the values of @var{P}\n\
-and @var{Q} as vector values, such that for full matrix, @code{@var{A}\n\
-(@var{P},:) = @var{L} * @var{U}}, and @code{@var{R}(@var{P},:) * @var{A}\n\
-(:, @var{Q}) = @var{L} * @var{U}}.\n\
+Given the string argument @qcode{\"vector\"}, @code{lu} returns the values\n\
+of @var{P} and @var{Q} as vector values, such that for full matrix,\n\
+@code{@var{A} (@var{P},:) = @var{L} * @var{U}}, and @code{@var{R}(@var{P},:)\n\
+* @var{A} (:, @var{Q}) = @var{L} * @var{U}}.\n\
 \n\
 With two output arguments, returns the permuted forms of the upper and\n\
 lower triangular matrices, such that @code{@var{A} = @var{L} * @var{U}}.\n\
@@ -137,6 +137,7 @@
 is embedded into @var{U} to give a return value similar to the full case.\n\
 For both full and sparse matrices, @code{lu} loses the permutation\n\
 information.\n\
+@seealso{luupdate, chol, hess, qr, qz, schur, svd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -614,7 +615,7 @@
 @end example\n\
 \n\
 @noindent\n\
-then a factorization of @xcode{@var{A}+@var{x}*@var{y}.'} can be obtained\n\
+then a factorization of @tcode{@var{A}+@var{x}*@var{y}.'} can be obtained\n\
 either as\n\
 \n\
 @example\n\
@@ -635,7 +636,7 @@
 The matrix case is done as a sequence of rank-1 updates;\n\
 thus, for large enough k, it will be both faster and more accurate to\n\
 recompute the factorization from scratch.\n\
-@seealso{lu, qrupdate, cholupdate}\n\
+@seealso{lu, cholupdate, qrupdate}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
--- a/libinterp/corefcn/luinc.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/luinc.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -47,7 +47,7 @@
 Two types of incomplete factorization are possible, and the type\n\
 is determined by the second argument to @code{luinc}.\n\
 \n\
-Called with a second argument of '0', the zero-level incomplete\n\
+Called with a second argument of @qcode{'0'}, the zero-level incomplete\n\
 LU@tie{}factorization is produced.  This creates a factorization of @var{A}\n\
 where the position of the non-zero arguments correspond to the same\n\
 positions as in the matrix @var{A}.\n\
@@ -91,8 +91,8 @@
 All other fields in @var{opts} are ignored.  The outputs from @code{luinc}\n\
 are the same as for @code{lu}.\n\
 \n\
-Given the string argument \"vector\", @code{luinc} returns the values of\n\
-@var{p} @var{q} as vector values.\n\
+Given the string argument @qcode{\"vector\"}, @code{luinc} returns the\n\
+values of @var{p} @var{q} as vector values.\n\
 @seealso{sparse, lu}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/matrix_type.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/matrix_type.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -50,48 +50,49 @@
 matrix and caches it for future use.  Called with more than one argument,\n\
 @code{matrix_type} allows the type of the matrix to be defined.\n\
 \n\
-If the option \"nocompute\" is given, the function will not attempt to guess\n\
-the type if it is still unknown.  This is useful for debugging purposes.\n\
+If the option @qcode{\"nocompute\"} is given, the function will not attempt\n\
+to guess the type if it is still unknown.  This is useful for debugging\n\
+purposes.\n\
 \n\
 The possible matrix types depend on whether the matrix is full or sparse, and\n\
 can be one of the following\n\
 \n\
 @table @asis\n\
-@item \"unknown\"\n\
+@item @qcode{\"unknown\"}\n\
 Remove any previously cached matrix type, and mark type as unknown.\n\
 \n\
-@item \"full\"\n\
+@item @qcode{\"full\"}\n\
 Mark the matrix as full.\n\
 \n\
-@item \"positive definite\"\n\
+@item @qcode{\"positive definite\"}\n\
 Probable full positive definite matrix.\n\
 \n\
-@item \"diagonal\"\n\
+@item @qcode{\"diagonal\"}\n\
 Diagonal matrix.  (Sparse matrices only)\n\
 \n\
-@item \"permuted diagonal\"\n\
+@item @qcode{\"permuted diagonal\"}\n\
 Permuted Diagonal matrix.  The permutation does not need to be specifically\n\
 indicated, as the structure of the matrix explicitly gives this.  (Sparse\n\
 matrices only)\n\
 \n\
-@item \"upper\"\n\
+@item @qcode{\"upper\"}\n\
 Upper triangular.  If the optional third argument @var{perm} is given, the\n\
 matrix is assumed to be a permuted upper triangular with the permutations\n\
 defined by the vector @var{perm}.\n\
 \n\
-@item \"lower\"\n\
+@item @qcode{\"lower\"}\n\
 Lower triangular.  If the optional third argument @var{perm} is given, the\n\
 matrix is assumed to be a permuted lower triangular with the permutations\n\
 defined by the vector @var{perm}.\n\
 \n\
-@item \"banded\"\n\
-@itemx \"banded positive definite\"\n\
+@item  @qcode{\"banded\"}\n\
+@itemx @qcode{\"banded positive definite\"}\n\
 Banded matrix with the band size of @var{nl} below the diagonal and @var{nu}\n\
 above it.  If @var{nl} and @var{nu} are 1, then the matrix is tridiagonal and\n\
 treated with specialized code.  In addition the matrix can be marked as\n\
 probably a positive definite.  (Sparse matrices only)\n\
 \n\
-@item \"singular\"\n\
+@item @qcode{\"singular\"}\n\
 The matrix is assumed to be singular and will be treated with a minimum norm\n\
 solution.\n\
 \n\
--- a/libinterp/corefcn/max.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/max.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -663,8 +663,10 @@
 @deftypefn  {Built-in Function} {} cummin (@var{x})\n\
 @deftypefnx {Built-in Function} {} cummin (@var{x}, @var{dim})\n\
 @deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} cummin (@var{x})\n\
-Return the cumulative minimum values along dimension @var{dim}.  If @var{dim}\n\
-is unspecified it defaults to column-wise operation.  For example:\n\
+Return the cumulative minimum values along dimension @var{dim}.\n\
+\n\
+If @var{dim} is unspecified it defaults to column-wise operation.  For\n\
+example:\n\
 \n\
 @example\n\
 @group\n\
@@ -673,40 +675,52 @@
 @end group\n\
 @end example\n\
 \n\
-\n\
-The call\n\
-\n\
-@example\n\
-  [w, iw] = cummin (x)\n\
-@end example\n\
-\n\
-@noindent\n\
-with @code{x} a vector, is equivalent to the following code:\n\
+If called with two output arguments the index of the minimum value is also\n\
+returned.\n\
 \n\
 @example\n\
 @group\n\
-w = iw = zeros (size (x));\n\
-for i = 1:length (x)\n\
-  [w(i), iw(i)] = max (x(1:i));\n\
-endfor\n\
+[w, iw] = cummin ([5 4 6 2 3 1])\n\
+@result{}\n\
+w =  5  4  4  2  2  1\n\
+iw = 1  2  2  4  4  6\n\
 @end group\n\
 @end example\n\
 \n\
-@noindent\n\
-but computed in a much faster manner.\n\
 @seealso{cummax, min, max}\n\
 @end deftypefn")
 {
   return do_cumminmax_body (args, nargout, true);
 }
 
+/*
+%!assert (cummin ([1, 4, 2, 3]), [1 1 1 1])
+%!assert (cummin ([1; -10; 5; -2]), [1; -10; -10; -10])
+%!assert (cummin ([4, i; -2, 2]), [4, i; -2, i])
+
+%!test
+%! x = reshape (1:8, [2,2,2]);
+%! assert (cummin (x, 1), reshape ([1 1 3 3 5 5 7 7], [2,2,2]));
+%! assert (cummin (x, 2), reshape ([1 2 1 2 5 6 5 6], [2,2,2]));
+%! [w, iw] = cummin (x, 3);
+%! assert (ndims (w), 3);
+%! assert (w, repmat ([1 3; 2 4], [1 1 2]));
+%! assert (ndims (iw), 3);
+%! assert (iw, ones (2,2,2));
+
+%!error cummin ()
+%!error cummin (1, 2, 3)
+*/
+
 DEFUN (cummax, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {} cummax (@var{x})\n\
 @deftypefnx {Built-in Function} {} cummax (@var{x}, @var{dim})\n\
-@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} cummax (@var{x})\n\
-Return the cumulative maximum values along dimension @var{dim}.  If @var{dim}\n\
-is unspecified it defaults to column-wise operation.  For example:\n\
+@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} cummax (@dots{})\n\
+Return the cumulative maximum values along dimension @var{dim}.\n\
+\n\
+If @var{dim} is unspecified it defaults to column-wise operation.  For\n\
+example:\n\
 \n\
 @example\n\
 @group\n\
@@ -715,28 +729,40 @@
 @end group\n\
 @end example\n\
 \n\
-The call\n\
-\n\
-@example\n\
-[w, iw] = cummax (x, dim)\n\
-@end example\n\
-\n\
-@noindent\n\
-with @code{x} a vector, is equivalent to the following code:\n\
+If called with two output arguments the index of the maximum value is also\n\
+returned.\n\
 \n\
 @example\n\
 @group\n\
-w = iw = zeros (size (x));\n\
-for i = 1:length (x)\n\
-  [w(i), iw(i)] = max (x(1:i));\n\
-endfor\n\
+[w, iw] = cummax ([1 3 2 6 4 5])\n\
+@result{}\n\
+w =  1  3  3  6  6  6\n\
+iw = 1  2  2  4  4  4\n\
 @end group\n\
 @end example\n\
 \n\
-@noindent\n\
-but computed in a much faster manner.\n\
 @seealso{cummin, max, min}\n\
 @end deftypefn")
 {
   return do_cumminmax_body (args, nargout, false);
 }
+
+/*
+%!assert (cummax ([1, 4, 2, 3]), [1 4 4 4])
+%!assert (cummax ([1; -10; 5; -2]), [1; 1; 5; 5])
+%!assert (cummax ([4, i 4.9, -2, 2, 3+4i]), [4, 4, 4.9, 4.9, 4.9, 3+4i])
+
+%!test
+%! x = reshape (8:-1:1, [2,2,2]);
+%! assert (cummax (x, 1), reshape ([8 8 6 6 4 4 2 2], [2,2,2]));
+%! assert (cummax (x, 2), reshape ([8 7 8 7 4 3 4 3], [2,2,2]));
+%! [w, iw] = cummax (x, 3);
+%! assert (ndims (w), 3);
+%! assert (w, repmat ([8 6; 7 5], [1 1 2]));
+%! assert (ndims (iw), 3);
+%! assert (iw, ones (2,2,2));
+
+%!error cummax ()
+%!error cummax (1, 2, 3)
+*/
+
--- a/libinterp/corefcn/mex.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/mex.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1164,7 +1164,7 @@
     switch (get_class_id ())
       {
       case mxLOGICAL_CLASS:
-        retval = int_to_ov<bool, boolNDArray, bool> (dv);
+        retval = int_to_ov<mxLogical, boolNDArray, bool> (dv);
         break;
 
       case mxCHAR_CLASS:
--- a/libinterp/corefcn/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -4,7 +4,9 @@
   corefcn/gl2ps.c \
   corefcn/graphics.in.h \
   corefcn/mxarray.in.h \
-  corefcn/oct-errno.in.cc
+  corefcn/oct-errno.in.cc \
+  corefcn/oct-tex-lexer.in.ll \
+  corefcn/oct-tex-symbols.in
 
 ## Options functions for Fortran packages like LSODE, DASPK.
 ## These are generated automagically by configure and Perl.
@@ -26,6 +28,8 @@
 	$(PERL) $(top_srcdir)/build-aux/mk-opts.pl --opt-handler-fcns $< > $@-t
 	mv $@-t $@
 
+$(OPT_HANDLERS): $(top_srcdir)/build-aux/mk-opts.pl
+
 $(OPT_INC) : %.h : %.in
 	$(MAKE) -C $(top_builddir)/liboctave/numeric $(@F)
 
@@ -35,9 +39,11 @@
   corefcn/jit-ir.h \
   corefcn/pt-jit.h
 
+TEX_PARSER_INC = \
+  corefcn/oct-tex-parser.h
+
 COREFCN_INC = \
   corefcn/Cell.h \
-  corefcn/action-container.h \
   corefcn/c-file-ptr-stream.h \
   corefcn/comment-list.h \
   corefcn/cutils.h \
@@ -74,6 +80,7 @@
   corefcn/mxarray.in.h \
   corefcn/oct-errno.h \
   corefcn/oct-fstrm.h \
+  corefcn/oct-handle.h \
   corefcn/oct-hdf5.h \
   corefcn/oct-hist.h \
   corefcn/oct-iostrm.h \
@@ -100,7 +107,6 @@
   corefcn/toplev.h \
   corefcn/txt-eng-ft.h \
   corefcn/txt-eng.h \
-  corefcn/unwind-prot.h \
   corefcn/utils.h \
   corefcn/variables.h \
   corefcn/workspace-element.h \
@@ -108,7 +114,8 @@
   corefcn/xnorm.h \
   corefcn/xpow.h \
   corefcn/zfstream.h \
-  $(JIT_INC)
+  $(JIT_INC) \
+  $(TEX_PARSER_INC)
 
 JIT_SRC = \
   corefcn/jit-util.cc \
@@ -116,6 +123,10 @@
   corefcn/jit-ir.cc \
   corefcn/pt-jit.cc
 
+TEX_PARSER_SRC = \
+  corefcn/oct-tex-lexer.ll \
+  corefcn/oct-tex-parser.yy
+
 C_COREFCN_SRC = \
   corefcn/cutils.c \
   corefcn/matherr.c \
@@ -240,9 +251,10 @@
   corefcn/time.cc \
   corefcn/toplev.cc \
   corefcn/tril.cc \
+  corefcn/txt-eng.cc \
   corefcn/txt-eng-ft.cc \
   corefcn/typecast.cc \
-  corefcn/unwind-prot.cc \
+  corefcn/urlwrite.cc \
   corefcn/utils.cc \
   corefcn/variables.cc \
   corefcn/xdiv.cc \
@@ -290,8 +302,28 @@
 	  -e "s|%OCTAVE_IDX_TYPE%|${OCTAVE_IDX_TYPE}|" > $@-t
 	mv $@-t $@
 
-noinst_LTLIBRARIES += corefcn/libcorefcn.la
+corefcn/oct-tex-lexer.ll: corefcn/oct-tex-lexer.in.ll corefcn/oct-tex-symbols.in Makefile.am
+	$(AWK) 'BEGIN { print "/* DO NOT EDIT. AUTOMATICALLY GENERATED FROM oct-tex-lexer.in.ll and oct-tex-symbols.in. */"; } /^@SYMBOL_RULES@$$/ { count = 0; while (getline < "$(srcdir)/corefcn/oct-tex-symbols.in") { if ($$0 !~ /^#.*/ && NF == 3) { printf("\"\\\\%s\" { yylval->sym = %d; return SYM; }\n", $$1, count); count++; } } getline } ! /^@SYMBOL_RULES@$$/ { print }' $< > $@-t
+	mv $@-t $@
+
+corefcn/oct-tex-symbols.cc: corefcn/oct-tex-symbols.in Makefile.am
+	$(AWK) 'BEGIN { print "// DO NOT EDIT. AUTOMATICALLY GENERATED FROM oct-tex-symbols.in."; print "static uint32_t symbol_codes[][2] = {"; count = 0; } END { print "};"; printf("static int num_symbol_codes = %d;\n", count); } /^#/ { } { if (NF == 3) { printf("  { %s, %s },\n", $$2, $$3); count++; } }' $< > $@-t
+	mv $@-t $@
+
+corefcn/txt-eng.cc: corefcn/oct-tex-symbols.cc
+corefcn/oct-tex-lexer.cc: LEX_OUTPUT_ROOT := lex.octave_tex_
+corefcn/oct-tex-parser.h: corefcn/oct-tex-parser.yy
+
+
+noinst_LTLIBRARIES += \
+  corefcn/libcorefcn.la \
+  corefcn/libtex_parser.la
 
 corefcn_libcorefcn_la_SOURCES = $(COREFCN_SRC)
 corefcn_libcorefcn_la_CPPFLAGS = $(liboctinterp_la_CPPFLAGS) $(FFTW_XCPPFLAGS)
 
+corefcn_libtex_parser_la_SOURCES = $(TEX_PARSER_SRC)
+corefcn_libtex_parser_la_CPPFLAGS = $(liboctinterp_la_CPPFLAGS)
+corefcn_libtex_parser_la_CXXFLAGS = \
+  $(filter-out -Wold-style-cast, $(AM_CXXFLAGS))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-handle.h	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,147 @@
+/*
+
+Copyright (C) 2007-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_handle_h)
+#define octave_handle_h 1
+
+#include "dMatrix.h"
+#include "lo-ieee.h"
+
+#include "ov.h"
+
+// ---------------------------------------------------------------------
+
+class octave_handle
+{
+public:
+  octave_handle (void) : val (octave_NaN) { }
+
+  octave_handle (const octave_value& a)
+    : val (octave_NaN)
+  {
+    if (a.is_empty ())
+      /* do nothing */;
+    else
+      {
+        double tval = a.double_value ();
+
+        if (! error_state)
+          val = tval;
+        else
+          error ("invalid handle");
+      }
+  }
+
+  octave_handle (int a) : val (a) { }
+
+  octave_handle (double a) : val (a) { }
+
+  octave_handle (const octave_handle& a) : val (a.val) { }
+
+  octave_handle& operator = (const octave_handle& a)
+  {
+    if (&a != this)
+      val = a.val;
+
+    return *this;
+  }
+
+  ~octave_handle (void) { }
+
+  double value (void) const { return val; }
+
+  octave_value as_octave_value (void) const
+  {
+    return ok () ? octave_value (val) : octave_value (Matrix ());
+  }
+
+  // Prefix increment/decrement operators.
+  octave_handle& operator ++ (void)
+  {
+    ++val;
+    return *this;
+  }
+
+  octave_handle& operator -- (void)
+  {
+    --val;
+    return *this;
+  }
+
+  // Postfix increment/decrement operators.
+  const octave_handle operator ++ (int)
+  {
+    octave_handle old_value = *this;
+    ++(*this);
+    return old_value;
+  }
+
+  const octave_handle operator -- (int)
+  {
+    octave_handle old_value = *this;
+    --(*this);
+    return old_value;
+  }
+
+  bool ok (void) const { return ! xisnan (val); }
+
+private:
+  double val;
+};
+
+inline bool
+operator == (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () == b.value ();
+}
+
+inline bool
+operator != (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () != b.value ();
+}
+
+inline bool
+operator < (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () < b.value ();
+}
+
+inline bool
+operator <= (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () <= b.value ();
+}
+
+inline bool
+operator >= (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () >= b.value ();
+}
+
+inline bool
+operator > (const octave_handle& a, const octave_handle& b)
+{
+  return a.value () > b.value ();
+}
+
+#endif
--- a/libinterp/corefcn/oct-hist.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -328,10 +328,8 @@
         tmp.resize (len - 1);
 
       if (! tmp.empty ())
-        {
-          command_history::add (tmp);
+        if (command_history::add (tmp))
           octave_link::append_history (tmp);
-        }
     }
 }
 
@@ -580,10 +578,8 @@
   std::string timestamp = now.strftime (Vhistory_timestamp_format_string);
 
   if (! timestamp.empty ())
-    {
-      command_history::add (timestamp); 
+    if (command_history::add (timestamp))
       octave_link::append_history (timestamp);
-   }
 }
 
 DEFUN (edit_history, args, ,
@@ -759,12 +755,13 @@
 @seealso{history_file, history_size, history_timestamp_format_string, history_save}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   std::string old_history_control = command_history::histcontrol ();
 
   std::string tmp = old_history_control;
 
-  octave_value retval = set_internal_variable (tmp, args, nargout,
-                                               "history_control");
+  retval = set_internal_variable (tmp, args, nargout, "history_control");
 
   if (tmp != old_history_control)
     command_history::process_histcontrol (tmp);
@@ -782,13 +779,15 @@
 @seealso{history_file, history_timestamp_format_string, history_save}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   int old_history_size = command_history::size ();
 
   int tmp = old_history_size;
 
-  octave_value retval = set_internal_variable (tmp, args, nargout,
-                                               "history_size", -1,
-                                               std::numeric_limits<int>::max ());
+  retval = set_internal_variable (tmp, args, nargout,
+                                  "history_size", -1,
+                                  std::numeric_limits<int>::max ());
 
   if (tmp != old_history_size)
     command_history::set_size (tmp);
@@ -807,12 +806,13 @@
 @seealso{history_size, history_save, history_timestamp_format_string}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   std::string old_history_file = command_history::file ();
 
   std::string tmp = old_history_file;
 
-  octave_value retval = set_internal_variable (tmp, args, nargout,
-                                               "history_file");
+  retval = set_internal_variable (tmp, args, nargout, "history_file");
 
   if (tmp != old_history_file)
     command_history::set_file (tmp);
@@ -834,9 +834,9 @@
 \"# Octave VERSION, %a %b %d %H:%M:%S %Y %Z <USER@@HOST>\"\n\
 @end example\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{strftime, history_file, history_size, history_save}\n\
 @end deftypefn")
 {
@@ -851,18 +851,19 @@
 Query or set the internal variable that controls whether commands entered\n\
 on the command line are saved in the history file.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{history_control, history_file, history_size, history_timestamp_format_string}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   bool old_history_save = ! command_history::ignoring_entries ();
 
   bool tmp = old_history_save;
 
-  octave_value retval = set_internal_variable (tmp, args, nargout,
-                                               "history_save");
+  retval = set_internal_variable (tmp, args, nargout, "history_save");
 
   if (tmp != old_history_save)
     command_history::ignore_entries (! tmp);
--- a/libinterp/corefcn/oct-map.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/oct-map.h	Sat Oct 05 11:22:09 2013 -0400
@@ -474,6 +474,7 @@
   { return v.map_value (); }
 
 // The original Octave_map object which is now deprecated.
+// It was fully deprecated in version 3.8 and should be removed in 3.12.
 // Octave_map and octave_map are convertible to each other.
 
 class
--- a/libinterp/corefcn/oct-stream.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/oct-stream.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1189,29 +1189,6 @@
   return is >> valptr;
 }
 
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, int*);
-
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, long int*);
-
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, short int*);
-
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, unsigned int*);
-
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, unsigned long int*);
-
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, unsigned short int*);
-
-#if 0
-template std::istream&
-octave_scan (std::istream&, const scanf_format_elt&, float*);
-#endif
-
 template<>
 std::istream&
 octave_scan<> (std::istream& is, const scanf_format_elt& fmt, double* valptr)
@@ -1278,36 +1255,6 @@
 }
 
 template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, long int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, short int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned long int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned short int*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-
-#if 0
-template void
-do_scanf_conv (std::istream&, const scanf_format_elt&, float*,
-               Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
-#endif
-
-template void
 do_scanf_conv (std::istream&, const scanf_format_elt&, double*,
                Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool);
 
@@ -2402,30 +2349,6 @@
   return retval;
 }
 
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, int,
-                const std::string&);
-
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, long,
-                const std::string&);
-
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, unsigned int,
-                const std::string&);
-
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, unsigned long,
-                const std::string&);
-
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, double,
-                const std::string&);
-
-template int
-do_printf_conv (std::ostream&, const char*, int, int, int, const char*,
-                const std::string&);
-
 #define DO_DOUBLE_CONV(TQUAL) \
   do \
     { \
@@ -2544,9 +2467,17 @@
                                 nsa--;
                             }
 
-                          const char *tval = xisinf (val)
-                            ? (val < 0 ? "-Inf" : "Inf")
-                            : (lo_ieee_is_NA (val) ? "NA" : "NaN");
+                          const char *tval;
+                          if (xisinf (val))
+                            if (elt->flags.find ('+') != std::string::npos)
+                              tval = (val < 0 ? "-Inf" : "+Inf");
+                            else
+                              tval = (val < 0 ? "-Inf" : "Inf");
+                          else
+                            if (elt->flags.find ('+') != std::string::npos)
+                              tval = (lo_ieee_is_NA (val) ? "+NA" : "+NaN");
+                            else
+                              tval = (lo_ieee_is_NA (val) ? "NA" : "NaN");
 
                           retval += do_printf_conv (os, tfmt.c_str (),
                                                     nsa, sa_1, sa_2,
@@ -3027,229 +2958,199 @@
     rep->close ();
 }
 
-template <class RET_T, class READ_T>
-octave_value
-do_read (octave_stream& strm, octave_idx_type nr, octave_idx_type nc, octave_idx_type block_size,
-         octave_idx_type skip, bool do_float_fmt_conv, bool do_NA_conv,
-         oct_mach_info::float_format from_flt_fmt, octave_idx_type& count)
+template <class SRC_T, class DST_T>
+static octave_value
+convert_and_copy (std::list<void *>& input_buf_list,
+                  octave_idx_type input_buf_elts,
+                  octave_idx_type elts_read,
+                  octave_idx_type nr, octave_idx_type nc, bool swap,
+                  bool do_float_fmt_conv, bool do_NA_conv,
+                  oct_mach_info::float_format from_flt_fmt)
 {
-  octave_value retval;
-
-  RET_T nda;
-
-  count = 0;
-
-  typedef typename RET_T::element_type ELMT;
-  ELMT elt_zero = ELMT ();
-
-  ELMT *dat = 0;
-
-  octave_idx_type max_size = 0;
-
-  octave_idx_type final_nr = 0;
-  octave_idx_type final_nc = 1;
-
-  if (nr > 0)
+  typedef typename DST_T::element_type dst_elt_type;
+
+  DST_T conv (dim_vector (nr, nc));
+
+  dst_elt_type *conv_data = conv.fortran_vec ();
+
+  octave_idx_type j = 0;
+
+  for (std::list<void *>::const_iterator it = input_buf_list.begin ();
+       it != input_buf_list.end (); it++)
     {
-      if (nc > 0)
+      SRC_T *data = static_cast<SRC_T *> (*it);
+
+      if (swap || do_float_fmt_conv)
         {
-          nda.resize (dim_vector (nr, nc), elt_zero);
-          dat = nda.fortran_vec ();
-          max_size = nr * nc;
+          for (octave_idx_type i = 0; i < input_buf_elts && j < elts_read;
+               i++, j++)
+            {
+              if (swap)
+                swap_bytes<sizeof (SRC_T)> (&data[i]);
+              else if (do_float_fmt_conv)
+                do_float_format_conversion (&data[i], sizeof (SRC_T),
+                                            1, from_flt_fmt,
+                                            oct_mach_info::float_format ());
+
+              dst_elt_type tmp (data[i]);
+
+              if (do_NA_conv && __lo_ieee_is_old_NA (tmp))
+                tmp = __lo_ieee_replace_old_NA (tmp);
+
+              conv_data[j] = tmp;
+            }
         }
       else
         {
-          nda.resize (dim_vector (nr, 32), elt_zero);
-          dat = nda.fortran_vec ();
-          max_size = nr * 32;
+          if (do_NA_conv)
+            {
+              for (octave_idx_type i = 0; i < input_buf_elts && j < elts_read;
+                   i++, j++)
+                {
+                  dst_elt_type tmp (data[i]);
+
+                  if (__lo_ieee_is_old_NA (tmp))
+                    tmp = __lo_ieee_replace_old_NA (tmp);
+
+                  conv_data[j] = tmp;
+                }
+            }
+          else
+            {
+              for (octave_idx_type i = 0; i < input_buf_elts && j < elts_read;
+                   i++, j++)
+                conv_data[j] = data[i];
+            }
         }
+
+      delete [] data;
     }
-  else
+
+  input_buf_list.clear ();
+
+  for (octave_idx_type i = elts_read; i < nr * nc; i++)
+    conv_data[i] = dst_elt_type (0);
+
+  return conv;
+}
+
+typedef octave_value (*conv_fptr)
+  (std::list<void *>& input_buf_list, octave_idx_type input_buf_elts,
+   octave_idx_type elts_read, octave_idx_type nr, octave_idx_type nc,
+   bool swap, bool do_float_fmt_conv, bool do_NA_conv,
+   oct_mach_info::float_format from_flt_fmt);
+
+#define TABLE_ELT(T, U, V, W) \
+  conv_fptr_table[oct_data_conv::T][oct_data_conv::U] = convert_and_copy<V, W>
+
+#define FILL_TABLE_ROW(T, V) \
+  TABLE_ELT (T, dt_int8, V, int8NDArray); \
+  TABLE_ELT (T, dt_uint8, V, uint8NDArray); \
+  TABLE_ELT (T, dt_int16, V, int16NDArray); \
+  TABLE_ELT (T, dt_uint16, V, uint16NDArray); \
+  TABLE_ELT (T, dt_int32, V, int32NDArray); \
+  TABLE_ELT (T, dt_uint32, V, uint32NDArray); \
+  TABLE_ELT (T, dt_int64, V, int64NDArray); \
+  TABLE_ELT (T, dt_uint64, V, uint64NDArray); \
+  TABLE_ELT (T, dt_single, V, FloatNDArray); \
+  TABLE_ELT (T, dt_double, V, NDArray); \
+  TABLE_ELT (T, dt_char, V, charNDArray); \
+  TABLE_ELT (T, dt_schar, V, charNDArray); \
+  TABLE_ELT (T, dt_uchar, V, charNDArray); \
+  TABLE_ELT (T, dt_logical, V, boolNDArray);
+
+octave_value
+octave_stream::finalize_read (std::list<void *>& input_buf_list,
+                              octave_idx_type input_buf_elts,
+                              octave_idx_type elts_read,
+                              octave_idx_type nr, octave_idx_type nc,
+                              oct_data_conv::data_type input_type,
+                              oct_data_conv::data_type output_type,
+                              oct_mach_info::float_format ffmt)
+{
+  octave_value retval;
+
+  static bool initialized = false;
+
+  // Table function pointers for return types x read types.
+
+  static conv_fptr conv_fptr_table[oct_data_conv::dt_unknown][14];
+
+  if (! initialized)
     {
-      nda.resize (dim_vector (32, 1), elt_zero);
-      dat = nda.fortran_vec ();
-      max_size = 32;
+      for (int i = 0; i < oct_data_conv::dt_unknown; i++)
+        for (int j = 0; j < 14; j++)
+          conv_fptr_table[i][j] = 0;
+
+      FILL_TABLE_ROW (dt_int8, int8_t);
+      FILL_TABLE_ROW (dt_uint8, uint8_t);
+      FILL_TABLE_ROW (dt_int16, int16_t);
+      FILL_TABLE_ROW (dt_uint16, uint16_t);
+      FILL_TABLE_ROW (dt_int32, int32_t);
+      FILL_TABLE_ROW (dt_uint32, uint32_t);
+      FILL_TABLE_ROW (dt_int64, int64_t);
+      FILL_TABLE_ROW (dt_uint64, uint64_t);
+      FILL_TABLE_ROW (dt_single, float);
+      FILL_TABLE_ROW (dt_double, double);
+      FILL_TABLE_ROW (dt_char, char);
+      FILL_TABLE_ROW (dt_schar, signed char);
+      FILL_TABLE_ROW (dt_uchar, unsigned char);
+      FILL_TABLE_ROW (dt_logical, bool);
+
+      initialized = true;
     }
 
-  // FIXME -- byte order for Cray?
-
   bool swap = false;
 
+  if (ffmt == oct_mach_info::flt_fmt_unknown)
+    ffmt = float_format ();
+
   if (oct_mach_info::words_big_endian ())
-    swap = (from_flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian
-            || from_flt_fmt == oct_mach_info::flt_fmt_vax_g
-            || from_flt_fmt == oct_mach_info::flt_fmt_vax_g);
+    swap = (ffmt == oct_mach_info::flt_fmt_ieee_little_endian);
   else
-    swap = (from_flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian);
-
-  union
-  {
-    char buf[sizeof (typename strip_template_param<octave_int, READ_T>::type)];
-    typename strip_template_param<octave_int, READ_T>::type val;
-  } u;
-
-  std::istream *isp = strm.input_stream ();
-
-  if (isp)
+    swap = (ffmt == oct_mach_info::flt_fmt_ieee_big_endian);
+
+  bool do_float_fmt_conv = ((input_type == oct_data_conv::dt_double
+                             || input_type == oct_data_conv::dt_single)
+                            && ffmt != float_format ());
+
+  bool do_NA_conv = (output_type == oct_data_conv::dt_double);
+
+  switch (output_type)
     {
-      std::istream& is = *isp;
-
-      octave_idx_type elts_read = 0;
-
-      for (;;)
-        {
-          // FIXME -- maybe there should be a special case for
-          // skip == 0.
-
-          if (is)
-            {
-              if (nr > 0 && nc > 0 && count == max_size)
-                {
-                  final_nr = nr;
-                  final_nc = nc;
-
-                  break;
-                }
-
-              is.read (u.buf, sizeof (typename strip_template_param<octave_int, READ_T>::type));
-
-              // We only swap bytes for integer types.  For float
-              // types, the format conversion will also handle byte
-              // swapping.
-
-              if (swap)
-                swap_bytes<sizeof (typename strip_template_param<octave_int, READ_T>::type)> (u.buf);
-              else if (do_float_fmt_conv)
-                do_float_format_conversion
-                  (u.buf,
-                   sizeof (typename strip_template_param<octave_int, READ_T>::type),
-                   1, from_flt_fmt, oct_mach_info::float_format ());
-
-              typename RET_T::element_type tmp
-                = static_cast <typename RET_T::element_type> (u.val);
-
-              if (is)
-                {
-                  if (count == max_size)
-                    {
-                      max_size *= 2;
-
-                      if (nr > 0)
-                        nda.resize (dim_vector (nr, max_size / nr),
-                                    elt_zero);
-                      else
-                        nda.resize (dim_vector (max_size, 1), elt_zero);
-
-                      dat = nda.fortran_vec ();
-                    }
-
-                  if (do_NA_conv && __lo_ieee_is_old_NA (tmp))
-                    tmp = __lo_ieee_replace_old_NA (tmp);
-
-                  dat[count++] = tmp;
-
-                  elts_read++;
-                }
-
-              int seek_status = 0;
-
-              if (skip != 0 && elts_read == block_size)
-                {
-                  seek_status = strm.seek (skip, SEEK_CUR);
-                  elts_read = 0;
-                }
-
-              if (is.eof () || seek_status < 0)
-                {
-                  if (nr > 0)
-                    {
-                      if (count > nr)
-                        {
-                          final_nr = nr;
-                          final_nc = (count - 1) / nr + 1;
-                        }
-                      else
-                        {
-                          final_nr = count;
-                          final_nc = 1;
-                        }
-                    }
-                  else
-                    {
-                      final_nr = count;
-                      final_nc = 1;
-                    }
-
-                  break;
-                }
-            }
-          else if (is.eof ())
-            break;
-        }
+    case oct_data_conv::dt_int8:
+    case oct_data_conv::dt_uint8:
+    case oct_data_conv::dt_int16:
+    case oct_data_conv::dt_uint16:
+    case oct_data_conv::dt_int32:
+    case oct_data_conv::dt_uint32:
+    case oct_data_conv::dt_int64:
+    case oct_data_conv::dt_uint64:
+    case oct_data_conv::dt_single:
+    case oct_data_conv::dt_double:
+    case oct_data_conv::dt_char:
+    case oct_data_conv::dt_schar:
+    case oct_data_conv::dt_uchar:
+    case oct_data_conv::dt_logical:
+      {
+        conv_fptr fptr = conv_fptr_table[input_type][output_type];
+
+        retval = fptr (input_buf_list, input_buf_elts, elts_read,
+                       nr, nc, swap, do_float_fmt_conv, do_NA_conv, ffmt);
+      }
+      break;
+
+    default:
+      retval = false;
+      (*current_liboctave_error_handler)
+        ("read: invalid type specification");
+      break;
     }
-
-  nda.resize (dim_vector (final_nr, final_nc), elt_zero);
-
-  retval = nda;
+  
 
   return retval;
 }
 
-#define DO_READ_VAL_TEMPLATE(RET_T, READ_T) \
-  template octave_value \
-  do_read<RET_T, READ_T> (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool, \
-                          oct_mach_info::float_format, octave_idx_type&)
-
-// FIXME -- should we only have float if it is a different
-// size from double?
-
-#define INSTANTIATE_DO_READ(VAL_T) \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_int8); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_uint8); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_int16); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_uint16); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_int32); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_uint32); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_int64); \
-  DO_READ_VAL_TEMPLATE (VAL_T, octave_uint64); \
-  DO_READ_VAL_TEMPLATE (VAL_T, float); \
-  DO_READ_VAL_TEMPLATE (VAL_T, double); \
-  DO_READ_VAL_TEMPLATE (VAL_T, char); \
-  DO_READ_VAL_TEMPLATE (VAL_T, signed char); \
-  DO_READ_VAL_TEMPLATE (VAL_T, unsigned char)
-
-INSTANTIATE_DO_READ (int8NDArray);
-INSTANTIATE_DO_READ (uint8NDArray);
-INSTANTIATE_DO_READ (int16NDArray);
-INSTANTIATE_DO_READ (uint16NDArray);
-INSTANTIATE_DO_READ (int32NDArray);
-INSTANTIATE_DO_READ (uint32NDArray);
-INSTANTIATE_DO_READ (int64NDArray);
-INSTANTIATE_DO_READ (uint64NDArray);
-INSTANTIATE_DO_READ (FloatNDArray);
-INSTANTIATE_DO_READ (NDArray);
-INSTANTIATE_DO_READ (charNDArray);
-INSTANTIATE_DO_READ (boolNDArray);
-
-typedef octave_value (*read_fptr) (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool,
-                                   oct_mach_info::float_format ffmt, octave_idx_type&);
-
-#define FILL_TABLE_ROW(R, VAL_T) \
-  read_fptr_table[R][oct_data_conv::dt_int8] = do_read<VAL_T, octave_int8>; \
-  read_fptr_table[R][oct_data_conv::dt_uint8] = do_read<VAL_T, octave_uint8>; \
-  read_fptr_table[R][oct_data_conv::dt_int16] = do_read<VAL_T, octave_int16>; \
-  read_fptr_table[R][oct_data_conv::dt_uint16] = do_read<VAL_T, octave_uint16>; \
-  read_fptr_table[R][oct_data_conv::dt_int32] = do_read<VAL_T, octave_int32>; \
-  read_fptr_table[R][oct_data_conv::dt_uint32] = do_read<VAL_T, octave_uint32>; \
-  read_fptr_table[R][oct_data_conv::dt_int64] = do_read<VAL_T, octave_int64>; \
-  read_fptr_table[R][oct_data_conv::dt_uint64] = do_read<VAL_T, octave_uint64>; \
-  read_fptr_table[R][oct_data_conv::dt_single] = do_read<VAL_T, float>; \
-  read_fptr_table[R][oct_data_conv::dt_double] = do_read<VAL_T, double>; \
-  read_fptr_table[R][oct_data_conv::dt_char] = do_read<VAL_T, char>; \
-  read_fptr_table[R][oct_data_conv::dt_schar] = do_read<VAL_T, signed char>; \
-  read_fptr_table[R][oct_data_conv::dt_uchar] = do_read<VAL_T, unsigned char>; \
-  read_fptr_table[R][oct_data_conv::dt_logical] = do_read<VAL_T, unsigned char>
-
 octave_value
 octave_stream::read (const Array<double>& size, octave_idx_type block_size,
                      oct_data_conv::data_type input_type,
@@ -3257,38 +3158,13 @@
                      octave_idx_type skip, oct_mach_info::float_format ffmt,
                      octave_idx_type& char_count)
 {
-  static bool initialized = false;
-
-  // Table function pointers for return types x read types.
-
-  static read_fptr read_fptr_table[oct_data_conv::dt_unknown][14];
-
-  if (! initialized)
-    {
-      for (int i = 0; i < oct_data_conv::dt_unknown; i++)
-        for (int j = 0; j < 14; j++)
-          read_fptr_table[i][j] = 0;
-
-      FILL_TABLE_ROW (oct_data_conv::dt_int8, int8NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_uint8, uint8NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_int16, int16NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_uint16, uint16NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_int32, int32NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_uint32, uint32NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_int64, int64NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_uint64, uint64NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_single, FloatNDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_double, NDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_char, charNDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_schar, charNDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_uchar, charNDArray);
-      FILL_TABLE_ROW (oct_data_conv::dt_logical, boolNDArray);
-
-      initialized = true;
-    }
-
   octave_value retval;
 
+  octave_idx_type nr = -1;
+  octave_idx_type nc = -1;
+
+  bool one_elt_size_spec = false;
+
   if (stream_ok ())
     {
       // FIXME -- we may eventually want to make this extensible.
@@ -3299,47 +3175,112 @@
 
       char_count = 0;
 
-      octave_idx_type nr = -1;
-      octave_idx_type nc = -1;
-
-      bool ignore;
-
-      get_size (size, nr, nc, ignore, "fread");
+      get_size (size, nr, nc, one_elt_size_spec, "fread");
 
       if (! error_state)
         {
-          if (nr == 0 || nc == 0)
-            retval = Matrix (nr, nc);
+
+          octave_idx_type elts_to_read = std::numeric_limits<octave_idx_type>::max ();
+
+          if (one_elt_size_spec)
+            {
+              // If NR == 0, Matlab returns [](0x0).
+
+              // If NR > 0, the result will be a column vector with the given
+              // number of rows.
+
+              // If NR < 0, then we have Inf and the result will be a column
+              // vector but we have to wait to see how big NR will be.
+
+              if (nr == 0)
+                nr = nc = 0;
+              else
+                nc = 1;
+            }
           else
             {
-              if (ffmt == oct_mach_info::flt_fmt_unknown)
-                ffmt = float_format ();
-
-              read_fptr fcn = read_fptr_table[output_type][input_type];
-
-              bool do_float_fmt_conv = ((input_type == oct_data_conv::dt_double
-                                         || input_type == oct_data_conv::dt_single)
-                                        && ffmt != float_format ());
-
-              bool do_NA_conv = (output_type == oct_data_conv::dt_double);
-
-              if (fcn)
+              // Matlab returns [] even if there are two elements in the size
+              // specification and one is nonzero.
+
+              // If NC < 0 we have [NR, Inf] and we'll wait to decide how big NC
+              // should be.
+
+              if (nr == 0 || nc == 0)
+                nr = nc = 0;
+            }
+
+          // FIXME -- ensure that this does not overflow.
+
+          elts_to_read = nr * nc;
+
+          bool read_to_eof = elts_to_read < 0;
+
+          octave_idx_type input_buf_elts = -1;
+
+          if (skip == 0)
+            {
+              if (read_to_eof)
+                input_buf_elts = 1024 * 1024;
+              else
+                input_buf_elts = elts_to_read;
+            }
+          else
+            input_buf_elts = block_size;
+
+          octave_idx_type input_elt_size = oct_data_conv::data_type_size (input_type);
+
+          octave_idx_type input_buf_size = input_buf_elts * input_elt_size;
+
+          assert (input_buf_size >= 0);
+
+          // Must also work and return correct type object for 0 elements to read.
+
+          std::istream *isp = input_stream ();
+
+          if (isp)
+            {
+              std::istream& is = *isp;
+
+              std::list <void *> input_buf_list;
+
+              octave_idx_type elts_read = 0;
+
+              while (is && ! is.eof () && (read_to_eof || elts_read < elts_to_read))
                 {
-                  retval = (*fcn) (*this, nr, nc, block_size, skip,
-                                   do_float_fmt_conv, do_NA_conv,
-                                   ffmt, char_count);
-
-                  // FIXME -- kluge!
-
-                  if (! error_state
-                      && (output_type == oct_data_conv::dt_char
-                          || output_type == oct_data_conv::dt_schar
-                          || output_type == oct_data_conv::dt_uchar))
-                    retval = retval.char_matrix_value ();
+                  char *input_buf = new char [input_buf_size];
+
+                  is.read (input_buf, input_buf_size);
+
+                  size_t count = is.gcount ();
+
+                  char_count += count;
+
+                  elts_read += count / input_elt_size;
+
+                  input_buf_list.push_back (input_buf);
+
+                  if (is && skip != 0 && elts_read == block_size)
+                    {
+                      int seek_status = seek (skip, SEEK_CUR);
+
+                      if (seek_status < 0)
+                        break;
+                    }
                 }
-              else
-                error ("fread: unable to read and convert requested types");
+
+              if (read_to_eof)
+                {
+                  if (nc < 0)
+                    nc = elts_read / nr + 1;
+                  else
+                    nr = elts_read;
+                }
+
+              retval = finalize_read (input_buf_list, input_buf_elts, elts_read,
+                                      nr, nc, input_type, output_type, ffmt);
             }
+          else
+            error ("fread: invalid input stream");
         }
       else
         invalid_operation ("fread", "reading");
@@ -3377,103 +3318,106 @@
   return retval;
 }
 
-template <class T>
-void
-write_int (std::ostream& os, bool swap, const T& val)
+template <class T, class V>
+static void
+convert_ints (const T *data, void *conv_data, octave_idx_type n_elts,
+              bool swap)
 {
-  typename T::val_type tmp = val.value ();
-
-  if (swap)
-    swap_bytes<sizeof (typename T::val_type)> (&tmp);
-
-  os.write (reinterpret_cast<const char *> (&tmp),
-            sizeof (typename T::val_type));
+  typedef typename V::val_type val_type;
+
+  val_type *vt_data = static_cast <val_type *> (conv_data);
+
+  for (octave_idx_type i = 0; i < n_elts; i++)
+    {
+      V val (data[i]);
+
+      vt_data[i] = val.value ();
+
+      if (swap)
+        swap_bytes<sizeof (val_type)> (&vt_data[i]);
+    }
 }
 
-template void write_int (std::ostream&, bool, const octave_int8&);
-template void write_int (std::ostream&, bool, const octave_uint8&);
-template void write_int (std::ostream&, bool, const octave_int16&);
-template void write_int (std::ostream&, bool, const octave_uint16&);
-template void write_int (std::ostream&, bool, const octave_int32&);
-template void write_int (std::ostream&, bool, const octave_uint32&);
-template void write_int (std::ostream&, bool, const octave_int64&);
-template void write_int (std::ostream&, bool, const octave_uint64&);
-
 template <class T>
-static inline bool
-do_write (std::ostream& os, const T& val, oct_data_conv::data_type output_type,
-          oct_mach_info::float_format flt_fmt, bool swap,
-          bool do_float_conversion)
+static bool
+convert_data (const T *data, void *conv_data, octave_idx_type n_elts,
+              oct_data_conv::data_type output_type,
+              oct_mach_info::float_format flt_fmt)
 {
   bool retval = true;
 
-  // For compatibility, Octave converts to the output type, then
-  // writes.  This means that truncation happens on the conversion.
-  // For example, the following program prints 0:
-  //
-  //   x = int8 (-1)
-  //   f = fopen ("foo.dat", "w");
-  //   fwrite (f, x, "unsigned char");
-  //   fclose (f);
-  //   f = fopen ("foo.dat", "r");
-  //   y = fread (f, 1, "unsigned char");
-  //   printf ("%d\n", y);
+  bool swap
+    = ((oct_mach_info::words_big_endian ()
+        && flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian)
+       || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian);
+
+  bool do_float_conversion =  flt_fmt != oct_mach_info::float_format ();
+
+  // We use octave_intN classes here instead of converting directly to
+  // intN_t so that we get integer saturation semantics.
 
   switch (output_type)
     {
     case oct_data_conv::dt_char:
     case oct_data_conv::dt_schar:
     case oct_data_conv::dt_int8:
-      write_int (os, swap, octave_int8 (val));
+      convert_ints<T, octave_int8> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_uchar:
     case oct_data_conv::dt_uint8:
-      write_int (os, swap, octave_uint8 (val));
+      convert_ints<T, octave_uint8> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_int16:
-      write_int (os, swap, octave_int16 (val));
+      convert_ints<T, octave_int16> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_uint16:
-      write_int (os, swap, octave_uint16 (val));
+      convert_ints<T, octave_uint16> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_int32:
-      write_int (os, swap, octave_int32 (val));
+      convert_ints<T, octave_int32> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_uint32:
-      write_int (os, swap, octave_uint32 (val));
+      convert_ints<T, octave_uint32> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_int64:
-      write_int (os, swap, octave_int64 (val));
+      convert_ints<T, octave_int64> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_uint64:
-      write_int (os, swap, octave_uint64 (val));
+      convert_ints<T, octave_uint64> (data, conv_data, n_elts, swap);
       break;
 
     case oct_data_conv::dt_single:
       {
-        float f = static_cast<float> (val);
-
-        if (do_float_conversion)
-          do_float_format_conversion (&f, 1, flt_fmt);
-
-        os.write (reinterpret_cast<const char *> (&f), sizeof (float));
+        float *vt_data = static_cast <float *> (conv_data);
+
+        for (octave_idx_type i = 0; i < n_elts; i++)
+          {
+            vt_data[i] = data[i];
+
+            if (do_float_conversion)
+              do_float_format_conversion (&vt_data[i], 1, flt_fmt);
+          }
       }
       break;
 
     case oct_data_conv::dt_double:
       {
-        double d = static_cast<double> (val);
-        if (do_float_conversion)
-          do_double_format_conversion (&d, 1, flt_fmt);
-
-        os.write (reinterpret_cast<const char *> (&d), sizeof (double));
+        double *vt_data = static_cast <double *> (conv_data);
+
+        for (octave_idx_type i = 0; i < n_elts; i++)
+          {
+            vt_data[i] = data[i];
+
+            if (do_float_conversion)
+              do_double_format_conversion (&vt_data[i], 1, flt_fmt);
+          }
       }
       break;
 
@@ -3487,198 +3431,174 @@
   return retval;
 }
 
-template bool
-do_write (std::ostream&, const octave_int8&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_uint8&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_int16&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_uint16&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_int32&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_uint32&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_int64&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
-
-template bool
-do_write (std::ostream&, const octave_uint64&, oct_data_conv::data_type,
-          oct_mach_info::float_format, bool, bool);
+bool
+octave_stream::write_bytes (const void *data, size_t nbytes)
+{
+  bool status = false;
+
+  std::ostream *osp = output_stream ();
+
+  if (osp)
+    {
+      std::ostream& os = *osp;
+
+      if (os)
+        {
+          os.write (static_cast<const char *> (data), nbytes);
+
+          if (os)
+            status = true;
+        }
+    }
+
+  return status;
+}
+
+bool
+octave_stream::skip_bytes (size_t skip)
+{
+  bool status = false;
+
+  std::ostream *osp = output_stream ();
+
+  if (osp)
+    {
+      std::ostream& os = *osp;
+
+      // Seek to skip when inside bounds of existing file.
+      // Otherwise, write NUL to skip.
+
+      off_t orig_pos = tell ();
+
+      seek (0, SEEK_END);
+
+      off_t eof_pos = tell ();
+
+      // Is it possible for this to fail to return us to the
+      // original position?
+      seek (orig_pos, SEEK_SET);
+
+      size_t remaining = eof_pos - orig_pos;
+
+      if (remaining < skip)
+        {
+          seek (0, SEEK_END);
+
+          // FIXME -- probably should try to write larger blocks...
+
+          unsigned char zero = 0;
+          for (size_t j = 0; j < skip - remaining; j++)
+            os.write (reinterpret_cast<const char *> (&zero), 1);
+        }
+      else
+        seek (skip, SEEK_CUR);
+
+      if (os)
+        status = true;
+    }
+
+  return status;
+}
 
 template <class T>
 octave_idx_type
 octave_stream::write (const Array<T>& data, octave_idx_type block_size,
                       oct_data_conv::data_type output_type,
-                      octave_idx_type skip, oct_mach_info::float_format flt_fmt)
+                      octave_idx_type skip,
+                      oct_mach_info::float_format flt_fmt)
 {
-  octave_idx_type retval = -1;
-
-  bool status = true;
-
-  octave_idx_type count = 0;
-
-  const T *d = data.data ();
-
-  octave_idx_type n = data.length ();
-
-  oct_mach_info::float_format native_flt_fmt
-    = oct_mach_info::float_format ();
-
-  bool do_float_conversion = (flt_fmt != native_flt_fmt);
-
-  // FIXME -- byte order for Cray?
-
-  bool swap = false;
-
-  if (oct_mach_info::words_big_endian ())
-    swap = (flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian
-            || flt_fmt == oct_mach_info::flt_fmt_vax_g
-            || flt_fmt == oct_mach_info::flt_fmt_vax_g);
+  bool swap
+    = ((oct_mach_info::words_big_endian ()
+        && flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian)
+       || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian);
+
+  bool do_data_conversion
+    = (swap || ! is_equivalent_type<T> (output_type) 
+       || flt_fmt != oct_mach_info::float_format ());
+
+  octave_idx_type nel = data.numel ();
+
+  octave_idx_type chunk_size;
+
+  if (skip != 0)
+    chunk_size = block_size;
+  else if (do_data_conversion)
+    chunk_size = 1024 * 1024;
   else
-    swap = (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian);
-
-  for (octave_idx_type i = 0; i < n; i++)
+    chunk_size = nel;
+
+  octave_idx_type i = 0;
+
+  const T *pdata = data.data ();
+
+  while (i < nel)
     {
-      std::ostream *osp = output_stream ();
-
-      if (osp)
+      if (skip != 0)
         {
-          std::ostream& os = *osp;
-
-          if (skip != 0 && (i % block_size) == 0)
-            {
-              // Seek to skip when inside bounds of existing file.
-              // Otherwise, write NUL to skip.
-
-              off_t orig_pos = tell ();
-
-              seek (0, SEEK_END);
-
-              off_t eof_pos = tell ();
-
-              // Is it possible for this to fail to return us to the
-              // original position?
-              seek (orig_pos, SEEK_SET);
-
-              off_t remaining = eof_pos - orig_pos;
-
-              if (remaining < skip)
-                {
-                  seek (0, SEEK_END);
-
-                  // FIXME -- probably should try to write larger
-                  // blocks...
-
-                  unsigned char zero = 0;
-                  for (octave_idx_type j = 0; j < skip - remaining; j++)
-                    os.write (reinterpret_cast<const char *> (&zero), 1);
-                }
-              else
-                seek (skip, SEEK_CUR);
-            }
-
-          if (os)
-            {
-              status = do_write (os, d[i], output_type, flt_fmt, swap,
-                                 do_float_conversion);
-
-              if (os && status)
-                count++;
-              else
-                break;
-            }
-          else
-            {
-              status = false;
-              break;
-            }
+          if (! skip_bytes (skip))
+            return -1;
+        }
+
+      octave_idx_type remaining_nel = nel - i;
+
+      if (chunk_size > remaining_nel)
+        chunk_size = remaining_nel;
+
+      bool status = false;
+
+      if (do_data_conversion)
+        {
+          size_t output_size
+            = chunk_size * oct_data_conv::data_type_size (output_type);
+
+          OCTAVE_LOCAL_BUFFER (unsigned char, conv_data, output_size);
+
+          status = convert_data (&pdata[i], conv_data, chunk_size,
+                                 output_type, flt_fmt);
+
+          if (status)
+            status = write_bytes (conv_data, output_size);
         }
       else
-        {
-          status = false;
-          break;
-        }
+        status = write_bytes (pdata, sizeof (T) * chunk_size);
+
+      if (! status)
+        return -1;
+
+      i += chunk_size;
     }
 
-  if (status)
-    retval = count;
-
-  return retval;
+  return nel;
 }
 
-template octave_idx_type
-octave_stream::write (const Array<char>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<bool>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<double>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<float>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_int8>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_uint8>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_int16>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_uint16>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_int32>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_uint32>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_int64>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
-
-template octave_idx_type
-octave_stream::write (const Array<octave_uint64>&, octave_idx_type,
-                      oct_data_conv::data_type,
-                      octave_idx_type, oct_mach_info::float_format);
+#define INSTANTIATE_WRITE(T) \
+  template \
+  octave_idx_type \
+  octave_stream::write (const Array<T>& data, octave_idx_type block_size, \
+                        oct_data_conv::data_type output_type, \
+                        octave_idx_type skip, \
+                        oct_mach_info::float_format flt_fmt)
+
+INSTANTIATE_WRITE (octave_int8);
+INSTANTIATE_WRITE (octave_uint8);
+INSTANTIATE_WRITE (octave_int16);
+INSTANTIATE_WRITE (octave_uint16);
+INSTANTIATE_WRITE (octave_int32);
+INSTANTIATE_WRITE (octave_uint32);
+INSTANTIATE_WRITE (octave_int64);
+INSTANTIATE_WRITE (octave_uint64);
+INSTANTIATE_WRITE (int8_t);
+INSTANTIATE_WRITE (uint8_t);
+INSTANTIATE_WRITE (int16_t);
+INSTANTIATE_WRITE (uint16_t);
+INSTANTIATE_WRITE (int32_t);
+INSTANTIATE_WRITE (uint32_t);
+INSTANTIATE_WRITE (int64_t);
+INSTANTIATE_WRITE (uint64_t);
+INSTANTIATE_WRITE (bool);
+INSTANTIATE_WRITE (char);
+INSTANTIATE_WRITE (float);
+INSTANTIATE_WRITE (double);
 
 octave_value
 octave_stream::scanf (const std::string& fmt, const Array<double>& size,
--- a/libinterp/corefcn/oct-stream.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/oct-stream.h	Sat Oct 05 11:22:09 2013 -0400
@@ -31,12 +31,14 @@
 #include <iosfwd>
 #include <sstream>
 #include <string>
+#include <list>
 #include <map>
 
 #include "Array.h"
 #include "data-conv.h"
 #include "lo-utils.h"
 #include "mach-info.h"
+#include "oct-locbuf.h"
 #include "oct-refcount.h"
 
 class
@@ -539,13 +541,19 @@
                      octave_idx_type& count);
 
   octave_idx_type write (const octave_value& data, octave_idx_type block_size,
-             oct_data_conv::data_type output_type,
-             octave_idx_type skip, oct_mach_info::float_format flt_fmt);
+                         oct_data_conv::data_type output_type,
+                         octave_idx_type skip,
+                         oct_mach_info::float_format flt_fmt);
+
+  bool write_bytes (const void *data, size_t n_elts);
+
+  bool skip_bytes (size_t n_elts);
 
   template <class T>
-  octave_idx_type write (const Array<T>&, octave_idx_type block_size,
-             oct_data_conv::data_type output_type,
-             octave_idx_type skip, oct_mach_info::float_format flt_fmt);
+  octave_idx_type write (const Array<T>& data, octave_idx_type block_size,
+                         oct_data_conv::data_type output_type,
+                         octave_idx_type skip,
+                         oct_mach_info::float_format flt_fmt);
 
   octave_value scanf (const std::string& fmt, const Array<double>& size,
                       octave_idx_type& count, const std::string& who /* = "scanf" */);
@@ -641,6 +649,15 @@
       if (rep)
         rep->invalid_operation (who, rw);
     }
+
+  octave_value
+  finalize_read (std::list<void *>& input_buf_list,
+                 octave_idx_type input_buf_elts,
+                 octave_idx_type elts_read,
+                 octave_idx_type nr, octave_idx_type nc,
+                 oct_data_conv::data_type input_type,
+                 oct_data_conv::data_type output_type,
+                 oct_mach_info::float_format ffmt);
 };
 
 class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-tex-lexer.in.ll	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,146 @@
+/*
+
+Copyright (C) 2013 Michael Goffioul
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+%option prefix = "octave_tex_"
+%option noyywrap
+%option reentrant
+%option bison-bridge
+
+%top {
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "txt-eng.h"
+#include "oct-tex-parser.h"
+}
+
+%x	NUM_MODE
+%x	MAYBE_NUM_MODE
+
+D       [0-9]
+NUM	(({D}+\.?{D}*)|(\.{D}+))
+
+%%
+
+%{
+// Numeric values
+%}
+
+<NUM_MODE>{NUM}		{
+    int nread;
+
+    nread = sscanf (yytext, "%lf", &(yylval->num));
+    if (nread == 1)
+      return NUM;
+  }
+<NUM_MODE>[ \t]+	{ }
+<NUM_MODE>"\n"|.	{ yyless (0); BEGIN (INITIAL); }
+
+<MAYBE_NUM_MODE>"{"	{ BEGIN (NUM_MODE); return START; }
+<MAYBE_NUM_MODE>"\n"|.	{ yyless (0); BEGIN (INITIAL); }
+
+%{
+// Simple commands
+%}
+
+"\\bf"		{ return BF; }
+"\\it"		{ return IT; }
+"\\sl"		{ return SL; }
+"\\rm"		{ return RM; }
+
+%{
+// Generic font commands
+%}
+
+"\\fontname"	{ return FONTNAME; }
+"\\fontsize"	{ BEGIN (MAYBE_NUM_MODE); return FONTSIZE; }
+"\\color[rgb]"	{ BEGIN (MAYBE_NUM_MODE); return COLOR_RGB; }
+"\\color"	{ return COLOR; }
+
+%{
+// Special characters
+%}
+
+"{"	{ return START; }
+"}"	{ return END; }
+"^"	{ return SUPER; }
+"_"	{ return SUB; }
+
+"\\{"	|
+"\\}"	|
+"\\^"	|
+"\\_"	|
+"\\\\"	{ yylval->ch = yytext[1]; return CH; }
+
+%{
+// Symbols
+%}
+
+@SYMBOL_RULES@
+
+%{
+// Generic character
+%}
+
+"\n"	|
+.	{ yylval->ch = yytext[0]; return CH; }
+
+%%
+
+bool
+text_parser_tex::init_lexer (const std::string& s)
+{
+  if (! scanner)
+    octave_tex_lex_init (&scanner);
+
+  if (scanner)
+    {
+      if (buffer_state)
+        {
+          octave_tex__delete_buffer (reinterpret_cast<YY_BUFFER_STATE> (buffer_state),
+                                     scanner);
+          buffer_state = 0;
+        }
+
+      buffer_state = octave_tex__scan_bytes (s.data (), s.length (), scanner);
+    }
+
+  return (scanner && buffer_state);
+}
+
+void
+text_parser_tex::destroy_lexer (void)
+{
+  if (buffer_state)
+    {
+      octave_tex__delete_buffer (reinterpret_cast<YY_BUFFER_STATE> (buffer_state),
+                                 scanner);
+      buffer_state = 0;
+    }
+
+  if (scanner)
+    {
+      octave_tex_lex_destroy (scanner);
+      scanner = 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-tex-parser.yy	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,210 @@
+/*
+
+Copyright (C) 2013 Michael Goffioul
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+%{
+#define YYDEBUG 1
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "txt-eng.h"
+#include "oct-tex-parser.h"
+
+extern int octave_tex_lex (YYSTYPE *, void *);
+static void yyerror (text_parser_tex& parser, const char *s);
+
+#define scanner parser.get_scanner ()
+%}
+
+%name-prefix="octave_tex_"
+%define api.pure
+%parse-param { text_parser_tex& parser } 
+%lex-param { void *scanner }
+
+%code requires {#include <string>}
+
+%union {
+  /* Leaf symbols produced by the scanner */
+  char                       ch;
+  double                     num;
+  int                        sym;
+
+  /* Used for string buffering */
+  std::string*               str;
+
+  /* Objects produced by the parser */
+  text_element*              e_base;
+  text_element_list*         e_list;
+}
+
+%token BF IT SL RM
+%token FONTNAME FONTSIZE
+%token COLOR COLOR_RGB
+%token START END SUPER SUB
+%token<ch> CH
+%token<num> NUM
+%token<sym> SYM
+
+%type<str> simple_string
+%type<e_base> string_element symbol_element
+%type<e_base> superscript_element subscript_element combined_script_element
+%type<e_base> font_modifier_element fontname_element fontsize_element color_element
+%type<e_list> string_element_list scoped_string_element_list
+
+/* Make sure there's no memory leak on parse error. */
+%destructor { } <ch> <num> <sym>
+%destructor { delete $$; } <*>
+
+%nonassoc SCRIPT
+%nonassoc SUB SUPER
+
+%nonassoc STR
+%nonassoc CH
+
+%start string
+
+%%
+
+simple_string			: CH
+				  { $$ = new std::string (1, $1); }
+				| simple_string CH
+				  { $1->append (1, $2); $$ = $1; }
+				;
+
+symbol_element			: SYM
+				  { $$ = new text_element_symbol ($1); }
+				;
+
+font_modifier_element		: BF
+				  { $$ = new text_element_fontstyle (text_element_fontstyle::bold); }
+				| IT
+				  { $$ = new text_element_fontstyle (text_element_fontstyle::italic); }
+				| SL
+				  { $$ = new text_element_fontstyle (text_element_fontstyle::oblique); }
+				| RM
+				  { $$ = new text_element_fontstyle (text_element_fontstyle::normal); }
+				;
+
+fontsize_element		: FONTSIZE START NUM END
+				  { $$ = new text_element_fontsize ($3); }
+				;
+
+fontname_element		: FONTNAME START simple_string END
+				  {
+				    $$ = new text_element_fontname (*$3);
+				    delete $3;
+				  }
+				;
+
+color_element			: COLOR START simple_string END
+				  {
+				    $$ = new text_element_color (*$3);
+				    delete $3;
+				  }
+				| COLOR_RGB START NUM NUM NUM END
+				  {
+				    $$ = new text_element_color ($3, $4, $5);
+				  }
+				;
+
+string_element			: simple_string %prec STR
+				  {
+				    $$ = new text_element_string (*$1);
+				    delete $1;
+				  }
+				| scoped_string_element_list
+				  /* This is just to avoid a warning in bison. */
+				  { $$ = $1; }
+				| symbol_element
+				| font_modifier_element
+				| fontsize_element
+				| fontname_element
+				| color_element
+				| superscript_element %prec SCRIPT
+				| subscript_element %prec SCRIPT
+				| combined_script_element
+				;
+
+superscript_element		: SUPER CH
+				  { $$ = new text_element_superscript ($2); }
+				| SUPER scoped_string_element_list
+				  { $$ = new text_element_superscript ($2); }
+				| SUPER symbol_element
+				  { $$ = new text_element_superscript ($2); }
+				;
+
+subscript_element		: SUB CH
+				  { $$ = new text_element_subscript ($2); }
+				| SUB scoped_string_element_list
+				  { $$ = new text_element_subscript ($2); }
+				| SUB symbol_element
+				  { $$ = new text_element_subscript ($2); }
+				;
+
+combined_script_element		: subscript_element superscript_element
+				  { $$ = new text_element_combined ($1, $2); }
+				| superscript_element subscript_element
+				  { $$ = new text_element_combined ($1, $2); }
+				;
+
+string_element_list		: string_element
+				  { $$ = new text_element_list ($1); }
+				| string_element_list string_element
+				  { $1->push_back ($2); $$ = $1; }
+				;
+
+scoped_string_element_list	: START string_element_list END
+				  { $$ = $2; }
+				| START END
+				  { $$ = new text_element_list (); }
+				;
+
+string				: /* empty */
+				  { parser.set_parse_result (new text_element_string ("")); }
+				| string_element_list
+				  { parser.set_parse_result ($1); }
+				;
+
+%%
+
+text_element*
+text_parser_tex::parse (const std::string& s)
+{
+  octave_tex_debug = 0;
+
+  if (init_lexer (s))
+    {
+      result = 0;
+
+      if (octave_tex_parse (*this) == 0)
+        return result;
+    }
+
+  return new text_element_string (s);
+}
+
+static void
+yyerror (text_parser_tex&, const char *s)
+{
+  fprintf (stderr, "TeX parse error: %s\n", s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-tex-symbols.in	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,113 @@
+# List of supported symbols for the TeX interpreter
+# (http://www.mathworks.com/help/matlab/ref/text_props.html):
+# - symbol name
+# - Unicode code
+# - MS symbol code (http://www.kostis.net/charsets/symbol.htm)
+# - Arranged by listings in The TeXbook, Appendix F 
+# - Lowercase Greek letters: Greek Upper case: Misc Symbols type Ord: "Large" operators:
+# - Binary operators: Relations: Negated relations: Arrows: Openings: Closings: Alternate names:
+# - Other (not in Appendix F Tables):
+
+alpha           0x03B1  0xF061
+beta            0x03B2  0xF062
+gamma           0x03B3  0xF067
+delta           0x03B4  0xF064
+epsilon         0x03B5  0xF065
+zeta            0x03B6  0xF07A
+eta             0x03B7  0xF068
+theta           0x03B8  0xF071
+vartheta        0x03D1  0xF04A
+iota            0x03B9  0xF069
+kappa           0x03BA  0xF06B
+lambda          0x03BB  0xF06C
+mu              0x03BC  0xF06D
+nu              0x03BD  0xF06E
+xi              0x03BE  0xF078
+o               0x03BF  0xF0B0
+pi              0x03C0  0xF070
+varpi           0x03D6  0xF076
+rho             0x03C1  0xF072
+sigma           0x03C3  0xF073
+varsigma        0x03C2  0xF056
+tau             0x03C4  0xF074
+upsilon         0x03C5  0xF075
+phi             0x03C6  0xF066
+chi             0x03C7  0xF063
+psi             0x03C8  0xF079
+omega           0x03C9  0xF077
+Gamma           0x0393  0xF047
+Delta           0x0394  0xF044
+Theta           0x0398  0xF051
+Lambda          0x039B  0xF04C
+Xi              0x039E  0xF058
+Pi              0x03A0  0xF050
+Sigma           0x03A3  0xF053
+Upsilon         0x03D2  0xF055
+Phi             0x03A6  0xF046
+Psi             0x03A8  0xF059
+Omega           0x03A9  0xF057
+aleph           0x2135  0xF0C0
+wp              0x2118  0xF0C3
+Re              0x211C  0xF0C2
+Im              0x2111  0xF0C1
+partial         0x2202  0xF0B6
+infty           0x221E  0xF0A5
+prime           0x2032  0xF0A2
+nabla           0x2207  0xF0D1
+surd            0x221A  0xF0D6
+angle           0x2220  0xF0D0
+forall          0x2200  0xF022
+exists          0x2203  0xF024
+neg             0x00AC  0xF0D8
+clubsuit        0x2663  0xF0A7
+diamondsuit     0x2666  0xF0A8
+heartsuit       0x2665  0xF0A9
+spadesuit       0x2660  0xF0AA
+int             0x222B  0xF0F2
+pm              0x00B1  0xF0B1
+cdot            0x22C5  0xF0D7
+times           0x00D7  0xF0B4
+ast             0x2217  0xF02A
+circ            0x2218  0xF0B0
+bullet          0x2219  0xF0B7
+div             0x00F7  0xF0B8
+cap             0x2229  0xF0C7
+cup             0x222A  0xF0C8
+vee             0x2228  0xF0DA
+wedge           0x2227  0xF0D9
+oplus           0x2295  0xF0C5
+otimes          0x2297  0xF0C4
+oslash          0x2298  0xF0C6
+leq             0x2264  0xF0A3
+subset          0x2282  0xF0CC
+subseteq        0x2286  0xF0CD
+in              0x2208  0xF0CE
+geq             0x2265  0xF0B3
+supset          0x2283  0xF0C9
+supseteq        0x2287  0xF0CA
+ni              0x220B  0xF027
+mid             0x2223  0xF0BD
+equiv           0x2261  0xF0BA
+sim             0x223C  0xF07E
+approx          0x2248  0xF0BB
+cong            0x2245  0xF040
+propto          0x221D  0xF0B5
+perp            0x22A5  0xF05E
+leftarrow       0x2190  0xF0AC
+Leftarrow       0x21D0  0xF0DC
+rightarrow      0x2192  0xF0AE
+Rightarrow      0x21D2  0xF0DE
+leftrightarrow  0x2194  0xF0AB
+uparrow         0x2191  0xF0AD
+downarrow       0x2193  0xF0AF
+lfloor          0x230A  0xF0EB
+langle          0x27E8  0xF0E1
+lceil           0x2308  0xF0E9
+rfloor          0x230B  0xF0FB
+rangle          0x27E9  0xF0F1
+rceil           0x2309  0xF0F9
+neq             0x2260  0xF0B9
+ldots           0x2026  0xF0BC
+0               0x2298  0xF0C6
+copyright       0x00A9  0xF0E3
+deg             0x00B0  0xF0B0
--- a/libinterp/corefcn/octave-link.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/octave-link.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -231,7 +231,7 @@
 
           retval.resize (3);
 
-          // If 3, then is filename, directory and selected index.
+          // If 3, then retval is filename, directory, and selected index.
           if (nel <= 3)
             {
               int idx = 0;
@@ -250,12 +250,12 @@
           else
             {
               // Multiple files.
-              nel = items_lst.size ();
+              nel = items_lst.size () - 2;
               Cell items (dim_vector (1, nel));
 
               std::list<std::string>::iterator it = items_lst.begin ();
 
-              for (unsigned int idx = 0; idx < items_lst.size ()-2; idx++)
+              for (int idx = 0; idx < nel; idx++)
                 {
                   items.xelem (idx) = *it;
                   it++;
@@ -402,3 +402,36 @@
 
   return retval;
 }
+
+DEFUN (__octave_link_show_preferences__, , ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} __octave_link_show_preferences__ ()\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  retval = octave_link::show_preferences ();
+
+  return retval;
+}
+
+DEFUN (__octave_link_show_doc__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} __octave_link_show_doc__ ( @var{filename} )\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval;
+  std::string file;
+
+  if (args.length () >= 1)
+    file = args(0).string_value();
+
+  retval = octave_link::show_doc (file);
+
+  return retval;
+}
+
+
+
--- a/libinterp/corefcn/octave-link.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/octave-link.h	Sat Oct 05 11:22:09 2013 -0400
@@ -307,6 +307,31 @@
     return instance_ok () ? instance->link_enabled : false;
   }
 
+  static bool
+  show_preferences ()
+  {
+    if (enabled ())
+      { 
+        instance->do_show_preferences ();
+        return true;
+      }
+    else
+      return false;
+  }
+
+  static bool 
+  show_doc (const std::string & file)
+  {
+    if (enabled ())
+      { 
+        instance->do_show_doc (file);
+        return true;
+      }
+    else
+      return false;
+ 
+  }
+
 private:
 
   static octave_link *instance;
@@ -425,6 +450,10 @@
 
   virtual void do_set_default_prompts (std::string& ps1, std::string& ps2,
                                        std::string& ps4) = 0;
+
+  virtual void do_show_preferences (void) = 0;
+
+  virtual void do_show_doc (const std::string &file) = 0;
 };
 
 #endif // OCTAVELINK_H
--- a/libinterp/corefcn/pager.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/pager.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -514,23 +514,29 @@
 
 DEFUN (diary, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Command} {} diary options\n\
+@deftypefn  {Command} {} diary\n\
+@deftypefnx {Command} {} diary on\n\
+@deftypefnx {Command} {} diary off\n\
+@deftypefnx {Command} {} diary @var{filename}\n\
 Record a list of all commands @emph{and} the output they produce, mixed\n\
-together just as you see them on your terminal.  Valid options are:\n\
+together just as they appear on the terminal.\n\
 \n\
-@table @code\n\
+Valid options are:\n\
+\n\
+@table @asis\n\
 @item on\n\
-Start recording your session in a file called @file{diary} in your\n\
+Start recording a session in a file called @file{diary} in the\n\
 current working directory.\n\
 \n\
 @item off\n\
-Stop recording your session in the diary file.\n\
+Stop recording the session in the diary file.\n\
 \n\
-@item @var{file}\n\
-Record your session in the file named @var{file}.\n\
+@item @var{filename}\n\
+Record the session in the file named @var{filename}.\n\
 @end table\n\
 \n\
 With no arguments, @code{diary} toggles the current diary state.\n\
+@seealso{history}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -648,9 +654,9 @@
 buffers its output and waits until just before the prompt is printed to\n\
 flush it to the pager.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{page_screen_output, more, PAGER, PAGER_FLAGS}\n\
 @end deftypefn")
 {
@@ -668,9 +674,9 @@
 (such as @code{less}---see @ref{Installation}) are also capable of moving\n\
 backward on the output.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{more, page_output_immediately, PAGER, PAGER_FLAGS}\n\
 @end deftypefn")
 {
@@ -684,13 +690,13 @@
 @deftypefnx {Built-in Function} {} PAGER (@var{new_val}, \"local\")\n\
 Query or set the internal variable that specifies the program to use\n\
 to display terminal output on your system.  The default value is\n\
-normally @code{\"less\"}, @code{\"more\"}, or\n\
-@code{\"pg\"}, depending on what programs are installed on your system.\n\
+normally @qcode{\"less\"}, @qcode{\"more\"}, or\n\
+@qcode{\"pg\"}, depending on what programs are installed on your system.\n\
 @xref{Installation}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{PAGER_FLAGS, page_output_immediately, more, page_screen_output}\n\
 @end deftypefn")
 {
@@ -705,9 +711,9 @@
 Query or set the internal variable that specifies the options to pass\n\
 to the pager.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{PAGER, more, page_screen_output, page_output_immediately}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/pinv.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/pinv.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -172,12 +172,12 @@
 
 /*
 %!shared a, b, tol, hitol, d, u, x, y
-%! a = reshape (rand*[1:16], 4, 4);   ## Rank 2 matrix
+%! a = reshape (rand*[1:16], 4, 4);  # Rank 2 matrix
 %! b = pinv (a);
 %! tol = 4e-14;
 %! hitol = 40*sqrt (eps);
 %! d = diag ([rand, rand, hitol, hitol]);
-%! u = rand (4);                      ## Could be singular by freak accident
+%! u = rand (4);                     # Could be singular by freak accident
 %! x = inv (u)*d*u;
 %! y = pinv (x, sqrt (eps));
 %!
--- a/libinterp/corefcn/pr-output.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/pr-output.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -493,7 +493,7 @@
     for (octave_idx_type i = 0; i < nr; i++)
       {
         double val = m(i,j);
-        if (xisinf (val) || xisnan (val))
+        if (! xfinite (val))
           continue;
 
         all_inf_or_nan = false;
@@ -522,7 +522,7 @@
     for (octave_idx_type i = 0; i < nr; i++)
       {
         double val = m(i,j);
-        if (xisinf (val) || xisnan (val))
+        if (xfinite (val))
           continue;
 
         all_inf_or_nan = false;
@@ -998,11 +998,9 @@
   double r_abs = rp < 0.0 ? -rp : rp;
   double i_abs = ip < 0.0 ? -ip : ip;
 
-  int r_x = (xisinf (rp) || xisnan (rp) || r_abs == 0.0)
-    ? 0 : num_digits (r_abs);
-
-  int i_x = (xisinf (ip) || xisnan (ip) || i_abs == 0.0)
-    ? 0 : num_digits (i_abs);
+  int r_x = (! xfinite (rp) || r_abs == 0.0) ? 0 : num_digits (r_abs);
+
+  int i_x = (! xfinite (ip) || i_abs == 0.0) ? 0 : num_digits (i_abs);
 
   int x_max, x_min;
 
@@ -1461,9 +1459,6 @@
           // Unless explicitly asked for, always print in big-endian
           // format.
 
-          // FIXME -- is it correct to swap bytes for VAX
-          // formats and not for Cray?
-
           // FIXME -- will bad things happen if we are
           // interrupted before resetting the format flags and fill
           // character?
@@ -1477,9 +1472,7 @@
             = os.flags (std::ios::right | std::ios::hex);
 
           if (hex_format > 1
-              || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian
-              || flt_fmt == oct_mach_info::flt_fmt_cray
-              || flt_fmt == oct_mach_info::flt_fmt_unknown)
+              || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian)
             {
               for (size_t i = 0; i < sizeof (double); i++)
                 os << std::setw (2) << static_cast<int> (tmp.i[i]);
@@ -1498,15 +1491,10 @@
           equiv tmp;
           tmp.d = d;
 
-          // FIXME -- is it correct to swap bytes for VAX
-          // formats and not for Cray?
-
           oct_mach_info::float_format flt_fmt =
             oct_mach_info::native_float_format ();
 
-          if (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian
-              || flt_fmt == oct_mach_info::flt_fmt_cray
-              || flt_fmt == oct_mach_info::flt_fmt_unknown)
+          if (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian)
             {
               for (size_t i = 0; i < sizeof (double); i++)
                 PRINT_CHAR_BITS (os, tmp.i[i]);
@@ -3805,7 +3793,7 @@
 @samp{e} format if it is unable to format a matrix properly using the\n\
 current format.\n\
 \n\
-@item short e\n\
+@item  short e\n\
 @itemx long e\n\
 Exponential format.  The number to be represented is split between a mantissa\n\
 and an exponent (power of 10).  The mantissa has 5 significant digits in the\n\
@@ -3813,14 +3801,14 @@
 For example, with the @samp{short e} format, @code{pi} is displayed as\n\
 @code{3.1416e+00}.\n\
 \n\
-@item short E\n\
+@item  short E\n\
 @itemx long E\n\
 Identical to @samp{short e} or @samp{long e} but displays an uppercase\n\
 @samp{E} to indicate the exponent.\n\
 For example, with the @samp{long E} format, @code{pi} is displayed as\n\
 @code{3.14159265358979E+00}.\n\
 \n\
-@item short g\n\
+@item  short g\n\
 @itemx long g\n\
 Optimally choose between fixed point and exponential format based on\n\
 the magnitude of the number.\n\
@@ -3839,19 +3827,19 @@
 @end group\n\
 @end example\n\
 \n\
-@item short eng\n\
+@item  short eng\n\
 @itemx long eng\n\
 Identical to @samp{short e} or @samp{long e} but displays the value\n\
 using an engineering format, where the exponent is divisible by 3. For\n\
 example, with the @samp{short eng} format, @code{10 * pi} is displayed as\n\
 @code{31.4159e+00}.\n\
 \n\
-@item long G\n\
+@item  long G\n\
 @itemx short G\n\
 Identical to @samp{short g} or @samp{long g} but displays an uppercase\n\
 @samp{E} to indicate the exponent.\n\
 \n\
-@item free\n\
+@item  free\n\
 @itemx none\n\
 Print output in free format, without trying to line up columns of\n\
 matrices on the decimal point.  This also causes complex numbers to be\n\
@@ -3984,9 +3972,9 @@
 this reason, you should be careful when setting\n\
 @code{fixed_point_format} to a nonzero value.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{format, output_max_field_width, output_precision}\n\
 @end deftypefn")
 {
@@ -4013,9 +4001,9 @@
 ans = [](3x0)\n\
 @end example\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{format}\n\
 @end deftypefn")
 {
@@ -4051,9 +4039,9 @@
 @end group\n\
 @end example\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{format}\n\
 @end deftypefn")
 {
@@ -4068,9 +4056,9 @@
 Query or set the internal variable that specifies the maximum width\n\
 of a numeric output field.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{format, fixed_point_format, output_precision}\n\
 @end deftypefn")
 {
@@ -4086,9 +4074,9 @@
 Query or set the internal variable that specifies the minimum number of\n\
 significant figures to display for numeric output.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{format, fixed_point_format, output_max_field_width}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/pt-jit.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/pt-jit.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -44,19 +44,43 @@
 
 static bool Vjit_enable = true;
 
+static int Vjit_startcnt = 1000;
+
 #include <llvm/Analysis/CallGraph.h>
 #include <llvm/Analysis/Passes.h>
 #include <llvm/Analysis/Verifier.h>
 #include <llvm/Bitcode/ReaderWriter.h>
-#include <llvm/LLVMContext.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/ExecutionEngine/JIT.h>
+#include <llvm/PassManager.h>
+
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+#include <llvm/IR/LLVMContext.h>
+#include <llvm/IR/Module.h>
+#else
+#include <llvm/LLVMContext.h>
 #include <llvm/Module.h>
-#include <llvm/PassManager.h>
+#endif
+
+#ifdef HAVE_LLVM_SUPPORT_IRBUILDER_H
 #include <llvm/Support/IRBuilder.h>
+#elif defined(HAVE_LLVM_IR_IRBUILDER_H)
+#include <llvm/IR/IRBuilder.h>
+#else
+#include <llvm/IRBuilder.h>
+#endif
+
 #include <llvm/Support/raw_os_ostream.h>
 #include <llvm/Support/TargetSelect.h>
+
+#ifdef HAVE_LLVM_IR_DATALAYOUT_H
+#include <llvm/IR/DataLayout.h>
+#elif defined(HAVE_LLVM_DATALAYOUT_H)
+#include <llvm/DataLayout.h>
+#else
 #include <llvm/Target/TargetData.h>
+#endif
+
 #include <llvm/Transforms/IPO.h>
 #include <llvm/Transforms/Scalar.h>
 
@@ -1868,7 +1892,11 @@
   module_pass_manager->add (llvm::createAlwaysInlinerPass ());
 
   pass_manager = new llvm::FunctionPassManager (module);
-  pass_manager->add (new llvm::TargetData(*engine->getTargetData ()));
+#ifdef HAVE_LLVM_DATALAYOUT
+  pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ()));
+#else
+  pass_manager->add (new llvm::TargetData (*engine->getTargetData ()));
+#endif
   pass_manager->add (llvm::createCFGSimplificationPass ());
   pass_manager->add (llvm::createBasicAliasAnalysisPass ());
   pass_manager->add (llvm::createPromoteMemoryToRegisterPass ());
@@ -1886,8 +1914,6 @@
 bool
 tree_jit::do_execute (tree_simple_for_command& cmd, const octave_value& bounds)
 {
-  const size_t MIN_TRIP_COUNT = 1000;
-
   size_t tc = trip_count (bounds);
   if (! tc || ! initialize () || ! enabled ())
     return false;
@@ -1898,7 +1924,7 @@
   jit_info *info = cmd.get_info ();
   if (! info || ! info->match (extra_vars))
     {
-      if (tc < MIN_TRIP_COUNT)
+      if (tc < static_cast<size_t> (Vjit_startcnt))
         return false;
 
       delete info;
@@ -2296,10 +2322,10 @@
 Query or set the internal variable that determines whether\n\
 debugging/tracing is enabled for Octave's JIT compiler.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
-@seealso{jit_enable}\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+@seealso{jit_enable, jit_startcnt}\n\
 @end deftypefn")
 {
 #if defined (HAVE_LLVM)
@@ -2317,10 +2343,10 @@
 @deftypefnx {Built-in Function} {} jit_enable (@var{new_val}, \"local\")\n\
 Query or set the internal variable that enables Octave's JIT compiler.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
-@seealso{debug_jit}\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+@seealso{jit_startcnt, debug_jit}\n\
 @end deftypefn")
 {
 #if defined (HAVE_LLVM)
@@ -2331,369 +2357,27 @@
 #endif
 }
 
-/*
-Test some simple cases that compile.
-
-%!test
-%! for i=1:1e6
-%!   if i < 5
-%!     break
-%!   else
-%!     break
-%!   endif
-%! endfor
-%! assert (i, 1);
-
-%!test
-%! while 1
-%!   if 1
-%!     break
-%!  else
-%!    break
-%!  endif
-%! endwhile
-
-%!test
-%! for i=1:1e6
-%!   if i == 100
-%!     break
-%!   endif
-%! endfor
-%! assert (i, 100);
-
-%!test
-%! inc = 1e-5;
-%! result = 0;
-%! for ii = 0:inc:1
-%!   result = result + inc * (1/3 * ii * ii);
-%! endfor
-%! assert (abs (result - 1/9) < 1e-5);
-
-%!test
-%! inc = 1e-5;
-%! result = 0;
-%! for ii = 0:inc:1
-%!   # the ^ operator's result is complex
-%!   result = result + inc * (1/3 * ii ^ 2);
-%! endfor
-%! assert (abs (result - 1/9) < 1e-5);
-
-%!test
-%! temp = 1+1i;
-%! nan = NaN;
-%! while 1
-%!   temp = temp - 1i;
-%!   temp = temp * nan;
-%!   break;
-%! endwhile
-%! assert (imag (temp), 0);
-
-%!test
-%! temp = 1+1i;
-%! nan = NaN+1i;
-%! while 1
-%!   nan = nan - 1i;
-%!   temp = temp - 1i;
-%!   temp = temp * nan;
-%!   break;
-%! endwhile
-%! assert (imag (temp), 0);
-
-%!test
-%! temp = 1+1i;
-%! while 1
-%!   temp = temp * 5;
-%!   break;
-%! endwhile
-%! assert (temp, 5+5i);
-
-%!test
-%! nr = 1001;
-%! mat = zeros (1, nr);
-%! for i = 1:nr
-%!   mat(i) = i;
-%! endfor
-%! assert (mat == 1:nr);
-
-%!test
-%! nr = 1001;
-%! mat = 1:nr;
-%! mat(end) = 0; # force mat to a matrix
-%! total = 0;
-%! for i = 1:nr
-%!   total = mat(i) + total;
-%! endfor
-%! assert (sum (mat) == total);
-
-%!test
-%! nr = 1001;
-%! mat = [3 1 5];
-%! try
-%!   for i = 1:nr
-%!     if i > 500
-%!       result = mat(100);
-%!     else
-%!       result = i;
-%!     endif
-%!   endfor
-%! catch
-%! end
-%! assert (result == 500);
-
-%!function result = gen_test (n)
-%!  result = double (rand (1, n) > .01);
-%!endfunction
-
-%!function z = vectorized (A, K)
-%!  temp = ones (1, K);
-%!  z = conv (A, temp);
-%!  z = z > K-1;
-%!  z = conv (z, temp);
-%!  z = z(K:end-K+1);
-%!  z = z >= 1;
-%!endfunction
-
-%!function z = loopy (A, K)
-%!  z = A;
-%!  n = numel (A);
-%!  counter = 0;
-%!  for ii=1:n
-%!    if z(ii)
-%!      counter = counter + 1;
-%!    else
-%!      if counter > 0 && counter < K
-%!        z(ii-counter:ii-1) = 0;
-%!      endif
-%!      counter = 0;
-%!    endif
-%!  endfor
-%!
-%!  if counter > 0 && counter < K
-%!    z(end-counter+1:end) = 0;
-%!  endif
-%!endfunction
-
-%!test
-%! test_set = gen_test (10000);
-%! assert (all (vectorized (test_set, 3) == loopy (test_set, 3)));
-
-%!test
-%! niter = 1001;
-%! i = 0;
-%! while (i < niter)
-%!   i = i + 1;
-%! endwhile
-%! assert (i == niter);
-
-%!test
-%! niter = 1001;
-%! result = 0;
-%! m = [5 10];
-%! for i=1:niter
-%!   result = result + m(end);
-%! endfor
-%! assert (result == m(end) * niter);
-
-%!test
-%! ndim = 100;
-%! result = 0;
-%! m = zeros (ndim);
-%! m(:) = 1:ndim^2;
-%! i = 1;
-%! while (i <= ndim)
-%!   for j = 1:ndim
-%!     result = result + m(i, j);
-%!    endfor
-%!   i = i + 1;
-%! endwhile
-%! assert (result == sum (sum (m)));
-
-%!test
-%! ndim = 100;
-%! m = zeros (ndim);
-%! i = 1;
-%! while (i <= ndim)
-%!   for j = 1:ndim
-%!     m(i, j) = (j - 1) * ndim + i;
-%!   endfor
-%!   i = i + 1;
-%! endwhile
-%! m2 = zeros (ndim);
-%! m2(:) = 1:(ndim^2);
-%! assert (all (m == m2));
-
-%!test
-%! ndim = 2;
-%! m = zeros (ndim, ndim, ndim, ndim);
-%! result = 0;
-%! i0 = 1;
-%! while (i0 <= ndim)
-%!   for i1 = 1:ndim
-%!     for i2 = 1:ndim
-%!       for i3 = 1:ndim
-%!         m(i0, i1, i2, i3) = 1;
-%!         m(i0, i1, i2, i3, 1, 1, 1, 1, 1, 1) = 1;
-%!         result = result + m(i0, i1, i2, i3);
-%!       endfor
-%!     endfor
-%!   endfor
-%!   i0 = i0 + 1;
-%! endwhile
-%! expected = ones (ndim, ndim, ndim, ndim);
-%! assert (all (m == expected));
-%! assert (result == sum (expected (:)));
-
-%!function test_divide ()
-%! state = warning ("query", "Octave:divide-by-zero").state;
-%! unwind_protect
-%!   warning ("error", "Octave:divide-by-zero");
-%!   for i=1:1e5
-%!     a = 1;
-%!     a / 0;
-%!   endfor
-%! unwind_protect_cleanup
-%!   warning (state, "Octave:divide-by-zero");
-%! end_unwind_protect
-%!endfunction
-
-%!error <division by zero> test_divide ()
-
-%!test
-%! while 1
-%!   a = 0;
-%!   result = a / 1;
-%!   break;
-%! endwhile
-%! assert (result, 0);
-
-%!test
-%! m = zeros (2, 1001);
-%! for i=1:1001
-%!   m(end, i) = i;
-%!   m(end - 1, end - i + 1) = i;
-%! endfor
-%! m2 = zeros (2, 1001);
-%! m2(1, :) = fliplr (1:1001);
-%! m2(2, :) = 1:1001;
-%! assert (m, m2);
-
-%!test
-%! m = [1 2 3];
-%! for i=1:1001
-%!   m = sin (m);
-%!   break;
-%! endfor
-%! assert (m == sin ([1  2 3]));
-
-%!test
-%! i = 0;
-%! while i < 10
-%!   i += 1;
-%! endwhile
-%! assert (i == 10);
-
-%!test
-%! i = 0;
-%! while i < 10
-%!   a = ++i;
-%! endwhile
-%! assert (i == 10);
-%! assert (a == 10);
-%!test
-%! i = 0;
-%! while i < 10
-%!   a = i++;
-%! endwhile
-%! assert (i == 10);
-%! assert (a == 9);
-
-%!test
-%! num = 2;
-%! a = zeros (1, num);
-%! i = 1;
-%! while i <= num
-%!   a(i) = norm (eye (i));
-%!   ++i;
-%! endwhile
-%! assert (a, ones (1, num));
-
-%!function test_compute_idom ()
-%! while (li <= length (l1) && si <= length (s1))
-%!   if (l1 (li) < s1 (si))
-%!     if (li == si)
-%!       break;
-%!     endif;
-%!     li++;
-%!   else
-%!     si++;
-%!   endif;
-%! endwhile
-
-%!error test_compute_idom ()
-
-%!function x = test_overload (a)
-%!  while 1
-%!    x = a;
-%!    break;
-%!  endwhile
-%!endfunction
-
-%!assert (test_overload (1), 1);
-%!assert (test_overload ([1 2]), [1 2]);
-
-%!function a = bubble (a = [3 2 1])
-%!  swapped = 1;
-%!  n = length (a);
-%!  while (swapped)
-%!    swapped = 0;
-%!    for i = 1:n-1
-%!      if a(i) > a(i + 1)
-%!        swapped = 1;
-%!        temp = a(i);
-%!        a(i) = a(i + 1);
-%!        a(i + 1) = temp;
-%!      endif
-%!    endfor
-%!  endwhile
-%!endfunction
-
-%!assert (bubble (), [1 2 3]);
-
-%!test
-%! a = 0;
-%! b = 1;
-%! for i=1:1e3
-%!   for j=1:2
-%!     a = a + b;
-%!   endfor
-%! endfor
-%! assert (a, 2000);
-%! assert (b, 1);
-
-%!test
-%! a = [1+1i 1+2i];
-%! b = 0;
-%! while 1
-%!   b = a(1);
-%!   break;
-%! endwhile
-%! assert (b, a(1));
-
-%!function test_undef ()
-%!  for i=1:1e7
-%!    XXX;
-%!  endfor
-%!endfunction
-
-%!error <undefined near> (test_undef);
-
-%!shared id
-%! id = @(x) x;
-
-%!assert (id (1), 1);
-%!assert (id (1+1i), 1+1i)
-%!assert (id (1, 2), 1)
-%!error <undefined> (id ())
-
-
-*/
+DEFUN (jit_startcnt, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} jit_startcnt ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} jit_startcnt (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} jit_startcnt (@var{new_val}, \"local\")\n\
+Query or set the internal variable that determines whether JIT compilation\n\
+will take place for a specific loop.  Because compilation is a costly\n\
+operation it does not make sense to employ JIT when the loop count is low.\n\
+By default only loops with greater than 1000 iterations will be accelerated.\n\
+\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+@seealso{jit_enable, debug_jit}\n\
+@end deftypefn")
+{
+#if defined (HAVE_LLVM)
+  return SET_INTERNAL_VARIABLE_WITH_LIMITS (jit_startcnt, 1,
+                                            std::numeric_limits<int>::max ());
+#else
+  warning ("jit_enable: JIT compiling not available in this version of Octave");
+  return octave_value ();
+#endif
+}
--- a/libinterp/corefcn/qz.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/qz.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -346,20 +346,20 @@
 of the revised pencil contains all eigenvalues that satisfy:\n\
 \n\
 @table @asis\n\
-@item \"N\"\n\
+@item @qcode{\"N\"}\n\
 = unordered (default)\n\
 \n\
-@item \"S\"\n\
+@item @qcode{\"S\"}\n\
 = small: leading block has all |lambda| @leq{} 1\n\
 \n\
-@item \"B\"\n\
+@item @qcode{\"B\"}\n\
 = big: leading block has all |lambda| @geq{} 1\n\
 \n\
-@item \"-\"\n\
+@item @qcode{\"-\"}\n\
 = negative real part: leading block has all eigenvalues\n\
 in the open left half-plane\n\
 \n\
-@item \"+\"\n\
+@item @qcode{\"+\"}\n\
 = non-negative real part: leading block has all eigenvalues\n\
 in the closed right half-plane\n\
 @end table\n\
@@ -367,9 +367,9 @@
 @end enumerate\n\
 \n\
 Note: @code{qz} performs permutation balancing, but not scaling\n\
-(@pxref{docXbalance}).  The order of output arguments was selected for\n\
+(@pxref{XREFbalance}).  The order of output arguments was selected for\n\
 compatibility with @sc{matlab}.\n\
-@seealso{balance, eig, schur}\n\
+@seealso{eig, balance, lu, chol, hess, qr, qzhess, schur, svd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
--- a/libinterp/corefcn/rand.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/rand.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -49,7 +49,7 @@
 
 /*
 %!shared __random_statistical_tests__
-%! # Flag whether the statistical tests should be run in "make check" or not
+%! ## Flag whether the statistical tests should be run in "make check" or not
 %! __random_statistical_tests__ = 0;
 */
 
@@ -424,7 +424,7 @@
 random numbers with a significantly longer cycle time.  However, in\n\
 some circumstances it might be desirable to obtain the same random\n\
 sequences as used by the old generators.  To do this the keyword\n\
-\"seed\" is used to specify that the old generators should be use,\n\
+@qcode{\"seed\"} is used to specify that the old generators should be use,\n\
 as in\n\
 \n\
 @example\n\
@@ -442,13 +442,15 @@
 However, it should be noted that querying the seed will not cause\n\
 @code{rand} to use the old generators, only setting the seed will.\n\
 To cause @code{rand} to once again use the new generators, the\n\
-keyword \"state\" should be used to reset the state of the @code{rand}.\n\
+keyword @qcode{\"state\"} should be used to reset the state of the\n\
+@code{rand}.\n\
 \n\
 The state or seed of the generator can be reset to a new random value\n\
-using the \"reset\" keyword.\n\
+using the @qcode{\"reset\"} keyword.\n\
 \n\
-The class of the value returned can be controlled by a trailing \"double\"\n\
-or \"single\" argument.  These are the only valid classes.\n\
+The class of the value returned can be controlled by a trailing\n\
+@qcode{\"double\"} or @qcode{\"single\"} argument.  These are the only valid\n\
+classes.\n\
 @seealso{randn, rande, randg, randp}\n\
 @end deftypefn")
 {
@@ -500,16 +502,16 @@
 
 /*
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! rand ("state", 1);
 %! assert (rand (1,6), [0.1343642441124013 0.8474337369372327 0.763774618976614 0.2550690257394218 0.495435087091941 0.4494910647887382], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! rand ("seed", 1);
 %! assert (rand (1,6), [0.8668024251237512 0.9126510815694928 0.09366085007786751 0.1664607301354408 0.7408077004365623 0.7615650338120759], 1e-6);
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   rand ("state", 12);
 %!   x = rand (100000, 1);
 %!   assert (max (x) < 1);   #*** Please report this!!! ***
@@ -521,7 +523,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   rand ("seed", 12);
 %!   x = rand (100000, 1);
 %!   assert (max (x) < 1);   #*** Please report this!!! ***
@@ -533,6 +535,19 @@
 %! endif
 */
 
+/*
+%!# Test out-of-range values as rand() seeds.  See oct-rand.cc: double2uint32().
+%!function v = __rand_sample__ (initval)
+%!  rand ("state", initval);
+%!  v = rand (1, 6);
+%!endfunction
+%!
+%!assert (__rand_sample__ (0), __rand_sample__ (2^32))
+%!assert (__rand_sample__ (-2), __rand_sample__ (2^32-2))
+%!assert (__rand_sample__ (Inf), __rand_sample__ (NaN))
+%!assert (! isequal (__rand_sample__ (-1), __rand_sample__ (-2)))
+*/
+
 static std::string current_distribution = octave_rand::distribution ();
 
 DEFUN (randn, args, ,
@@ -555,8 +570,9 @@
 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique''\n\
 to transform from a uniform to a normal distribution.\n\
 \n\
-The class of the value returned can be controlled by a trailing \"double\"\n\
-or \"single\" argument.  These are the only valid classes.\n\
+The class of the value returned can be controlled by a trailing\n\
+@qcode{\"double\"} or @qcode{\"single\"} argument.  These are the only valid\n\
+classes.\n\
 \n\
 Reference: G. Marsaglia and W.W. Tsang,\n\
 @cite{Ziggurat Method for Generating Random Variables},\n\
@@ -577,16 +593,16 @@
 
 /*
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randn ("state", 1);
 %! assert (randn (1, 6), [-2.666521678978671 -0.7381719971724564 1.507903992673601 0.6019427189162239 -0.450661261143348 -0.7054431351574116], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randn ("seed", 1);
 %! assert (randn (1, 6), [-1.039402365684509 -1.25938892364502 0.1968704611063004 0.3874166905879974 -0.5976632833480835 -0.6615074276924133], 1e-6);
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randn ("state", 12);
 %!   x = randn (100000, 1);
 %!   assert (mean (x), 0, 0.01);
@@ -596,7 +612,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randn ("seed", 12);
 %!   x = randn (100000, 1);
 %!   assert (mean (x), 0, 0.01);
@@ -625,8 +641,9 @@
 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique''\n\
 to transform from a uniform to an exponential distribution.\n\
 \n\
-The class of the value returned can be controlled by a trailing \"double\"\n\
-or \"single\" argument.  These are the only valid classes.\n\
+The class of the value returned can be controlled by a trailing\n\
+@qcode{\"double\"} or @qcode{\"single\"} argument.  These are the only valid\n\
+classes.\n\
 \n\
 Reference: G. Marsaglia and W.W. Tsang,\n\
 @cite{Ziggurat Method for Generating Random Variables},\n\
@@ -647,16 +664,16 @@
 
 /*
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! rande ("state", 1);
 %! assert (rande (1, 6), [3.602973885835625 0.1386190677555021 0.6743112889616958 0.4512830847258422 0.7255744741233175 0.3415969205292291], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! rande ("seed", 1);
 %! assert (rande (1, 6), [0.06492075175653866 1.717980206012726 0.4816154008731246 0.5231300676241517 0.103910739364359 1.668931916356087], 1e-6);
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally
+%!   ## statistical tests may fail occasionally
 %!   rande ("state", 1);
 %!   x = rande (100000, 1);
 %!   assert (min (x) > 0);   # *** Please report this!!! ***
@@ -667,7 +684,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally
+%!   ## statistical tests may fail occasionally
 %!   rande ("seed", 1);
 %!   x = rande (100000, 1);
 %!   assert (min (x)>0);   # *** Please report this!!! ***
@@ -771,8 +788,9 @@
 \n\
 @end table\n\
 \n\
-The class of the value returned can be controlled by a trailing \"double\"\n\
-or \"single\" argument.  These are the only valid classes.\n\
+The class of the value returned can be controlled by a trailing\n\
+@qcode{\"double\"} or @qcode{\"single\"} argument.  These are the only valid\n\
+classes.\n\
 @seealso{rand, randn, rande, randp}\n\
 @end deftypefn")
 {
@@ -794,49 +812,49 @@
 %! assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]); # *** Please report
 
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randg ("state", 1);
 %! assert (randg (0.1, 1, 6), [0.0103951513331241 8.335671459898252e-05 0.00138691397249762 0.000587308416993855 0.495590518784736 2.3921917414795e-12], 1e-6);
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randg ("state", 1);
 %! assert (randg (0.95, 1, 6), [3.099382433255327 0.3974529788871218 0.644367450750855 1.143261091802246 1.964111762696822 0.04011915547957939], 1e-6);
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randg ("state", 1);
 %! assert (randg (1, 1, 6), [0.2273389379645993 1.288822625058359 0.2406335209340746 1.218869553370733 1.024649860162554 0.09631230343599533], 1e-6);
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randg ("state", 1);
 %! assert (randg (10, 1, 6), [3.520369644331133 15.15369864472106 8.332112081991205 8.406211067432674 11.81193475187611 10.88792728177059], 1e-5);
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randg ("state", 1);
 %! assert (randg (100, 1, 6), [75.34570255262264 115.4911985594699 95.23493031356388 95.48926019250911 106.2397448229803 103.4813150404118], 1e-4);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randg ("seed", 1);
 %! assert (randg (0.1, 1, 6), [0.07144210487604141 0.460641473531723 0.4749028384685516 0.06823389977216721 0.000293838675133884 1.802567535340305e-12], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randg ("seed", 1);
 %! assert (randg (0.95, 1, 6), [1.664905071258545 1.879976987838745 1.905677795410156 0.9948706030845642 0.5606933236122131 0.0766092911362648], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randg ("seed", 1);
 %! assert (randg (1, 1, 6), [0.03512085229158401 0.6488978862762451 0.8114678859710693 0.1666885763406754 1.60791552066803 1.90356981754303], 1e-6);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randg ("seed", 1);
 %! assert (randg (10, 1, 6), [6.566435813903809 10.11648464202881 10.73162078857422 7.747178077697754 6.278522491455078 6.240195751190186], 1e-5);
 %!test
-%! # Test fixed seed
+%! ## Test fixed seed
 %! randg ("seed", 1);
 %! assert (randg (100, 1, 6), [89.40208435058594 101.4734725952148 103.4020004272461 93.62763214111328 88.33104705810547 88.1871337890625], 1e-4);
 
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("state", 12);
 %!   a = 0.1;
 %!   x = randg (a, 100000, 1);
@@ -847,7 +865,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("state", 12);
 %!   a = 0.95;
 %!   x = randg (a, 100000, 1);
@@ -858,7 +876,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("state", 12);
 %!   a = 1;
 %!   x = randg (a, 100000, 1);
@@ -869,7 +887,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("state", 12);
 %!   a = 10;
 %!   x = randg (a, 100000, 1);
@@ -880,7 +898,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("state", 12);
 %!   a = 100;
 %!   x = randg (a, 100000, 1);
@@ -894,7 +912,7 @@
 %!assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]) # *** Please report
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("seed", 12);
 %!   a = 0.1;
 %!   x = randg (a, 100000, 1);
@@ -905,7 +923,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("seed", 12);
 %!   a = 0.95;
 %!   x = randg (a, 100000, 1);
@@ -916,7 +934,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("seed", 12);
 %!   a = 1;
 %!   x = randg (a, 100000, 1);
@@ -927,7 +945,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("seed", 12);
 %!   a = 10;
 %!   x = randg (a, 100000, 1);
@@ -938,7 +956,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randg ("seed", 12);
 %!   a = 100;
 %!   x = randg (a, 100000, 1);
@@ -993,8 +1011,9 @@
 D 50 p1284, 1994.\n\
 @end table\n\
 \n\
-The class of the value returned can be controlled by a trailing \"double\"\n\
-or \"single\" argument.  These are the only valid classes.\n\
+The class of the value returned can be controlled by a trailing\n\
+@qcode{\"double\"} or @qcode{\"single\"} argument.  These are the only valid\n\
+classes.\n\
 @seealso{rand, randn, rande, randg}\n\
 @end deftypefn")
 {
@@ -1015,33 +1034,33 @@
 %! randp ("state", 12);
 %! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]);   # *** Please report
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("state", 1);
 %! assert (randp (5, 1, 6), [5 5 3 7 7 3])
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("state", 1);
 %! assert (randp (15, 1, 6), [13 15 8 18 18 15])
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("state", 1);
 %! assert (randp (1e9, 1, 6), [999915677 999976657 1000047684 1000019035 999985749 999977692], -1e-6)
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("seed", 1);
 %! %%assert (randp (5, 1, 6), [8 2 3 6 6 8])
 %! assert (randp (5, 1, 5), [8 2 3 6 6])
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("seed", 1);
 %! assert (randp (15, 1, 6), [15 16 12 10 10 12])
 %!test
-%! # Test fixed state
+%! ## Test fixed state
 %! randp ("seed", 1);
 %! assert (randp (1e9, 1, 6), [1000006208 1000012224 999981120 999963520 999963072 999981440], -1e-6)
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randp ("state", 12);
 %!   for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03]
 %!     x = randp (a (1), 100000, 1);
@@ -1054,7 +1073,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randp ("state", 12);
 %!   for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03]
 %!     x = randp (a(1)*ones (100000, 1), 100000, 1);
@@ -1070,7 +1089,7 @@
 %! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]);   # *** Please report
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randp ("seed", 12);
 %!   for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03]
 %!     x = randp (a(1), 100000, 1);
@@ -1083,7 +1102,7 @@
 %! endif
 %!test
 %! if (__random_statistical_tests__)
-%!   # statistical tests may fail occasionally.
+%!   ## statistical tests may fail occasionally.
 %!   randp ("seed", 12);
 %!   for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03]
 %!     x = randp (a(1)*ones (100000, 1), 100000, 1);
--- a/libinterp/corefcn/regexp.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/regexp.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -33,7 +33,7 @@
 #include "base-list.h"
 #include "oct-locbuf.h"
 #include "quit.h"
-#include "regexp.h"
+#include "lo-regexp.h"
 #include "str-vec.h"
 
 #include "defun.h"
@@ -70,6 +70,13 @@
               retval[i] = '\b';
               break;
 
+            // Translate \< and \> to PCRE word boundary
+            case '<': // begin word boundary
+            case '>': // end word boundary
+              retval[i] = '\\';
+              retval[++i] = 'b';
+              break;
+
 #if 0
 // FIXME : To be complete, we need to handle \oN, \o{N}.
 //         The PCRE library already handles \N where N
@@ -640,11 +647,18 @@
 In addition, the following escaped characters have special meaning.\n\
 \n\
 @table @code\n\
-@item \\b\n\
-Match a word boundary\n\
+\n\
+@item \\d\n\
+Match any digit\n\
 \n\
-@item \\B\n\
-Match within a word\n\
+@item \\D\n\
+Match any non-digit\n\
+\n\
+@item \\s\n\
+Match any whitespace character\n\
+\n\
+@item \\S\n\
+Match any non-whitespace character\n\
 \n\
 @item \\w\n\
 Match any word character\n\
@@ -658,21 +672,12 @@
 @item \\>\n\
 Match the end of a word\n\
 \n\
-@item \\s\n\
-Match any whitespace character\n\
-\n\
-@item \\S\n\
-Match any non-whitespace character\n\
-\n\
-@item \\d\n\
-Match any digit\n\
-\n\
-@item \\D\n\
-Match any non-digit\n\
+@item \\B\n\
+Match within a word\n\
 @end table\n\
 \n\
 Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\
-sequences (e.g., \"\\n\" => newline) are processed in @var{pat}\n\
+sequences (e.g., @qcode{\"\\n\"} => newline) are processed in @var{pat}\n\
 regardless of whether @var{pat} has been defined within single quotes.  Use\n\
 a second backslash to stop interpolation of the escape sequence (e.g.,\n\
 \"\\\\n\") or use the @code{regexptranslate} function.\n\
@@ -712,13 +717,13 @@
 are\n\
 \n\
 @multitable @columnfractions 0.2 0.3 0.3 0.2\n\
-@item @tab 'start'        @tab @var{s}  @tab\n\
-@item @tab 'end'          @tab @var{e}  @tab\n\
-@item @tab 'tokenExtents' @tab @var{te} @tab\n\
-@item @tab 'match'        @tab @var{m}  @tab\n\
-@item @tab 'tokens'       @tab @var{t}  @tab\n\
-@item @tab 'names'        @tab @var{nm} @tab\n\
-@item @tab 'split'        @tab @var{sp} @tab\n\
+@item @tab @qcode{'start'}        @tab @var{s}  @tab\n\
+@item @tab @qcode{'end'}          @tab @var{e}  @tab\n\
+@item @tab @qcode{'tokenExtents'} @tab @var{te} @tab\n\
+@item @tab @qcode{'match'}        @tab @var{m}  @tab\n\
+@item @tab @qcode{'tokens'}       @tab @var{t}  @tab\n\
+@item @tab @qcode{'names'}        @tab @var{nm} @tab\n\
+@item @tab @qcode{'split'}        @tab @var{sp} @tab\n\
 @end multitable\n\
 \n\
 Additional arguments are summarized below.\n\
@@ -777,8 +782,8 @@
 @item emptymatch\n\
 Return zero-length matches.\n\
 \n\
-@code{regexp ('a', 'b*', 'emptymatch'} returns @code{[1 2]} because there are\n\
-zero or more 'b' characters at positions 1 and end-of-string.\n\
+@code{regexp ('a', 'b*', 'emptymatch')} returns @code{[1 2]} because there\n\
+are zero or more @qcode{'b'} characters at positions 1 and end-of-string.\n\
 \n\
 @end table\n\
 @seealso{regexpi, strfind, regexprep}\n\
@@ -920,7 +925,7 @@
 
 ## Tests for named tokens
 %!test
-%! # Parenthesis in named token (ie (int)) causes a problem
+%! ## Parenthesis in named token (ie (int)) causes a problem
 %! assert (regexp ('qwe int asd', ['(?<typestr>(int))'], 'names'), struct ('typestr', 'int'));
 
 %!test
@@ -1067,7 +1072,7 @@
 \n\
 Case insensitive regular expression string matching.  Search for @var{pat} in\n\
 @var{str} and return the positions and substrings of any matches, or empty\n\
-values if there are none.  @xref{docXregexp,,regexp}, for details on the\n\
+values if there are none.  @xref{XREFregexp,,regexp}, for details on the\n\
 syntax of the search pattern.\n\
 @seealso{regexp}\n\
 @end deftypefn")
@@ -1279,7 +1284,7 @@
 Replace occurrences of pattern @var{pat} in @var{string} with @var{repstr}.\n\
 \n\
 The pattern is a regular expression as documented for @code{regexp}.\n\
-@xref{docXregexp,,regexp}.\n\
+@xref{XREFregexp,,regexp}.\n\
 \n\
 The replacement string may contain @code{$i}, which substitutes\n\
 for the ith set of parentheses in the match string.  For example,\n\
@@ -1304,7 +1309,7 @@
 @end table\n\
 \n\
 Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\
-sequences (e.g., \"\\n\" => newline) are processed in both @var{pat}\n\
+sequences (e.g., @qcode{\"\\n\"} => newline) are processed in both @var{pat}\n\
 and @var{repstr} regardless of whether they were defined within single\n\
 quotes.  Use a second backslash to stop interpolation of the escape sequence\n\
 (e.g., \"\\\\n\") or use the @code{regexptranslate} function.\n\
--- a/libinterp/corefcn/schur.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/schur.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -107,7 +107,8 @@
 blocks, when appropriate) are the eigenvalues of @var{A} and @var{S}.\n\
 \n\
 The default for real matrices is a real Schur@tie{}decomposition.\n\
-A complex decomposition may be forced by passing the flag \"complex\".\n\
+A complex decomposition may be forced by passing the flag\n\
+@qcode{\"complex\"}.\n\
 \n\
 The eigenvalues are optionally ordered along the diagonal according to\n\
 the value of @var{opt}.  @code{@var{opt} = \"a\"} indicates that all\n\
@@ -123,7 +124,7 @@
 The Schur@tie{}decomposition is used to compute eigenvalues of a\n\
 square matrix, and has applications in the solution of algebraic\n\
 Riccati equations in control (see @code{are} and @code{dare}).\n\
-@seealso{rsf2csf}\n\
+@seealso{rsf2csf, lu, chol, hess, qr, qz, svd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -305,7 +306,7 @@
 $U^{\\dagger} U$ is the identity matrix I.\n\
 @end tex\n\
 @ifnottex\n\
-@xcode{@var{UR} * @var{TR} * @var{UR}' = @var{U} * @var{T} * @var{U}'} and\n\
+@tcode{@var{UR} * @var{TR} * @var{UR}' = @var{U} * @var{T} * @var{U}'} and\n\
 @code{@var{U}' * @var{U}} is the identity matrix I.\n\
 @end ifnottex\n\
 \n\
--- a/libinterp/corefcn/sighandlers.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/sighandlers.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -577,6 +577,137 @@
 
 }
 
+static pid_t gui_pid = 0;
+
+static void
+gui_driver_sig_handler (int sig)
+{
+  if (gui_pid > 0)
+    octave_syscalls::kill (gui_pid, sig);
+}
+
+void
+install_gui_driver_signal_handlers (pid_t pid)
+{
+  gui_pid = pid;
+
+#ifdef SIGINT
+  octave_set_signal_handler (SIGINT, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGBREAK
+  octave_set_signal_handler (SIGBREAK, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGABRT
+  octave_set_signal_handler (SIGABRT, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGALRM
+  octave_set_signal_handler (SIGALRM, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGBUS
+  octave_set_signal_handler (SIGBUS, gui_driver_sig_handler);
+#endif
+
+  // SIGCHLD
+  // SIGCLD
+  // SIGCONT
+
+#ifdef SIGEMT
+  octave_set_signal_handler (SIGEMT, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGFPE
+  octave_set_signal_handler (SIGFPE, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGHUP
+  octave_set_signal_handler (SIGHUP, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGILL
+  octave_set_signal_handler (SIGILL, gui_driver_sig_handler);
+#endif
+
+  // SIGINFO
+  // SIGINT
+
+#ifdef SIGIOT
+  octave_set_signal_handler (SIGIOT, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGLOST
+  octave_set_signal_handler (SIGLOST, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGPIPE
+  octave_set_signal_handler (SIGPIPE, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGPOLL
+  octave_set_signal_handler (SIGPOLL, gui_driver_sig_handler);
+#endif
+
+  // SIGPROF
+  // SIGPWR
+
+#ifdef SIGQUIT
+  octave_set_signal_handler (SIGQUIT, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGSEGV
+  octave_set_signal_handler (SIGSEGV, gui_driver_sig_handler);
+#endif
+
+  // SIGSTOP
+
+#ifdef SIGSYS
+  octave_set_signal_handler (SIGSYS, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGTERM
+  octave_set_signal_handler (SIGTERM, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGTRAP
+  octave_set_signal_handler (SIGTRAP, gui_driver_sig_handler);
+#endif
+
+  // SIGTSTP
+  // SIGTTIN
+  // SIGTTOU
+  // SIGURG
+
+#ifdef SIGUSR1
+  octave_set_signal_handler (SIGUSR1, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGUSR2
+  octave_set_signal_handler (SIGUSR2, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGVTALRM
+  octave_set_signal_handler (SIGVTALRM, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGIO
+  octave_set_signal_handler (SIGIO, gui_driver_sig_handler);
+#endif
+
+  // SIGWINCH
+
+#ifdef SIGXCPU
+  octave_set_signal_handler (SIGXCPU, gui_driver_sig_handler);
+#endif
+
+#ifdef SIGXFSZ
+  octave_set_signal_handler (SIGXFSZ, gui_driver_sig_handler);
+#endif
+
+}
+
 static octave_scalar_map
 make_sig_struct (void)
 {
@@ -908,9 +1039,9 @@
 generated with @kbd{C-c}).  If a second interrupt signal is received\n\
 before reaching the debugging mode, a normal interrupt will occur.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{debug_on_error, debug_on_warning}\n\
 @end deftypefn")
 {
@@ -935,12 +1066,12 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} sighup_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-workspace\" if it receives\n\
-a hangup signal.\n\
+to save all current variables to the file @file{octave-workspace} if it\n\
+receives a hangup signal.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (sighup_dumps_octave_core);
@@ -964,12 +1095,12 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} sigterm_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-workspace\" if it receives\n\
-a terminate signal.\n\
+to save all current variables to the file @file{octave-workspace} if it\n\
+receives a terminate signal.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (sigterm_dumps_octave_core);
--- a/libinterp/corefcn/sighandlers.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/sighandlers.h	Sat Oct 05 11:22:09 2013 -0400
@@ -71,6 +71,8 @@
 
 extern OCTINTERP_API void install_signal_handlers (void);
 
+extern OCTINTERP_API void install_gui_driver_signal_handlers (pid_t pid);
+
 extern OCTINTERP_API void octave_signal_handler (void);
 
 extern OCTINTERP_API octave_interrupt_handler octave_catch_interrupts (void);
--- a/libinterp/corefcn/sparse.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/sparse.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -91,8 +91,9 @@
 @end group\n\
 @end example\n\
 \n\
-Given the option \"unique\". if more than two values are specified for the\n\
-same @var{i}, @var{j} indices, the last specified value will be used.\n\
+Given the option @qcode{\"unique\"}, if more than two values are specified\n\
+for the same @var{i}, @var{j} indices, the last specified value will be\n\
+used.\n\
 \n\
 @code{sparse (@var{m}, @var{n})} is equivalent to\n\
 @code{sparse ([], [], [], @var{m}, @var{n}, 0)}\n\
--- a/libinterp/corefcn/spparms.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/spparms.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -97,9 +97,9 @@
 The value of individual keys can be set with\n\
 @code{spparms (@var{key}, @var{val})}.\n\
 The default values can be restored with the special keyword\n\
-\"defaults\".  The special keyword \"tight\" can be used to set the mmd\n\
-solvers to attempt a sparser solution at the potential cost of longer\n\
-running time.\n\
+@qcode{\"defaults\"}.  The special keyword @qcode{\"tight\"} can be used to\n\
+set the mmd solvers to attempt a sparser solution at the potential cost of\n\
+longer running time.\n\
 @end deftypefn")
 {
   octave_value_list retval;
--- a/libinterp/corefcn/sqrtm.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/sqrtm.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -272,5 +272,5 @@
 %! z = eye (4);  z(2,2) = z(3,3) = 2^-13;  z(1,4) = 0.5;
 %! [y, err] = sqrtm (x);
 %! assert (y, z);
-%! assert (err, 0);   ## Yes, this one has to hold exactly
+%! assert (err, 0);   # Yes, this one has to hold exactly
 */
--- a/libinterp/corefcn/str2double.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/str2double.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -42,9 +42,11 @@
 is_imag_unit (int c)
 { return c == 'i' || c == 'j'; }
 
-static std::istringstream&
-single_num (std::istringstream& is, double& num)
+static double
+single_num (std::istringstream& is)
 {
+  double num;
+
   char c = is.peek ();
 
   // Skip spaces.
@@ -92,7 +94,7 @@
   else
     is >> num;
 
-  return is;
+  return num;
 }
 
 static std::istringstream&
@@ -114,10 +116,10 @@
   // Accept leading sign.
   if (c == '+' || c == '-')
     {
+      have_sign = true;
       negative = c == '-';
       is.get ();
       c = is.peek ();
-      have_sign = true;
     }
 
   // Skip spaces after sign.
@@ -138,13 +140,11 @@
         {
           // just 'i' and string is finished.  Return immediately.
           imag = true;
-          num = 1.0;
-          if (negative)
-            num = -num;
+          num = negative ? -1.0 : 1.0;
           return is;
         }
       else
-        { 
+        {
           if (std::tolower (c) != 'n')
             imag = true;
           is.unget ();
@@ -152,7 +152,7 @@
     }
   else if (c == 'j')
     imag = true;
-    
+
   // It's i*num or just i
   if (imag)
     {
@@ -169,7 +169,7 @@
         {
           // Multiplier follows, we extract it as a number.
           is.get ();
-          single_num (is, num);
+          num = single_num (is);
           if (is.good ())
             c = is.peek ();
         }
@@ -179,7 +179,7 @@
   else
     {
       // It's num, num*i, or numi.
-      single_num (is, num);
+      num = single_num (is);
       if (is.good ())
         {
           c = is.peek ();
@@ -265,10 +265,9 @@
 
   std::string str = str_arg;
 
-  // FIXME -- removing all commas does too much...
-  std::string::iterator se = str.end ();
-  se = std::remove (str.begin (), se, ',');
-  str.erase (se, str.end ());
+  // FIXME: removing all commas doesn't allow actual parsing.
+  //        Example: "1,23.45" is wrong, but passes Octave.
+  str.erase (std::remove (str.begin (), str.end(), ','), str.end ());
   std::istringstream is (str);
 
   double num;
@@ -300,7 +299,7 @@
 Convert a string to a real or complex number.\n\
 \n\
 The string must be in one of the following formats where\n\
-a and b are real numbers and the complex unit is 'i' or 'j':\n\
+a and b are real numbers and the complex unit is @qcode{'i'} or @qcode{'j'}:\n\
 \n\
 @itemize\n\
 @item a + bi\n\
@@ -317,17 +316,24 @@
 @end itemize\n\
 \n\
 If present, a and/or b are of the form @nospell{[+-]d[,.]d[[eE][+-]d]} where\n\
-the brackets indicate optional arguments and 'd' indicates zero or more\n\
-digits.  The special input values @code{Inf}, @code{NaN}, and @code{NA} are\n\
-also accepted.\n\
+the brackets indicate optional arguments and @qcode{'d'} indicates zero or\n\
+more digits.  The special input values @code{Inf}, @code{NaN}, and @code{NA}\n\
+are also accepted.\n\
 \n\
-@var{s} may also be a character matrix, in which case the conversion is\n\
-repeated for each row.  Or @var{s} may be a cell array of strings, in which\n\
-case each element is converted and an array of the same dimensions is\n\
-returned.\n\
+@var{s} may be a character string, character matrix, or cell array.\n\
+For character arrays the conversion is repeated for every row, and\n\
+a double or complex array is returned.  Empty rows in @var{s} are deleted\n\
+and not returned in the numeric array.  For cell arrays each character\n\
+string element is processed and a double or complex array of the same\n\
+dimensions as @var{s} is returned.\n\
 \n\
-@code{str2double} returns NaN for elements of @var{s} which cannot be\n\
-converted.\n\
+For unconvertible scalar or character string input @code{str2double} returns\n\
+a NaN@.  Similarly, for character array input @code{str2double} returns a\n\
+NaN for any row of @var{s} that could not be converted.  For a cell array,\n\
+@code{str2double} returns a NaN for any element of @var{s} for which\n\
+conversion fails.  Note that numeric elements in a mixed string/numeric\n\
+cell array are not strings and the conversion will fail for these elements\n\
+and return NaN.\n\
 \n\
 @code{str2double} can replace @code{str2num}, and it avoids the security\n\
 risk of using @code{eval} on unknown data.\n\
@@ -340,7 +346,11 @@
     print_usage ();
   else if (args(0).is_string ())
     {
-      if (args(0).rows () == 1 && args(0).ndims () == 2)
+      if (args(0).rows () == 0 || args(0).columns () == 0)
+        {
+          retval = Matrix (1, 1, octave_NaN);
+        }
+      else if (args(0).rows () == 1 && args(0).ndims () == 2)
         {
           retval = str2double1 (args(0).string_value ());
         }
@@ -367,7 +377,7 @@
       }
     }
   else
-    retval = NDArray (args(0).dims (), octave_NaN);
+    retval = Matrix (1, 1, octave_NaN);
 
 
   return retval;
@@ -377,7 +387,6 @@
 %!assert (str2double ("1"), 1)
 %!assert (str2double ("-.1e-5"), -1e-6)
 %!assert (str2double (char ("1", "2 3", "4i")), [1; NaN; 4i])
-%!assert (str2double ("-.1e-5"), -1e-6)
 %!assert (str2double ("1,222.5"), 1222.5)
 %!assert (str2double ("i"), i)
 %!assert (str2double ("2j"), 2i)
@@ -402,5 +411,8 @@
 %!assert (str2double ("-i*NaN - Inf"), complex (-Inf, -NaN))
 %!assert (str2double ({"abc", "4i"}), [NaN + 0i, 4i])
 %!assert (str2double ({2, "4i"}), [NaN + 0i, 4i])
-%!assert (str2double (zeros (3,1,2)), NaN (3,1,2))
-*/
+%!assert (str2double (zeros (3,1,2)), NaN)
+%!assert (str2double (''), NaN)
+%!assert (str2double ([]), NaN)
+%!assert (str2double (char(zeros(3,0))), NaN)
+ */
--- a/libinterp/corefcn/strfind.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/strfind.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -149,20 +149,29 @@
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {@var{idx} =} strfind (@var{str}, @var{pattern})\n\
 @deftypefnx {Built-in Function} {@var{idx} =} strfind (@var{cellstr}, @var{pattern})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} strfind (@dots{}, \"overlaps\", @var{val})\n\
 Search for @var{pattern} in the string @var{str} and return the\n\
 starting index of every such occurrence in the vector @var{idx}.\n\
+\n\
 If there is no such occurrence, or if @var{pattern} is longer\n\
 than @var{str}, then @var{idx} is the empty array @code{[]}.\n\
+The optional argument @qcode{\"overlaps\"} determines whether the pattern\n\
+can match at every position in @var{str} (true), or only for unique\n\
+occurrences of the complete pattern (false).  The default is true.\n\
 \n\
 If a cell array of strings @var{cellstr} is specified\n\
-then @var{idx} is a cell array of vectors, as specified\n\
-above.  Examples:\n\
+then @var{idx} is a cell array of vectors, as specified above.\n\
+\n\
+Examples:\n\
 \n\
 @example\n\
 @group\n\
 strfind (\"abababa\", \"aba\")\n\
      @result{} [1, 3, 5]\n\
 \n\
+strfind (\"abababa\", \"aba\", \"overlaps\", false)\n\
+     @result{} [1, 5]\n\
+\n\
 strfind (@{\"abababa\", \"bebebe\", \"ab\"@}, \"aba\")\n\
      @result{}\n\
         @{\n\
@@ -321,10 +330,20 @@
 
 DEFUN (strrep, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep})\n\
-@deftypefnx {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep}, \"overlaps\", @var{o})\n\
-Replace all occurrences of the substring @var{ptn} in the string @var{s}\n\
-with the string @var{rep} and return the result.  For example:\n\
+@deftypefn  {Built-in Function} {@var{newstr} =} strrep (@var{str}, @var{ptn}, @var{rep})\n\
+@deftypefnx {Built-in Function} {@var{newstr} =} strrep (@var{cellstr}, @var{ptn}, @var{rep})\n\
+@deftypefnx {Built-in Function} {@var{newstr} =} strrep (@dots{}, \"overlaps\", @var{val})\n\
+Replace all occurrences of the pattern @var{ptn} in the string @var{str}\n\
+with the string @var{rep} and return the result.\n\
+\n\
+The optional argument @qcode{\"overlaps\"} determines whether the pattern\n\
+can match at every position in @var{str} (true), or only for unique\n\
+occurrences of the complete pattern (false).  The default is true.\n\
+\n\
+@var{s} may also be a cell array of strings, in which case the replacement is\n\
+done for each element and a cell array is returned.\n\
+\n\
+Example:\n\
 \n\
 @example\n\
 @group\n\
@@ -333,8 +352,6 @@
 @end group\n\
 @end example\n\
 \n\
-@var{s} may also be a cell array of strings, in which case the replacement is\n\
-done for each element and a cell array is returned.\n\
 @seealso{regexprep, strfind, findstr}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/svd.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/svd.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -121,7 +121,7 @@
 If given a second argument, @code{svd} returns an economy-sized\n\
 decomposition, eliminating the unnecessary rows or columns of @var{U} or\n\
 @var{V}.\n\
-@seealso{svd_driver, svds, eig}\n\
+@seealso{svd_driver, svds, eig, lu, chol, hess, qr, qz}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -408,12 +408,12 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} svd_driver (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} svd_driver (@var{new_val}, \"local\")\n\
 Query or set the underlying @sc{lapack} driver used by @code{svd}.\n\
-Currently recognized values are \"gesvd\" and \"gesdd\".  The default\n\
-is \"gesvd\".\n\
+Currently recognized values are @qcode{\"gesvd\"} and @qcode{\"gesdd\"}.  \n\
+The default is @qcode{\"gesvd\"}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{svd}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/symtab.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/symtab.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1594,14 +1594,14 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} ignore_function_time_stamp (@var{new_val})\n\
 Query or set the internal variable that controls whether Octave checks\n\
 the time stamp on files each time it looks up functions defined in\n\
-function files.  If the internal variable is set to @code{\"system\"},\n\
+function files.  If the internal variable is set to @qcode{\"system\"},\n\
 Octave will not automatically recompile function files in subdirectories of\n\
 @file{@var{octave-home}/lib/@var{version}} if they have changed since\n\
 they were last compiled, but will recompile other function files in the\n\
-search path if they change.  If set to @code{\"all\"}, Octave will not\n\
+search path if they change.  If set to @qcode{\"all\"}, Octave will not\n\
 recompile any function files unless their definitions are removed with\n\
-@code{clear}.  If set to \"none\", Octave will always check time stamps\n\
-on files to determine whether functions defined in function files\n\
+@code{clear}.  If set to @qcode{\"none\"}, Octave will always check time\n\
+stamps on files to determine whether functions defined in function files\n\
 need to recompiled.\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/symtab.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/symtab.h	Sat Oct 05 11:22:09 2013 -0400
@@ -31,7 +31,7 @@
 #include <string>
 
 #include "glob-match.h"
-#include "regexp.h"
+#include "lo-regexp.h"
 
 class tree_argument_list;
 class octave_user_function;
--- a/libinterp/corefcn/syscalls.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/syscalls.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -38,6 +38,7 @@
 
 #include <fcntl.h>
 
+#include "cmd-hist.h"
 #include "file-ops.h"
 #include "file-stat.h"
 #include "oct-env.h"
@@ -48,6 +49,7 @@
 #include "error.h"
 #include "gripes.h"
 #include "lo-utils.h"
+#include "oct-hist.h"
 #include "oct-map.h"
 #include "oct-obj.h"
 #include "oct-stdstrm.h"
@@ -220,6 +222,11 @@
 
           if (! error_state)
             {
+              octave_history_write_timestamp ();
+
+              if (! command_history::ignoring_entries ())
+                command_history::clean_up_and_save ();
+
               std::string msg;
 
               int status = octave_syscalls::execvp (exec_file, exec_args, msg);
@@ -276,7 +283,7 @@
    @print{} are\n\
 @end example\n\
 \n\
-Note that @code{popen2}, unlike @code{popen}, will not \"reap\" the\n\
+Note that @code{popen2}, unlike @code{popen}, will not @qcode{\"reap\"} the\n\
 child process.  If you don't use @code{waitpid} to check the child's\n\
 exit status, it will linger until Octave exits.\n\
 @end deftypefn")
@@ -742,11 +749,13 @@
 
 DEFUNX ("lstat", Flstat, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{symlink})\n\
+@deftypefn  {Built-in Function} {@var{info} =} lstat (@var{symlink})\n\
+@deftypefnx {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{symlink})\n\
 Return a structure @var{info} containing information about the symbolic link\n\
-@var{symlink}.  The function outputs are described in the documentation for\n\
-@code{stat}.\n\
-@seealso{stat}\n\
+@var{symlink}.\n\
+\n\
+The function outputs are described in the documentation for @code{stat}.\n\
+@seealso{stat, symlink}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -770,12 +779,14 @@
 
 DEFUNX ("mkfifo", Fmkfifo, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode})\n\
-Create a @var{fifo} special file named @var{name} with file mode @var{mode}\n\
+@deftypefn  {Built-in Function} {} mkfifo (@var{name}, @var{mode})\n\
+@deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode})\n\
+Create a FIFO special file named @var{name} with file mode @var{mode}\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
+@seealso{pipe}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -830,6 +841,7 @@
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\
 system-dependent error message.\n\
+@seealso{mkfifo}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -893,9 +905,9 @@
 \n\
 @item mode\n\
 File mode, as an integer.  Use the functions @w{@code{S_ISREG}},\n\
-@w{@code{S_ISDIR}}, @w{@code{S_ISCHR}}, @w{@code{S_ISBLK}}, @w{@code{S_ISFIFO}},\n\
-@w{@code{S_ISLNK}}, or @w{@code{S_ISSOCK}} to extract information from this\n\
-value.\n\
+@w{@code{S_ISDIR}}, @w{@code{S_ISCHR}}, @w{@code{S_ISBLK}},\n\
+@w{@code{S_ISFIFO}}, @w{@code{S_ISLNK}}, or @w{@code{S_ISSOCK}} to extract\n\
+information from this value.\n\
 \n\
 @item modestr\n\
 File mode, as a string of ten letters or dashes as would be returned by\n\
@@ -968,6 +980,7 @@
   @result{} err = 0\n\
   @result{} msg =\n\
 @end example\n\
+@seealso{lstat, ls, dir}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -1006,8 +1019,9 @@
 DEFUNX ("S_ISREG", FS_ISREG, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISREG (@var{mode})\n\
-Return true if @var{mode} corresponds to a regular file.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a regular file.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1031,8 +1045,9 @@
 DEFUNX ("S_ISDIR", FS_ISDIR, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISDIR (@var{mode})\n\
-Return true if @var{mode} corresponds to a directory.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a directory.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1056,8 +1071,9 @@
 DEFUNX ("S_ISCHR", FS_ISCHR, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISCHR (@var{mode})\n\
-Return true if @var{mode} corresponds to a character device.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a character device.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1081,8 +1097,9 @@
 DEFUNX ("S_ISBLK", FS_ISBLK, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISBLK (@var{mode})\n\
-Return true if @var{mode} corresponds to a block device.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a block device.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1106,8 +1123,9 @@
 DEFUNX ("S_ISFIFO", FS_ISFIFO, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISFIFO (@var{mode})\n\
-Return true if @var{mode} corresponds to a fifo.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a fifo.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1131,8 +1149,9 @@
 DEFUNX ("S_ISLNK", FS_ISLNK, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISLNK (@var{mode})\n\
-Return true if @var{mode} corresponds to a symbolic link.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a symbolic link.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
@@ -1156,8 +1175,9 @@
 DEFUNX ("S_ISSOCK", FS_ISSOCK, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} S_ISSOCK (@var{mode})\n\
-Return true if @var{mode} corresponds to a socket.  The value\n\
-of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
+Return true if @var{mode} corresponds to a socket.\n\
+\n\
+The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\
 @seealso{stat, lstat}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/toplev.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/toplev.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -634,6 +634,9 @@
     }
   while (retval == 0);
 
+  if (retval == EOF)
+    retval = 0;
+
   return retval;
 }
 
@@ -751,7 +754,7 @@
   else
     {
       if (octave_exit)
-        (*octave_exit) (retval == EOF ? 0 : retval);
+        (*octave_exit) (retval);
     }
 }
 
@@ -807,8 +810,7 @@
 {
   octave_value_list retval;
 
-  octave_stdout << "\n" \
-    OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\
+  octave_stdout << "\n" << octave_name_version_and_copyright () << "\n\
 \n\
 GNU Octave free software; you can redistribute it and/or modify\n\
 it under the terms of the GNU General Public License as published by\n\
@@ -913,11 +915,11 @@
 @deftypefnx {Built-in Function} {} system (\"@var{string}\", @var{return_output}, @var{type})\n\
 @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} system (@dots{})\n\
 Execute a shell command specified by @var{string}.\n\
-If the optional argument @var{type} is \"async\", the process\n\
+If the optional argument @var{type} is @qcode{\"async\"}, the process\n\
 is started in the background and the process ID of the child process\n\
 is returned immediately.  Otherwise, the child process is started and\n\
 Octave waits until it exits.  If the @var{type} argument is omitted, it\n\
-defaults to the value \"sync\".\n\
+defaults to the value @qcode{\"sync\"}.\n\
 \n\
 If @var{system} is called with one or more output arguments, or if the\n\
 optional argument @var{return_output} is true and the subprocess is started\n\
@@ -1139,7 +1141,7 @@
 @end example\n\
 \n\
 @noindent\n\
-will print the message \"Bye bye\" when Octave exits.\n\
+will print the message @qcode{\"Bye bye\"} when Octave exits.\n\
 \n\
 The additional argument @var{flag} will register or unregister\n\
 @var{fcn} from the list of functions to be called when Octave\n\
--- a/libinterp/corefcn/toplev.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/toplev.h	Sat Oct 05 11:22:09 2013 -0400
@@ -40,6 +40,7 @@
 
 #include "input.h"
 #include "oct-map.h"
+#include "symtab.h"
 
 
 typedef void (*octave_exit_func) (int);
--- a/libinterp/corefcn/tril.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/tril.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -386,9 +386,9 @@
 @end group\n\
 @end example\n\
 \n\
-If the option \"pack\" is given as third argument, the extracted elements\n\
-are not inserted into a matrix, but rather stacked column-wise one above\n\
-other.\n\
+If the option @qcode{\"pack\"} is given as third argument, the extracted\n\
+elements are not inserted into a matrix, but rather stacked column-wise one\n\
+above other.\n\
 @seealso{diag}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/txt-eng-ft.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/txt-eng-ft.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -30,7 +30,11 @@
 #include <fontconfig/fontconfig.h>
 #endif
 
+#include <clocale>
+#include <cwchar>
 #include <iostream>
+#include <map>
+#include <utility>
 
 #include "singleton-cleanup.h"
 
@@ -38,33 +42,36 @@
 #include "pr-output.h"
 #include "txt-eng-ft.h"
 
-// FIXME -- maybe issue at most one warning per glyph/font/size/weight
-// combination.
+// FIXME: maybe issue at most one warning per glyph/font/size/weight
+//        combination.
 
 static void
-gripe_missing_glyph (char c)
+gripe_missing_glyph (FT_ULong c)
 {
   warning_with_id ("Octave:missing-glyph",
-                   "ft_render: skipping missing glyph for character '%c'",
+                   "ft_render: skipping missing glyph for character '%x'",
                    c);
 }
 
 static void
-gripe_glyph_render (char c)
+gripe_glyph_render (FT_ULong c)
 {
   warning_with_id ("Octave:glyph-render",
-                   "ft_render: unable to render glyph for character '%c'",
+                   "ft_render: unable to render glyph for character '%x'",
                    c);
 }
 
 #ifdef _MSC_VER
-// This is just a trick to avoid multiply symbols definition.
+// This is just a trick to avoid multiple symbol definitions.
 // PermMatrix.h contains a dllexport'ed Array<octave_idx_type>
-// that will make MSVC not to generate new instantiation and
-// use the imported one.
+// that will cause MSVC not to generate a new instantiation and
+// use the imported one instead.
 #include "PermMatrix.h"
 #endif
 
+// Forward declaration
+static void ft_face_destroyed (void* object);
+
 class
 ft_manager
 {
@@ -99,10 +106,24 @@
               ? instance->do_get_font (name, weight, angle, size)
               : 0); }
 
+  static void font_destroyed (FT_Face face)
+    {
+      if (instance_ok ())
+        instance->do_font_destroyed (face);
+    }
+
 private:
 
   static ft_manager *instance;
 
+  typedef std::pair<std::string, double> ft_key;
+  typedef std::map<ft_key, FT_Face> ft_cache;
+
+  // Cache the fonts loaded by freetype. This cache only contains
+  // weak references to the fonts, strong references are only present
+  // in class ft_render.
+  ft_cache cache;
+
 private:
 
   // No copying!
@@ -133,8 +154,7 @@
         FT_Done_FreeType (library);
 
 #if defined (HAVE_FONTCONFIG)
-      // FIXME -- Skip the call to FcFini because it can trigger the
-      // assertion
+      // FIXME: Skip the call to FcFini because it can trigger the assertion
       //
       //   octave: fccache.c:507: FcCacheFini: Assertion 'fcCacheChains[i] == ((void *)0)' failed.
       //
@@ -149,6 +169,20 @@
     {
       FT_Face retval = 0;
 
+#if HAVE_FT_REFERENCE_FACE
+      // Look first into the font cache, then use fontconfig. If the font
+      // is present in the cache, simply add a reference and return it.
+
+      ft_key key (name + ":" + weight + ":" + angle, size);
+      ft_cache::const_iterator it = cache.find (key);
+
+      if (it != cache.end ())
+        {
+          FT_Reference_Face (it->second);
+          return it->second;
+        }
+#endif
+
       std::string file;
 
 #if defined (HAVE_FONTCONFIG)
@@ -190,7 +224,7 @@
               FcDefaultSubstitute (pat);
               match = FcFontMatch (0, pat, &res);
 
-              // FIXME -- originally, this test also required that
+              // FIXME: originally, this test also required that
               // res != FcResultNoMatch.  Is that really needed?
               if (match)
                 {
@@ -221,12 +255,42 @@
 #endif
         }
 
-      if (! file.empty () && FT_New_Face (library, file.c_str (), 0, &retval))
-        ::warning ("ft_manager: unable to load font: %s", file.c_str ());
+      if (! file.empty ())
+        {
+          if (FT_New_Face (library, file.c_str (), 0, &retval))
+            ::warning ("ft_manager: unable to load font: %s", file.c_str ());
+#if HAVE_FT_REFERENCE_FACE
+          else
+            {
+              // Install a finalizer to notify ft_manager that the font is
+              // being destroyed. The class ft_manager only keeps weak
+              // references to font objects.
+
+              retval->generic.data = new ft_key (key);
+              retval->generic.finalizer = ft_face_destroyed;
+
+              // Insert loaded font into the cache.
+
+              cache[key] = retval;
+            }
+#endif
+        }
 
       return retval;
     }
 
+  void do_font_destroyed (FT_Face face)
+    {
+      if (face->generic.data)
+        {
+          ft_key* pkey = reinterpret_cast<ft_key*> (face->generic.data);
+
+          cache.erase (*pkey);
+          delete pkey;
+          face->generic.data = 0;
+        }
+    }
+
 private:
   FT_Library library;
   bool freetype_initialized;
@@ -235,39 +299,164 @@
 
 ft_manager* ft_manager::instance = 0;
 
+static void
+ft_face_destroyed (void* object)
+{ ft_manager::font_destroyed (reinterpret_cast<FT_Face> (object)); }
+
 // ---------------------------------------------------------------------------
 
 ft_render::ft_render (void)
-    : text_processor (), face (0), bbox (1, 4, 0.0),
-      xoffset (0), yoffset (0), multiline_halign (0),
-      multiline_align_xoffsets (), mode (MODE_BBOX),
-      red (0), green (0), blue (0)
+    : text_processor (), font (), bbox (1, 4, 0.0), halign (0), xoffset (0),
+      line_yoffset (0), yoffset (0), mode (MODE_BBOX),
+      color (dim_vector (1, 3), 0)
 {
 }
 
 ft_render::~ft_render (void)
 {
-  if (face)
-    FT_Done_Face (face);
 }
 
 void
 ft_render::set_font (const std::string& name, const std::string& weight,
                      const std::string& angle, double size)
 {
-  if (face)
-    FT_Done_Face (face);
+  // FIXME: take "fontunits" into account
+
+  font = ft_font (name, weight, angle, size, 0);
+}
+
+void
+ft_render::push_new_line (void)
+{
+  switch (mode)
+    {
+    case MODE_BBOX:
+        {
+          // Create a new bbox entry based on the current font.
+
+          FT_Face face = font.get_face ();
+
+          if (face)
+            {
+              int asc = face->size->metrics.ascender >> 6;
+              int desc = face->size->metrics.descender >> 6;
+              int h = face->size->metrics.height >> 6;
+
+              Matrix bb (1, 5, 0.0);
+
+              bb(1) = desc;
+              bb(3) = asc - desc;
+              bb(4) = h;
+
+              line_bbox.push_back (bb);
 
-  // FIXME: take "fontunits" into account
-  face = ft_manager::get_font (name, weight, angle, size);
+              xoffset = yoffset = 0;
+            }
+        }
+      break;
+
+    case MODE_RENDER:
+        {
+          // Move to the next line bbox, adjust xoffset based on alignment
+          // and yoffset based on the old and new line bbox.
+
+          Matrix old_bbox = line_bbox.front ();
+          line_bbox.pop_front ();
+          Matrix new_bbox = line_bbox.front ();
+
+          xoffset = compute_line_xoffset (new_bbox);
+          line_yoffset += (old_bbox(1) - (new_bbox(1) + new_bbox(3)));
+          yoffset = 0;
+        }
+      break;
+    }
+}
+
+int
+ft_render::compute_line_xoffset (const Matrix& lb) const
+{
+  if (! bbox.is_empty ())
+    {
+      switch (halign)
+        {
+        case 0:
+          return 0;
+        case 1:
+          return (bbox(2) - lb(2)) / 2;
+        case 2:
+          return (bbox(2) - lb(2));
+        }
+    }
 
-  if (face)
+  return 0;
+}
+
+void
+ft_render::compute_bbox (void)
+{
+  // Stack the various line bbox together and compute the final
+  // bounding box for the entire text string.
+
+  bbox = Matrix ();
+
+  switch (line_bbox.size ())
     {
-      if (FT_Set_Char_Size (face, 0, size*64, 0, 0))
-        ::warning ("ft_render: unable to set font size to %d", size);
+    case 0:
+      break;
+    case 1:
+      bbox = line_bbox.front ().extract (0, 0, 0, 3);
+      break;
+    default:
+      for (std::list<Matrix>::const_iterator it = line_bbox.begin ();
+           it != line_bbox.end (); ++it)
+        {
+          if (bbox.is_empty ())
+            bbox = it->extract (0, 0, 0, 3);
+          else
+            {
+              bbox(1) -= (*it)(3);
+              bbox(3) += (*it)(3);
+              bbox(2) = xmax (bbox(2), (*it)(2));
+            }
+        }
+      break;
     }
-  else
-    ::warning ("ft_render: unable to load appropriate font");
+}
+
+void
+ft_render::update_line_bbox (void)
+{
+  // Called after a font change, when in MODE_BBOX mode, to update the
+  // current line bbox with the new font metrics. This also includes the
+  // current yoffset, that is the offset of the current glyph's baseline
+  // the line's baseline.
+
+  if (mode == MODE_BBOX)
+    {
+      int asc = font.get_face ()->size->metrics.ascender >> 6;
+      int desc = font.get_face ()->size->metrics.descender >> 6;
+
+      Matrix& bb = line_bbox.front ();
+
+      if ((yoffset + desc) < bb(1))
+        {
+          // The new font goes below the bottom of the current bbox.
+
+          int delta = bb(1) - (yoffset + desc);
+
+          bb(1) -= delta;
+          bb(3) += delta;
+        }
+
+      if ((yoffset + asc) > (bb(1) + bb(3)))
+        {
+          // The new font goes above the top of the current bbox.
+
+          int delta = (yoffset + asc) - (bb(1) + bb(3));
+
+          bb(3) += delta;
+        }
+    }
 }
 
 void
@@ -278,23 +467,26 @@
   switch (mode)
     {
     case MODE_BBOX:
-      xoffset = yoffset = 0;
+      xoffset = line_yoffset = yoffset = 0;
       bbox = Matrix (1, 4, 0.0);
+      line_bbox.clear ();
+      push_new_line ();
       break;
     case MODE_RENDER:
       if (bbox.numel () != 4)
         {
           ::warning ("ft_render: invalid bounding box, cannot render");
 
-          xoffset = yoffset = 0;
+          xoffset = line_yoffset = yoffset = 0;
           pixels = uint8NDArray ();
         }
       else
         {
           pixels = uint8NDArray (dim_vector (4, bbox(2), bbox(3)),
                                  static_cast<uint8_t> (0));
-          xoffset = 0;
-          yoffset = -bbox(1)-1;
+          xoffset = compute_line_xoffset (line_bbox.front ());
+          line_yoffset = -bbox(1)-1;
+          yoffset = 0;
         }
       break;
     default:
@@ -303,187 +495,335 @@
     }
 }
 
+FT_UInt
+ft_render::process_character (FT_ULong code, FT_UInt previous)
+{
+  FT_Face face = font.get_face ();
+  FT_UInt glyph_index = 0;
+
+  if (face)
+    {
+      glyph_index = FT_Get_Char_Index (face, code);
+
+      if (code != '\n'
+          && (! glyph_index
+              || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT)))
+        {
+          glyph_index = 0;
+          gripe_missing_glyph (code);
+        }
+      else
+        {
+          switch (mode)
+            {
+            case MODE_RENDER:
+              if (code == '\n')
+                {
+                  glyph_index = FT_Get_Char_Index (face, ' ');
+                  if (!glyph_index || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))
+                    {
+                      glyph_index = 0;
+                      gripe_missing_glyph (' ');
+                    }
+                  else
+                    push_new_line ();
+                }
+              else if (FT_Render_Glyph (face->glyph, FT_RENDER_MODE_NORMAL))
+                {
+                  glyph_index = 0;
+                  gripe_glyph_render (code);
+                }
+              else
+                {
+                  FT_Bitmap& bitmap = face->glyph->bitmap;
+                  int x0, y0;
+
+                  if (previous)
+                    {
+                      FT_Vector delta;
+
+                      FT_Get_Kerning (face, previous, glyph_index, FT_KERNING_DEFAULT, &delta);
+                      xoffset += (delta.x >> 6);
+                    }
+
+                  x0 = xoffset + face->glyph->bitmap_left;
+                  y0 = line_yoffset + yoffset + face->glyph->bitmap_top;
+
+                  // 'w' seems to have a negative -1
+                  // face->glyph->bitmap_left, this is so we don't
+                  // index out of bound, and assumes we we allocated
+                  // the right amount of horizontal space in the bbox.
+                  if (x0 < 0)
+                    x0 = 0;
+
+                  for (int r = 0; r < bitmap.rows; r++)
+                    for (int c = 0; c < bitmap.width; c++)
+                      {
+                        unsigned char pix = bitmap.buffer[r*bitmap.width+c];
+                        if (x0+c < 0 || x0+c >= pixels.dim2 ()
+                            || y0-r < 0 || y0-r >= pixels.dim3 ())
+                          {
+                            //::warning ("ft_render: pixel out of bound (char=%d, (x,y)=(%d,%d), (w,h)=(%d,%d)",
+                            //           str[i], x0+c, y0-r, pixels.dim2 (), pixels.dim3 ());
+                          }
+                        else if (pixels(3, x0+c, y0-r).value () == 0)
+                          {
+                            pixels(0, x0+c, y0-r) = color(0);
+                            pixels(1, x0+c, y0-r) = color(1);
+                            pixels(2, x0+c, y0-r) = color(2);
+                            pixels(3, x0+c, y0-r) = pix;
+                          }
+                      }
+
+                  xoffset += (face->glyph->advance.x >> 6);
+                }
+              break;
+
+            case MODE_BBOX:
+              if (code == '\n')
+                {
+                  glyph_index = FT_Get_Char_Index (face, ' ');
+                  if (! glyph_index
+                      || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))
+                    {
+                      glyph_index = 0;
+                      gripe_missing_glyph (' ');
+                    }
+                  else
+                    push_new_line ();
+                }
+              else
+                {
+                  Matrix& bb = line_bbox.back ();
+
+                  // If we have a previous glyph, use kerning information.
+                  // This usually means moving a bit backward before adding
+                  // the next glyph. That is, "delta.x" is usually < 0.
+                  if (previous)
+                    {
+                      FT_Vector delta;
+
+                      FT_Get_Kerning (face, previous, glyph_index,
+                                      FT_KERNING_DEFAULT, &delta);
+
+                      xoffset += (delta.x >> 6);
+                    }
+
+                  // Extend current X offset box by the width of the current
+                  // glyph. Then extend the line bounding box if necessary.
+
+                  xoffset += (face->glyph->advance.x >> 6);
+                  bb(2) = xmax (bb(2), xoffset);
+                }
+              break;
+            }
+        }
+    }
+
+  return glyph_index;
+}
+
 void
 ft_render::visit (text_element_string& e)
 {
-  if (face)
+  if (font.is_valid ())
     {
-      int line_index = 0;
-      FT_UInt box_line_width = 0;
-      std::string str = e.string_value ();
       FT_UInt glyph_index, previous = 0;
 
-      if (mode == MODE_BBOX)
-        multiline_align_xoffsets.clear ();
-      else if (mode == MODE_RENDER)
-        xoffset += multiline_align_xoffsets[line_index];
+      std::string str = e.string_value ();
+      size_t n = str.length (), curr = 0;
+      mbstate_t ps;
+      memset (&ps, 0, sizeof (ps));  // Initialize state to 0.
+      wchar_t wc;
 
-      for (size_t i = 0; i < str.length (); i++)
+      while (n > 0)
         {
-          glyph_index = FT_Get_Char_Index (face, str[i]);
+          size_t r = gnulib::mbrtowc (&wc, str.data () + curr, n, &ps);
 
-          if (str[i] != '\n'
-              && (! glyph_index
-              || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT)))
-            gripe_missing_glyph (str[i]);
+          if (r > 0
+              && r != static_cast<size_t> (-1)
+              && r != static_cast<size_t> (-2))
+            {
+              n -= r;
+              curr += r;
+
+              glyph_index = process_character (wc, previous);
+
+              if (wc == L'\n')
+                previous = 0;
+              else
+                previous = glyph_index;
+            }
           else
             {
-              switch (mode)
-                {
-                case MODE_RENDER:
-                  if (str[i] == '\n')
-                    {
-                    glyph_index = FT_Get_Char_Index (face, ' ');
-                    if (!glyph_index || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))
-                      {
-                        gripe_missing_glyph (' ');
-                      }
-                    else
-                      {
-                        line_index++;
-                        xoffset = multiline_align_xoffsets[line_index];
-                        yoffset -= (face->size->metrics.height >> 6);
-                      }
-                    }
-                  else if (FT_Render_Glyph (face->glyph, FT_RENDER_MODE_NORMAL))
-                    {
-                      gripe_glyph_render (str[i]);
-                    }
-                  else
-                    {
-                      FT_Bitmap& bitmap = face->glyph->bitmap;
-                      int x0, y0;
-
-                      if (previous)
-                        {
-                          FT_Vector delta;
-
-                          FT_Get_Kerning (face, previous, glyph_index, FT_KERNING_DEFAULT, &delta);
-                          xoffset += (delta.x >> 6);
-                        }
-
-                      x0 = xoffset+face->glyph->bitmap_left;
-                      y0 = yoffset+face->glyph->bitmap_top;
-
-                      // 'w' seems to have a negative -1
-                      // face->glyph->bitmap_left, this is so we don't
-                      // index out of bound, and assumes we we allocated
-                      // the right amount of horizontal space in the bbox.
-                      if (x0 < 0)
-                        x0 = 0;
-
-                      for (int r = 0; r < bitmap.rows; r++)
-                        for (int c = 0; c < bitmap.width; c++)
-                          {
-                            unsigned char pix = bitmap.buffer[r*bitmap.width+c];
-                            if (x0+c < 0 || x0+c >= pixels.dim2 ()
-                                || y0-r < 0 || y0-r >= pixels.dim3 ())
-                              {
-                                //::error ("out-of-bound indexing!!");
-                              }
-                            else if (pixels(3, x0+c, y0-r).value () == 0)
-                              {
-                                pixels(0, x0+c, y0-r) = red;
-                                pixels(1, x0+c, y0-r) = green;
-                                pixels(2, x0+c, y0-r) = blue;
-                                pixels(3, x0+c, y0-r) = pix;
-                              }
-                          }
-
-                      xoffset += (face->glyph->advance.x >> 6);
-                    }
-                  break;
-
-                case MODE_BBOX:
-                  if (str[i] == '\n')
-                    {
-                      glyph_index = FT_Get_Char_Index (face, ' ');
-                      if (! glyph_index
-                          || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))
-                      {
-                        gripe_missing_glyph (' ');
-                      }
-                    else
-                      {
-                        multiline_align_xoffsets.push_back (box_line_width);
-                        // Reset the pixel width for this newline, so we don't
-                        // allocate a bounding box larger than the horizontal
-                        // width of the multi-line
-                        box_line_width = 0;
-                        bbox(1) -= (face->size->metrics.height >> 6);
-                      }
-                    }
-                  else
-                    {
-                    // width
-                    if (previous)
-                      {
-                        FT_Vector delta;
-
-                        FT_Get_Kerning (face, previous, glyph_index,
-                                        FT_KERNING_DEFAULT, &delta);
-
-                        box_line_width += (delta.x >> 6);
-                      }
-
-                    box_line_width += (face->glyph->advance.x >> 6);
-
-                    int asc, desc;
-
-                    if (false /*tight*/)
-                      {
-                        desc = face->glyph->metrics.horiBearingY - face->glyph->metrics.height;
-                        asc = face->glyph->metrics.horiBearingY;
-                      }
-                    else
-                      {
-                        asc = face->size->metrics.ascender;
-                        desc = face->size->metrics.descender;
-                      }
-
-                    asc = yoffset + (asc >> 6);
-                    desc = yoffset + (desc >> 6);
-
-                    if (desc < bbox(1))
-                      {
-                        bbox(3) += (bbox(1) - desc);
-                        bbox(1) = desc;
-                      }
-                    if (asc > (bbox(3)+bbox(1)))
-                      bbox(3) = asc-bbox(1);
-                    if (bbox(2) < box_line_width)
-                      bbox(2) = box_line_width;
-                  }
-                  break;
-                }
-                if (str[i] == '\n')
-                  previous = 0;
-                else
-                  previous = glyph_index;
-            }
-        }
-      if (mode == MODE_BBOX)
-        {
-          /* Push last the width associated with the last line */
-          multiline_align_xoffsets.push_back (box_line_width);
-
-          for (unsigned int i = 0; i < multiline_align_xoffsets.size (); i++)
-            {
-            /* Center align */
-            if (multiline_halign == 1)
-              multiline_align_xoffsets[i] = (bbox(2) - multiline_align_xoffsets[i])/2;
-            /* Right align */
-            else if (multiline_halign == 2)
-              multiline_align_xoffsets[i] = (bbox(2) - multiline_align_xoffsets[i]);
-            /* Left align */
-            else
-              multiline_align_xoffsets[i] = 0;
+              if (r != 0)
+                ::warning ("ft_render: failed to decode string `%s' with "
+                           "locale `%s'", str.c_str (),
+                           std::setlocale (LC_CTYPE, NULL));
+              break;
             }
         }
     }
 }
 
 void
+ft_render::visit (text_element_list& e)
+{
+  // Save and restore (after processing the list) the current font and color.
+
+  ft_font saved_font (font);
+  uint8NDArray saved_color (color);
+
+  text_processor::visit (e);
+
+  font = saved_font;
+  color = saved_color;
+}
+
+void
+ft_render::visit (text_element_subscript& e)
+{
+  ft_font saved_font (font);
+  int saved_line_yoffset = line_yoffset;
+  int saved_yoffset = yoffset;
+
+  set_font (font.get_name (), font.get_weight (), font.get_angle (),
+            font.get_size () - 2);
+
+  if (font.is_valid ())
+    {
+      int h = font.get_face ()->size->metrics.height >> 6;
+
+      // Shifting the baseline by 2/3 the font height seems to produce
+      // decent result.
+      yoffset -= (h * 2) / 3;
+
+      if (mode == MODE_BBOX)
+        update_line_bbox ();
+    }
+
+  text_processor::visit (e);
+
+  font = saved_font;
+  // If line_yoffset changed, this means we moved to a new line; hence yoffset
+  // cannot be restored, because the saved value is not relevant anymore.
+  if (line_yoffset == saved_line_yoffset)
+    yoffset = saved_yoffset;
+}
+
+void
+ft_render::visit (text_element_superscript& e)
+{
+  ft_font saved_font (font);
+  int saved_line_yoffset = line_yoffset;
+  int saved_yoffset = yoffset;
+
+  set_font (font.get_name (), font.get_weight (), font.get_angle (),
+            font.get_size () - 2);
+
+  if (saved_font.is_valid ())
+    {
+      int s_asc = saved_font.get_face ()->size->metrics.ascender >> 6;
+
+      // Shifting the baseline by 2/3 base font ascender seems to produce
+      // decent result.
+      yoffset += (s_asc * 2) / 3;
+
+      if (mode == MODE_BBOX)
+        update_line_bbox ();
+    }
+
+  text_processor::visit (e);
+
+  font = saved_font;
+  // If line_yoffset changed, this means we moved to a new line; hence yoffset
+  // cannot be restored, because the saved value is not relevant anymore.
+  if (line_yoffset == saved_line_yoffset)
+    yoffset = saved_yoffset;
+}
+
+void
+ft_render::visit (text_element_color& e)
+{
+  if (mode == MODE_RENDER)
+    set_color (e.get_color ());
+}
+
+void
+ft_render::visit (text_element_fontsize& e)
+{
+  double sz = e.get_fontsize ();
+
+  // FIXME: Matlab documentation says that the font size is expressed
+  //        in the text object FontUnit.
+
+  set_font (font.get_name (), font.get_weight (), font.get_angle (), sz);
+
+  if (mode == MODE_BBOX)
+    update_line_bbox ();
+}
+
+void
+ft_render::visit (text_element_fontname& e)
+{
+  set_font (e.get_fontname (), font.get_weight (), font.get_angle (),
+            font.get_size ());
+
+  if (mode == MODE_BBOX)
+    update_line_bbox ();
+}
+
+void
+ft_render::visit (text_element_fontstyle& e)
+{
+  switch (e.get_fontstyle ())
+    {
+    case text_element_fontstyle::normal:
+      set_font (font.get_name (), "normal", "normal", font.get_size ());
+      break;
+    case text_element_fontstyle::bold:
+      set_font (font.get_name (), "bold", "normal", font.get_size ());
+      break;
+    case text_element_fontstyle::italic:
+      set_font (font.get_name (), "normal", "italic", font.get_size ());
+      break;
+    case text_element_fontstyle::oblique:
+      set_font (font.get_name (), "normal", "oblique", font.get_size ());
+      break;
+    }
+
+  if (mode == MODE_BBOX)
+    update_line_bbox ();
+}
+
+void
+ft_render::visit (text_element_symbol& e)
+{
+  uint32_t code = e.get_symbol_code ();
+
+  if (code != text_element_symbol::invalid_code && font.is_valid ())
+    process_character (code);
+  else if (font.is_valid ())
+    ::warning ("ignoring unknown symbol: %d", e.get_symbol ());
+}
+
+void
+ft_render::visit (text_element_combined& e)
+{
+  int saved_xoffset = xoffset;
+  int max_xoffset = xoffset;
+
+  for (text_element_combined::iterator it = e.begin (); it != e.end (); ++it)
+    {
+      xoffset = saved_xoffset;
+      (*it)->accept (*this);
+      max_xoffset = xmax (xoffset, max_xoffset);
+    }
+
+  xoffset = max_xoffset;
+}
+
+void
 ft_render::reset (void)
 {
   set_mode (MODE_BBOX);
@@ -495,9 +835,9 @@
 {
   if (c.numel () == 3)
     {
-      red = static_cast<uint8_t> (c(0)*255);
-      green = static_cast<uint8_t> (c(1)*255);
-      blue = static_cast<uint8_t> (c(2)*255);
+      color(0) = static_cast<uint8_t> (c(0)*255);
+      color(1) = static_cast<uint8_t> (c(1)*255);
+      color(2) = static_cast<uint8_t> (c(2)*255);
     }
   else
     ::warning ("ft_render::set_color: invalid color");
@@ -508,6 +848,7 @@
 {
   set_mode (MODE_BBOX);
   elt->accept (*this);
+  compute_bbox ();
   box = bbox;
 
   set_mode (MODE_RENDER);
@@ -574,6 +915,7 @@
 {
   set_mode (MODE_BBOX);
   elt->accept (*this);
+  compute_bbox ();
 
   Matrix extent (1, 2, 0.0);
 
@@ -594,9 +936,10 @@
 }
 
 Matrix
-ft_render::get_extent (const std::string& txt, double rotation)
+ft_render::get_extent (const std::string& txt, double rotation,
+                       const caseless_str& interpreter)
 {
-  text_element *elt = text_parser_none ().parse (txt);
+  text_element *elt = text_parser::parse (txt, interpreter);
   Matrix extent = get_extent (elt, rotation);
   delete elt;
 
@@ -606,6 +949,12 @@
 int
 ft_render::rotation_to_mode (double rotation) const
 {
+  // Clip rotation to range [0, 360]
+  while (rotation < 0)
+    rotation += 360.0;
+  while (rotation > 360.0)
+    rotation -= 360.0;
+
   if (rotation == 0.0)
     return ROTATION_0;
   else if (rotation == 90.0)
@@ -621,14 +970,14 @@
 void
 ft_render::text_to_pixels (const std::string& txt,
                            uint8NDArray& pixels_, Matrix& box,
-                           int halign, int valign, double rotation)
+                           int _halign, int valign, double rotation,
+                           const caseless_str& interpreter)
 {
-  // FIXME: clip "rotation" between 0 and 360
   int rot_mode = rotation_to_mode (rotation);
 
-  multiline_halign = halign;
+  halign = _halign;
 
-  text_element *elt = text_parser_none ().parse (txt);
+  text_element *elt = text_parser::parse (txt, interpreter);
   pixels_ = render (elt, box, rot_mode);
   delete elt;
 
@@ -672,4 +1021,61 @@
     }
 }
 
+ft_render::ft_font::ft_font (const ft_font& ft)
+     : name (ft.name), weight (ft.weight), angle (ft.angle), size (ft.size),
+       face (0)
+{
+#if HAVE_FT_REFERENCE_FACE
+  FT_Face ft_face = ft.get_face ();
+
+  if (ft_face && FT_Reference_Face (ft_face) == 0)
+    face = ft_face;
+#endif
+}
+
+ft_render::ft_font&
+ft_render::ft_font::operator = (const ft_font& ft)
+{
+  if (&ft != this)
+    {
+      name = ft.name;
+      weight = ft.weight;
+      angle = ft.angle;
+      size = ft.size;
+      if (face)
+        {
+          FT_Done_Face (face);
+          face = 0;
+        }
+
+#if HAVE_FT_REFERENCE_FACE
+      FT_Face ft_face = ft.get_face ();
+
+      if (ft_face && FT_Reference_Face (ft_face) == 0)
+        face = ft_face;
+#endif
+    }
+
+  return *this;
+}
+
+FT_Face
+ft_render::ft_font::get_face (void) const
+{
+  if (! face && ! name.empty ())
+    {
+      face = ft_manager::get_font (name, weight, angle, size);
+
+      if (face)
+        {
+          if (FT_Set_Char_Size (face, 0, size*64, 0, 0))
+            ::warning ("ft_render: unable to set font size to %g", size);
+        }
+      else
+        ::warning ("ft_render: unable to load appropriate font");
+    }
+
+  return face;
+}
+
 #endif // HAVE_FREETYPE
--- a/libinterp/corefcn/txt-eng-ft.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/txt-eng-ft.h	Sat Oct 05 11:22:09 2013 -0400
@@ -25,6 +25,7 @@
 
 #if HAVE_FREETYPE
 
+#include <list>
 #include <vector>
 
 #include <ft2build.h>
@@ -58,6 +59,24 @@
 
   void visit (text_element_string& e);
 
+  void visit (text_element_list& e);
+
+  void visit (text_element_subscript& e);
+
+  void visit (text_element_superscript& e);
+
+  void visit (text_element_color& e);
+
+  void visit (text_element_fontsize& e);
+
+  void visit (text_element_fontname& e);
+
+  void visit (text_element_fontstyle& e);
+
+  void visit (text_element_symbol& e);
+
+  void visit (text_element_combined& e);
+
   void reset (void);
 
   uint8NDArray get_pixels (void) const { return pixels; }
@@ -68,7 +87,8 @@
                        int rotation = ROTATION_0);
 
   Matrix get_extent (text_element *elt, double rotation = 0.0);
-  Matrix get_extent (const std::string& txt, double rotation = 0.0);
+  Matrix get_extent (const std::string& txt, double rotation = 0.0,
+                     const caseless_str& interpreter = "tex");
 
   void set_font (const std::string& name, const std::string& weight,
                  const std::string& angle, double size);
@@ -79,7 +99,8 @@
 
   void text_to_pixels (const std::string& txt,
                        uint8NDArray& pixels_, Matrix& bbox,
-                       int halign, int valign, double rotation);
+                       int halign, int valign, double rotation,
+                       const caseless_str& interpreter = "tex");
 
 private:
   int rotation_to_mode (double rotation) const;
@@ -90,16 +111,96 @@
 
   ft_render& operator = (const ft_render&);
 
+  // Class to hold information about fonts and a strong
+  // reference to the font objects loaded by freetype.
+  class ft_font
+    {
+    public:
+      ft_font (void)
+        : name (), weight (), angle (), size (0), face (0) { }
+
+      ft_font (const std::string& nm, const std::string& wt,
+               const std::string& ang, double sz, FT_Face f = 0)
+        : name (nm), weight (wt), angle (ang), size (sz), face (f) { }
+
+      ft_font (const ft_font& ft);
+
+      ~ft_font (void)
+        {
+          if (face)
+            FT_Done_Face (face);
+        }
+
+      ft_font& operator = (const ft_font& ft);
+
+      bool is_valid (void) const { return get_face (); }
+
+      std::string get_name (void) const { return name; }
+
+      std::string get_weight (void) const { return weight; }
+
+      std::string get_angle (void) const { return angle; }
+
+      double get_size (void) const { return size; }
+
+      FT_Face get_face (void) const;
+
+    private:
+      std::string name;
+      std::string weight;
+      std::string angle;
+      double size;
+      mutable FT_Face face;
+    };
+
+  void push_new_line (void);
+
+  void update_line_bbox (void);
+
+  void compute_bbox (void);
+
+  int compute_line_xoffset (const Matrix& lb) const;
+
+  FT_UInt process_character (FT_ULong code, FT_UInt previous = 0);
+
 private:
-  FT_Face face;
+  // The current font used by the renderer.
+  ft_font font;
+
+  // Used to stored the bounding box corresponding to the rendered text.
+  // The bounding box has the form [x, y, w, h] where x and y represent the
+  // coordinates of the bottom left corner relative to the anchor point of
+  // the text (== start of text on the baseline). Due to font descent or
+  // multiple lines, the value y is usually negative.
   Matrix bbox;
+
+  // Used to stored the rendered text. It's a 3D matrix with size MxNx4
+  // where M and N are the width and height of the bounding box.
   uint8NDArray pixels;
+
+  // Used to store the bounding box of each line. This is used to layout
+  // multiline text properly.
+  std::list<Matrix> line_bbox;
+
+  // The current horizontal alignment. This is used to align multi-line text.
+  int halign;
+
+  // The X offset for the next glyph.
   int xoffset;
+
+  // The Y offset of the baseline for the current line.
+  int line_yoffset;
+
+  // The Y offset of the baseline for the next glyph. The offset is relative
+  // to line_yoffset. The total Y offset is computed with:
+  // line_yoffset + yoffset.
   int yoffset;
-  int multiline_halign;
-  std::vector<int> multiline_align_xoffsets;
+
+  // The current mode of the rendering process (box computing or rendering).
   int mode;
-  uint8_t red, green, blue;
+
+  // The base color of the rendered text.
+  uint8NDArray color;
 };
 
 #endif // HAVE_FREETYPE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/txt-eng.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,39 @@
+/*
+
+Copyright (C) 2013 Michael Goffioul
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "txt-eng.h"
+#include "oct-tex-symbols.cc"
+
+uint32_t
+text_element_symbol::get_symbol_code (void) const
+{
+  uint32_t code = invalid_code;
+
+  if (0 <= symbol && symbol < num_symbol_codes)
+    code = symbol_codes[symbol][0];
+
+  return code;
+}
--- a/libinterp/corefcn/txt-eng.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/txt-eng.h	Sat Oct 05 11:22:09 2013 -0400
@@ -23,13 +23,24 @@
 #if ! defined (txt_eng_h)
 #define txt_eng_h 1
 
+#include <memory>
+#include <string>
+
 #include "base-list.h"
+#include "caseless-str.h"
+#include "dMatrix.h"
 
 class text_element;
 class text_element_string;
+class text_element_symbol;
 class text_element_list;
-class text_subscript_element;
-class text_superscript_element;
+class text_element_subscript;
+class text_element_superscript;
+class text_element_combined;
+class text_element_fontname;
+class text_element_fontsize;
+class text_element_fontstyle;
+class text_element_color;
 
 class text_processor;
 
@@ -54,7 +65,7 @@
 {
 public:
   text_element_string (const std::string& s = "")
-      : text_element (), str (s) { }
+    : text_element (), str (s) { }
 
   ~text_element_string (void) { }
 
@@ -71,13 +82,40 @@
 
 class
 OCTINTERP_API
+text_element_symbol : public text_element
+{
+public:
+  enum { invalid_code = 0xFFFFFFFFU };
+
+public:
+  text_element_symbol (int sym)
+    : text_element (), symbol (sym) { }
+
+  ~text_element_symbol (void) { }
+
+  int get_symbol (void) const { return symbol; }
+
+  uint32_t get_symbol_code (void) const;
+
+  void accept (text_processor& p);
+
+private:
+  int symbol;
+};
+
+class
+OCTINTERP_API
 text_element_list :
     public text_element,
     public octave_base_list<text_element *>
 {
 public:
   text_element_list (void)
-      : text_element (), octave_base_list<text_element*> () { }
+    : text_element (), octave_base_list<text_element*> () { }
+
+  text_element_list (text_element* e)
+    : text_element (), octave_base_list<text_element*> ()
+    { push_back (e); }
 
   ~text_element_list (void)
     {
@@ -94,28 +132,181 @@
 
 class
 OCTINTERP_API
-text_subscript_element : public text_element_list
+text_element_subscript : public text_element
+{
+public:
+  text_element_subscript (text_element* e)
+    : text_element (), elem (e) { }
+
+  text_element_subscript (char c)
+    : text_element ()
+    { elem = new text_element_string (std::string (1, c)); }
+
+  ~text_element_subscript (void)
+    { delete elem; }
+
+  void accept (text_processor& p);
+
+  text_element* get_element (void) { return elem; }
+
+private:
+  text_element* elem;
+
+private:
+  text_element_subscript (void);
+};
+
+class
+OCTINTERP_API
+text_element_superscript : public text_element
 {
 public:
-  text_subscript_element (void)
-      : text_element_list () { }
+  text_element_superscript (text_element* e)
+    : text_element (), elem (e) { }
+
+  text_element_superscript (char c)
+    : text_element ()
+    { elem = new text_element_string (std::string (1, c)); }
+
+  ~text_element_superscript (void)
+    { delete elem; }
+
+  void accept (text_processor& p);
+
+  text_element* get_element (void) { return elem; }
 
-  ~text_subscript_element (void) { }
+private:
+  text_element* elem;
+
+private:
+  text_element_superscript (void);
+};
+
+class
+OCTINTERP_API
+text_element_combined : public text_element_list
+{
+public:
+  text_element_combined (text_element* e)
+    : text_element_list (e) { }
+
+  text_element_combined (text_element* e1, text_element* e2)
+    : text_element_list(e1)
+    { push_back (e2); }
 
   void accept (text_processor& p);
 };
 
 class
 OCTINTERP_API
-text_superscript_element : public text_element_list
+text_element_fontstyle : public text_element
+{
+public:
+  enum fontstyle
+    {
+      normal,
+      bold,
+      italic,
+      oblique
+    };
+
+  text_element_fontstyle (fontstyle st)
+    : text_element (), style (st) { }
+
+  ~text_element_fontstyle (void) { }
+
+  fontstyle get_fontstyle (void) const { return style; }
+
+  void accept (text_processor& p);
+
+private:
+  fontstyle style;
+
+private:
+  text_element_fontstyle (void);
+};
+
+class
+OCTINTERP_API
+text_element_fontname : public text_element
+{
+public:
+  text_element_fontname (const std::string& fname)
+    : text_element (), name (fname) { }
+
+  ~text_element_fontname (void) { }
+
+  const std::string& get_fontname (void) const { return name; }
+
+  void accept (text_processor& p);
+
+private:
+  std::string name;
+
+private:
+  text_element_fontname (void);
+};
+
+class
+OCTINTERP_API
+text_element_fontsize : public text_element
 {
 public:
-  text_superscript_element (void)
-      : text_element_list () { }
+  text_element_fontsize (double fsize)
+    : text_element (), size (fsize) { }
 
-  ~text_superscript_element (void) { }
+  ~text_element_fontsize (void) { }
+
+  double get_fontsize (void) const { return size; }
 
   void accept (text_processor& p);
+
+private:
+  double size;
+
+private:
+  text_element_fontsize (void);
+};
+
+class
+OCTINTERP_API
+text_element_color : public text_element
+{
+public:
+  text_element_color (double r, double g, double b)
+    : text_element (), rgb (1, 3, 0.0)
+    {
+      rgb(0) = r;
+      rgb(1) = g;
+      rgb(2) = b;
+    }
+
+  text_element_color (const std::string& cname)
+    : text_element (), rgb (1, 3, 0.0)
+    {
+#define ASSIGN_COLOR(r,g,b) { rgb(0) = r; rgb(1) = g; rgb(2) = b; }
+      if (cname == "red") ASSIGN_COLOR(1, 0, 0)
+      else if (cname == "green") ASSIGN_COLOR(0, 1, 0)
+      else if (cname == "yellow") ASSIGN_COLOR(1, 1, 0)
+      else if (cname == "magenta") ASSIGN_COLOR(1, 0, 1)
+      else if (cname == "blue") ASSIGN_COLOR(0, 0, 1)
+      else if (cname == "black") ASSIGN_COLOR(0, 0, 0)
+      else if (cname == "white") ASSIGN_COLOR(1, 1, 1)
+      else if (cname == "gray") ASSIGN_COLOR(.5, .5, .5)
+      else if (cname == "darkGreen") ASSIGN_COLOR(0, .5, 0)
+      else if (cname == "orange") ASSIGN_COLOR(1, .65, 0)
+      else if (cname == "lightBlue") ASSIGN_COLOR(0.68, .85, .9)
+#undef ASSIGN_COLOR
+    }
+
+  ~text_element_color (void) { }
+
+  Matrix get_color (void) { return rgb; }
+
+  void accept (text_processor& p);
+
+private:
+  Matrix rgb;
 };
 
 class
@@ -125,6 +316,8 @@
 public:
   virtual void visit (text_element_string& e) = 0;
 
+  virtual void visit (text_element_symbol&) { }
+
   virtual void visit (text_element_list& e)
     {
       for (text_element_list::iterator it = e.begin ();
@@ -134,11 +327,21 @@
         }
     }
 
-  virtual void visit (text_subscript_element& e)
-    { visit (dynamic_cast<text_element_list&> (e)); }
+  virtual void visit (text_element_subscript& e)
+    { e.get_element ()->accept (*this); }
+
+  virtual void visit (text_element_superscript& e)
+    { e.get_element ()->accept (*this); }
+
+  virtual void visit (text_element_combined&) { }
 
-  virtual void visit (text_superscript_element& e)
-    { visit (dynamic_cast<text_element_list&> (e)); }
+  virtual void visit (text_element_fontstyle&) { }
+
+  virtual void visit (text_element_fontname&) { }
+
+  virtual void visit (text_element_fontsize&) { }
+
+  virtual void visit (text_element_color&) { }
 
   virtual void reset (void) { }
 
@@ -154,9 +357,15 @@
 { p.visit (*this); }
 
 TEXT_ELEMENT_ACCEPT(text_element_string)
+TEXT_ELEMENT_ACCEPT(text_element_symbol)
 TEXT_ELEMENT_ACCEPT(text_element_list)
-TEXT_ELEMENT_ACCEPT(text_subscript_element)
-TEXT_ELEMENT_ACCEPT(text_superscript_element)
+TEXT_ELEMENT_ACCEPT(text_element_subscript)
+TEXT_ELEMENT_ACCEPT(text_element_superscript)
+TEXT_ELEMENT_ACCEPT(text_element_combined)
+TEXT_ELEMENT_ACCEPT(text_element_fontstyle)
+TEXT_ELEMENT_ACCEPT(text_element_fontname)
+TEXT_ELEMENT_ACCEPT(text_element_fontsize)
+TEXT_ELEMENT_ACCEPT(text_element_color)
 
 class
 OCTINTERP_API
@@ -168,6 +377,10 @@
   virtual ~text_parser (void) { }
 
   virtual text_element* parse (const std::string& s) = 0;
+
+public:
+  static text_element* parse (const std::string& s,
+                              const caseless_str& interpreter);
 };
 
 class
@@ -190,4 +403,50 @@
     }
 };
 
+class
+OCTINTERP_API
+text_parser_tex : public text_parser
+{
+public:
+  text_parser_tex (void)
+    : text_parser (), scanner (0), buffer_state (0), result (0)
+    { }
+
+  ~text_parser_tex (void)
+    { destroy_lexer (); }
+
+  text_element* parse (const std::string& s);
+
+  void* get_scanner (void) { return scanner; }
+
+  void set_parse_result (text_element* e) { result = e; }
+
+  text_element* get_parse_result (void) { return result; }
+
+private:
+  bool init_lexer (const std::string& s);
+
+  void destroy_lexer (void);
+
+private:
+  void* scanner;
+
+  void* buffer_state;
+
+  text_element* result;
+};
+
+inline text_element*
+text_parser::parse (const std::string& s, const caseless_str& interpreter)
+{
+  std::auto_ptr<text_parser> parser;
+
+  if (interpreter.compare ("tex"))
+    parser.reset (new text_parser_tex ());
+  else
+    parser.reset (new text_parser_none ());
+
+  return parser->parse (s);
+}
+
 #endif
--- a/libinterp/corefcn/typecast.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/typecast.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -25,7 +25,7 @@
 #include <config.h>
 #endif
 
-#include <climits>
+#include <limits>
 
 #include "mx-base.h"
 
@@ -121,10 +121,10 @@
 their bit counts.  Both logical and char are typically one byte wide;\n\
 however, this is not guaranteed by C++.  If your system is IEEE conformant,\n\
 single and double should be 4 bytes and 8 bytes wide, respectively.\n\
-\"logical\" is not allowed for @var{class}.  If the input is a row vector,\n\
-the return value is a row vector, otherwise it is a column vector.  If the\n\
-bit length of @var{x} is not divisible by that of @var{class}, an error\n\
-occurs.\n\
+@qcode{\"logical\"} is not allowed for @var{class}.  If the input is a row\n\
+vector, the return value is a row vector, otherwise it is a column vector.  \n\
+If the bit length of @var{x} is not divisible by that of @var{class}, an\n\
+error occurs.\n\
 \n\
 An example of the use of typecast on a little-endian machine is\n\
 \n\
@@ -242,9 +242,9 @@
 do_bitpack (const boolNDArray& bitp)
 {
   typedef typename ArrayType::element_type T;
-  octave_idx_type n = bitp.numel () / (sizeof (T) * CHAR_BIT);
+  octave_idx_type n = bitp.numel () / (sizeof (T) * std::numeric_limits<unsigned char>::digits);
 
-  if (n * static_cast<int> (sizeof (T)) * CHAR_BIT == bitp.numel ())
+  if (n * static_cast<int> (sizeof (T)) * std::numeric_limits<unsigned char>::digits == bitp.numel ())
     {
 
       ArrayType retval (get_vec_dims (bitp.dims (), n));
@@ -257,11 +257,11 @@
       for (octave_idx_type i = 0; i < m; i++)
         {
           char c = bits[0];
-          for (int j = 1; j < CHAR_BIT; j++)
+          for (int j = 1; j < std::numeric_limits<unsigned char>::digits; j++)
             c |= bits[j] << j;
 
           packed[i] = c;
-          bits += CHAR_BIT;
+          bits += std::numeric_limits<unsigned char>::digits;
         }
 
       return retval;
@@ -361,22 +361,22 @@
 do_bitunpack (const ArrayType& array)
 {
   typedef typename ArrayType::element_type T;
-  octave_idx_type n = array.numel () * sizeof (T) * CHAR_BIT;
+  octave_idx_type n = array.numel () * sizeof (T) * std::numeric_limits<unsigned char>::digits;
 
   boolNDArray retval (get_vec_dims (array.dims (), n));
 
   const char *packed = reinterpret_cast<const char *> (array.fortran_vec ());
   bool *bits = retval.fortran_vec ();
 
-  octave_idx_type m = n / CHAR_BIT;
+  octave_idx_type m = n / std::numeric_limits<unsigned char>::digits;
 
   for (octave_idx_type i = 0; i < m; i++)
     {
       char c = packed[i];
       bits[0] = c & 1;
-      for (int j = 1; j < CHAR_BIT; j++)
+      for (int j = 1; j < std::numeric_limits<unsigned char>::digits; j++)
         bits[j] = (c >>= 1) & 1;
-      bits += CHAR_BIT;
+      bits += std::numeric_limits<unsigned char>::digits;
     }
 
   return retval;
--- a/libinterp/corefcn/unwind-prot.cc	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 1993-2012 John W. Eaton
-Copyright (C) 2009 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "unwind-prot.h"
-
-void unwind_protect_safe::gripe_exception (void)
-{
-  // FIXME: can this throw an exception?
-  error ("internal: unhandled exception in unwind_protect handler");
-}
--- a/libinterp/corefcn/unwind-prot.h	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-
-Copyright (C) 1993-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_unwind_prot_h)
-#define octave_unwind_prot_h 1
-
-#include <stack>
-#include <memory>
-
-#include "action-container.h"
-
-class
-OCTINTERP_API
-unwind_protect : public action_container
-{
-public:
-
-  unwind_protect (void) : lifo () { }
-
-  // Destructor should not raise an exception, so all actions
-  // registered should be exception-safe (but setting error_state is
-  // allowed). If you're not sure, see unwind_protect_safe.
-
-  ~unwind_protect (void) { run (); }
-
-  virtual void add (elem *new_elem)
-  {
-    lifo.push (new_elem);
-  }
-
-  void add (void (*fcn) (void *), void *ptr = 0) GCC_ATTR_DEPRECATED
-  {
-    add (new fcn_arg_elem<void *> (fcn, ptr));
-  }
-
-  operator bool (void) const { return ! empty (); }
-
-  void run_top (void) GCC_ATTR_DEPRECATED { run_first (); }
-
-  void run_first (void)
-  {
-    if (! empty ())
-      {
-        // No leak on exception!
-        std::auto_ptr<elem> ptr (lifo.top ());
-        lifo.pop ();
-        ptr->run ();
-      }
-  }
-
-  void run_top (int num) GCC_ATTR_DEPRECATED { run (num); }
-
-  void discard_top (void) GCC_ATTR_DEPRECATED { discard_first (); }
-
-  void discard_first (void)
-  {
-    if (! empty ())
-      {
-        elem *ptr = lifo.top ();
-        lifo.pop ();
-        delete ptr;
-      }
-  }
-
-  void discard_top (int num) GCC_ATTR_DEPRECATED { discard (num); }
-
-  size_t size (void) const { return lifo.size (); }
-
-protected:
-
-  std::stack<elem *> lifo;
-
-private:
-
-  // No copying!
-
-  unwind_protect (const unwind_protect&);
-
-  unwind_protect& operator = (const unwind_protect&);
-};
-
-// Like unwind_protect, but this one will guard against the
-// possibility of seeing an exception (or interrupt) in the cleanup
-// actions. Not that we can do much about it, but at least we won't
-// crash.
-
-class
-OCTINTERP_API
-unwind_protect_safe : public unwind_protect
-{
-private:
-
-  static void gripe_exception (void);
-
-public:
-
-  unwind_protect_safe (void) : unwind_protect () { }
-
-  ~unwind_protect_safe (void)
-    {
-      while (! empty ())
-        {
-          try
-            {
-              run_first ();
-            }
-          catch (...) // Yes, the black hole. Remember we're in a dtor.
-            {
-              gripe_exception ();
-            }
-        }
-    }
-
-private:
-
-  // No copying!
-
-  unwind_protect_safe (const unwind_protect_safe&);
-
-  unwind_protect_safe& operator = (const unwind_protect_safe&);
-};
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/urlwrite.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,1180 @@
+// urlwrite and urlread, a curl front-end for octave
+/*
+
+Copyright (C) 2006-2012 Alexander Barth
+Copyright (C) 2009 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Author: Alexander Barth <abarth@marine.usf.edu>
+// Adapted-By: jwe
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+
+#include "dir-ops.h"
+#include "file-ops.h"
+#include "file-stat.h"
+#include "oct-env.h"
+#include "oct-handle.h"
+#include "glob-match.h"
+#include "singleton-cleanup.h"
+#include "url-transfer.h"
+
+#include "defun.h"
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-cell.h"
+#include "pager.h"
+#include "oct-map.h"
+#include "oct-refcount.h"
+#include "unwind-prot.h"
+
+static void
+delete_file (const std::string& file)
+{
+  octave_unlink (file);
+}
+
+typedef octave_handle curl_handle;
+
+class OCTINTERP_API ch_manager
+{
+protected:
+
+  ch_manager (void)
+    : handle_map (), handle_free_list (),
+      next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)) { }
+
+public:
+
+  static void create_instance (void);
+
+  static bool instance_ok (void)
+  {
+    bool retval = true;
+
+    if (! instance)
+      create_instance ();
+
+    if (! instance)
+      {
+        ::error ("unable to create ch_manager!");
+
+        retval = false;
+      }
+
+    return retval;
+  }
+
+  static void cleanup_instance (void) { delete instance; instance = 0; }
+
+  static curl_handle get_handle (void)
+  {
+    return instance_ok ()
+      ? instance->do_get_handle () : curl_handle ();
+  }
+
+  static void free (const curl_handle& h)
+  {
+    if (instance_ok ())
+      instance->do_free (h);
+  }
+
+  static curl_handle lookup (double val)
+  {
+    return instance_ok () ? instance->do_lookup (val) : curl_handle ();
+  }
+
+  static curl_handle lookup (const octave_value& val)
+  {
+    return val.is_real_scalar ()
+      ? lookup (val.double_value ()) : curl_handle ();
+  }
+
+  static url_transfer get_object (double val)
+  {
+    return get_object (lookup (val));
+  }
+
+  static url_transfer get_object (const octave_value& val)
+  {
+    return get_object (lookup (val));
+  }
+
+  static url_transfer get_object (const curl_handle& h)
+  {
+    return instance_ok () ? instance->do_get_object (h) : url_transfer ();
+  }
+
+  static curl_handle make_curl_handle (const std::string& host,
+                                       const std::string& user,
+                                       const std::string& passwd,
+                                       std::ostream& os)
+  {
+    return instance_ok ()
+      ? instance->do_make_curl_handle (host, user, passwd, os) : curl_handle ();
+  }
+
+  static Matrix handle_list (void)
+  {
+    return instance_ok () ? instance->do_handle_list () : Matrix ();
+  }
+
+private:
+
+  static ch_manager *instance;
+
+  typedef std::map<curl_handle, url_transfer>::iterator iterator;
+  typedef std::map<curl_handle, url_transfer>::const_iterator const_iterator;
+
+  typedef std::set<curl_handle>::iterator free_list_iterator;
+  typedef std::set<curl_handle>::const_iterator const_free_list_iterator;
+
+  // A map of handles to curl objects.
+  std::map<curl_handle, url_transfer> handle_map;
+
+  // The available curl handles.
+  std::set<curl_handle> handle_free_list;
+
+  // The next handle available if handle_free_list is empty.
+  double next_handle;
+
+  curl_handle do_get_handle (void);
+
+  void do_free (const curl_handle& h);
+
+  curl_handle do_lookup (double val)
+  {
+    iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val));
+
+    return (p != handle_map.end ()) ? p->first : curl_handle ();
+  }
+
+  url_transfer do_get_object (const curl_handle& h)
+  {
+    iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ());
+
+    return (p != handle_map.end ()) ? p->second : url_transfer ();
+  }
+
+  curl_handle do_make_curl_handle (const std::string& host,
+                                   const std::string& user,
+                                   const std::string& passwd,
+                                   std::ostream& os)
+  {
+    curl_handle h = get_handle ();
+
+    url_transfer obj (host, user, passwd, os);
+
+    if (! error_state)
+      handle_map[h] = obj;
+    else
+      h = curl_handle ();
+
+    return h;
+  }
+
+  Matrix do_handle_list (void)
+  {
+    Matrix retval (1, handle_map.size ());
+
+    octave_idx_type i = 0;
+    for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
+      {
+        curl_handle h = p->first;
+
+        retval(i++) = h.value ();
+      }
+
+    return retval;
+  }
+};
+
+void
+ch_manager::create_instance (void)
+{
+  instance = new ch_manager ();
+
+  if (instance)
+    singleton_cleanup_list::add (cleanup_instance);
+}
+
+static double
+make_handle_fraction (void)
+{
+  static double maxrand = RAND_MAX + 2.0;
+
+  return (rand () + 1.0) / maxrand;
+}
+
+curl_handle
+ch_manager::do_get_handle (void)
+{
+  curl_handle retval;
+
+  // Curl handles are negative integers plus some random fractional
+  // part.  To avoid running out of integers, we recycle the integer
+  // part but tack on a new random part each time.
+
+  free_list_iterator p = handle_free_list.begin ();
+
+  if (p != handle_free_list.end ())
+    {
+      retval = *p;
+      handle_free_list.erase (p);
+    }
+  else
+    {
+      retval = curl_handle (next_handle);
+
+      next_handle = std::ceil (next_handle) - 1.0 - make_handle_fraction ();
+    }
+
+  return retval;
+}
+
+void
+ch_manager::do_free (const curl_handle& h)
+{
+  if (h.ok ())
+    {
+      iterator p = handle_map.find (h);
+
+      if (p != handle_map.end ())
+        {
+          // Curl handles are negative integers plus some random
+          // fractional part.  To avoid running out of integers, we
+          // recycle the integer part but tack on a new random part
+          // each time.
+
+          handle_map.erase (p);
+
+          if (h.value () < 0)
+            handle_free_list.insert (std::ceil (h.value ()) - make_handle_fraction ());
+        }
+      else
+        error ("ch_manager::free: invalid object %g", h.value ());
+    }
+}
+
+ch_manager *ch_manager::instance = 0;
+
+DEFUN (urlwrite, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Loadable Function} {} urlwrite (@var{url}, @var{localfile})\n\
+@deftypefnx {Loadable Function} {@var{f} =} urlwrite (@var{url}, @var{localfile})\n\
+@deftypefnx {Loadable Function} {[@var{f}, @var{success}] =} urlwrite (@var{url}, @var{localfile})\n\
+@deftypefnx {Loadable Function} {[@var{f}, @var{success}, @var{message}] =} urlwrite (@var{url}, @var{localfile})\n\
+Download a remote file specified by its @var{url} and save it as\n\
+@var{localfile}.  For example:\n\
+\n\
+@example\n\
+@group\n\
+urlwrite (\"ftp://ftp.octave.org/pub/octave/README\",\n\
+          \"README.txt\");\n\
+@end group\n\
+@end example\n\
+\n\
+The full path of the downloaded file is returned in @var{f}.  The\n\
+variable @var{success} is 1 if the download was successful,\n\
+otherwise it is 0 in which case @var{message} contains an error\n\
+message.  If no output argument is specified and an error occurs,\n\
+then the error is signaled through Octave's error handling mechanism.\n\
+\n\
+This function uses libcurl.  Curl supports, among others, the HTTP,\n\
+FTP and FILE protocols.  Username and password may be specified in\n\
+the URL, for example:\n\
+\n\
+@example\n\
+@group\n\
+urlwrite (\"http://username:password@@example.com/file.txt\",\n\
+          \"file.txt\");\n\
+@end group\n\
+@end example\n\
+\n\
+GET and POST requests can be specified by @var{method} and @var{param}.\n\
+The parameter @var{method} is either @samp{get} or @samp{post}\n\
+and @var{param} is a cell array of parameter and value pairs.\n\
+For example:\n\
+\n\
+@example\n\
+@group\n\
+urlwrite (\"http://www.google.com/search\", \"search.html\",\n\
+          \"get\", @{\"query\", \"octave\"@});\n\
+@end group\n\
+@end example\n\
+@seealso{urlread}\n\
+@end deftypefn")
+{
+  octave_value_list retval;
+
+  int nargin = args.length ();
+
+  // verify arguments
+  if (nargin != 2 && nargin != 4)
+    {
+      print_usage ();
+      return retval;
+    }
+
+  std::string url = args(0).string_value ();
+
+  if (error_state)
+    {
+      error ("urlwrite: URL must be a character string");
+      return retval;
+    }
+
+  // name to store the file if download is succesful
+  std::string filename = args(1).string_value ();
+
+  if (error_state)
+    {
+      error ("urlwrite: LOCALFILE must be a character string");
+      return retval;
+    }
+
+  std::string method;
+  Array<std::string> param;
+
+  if (nargin == 4)
+    {
+      method = args(2).string_value ();
+
+      if (error_state)
+        {
+          error ("urlwrite: METHOD must be \"get\" or \"post\"");
+          return retval;
+        }
+
+      if (method != "get" && method != "post")
+        {
+          error ("urlwrite: METHOD must be \"get\" or \"post\"");
+          return retval;
+        }
+
+      param = args(3).cellstr_value ();
+
+      if (error_state)
+        {
+          error ("urlwrite: parameters (PARAM) for get and post requests must be given as a cell array of character strings");
+          return retval;
+        }
+
+
+      if (param.numel () % 2 == 1 )
+        {
+          error ("urlwrite: number of elements in PARAM must be even");
+          return retval;
+        }
+    }
+
+  // The file should only be deleted if it doesn't initially exist, we
+  // create it, and the download fails.  We use unwind_protect to do
+  // it so that the deletion happens no matter how we exit the function.
+
+  file_stat fs (filename);
+
+  std::ofstream ofile (filename.c_str (), std::ios::out | std::ios::binary);
+
+  if (! ofile.is_open ())
+    {
+      error ("urlwrite: unable to open file");
+      return retval;
+    }
+
+  unwind_protect_safe frame;
+
+  frame.add_fcn (delete_file, filename);
+
+  url_transfer curl = url_transfer (url, method, param, ofile);
+
+  ofile.close ();
+
+  if (curl.good ())
+    frame.discard ();
+
+  if (nargout > 0)
+    {
+      if (curl.good ())
+        {
+          retval(2) = std::string ();
+          retval(1) = true;
+          retval(0) = octave_env::make_absolute (filename);
+        }
+      else
+        {
+          retval(2) = curl.lasterror ();
+          retval(1) = false;
+          retval(0) = std::string ();
+        }
+    }
+
+  if (nargout < 2 && ! curl.good ())
+    error ("urlwrite: %s", curl.lasterror ().c_str ());
+
+  return retval;
+}
+
+DEFUN (urlread, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Loadable Function} {@var{s} =} urlread (@var{url})\n\
+@deftypefnx {Loadable Function} {[@var{s}, @var{success}] =} urlread (@var{url})\n\
+@deftypefnx {Loadable Function} {[@var{s}, @var{success}, @var{message}] =} urlread (@var{url})\n\
+@deftypefnx {Loadable Function} {[@dots{}] =} urlread (@var{url}, @var{method}, @var{param})\n\
+Download a remote file specified by its @var{url} and return its content\n\
+in string @var{s}.  For example:\n\
+\n\
+@example\n\
+s = urlread (\"ftp://ftp.octave.org/pub/octave/README\");\n\
+@end example\n\
+\n\
+The variable @var{success} is 1 if the download was successful,\n\
+otherwise it is 0 in which case @var{message} contains an error\n\
+message.  If no output argument is specified and an error occurs,\n\
+then the error is signaled through Octave's error handling mechanism.\n\
+\n\
+This function uses libcurl.  Curl supports, among others, the HTTP,\n\
+FTP and FILE protocols.  Username and password may be specified in the\n\
+URL@.  For example:\n\
+\n\
+@example\n\
+s = urlread (\"http://user:password@@example.com/file.txt\");\n\
+@end example\n\
+\n\
+GET and POST requests can be specified by @var{method} and @var{param}.\n\
+The parameter @var{method} is either @samp{get} or @samp{post}\n\
+and @var{param} is a cell array of parameter and value pairs.\n\
+For example:\n\
+\n\
+@example\n\
+@group\n\
+s = urlread (\"http://www.google.com/search\", \"get\",\n\
+            @{\"query\", \"octave\"@});\n\
+@end group\n\
+@end example\n\
+@seealso{urlwrite}\n\
+@end deftypefn")
+{
+  // Octave's return value
+  octave_value_list retval;
+
+  int nargin = args.length ();
+
+  // verify arguments
+  if (nargin != 1  && nargin != 3)
+    {
+      print_usage ();
+      return retval;
+    }
+
+  std::string url = args(0).string_value ();
+
+  if (error_state)
+    {
+      error ("urlread: URL must be a character string");
+      return retval;
+    }
+
+  std::string method;
+  Array<std::string> param;
+
+  if (nargin == 3)
+    {
+      method = args(1).string_value ();
+
+      if (error_state)
+        {
+          error ("urlread: METHOD must be \"get\" or \"post\"");
+          return retval;
+        }
+
+      if (method != "get" && method != "post")
+        {
+          error ("urlread: METHOD must be \"get\" or \"post\"");
+          return retval;
+        }
+
+      param = args(2).cellstr_value ();
+
+      if (error_state)
+        {
+          error ("urlread: parameters (PARAM) for get and post requests must be given as a cell array of character strings");
+          return retval;
+        }
+
+      if (param.numel () % 2 == 1 )
+        {
+          error ("urlread: number of elements in PARAM must be even");
+          return retval;
+        }
+    }
+
+  std::ostringstream buf;
+
+  url_transfer curl = url_transfer (url, method, param, buf);
+
+  if (curl.good ())
+    {
+      if (nargout > 0)
+        {
+          // Return empty string if no error occured.
+          retval(2) = curl.good () ? "" : curl.lasterror ();
+          retval(1) = curl.good ();
+          retval(0) = buf.str ();
+        }
+    }
+
+  if (nargout < 2 && ! curl.good ())
+    error ("urlread: %s", curl.lasterror().c_str());
+
+  return retval;
+}
+
+DEFUN (__ftp__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Loadable Function} {@var{handle} =} __ftp__ (@var{host})\n\
+@deftypefnx {Loadable Function} {@var{handle} =} __ftp__ (@var{host}, @var{username}, @var{password})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+  std::string host;
+  std::string user = "anonymous";
+  std::string passwd = "";
+
+  if (nargin < 1 || nargin > 3)
+    {
+      print_usage ();
+      return retval;
+    }
+  else
+    {
+      host = args(0).string_value ();
+
+      if (nargin > 1)
+        user = args(1).string_value ();
+
+      if (nargin > 2)
+        passwd = args(2).string_value ();
+
+      if (! error_state)
+        {
+          curl_handle ch
+            = ch_manager::make_curl_handle (host, user, passwd, octave_stdout);
+
+          if (! error_state)
+            retval = ch.value ();
+        }
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_pwd__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_pwd__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_pwd__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        retval = curl.pwd ();
+      else
+        error ("__ftp_pwd__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_cwd__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_cwd__ (@var{handle}, @var{path})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1 && nargin != 2)
+    error ("__ftp_cwd__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string path = "";
+
+          if (nargin > 1)
+            path = args(1).string_value ();
+
+          if (! error_state)
+            curl.cwd (path);
+          else
+            error ("__ftp_cwd__: expecting path as second argument");
+        }
+      else
+        error ("__ftp_cwd__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_dir__, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_dir__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_dir__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          if (nargout == 0)
+            curl.dir ();
+          else
+            {
+              string_vector sv = curl.list ();
+              octave_idx_type n = sv.length ();
+
+              if (n == 0)
+                {
+                  string_vector flds (5);
+
+                  flds(0) = "name";
+                  flds(1) = "date";
+                  flds(2) = "bytes";
+                  flds(3) = "isdir";
+                  flds(4) = "datenum";
+
+                  retval = octave_map (flds);
+                }
+              else
+                {
+                  octave_map st;
+
+                  Cell filectime (dim_vector (n, 1));
+                  Cell filesize (dim_vector (n, 1));
+                  Cell fileisdir (dim_vector (n, 1));
+                  Cell filedatenum (dim_vector (n, 1));
+
+                  st.assign ("name", Cell (sv));
+
+                  for (octave_idx_type i = 0; i < n; i++)
+                    {
+                      time_t ftime;
+                      bool fisdir;
+                      double fsize;
+
+                      curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
+
+                      fileisdir (i) = fisdir;
+                      filectime (i) = ctime (&ftime);
+                      filesize (i) = fsize;
+                      filedatenum (i) = double (ftime);
+                    }
+
+                  st.assign ("date", filectime);
+                  st.assign ("bytes", filesize);
+                  st.assign ("isdir", fileisdir);
+                  st.assign ("datenum", filedatenum);
+
+                  retval = st;
+                }
+            }
+        }
+      else
+        error ("__ftp_dir__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_ascii__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_ascii__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_ascii__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        curl.ascii ();
+      else
+        error ("__ftp_ascii__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_binary__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_binary__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_binary__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        curl.binary ();
+      else
+        error ("__ftp_binary__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_close__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_close__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_close__: incorrect number of arguments");
+  else
+    {
+      curl_handle h = ch_manager::lookup (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (h.ok ())
+        ch_manager::free (h);
+      else
+        error ("__ftp_close__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_mode__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_mode__ (@var{handle})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 1)
+    error ("__ftp_mode__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        retval = (curl.is_ascii () ? "ascii" : "binary");
+      else
+        error ("__ftp_binary__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_delete__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_delete__ (@var{handle}, @var{path})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2)
+    error ("__ftp_delete__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string file = args(1).string_value ();
+
+          if (! error_state)
+            curl.del (file);
+          else
+            error ("__ftp_delete__: expecting file name as second argument");
+        }
+      else
+        error ("__ftp_delete__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_rmdir__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_rmdir__ (@var{handle}, @var{path})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2)
+    error ("__ftp_rmdir__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string dir = args(1).string_value ();
+
+          if (! error_state)
+            curl.rmdir (dir);
+          else
+            error ("__ftp_rmdir__: expecting directory name as second argument");
+        }
+      else
+        error ("__ftp_rmdir__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_mkdir__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_mkdir__ (@var{handle}, @var{path})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2)
+    error ("__ftp_mkdir__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string dir = args(1).string_value ();
+
+          if (! error_state)
+            curl.mkdir (dir);
+          else
+            error ("__ftp_mkdir__: expecting directory name as second argument");
+        }
+      else
+        error ("__ftp_mkdir__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_rename__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_rename__ (@var{handle}, @var{path})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 3)
+    error ("__ftp_rename__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string oldname = args(1).string_value ();
+          std::string newname = args(2).string_value ();
+
+          if (! error_state)
+            curl.rename (oldname, newname);
+          else
+            error ("__ftp_rename__: expecting file names for second and third arguments");
+        }
+      else
+        error ("__ftp_rename__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_mput__, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_mput__ (@var{handle}, @var{files})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2)
+    error ("__ftp_mput__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string pat = args(1).string_value ();
+
+          if (! error_state)
+            {
+              string_vector file_list;
+
+              glob_match pattern (file_ops::tilde_expand (pat));
+              string_vector files = pattern.glob ();
+
+              for (octave_idx_type i = 0; i < files.length (); i++)
+                {
+                  std::string file = files (i);
+
+                  file_stat fs (file);
+
+                  if (! fs.exists ())
+                    {
+                      error ("__ftp__mput: file does not exist");
+                      break;
+                    }
+
+                  if (fs.is_dir ())
+                    {
+                      file_list.append (curl.mput_directory ("", file));
+
+                      if (! curl.good ())
+                        {
+                          error ("__ftp_mput__: %s", curl.lasterror().c_str());
+                          break;
+                        }
+                    }
+                  else
+                    {
+                      // FIXME Does ascii mode need to be flagged here?
+                      std::ifstream ifile (file.c_str (), std::ios::in |
+                                           std::ios::binary);
+
+                      if (! ifile.is_open ())
+                        {
+                          error ("__ftp_mput__: unable to open file");
+                          break;
+                        }
+
+                      curl.put (file, ifile);
+
+                      ifile.close ();
+
+                      if (! curl.good ())
+                        {
+                          error ("__ftp_mput__: %s", curl.lasterror().c_str());
+                          break;
+                        }
+
+                      file_list.append (file);
+                    }
+                }
+
+              if (nargout > 0)
+                retval = file_list;
+            }
+          else
+            error ("__ftp_mput__: expecting file name patter as second argument");
+        }
+      else
+        error ("__ftp_mput__: invalid ftp handle");
+    }
+
+  return retval;
+}
+
+DEFUN (__ftp_mget__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __ftp_mget__ (@var{handle}, @var{files})\n\
+Undocumented internal function\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2 && nargin != 3)
+    error ("__ftp_mget__: incorrect number of arguments");
+  else
+    {
+      url_transfer curl = ch_manager::get_object (args(0));
+
+      if (error_state)
+        return retval;
+
+      if (curl.is_valid ())
+        {
+          std::string file = args(1).string_value ();
+          std::string target;
+
+          if (nargin == 3)
+            target = args(2).string_value () + file_ops::dir_sep_str ();
+
+          if (! error_state)
+            {
+              string_vector sv = curl.list ();
+              octave_idx_type n = 0;
+              glob_match pattern (file);
+
+
+              for (octave_idx_type i = 0; i < sv.length (); i++)
+                {
+                  if (pattern.match (sv(i)))
+                    {
+                      n++;
+
+                      time_t ftime;
+                      bool fisdir;
+                      double fsize;
+
+                      curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
+
+                      if (fisdir)
+                        curl.mget_directory (sv(i), target);
+                      else
+                        {
+                          std::ofstream ofile ((target + sv(i)).c_str (),
+                                               std::ios::out |
+                                               std::ios::binary);
+
+                          if (! ofile.is_open ())
+                            {
+                              error ("__ftp_mget__: unable to open file");
+                              break;
+                            }
+
+                          unwind_protect_safe frame;
+
+                          frame.add_fcn (delete_file, target + sv(i));
+
+                          curl.get (sv(i), ofile);
+
+                          ofile.close ();
+
+                          if (curl.good ())
+                            frame.discard ();
+                        }
+
+                      if (! curl.good ())
+                        {
+                          error ("__ftp_mget__: %s", curl.lasterror().c_str());
+                          break;
+                        }
+                    }
+                }
+              if (n == 0)
+                error ("__ftp_mget__: file not found");
+            }
+          else
+            error ("__ftp_mget__: expecting file name and target as second and third arguments");
+        }
+      else
+        error ("__ftp_mget__: invalid ftp handle");
+    }
+
+  return retval;
+}
--- a/libinterp/corefcn/utils.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/utils.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -299,7 +299,7 @@
 directory of the loadpath for element of the cell array and return\n\
 the first that matches.\n\
 \n\
-If the second optional argument @code{\"all\"} is supplied, return\n\
+If the second optional argument @qcode{\"all\"} is supplied, return\n\
 a cell array containing the list of all files that have the same\n\
 name in the path.  If no files are found, return an empty cell array.\n\
 @seealso{file_in_path, path}\n\
@@ -375,7 +375,7 @@
 directory of the path for element of the cell array and return\n\
 the first that matches.\n\
 \n\
-If the third optional argument @code{\"all\"} is supplied, return\n\
+If the third optional argument @qcode{\"all\"} is supplied, return\n\
 a cell array containing the list of all files that have the same\n\
 name in the path.  If no files are found, return an empty cell array.\n\
 @seealso{file_in_loadpath}\n\
@@ -896,9 +896,10 @@
 @deftypefnx {Built-in Function} {} find_dir_in_path (@var{dir}, \"all\")\n\
 Return the full name of the path element matching @var{dir}.  The\n\
 match is performed at the end of each path element.  For example, if\n\
-@var{dir} is @code{\"foo/bar\"}, it matches the path element\n\
-@code{\"/some/dir/foo/bar\"}, but not @code{\"/some/dir/foo/bar/baz\"}\n\
-or @code{\"/some/dir/allfoo/bar\"}.\n\
+@var{dir} is @qcode{\"foo/bar\"}, it matches the path element\n\
+@nospell{@qcode{\"/some/dir/foo/bar\"}}, but not\n\
+@nospell{@qcode{\"/some/dir/foo/bar/baz\"}}\n\
+@nospell{@qcode{\"/some/dir/allfoo/bar\"}}.\n\
 \n\
 The second argument is optional.  If it is supplied, return a cell array\n\
 containing all name matches rather than just the first.\n\
--- a/libinterp/corefcn/variables.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/corefcn/variables.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -36,7 +36,7 @@
 #include "oct-env.h"
 #include "file-ops.h"
 #include "glob-match.h"
-#include "regexp.h"
+#include "lo-regexp.h"
 #include "str-vec.h"
 
 #include <defaults.h>
@@ -401,6 +401,8 @@
       struct_elts = name.substr (pos+1);
       symbol_name = name.substr (0, pos);
     }
+  else if (is_keyword (symbol_name))
+    return retval;
 
   // We shouldn't need to look in the global symbol table, since any
   // name that is visible in the current scope will be in the local
@@ -537,16 +539,16 @@
 symbols of the specified type.  Valid types are\n\
 \n\
 @table @asis\n\
-@item \"var\"\n\
+@item @qcode{\"var\"}\n\
 Check only for variables.\n\
 \n\
-@item \"builtin\"\n\
+@item @qcode{\"builtin\"}\n\
 Check only for built-in functions.\n\
 \n\
-@item \"file\"\n\
+@item @qcode{\"file\"}\n\
 Check only for files and directories.\n\
 \n\
-@item \"dir\"\n\
+@item @qcode{\"dir\"}\n\
 Check only for directories.\n\
 @end table\n\
 \n\
@@ -2530,11 +2532,11 @@
 left of the specified balance column.\n\
 \n\
 The default format is\n\
-@code{\"  %a:4; %ln:6; %cs:16:6:1;  %rb:12;  %lc:-1;\\n\"}.\n\
+@qcode{\"  %a:4; %ln:6; %cs:16:6:1;  %rb:12;  %lc:-1;\\n\"}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{whos}\n\
 @end deftypefn")
 {
@@ -2551,9 +2553,9 @@
 Query or set the internal variable that specifies the function to call when\n\
 an unknown identifier is requested.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (missing_function_hook);
@@ -2604,3 +2606,33 @@
 
   return retval;
 }
+
+static std::string Vmissing_component_hook;
+
+DEFUN (missing_component_hook, args, nargout,
+    "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} missing_component_hook ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} missing_component_hook (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} missing_component_hook (@var{new_val}, \"local\")\n\
+Query or set the internal variable that specifies the function to call when\n\
+a component of Octave is missing.  This can be useful for packagers that\n\
+may split the Octave installation into multiple sub-packages, for example,\n\
+to provide a hint to users for how to install the missing components.\n\
+\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+\n\
+The hook function is expected to be of the form\n\
+\n\
+@example\n\
+@var{fcn} (@var{component})\n\
+@end example\n\
+\n\
+Octave will call @var{fcn} with the name of the function that requires the\n\
+component and a string describing the missing component.  The hook function\n\
+should return an error message to be displayed.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (missing_component_hook);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/dldfcn/__eigs__.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,618 @@
+/*
+
+Copyright (C) 2005-2012 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov.h"
+#include "defun-dld.h"
+#include "error.h"
+#include "gripes.h"
+#include "quit.h"
+#include "variables.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+#include "oct-map.h"
+#include "pager.h"
+#include "unwind-prot.h"
+
+#include "eigs-base.cc"
+
+// Global pointer for user defined function.
+static octave_function *eigs_fcn = 0;
+
+// Have we warned about imaginary values returned from user function?
+static bool warned_imaginary = false;
+
+// Is this a recursive call?
+static int call_depth = 0;
+
+ColumnVector
+eigs_func (const ColumnVector &x, int &eigs_error)
+{
+  ColumnVector retval;
+  octave_value_list args;
+  args(0) = x;
+
+  if (eigs_fcn)
+    {
+      octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args);
+
+      if (error_state)
+        {
+          eigs_error = 1;
+          gripe_user_supplied_eval ("eigs");
+          return retval;
+        }
+
+      if (tmp.length () && tmp(0).is_defined ())
+        {
+          if (! warned_imaginary && tmp(0).is_complex_type ())
+            {
+              warning ("eigs: ignoring imaginary part returned from user-supplied function");
+              warned_imaginary = true;
+            }
+
+          retval = ColumnVector (tmp(0).vector_value ());
+
+          if (error_state)
+            {
+              eigs_error = 1;
+              gripe_user_supplied_eval ("eigs");
+            }
+        }
+      else
+        {
+          eigs_error = 1;
+          gripe_user_supplied_eval ("eigs");
+        }
+    }
+
+  return retval;
+}
+
+ComplexColumnVector
+eigs_complex_func (const ComplexColumnVector &x, int &eigs_error)
+{
+  ComplexColumnVector retval;
+  octave_value_list args;
+  args(0) = x;
+
+  if (eigs_fcn)
+    {
+      octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args);
+
+      if (error_state)
+        {
+          eigs_error = 1;
+          gripe_user_supplied_eval ("eigs");
+          return retval;
+        }
+
+      if (tmp.length () && tmp(0).is_defined ())
+        {
+          retval = ComplexColumnVector (tmp(0).complex_vector_value ());
+
+          if (error_state)
+            {
+              eigs_error = 1;
+              gripe_user_supplied_eval ("eigs");
+            }
+        }
+      else
+        {
+          eigs_error = 1;
+          gripe_user_supplied_eval ("eigs");
+        }
+    }
+
+  return retval;
+}
+
+DEFUN_DLD (__eigs__, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Loadable Function} {@var{d} =} __eigs__ (@var{A})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma}, @var{opts})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts})\n\
+@deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\
+@deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} __eigs__ (@var{A}, @dots{})\n\
+@deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} __eigs__ (@var{af}, @var{n}, @dots{})\n\
+@deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{A}, @dots{})\n\
+@deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{af}, @var{n}, @dots{})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value_list retval;
+#ifdef HAVE_ARPACK
+  int nargin = args.length ();
+  std::string fcn_name;
+  octave_idx_type n = 0;
+  octave_idx_type k = 6;
+  Complex sigma = 0.;
+  double sigmar, sigmai;
+  bool have_sigma = false;
+  std::string typ = "LM";
+  Matrix amm, bmm, bmt;
+  ComplexMatrix acm, bcm, bct;
+  SparseMatrix asmm, bsmm, bsmt;
+  SparseComplexMatrix ascm, bscm, bsct;
+  int b_arg = 0;
+  bool have_b = false;
+  bool have_a_fun = false;
+  bool a_is_complex = false;
+  bool b_is_complex = false;
+  bool symmetric = false;
+  bool sym_tested = false;
+  bool cholB = false;
+  bool a_is_sparse = false;
+  ColumnVector permB;
+  int arg_offset = 0;
+  double tol = std::numeric_limits<double>::epsilon ();
+  int maxit = 300;
+  int disp = 0;
+  octave_idx_type p = -1;
+  ColumnVector resid;
+  ComplexColumnVector cresid;
+  octave_idx_type info = 1;
+
+  warned_imaginary = false;
+
+  unwind_protect frame;
+
+  frame.protect_var (call_depth);
+  call_depth++;
+
+  if (call_depth > 1)
+    {
+      error ("eigs: invalid recursive call");
+      if (fcn_name.length ())
+        clear_function (fcn_name);
+      return retval;
+    }
+
+  if (nargin == 0)
+    print_usage ();
+  else if (args(0).is_function_handle () || args(0).is_inline_function ()
+           || args(0).is_string ())
+    {
+      if (args(0).is_string ())
+        {
+          std::string name = args(0).string_value ();
+          std::string fname = "function y = ";
+          fcn_name = unique_symbol_name ("__eigs_fcn_");
+          fname.append (fcn_name);
+          fname.append ("(x) y = ");
+          eigs_fcn = extract_function (args(0), "eigs", fcn_name, fname,
+                                       "; endfunction");
+        }
+      else
+        eigs_fcn = args(0).function_value ();
+
+      if (!eigs_fcn)
+        {
+          error ("eigs: unknown function");
+          return retval;
+        }
+
+      if (nargin < 2)
+        {
+          error ("eigs: incorrect number of arguments");
+          return retval;
+        }
+      else
+        {
+          n = args(1).nint_value ();
+          arg_offset = 1;
+          have_a_fun = true;
+        }
+    }
+  else
+    {
+      if (args(0).is_complex_type ())
+        {
+          if (args(0).is_sparse_type ())
+            {
+              ascm = (args(0).sparse_complex_matrix_value ());
+              a_is_sparse = true;
+            }
+          else
+            acm = (args(0).complex_matrix_value ());
+          a_is_complex = true;
+          symmetric = false; // ARPACK doesn't special case complex symmetric
+          sym_tested = true;
+        }
+      else
+        {
+          if (args(0).is_sparse_type ())
+            {
+              asmm = (args(0).sparse_matrix_value ());
+              a_is_sparse = true;
+            }
+          else
+            {
+              amm = (args(0).matrix_value ());
+            }
+        }
+
+    }
+
+  // Note hold off reading B till later to avoid issues of double
+  // copies of the matrix if B is full/real while A is complex.
+  if (!error_state && nargin > 1 + arg_offset &&
+      !(args(1 + arg_offset).is_real_scalar ()))
+    {
+      if (args(1+arg_offset).is_complex_type ())
+        {
+          b_arg = 1+arg_offset;
+          have_b = true;
+          b_is_complex = true;
+          arg_offset++;
+        }
+      else
+        {
+          b_arg = 1+arg_offset;
+          have_b = true;
+          arg_offset++;
+        }
+    }
+
+  if (!error_state && nargin > (1+arg_offset))
+    k = args(1+arg_offset).nint_value ();
+
+  if (!error_state && nargin > (2+arg_offset))
+    {
+      if (args(2+arg_offset).is_string ())
+        {
+          typ = args(2+arg_offset).string_value ();
+
+          // Use STL function to convert to upper case
+          transform (typ.begin (), typ.end (), typ.begin (), toupper);
+
+          sigma = 0.;
+        }
+      else
+        {
+          sigma = args(2+arg_offset).complex_value ();
+
+          if (! error_state)
+            have_sigma = true;
+          else
+            {
+              error ("eigs: SIGMA must be a scalar or a string");
+              return retval;
+            }
+        }
+    }
+
+  sigmar = std::real (sigma);
+  sigmai = std::imag (sigma);
+
+  if (!error_state && nargin > (3+arg_offset))
+    {
+      if (args(3+arg_offset).is_map ())
+        {
+          octave_scalar_map map = args(3+arg_offset).scalar_map_value ();
+
+          if (! error_state)
+            {
+              octave_value tmp;
+
+              // issym is ignored for complex matrix inputs
+              tmp = map.getfield ("issym");
+              if (tmp.is_defined () && !sym_tested)
+                {
+                  symmetric = tmp.double_value () != 0.;
+                  sym_tested = true;
+                }
+
+              // isreal is ignored if A is not a function
+              tmp = map.getfield ("isreal");
+              if (tmp.is_defined () && have_a_fun)
+                a_is_complex = ! (tmp.double_value () != 0.);
+
+              tmp = map.getfield ("tol");
+              if (tmp.is_defined ())
+                tol = tmp.double_value ();
+
+              tmp = map.getfield ("maxit");
+              if (tmp.is_defined ())
+                maxit = tmp.nint_value ();
+
+              tmp = map.getfield ("p");
+              if (tmp.is_defined ())
+                p = tmp.nint_value ();
+
+              tmp = map.getfield ("v0");
+              if (tmp.is_defined ())
+                {
+                  if (a_is_complex || b_is_complex)
+                    cresid = ComplexColumnVector (tmp.complex_vector_value ());
+                  else
+                    resid = ColumnVector (tmp.vector_value ());
+                }
+
+              tmp = map.getfield ("disp");
+              if (tmp.is_defined ())
+                disp = tmp.nint_value ();
+
+              tmp = map.getfield ("cholB");
+              if (tmp.is_defined ())
+                cholB = tmp.double_value () != 0.;
+
+              tmp = map.getfield ("permB");
+              if (tmp.is_defined ())
+                permB = ColumnVector (tmp.vector_value ()) - 1.0;
+            }
+          else
+            {
+              error ("eigs: OPTS argument must be a scalar structure");
+              return retval;
+            }
+        }
+      else
+        {
+          error ("eigs: OPTS argument must be a structure");
+          return retval;
+        }
+    }
+
+  if (nargin > (4+arg_offset))
+    {
+      error ("eigs: incorrect number of arguments");
+      return retval;
+    }
+
+  // Test undeclared (no issym) matrix inputs for symmetry
+  if (!sym_tested && !have_a_fun)
+    {
+      if (a_is_sparse)
+        symmetric = asmm.is_symmetric ();
+      else
+        symmetric = amm.is_symmetric ();
+    }
+
+  if (have_b)
+    {
+      if (a_is_complex || b_is_complex)
+        {
+          if (a_is_sparse)
+            bscm = args(b_arg).sparse_complex_matrix_value ();
+          else
+            bcm = args(b_arg).complex_matrix_value ();
+        }
+      else
+        {
+          if (a_is_sparse)
+            bsmm = args(b_arg).sparse_matrix_value ();
+          else
+            bmm = args(b_arg).matrix_value ();
+        }
+    }
+
+  // Mode 1 for SM mode seems unstable for some reason.
+  // Use Mode 3 instead, with sigma = 0.
+  if (!error_state && !have_sigma && typ == "SM")
+    have_sigma = true;
+
+  if (!error_state)
+    {
+      octave_idx_type nconv;
+      if (a_is_complex || b_is_complex)
+        {
+          ComplexMatrix eig_vec;
+          ComplexColumnVector eig_val;
+
+
+          if (have_a_fun)
+            nconv = EigsComplexNonSymmetricFunc
+              (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, eig_val,
+               cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+          else if (have_sigma)
+            {
+              if (a_is_sparse)
+                nconv = EigsComplexNonSymmetricMatrixShift
+                  (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB,
+                   cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                   maxit);
+              else
+                nconv = EigsComplexNonSymmetricMatrixShift
+                  (acm, sigma, k, p, info, eig_vec, eig_val, bcm, permB, cresid,
+                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+            }
+          else
+            {
+              if (a_is_sparse)
+                nconv = EigsComplexNonSymmetricMatrix
+                  (ascm, typ, k, p, info, eig_vec, eig_val, bscm, permB, cresid,
+                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+              else
+                nconv = EigsComplexNonSymmetricMatrix
+                  (acm, typ, k, p, info, eig_vec, eig_val, bcm, permB, cresid,
+                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+            }
+
+          if (nargout < 2)
+            retval(0) = eig_val;
+          else
+            {
+              retval(2) = double (info);
+              retval(1) = ComplexDiagMatrix (eig_val);
+              retval(0) = eig_vec;
+            }
+        }
+      else if (sigmai != 0.)
+        {
+          // Promote real problem to a complex one.
+          ComplexMatrix eig_vec;
+          ComplexColumnVector eig_val;
+
+          if (have_a_fun)
+            nconv = EigsComplexNonSymmetricFunc
+              (eigs_complex_func, n, typ,  sigma, k, p, info, eig_vec, eig_val,
+               cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+          else
+            {
+              if (a_is_sparse)
+                nconv = EigsComplexNonSymmetricMatrixShift
+                  (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec,
+                   eig_val, SparseComplexMatrix (bsmm), permB, cresid,
+                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+              else
+                nconv = EigsComplexNonSymmetricMatrixShift
+                  (ComplexMatrix (amm), sigma, k, p, info, eig_vec,
+                   eig_val, ComplexMatrix (bmm), permB, cresid,
+                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
+            }
+
+          if (nargout < 2)
+            retval(0) = eig_val;
+          else
+            {
+              retval(2) = double (info);
+              retval(1) = ComplexDiagMatrix (eig_val);
+              retval(0) = eig_vec;
+            }
+        }
+      else
+        {
+          if (symmetric)
+            {
+              Matrix eig_vec;
+              ColumnVector eig_val;
+
+              if (have_a_fun)
+                nconv = EigsRealSymmetricFunc
+                  (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val,
+                   resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                   maxit);
+              else if (have_sigma)
+                {
+                  if (a_is_sparse)
+                    nconv = EigsRealSymmetricMatrixShift
+                      (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                  else
+                    nconv = EigsRealSymmetricMatrixShift
+                      (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                }
+              else
+                {
+                  if (a_is_sparse)
+                    nconv = EigsRealSymmetricMatrix
+                      (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                  else
+                    nconv = EigsRealSymmetricMatrix
+                      (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                }
+
+              if (nargout < 2)
+                retval(0) = eig_val;
+              else
+                {
+                  retval(2) = double (info);
+                  retval(1) = DiagMatrix (eig_val);
+                  retval(0) = eig_vec;
+                }
+            }
+          else
+            {
+              ComplexMatrix eig_vec;
+              ComplexColumnVector eig_val;
+
+              if (have_a_fun)
+                nconv = EigsRealNonSymmetricFunc
+                  (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val,
+                   resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                   maxit);
+              else if (have_sigma)
+                {
+                  if (a_is_sparse)
+                    nconv = EigsRealNonSymmetricMatrixShift
+                      (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                  else
+                    nconv = EigsRealNonSymmetricMatrixShift
+                      (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                }
+              else
+                {
+                  if (a_is_sparse)
+                    nconv = EigsRealNonSymmetricMatrix
+                      (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                  else
+                    nconv = EigsRealNonSymmetricMatrix
+                      (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
+                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
+                       maxit);
+                }
+
+              if (nargout < 2)
+                retval(0) = eig_val;
+              else
+                {
+                  retval(2) = double (info);
+                  retval(1) = ComplexDiagMatrix (eig_val);
+                  retval(0) = eig_vec;
+                }
+            }
+        }
+
+      if (nconv <= 0)
+        warning ("eigs: None of the %d requested eigenvalues converged", k);
+      else if (nconv < k)
+        warning ("eigs: Only %d of the %d requested eigenvalues converged",
+                 nconv, k);
+    }
+
+  if (! fcn_name.empty ())
+    clear_function (fcn_name);
+#else
+  error ("eigs: not available in this version of Octave");
+#endif
+
+  return retval;
+}
--- a/libinterp/dldfcn/__glpk__.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/__glpk__.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,7 @@
 /*
 
 Copyright (C) 2005-2012 Nicolo' Giorgetti
+Copyright (C) 2013 Sébastien Villemot <sebastien@debian.org>
 
 This file is part of Octave.
 
@@ -46,191 +47,86 @@
 #else
 #include <glpk.h>
 #endif
-
-#if 0
-#ifdef GLPK_PRE_4_14
-
-#ifndef _GLPLIB_H
-#include <glplib.h>
-#endif
-#ifndef lib_set_fault_hook
-#define lib_set_fault_hook lib_fault_hook
-#endif
-#ifndef lib_set_print_hook
-#define lib_set_print_hook lib_print_hook
-#endif
-
-#else
-
-void _glp_lib_print_hook (int (*func)(void *info, char *buf), void *info);
-void _glp_lib_fault_hook (int (*func)(void *info, char *buf), void *info);
-
-#endif
-#endif
 }
 
-#define NIntP 17
-#define NRealP 10
-
-int lpxIntParam[NIntP] = {
-  0,
-  1,
-  0,
-  1,
-  0,
-  -1,
-  0,
-  200,
-  1,
-  2,
-  0,
-  1,
-  0,
-  0,
-  2,
-  2,
-  1
-};
-
-int IParam[NIntP] = {
-  LPX_K_MSGLEV,
-  LPX_K_SCALE,
-  LPX_K_DUAL,
-  LPX_K_PRICE,
-  LPX_K_ROUND,
-  LPX_K_ITLIM,
-  LPX_K_ITCNT,
-  LPX_K_OUTFRQ,
-  LPX_K_MPSINFO,
-  LPX_K_MPSOBJ,
-  LPX_K_MPSORIG,
-  LPX_K_MPSWIDE,
-  LPX_K_MPSFREE,
-  LPX_K_MPSSKIP,
-  LPX_K_BRANCH,
-  LPX_K_BTRACK,
-  LPX_K_PRESOL
-};
-
-
-double lpxRealParam[NRealP] = {
-  0.07,
-  1e-7,
-  1e-7,
-  1e-9,
-  -std::numeric_limits<double>::max (),
-  std::numeric_limits<double>::max (),
-  -1.0,
-  0.0,
-  1e-6,
-  1e-7
-};
-
-int RParam[NRealP] = {
-  LPX_K_RELAX,
-  LPX_K_TOLBND,
-  LPX_K_TOLDJ,
-  LPX_K_TOLPIV,
-  LPX_K_OBJLL,
-  LPX_K_OBJUL,
-  LPX_K_TMLIM,
-  LPX_K_OUTDLY,
-  LPX_K_TOLINT,
-  LPX_K_TOLOBJ
+struct control_params
+{
+  int msglev;
+  int dual;
+  int price;
+  int itlim;
+  int outfrq;
+  int branch;
+  int btrack;
+  int presol;
+  int rtest;
+  int tmlim;
+  int outdly;
+  double tolbnd;
+  double toldj;
+  double tolpiv;
+  double objll;
+  double objul;
+  double tolint;
+  double tolobj;
 };
 
 static jmp_buf mark;  //-- Address for long jump to jump to
 
-#if 0
-int
-glpk_fault_hook (void * /* info */, char *msg)
-{
-  error ("CRITICAL ERROR in GLPK: %s", msg);
-  longjmp (mark, -1);
-}
-
-int
-glpk_print_hook (void * /* info */, char *msg)
-{
-  message (0, "%s", msg);
-  return 1;
-}
-#endif
-
 int
 glpk (int sense, int n, int m, double *c, int nz, int *rn, int *cn,
       double *a, double *b, char *ctype, int *freeLB, double *lb,
       int *freeUB, double *ub, int *vartype, int isMIP, int lpsolver,
-      int save_pb, double *xmin, double *fmin, double *status,
-      double *lambda, double *redcosts, double *time, double *mem)
+      int save_pb, int scale, const control_params *par,
+      double *xmin, double *fmin, int *status,
+      double *lambda, double *redcosts, double *time)
 {
-  int errnum;
   int typx = 0;
-  int method;
+  int errnum = 0;
 
   clock_t t_start = clock ();
 
-#if 0
-#ifdef GLPK_PRE_4_14
-  lib_set_fault_hook (0, glpk_fault_hook);
-#else
-  _glp_lib_fault_hook (glpk_fault_hook, 0);
-#endif
-
-  if (lpxIntParam[0] > 1)
-#ifdef GLPK_PRE_4_14
-    lib_set_print_hook (0, glpk_print_hook);
-#else
-    _glp_lib_print_hook (glpk_print_hook, 0);
-#endif
-#endif
-
-  LPX *lp = lpx_create_prob ();
-
+  glp_prob *lp = glp_create_prob ();
 
   //-- Set the sense of optimization
   if (sense == 1)
-    lpx_set_obj_dir (lp, LPX_MIN);
+    glp_set_obj_dir (lp, GLP_MIN);
   else
-    lpx_set_obj_dir (lp, LPX_MAX);
+    glp_set_obj_dir (lp, GLP_MAX);
 
-  //-- If the problem has integer structural variables switch to MIP
-  if (isMIP)
-    lpx_set_class (lp, LPX_MIP);
-
-  lpx_add_cols (lp, n);
+  glp_add_cols (lp, n);
   for (int i = 0; i < n; i++)
     {
       //-- Define type of the structural variables
       if (! freeLB[i] && ! freeUB[i])
         {
           if (lb[i] != ub[i])
-            lpx_set_col_bnds (lp, i+1, LPX_DB, lb[i], ub[i]);
+            glp_set_col_bnds (lp, i+1, GLP_DB, lb[i], ub[i]);
           else
-            lpx_set_col_bnds (lp, i+1, LPX_FX, lb[i], ub[i]);
+            glp_set_col_bnds (lp, i+1, GLP_FX, lb[i], ub[i]);
         }
       else
         {
           if (! freeLB[i] && freeUB[i])
-            lpx_set_col_bnds (lp, i+1, LPX_LO, lb[i], ub[i]);
+            glp_set_col_bnds (lp, i+1, GLP_LO, lb[i], ub[i]);
           else
             {
               if (freeLB[i] && ! freeUB[i])
-                lpx_set_col_bnds (lp, i+1, LPX_UP, lb[i], ub[i]);
+                glp_set_col_bnds (lp, i+1, GLP_UP, lb[i], ub[i]);
               else
-                lpx_set_col_bnds (lp, i+1, LPX_FR, lb[i], ub[i]);
+                glp_set_col_bnds (lp, i+1, GLP_FR, lb[i], ub[i]);
             }
         }
 
       // -- Set the objective coefficient of the corresponding
       // -- structural variable. No constant term is assumed.
-      lpx_set_obj_coef(lp,i+1,c[i]);
+      glp_set_obj_coef(lp,i+1,c[i]);
 
       if (isMIP)
-        lpx_set_col_kind (lp, i+1, vartype[i]);
+        glp_set_col_kind (lp, i+1, vartype[i]);
     }
 
-  lpx_add_rows (lp, m);
+  glp_add_rows (lp, m);
 
   for (int i = 0; i < m; i++)
     {
@@ -245,124 +141,123 @@
       switch (ctype[i])
         {
         case 'F':
-          typx = LPX_FR;
+          typx = GLP_FR;
           break;
 
         case 'U':
-          typx = LPX_UP;
+          typx = GLP_UP;
           break;
 
         case 'L':
-          typx = LPX_LO;
+          typx = GLP_LO;
           break;
 
         case 'S':
-          typx = LPX_FX;
+          typx = GLP_FX;
           break;
 
         case 'D':
-          typx = LPX_DB;
+          typx = GLP_DB;
           break;
         }
 
-      lpx_set_row_bnds (lp, i+1, typx, b[i], b[i]);
+      glp_set_row_bnds (lp, i+1, typx, b[i], b[i]);
 
     }
 
-  lpx_load_matrix (lp, nz, rn, cn, a);
+  glp_load_matrix (lp, nz, rn, cn, a);
 
   if (save_pb)
     {
       static char tmp[] = "outpb.lp";
-      if (lpx_write_cpxlp (lp, tmp) != 0)
+      if (glp_write_lp (lp, NULL, tmp) != 0)
         {
           error ("__glpk__: unable to write problem");
           longjmp (mark, -1);
         }
     }
 
-  //-- scale the problem data (if required)
-  //-- if (scale && (!presol || method == 1)) lpx_scale_prob (lp);
-  //-- LPX_K_SCALE=IParam[1]  LPX_K_PRESOL=IParam[16]
-  if (lpxIntParam[1] && (! lpxIntParam[16] || lpsolver != 1))
-    lpx_scale_prob (lp);
+  //-- scale the problem data
+  if (!par->presol || lpsolver != 1)
+    glp_scale_prob (lp, scale);
 
   //-- build advanced initial basis (if required)
-  if (lpsolver == 1 && ! lpxIntParam[16])
-    lpx_adv_basis (lp);
-
-  for (int i = 0; i < NIntP; i++)
-    lpx_set_int_parm (lp, IParam[i], lpxIntParam[i]);
+  if (lpsolver == 1 && !par->presol)
+    glp_adv_basis (lp, 0);
 
-  for (int i = 0; i < NRealP; i++)
-    lpx_set_real_parm (lp, RParam[i], lpxRealParam[i]);
-
-  if (lpsolver == 1)
-    method = 'S';
-  else
-    method = 'T';
-
-  switch (method)
+  /* For MIP problems without a presolver, a first pass with glp_simplex
+     is required */
+  if ((!isMIP && lpsolver == 1)
+      || (isMIP && !par->presol))
     {
-    case 'S':
-      {
-        if (isMIP)
-          {
-            method = 'I';
-            errnum = lpx_simplex (lp);
-            errnum = lpx_integer (lp);
-          }
-        else
-          errnum = lpx_simplex (lp);
-      }
-     break;
-
-    case 'T':
-      errnum = lpx_interior (lp);
-      break;
-
-    default:
-      break;
-#if 0
-#ifdef GLPK_PRE_4_14
-      insist (method != method);
-#else
-      static char tmp[] = "method != method";
-      glpk_fault_hook (0, tmp);
-#endif
-#endif
+      glp_smcp smcp;
+      glp_init_smcp (&smcp);
+      smcp.msg_lev = par->msglev;
+      smcp.meth = par->dual;
+      smcp.pricing = par->price;
+      smcp.r_test = par->rtest;
+      smcp.tol_bnd = par->tolbnd;
+      smcp.tol_dj = par->toldj;
+      smcp.tol_piv = par->tolpiv;
+      smcp.obj_ll = par->objll;
+      smcp.obj_ul = par->objul;
+      smcp.it_lim = par->itlim;
+      smcp.tm_lim = par->tmlim;
+      smcp.out_frq = par->outfrq;
+      smcp.out_dly = par->outdly;
+      smcp.presolve = par->presol;
+      errnum = glp_simplex (lp, &smcp);
     }
 
-  /*  errnum assumes the following results:
-      errnum = 0 <=> No errors
-      errnum = 1 <=> Iteration limit exceeded.
-      errnum = 2 <=> Numerical problems with basis matrix.
-  */
-  if (errnum == LPX_E_OK)
+  if (isMIP)
+    {
+      glp_iocp iocp;
+      glp_init_iocp (&iocp);
+      iocp.msg_lev = par->msglev;
+      iocp.br_tech = par->branch;
+      iocp.bt_tech = par->btrack;
+      iocp.tol_int = par->tolint;
+      iocp.tol_obj = par->tolobj;
+      iocp.tm_lim = par->tmlim;
+      iocp.out_frq = par->outfrq;
+      iocp.out_dly = par->outdly;
+      iocp.presolve = par->presol;
+      errnum = glp_intopt (lp, &iocp);
+    }
+
+  if (!isMIP && lpsolver == 2)
+    {
+      glp_iptcp iptcp;
+      glp_init_iptcp (&iptcp);
+      iptcp.msg_lev = par->msglev;
+      errnum = glp_interior (lp, &iptcp);
+    }
+
+  if (errnum == 0)
     {
       if (isMIP)
         {
-          *status = lpx_mip_status (lp);
-          *fmin = lpx_mip_obj_val (lp);
+          *status = glp_mip_status (lp);
+          *fmin = glp_mip_obj_val (lp);
         }
       else
         {
           if (lpsolver == 1)
             {
-              *status = lpx_get_status (lp);
-              *fmin = lpx_get_obj_val (lp);
+              *status = glp_get_status (lp);
+              *fmin = glp_get_obj_val (lp);
             }
           else
             {
-              *status = lpx_ipt_status (lp);
-              *fmin = lpx_ipt_obj_val (lp);
+              *status = glp_ipt_status (lp);
+              *fmin = glp_ipt_obj_val (lp);
             }
         }
 
       if (isMIP)
         {
           for (int i = 0; i < n; i++)
-            xmin[i] = lpx_mip_col_val (lp, i+1);
+            xmin[i] = glp_mip_col_val (lp, i+1);
         }
       else
         {
@@ -370,52 +265,41 @@
           for (int i = 0; i < n; i++)
             {
               if (lpsolver == 1)
-                xmin[i] = lpx_get_col_prim (lp, i+1);
+                xmin[i] = glp_get_col_prim (lp, i+1);
               else
-                xmin[i] = lpx_ipt_col_prim (lp, i+1);
+                xmin[i] = glp_ipt_col_prim (lp, i+1);
             }
 
           /* Dual values */
           for (int i = 0; i < m; i++)
             {
               if (lpsolver == 1)
-                lambda[i] = lpx_get_row_dual (lp, i+1);
+                lambda[i] = glp_get_row_dual (lp, i+1);
               else
-                lambda[i] = lpx_ipt_row_dual (lp, i+1);
+                lambda[i] = glp_ipt_row_dual (lp, i+1);
             }
 
           /* Reduced costs */
-          for (int i = 0; i < lpx_get_num_cols (lp); i++)
+          for (int i = 0; i < glp_get_num_cols (lp); i++)
             {
               if (lpsolver == 1)
-                redcosts[i] = lpx_get_col_dual (lp, i+1);
+                redcosts[i] = glp_get_col_dual (lp, i+1);
               else
-                redcosts[i] = lpx_ipt_col_dual (lp, i+1);
+                redcosts[i] = glp_ipt_col_dual (lp, i+1);
             }
         }
 
       *time = (clock () - t_start) / CLOCKS_PER_SEC;
-
-#ifdef GLPK_PRE_4_14
-      *mem = (lib_env_ptr () -> mem_tpeak);
-#else
-      *mem = 0;
-#endif
-
-      lpx_delete_prob (lp);
-      return 0;
     }
 
-   lpx_delete_prob (lp);
-
-   *status = errnum;
+   glp_delete_prob (lp);
 
    return errnum;
 }
 
 #endif
 
-#define OCTAVE_GLPK_GET_REAL_PARAM(NAME, IDX) \
+#define OCTAVE_GLPK_GET_REAL_PARAM(NAME, VAL) \
   do \
     { \
       octave_value tmp = PARAM.getfield (NAME); \
@@ -424,7 +308,7 @@
         { \
           if (! tmp.is_empty ()) \
             { \
-              lpxRealParam[IDX] = tmp.scalar_value (); \
+              VAL = tmp.scalar_value (); \
  \
               if (error_state) \
                 { \
@@ -659,10 +543,10 @@
       if (VTYPE(i,0) == 'I')
         {
           isMIP = 1;
-          vartype(i) = LPX_IV;
+          vartype(i) = GLP_IV;
         }
       else
-        vartype(i) = LPX_CV;
+        vartype(i) = GLP_CV;
     }
 
   //-- 8th Input. Sense of optimization.
@@ -689,78 +573,78 @@
       return retval;
     }
 
+  control_params par;
+
   //-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   //-- Integer parameters
   //-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   //-- Level of messages output by the solver
-  OCTAVE_GLPK_GET_INT_PARAM ("msglev", lpxIntParam[0]);
-  if (lpxIntParam[0] < 0 || lpxIntParam[0] > 3)
+  par.msglev = 1;
+  OCTAVE_GLPK_GET_INT_PARAM ("msglev", par.msglev);
+  if (par.msglev < 0 || par.msglev > 3)
     {
-      error ("__glpk__: PARAM.msglev must be 0 (no output [default]) or 1 (error messages only) or 2 (normal output) or 3 (full output)");
+      error ("__glpk__: PARAM.msglev must be 0 (no output) or 1 (error and warning messages only [default]) or 2 (normal output) or 3 (full output)");
       return retval;
     }
 
   //-- scaling option
-  OCTAVE_GLPK_GET_INT_PARAM ("scale", lpxIntParam[1]);
-  if (lpxIntParam[1] < 0 || lpxIntParam[1] > 2)
+  volatile int scale = 16;
+  OCTAVE_GLPK_GET_INT_PARAM ("scale", scale);
+  if (scale < 0 || scale > 128)
     {
-      error ("__glpk__: PARAM.scale must be 0 (no scaling) or 1 (equilibration scaling [default]) or 2 (geometric mean scaling)");
+      error ("__glpk__: PARAM.scale must either be 128 (automatic selection of scaling options), or a bitwise or of: 1 (geometric mean scaling), 16 (equilibration scaling), 32 (round scale factors to power of two), 64 (skip if problem is well scaled");
       return retval;
     }
 
-  //-- Dual dimplex option
-  OCTAVE_GLPK_GET_INT_PARAM ("dual", lpxIntParam[2]);
-  if (lpxIntParam[2] < 0 || lpxIntParam[2] > 1)
+  //-- Dual simplex option
+  par.dual = 1;
+  OCTAVE_GLPK_GET_INT_PARAM ("dual", par.dual);
+  if (par.dual < 1 || par.dual > 3)
     {
-      error ("__glpk__: PARAM.dual must be 0 (do NOT use dual simplex [default]) or 1 (use dual simplex)");
+      error ("__glpk__: PARAM.dual must be 1 (use two-phase primal simplex [default]) or 2 (use two-phase dual simplex) or 3 (use two-phase dual simplex, and if it fails, switch to the primal simplex)");
       return retval;
     }
 
   //-- Pricing option
-  OCTAVE_GLPK_GET_INT_PARAM ("price", lpxIntParam[3]);
-  if (lpxIntParam[3] < 0 || lpxIntParam[3] > 1)
+  par.price = 34;
+  OCTAVE_GLPK_GET_INT_PARAM ("price", par.price);
+  if (par.price != 17 && par.price != 34)
     {
-      error ("__glpk__: PARAM.price must be 0 (textbook pricing) or 1 (steepest edge pricing [default])");
-      return retval;
-    }
-
-  //-- Solution rounding option
-  OCTAVE_GLPK_GET_INT_PARAM ("round", lpxIntParam[4]);
-  if (lpxIntParam[4] < 0 || lpxIntParam[4] > 1)
-    {
-      error ("__glpk__: PARAM.round must be 0 (report all primal and dual values [default]) or 1 (replace tiny primal and dual values by exact zero)");
+      error ("__glpk__: PARAM.price must be 17 (textbook pricing) or 34 (steepest edge pricing [default])");
       return retval;
     }
 
   //-- Simplex iterations limit
-  OCTAVE_GLPK_GET_INT_PARAM ("itlim", lpxIntParam[5]);
-
-  //-- Simplex iterations count
-  OCTAVE_GLPK_GET_INT_PARAM ("itcnt", lpxIntParam[6]);
+  par.itlim = std::numeric_limits<int>::max ();
+  OCTAVE_GLPK_GET_INT_PARAM ("itlim", par.itlim);
 
   //-- Output frequency, in iterations
-  OCTAVE_GLPK_GET_INT_PARAM ("outfrq", lpxIntParam[7]);
+  par.outfrq = 200;
+  OCTAVE_GLPK_GET_INT_PARAM ("outfrq", par.outfrq);
 
   //-- Branching heuristic option
-  OCTAVE_GLPK_GET_INT_PARAM ("branch", lpxIntParam[14]);
-  if (lpxIntParam[14] < 0 || lpxIntParam[14] > 2)
+  par.branch = 4;
+  OCTAVE_GLPK_GET_INT_PARAM ("branch", par.branch);
+  if (par.branch < 1 || par.branch > 5)
     {
-      error ("__glpk__: PARAM.branch must be (MIP only) 0 (branch on first variable) or 1 (branch on last variable) or 2 (branch using a heuristic by Driebeck and Tomlin [default]");
+      error ("__glpk__: PARAM.branch must be 1 (first fractional variable) or 2 (last fractional variable) or 3 (most fractional variable) or 4 (heuristic by Driebeck and Tomlin [default]) or 5 (hybrid pseudocost heuristic)");
       return retval;
     }
 
   //-- Backtracking heuristic option
-  OCTAVE_GLPK_GET_INT_PARAM ("btrack", lpxIntParam[15]);
-  if (lpxIntParam[15] < 0 || lpxIntParam[15] > 2)
+  par.btrack = 4;
+  OCTAVE_GLPK_GET_INT_PARAM ("btrack", par.btrack);
+  if (par.btrack < 1 || par.btrack > 4)
     {
-      error ("__glpk__: PARAM.btrack must be (MIP only) 0 (depth first search) or 1 (breadth first search) or 2 (backtrack using the best projection heuristic [default]");
+      error ("__glpk__: PARAM.btrack must be 1 (depth first search) or 2 (breadth first search) or 3 (best local bound) or 4 (best projection heuristic [default]");
       return retval;
     }
 
   //-- Presolver option
-  OCTAVE_GLPK_GET_INT_PARAM ("presol", lpxIntParam[16]);
-  if (lpxIntParam[16] < 0 || lpxIntParam[16] > 1)
+  par.presol = 1;
+  OCTAVE_GLPK_GET_INT_PARAM ("presol", par.presol);
+  if (par.presol < 0 || par.presol > 1)
     {
       error ("__glpk__: PARAM.presol must be 0 (do NOT use LP presolver) or 1 (use LP presolver [default])");
       return retval;
@@ -775,6 +659,21 @@
       return retval;
     }
 
+  //-- Ratio test option
+  par.rtest = 34;
+  OCTAVE_GLPK_GET_INT_PARAM ("rtest", par.rtest);
+  if (par.rtest != 17 && par.rtest != 34)
+    {
+      error ("__glpk__: PARAM.rtest must be 17 (standard ratio test) or 34 (Harris' two-pass ratio test [default])");
+      return retval;
+    }
+
+  par.tmlim = std::numeric_limits<int>::max ();
+  OCTAVE_GLPK_GET_INT_PARAM ("tmlim", par.tmlim);
+
+  par.outdly = 0;
+  OCTAVE_GLPK_GET_INT_PARAM ("outdly", par.outdly);
+
   //-- Save option
   volatile int save_pb = 0;
   OCTAVE_GLPK_GET_INT_PARAM ("save", save_pb);
@@ -784,51 +683,50 @@
   //-- Real parameters
   //-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-  //-- Ratio test option
-  OCTAVE_GLPK_GET_REAL_PARAM ("relax", 0);
-
   //-- Relative tolerance used to check if the current basic solution
   //-- is primal feasible
-  OCTAVE_GLPK_GET_REAL_PARAM ("tolbnd", 1);
+  par.tolbnd = 1e-7;
+  OCTAVE_GLPK_GET_REAL_PARAM ("tolbnd", par.tolbnd);
 
   //-- Absolute tolerance used to check if the current basic solution
   //-- is dual feasible
-  OCTAVE_GLPK_GET_REAL_PARAM ("toldj", 2);
+  par.toldj = 1e-7;
+  OCTAVE_GLPK_GET_REAL_PARAM ("toldj", par.toldj);
 
   //-- Relative tolerance used to choose eligible pivotal elements of
   //--  the simplex table in the ratio test
-  OCTAVE_GLPK_GET_REAL_PARAM ("tolpiv", 3);
+  par.tolpiv = 1e-10;
+  OCTAVE_GLPK_GET_REAL_PARAM ("tolpiv", par.tolpiv);
 
-  OCTAVE_GLPK_GET_REAL_PARAM ("objll", 4);
-
-  OCTAVE_GLPK_GET_REAL_PARAM ("objul", 5);
+  par.objll = -std::numeric_limits<double>::max ();
+  OCTAVE_GLPK_GET_REAL_PARAM ("objll", par.objll);
 
-  OCTAVE_GLPK_GET_REAL_PARAM ("tmlim", 6);
-
-  OCTAVE_GLPK_GET_REAL_PARAM ("outdly", 7);
+  par.objul = std::numeric_limits<double>::max ();
+  OCTAVE_GLPK_GET_REAL_PARAM ("objul", par.objul);
 
-  OCTAVE_GLPK_GET_REAL_PARAM ("tolint", 8);
+  par.tolint = 1e-5;
+  OCTAVE_GLPK_GET_REAL_PARAM ("tolint", par.tolint);
 
-  OCTAVE_GLPK_GET_REAL_PARAM ("tolobj", 9);
+  par.tolobj = 1e-7;
+  OCTAVE_GLPK_GET_REAL_PARAM ("tolobj", par.tolobj);
 
   //-- Assign pointers to the output parameters
   ColumnVector xmin (mrowsc, octave_NA);
   double fmin = octave_NA;
-  double status;
   ColumnVector lambda (mrowsA, octave_NA);
   ColumnVector redcosts (mrowsc, octave_NA);
   double time;
-  double mem;
+  int status, errnum = 0;
 
   int jmpret = setjmp (mark);
 
   if (jmpret == 0)
-    glpk (sense, mrowsc, mrowsA, c, nz, rn.fortran_vec (),
-          cn.fortran_vec (), a.fortran_vec (), b, ctype,
-          freeLB.fortran_vec (), lb, freeUB.fortran_vec (), ub,
-          vartype.fortran_vec (), isMIP, lpsolver, save_pb,
-          xmin.fortran_vec (), &fmin, &status, lambda.fortran_vec (),
-          redcosts.fortran_vec (), &time, &mem);
+    errnum = glpk (sense, mrowsc, mrowsA, c, nz, rn.fortran_vec (),
+                   cn.fortran_vec (), a.fortran_vec (), b, ctype,
+                   freeLB.fortran_vec (), lb, freeUB.fortran_vec (), ub,
+                   vartype.fortran_vec (), isMIP, lpsolver, save_pb, scale, &par,
+                   xmin.fortran_vec (), &fmin, &status, lambda.fortran_vec (),
+                   redcosts.fortran_vec (), &time);
 
   octave_scalar_map extra;
 
@@ -839,10 +737,10 @@
     }
 
   extra.assign ("time", time);
-  extra.assign ("mem", mem);
+  extra.assign ("status", status);
 
   retval(3) = extra;
-  retval(2) = status;
+  retval(2) = errnum;
   retval(1) = fmin;
   retval(0) = xmin;
 
--- a/libinterp/dldfcn/__init_fltk__.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/__init_fltk__.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -255,7 +255,7 @@
 };
 
 // Parameter controlling how fast we zoom when using the scrool wheel.
-static double wheel_zoom_speed = 0.05;
+static double Vwheel_zoom_speed = 0.05;
 // Parameter controlling the GUI mode.
 static enum { pan_zoom, rotate_zoom, none } gui_mode;
 
@@ -662,10 +662,10 @@
   friend class fltk_uimenu;
 public:
   plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp)
-    : Fl_Window (xx, yy, ww, hh, "octave"), window_label (), shift (0),
-      ndim (2), fp (xfp), canvas (0), autoscale (0), togglegrid (0),
-      panzoom (0), rotate (0), help (0), status (0),
-      ax_obj (), pos_x (0), pos_y (0)
+    : Fl_Window (xx, yy - menu_h, ww, hh + menu_h + status_h, "octave"),
+      window_label (), shift (0), ndim (2), fp (xfp), canvas (0),
+      autoscale (0), togglegrid (0), panzoom (0), rotate (0), help (0),
+      status (0), ax_obj (), pos_x (0), pos_y (0)
   {
     callback (window_close, static_cast<void*> (this));
     size_range (4*status_h, 2*status_h);
@@ -680,32 +680,38 @@
 
     begin ();
     {
+      // bbox of plot canvas = [xx, yy, ww, hh];
+      // (xx, yy) = UL coordinate relative to UL window.
 
-      canvas = new OpenGL_fltk (0, 0, ww, hh - status_h, number ());
+      canvas = new OpenGL_fltk (0, menu_h, ww, hh, number ());
 
       uimenu = new fltk_uimenu (0, 0, ww, menu_h);
       uimenu->hide ();
 
-      bottom = new Fl_Box (0, hh - status_h, ww, status_h);
+      // Toolbar is a composite of "bottom", "autoscale", "togglegrid",
+      // "panzoom", "rotate", "help", and "status".
+
+      yy = hh + menu_h;
+      bottom = new Fl_Box (0, yy, ww, status_h);
       bottom->box (FL_FLAT_BOX);
 
       ndim = calc_dimensions (gh_manager::get_object (fp.get___myhandle__ ()));
 
-      autoscale = new Fl_Button (0, hh - status_h, status_h, status_h, "A");
+      autoscale = new Fl_Button (0, yy, status_h, status_h, "A");
       autoscale->callback (button_callback, static_cast<void*> (this));
       autoscale->tooltip ("Autoscale");
 
-      togglegrid = new Fl_Button (status_h, hh - status_h, status_h,
+      togglegrid = new Fl_Button (status_h, yy, status_h,
                                   status_h, "G");
       togglegrid->callback (button_callback, static_cast<void*> (this));
       togglegrid->tooltip ("Toggle Grid");
 
-      panzoom = new Fl_Button (2 * status_h, hh - status_h, status_h,
+      panzoom = new Fl_Button (2 * status_h, yy, status_h,
                                status_h, "P");
       panzoom->callback (button_callback, static_cast<void*> (this));
       panzoom->tooltip ("Mouse Pan/Zoom");
 
-      rotate = new Fl_Button (3 * status_h, hh - status_h, status_h,
+      rotate = new Fl_Button (3 * status_h, yy, status_h,
                               status_h, "R");
       rotate->callback (button_callback, static_cast<void*> (this));
       rotate->tooltip ("Mouse Rotate");
@@ -713,12 +719,12 @@
       if (ndim == 2)
         rotate->deactivate ();
 
-      help = new Fl_Button (4 * status_h, hh - status_h, status_h,
+      help = new Fl_Button (4 * status_h, yy, status_h,
                             status_h, "?");
       help->callback (button_callback, static_cast<void*> (this));
       help->tooltip ("Help");
 
-      status = new Fl_Output (5 * status_h, hh - status_h,
+      status = new Fl_Output (5 * status_h, yy,
                               ww > 2*status_h ? ww - status_h : 0,
                               status_h, "");
 
@@ -799,10 +805,7 @@
   {
     if (!uimenu->is_visible ())
       {
-        canvas->resize (canvas->x (),
-                        canvas->y () + menu_h,
-                        canvas->w (),
-                        canvas->h () - menu_h);
+        // FIXME - Toolbar and menubar do not update
         uimenu->show ();
         mark_modified ();
       }
@@ -812,10 +815,7 @@
   {
     if (uimenu->is_visible ())
       {
-        canvas->resize (canvas->x (),
-                        canvas->y () - menu_h,
-                        canvas->w (),
-                        canvas->h () + menu_h);
+        // FIXME - Toolbar and menubar do not update
         uimenu->hide ();
         mark_modified ();
       }
@@ -1108,8 +1108,12 @@
       {
         Matrix pos (1,2,0);
         pos(0) = px;
-        pos(1) = h () - status_h - menu_h - py;
+        pos(1) = h () - (py + status_h + menu_dy ());
         fp.set_currentpoint (pos);
+        graphics_object robj = gh_manager::get_object (fp.get_parent ());
+        root_figure::properties& rp =
+          dynamic_cast<root_figure::properties&> (robj.get_properties ());
+        rp.set_currentfigure (fp.get___myhandle__ ().value ());
       }
   }
 
@@ -1130,9 +1134,18 @@
         pos(1,1) = yy;
 
         ap.set_currentpoint (pos);
+        fp.set_currentaxes (ap.get___myhandle__ ().value ());
       }
   }
 
+  int menu_dy ()
+    {
+      if (uimenu->is_visible ())
+        return menu_h;
+      else
+        return 0;
+    }
+
   int key2shift (int key)
   {
     if (key == FL_Shift_L || key == FL_Shift_R)
@@ -1181,17 +1194,35 @@
 
     Matrix pos (1,4,0);
     pos(0) = xx;
-    pos(1) = yy;
+    pos(1) = yy + menu_dy ();
     pos(2) = ww;
-    pos(3) = hh - status_h - menu_h;
+    pos(3) = hh - menu_dy () - status_h;
 
     fp.set_boundingbox (pos, true);
   }
 
   void draw (void)
   {
+    // FIXME - Toolbar and menubar do not update properly
     Matrix pos = fp.get_boundingbox (true);
-    Fl_Window::resize (pos(0), pos(1), pos(2), pos(3) + status_h + menu_h);
+    int canvas_h = pos(3);
+    int canvas_w = pos(2);
+    int canvas_y = menu_dy ();
+    int toolbar_y = menu_dy () + canvas_h;
+    pos(1) = pos(1) - menu_dy ();
+    pos(3) = pos(3) + menu_dy () + status_h;
+
+    Fl_Window::resize (pos(0), pos(1), pos(2), pos(3));
+
+    bottom->resize (0, toolbar_y, status_h, status_h);
+    autoscale->resize (0, toolbar_y, status_h, status_h);
+    togglegrid->resize (status_h, toolbar_y, status_h, status_h);
+    panzoom->resize (2 * status_h, toolbar_y, status_h, status_h);
+    rotate->resize (3 * status_h, toolbar_y, status_h, status_h);
+    help->resize (4 * status_h, toolbar_y, status_h, status_h);
+    status->resize (5 * status_h, toolbar_y, pos(2) - 4 * status_h, status_h);
+    if (canvas->valid ())
+      canvas->resize (0, canvas_y, canvas_w, canvas_h);
 
     return Fl_Window::draw ();
   }
@@ -1268,15 +1299,15 @@
             break;
 
           case FL_MOVE:
-            pixel2status (pixel2axes_or_ca (Fl::event_x (), Fl::event_y ()),
-                          Fl::event_x (), Fl::event_y ());
+            pixel2status (pixel2axes_or_ca (Fl::event_x (), Fl::event_y () - menu_dy ()),
+                          Fl::event_x (), Fl::event_y () - menu_dy ());
             break;
 
           case FL_PUSH:
             pos_x = Fl::event_x ();
-            pos_y = Fl::event_y ();
+            pos_y = Fl::event_y () - menu_dy ();
 
-            set_currentpoint (Fl::event_x (), Fl::event_y ());
+            set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
 
             gh = pixel2axes_or_ca (pos_x, pos_y);
 
@@ -1296,7 +1327,7 @@
           case FL_DRAG:
             if (fp.get_windowbuttonmotionfcn ().is_defined ())
               {
-                set_currentpoint (Fl::event_x (), Fl::event_y ());
+                set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
                 fp.execute_windowbuttonmotionfcn ();
               }
 
@@ -1306,7 +1337,7 @@
                   {
                     if (gui_mode == pan_zoom)
                       pixel2status (ax_obj, pos_x, pos_y,
-                                    Fl::event_x (), Fl::event_y ());
+                                    Fl::event_x (), Fl::event_y () - menu_dy ());
                     else
                       view2status (ax_obj);
                     axes::properties& ap =
@@ -1315,7 +1346,7 @@
                     double x0, y0, x1, y1;
                     Matrix pos = fp.get_boundingbox (true);
                     pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
-                    pixel2pos (ax_obj, Fl::event_x (), Fl::event_y (), x1, y1);
+                    pixel2pos (ax_obj, Fl::event_x (), Fl::event_y () - menu_dy (), x1, y1);
 
                     if (gui_mode == pan_zoom)
                       ap.translate_view (x0, x1, y0, y1);
@@ -1323,12 +1354,12 @@
                       {
                         double daz, del;
                         daz = (Fl::event_x () - pos_x) / pos(2) * 360;
-                        del = (Fl::event_y () - pos_y) / pos(3) * 360;
+                        del = (Fl::event_y () - menu_dy () - pos_y) / pos(3) * 360;
                         ap.rotate_view (del, daz);
                       }
 
                     pos_x = Fl::event_x ();
-                    pos_y = Fl::event_y ();
+                    pos_y = Fl::event_y () - menu_dy ();
                     mark_modified ();
                   }
                 return 1;
@@ -1336,12 +1367,12 @@
             else if (Fl::event_button () == 3)
               {
                 pixel2status (ax_obj, pos_x, pos_y,
-                              Fl::event_x (), Fl::event_y ());
+                              Fl::event_x (), Fl::event_y () - menu_dy ());
                 Matrix zoom_box (1,4,0);
                 zoom_box (0) = pos_x;
                 zoom_box (1) = pos_y;
                 zoom_box (2) =  Fl::event_x ();
-                zoom_box (3) =  Fl::event_y ();
+                zoom_box (3) =  Fl::event_y () - menu_dy ();
                 canvas->set_zoom_box (zoom_box);
                 canvas->zoom (true);
                 canvas->redraw ();
@@ -1353,7 +1384,7 @@
             {
               graphics_object ax =
                 gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (),
-                                                          Fl::event_y ()));
+                                                          Fl::event_y () - menu_dy ()));
               if (ax && ax.isa ("axes"))
                 {
                   axes::properties& ap =
@@ -1361,11 +1392,12 @@
 
                   // Determine if we're zooming in or out.
                   const double factor =
-                    (Fl::event_dy () > 0) ? 1.0 + wheel_zoom_speed : 1.0 - wheel_zoom_speed;
+                    (Fl::event_dy () > 0) ? 1 / (1.0 - Vwheel_zoom_speed)
+                                          : 1.0 - Vwheel_zoom_speed;
 
                   // Get the point we're zooming about.
                   double x1, y1;
-                  pixel2pos (ax, Fl::event_x (), Fl::event_y (), x1, y1);
+                  pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (), x1, y1);
 
                   ap.zoom_about_point (x1, y1, factor, false);
                   mark_modified ();
@@ -1376,7 +1408,7 @@
           case FL_RELEASE:
             if (fp.get_windowbuttonupfcn ().is_defined ())
               {
-                set_currentpoint (Fl::event_x (), Fl::event_y ());
+                set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
                 fp.execute_windowbuttonupfcn ();
               }
 
@@ -1408,7 +1440,7 @@
                           dynamic_cast<axes::properties&> (ax_obj.get_properties ());
                         pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
                         int pos_x1 = Fl::event_x ();
-                        int pos_y1 = Fl::event_y ();
+                        int pos_y1 = Fl::event_y () - menu_dy ();
                         pixel2pos (ax_obj, pos_x1, pos_y1, x1, y1);
                         Matrix xl (1,2,0);
                         Matrix yl (1,2,0);
@@ -1845,7 +1877,18 @@
   bool is_valid (void) const { return true; }
 
   bool initialize (const graphics_object& go)
-    { return go.isa ("figure"); }
+  {
+    if (go.isa ("figure")
+        || go.isa ("uimenu"))
+      {
+        if (go.isa ("uimenu"))
+          update (go, uimenu::properties::ID_LABEL);
+
+        return true;
+      }
+
+    return false;
+  }
 
   void finalize (const graphics_object& go)
   {
@@ -2086,35 +2129,35 @@
   return retval;
 }
 
-// FIXME -- This function should be abstracted and made potentially
+// FIXME: This function should be abstracted and made potentially
 // available to all graphics toolkits.  This suggests putting it in
 // graphics.cc as is done for drawnow() and having the master
 // mouse_wheel_zoom function call fltk_mouse_wheel_zoom.  The same
 // should be done for gui_mode and fltk_gui_mode.  For now (2011.01.30),
 // just changing function names and docstrings.
 
-DEFUN_DLD (mouse_wheel_zoom, args, ,
+DEFUN_DLD (mouse_wheel_zoom, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{speed} =} mouse_wheel_zoom ()\n\
-@deftypefnx {Built-in Function} {} mouse_wheel_zoom (@var{speed})\n\
+@deftypefn  {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n\
+@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n\
+@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\n\
 Query or set the mouse wheel zoom factor.\n\
 \n\
+The zoom factor is a number in the range (0,1) which is the percentage of the\n\
+current axis limits that will be used when zooming.  For example, if the\n\
+current x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\n\
+then a zoom operation will change the limits by 20.\n\
+\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
+\n\
 This function is currently implemented only for the FLTK graphics toolkit.\n\
 @seealso{gui_mode}\n\
 @end deftypefn")
 {
 #ifdef HAVE_FLTK
-  octave_value retval = wheel_zoom_speed;
-
-  if (args.length () == 1)
-    {
-      if (args(0).is_real_scalar ())
-        wheel_zoom_speed = args(0).double_value ();
-      else
-        error ("mouse_wheel_zoom: SPEED must be a real scalar");
-    }
-
-  return retval;
+  return SET_INTERNAL_VARIABLE_WITH_LIMITS(wheel_zoom_speed, 0.0001, 0.9999);
 #else
   error ("mouse_wheel_zoom: not available without OpenGL and FLTK libraries");
   return octave_value ();
@@ -2129,13 +2172,13 @@
 The @var{mode} argument can be one of the following strings:\n\
 \n\
 @table @asis\n\
-@item '2d'\n\
+@item @qcode{\"2d\"}\n\
 Allows panning and zooming of current axes.\n\
 \n\
-@item '3d'\n\
+@item @qcode{\"3d\"}\n\
 Allows rotating and zooming of current axes.\n\
 \n\
-@item 'none'\n\
+@item @qcode{\"none\"}\n\
 Mouse inputs have no effect.\n\
 @end table\n\
 \n\
--- a/libinterp/dldfcn/__magick_read__.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/__magick_read__.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1,5 +1,6 @@
 /*
 
+Copyright (C) 2013 Carnë Draug
 Copyright (C) 2002-2012 Andy Adler
 Copyright (C) 2008 Thomas L. Scofield
 Copyright (C) 2010 David Grundberg
@@ -26,8 +27,6 @@
 #include <config.h>
 #endif
 
-#include <cmath>
-
 #include "file-stat.h"
 #include "oct-env.h"
 #include "oct-time.h"
@@ -36,357 +35,647 @@
 #include "error.h"
 #include "ov-struct.h"
 
+#include "gripes.h"
+
 #ifdef HAVE_MAGICK
 
 #include <Magick++.h>
 #include <clocale>
 
-octave_value_list
-read_indexed_images (std::vector<Magick::Image>& imvec,
-                     const Array<int>& frameidx, bool wantalpha)
+// In theory, it should be enough to check the class:
+// Magick::ClassType
+// PseudoClass:
+// Image is composed of pixels which specify an index in a color palette.
+// DirectClass:
+// Image is composed of pixels which represent literal color values.
+//
+//  GraphicsMagick does not really distinguishes between indexed and
+//  normal images. After reading a file, it decides itself the optimal
+//  way to store the image in memory, independently of the how the
+//  image was stored in the file. That's what ClassType returns. While
+//  it seems to match the original file most of the times, this is
+//  not necessarily true all the times. See
+//    https://sourceforge.net/mailarchive/message.php?msg_id=31180507
+//  In addition to the ClassType, there is also ImageType which has a
+//  type for indexed images (PaletteType and PaletteMatteType). However,
+//  they also don't represent the original image. Not only does DirectClass
+//  can have a PaletteType, but also does a PseudoClass have non Palette
+//  types.
+//
+//        We can't do better without having format specific code which is
+//        what we are trying to avoid by using a library such as GM. We at
+//        least create workarounds for the most common problems.
+//
+// 1) A grayscale jpeg image can report being indexed even though the
+//    JPEG format has no support for indexed images. We can at least
+//    fix this one.
+// 2) A PNG file is only an indexed image if color type orig is 3 (value comes
+//    from libpng)
+static bool
+is_indexed (const Magick::Image& img)
 {
-  octave_value_list output;
-
-  int rows = imvec[0].baseRows ();
-  int columns = imvec[0].baseColumns ();
-  int nframes = frameidx.length ();
-
-  dim_vector idim = dim_vector ();
-  idim.resize (4);
-  idim(0) = rows;
-  idim(1) = columns;
-  idim(2) = 1;
-  idim(3) = nframes;
-
-  Array<int> idx (dim_vector (4, 1));
-
-  Magick::ImageType type = imvec[0].type ();
-
-  unsigned int mapsize = imvec[0].colorMapSize ();
-  unsigned int i = mapsize;
-  unsigned int depth = 0;
-  while (i >>= 1)
-    depth++;
-  i = 0;
-  depth--;
-  while (depth >>= 1)
-    i++;
-  depth = 1 << i;
+  bool retval = false;
+  const std::string format = img.magick ();
+  if (img.classType () == Magick::PseudoClass
+      && format != "JPEG"
+      && (format != "PNG"
+          || const_cast<Magick::Image&> (img).attribute ("PNG:IHDR.color-type-orig") == "3"))
+    retval = true;
 
-  switch (depth)
-    {
-    case 1:
-    case 2:
-    case 4:
-    case 8:
-      {
-        uint8NDArray im = uint8NDArray (idim);
-
-        idx(2) = 0;
-        for (int frame = 0; frame < nframes; frame++)
-          {
-            imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
-
-            const Magick::IndexPacket *pix
-              = imvec[frameidx(frame)].getConstIndexes ();
-
-            i = 0;
-            idx(3) = frame;
-
-            for (int y = 0; y < rows; y++)
-              {
-                idx(0) = y;
-                for (int x = 0; x < columns; x++)
-                  {
-                    idx(1) = x;
-                    im(idx) = static_cast<octave_uint8> (pix[i++]);
-                  }
-              }
-          }
-
-        output(0) = octave_value (im);
-      }
-      break;
-
-    case 16:
-      {
-        uint16NDArray im = uint16NDArray (idim);
+  return retval;
+}
 
-        idx(2) = 0;
-        for (int frame = 0; frame < nframes; frame++)
-          {
-            imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
-
-            const Magick::IndexPacket *pix
-              = imvec[frameidx(frame)].getConstIndexes ();
-
-            i = 0;
-            idx(3) = frame;
+//  The depth from depth() is not always correct for us but seems to be the
+//  best value we can get. For example, a grayscale png image with 1 bit
+//  per channel should return a depth of 1 but instead we get 8.
+//  We could check channelDepth() but then, which channel has the data
+//  is not straightforward. So we'd have to check all
+//  the channels and select the highest value. But then, I also
+//  have a 16bit TIFF whose depth returns 16 (correct), but all of the
+//  channels gives 8 (wrong). No idea why, maybe a bug in GM?
+//  Anyway, using depth() seems that only causes problems for binary
+//  images, and the problem with channelDepth() is not making set them
+//  all to 1. So we will guess that if all channels have depth of 1,
+//  then we must have a binary image.
+//  Note that we can't use AllChannels it doesn't work for this.
+//  Instead of checking all of the individual channels, we check one
+//  from RGB, CMYK, grayscale, and transparency.
+static octave_idx_type
+get_depth (Magick::Image& img)
+{
+  octave_idx_type depth = img.depth ();
+  if (depth == 8
+      && img.channelDepth (Magick::RedChannel)     == 1
+      && img.channelDepth (Magick::CyanChannel)    == 1
+      && img.channelDepth (Magick::OpacityChannel) == 1
+      && img.channelDepth (Magick::GrayChannel)    == 1)
+    depth = 1;
 
-            for (int y = 0; y < rows; y++)
-              {
-                idx(0) = y;
-                for (int x = 0; x < columns; x++)
-                  {
-                    idx(1) = x;
-                    im(idx) = static_cast<octave_uint16> (pix[i++]);
-                  }
-              }
-          }
+  return depth;
+}
 
-        output(0) = octave_value (im);
-      }
-      break;
-
-    default:
-      error ("__magic_read__: index depths greater than 16-bit are not supported");
-      return octave_value_list ();
-    }
-
-  Matrix map = Matrix (mapsize, 3);
-  Matrix alpha;
-
-  switch (type)
+// We need this in case one of the sides of the image being read has
+// width 1. In those cases, the type will come as scalar instead of range
+// since that's the behaviour of the colon operator (1:1:1 will be a scalar,
+// not a range).
+static Range
+get_region_range (const octave_value& region)
+{
+  Range output;
+  if (region.is_range ())
+    output = region.range_value ();
+  else if (region.is_scalar_type ())
     {
-    case Magick::PaletteMatteType:
-#if 0
-      warning ("palettematte");
-      Matrix map (mapsize, 3);
-      Matrix alpha (mapsize, 1);
-      for (i = 0; i < mapsize; i++)
-        {
-          warning ("%d", i);
-          Magick::ColorRGB c = imvec[0].colorMap (i);
-          map(i,0) = c.red ();
-          map(i,1) = c.green ();
-          map(i,2) = c.blue ();
-          alpha(i,1) = c.alpha ();
-        }
-      break;
-#endif
-
-    case Magick::PaletteType:
-      alpha = Matrix (0, 0);
-      for (i = 0; i < mapsize; i++)
-        {
-          Magick::ColorRGB c = imvec[0].colorMap (i);
-          map(i,0) = c.red ();
-          map(i,1) = c.green ();
-          map(i,2) = c.blue ();
-        }
-      break;
-
-    default:
-      error ("__magick_read__: unsupported indexed image type");
-      return octave_value_list ();
+      double value = region.scalar_value ();
+      output = Range (value, value);
     }
-
-  if (wantalpha)
-    output(2) = alpha;
-
-  output(1) = map;
+  else
+    error ("__magick_read__: unknow datatype for Region option");
 
   return output;
 }
 
+static std::map<std::string, octave_idx_type>
+calculate_region (const octave_scalar_map& options)
+{
+  std::map<std::string, octave_idx_type> region;
+  const Cell pixel_region = options.getfield ("region").cell_value ();
+
+  // Subtract 1 to account for 0 indexing.
+  const Range rows     = get_region_range (pixel_region (0));
+  const Range cols     = get_region_range (pixel_region (1));
+  region["row_start"]  = rows.base () -1;
+  region["col_start"]  = cols.base () -1;
+  region["row_end"]    = rows.max ()  -1;
+  region["col_end"]    = cols.max ()  -1;
+
+  // Length of the area to load into the Image Pixel Cache.  We use max and
+  // min to account for cases where last element of range is the range limit.
+  region["row_cache"] = region["row_end"] - region["row_start"] +1;
+  region["col_cache"] = region["col_end"] - region["col_start"] +1;
+
+  // How much we have to shift in the memory when doing the loops.
+  region["row_shift"] = region["col_cache"] * rows.inc ();
+  region["col_shift"] = region["col_cache"] *
+                        (region["row_cache"] + rows.inc () -1) - cols.inc ();
+
+  // The actual height and width of the output image
+  region["row_out"] = rows.nelem ();
+  region["col_out"] = cols.nelem ();
+
+  return region;
+}
+
+static octave_value_list
+read_maps (Magick::Image& img)
+{
+  // can't call colorMapSize on const Magick::Image
+  const octave_idx_type mapsize = img.colorMapSize ();
+  Matrix cmap                   = Matrix (mapsize, 3); // colormap
+  ColumnVector amap             = ColumnVector (mapsize); // alpha map
+  for (octave_idx_type i = 0; i < mapsize; i++)
+    {
+      const Magick::ColorRGB c = img.colorMap (i);
+      cmap(i,0) = c.red   ();
+      cmap(i,1) = c.green ();
+      cmap(i,2) = c.blue  ();
+      amap(i)   = c.alpha ();
+    }
+  octave_value_list maps;
+  maps(0) = cmap;
+  maps(1) = amap;
+  return maps;
+}
+
+template <class T>
+static octave_value_list
+read_indexed_images (const std::vector<Magick::Image>& imvec,
+                     const Array<octave_idx_type>& frameidx,
+                     const octave_idx_type& nargout,
+                     const octave_scalar_map& options)
+{
+  typedef typename T::element_type P;
+
+  octave_value_list retval (3, Matrix ());
+
+  std::map<std::string, octave_idx_type> region = calculate_region (options);
+  const octave_idx_type nFrames = frameidx.length ();
+  const octave_idx_type nRows = region["row_out"];
+  const octave_idx_type nCols = region["col_out"];
+
+  // imvec has all of the pages of a file, even the ones we are not
+  // interested in. We will use the first image that we will be actually
+  // reading to get information about the image.
+  const octave_idx_type def_elem = frameidx(0);
+
+  T img       = T (dim_vector (nRows, nCols, 1, nFrames));
+  P* img_fvec = img.fortran_vec ();
+
+  const octave_idx_type row_start  = region["row_start"];
+  const octave_idx_type col_start  = region["col_start"];
+  const octave_idx_type row_shift  = region["row_shift"];
+  const octave_idx_type col_shift  = region["col_shift"];
+  const octave_idx_type row_cache  = region["row_cache"];
+  const octave_idx_type col_cache  = region["col_cache"];
+
+  // When reading PixelPackets from the Image Pixel Cache, they come in
+  // row major order. So we keep moving back and forth there so we can
+  // write the image in column major order.
+  octave_idx_type idx = 0;
+  for (octave_idx_type frame = 0; frame < nFrames; frame++)
+    {
+      imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                             col_cache, row_cache);
+
+      const Magick::IndexPacket *pix
+        = imvec[frameidx(frame)].getConstIndexes ();
+
+      for (octave_idx_type col = 0; col < nCols; col++)
+        {
+          for (octave_idx_type row = 0; row < nRows; row++)
+            {
+              img_fvec[idx++] = static_cast<P> (*pix);
+              pix += row_shift;
+            }
+          pix -= col_shift;
+        }
+    }
+  retval(0) = octave_value (img);
+
+//   Only bother reading the colormap if it was requested as output.
+  if (nargout > 1)
+    {
+      // In theory, it should be possible for each frame of an image to
+      // have different colormaps but for Matlab compatibility, we only
+      // return the colormap of the first frame.  To obtain the colormaps
+      // of different frames, one needs can either use imfinfo or a for
+      // loop around imread.
+      const octave_value_list maps =
+        read_maps (const_cast<Magick::Image&> (imvec[frameidx(def_elem)]));
+
+      retval(1) = maps(0);
+
+      // only interpret alpha channel if it exists and was requested as output
+      if (imvec[def_elem].matte () && nargout >= 3)
+        {
+          const Matrix amap = maps(1).matrix_value ();
+          const double* amap_fvec = amap.fortran_vec ();
+
+          NDArray alpha (dim_vector (nRows, nCols, 1, nFrames));
+          double* alpha_fvec = alpha.fortran_vec ();
+
+          // GraphicsMagick stores the alpha values inverted, i.e.,
+          // 1 for transparent and 0 for opaque so we fix that here.
+          const octave_idx_type nPixels = alpha.numel ();
+          for (octave_idx_type pix = 0; pix < nPixels; pix++)
+            alpha_fvec[pix] = 1 - amap_fvec[static_cast<int> (img_fvec[3])];
+
+          retval(2) = alpha;
+        }
+    }
+
+  return retval;
+}
+
+// This function is highly repetitive, a bunch of for loops that are
+// very similar to account for different image types. They are different
+// enough that trying to reduce the copy and paste would decrease its
+// readability too much.
 template <class T>
 octave_value_list
-read_images (const std::vector<Magick::Image>& imvec,
-             const Array<int>& frameidx, unsigned int depth)
+read_images (std::vector<Magick::Image>& imvec,
+             const Array<octave_idx_type>& frameidx,
+             const octave_idx_type& nargout,
+             const octave_scalar_map& options)
 {
   typedef typename T::element_type P;
 
   octave_value_list retval (3, Matrix ());
 
-  T im;
+  std::map<std::string, octave_idx_type> region = calculate_region (options);
+  const octave_idx_type nFrames = frameidx.length ();
+  const octave_idx_type nRows = region["row_out"];
+  const octave_idx_type nCols = region["col_out"];
+  T img;
+
+  // imvec has all of the pages of a file, even the ones we are not
+  // interested in. We will use the first image that we will be actually
+  // reading to get information about the image.
+  const octave_idx_type def_elem = frameidx(0);
+
+  const octave_idx_type row_start  = region["row_start"];
+  const octave_idx_type col_start  = region["col_start"];
+  const octave_idx_type row_shift  = region["row_shift"];
+  const octave_idx_type col_shift  = region["col_shift"];
+  const octave_idx_type row_cache  = region["row_cache"];
+  const octave_idx_type col_cache  = region["col_cache"];
 
-  int rows = imvec[0].baseRows ();
-  int columns = imvec[0].baseColumns ();
-  int nframes = frameidx.length ();
+  // GraphicsMagick (GM) keeps the image values in memory using whatever
+  // QuantumDepth it was built with independently of the original image
+  // bitdepth. Basically this means that if GM was built with quantum 16
+  // all values are scaled in the uint16 range. If the original image
+  // had an 8 bit depth, we need to rescale it for that range.
+  // However, if the image had a bitdepth of 32, then we will be returning
+  // a floating point image. In this case, the values need to be rescaled
+  // for the range [0 1] (this is what Matlab has documented on the page
+  // about image types but in some cases seems to be doing something else.
+  // See bug #39249).
+  // Finally, we must do the division ourselves (set a divisor) instead of
+  // using quantumOperator for the cases where we will be returning floating
+  // point and want things in the range [0 1]. This is the same reason why
+  // the divisor is of type double.
+  // uint64_t is used in expression because default 32-bit value overflows
+  // when depth() is 32.
+  // TODO in the next release of GraphicsMagick, MaxRGB should be replaced
+  //      with QuantumRange since MaxRGB is already deprecated in ImageMagick.
+  double divisor;
+  if (imvec[def_elem].depth () == 32)
+    divisor = std::numeric_limits<uint32_t>::max ();
+  else
+    divisor = MaxRGB / ((uint64_t (1) << imvec[def_elem].depth ()) - 1);
+
+  // FIXME: this workaround should probably be fixed in GM by creating a
+  //        new ImageType BilevelMatteType
+  // Despite what GM documentation claims, opacity is not only on the types
+  // with Matte on the name. It is possible that an image is completely
+  // black (1 color), and have a second channel set for transparency (2nd
+  // color). Its type will be bilevel since there is no BilevelMatte. The
+  // only way to check for this seems to be by checking matte ().
+  Magick::ImageType type = imvec[def_elem].type ();
+  if (type == Magick::BilevelType && imvec[def_elem].matte ())
+    type = Magick::GrayscaleMatteType;
 
-  dim_vector idim = dim_vector ();
-  idim.resize (4);
-  idim(0) = rows;
-  idim(1) = columns;
-  idim(2) = 1;
-  idim(3) = nframes;
+  // FIXME: ImageType is the type being used to represent the image in memory
+  // by GM. The real type may be different (see among others bug #36820). For
+  // example, a png file where all channels are equal may report being
+  // grayscale or even bilevel. But we must always return the real image in
+  // file. In some cases, the original image attributes are stored in the
+  // attributes but this is undocumented. This should be fixed in GM so that
+  // a method such as original_type returns an actual Magick::ImageType
+  if (imvec[0].magick () == "PNG")
+    {
+      // These values come from libpng, not GM:
+      //      Grayscale         = 0
+      //      Palette           = 2 + 1
+      //      RGB               = 2
+      //      RGB + Alpha       = 2 + 4
+      //      Grayscale + Alpha = 4
+      // We won't bother with case 3 (palette) since those should be
+      // read by the function to read indexed images
+      const std::string type_str = imvec[0].attribute ("PNG:IHDR.color-type-orig");
+      if (type_str == "0")
+        type = Magick::GrayscaleType;
+      else if (type_str == "2")
+        type = Magick::TrueColorType;
+      else if (type_str == "6")
+        type = Magick::TrueColorMatteType;
+      else if (type_str == "4")
+        type = Magick::GrayscaleMatteType;
+      // Color types 0, 2, and 3 can also have alpha channel, conveyed
+      // via the "tRNS" chunk.  For 0 and 2, it's limited to GIF-style
+      // binary transparency, while 3 can have any level of alpha per
+      // palette entry. We thus must check matte() to see if the image
+      // really doesn't have an alpha channel.
+      if (imvec[0].matte ())
+        {
+          if (type == Magick::GrayscaleType)
+            type = Magick::GrayscaleMatteType;
+          else if (type == Magick::TrueColorType)
+            type = Magick::TrueColorMatteType;
+        }
+    }
 
-  Magick::ImageType type = imvec[0].type ();
-  const int divisor = ((uint64_t (1) << QuantumDepth) - 1) / 
-                      ((uint64_t (1) << depth) - 1);
+  // If the alpha channel was not requested, treat images as if
+  // it doesn't exist.
+  if (nargout < 3)
+    {
+      switch (type)
+        {
+        case Magick::GrayscaleMatteType:
+          type = Magick::GrayscaleType;
+          break;
+
+        case Magick::PaletteMatteType:
+          type = Magick::PaletteType;
+          break;
+
+        case Magick::TrueColorMatteType:
+          type = Magick::TrueColorType;
+          break;
+
+        case Magick::ColorSeparationMatteType:
+          type = Magick::ColorSeparationType;
+          break;
+
+        default:
+          // Do nothing other than silencing warnings about enumeration
+          // values not being handled in switch.
+          ;
+        }
+    }
 
   switch (type)
     {
-    case Magick::BilevelType:
-    case Magick::GrayscaleType:
+    case Magick::BilevelType:           // Monochrome bi-level image
+    case Magick::GrayscaleType:         // Grayscale image
       {
-        im = T (idim);
-        P *vec = im.fortran_vec ();
+        img = T (dim_vector (nRows, nCols, 1, nFrames));
+        P *img_fvec = img.fortran_vec ();
+
+        octave_idx_type idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            const Magick::PixelPacket *pix
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
 
-        for (int frame = 0; frame < nframes; frame++)
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    img_fvec[idx++] = pix->red / divisor;
+                    pix += row_shift;
+                  }
+                pix -= col_shift;
+              }
+          }
+        break;
+      }
+
+    case Magick::GrayscaleMatteType:    // Grayscale image with opacity
+      {
+        img   = T (dim_vector (nRows, nCols, 1, nFrames));
+        T alpha   (dim_vector (nRows, nCols, 1, nFrames));
+        P *img_fvec = img.fortran_vec ();
+        P *a_fvec   = alpha.fortran_vec ();
+
+        octave_idx_type idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
           {
             const Magick::PixelPacket *pix
-              = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
-
-            P *rbuf = vec;
-            for (int y = 0; y < rows; y++)
-              {
-                for (int x = 0; x < columns; x++)
-                  {
-                    *rbuf = pix->red / divisor;
-                    pix++;
-                    rbuf += rows;
-                  }
-                rbuf -= rows * columns - 1;
-              }
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
 
-            // Next frame.
-            vec += rows * columns * idim(2);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    img_fvec[idx] = pix->red / divisor;
+                    a_fvec[idx]   = (MaxRGB - pix->opacity) / divisor;
+                    pix += row_shift;
+                    idx++;
+                  }
+                pix -= col_shift;
+              }
           }
-        }
-      break;
+        retval(2) = alpha;
+        break;
+      }
 
-    case Magick::GrayscaleMatteType:
+    case Magick::PaletteType:           // Indexed color (palette) image
+    case Magick::TrueColorType:         // Truecolor image
       {
-        idim(2) = 2;
-        im = T (idim);
-        P *vec = im.fortran_vec ();
+        img = T (dim_vector (nRows, nCols, 3, nFrames));
+        P *img_fvec = img.fortran_vec ();
 
-        for (int frame = 0; frame < nframes; frame++)
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
           {
             const Magick::PixelPacket *pix
-              = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
 
-            P *rbuf = vec;
-            P *obuf = vec + rows * columns;
-            for (int y = 0; y < rows; y++)
+            octave_idx_type idx = 0;
+            img_fvec += nRows * nCols * frame;
+            P *rbuf   = img_fvec;
+            P *gbuf   = img_fvec + nRows * nCols;
+            P *bbuf   = img_fvec + nRows * nCols * 2;
+
+            for (octave_idx_type col = 0; col < nCols; col++)
               {
-                for (int x = 0; x < columns; x++)
+                for (octave_idx_type row = 0; row < nRows; row++)
                   {
-                    *rbuf = pix->red / divisor;
-                    *obuf = pix->opacity / divisor;
-                    pix++;
-                    rbuf += rows;
-                    obuf += rows;
+                    rbuf[idx] = pix->red   / divisor;
+                    gbuf[idx] = pix->green / divisor;
+                    bbuf[idx] = pix->blue  / divisor;
+                    pix += row_shift;
+                    idx++;
                   }
-                rbuf -= rows * columns - 1;
-                obuf -= rows * columns - 1;
+                pix -= col_shift;
               }
-
-            // Next frame.
-            vec += rows * columns * idim(2);
           }
-        }
-      break;
+        break;
+      }
 
-    case Magick::PaletteType:
-    case Magick::TrueColorType:
+    case Magick::PaletteMatteType:      // Indexed color (palette) image with opacity
+    case Magick::TrueColorMatteType:    // Truecolor image with opacity
       {
-        idim(2) = 3;
-        im = T (idim);
-        P *vec = im.fortran_vec ();
+        img   = T (dim_vector (nRows, nCols, 3, nFrames));
+        T alpha   (dim_vector (nRows, nCols, 1, nFrames));
+        P *img_fvec = img.fortran_vec ();
+        P *a_fvec   = alpha.fortran_vec ();
 
-        for (int frame = 0; frame < nframes; frame++)
+        // Unlike the index for the other channels, this one won't need
+        // to be reset on each frame since it's a separate matrix.
+        octave_idx_type a_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
           {
             const Magick::PixelPacket *pix
-              = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
 
-            P *rbuf = vec;
-            P *gbuf = vec + rows * columns;
-            P *bbuf = vec + rows * columns * 2;
-            for (int y = 0; y < rows; y++)
+            octave_idx_type idx = 0;
+            img_fvec += nRows * nCols * frame;
+            P *rbuf   = img_fvec;
+            P *gbuf   = img_fvec + nRows * nCols;
+            P *bbuf   = img_fvec + nRows * nCols * 2;
+
+            for (octave_idx_type col = 0; col < nCols; col++)
               {
-                for (int x = 0; x < columns; x++)
+                for (octave_idx_type row = 0; row < nRows; row++)
                   {
-                    *rbuf = pix->red / divisor;
-                    *gbuf = pix->green / divisor;
-                    *bbuf = pix->blue / divisor;
-                    pix++;
-                    rbuf += rows;
-                    gbuf += rows;
-                    bbuf += rows;
+                    rbuf[idx]     = pix->red     / divisor;
+                    gbuf[idx]     = pix->green   / divisor;
+                    bbuf[idx]     = pix->blue    / divisor;
+                    a_fvec[a_idx++] = (MaxRGB - pix->opacity) / divisor;
+                    pix += row_shift;
+                    idx++;
                   }
-                rbuf -= rows * columns - 1;
-                gbuf -= rows * columns - 1;
-                bbuf -= rows * columns - 1;
+                pix -= col_shift;
               }
-
-            // Next frame.
-            vec += rows * columns * idim(2);
           }
-        }
-      break;
+        retval(2) = alpha;
+        break;
+      }
 
-    case Magick::PaletteMatteType:
-    case Magick::TrueColorMatteType:
-    case Magick::ColorSeparationType:
+    case Magick::ColorSeparationType:   // Cyan/Yellow/Magenta/Black (CYMK) image
       {
-        idim(2) = 4;
-        im = T (idim);
-        P *vec = im.fortran_vec ();
+        img   = T (dim_vector (nRows, nCols, 4, nFrames));
+        P *img_fvec = img.fortran_vec ();
 
-        for (int frame = 0; frame < nframes; frame++)
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
           {
             const Magick::PixelPacket *pix
-              = imvec[frameidx(frame)].getConstPixels (0, 0, columns, rows);
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
 
-            P *rbuf = vec;
-            P *gbuf = vec + rows * columns;
-            P *bbuf = vec + rows * columns * 2;
-            P *obuf = vec + rows * columns * 3;
-            for (int y = 0; y < rows; y++)
+            octave_idx_type idx = 0;
+            img_fvec += nRows * nCols * frame;
+            P *cbuf   = img_fvec;
+            P *mbuf   = img_fvec + nRows * nCols;
+            P *ybuf   = img_fvec + nRows * nCols * 2;
+            P *kbuf   = img_fvec + nRows * nCols * 3;
+
+            for (octave_idx_type col = 0; col < nCols; col++)
               {
-                for (int x = 0; x < columns; x++)
+                for (octave_idx_type row = 0; row < nRows; row++)
                   {
-                    *rbuf = pix->red / divisor;
-                    *gbuf = pix->green / divisor;
-                    *bbuf = pix->blue / divisor;
-                    *obuf = pix->opacity / divisor;
-                    pix++;
-                    rbuf += rows;
-                    gbuf += rows;
-                    bbuf += rows;
-                    obuf += rows;
+                    cbuf[idx] = pix->red     / divisor;
+                    mbuf[idx] = pix->green   / divisor;
+                    ybuf[idx] = pix->blue    / divisor;
+                    kbuf[idx] = pix->opacity / divisor;
+                    pix += row_shift;
+                    idx++;
                   }
-                rbuf -= rows * columns - 1;
-                gbuf -= rows * columns - 1;
-                bbuf -= rows * columns - 1;
-                obuf -= rows * columns - 1;
+                pix -= col_shift;
               }
+          }
+        break;
+      }
+
+    // Cyan, magenta, yellow, and black with alpha (opacity) channel
+    case Magick::ColorSeparationMatteType:
+      {
+        img   = T (dim_vector (nRows, nCols, 4, nFrames));
+        T alpha   (dim_vector (nRows, nCols, 1, nFrames));
+        P *img_fvec = img.fortran_vec ();
+        P *a_fvec   = alpha.fortran_vec ();
 
-            // Next frame.
-            vec += rows * columns * idim(2);
+        // Unlike the index for the other channels, this one won't need
+        // to be reset on each frame since it's a separate matrix.
+        octave_idx_type a_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            const Magick::PixelPacket *pix
+              = imvec[frameidx(frame)].getConstPixels (col_start, row_start,
+                                                       col_cache, row_cache);
+            // Note that for CMYKColorspace + matte (CMYKA), the opacity is
+            // stored in the assocated IndexPacket.
+            const Magick::IndexPacket *apix
+              = imvec[frameidx(frame)].getConstIndexes ();
+
+            octave_idx_type idx = 0;
+            img_fvec += nRows * nCols * frame;
+            P *cbuf   = img_fvec;
+            P *mbuf   = img_fvec + nRows * nCols;
+            P *ybuf   = img_fvec + nRows * nCols * 2;
+            P *kbuf   = img_fvec + nRows * nCols * 3;
+
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    cbuf[idx]     = pix->red     / divisor;
+                    mbuf[idx]     = pix->green   / divisor;
+                    ybuf[idx]     = pix->blue    / divisor;
+                    kbuf[idx]     = pix->opacity / divisor;
+                    a_fvec[a_idx++] = (MaxRGB - *apix) / divisor;
+                    pix += row_shift;
+                    idx++;
+                  }
+                pix -= col_shift;
+              }
           }
-        }
-      break;
+        retval(2) = alpha;
+        break;
+      }
 
     default:
-      error ("__magick_read__: undefined ImageMagick image type");
+      error ("__magick_read__: unknown Magick++ image type");
       return retval;
     }
 
-  retval(0) = im;
-
+  retval(0) = img;
   return retval;
 }
 
-#endif
+// Read a file into vector of image objects.
+void static
+read_file (const std::string& filename, std::vector<Magick::Image>& imvec)
+{
+  try
+    {
+      Magick::readImages (&imvec, filename);
+    }
+  catch (Magick::Warning& w)
+    {
+      warning ("Magick++ warning: %s", w.what ());
+    }
+  catch (Magick::ErrorCoder& e)
+    {
+      // FIXME: there's a WarningCoder and ErrorCoder. Shouldn't this
+      // exception cause an error?
+      warning ("Magick++ coder error: %s", e.what ());
+    }
+  catch (Magick::Exception& e)
+    {
+      error ("Magick++ exception: %s", e.what ());
+      error_state = 1;
+    }
+}
 
 static void
 maybe_initialize_magick (void)
 {
-#ifdef HAVE_MAGICK
-
   static bool initialized = false;
 
   if (! initialized)
     {
-      // Save locale as GraphicsMagick might change this (depending on version)
+      // Save locale as GraphicsMagick might change this (fixed in
+      // GraphicsMagick since version 1.3.13 released on December 24, 2011)
       const char *static_locale = setlocale (LC_ALL, NULL);
       const std::string locale (static_locale);
 
-      std::string program_name = octave_env::get_program_invocation_name ();
-
+      const std::string program_name = octave_env::get_program_invocation_name ();
       Magick::InitializeMagick (program_name.c_str ());
 
       // Restore locale from before GraphicsMagick initialisation
@@ -398,57 +687,576 @@
 
       initialized = true;
     }
+}
 #endif
-}
 
 DEFUN_DLD (__magick_read__, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{m} =} __magick_read__ (@var{fname}, @var{index})\n\
-@deftypefnx {Loadable Function} {[@var{m}, @var{colormap}] =} __magick_read__ (@var{fname}, @var{index})\n\
-@deftypefnx {Loadable Function} {[@var{m}, @var{colormap}, @var{alpha}] =} __magick_read__ (@var{fname}, @var{index})\n\
-Read images with ImageMagick++.  In general you should not be using this\n\
-function.  Instead use @code{imread}.\n\
-@seealso{imread}\n\
+@deftypefn {Loadable Function} {[@var{img}, @var{map}, @var{alpha}] =} __magick_read__ (@var{fname}, @var{options})\n\
+Read image with GraphicsMagick or ImageMagick.\n\
+\n\
+This is a private internal function not intended for direct use.  Instead\n\
+use @code{imread}.\n\
+\n\
+@seealso{imfinfo, imformats, imread, imwrite}\n\
 @end deftypefn")
 {
   octave_value_list output;
 
-#ifdef HAVE_MAGICK
+#ifndef HAVE_MAGICK
+  gripe_disabled_feature ("imread", "Image IO");
+#else
 
   maybe_initialize_magick ();
 
-  if (args.length () > 3 || args.length () < 1 || ! args(0).is_string ()
-      || nargout > 3)
+  if (args.length () != 2 || ! args(0).is_string ())
     {
       print_usage ();
       return output;
     }
 
-  Array<int> frameidx;
-  bool all_frames = false;
+  const octave_scalar_map options = args(1).scalar_map_value ();
+  if (error_state)
+    {
+      error ("__magick_read__: OPTIONS must be a struct");
+      return output;
+    }
 
-  if (args.length () == 2 && args(1).is_real_type ())
-    frameidx = args(1).int_vector_value ();
-  else if (args.length () == 3 && args(1).is_string ()
-           && args(1).string_value () == "frames")
+  std::vector<Magick::Image> imvec;
+  read_file (args(0).string_value (), imvec);
+  if (error_state)
+    return output;
+
+  // Prepare an Array with the indexes for the requested frames.
+  const octave_idx_type nFrames = imvec.size ();
+  Array<octave_idx_type> frameidx;
+  const octave_value indexes = options.getfield ("index");
+  if (indexes.is_string () && indexes.string_value () == "all")
     {
-      if (args(2).is_string () && args(2).string_value () == "all")
-        all_frames = true;
-      else if (args(2).is_real_type ())
-        frameidx = args(2).int_vector_value ();
+      frameidx.resize (dim_vector (1, nFrames));
+      for (octave_idx_type i = 0; i < nFrames; i++)
+        frameidx(i) = i;
     }
   else
     {
-      frameidx = Array<int> (dim_vector (1, 1));
-      frameidx(0) = 1;
+      frameidx = indexes.int_vector_value ();
+      if (error_state)
+        {
+          error ("__magick_read__: invalid value for Index/Frame");
+          return output;
+        }
+      // Fix indexes from base 1 to base 0, and at the same time, make
+      // sure none of the indexes is outside the range of image number.
+      const octave_idx_type n = frameidx.nelem ();
+      for (octave_idx_type i = 0; i < n; i++)
+        {
+          frameidx(i)--;
+          if (frameidx(i) < 0 || frameidx(i) > nFrames - 1)
+            {
+              error ("imread: index/frames specified are outside the number of images");
+              return output;
+            }
+        }
+    }
+
+  const octave_idx_type depth = get_depth (imvec[frameidx(0)]);
+  if (is_indexed (imvec[frameidx(0)]))
+    {
+      if (depth <= 1)
+        output = read_indexed_images<boolNDArray>   (imvec, frameidx,
+                                                     nargout, options);
+      else if (depth <= 8)
+        output = read_indexed_images<uint8NDArray>  (imvec, frameidx,
+                                                     nargout, options);
+      else if (depth <= 16)
+        output = read_indexed_images<uint16NDArray> (imvec, frameidx,
+                                                     nargout, options);
+      else
+        {
+          error ("imread: indexed images with depths greater than 16-bit are not supported");
+          return output;
+        }
+    }
+
+  else
+    {
+      if (depth <= 1)
+        output = read_images<boolNDArray>   (imvec, frameidx, nargout, options);
+      else if (depth <= 8)
+        output = read_images<uint8NDArray>  (imvec, frameidx, nargout, options);
+      else if (depth <= 16)
+        output = read_images<uint16NDArray> (imvec, frameidx, nargout, options);
+      else if (depth <= 32)
+        output = read_images<FloatNDArray>  (imvec, frameidx, nargout, options);
+      else
+        {
+          error ("imread: reading of images with %i-bit depth is not supported",
+                 depth);
+        }
+    }
+
+#endif
+  return output;
+}
+
+/*
+## No test needed for internal helper function.
+%!assert (1)
+*/
+
+#ifdef HAVE_MAGICK
+
+template <class T>
+static uint32NDArray
+img_float2uint (const T& img)
+{
+  typedef typename T::element_type P;
+  uint32NDArray out (img.dims ());
+
+  octave_uint32* out_fvec = out.fortran_vec ();
+  const P*       img_fvec = img.fortran_vec ();
+
+  const octave_uint32 max = octave_uint32::max ();
+  const octave_idx_type numel = img.numel ();
+  for (octave_idx_type idx = 0; idx < numel; idx++)
+    out_fvec[idx] = img_fvec[idx] * max;
+
+  return out;
+}
+
+// Gets the bitdepth to be used for an Octave class, i.e, returns 8 for
+// uint8, 16 for uint16, and 32 for uint32
+template <class T>
+static octave_idx_type
+bitdepth_from_class ()
+{
+  typedef typename T::element_type P;
+  const octave_idx_type bitdepth =
+    sizeof (P) * std::numeric_limits<unsigned char>::digits;
+  return bitdepth;
+}
+
+static Magick::Image
+init_enconde_image (const octave_idx_type& nCols, const octave_idx_type& nRows,
+                    const octave_idx_type& bitdepth,
+                    const Magick::ImageType& type,
+                    const Magick::ClassType& klass)
+{
+  Magick::Image img (Magick::Geometry (nCols, nRows), "black");
+  // Ensure that there are no other references to this image.
+  img.modifyImage ();
+
+  img.classType (klass);
+  img.type (type);
+  // FIXME: for some reason, setting bitdepth doesn't seem to work for
+  //        indexed images.
+  img.depth (bitdepth);
+  switch (type)
+    {
+      case Magick::GrayscaleMatteType:
+      case Magick::TrueColorMatteType:
+      case Magick::ColorSeparationMatteType:
+      case Magick::PaletteMatteType:
+        img.matte (true);
+        break;
+
+      default:
+        img.matte (false);
     }
 
-  std::vector<Magick::Image> imvec;
+  return img;
+}
+
+template <class T>
+static void
+encode_indexed_images (std::vector<Magick::Image>& imvec,
+                       const T& img,
+                       const Matrix& cmap)
+{
+  typedef typename T::element_type P;
+  const octave_idx_type nFrames   = img.ndims () < 4 ? 1 : img.dims ()(3);
+  const octave_idx_type nRows     = img.rows ();
+  const octave_idx_type nCols     = img.columns ();
+  const octave_idx_type cmap_size = cmap.rows ();
+  const octave_idx_type bitdepth  = bitdepth_from_class<T> ();
+
+  // There is no colormap object, we need to build a new one for each frame,
+  // even if it's always the same. We can least get a vector for the Colors.
+  std::vector<Magick::ColorRGB> colormap;
+  {
+    const double* cmap_fvec = cmap.fortran_vec ();
+    const octave_idx_type G_offset = cmap_size;
+    const octave_idx_type B_offset = cmap_size * 2;
+    for (octave_idx_type map_idx = 0; map_idx < cmap_size; map_idx++)
+      colormap.push_back (Magick::ColorRGB (cmap_fvec[map_idx],
+                                            cmap_fvec[map_idx + G_offset],
+                                            cmap_fvec[map_idx + B_offset]));
+  }
+
+  for (octave_idx_type frame = 0; frame < nFrames; frame++)
+    {
+      Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                Magick::PaletteType,
+                                                Magick::PseudoClass);
+
+      // Insert colormap.
+      m_img.colorMapSize (cmap_size);
+      for (octave_idx_type map_idx = 0; map_idx < cmap_size; map_idx++)
+        m_img.colorMap (map_idx, colormap[map_idx]);
+
+      // Why are we also setting the pixel values instead of only the
+      // index values? We don't know if a file format supports indexed
+      // images. If we only set the indexes and then try to save the
+      // image as JPEG for example, the indexed values get discarded,
+      // there is no conversion from the indexes, it's the initial values
+      // that get used. An alternative would be to only set the pixel
+      // values (no indexes), then set the image as PseudoClass and GM
+      // would create a colormap for us. However, we wouldn't have control
+      // over the order of that colormap. And that's why we set both.
+      Magick::PixelPacket* pix  = m_img.getPixels (0, 0, nCols, nRows);
+      Magick::IndexPacket* ind  = m_img.getIndexes ();
+      const P* img_fvec         = img.fortran_vec ();
+
+      octave_idx_type GM_idx = 0;
+      for (octave_idx_type column = 0; column < nCols; column++)
+        {
+          for (octave_idx_type row = 0; row < nRows; row++)
+            {
+              ind[GM_idx] = double (*img_fvec);
+              pix[GM_idx] = m_img.colorMap (double (*img_fvec));
+              img_fvec++;
+              GM_idx += nCols;
+            }
+          GM_idx -= nCols * nRows - 1;
+        }
+
+      // Save changes to underlying image.
+      m_img.syncPixels ();
+      imvec.push_back (m_img);
+    }
+}
+
+static void
+encode_bool_image (std::vector<Magick::Image>& imvec, const boolNDArray& img)
+{
+  const octave_idx_type nFrames   = img.ndims () < 4 ? 1 : img.dims ()(3);
+  const octave_idx_type nRows     = img.rows ();
+  const octave_idx_type nCols     = img.columns ();
+
+  // The initialized image will be black, this is for the other pixels
+  const Magick::Color white ("white");
+
+  const bool *img_fvec = img.fortran_vec ();
+  octave_idx_type img_idx = 0;
+  for (octave_idx_type frame = 0; frame < nFrames; frame++)
+    {
+      // For some reason, we can't set the type to Magick::BilevelType or
+      // the output image will be black, changing to white has no effect.
+      // However, this will still work fine and a binary image will be
+      // saved because we are setting the bitdepth to 1.
+      Magick::Image m_img = init_enconde_image (nCols, nRows, 1,
+                                                Magick::GrayscaleType,
+                                                Magick::DirectClass);
+
+      Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+      octave_idx_type GM_idx = 0;
+      for (octave_idx_type col = 0; col < nCols; col++)
+        {
+          for (octave_idx_type row = 0; row < nRows; row++)
+            {
+              if (img_fvec[img_idx])
+                pix[GM_idx] = white;
+
+              img_idx++;
+              GM_idx += nCols;
+            }
+          GM_idx -= nCols * nRows - 1;
+        }
+      // Save changes to underlying image.
+      m_img.syncPixels ();
+      // While we could not set it to Bilevel at the start, we can do it
+      // here otherwise some coders won't save it as binary.
+      m_img.type (Magick::BilevelType);
+      imvec.push_back (m_img);
+    }
+}
+
+template <class T>
+static void
+encode_uint_image (std::vector<Magick::Image>& imvec,
+                   const T& img, const T& alpha)
+{
+  typedef typename T::element_type P;
+  const octave_idx_type channels  = img.ndims () < 3 ? 1 : img.dims ()(2);
+  const octave_idx_type nFrames   = img.ndims () < 4 ? 1 : img.dims ()(3);
+  const octave_idx_type nRows     = img.rows ();
+  const octave_idx_type nCols     = img.columns ();
+  const octave_idx_type bitdepth  = bitdepth_from_class<T> ();
+
+  Magick::ImageType type;
+  const bool has_alpha = ! alpha.is_empty ();
+  switch (channels)
+    {
+    case 1:
+      if (has_alpha)
+        type = Magick::GrayscaleMatteType;
+      else
+        type = Magick::GrayscaleType;
+      break;
+
+    case 3:
+      if (has_alpha)
+        type = Magick::TrueColorMatteType;
+      else
+        type = Magick::TrueColorType;
+      break;
+
+    case 4:
+      if (has_alpha)
+        type = Magick::ColorSeparationMatteType;
+      else
+        type = Magick::ColorSeparationType;
+      break;
+
+    default:
+      {
+        // __imwrite should have already filtered this cases
+        error ("__magick_write__: wrong size on 3rd dimension");
+        return;
+      }
+    }
+
+  // We will be passing the values as integers with depth as specified
+  // by QuantumDepth (maximum value specified by MaxRGB). This is independent
+  // of the actual depth of the image. GM will then convert the values but
+  // while in memory, it always keeps the values as specified by QuantumDepth.
+  // From GM documentation:
+  //  Color arguments are must be scaled to fit the Quantum size according to
+  //  the range of MaxRGB
+  const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1) / MaxRGB;
+
+  const P *img_fvec = img.fortran_vec ();
+  const P *a_fvec   = alpha.fortran_vec ();
+  switch (type)
+    {
+    case Magick::GrayscaleType:
+      {
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
 
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c;
+                    c.redQuantum (double (*img_fvec) / divisor);
+                    pix[GM_idx] = c;
+                    img_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    case Magick::GrayscaleMatteType:
+      {
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
+
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c;
+                    c.redQuantum   (double (*img_fvec) / divisor);
+                    c.alphaQuantum (MaxRGB - (double (*a_fvec) / divisor));
+                    pix[GM_idx] = c;
+                    img_fvec++;
+                    a_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    case Magick::TrueColorType:
+      {
+        // The fortran_vec offset for the green and blue channels
+        const octave_idx_type G_offset = nCols * nRows;
+        const octave_idx_type B_offset = nCols * nRows * 2;
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
+
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c (double (*img_fvec)          / divisor,
+                                     double (img_fvec[G_offset]) / divisor,
+                                     double (img_fvec[B_offset]) / divisor);
+                    pix[GM_idx] = c;
+                    img_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    case Magick::TrueColorMatteType:
+      {
+        // The fortran_vec offset for the green and blue channels
+        const octave_idx_type G_offset = nCols * nRows;
+        const octave_idx_type B_offset = nCols * nRows * 2;
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
+
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c (double (*img_fvec)          / divisor,
+                                     double (img_fvec[G_offset]) / divisor,
+                                     double (img_fvec[B_offset]) / divisor,
+                                     MaxRGB - (double (*a_fvec) / divisor));
+                    pix[GM_idx] = c;
+                    img_fvec++;
+                    a_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    case Magick::ColorSeparationType:
+      {
+        // The fortran_vec offset for the Magenta, Yellow, and blacK channels
+        const octave_idx_type M_offset = nCols * nRows;
+        const octave_idx_type Y_offset = nCols * nRows * 2;
+        const octave_idx_type K_offset = nCols * nRows * 3;
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
+
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c (double (*img_fvec)          / divisor,
+                                     double (img_fvec[M_offset]) / divisor,
+                                     double (img_fvec[Y_offset]) / divisor,
+                                     double (img_fvec[K_offset]) / divisor);
+                    pix[GM_idx] = c;
+                    img_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    case Magick::ColorSeparationMatteType:
+      {
+        // The fortran_vec offset for the Magenta, Yellow, and blacK channels
+        const octave_idx_type M_offset = nCols * nRows;
+        const octave_idx_type Y_offset = nCols * nRows * 2;
+        const octave_idx_type K_offset = nCols * nRows * 3;
+        octave_idx_type GM_idx = 0;
+        for (octave_idx_type frame = 0; frame < nFrames; frame++)
+          {
+            Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth,
+                                                      type,
+                                                      Magick::DirectClass);
+
+            Magick::PixelPacket *pix = m_img.getPixels (0, 0, nCols, nRows);
+            Magick::IndexPacket *ind = m_img.getIndexes ();
+            for (octave_idx_type col = 0; col < nCols; col++)
+              {
+                for (octave_idx_type row = 0; row < nRows; row++)
+                  {
+                    Magick::Color c (double (*img_fvec)          / divisor,
+                                     double (img_fvec[M_offset]) / divisor,
+                                     double (img_fvec[Y_offset]) / divisor,
+                                     double (img_fvec[K_offset]) / divisor);
+                    pix[GM_idx] = c;
+                    ind[GM_idx] = MaxRGB - (double (*a_fvec) / divisor);
+                    img_fvec++;
+                    a_fvec++;
+                    GM_idx += nCols;
+                  }
+                GM_idx -= nCols * nRows - 1;
+              }
+            // Save changes to underlying image.
+            m_img.syncPixels ();
+            imvec.push_back (m_img);
+          }
+        break;
+      }
+
+    default:
+      {
+        error ("__magick_write__: unrecognized Magick::ImageType");
+        return;
+      }
+    }
+  return;
+}
+
+void static
+write_file (const std::string& filename,
+            const std::string& ext,
+            std::vector<Magick::Image>& imvec)
+{
   try
     {
-      // Read a file into vector of image objects
-      Magick::readImages (&imvec, args(0).string_value ());
+      Magick::writeImages (imvec.begin (), imvec.end (), ext + ":" + filename);
     }
   catch (Magick::Warning& w)
     {
@@ -461,409 +1269,7 @@
   catch (Magick::Exception& e)
     {
       error ("Magick++ exception: %s", e.what ());
-      return output;
-    }
-
-  int nframes = imvec.size ();
-  if (all_frames)
-    {
-      frameidx = Array<int> (dim_vector (1, nframes));
-      for (int i = 0; i < frameidx.length (); i++)
-        frameidx(i) = i;
-    }
-  else
-    {
-      for (int i = 0; i < frameidx.length (); i++)
-        {
-          frameidx(i) = frameidx(i) - 1;
-
-          if (frameidx(i) >= nframes || frameidx(i) < 0)
-            {
-              error ("__magick_read__: invalid INDEX vector");
-              return output;
-            }
-        }
-    }
-
-  Magick::ClassType klass = imvec[0].classType ();
-
-  if (klass == Magick::PseudoClass && nargout > 1)
-    output = read_indexed_images (imvec, frameidx, (nargout == 3));
-  else
-    {
-      unsigned int depth = imvec[0].modulusDepth ();
-      if (depth > 1)
-        {
-          --depth;
-          int i = 1;
-          while (depth >>= 1)
-            i++;
-          depth = 1 << i;
-        }
-
-      switch (depth)
-        {
-        case 1:
-          output = read_images<boolNDArray> (imvec, frameidx, depth);
-          break;
-
-        case 2:
-        case 4:
-        case 8:
-          output = read_images<uint8NDArray> (imvec, frameidx, depth) ;
-          break;
-
-        case 16:
-          output = read_images<uint16NDArray> (imvec, frameidx, depth);
-          break;
-
-        case 32:
-        case 64:
-        default:
-          error ("__magick_read__: image depths greater than 16-bit are not supported");
-        }
-    }
-#else
-
-  error ("imread: image reading capabilities were disabled when Octave was compiled");
-
-#endif
-
-  return output;
-}
-
-/*
-## No test needed for internal helper function.
-%!assert (1)
-*/
-
-#ifdef HAVE_MAGICK
-
-static void
-jpg_settings (std::vector<Magick::Image>& imvec,
-              const octave_map& options,
-              bool)
-{
-  bool something_set = false;
-
-  // Quality setting
-  octave_value result;
-  octave_map::const_iterator p;
-  bool found_it = false;
-
-  for (p = options.begin (); p != options.end (); p++)
-    {
-      if (options.key (p) == "Quality")
-        {
-          found_it = true;
-          result = options.contents (p).elem (0);
-          break;
-        }
-    }
-
-  if (found_it && (! result.is_empty ()))
-    {
-      something_set = true;
-
-      if (result.is_real_type ())
-        {
-          int qlev = result.int_value ();
-
-          if (qlev < 0 || qlev > 100)
-            warning ("warning: Quality setting invalid--use default of 75");
-          else
-            {
-              for (size_t fnum = 0; fnum < imvec.size (); fnum++)
-                imvec[fnum].quality (static_cast<unsigned int>(qlev));
-            }
-        }
-      else
-        warning ("warning: Quality setting invalid--use default of 75");
-    }
-
-  // Other settings go here
-
-  if (! something_set)
-    warning ("__magick_write__ warning: all write parameters ignored");
-}
-
-static void
-encode_bool_image (std::vector<Magick::Image>& imvec, const octave_value& img)
-{
-  unsigned int nframes = 1;
-  boolNDArray m = img.bool_array_value ();
-
-  dim_vector dsizes = m.dims ();
-  if (dsizes.length () == 4)
-    nframes = dsizes(3);
-
-  Array<octave_idx_type> idx (dim_vector (dsizes.length (), 1));
-
-  octave_idx_type rows = m.rows ();
-  octave_idx_type columns = m.columns ();
-
-  for (unsigned int ii = 0; ii < nframes; ii++)
-    {
-      Magick::Image im (Magick::Geometry (columns, rows), "black");
-      im.classType (Magick::DirectClass);
-      im.depth (1);
-
-      for (int y = 0; y < columns; y++)
-        {
-          idx(1) = y;
-
-          for (int x = 0; x < rows; x++)
-            {
-              if (nframes > 1)
-                {
-                  idx(2) = 0;
-                  idx(3) = ii;
-                }
-
-              idx(0) = x;
-
-              if (m(idx))
-                im.pixelColor (y, x, "white");
-            }
-        }
-
-      im.quantizeColorSpace (Magick::GRAYColorspace);
-      im.quantizeColors (2);
-      im.quantize ();
-
-      imvec.push_back (im);
-    }
-}
-
-template <class T>
-static void
-encode_uint_image (std::vector<Magick::Image>& imvec,
-                   const octave_value& img,
-                   bool has_map)
-{
-  unsigned int bitdepth = 0;
-  T m;
-
-  if (img.is_uint8_type ())
-    {
-      bitdepth = 8;
-      m = img.uint8_array_value ();
-    }
-  else if (img.is_uint16_type ())
-    {
-      bitdepth = 16;
-      m = img.uint16_array_value ();
-    }
-  else
-    error ("__magick_write__: invalid image class");
-
-  dim_vector dsizes = m.dims ();
-  unsigned int nframes = 1;
-  if (dsizes.length () == 4)
-    nframes = dsizes(3);
-
-  bool is_color = ((dsizes.length () > 2) && (dsizes(2) > 2));
-  bool has_alpha = (dsizes.length () > 2 && (dsizes(2) == 2 || dsizes(2) == 4));
-
-  Array<octave_idx_type> idx (dim_vector (dsizes.length (), 1));
-  octave_idx_type rows = m.rows ();
-  octave_idx_type columns = m.columns ();
-
-  unsigned int div_factor = (1 << bitdepth) - 1;
-
-  for (unsigned int ii = 0; ii < nframes; ii++)
-    {
-      Magick::Image im (Magick::Geometry (columns, rows), "black");
-
-      im.depth (bitdepth);
-
-      if (has_map)
-        im.classType (Magick::PseudoClass);
-      else
-        im.classType (Magick::DirectClass);
-
-      if (is_color)
-        {
-          if (has_alpha)
-            im.type (Magick::TrueColorMatteType);
-          else
-            im.type (Magick::TrueColorType);
-
-          Magick::ColorRGB c;
-
-          for (int y = 0; y < columns; y++)
-            {
-              idx(1) = y;
-
-              for (int x = 0; x < rows; x++)
-                {
-                  idx(0) = x;
-
-                  if (nframes > 1)
-                    idx(3) = ii;
-
-                  idx(2) = 0;
-                  c.red (static_cast<double>(m(idx)) / div_factor);
-
-                  idx(2) = 1;
-                  c.green (static_cast<double>(m(idx)) / div_factor);
-
-                  idx(2) = 2;
-                  c.blue (static_cast<double>(m(idx)) / div_factor);
-
-                  if (has_alpha)
-                    {
-                      idx(2) = 3;
-                      c.alpha (static_cast<double>(m(idx)) / div_factor);
-                    }
-
-                  im.pixelColor (y, x, c);
-                }
-            }
-        }
-      else
-        {
-          if (has_alpha)
-            im.type (Magick::GrayscaleMatteType);
-          else
-            im.type (Magick::GrayscaleType);
-
-          Magick::ColorGray c;
-
-          for (int y = 0; y < columns; y++)
-            {
-              idx(1) = y;
-
-              for (int x=0; x < rows; x++)
-                {
-                  idx(0) = x;
-
-                  if (nframes > 1)
-                    {
-                      idx(2) = 0;
-                      idx(3) = ii;
-                    }
-
-                  if (has_alpha)
-                    {
-                      idx(2) = 1;
-                      c.alpha (static_cast<double>(m(idx)) / div_factor);
-                      idx(2) = 0;
-                    }
-
-                  c.shade (static_cast<double>(m(idx)) / div_factor);
-
-                  im.pixelColor (y, x, c);
-                }
-            }
-
-          im.quantizeColorSpace (Magick::GRAYColorspace);
-          im.quantizeColors (1 << bitdepth);
-          im.quantize ();
-        }
-
-      imvec.push_back (im);
-    }
-}
-
-static void
-encode_map (std::vector<Magick::Image>& imvec, const NDArray& cmap)
-{
-  unsigned int mapsize = cmap.dim1 ();
-
-  for (size_t fnum = 0; fnum < imvec.size (); fnum++)
-    {
-      imvec[fnum].colorMapSize (mapsize);
-      imvec[fnum].type (Magick::PaletteType);
-    }
-
-  for (unsigned int ii = 0; ii < mapsize; ii++)
-    {
-      Magick::ColorRGB c (cmap(ii,0), cmap(ii,1), cmap(ii,2));
-
-      // FIXME -- is this case needed?
-      if (cmap.dim2 () == 4)
-        c.alpha (cmap(ii,3));
-
-      try
-        {
-          for_each (imvec.begin (), imvec.end (),
-                    Magick::colorMapImage (ii, c));
-        }
-      catch (Magick::Warning& w)
-        {
-          warning ("Magick++ warning: %s", w.what ());
-        }
-      catch (Magick::ErrorCoder& e)
-        {
-          warning ("Magick++ coder error: %s", e.what ());
-        }
-      catch (Magick::Exception& e)
-        {
-          error ("Magick++ exception: %s", e.what ());
-        }
-    }
-}
-
-static void
-write_image (const std::string& filename, const std::string& fmt,
-             const octave_value& img,
-             const octave_value& map = octave_value (),
-             const octave_value& params = octave_value ())
-{
-  std::vector<Magick::Image> imvec;
-
-  bool has_map = map.is_defined ();
-
-  if (has_map)
-    {
-      error ("__magick_write__: direct saving of indexed images not currently supported; use ind2rgb and save converted image");
-      return;
-    }
-
-  if (img.is_bool_type ())
-    encode_bool_image (imvec, img);
-  else if (img.is_uint8_type ())
-    encode_uint_image<uint8NDArray> (imvec, img, has_map);
-  else if (img.is_uint16_type ())
-    encode_uint_image<uint16NDArray> (imvec, img, has_map);
-  else
-    error ("__magick_write__: image type not supported");
-
-  if (! error_state && has_map)
-    {
-      NDArray cmap = map.array_value ();
-
-      if (! error_state)
-        encode_map (imvec, cmap);
-    }
-
-  if (! error_state && params.is_defined ())
-    {
-      octave_map options = params.map_value ();
-
-      // Insert calls here to handle parameters for various image formats
-      if (fmt == "jpg" || fmt == "jpeg")
-        jpg_settings (imvec, options, has_map);
-      else
-        warning ("warning: your parameter(s) currently not supported");
-    }
-
-  try
-    {
-      Magick::writeImages (imvec.begin (), imvec.end (), fmt + ":" + filename);
-    }
-  catch (Magick::Warning& w)
-    {
-      warning ("Magick++ warning: %s", w.what ());
-    }
-  catch (Magick::ErrorCoder& e)
-    {
-      warning ("Magick++ coder error: %s", e.what ());
-    }
-  catch (Magick::Exception& e)
-    {
-      error ("Magick++ exception: %s", e.what ());
+      error_state = 1;
     }
 }
 
@@ -871,277 +1277,135 @@
 
 DEFUN_DLD (__magick_write__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img})\n\
-@deftypefnx {Loadable Function} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img}, @var{map})\n\
-Write images with ImageMagick++.  In general you should not be using this\n\
-function.  Instead use @code{imwrite}.\n\
-@seealso{imread}\n\
+@deftypefn {Loadable Function} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img}, @var{map}, @var{options})\n\
+Write image with GraphicsMagick or ImageMagick.\n\
+\n\
+This is a private internal function not intended for direct use.  Instead\n\
+use @code{imwrite}.\n\
+\n\
+@seealso{imfinfo, imformats, imread, imwrite}\n\
 @end deftypefn")
 {
   octave_value_list retval;
 
-#ifdef HAVE_MAGICK
-  maybe_initialize_magick ();
-
-  int nargin = args.length ();
-
-  if (nargin > 2)
-    {
-      std::string filename = args(0).string_value ();
-
-      if (! error_state)
-        {
-          std::string fmt = args(1).string_value ();
-
-          if (! error_state)
-            {
-              if (nargin > 4)
-                write_image (filename, fmt, args(2), args(3), args(4));
-              else if (nargin > 3)
-                if (args(3).is_real_type ())
-                  write_image (filename, fmt, args(2), args(3));
-                else
-                  write_image (filename, fmt, args(2), octave_value (), args(3));
-              else
-                write_image (filename, fmt, args(2));
-            }
-          else
-            error ("__magick_write__: FMT must be string");
-        }
-      else
-        error ("__magick_write__: FNAME must be a string");
-    }
-  else
-    print_usage ();
+#ifndef HAVE_MAGICK
+  gripe_disabled_feature ("imwrite", "Image IO");
 #else
 
-  error ("__magick_write__: not available in this version of Octave");
-
-#endif
-
-return retval;
-}
-
-/*
-## No test needed for internal helper function.
-%!assert (1)
-*/
-
-#ifdef HAVE_MAGICK
-
-template<class T>
-static octave_value
-magick_to_octave_value (const T magick)
-{
-  return octave_value (magick);
-}
-
-static octave_value
-magick_to_octave_value (const Magick::EndianType magick)
-{
-  switch (magick)
-    {
-      case Magick::LSBEndian:
-        return octave_value ("little-endian");
-
-      case Magick::MSBEndian:
-        return octave_value ("big-endian");
-
-      default:
-        return octave_value ("undefined");
-    }
-}
-
-static octave_value
-magick_to_octave_value (const Magick::ResolutionType magick)
-{
-  switch (magick)
-    {
-      case Magick::PixelsPerInchResolution:
-        return octave_value ("pixels per inch");
-
-      case Magick::PixelsPerCentimeterResolution:
-        return octave_value ("pixels per centimeter");
-
-      default:
-        return octave_value ("undefined");
-    }
-}
-
-static octave_value
-magick_to_octave_value (const Magick::ImageType magick)
-{
-  switch (magick)
-    {
-      case Magick::BilevelType:
-      case Magick::GrayscaleType:
-      case Magick::GrayscaleMatteType:
-        return octave_value ("grayscale");
-
-      case Magick::PaletteType:
-      case Magick::PaletteMatteType:
-        return octave_value ("indexed");
-
-      case Magick::TrueColorType:
-      case Magick::TrueColorMatteType:
-      case Magick::ColorSeparationType:
-        return octave_value ("truecolor");
-
-      default:
-        return octave_value ("undefined");
-    }
-}
-
-// We put this in a try-block because GraphicsMagick will throw
-// exceptions if a parameter isn't present in the current image.
-#define GET_PARAM(NAME, OUTNAME) \
-  try \
-    { \
-      info.contents (OUTNAME)(frame,0) = magick_to_octave_value (im.NAME ()); \
-    } \
-  catch (Magick::Warning& w) \
-    { \
-    }
-
-#endif
-
-DEFUN_DLD (__magick_finfo__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __magick_finfo__ (@var{fname})\n\
-Read image information with GraphicsMagick++.  In general you should\n\
-not be using this function.  Instead use @code{imfinfo}.\n\
-@seealso{imfinfo, imread}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-#ifdef HAVE_MAGICK
-
   maybe_initialize_magick ();
 
-  if (args.length () < 1 || ! args (0).is_string ())
+  if (args.length () != 5 || ! args(0).is_string () || ! args(1).is_string ())
     {
       print_usage ();
       return retval;
     }
+  const std::string filename = args(0).string_value ();
+  const std::string ext      = args(1).string_value ();
 
-  const std::string filename = args (0).string_value ();
+  const octave_scalar_map options = args(4).scalar_map_value ();
+  if (error_state)
+    {
+      error ("__magick_write__: OPTIONS must be a struct");
+      return retval;
+    }
 
-  try
+  const octave_value img  = args(2);
+  const Matrix       cmap = args(3).matrix_value ();
+  if (error_state)
     {
-      // Read the file.
-      std::vector<Magick::Image> imvec;
-      Magick::readImages (&imvec, args(0).string_value ());
-      int nframes = imvec.size ();
+      error ("__magick_write__: invalid IMG or MAP");
+      return retval;
+    }
+
+  std::vector<Magick::Image> imvec;
 
-      // Create the right size for the output.
-
-      static const char *fields[] =
+  if (cmap.is_empty ())
+    {
+      const octave_value alpha = options.getfield ("alpha");
+      if (img.is_bool_type ())
+        encode_bool_image (imvec, img.bool_array_value ());
+      else if (img.is_uint8_type ())
+        encode_uint_image<uint8NDArray>  (imvec, img.uint8_array_value (),
+                                          alpha.uint8_array_value ());
+      else if (img.is_uint16_type ())
+        encode_uint_image<uint16NDArray> (imvec, img.uint16_array_value (),
+                                          alpha.uint16_array_value ());
+      else if (img.is_uint32_type ())
+        encode_uint_image<uint32NDArray> (imvec, img.uint32_array_value (),
+                                          alpha.uint32_array_value ());
+      else if (img.is_float_type ())
         {
-          "Filename",
-          "FileModDate",
-          "FileSize",
-          "Height",
-          "Width",
-          "BitDepth",
-          "Format",
-          "LongFormat",
-          "XResolution",
-          "YResolution",
-          "TotalColors",
-          "TileName",
-          "AnimationDelay",
-          "AnimationIterations",
-          "ByteOrder",
-          "Gamma",
-          "Matte",
-          "ModulusDepth",
-          "Quality",
-          "QuantizeColors",
-          "ResolutionUnits",
-          "ColorType",
-          "View",
-          0
-        };
-
-      octave_map info (dim_vector (nframes, 1), string_vector (fields));
-
-      file_stat fs (filename);
-
-      std::string filetime;
-
-      if (fs)
-        {
-          octave_localtime mtime = fs.mtime ();
-
-          filetime = mtime.strftime ("%e-%b-%Y %H:%M:%S");
+          // For image formats that support floating point values, we write
+          // the actual values. For those who don't, we only use the values
+          // on the range [0 1] and save integer values.
+          // But here, even for formats that would support floating point
+          // values, GM seems unable to do that so we at least make them uint32.
+          uint32NDArray clip_img;
+          uint32NDArray clip_alpha;
+          if (img.is_single_type ())
+            {
+              clip_img   = img_float2uint<FloatNDArray> (img.float_array_value ());
+              clip_alpha = img_float2uint<FloatNDArray> (alpha.float_array_value ());
+            }
+          else
+            {
+              clip_img   = img_float2uint<NDArray> (img.array_value ());
+              clip_alpha = img_float2uint<NDArray> (alpha.array_value ());
+            }
+          encode_uint_image<uint32NDArray> (imvec, clip_img, clip_alpha);
         }
       else
         {
-          std::string msg = fs.error ();
-
-          error ("imfinfo: error reading '%s': %s",
-                 filename.c_str (), msg.c_str ());
-
+          error ("__magick_write__: image type not supported");
+          return retval;
+        }
+    }
+  else
+    {
+      // We should not get floating point indexed images here because we
+      // converted them in __imwrite__.m. We should probably do it here
+      // but it would look much messier.
+      if (img.is_uint8_type ())
+        encode_indexed_images<uint8NDArray>  (imvec, img.uint8_array_value (),
+                                              cmap);
+      else if (img.is_uint16_type ())
+        encode_indexed_images<uint16NDArray> (imvec, img.uint16_array_value (),
+                                              cmap);
+      else
+        {
+          error ("__magick_write__: indexed image must be uint8, uint16 or float.");
           return retval;
         }
-
-      // For each frame in the image (some images contain multiple
-      // layers, each to be treated like a separate image).
-      for (int frame = 0; frame < nframes; frame++)
-        {
-          Magick::Image im = imvec[frame];
-
-          // Add file name and timestamp.
-          info.contents ("Filename")(frame,0) = filename;
-          info.contents ("FileModDate")(frame,0) = filetime;
-
-          // Annoying CamelCase naming is for Matlab compatibility.
-          GET_PARAM (fileSize, "FileSize")
-          GET_PARAM (rows, "Height")
-          GET_PARAM (columns, "Width")
-          GET_PARAM (depth, "BitDepth")
-          GET_PARAM (magick, "Format")
-          GET_PARAM (format, "LongFormat")
-          GET_PARAM (xResolution, "XResolution")
-          GET_PARAM (yResolution, "YResolution")
-          GET_PARAM (totalColors, "TotalColors")
-          GET_PARAM (tileName, "TileName")
-          GET_PARAM (animationDelay, "AnimationDelay")
-          GET_PARAM (animationIterations, "AnimationIterations")
-          GET_PARAM (endian, "ByteOrder")
-          GET_PARAM (gamma, "Gamma")
-          GET_PARAM (matte, "Matte")
-          GET_PARAM (modulusDepth, "ModulusDepth")
-          GET_PARAM (quality, "Quality")
-          GET_PARAM (quantizeColors, "QuantizeColors")
-          GET_PARAM (resolutionUnits, "ResolutionUnits")
-          GET_PARAM (type, "ColorType")
-          GET_PARAM (view, "View")
-        }
-
-      retval = octave_value (info);
-    }
-  catch (Magick::Warning& w)
-    {
-      warning ("Magick++ warning: %s", w.what ());
-    }
-  catch (Magick::ErrorCoder& e)
-    {
-      warning ("Magick++ coder error: %s", e.what ());
-    }
-  catch (Magick::Exception& e)
-    {
-      error ("Magick++ exception: %s", e.what ());
-      return retval;
     }
 
-#else
+  const octave_idx_type nFrames = imvec.size ();
+
+  // FIXME What happens when we try to set with formats that do not support it?
+  const octave_idx_type quality = options.getfield ("quality").int_value ();
+  for (octave_idx_type i = 0; i < nFrames; i++)
+    imvec[i].quality (quality);
 
-  error ("imfinfo: not available in this version of Octave");
+  // If writemode is set to append, read the image and append to it. Even
+  // if set to append, make sure that something was read at all.
+  const std::string writemode = options.getfield ("writemode").string_value ();
+  if (writemode == "append" && file_stat (filename).exists ())
+    {
+      std::vector<Magick::Image> ini_imvec;
+      read_file (filename, ini_imvec);
+      if (error_state)
+          return retval;
+      if (ini_imvec.size () > 0)
+        {
+          ini_imvec.insert (ini_imvec.end (), imvec.begin (), imvec.end ());
+          ini_imvec.swap (imvec);
+        }
+    }
+
+  write_file (filename, ext, imvec);
+  if (error_state)
+    return retval;
 
 #endif
-
   return retval;
 }
 
@@ -1150,63 +1414,686 @@
 %!assert (1)
 */
 
-#undef GET_PARAM
+// Gets the minimum information from images such as its size and format. Much
+// faster than using imfinfo, which slows down a lot since. Note than without
+// this, we need to read the image once for imfinfo to set defaults (which is
+// done in Octave language), and then again for the actual reading.
+DEFUN_DLD (__magick_ping__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __magick_ping__ (@var{fname}, @var{idx})\n\
+Ping image information with GraphicsMagick or ImageMagick.\n\
+\n\
+This is a private internal function not intended for direct use.\n\
+\n\
+@seealso{imfinfo}\n\
+@end deftypefn")
+{
+  octave_value retval;
+#ifndef HAVE_MAGICK
+  gripe_disabled_feature ("imfinfo", "Image IO");
+#else
+  maybe_initialize_magick ();
+
+  if (args.length () < 1 || ! args(0).is_string ())
+    {
+      print_usage ();
+      return retval;
+    }
+  const std::string filename = args(0).string_value ();
+  int idx;
+  if (args.length () > 1)
+    idx = args(1).int_value () -1;
+  else
+    idx = 0;
+
+  Magick::Image img;
+  img.subImage (idx);
+  img.subRange (1);
+  img.ping (filename);
+  static const char *fields[] = {"rows", "columns", "format", 0};
+  octave_scalar_map ping = octave_scalar_map (string_vector (fields));
+  ping.setfield ("rows",    octave_value (img.rows ()));
+  ping.setfield ("columns", octave_value (img.columns ()));
+  ping.setfield ("format",  octave_value (img.magick ()));
+  retval = octave_value (ping);
+#endif
+  return retval;
+}
+
+#ifdef HAVE_MAGICK
+static octave_value
+magick_to_octave_value (const Magick::CompressionType& magick)
+{
+  switch (magick)
+    {
+      case Magick::NoCompression:
+        return octave_value ("none");
+      case Magick::BZipCompression:
+        return octave_value ("bzip");
+      case Magick::FaxCompression:
+        return octave_value ("fax3");
+      case Magick::Group4Compression:
+        return octave_value ("fax4");
+      case Magick::JPEGCompression:
+        return octave_value ("jpeg");
+      case Magick::LZWCompression:
+        return octave_value ("lzw");
+      case Magick::RLECompression:
+        // This is named "rle" for the HDF, but the same thing is named
+        // "ccitt" and "PackBits" for binary and non-binary images in TIFF.
+        return octave_value ("rle");
+      case Magick::ZipCompression:
+        return octave_value ("deflate");
+
+      // The following are present only in recent versions of GraphicsMagick.
+      // At the moment the only use of this would be to have imfinfo report
+      // the compression method. In the future, someone could implement
+      // the Compression option for imwrite in which case a macro in
+      // configure.ac will have to check for their presence of this.
+      // See bug #39913
+//      case Magick::LZMACompression:
+//        return octave_value ("lzma");
+//      case Magick::JPEG2000Compression:
+//        return octave_value ("jpeg2000");
+//      case Magick::JBIG1Compression:
+//        return octave_value ("jbig1");
+//      case Magick::JBIG2Compression:
+//        return octave_value ("jbig2");
+      default:
+        return octave_value ("undefined");
+    }
+}
+
+static octave_value
+magick_to_octave_value (const Magick::EndianType& magick)
+{
+  switch (magick)
+    {
+      case Magick::LSBEndian:
+        return octave_value ("little-endian");
+      case Magick::MSBEndian:
+        return octave_value ("big-endian");
+      default:
+        return octave_value ("undefined");
+    }
+}
 
-// Determine the file formats supported by GraphicsMagick.  This is
-// called once at the beginning of imread or imwrite to determine
-// exactly which file formats are supported, so error messages can be
-// displayed properly.
+static octave_value
+magick_to_octave_value (const Magick::OrientationType& magick)
+{
+  switch (magick)
+    {
+      // Values come from the TIFF6 spec
+      case Magick::TopLeftOrientation:
+        return octave_value (1);
+      case Magick::TopRightOrientation:
+        return octave_value (2);
+      case Magick::BottomRightOrientation:
+        return octave_value (3);
+      case Magick::BottomLeftOrientation:
+        return octave_value (4);
+      case Magick::LeftTopOrientation:
+        return octave_value (5);
+      case Magick::RightTopOrientation:
+        return octave_value (6);
+      case Magick::RightBottomOrientation:
+        return octave_value (7);
+      case Magick::LeftBottomOrientation:
+        return octave_value (8);
+      default:
+        return octave_value (1);
+    }
+}
+
+static octave_value
+magick_to_octave_value (const Magick::ResolutionType& magick)
+{
+  switch (magick)
+    {
+      case Magick::PixelsPerInchResolution:
+        return octave_value ("Inch");
+      case Magick::PixelsPerCentimeterResolution:
+        return octave_value ("Centimeter");
+      default:
+        return octave_value ("undefined");
+    }
+}
+
+// Meant to be shared with both imfinfo and imwrite.
+static std::map<octave_idx_type, std::string>
+init_disposal_methods ()
+{
+  //  GIF Specifications:
+  //
+  // Disposal Method - Indicates the way in which the graphic is to
+  //                    be treated after being displayed.
+  //
+  //  0 -   No disposal specified. The decoder is
+  //        not required to take any action.
+  //  1 -   Do not dispose. The graphic is to be left
+  //        in place.
+  //  2 -   Restore to background color. The area used by the
+  //        graphic must be restored to the background color.
+  //  3 -   Restore to previous. The decoder is required to
+  //        restore the area overwritten by the graphic with
+  //        what was there prior to rendering the graphic.
+  //  4-7 - To be defined.
+  static std::map<octave_idx_type, std::string> methods;
+  if (methods.empty ())
+    {
+      methods[0] = "doNotSpecify";
+      methods[1] = "leaveInPlace";
+      methods[2] = "restoreBG";
+      methods[3] = "restorePrevious";
+    }
+  return methods;
+}
 
-DEFUN_DLD (__magick_format_list__, args, ,
+static bool
+is_valid_exif (const std::string& val)
+{
+  // Sometimes GM will return the string "unknown" instead of empty
+  // for an empty value.
+  return (! val.empty () && val != "unknown");
+}
+
+static void
+fill_exif (octave_scalar_map& map, Magick::Image& img,
+           const std::string& key)
+{
+  const std::string attr = img.attribute ("EXIF:" + key);
+  if (is_valid_exif (attr))
+    map.setfield (key, octave_value (attr));
+  return;
+}
+
+static void
+fill_exif_ints (octave_scalar_map& map, Magick::Image& img,
+                const std::string& key)
+{
+  const std::string attr = img.attribute ("EXIF:" + key);
+  if (is_valid_exif (attr))
+    {
+      // string of the type "float,float,float....."
+      float number;
+      ColumnVector values (std::count (attr.begin (), attr.end (), ',') +1);
+      std::string sub;
+      std::istringstream sstream (attr);
+      octave_idx_type n = 0;
+      while (std::getline (sstream, sub, char (',')))
+        {
+          sscanf (sub.c_str (), "%f", &number);
+          values(n++) = number;
+        }
+      map.setfield (key, octave_value (values));
+    }
+  return;
+}
+
+static void
+fill_exif_floats (octave_scalar_map& map, Magick::Image& img,
+                  const std::string& key)
+{
+  const std::string attr = img.attribute ("EXIF:" + key);
+  if (is_valid_exif (attr))
+    {
+      // string of the type "int/int,int/int,int/int....."
+      int numerator;
+      int denominator;
+      ColumnVector values (std::count (attr.begin (), attr.end (), ',') +1);
+      std::string sub;
+      std::istringstream sstream (attr);
+      octave_idx_type n = 0;
+      while (std::getline (sstream, sub, ','))
+        {
+          sscanf (sub.c_str (), "%i/%i", &numerator, &denominator);
+          values(n++) = double (numerator) / double (denominator);
+        }
+      map.setfield (key, octave_value (values));
+    }
+  return;
+}
+
+#endif
+
+DEFUN_DLD (__magick_finfo__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __magick_format_list__ (@var{formats})\n\
-Undocumented internal function.\n\
+@deftypefn {Loadable Function} {} __magick_finfo__ (@var{fname})\n\
+Read image information with GraphicsMagick or ImageMagick.\n\
+\n\
+This is a private internal function not intended for direct use.  Instead\n\
+use @code{imfinfo}.\n\
+\n\
+@seealso{imfinfo, imformats, imread, imwrite}\n\
 @end deftypefn")
 {
   octave_value retval;
 
-#ifdef HAVE_MAGICK
+#ifndef HAVE_MAGICK
+  gripe_disabled_feature ("imfinfo", "Image IO");
+#else
   maybe_initialize_magick ();
 
-  std::list<std::string> accepted_formats;
+  if (args.length () < 1 || ! args(0).is_string ())
+    {
+      print_usage ();
+      return retval;
+    }
+  const std::string filename = args(0).string_value ();
 
-  if (args.length () == 1)
-    {
-      Cell c = args (0).cell_value ();
+  std::vector<Magick::Image> imvec;
+  read_file (filename, imvec);
+  if (error_state)
+    return retval;
+  const octave_idx_type nFrames = imvec.size ();
+  const std::string format = imvec[0].magick ();
 
-      if (! error_state)
-        {
-          for (octave_idx_type i = 0; i < c.nelem (); i++)
-            {
-              try
-                {
-                  std::string fmt = c.elem (i).string_value ();
+  // Here's how this function works. We need to return a struct array, one
+  // struct for each image in the file (remember, there are image
+  // that allow for multiple images in the same file). Now, Matlab seems
+  // to have format specific code so the fields on the struct are different
+  // for each format. It only has a small subset that is common to all
+  // of them, the others are undocumented. Because we try to abstract from
+  // the formats we always return the same list of fields (note that with
+  // GM we support more than 88 formats. That's way more than Matlab, and
+  // I don't want to write specific code for each of them).
+  //
+  // So what we do is we create an octave_scalar_map, fill it with the
+  // information for that image, and then insert it into an octave_map.
+  // Because in the same file, different images may have values for
+  // different fields, we can't create a field only if there's a value.
+  // Bad things happen if we merge octave_scalar_maps with different
+  // fields from the others (suppose for example a TIFF file with 4 images,
+  // where only the third image has a colormap.
+
+  static const char *fields[] =
+    {
+      // These are fields that must always appear for Matlab.
+      "Filename",
+      "FileModDate",
+      "FileSize",
+      "Format",
+      "FormatVersion",
+      "Width",
+      "Height",
+      "BitDepth",
+      "ColorType",
 
-                  Magick::CoderInfo info(fmt);
+      // These are format specific or not existent in Matlab. The most
+      // annoying thing is that Matlab may have different names for the
+      // same thing in different formats.
+      "DelayTime",
+      "DisposalMethod",
+      "LoopCount",
+      "ByteOrder",
+      "Gamma",
+      "Chromaticities",
+      "Comment",
+      "Quality",
+      "Compression",        // same as CompressionType
+      "Colormap",           // same as ColorTable (in PNG)
+      "Orientation",
+      "ResolutionUnit",
+      "XResolution",
+      "YResolution",
+      "Software",           // sometimes is an Exif tag
+      "Make",               // actually an Exif tag
+      "Model",              // actually an Exif tag
+      "DateTime",           // actually an Exif tag
+      "ImageDescription",   // actually an Exif tag
+      "Artist",             // actually an Exif tag
+      "Copyright",          // actually an Exif tag
+      "DigitalCamera",
+      "GPSInfo",
+      // Notes for the future: GM allows to get many attributes, and even has
+      // attribute() to obtain arbitrary ones, that may exist in only some
+      // cases. The following is a list of some methods and into what possible
+      // Matlab compatible values they may be converted.
+      //
+      //  colorSpace()      -> PhotometricInterpretation
+      //  backgroundColor() -> BackgroundColor
+      //  interlaceType()   -> Interlaced, InterlaceType, and PlanarConfiguration
+      //  label()           -> Title
+      0
+    };
 
-                  if (info.isReadable () && info.isWritable ())
-                    accepted_formats.push_back (fmt);
-                }
-              catch (Magick::Exception& e)
-                {
-                  // Do nothing: exception here are simply missing formats.
-                }
-            }
-        }
-      else
-        error ("__magick_format_list__: expecting a cell array of image format names");
+  // The one we will return at the end
+  octave_map info (dim_vector (nFrames, 1), string_vector (fields));
+
+  // Some of the fields in the struct are about file information and will be
+  // the same for all images in the file. So we create a template, fill in
+  // those values, and make a copy of the template for each image.
+  octave_scalar_map template_info = (string_vector (fields));
+
+  template_info.setfield ("Format", octave_value (format));
+  // We can't actually get FormatVersion but even Matlab sometimes can't.
+  template_info.setfield ("FormatVersion", octave_value (""));
+
+  const file_stat fs (filename);
+  if (fs)
+    {
+      const octave_localtime mtime (fs.mtime ());
+      const std::string filetime = mtime.strftime ("%e-%b-%Y %H:%M:%S");
+      template_info.setfield ("Filename",    octave_value (filename));
+      template_info.setfield ("FileModDate", octave_value (filetime));
+      template_info.setfield ("FileSize",    octave_value (fs.size ()));
     }
   else
-    print_usage ();
+    {
+      error ("imfinfo: error reading '%s': %s",
+             filename.c_str (), fs.error ().c_str ());
+      return retval;
+    }
+
+  for (octave_idx_type frame = 0; frame < nFrames; frame++)
+    {
+      octave_scalar_map info_frame (template_info);
+      const Magick::Image img = imvec[frame];
+
+      info_frame.setfield ("Width",  octave_value (img.columns ()));
+      info_frame.setfield ("Height", octave_value (img.rows ()));
+      info_frame.setfield ("BitDepth",
+        octave_value (get_depth (const_cast<Magick::Image&> (img))));
+
+      // Stuff related to colormap, image class and type
+      // Because GM is too smart for us... Read the comments in is_indexed()
+      {
+        std::string color_type;
+        Matrix cmap;
+        if (is_indexed (img))
+          {
+            color_type = "indexed";
+            cmap = read_maps (const_cast<Magick::Image&> (img))(0).matrix_value ();
+          }
+        else
+          {
+            switch (img.type ())
+              {
+                case Magick::BilevelType:
+                case Magick::GrayscaleType:
+                case Magick::GrayscaleMatteType:
+                  color_type = "grayscale";
+                  break;
+
+                case Magick::TrueColorType:
+                case Magick::TrueColorMatteType:
+                  color_type = "truecolor";
+                  break;
+
+                case Magick::PaletteType:
+                case Magick::PaletteMatteType:
+                  // we should never get here or is_indexed needs to be fixed
+                  color_type = "indexed";
+                  break;
+
+                case Magick::ColorSeparationType:
+                case Magick::ColorSeparationMatteType:
+                  color_type = "CMYK";
+                  break;
+
+                default:
+                  color_type = "undefined";
+              }
+          }
+        info_frame.setfield ("ColorType", octave_value (color_type));
+        info_frame.setfield ("Colormap",  octave_value (cmap));
+      }
+
+      {
+        // Not all images have chroma values. In such cases, they'll
+        // be all zeros. So rather than send a matrix of zeros, we will
+        // check for that, and send an empty vector instead.
+        RowVector chromaticities (8);
+        double* chroma_fvec = chromaticities.fortran_vec ();
+        img.chromaWhitePoint    (&chroma_fvec[0], &chroma_fvec[1]);
+        img.chromaRedPrimary    (&chroma_fvec[2], &chroma_fvec[3]);
+        img.chromaGreenPrimary  (&chroma_fvec[4], &chroma_fvec[5]);
+        img.chromaBluePrimary   (&chroma_fvec[6], &chroma_fvec[7]);
+        if (chromaticities.nnz () == 0)
+          chromaticities = RowVector (0);
+        info_frame.setfield ("Chromaticities", octave_value (chromaticities));
+      }
 
-  retval = Cell (accepted_formats);
+      info_frame.setfield ("Gamma",         octave_value (img.gamma ()));
+      info_frame.setfield ("XResolution",   octave_value (img.xResolution ()));
+      info_frame.setfield ("YResolution",   octave_value (img.yResolution ()));
+      info_frame.setfield ("DelayTime",     octave_value (img.animationDelay ()));
+      info_frame.setfield ("LoopCount",     octave_value (img.animationIterations ()));
+      info_frame.setfield ("Quality",       octave_value (img.quality ()));
+      info_frame.setfield ("Comment",       octave_value (img.comment ()));
+
+      info_frame.setfield ("Compression",
+        magick_to_octave_value (img.compressType ()));
+      info_frame.setfield ("Orientation",
+        magick_to_octave_value (img.orientation ()));
+      info_frame.setfield ("ResolutionUnit",
+        magick_to_octave_value (img.resolutionUnits ()));
+      info_frame.setfield ("ByteOrder",
+        magick_to_octave_value (img.endian ()));
+
+      // It is not possible to know if there's an Exif field so we just
+      // check for the Exif Version value. If it does exists, then we
+      // bother about looking for specific fields.
+      {
+        Magick::Image& cimg = const_cast<Magick::Image&> (img);
+
+        // These will be in Exif tags but must appear as fields in the
+        // base struct array, not as another struct in one of its fields.
+        // This is likely because they belong to the Baseline TIFF specs
+        // and may appear out of the Exif tag. So first we check if it
+        // exists outside the Exif tag.
+        // See Section 4.6.4, table 4, page 28 of Exif specs version 2.3
+        // (CIPA DC- 008-Translation- 2010)
+        static const char *base_exif_str_fields[] = {
+          "DateTime",
+          "ImageDescription",
+          "Make",
+          "Model",
+          "Software",
+          "Artist",
+          "Copyright",
+          0,
+        };
+        static const string_vector base_exif_str (base_exif_str_fields);
+        static const octave_idx_type n_base_exif_str = base_exif_str.numel ();
+        for (octave_idx_type field = 0; field < n_base_exif_str; field++)
+          {
+            info_frame.setfield (base_exif_str[field],
+              octave_value (cimg.attribute (base_exif_str[field])));
+            fill_exif (info_frame, cimg, base_exif_str[field]);
+          }
+
+        octave_scalar_map camera;
+        octave_scalar_map gps;
+        if (! cimg.attribute ("EXIF:ExifVersion").empty ())
+          {
+            // See Section 4.6.5, table 7 and 8, over pages page 42 to 43
+            // of Exif specs version 2.3 (CIPA DC- 008-Translation- 2010)
+
+            // Listed on the Exif specs as being of type ASCII.
+            static const char *exif_str_fields[] = {
+              "RelatedSoundFile",
+              "DateTimeOriginal",
+              "DateTimeDigitized",
+              "SubSecTime",
+              "DateTimeOriginal",
+              "SubSecTimeOriginal",
+              "SubSecTimeDigitized",
+              "ImageUniqueID",
+              "CameraOwnerName",
+              "BodySerialNumber",
+              "LensMake",
+              "LensModel",
+              "LensSerialNumber",
+              "SpectralSensitivity",
+              // These last two are of type undefined but most likely will
+              // be strings. Even if they're not GM returns a string anyway.
+              "UserComment",
+              "MakerComment",
+              0
+            };
+            static const string_vector exif_str (exif_str_fields);
+            static const octave_idx_type n_exif_str = exif_str.numel ();
+            for (octave_idx_type field = 0; field < n_exif_str; field++)
+              fill_exif (camera, cimg, exif_str[field]);
 
-#else
+            // Listed on the Exif specs as being of type SHORT or LONG.
+            static const char *exif_int_fields[] = {
+              "ColorSpace",
+              "ExifImageWidth",  // PixelXDimension (CPixelXDimension in Matlab)
+              "ExifImageHeight", // PixelYDimension (CPixelYDimension in Matlab)
+              "PhotographicSensitivity",
+              "StandardOutputSensitivity",
+              "RecommendedExposureIndex",
+              "ISOSpeed",
+              "ISOSpeedLatitudeyyy",
+              "ISOSpeedLatitudezzz",
+              "FocalPlaneResolutionUnit",
+              "FocalLengthIn35mmFilm",
+              // Listed as SHORT or LONG but with more than 1 count.
+              "SubjectArea",
+              "SubjectLocation",
+              // While the following are an integer, their value have a meaning
+              // that must be represented as a string for Matlab compatibility.
+              // For example, a 3 on ExposureProgram, would return
+              // "Aperture priority" as defined on the Exif specs.
+              "ExposureProgram",
+              "SensitivityType",
+              "MeteringMode",
+              "LightSource",
+              "Flash",
+              "SensingMethod",
+              "FileSource",
+              "CustomRendered",
+              "ExposureMode",
+              "WhiteBalance",
+              "SceneCaptureType",
+              "GainControl",
+              "Contrast",
+              "Saturation",
+              "Sharpness",
+              "SubjectDistanceRange",
+              0
+            };
+            static const string_vector exif_int (exif_int_fields);
+            static const octave_idx_type n_exif_int = exif_int.numel ();
+            for (octave_idx_type field = 0; field < n_exif_int; field++)
+              fill_exif_ints (camera, cimg, exif_int[field]);
+
+            // Listed as RATIONAL or SRATIONAL
+            static const char *exif_float_fields[] = {
+              "Gamma",
+              "CompressedBitsPerPixel",
+              "ExposureTime",
+              "FNumber",
+              "ShutterSpeedValue",  // SRATIONAL
+              "ApertureValue",
+              "BrightnessValue",    // SRATIONAL
+              "ExposureBiasValue",  // SRATIONAL
+              "MaxApertureValue",
+              "SubjectDistance",
+              "FocalLength",
+              "FlashEnergy",
+              "FocalPlaneXResolution",
+              "FocalPlaneYResolution",
+              "ExposureIndex",
+              "DigitalZoomRatio",
+              // Listed as RATIONAL or SRATIONAL with more than 1 count.
+              "LensSpecification",
+              0
+            };
+            static const string_vector exif_float (exif_float_fields);
+            static const octave_idx_type n_exif_float = exif_float.numel ();
+            for (octave_idx_type field = 0; field < n_exif_float; field++)
+              fill_exif_floats (camera, cimg, exif_float[field]);
+
+            // Inside a Exif field, it is possible that there is also a
+            // GPS field. This is not the same as ExifVersion but seems
+            // to be how we have to check for it.
+            if (cimg.attribute ("EXIF:GPSInfo") != "unknown")
+              {
+                // The story here is the same as with Exif.
+                // See Section 4.6.6, table 15 on page 68 of Exif specs
+                // version 2.3 (CIPA DC- 008-Translation- 2010)
 
-  error ("__magick_format_list__: not available in this version of Octave");
+                static const char *gps_str_fields[] = {
+                  "GPSLatitudeRef",
+                  "GPSLongitudeRef",
+                  "GPSAltitudeRef",
+                  "GPSSatellites",
+                  "GPSStatus",
+                  "GPSMeasureMode",
+                  "GPSSpeedRef",
+                  "GPSTrackRef",
+                  "GPSImgDirectionRef",
+                  "GPSMapDatum",
+                  "GPSDestLatitudeRef",
+                  "GPSDestLongitudeRef",
+                  "GPSDestBearingRef",
+                  "GPSDestDistanceRef",
+                  "GPSDateStamp",
+                  0
+                };
+                static const string_vector gps_str (gps_str_fields);
+                static const octave_idx_type n_gps_str = gps_str.numel ();
+                for (octave_idx_type field = 0; field < n_gps_str; field++)
+                  fill_exif (gps, cimg, gps_str[field]);
+
+                static const char *gps_int_fields[] = {
+                  "GPSDifferential",
+                  0
+                };
+                static const string_vector gps_int (gps_int_fields);
+                static const octave_idx_type n_gps_int = gps_int.numel ();
+                for (octave_idx_type field = 0; field < n_gps_int; field++)
+                  fill_exif_ints (gps, cimg, gps_int[field]);
 
+                static const char *gps_float_fields[] = {
+                  "GPSAltitude",
+                  "GPSDOP",
+                  "GPSSpeed",
+                  "GPSTrack",
+                  "GPSImgDirection",
+                  "GPSDestBearing",
+                  "GPSDestDistance",
+                  "GPSHPositioningError",
+                  // Listed as RATIONAL or SRATIONAL with more than 1 count.
+                  "GPSLatitude",
+                  "GPSLongitude",
+                  "GPSTimeStamp",
+                  "GPSDestLatitude",
+                  "GPSDestLongitude",
+                  0
+                };
+                static const string_vector gps_float (gps_float_fields);
+                static const octave_idx_type n_gps_float = gps_float.numel ();
+                for (octave_idx_type field = 0; field < n_gps_float; field++)
+                  fill_exif_floats (gps, cimg, gps_float[field]);
+
+              }
+          }
+        info_frame.setfield ("DigitalCamera", octave_value (camera));
+        info_frame.setfield ("GPSInfo",       octave_value (gps));
+      }
+
+      info.fast_elem_insert (frame, info_frame);
+    }
+
+  if (format == "GIF")
+    {
+      static std::map<octave_idx_type, std::string> disposal_methods
+        = init_disposal_methods ();
+      string_vector methods (nFrames);
+      for (octave_idx_type frame = 0; frame < nFrames; frame++)
+        methods[frame] = disposal_methods[imvec[frame].gifDisposeMethod ()];
+      info.setfield ("DisposalMethod", Cell (methods));
+    }
+  else
+    info.setfield ("DisposalMethod",
+                   Cell (dim_vector (nFrames, 1), octave_value ("")));
+
+  retval = octave_value (info);
 #endif
-
   return retval;
 }
 
@@ -1214,3 +2101,58 @@
 ## No test needed for internal helper function.
 %!assert (1)
 */
+
+DEFUN_DLD (__magick_formats__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} __magick_imformats__ (@var{formats})\n\
+Fill formats info with GraphicsMagick CoderInfo.\n\
+\n\
+@seealso{imfinfo, imformats, imread, imwrite}\n\
+@end deftypefn")
+{
+  octave_value retval;
+#ifndef HAVE_MAGICK
+  gripe_disabled_feature ("imformats", "Image IO");
+#else
+  if (args.length () != 1 || ! args(0).is_map ())
+    {
+      print_usage ();
+      return retval;
+    }
+  octave_map formats = args(0).map_value ();
+
+  maybe_initialize_magick ();
+  for (octave_idx_type idx = 0; idx < formats.numel (); idx++)
+    {
+      try
+        {
+          octave_scalar_map fmt = formats.checkelem (idx);
+          Magick::CoderInfo coder (fmt.getfield ("coder").string_value ());
+
+          fmt.setfield ("description", octave_value (coder.description ()));
+          fmt.setfield ("multipage", coder.isMultiFrame () ? true : false);
+          // default for read and write is a function handle. If we can't
+          // read or write them, them set it to an empty value
+          if (! coder.isReadable ())
+            fmt.setfield ("read",  Matrix ());
+          if (! coder.isWritable ())
+            fmt.setfield ("write", Matrix ());
+          formats.fast_elem_insert (idx, fmt);
+        }
+      catch (Magick::Exception& e)
+        {
+          // Exception here are missing formats. So we remove the format
+          // from the structure and reduce idx.
+          formats.delete_elements (idx);
+          idx--;
+        }
+    }
+  retval = formats;
+#endif
+  return retval;
+}
+
+/*
+## No test needed for internal helper function.
+%!assert (1)
+*/
--- a/libinterp/dldfcn/chol.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/chol.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -103,8 +103,8 @@
 @end ifnottex\n\
 \n\
 The sparsity preserving permutation is generally returned as a matrix.\n\
-However, given the flag \"vector\", @var{Q} will be returned as a vector\n\
-such that\n\
+However, given the flag @qcode{\"vector\"}, @var{Q} will be returned as a\n\
+vector such that\n\
 @tex\n\
 $ R^T R = A (Q, Q)$.\n\
 @end tex\n\
@@ -116,8 +116,8 @@
 \n\
 @end ifnottex\n\
 \n\
-Called with either a sparse or full matrix and using the \"lower\" flag,\n\
-@code{chol} returns the lower triangular factorization such that\n\
+Called with either a sparse or full matrix and using the @qcode{\"lower\"}\n\
+flag, @code{chol} returns the lower triangular factorization such that\n\
 @tex\n\
 $ L L^T = A $.\n\
 @end tex\n\
@@ -129,13 +129,13 @@
 \n\
 @end ifnottex\n\
 \n\
-For full matrices, if the \"lower\" flag is set only the lower triangular\n\
-part of the matrix is used for the factorization, otherwise the upper\n\
-triangular part is used.\n\
+For full matrices, if the @qcode{\"lower\"} flag is set only the lower\n\
+triangular part of the matrix is used for the factorization, otherwise the\n\
+upper triangular part is used.\n\
 \n\
 In general the lower triangular factorization is significantly faster for\n\
 sparse matrices.\n\
-@seealso{cholinv, chol2inv}\n\
+@seealso{hess, lu, qr, qz, schur, svd, cholinv, chol2inv, cholupdate, cholinsert, choldelete, cholshift}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -631,14 +631,14 @@
 @itemize @bullet\n\
 @item\n\
 @var{R1}'*@var{R1} = @var{R}'*@var{R} + @var{u}*@var{u}'\n\
-if @var{op} is \"+\"\n\
+if @var{op} is @qcode{\"+\"}\n\
 \n\
 @item\n\
 @var{R1}'*@var{R1} = @var{R}'*@var{R} - @var{u}*@var{u}'\n\
-if @var{op} is \"-\"\n\
+if @var{op} is @qcode{\"-\"}\n\
 @end itemize\n\
 \n\
-If @var{op} is \"-\", @var{info} is set to\n\
+If @var{op} is @qcode{\"-\"}, @var{info} is set to\n\
 \n\
 @itemize\n\
 @item 0 if the downdate was successful,\n\
@@ -649,7 +649,7 @@
 @end itemize\n\
 \n\
 If @var{info} is not present, an error message is printed in cases 1 and 2.\n\
-@seealso{chol, qrupdate}\n\
+@seealso{chol, cholinsert, choldelete, cholshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -849,7 +849,7 @@
 @end itemize\n\
 \n\
 If @var{info} is not present, an error message is printed in cases 1 and 2.\n\
-@seealso{chol, cholupdate, choldelete}\n\
+@seealso{chol, cholupdate, choldelete, cholshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -1097,7 +1097,7 @@
 positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper\n\
 triangular, return the Cholesky@tie{}factorization of @w{A(p,p)}, where\n\
 @w{p = [1:j-1,j+1:n+1]}.\n\
-@seealso{chol, cholupdate, cholinsert}\n\
+@seealso{chol, cholupdate, cholinsert, cholshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -1234,7 +1234,7 @@
  or @*\n\
 @code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}.  @*\n\
 \n\
-@seealso{chol, cholinsert, choldelete}\n\
+@seealso{chol, cholupdate, cholinsert, choldelete}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
--- a/libinterp/dldfcn/colamd.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/colamd.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -651,7 +651,8 @@
 is assumed to be symmetric and the symmetric elimination tree is\n\
 returned.  The argument @var{typ} controls whether a symmetric or\n\
 column elimination tree is returned.  Valid values of @var{typ} are\n\
-\"sym\" or \"col\", for symmetric or column elimination tree respectively\n\
+@qcode{\"sym\"} or @qcode{\"col\"}, for symmetric or column elimination tree\n\
+respectively.\n\
 \n\
 Called with a second argument, @code{etree} also returns the postorder\n\
 permutations on the tree.\n\
--- a/libinterp/dldfcn/eigs.cc	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1521 +0,0 @@
-/*
-
-Copyright (C) 2005-2012 David Bateman
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ov.h"
-#include "defun-dld.h"
-#include "error.h"
-#include "gripes.h"
-#include "quit.h"
-#include "variables.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-#include "oct-map.h"
-#include "pager.h"
-#include "unwind-prot.h"
-
-#include "eigs-base.cc"
-
-// Global pointer for user defined function.
-static octave_function *eigs_fcn = 0;
-
-// Have we warned about imaginary values returned from user function?
-static bool warned_imaginary = false;
-
-// Is this a recursive call?
-static int call_depth = 0;
-
-ColumnVector
-eigs_func (const ColumnVector &x, int &eigs_error)
-{
-  ColumnVector retval;
-  octave_value_list args;
-  args(0) = x;
-
-  if (eigs_fcn)
-    {
-      octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args);
-
-      if (error_state)
-        {
-          eigs_error = 1;
-          gripe_user_supplied_eval ("eigs");
-          return retval;
-        }
-
-      if (tmp.length () && tmp(0).is_defined ())
-        {
-          if (! warned_imaginary && tmp(0).is_complex_type ())
-            {
-              warning ("eigs: ignoring imaginary part returned from user-supplied function");
-              warned_imaginary = true;
-            }
-
-          retval = ColumnVector (tmp(0).vector_value ());
-
-          if (error_state)
-            {
-              eigs_error = 1;
-              gripe_user_supplied_eval ("eigs");
-            }
-        }
-      else
-        {
-          eigs_error = 1;
-          gripe_user_supplied_eval ("eigs");
-        }
-    }
-
-  return retval;
-}
-
-ComplexColumnVector
-eigs_complex_func (const ComplexColumnVector &x, int &eigs_error)
-{
-  ComplexColumnVector retval;
-  octave_value_list args;
-  args(0) = x;
-
-  if (eigs_fcn)
-    {
-      octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args);
-
-      if (error_state)
-        {
-          eigs_error = 1;
-          gripe_user_supplied_eval ("eigs");
-          return retval;
-        }
-
-      if (tmp.length () && tmp(0).is_defined ())
-        {
-          retval = ComplexColumnVector (tmp(0).complex_vector_value ());
-
-          if (error_state)
-            {
-              eigs_error = 1;
-              gripe_user_supplied_eval ("eigs");
-            }
-        }
-      else
-        {
-          eigs_error = 1;
-          gripe_user_supplied_eval ("eigs");
-        }
-    }
-
-  return retval;
-}
-
-DEFUN_DLD (eigs, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{d} =} eigs (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{k})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{k}, @var{sigma})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{k}, @var{sigma}, @var{opts})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{B}, @var{k})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{B}, @var{k}, @var{sigma})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{B})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{k})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{k}, @var{sigma})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts})\n\
-@deftypefnx {Loadable Function} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} eigs (@var{A}, @dots{})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} eigs (@var{af}, @var{n}, @dots{})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} eigs (@var{A}, @dots{})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} eigs (@var{af}, @var{n}, @dots{})\n\
-Calculate a limited number of eigenvalues and eigenvectors of @var{A},\n\
-based on a selection criteria.  The number of eigenvalues and eigenvectors to\n\
-calculate is given by @var{k} and defaults to 6.\n\
-\n\
-By default, @code{eigs} solve the equation\n\
-@tex\n\
-$A \\nu = \\lambda \\nu$,\n\
-@end tex\n\
-@ifinfo\n\
-@code{A * v = lambda * v},\n\
-@end ifinfo\n\
-where\n\
-@tex\n\
-$\\lambda$ is a scalar representing one of the eigenvalues, and $\\nu$\n\
-@end tex\n\
-@ifinfo\n\
-@code{lambda} is a scalar representing one of the eigenvalues, and @code{v}\n\
-@end ifinfo\n\
-is the corresponding eigenvector.  If given the positive definite matrix\n\
-@var{B} then @code{eigs} solves the general eigenvalue equation\n\
-@tex\n\
-$A \\nu = \\lambda B \\nu$.\n\
-@end tex\n\
-@ifinfo\n\
-@code{A * v = lambda * B * v}.\n\
-@end ifinfo\n\
-\n\
-The argument @var{sigma} determines which eigenvalues are returned.\n\
-@var{sigma} can be either a scalar or a string.  When @var{sigma} is a\n\
-scalar, the @var{k} eigenvalues closest to @var{sigma} are returned.  If\n\
-@var{sigma} is a string, it must have one of the following values.\n\
-\n\
-@table @asis\n\
-@item \"lm\"\n\
-Largest Magnitude (default).\n\
-\n\
-@item \"sm\"\n\
-Smallest Magnitude.\n\
-\n\
-@item \"la\"\n\
-Largest Algebraic (valid only for real symmetric problems).\n\
-\n\
-@item \"sa\"\n\
-Smallest Algebraic (valid only for real symmetric problems).\n\
-\n\
-@item \"be\"\n\
-Both Ends, with one more from the high-end if @var{k} is odd (valid only for\n\
-real symmetric problems).\n\
-\n\
-@item \"lr\"\n\
-Largest Real part (valid only for complex or unsymmetric problems).\n\
-\n\
-@item \"sr\"\n\
-Smallest Real part (valid only for complex or unsymmetric problems).\n\
-\n\
-@item \"li\"\n\
-Largest Imaginary part (valid only for complex or unsymmetric problems).\n\
-\n\
-@item \"si\"\n\
-Smallest Imaginary part (valid only for complex or unsymmetric problems).\n\
-@end table\n\
-\n\
-If @var{opts} is given, it is a structure defining possible options that\n\
-@code{eigs} should use.  The fields of the @var{opts} structure are:\n\
-\n\
-@table @code\n\
-@item issym\n\
-If @var{af} is given, then flags whether the function @var{af} defines a\n\
-symmetric problem.  It is ignored if @var{A} is given.  The default is false.\n\
-\n\
-@item isreal\n\
-If @var{af} is given, then flags whether the function @var{af} defines a\n\
-real problem.  It is ignored if @var{A} is given.  The default is true.\n\
-\n\
-@item tol\n\
-Defines the required convergence tolerance, calculated as\n\
-@code{tol * norm (A)}.  The default is @code{eps}.\n\
-\n\
-@item maxit\n\
-The maximum number of iterations.  The default is 300.\n\
-\n\
-@item p\n\
-The number of Lanzcos basis vectors to use.  More vectors will result in\n\
-faster convergence, but a greater use of memory.  The optimal value of\n\
-@code{p} is problem dependent and should be in the range @var{k} to @var{n}.\n\
-The default value is @code{2 * @var{k}}.\n\
-\n\
-@item v0\n\
-The starting vector for the algorithm.  An initial vector close to the\n\
-final vector will speed up convergence.  The default is for @sc{arpack}\n\
-to randomly generate a starting vector.  If specified, @code{v0} must be\n\
-an @var{n}-by-1 vector where @code{@var{n} = rows (@var{A})}\n\
-\n\
-@item disp\n\
-The level of diagnostic printout (0|1|2).  If @code{disp} is 0 then\n\
-diagnostics are disabled.  The default value is 0.\n\
-\n\
-@item cholB\n\
-Flag if @code{chol (@var{B})} is passed rather than @var{B}.  The default is\n\
-false.\n\
-\n\
-@item permB\n\
-The permutation vector of the Cholesky@tie{}factorization of @var{B} if\n\
-@code{cholB} is true.  That is @code{chol (@var{B}(permB, permB))}.  The\n\
-default is @code{1:@var{n}}.\n\
-\n\
-@end table\n\
-\n\
-It is also possible to represent @var{A} by a function denoted @var{af}.\n\
-@var{af} must be followed by a scalar argument @var{n} defining the length\n\
-of the vector argument accepted by @var{af}.  @var{af} can be\n\
-a function handle, an inline function, or a string.  When @var{af} is a\n\
-string it holds the name of the function to use.\n\
-\n\
-@var{af} is a function of the form @code{y = af (x)}\n\
-where the required return value of @var{af} is determined by\n\
-the value of @var{sigma}.  The four possible forms are\n\
-\n\
-@table @code\n\
-@item A * x\n\
-if @var{sigma} is not given or is a string other than \"sm\".\n\
-\n\
-@item A \\ x\n\
-if @var{sigma} is 0 or \"sm\".\n\
-\n\
-@item (A - sigma * I) \\ x\n\
-for the standard eigenvalue problem, where @code{I} is the identity matrix of\n\
-the same size as @var{A}.\n\
-\n\
-@item (A - sigma * B) \\ x\n\
-for the general eigenvalue problem.\n\
-@end table\n\
-\n\
-The return arguments of @code{eigs} depend on the number of return arguments\n\
-requested.  With a single return argument, a vector @var{d} of length @var{k}\n\
-is returned containing the @var{k} eigenvalues that have been found.  With\n\
-two return arguments, @var{V} is a @var{n}-by-@var{k} matrix whose columns\n\
-are the @var{k} eigenvectors corresponding to the returned eigenvalues.  The\n\
-eigenvalues themselves are returned in @var{d} in the form of a\n\
-@var{n}-by-@var{k} matrix, where the elements on the diagonal are the\n\
-eigenvalues.\n\
-\n\
-Given a third return argument @var{flag}, @code{eigs} returns the status\n\
-of the convergence.  If @var{flag} is 0 then all eigenvalues have converged.\n\
-Any other value indicates a failure to converge.\n\
-\n\
-This function is based on the @sc{arpack} package, written by R. Lehoucq,\n\
-K. Maschhoff, D. Sorensen, and C. Yang.  For more information see\n\
-@url{http://www.caam.rice.edu/software/ARPACK/}.\n\
-\n\
-@seealso{eig, svds}\n\
-@end deftypefn")
-{
-  octave_value_list retval;
-#ifdef HAVE_ARPACK
-  int nargin = args.length ();
-  std::string fcn_name;
-  octave_idx_type n = 0;
-  octave_idx_type k = 6;
-  Complex sigma = 0.;
-  double sigmar, sigmai;
-  bool have_sigma = false;
-  std::string typ = "LM";
-  Matrix amm, bmm, bmt;
-  ComplexMatrix acm, bcm, bct;
-  SparseMatrix asmm, bsmm, bsmt;
-  SparseComplexMatrix ascm, bscm, bsct;
-  int b_arg = 0;
-  bool have_b = false;
-  bool have_a_fun = false;
-  bool a_is_complex = false;
-  bool b_is_complex = false;
-  bool symmetric = false;
-  bool sym_tested = false;
-  bool cholB = false;
-  bool a_is_sparse = false;
-  ColumnVector permB;
-  int arg_offset = 0;
-  double tol = std::numeric_limits<double>::epsilon ();
-  int maxit = 300;
-  int disp = 0;
-  octave_idx_type p = -1;
-  ColumnVector resid;
-  ComplexColumnVector cresid;
-  octave_idx_type info = 1;
-
-  warned_imaginary = false;
-
-  unwind_protect frame;
-
-  frame.protect_var (call_depth);
-  call_depth++;
-
-  if (call_depth > 1)
-    {
-      error ("eigs: invalid recursive call");
-      if (fcn_name.length ())
-        clear_function (fcn_name);
-      return retval;
-    }
-
-  if (nargin == 0)
-    print_usage ();
-  else if (args(0).is_function_handle () || args(0).is_inline_function ()
-           || args(0).is_string ())
-    {
-      if (args(0).is_string ())
-        {
-          std::string name = args(0).string_value ();
-          std::string fname = "function y = ";
-          fcn_name = unique_symbol_name ("__eigs_fcn_");
-          fname.append (fcn_name);
-          fname.append ("(x) y = ");
-          eigs_fcn = extract_function (args(0), "eigs", fcn_name, fname,
-                                       "; endfunction");
-        }
-      else
-        eigs_fcn = args(0).function_value ();
-
-      if (!eigs_fcn)
-        {
-          error ("eigs: unknown function");
-          return retval;
-        }
-
-      if (nargin < 2)
-        {
-          error ("eigs: incorrect number of arguments");
-          return retval;
-        }
-      else
-        {
-          n = args(1).nint_value ();
-          arg_offset = 1;
-          have_a_fun = true;
-        }
-    }
-  else
-    {
-      if (args(0).is_complex_type ())
-        {
-          if (args(0).is_sparse_type ())
-            {
-              ascm = (args(0).sparse_complex_matrix_value ());
-              a_is_sparse = true;
-            }
-          else
-            acm = (args(0).complex_matrix_value ());
-          a_is_complex = true;
-          symmetric = false; // ARPACK doesn't special case complex symmetric
-          sym_tested = true;
-        }
-      else
-        {
-          if (args(0).is_sparse_type ())
-            {
-              asmm = (args(0).sparse_matrix_value ());
-              a_is_sparse = true;
-            }
-          else
-            {
-              amm = (args(0).matrix_value ());
-            }
-        }
-
-    }
-
-  // Note hold off reading B till later to avoid issues of double
-  // copies of the matrix if B is full/real while A is complex.
-  if (!error_state && nargin > 1 + arg_offset &&
-      !(args(1 + arg_offset).is_real_scalar ()))
-    {
-      if (args(1+arg_offset).is_complex_type ())
-        {
-          b_arg = 1+arg_offset;
-          have_b = true;
-          b_is_complex = true;
-          arg_offset++;
-        }
-      else
-        {
-          b_arg = 1+arg_offset;
-          have_b = true;
-          arg_offset++;
-        }
-    }
-
-  if (!error_state && nargin > (1+arg_offset))
-    k = args(1+arg_offset).nint_value ();
-
-  if (!error_state && nargin > (2+arg_offset))
-    {
-      if (args(2+arg_offset).is_string ())
-        {
-          typ = args(2+arg_offset).string_value ();
-
-          // Use STL function to convert to upper case
-          transform (typ.begin (), typ.end (), typ.begin (), toupper);
-
-          sigma = 0.;
-        }
-      else
-        {
-          sigma = args(2+arg_offset).complex_value ();
-
-          if (! error_state)
-            have_sigma = true;
-          else
-            {
-              error ("eigs: SIGMA must be a scalar or a string");
-              return retval;
-            }
-        }
-    }
-
-  sigmar = std::real (sigma);
-  sigmai = std::imag (sigma);
-
-  if (!error_state && nargin > (3+arg_offset))
-    {
-      if (args(3+arg_offset).is_map ())
-        {
-          octave_scalar_map map = args(3+arg_offset).scalar_map_value ();
-
-          if (! error_state)
-            {
-              octave_value tmp;
-
-              // issym is ignored for complex matrix inputs
-              tmp = map.getfield ("issym");
-              if (tmp.is_defined () && !sym_tested)
-                {
-                  symmetric = tmp.double_value () != 0.;
-                  sym_tested = true;
-                }
-
-              // isreal is ignored if A is not a function
-              tmp = map.getfield ("isreal");
-              if (tmp.is_defined () && have_a_fun)
-                a_is_complex = ! (tmp.double_value () != 0.);
-
-              tmp = map.getfield ("tol");
-              if (tmp.is_defined ())
-                tol = tmp.double_value ();
-
-              tmp = map.getfield ("maxit");
-              if (tmp.is_defined ())
-                maxit = tmp.nint_value ();
-
-              tmp = map.getfield ("p");
-              if (tmp.is_defined ())
-                p = tmp.nint_value ();
-
-              tmp = map.getfield ("v0");
-              if (tmp.is_defined ())
-                {
-                  if (a_is_complex || b_is_complex)
-                    cresid = ComplexColumnVector (tmp.complex_vector_value ());
-                  else
-                    resid = ColumnVector (tmp.vector_value ());
-                }
-
-              tmp = map.getfield ("disp");
-              if (tmp.is_defined ())
-                disp = tmp.nint_value ();
-
-              tmp = map.getfield ("cholB");
-              if (tmp.is_defined ())
-                cholB = tmp.double_value () != 0.;
-
-              tmp = map.getfield ("permB");
-              if (tmp.is_defined ())
-                permB = ColumnVector (tmp.vector_value ()) - 1.0;
-            }
-          else
-            {
-              error ("eigs: OPTS argument must be a scalar structure");
-              return retval;
-            }
-        }
-      else
-        {
-          error ("eigs: OPTS argument must be a structure");
-          return retval;
-        }
-    }
-
-  if (nargin > (4+arg_offset))
-    {
-      error ("eigs: incorrect number of arguments");
-      return retval;
-    }
-
-  // Test undeclared (no issym) matrix inputs for symmetry
-  if (!sym_tested && !have_a_fun)
-    {
-      if (a_is_sparse)
-        symmetric = asmm.is_symmetric ();
-      else
-        symmetric = amm.is_symmetric ();
-    }
-
-  if (have_b)
-    {
-      if (a_is_complex || b_is_complex)
-        {
-          if (a_is_sparse)
-            bscm = args(b_arg).sparse_complex_matrix_value ();
-          else
-            bcm = args(b_arg).complex_matrix_value ();
-        }
-      else
-        {
-          if (a_is_sparse)
-            bsmm = args(b_arg).sparse_matrix_value ();
-          else
-            bmm = args(b_arg).matrix_value ();
-        }
-    }
-
-  // Mode 1 for SM mode seems unstable for some reason.
-  // Use Mode 3 instead, with sigma = 0.
-  if (!error_state && !have_sigma && typ == "SM")
-    have_sigma = true;
-
-  if (!error_state)
-    {
-      octave_idx_type nconv;
-      if (a_is_complex || b_is_complex)
-        {
-          ComplexMatrix eig_vec;
-          ComplexColumnVector eig_val;
-
-
-          if (have_a_fun)
-            nconv = EigsComplexNonSymmetricFunc
-              (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, eig_val,
-               cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-          else if (have_sigma)
-            {
-              if (a_is_sparse)
-                nconv = EigsComplexNonSymmetricMatrixShift
-                  (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB,
-                   cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                   maxit);
-              else
-                nconv = EigsComplexNonSymmetricMatrixShift
-                  (acm, sigma, k, p, info, eig_vec, eig_val, bcm, permB, cresid,
-                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-            }
-          else
-            {
-              if (a_is_sparse)
-                nconv = EigsComplexNonSymmetricMatrix
-                  (ascm, typ, k, p, info, eig_vec, eig_val, bscm, permB, cresid,
-                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-              else
-                nconv = EigsComplexNonSymmetricMatrix
-                  (acm, typ, k, p, info, eig_vec, eig_val, bcm, permB, cresid,
-                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-            }
-
-          if (nargout < 2)
-            retval(0) = eig_val;
-          else
-            {
-              retval(2) = double (info);
-              retval(1) = ComplexDiagMatrix (eig_val);
-              retval(0) = eig_vec;
-            }
-        }
-      else if (sigmai != 0.)
-        {
-          // Promote real problem to a complex one.
-          ComplexMatrix eig_vec;
-          ComplexColumnVector eig_val;
-
-          if (have_a_fun)
-            nconv = EigsComplexNonSymmetricFunc
-              (eigs_complex_func, n, typ,  sigma, k, p, info, eig_vec, eig_val,
-               cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-          else
-            {
-              if (a_is_sparse)
-                nconv = EigsComplexNonSymmetricMatrixShift
-                  (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec,
-                   eig_val, SparseComplexMatrix (bsmm), permB, cresid,
-                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-              else
-                nconv = EigsComplexNonSymmetricMatrixShift
-                  (ComplexMatrix (amm), sigma, k, p, info, eig_vec,
-                   eig_val, ComplexMatrix (bmm), permB, cresid,
-                   octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
-            }
-
-          if (nargout < 2)
-            retval(0) = eig_val;
-          else
-            {
-              retval(2) = double (info);
-              retval(1) = ComplexDiagMatrix (eig_val);
-              retval(0) = eig_vec;
-            }
-        }
-      else
-        {
-          if (symmetric)
-            {
-              Matrix eig_vec;
-              ColumnVector eig_val;
-
-              if (have_a_fun)
-                nconv = EigsRealSymmetricFunc
-                  (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val,
-                   resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                   maxit);
-              else if (have_sigma)
-                {
-                  if (a_is_sparse)
-                    nconv = EigsRealSymmetricMatrixShift
-                      (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                  else
-                    nconv = EigsRealSymmetricMatrixShift
-                      (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                }
-              else
-                {
-                  if (a_is_sparse)
-                    nconv = EigsRealSymmetricMatrix
-                      (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                  else
-                    nconv = EigsRealSymmetricMatrix
-                      (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                }
-
-              if (nargout < 2)
-                retval(0) = eig_val;
-              else
-                {
-                  retval(2) = double (info);
-                  retval(1) = DiagMatrix (eig_val);
-                  retval(0) = eig_vec;
-                }
-            }
-          else
-            {
-              ComplexMatrix eig_vec;
-              ComplexColumnVector eig_val;
-
-              if (have_a_fun)
-                nconv = EigsRealNonSymmetricFunc
-                  (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val,
-                   resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                   maxit);
-              else if (have_sigma)
-                {
-                  if (a_is_sparse)
-                    nconv = EigsRealNonSymmetricMatrixShift
-                      (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                  else
-                    nconv = EigsRealNonSymmetricMatrixShift
-                      (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                }
-              else
-                {
-                  if (a_is_sparse)
-                    nconv = EigsRealNonSymmetricMatrix
-                      (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                  else
-                    nconv = EigsRealNonSymmetricMatrix
-                      (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
-                       resid, octave_stdout, tol, (nargout > 1), cholB, disp,
-                       maxit);
-                }
-
-              if (nargout < 2)
-                retval(0) = eig_val;
-              else
-                {
-                  retval(2) = double (info);
-                  retval(1) = ComplexDiagMatrix (eig_val);
-                  retval(0) = eig_vec;
-                }
-            }
-        }
-
-      if (nconv <= 0)
-        warning ("eigs: None of the %d requested eigenvalues converged", k);
-      else if (nconv < k)
-        warning ("eigs: Only %d of the %d requested eigenvalues converged",
-                 nconv, k);
-    }
-
-  if (! fcn_name.empty ())
-    clear_function (fcn_name);
-#else
-  error ("eigs: not available in this version of Octave");
-#endif
-
-  return retval;
-}
-
-/* #### SPARSE MATRIX VERSIONS #### */
-
-/*
-## Real positive definite tests, n must be even
-%!shared n, k, A, d0, d2
-%! n = 20;
-%! k = 4;
-%! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),4*ones(1,n),ones(1,n-2)]);
-%! d0 = eig (A);
-%! d2 = sort (d0);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); # initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (d1, d0(end:-1:(end-k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (d1, d0(k:-1:1), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "la");
-%! assert (d1, d2(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sa");
-%! assert (d1, d2(1:k), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "be");
-%! assert (d1, d2([1:floor(k/2), (end - ceil(k/2) + 1):end]), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1, "be");
-%! assert (d1, d2([1:floor((k+1)/2), (end - ceil((k+1)/2) + 1):end]), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (d1(idx1), d0(idx0(1:k)), 1e-11);
-%!testif HAVE_ARPACK, HAVE_CHOLMOD
-%! d1 = eigs (A, speye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (eigs (A, k, 4.1), eigs (A, speye (n), k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (eigs (A, k, 4.1), eigs (A, speye (n), k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (d1, d0(k:-1:1), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (d1, eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! AA = speye (10);
-%! fn = @(x) AA * x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! assert (eigs (fn, 10, AA, 3, "lm", opts), [1; 1; 1], 10*eps);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "la");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sa");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "be");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
-
-/*
-## Real unsymmetric tests
-%!shared n, k, A, d0
-%! n = 20;
-%! k = 4;
-%! A =  sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]);
-%! d0 = eig (A);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (abs (d1), abs (d0(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lr");
-%! [~, idx] = sort (real (d0));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "li");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "si");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
-%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_CHOLMOD
-%! d1 = eigs (A, speye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, speye (n), k, 4.1)), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, speye (n), k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (abs (d1), d0(1:k), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "li");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "si");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
-
-/*
-## Complex hermitian tests
-%!shared n, k, A, d0
-%! n = 20;
-%! k = 4;
-%! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[1i*ones(1,n-2),4*ones(1,n),-1i*ones(1,n-2)]);
-%! d0 = eig (A);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (abs (d1), abs (d0(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "li");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "si");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
-%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_CHOLMOD
-%! d1 = eigs (A, speye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, speye (n), k, 4.1, opts);
-%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
-%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
-%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
-%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, speye (n), k, 4.1)), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, speye (n), k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (abs (d1), d0(1:k), 1e-11);
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK, HAVE_UMFPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "li");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "si");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
-
-/* #### FULL MATRIX VERSIONS #### */
-
-/*
-## Real positive definite tests, n must be even
-%!shared n, k, A, d0, d2
-%! n = 20;
-%! k = 4;
-%! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),4*ones(1,n),ones(1,n-2)]));
-%! d0 = eig (A);
-%! d2 = sort (d0);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (d1, d0(end:-1:(end-k)),1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (d1, d0(k:-1:1), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "la");
-%! assert (d1, d2(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sa");
-%! assert (d1, d2(1:k), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "be");
-%! assert (d1, d2([1:floor(k/2), (end - ceil(k/2) + 1):end]), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1, "be");
-%! assert (d1, d2([1:floor((k+1)/2), (end - ceil((k+1)/2) + 1):end]), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (d1(idx1), d0(idx0(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, eye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (eigs (A, k, 4.1), eigs (A, eye (n), k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (eigs (A, k, 4.1), eigs (A, eye (n), k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (d1, d0(k:-1:1), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 1;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (d1, eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "la");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sa");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "be");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
-
-/*
-## Real unsymmetric tests
-%!shared n, k, A, d0
-%! n = 20;
-%! k = 4;
-%! A =  full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]));
-%! d0 = eig (A);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (abs (d1), abs (d0(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lr");
-%! [~, idx] = sort (real (d0));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "li");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "si");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
-%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, eye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, eye (n), k, 4.1)), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, eye (n), k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (abs (d1), d0(1:k), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 0;  opts.isreal = 1;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "li");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "si");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
-
-/*
-## Complex hermitian tests
-%!shared n, k, A, d0
-%! n = 20;
-%! k = 4;
-%! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[1i*ones(1,n-2),4*ones(1,n),-1i*ones(1,n-2)]));
-%! d0 = eig (A);
-%! [~, idx] = sort (abs (d0));
-%! d0 = d0(idx);
-%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k+1);
-%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sm");
-%! assert (abs (d1), abs (d0(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "lr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "sr");
-%! [~, idx] = sort (real (abs (d0)));
-%! d2 = d0(idx);
-%! assert (real (d1), real (d2(1:k)), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "li");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, "si");
-%! [~, idx] = sort (imag (abs (d0)));
-%! d2 = d0(idx);
-%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, k, 4.1);
-%! [~, idx0] = sort (abs (d0 - 4.1));
-%! [~, idx1] = sort (abs (d1 - 4.1));
-%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
-%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
-%!testif HAVE_ARPACK
-%! d1 = eigs (A, eye (n), k, "lm");
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! d1 = eigs (A, eye (n), k, 4.1, opts);
-%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
-%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! opts.cholB = true;
-%! q = [2:n,1];
-%! opts.permB = q;
-%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
-%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
-%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, eye (n), k, 4.1)), 1e-11);
-%!testif HAVE_ARPACK
-%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, eye (n), k, 4.1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A * x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, "lm", opts);
-%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) A \ x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, "sm", opts);
-%! assert (abs (d1), d0(1:k), 1e-11);
-%!testif HAVE_ARPACK
-%! fn = @(x) (A - 4.1 * eye (n)) \ x;
-%! opts.issym = 0;  opts.isreal = 0;
-%! d1 = eigs (fn, n, k, 4.1, opts);
-%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sm");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "lr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "sr");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "li");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-%!testif HAVE_ARPACK
-%! [v1,d1] = eigs (A, k, "si");
-%! d1 = diag (d1);
-%! for i=1:k
-%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
-%! endfor
-*/
--- a/libinterp/dldfcn/fftw.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/fftw.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -70,31 +70,32 @@
 wisdom can be treated:\n\
 \n\
 @table @asis\n\
-@item \"estimate\"\n\
+@item @qcode{\"estimate\"}\n\
 Specifies that no run-time measurement of the optimal means of\n\
 calculating a particular is performed, and a simple heuristic is used\n\
 to pick a (probably sub-optimal) plan.  The advantage of this method is\n\
 that there is little or no overhead in the generation of the plan, which\n\
 is appropriate for a Fourier transform that will be calculated once.\n\
 \n\
-@item \"measure\"\n\
+@item @qcode{\"measure\"}\n\
 In this case a range of algorithms to perform the transform is considered\n\
 and the best is selected based on their execution time.\n\
 \n\
-@item \"patient\"\n\
-Similar to \"measure\", but a wider range of algorithms is considered.\n\
+@item @qcode{\"patient\"}\n\
+Similar to @qcode{\"measure\"}, but a wider range of algorithms is\n\
+considered.\n\
 \n\
-@item \"exhaustive\"\n\
-Like \"measure\", but all possible algorithms that may be used to\n\
+@item @qcode{\"exhaustive\"}\n\
+Like @qcode{\"measure\"}, but all possible algorithms that may be used to\n\
 treat the transform are considered.\n\
 \n\
-@item \"hybrid\"\n\
+@item @qcode{\"hybrid\"}\n\
 As run-time measurement of the algorithm can be expensive, this is a\n\
-compromise where \"measure\" is used for transforms up to the size of 8192\n\
-and beyond that the \"estimate\" method is used.\n\
+compromise where @qcode{\"measure\"} is used for transforms up to the size\n\
+of 8192 and beyond that the @qcode{\"estimate\"} method is used.\n\
 @end table\n\
 \n\
-The default method is \"estimate\".  The current method can\n\
+The default method is @qcode{\"estimate\"}.  The current method can\n\
 be queried with\n\
 \n\
 @example\n\
--- a/libinterp/dldfcn/module-files	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/module-files	Sat Oct 05 11:22:09 2013 -0400
@@ -1,9 +1,10 @@
 # FILE|CPPFLAGS|LDFLAGS|LIBRARIES
 __delaunayn__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
 __dsearchn__.cc
+__eigs__.cc|$(ARPACK_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(ARPACK_LDFLAGS) $(SPARSE_XLDFLAGS)|$(ARPACK_LIBS) $(SPARSE_XLIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
 __fltk_uigetfile__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS)
 __glpk__.cc|$(GLPK_CPPFLAGS)|$(GLPK_LDFLAGS)|$(GLPK_LIBS)
-__init_fltk__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS)
+__init_fltk__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS) $(OPENGL_LIBS)
 __init_gnuplot__.cc
 __magick_read__.cc|$(MAGICK_CPPFLAGS)|$(MAGICK_LDFLAGS)|$(MAGICK_LIBS)
 __voronoi__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
@@ -13,10 +14,8 @@
 colamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 convhulln.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
 dmperm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-eigs.cc|$(ARPACK_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(ARPACK_LDFLAGS) $(SPARSE_XLDFLAGS)|$(ARPACK_LIBS) $(SPARSE_XLIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
 fftw.cc|$(FFTW_XCPPFLAGS)|$(FFTW_XLDFLAGS)|$(FFTW_XLIBS)
 qr.cc|$(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(QRUPDATE_LDFLAGS) $(SPARSE_XLDFLAGS)|$(QRUPDATE_LIBS) $(SPARSE_XLIBS)
 symbfact.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 symrcm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 tsearch.cc
-urlwrite.cc|$(CURL_CPPFLAGS)|$(CURL_LDFLAGS)|$(CURL_LIBS)
--- a/libinterp/dldfcn/qr.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/qr.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -133,7 +133,7 @@
 @var{R} is upper triangular.\n\
 @end ifnottex\n\
 \n\
-If given a second argument of '0', @code{qr} returns an economy-sized\n\
+If given a second argument of @qcode{'0'}, @code{qr} returns an economy-sized\n\
 QR@tie{}factorization, omitting zero rows of @var{R} and the corresponding\n\
 columns of @var{Q}.\n\
 \n\
@@ -194,6 +194,7 @@
 x = @var{R} \\ @var{C}\n\
 @end group\n\
 @end example\n\
+@seealso{chol, hess, lu, qz, schur, svd, qrupdate, qrinsert, qrdelete, qrshift}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -769,7 +770,7 @@
 The QR@tie{}factorization supplied may be either full\n\
 (Q is square) or economized (R is square).\n\
 \n\
-@seealso{qr, qrinsert, qrdelete}\n\
+@seealso{qr, qrinsert, qrdelete, qrshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -941,13 +942,13 @@
 @w{@var{A} = @var{Q}*@var{R}}, @var{Q}@tie{}unitary and\n\
 @var{R}@tie{}upper trapezoidal, return the QR@tie{}factorization of\n\
 @w{[A(:,1:j-1) x A(:,j:n)]}, where @var{u} is a column vector to be\n\
-inserted into @var{A} (if @var{orient} is @code{\"col\"}), or the\n\
+inserted into @var{A} (if @var{orient} is @qcode{\"col\"}), or the\n\
 QR@tie{}factorization of @w{[A(1:j-1,:);x;A(:,j:n)]}, where @var{x}\n\
 is a row vector to be inserted into @var{A} (if @var{orient} is\n\
-@code{\"row\"}).\n\
+@qcode{\"row\"}).\n\
 \n\
-The default value of @var{orient} is @code{\"col\"}.\n\
-If @var{orient} is @code{\"col\"},\n\
+The default value of @var{orient} is @qcode{\"col\"}.\n\
+If @var{orient} is @qcode{\"col\"},\n\
 @var{u} may be a matrix and @var{j} an index vector\n\
 resulting in the QR@tie{}factorization of a matrix @var{B} such that\n\
 @w{B(:,@var{j})} gives @var{u} and @w{B(:,@var{j}) = []} gives @var{A}.\n\
@@ -955,12 +956,12 @@
 thus, for k large enough, it will be both faster and more accurate to\n\
 recompute the factorization from scratch.\n\
 \n\
-If @var{orient} is @code{\"col\"},\n\
+If @var{orient} is @qcode{\"col\"},\n\
 the QR@tie{}factorization supplied may be either full\n\
 (Q is square) or economized (R is square).\n\
 \n\
-If @var{orient} is @code{\"row\"}, full factorization is needed.\n\
-@seealso{qr, qrupdate, qrdelete}\n\
+If @var{orient} is @qcode{\"row\"}, full factorization is needed.\n\
+@seealso{qr, qrupdate, qrdelete, qrshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -1160,13 +1161,13 @@
 @w{@var{A} = @var{Q}*@var{R}}, @var{Q}@tie{}unitary and\n\
 @var{R}@tie{}upper trapezoidal, return the QR@tie{}factorization of\n\
 @w{[A(:,1:j-1) A(:,j+1:n)]}, i.e., @var{A} with one column deleted\n\
-(if @var{orient} is \"col\"), or the QR@tie{}factorization of\n\
+(if @var{orient} is @qcode{\"col\"}), or the QR@tie{}factorization of\n\
 @w{[A(1:j-1,:);A(j+1:n,:)]}, i.e., @var{A} with one row deleted (if\n\
-@var{orient} is \"row\").\n\
+@var{orient} is @qcode{\"row\"}).\n\
 \n\
-The default value of @var{orient} is \"col\".\n\
+The default value of @var{orient} is @qcode{\"col\"}.\n\
 \n\
-If @var{orient} is @code{\"col\"},\n\
+If @var{orient} is @qcode{\"col\"},\n\
 @var{j} may be an index vector\n\
 resulting in the QR@tie{}factorization of a matrix @var{B} such that\n\
 @w{A(:,@var{j}) = []} gives @var{B}.\n\
@@ -1174,12 +1175,12 @@
 thus, for k large enough, it will be both faster and more accurate to\n\
 recompute the factorization from scratch.\n\
 \n\
-If @var{orient} is @code{\"col\"},\n\
+If @var{orient} is @qcode{\"col\"},\n\
 the QR@tie{}factorization supplied may be either full\n\
 (Q is square) or economized (R is square).\n\
 \n\
-If @var{orient} is @code{\"row\"}, full factorization is needed.\n\
-@seealso{qr, qrinsert, qrupdate}\n\
+If @var{orient} is @qcode{\"row\"}, full factorization is needed.\n\
+@seealso{qr, qrupdate, qrinsert, qrshift}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
@@ -1391,7 +1392,7 @@
 %! assert (norm (vec (triu (R) - R), Inf) == 0);
 %! assert (norm (vec (Q*R - [AA(1:2,:);AA(4:5,:)]), Inf) < norm (AA)*1e1*eps ("single"));
 %!testif HAVE_QRUPDATE
-%! # Same test as above but with more precicision
+%! ## Same test as above but with more precicision
 %! AA = single ([0.091364  0.613038  0.027504  0.999083;
 %!               0.594638  0.425302  0.562834  0.603537;
 %!               0.383594  0.291238  0.742073  0.085574;
@@ -1429,7 +1430,7 @@
  or @*\n\
 @code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}.  @*\n\
 \n\
-@seealso{qr, qrinsert, qrdelete}\n\
+@seealso{qr, qrupdate, qrinsert, qrdelete}\n\
 @end deftypefn")
 {
   octave_idx_type nargin = args.length ();
--- a/libinterp/dldfcn/symbfact.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/dldfcn/symbfact.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -63,18 +63,18 @@
 Factorize @code{@var{S}' * @var{S}}.\n\
 \n\
 @item row\n\
-Factorize @xcode{@var{S} * @var{S}'}.\n\
+Factorize @tcode{@var{S} * @var{S}'}.\n\
 \n\
 @item lo\n\
-Factorize @xcode{@var{S}'}\n\
+Factorize @tcode{@var{S}'}\n\
 @end table\n\
 \n\
 @item mode\n\
 The default is to return the Cholesky@tie{}factorization for @var{r}, and if\n\
-@var{mode} is 'L', the conjugate transpose of the Cholesky@tie{}factorization\n\
-is returned.  The conjugate transpose version is faster and uses less\n\
-memory, but returns the same values for @var{count}, @var{h}, @var{parent}\n\
-and @var{post} outputs.\n\
+@var{mode} is @qcode{'L'}, the conjugate transpose of the\n\
+Cholesky@tie{}factorization is returned.  The conjugate transpose version is\n\
+faster and uses less memory, but returns the same values for @var{count},\n\
+@var{h}, @var{parent} and @var{post} outputs.\n\
 @end table\n\
 \n\
 The output variables are\n\
--- a/libinterp/dldfcn/urlwrite.cc	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1742 +0,0 @@
-// urlwrite and urlread, a curl front-end for octave
-/*
-
-Copyright (C) 2006-2012 Alexander Barth
-Copyright (C) 2009 David Bateman
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-// Author: Alexander Barth <abarth@marine.usf.edu>
-// Adapted-By: jwe
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-
-#include "dir-ops.h"
-#include "file-ops.h"
-#include "file-stat.h"
-#include "oct-env.h"
-#include "glob-match.h"
-
-#include "defun-dld.h"
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-cell.h"
-#include "pager.h"
-#include "oct-map.h"
-#include "oct-refcount.h"
-#include "unwind-prot.h"
-
-#ifdef HAVE_CURL
-
-#include <curl/curl.h>
-#include <curl/curlver.h>
-#include <curl/easy.h>
-
-static int
-write_data (void *buffer, size_t size, size_t nmemb, void *streamp)
-{
-  std::ostream& stream = *(static_cast<std::ostream*> (streamp));
-  stream.write (static_cast<const char*> (buffer), size*nmemb);
-  return (stream.fail () ? 0 : size * nmemb);
-}
-
-static int
-read_data (void *buffer, size_t size, size_t nmemb, void *streamp)
-{
-  std::istream& stream = *(static_cast<std::istream*> (streamp));
-  stream.read (static_cast<char*> (buffer), size*nmemb);
-  if (stream.eof ())
-    return stream.gcount ();
-  else
-    return (stream.fail () ? 0 : size * nmemb);
-}
-
-static size_t
-throw_away (void *, size_t size, size_t nmemb, void *)
-{
-  return static_cast<size_t>(size * nmemb);
-}
-
-class
-curl_handle
-{
-private:
-  class
-  curl_handle_rep
-  {
-  public:
-    curl_handle_rep (void) : count (1), valid (true), ascii (false)
-      {
-        curl = curl_easy_init ();
-        if (!curl)
-          error ("can not create curl handle");
-      }
-
-    ~curl_handle_rep (void)
-      {
-        if (curl)
-          curl_easy_cleanup (curl);
-      }
-
-    bool is_valid (void) const
-      {
-        return valid;
-      }
-
-    bool perform (bool curlerror) const
-      {
-        bool retval = false;
-        if (!error_state)
-          {
-            BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-
-            errnum = curl_easy_perform (curl);
-            if (errnum != CURLE_OK)
-              {
-                if (curlerror)
-                  error ("%s", curl_easy_strerror (errnum));
-              }
-            else
-              retval = true;
-
-            END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-          }
-        return retval;
-      }
-
-    CURL* handle (void) const
-      {
-        return curl;
-      }
-
-    bool is_ascii (void) const
-      {
-        return ascii;
-      }
-
-    bool is_binary (void) const
-      {
-        return !ascii;
-      }
-
-    octave_refcount<size_t> count;
-    std::string host;
-    std::string url;
-    std::string userpwd;
-    bool valid;
-    bool ascii;
-    mutable CURLcode errnum;
-
-  private:
-    CURL *curl;
-
-    // No copying!
-
-    curl_handle_rep (const curl_handle_rep& ov);
-
-    curl_handle_rep& operator = (const curl_handle_rep&);
-  };
-
-public:
-
-// I'd love to rewrite this as a private method of the curl_handle
-// class, but you can't pass the va_list from the wrapper setopt to
-// the curl_easy_setopt function.
-#define setopt(option, parameter) \
-  { \
-    CURLcode res = curl_easy_setopt (rep->handle (), option, parameter); \
-    if (res != CURLE_OK) \
-      error ("%s", curl_easy_strerror (res)); \
-  }
-
-  curl_handle (void) : rep (new curl_handle_rep ())
-    {
-      rep->valid = false;
-    }
-
-  curl_handle (const std::string& _host, const std::string& user,
-               const std::string& passwd) :
-    rep (new curl_handle_rep ())
-    {
-      rep->host = _host;
-      init (user, passwd, std::cin, octave_stdout);
-
-      rep->url = "ftp://" + _host;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-
-      // Setup the link, with no transfer
-      if (!error_state)
-        perform ();
-    }
-
-  curl_handle (const std::string& url, const std::string& method,
-               const Cell& param, std::ostream& os, bool& retval) :
-    rep (new curl_handle_rep ())
-    {
-      retval = false;
-
-      init ("", "", std::cin, os);
-
-      setopt (CURLOPT_NOBODY, 0);
-
-      // Restore the default HTTP request method to GET after setting
-      // NOBODY to true and back to false.  This is needed for backward
-      // compatibility with versions of libcurl < 7.18.2.
-      setopt (CURLOPT_HTTPGET, 1);
-
-      // Don't need to store the parameters here as we can't change
-      // the URL after the handle is created
-      std::string query_string = form_query_string (param);
-
-      if (method == "get")
-        {
-          query_string = url + "?" + query_string;
-          setopt (CURLOPT_URL, query_string.c_str ());
-        }
-      else if (method == "post")
-        {
-          setopt (CURLOPT_URL, url.c_str ());
-          setopt (CURLOPT_POSTFIELDS, query_string.c_str ());
-        }
-      else
-        setopt (CURLOPT_URL, url.c_str ());
-
-      if (!error_state)
-        retval = perform (false);
-    }
-
-  curl_handle (const curl_handle& h) : rep (h.rep)
-    {
-      rep->count++;
-    }
-
-  ~curl_handle (void)
-    {
-      if (--rep->count == 0)
-        delete rep;
-    }
-
-  curl_handle& operator = (const curl_handle& h)
-    {
-      if (this != &h)
-        {
-          if (--rep->count == 0)
-            delete rep;
-
-          rep = h.rep;
-          rep->count++;
-        }
-      return *this;
-    }
-
-  bool is_valid (void) const
-    {
-      return rep->is_valid ();
-    }
-
-  std::string lasterror (void) const
-    {
-      return std::string (curl_easy_strerror (rep->errnum));
-    }
-
-  void set_ostream (std::ostream& os) const
-    {
-      setopt (CURLOPT_WRITEDATA, static_cast<void*> (&os));
-    }
-
-  void set_istream (std::istream& is) const
-    {
-      setopt (CURLOPT_READDATA, static_cast<void*> (&is));
-    }
-
-  void ascii (void) const
-    {
-      setopt (CURLOPT_TRANSFERTEXT, 1);
-      rep->ascii = true;
-    }
-
-  void binary (void) const
-    {
-      setopt (CURLOPT_TRANSFERTEXT, 0);
-      rep->ascii = false;
-    }
-
-  bool is_ascii (void) const
-    {
-      return rep->is_ascii ();
-    }
-
-  bool is_binary (void) const
-    {
-      return rep->is_binary ();
-    }
-
-  void cwd (const std::string& path) const
-    {
-      struct curl_slist *slist = 0;
-      std::string cmd = "cwd " + path;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      setopt (CURLOPT_POSTQUOTE, slist);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-    }
-
-  void del (const std::string& file) const
-    {
-      struct curl_slist *slist = 0;
-      std::string cmd = "dele " + file;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      setopt (CURLOPT_POSTQUOTE, slist);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-    }
-
-  void rmdir (const std::string& path) const
-    {
-      struct curl_slist *slist = 0;
-      std::string cmd = "rmd " + path;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      setopt (CURLOPT_POSTQUOTE, slist);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-    }
-
-  bool mkdir (const std::string& path, bool curlerror = true) const
-    {
-      bool retval = false;
-      struct curl_slist *slist = 0;
-      std::string cmd = "mkd " + path;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      setopt (CURLOPT_POSTQUOTE, slist);
-      if (! error_state)
-        retval = perform (curlerror);
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-      return retval;
-    }
-
-  void rename (const std::string& oldname, const std::string& newname) const
-    {
-      struct curl_slist *slist = 0;
-      std::string cmd = "rnfr " + oldname;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      cmd = "rnto " + newname;
-      slist = curl_slist_append (slist, cmd.c_str ());
-      setopt (CURLOPT_POSTQUOTE, slist);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-    }
-
-  void put (const std::string& file, std::istream& is) const
-    {
-      rep->url = "ftp://" + rep->host + "/" + file;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-      setopt (CURLOPT_UPLOAD, 1);
-      setopt (CURLOPT_NOBODY, 0);
-      set_istream (is);
-      if (! error_state)
-        perform ();
-      set_istream (std::cin);
-      setopt (CURLOPT_NOBODY, 1);
-      setopt (CURLOPT_UPLOAD, 0);
-      rep->url = "ftp://" + rep->host;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-    }
-
-  void get (const std::string& file, std::ostream& os) const
-    {
-      rep->url = "ftp://" + rep->host + "/" + file;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-      setopt (CURLOPT_NOBODY, 0);
-      set_ostream (os);
-      if (! error_state)
-        perform ();
-      set_ostream (octave_stdout);
-      setopt (CURLOPT_NOBODY, 1);
-      rep->url = "ftp://" + rep->host;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-    }
-
-  void dir (void) const
-    {
-      rep->url = "ftp://" + rep->host + "/";
-      setopt (CURLOPT_URL, rep->url.c_str ());
-      setopt (CURLOPT_NOBODY, 0);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_NOBODY, 1);
-      rep->url = "ftp://" + rep->host;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-    }
-
-  string_vector list (void) const
-    {
-      std::ostringstream buf;
-      rep->url = "ftp://" + rep->host + "/";
-      setopt (CURLOPT_WRITEDATA, static_cast<void*> (&buf));
-      setopt (CURLOPT_URL, rep->url.c_str ());
-      setopt (CURLOPT_DIRLISTONLY, 1);
-      setopt (CURLOPT_NOBODY, 0);
-      if (! error_state)
-        perform ();
-      setopt (CURLOPT_NOBODY, 1);
-      rep->url = "ftp://" + rep->host;
-      setopt (CURLOPT_WRITEDATA, static_cast<void*> (&octave_stdout));
-      setopt (CURLOPT_DIRLISTONLY, 0);
-      setopt (CURLOPT_URL, rep->url.c_str ());
-
-      // Count number of directory entries
-      std::string str = buf.str ();
-      octave_idx_type n = 0;
-      size_t pos = 0;
-      while (true)
-        {
-          pos = str.find_first_of ('\n', pos);
-          if (pos == std::string::npos)
-            break;
-          pos++;
-          n++;
-        }
-      string_vector retval (n);
-      pos = 0;
-      for (octave_idx_type i = 0; i < n; i++)
-        {
-          size_t newpos = str.find_first_of ('\n', pos);
-          if (newpos == std::string::npos)
-            break;
-
-          retval(i) = str.substr(pos, newpos - pos);
-          pos = newpos + 1;
-        }
-      return retval;
-    }
-
-  void get_fileinfo (const std::string& filename, double& filesize,
-                     time_t& filetime, bool& fileisdir) const
-    {
-      std::string path = pwd ();
-
-      rep->url = "ftp://" + rep->host + "/" + path + "/" + filename;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-      setopt (CURLOPT_FILETIME, 1);
-      setopt (CURLOPT_HEADERFUNCTION, throw_away);
-      setopt (CURLOPT_WRITEFUNCTION, throw_away);
-
-      // FIXME
-      // The MDTM command fails for a directory on the servers I tested
-      // so this is a means of testing for directories. It also means
-      // I can't get the date of directories!
-      if (! error_state)
-        {
-          if (! perform (false))
-            {
-              fileisdir = true;
-              filetime = -1;
-              filesize = 0;
-            }
-          else
-            {
-              fileisdir = false;
-              time_t ft;
-              curl_easy_getinfo (rep->handle (), CURLINFO_FILETIME, &ft);
-              filetime = ft;
-              double fs;
-              curl_easy_getinfo (rep->handle (),
-                                 CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fs);
-              filesize = fs;
-            }
-        }
-
-      setopt (CURLOPT_WRITEFUNCTION, write_data);
-      setopt (CURLOPT_HEADERFUNCTION, 0);
-      setopt (CURLOPT_FILETIME, 0);
-      rep->url = "ftp://" + rep->host;
-      setopt (CURLOPT_URL, rep->url.c_str ());
-
-      // The MDTM command seems to reset the path to the root with the
-      // servers I tested with, so cd again into the correct path. Make
-      // the path absolute so that this will work even with servers that
-      // don't end up in the root after an MDTM command.
-      cwd ("/" + path);
-    }
-
-  std::string pwd (void) const
-    {
-      struct curl_slist *slist = 0;
-      std::string retval;
-      std::ostringstream buf;
-
-      slist = curl_slist_append (slist, "pwd");
-      setopt (CURLOPT_POSTQUOTE, slist);
-      setopt (CURLOPT_HEADERFUNCTION, write_data);
-      setopt (CURLOPT_WRITEHEADER, static_cast<void *>(&buf));
-
-      if (! error_state)
-        {
-          perform ();
-          retval = buf.str ();
-
-          // Can I assume that the path is alway in "" on the last line
-          size_t pos2 = retval.rfind ('"');
-          size_t pos1 = retval.rfind ('"', pos2 - 1);
-          retval = retval.substr (pos1 + 1, pos2 - pos1 - 1);
-        }
-      setopt (CURLOPT_HEADERFUNCTION, 0);
-      setopt (CURLOPT_WRITEHEADER, 0);
-      setopt (CURLOPT_POSTQUOTE, 0);
-      curl_slist_free_all (slist);
-
-      return retval;
-    }
-
-  bool perform (bool curlerror = true) const
-    {
-      return rep->perform (curlerror);
-    }
-
-private:
-  curl_handle_rep *rep;
-
-  std::string form_query_string (const Cell& param)
-    {
-      std::ostringstream query;
-
-      for (int i = 0; i < param.numel (); i += 2)
-        {
-          std::string name = param(i).string_value ();
-          std::string text = param(i+1).string_value ();
-
-          // Encode strings.
-          char *enc_name = curl_easy_escape (rep->handle (), name.c_str (),
-                                             name.length ());
-          char *enc_text = curl_easy_escape (rep->handle (), text.c_str (),
-                                             text.length ());
-
-          query << enc_name << "=" << enc_text;
-
-          curl_free (enc_name);
-          curl_free (enc_text);
-
-          if (i < param.numel ()-1)
-            query << "&";
-        }
-
-      query.flush ();
-
-      return query.str ();
-    }
-
-  void init (const std::string& user, const std::string& passwd,
-             std::istream& is, std::ostream& os)
-    {
-      // No data transfer by default
-      setopt (CURLOPT_NOBODY, 1);
-
-      // Set the username and password
-      rep->userpwd = user;
-      if (! passwd.empty ())
-        rep->userpwd += ":" + passwd;
-      if (! rep->userpwd.empty ())
-        setopt (CURLOPT_USERPWD, rep->userpwd.c_str ());
-
-      // Define our callback to get called when there's data to be written.
-      setopt (CURLOPT_WRITEFUNCTION, write_data);
-
-      // Set a pointer to our struct to pass to the callback.
-      setopt (CURLOPT_WRITEDATA, static_cast<void*> (&os));
-
-      // Define our callback to get called when there's data to be read
-      setopt (CURLOPT_READFUNCTION, read_data);
-
-      // Set a pointer to our struct to pass to the callback.
-      setopt (CURLOPT_READDATA, static_cast<void*> (&is));
-
-      // Follow redirects.
-      setopt (CURLOPT_FOLLOWLOCATION, true);
-
-      // Don't use EPSV since connecting to sites that don't support it
-      // will hang for some time (3 minutes?) before moving on to try PASV
-      // instead.
-      setopt (CURLOPT_FTP_USE_EPSV, false);
-
-      setopt (CURLOPT_NOPROGRESS, true);
-      setopt (CURLOPT_FAILONERROR, true);
-
-      setopt (CURLOPT_POSTQUOTE, 0);
-      setopt (CURLOPT_QUOTE, 0);
-    }
-
-#undef setopt
-};
-
-class
-curl_handles
-{
-public:
-
-  typedef std::map<std::string, curl_handle>::iterator iterator;
-  typedef std::map<std::string, curl_handle>::const_iterator const_iterator;
-
-  curl_handles (void) : map ()
-   {
-     curl_global_init (CURL_GLOBAL_DEFAULT);
-   }
-
-  ~curl_handles (void)
-    {
-      // Remove the elements of the map explicitly as they should
-      // be deleted before the call to curl_global_cleanup
-      map.erase (begin (), end ());
-
-      curl_global_cleanup ();
-    }
-
-  iterator begin (void) { return iterator (map.begin ()); }
-  const_iterator begin (void) const { return const_iterator (map.begin ()); }
-
-  iterator end (void) { return iterator (map.end ()); }
-  const_iterator end (void) const { return const_iterator (map.end ()); }
-
-  iterator seek (const std::string& k) { return map.find (k); }
-  const_iterator seek (const std::string& k) const { return map.find (k); }
-
-  std::string key (const_iterator p) const { return p->first; }
-
-  curl_handle& contents (const std::string& k)
-    {
-      return map[k];
-    }
-
-  curl_handle contents (const std::string& k) const
-    {
-      const_iterator p = seek (k);
-      return p != end () ? p->second : curl_handle ();
-    }
-
-  curl_handle& contents (iterator p)
-    { return p->second; }
-
-  curl_handle contents (const_iterator p) const
-    { return p->second; }
-
-  void del (const std::string& k)
-    {
-      iterator p = map.find (k);
-
-      if (p != map.end ())
-        map.erase (p);
-    }
-
-private:
-  std::map<std::string, curl_handle> map;
-};
-
-static curl_handles handles;
-
-static void
-cleanup_urlwrite (std::string filename)
-{
-  octave_unlink (filename);
-}
-
-static void
-reset_path (const curl_handle curl)
-{
-  curl.cwd ("..");
-}
-
-static void
-delete_file (std::string file)
-{
-  octave_unlink (file);
-}
-#endif
-
-DEFUN_DLD (urlwrite, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} urlwrite (@var{url}, @var{localfile})\n\
-@deftypefnx {Loadable Function} {@var{f} =} urlwrite (@var{url}, @var{localfile})\n\
-@deftypefnx {Loadable Function} {[@var{f}, @var{success}] =} urlwrite (@var{url}, @var{localfile})\n\
-@deftypefnx {Loadable Function} {[@var{f}, @var{success}, @var{message}] =} urlwrite (@var{url}, @var{localfile})\n\
-Download a remote file specified by its @var{url} and save it as\n\
-@var{localfile}.  For example:\n\
-\n\
-@example\n\
-@group\n\
-urlwrite (\"ftp://ftp.octave.org/pub/octave/README\",\n\
-          \"README.txt\");\n\
-@end group\n\
-@end example\n\
-\n\
-The full path of the downloaded file is returned in @var{f}.  The\n\
-variable @var{success} is 1 if the download was successful,\n\
-otherwise it is 0 in which case @var{message} contains an error\n\
-message.  If no output argument is specified and an error occurs,\n\
-then the error is signaled through Octave's error handling mechanism.\n\
-\n\
-This function uses libcurl.  Curl supports, among others, the HTTP,\n\
-FTP and FILE protocols.  Username and password may be specified in\n\
-the URL, for example:\n\
-\n\
-@example\n\
-@group\n\
-urlwrite (\"http://username:password@@example.com/file.txt\",\n\
-          \"file.txt\");\n\
-@end group\n\
-@end example\n\
-\n\
-GET and POST requests can be specified by @var{method} and @var{param}.\n\
-The parameter @var{method} is either @samp{get} or @samp{post}\n\
-and @var{param} is a cell array of parameter and value pairs.\n\
-For example:\n\
-\n\
-@example\n\
-@group\n\
-urlwrite (\"http://www.google.com/search\", \"search.html\",\n\
-          \"get\", @{\"query\", \"octave\"@});\n\
-@end group\n\
-@end example\n\
-@seealso{urlread}\n\
-@end deftypefn")
-{
-  octave_value_list retval;
-
-#ifdef HAVE_CURL
-
-  int nargin = args.length ();
-
-  // verify arguments
-  if (nargin != 2 && nargin != 4)
-    {
-      print_usage ();
-      return retval;
-    }
-
-  std::string url = args(0).string_value ();
-
-  if (error_state)
-    {
-      error ("urlwrite: URL must be a character string");
-      return retval;
-    }
-
-  // name to store the file if download is succesful
-  std::string filename = args(1).string_value ();
-
-  if (error_state)
-    {
-      error ("urlwrite: LOCALFILE must be a character string");
-      return retval;
-    }
-
-  std::string method;
-  Cell param; // empty cell array
-
-  if (nargin == 4)
-    {
-      method = args(2).string_value ();
-
-      if (error_state)
-        {
-          error ("urlwrite: METHOD must be \"get\" or \"post\"");
-          return retval;
-        }
-
-      if (method != "get" && method != "post")
-        {
-          error ("urlwrite: METHOD must be \"get\" or \"post\"");
-          return retval;
-        }
-
-      param = args(3).cell_value ();
-
-      if (error_state)
-        {
-          error ("urlwrite: parameters (PARAM) for get and post requests must be given as a cell");
-          return retval;
-        }
-
-
-      if (param.numel () % 2 == 1 )
-        {
-          error ("urlwrite: number of elements in PARAM must be even");
-          return retval;
-        }
-    }
-
-  // The file should only be deleted if it doesn't initially exist, we
-  // create it, and the download fails.  We use unwind_protect to do
-  // it so that the deletion happens no matter how we exit the function.
-
-  file_stat fs (filename);
-
-  std::ofstream ofile (filename.c_str (), std::ios::out | std::ios::binary);
-
-  if (! ofile.is_open ())
-    {
-      error ("urlwrite: unable to open file");
-      return retval;
-    }
-
-  unwind_protect_safe frame;
-
-  frame.add_fcn (cleanup_urlwrite, filename);
-
-  bool ok;
-  curl_handle curl = curl_handle (url, method, param, ofile, ok);
-
-  ofile.close ();
-
-  if (!error_state)
-    frame.discard ();
-  else
-    frame.run ();
-
-  if (nargout > 0)
-    {
-      if (ok)
-        {
-          retval(2) = std::string ();
-          retval(1) = true;
-          retval(0) = octave_env::make_absolute (filename);
-        }
-      else
-        {
-          retval(2) = curl.lasterror ();
-          retval(1) = false;
-          retval(0) = std::string ();
-        }
-    }
-
-  if (nargout < 2 && ! ok)
-    error ("urlwrite: curl: %s", curl.lasterror ().c_str ());
-
-#else
-  error ("urlwrite: not available in this version of Octave");
-#endif
-
-  return retval;
-}
-
-DEFUN_DLD (urlread, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{s} =} urlread (@var{url})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{success}] =} urlread (@var{url})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{success}, @var{message}] =} urlread (@var{url})\n\
-@deftypefnx {Loadable Function} {[@dots{}] =} urlread (@var{url}, @var{method}, @var{param})\n\
-Download a remote file specified by its @var{url} and return its content\n\
-in string @var{s}.  For example:\n\
-\n\
-@example\n\
-s = urlread (\"ftp://ftp.octave.org/pub/octave/README\");\n\
-@end example\n\
-\n\
-The variable @var{success} is 1 if the download was successful,\n\
-otherwise it is 0 in which case @var{message} contains an error\n\
-message.  If no output argument is specified and an error occurs,\n\
-then the error is signaled through Octave's error handling mechanism.\n\
-\n\
-This function uses libcurl.  Curl supports, among others, the HTTP,\n\
-FTP and FILE protocols.  Username and password may be specified in the\n\
-URL@.  For example:\n\
-\n\
-@example\n\
-s = urlread (\"http://user:password@@example.com/file.txt\");\n\
-@end example\n\
-\n\
-GET and POST requests can be specified by @var{method} and @var{param}.\n\
-The parameter @var{method} is either @samp{get} or @samp{post}\n\
-and @var{param} is a cell array of parameter and value pairs.\n\
-For example:\n\
-\n\
-@example\n\
-@group\n\
-s = urlread (\"http://www.google.com/search\", \"get\",\n\
-            @{\"query\", \"octave\"@});\n\
-@end group\n\
-@end example\n\
-@seealso{urlwrite}\n\
-@end deftypefn")
-{
-  // Octave's return value
-  octave_value_list retval;
-
-#ifdef HAVE_CURL
-
-  int nargin = args.length ();
-
-  // verify arguments
-  if (nargin != 1  && nargin != 3)
-    {
-      print_usage ();
-      return retval;
-    }
-
-  std::string url = args(0).string_value ();
-
-  if (error_state)
-    {
-      error ("urlread: URL must be a character string");
-      return retval;
-    }
-
-  std::string method;
-  Cell param; // empty cell array
-
-  if (nargin == 3)
-    {
-      method = args(1).string_value ();
-
-      if (error_state)
-        {
-          error ("urlread: METHOD must be \"get\" or \"post\"");
-          return retval;
-        }
-
-      if (method != "get" && method != "post")
-        {
-          error ("urlread: METHOD must be \"get\" or \"post\"");
-          return retval;
-        }
-
-      param = args(2).cell_value ();
-
-      if (error_state)
-        {
-          error ("urlread: parameters (PARAM) for get and post requests must be given as a cell");
-          return retval;
-        }
-
-      if (param.numel () % 2 == 1 )
-        {
-          error ("urlread: number of elements in PARAM must be even");
-          return retval;
-        }
-    }
-
-  std::ostringstream buf;
-
-  bool ok;
-  curl_handle curl = curl_handle (url, method, param, buf, ok);
-
-  if (nargout > 0)
-    {
-      // Return empty string if no error occured.
-      retval(2) = ok ? "" : curl.lasterror ();
-      retval(1) = ok;
-      retval(0) = buf.str ();
-    }
-
-  if (nargout < 2 && ! ok)
-    error ("urlread: curl: %s", curl.lasterror().c_str());
-
-#else
-  error ("urlread: not available in this version of Octave");
-#endif
-
-  return retval;
-}
-
-DEFUN_DLD (__ftp__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} __ftp__ (@var{handle}, @var{host})\n\
-@deftypefnx {Loadable Function} {} __ftp__ (@var{handle}, @var{host}, @var{username}, @var{password})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-  std::string handle;
-  std::string host;
-  std::string user = "anonymous";
-  std::string passwd = "";
-
-  if (nargin < 2 || nargin > 4)
-    error ("incorrect number of arguments");
-  else
-    {
-      handle = args(0).string_value ();
-      host = args(1).string_value ();
-
-      if (nargin > 1)
-        user = args(2).string_value ();
-
-      if (nargin > 2)
-        passwd = args(3).string_value ();
-
-      if (!error_state)
-        {
-          handles.contents (handle) = curl_handle (host, user, passwd);
-
-          if (error_state)
-            handles.del (handle);
-        }
-    }
-#else
-  error ("__ftp__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_pwd__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_pwd__ (@var{handle})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-  octave_value retval;
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 1)
-    error ("__ftp_pwd__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            retval = curl.pwd ();
-          else
-            error ("__ftp_pwd__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_pwd__: not available in this version of Octave");
-#endif
-
-  return retval;
-}
-
-DEFUN_DLD (__ftp_cwd__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_cwd__ (@var{handle}, @var{path})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 1 && nargin != 2)
-    error ("__ftp_cwd__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string path = "";
-
-      if (nargin > 1)
-        path  = args(1).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.cwd (path);
-          else
-            error ("__ftp_cwd__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_cwd__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_dir__, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_dir__ (@var{handle})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-  octave_value retval;
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 1)
-    error ("__ftp_dir__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            {
-              if (nargout == 0)
-                curl.dir ();
-              else
-                {
-                  string_vector sv = curl.list ();
-                  octave_idx_type n = sv.length ();
-                  if (n == 0)
-                    {
-                      string_vector flds (5);
-                      flds(0) = "name";
-                      flds(1) = "date";
-                      flds(2) = "bytes";
-                      flds(3) = "isdir";
-                      flds(4) = "datenum";
-                      retval = octave_map (flds);
-                    }
-                  else
-                    {
-                      octave_map st;
-                      Cell filectime (dim_vector (n, 1));
-                      Cell filesize (dim_vector (n, 1));
-                      Cell fileisdir (dim_vector (n, 1));
-                      Cell filedatenum (dim_vector (n, 1));
-
-                      st.assign ("name", Cell (sv));
-
-                      for (octave_idx_type i = 0; i < n; i++)
-                        {
-                          time_t ftime;
-                          bool fisdir;
-                          double fsize;
-
-                          curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
-
-                          fileisdir (i) = fisdir;
-                          filectime (i) = ctime (&ftime);
-                          filesize (i) = fsize;
-                          filedatenum (i) = double (ftime);
-                        }
-                      st.assign ("date", filectime);
-                      st.assign ("bytes", filesize);
-                      st.assign ("isdir", fileisdir);
-                      st.assign ("datenum", filedatenum);
-                      retval = st;
-                    }
-                }
-            }
-          else
-            error ("__ftp_dir__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_dir__: not available in this version of Octave");
-#endif
-
-  return retval;
-}
-
-DEFUN_DLD (__ftp_ascii__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_ascii__ (@var{handle})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 1)
-    error ("__ftp_ascii__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.ascii ();
-          else
-            error ("__ftp_ascii__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_ascii__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_binary__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_binary__ (@var{handle})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 1)
-    error ("__ftp_binary__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.binary ();
-          else
-            error ("__ftp_binary__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_binary__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_close__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_close__ (@var{handle})\n\
- Undocumented internal function\n\
- @end deftypefn")
- {
- #ifdef HAVE_CURL
-   int nargin = args.length ();
-
-   if (nargin != 1)
-     error ("__ftp_close__: incorrect number of arguments");
-   else
-     {
-       std::string handle = args(0).string_value ();
-
-       if (!error_state)
-         handles.del (handle);
-     }
- #else
-   error ("__ftp_close__: not available in this version of Octave");
- #endif
-
-   return octave_value ();
- }
-
-DEFUN_DLD (__ftp_mode__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_mode__ (@var{handle})\n\
- Undocumented internal function\n\
- @end deftypefn")
- {
-   octave_value retval;
- #ifdef HAVE_CURL
-   int nargin = args.length ();
-
-   if (nargin != 1)
-     error ("__ftp_mode__: incorrect number of arguments");
-   else
-     {
-       std::string handle = args(0).string_value ();
-
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            retval = (curl.is_ascii () ? "ascii" : "binary");
-          else
-            error ("__ftp_binary__: invalid ftp handle");
-        }
-     }
- #else
-   error ("__ftp_mode__: not available in this version of Octave");
- #endif
-
-   return retval;
- }
-
-DEFUN_DLD (__ftp_delete__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_delete__ (@var{handle}, @var{path})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 2)
-    error ("__ftp_delete__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string file = args(1).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.del (file);
-          else
-            error ("__ftp_delete__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_delete__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_rmdir__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_rmdir__ (@var{handle}, @var{path})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 2)
-    error ("__ftp_rmdir__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string dir = args(1).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.rmdir (dir);
-          else
-            error ("__ftp_rmdir__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_rmdir__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_mkdir__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_mkdir__ (@var{handle}, @var{path})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 2)
-    error ("__ftp_mkdir__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string dir = args(1).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.mkdir (dir);
-          else
-            error ("__ftp_mkdir__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_mkdir__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-DEFUN_DLD (__ftp_rename__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_rename__ (@var{handle}, @var{path})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 3)
-    error ("__ftp_rename__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string oldname = args(1).string_value ();
-      std::string newname = args(2).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            curl.rename (oldname, newname);
-          else
-            error ("__ftp_rename__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_rename__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
-
-#ifdef HAVE_CURL
-static string_vector
-mput_directory (const curl_handle& curl, const std::string& base,
-                const std::string& dir)
-{
-  string_vector retval;
-
-  if (! curl.mkdir (dir, false))
-    warning ("__ftp_mput__: can not create the remote directory ""%s""",
-             (base.length () == 0 ? dir : base +
-              file_ops::dir_sep_str () + dir).c_str ());
-
-  curl.cwd (dir);
-
-  if (! error_state)
-    {
-      unwind_protect_safe frame;
-
-      frame.add_fcn (reset_path, curl);
-
-      std::string realdir = base.length () == 0 ? dir : base +
-                         file_ops::dir_sep_str () + dir;
-
-      dir_entry dirlist (realdir);
-
-      if (dirlist)
-        {
-          string_vector files = dirlist.read ();
-
-          for (octave_idx_type i = 0; i < files.length (); i++)
-            {
-              std::string file = files (i);
-
-              if (file == "." || file == "..")
-                continue;
-
-              std::string realfile = realdir + file_ops::dir_sep_str () + file;
-              file_stat fs (realfile);
-
-              if (! fs.exists ())
-                {
-                  error ("__ftp__mput: file ""%s"" does not exist",
-                         realfile.c_str ());
-                  break;
-                }
-
-              if (fs.is_dir ())
-                {
-                  retval.append (mput_directory (curl, realdir, file));
-
-                  if (error_state)
-                    break;
-                }
-              else
-                {
-                  // FIXME Does ascii mode need to be flagged here?
-                  std::ifstream ifile (realfile.c_str (), std::ios::in |
-                                       std::ios::binary);
-
-                  if (! ifile.is_open ())
-                    {
-                      error ("__ftp_mput__: unable to open file ""%s""",
-                             realfile.c_str ());
-                      break;
-                    }
-
-                  curl.put (file, ifile);
-
-                  ifile.close ();
-
-                  if (error_state)
-                    break;
-
-                  retval.append (realfile);
-                }
-            }
-        }
-      else
-        error ("__ftp_mput__: can not read the directory ""%s""",
-               realdir.c_str ());
-    }
-
-  return retval;
-}
-#endif
-
-DEFUN_DLD (__ftp_mput__, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_mput__ (@var{handle}, @var{files})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-  string_vector retval;
-
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 2)
-    error ("__ftp_mput__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string pat = args(1).string_value ();
-
-      if (!error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            {
-              glob_match pattern (file_ops::tilde_expand (pat));
-              string_vector files = pattern.glob ();
-
-              for (octave_idx_type i = 0; i < files.length (); i++)
-                {
-                  std::string file = files (i);
-
-                  file_stat fs (file);
-
-                  if (! fs.exists ())
-                    {
-                      error ("__ftp__mput: file does not exist");
-                      break;
-                    }
-
-                  if (fs.is_dir ())
-                    {
-                      retval.append (mput_directory (curl, "", file));
-                      if (error_state)
-                        break;
-                    }
-                  else
-                    {
-                      // FIXME Does ascii mode need to be flagged here?
-                      std::ifstream ifile (file.c_str (), std::ios::in |
-                                           std::ios::binary);
-
-                      if (! ifile.is_open ())
-                        {
-                          error ("__ftp_mput__: unable to open file");
-                          break;
-                        }
-
-                      curl.put (file, ifile);
-
-                      ifile.close ();
-
-                      if (error_state)
-                        break;
-
-                      retval.append (file);
-                    }
-                }
-            }
-          else
-            error ("__ftp_mput__: invalid ftp handle");
-        }
-    }
-#else
-  error ("__ftp_mput__: not available in this version of Octave");
-#endif
-
-  return (nargout > 0 ? octave_value (retval) : octave_value ());
-}
-
-#ifdef HAVE_CURL
-static void
-getallfiles (const curl_handle& curl, const std::string& dir,
-             const std::string& target)
-{
-  std::string sep = file_ops::dir_sep_str ();
-  file_stat fs (dir);
-
-  if (!fs || !fs.is_dir ())
-    {
-      std::string msg;
-      int status = octave_mkdir (dir, 0777, msg);
-
-      if (status < 0)
-        error ("__ftp_mget__: can't create directory %s%s%s. %s",
-               target.c_str (), sep.c_str (), dir.c_str (), msg.c_str ());
-    }
-
-  if (! error_state)
-    {
-      curl.cwd (dir);
-
-      if (! error_state)
-        {
-          unwind_protect_safe frame;
-
-          frame.add_fcn (reset_path, curl);
-
-          string_vector sv = curl.list ();
-
-          for (octave_idx_type i = 0; i < sv.length (); i++)
-            {
-              time_t ftime;
-              bool fisdir;
-              double fsize;
-
-              curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
-
-              if (fisdir)
-                getallfiles (curl, sv(i), target + dir + sep);
-              else
-                {
-                  std::string realfile = target + dir + sep + sv(i);
-                  std::ofstream ofile (realfile.c_str (),
-                                       std::ios::out |
-                                       std::ios::binary);
-
-                  if (! ofile.is_open ())
-                    {
-                      error ("__ftp_mget__: unable to open file");
-                      break;
-                    }
-
-                  unwind_protect_safe frame2;
-
-                  frame2.add_fcn (delete_file, realfile);
-
-                  curl.get (sv(i), ofile);
-
-                  ofile.close ();
-
-                  if (!error_state)
-                    frame2.discard ();
-                  else
-                    frame2.run ();
-                }
-
-              if (error_state)
-                break;
-            }
-        }
-    }
-}
-#endif
-
-DEFUN_DLD (__ftp_mget__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __ftp_mget__ (@var{handle}, @var{files})\n\
-Undocumented internal function\n\
-@end deftypefn")
-{
-#ifdef HAVE_CURL
-  int nargin = args.length ();
-
-  if (nargin != 2 && nargin != 3)
-    error ("__ftp_mget__: incorrect number of arguments");
-  else
-    {
-      std::string handle = args(0).string_value ();
-      std::string file = args(1).string_value ();
-      std::string target;
-
-      if (nargin == 3)
-        target = args(2).string_value () + file_ops::dir_sep_str ();
-
-      if (! error_state)
-        {
-          const curl_handle curl = handles.contents (handle);
-
-          if (curl.is_valid ())
-            {
-              string_vector sv = curl.list ();
-              octave_idx_type n = 0;
-              glob_match pattern (file);
-
-              for (octave_idx_type i = 0; i < sv.length (); i++)
-                {
-                  if (pattern.match (sv(i)))
-                    {
-                      n++;
-
-                      time_t ftime;
-                      bool fisdir;
-                      double fsize;
-
-                      curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
-
-                      if (fisdir)
-                        getallfiles (curl, sv(i), target);
-                      else
-                        {
-                          std::ofstream ofile ((target + sv(i)).c_str (),
-                                               std::ios::out |
-                                               std::ios::binary);
-
-                          if (! ofile.is_open ())
-                            {
-                              error ("__ftp_mget__: unable to open file");
-                              break;
-                            }
-
-                          unwind_protect_safe frame;
-
-                          frame.add_fcn (delete_file, target + sv(i));
-
-                          curl.get (sv(i), ofile);
-
-                          ofile.close ();
-
-                          if (!error_state)
-                            frame.discard ();
-                          else
-                            frame.run ();
-                        }
-
-                      if (error_state)
-                        break;
-                    }
-                }
-              if (n == 0)
-                error ("__ftp_mget__: file not found");
-            }
-        }
-    }
-#else
-  error ("__ftp_mget__: not available in this version of Octave");
-#endif
-
-  return octave_value ();
-}
--- a/libinterp/gendoc.pl	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/gendoc.pl	Sat Oct 05 11:22:09 2013 -0400
@@ -64,7 +64,7 @@
   foreach $i (0 .. $#func_list)
   {
     $func = $func_list[$i];
-    print "$func\n";
+    print "\x{1d}$func\n";
     print "\@c $func $src_fname\n";
     print $docstr[$i],"\n";
   }
--- a/libinterp/octave-value/ov-base.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-base.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1565,9 +1565,9 @@
 @end group\n\
 @end example\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
--- a/libinterp/octave-value/ov-bool-sparse.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-bool-sparse.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -273,7 +273,7 @@
     swap_bytes<4> (&tmp);
 
   if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
+    error ("load: only 2-D sparse matrices are supported");
     return false;
   }
 
--- a/libinterp/octave-value/ov-class.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-class.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1239,13 +1239,19 @@
 
       if (have_ctor)
         {
+          unwind_protect frame;
+
+          // Simulate try/catch.
+
+          interpreter_try (frame);
+
           octave_value_list result
             = ctor.do_multi_index_op (1, octave_value_list ());
 
-          if (result.length () == 1)
+          if (! error_state && result.length () == 1)
             retval = true;
-          else
-            warning ("call to constructor for class %s failed", c_name.c_str ());
+
+          error_state = false;
         }
       else
         warning ("no constructor for class %s", c_name.c_str ());
@@ -1401,19 +1407,17 @@
 
                   if (! reconstruct_parents ())
                     warning ("load: unable to reconstruct object inheritance");
-                  else
+
+                  if (load_path::find_method (classname, "loadobj")
+                      != std::string ())
                     {
-                      if (load_path::find_method (classname, "loadobj")
-                          != std::string ())
-                        {
-                          octave_value in = new octave_class (*this);
-                          octave_value_list tmp = feval ("loadobj", in, 1);
+                      octave_value in = new octave_class (*this);
+                      octave_value_list tmp = feval ("loadobj", in, 1);
 
-                          if (! error_state)
-                            map = tmp(0).map_value ();
-                          else
-                            success = false;
-                        }
+                      if (! error_state)
+                        map = tmp(0).map_value ();
+                      else
+                        success = false;
                     }
                 }
               else
@@ -1548,18 +1552,16 @@
 
           if (! reconstruct_parents ())
             warning ("load: unable to reconstruct object inheritance");
-          else
+
+          if (load_path::find_method (c_name, "loadobj") != std::string ())
             {
-              if (load_path::find_method (c_name, "loadobj") != std::string ())
-                {
-                  octave_value in = new octave_class (*this);
-                  octave_value_list tmp = feval ("loadobj", in, 1);
+              octave_value in = new octave_class (*this);
+              octave_value_list tmp = feval ("loadobj", in, 1);
 
-                  if (! error_state)
-                    map = tmp(0).map_value ();
-                  else
-                    success = false;
-                }
+              if (! error_state)
+                map = tmp(0).map_value ();
+              else
+                success = false;
             }
         }
       else
@@ -1788,23 +1790,19 @@
 
       if (!reconstruct_parents ())
         warning ("load: unable to reconstruct object inheritance");
-      else
-        {
-          if (load_path::find_method (c_name, "loadobj") != std::string ())
-            {
-              octave_value in = new octave_class (*this);
-              octave_value_list tmp = feval ("loadobj", in, 1);
 
-              if (! error_state)
-                {
-                  map = tmp(0).map_value ();
-                  retval = true;
-                }
-              else
-                retval = false;
+      if (load_path::find_method (c_name, "loadobj") != std::string ())
+        {
+          octave_value in = new octave_class (*this);
+          octave_value_list tmp = feval ("loadobj", in, 1);
+
+          if (! error_state)
+            {
+              map = tmp(0).map_value ();
+              retval = true;
             }
           else
-            retval = true;
+            retval = false;
         }
     }
 
--- a/libinterp/octave-value/ov-cx-sparse.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-cx-sparse.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -305,7 +305,7 @@
     swap_bytes<4> (&tmp);
 
   if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
+    error ("load: only 2-D sparse matrices are supported");
     return false;
   }
 
--- a/libinterp/octave-value/ov-fcn-handle.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1329,14 +1329,14 @@
 
 /*
 %!function fcn_handle_save_recurse (n, mode, nm, f2, g2, hm2, hdld2, hbi2)
-%!  if n == 0
+%!  if (n == 0)
 %!    save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2");
 %!  else
 %!    fcn_handle_save_recurse (n - 1, mode, nm, f2, g2, hm2, hdld2, hbi2);
 %!  endif
 %!endfunction
 %!function [f2, g2, hm2, hdld2, hbi2] = fcn_handle_load_recurse (n, nm)
-%!  if n == 0
+%!  if (n == 0)
 %!    load (nm)
 %!  else
 %!    [f2, g2, hm2, hdld2, hbi2] = fcn_handle_load_recurse (n - 1, nm);
@@ -1792,8 +1792,8 @@
 @deftypefn  {Built-in Function} {} str2func (@var{fcn_name})\n\
 @deftypefnx {Built-in Function} {} str2func (@var{fcn_name}, \"global\")\n\
 Return a function handle constructed from the string @var{fcn_name}.\n\
-If the optional \"global\" argument is passed, locally visible functions\n\
-are ignored in the lookup.\n\
+If the optional @qcode{\"global\"} argument is passed, locally visible\n\
+functions are ignored in the lookup.\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/libinterp/octave-value/ov-fcn-inline.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-fcn-inline.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -652,7 +652,7 @@
 they are the names of the arguments of the function.\n\
 \n\
 If the second argument is an integer @var{n}, the arguments are\n\
-@code{\"x\"}, @code{\"P1\"}, @dots{}, @code{\"P@var{N}\"}.\n\
+@qcode{\"x\"}, @qcode{\"P1\"}, @dots{}, @qcode{\"P@var{N}\"}.\n\
 @seealso{argnames, formula, vectorize}\n\
 @end deftypefn")
 {
--- a/libinterp/octave-value/ov-java.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-java.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -2304,9 +2304,9 @@
 Query or set the internal variable that controls whether Java arrays are\n\
 automatically converted to Octave matrices.  The default value is false.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{java_unsigned_autoconversion, debug_java}\n\
 @end deftypefn")
 {
@@ -2328,9 +2328,9 @@
 Java arrays of class Byte or Integer are converted to matrices of class\n\
 uint8 or uint32 respectively.  The default value is true.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{java_matrix_autoconversion, debug_java}\n\
 @end deftypefn")
 {
@@ -2351,9 +2351,9 @@
 information regarding the initialization of the JVM and any Java exceptions\n\
 is printed.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @seealso{java_matrix_autoconversion, java_unsigned_autoconversion}\n\
 @end deftypefn")
 {
--- a/libinterp/octave-value/ov-range.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-range.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -688,9 +688,9 @@
 compatibility; however, it is still not entirely compatible because\n\
 @sc{matlab} treats the range expression differently in different contexts.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index);
--- a/libinterp/octave-value/ov-re-sparse.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-re-sparse.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -338,7 +338,7 @@
     swap_bytes<4> (&tmp);
 
   if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
+    error ("load: only 2-D sparse matrices are supported");
     return false;
   }
 
--- a/libinterp/octave-value/ov-struct.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-struct.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -2285,9 +2285,9 @@
 Query or set the internal variable that specifies the number of\n\
 structure levels to display.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE_WITH_LIMITS (struct_levels_to_print, -1,
@@ -2305,9 +2305,9 @@
 are always printed.  In both cases, however, printing will be limited to\n\
 the number of levels specified by @var{struct_levels_to_print}.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (print_struct_array_contents);
--- a/libinterp/octave-value/ov-usr-fcn.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1014,9 +1014,9 @@
 If true, Octave will attempt to eliminate the redundant copying when calling\n\
 subsasgn method of a user-defined class.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (optimize_subsasgn_calls);
--- a/libinterp/octave.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -33,6 +33,7 @@
 
 #include <iostream>
 
+#include <fcntl.h>
 #include <getopt.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -126,6 +127,10 @@
 // (--force-gui)
 static bool force_gui_option = false;
 
+// If TRUE don't fork when starting the GUI.
+// (--no-fork)
+static bool no_fork_option = false;
+
 // If TRUE don't start the GUI.
 // (--no-gui)
 static bool no_gui_option = false;
@@ -160,7 +165,7 @@
        [--echo-commands] [--eval CODE] [--exec-path path]\n\
        [--force-gui] [--help] [--image-path path]\n\
        [--info-file file] [--info-program prog] [--interactive]\n\
-       [--line-editing] [--no-gui] [--no-history]\n\
+       [--line-editing] [--no-fork] [--no-gui] [--no-history]\n\
        [--no-init-file] [--no-init-path] [--no-jit-compiler]\n\
        [--no-line-editing] [--no-site-file] [--no-window-system]\n\
        [--norc] [-p path] [--path path] [--persist] [--silent]\n\
@@ -195,15 +200,16 @@
 #define INFO_PROG_OPTION 8
 #define DEBUG_JIT_OPTION 9
 #define LINE_EDITING_OPTION 10
-#define NO_GUI_OPTION 11
-#define NO_INIT_FILE_OPTION 12
-#define NO_INIT_PATH_OPTION 13
-#define NO_JIT_COMPILER_OPTION 14
-#define NO_LINE_EDITING_OPTION 15
-#define NO_SITE_FILE_OPTION 16
-#define PERSIST_OPTION 17
-#define TEXI_MACROS_FILE_OPTION 18
-#define TRADITIONAL_OPTION 19
+#define NO_FORK_OPTION 11
+#define NO_GUI_OPTION 12
+#define NO_INIT_FILE_OPTION 13
+#define NO_INIT_PATH_OPTION 14
+#define NO_JIT_COMPILER_OPTION 15
+#define NO_LINE_EDITING_OPTION 16
+#define NO_SITE_FILE_OPTION 17
+#define PERSIST_OPTION 18
+#define TEXI_MACROS_FILE_OPTION 19
+#define TRADITIONAL_OPTION 20
 struct option long_opts[] = {
   { "braindead",                no_argument,       0, TRADITIONAL_OPTION },
   { "built-in-docstrings-file", required_argument, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION },
@@ -220,6 +226,7 @@
   { "info-program",             required_argument, 0, INFO_PROG_OPTION },
   { "interactive",              no_argument,       0, 'i' },
   { "line-editing",             no_argument,       0, LINE_EDITING_OPTION },
+  { "no-fork",                  no_argument,       0, NO_FORK_OPTION },
   { "no-gui",                   no_argument,       0, NO_GUI_OPTION },
   { "no-history",               no_argument,       0, 'H' },
   { "no-init-file",             no_argument,       0, NO_INIT_FILE_OPTION },
@@ -517,7 +524,8 @@
 static void
 verbose_usage (void)
 {
-  std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY "\n\
+  std::cout << octave_name_version_copyright_copying_and_warranty ()
+            << "\n\
 \n\
 Usage: octave [options] [FILE]\n\
 \n\
@@ -537,6 +545,7 @@
   --info-program PROGRAM  Use PROGRAM for reading info files.\n\
   --interactive, -i       Force interactive behavior.\n\
   --line-editing          Force readline use for command-line editing.\n\
+  --no-fork               Don't fork when starting the graphical user interface.\n\
   --no-gui                Disable the graphical user interface.\n\
   --no-history, -H        Don't save commands to the history list\n\
   --no-init-file          Don't read the ~/.octaverc or .octaverc files.\n\
@@ -557,11 +566,12 @@
   FILE                    Execute commands from FILE.  Exit when done\n\
                           unless --persist is also specified.\n\
 \n"
-OCTAVE_WWW_STATEMENT "\n\
-\n"
-OCTAVE_CONTRIB_STATEMENT "\n\
-\n"
-OCTAVE_BUGS_STATEMENT "\n";
+            << octave_www_statement ()
+            << "\n\n"
+            << octave_contrib_statement ()
+            << "\n\n"
+            << octave_bugs_statement ()
+            << "\n";
 
   exit (0);
 }
@@ -578,7 +588,8 @@
 static void
 print_version_and_exit (void)
 {
-  std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS "\n";
+  std::cout << octave_name_version_copyright_copying_warranty_and_bugs ()
+            << "\n";
   exit (0);
 }
 
@@ -785,6 +796,10 @@
           forced_line_editing = true;
           break;
 
+        case NO_FORK_OPTION:
+          no_fork_option = true;
+          break;
+
         case NO_GUI_OPTION:
           no_gui_option = true;
           break;
@@ -944,7 +959,7 @@
 octave_execute_interpreter (void)
 {
   if (! inhibit_startup_message)
-    std::cout << OCTAVE_STARTUP_MESSAGE "\n" << std::endl;
+    std::cout << octave_startup_message () << "\n" << std::endl;
 
   execute_startup_files ();
 
@@ -1071,6 +1086,26 @@
   return start_gui;
 }
 
+int
+octave_fork_gui (void)
+{
+  bool have_ctty = false;
+
+#if ! (defined (__WIN32__) || defined (__APPLE__)) || defined (__CYGWIN__)
+
+#if defined (HAVE_CTERMID)
+  const char *ctty = ctermid (0);
+#else
+  const char *ctty = "/dev/tty";
+#endif
+
+  have_ctty = gnulib::open (ctty, O_RDWR, 0) > 0;
+
+#endif
+
+  return (have_ctty && ! no_fork_option);
+}
+
 DEFUN (isguirunning, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} isguirunning ()\n\
--- a/libinterp/octave.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/octave.h	Sat Oct 05 11:22:09 2013 -0400
@@ -41,6 +41,7 @@
 extern OCTINTERP_API int octave_embedded;
 
 extern OCTINTERP_API int octave_starting_gui (void);
+extern OCTINTERP_API int octave_fork_gui (void);
 
 #ifdef  __cplusplus
 }
--- a/libinterp/parse-tree/lex.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/lex.h	Sat Oct 05 11:22:09 2013 -0400
@@ -282,6 +282,7 @@
       looping (0), defining_func (0), looking_at_function_handle (0),
       block_comment_nesting_level (0), token_count (0),
       current_input_line (), comment_text (), help_text (),
+      string_text (), string_line (0), string_column (0),
       fcn_file_name (), fcn_file_full_name (), looking_at_object_index (),
       parsed_function_name (), pending_local_variables (),
       symtab_context (), nesting_level (), tokens ()
@@ -419,6 +420,13 @@
   // The current help text.
   std::string help_text;
 
+  // The current character string text.
+  std::string string_text;
+
+  // The position of the beginning of the current character string.
+  int string_line;
+  int string_column;
+
   // Simple name of function file we are reading.
   std::string fcn_file_name;
 
@@ -509,6 +517,8 @@
 
   void prep_for_file (void);
 
+  void begin_string (int state);
+
   virtual int fill_flex_buffer (char *buf, unsigned int max_size) = 0;
 
   bool at_end_of_buffer (void) const { return input_buf.empty (); }
@@ -543,12 +553,6 @@
 
   void finish_comment (octave_comment_elt::comment_type typ);
 
-  bool have_continuation (bool trailing_comments_ok = true);
-
-  bool have_ellipsis_continuation (bool trailing_comments_ok = true);
-
-  int handle_string (char delim);
-
   int handle_close_bracket (int bracket_type);
 
   bool looks_like_command_arg (void);
--- a/libinterp/parse-tree/lex.ll	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/lex.ll	Sat Oct 05 11:22:09 2013 -0400
@@ -51,6 +51,9 @@
 %x BLOCK_COMMENT_START
 %x LINE_COMMENT_START
 
+%x DQ_STRING_START
+%x SQ_STRING_START
+
 %{
 
 #include <cctype>
@@ -205,6 +208,31 @@
     } \
   while (0)
 
+// We can't rely on the trick used elsewhere of sticking ASCII 1 in
+// the input buffer and recognizing it as a special case because ASCII
+// 1 is a valid character for a character string.  If we are at the
+// end of the buffer, ask for more input.  If we are at the end of the
+// file, deal with it.  Otherwise, just keep going with the text from
+// the current buffer.
+#define HANDLE_STRING_CONTINUATION \
+  do \
+    { \
+      curr_lexer->decrement_promptflag (); \
+      curr_lexer->input_line_number++; \
+      curr_lexer->current_input_column = 1; \
+ \
+      if (curr_lexer->is_push_lexer ()) \
+        { \
+          if (curr_lexer->at_end_of_buffer ()) \
+            return -1; \
+ \
+          if (curr_lexer->at_end_of_file ()) \
+            return curr_lexer->handle_end_of_input (); \
+        } \
+    } \
+  while (0)
+
+
 static bool Vdisplay_tokens = false;
 
 static unsigned int Vtoken_count = 0;
@@ -222,7 +250,6 @@
 D       [0-9]
 S       [ \t]
 NL      ((\n)|(\r)|(\r\n))
-CONT    ((\.\.\.)|(\\))
 Im      [iIjJ]
 CCHAR   [#%]
 IDENT   ([_$a-zA-Z][_$a-zA-Z0-9]*)
@@ -290,9 +317,9 @@
     curr_lexer->at_beginning_of_statement = false;
 
     curr_lexer->current_input_column++;
-    int tok = curr_lexer->handle_string (yytext[0]);
-
-    return curr_lexer->count_token_internal (tok);
+
+    curr_lexer->begin_string (yytext[0] == '"'
+                              ? DQ_STRING_START : SQ_STRING_START);
   }
 
 <COMMAND_START>[^#% \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* {
@@ -449,7 +476,7 @@
 %}
 
 ^{S}*{CCHAR}\{{S}*{NL} {
-    curr_lexer->lexer_debug ("^{S}*{CCHAR}\{{S}*{NL}");
+    curr_lexer->lexer_debug ("^{S}*{CCHAR}\\{{S}*{NL}");
 
     yyless (0);
 
@@ -468,7 +495,7 @@
   }
 
 <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL} {
-    curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL}");
+    curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>^{S}*{CCHAR}\\{{S}*{NL}");
 
     curr_lexer->input_line_number++;
     curr_lexer->current_input_column = 1;
@@ -622,6 +649,238 @@
   }
 
 %{
+// Double-quoted character strings.
+%}
+
+<DQ_STRING_START>\"\" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"\\\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '"';
+  }
+
+<DQ_STRING_START>\" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\"");
+
+    curr_lexer->current_input_column++;
+
+    curr_lexer->pop_start_state ();
+
+    curr_lexer->looking_for_object_index = true;
+    curr_lexer->at_beginning_of_statement = false;
+
+    curr_lexer->push_token (new token (DQ_STRING,
+                                       curr_lexer->string_text,
+                                       curr_lexer->string_line,
+                                       curr_lexer->string_column));
+
+    curr_lexer->string_text = "";
+
+    return curr_lexer->count_token_internal (DQ_STRING);
+  }
+
+<DQ_STRING_START>\\[0-7]{1,3} {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}");
+
+    curr_lexer->current_input_column += yyleng;
+
+    int result;
+    sscanf (yytext+1, "%o", &result);
+
+    if (result > 0xff)
+      error ("invalid octal escape sequence in character string");
+    else
+      curr_lexer->string_text += static_cast<unsigned char> (result);
+  }
+
+<DQ_STRING_START>\\x[0-9a-fA-F]+ {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+");
+
+    curr_lexer->current_input_column += yyleng;
+
+    int result;
+    sscanf (yytext+2, "%x", &result);
+
+    // Truncate the value silently instead of checking the range like
+    // we do for octal above.  This is to match C/C++ where any number
+    // of digits is allowed but the value is implementation-defined if
+    // it exceeds the range of the character type.
+    curr_lexer->string_text += static_cast<unsigned char> (result);
+  }
+
+<DQ_STRING_START>"\\a" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\a\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\a';
+  }
+
+<DQ_STRING_START>"\\b" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\b\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\b';
+  }
+
+<DQ_STRING_START>"\\f" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\f\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\f';
+  }
+
+<DQ_STRING_START>"\\n" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\n\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\n';
+  }
+
+<DQ_STRING_START>"\\r" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\r\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\r';
+  }
+
+<DQ_STRING_START>"\\t" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\t\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\t';
+  }
+
+<DQ_STRING_START>"\\v" {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\"\\\\v\"");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\v';
+  }
+
+<DQ_STRING_START>(\.\.\.){S}*{NL} |
+<DQ_STRING_START>(\.\.\.){S}*{CCHAR}.*{NL} {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}|<DQ_STRING_START>(\\.\\.\\.){S}*{CCHAR}.*{NL}");
+
+    static const char *msg = "'...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\\' instead";
+
+    std::string nm = curr_lexer->fcn_file_full_name;
+
+    if (nm.empty ())
+      warning_with_id ("Octave:deprecated-syntax", "%s", msg);
+    else
+      warning_with_id ("Octave:deprecated-syntax",
+                       "%s; near line %d of file '%s'", msg,
+                       curr_lexer->input_line_number, nm.c_str ());
+
+    HANDLE_STRING_CONTINUATION;
+  }
+
+<DQ_STRING_START>\\{S}+{NL} |
+<DQ_STRING_START>\\{S}*{CCHAR}.*{NL} {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}|<DQ_STRING_START>\\\\{S}*{CCHAR}.*{NL}");
+
+    static const char *msg = "white space and comments after continuation markers in double-quoted character strings are obsolete and will not be allowed in a future version of Octave";
+
+    std::string nm = curr_lexer->fcn_file_full_name;
+
+    if (nm.empty ())
+      warning_with_id ("Octave:deprecated-syntax", "%s", msg);
+    else
+      warning_with_id ("Octave:deprecated-syntax",
+                       "%s; near line %d of file '%s'", msg,
+                       curr_lexer->input_line_number, nm.c_str ());
+
+    HANDLE_STRING_CONTINUATION;
+  }
+
+<DQ_STRING_START>\\{NL} {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{NL}");
+
+    HANDLE_STRING_CONTINUATION;
+  }
+
+<DQ_STRING_START>\\. {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\.");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += yytext[1];
+  }
+
+<DQ_STRING_START>\. {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>\\.");
+
+    curr_lexer->current_input_column++;
+    curr_lexer->string_text += yytext[0];
+  }
+
+<DQ_STRING_START>[^\.\\\r\n\"]+ {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>[^\\.\\\\\\r\\n\\\"]+");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += yytext;
+  }
+
+<DQ_STRING_START>{NL} {
+    curr_lexer->lexer_debug ("<DQ_STRING_START>{NL}");
+
+    curr_lexer->input_line_number++;
+    curr_lexer->current_input_column = 1;
+
+    error ("unterminated character string constant");
+
+    return LEXICAL_ERROR;
+  }
+
+%{
+// Single-quoted character strings.
+%}
+
+<SQ_STRING_START>\'\' {
+    curr_lexer->lexer_debug ("<SQ_STRING_START>\\'\\'");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += '\'';
+  }
+
+<SQ_STRING_START>\' {
+    curr_lexer->lexer_debug ("<SQ_STRING_START>\\'");
+
+    curr_lexer->current_input_column++;
+
+    curr_lexer->pop_start_state ();
+
+    curr_lexer->looking_for_object_index = true;
+    curr_lexer->at_beginning_of_statement = false;
+
+    curr_lexer->push_token (new token (SQ_STRING,
+                                       curr_lexer->string_text,
+                                       curr_lexer->string_line,
+                                       curr_lexer->string_column));
+
+    curr_lexer->string_text = "";
+
+    return curr_lexer->count_token_internal (SQ_STRING);
+  }
+
+<SQ_STRING_START>[^\'\n\r]+ {
+    curr_lexer->lexer_debug ("<SQ_STRING_START>[^\\'\\n\\r]+");
+
+    curr_lexer->current_input_column += yyleng;
+    curr_lexer->string_text += yytext;
+  }
+
+<SQ_STRING_START>{NL} {
+    curr_lexer->lexer_debug ("<SQ_STRING_START>{NL}");
+
+    curr_lexer->input_line_number++;
+    curr_lexer->current_input_column = 1;
+
+    error ("unterminated character string constant");
+
+    return LEXICAL_ERROR;
+  }
+
+%{
 // Imaginary numbers.
 %}
 
@@ -661,7 +920,7 @@
 
 {D}+/\.[\*/\\^\'] |
 {NUMBER} {
-    curr_lexer->lexer_debug ("{D}+/\\.[\\*/\\^\\']|{NUMBER}");
+    curr_lexer->lexer_debug ("{D}+/\\.[\\*/\\\\^\\']|{NUMBER}");
 
     if (curr_lexer->previous_token_may_be_command ()
         &&  curr_lexer->space_follows_previous_token ())
@@ -701,12 +960,33 @@
   }
 
 %{
-// Continuation lines.  Allow comments after continuations.
+// Continuation lines.  Allow arbitrary text after continuations.
+%}
+
+\.\.\..*{NL} {
+    curr_lexer->lexer_debug ("\\.\\.\\..*{NL}");
+
+    curr_lexer->handle_continuation ();
+  }
+
+%{
+// Deprecated C preprocessor style continuation markers.
 %}
 
-{CONT}{S}*{NL} |
-{CONT}{S}*{CCHAR}.*{NL} {
-    curr_lexer->lexer_debug ("{CONT}{S}*{NL}|{CONT}{S}*{CCHAR}.*{NL}");
+\\{S}*{NL} |
+\\{S}*{CCHAR}.*{NL} {
+    curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}.*{NL}");
+
+    static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed in a future version of Octave";
+
+    std::string nm = curr_lexer->fcn_file_full_name;
+
+    if (nm.empty ())
+      warning_with_id ("Octave:deprecated-syntax", "%s", msg);
+    else
+      warning_with_id ("Octave:deprecated-syntax",
+                       "%s; near line %d of file '%s'", msg,
+                       curr_lexer->input_line_number, nm.c_str ());
 
     curr_lexer->handle_continuation ();
   }
@@ -867,14 +1147,14 @@
     if (curr_lexer->previous_token_may_be_command ()
         &&  curr_lexer->space_follows_previous_token ())
       {
-        yyless (0);
+        curr_lexer->current_input_column++;
         curr_lexer->push_start_state (COMMAND_START);
+        curr_lexer->begin_string (SQ_STRING_START);
       }
     else if (curr_lexer->at_beginning_of_statement)
       {
         curr_lexer->current_input_column++;
-        int retval = curr_lexer->handle_string ('\'');
-        return curr_lexer->count_token_internal (retval);
+        curr_lexer->begin_string (SQ_STRING_START);
       }
     else
       {
@@ -888,8 +1168,7 @@
                     || curr_lexer->previous_token_is_binop ())
                   {
                     curr_lexer->current_input_column++;
-                    int retval = curr_lexer->handle_string ('\'');
-                    return curr_lexer->count_token_internal (retval);
+                    curr_lexer->begin_string (SQ_STRING_START);
                   }
                 else
                   {
@@ -906,8 +1185,7 @@
                     || curr_lexer->previous_token_is_keyword ())
                   {
                     curr_lexer->current_input_column++;
-                    int retval = curr_lexer->handle_string ('\'');
-                    return curr_lexer->count_token_internal (retval);
+                    curr_lexer->begin_string (SQ_STRING_START);
                   }
                 else
                   return curr_lexer->count_token (HERMITIAN);
@@ -920,8 +1198,7 @@
                 || curr_lexer->previous_token_is_keyword ())
               {
                 curr_lexer->current_input_column++;
-                int retval = curr_lexer->handle_string ('\'');
-                return curr_lexer->count_token_internal (retval);
+                curr_lexer->begin_string (SQ_STRING_START);
               }
             else
               return curr_lexer->count_token (HERMITIAN);
@@ -934,13 +1211,14 @@
 %}
 
 \" {
-    curr_lexer->lexer_debug ("\"");
+    curr_lexer->lexer_debug ("\\\"");
 
     if (curr_lexer->previous_token_may_be_command ()
         &&  curr_lexer->space_follows_previous_token ())
       {
-        yyless (0);
+        curr_lexer->current_input_column++;
         curr_lexer->push_start_state (COMMAND_START);
+        curr_lexer->begin_string (DQ_STRING_START);
       }
     else
       {
@@ -954,8 +1232,7 @@
                     || curr_lexer->previous_token_is_binop ())
                   {
                     curr_lexer->current_input_column++;
-                    int retval = curr_lexer->handle_string ('"');
-                    return curr_lexer->count_token_internal (retval);
+                    curr_lexer->begin_string (DQ_STRING_START);
                   }
                 else
                   {
@@ -968,15 +1245,13 @@
             else
               {
                 curr_lexer->current_input_column++;
-                int retval = curr_lexer->handle_string ('"');
-                return curr_lexer->count_token_internal (retval);
+                curr_lexer->begin_string (DQ_STRING_START);
               }
           }
         else
           {
             curr_lexer->current_input_column++;
-            int retval = curr_lexer->handle_string ('"');
-            return curr_lexer->count_token_internal (retval);
+            curr_lexer->begin_string (DQ_STRING_START);
           }
       }
   }
@@ -1557,6 +1832,9 @@
   current_input_line = "";
   comment_text = "";
   help_text = "";
+  string_text = "";
+  string_line = 0;
+  string_column = 0;
   fcn_file_name = "";
   fcn_file_full_name = "";
   looking_at_object_index.clear ();
@@ -1771,6 +2049,15 @@
   push_start_state (INPUT_FILE_START);
 }
 
+void
+octave_base_lexer::begin_string (int state)
+{
+  string_line = input_line_number;
+  string_column = current_input_column;
+
+  push_start_state (state);
+}
+
 int
 octave_base_lexer::handle_end_of_input (void)
 {
@@ -2259,218 +2546,6 @@
   at_beginning_of_statement = true;
 }
 
-// We have seen a backslash and need to find out if it should be
-// treated as a continuation character.  If so, this eats it, up to
-// and including the new line character.
-//
-// Match whitespace only, followed by a comment character or newline.
-// Once a comment character is found, discard all input until newline.
-// If non-whitespace characters are found before comment
-// characters, return 0.  Otherwise, return 1.
-
-// FIXME -- we need to handle block comments here.
-
-bool
-octave_base_lexer::have_continuation (bool trailing_comments_ok)
-{
-  std::ostringstream buf;
-
-  std::string comment_buf;
-
-  bool in_comment = false;
-  bool beginning_of_comment = false;
-
-  int c = 0;
-
-  while ((c = text_yyinput ()) != EOF)
-    {
-      buf << static_cast<char> (c);
-
-      switch (c)
-        {
-        case ' ':
-        case '\t':
-          if (in_comment)
-            {
-              comment_buf += static_cast<char> (c);
-              beginning_of_comment = false;
-            }
-          break;
-
-        case '%':
-        case '#':
-          if (trailing_comments_ok)
-            {
-              if (in_comment)
-                {
-                  if (! beginning_of_comment)
-                    comment_buf += static_cast<char> (c);
-                }
-              else
-                {
-                  maybe_gripe_matlab_incompatible_comment (c);
-                  in_comment = true;
-                  beginning_of_comment = true;
-                }
-            }
-          else
-            goto cleanup;
-          break;
-
-        case '\n':
-          if (in_comment)
-            {
-              comment_buf += static_cast<char> (c);
-              octave_comment_buffer::append (comment_buf);
-            }
-          current_input_column = 0;
-          decrement_promptflag ();
-          gripe_matlab_incompatible_continuation ();
-          return true;
-
-        default:
-          if (in_comment)
-            {
-              comment_buf += static_cast<char> (c);
-              beginning_of_comment = false;
-            }
-          else
-            goto cleanup;
-          break;
-        }
-    }
-
-  xunput (c);
-  return false;
-
-cleanup:
-
-  std::string s = buf.str ();
-
-  int len = s.length ();
-  while (len--)
-    xunput (s[len]);
-
-  return false;
-}
-
-// We have seen a '.' and need to see if it is the start of a
-// continuation.  If so, this eats it, up to and including the new
-// line character.
-
-bool
-octave_base_lexer::have_ellipsis_continuation (bool trailing_comments_ok)
-{
-  char c1 = text_yyinput ();
-  if (c1 == '.')
-    {
-      char c2 = text_yyinput ();
-      if (c2 == '.' && have_continuation (trailing_comments_ok))
-        return true;
-      else
-        {
-          xunput (c2);
-          xunput (c1);
-        }
-    }
-  else
-    xunput (c1);
-
-  return false;
-}
-
-int
-octave_base_lexer::handle_string (char delim)
-{
-  std::ostringstream buf;
-
-  int bos_line = input_line_number;
-  int bos_col = current_input_column;
-
-  int c;
-  int escape_pending = 0;
-
-  while ((c = text_yyinput ()) != EOF)
-    {
-      current_input_column++;
-
-      if (c == '\\')
-        {
-          if (delim == '\'' || escape_pending)
-            {
-              buf << static_cast<char> (c);
-              escape_pending = 0;
-            }
-          else
-            {
-              if (have_continuation (false))
-                escape_pending = 0;
-              else
-                {
-                  buf << static_cast<char> (c);
-                  escape_pending = 1;
-                }
-            }
-          continue;
-        }
-      else if (c == '.')
-        {
-          if (delim == '\'' || ! have_ellipsis_continuation (false))
-            buf << static_cast<char> (c);
-        }
-      else if (c == '\n')
-        {
-          error ("unterminated string constant");
-          break;
-        }
-      else if (c == delim)
-        {
-          if (escape_pending)
-            buf << static_cast<char> (c);
-          else
-            {
-              c = text_yyinput ();
-              if (c == delim)
-                {
-                  buf << static_cast<char> (c);
-                }
-              else
-                {
-                  std::string s;
-                  xunput (c);
-
-                  if (delim == '\'')
-                    s = buf.str ();
-                  else
-                    s = do_string_escapes (buf.str ());
-
-                  if (delim == '"')
-                    gripe_matlab_incompatible ("\" used as string delimiter");
-                  else if (delim == '\'')
-                    gripe_single_quote_string ();
-
-                  looking_for_object_index = true;
-                  at_beginning_of_statement = false;
-
-                  int tok = delim == '"' ? DQ_STRING : SQ_STRING;
-
-                  push_token (new token (tok, s, bos_line, bos_col));
-
-                  return tok;
-                }
-            }
-        }
-      else
-        {
-          buf << static_cast<char> (c);
-        }
-
-      escape_pending = 0;
-    }
-
-  return LEXICAL_ERROR;
-}
-
 int
 octave_base_lexer::handle_close_bracket (int bracket_type)
 {
@@ -2638,11 +2713,7 @@
       return kw_token;
     }
 
-  // Find the token in the symbol table.  Beware the magic
-  // transformation of the end keyword...
-
-  if (tok == "end")
-    tok = "__end__";
+  // Find the token in the symbol table.
 
   symbol_table::scope_id sid = symtab_context.curr_scope ();
 
@@ -2669,7 +2740,9 @@
 
   current_input_column += flex_yyleng ();
 
-  if (tok != "__end__")
+  // The magic end index can't be indexed.
+
+  if (tok != "end")
     looking_for_object_index = true;
 
   at_beginning_of_statement = false;
@@ -2980,6 +3053,14 @@
       std::cerr << "LINE_COMMENT_START" << std::endl;
       break;
 
+    case DQ_STRING_START:
+      std::cerr << "DQ_STRING_START" << std::endl;
+      break;
+
+    case SQ_STRING_START:
+      std::cerr << "SQ_STRING_START" << std::endl;
+      break;
+
     default:
       std::cerr << "UNKNOWN START STATE!" << std::endl;
       break;
--- a/libinterp/parse-tree/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -1,5 +1,6 @@
 EXTRA_DIST += \
   parse-tree/module.mk \
+  parse-tree/oct-parse.in.yy \
   parse-tree/octave.gperf
 
 PARSER_INC = \
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Sat Oct 05 11:22:09 2013 -0400
@@ -257,8 +257,8 @@
 %type <tree_constant_type> string constant magic_colon
 %type <tree_anon_fcn_handle_type> anon_fcn_handle
 %type <tree_fcn_handle_type> fcn_handle
-%type <tree_matrix_type> matrix_rows matrix_rows1
-%type <tree_cell_type> cell_rows cell_rows1
+%type <tree_matrix_type> matrix_rows
+%type <tree_cell_type> cell_rows
 %type <tree_expression_type> matrix cell
 %type <tree_expression_type> primary_expr oper_expr
 %type <tree_expression_type> simple_expr colon_expr assign_expr expression
@@ -282,13 +282,12 @@
 %type <tree_switch_command_type> switch_command
 %type <tree_switch_case_type> switch_case default_case
 %type <tree_switch_case_list_type> case_list1 case_list
-%type <tree_decl_elt_type> decl2
+%type <tree_decl_elt_type> decl2 param_list_elt
 %type <tree_decl_init_list_type> decl1
 %type <tree_decl_command_type> declaration
 %type <tree_statement_type> statement function_end
 %type <tree_statement_list_type> simple_list simple_list1 list list1
-%type <tree_statement_list_type> opt_list input1
-
+%type <tree_statement_list_type> opt_list
 %type <tree_classdef_attribute_type> attr
 %type <tree_classdef_attribute_list_type> attr_list opt_attr_list
 %type <tree_classdef_superclass_type> superclass
@@ -331,33 +330,24 @@
 // Statements and statement lists
 // ==============================
 
-input           : input1
+input           : simple_list '\n'
                   {
                     parser.stmt_list = $1;
                     YYACCEPT;
                   }
-                | simple_list parse_error
-                  { ABORT_PARSE; }
+                | simple_list END_OF_INPUT
+                  {
+                    lexer.end_of_input = true;
+                    parser.stmt_list = $1;
+                    YYACCEPT;
+                  }
                 | parse_error
                   { ABORT_PARSE; }
                 ;
 
-input1          : '\n'
+simple_list     : opt_sep_no_nl
                   { $$ = 0; }
-                | END_OF_INPUT
-                  {
-                    lexer.end_of_input = true;
-                    $$ = 0;
-                  }
-                | simple_list
-                  { $$ = $1; }
-                | simple_list '\n'
-                  { $$ = $1; }
-                | simple_list END_OF_INPUT
-                  { $$ = $1; }
-                ;
-
-simple_list     : simple_list1 opt_sep_no_nl
+                | simple_list1 opt_sep_no_nl
                   { $$ = parser.set_stmt_print_flag ($1, $2, false); }
                 ;
 
@@ -465,59 +455,62 @@
                   { $$ = $1; }
                 ;
 
-matrix          : '[' ']'
-                  { $$ = new tree_constant (octave_null_matrix::instance); }
-                | '[' ';' ']'
-                  { $$ = new tree_constant (octave_null_matrix::instance); }
-                | '[' ',' ']'
-                  { $$ = new tree_constant (octave_null_matrix::instance); }
-                | '[' matrix_rows ']'
+matrix          : '[' matrix_rows ']'
                   { $$ = parser.finish_matrix ($2); }
                 ;
 
-matrix_rows     : matrix_rows1
-                  { $$ = $1; }
-                | matrix_rows1 ';'      // Ignore trailing semicolon.
-                  { $$ = $1; }
-                ;
-
-matrix_rows1    : cell_or_matrix_row
-                  { $$ = new tree_matrix ($1); }
-                | matrix_rows1 ';' cell_or_matrix_row
+matrix_rows     : cell_or_matrix_row
+                  { $$ = $1 ? new tree_matrix ($1) : 0; }
+                | matrix_rows ';' cell_or_matrix_row
                   {
-                    $1->append ($3);
-                    $$ = $1;
+                    if ($1)
+                      {
+                        if ($3)
+                          $1->append ($3);
+
+                        $$ = $1;
+                      }
+                    else
+                      $$ = $3 ? new tree_matrix ($3) : 0;
                   }
                 ;
 
-cell            : '{' '}'
-                  { $$ = new tree_constant (octave_value (Cell ())); }
-                | '{' ';' '}'
-                  { $$ = new tree_constant (octave_value (Cell ())); }
-                | '{' cell_rows '}'
+cell            : '{' cell_rows '}'
                   { $$ = parser.finish_cell ($2); }
                 ;
 
-cell_rows       : cell_rows1
-                  { $$ = $1; }
-                | cell_rows1 ';'        // Ignore trailing semicolon.
-                  { $$ = $1; }
-                ;
-
-cell_rows1      : cell_or_matrix_row
-                  { $$ = new tree_cell ($1); }
-                | cell_rows1 ';' cell_or_matrix_row
+cell_rows       : cell_or_matrix_row
+                  { $$ = $1 ? new tree_cell ($1) : 0; }
+                | cell_rows ';' cell_or_matrix_row
                   {
-                    $1->append ($3);
-                    $$ = $1;
+                    if ($1)
+                      {
+                        if ($3)
+                          $1->append ($3);
+
+                        $$ = $1;
+                      }
+                    else
+                      $$ = $3 ? new tree_cell ($3) : 0;
                   }
                 ;
 
+// tree_argument_list objects can't be empty or have leading or trailing
+// commas, but those are all allowed in matrix and cell array rows.
+
 cell_or_matrix_row
-                : arg_list
+                : // empty
+                  { $$ = 0; }
+                | ','
+                  { $$ = 0; }
+                | arg_list
                   { $$ = $1; }
-                | arg_list ','          // Ignore trailing comma.
+                | arg_list ','
                   { $$ = $1; }
+                | ',' arg_list
+                  { $$ = $2; }
+                | ',' arg_list ','
+                  { $$ = $2; }
                 ;
 
 fcn_handle      : '@' FCN_HANDLE
@@ -832,10 +825,6 @@
                     lexer.looking_at_initializer_expression = false;
                     $$ = new tree_decl_elt ($1, $4);
                   }
-                | magic_tilde
-                  {
-                    $$ = new tree_decl_elt ($1);
-                  }
                 ;
 
 // ====================
@@ -1009,15 +998,15 @@
                     if (! ($$ = parser.make_unwind_command ($1, $4, $8, $9, $2, $6)))
                       ABORT_PARSE;
                   }
-                | TRY stash_comment opt_sep opt_list CATCH
-                  stash_comment opt_sep opt_list END
+                | TRY stash_comment opt_sep opt_list CATCH stash_comment
+                  opt_sep opt_list END
                   {
-                    if (! ($$ = parser.make_try_command ($1, $4, $8, $9, $2, $6)))
+                    if (! ($$ = parser.make_try_command ($1, $4, $7, $8, $9, $2, $6)))
                       ABORT_PARSE;
                   }
                 | TRY stash_comment opt_sep opt_list END
                   {
-                    if (! ($$ = parser.make_try_command ($1, $4, 0, $5, $2, 0)))
+                    if (! ($$ = parser.make_try_command ($1, $4, 0, 0, $5, $2, 0)))
                       ABORT_PARSE;
                   }
                 ;
@@ -1104,15 +1093,21 @@
                   }
                 ;
 
-param_list2     : decl2
+param_list2     : param_list_elt
                   { $$ = new tree_parameter_list ($1); }
-                | param_list2 ',' decl2
+                | param_list2 ',' param_list_elt
                   {
                     $1->append ($3);
                     $$ = $1;
                   }
                 ;
 
+param_list_elt  : decl2
+                  { $$ = $1; }
+                | magic_tilde
+                  { $$ = new tree_decl_elt ($1); }
+                ;
+
 // ===================================
 // List of function return value names
 // ===================================
@@ -1120,19 +1115,31 @@
 return_list     : '[' ']'
                   {
                     lexer.looking_at_return_list = false;
+
                     $$ = new tree_parameter_list ();
                   }
-                | return_list1
+                | identifier
                   {
                     lexer.looking_at_return_list = false;
-                    if ($1->validate (tree_parameter_list::out))
-                      $$ = $1;
+
+                    tree_parameter_list *tmp = new tree_parameter_list ($1);
+
+                    // Even though this parameter list can contain only
+                    // a single identifier, we still need to validate it
+                    // to check for varargin or varargout.
+
+                    if (tmp->validate (tree_parameter_list::out))
+                      $$ = tmp;
                     else
                       ABORT_PARSE;
                   }
                 | '[' return_list1 ']'
                   {
                     lexer.looking_at_return_list = false;
+
+                    // Check for duplicate parameter names, varargin,
+                    // or varargout.
+
                     if ($2->validate (tree_parameter_list::out))
                       $$ = $2;
                     else
@@ -2283,6 +2290,7 @@
 tree_command *
 octave_base_parser::make_try_command (token *try_tok,
                                       tree_statement_list *body,
+                                      char catch_sep,
                                       tree_statement_list *cleanup_stmts,
                                       token *end_tok,
                                       octave_comment_list *lc,
@@ -2297,7 +2305,26 @@
       int l = try_tok->line ();
       int c = try_tok->column ();
 
-      retval = new tree_try_catch_command (body, cleanup_stmts,
+      tree_identifier *id = 0;
+
+      if (! catch_sep && cleanup_stmts && ! cleanup_stmts->empty ())
+        {
+          tree_statement *stmt = cleanup_stmts->front ();
+
+          if (stmt)
+            {
+              tree_expression *expr = stmt->expression ();
+
+              if (expr && expr->is_identifier ())
+                {
+                  id = dynamic_cast<tree_identifier *> (expr);
+
+                  cleanup_stmts->pop_front ();
+                }
+            }
+        }
+
+      retval = new tree_try_catch_command (body, cleanup_stmts, id,
                                            lc, mc, tc, l, c);
     }
 
@@ -3340,7 +3367,9 @@
 tree_expression *
 octave_base_parser::finish_matrix (tree_matrix *m)
 {
-  return finish_array_list (m);
+  return (m
+          ? finish_array_list (m)
+          : new tree_constant (octave_null_matrix::instance));
 }
 
 // Finish building a cell list.
@@ -3348,7 +3377,9 @@
 tree_expression *
 octave_base_parser::finish_cell (tree_cell *c)
 {
-  return finish_array_list (c);
+  return (c
+          ? finish_array_list (c)
+          : new tree_constant (octave_value (Cell ())));
 }
 
 void
@@ -3804,7 +3835,7 @@
 
 DEFUN (autoload, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} autoload (@var{function}, @var{file})\n\
+@deftypefn  {Built-in Function} {} autoload (@var{function}, @var{file})\n\
 @deftypefnx {Built-in Function} {} autoload (@dots{}, @asis{\"remove\"})\n\
 Define @var{function} to autoload from @var{file}.\n\
 \n\
@@ -4034,9 +4065,9 @@
 @deftypefnx {Built-in Function} {} mfilename (\"fullpath\")\n\
 @deftypefnx {Built-in Function} {} mfilename (\"fullpathext\")\n\
 Return the name of the currently executing file.  At the top-level,\n\
-return the empty string.  Given the argument @code{\"fullpath\"},\n\
+return the empty string.  Given the argument @qcode{\"fullpath\"},\n\
 include the directory part of the file name, but not the extension.\n\
-Given the argument @code{\"fullpathext\"}, include the directory part\n\
+Given the argument @qcode{\"fullpathext\"}, include the directory part\n\
 of the file name and the extension.\n\
 @end deftypefn")
 {
@@ -4555,7 +4586,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} assignin (@var{context}, @var{varname}, @var{value})\n\
 Assign @var{value} to @var{varname} in context @var{context}, which\n\
-may be either @code{\"base\"} or @code{\"caller\"}.\n\
+may be either @qcode{\"base\"} or @qcode{\"caller\"}.\n\
 @seealso{evalin}\n\
 @end deftypefn")
 {
@@ -4609,8 +4640,8 @@
 @deftypefn  {Built-in Function} {} evalin (@var{context}, @var{try})\n\
 @deftypefnx {Built-in Function} {} evalin (@var{context}, @var{try}, @var{catch})\n\
 Like @code{eval}, except that the expressions are evaluated in the\n\
-context @var{context}, which may be either @code{\"caller\"} or\n\
-@code{\"base\"}.\n\
+context @var{context}, which may be either @qcode{\"caller\"} or\n\
+@qcode{\"base\"}.\n\
 @seealso{eval, assignin}\n\
 @end deftypefn")
 {
@@ -4693,3 +4724,54 @@
 
   return retval;
 }
+
+DEFUN (__parse_file__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} __parse_file__ (@var{file}, @var{verbose})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1 || nargin == 2)
+    {
+      std::string file = args(0).string_value ();
+      
+      std::string full_file = octave_env::make_absolute (file);
+
+      size_t file_len = file.length ();
+
+      if ((file_len > 4 && file.substr (file_len-4) == ".oct")
+          || (file_len > 4 && file.substr (file_len-4) == ".mex")
+          || (file_len > 2 && file.substr (file_len-2) == ".m"))
+        {
+          file = octave_env::base_pathname (file);
+          file = file.substr (0, file.find_last_of ('.'));
+
+          size_t pos = file.find_last_of (file_ops::dir_sep_str ());
+          if (pos != std::string::npos)
+            file = file.substr (pos+1);
+        }
+
+      if (! error_state)
+        {
+          if (nargin == 2)
+            octave_stdout << "parsing " << full_file << std::endl;
+
+          octave_function *fcn = parse_fcn_file (full_file, file, "", "",
+                                                 true, false, false,
+                                                 false, "__parse_file__");
+
+          if (fcn)
+            delete fcn;
+        }
+      else
+        error ("__parse_file__: expecting file name as argument");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
--- a/libinterp/parse-tree/parse.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/parse.h	Sat Oct 05 11:22:09 2013 -0400
@@ -215,8 +215,9 @@
   // Build a try-catch command.
   tree_command *
   make_try_command (token *try_tok, tree_statement_list *body,
-                    tree_statement_list *cleanup, token *end_tok,
-                    octave_comment_list *lc, octave_comment_list *mc);
+                    char catch_sep, tree_statement_list *cleanup,
+                    token *end_tok, octave_comment_list *lc,
+                    octave_comment_list *mc);
 
   // Build a while command.
   tree_command *
--- a/libinterp/parse-tree/pt-arg-list.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-arg-list.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -126,7 +126,7 @@
 static int index_position = 0;
 static int num_indices = 0;
 
-DEFCONSTFUN (__end__, , ,
+DEFCONSTFUN (end, , ,
   "internal function")
 {
   octave_value retval;
--- a/libinterp/parse-tree/pt-binop.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-binop.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -293,9 +293,9 @@
 To obtain short-circuit behavior for logical expressions in new programs,\n\
 you should always use the @samp{&&} and @samp{||} operators.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (do_braindead_shortcircuit_evaluation);
--- a/libinterp/parse-tree/pt-check.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-check.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -504,6 +504,15 @@
 {
   tree_statement_list *try_code = cmd.body ();
 
+  tree_identifier *expr_id = cmd.identifier ();
+
+  if (expr_id)
+    {
+      if (! expr_id->lvalue_ok ())
+        gripe ("invalid lvalue used for identifier in try-catch command",
+               cmd.line ());
+    }
+
   if (try_code)
     try_code->accept (*this);
 
--- a/libinterp/parse-tree/pt-eval.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -816,18 +816,18 @@
                 break;
               else
                 {
-                  // Clear preivous values before next statement is
+                  // Clear previous values before next statement is
                   // evaluated so that we aren't holding an extra
                   // reference to a value that may be used next.  For
                   // example, in code like this:
                   //
-                  //   X = rand (N);  ## refcount for X should be 1
-                  //                  ## after this statement
+                  //   X = rand (N);  # refcount for X should be 1
+                  //                  # after this statement
                   //
-                  //   X(idx) = val;  ## no extra copy of X should be
-                  //                  ## needed, but we will be faked
-                  //                  ## out if retval is not cleared
-                  //                  ## between statements here
+                  //   X(idx) = val;  # no extra copy of X should be
+                  //                  # needed, but we will be faked
+                  //                  # out if retval is not cleared
+                  //                  # between statements here
 
                   //              result_values = empty_list;
                 }
@@ -927,6 +927,27 @@
 
           buffer_error_messages--;
 
+          tree_identifier *expr_id = cmd.identifier ();
+          octave_lvalue ult;
+
+          if (expr_id)
+            {
+
+              octave_scalar_map err;
+
+              ult = expr_id->lvalue ();
+
+              if (error_state)
+                return;
+
+              err.assign ("message", last_error_message ());
+              err.assign ("identifier", last_error_id ());
+
+              if (! error_state)
+                ult.assign (octave_value::op_asn_eq, err);
+
+            }
+
           if (catch_code)
             catch_code->accept (*this);
         }
@@ -1244,9 +1265,9 @@
 be called recursively.  If the limit is exceeded, an error message is\n\
 printed and control returns to the top level.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.\n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (max_recursion_depth);
@@ -1274,9 +1295,9 @@
 Octave will display the results produced by evaluating expressions\n\
 within a function body that are not terminated with a semicolon.\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.\n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (silent_functions);
--- a/libinterp/parse-tree/pt-except.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-except.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -33,6 +33,7 @@
 #include "pt-cmd.h"
 #include "pt-except.h"
 #include "pt-exp.h"
+#include "pt-id.h"
 #include "pt-jump.h"
 #include "pt-stmt.h"
 #include "pt-walk.h"
@@ -43,6 +44,7 @@
 
 tree_try_catch_command::~tree_try_catch_command (void)
 {
+  delete expr_id;
   delete try_code;
   delete catch_code;
   delete lead_comm;
@@ -57,6 +59,7 @@
   return new
     tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0,
                             catch_code ? catch_code->dup (scope, context) : 0,
+                            expr_id ? expr_id->dup (scope, context) : 0,
                             lead_comm ? lead_comm->dup () : 0,
                             mid_comm ? mid_comm->dup () : 0,
                             trail_comm ? trail_comm->dup () : 0,
--- a/libinterp/parse-tree/pt-except.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-except.h	Sat Oct 05 11:22:09 2013 -0400
@@ -29,6 +29,7 @@
 
 #include "comment-list.h"
 #include "pt-cmd.h"
+#include "pt-id.h"
 #include "symtab.h"
 
 // Simple exception handling.
@@ -39,19 +40,22 @@
 public:
 
   tree_try_catch_command (int l = -1, int c = -1)
-    : tree_command (l, c), try_code (0), catch_code (0), lead_comm (0),
+    : tree_command (l, c), try_code (0), catch_code (0), expr_id (0), lead_comm (0),
       mid_comm (0), trail_comm (0) { }
 
   tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
+                          tree_identifier *id,
                           octave_comment_list *cl = 0,
                           octave_comment_list *cm = 0,
                           octave_comment_list *ct = 0,
                           int l = -1, int c = -1)
-    : tree_command (l, c), try_code (tc), catch_code (cc),
+    : tree_command (l, c), try_code (tc), catch_code (cc), expr_id (id),
       lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
 
   ~tree_try_catch_command (void);
 
+  tree_identifier *identifier (void) { return expr_id; }
+
   tree_statement_list *body (void) { return try_code; }
 
   tree_statement_list *cleanup (void) { return catch_code; }
@@ -75,6 +79,9 @@
   // The code to execute if an error occurs in the first block.
   tree_statement_list *catch_code;
 
+  // Identifier to modify.
+  tree_identifier *expr_id;
+
   // Comment preceding TRY token.
   octave_comment_list *lead_comm;
 
--- a/libinterp/parse-tree/pt-id.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-id.h	Sat Oct 05 11:22:09 2013 -0400
@@ -56,7 +56,7 @@
 
   ~tree_identifier (void) { }
 
-  bool has_magic_end (void) const { return (name () == "__end__"); }
+  bool has_magic_end (void) const { return (name () == "end"); }
 
   bool is_identifier (void) const { return true; }
 
--- a/libinterp/parse-tree/pt-idx.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-idx.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -360,7 +360,7 @@
                   // contains the second (or third, etc.) "end" token,
                   // so we must evaluate everything up to the point of
                   // that argument list so we can pass the appropriate
-                  // value to the built-in __end__ function.
+                  // value to the built-in end function.
 
                   const octave_value_list tmp_list
                     = tmp.subsref (type.substr (tmpi, i - tmpi), idx, nargout);
--- a/libinterp/parse-tree/pt-mat.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-mat.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1336,6 +1336,34 @@
 
 %!assert (class ([cell(1), struct("foo", "bar")]), "cell")
 %!error [struct("foo", "bar"), cell(1)]
+
+%!assert ([,1], 1)
+%!assert ([1,], 1)
+%!assert ([,1,], 1)
+%!assert ([,1,;;], 1)
+%!assert ([,1,;,;], 1)
+
+%!assert ([1,1], ones (1, 2))
+%!assert ([,1,1], ones (1, 2))
+%!assert ([1,1,], ones (1, 2))
+%!assert ([,1,1,], ones (1, 2))
+%!assert ([,1,1,;;], ones (1, 2))
+%!assert ([,1,1,;,;], ones (1, 2))
+%!assert ([,;,1,1], ones (1, 2))
+
+%!assert ([1;1], ones (2, 1))
+%!assert ([1,;1], ones (2, 1))
+%!assert ([1,;,;1], ones (2, 1))
+
+%!error eval ("[,,]")
+%!error eval ("[,,;,]")
+%!error eval ("[,;,,;,]")
+
+%!assert (isnull ([,]))
+%!assert (isnull ([;]))
+%!assert (isnull ([;;]))
+%!assert (isnull ([;,;]))
+%!assert (isnull ([,;,;,]))
 */
 
 DEFUN (string_fill_char, args, nargout,
@@ -1345,7 +1373,7 @@
 @deftypefnx {Built-in Function} {} string_fill_char (@var{new_val}, \"local\")\n\
 Query or set the internal variable used to pad all rows of a character\n\
 matrix to the same length.  It must be a single character.  The default\n\
-value is @code{\" \"} (a single space).  For example:\n\
+value is @qcode{\" \"} (a single space).  For example:\n\
 \n\
 @example\n\
 @group\n\
@@ -1357,9 +1385,9 @@
 @end group\n\
 @end example\n\
 \n\
-When called from inside a function with the \"local\" option, the variable is\n\
-changed locally for the function and any subroutines it calls.  The original\n\
-variable value is restored when exiting the function.\n\
+When called from inside a function with the @qcode{\"local\"} option, the\n\
+variable is changed locally for the function and any subroutines it calls.  \n\
+The original variable value is restored when exiting the function.\n\
 @end deftypefn")
 {
   return SET_INTERNAL_VARIABLE (string_fill_char);
--- a/libinterp/parse-tree/pt-misc.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-misc.h	Sat Oct 05 11:22:09 2013 -0400
@@ -59,6 +59,9 @@
   tree_parameter_list (tree_decl_elt *t)
     : marked_for_varargs (0) { append (t); }
 
+  tree_parameter_list (tree_identifier *id)
+    : marked_for_varargs (0) { append (new tree_decl_elt (id)); }
+
   ~tree_parameter_list (void);
 
   void mark_as_formal_parameters (void);
--- a/libinterp/parse-tree/pt-pr-code.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/parse-tree/pt-pr-code.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -1005,6 +1005,7 @@
   newline ();
 
   tree_statement_list *try_code = cmd.body ();
+  tree_identifier *expr_id = cmd.identifier ();
 
   if (try_code)
     {
@@ -1021,6 +1022,12 @@
 
   os << "catch";
 
+  if (expr_id)
+    {
+      os << " ";
+      expr_id->accept (*this);
+    }
+
   newline ();
 
   tree_statement_list *catch_code = cmd.cleanup ();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/version.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,131 @@
+/*
+
+Copyright (C) 2013 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+
+#include "defaults.h"
+#include "version.h"
+
+static std::string
+octave_warranty_statement (const std::string& extra_info = std::string ())
+{
+  return "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\
+FITNESS FOR A PARTICULAR PURPOSE."
+    + extra_info;
+}
+
+static std::string
+format_url (bool html, const std::string& url)
+{
+  return html ? "<a href=\"" + url + "\">" + url + "</a>" : url;
+}
+
+std::string
+octave_www_statement (bool html)
+{
+  return "Additional information about Octave is available at "
+    + format_url (html, "http://www.octave.org.");
+}
+
+std::string
+octave_contrib_statement (bool html)
+{
+  return "Please contribute if you find this software useful.\n\
+For more information, visit "
+    + format_url (html, "http://www.octave.org/get-involved.html");
+}
+
+std::string
+octave_bugs_statement (bool html)
+{
+  return "Read " + format_url (html, "http://www.octave.org/bugs.html")
+    + " to learn how to submit bug reports.";
+}
+
+std::string
+octave_name_version_and_copyright (void)
+{
+  // The GNU coding standards say that on the first line printed by
+  // --version, the version number should follow the last space on the
+  // line.
+
+  return "GNU Octave, version " OCTAVE_VERSION "\n" OCTAVE_COPYRIGHT;
+}
+
+std::string
+octave_name_version_copyright_copying_and_warranty
+ (bool html, const std::string& extra_info)
+{
+  std::string br = html ? "<br>\n" : "\n";
+  std::string sep = html ? "\n</p>\n<p>\n" : "\n\n";
+
+  return octave_name_version_and_copyright ()
+    + br
+    + "This is free software; see the source code for copying conditions."
+    + br
+    + octave_warranty_statement (extra_info)
+    + sep
+    + "Octave was configured for \"" OCTAVE_CANONICAL_HOST_TYPE "\".";
+}
+
+std::string
+octave_name_version_copyright_copying_warranty_and_bugs
+  (bool html, const std::string& extra_info)
+{
+  std::string sep = html ? "\n</p>\n<p>\n" : "\n\n";
+
+  std::string msg;
+
+  if (html)
+    msg = "<p>\n";
+
+  msg += octave_name_version_copyright_copying_and_warranty (html, extra_info)
+    + sep
+    + octave_www_statement (html)
+    + sep
+    + octave_contrib_statement (html)
+    + sep
+    + octave_bugs_statement (html)
+    + (html ? "\n</p>" : "");
+
+  return msg;
+}
+
+std::string
+octave_startup_message (bool html)
+{
+  std::string msg
+    = octave_name_version_copyright_copying_warranty_and_bugs
+        (html, "  For details, type 'warranty'.");
+
+  msg += (html ? "<p>\n" : "\n");
+
+  msg += "For information about changes from previous versions, type 'news'.";
+
+  msg += (html ? "\n</p>" : "");
+
+  return msg;
+}
--- a/libinterp/version.in.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/libinterp/version.in.h	Sat Oct 05 11:22:09 2013 -0400
@@ -26,67 +26,28 @@
 
 #define OCTAVE_VERSION %OCTAVE_VERSION%
 
-#define OCTAVE_API_VERSION_NUMBER %OCTAVE_API_VERSION_NUMBER%
-
 #define OCTAVE_API_VERSION %OCTAVE_API_VERSION%
 
 #define OCTAVE_RELEASE_DATE %OCTAVE_RELEASE_DATE%
 
 #define OCTAVE_COPYRIGHT %OCTAVE_COPYRIGHT%
 
-// This is the first line printed by --version.  The GNU coding
-// standards say that the version number should follow the last space
-// on the line.
-
-#define OCTAVE_NAME_AND_VERSION "GNU Octave, version " OCTAVE_VERSION
+extern std::string octave_www_statement (bool html = false);
 
-#define OCTAVE_CONFIG_STATEMENT \
-  "Octave was configured for \"" OCTAVE_CANONICAL_HOST_TYPE "\"."
-
-#define OCTAVE_COPYING_STATEMENT \
-  "This is free software; see the source code for copying conditions."
+extern std::string octave_contrib_statement (bool html = false);
 
-#define X_OCTAVE_WARRANTY_STATEMENT(ARG) \
-  "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\
-FITNESS FOR A PARTICULAR PURPOSE." ARG
-
-#define OCTAVE_WARRANTY_STATEMENT \
-  X_OCTAVE_WARRANTY_STATEMENT ("")
+extern std::string octave_bugs_statement (bool html = false);
 
-#define OCTAVE_WWW_STATEMENT \
-  "Additional information about Octave is available at http://www.octave.org."
-
-#define OCTAVE_CONTRIB_STATEMENT \
-  "Please contribute if you find this software useful.\n\
-For more information, visit http://www.octave.org/get-involved.html"
+extern std::string octave_name_version_and_copyright (void);
 
-#define OCTAVE_BUGS_STATEMENT \
-  "Read http://www.octave.org/bugs.html to learn how to submit bug reports."
-
-#define OCTAVE_NAME_VERSION_AND_COPYRIGHT \
-  OCTAVE_NAME_AND_VERSION "\n" \
-  OCTAVE_COPYRIGHT
-
-#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY("") \
+extern std::string
+octave_name_version_copyright_copying_and_warranty
+  (bool html = false, const std::string& extra_info = std::string ());
 
-#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) \
-  OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n" \
-  OCTAVE_COPYING_STATEMENT "\n" \
-  X_OCTAVE_WARRANTY_STATEMENT (ARG) "\n\n" \
-  OCTAVE_CONFIG_STATEMENT
+extern std::string
+octave_name_version_copyright_copying_warranty_and_bugs
+  (bool html = false, const std::string& extra_info = std::string ());
 
-#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS(ARG) \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) "\n\n" \
-  OCTAVE_WWW_STATEMENT "\n\n" \
-  OCTAVE_CONTRIB_STATEMENT "\n\n" \
-  OCTAVE_BUGS_STATEMENT
+extern std::string octave_startup_message (bool html = false);
 
-#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS ("")
-
-#define OCTAVE_STARTUP_MESSAGE \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
-    ("  For details, type 'warranty'.") "\n\n" \
-  "For information about changes from previous versions, type 'news'."
 #endif
--- a/liboctave/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -20,8 +20,6 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 ## Run cruft dir with stand-alone Makefile.
 ## Eventually this will use module.mk syntax.
 SUBDIRS = cruft
@@ -125,7 +123,8 @@
   $(array_libarray_la_SOURCES) \
   $(numeric_libnumeric_la_SOURCES) \
   $(system_libsystem_la_SOURCES) \
-  $(util_libutil_la_SOURCES)
+  $(util_libutil_la_SOURCES) \
+  $(TEMPLATE_SRC)
 
 TST_FILES_SRC := $(shell $(top_srcdir)/build-aux/find-files-with-tests.sh "$(srcdir)" $(LIBOCTAVE_TST_SRC))
 
--- a/liboctave/array/Sparse.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/array/Sparse.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -2623,7 +2623,7 @@
  *
 
 %!function x = set_slice (x, dim, slice, arg)
-%!  switch dim
+%!  switch (dim)
 %!    case 11
 %!      x(slice) = 2;
 %!    case 21
@@ -2636,7 +2636,7 @@
 %!endfunction
 
 %!function x = set_slice2 (x, dim, slice)
-%!  switch dim
+%!  switch (dim)
 %!    case 11
 %!      x(slice) = 2 * ones (size (slice));
 %!    case 21
@@ -2793,6 +2793,23 @@
 %! s(1,:) = [];
 %! assert (s, sparse ([], [], [], 0, 1));
 
+## Test (bug #37321)
+%!test a=sparse (0,0); assert (all (a) == sparse ([1]));
+%!test a=sparse (0,1); assert (all (a) == sparse ([1]));
+%!test a=sparse (1,0); assert (all (a) == sparse ([1]));
+%!test a=sparse (1,0); assert (all (a,2) == sparse ([1]));
+%!test a=sparse (1,0); assert (size (all (a,1)), [1 0]);
+%!test a=sparse (1,1);
+%! assert (all (a) == sparse ([0]));
+%! assert (size (all (a)), [1 1]);
+%!test a=sparse (2,1);
+%! assert (all (a) == sparse ([0]));
+%! assert (size (all (a)), [1 1]);
+%!test a=sparse (1,2);
+%! assert (all (a) == sparse ([0]));
+%! assert (size (all (a)), [1 1]);
+%!test a=sparse (2,2); assert (isequal (all (a), sparse ([0 0])));
+
 */
 
 template <class T>
--- a/liboctave/cruft/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/cruft/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -20,8 +20,6 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 ## Search local directories before those specified by the user.
 AM_CPPFLAGS = \
   -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu
--- a/liboctave/link-deps.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/link-deps.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -15,6 +15,7 @@
 
 LIBOCTAVE_LINK_DEPS = \
   $(GNULIB_LINK_DEPS) \
+  $(CURL_LIBS) \
   $(SPARSE_XLIBS) \
   $(ARPACK_LIBS) \
   $(QRUPDATE_LIBS) \
@@ -31,6 +32,7 @@
   $(LIBS)
 
 LIBOCTAVE_LINK_OPTS = \
+  $(CURL_LDFLAGS) \
   $(SPARSE_XLDFLAGS) \
   $(ARPACK_LDFLAGS) \
   $(QRUPDATE_LDFLAGS) \
--- a/liboctave/numeric/DASPK-opts.in	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/DASPK-opts.in	Sat Oct 05 11:22:09 2013 -0400
@@ -103,7 +103,7 @@
 initial conditions that are consistent).
 
 If this option is set to a nonzero value, you must also set the
-@code{\"algebraic variables\"} option to declare which variables in the
+@qcode{\"algebraic variables\"} option to declare which variables in the
 problem are algebraic.
 
   END_DOC_ITEM
@@ -139,11 +139,11 @@
 
 @item MXNH
 Maximum number of values of the artificial stepsize parameter to be
-tried if the @code{\"compute consistent initial condition\"} option has
+tried if the @qcode{\"compute consistent initial condition\"} option has
 been set to 1 (default is 5).
 
 Note that the maximum total number of Newton iterations allowed is
-@code{MXNIT*MXNJ*MXNH} if the @code{\"compute consistent initial
+@code{MXNIT*MXNJ*MXNH} if the @qcode{\"compute consistent initial
 condition\"} option has been set to 1 and @code{MXNIT*MXNJ} if it is
 set to 2.
 
@@ -194,7 +194,7 @@
   NAME = "exclude algebraic variables from error test"
   DOC_ITEM
 Set to a nonzero value to exclude algebraic variables from the error
-test.  You must also set the @code{\"algebraic variables\"} option to
+test.  You must also set the @qcode{\"algebraic variables\"} option to
 declare which variables in the problem are algebraic (default is 0).
 
   END_DOC_ITEM
@@ -212,8 +212,8 @@
 in the equation set.
 
 This option is required by the
-@code{compute consistent initial condition\"} and
-@code{\"exclude algebraic variables from error test\"} options.
+@qcode{compute consistent initial condition\"} and
+@qcode{\"exclude algebraic variables from error test\"} options.
 
   END_DOC_ITEM
   TYPE = "Array<octave_idx_type>"
@@ -239,7 +239,7 @@
   NAME = "enforce inequality constraints"
   DOC_ITEM
 Set to one of the following values to enforce the inequality
-constraints specified by the @code{\"inequality constraint types\"}
+constraints specified by the @qcode{\"inequality constraint types\"}
 option (default is 0).
 
 @enumerate
@@ -282,7 +282,7 @@
 @end table
 
 This option only has an effect if the
-@code{\"enforce inequality constraints\"} option is nonzero.
+@qcode{\"enforce inequality constraints\"} option is nonzero.
 
   END_DOC_ITEM
   TYPE = "Array<octave_idx_type>"
--- a/liboctave/numeric/LSODE-opts.in	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/LSODE-opts.in	Sat Oct 05 11:22:09 2013 -0400
@@ -74,12 +74,12 @@
 system.  Valid values are
 
 @table @asis
-@item \"adams\"
-@itemx \"non-stiff\"
+@item  @qcode{\"adams\"}
+@itemx @qcode{\"non-stiff\"}
 No Jacobian used (even if it is available).
 
-@item \"bdf\"
-@itemx \"stiff\"
+@item  @qcode{\"bdf\"}
+@itemx @qcode{\"stiff\"}
 Use stiff backward differentiation formula (BDF) method.  If a
 function to compute the Jacobian is not supplied, @code{lsode} will
 compute a finite difference approximation of the Jacobian matrix.
--- a/liboctave/numeric/lo-mappers.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/lo-mappers.h	Sat Oct 05 11:22:09 2013 -0400
@@ -234,7 +234,7 @@
 T
 X_NINT (T x)
 {
-  return (xisinf (x) || xisnan (x)) ? x : xfloor (x + 0.5);
+  return (xfinite (x) ? xfloor (x + 0.5) : x);
 }
 
 inline OCTAVE_API double D_NINT (double x) { return X_NINT (x); }
--- a/liboctave/numeric/lo-specfun.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/lo-specfun.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -3568,3 +3568,100 @@
 
   return retval;
 }
+
+void
+ellipj (double u, double m, double& sn, double& cn, double& dn, double& err)
+{
+  static const int Nmax = 16;
+  double m1, t=0, si_u, co_u, se_u, ta_u, b, c[Nmax], a[Nmax], phi;
+  int n, Nn, ii;
+
+  if (m < 0 || m > 1)
+    {
+      (*current_liboctave_warning_handler)
+        ("ellipj: expecting 0 <= M <= 1");
+      sn = cn = dn = lo_ieee_nan_value ();
+      return;
+    }
+
+  double sqrt_eps = sqrt (std::numeric_limits<double>::epsilon ());
+  if (m < sqrt_eps)
+    {
+      // For small m, ( Abramowitz and Stegun, Section 16.13 )
+      si_u = sin (u);
+      co_u = cos (u);
+      t = 0.25*m*(u - si_u*co_u);
+      sn = si_u - t * co_u;
+      cn = co_u + t * si_u;
+      dn = 1 - 0.5*m*si_u*si_u;
+    }
+  else if ((1 - m) < sqrt_eps)
+    {
+      // For m1 = (1-m) small ( Abramowitz and Stegun, Section 16.15 )
+      m1 = 1 - m;
+      si_u = sinh (u);
+      co_u = cosh (u);
+      ta_u = tanh (u);
+      se_u = 1/co_u;
+      sn = ta_u + 0.25*m1*(si_u*co_u - u)*se_u*se_u;
+      cn = se_u - 0.25*m1*(si_u*co_u - u)*ta_u*se_u;
+      dn = se_u + 0.25*m1*(si_u*co_u + u)*ta_u*se_u;
+    }
+  else
+    {
+      //  Arithmetic-Geometric Mean (AGM) algorithm
+      //    ( Abramowitz and Stegun, Section 16.4 )
+      a[0] = 1;
+      b    = sqrt (1 - m);
+      c[0] = sqrt (m);
+      for (n = 1; n < Nmax; ++n)
+        {
+          a[n] = (a[n - 1] + b)/2;
+          c[n] = (a[n - 1] - b)/2;
+          b = sqrt (a[n - 1]*b);
+          if (c[n]/a[n] < std::numeric_limits<double>::epsilon ()) break;
+        }
+      if (n >= Nmax - 1)
+        {
+          err = 1;
+          return;
+        }
+      Nn = n;
+      for (ii = 1; n > 0; ii = ii*2, --n) ; // ii = pow(2,Nn)
+      phi = ii*a[Nn]*u;
+      for (n = Nn; n > 0; --n)
+        {
+          t = phi;
+          phi = (asin ((c[n]/a[n])* sin (phi)) + phi)/2;
+        }
+      sn = sin (phi);
+      cn = cos (phi);
+      dn = cn/cos (t - phi);
+    }
+}
+
+void
+ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, double& err)
+{
+  double m1 = 1 - m, ss1, cc1, dd1;
+
+  ellipj (imag (u), m1, ss1, cc1, dd1, err);
+  if (real (u) == 0)
+    {
+      // u is pure imag: Jacoby imag. transf.
+      sn = Complex (0, ss1/cc1);
+      cn = 1/cc1;         //    cn.imag = 0;
+      dn = dd1/cc1;       //    dn.imag = 0;
+    }
+  else
+    {
+      // u is generic complex
+      double ss, cc, dd, ddd;
+
+      ellipj (real (u), m, ss, cc, dd, err);
+      ddd = cc1*cc1 + m*ss*ss*ss1*ss1;
+      sn = Complex (ss*dd1/ddd, cc*dd*ss1*cc1/ddd);
+      cn = Complex (cc*cc1/ddd, -ss*dd*ss1*dd1/ddd);
+      dn = Complex (dd*cc1*dd1/ddd, -m*ss*cc*ss1/ddd);
+    }
+}
--- a/liboctave/numeric/lo-specfun.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/lo-specfun.h	Sat Oct 05 11:22:09 2013 -0400
@@ -607,4 +607,7 @@
 extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, const Array<double>& a, double b);
 extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, const Array<double>& a, const Array<double>& b);
 
+extern OCTAVE_API void ellipj (double u, double m, double& sn, double& cn, double& dn, double& err);
+extern OCTAVE_API void ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, double& err);
+
 #endif
--- a/liboctave/numeric/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -168,11 +168,13 @@
   numeric/sparse-dmsolve.cc
 
 ## Special rules for sources which must be built before rest of compilation.
-$(OPT_INC) : %.h : %.in $(top_srcdir)/build-aux/mk-opts.pl
+$(OPT_INC) : %.h : %.in
 	@echo making $@ from $<
 	@$(PERL) $(top_srcdir)/build-aux/mk-opts.pl --opt-class-header $< > $@-t
 	mv $@-t $@
 
+$(OPT_INC) : $(top_srcdir)/build-aux/mk-opts.pl
+
 noinst_LTLIBRARIES += numeric/libnumeric.la
 
 numeric_libnumeric_la_SOURCES = $(NUMERIC_SRC)
--- a/liboctave/numeric/oct-rand.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/oct-rand.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -360,7 +360,7 @@
           break;
 
         case poisson_dist:
-          if (a < 0.0 || xisnan (a) || xisinf (a))
+          if (a < 0.0 || ! xfinite (a))
             retval = octave_NaN;
           else
             {
@@ -371,7 +371,7 @@
           break;
 
         case gamma_dist:
-          if (a <= 0.0 || xisnan (a) || xisinf (a))
+          if (a <= 0.0 || ! xfinite (a))
             retval = octave_NaN;
           else
             F77_FUNC (dgengam, DGENGAM) (1.0, a, retval);
@@ -443,7 +443,7 @@
           break;
 
         case poisson_dist:
-          if (da < 0.0 || xisnan (da) || xisinf (da))
+          if (da < 0.0 || ! xfinite (a))
             dretval = octave_NaN;
           else
             {
@@ -454,7 +454,7 @@
           break;
 
         case gamma_dist:
-          if (da <= 0.0 || xisnan (da) || xisinf (da))
+          if (da <= 0.0 || ! xfinite (a))
             retval = octave_NaN;
           else
             F77_FUNC (dgengam, DGENGAM) (1.0, da, dretval);
@@ -663,6 +663,30 @@
   return retval;
 }
 
+// Guarantee reproducible conversion of negative initialization values to
+// random number algorithm.  Note that Matlab employs slightly different rules.
+// 1) Seed saturates at 2^32-1 for any value larger than that.
+// 2) NaN, Inf are translated to 2^32-1.
+// 3) -Inf is translated to 0.
+static uint32_t
+double2uint32 (double d)
+{
+  uint32_t u;
+  static const double TWOUP32 = std::numeric_limits<uint32_t>::max() + 1.0;
+
+  if (! xfinite (d))
+    u = 0;
+  else
+    {
+      d = fmod (d, TWOUP32);
+      if (d < 0)
+        d += TWOUP32;
+      u = static_cast<uint32_t> (d);
+    }
+
+  return u;
+}
+
 void
 octave_rand::set_internal_state (const ColumnVector& s)
 {
@@ -672,7 +696,7 @@
   OCTAVE_LOCAL_BUFFER (uint32_t, tmp, MT_N + 1);
 
   for (octave_idx_type i = 0; i < n; i++)
-    tmp[i] = static_cast<uint32_t> (s.elem (i));
+    tmp[i] = double2uint32 (s.elem (i));
 
   if (len == MT_N + 1 && tmp[MT_N] <= MT_N && tmp[MT_N] > 0)
     oct_set_state (tmp);
@@ -748,7 +772,7 @@
     case poisson_dist:
       if (use_old_generators)
         {
-          if (a < 0.0 || xisnan (a) || xisinf (a))
+          if (a < 0.0 || ! xfinite (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -769,7 +793,7 @@
     case gamma_dist:
       if (use_old_generators)
         {
-          if (a <= 0.0 || xisnan (a) || xisinf (a))
+          if (a <= 0.0 || ! xfinite (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -838,7 +862,7 @@
       if (use_old_generators)
         {
           double da = a;
-          if (da < 0.0 || xisnan (da) || xisinf (da))
+          if (da < 0.0 || ! xfinite (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -860,7 +884,7 @@
       if (use_old_generators)
         {
           double da = a;
-          if (da <= 0.0 || xisnan (da) || xisinf (da))
+          if (da <= 0.0 || ! xfinite (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
--- a/liboctave/numeric/randmtzig.c	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/numeric/randmtzig.c	Sat Oct 05 11:22:09 2013 -0400
@@ -268,7 +268,7 @@
             unsigned char word[4];
             if (fread (word, 4, 1, urandom) != 1)
               break;
-            entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+(word[3]<<24);
+            entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+((uint32_t)word[3]<<24);
           }
         fclose (urandom);
       }
--- a/liboctave/operators/Sparse-op-defs.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/operators/Sparse-op-defs.h	Sat Oct 05 11:22:09 2013 -0400
@@ -1766,7 +1766,7 @@
           for (octave_idx_type i = 0; i < nc ; i++) \
             { \
               retval.ridx (i) = 0; \
-              retval.cidx (i+1) = i; \
+              retval.cidx (i+1) = i+1; \
               retval.data (i) = MT_RESULT; \
             } \
         } \
--- a/liboctave/system/mach-info.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/system/mach-info.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -75,14 +75,6 @@
 {
   oct_mach_info::float_format retval = oct_mach_info::flt_fmt_unknown;
 
-#if defined (CRAY)
-
-  // FIXME -- this should be determined automatically.
-
-  native_float_fmt = oct_mach_info::flt_fmt_cray;
-
-#else
-
   float_params fp[5];
 
   INIT_FLT_PAR (fp[0], oct_mach_info::flt_fmt_ieee_big_endian,
@@ -97,18 +89,6 @@
                  0, 1017118720,
                  0, 1018167296);
 
-  INIT_FLT_PAR (fp[2], oct_mach_info::flt_fmt_vax_d,
-                   128,  0,
-                -32769, -1,
-                  9344,  0,
-                  9344,  0);
-
-  INIT_FLT_PAR (fp[3], oct_mach_info::flt_fmt_vax_g,
-                    16,  0,
-                -32769, -1,
-                 15552,  0,
-                 15552,  0);
-
   INIT_FLT_PAR (fp[4], oct_mach_info::flt_fmt_unknown,
                 0, 0,
                 0, 0,
@@ -133,8 +113,6 @@
     }
   while (fp[++i].fp_fmt != oct_mach_info::flt_fmt_unknown);
 
-#endif
-
   return retval;
 }
 
@@ -214,12 +192,6 @@
     retval = oct_mach_info::flt_fmt_ieee_big_endian;
   else if (s == "ieee-le" || s == "l")
     retval = oct_mach_info::flt_fmt_ieee_little_endian;
-  else if (s == "vaxd" || s == "d")
-    retval = oct_mach_info::flt_fmt_vax_d;
-  else if (s == "vaxg" || s == "g")
-    retval = oct_mach_info::flt_fmt_vax_g;
-  else if (s == "cray" || s == "c")
-    retval = oct_mach_info::flt_fmt_cray;
   else if (s == "unknown")
     retval = oct_mach_info::flt_fmt_unknown;
   else
@@ -244,18 +216,6 @@
       retval = "ieee-le";
       break;
 
-    case flt_fmt_vax_d:
-      retval = "vaxd";
-      break;
-
-    case flt_fmt_vax_g:
-      retval = "vaxg";
-      break;
-
-    case flt_fmt_cray:
-      retval = "cray";
-      break;
-
     default:
       break;
     }
--- a/liboctave/system/mach-info.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/system/mach-info.h	Sat Oct 05 11:22:09 2013 -0400
@@ -40,9 +40,6 @@
       flt_fmt_unknown,
       flt_fmt_ieee_little_endian,
       flt_fmt_ieee_big_endian,
-      flt_fmt_vax_d,
-      flt_fmt_vax_g,
-      flt_fmt_cray
     };
 
   static bool instance_ok (void);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/action-container.h	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,341 @@
+/*
+
+Copyright (C) 1993-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_action_container_h)
+#define octave_action_container_h 1
+
+// This class allows registering actions in a list for later
+// execution, either explicitly or when the container goes out of
+// scope.
+
+// FIXME -- is there a better name for this class?
+
+class
+action_container
+{
+public:
+
+  // A generic unwind_protect element. Knows how to run itself and
+  // discard itself.  Also, contains a pointer to the next element.
+  class elem
+  {
+  public:
+    elem (void) { }
+
+    virtual void run (void) { }
+
+    virtual ~elem (void) { }
+
+    friend class action_container;
+
+  private:
+
+    // No copying!
+
+    elem (const elem&);
+
+    elem& operator = (const elem&);
+  };
+
+  // An element that merely runs a void (*)(void) function.
+
+  class fcn_elem : public elem
+  {
+  public:
+    fcn_elem (void (*fptr) (void))
+      : e_fptr (fptr) { }
+
+    void run (void) { e_fptr (); }
+
+  private:
+    void (*e_fptr) (void);
+  };
+
+  // An element that stores a variable of type T along with a void (*) (T)
+  // function pointer, and calls the function with the parameter.
+
+  template <class T>
+  class fcn_arg_elem : public elem
+  {
+  public:
+    fcn_arg_elem (void (*fcn) (T), T arg)
+      : e_fcn (fcn), e_arg (arg) { }
+
+    void run (void) { e_fcn (e_arg); }
+
+  private:
+
+    // No copying!
+
+    fcn_arg_elem (const fcn_arg_elem&);
+
+    fcn_arg_elem& operator = (const fcn_arg_elem&);
+
+    void (*e_fcn) (T);
+    T e_arg;
+  };
+
+  // An element that stores a variable of type T along with a
+  // void (*) (const T&) function pointer, and calls the function with
+  // the parameter.
+
+  template <class T>
+  class fcn_crefarg_elem : public elem
+  {
+  public:
+    fcn_crefarg_elem (void (*fcn) (const T&), const T& arg)
+      : e_fcn (fcn), e_arg (arg) { }
+
+    void run (void) { e_fcn (e_arg); }
+
+  private:
+    void (*e_fcn) (const T&);
+    T e_arg;
+  };
+
+  // An element for calling a member function.
+
+  template <class T>
+  class method_elem : public elem
+  {
+  public:
+    method_elem (T *obj, void (T::*method) (void))
+      : e_obj (obj), e_method (method) { }
+
+    void run (void) { (e_obj->*e_method) (); }
+
+  private:
+
+    T *e_obj;
+    void (T::*e_method) (void);
+
+    // No copying!
+
+    method_elem (const method_elem&);
+
+    method_elem operator = (const method_elem&);
+  };
+
+  // An element for calling a member function with a single argument
+
+  template <class T, class A>
+  class method_arg_elem : public elem
+  {
+  public:
+    method_arg_elem (T *obj, void (T::*method) (A), A arg)
+      : e_obj (obj), e_method (method), e_arg (arg) { }
+
+    void run (void) { (e_obj->*e_method) (e_arg); }
+
+  private:
+
+    T *e_obj;
+    void (T::*e_method) (A);
+    A e_arg;
+
+    // No copying!
+
+    method_arg_elem (const method_arg_elem&);
+
+    method_arg_elem operator = (const method_arg_elem&);
+  };
+
+  // An element for calling a member function with a single argument
+
+  template <class T, class A>
+  class method_crefarg_elem : public elem
+  {
+  public:
+    method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg)
+      : e_obj (obj), e_method (method), e_arg (arg) { }
+
+    void run (void) { (e_obj->*e_method) (e_arg); }
+
+  private:
+
+    T *e_obj;
+    void (T::*e_method) (const A&);
+    A e_arg;
+
+    // No copying!
+
+    method_crefarg_elem (const method_crefarg_elem&);
+
+    method_crefarg_elem operator = (const method_crefarg_elem&);
+  };
+
+  // An element that stores arbitrary variable, and restores it.
+
+  template <class T>
+  class restore_var_elem : public elem
+  {
+  public:
+    restore_var_elem (T& ref, const T& val)
+      : e_ptr (&ref), e_val (val) { }
+
+    void run (void) { *e_ptr = e_val; }
+
+  private:
+
+    // No copying!
+
+    restore_var_elem (const restore_var_elem&);
+
+    restore_var_elem& operator = (const restore_var_elem&);
+
+    T *e_ptr, e_val;
+  };
+
+  // Deletes a class allocated using new.
+
+  template <class T>
+  class delete_ptr_elem : public elem
+  {
+  public:
+    delete_ptr_elem (T *ptr)
+      : e_ptr (ptr) { }
+
+    void run (void) { delete e_ptr; }
+
+  private:
+
+    T *e_ptr;
+
+    // No copying!
+
+    delete_ptr_elem (const delete_ptr_elem&);
+
+    delete_ptr_elem operator = (const delete_ptr_elem&);
+  };
+
+  action_container (void) { }
+
+  virtual ~action_container (void) { }
+
+  virtual void add (elem *new_elem) = 0;
+
+  // Call to void func (void).
+  void add_fcn (void (*fcn) (void))
+  {
+    add (new fcn_elem (fcn));
+  }
+
+  // Call to void func (T).
+  template <class T>
+  void add_fcn (void (*action) (T), T val)
+  {
+    add (new fcn_arg_elem<T> (action, val));
+  }
+
+  // Call to void func (const T&).
+  template <class T>
+  void add_fcn (void (*action) (const T&), const T& val)
+  {
+    add (new fcn_crefarg_elem<T> (action, val));
+  }
+
+  // Call to T::method (void).
+  template <class T>
+  void add_method (T *obj, void (T::*method) (void))
+  {
+    add (new method_elem<T> (obj, method));
+  }
+
+  // Call to T::method (A).
+  template <class T, class A>
+  void add_method (T *obj, void (T::*method) (A), A arg)
+  {
+    add (new method_arg_elem<T, A> (obj, method, arg));
+  }
+
+  // Call to T::method (const A&).
+  template <class T, class A>
+  void add_method (T *obj, void (T::*method) (const A&), const A& arg)
+  {
+    add (new method_crefarg_elem<T, A> (obj, method, arg));
+  }
+
+  // Call to delete (T*).
+
+  template <class T>
+  void add_delete (T *obj)
+  {
+    add (new delete_ptr_elem<T> (obj));
+  }
+
+  // Protect any variable.
+  template <class T>
+  void protect_var (T& var)
+  {
+    add (new restore_var_elem<T> (var, var));
+  }
+
+  // Protect any variable, value given.
+  template <class T>
+  void protect_var (T& var, const T& val)
+  {
+    add (new restore_var_elem<T> (var, val));
+  }
+
+  operator bool (void) const { return ! empty (); }
+
+  virtual void run_first (void) = 0;
+
+  void run (size_t num)
+  {
+    if (num > size ())
+      num = size ();
+
+    for (size_t i = 0; i < num; i++)
+      run_first ();
+  }
+
+  void run (void) { run (size ()); }
+
+  virtual void discard_first (void) = 0;
+
+  void discard (size_t num)
+  {
+    if (num > size ())
+      num = size ();
+
+    for (size_t i = 0; i < num; i++)
+      discard_first ();
+  }
+
+  void discard (void) { discard (size ()); }
+
+  virtual size_t size (void) const = 0;
+
+  bool empty (void) const { return size () == 0; }
+
+private:
+
+  // No copying!
+
+  action_container (const action_container&);
+
+  action_container& operator = (const action_container&);
+};
+
+#endif
--- a/liboctave/util/base-list.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/base-list.h	Sat Oct 05 11:22:09 2013 -0400
@@ -49,24 +49,28 @@
   template <class P>
   void remove_if (P pred)
   {
+    lst.remove_if (pred);
+
+    // FIXME: kluge removed 8/7/13.  Eventually this commented
+    //        code should be deleted.
+    //
+    // FIXME: this kluge should be removed at some point.
     // We would like to simply call
     //
     //   lst.remove_if (pred);
     //
     // but the Sun Studio compiler chokes on that.
     //
-    // FIXME -- this kluge should be removed at some point.
-
-    iterator b = lst.begin ();
-    iterator e = lst.end ();
-    while (b != e)
-      {
-        iterator n = b;
-        n++;
-        if (pred (*b))
-          lst.erase (b);
-        b = n;
-      }
+    // iterator b = lst.begin ();
+    // iterator e = lst.end ();
+    // while (b != e)
+    //   {
+    //     iterator n = b;
+    //     n++;
+    //     if (pred (*b))
+    //       lst.erase (b);
+    //     b = n;
+    //   }
   }
 
   void clear (void) { lst.clear (); }
--- a/liboctave/util/byte-swap.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/byte-swap.h	Sat Oct 05 11:22:09 2013 -0400
@@ -23,13 +23,10 @@
 #if !defined (octave_byte_swap_h)
 #define octave_byte_swap_h 1
 
-// FIXME -- not sure these volatile qualifiers are really
-// needed or appropriate here.
-
 static inline void
-swap_bytes (volatile void *ptr, unsigned int i, unsigned int j)
+swap_bytes (void *ptr, unsigned int i, unsigned int j)
 {
-  volatile char *t = static_cast<volatile char *> (ptr);
+  char *t = static_cast<char *> (ptr);
 
   char tmp = t[i];
   t[i] = t[j];
@@ -38,7 +35,7 @@
 
 template <int n>
 void
-swap_bytes (volatile void *ptr)
+swap_bytes (void *ptr)
 {
   for (int i = 0; i < n/2; i++)
     swap_bytes (ptr, i, n-1-i);
@@ -46,20 +43,20 @@
 
 template <>
 inline void
-swap_bytes <1> (volatile void *)
+swap_bytes<1> (void *)
 {
 }
 
 template <>
 inline void
-swap_bytes <2> (volatile void *ptr)
+swap_bytes<2> (void *ptr)
 {
   swap_bytes (ptr, 0, 1);
 }
 
 template <>
 inline void
-swap_bytes <4> (volatile void *ptr)
+swap_bytes<4> (void *ptr)
 {
   swap_bytes (ptr, 0, 3);
   swap_bytes (ptr, 1, 2);
@@ -67,7 +64,7 @@
 
 template <>
 inline void
-swap_bytes <8> (volatile void *ptr)
+swap_bytes<8> (void *ptr)
 {
   swap_bytes (ptr, 0, 7);
   swap_bytes (ptr, 1, 6);
@@ -77,9 +74,9 @@
 
 template <int n>
 void
-swap_bytes (volatile void *ptr, int len)
+swap_bytes (void *ptr, int len)
 {
-  volatile char *t = static_cast<volatile char *> (ptr);
+  char *t = static_cast<char *> (ptr);
 
   for (int i = 0; i < len; i++)
     {
@@ -90,7 +87,7 @@
 
 template <>
 inline void
-swap_bytes<1> (volatile void *, int)
+swap_bytes<1> (void *, int)
 {
 }
 
--- a/liboctave/util/cmd-hist.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/cmd-hist.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -65,7 +65,7 @@
 
   std::string do_histcontrol (void) const;
 
-  void do_add (const std::string&);
+  bool do_add (const std::string&);
 
   void do_remove (int);
 
@@ -184,14 +184,14 @@
   return retval;
 }
 
-void
+bool
 gnu_history::do_add (const std::string& s)
 {
   if (! do_ignoring_entries ())
     {
       if (s.empty ()
           || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n')))
-        return;
+        return false;
      
       // Strip newline before adding to list
       std::string stmp = s;
@@ -199,8 +199,11 @@
       if (stmp[stmp_len - 1] == '\n')
         stmp.resize (stmp_len - 1);
 
-      lines_this_session += ::octave_add_history (stmp.c_str (), history_control);
+      int added = ::octave_add_history (stmp.c_str (), history_control);
+      lines_this_session += added;
+      return (added > 0) ? true : false;
     }
+  return false;
 }
 
 void
@@ -587,11 +590,12 @@
     ? instance->do_ignoring_entries () : false;
 }
 
-void
+bool
 command_history::add (const std::string& s)
 {
   if (instance_ok ())
-    instance->do_add (s);
+    return instance->do_add (s);
+  return false;
 }
 
 void
@@ -818,9 +822,10 @@
   return ignoring_additions;
 }
 
-void
+bool
 command_history::do_add (const std::string&)
 {
+  return false;
 }
 
 void
--- a/liboctave/util/cmd-hist.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/cmd-hist.h	Sat Oct 05 11:22:09 2013 -0400
@@ -61,7 +61,7 @@
 
   static bool ignoring_entries (void);
 
-  static void add (const std::string&);
+  static bool add (const std::string&);
 
   static void remove (int);
 
@@ -156,7 +156,7 @@
 
   virtual bool do_ignoring_entries (void) const;
 
-  virtual void do_add (const std::string&);
+  virtual bool do_add (const std::string&);
 
   virtual void do_remove (int);
 
--- a/liboctave/util/data-conv.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/data-conv.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -25,10 +25,10 @@
 #endif
 
 #include <cctype>
-#include <climits>
 #include <cstdlib>
 
 #include <iostream>
+#include <limits>
 #include <vector>
 
 #include "byte-swap.h"
@@ -37,15 +37,11 @@
 #include "lo-ieee.h"
 #include "oct-locbuf.h"
 
-template void swap_bytes<2> (volatile void *, int);
-template void swap_bytes<4> (volatile void *, int);
-template void swap_bytes<8> (volatile void *, int);
-
 #if defined HAVE_LONG_LONG_INT
 #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \
   do \
     { \
-      int sz = BITS / CHAR_BIT; \
+      int sz = BITS / std::numeric_limits<unsigned char>::digits; \
       if (sizeof (TQ char) == sz) \
         VAL = oct_data_conv::dt_ ## Q ## char; \
       else if (sizeof (TQ short) == sz) \
@@ -64,7 +60,7 @@
 #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \
   do \
     { \
-      int sz = BITS / CHAR_BIT; \
+      int sz = BITS / std::numeric_limits<unsigned char>::digits; \
       if (sizeof (TQ char) == sz) \
         VAL = oct_data_conv::dt_ ## Q ## char; \
       else if (sizeof (TQ short) == sz) \
@@ -82,7 +78,7 @@
 #define FIND_SIZED_FLOAT_TYPE(VAL, BITS) \
   do \
     { \
-      int sz = BITS / CHAR_BIT; \
+      int sz = BITS / std::numeric_limits<unsigned char>::digits; \
       if (sizeof (float) == sz) \
         VAL = oct_data_conv::dt_float; \
       else if (sizeof (double) == sz) \
@@ -94,8 +90,9 @@
 
 // I'm not sure it is worth the trouble, but let's use a lookup table
 // for the types that are supposed to be a specific number of bits
-// wide.  Given the macros above, this should work as long as CHAR_BIT
-// is a multiple of 8 and there are types with the right sizes.
+// wide.  Given the macros above, this should work as long as
+// std::numeric_limits<unsigned char>::digits is a multiple of 8 and
+// there are types with the right sizes.
 //
 // The sized data type lookup table has the following format:
 //
@@ -177,6 +174,111 @@
     } \
   while (0)
 
+size_t
+oct_data_conv::data_type_size (data_type dt)
+{
+  size_t retval = -1;
+
+  switch (dt)
+    {
+    case oct_data_conv::dt_int8:
+      retval = sizeof (int8_t);
+      break;
+
+    case oct_data_conv::dt_uint8:
+      retval = sizeof (uint8_t);
+      break;
+
+    case oct_data_conv::dt_int16:
+      retval = sizeof (int16_t);
+      break;
+
+    case oct_data_conv::dt_uint16:
+      retval = sizeof (uint16_t);
+      break;
+
+    case oct_data_conv::dt_int32:
+      retval = sizeof (int32_t);
+      break;
+
+    case oct_data_conv::dt_uint32:
+      retval = sizeof (uint32_t);
+      break;
+
+    case oct_data_conv::dt_int64:
+      retval = sizeof (int64_t);
+      break;
+
+    case oct_data_conv::dt_uint64:
+      retval = sizeof (uint64_t);
+      break;
+
+    case oct_data_conv::dt_float:
+    case oct_data_conv::dt_single:
+      retval = sizeof (float);
+      break;
+
+    case oct_data_conv::dt_double:
+      retval = sizeof (double);
+      break;
+
+    case oct_data_conv::dt_char:
+      retval = sizeof (char);
+      break;
+
+    case oct_data_conv::dt_schar:
+      retval = sizeof (signed char);
+      break;
+
+    case oct_data_conv::dt_uchar:
+      retval = sizeof (unsigned char);
+      break;
+
+    case oct_data_conv::dt_short:
+      retval = sizeof (short);
+      break;
+
+    case oct_data_conv::dt_ushort:
+      retval = sizeof (unsigned short);
+      break;
+
+    case oct_data_conv::dt_int:
+      retval = sizeof (int);
+      break;
+
+    case oct_data_conv::dt_uint:
+      retval = sizeof (unsigned int);
+      break;
+
+    case oct_data_conv::dt_long:
+      retval = sizeof (long);
+      break;
+
+    case oct_data_conv::dt_ulong:
+      retval = sizeof (unsigned long);
+      break;
+
+    case oct_data_conv::dt_longlong:
+      retval = sizeof (long long);
+      break;
+
+    case oct_data_conv::dt_ulonglong:
+      retval = sizeof (unsigned long long);
+      break;
+
+    case oct_data_conv::dt_logical:
+      retval = sizeof (bool);
+      break;
+
+    case oct_data_conv::dt_unknown:
+    default:
+      abort ();
+      break;
+    }
+
+  return retval;
+}
+
 oct_data_conv::data_type
 oct_data_conv::string_to_data_type (const std::string& str)
 {
@@ -429,7 +531,7 @@
       break;
 
     case oct_data_conv::dt_uchar:
-      retval = "usigned char";
+      retval = "unsigned char";
       break;
 
     case oct_data_conv::dt_short:
@@ -445,7 +547,7 @@
       break;
 
     case oct_data_conv::dt_uint:
-      retval = "usigned int";
+      retval = "unsigned int";
       break;
 
     case oct_data_conv::dt_long:
@@ -453,7 +555,7 @@
       break;
 
     case oct_data_conv::dt_ulong:
-      retval = "usigned long";
+      retval = "unsigned long";
       break;
 
     case oct_data_conv::dt_longlong:
@@ -548,191 +650,23 @@
 }
 
 static void
-VAX_D_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "IEEE little endian format");
-}
-
-static void
-VAX_G_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "IEEE little endian format");
-}
-
-static void
-Cray_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "IEEE little endian format");
-}
-
-static void
 IEEE_big_float_to_IEEE_little_float (void *d, octave_idx_type len)
 {
   swap_bytes<4> (d, len);
 }
 
 static void
-VAX_D_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "IEEE little endian format");
-}
-
-static void
-VAX_G_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "IEEE little endian format");
-}
-
-static void
-Cray_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "IEEE little endian format");
-}
-
-static void
 IEEE_little_double_to_IEEE_big_double (void *d, octave_idx_type len)
 {
   swap_bytes<8> (d, len);
 }
 
 static void
-VAX_D_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "IEEE big endian format");
-}
-
-static void
-VAX_G_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "IEEE big endian format");
-}
-
-static void
-Cray_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "IEEE big endian format");
-}
-
-static void
 IEEE_little_float_to_IEEE_big_float (void *d, octave_idx_type len)
 {
   swap_bytes<4> (d, len);
 }
 
-static void
-VAX_D_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "IEEE big endian format");
-}
-
-static void
-VAX_G_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "IEEE big endian format");
-}
-
-static void
-Cray_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "IEEE big endian format");
-}
-
-static void
-IEEE_little_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE little endian", "VAX D");
-}
-
-static void
-IEEE_big_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE big endian", "VAX D");
-}
-
-static void
-VAX_G_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "VAX D");
-}
-
-static void
-Cray_to_VAX_D_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "VAX D");
-}
-
-static void
-IEEE_little_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE little endian", "VAX D");
-}
-
-static void
-IEEE_big_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE big endian", "VAX D");
-}
-
-static void
-VAX_G_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "VAX D");
-}
-
-static void
-Cray_to_VAX_D_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("Cray", "VAX D");
-}
-
-static void
-IEEE_little_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE little endian", "VAX G");
-}
-
-static void
-IEEE_big_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE big endian", "VAX G");
-}
-
-static void
-VAX_D_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "VAX G");
-}
-
-static void
-Cray_to_VAX_G_double (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "VAX G");
-}
-
-static void
-IEEE_little_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE little endian", "VAX G");
-}
-
-static void
-IEEE_big_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("IEEE big endian", "VAX G");
-}
-
-static void
-VAX_D_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX D float", "VAX G");
-}
-
-static void
-Cray_to_VAX_G_float (void * /* d */, octave_idx_type /* len */)
-{
-  gripe_data_conversion ("VAX G float", "VAX G");
-}
-
 void
 do_double_format_conversion (void *data, octave_idx_type len,
                              oct_mach_info::float_format from_fmt,
@@ -750,18 +684,6 @@
           IEEE_big_double_to_IEEE_little_double (data, len);
           break;
 
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_double_to_IEEE_little_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_double_to_IEEE_little_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_IEEE_little_double (data, len);
-          break;
-
         default:
           gripe_unrecognized_float_fmt ();
           break;
@@ -778,74 +700,6 @@
         case oct_mach_info::flt_fmt_ieee_big_endian:
           break;
 
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_double_to_IEEE_big_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_double_to_IEEE_big_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_IEEE_big_double (data, len);
-          break;
-
-        default:
-          gripe_unrecognized_float_fmt ();
-          break;
-        }
-      break;
-
-    case oct_mach_info::flt_fmt_vax_d:
-      switch (from_fmt)
-        {
-        case oct_mach_info::flt_fmt_ieee_little_endian:
-          IEEE_little_double_to_VAX_D_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_ieee_big_endian:
-          IEEE_big_double_to_VAX_D_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_d:
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_double_to_VAX_D_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_VAX_D_double (data, len);
-          break;
-
-        default:
-          gripe_unrecognized_float_fmt ();
-          break;
-        }
-      break;
-
-    case oct_mach_info::flt_fmt_vax_g:
-      switch (from_fmt)
-        {
-        case oct_mach_info::flt_fmt_ieee_little_endian:
-          IEEE_little_double_to_VAX_G_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_ieee_big_endian:
-          IEEE_big_double_to_VAX_G_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_double_to_VAX_G_double (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_VAX_G_double (data, len);
-          break;
-
         default:
           gripe_unrecognized_float_fmt ();
           break;
@@ -877,18 +731,6 @@
           IEEE_big_float_to_IEEE_little_float (data, len);
           break;
 
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_float_to_IEEE_little_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_float_to_IEEE_little_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_IEEE_little_float (data, len);
-          break;
-
         default:
           gripe_unrecognized_float_fmt ();
           break;
@@ -905,74 +747,6 @@
         case oct_mach_info::flt_fmt_ieee_big_endian:
           break;
 
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_float_to_IEEE_big_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_float_to_IEEE_big_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_IEEE_big_float (data, len);
-          break;
-
-        default:
-          gripe_unrecognized_float_fmt ();
-          break;
-        }
-      break;
-
-    case oct_mach_info::flt_fmt_vax_d:
-      switch (from_fmt)
-        {
-        case oct_mach_info::flt_fmt_ieee_little_endian:
-          IEEE_little_float_to_VAX_D_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_ieee_big_endian:
-          IEEE_big_float_to_VAX_D_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_d:
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          VAX_G_float_to_VAX_D_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_VAX_D_float (data, len);
-          break;
-
-        default:
-          gripe_unrecognized_float_fmt ();
-          break;
-        }
-      break;
-
-    case oct_mach_info::flt_fmt_vax_g:
-      switch (from_fmt)
-        {
-        case oct_mach_info::flt_fmt_ieee_little_endian:
-          IEEE_little_float_to_VAX_G_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_ieee_big_endian:
-          IEEE_big_float_to_VAX_G_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_d:
-          VAX_D_float_to_VAX_G_float (data, len);
-          break;
-
-        case oct_mach_info::flt_fmt_vax_g:
-          break;
-
-        case oct_mach_info::flt_fmt_cray:
-          Cray_to_VAX_G_float (data, len);
-          break;
-
         default:
           gripe_unrecognized_float_fmt ();
           break;
--- a/liboctave/util/data-conv.h	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/data-conv.h	Sat Oct 05 11:22:09 2013 -0400
@@ -26,6 +26,7 @@
 #include <limits>
 
 #include "mach-info.h"
+#include "oct-inttypes.h"
 
 class
 OCTAVE_API
@@ -61,6 +62,8 @@
       dt_unknown   = 23 // Must be last, have largest value!
     };
 
+  static size_t data_type_size (data_type dt);
+
   static data_type string_to_data_type (const std::string& s);
 
   static void string_to_data_type (const std::string& s, int& block_size,
@@ -125,4 +128,137 @@
 write_floats (std::ostream& os, const float *data, save_type type,
               octave_idx_type len);
 
+template <typename T>
+inline bool
+is_equivalent_type (oct_data_conv::data_type)
+{
+  return false;
+}
+
+template <>
+inline bool
+is_equivalent_type<int8_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int8;
+}
+
+template <>
+inline bool
+is_equivalent_type<int16_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int16;
+}
+
+template <>
+inline bool
+is_equivalent_type<int32_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int32;
+}
+
+template <>
+inline bool
+is_equivalent_type<int64_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int64;
+}
+
+template <>
+inline bool
+is_equivalent_type<uint8_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint8;
+}
+
+template <>
+inline bool
+is_equivalent_type<uint16_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint16;
+}
+
+template <>
+inline bool
+is_equivalent_type<uint32_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint32;
+}
+
+template <>
+inline bool
+is_equivalent_type<uint64_t> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint64;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_int8> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int8;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_int16> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int16;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_int32> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int32;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_int64> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_int64;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_uint8> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint8;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_uint16> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint16;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_uint32> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint32;
+}
+
+template <>
+inline bool
+is_equivalent_type<octave_uint64> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_uint64;
+}
+
+template <>
+inline bool
+is_equivalent_type<double> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_double;
+}
+
+template <>
+inline bool
+is_equivalent_type<float> (oct_data_conv::data_type t)
+{
+  return t == oct_data_conv::dt_single || t == oct_data_conv::dt_float;
+}
+
 #endif
--- a/liboctave/util/lo-ieee.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/lo-ieee.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -73,9 +73,6 @@
       }
       break;
 
-    case oct_mach_info::flt_fmt_cray:
-    case oct_mach_info::flt_fmt_vax_d:
-    case oct_mach_info::flt_fmt_vax_g:
     default:
       // If the format is unknown, then you will probably not have a
       // useful system, so we will abort here.  Anyone wishing to
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/lo-regexp.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,620 @@
+/*
+
+Copyright (C) 2012 John W. Eaton
+Copyright (C) 2005-2012 David Bateman
+Copyright (C) 2002-2005 Paul Kienzle
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <list>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#if defined (HAVE_PCRE_H)
+#include <pcre.h>
+#elif defined (HAVE_PCRE_PCRE_H)
+#include <pcre/pcre.h>
+#endif
+
+#include "Matrix.h"
+#include "base-list.h"
+#include "lo-error.h"
+#include "oct-locbuf.h"
+#include "quit.h"
+#include "lo-regexp.h"
+#include "str-vec.h"
+
+// Define the maximum number of retries for a pattern that possibly
+// results in an infinite recursion.
+#define PCRE_MATCHLIMIT_MAX 10
+
+// FIXME -- should this be configurable?
+#define MAXLOOKBEHIND 10
+
+static bool lookbehind_warned = false;
+
+// FIXME -- don't bother collecting and composing return values the user
+// doesn't want.
+
+void
+regexp::free (void)
+{
+  if (data)
+    pcre_free (static_cast<pcre *> (data));
+}
+
+void
+regexp::compile_internal (void)
+{
+  // If we had a previously compiled pattern, release it.
+  free ();
+
+  size_t max_length = MAXLOOKBEHIND;
+
+  size_t pos = 0;
+  size_t new_pos;
+  int inames = 0;
+  std::ostringstream buf;
+
+  while ((new_pos = pattern.find ("(?", pos)) != std::string::npos)
+    {
+      if (pattern.at (new_pos + 2) == '<'
+          && !(pattern.at (new_pos + 3) == '='
+               || pattern.at (new_pos + 3) == '!'))
+        {
+          // The syntax of named tokens in pcre is "(?P<name>...)" while
+          // we need a syntax "(?<name>...)", so fix that here. Also an
+          // expression like
+          // "(?<first>\w+)\s+(?<last>\w+)|(?<last>\w+),\s+(?<first>\w+)"
+          // should be perfectly legal, while pcre does not allow the same
+          // named token name on both sides of the alternative. Also fix
+          // that here by replacing name tokens by dummy names, and dealing
+          // with the dummy names later.
+
+          size_t tmp_pos = pattern.find_first_of ('>', new_pos);
+
+          if (tmp_pos == std::string::npos)
+            {
+              (*current_liboctave_error_handler)
+                ("regexp: syntax error in pattern");
+              return;
+            }
+
+          std::string tmp_name =
+            pattern.substr (new_pos+3, tmp_pos-new_pos-3);
+
+          bool found = false;
+
+          for (int i = 0; i < nnames; i++)
+            {
+              if (named_pats(i) == tmp_name)
+                {
+                  named_idx.resize (dim_vector (inames+1, 1));
+                  named_idx(inames) = i;
+                  found = true;
+                  break;
+                }
+            }
+
+          if (! found)
+            {
+              named_idx.resize (dim_vector (inames+1, 1));
+              named_idx(inames) = nnames;
+              named_pats.append (tmp_name);
+              nnames++;
+            }
+
+          if (new_pos - pos > 0)
+            buf << pattern.substr (pos, new_pos-pos);
+          if (inames < 10)
+            buf << "(?P<n00" << inames++;
+          else if (inames < 100)
+            buf << "(?P<n0" << inames++;
+          else
+            buf << "(?P<n" << inames++;
+
+          pos = tmp_pos;
+        }
+      else if (pattern.at (new_pos + 2) == '<')
+        {
+          // Find lookbehind operators of arbitrary length (ie like
+          // "(?<=[a-z]*)") and replace with a maximum length operator
+          // as PCRE can not yet handle arbitrary length lookahead
+          // operators. Use the string length as the maximum length to
+          // avoid issues.
+
+          int brackets = 1;
+          size_t tmp_pos1 = new_pos + 2;
+          size_t tmp_pos2 = tmp_pos1;
+
+          while (tmp_pos1 < pattern.length () && brackets > 0)
+            {
+              char ch = pattern.at (tmp_pos1);
+
+              if (ch == '(')
+                brackets++;
+              else if (ch == ')')
+                {
+                  if (brackets > 1)
+                    tmp_pos2 = tmp_pos1;
+
+                  brackets--;
+                }
+
+              tmp_pos1++;
+            }
+
+          if (brackets != 0)
+            {
+              buf << pattern.substr (pos, new_pos - pos) << "(?";
+              pos = new_pos + 2;
+            }
+          else
+            {
+              size_t tmp_pos3 = pattern.find_first_of ("*+", tmp_pos2);
+
+              if (tmp_pos3 != std::string::npos && tmp_pos3 < tmp_pos1)
+                {
+                  if (!lookbehind_warned)
+                    {
+                      lookbehind_warned = true;
+                      (*current_liboctave_warning_handler)
+                        ("%s: arbitrary length lookbehind patterns are only supported up to length %d",
+                               who.c_str (), MAXLOOKBEHIND);
+                    }
+
+                  buf << pattern.substr (pos, new_pos - pos) << "(";
+
+                  size_t i;
+
+                  if (pattern.at (tmp_pos3) == '*')
+                    i = 0;
+                  else
+                    i = 1;
+
+                  for (; i < max_length + 1; i++)
+                    {
+                      buf << pattern.substr (new_pos, tmp_pos3 - new_pos)
+                          << "{" << i << "}";
+                      buf << pattern.substr (tmp_pos3 + 1,
+                                             tmp_pos1 - tmp_pos3 - 1);
+                      if (i != max_length)
+                        buf << "|";
+                    }
+                  buf << ")";
+                }
+              else
+                buf << pattern.substr (pos, tmp_pos1 - pos);
+
+              pos = tmp_pos1;
+            }
+        }
+      else
+        {
+          buf << pattern.substr (pos, new_pos - pos) << "(?";
+          pos = new_pos + 2;
+        }
+
+    }
+
+  buf << pattern.substr (pos);
+
+  const char *err;
+  int erroffset;
+  std::string buf_str = buf.str ();
+
+  int pcre_options
+    = ((options.case_insensitive () ? PCRE_CASELESS : 0)
+       | (options.dotexceptnewline () ? 0 : PCRE_DOTALL)
+       | (options.lineanchors () ? PCRE_MULTILINE : 0)
+       | (options.freespacing () ? PCRE_EXTENDED : 0));
+
+  data = pcre_compile (buf_str.c_str (), pcre_options, &err, &erroffset, 0);
+
+  if (! data)
+    (*current_liboctave_error_handler)
+      ("%s: %s at position %d of expression", who.c_str (),
+       err, erroffset);
+}
+
+regexp::match_data
+regexp::match (const std::string& buffer)
+{
+  regexp::match_data retval;
+
+  std::list<regexp::match_element> lst;
+
+  int subpatterns;
+  int namecount;
+  int nameentrysize;
+  char *nametable;
+  size_t idx = 0;
+
+  pcre *re = static_cast <pcre *> (data);
+
+  pcre_fullinfo (re, 0, PCRE_INFO_CAPTURECOUNT,  &subpatterns);
+  pcre_fullinfo (re, 0, PCRE_INFO_NAMECOUNT, &namecount);
+  pcre_fullinfo (re, 0, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize);
+  pcre_fullinfo (re, 0, PCRE_INFO_NAMETABLE, &nametable);
+
+  OCTAVE_LOCAL_BUFFER (int, ovector, (subpatterns+1)*3);
+  OCTAVE_LOCAL_BUFFER (int, nidx, namecount);
+
+  for (int i = 0; i < namecount; i++)
+    {
+      // Index of subpattern in first two bytes MSB first of name.
+      // Extract index.
+      nidx[i] = (static_cast<int> (nametable[i*nameentrysize])) << 8
+        | static_cast<int> (nametable[i*nameentrysize+1]);
+    }
+
+  while (true)
+    {
+      OCTAVE_QUIT;
+
+      int matches = pcre_exec (re, 0, buffer.c_str (),
+                               buffer.length (), idx,
+                               (idx ? PCRE_NOTBOL : 0),
+                               ovector, (subpatterns+1)*3);
+
+      if (matches == PCRE_ERROR_MATCHLIMIT)
+        {
+          // Try harder; start with default value for MATCH_LIMIT
+          // and increase it.
+          (*current_liboctave_warning_handler)
+            ("your pattern caused PCRE to hit its MATCH_LIMIT; trying harder now, but this will be slow");
+
+          pcre_extra pe;
+
+          pcre_config (PCRE_CONFIG_MATCH_LIMIT,
+                       static_cast <void *> (&pe.match_limit));
+
+          pe.flags = PCRE_EXTRA_MATCH_LIMIT;
+
+          int i = 0;
+          while (matches == PCRE_ERROR_MATCHLIMIT
+                 && i++ < PCRE_MATCHLIMIT_MAX)
+            {
+              OCTAVE_QUIT;
+
+              pe.match_limit *= 10;
+              matches = pcre_exec (re, &pe, buffer.c_str (),
+                                   buffer.length (), idx,
+                                   (idx ? PCRE_NOTBOL : 0),
+                                   ovector, (subpatterns+1)*3);
+            }
+        }
+
+      if (matches < 0 && matches != PCRE_ERROR_NOMATCH)
+        {
+          (*current_liboctave_error_handler)
+            ("%s: internal error calling pcre_exec; error code from pcre_exec is %i",
+             who.c_str (), matches);
+          return retval;
+        }
+      else if (matches == PCRE_ERROR_NOMATCH)
+        break;
+      else if (ovector[1] <= ovector[0] && ! options.emptymatch ())
+        {
+          // Zero length match.  Skip to next char.
+          idx = ovector[0] + 1;
+          if (idx < buffer.length ())
+            continue;
+          else
+            break;
+        }
+      else
+        {
+          int pos_match = 0;
+          Matrix token_extents (matches-1, 2);
+
+          for (int i = 1; i < matches; i++)
+            {
+              if (ovector[2*i] >= 0 && ovector[2*i+1] > 0
+                  && (i == 1 || ovector[2*i] != ovector[2*i-2]
+                      || ovector[2*i-1] != ovector[2*i+1]))
+                {
+                  token_extents(pos_match,0) = double (ovector[2*i]+1);
+                  token_extents(pos_match++,1) = double (ovector[2*i+1]);
+                }
+            }
+
+          token_extents.resize (pos_match, 2);
+
+          double start = double (ovector[0]+1);
+          double end = double (ovector[1]);
+
+          const char **listptr;
+          int status = pcre_get_substring_list (buffer.c_str (), ovector,
+                                                matches, &listptr);
+
+          if (status == PCRE_ERROR_NOMEMORY)
+            {
+              (*current_liboctave_error_handler)
+                ("%s: cannot allocate memory in pcre_get_substring_list",
+                 who.c_str ());
+              return retval;
+            }
+
+          string_vector tokens (pos_match);
+          string_vector named_tokens (nnames);
+          int pos_offset = 0;
+          pos_match = 0;
+
+          for (int i = 1; i < matches; i++)
+            {
+              if (ovector[2*i] >= 0 && ovector[2*i+1] > 0)
+                {
+                  if (i == 1 || ovector[2*i] != ovector[2*i-2]
+                      || ovector[2*i-1] != ovector[2*i+1])
+                    {
+                      if (namecount > 0)
+                        {
+                          // FIXME: Should probably do this with a map()
+                          // rather than a linear search.  However,
+                          // the number of captured, named expressions
+                          // is usually pretty small (< 4)
+                          for (int j = 0; j < namecount; j++)
+                            {
+                              if (nidx[j] == i)
+                                { 
+                                  named_tokens(named_idx(j)) =
+                                    std::string (*(listptr+i-pos_offset));
+                                  break;
+                                }
+                            }
+                        }
+
+                      tokens(pos_match++) = std::string (*(listptr+i));
+                    }
+                  else
+                    pos_offset++;
+                }
+            }
+
+          std::string match_string = std::string (*listptr);
+
+          pcre_free_substring_list (listptr);
+
+          regexp::match_element new_elem (named_tokens, tokens, match_string,
+                                          token_extents, start, end);
+          lst.push_back (new_elem);
+
+          if (ovector[1] <= ovector[0])
+          {
+            // Zero length match.  Skip to next char.
+            idx = ovector[0] + 1;
+            if (idx <= buffer.length ())
+              continue;
+          }
+          else 
+            idx = ovector[1];
+
+          if (options.once () || idx >= buffer.length ())
+            break;
+        }
+    }
+
+  retval = regexp::match_data (lst, named_pats);
+
+  return retval;
+}
+
+bool
+regexp::is_match (const std::string& buffer)
+{
+  regexp::match_data rx_lst = match (buffer);
+
+  return rx_lst.size () > 0;
+}
+
+Array<bool>
+regexp::is_match (const string_vector& buffer)
+{
+  octave_idx_type len = buffer.length ();
+
+  Array<bool> retval (dim_vector (len, 1));
+
+  for (octave_idx_type i = 0; i < buffer.length (); i++)
+    retval(i) = is_match (buffer(i));
+
+  return retval;
+}
+
+// Declare rep_token_t used in processing replacement string
+typedef struct
+  {
+    size_t pos;
+    int num;
+  } rep_token_t;
+
+
+std::string
+regexp::replace (const std::string& buffer, const std::string& replacement)
+{
+  std::string retval;
+
+  regexp::match_data rx_lst = match (buffer);
+
+  size_t num_matches = rx_lst.size ();
+
+  if (num_matches == 0)
+    {
+      retval = buffer;
+      return retval;
+    }
+
+  // Identify replacement tokens; build a vector of group numbers in
+  // the replacement string so that we can quickly calculate the size
+  // of the replacement.
+
+  // FIXME: All code assumes that only 10 tokens ($0-$9) exist.
+  //        $11 represents $1 followed by the character '1' rather than
+  //        the eleventh capture buffer.
+
+  std::string repstr = replacement;
+  std::vector<rep_token_t> tokens;
+  tokens.reserve (5);  // Reserve memory for 5 pattern replacements
+
+  for (size_t i=0; i < repstr.size (); i++)
+    {
+      if (repstr[i] == '\\')
+        {
+          if (i < repstr.size () - 1 && repstr[i+1] == '$')
+            {
+              repstr.erase (i,1);  // erase backslash
+              i++;                 // skip over '$'
+              continue;
+            }
+          if (i < repstr.size () - 1 && repstr[i+1] == '\\')
+            {
+              repstr.erase (i,1);  // erase 1st backslash
+              continue;
+            }
+        }
+      else if (repstr[i] == '$')
+        {
+          if (i < repstr.size () - 1 && isdigit (repstr[i+1]))
+            {
+              rep_token_t tmp_token;
+
+              tmp_token.pos = i;
+              tmp_token.num = repstr[i+1]-'0';
+              tokens.push_back (tmp_token);
+            }
+        }
+    }
+
+  std::string rep;
+  int num_tokens = tokens.size ();
+
+  if (num_tokens > 0)
+    {
+      // Determine replacement length
+      const size_t replen = repstr.size () - 2*num_tokens;
+      int delta = 0;
+      regexp::match_data::const_iterator p = rx_lst.begin ();
+      for (size_t i = 0; i < num_matches; i++)
+        {
+          OCTAVE_QUIT;
+
+          double start = p->start ();
+          double end = p->end ();
+
+          const Matrix pairs (p->token_extents ());
+          size_t pairlen = 0;
+          for (int j = 0; j < num_tokens; j++)
+            {
+              if (tokens[j].num == 0)
+                pairlen += static_cast<size_t> (end - start) + 1;
+              else if (tokens[j].num <= pairs.rows ())
+                pairlen += static_cast<size_t> (pairs(tokens[j].num-1,1)
+                                                - pairs(tokens[j].num-1,0)) + 1;
+            }
+          delta += (static_cast<int> (replen + pairlen)
+                    - static_cast<int> (end - start + 1));
+          p++;
+        }
+
+      // Build replacement string
+      rep.reserve (buffer.size () + delta);
+      size_t from = 0;
+      p = rx_lst.begin ();
+      for (size_t i = 0; i < num_matches; i++)
+        {
+          OCTAVE_QUIT;
+
+          double start = p->start ();
+          double end = p->end ();
+
+          const Matrix pairs (p->token_extents ());
+          rep.append (&buffer[from], static_cast<size_t> (start - 1) - from);
+          from = static_cast<size_t> (end);
+
+          size_t cur_pos = 0;
+
+          for (int j = 0; j < num_tokens; j++)
+            {
+              rep.append (&repstr[cur_pos], (tokens[j].pos) - cur_pos);
+              cur_pos = tokens[j].pos+2;
+
+              int k = tokens[j].num;
+              if (k == 0)
+                {
+                  // replace with entire match
+                  rep.append (&buffer[static_cast<size_t> (end - 1)],
+                              static_cast<size_t> (end - start) + 1);
+                }
+              else if (k <= pairs.rows ())
+                {
+                  // replace with group capture
+                  rep.append (&buffer[static_cast<size_t> (pairs(k-1,0)-1)],
+                              static_cast<size_t> (pairs(k-1,1)
+                                                   - pairs(k-1,0)) + 1);
+                }
+              else
+                {
+                  // replace with nothing
+                }
+            }
+          if (cur_pos < repstr.size ())
+            rep.append (&repstr[cur_pos], repstr.size () - cur_pos);
+
+          p++;
+        }
+      rep.append (&buffer[from], buffer.size () - from);
+    }
+  else
+    {
+      // Determine repstr length
+      const size_t replen = repstr.size ();
+      int delta = 0;
+      regexp::match_data::const_iterator p = rx_lst.begin ();
+      for (size_t i = 0; i < num_matches; i++)
+        {
+          OCTAVE_QUIT;
+          delta += static_cast<int> (replen)
+                   - static_cast<int> (p->end () - p->start () + 1);
+          p++;
+        }
+
+      // Build replacement string
+      rep.reserve (buffer.size () + delta);
+      size_t from = 0;
+      p = rx_lst.begin ();
+      for (size_t i = 0; i < num_matches; i++)
+        {
+          OCTAVE_QUIT;
+          rep.append (&buffer[from],
+                      static_cast<size_t> (p->start () - 1) - from);
+          from = static_cast<size_t> (p->end ());
+          rep.append (repstr);
+          p++;
+        }
+      rep.append (&buffer[from], buffer.size () - from);
+    }
+
+  retval = rep;
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/lo-regexp.h	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,289 @@
+/*
+
+Copyright (C) 2012 John W. Eaton
+Copyright (C) 2005-2012 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_liboctave_regexp_match_h)
+#define octave_liboctave_regexp_match_h 1
+
+#include <list>
+#include <sstream>
+#include <string>
+
+#include "Array.h"
+#include "Matrix.h"
+#include "base-list.h"
+#include "str-vec.h"
+
+class
+OCTAVE_API
+regexp
+{
+public:
+
+  class opts;
+  class match_data;
+
+  regexp (const std::string& pat = "",
+          const regexp::opts& opt = regexp::opts (),
+          const std::string& w = "regexp")
+    : pattern (pat), options (opt), data (0), named_pats (),
+      nnames (0), named_idx (), who (w)
+  {
+    compile_internal ();
+  }
+
+  regexp (const regexp& rx)
+    : pattern (rx.pattern), data (rx.data), named_pats (rx.named_pats),
+      nnames (rx.nnames), named_idx (rx.named_idx)
+  { }
+
+  regexp& operator = (const regexp& rx)
+  {
+    if (this != &rx)
+      {
+        pattern = rx.pattern;
+        data = rx.data;
+        named_pats = rx.named_pats;
+        nnames = rx.nnames;
+        named_idx = rx.named_idx;
+      }
+
+    return *this;
+  }
+
+  ~regexp (void) { free (); }
+
+  void compile (const std::string& pat,
+                const regexp::opts& opt = regexp::opts ())
+  {
+    pattern = pat;
+    options = opt;
+    compile_internal ();
+  }
+
+  match_data match (const std::string& buffer);
+
+  bool is_match (const std::string& buffer);
+
+  Array<bool> is_match (const string_vector& buffer);
+
+  std::string replace (const std::string& buffer,
+                       const std::string& replacement);
+
+  class opts
+  {
+  public:
+
+    opts (void)
+      : x_case_insensitive (false), x_dotexceptnewline (false),
+        x_emptymatch (false), x_freespacing (false), x_lineanchors (false),
+        x_once (false) { }
+
+    opts (const opts& o)
+      : x_case_insensitive (o.x_case_insensitive),
+        x_dotexceptnewline (o.x_dotexceptnewline),
+        x_emptymatch (o.x_emptymatch),
+        x_freespacing (o.x_freespacing),
+        x_lineanchors (o.x_lineanchors),
+        x_once (o.x_once)
+    { }
+
+    opts& operator = (const opts& o)
+    {
+      if (this != &o)
+        {
+          x_case_insensitive = o.x_case_insensitive;
+          x_dotexceptnewline = o.x_dotexceptnewline;
+          x_emptymatch = o.x_emptymatch;
+          x_freespacing = o.x_freespacing;
+          x_lineanchors = o.x_lineanchors;
+          x_once = o.x_once;
+        }
+
+      return *this;
+    }
+
+    ~opts (void) { }
+
+    void case_insensitive (bool val) { x_case_insensitive = val; }
+    void dotexceptnewline (bool val) { x_dotexceptnewline = val; }
+    void emptymatch (bool val) { x_emptymatch = val; }
+    void freespacing (bool val) { x_freespacing = val; }
+    void lineanchors (bool val) { x_lineanchors = val; }
+    void once (bool val) { x_once = val; }
+
+    bool case_insensitive (void) const { return x_case_insensitive; }
+    bool dotexceptnewline (void) const { return x_dotexceptnewline; }
+    bool emptymatch (void) const { return x_emptymatch; }
+    bool freespacing (void) const { return x_freespacing; }
+    bool lineanchors (void) const { return x_lineanchors; }
+    bool once (void) const { return x_once; }
+
+  private:
+
+    bool x_case_insensitive;
+    bool x_dotexceptnewline;
+    bool x_emptymatch;
+    bool x_freespacing;
+    bool x_lineanchors;
+    bool x_once;
+  };
+
+  class match_element
+  {
+  public:
+
+    match_element (const string_vector& nt, const string_vector& t,
+                   const std::string& ms, const Matrix& te,
+                   double s, double e)
+      : x_match_string (ms), x_named_tokens (nt), x_tokens (t),
+        x_token_extents (te), x_start (s), x_end (e)
+    { }
+
+    match_element (const match_element &a)
+      : x_match_string (a.x_match_string),
+        x_named_tokens (a.x_named_tokens), x_tokens (a.x_tokens),
+        x_token_extents (a.x_token_extents),
+        x_start (a.x_start), x_end (a.x_end)
+    { }
+
+    std::string match_string (void) const { return x_match_string; }
+    string_vector named_tokens (void) const { return x_named_tokens; }
+    string_vector tokens (void) const { return x_tokens; }
+    Matrix token_extents (void) const { return x_token_extents; }
+    double start (void) const { return x_start; }
+    double end (void) const { return x_end; }
+
+  private:
+
+    std::string x_match_string;
+    string_vector x_named_tokens;
+    string_vector x_tokens;
+    Matrix x_token_extents;
+    double x_start;
+    double x_end;
+  };
+
+  class match_data : public octave_base_list<match_element>
+  {
+  public:
+
+    match_data (void)
+      : octave_base_list<match_element> (), named_pats ()
+    { }
+
+    match_data (const std::list<match_element>& l, const string_vector& np)
+      : octave_base_list<match_element> (l), named_pats (np)
+    { }
+
+    match_data (const match_data& rx_lst)
+      : octave_base_list<match_element> (rx_lst),
+        named_pats (rx_lst.named_pats)
+    { }
+
+    match_data& operator = (const match_data& rx_lst)
+    {
+      if (this != &rx_lst)
+        {
+          octave_base_list<match_element>::operator = (rx_lst);
+          named_pats = rx_lst.named_pats;
+        }
+
+      return *this;
+    }
+
+    ~match_data (void) { }
+
+    string_vector named_patterns (void) { return named_pats; }
+
+  private:
+
+    string_vector named_pats;
+  };
+
+private:
+
+  // The pattern we've been asked to match.
+  std::string pattern;
+
+  opts options;
+
+  // Internal data describing the regular expression.
+  void *data;
+
+  std::string m;
+  string_vector named_pats;
+  int nnames;
+  Array<int> named_idx;
+  std::string who;
+
+  void free (void);
+
+  void compile_internal (void);
+};
+
+inline regexp::match_data
+regexp_match (const std::string& pat,
+              const std::string& buffer,
+              const regexp::opts& opt = regexp::opts (),
+              const std::string& who = "regexp")
+{
+  regexp rx (pat, opt, who);
+
+  return rx.match (buffer);
+}
+
+inline bool
+is_regexp_match (const std::string& pat,
+                 const std::string& buffer,
+                 const regexp::opts& opt = regexp::opts (),
+                 const std::string& who = "regexp")
+{
+  regexp rx (pat, opt, who);
+
+  return rx.is_match (buffer);
+}
+
+inline Array<bool>
+is_regexp_match (const std::string& pat,
+                 const string_vector& buffer,
+                 const regexp::opts& opt = regexp::opts (),
+                 const std::string& who = "regexp")
+{
+  regexp rx (pat, opt, who);
+
+  return rx.is_match (buffer);
+}
+
+inline std::string
+regexp_replace (const std::string& pat,
+                const std::string& buffer,
+                const std::string& replacement,
+                const regexp::opts& opt = regexp::opts (),
+                const std::string& who = "regexp")
+{
+  regexp rx (pat, opt, who);
+
+  return rx.replace (buffer, replacement);
+}
+
+#endif
--- a/liboctave/util/lo-utils.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/lo-utils.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -55,8 +55,7 @@
 
 bool xtoo_large_for_float (double x)
 {
-  return (! (xisnan (x) || xisinf (x))
-          && fabs (x) > std::numeric_limits<float>::max ());
+  return (xfinite (x) && fabs (x) > std::numeric_limits<float>::max ());
 }
 
 bool xtoo_large_for_float (const Complex& x)
--- a/liboctave/util/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -2,6 +2,7 @@
   util/module.mk
 
 UTIL_INC = \
+  util/action-container.h \
   util/base-list.h \
   util/byte-swap.h \
   util/caseless-str.h \
@@ -34,13 +35,15 @@
   util/oct-sort.h \
   util/oct-sparse.h \
   util/pathsearch.h \
-  util/regexp.h \
+  util/lo-regexp.h \
   util/singleton-cleanup.h \
   util/sparse-sort.h \
   util/sparse-util.h \
   util/statdefs.h \
   util/str-vec.h \
-  util/sun-utils.h 
+  util/sun-utils.h \
+  util/unwind-prot.h \
+  util/url-transfer.h
 
 UTIL_C_SRC = \
   util/f2c-main.c \
@@ -66,11 +69,13 @@
   util/oct-mutex.cc \
   util/oct-shlib.cc \
   util/pathsearch.cc \
-  util/regexp.cc \
+  util/lo-regexp.cc \
   util/singleton-cleanup.cc \
   util/sparse-sort.cc \
   util/sparse-util.cc \
   util/str-vec.cc \
+  util/unwind-prot.cc \
+  util/url-transfer.cc \
   $(UTIL_C_SRC)
 
 TEMPLATE_SRC += \
--- a/liboctave/util/oct-rl-hist.c	Thu Sep 12 21:08:07 2013 -0400
+++ b/liboctave/util/oct-rl-hist.c	Sat Oct 05 11:22:09 2013 -0400
@@ -289,12 +289,10 @@
           char *tmp = malloc (len + 64);
 
           if (number_lines)
-            sprintf (tmp, "%5d%c%s", i + history_base,
-                     hlist[i]->data ? '*' : ' ',
+            sprintf (tmp, "%5d %s", i + history_base,
                      line ? line : "");
           else
-            sprintf (tmp, "%c%s", hlist[i]->data ? '*' : ' ',
-                     line ? line : "");
+            strcpy (tmp, line ? line : "");
 
           retval[k++] = tmp;
         }
--- a/liboctave/util/regexp.cc	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,620 +0,0 @@
-/*
-
-Copyright (C) 2012 John W. Eaton
-Copyright (C) 2005-2012 David Bateman
-Copyright (C) 2002-2005 Paul Kienzle
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <list>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#if defined (HAVE_PCRE_H)
-#include <pcre.h>
-#elif defined (HAVE_PCRE_PCRE_H)
-#include <pcre/pcre.h>
-#endif
-
-#include "Matrix.h"
-#include "base-list.h"
-#include "lo-error.h"
-#include "oct-locbuf.h"
-#include "quit.h"
-#include "regexp.h"
-#include "str-vec.h"
-
-// Define the maximum number of retries for a pattern that possibly
-// results in an infinite recursion.
-#define PCRE_MATCHLIMIT_MAX 10
-
-// FIXME -- should this be configurable?
-#define MAXLOOKBEHIND 10
-
-static bool lookbehind_warned = false;
-
-// FIXME -- don't bother collecting and composing return values the user
-// doesn't want.
-
-void
-regexp::free (void)
-{
-  if (data)
-    pcre_free (static_cast<pcre *> (data));
-}
-
-void
-regexp::compile_internal (void)
-{
-  // If we had a previously compiled pattern, release it.
-  free ();
-
-  size_t max_length = MAXLOOKBEHIND;
-
-  size_t pos = 0;
-  size_t new_pos;
-  int inames = 0;
-  std::ostringstream buf;
-
-  while ((new_pos = pattern.find ("(?", pos)) != std::string::npos)
-    {
-      if (pattern.at (new_pos + 2) == '<'
-          && !(pattern.at (new_pos + 3) == '='
-               || pattern.at (new_pos + 3) == '!'))
-        {
-          // The syntax of named tokens in pcre is "(?P<name>...)" while
-          // we need a syntax "(?<name>...)", so fix that here. Also an
-          // expression like
-          // "(?<first>\w+)\s+(?<last>\w+)|(?<last>\w+),\s+(?<first>\w+)"
-          // should be perfectly legal, while pcre does not allow the same
-          // named token name on both sides of the alternative. Also fix
-          // that here by replacing name tokens by dummy names, and dealing
-          // with the dummy names later.
-
-          size_t tmp_pos = pattern.find_first_of ('>', new_pos);
-
-          if (tmp_pos == std::string::npos)
-            {
-              (*current_liboctave_error_handler)
-                ("regexp: syntax error in pattern");
-              return;
-            }
-
-          std::string tmp_name =
-            pattern.substr (new_pos+3, tmp_pos-new_pos-3);
-
-          bool found = false;
-
-          for (int i = 0; i < nnames; i++)
-            {
-              if (named_pats(i) == tmp_name)
-                {
-                  named_idx.resize (dim_vector (inames+1, 1));
-                  named_idx(inames) = i;
-                  found = true;
-                  break;
-                }
-            }
-
-          if (! found)
-            {
-              named_idx.resize (dim_vector (inames+1, 1));
-              named_idx(inames) = nnames;
-              named_pats.append (tmp_name);
-              nnames++;
-            }
-
-          if (new_pos - pos > 0)
-            buf << pattern.substr (pos, new_pos-pos);
-          if (inames < 10)
-            buf << "(?P<n00" << inames++;
-          else if (inames < 100)
-            buf << "(?P<n0" << inames++;
-          else
-            buf << "(?P<n" << inames++;
-
-          pos = tmp_pos;
-        }
-      else if (pattern.at (new_pos + 2) == '<')
-        {
-          // Find lookbehind operators of arbitrary length (ie like
-          // "(?<=[a-z]*)") and replace with a maximum length operator
-          // as PCRE can not yet handle arbitrary length lookahead
-          // operators. Use the string length as the maximum length to
-          // avoid issues.
-
-          int brackets = 1;
-          size_t tmp_pos1 = new_pos + 2;
-          size_t tmp_pos2 = tmp_pos1;
-
-          while (tmp_pos1 < pattern.length () && brackets > 0)
-            {
-              char ch = pattern.at (tmp_pos1);
-
-              if (ch == '(')
-                brackets++;
-              else if (ch == ')')
-                {
-                  if (brackets > 1)
-                    tmp_pos2 = tmp_pos1;
-
-                  brackets--;
-                }
-
-              tmp_pos1++;
-            }
-
-          if (brackets != 0)
-            {
-              buf << pattern.substr (pos, new_pos - pos) << "(?";
-              pos = new_pos + 2;
-            }
-          else
-            {
-              size_t tmp_pos3 = pattern.find_first_of ("*+", tmp_pos2);
-
-              if (tmp_pos3 != std::string::npos && tmp_pos3 < tmp_pos1)
-                {
-                  if (!lookbehind_warned)
-                    {
-                      lookbehind_warned = true;
-                      (*current_liboctave_warning_handler)
-                        ("%s: arbitrary length lookbehind patterns are only supported up to length %d",
-                               who.c_str (), MAXLOOKBEHIND);
-                    }
-
-                  buf << pattern.substr (pos, new_pos - pos) << "(";
-
-                  size_t i;
-
-                  if (pattern.at (tmp_pos3) == '*')
-                    i = 0;
-                  else
-                    i = 1;
-
-                  for (; i < max_length + 1; i++)
-                    {
-                      buf << pattern.substr (new_pos, tmp_pos3 - new_pos)
-                          << "{" << i << "}";
-                      buf << pattern.substr (tmp_pos3 + 1,
-                                             tmp_pos1 - tmp_pos3 - 1);
-                      if (i != max_length)
-                        buf << "|";
-                    }
-                  buf << ")";
-                }
-              else
-                buf << pattern.substr (pos, tmp_pos1 - pos);
-
-              pos = tmp_pos1;
-            }
-        }
-      else
-        {
-          buf << pattern.substr (pos, new_pos - pos) << "(?";
-          pos = new_pos + 2;
-        }
-
-    }
-
-  buf << pattern.substr (pos);
-
-  const char *err;
-  int erroffset;
-  std::string buf_str = buf.str ();
-
-  int pcre_options
-    = ((options.case_insensitive () ? PCRE_CASELESS : 0)
-       | (options.dotexceptnewline () ? 0 : PCRE_DOTALL)
-       | (options.lineanchors () ? PCRE_MULTILINE : 0)
-       | (options.freespacing () ? PCRE_EXTENDED : 0));
-
-  data = pcre_compile (buf_str.c_str (), pcre_options, &err, &erroffset, 0);
-
-  if (! data)
-    (*current_liboctave_error_handler)
-      ("%s: %s at position %d of expression", who.c_str (),
-       err, erroffset);
-}
-
-regexp::match_data
-regexp::match (const std::string& buffer)
-{
-  regexp::match_data retval;
-
-  std::list<regexp::match_element> lst;
-
-  int subpatterns;
-  int namecount;
-  int nameentrysize;
-  char *nametable;
-  size_t idx = 0;
-
-  pcre *re = static_cast <pcre *> (data);
-
-  pcre_fullinfo (re, 0, PCRE_INFO_CAPTURECOUNT,  &subpatterns);
-  pcre_fullinfo (re, 0, PCRE_INFO_NAMECOUNT, &namecount);
-  pcre_fullinfo (re, 0, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize);
-  pcre_fullinfo (re, 0, PCRE_INFO_NAMETABLE, &nametable);
-
-  OCTAVE_LOCAL_BUFFER (int, ovector, (subpatterns+1)*3);
-  OCTAVE_LOCAL_BUFFER (int, nidx, namecount);
-
-  for (int i = 0; i < namecount; i++)
-    {
-      // Index of subpattern in first two bytes MSB first of name.
-      // Extract index.
-      nidx[i] = (static_cast<int> (nametable[i*nameentrysize])) << 8
-        | static_cast<int> (nametable[i*nameentrysize+1]);
-    }
-
-  while (true)
-    {
-      OCTAVE_QUIT;
-
-      int matches = pcre_exec (re, 0, buffer.c_str (),
-                               buffer.length (), idx,
-                               (idx ? PCRE_NOTBOL : 0),
-                               ovector, (subpatterns+1)*3);
-
-      if (matches == PCRE_ERROR_MATCHLIMIT)
-        {
-          // Try harder; start with default value for MATCH_LIMIT
-          // and increase it.
-          (*current_liboctave_warning_handler)
-            ("your pattern caused PCRE to hit its MATCH_LIMIT; trying harder now, but this will be slow");
-
-          pcre_extra pe;
-
-          pcre_config (PCRE_CONFIG_MATCH_LIMIT,
-                       static_cast <void *> (&pe.match_limit));
-
-          pe.flags = PCRE_EXTRA_MATCH_LIMIT;
-
-          int i = 0;
-          while (matches == PCRE_ERROR_MATCHLIMIT
-                 && i++ < PCRE_MATCHLIMIT_MAX)
-            {
-              OCTAVE_QUIT;
-
-              pe.match_limit *= 10;
-              matches = pcre_exec (re, &pe, buffer.c_str (),
-                                   buffer.length (), idx,
-                                   (idx ? PCRE_NOTBOL : 0),
-                                   ovector, (subpatterns+1)*3);
-            }
-        }
-
-      if (matches < 0 && matches != PCRE_ERROR_NOMATCH)
-        {
-          (*current_liboctave_error_handler)
-            ("%s: internal error calling pcre_exec; error code from pcre_exec is %i",
-             who.c_str (), matches);
-          return retval;
-        }
-      else if (matches == PCRE_ERROR_NOMATCH)
-        break;
-      else if (ovector[1] <= ovector[0] && ! options.emptymatch ())
-        {
-          // Zero length match.  Skip to next char.
-          idx = ovector[0] + 1;
-          if (idx < buffer.length ())
-            continue;
-          else
-            break;
-        }
-      else
-        {
-          int pos_match = 0;
-          Matrix token_extents (matches-1, 2);
-
-          for (int i = 1; i < matches; i++)
-            {
-              if (ovector[2*i] >= 0 && ovector[2*i+1] > 0
-                  && (i == 1 || ovector[2*i] != ovector[2*i-2]
-                      || ovector[2*i-1] != ovector[2*i+1]))
-                {
-                  token_extents(pos_match,0) = double (ovector[2*i]+1);
-                  token_extents(pos_match++,1) = double (ovector[2*i+1]);
-                }
-            }
-
-          token_extents.resize (pos_match, 2);
-
-          double start = double (ovector[0]+1);
-          double end = double (ovector[1]);
-
-          const char **listptr;
-          int status = pcre_get_substring_list (buffer.c_str (), ovector,
-                                                matches, &listptr);
-
-          if (status == PCRE_ERROR_NOMEMORY)
-            {
-              (*current_liboctave_error_handler)
-                ("%s: cannot allocate memory in pcre_get_substring_list",
-                 who.c_str ());
-              return retval;
-            }
-
-          string_vector tokens (pos_match);
-          string_vector named_tokens (nnames);
-          int pos_offset = 0;
-          pos_match = 0;
-
-          for (int i = 1; i < matches; i++)
-            {
-              if (ovector[2*i] >= 0 && ovector[2*i+1] > 0)
-                {
-                  if (i == 1 || ovector[2*i] != ovector[2*i-2]
-                      || ovector[2*i-1] != ovector[2*i+1])
-                    {
-                      if (namecount > 0)
-                        {
-                          // FIXME: Should probably do this with a map()
-                          // rather than a linear search.  However,
-                          // the number of captured, named expressions
-                          // is usually pretty small (< 4)
-                          for (int j = 0; j < namecount; j++)
-                            {
-                              if (nidx[j] == i)
-                                { 
-                                  named_tokens(named_idx(j)) =
-                                    std::string (*(listptr+i-pos_offset));
-                                  break;
-                                }
-                            }
-                        }
-
-                      tokens(pos_match++) = std::string (*(listptr+i));
-                    }
-                  else
-                    pos_offset++;
-                }
-            }
-
-          std::string match_string = std::string (*listptr);
-
-          pcre_free_substring_list (listptr);
-
-          regexp::match_element new_elem (named_tokens, tokens, match_string,
-                                          token_extents, start, end);
-          lst.push_back (new_elem);
-
-          if (ovector[1] <= ovector[0])
-          {
-            // Zero length match.  Skip to next char.
-            idx = ovector[0] + 1;
-            if (idx <= buffer.length ())
-              continue;
-          }
-          else 
-            idx = ovector[1];
-
-          if (options.once () || idx >= buffer.length ())
-            break;
-        }
-    }
-
-  retval = regexp::match_data (lst, named_pats);
-
-  return retval;
-}
-
-bool
-regexp::is_match (const std::string& buffer)
-{
-  regexp::match_data rx_lst = match (buffer);
-
-  return rx_lst.size () > 0;
-}
-
-Array<bool>
-regexp::is_match (const string_vector& buffer)
-{
-  octave_idx_type len = buffer.length ();
-
-  Array<bool> retval (dim_vector (len, 1));
-
-  for (octave_idx_type i = 0; i < buffer.length (); i++)
-    retval(i) = is_match (buffer(i));
-
-  return retval;
-}
-
-// Declare rep_token_t used in processing replacement string
-typedef struct
-  {
-    size_t pos;
-    int num;
-  } rep_token_t;
-
-
-std::string
-regexp::replace (const std::string& buffer, const std::string& replacement)
-{
-  std::string retval;
-
-  regexp::match_data rx_lst = match (buffer);
-
-  size_t num_matches = rx_lst.size ();
-
-  if (num_matches == 0)
-    {
-      retval = buffer;
-      return retval;
-    }
-
-  // Identify replacement tokens; build a vector of group numbers in
-  // the replacement string so that we can quickly calculate the size
-  // of the replacement.
-
-  // FIXME: All code assumes that only 10 tokens ($0-$9) exist.
-  //        $11 represents $1 followed by the character '1' rather than
-  //        the eleventh capture buffer.
-
-  std::string repstr = replacement;
-  std::vector<rep_token_t> tokens;
-  tokens.reserve (5);  // Reserve memory for 5 pattern replacements
-
-  for (size_t i=0; i < repstr.size (); i++)
-    {
-      if (repstr[i] == '\\')
-        {
-          if (i < repstr.size () - 1 && repstr[i+1] == '$')
-            {
-              repstr.erase (i,1);  // erase backslash
-              i++;                 // skip over '$'
-              continue;
-            }
-          if (i < repstr.size () - 1 && repstr[i+1] == '\\')
-            {
-              repstr.erase (i,1);  // erase 1st backslash
-              continue;
-            }
-        }
-      else if (repstr[i] == '$')
-        {
-          if (i < repstr.size () - 1 && isdigit (repstr[i+1]))
-            {
-              rep_token_t tmp_token;
-
-              tmp_token.pos = i;
-              tmp_token.num = repstr[i+1]-'0';
-              tokens.push_back (tmp_token);
-            }
-        }
-    }
-
-  std::string rep;
-  int num_tokens = tokens.size ();
-
-  if (num_tokens > 0)
-    {
-      // Determine replacement length
-      const size_t replen = repstr.size () - 2*num_tokens;
-      int delta = 0;
-      regexp::match_data::const_iterator p = rx_lst.begin ();
-      for (size_t i = 0; i < num_matches; i++)
-        {
-          OCTAVE_QUIT;
-
-          double start = p->start ();
-          double end = p->end ();
-
-          const Matrix pairs (p->token_extents ());
-          size_t pairlen = 0;
-          for (int j = 0; j < num_tokens; j++)
-            {
-              if (tokens[j].num == 0)
-                pairlen += static_cast<size_t> (end - start) + 1;
-              else if (tokens[j].num <= pairs.rows ())
-                pairlen += static_cast<size_t> (pairs(tokens[j].num-1,1)
-                                                - pairs(tokens[j].num-1,0)) + 1;
-            }
-          delta += (static_cast<int> (replen + pairlen)
-                    - static_cast<int> (end - start + 1));
-          p++;
-        }
-
-      // Build replacement string
-      rep.reserve (buffer.size () + delta);
-      size_t from = 0;
-      p = rx_lst.begin ();
-      for (size_t i = 0; i < num_matches; i++)
-        {
-          OCTAVE_QUIT;
-
-          double start = p->start ();
-          double end = p->end ();
-
-          const Matrix pairs (p->token_extents ());
-          rep.append (&buffer[from], static_cast<size_t> (start - 1) - from);
-          from = static_cast<size_t> (end - 1) + 1;
-
-          size_t cur_pos = 0;
-
-          for (int j = 0; j < num_tokens; j++)
-            {
-              rep.append (&repstr[cur_pos], (tokens[j].pos) - cur_pos);
-              cur_pos = tokens[j].pos+2;
-
-              int k = tokens[j].num;
-              if (k == 0)
-                {
-                  // replace with entire match
-                  rep.append (&buffer[static_cast<size_t> (end - 1)],
-                              static_cast<size_t> (end - start) + 1);
-                }
-              else if (k <= pairs.rows ())
-                {
-                  // replace with group capture
-                  rep.append (&buffer[static_cast<size_t> (pairs(k-1,0)-1)],
-                              static_cast<size_t> (pairs(k-1,1)
-                                                   - pairs(k-1,0)) + 1);
-                }
-              else
-                {
-                  // replace with nothing
-                }
-            }
-          if (cur_pos < repstr.size ())
-            rep.append (&repstr[cur_pos], repstr.size () - cur_pos);
-
-          p++;
-        }
-      rep.append (&buffer[from], buffer.size () - from);
-    }
-  else
-    {
-      // Determine repstr length
-      const size_t replen = repstr.size ();
-      int delta = 0;
-      regexp::match_data::const_iterator p = rx_lst.begin ();
-      for (size_t i = 0; i < num_matches; i++)
-        {
-          OCTAVE_QUIT;
-          delta += static_cast<int> (replen)
-                   - static_cast<int> (p->end () - p->start () + 1);
-          p++;
-        }
-
-      // Build replacement string
-      rep.reserve (buffer.size () + delta);
-      size_t from = 0;
-      p = rx_lst.begin ();
-      for (size_t i = 0; i < num_matches; i++)
-        {
-          OCTAVE_QUIT;
-          rep.append (&buffer[from],
-                      static_cast<size_t> (p->start () - 1) - from);
-          from = static_cast<size_t> (p->end () - 1) + 1;
-          rep.append (repstr);
-          p++;
-        }
-      rep.append (&buffer[from], buffer.size () - from);
-    }
-
-  retval = rep;
-  return retval;
-}
--- a/liboctave/util/regexp.h	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +0,0 @@
-/*
-
-Copyright (C) 2012 John W. Eaton
-Copyright (C) 2005-2012 David Bateman
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_regexp_match_h)
-#define octave_regexp_match_h 1
-
-#include <list>
-#include <sstream>
-#include <string>
-
-#include "Array.h"
-#include "Matrix.h"
-#include "base-list.h"
-#include "str-vec.h"
-
-class
-OCTAVE_API
-regexp
-{
-public:
-
-  class opts;
-  class match_data;
-
-  regexp (const std::string& pat = "",
-          const regexp::opts& opt = regexp::opts (),
-          const std::string& w = "regexp")
-    : pattern (pat), options (opt), data (0), named_pats (),
-      nnames (0), named_idx (), who (w)
-  {
-    compile_internal ();
-  }
-
-  regexp (const regexp& rx)
-    : pattern (rx.pattern), data (rx.data), named_pats (rx.named_pats),
-      nnames (rx.nnames), named_idx (rx.named_idx)
-  { }
-
-  regexp& operator = (const regexp& rx)
-  {
-    if (this != &rx)
-      {
-        pattern = rx.pattern;
-        data = rx.data;
-        named_pats = rx.named_pats;
-        nnames = rx.nnames;
-        named_idx = rx.named_idx;
-      }
-
-    return *this;
-  }
-
-  ~regexp (void) { free (); }
-
-  void compile (const std::string& pat,
-                const regexp::opts& opt = regexp::opts ())
-  {
-    pattern = pat;
-    options = opt;
-    compile_internal ();
-  }
-
-  match_data match (const std::string& buffer);
-
-  bool is_match (const std::string& buffer);
-
-  Array<bool> is_match (const string_vector& buffer);
-
-  std::string replace (const std::string& buffer,
-                       const std::string& replacement);
-
-  class opts
-  {
-  public:
-
-    opts (void)
-      : x_case_insensitive (false), x_dotexceptnewline (false),
-        x_emptymatch (false), x_freespacing (false), x_lineanchors (false),
-        x_once (false) { }
-
-    opts (const opts& o)
-      : x_case_insensitive (o.x_case_insensitive),
-        x_dotexceptnewline (o.x_dotexceptnewline),
-        x_emptymatch (o.x_emptymatch),
-        x_freespacing (o.x_freespacing),
-        x_lineanchors (o.x_lineanchors),
-        x_once (o.x_once)
-    { }
-
-    opts& operator = (const opts& o)
-    {
-      if (this != &o)
-        {
-          x_case_insensitive = o.x_case_insensitive;
-          x_dotexceptnewline = o.x_dotexceptnewline;
-          x_emptymatch = o.x_emptymatch;
-          x_freespacing = o.x_freespacing;
-          x_lineanchors = o.x_lineanchors;
-          x_once = o.x_once;
-        }
-
-      return *this;
-    }
-
-    ~opts (void) { }
-
-    void case_insensitive (bool val) { x_case_insensitive = val; }
-    void dotexceptnewline (bool val) { x_dotexceptnewline = val; }
-    void emptymatch (bool val) { x_emptymatch = val; }
-    void freespacing (bool val) { x_freespacing = val; }
-    void lineanchors (bool val) { x_lineanchors = val; }
-    void once (bool val) { x_once = val; }
-
-    bool case_insensitive (void) const { return x_case_insensitive; }
-    bool dotexceptnewline (void) const { return x_dotexceptnewline; }
-    bool emptymatch (void) const { return x_emptymatch; }
-    bool freespacing (void) const { return x_freespacing; }
-    bool lineanchors (void) const { return x_lineanchors; }
-    bool once (void) const { return x_once; }
-
-  private:
-
-    bool x_case_insensitive;
-    bool x_dotexceptnewline;
-    bool x_emptymatch;
-    bool x_freespacing;
-    bool x_lineanchors;
-    bool x_once;
-  };
-
-  class match_element
-  {
-  public:
-
-    match_element (const string_vector& nt, const string_vector& t,
-                   const std::string& ms, const Matrix& te,
-                   double s, double e)
-      : x_match_string (ms), x_named_tokens (nt), x_tokens (t),
-        x_token_extents (te), x_start (s), x_end (e)
-    { }
-
-    match_element (const match_element &a)
-      : x_match_string (a.x_match_string),
-        x_named_tokens (a.x_named_tokens), x_tokens (a.x_tokens),
-        x_token_extents (a.x_token_extents),
-        x_start (a.x_start), x_end (a.x_end)
-    { }
-
-    std::string match_string (void) const { return x_match_string; }
-    string_vector named_tokens (void) const { return x_named_tokens; }
-    string_vector tokens (void) const { return x_tokens; }
-    Matrix token_extents (void) const { return x_token_extents; }
-    double start (void) const { return x_start; }
-    double end (void) const { return x_end; }
-
-  private:
-
-    std::string x_match_string;
-    string_vector x_named_tokens;
-    string_vector x_tokens;
-    Matrix x_token_extents;
-    double x_start;
-    double x_end;
-  };
-
-  class match_data : public octave_base_list<match_element>
-  {
-  public:
-
-    match_data (void)
-      : octave_base_list<match_element> (), named_pats ()
-    { }
-
-    match_data (const std::list<match_element>& l, const string_vector& np)
-      : octave_base_list<match_element> (l), named_pats (np)
-    { }
-
-    match_data (const match_data& rx_lst)
-      : octave_base_list<match_element> (rx_lst),
-        named_pats (rx_lst.named_pats)
-    { }
-
-    match_data& operator = (const match_data& rx_lst)
-    {
-      if (this != &rx_lst)
-        {
-          octave_base_list<match_element>::operator = (rx_lst);
-          named_pats = rx_lst.named_pats;
-        }
-
-      return *this;
-    }
-
-    ~match_data (void) { }
-
-    string_vector named_patterns (void) { return named_pats; }
-
-  private:
-
-    string_vector named_pats;
-  };
-
-private:
-
-  // The pattern we've been asked to match.
-  std::string pattern;
-
-  opts options;
-
-  // Internal data describing the regular expression.
-  void *data;
-
-  std::string m;
-  string_vector named_pats;
-  int nnames;
-  Array<int> named_idx;
-  std::string who;
-
-  void free (void);
-
-  void compile_internal (void);
-};
-
-inline regexp::match_data
-regexp_match (const std::string& pat,
-              const std::string& buffer,
-              const regexp::opts& opt = regexp::opts (),
-              const std::string& who = "regexp")
-{
-  regexp rx (pat, opt, who);
-
-  return rx.match (buffer);
-}
-
-inline bool
-is_regexp_match (const std::string& pat,
-                 const std::string& buffer,
-                 const regexp::opts& opt = regexp::opts (),
-                 const std::string& who = "regexp")
-{
-  regexp rx (pat, opt, who);
-
-  return rx.is_match (buffer);
-}
-
-inline Array<bool>
-is_regexp_match (const std::string& pat,
-                 const string_vector& buffer,
-                 const regexp::opts& opt = regexp::opts (),
-                 const std::string& who = "regexp")
-{
-  regexp rx (pat, opt, who);
-
-  return rx.is_match (buffer);
-}
-
-inline std::string
-regexp_replace (const std::string& pat,
-                const std::string& buffer,
-                const std::string& replacement,
-                const regexp::opts& opt = regexp::opts (),
-                const std::string& who = "regexp")
-{
-  regexp rx (pat, opt, who);
-
-  return rx.replace (buffer, replacement);
-}
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/unwind-prot.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,38 @@
+/*
+
+Copyright (C) 1993-2012 John W. Eaton
+Copyright (C) 2009 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "lo-error.h"
+#include "unwind-prot.h"
+
+void
+unwind_protect_safe::gripe_exception (void)
+{
+  // FIXME: can this throw an exception?
+
+  (*current_liboctave_error_handler)
+    ("internal: unhandled exception in unwind_protect handler");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/unwind-prot.h	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,145 @@
+/*
+
+Copyright (C) 1993-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_unwind_prot_h)
+#define octave_unwind_prot_h 1
+
+#include <cstddef>
+
+#include <stack>
+#include <memory>
+
+#include "action-container.h"
+
+class
+OCTINTERP_API
+unwind_protect : public action_container
+{
+public:
+
+  unwind_protect (void) : lifo () { }
+
+  // Destructor should not raise an exception, so all actions
+  // registered should be exception-safe (but setting error_state is
+  // allowed). If you're not sure, see unwind_protect_safe.
+
+  ~unwind_protect (void) { run (); }
+
+  virtual void add (elem *new_elem)
+  {
+    lifo.push (new_elem);
+  }
+
+  void add (void (*fcn) (void *), void *ptr = 0) GCC_ATTR_DEPRECATED
+  {
+    add (new fcn_arg_elem<void *> (fcn, ptr));
+  }
+
+  operator bool (void) const { return ! empty (); }
+
+  void run_top (void) GCC_ATTR_DEPRECATED { run_first (); }
+
+  void run_first (void)
+  {
+    if (! empty ())
+      {
+        // No leak on exception!
+        std::auto_ptr<elem> ptr (lifo.top ());
+        lifo.pop ();
+        ptr->run ();
+      }
+  }
+
+  void run_top (int num) GCC_ATTR_DEPRECATED { run (num); }
+
+  void discard_top (void) GCC_ATTR_DEPRECATED { discard_first (); }
+
+  void discard_first (void)
+  {
+    if (! empty ())
+      {
+        elem *ptr = lifo.top ();
+        lifo.pop ();
+        delete ptr;
+      }
+  }
+
+  void discard_top (int num) GCC_ATTR_DEPRECATED { discard (num); }
+
+  size_t size (void) const { return lifo.size (); }
+
+protected:
+
+  std::stack<elem *> lifo;
+
+private:
+
+  // No copying!
+
+  unwind_protect (const unwind_protect&);
+
+  unwind_protect& operator = (const unwind_protect&);
+};
+
+// Like unwind_protect, but this one will guard against the
+// possibility of seeing an exception (or interrupt) in the cleanup
+// actions. Not that we can do much about it, but at least we won't
+// crash.
+
+class
+OCTINTERP_API
+unwind_protect_safe : public unwind_protect
+{
+private:
+
+  static void gripe_exception (void);
+
+public:
+
+  unwind_protect_safe (void) : unwind_protect () { }
+
+  ~unwind_protect_safe (void)
+    {
+      while (! empty ())
+        {
+          try
+            {
+              run_first ();
+            }
+          catch (...) // Yes, the black hole. Remember we're in a dtor.
+            {
+              gripe_exception ();
+            }
+        }
+    }
+
+private:
+
+  // No copying!
+
+  unwind_protect_safe (const unwind_protect_safe&);
+
+  unwind_protect_safe& operator = (const unwind_protect_safe&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/url-transfer.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,799 @@
+/*
+
+Copyright (C) 2013 John W. Eaton
+Copyright (C) 2006-2012 Alexander Barth
+Copyright (C) 2009 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Author: Alexander Barth <abarth@marine.usf.edu>
+// Author: jwe
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+
+#include "dir-ops.h"
+#include "file-ops.h"
+#include "file-stat.h"
+#include "unwind-prot.h"
+#include "url-transfer.h"
+
+#ifdef HAVE_CURL
+#include <curl/curl.h>
+#include <curl/curlver.h>
+#include <curl/easy.h>
+#endif
+
+void base_url_transfer::delete_file (const std::string& file)
+{
+  octave_unlink (file);
+}
+
+void
+base_url_transfer::mget_directory (const std::string& directory,
+                                   const std::string& target)
+{
+  std::string sep = file_ops::dir_sep_str ();
+  file_stat fs (directory);
+
+  if (!fs || !fs.is_dir ())
+    {
+      std::string msg;
+      int status = octave_mkdir (directory, 0777, msg);
+
+      if (status < 0)
+        {
+          ok = false;
+          errmsg = "__ftp_mget__: can not create directory '"
+            + target + sep + directory + "': " + msg;
+          return;
+        }
+    }
+
+  cwd (directory);
+
+  if (good ())
+    {
+      unwind_protect_safe frame;
+
+      frame.add_fcn (reset_path, this);
+
+      string_vector sv = list ();
+
+      for (octave_idx_type i = 0; i < sv.length (); i++)
+        {
+          time_t ftime;
+          bool fisdir;
+          double fsize;
+
+          get_fileinfo (sv(i), fsize, ftime, fisdir);
+
+          if (fisdir)
+            mget_directory (sv(i), target + directory + sep);
+          else
+            {
+              std::string realfile = target + directory + sep + sv(i);
+
+              std::ofstream ofile (realfile.c_str (),
+                                   std::ios::out | std::ios::binary);
+
+              if (! ofile.is_open ())
+                {
+                  ok = false;
+                  errmsg = "__ftp_mget__: unable to open file";
+                  break;
+                }
+
+              unwind_protect_safe frame2;
+
+              frame2.add_fcn (delete_file, realfile);
+
+              get (sv(i), ofile);
+
+              ofile.close ();
+
+              if (good ())
+                frame2.discard ();
+            }
+
+          if (! good ())
+            break;
+        }
+    }
+}
+
+string_vector
+base_url_transfer::mput_directory (const std::string& base,
+                                   const std::string& directory)
+{
+  string_vector file_list;
+
+  std::string realdir
+    = (base.length () == 0
+       ? directory : base + file_ops::dir_sep_str () + directory);
+
+  mkdir (directory);
+
+  if (! good ())
+    return file_list;
+
+  cwd (directory);
+
+  if (good ())
+    {
+      unwind_protect_safe frame;
+
+      frame.add_fcn (reset_path, this);
+
+      dir_entry dirlist (realdir);
+
+      if (dirlist)
+        {
+          string_vector files = dirlist.read ();
+
+          for (octave_idx_type i = 0; i < files.length (); i++)
+            {
+              std::string file = files (i);
+
+              if (file == "." || file == "..")
+                continue;
+
+              std::string realfile = realdir + file_ops::dir_sep_str () + file;
+              file_stat fs (realfile);
+
+              if (! fs.exists ())
+                {
+                  ok = false;
+                  errmsg = "__ftp__mput: file '" + realfile
+                    + "' does not exist";
+                  break;
+                }
+
+              if (fs.is_dir ())
+                {
+                  file_list.append (mput_directory (realdir, file));
+
+                  if (! good ())
+                    break;
+                }
+              else
+                {
+                  // FIXME Does ascii mode need to be flagged here?
+                  std::ifstream ifile (realfile.c_str (), std::ios::in |
+                                       std::ios::binary);
+
+                  if (! ifile.is_open ())
+                    {
+                      ok = false;
+                      errmsg = "__ftp_mput__: unable to open file '"
+                        + realfile + "'";
+                      break;
+                    }
+
+                  put (file, ifile);
+
+                  ifile.close ();
+
+                  if (! good ())
+                    break;
+
+                  file_list.append (realfile);
+                }
+            }
+        }
+      else
+        {
+          ok = false;
+          errmsg = "__ftp_mput__: can not read the directory '"
+            + realdir + "'";
+        }
+    }
+}
+
+#if defined (HAVE_CURL)
+
+static int
+write_data (void *buffer, size_t size, size_t nmemb, void *streamp)
+{
+  std::ostream& stream = *(static_cast<std::ostream*> (streamp));
+  stream.write (static_cast<const char*> (buffer), size*nmemb);
+  return (stream.fail () ? 0 : size * nmemb);
+}
+
+static int
+read_data (void *buffer, size_t size, size_t nmemb, void *streamp)
+{
+  std::istream& stream = *(static_cast<std::istream*> (streamp));
+  stream.read (static_cast<char*> (buffer), size*nmemb);
+  if (stream.eof ())
+    return stream.gcount ();
+  else
+    return (stream.fail () ? 0 : size * nmemb);
+}
+
+static size_t
+throw_away (void *, size_t size, size_t nmemb, void *)
+{
+  return static_cast<size_t>(size * nmemb);
+}
+
+// I'd love to rewrite this as a private method of the url_transfer
+// class, but you can't pass the va_list from the wrapper SETOPT to
+// the curl_easy_setopt function.
+#define SETOPT(option, parameter) \
+  do \
+    { \
+      CURLcode res = curl_easy_setopt (curl, option, parameter); \
+      if (res != CURLE_OK) \
+        { \
+          ok = false; \
+          errmsg = curl_easy_strerror (res); \
+          return; \
+        } \
+    } \
+  while (0)
+
+// Same as above but with a return value.
+#define SETOPTR(option, parameter) \
+  do \
+    { \
+      CURLcode res = curl_easy_setopt (curl, option, parameter); \
+      if (res != CURLE_OK) \
+        { \
+          ok = false; \
+          errmsg = curl_easy_strerror (res); \
+          return retval; \
+        } \
+    } \
+  while (0)
+
+class curl_transfer : public base_url_transfer
+{
+public:
+
+  curl_transfer (void)
+    : base_url_transfer (), curl (curl_easy_init ()), errnum ()
+  {
+    if (curl)
+      valid = true;
+    else
+      errmsg = "can not create curl object";
+  }
+
+  curl_transfer (const std::string& host_arg, const std::string& user_arg,
+                 const std::string& passwd, std::ostream& os)
+    : base_url_transfer (host_arg, user_arg, passwd, os),
+      curl (curl_easy_init ()), errnum ()
+  {
+    if (curl)
+      valid = true;
+    else
+      {
+        errmsg = "can not create curl object";
+        return;
+      }
+
+    init (user_arg, passwd, std::cin, os);
+
+    std::string url ("ftp://" + host_arg);
+    SETOPT (CURLOPT_URL, url.c_str ());
+
+    // Setup the link, with no transfer.
+    perform ();
+  }
+
+  curl_transfer (const std::string& url, const std::string& method,
+                 const Array<std::string>& param, std::ostream& os)
+    : base_url_transfer (url, method, param, os),
+      curl (curl_easy_init ()), errnum ()
+  {
+    if (curl)
+      valid = true;
+    else
+      {
+        errmsg = "can not create curl object";
+        return;
+      }
+
+    init ("", "", std::cin, os);
+
+    SETOPT (CURLOPT_NOBODY, 0);
+
+    // Restore the default HTTP request method to GET after setting
+    // NOBODY to true and back to false.  This is needed for backward
+    // compatibility with versions of libcurl < 7.18.2.
+    SETOPT (CURLOPT_HTTPGET, 1);
+
+    // Don't need to store the parameters here as we can't change
+    // the URL after the object is created
+    std::string query_string = form_query_string (param);
+
+    if (method == "get")
+      {
+        query_string = url + "?" + query_string;
+        SETOPT (CURLOPT_URL, query_string.c_str ());
+      }
+    else if (method == "post")
+      {
+        SETOPT (CURLOPT_URL, url.c_str ());
+        SETOPT (CURLOPT_POSTFIELDS, query_string.c_str ());
+      }
+    else
+      SETOPT (CURLOPT_URL, url.c_str ());
+
+    perform ();
+  }
+
+  ~curl_transfer (void)
+  {
+    if (curl)
+      curl_easy_cleanup (curl);
+  }
+
+  void perform (void)
+  {
+    BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
+
+    errnum = curl_easy_perform (curl);
+
+    if (errnum != CURLE_OK)
+      {
+        ok = false;
+        errmsg = curl_easy_strerror (errnum);
+      }
+
+    END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
+  }
+
+  std::string lasterror (void) const
+  {
+    return std::string (curl_easy_strerror (errnum));
+  }
+
+  std::ostream& set_ostream (std::ostream& os)
+  {
+    std::ostream& retval = *curr_ostream;
+    curr_ostream = &os;
+    SETOPTR (CURLOPT_WRITEDATA, static_cast<void*> (curr_ostream));
+    return retval;
+  }
+
+  std::istream& set_istream (std::istream& is)
+  {
+    std::istream& retval = *curr_istream;
+    curr_istream = &is;
+    SETOPTR (CURLOPT_READDATA, static_cast<void*> (curr_istream));
+    return retval;
+  }
+
+  void ascii (void)
+  {
+    ascii_mode = true;
+    SETOPT (CURLOPT_TRANSFERTEXT, 1);
+  }
+
+  void binary (void)
+  {
+    ascii_mode = false;
+    SETOPT (CURLOPT_TRANSFERTEXT, 0);
+  }
+
+  void cwd (const std::string& path)
+  {
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    std::string cmd = "cwd " + path;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    SETOPT (CURLOPT_POSTQUOTE, slist);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+  }
+
+  void del (const std::string& file)
+  {
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    std::string cmd = "dele " + file;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    SETOPT (CURLOPT_POSTQUOTE, slist);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+  }
+
+  void rmdir (const std::string& path)
+  {
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    std::string cmd = "rmd " + path;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    SETOPT (CURLOPT_POSTQUOTE, slist);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+  }
+
+  void mkdir (const std::string& path)
+  {
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    std::string cmd = "mkd " + path;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    SETOPT (CURLOPT_POSTQUOTE, slist);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+  }
+
+  void rename (const std::string& oldname, const std::string& newname)
+  {
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    std::string cmd = "rnfr " + oldname;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    cmd = "rnto " + newname;
+    slist = curl_slist_append (slist, cmd.c_str ());
+    SETOPT (CURLOPT_POSTQUOTE, slist);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+  }
+
+  void put (const std::string& file, std::istream& is)
+  {
+    std::string url = "ftp://" + host + "/" + file;
+    SETOPT (CURLOPT_URL, url.c_str ());
+    SETOPT (CURLOPT_UPLOAD, 1);
+    SETOPT (CURLOPT_NOBODY, 0);
+    std::istream& old_is = set_istream (is);
+
+    perform ();
+    if (! good ())
+      return;
+
+    set_istream (old_is);
+    SETOPT (CURLOPT_NOBODY, 1);
+    SETOPT (CURLOPT_UPLOAD, 0);
+    url = "ftp://" + host;
+    SETOPT (CURLOPT_URL, url.c_str ());
+  }
+
+  void get (const std::string& file, std::ostream& os)
+  {
+    std::string url = "ftp://" + host + "/" + file;
+    SETOPT (CURLOPT_URL, url.c_str ());
+    SETOPT (CURLOPT_NOBODY, 0);
+    std::ostream& old_os = set_ostream (os);
+
+    perform ();
+    if (! good ())
+      return;
+
+    set_ostream (old_os);
+    SETOPT (CURLOPT_NOBODY, 1);
+    url = "ftp://" + host;
+    SETOPT (CURLOPT_URL, url.c_str ());
+  }
+
+  void dir (void)
+  {
+    std::string url = "ftp://" + host + "/";
+    SETOPT (CURLOPT_URL, url.c_str ());
+    SETOPT (CURLOPT_NOBODY, 0);
+
+    perform ();
+    if (! good ())
+      return;
+
+    SETOPT (CURLOPT_NOBODY, 1);
+    url = "ftp://" + host;
+    SETOPT (CURLOPT_URL, url.c_str ());
+  }
+
+  string_vector list (void)
+  {
+    string_vector retval;
+
+    std::ostringstream buf;
+    std::string url = "ftp://" + host + "/";
+    SETOPTR (CURLOPT_WRITEDATA, static_cast<void*> (&buf));
+    SETOPTR (CURLOPT_URL, url.c_str ());
+    SETOPTR (CURLOPT_DIRLISTONLY, 1);
+    SETOPTR (CURLOPT_NOBODY, 0);
+
+    perform ();
+    if (! good ())
+      return retval;
+
+    SETOPTR (CURLOPT_NOBODY, 1);
+    url = "ftp://" + host;
+    SETOPTR (CURLOPT_WRITEDATA, static_cast<void*> (curr_ostream));
+    SETOPTR (CURLOPT_DIRLISTONLY, 0);
+    SETOPTR (CURLOPT_URL, url.c_str ());
+
+    // Count number of directory entries
+    std::string str = buf.str ();
+    octave_idx_type n = 0;
+    size_t pos = 0;
+    while (true)
+      {
+        pos = str.find_first_of ('\n', pos);
+        if (pos == std::string::npos)
+          break;
+        pos++;
+        n++;
+      }
+    retval.resize (n);
+    pos = 0;
+    for (octave_idx_type i = 0; i < n; i++)
+      {
+        size_t newpos = str.find_first_of ('\n', pos);
+        if (newpos == std::string::npos)
+          break;
+
+        retval(i) = str.substr(pos, newpos - pos);
+        pos = newpos + 1;
+      }
+
+    return retval;
+  }
+
+  void get_fileinfo (const std::string& filename, double& filesize,
+                     time_t& filetime, bool& fileisdir)
+  {
+    std::string path = pwd ();
+
+    std::string url = "ftp://" + host + "/" + path + "/" + filename;
+    SETOPT (CURLOPT_URL, url.c_str ());
+    SETOPT (CURLOPT_FILETIME, 1);
+    SETOPT (CURLOPT_HEADERFUNCTION, throw_away);
+    SETOPT (CURLOPT_WRITEFUNCTION, throw_away);
+
+    // FIXME
+    // The MDTM command fails for a directory on the servers I tested
+    // so this is a means of testing for directories. It also means
+    // I can't get the date of directories!
+
+    perform ();
+    if (! good ())
+      {
+        fileisdir = true;
+        filetime = -1;
+        filesize = 0;
+
+        return;
+      }
+
+    fileisdir = false;
+    time_t ft;
+    curl_easy_getinfo (curl, CURLINFO_FILETIME, &ft);
+    filetime = ft;
+    double fs;
+    curl_easy_getinfo (curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fs);
+    filesize = fs;
+
+    SETOPT (CURLOPT_WRITEFUNCTION, write_data);
+    SETOPT (CURLOPT_HEADERFUNCTION, 0);
+    SETOPT (CURLOPT_FILETIME, 0);
+    url = "ftp://" + host;
+    SETOPT (CURLOPT_URL, url.c_str ());
+
+    // The MDTM command seems to reset the path to the root with the
+    // servers I tested with, so cd again into the correct path. Make
+    // the path absolute so that this will work even with servers that
+    // don't end up in the root after an MDTM command.
+    cwd ("/" + path);
+  }
+
+  std::string pwd (void)
+  {
+    std::string retval;
+
+    struct curl_slist *slist = 0;
+
+    unwind_protect frame;
+    frame.add_fcn (curl_slist_free_all, slist);
+
+    slist = curl_slist_append (slist, "pwd");
+    SETOPTR (CURLOPT_POSTQUOTE, slist);
+    SETOPTR (CURLOPT_HEADERFUNCTION, write_data);
+
+    std::ostringstream buf;
+    SETOPTR (CURLOPT_WRITEHEADER, static_cast<void *>(&buf));
+
+    perform ();
+    if (! good ())
+      return retval;
+
+    retval = buf.str ();
+
+    // Can I assume that the path is alway in "" on the last line
+    size_t pos2 = retval.rfind ('"');
+    size_t pos1 = retval.rfind ('"', pos2 - 1);
+    retval = retval.substr (pos1 + 1, pos2 - pos1 - 1);
+
+    SETOPTR (CURLOPT_HEADERFUNCTION, 0);
+    SETOPTR (CURLOPT_WRITEHEADER, 0);
+    SETOPTR (CURLOPT_POSTQUOTE, 0);
+
+    return retval;
+  }
+
+private:
+
+  CURL *curl;
+  CURLcode errnum;
+
+  // No copying!
+
+  curl_transfer (const curl_transfer&);
+
+  curl_transfer& operator = (const curl_transfer&);
+
+  void init (const std::string& user, const std::string& passwd,
+             std::istream& is, std::ostream& os)
+  {
+    // No data transfer by default
+    SETOPT (CURLOPT_NOBODY, 1);
+
+    // Set the username and password
+    userpwd = user;
+    if (! passwd.empty ())
+      userpwd += ":" + passwd;
+    if (! userpwd.empty ())
+      SETOPT (CURLOPT_USERPWD, userpwd.c_str ());
+
+    // Define our callback to get called when there's data to be written.
+    SETOPT (CURLOPT_WRITEFUNCTION, write_data);
+
+    // Set a pointer to our struct to pass to the callback.
+    SETOPT (CURLOPT_WRITEDATA, static_cast<void*> (&os));
+
+    // Define our callback to get called when there's data to be read
+    SETOPT (CURLOPT_READFUNCTION, read_data);
+
+    // Set a pointer to our struct to pass to the callback.
+    SETOPT (CURLOPT_READDATA, static_cast<void*> (&is));
+
+    // Follow redirects.
+    SETOPT (CURLOPT_FOLLOWLOCATION, true);
+
+    // Don't use EPSV since connecting to sites that don't support it
+    // will hang for some time (3 minutes?) before moving on to try PASV
+    // instead.
+    SETOPT (CURLOPT_FTP_USE_EPSV, false);
+
+    SETOPT (CURLOPT_NOPROGRESS, true);
+    SETOPT (CURLOPT_FAILONERROR, true);
+
+    SETOPT (CURLOPT_POSTQUOTE, 0);
+    SETOPT (CURLOPT_QUOTE, 0);
+  }
+
+  std::string form_query_string (const Array<std::string>& param)
+  {
+    std::ostringstream query;
+
+    for (int i = 0; i < param.numel (); i += 2)
+      {
+        std::string name = param(i);
+        std::string text = param(i+1);
+
+        // Encode strings.
+        char *enc_name = curl_easy_escape (curl, name.c_str (),
+                                           name.length ());
+        char *enc_text = curl_easy_escape (curl, text.c_str (),
+                                           text.length ());
+
+        query << enc_name << "=" << enc_text;
+
+        curl_free (enc_name);
+        curl_free (enc_text);
+
+        if (i < param.numel ()-1)
+          query << "&";
+      }
+
+    query.flush ();
+
+    return query.str ();
+  }
+};
+
+#undef SETOPT
+
+#else
+
+static void
+disabled_error (void)
+{
+  (*current_liboctave_error_handler)
+    ("support for url transfers was disabled when Octave was built");
+}
+
+#endif
+
+#if defined (HAVE_CURL)
+# define REP_CLASS curl_transfer
+#else
+# define REP_CLASS base_url_transfer
+#endif
+
+url_transfer::url_transfer (void) : rep (new REP_CLASS ())
+{
+#if !defined (HAVE_CURL)
+  disabled_error ();
+#endif
+}
+
+url_transfer::url_transfer (const std::string& host, const std::string& user,
+                            const std::string& passwd, std::ostream& os)
+  : rep (new REP_CLASS (host, user, passwd, os))
+{
+#if !defined (HAVE_CURL)
+  disabled_error ();
+#endif
+}
+
+url_transfer::url_transfer (const std::string& url, const std::string& method,
+                            const Array<std::string>& param, std::ostream& os)
+  : rep (new REP_CLASS (url, method, param, os))
+{
+#if !defined (HAVE_CURL)
+  disabled_error ();
+#endif
+}
+
+#undef REP_CLASS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/util/url-transfer.h	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,265 @@
+/*
+
+Copyright (C) 2013 John W. Eaton
+Copyright (C) 2006-2012 Alexander Barth
+Copyright (C) 2009 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Author: Alexander Barth <abarth@marine.usf.edu>
+// Author: jwe
+
+#if !defined (octave_url_transfer_h)
+#define octave_url_transfer_h 1
+
+#include <iosfwd>
+#include <string>
+
+class base_url_transfer
+{
+private:
+
+  static void delete_file (const std::string& file);
+
+  static void reset_path (base_url_transfer *curl_xfer)
+  {
+    curl_xfer->cwd ("..");
+  }
+
+public:
+
+  friend class url_transfer;
+
+  base_url_transfer (void)
+    : count (1), host (), userpwd (), valid (false), ascii_mode (false),
+      ok (true), errmsg (), curr_istream (&std::cin), curr_ostream (&std::cout)
+  { }
+
+  base_url_transfer (const std::string& host_arg,
+                     const std::string& /* user_arg */,
+                     const std::string& /* passwd */,
+                     std::ostream& os)
+    : count (1), host (host_arg), userpwd (), valid (false),
+      ascii_mode (false), ok (true), errmsg (), curr_istream (&std::cin),
+      curr_ostream (&os) { }
+
+  base_url_transfer (const std::string& /* url */,
+                     const std::string& /* method */,
+                     const Array<std::string>& /* param */,
+                     std::ostream& os)
+    : count (1), host (), userpwd (), valid (false), ascii_mode (false),
+      ok (true), errmsg (), curr_istream (&std::cin), curr_ostream (&os) { }
+
+  virtual ~base_url_transfer (void) { }
+
+  bool is_valid (void) const { return valid; }
+
+  bool good (void) const { return valid && ok; }
+
+  virtual void perform (void) { }
+
+  virtual std::string lasterror (void) const { return errmsg; }
+
+  virtual std::ostream& set_ostream (std::ostream& /* os */)
+  {
+    return *curr_ostream;
+  }
+
+  virtual std::istream& set_istream (std::istream& /* is */)
+  {
+    return *curr_istream;
+  }
+
+  virtual void ascii (void) { }
+
+  virtual void binary (void) { }
+
+  bool is_ascii (void) const { return ascii_mode; }
+
+  bool is_binary (void) const { return !ascii_mode; }
+
+  virtual void cwd (const std::string& /* path */) { } 
+
+  virtual void del (const std::string& /* file */) { }
+
+  virtual void rmdir (const std::string& /* path */) { }
+
+  virtual void mkdir (const std::string& /* path */) { }
+
+  virtual void rename (const std::string& /* oldname */,
+                       const std::string& /* newname */) { }
+
+  virtual void put (const std::string& /* file */,
+                    std::istream& /* is */) { }
+
+  virtual void get (const std::string& /* file */,
+                    std::ostream& /* os */) { }
+
+  void mget_directory (const std::string& directory,
+                       const std::string& target);
+
+  string_vector mput_directory (const std::string& base,
+                                const std::string& directory);
+
+  virtual void dir (void) { }
+
+  virtual string_vector list (void) { return string_vector (); }
+
+  virtual void get_fileinfo (const std::string& /* filename */,
+                             double& /* filesize */,
+                             time_t& /* filetime */,
+                             bool& /* fileisdir */) { }
+
+  virtual std::string pwd (void) { return std::string (); }
+
+protected:
+
+  octave_refcount<size_t> count;
+  std::string host;
+  std::string userpwd;
+  bool valid;
+  bool ascii_mode;
+  bool ok;
+  std::string errmsg;
+  std::istream *curr_istream;
+  std::ostream *curr_ostream;
+
+private:
+
+  // No copying!
+
+  base_url_transfer (const base_url_transfer&);
+
+  base_url_transfer& operator = (const base_url_transfer&);
+};
+
+class url_transfer
+{
+public:
+
+  url_transfer (void);
+
+  url_transfer (const std::string& host, const std::string& user,
+                const std::string& passwd, std::ostream& os);
+
+  url_transfer (const std::string& url, const std::string& method,
+                const Array<std::string>& param, std::ostream& os);
+
+  url_transfer (const url_transfer& h) : rep (h.rep)
+  {
+    rep->count++;
+  }
+
+  ~url_transfer (void)
+  {
+    if (--rep->count == 0)
+      delete rep;
+  }
+
+  url_transfer& operator = (const url_transfer& h)
+  {
+    if (this != &h)
+      {
+        if (--rep->count == 0)
+          delete rep;
+
+        rep = h.rep;
+        rep->count++;
+      }
+
+    return *this;
+  }
+
+  bool is_valid (void) const { return rep->is_valid (); }
+
+  bool good (void) const { return rep->good (); }
+
+  std::string lasterror (void) const { return rep->lasterror (); }
+
+  std::ostream& set_ostream (std::ostream& os)
+  {
+    return rep->set_ostream (os);
+  }
+
+  std::istream& set_istream (std::istream& is)
+  {
+    return rep->set_istream (is);
+  }
+
+  void ascii (void) { rep->ascii (); }
+
+  void binary (void) { rep->binary (); }
+
+  bool is_ascii (void) const { return rep->is_ascii (); }
+
+  bool is_binary (void) const { return rep->is_binary (); }
+
+  void cwd (const std::string& path) { rep->cwd (path); }
+
+  void del (const std::string& file) { rep->del (file); }
+
+  void rmdir (const std::string& path) { rep->rmdir (path); }
+
+  void mkdir (const std::string& path) { rep->mkdir (path); }
+
+  void rename (const std::string& oldname, const std::string& newname)
+  {
+    rep->rename (oldname, newname);
+  }
+
+  void put (const std::string& file, std::istream& is)
+  {
+    rep->put (file, is);
+  }
+
+  void get (const std::string& file, std::ostream& os)
+  {
+    rep->get (file, os);
+  }
+
+  void mget_directory (const std::string& directory,
+                       const std::string& target)
+  {
+    rep->mget_directory (directory, target);
+  }
+
+  string_vector mput_directory (const std::string& base,
+                                const std::string& directory)
+  {
+    return rep->mput_directory (base, directory);
+  }
+
+  void dir (void) { rep->dir (); }
+
+  string_vector list (void) { return rep->list (); }
+
+  void get_fileinfo (const std::string& filename, double& filesize,
+                     time_t& filetime, bool& fileisdir)
+  {
+    rep->get_fileinfo (filename, filesize, filetime, fileisdir);
+  }
+
+  std::string pwd (void) { return rep->pwd (); }
+
+private:
+
+  base_url_transfer *rep;
+};
+
+#endif
--- a/m4/acinclude.m4	Thu Sep 12 21:08:07 2013 -0400
+++ b/m4/acinclude.m4	Sat Oct 05 11:22:09 2013 -0400
@@ -1,19 +1,19 @@
 dnl aclocal.m4 -- extra macros for configuring Octave
 dnl
 dnl Copyright (C) 1995-2012 John W. Eaton
-dnl 
+dnl
 dnl This file is part of Octave.
-dnl 
+dnl
 dnl Octave is free software; you can redistribute it and/or modify it
 dnl under the terms of the GNU General Public License as published by the
 dnl Free Software Foundation; either version 3 of the License, or (at
 dnl your option) any later version.
-dnl 
+dnl
 dnl Octave is distributed in the hope that it will be useful, but WITHOUT
 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 dnl for more details.
-dnl 
+dnl
 dnl You should have received a copy of the GNU General Public License
 dnl along with Octave; see the file COPYING.  If not, see
 dnl <http://www.gnu.org/licenses/>.
@@ -84,7 +84,7 @@
   ])
   if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then
     AC_MSG_RESULT([yes])
-    ifelse([$2], , 
+    ifelse([$2], ,
       [CFLAGS="$CFLAGS $1"
       AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
   else
@@ -147,7 +147,7 @@
 dnl Check whether a math mapper function is available in <cmath>.
 dnl Will define HAVE_CMATH_FUNC if there is a double variant and
 dnl HAVE_CMATH_FUNCF if there is a float variant.
-dnl Currently capable of checking for functions with single 
+dnl Currently capable of checking for functions with single
 dnl argument and returning bool/int/real.
 dnl
 AC_DEFUN([OCTAVE_CHECK_FUNC_CMATH], [
@@ -242,7 +242,7 @@
       end program
 ]],
       octave_cv_func_fortran_isnan=yes, octave_cv_func_fortran_isnan=no)
-    AC_LANG_POP(Fortran 77)      
+    AC_LANG_POP(Fortran 77)
   ])
 ])
 dnl
@@ -267,7 +267,7 @@
     AC_LANG_POP(C++)
   ])
   if test $octave_cv_func_glutesscallback_threedots = yes; then
-    AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, 
+    AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
       [Define to 1 if gluTessCallback is called with (...).])
   fi
 ])
@@ -295,11 +295,54 @@
     AC_LANG_POP(C++)
   ])
   if test $octave_cv_func_setplaceholdertext = yes; then
-    AC_DEFINE(HAVE_SETPLACEHOLDERTEXT, 1, 
+    AC_DEFINE(HAVE_SETPLACEHOLDERTEXT, 1,
       [Define to 1 if you have the Qt SetPlaceholderText function.])
   fi
 ])
 dnl
+dnl Check whether the Qt QAbstractItemModel::beginResetModel() function exists.
+dnl Also checks for QAbstractItemModel::endResetModel().  These are two of the
+dnl newest Qt functions that the Octave GUI depends on, added in Qt 4.6.
+dnl
+AC_DEFUN([OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL], [
+  AC_CACHE_CHECK([whether Qt has the QAbstractItemModel::beginResetModel() function],
+    [octave_cv_func_qabstractitemmodel_beginresetmodel],
+    [AC_LANG_PUSH(C++)
+    ac_octave_save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <QAbstractItemModel>
+        class item_model : public QAbstractItemModel
+        {
+        public:
+          item_model (QObject *parent = 0) : QAbstractItemModel (parent) {}
+          ~item_model () {}
+          QModelIndex index (int, int, const QModelIndex& m) const { return m; }
+          QModelIndex parent (const QModelIndex& m) const { return m; }
+          int columnCount (const QModelIndex&) const { return 0; }
+          int rowCount (const QModelIndex&) const { return 0; }
+          QVariant data (const QModelIndex&, int) const { return QVariant(); }
+          void update_model ()
+          {
+            this->beginResetModel ();
+            this->endResetModel ();
+          }
+        };
+        ]], [[
+        item_model model;
+        model.update_model ();
+        ]])],
+      octave_cv_func_qabstractitemmodel_beginresetmodel=yes,
+      octave_cv_func_qabstractitemmodel_beginresetmodel=no)
+    CPPFLAGS="$ac_octave_save_CPPFLAGS"
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_func_qabstractitemmodel_beginresetmodel = yes; then
+    AC_DEFINE(HAVE_QABSTRACTITEMMODEL_BEGINRESETMODEL, 1,
+      [Define to 1 if Qt has the QAbstractItemModel::beginResetModel() function.])
+  fi
+])
+dnl
 dnl Check whether HDF5 library has version 1.6 API functions.
 dnl
 AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [
@@ -470,7 +513,7 @@
   ip[8] = 0;
   ip[9] = 0;
   ip[10] = 0;
- 
+
   int *ipntr = new int [14];
 
   int k = 1;
@@ -486,7 +529,7 @@
 
   double tol = DBL_EPSILON;
 
-  do 
+  do
     {
       F77_FUNC (dnaupd, DNAUPD) (ido, "I", n, "LM", k, tol, resid, p,
                                  v, n, ip, ipntr, workd, workl, lwork,
@@ -509,7 +552,7 @@
 
           break;
         }
-    } 
+    }
   while (1);
 
   int *sel = new int [p];
@@ -555,6 +598,42 @@
   fi
 ])
 dnl
+dnl Check whether GLPK provides the latest API functions required
+dnl for the glpk function. The glp_iptcp structure was introduced
+dnl in GLPK version 4.38.
+dnl
+AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [
+  AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)],
+    [octave_cv_lib_glpk_ok],
+    [AC_LANG_PUSH(C++)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+        extern "C"
+        {
+        #if defined (HAVE_GLPK_GLPK_H)
+        #include <glpk/glpk.h>
+        #else
+        #include <glpk.h>
+        #endif
+        }
+        ]], [[
+        glp_prob *lp = glp_create_prob ();
+        glp_iptcp iptcp;
+        glp_init_iptcp (&iptcp);
+        int retval = glp_interior (lp, &iptcp);
+        ]])],
+      octave_cv_lib_glpk_ok=yes,
+      octave_cv_lib_glpk_ok=no)
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_lib_glpk_ok = yes; then
+    $1
+    :
+  else
+    $2
+    :
+  fi
+])
+dnl
 dnl Check whether using HDF5 DLL under Windows.  This is done by
 dnl testing for a data symbol in the HDF5 library, which would
 dnl require the definition of _HDF5USEDL_ under MSVC compiler.
@@ -637,7 +716,7 @@
 #endif
     ])
 
-    if test "$have_opengl_incs" = yes; then
+    if test $have_opengl_incs = yes; then
       case $canonical_host_type in
         *-*-mingw32* | *-*-msdosmsvc)
           save_LIBS="$LIBS"
@@ -652,7 +731,7 @@
             #elif defined (HAVE_OPENGL_GL_H)
             # include <OpenGL/gl.h>
             #endif
-            ]], [[ 
+            ]], [[
             glEnable(GL_SMOOTH);
             ]])], [OPENGL_LIBS="-lopengl32 -lglu32"])
 
@@ -715,7 +794,7 @@
         int n = 4;
         coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 };
         boolT ismalloc = 0;
-        return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr); 
+        return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr);
       ]])],
       octave_cv_lib_qhull_ok=yes,
       octave_cv_lib_qhull_ok=no,
@@ -740,7 +819,7 @@
                  [], [])
   LIBS="$ac_octave_save_LIBS"
   case "$ac_cv_search_tputs" in
-    -l*)  
+    -l*)
       TERM_LIBS="$ac_cv_search_tputs"
     ;;
     no)
@@ -776,7 +855,7 @@
         ]], [[
         int main(int argc, char* argv[])
         {
-          _Pragma("omp parallel")  
+          _Pragma("omp parallel")
           printf("Hello, world.\n");
           return 0;
         }
@@ -828,7 +907,7 @@
         #endif
         ]], [[
         const char *tmp = qh_version;
-      ]])], 
+      ]])],
       octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no)
   ])
   if test $octave_cv_lib_qhull_version = no; then
@@ -998,7 +1077,7 @@
     AC_LANG_POP(C++)
   ])
   if test $octave_cv_cxx_complex_setters = yes; then
-    AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1, 
+    AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1,
       [Define to 1 if C++ complex class has void real (T) and void imag (T) methods.])
   fi
 ])
@@ -1015,7 +1094,7 @@
         char x[length()];
         test(x);
       ]])],
-      octave_cv_cxx_dynamic_auto_arrays=yes, 
+      octave_cv_cxx_dynamic_auto_arrays=yes,
       octave_cv_cxx_dynamic_auto_arrays=no)
     AC_LANG_POP(C++)
   ])
@@ -1087,13 +1166,13 @@
   ])
   AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library])
   if test $octave_cv_cxx_iso_compliant_library = yes; then
-    AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, 
+    AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1,
       [Define to 1 if your C++ runtime library is ISO compliant.])
   fi
 ])
 dnl
 dnl Check if C++ compiler needs the new friend template declaration
-dnl syntax. 
+dnl syntax.
 dnl
 AC_DEFUN([OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL], [
   AC_REQUIRE([AC_PROG_CXX])
@@ -1141,7 +1220,7 @@
         ]], [[
         operator delete((void *)0, (void *)0);
       ]])],
-      octave_cv_cxx_placement_delete=yes, 
+      octave_cv_cxx_placement_delete=yes,
       octave_cv_cxx_placement_delete=no)
     AC_LANG_POP(C++)
   ])
@@ -1230,16 +1309,16 @@
     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
         #include <limits>
         template<class UT, class ST>
-        static bool 
+        static bool
         do_test (UT, ST)
         {
           volatile ST s = std::numeric_limits<ST>::min () / 3;
           volatile UT u = static_cast<UT> (s);
           if (*(reinterpret_cast<volatile ST *> (&u)) != s) return true;
-          
+
           u = 0; u = ~u;
           if (*(reinterpret_cast<volatile ST *> (&u)) != -1) return true;
-          
+
           ST sx, sy;
           sx = std::numeric_limits<ST>::max () / 2 + 1;
           sy = std::numeric_limits<ST>::max () / 2 + 2;
@@ -1247,7 +1326,7 @@
               != std::numeric_limits<ST>::min () + 1) return true;
           if (static_cast<ST> (static_cast<UT> (sx) - static_cast<UT> (sy))
               != -1) return true;
-          
+
           if ((sx & sy) != (static_cast<UT> (sx) & static_cast<UT> (sy)))
             return true;
           if ((sx | sy) != (static_cast<UT> (sx) | static_cast<UT> (sy)))
@@ -1257,7 +1336,7 @@
           if ((-1 >> 1) != -1) return true;
           return false;
         }
-      
+
         #define DO_TEST(T) \
           if (do_test (static_cast<unsigned T> (0), static_cast<signed T> (0)))\
             return sizeof (T);
@@ -1305,7 +1384,7 @@
   if test "$octave_cv_framework_$1" = yes; then
     AC_MSG_RESULT([yes])
     AC_ARG_WITH(framework-m4_tolower($1),
-      [AS_HELP_STRING([--without-framework-m4_tolower($1)], 
+      [AS_HELP_STRING([--without-framework-m4_tolower($1)],
         [don't use framework $1])],
          with_have_framework=$withval, with_have_framework=yes)
     if test "$with_have_framework" = yes; then
@@ -1349,10 +1428,10 @@
   AC_CACHE_VAL([octave_cv_ieee754_data_format],
     [AC_RUN_IFELSE([AC_LANG_SOURCE([[
         int
-        main (void) 
+        main (void)
         {
           typedef union { unsigned char c[8]; double d; } ieeebytes;
-           
+
           ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
           ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
 
@@ -1381,6 +1460,101 @@
   fi
 ])
 dnl
+dnl Check for CallInst::addAttribute API
+dnl
+AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [
+  AC_CACHE_CHECK([check LLVM::CallInst::addAttribute arg type is llvm::Attributes],
+    [octave_cv_callinst_addattribute_arg_is_attributes],
+    [AC_LANG_PUSH(C++)
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+          #include <llvm/IR/Instructions.h>
+          #include <llvm/IR/Attributes.h>
+#else
+          #include <llvm/Instructions.h>
+          #include <llvm/Attributes.h>
+#endif
+          ], [[
+          llvm::CallInst *callinst;
+          llvm::AttrBuilder attr_builder;
+          attr_builder.addAttribute(llvm::Attributes::StructRet);
+          llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
+          callinst->addAttribute (1, attrs);
+        ]])],
+        octave_cv_callinst_addattribute_arg_is_attributes=yes,
+        octave_cv_callinst_addattribute_arg_is_attributes=no)
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
+    AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
+      [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
+  fi
+])
+dnl
+dnl Check for Function::addAttribute API
+dnl
+AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [
+  AC_CACHE_CHECK([check llvm::Function::addAttribute arg type is llvm::Attributes],
+    [octave_cv_function_addattribute_arg_is_attributes],
+    [AC_LANG_PUSH(C++)
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+#ifdef HAVE_LLVM_IR_FUNCTION_H
+          #include <llvm/IR/Function.h>
+          #include <llvm/IR/Attributes.h>
+          #include <llvm/IR/LLVMContext.h>
+#else
+          #include <llvm/Function.h>
+          #include <llvm/Attributes.h>
+          #include <llvm/LLVMContext.h>
+#endif
+          ]], [[
+          llvm::Function *llvm_function;
+          llvm::AttrBuilder attr_builder;
+          attr_builder.addAttribute(llvm::Attributes::StructRet);
+          llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
+          llvm_function->addAttribute (1, attrs);
+        ]])],
+        octave_cv_function_addattribute_arg_is_attributes=yes,
+        octave_cv_function_addattribute_arg_is_attributes=no)
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_function_addattribute_arg_is_attributes = yes; then
+    AC_DEFINE(FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
+      [Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes.])
+  fi
+])
+dnl
+dnl Check for Function::addFnAttr API
+dnl
+AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDFNATTR_API], [
+  AC_CACHE_CHECK([check LLVM::Function::addFnAttr arg type is llvm::Attributes],
+    [octave_cv_function_addfnattr_arg_is_attributes],
+    [AC_LANG_PUSH(C++)
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+#ifdef LLVM_HAVE_IR_FUNCTION_H
+          #include <llvm/Function.h>
+          #include <llvm/Attributes.h>
+#else
+          #include <llvm/Function.h>
+          #include <llvm/Attributes.h>
+#endif
+          ]], [[
+          llvm::Function *llvm_function;
+          llvm_function->addFnAttr (llvm::Attributes::AlwaysInline);
+        ]])],
+        octave_cv_function_addfnattr_arg_is_attributes=yes,
+        octave_cv_function_addfnattr_arg_is_attributes=no)
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_function_addfnattr_arg_is_attributes = yes; then
+    AC_DEFINE(FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES, 1,
+      [Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes.])
+  fi
+])
+dnl
 dnl Check for ar.
 dnl
 AC_DEFUN([OCTAVE_PROG_AR], [
@@ -1401,11 +1575,11 @@
   AC_PROG_YACC
 
   case "`$YACC --version`" in
-    *bison*) tmp_have_bison="yes" ;;
+    *bison*) tmp_have_bison=yes ;;
     *) tmp_have_bison=no ;;
   esac
 
-  if test "$tmp_have_bison" = yes; then
+  if test $tmp_have_bison = yes; then
     AC_CACHE_CHECK([syntax of bison push/pull declaration],
                    [octave_cv_bison_push_pull_decl_style], [
       style="dash underscore"
@@ -1459,7 +1633,7 @@
     OCTAVE_CONFIGURE_WARNING([warn_bison_push_pull_decl_style])
   fi
 
-  if test "$tmp_have_bison" = no; then
+  if test $tmp_have_bison = no; then
     YACC='$(top_srcdir)/build-aux/missing bison'
     warn_bison="
 
@@ -1574,7 +1748,7 @@
     warn_gperf="
 
 I didn't find gperf, but it's only a problem if you need to
-reconstruct oct-gperf.h 
+reconstruct oct-gperf.h
 "
     OCTAVE_CONFIGURE_WARNING([warn_gperf])
     GPERF='$(top_srcdir)/build-aux/missing gperf'
@@ -1761,7 +1935,7 @@
 dnl Macro assumes that the check for umfpack has already been performed.
 dnl
 AC_DEFUN([OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME], [
-  AC_CACHE_CHECK([whether UMFPACK needs SuiteSparse_time function], 
+  AC_CACHE_CHECK([whether UMFPACK needs SuiteSparse_time function],
     [octave_cv_umfpack_need_suitesparse_time],
     [AC_LANG_PUSH(C)
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
@@ -1814,7 +1988,7 @@
         idx_type n = 5;
         idx_type Ap[] = {0, 2, 5, 9, 10, 12};
         idx_type Ai[]  = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4};
-        double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., 
+        double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0.,
                       -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.};
         double br[] = {8., 45., -3., 3., 19.};
         double bi[] = {0., 0., 0., 0., 0.};
@@ -1827,10 +2001,10 @@
           (void) UMFPACK_NAME (symbolic) (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ;
           (void) UMFPACK_NAME (numeric) (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ;
           UMFPACK_NAME (free_symbolic) (&Symbolic) ;
-          (void) UMFPACK_NAME (solve) (0, Ap, Ai, Ax, null, x, null, br, bi, 
+          (void) UMFPACK_NAME (solve) (0, Ap, Ai, Ax, null, x, null, br, bi,
                                    Numeric, null, null) ;
           UMFPACK_NAME (free_numeric) (&Numeric) ;
-          for (i = 0; i < n; i++, x+=2) 
+          for (i = 0; i < n; i++, x+=2)
             if (fabs (*x - i - 1.) > 1.e-13)
               return (1);
           return (0) ;
@@ -1846,7 +2020,7 @@
     AC_MSG_RESULT([$octave_cv_umfpack_separate_split])
   fi
   if test $octave_cv_umfpack_separate_split = yes; then
-    AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, 
+    AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1,
       [Define to 1 if the UMFPACK Complex solver allows matrix and RHS to be split independently.])
   fi
 ])
@@ -1857,7 +2031,7 @@
 AC_DEFUN([OCTAVE_UNORDERED_MAP_HEADERS], [
   AC_CHECK_HEADERS([unordered_map], [],
     [AC_CHECK_HEADERS([tr1/unordered_map])])
-  AC_CACHE_CHECK([whether unordered_map requires tr1 namespace], 
+  AC_CACHE_CHECK([whether unordered_map requires tr1 namespace],
     [octave_cv_header_require_tr1_namespace],
     [AC_LANG_PUSH(C++)
     octave_cv_header_require_tr1_namespace=no
@@ -1870,7 +2044,7 @@
           ]], [[
           std::unordered_map<int,int> m;
         ]])],
-        octave_cv_header_require_tr1_namespace=no, 
+        octave_cv_header_require_tr1_namespace=no,
         octave_cv_header_require_tr1_namespace=yes)
     elif test $ac_cv_header_tr1_unordered_map = yes; then
       octave_cv_header_require_tr1_namespace=yes
@@ -1878,7 +2052,7 @@
     AC_LANG_POP(C++)
   ])
   if test $octave_cv_header_require_tr1_namespace = yes; then
-    AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, 
+    AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1,
       [Define to 1 if unordered_map requires the use of tr1 namespace.])
   fi
 ])
--- a/scripts/@ftp/ascii.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/ascii.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,3 +29,4 @@
 function ascii (f)
   __ftp_ascii__ (f.curlhandle);
 endfunction
+
--- a/scripts/@ftp/binary.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/binary.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,3 +28,4 @@
 function binary (f)
   __ftp_binary__ (f.curlhandle);
 endfunction
+
--- a/scripts/@ftp/cd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/cd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -41,3 +41,4 @@
   endif
   path = __ftp_pwd__ (f.curlhandle);
 endfunction
+
--- a/scripts/@ftp/close.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/close.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,6 +23,7 @@
 ## @var{f} is an FTP object returned by the @code{ftp} function.
 ## @end deftypefn
 
-function dir (f)
+function close (f)
   __ftp_close__ (f.curlhandle);
 endfunction
+
--- a/scripts/@ftp/delete.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/delete.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,3 +26,4 @@
 function delete (f, file)
   __ftp_delete__ (f.curlhandle, file);
 endfunction
+
--- a/scripts/@ftp/dir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/dir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,3 +31,4 @@
     lst = __ftp_dir__ (f.curlhandle);
   endif
 endfunction
+
--- a/scripts/@ftp/display.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/display.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,4 +22,5 @@
   printf (" user: %s\n", obj.username);
   printf ("  dir: %s\n", __ftp_pwd__ (obj.curlhandle));
   printf (" mode: %s\n", __ftp_mode__ (obj.curlhandle));
-endfunction
\ No newline at end of file
+endfunction
+
--- a/scripts/@ftp/ftp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/ftp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,9 +20,9 @@
 ## @deftypefn  {Function File} {@var{f} =} ftp (@var{host})
 ## @deftypefnx {Function File} {@var{f} =} ftp (@var{host}, @var{username}, @var{password})
 ## Connect to the FTP server @var{host} with @var{username} and @var{password}.
-## If @var{username} and @var{password} are not specified, user "anonymous"
-## with no password is used.  The returned FTP object @var{f} represents the
-## established FTP connection.
+## If @var{username} and @var{password} are not specified, user
+## @qcode{"anonymous"} with no password is used.  The returned FTP object
+## @var{f} represents the established FTP connection.
 ##
 ## The list of actions for an FTP object are shown below.  All functions
 ## require an FTP object as the first argument.
@@ -53,8 +53,9 @@
     p.password = password;
     p.curlhandle = tmpnam ("ftp-");
     if (nargin > 0)
-      __ftp__ (p.curlhandle, host, username, password);
+      p.curlhandle = __ftp__ (host, username, password);
     endif
     obj = class (p, "ftp");
   endif
 endfunction
+
--- a/scripts/@ftp/loadobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/loadobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,8 +21,7 @@
   if (isfield (b, "jobject"))
     b = rmfield (b, "jobject");
   endif
-  b.curlhandle = tmpnam ("ftp-");
-  __ftp__ (b.curlhandle, b.host, b.username, b.password);
+  b.curlhandle = __ftp__ (b.host, b.username, b.password);
   if (isfield (b, "dir"))
     if (! isempty (b.dir))
       __ftp_cwd__ (b.curlhandle, b.dir);
@@ -34,3 +33,4 @@
     b = rmfield (b, "remotePwd");
   endif
 endfunction
+
--- a/scripts/@ftp/mget.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/mget.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,3 +35,4 @@
 function mget (f, file)
   __ftp_mget__ (f.curlhandle, file);
 endfunction
+
--- a/scripts/@ftp/mkdir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/mkdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,3 +26,4 @@
 function mkdir (f, path)
   __ftp_mkdir__ (f.curlhandle, path);
 endfunction
+
--- a/scripts/@ftp/mput.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/mput.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,3 +33,4 @@
     retval = __ftp_mput__ (f.curlhandle, file);
   endif
 endfunction
+
--- a/scripts/@ftp/rename.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/rename.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,3 +27,4 @@
 function rename (f, oldname, newname)
   __ftp_rename__ (f.curlhandle, oldname, newname);
 endfunction
+
--- a/scripts/@ftp/rmdir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/rmdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,3 +26,4 @@
 function rmdir (f, path)
   __ftp_rmdir__ (f.curlhandle, path);
 endfunction
+
--- a/scripts/@ftp/saveobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/@ftp/saveobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,5 +19,6 @@
 function b = saveobj (a)
   b = a;
   b = rmfield (b, "curlhandle");
-  b.dir = __ftp_pwd (a.curlhandle);
+  b.dir = __ftp_pwd__ (a.curlhandle);
 endfunction
+
--- a/scripts/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -20,8 +20,6 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 EXTRA_DIST =
 
 CLEANFILES =
@@ -49,6 +47,7 @@
 include elfun/module.mk
 include general/module.mk
 include geometry/module.mk
+include gui/module.mk
 include help/module.mk
 include image/module.mk
 include io/module.mk
@@ -58,7 +57,9 @@
 include optimization/module.mk
 include path/module.mk
 include pkg/module.mk
-include plot/module.mk
+include plot/appearance/module.mk
+include plot/draw/module.mk
+include plot/util/module.mk
 include polynomial/module.mk
 include prefs/module.mk
 include set/module.mk
@@ -114,6 +115,10 @@
 	$(srcdir)/mk-pkg-add $(srcdir) $(geometry_FCN_FILES) -- $(geometry_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
+gui/PKG_ADD: $(gui_FCN_FILES) $(gui_GEN_FCN_FILES) gui/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(gui_FCN_FILES) -- $(gui_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
 help/PKG_ADD: $(help_FCN_FILES) $(help_GEN_FCN_FILES) help/$(octave_dirstamp) mk-pkg-add
 	$(srcdir)/mk-pkg-add $(srcdir) $(help_FCN_FILES) -- $(help_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
@@ -150,8 +155,16 @@
 	$(srcdir)/mk-pkg-add $(srcdir) $(pkg_FCN_FILES) -- $(pkg_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
-plot/PKG_ADD: $(plot_FCN_FILES) $(plot_GEN_FCN_FILES) plot/$(octave_dirstamp) mk-pkg-add
-	$(srcdir)/mk-pkg-add $(srcdir) $(plot_FCN_FILES) -- $(plot_GEN_FCN_FILES) > $@-t
+plot/appearance/PKG_ADD: $(plot_appearance_FCN_FILES) $(plot_appearance_GEN_FCN_FILES) plot/appearance/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_appearance_FCN_FILES) -- $(plot_appearance_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
+plot/draw/PKG_ADD: $(plot_draw_FCN_FILES) $(plot_draw_GEN_FCN_FILES) plot/draw/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_draw_FCN_FILES) -- $(plot_draw_GEN_FCN_FILES) > $@-t
+	mv $@-t $@
+
+plot/util/PKG_ADD: $(plot_util_FCN_FILES) $(plot_util_GEN_FCN_FILES) plot/util/$(octave_dirstamp) mk-pkg-add
+	$(srcdir)/mk-pkg-add $(srcdir) $(plot_util_FCN_FILES) -- $(plot_util_GEN_FCN_FILES) > $@-t
 	mv $@-t $@
 
 polynomial/PKG_ADD: $(polynomial_FCN_FILES) $(polynomial_GEN_FCN_FILES) polynomial/$(octave_dirstamp) mk-pkg-add
@@ -224,6 +237,7 @@
 $(elfun_GEN_FCN_FILES): elfun/$(octave_dirstamp)
 $(general_GEN_FCN_FILES): general/$(octave_dirstamp)
 $(geometry_GEN_FCN_FILES): geometry/$(octave_dirstamp)
+$(gui_GEN_FCN_FILES): gui/$(octave_dirstamp)
 $(help_GEN_FCN_FILES): help/$(octave_dirstamp)
 $(image_GEN_FCN_FILES): image/$(octave_dirstamp)
 $(io_GEN_FCN_FILES): io/$(octave_dirstamp)
@@ -233,7 +247,9 @@
 $(optimization_GEN_FCN_FILES): optimization/$(octave_dirstamp)
 $(path_GEN_FCN_FILES): path/$(octave_dirstamp)
 $(pkg_GEN_FCN_FILES): pkg/$(octave_dirstamp)
-$(plot_GEN_FCN_FILES): plot/$(octave_dirstamp)
+$(plot_appearance_GEN_FCN_FILES): plot/appearance/$(octave_dirstamp)
+$(plot_draw_GEN_FCN_FILES): plot/draw/$(octave_dirstamp)
+$(plot_util_GEN_FCN_FILES): plot/util/$(octave_dirstamp)
 $(polynomial_GEN_FCN_FILES): polynomial/$(octave_dirstamp)
 $(prefs_GEN_FCN_FILES): prefs/$(octave_dirstamp)
 $(set_GEN_FCN_FILES): set/$(octave_dirstamp)
@@ -269,6 +285,9 @@
 geometry/$(octave_dirstamp):
 	$(MKDIR_P) geometry
 	: > geometry/$(octave_dirstamp)
+gui/$(octave_dirstamp):
+	$(MKDIR_P) gui
+	: > gui/$(octave_dirstamp)
 help/$(octave_dirstamp):
 	$(MKDIR_P) help
 	: > help/$(octave_dirstamp)
@@ -296,9 +315,15 @@
 pkg/$(octave_dirstamp):
 	$(MKDIR_P) pkg
 	: > pkg/$(octave_dirstamp)
-plot/$(octave_dirstamp):
-	$(MKDIR_P) plot
-	: > plot/$(octave_dirstamp)
+plot/appearance/$(octave_dirstamp):
+	$(MKDIR_P) plot/appearance
+	: > plot/appearance/$(octave_dirstamp)
+plot/draw/$(octave_dirstamp):
+	$(MKDIR_P) plot/draw
+	: > plot/draw/$(octave_dirstamp)
+plot/util/$(octave_dirstamp):
+	$(MKDIR_P) plot/util
+	: > plot/util/$(octave_dirstamp)
 polynomial/$(octave_dirstamp):
 	$(MKDIR_P) polynomial
 	: > polynomial/$(octave_dirstamp)
--- a/scripts/audio/lin2mu.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/lin2mu.m	Sat Oct 05 11:22:09 2013 -0400
@@ -74,3 +74,4 @@
   y = 64 * sig - 16 * e - fix (32 * f) + 335;
 
 endfunction
+
--- a/scripts/audio/loadaudio.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/loadaudio.m	Sat Oct 05 11:22:09 2013 -0400
@@ -79,3 +79,4 @@
   fclose (num);
 
 endfunction
+
--- a/scripts/audio/mu2lin.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/mu2lin.m	Sat Oct 05 11:22:09 2013 -0400
@@ -80,3 +80,4 @@
   endif
 
 endfunction
+
--- a/scripts/audio/record.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/record.m	Sat Oct 05 11:22:09 2013 -0400
@@ -63,3 +63,4 @@
   X = Y - 127;
 
 endfunction
+
--- a/scripts/audio/saveaudio.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/saveaudio.m	Sat Oct 05 11:22:09 2013 -0400
@@ -86,3 +86,4 @@
   fclose (num);
 
 endfunction
+
--- a/scripts/audio/setaudio.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/setaudio.m	Sat Oct 05 11:22:09 2013 -0400
@@ -41,3 +41,4 @@
   endif
 
 endfunction
+
--- a/scripts/audio/wavread.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/wavread.m	Sat Oct 05 11:22:09 2013 -0400
@@ -177,8 +177,8 @@
         length = (param(2)-param(1)+1) * channels;
       elseif (nparams == 4 && char (param) == "size")
         ## Size of the file is requested.
-        tmp = idivide (8 * data_size, channels * bits_per_sample);
-        y = [tmp, channels];
+        y = idivide (8 * data_size, channels * bits_per_sample);
+        samples_per_sec = channels;
         return;
       else
         error ("wavread: invalid PARAM argument");
--- a/scripts/audio/wavwrite.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/audio/wavwrite.m	Sat Oct 05 11:22:09 2013 -0400
@@ -154,46 +154,65 @@
 %! fname = tmpnam ();
 
 %!test
-%! A = [-1:0.1:1; -1:0.1:1];
+%! A = [-1:0.1:1; -1:0.1:1]';
 %! wavwrite (A, fname);
 %! [B, samples_per_sec, bits_per_sample] = wavread (fname);
+%! unlink (fname);
 %! assert (A,B, 1/2^15);
 %! assert (samples_per_sec, 8000);
 %! assert (bits_per_sample, 16);
-%! unlink (fname);
-%
+
 %!test
-%! A = [-1:0.1:1; -1:0.1:1];
+%! A = [-1:0.1:1; -1:0.1:1]';
 %! wavwrite (A, 4000, fname);
 %! [B, samples_per_sec, bits_per_sample] = wavread (fname);
+%! unlink (fname);
 %! assert (A,B, 1/2^15);
 %! assert (samples_per_sec, 4000);
 %! assert (bits_per_sample, 16);
-%! unlink (fname);
-%
+
 %!test
-%! A = [-1:0.1:1; -1:0.1:1];
+%! A = [-1:0.1:1; -1:0.1:1]';
 %! wavwrite (A, 4000, 8, fname);
 %! [B, samples_per_sec, bits_per_sample] = wavread (fname);
+%! unlink (fname);
 %! assert (A,B, 1/128);
 %! assert (samples_per_sec, 4000);
 %! assert (bits_per_sample, 8);
-%! unlink (fname);
-%
+
 %!test
 %! A = [-2:2]';
 %! wavwrite (A, fname);
 %! B = wavread (fname);
+%! unlink (fname);
 %! B *= 32768;
 %! assert (B, [-32768 -32768 0 32767 32767]');
-%! unlink (fname);
-%
+
 %!test
 %! A = [-1:0.1:1];
 %! wavwrite (A, fname);
 %! [B, samples_per_sec, bits_per_sample] = wavread (fname);
+%! unlink (fname);
 %! assert (A', B, 1/2^15);
 %! assert (samples_per_sec, 8000);
 %! assert (bits_per_sample, 16);
+
+%!test
+%! A = [-1:0.1:1; -1:0.1:1]';
+%! wavwrite (A, fname);
+%! B = wavread (fname, 15);
 %! unlink (fname);
+%! assert (A(1:15,:) ,B, 1/2^15);
+%! wavwrite (A, fname);
+%! B = wavread (fname, [10, 20]);
+%! unlink (fname);
+%! assert (A(10:20,:) ,B, 1/2^15);
 
+%!test
+%! A = [-1:0.1:1; -1:0.1:1]';
+%! wavwrite (A, fname);
+%! [nsamp, nchan] = wavread (fname, "size");
+%! unlink (fname);
+%! assert (nsamp, 21);
+%! assert (nchan, 2);
+
--- a/scripts/deprecated/__error_text__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/__error_text__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,3 +34,4 @@
   [msg, msgid] = lasterr (varargin{:});
 
 endfunction
+
--- a/scripts/deprecated/cut.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/cut.m	Sat Oct 05 11:22:09 2013 -0400
@@ -69,3 +69,4 @@
   endif
 
 endfunction
+
--- a/scripts/deprecated/error_text.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/error_text.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,3 +34,4 @@
   [msg, msgid] = lasterr (varargin{:});
 
 endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/isequalwithequalnans.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,50 @@
+## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isequalwithequalnans (@var{x1}, @var{x2}, @dots{})
+## This function has been deprecated.  Use @code{@file{isequaln}} instead.
+## @seealso{isequaln}
+## @end deftypefn
+
+## Deprecated in 3.8
+
+function retval = isequalwithequalnans (varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "isequalwithequalnans is obsolete and will be removed from a future version of Octave, please use isequaln instead");
+  endif
+
+  retval = isequaln (varargin{:});
+
+endfunction
+
+
+## test for equality
+%!assert (isequalwithequalnans ({1,2,NaN,4},{1,2,NaN,4}), true)
+%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,NaN,4]), true)
+## test for inequality
+%!assert (isequalwithequalnans ([1,2,NaN,4],[1,NaN,3,4]), false)
+%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,3,4]), false)
+## test for equality (struct)
+%!assert (isequalwithequalnans (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true)
+%!assert (isequalwithequalnans (1,2,1), false)
+
--- a/scripts/deprecated/isstr.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/isstr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -38,3 +38,4 @@
   retval = ischar (varargin{:});
 
 endfunction
+
--- a/scripts/deprecated/java_convert_matrix.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/java_convert_matrix.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,9 +23,9 @@
 ## Query or set the internal variable that controls whether Java arrays are
 ## automatically converted to Octave matrices.  The default value is false.
 ## 
-## When called from inside a function with the "local" option, the variable is
-## changed locally for the function and any subroutines it calls.  The original
-## variable value is restored when exiting the function.
+## When called from inside a function with the @qcode{"local"} option, the
+## variable is changed locally for the function and any subroutines it calls.
+##  The original variable value is restored when exiting the function.
 ## @seealso{java_matrix_autoconversion, java_unsigned_conversion, java_debug}
 ## @end deftypefn
 
--- a/scripts/deprecated/java_debug.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/java_debug.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,9 +24,9 @@
 ## information regarding the initialization of the JVM and any Java exceptions
 ## is printed.
 ## 
-## When called from inside a function with the "local" option, the variable is
-## changed locally for the function and any subroutines it calls.  The original
-## variable value is restored when exiting the function.
+## When called from inside a function with the @qcode{"local"} option, the
+## variable is changed locally for the function and any subroutines it calls.
+##  The original variable value is restored when exiting the function.
 ## @seealso{debug_java, java_convert_matrix, java_unsigned_conversion}
 ## @end deftypefn
 
--- a/scripts/deprecated/java_unsigned_conversion.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/java_unsigned_conversion.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,9 +25,9 @@
 ## arrays of class Byte or Integer are converted to matrices of class uint8 or
 ## uint32 respectively.
 ## 
-## When called from inside a function with the "local" option, the variable is
-## changed locally for the function and any subroutines it calls.  The original
-## variable value is restored when exiting the function.
+## When called from inside a function with the @qcode{"local"} option, the
+## variable is changed locally for the function and any subroutines it calls.
+##  The original variable value is restored when exiting the function.
 ## @seealso{java_unsigned_autoconversion, java_convert_matrix, debug_java}
 ## @end deftypefn
 
--- a/scripts/deprecated/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -9,6 +9,7 @@
   deprecated/java_debug.m \
   deprecated/error_text.m \
   deprecated/gen_doc_cache.m \
+  deprecated/isequalwithequalnans.m \
   deprecated/isstr.m \
   deprecated/java_convert_matrix.m \
   deprecated/java_get.m \
--- a/scripts/deprecated/polyderiv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/polyderiv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -98,6 +98,7 @@
 
 endfunction
 
+
 %!assert(all (all (polyderiv ([1, 2, 3]) == [2, 2])));
 
 %!assert(polyderiv (13) == 0);
--- a/scripts/deprecated/shell_cmd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/shell_cmd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,11 +23,11 @@
 ## @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} shell_cmd (@dots{})
 ## @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} shell_cmd (@var{string}, @var{return_output}, @var{type})
 ## Execute a shell command specified by @var{string}.
-## If the optional argument @var{type} is "async", the process
+## If the optional argument @var{type} is @qcode{"async"}, the process
 ## is started in the background and the process id of the child process
 ## is returned immediately.  Otherwise, the process is started and
 ## Octave waits until it exits.  If the @var{type} argument is omitted, it
-## defaults to a value of "sync".
+## defaults to a value of @qcode{"sync"}.
 ## 
 ## If the optional argument @var{return_output} is true and the subprocess
 ## is started synchronously, or if @var{shell_cmd} is called with one input
--- a/scripts/deprecated/studentize.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/studentize.m	Sat Oct 05 11:22:09 2013 -0400
@@ -78,6 +78,7 @@
 
 endfunction
 
+
 %!assert(studentize ([1,2,3]), [-1,0,1])
 %!assert(studentize (int8 ([1,2,3])), [-1,0,1])
 #%!assert(studentize (ones (3,2,0,2)), zeros (3,2,0,2))
--- a/scripts/deprecated/sylvester_matrix.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/deprecated/sylvester_matrix.m	Sat Oct 05 11:22:09 2013 -0400
@@ -57,6 +57,7 @@
 
 endfunction
 
+
 %!assert((sylvester_matrix (1) == [1, 1; 1, -1]
 %! && (sylvester_matrix (2)
 %! == [1, 1, 1, 1; 1, -1, 1, -1; 1, 1, -1, -1; 1, -1, -1, 1])));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/elfun/atan2d.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,41 @@
+## Copyright (C) 2013 Rik Wehbring
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} atan2d (@var{y}, @var{x})
+## Compute atan2 (@var{y} / @var{x}) in degrees for corresponding elements
+## from @var{y} and @var{x}.
+## @seealso{tand, atan2}
+## @end deftypefn
+
+function retval = atan2d (y, x)
+
+  if (nargin != 2)
+    print_usage ();
+  endif
+
+  retval = 180 ./ pi .* atan2 (y, x);
+
+endfunction
+
+
+%!assert (atan2d (-1:.1:1, 1:-.1:-1), 180/pi * atan2 (-1:.1:1, 1:-.1:-1), -10*eps)
+
+%!error atan2d ()
+%!error atan2d (1)
+
--- a/scripts/elfun/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/elfun/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -12,6 +12,7 @@
   elfun/asecd.m \
   elfun/asech.m \
   elfun/asind.m \
+  elfun/atan2d.m \
   elfun/atand.m \
   elfun/cosd.m \
   elfun/cot.m \
--- a/scripts/general/accumarray.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/accumarray.m	Sat Oct 05 11:22:09 2013 -0400
@@ -61,7 +61,7 @@
 ## that in the first column counts how many occurrences each number in
 ## the second column has, taken from the vector @var{x}.  Note the usage
 ## of @code{unique}  for assigning to all repeated elements of @var{x}
-## the same index (@pxref{docXunique}).
+## the same index (@pxref{XREFunique,,unique}).
 ##
 ## @example
 ## @group
@@ -92,7 +92,7 @@
 ## @end example
 ##
 ## The sparse option can be used as an alternative to the @code{sparse}
-## constructor (@pxref{docXsparse}).  Thus
+## constructor (@pxref{XREFsparse,,sparse}).  Thus
 ##
 ## @example
 ## sparse (@var{i}, @var{j}, @var{sv})
--- a/scripts/general/accumdim.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/accumdim.m	Sat Oct 05 11:22:09 2013 -0400
@@ -108,7 +108,7 @@
       subsc{dim} = mask;
       A(subsc{:}) = fillval;
     endif
-    return
+    return;
   endif
 
   ## The general case.
--- a/scripts/general/bicubic.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/bicubic.m	Sat Oct 05 11:22:09 2013 -0400
@@ -221,6 +221,7 @@
 
 endfunction
 
+
 %!demo
 %! clf;
 %! colormap ("default");
--- a/scripts/general/bitcmp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/bitcmp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -49,6 +49,9 @@
   if (isa (A, "double"))
     bmax = bitmax;
     amax = ceil (log2 (bmax));
+  elseif (isa (A, "single"))
+    bmax = bitmax ("single");
+    amax = ceil (log2 (bmax));
   else
     if (isa (A, "uint8"))
       amax = 8;
@@ -93,6 +96,13 @@
 %! assert (bitcmp (A,Amax-1), bitshift (1,Amax-2));
 %! assert (bitcmp (A,Amax-2), 0);
 %!test
+%! Amax = 24;
+%! Bmax = bitmax ("single");
+%! A = bitshift (Bmax,-2);
+%! assert (bitcmp (A,Amax),bitor (bitshift (single (1),Amax-1), bitshift (single (1),Amax-2)));
+%! assert (bitcmp (A,Amax-1), bitshift (single (1),Amax-2));
+%! assert (bitcmp (A,Amax-2), single (0));
+%!test
 %! Amax = 8;
 %! Bmax = intmax ("uint8");
 %! A = bitshift (Bmax,-2);
--- a/scripts/general/bitget.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/bitget.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,8 +39,11 @@
   endif
 
   if (isa (A, "double"))
-    Amax = log2 (bitmax) + 1;
+    Amax = ceil (log2 (bitmax));
     _conv = @double;
+  elseif (isa (A, "single"))
+    Amax = ceil (log2 (bitmax ("single")));
+    _conv = @single;
   else
     if (isa (A, "uint8"))
       Amax = 8;
@@ -83,6 +86,7 @@
 
 %!test
 %! assert (bitget ([4, 14], [3, 3]), logical ([1, 1]));
+%! assert (bitget (single ([4, 14]), [3, 3]), logical ([1, 1]));
 %! pfx = {"", "u"};
 %! for i = 1:2
 %!   for prec = [8, 16, 32, 64]
@@ -94,6 +98,9 @@
 %!error bitget (0, 0)
 %!error bitget (0, 55)
 
+%!error bitget (single (0), 0)
+%!error bitget (single (0), 26)
+
 %!error bitget (int8 (0), 9)
 %!error bitget (uint8 (0), 9)
 
--- a/scripts/general/bitset.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/bitset.m	Sat Oct 05 11:22:09 2013 -0400
@@ -54,10 +54,10 @@
 
   if (isfloat (A) && isreal (A))
     Bmax = bitmax (cl);
-    Amax = log2 (Bmax);
+    Amax = ceil (log2 (Bmax));
   elseif (isinteger (A))
     Bmax = intmax (cl);
-    Amax = round (log2 (Bmax));
+    Amax = ceil (log2 (Bmax));
   else
     error ("bitset: invalid class %s", cl);
   endif
@@ -91,6 +91,7 @@
 
 %!test
 %! assert (bitset ([0, 10], [3, 3]), [4, 14]);
+%! assert (bitset (single ([0, 10]), [3, 3]), single ([4, 14]));
 %! pfx = {"", "u"};
 %! for i = 1:2
 %!   for prec = [8, 16, 32, 64]
@@ -108,6 +109,8 @@
 %!error <invalid class char> bitset ("1", 2)
 %!error <N must be in the range \[1,53\]> bitset (0, 0)
 %!error <N must be in the range \[1,53\]> bitset (0, 55)
+%!error <N must be in the range \[1,24\]> bitset (single (0), 0)
+%!error <N must be in the range \[1,24\]> bitset (single (0), 26)
 %!error <N must be in the range \[1,8\]> bitset (uint8 (0), 0)
 %!error <N must be in the range \[1,8\]> bitset (uint8 (0), 9)
 %!error <N must be in the range \[1,7\]> bitset (int8 (0), 9)
--- a/scripts/general/cell2mat.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/cell2mat.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,8 +21,8 @@
 ## @deftypefn {Function File} {@var{m} =} cell2mat (@var{c})
 ## Convert the cell array @var{c} into a matrix by concatenating all
 ## elements of @var{c} into a hyperrectangle.  Elements of @var{c} must
-## be numeric, logical or char matrices, or cell arrays, and @code{cat}
-## must be able to concatenate them together.
+## be numeric, logical, or char matrices; or cell arrays; or structs; and
+## @code{cat} must be able to concatenate them together.
 ## @seealso{mat2cell, num2cell}
 ## @end deftypefn
 
@@ -42,38 +42,48 @@
     m = [];
   else
 
-    ## We only want numeric, logical, and char matrices.
+    ## Check first for valid matrix types
     valid = cellfun ("isnumeric", c);
-    valid |= cellfun ("islogical", c);
-    valid |= cellfun ("isclass", c, "char");
-    validc = cellfun ("isclass", c, "cell");
-    valids = cellfun ("isclass", c, "struct");
-
-    if (! all (valid(:)) && ! all (validc(:)) && ! all (valids(:)))
-      error ("cell2mat: wrong type elements or mixed cells, structs and matrices");
+    valid = cellfun ("islogical", c(! valid));
+    valid = cellfun ("isclass", c(! valid), "char");
+    if (! all (valid(:)))
+      valid = cellfun ("isclass", c, "cell");
+      if (! all (valid(:)))
+        valid = cellfun ("isclass", c, "struct");
+        if (! all (valid(:)))
+          error ("cell2mat: wrong type elements or mixed cells, structs, and matrices");
+        endif
+      endif
     endif
 
-    ## The goal is to minimize the total number of cat() calls.
-    ## The dimensions can be concatenated along in arbitrary order.
-    ## The numbers of concatenations are:
-    ## n / d1
-    ## n / (d1 * d2)
-    ## n / (d1 * d2 * d3)
-    ## etc.
-    ## This is minimized if d1 >= d2 >= d3...
+    sz = size (c);
+    if (all (cellfun ("numel", c)(:) == 1))
+      ## Special case of all scalars
+      m = reshape (cat (1, c{:}), sz);
+    else
 
-    sc = size (c);
-    nd = ndims (c);
-    [~, isc] = sort (sc);
-    for idim = isc
-      if (sc(idim) == 1)
-        continue;
-      endif
-      xdim = [1:idim-1, idim+1:nd];
-      cc = num2cell (c, xdim);
-      c = cellfun ("cat", {idim}, cc{:}, "uniformoutput", false);
-    endfor
-    m = c{1};
+      ## The goal is to minimize the total number of cat() calls.
+      ## The dimensions can be concatenated along in arbitrary order.
+      ## The numbers of concatenations are:
+      ## n / d1
+      ## n / (d1 * d2)
+      ## n / (d1 * d2 * d3)
+      ## etc.
+      ## This is minimized if d1 >= d2 >= d3...
+
+      nd = ndims (c);
+      [~, isz] = sort (sz, "descend");
+      for idim = isz
+        if (sz(idim) == 1)
+          continue;
+        endif
+        xdim = [1:idim-1, idim+1:nd];
+        cc = num2cell (c, xdim);
+        c = cellfun ("cat", {idim}, cc{:}, "uniformoutput", false);
+      endfor
+      m = c{1};
+
+    endif
   endif
 
 endfunction
@@ -103,3 +113,10 @@
 %! m = {1, 2, 3};
 %! assert (cell2mat (mat2cell (m, 1, [1 1 1])), m);
 
+%!error cell2mat ()
+%!error cell2mat (1,2)
+%!error <C is not a cell array> cell2mat ([1,2])
+%!error <mixed cells, structs, and matrices> cell2mat ({[1], struct()})
+%!error <mixed cells, structs, and matrices> cell2mat ({[1], {1}})
+%!error <mixed cells, structs, and matrices> cell2mat ({struct(), {1}})
+
--- a/scripts/general/celldisp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/celldisp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -89,3 +89,4 @@
 %!error celldisp ()
 %!error celldisp ({}, "name", 1)
 %!error <C must be a cell array> celldisp (1)
+
--- a/scripts/general/colon.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/colon.m	Sat Oct 05 11:22:09 2013 -0400
@@ -43,3 +43,4 @@
 %!error colon (1)
 
 ## FIXME -- what does colon () mean since it doesn't set a return value?
+
--- a/scripts/general/cplxpair.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/cplxpair.m	Sat Oct 05 11:22:09 2013 -0400
@@ -161,6 +161,6 @@
 %!assert (cplxpair ([z(randperm(7)),z(randperm(7))],[],1), [z,z])
 %!assert (cplxpair ([z(randperm(7)).';z(randperm(7)).'],[],2), [z.';z.'])
 
-%!## tolerance test
+## tolerance test
 %!assert (cplxpair ([1i, -1i, 1+(1i*eps)],2*eps), [-1i, 1i, 1+(1i*eps)])
- 
+
--- a/scripts/general/dblquad.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/dblquad.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,8 @@
 ## is @code{quadcc}.
 ##
 ## Additional arguments, are passed directly to @var{f}.  To use the default
-## value for @var{tol} or @var{quadf} one may pass ':' or an empty matrix ([]).
+## value for @var{tol} or @var{quadf} one may pass @qcode{':'} or an empty
+## matrix ([]).
 ## @seealso{triplequad, quad, quadv, quadl, quadgk, quadcc, trapz}
 ## @end deftypefn
 
--- a/scripts/general/del2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/del2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -157,3 +157,4 @@
 
   D = D ./ nd;
 endfunction
+
--- a/scripts/general/display.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/display.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} display (@var{a})
 ## Display the contents of an object.  If @var{a} is an object of the
-## class "myclass", then @code{display} is called in a case like
+## class @qcode{"myclass"}, then @code{display} is called in a case like
 ##
 ## @example
 ## myclass (@dots{})
@@ -27,7 +27,7 @@
 ##
 ## @noindent
 ## where Octave is required to display the contents of a variable of the
-## type "myclass".
+## type @qcode{"myclass"}.
 ##
 ## @seealso{class, subsref, subsasgn}
 ## @end deftypefn
@@ -48,3 +48,4 @@
   endif
 
 endfunction
+
--- a/scripts/general/fieldnames.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/fieldnames.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,7 +31,7 @@
 ## properties of the object.
 ##
 ## When the input is a Java object @var{javaobj} or Java classname
-## @var{jclassname}) the name are the public data elements of the object or
+## @var{jclassname} the name are the public data elements of the object or
 ## class.
 ## @seealso{struct, methods}
 ## @end deftypefn
--- a/scripts/general/genvarname.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/genvarname.m	Sat Oct 05 11:22:09 2013 -0400
@@ -82,14 +82,15 @@
 ## an underscore.  Also, variables may not begin with a digit; in this
 ## case an underscore is added before the variable name.
 ##
-## Variable names beginning and ending with two underscores "__" are valid but
-## they are used internally by octave and should generally be avoided, therefore
-## genvarname will not generate such names.
+## Variable names beginning and ending with two underscores @qcode{"__"} are
+## valid but they are used internally by octave and should generally be
+## avoided, therefore genvarname will not generate such names.
 ##
 ## genvarname will also make sure that returned names do not clash with
-## keywords such as "for" and "if".  A number will be appended if necessary.
-## Note, however, that this does @strong{not} include function names,
-## such as "sin".  Such names should be included in @var{avoid} if necessary.
+## keywords such as @qcode{"for"} and @qcode{"if"}.  A number will be
+## appended if necessary.  Note, however, that this does @strong{not} include
+## function names, such as @qcode{"sin"}.  Such names should be included in
+## @var{avoid} if necessary.
 ## @seealso{isvarname, exist, tmpnam, eval}
 ## @end deftypefn
 
@@ -119,7 +120,7 @@
     error ("genvarname: STR must be a string or a cellstr");
   endif
 
-  validchars = cstrcat ("A":"Z", "a":"z", "0":"9", "_");
+  validchars = ["A":"Z", "a":"z", "0":"9", "_"];
 
   varname = cell (size (str));
   for i = 1:numel (str)
@@ -130,7 +131,7 @@
     str{i}(! ismember (str{i}, validchars)) = "_";
     ## do not use keywords
     if (iskeyword (str{i}))
-      str{i} = cstrcat ("_", str{i});
+      str{i} = ["_" str{i}];
     endif
     ## double underscores at the beginning and end are reserved variables
     underscores = (str{i} == "_");
@@ -145,7 +146,7 @@
     endif
     ## it cannot start with a number
     if (ismember (str{i}(1), "0":"9"))
-      str{i} = cstrcat ("_", str{i});
+      str{i} = ["_" str{i}];
     endif
 
     ## make sure that the variable is unique relative to other variables
--- a/scripts/general/idivide.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/idivide.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,25 +28,25 @@
 ## a string with one of the values:
 ##
 ## @table @asis
-## @item "fix"
+## @item @qcode{"fix"}
 ## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded
 ## towards zero.
 ##
-## @item "round"
+## @item @qcode{"round"}
 ## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded
 ## towards the nearest integer.
 ##
-## @item "floor"
+## @item @qcode{"floor"}
 ## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded
 ## towards negative infinity.
 ##
-## @item "ceil"
+## @item @qcode{"ceil"}
 ## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded
 ## towards positive infinity.
 ## @end table
 ##
 ## @noindent
-## If @var{op} is not given it defaults to @code{"fix"}.
+## If @var{op} is not given it defaults to @qcode{"fix"}.
 ## An example demonstrating these rounding rules is
 ##
 ## @example
--- a/scripts/general/int2str.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/int2str.m	Sat Oct 05 11:22:09 2013 -0400
@@ -67,9 +67,9 @@
     ifmt = get_fmt (n(idx{:}), 0);
     idx(2) = 2:sz(2);
     rfmt = get_fmt (n(idx{:}), 2);
-    fmt = cstrcat (ifmt, repmat (rfmt, 1, nc-1), "\n");
+    fmt = [ifmt repmat(rfmt,1,nc-1) "\n"];
   else
-    fmt = cstrcat (get_fmt (n, 0), "\n");
+    fmt = [get_fmt(n, 0) "\n"];
   endif
   tmp = sprintf (fmt, permute (n, [2, 1, 3 : nd]));
   tmp(end) = "";
@@ -86,7 +86,7 @@
     fmt = sprintf ("%%%dd", 1 + sep);
   else
     ## Maybe have some zeros.
-    nan_inf = isinf (t) | isnan (t);
+    nan_inf = ! isfinite (t);
     if (any (nan_inf))
       if (any (t(nan_inf) < 0))
         min_fw = 4 + sep;
--- a/scripts/general/interp1.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interp1.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,25 +26,25 @@
 ##
 ## One-dimensional interpolation.  Interpolates to determine the value of
 ## @var{yi} at the points, @var{xi}.  If not specified, @var{x} is taken
-## to be the indices of @var{y}.  If @var{y} is an array, treat the columns
-## of @var{y} separately.
+## to be the indices of @var{y}.  If @var{y} is a matrix or an N-dimensional
+## array, the interpolation is performed on each column of @var{y}.
 ##
 ## Method is one of:
 ##
 ## @table @asis
-## @item "nearest"
+## @item @qcode{"nearest"}
 ## Return the nearest neighbor.
 ##
-## @item "linear"
+## @item @qcode{"linear"}
 ## Linear interpolation from nearest neighbors
 ##
-## @item "pchip"
+## @item @qcode{"pchip"}
 ## Piecewise cubic Hermite interpolating polynomial
 ##
-## @item "cubic"
+## @item @qcode{"cubic"}
 ## Cubic interpolation (same as @code{pchip})
 ##
-## @item "spline"
+## @item @qcode{"spline"}
 ## Cubic spline interpolation---smooth first and second derivatives
 ## throughout the curve
 ## @end table
@@ -52,18 +52,18 @@
 ## Appending '*' to the start of the above method forces @code{interp1}
 ## to assume that @var{x} is uniformly spaced, and only @code{@var{x}(1)}
 ## and @code{@var{x}(2)} are referenced.  This is usually faster,
-## and is never slower.  The default method is "linear".
+## and is never slower.  The default method is @qcode{"linear"}.
 ##
-## If @var{extrap} is the string "extrap", then extrapolate values beyond
-## the endpoints.  If @var{extrap} is a number, replace values beyond the
-## endpoints with that number.  If @var{extrap} is missing, assume NA.
+## If @var{extrap} is the string @qcode{"extrap"}, then extrapolate values
+## beyond the endpoints.  If @var{extrap} is a number, replace values beyond
+## the endpoints with that number.  If @var{extrap} is missing, assume NA.
 ##
-## If the string argument "pp" is specified, then @var{xi} should not be
+## If the string argument @qcode{"pp"} is specified, then @var{xi} should not be
 ## supplied and @code{interp1} returns the piecewise polynomial that
 ## can later be used with @code{ppval} to evaluate the interpolation.
 ## There is an equivalence, such that @code{ppval (interp1 (@var{x},
-## @var{y}, @var{method}, "pp"), @var{xi}) == interp1 (@var{x}, @var{y},
-## @var{xi}, @var{method}, "extrap")}.
+## @var{y}, @var{method}, @qcode{"pp"}), @var{xi}) == interp1 (@var{x}, @var{y},
+## @var{xi}, @var{method}, @qcode{"extrap"})}.
 ##
 ## Duplicate points in @var{x} specify a discontinuous interpolant.  There
 ## may be at most 2 consecutive points with the same value.
@@ -71,10 +71,11 @@
 ## right-continuous.  If @var{x} is decreasing, the default discontinuous
 ## interpolant is left-continuous.
 ## The continuity condition of the interpolant may be specified by using
-## the options, "-left" or "-right", to select a left-continuous
+## the options, @qcode{"-left"} or @qcode{"-right"}, to select a left-continuous
 ## or right-continuous interpolant, respectively.
-## Discontinuous interpolation is only allowed for "nearest" and "linear"
-## methods; in all other cases, the @var{x}-values must be unique.
+## Discontinuous interpolation is only allowed for @qcode{"nearest"} and
+## @qcode{"linear"} methods; in all other cases, the @var{x}-values must be
+## unique.
 ##
 ## An example of the use of @code{interp1} is
 ##
@@ -149,7 +150,11 @@
   if (isempty (xi) && firstnumeric && ! ispp)
     xi = y;
     y = x;
-    x = 1:numel (y);
+    if (isvector (y))
+      x = 1:numel (y);
+    else
+      x = 1:rows (y);
+    endif
   endif
 
   ## reshape matrices for convenience
@@ -182,15 +187,15 @@
       rightcontinuous = false;
     else
       rightcontinuous = true;
-    end
+    endif
   endif
 
   if ((rightcontinuous && (x(end) < x(1)))
-      || (~ rightcontinuous && (x(end) > x(1))))
+      || (! rightcontinuous && (x(end) > x(1))))
     ## Switch between left-continuous and right-continuous
     x = flipud (x);
     y = flipud (y);
-  end
+  endif
 
   starmethod = method(1) == "*";
 
@@ -212,91 +217,93 @@
 
   ## Proceed with interpolating by all methods.
   switch (method)
-  case "nearest"
-    pp = mkpp ([x(1); (x(1:nx-1)+x(2:nx))/2; x(nx)], shiftdim (y, 1), szy(2:end));
-    pp.orient = "first";
+    case "nearest"
+      pp = mkpp ([x(1); (x(1:nx-1)+x(2:nx))/2; x(nx)],
+                 shiftdim (y, 1), szy(2:end));
+      pp.orient = "first";
 
-    if (ispp)
-      yi = pp;
-    else
-      yi = ppval (pp, reshape (xi, szx));
-    endif
-  case "*nearest"
-    pp = mkpp ([x(1), x(1)+[0.5:(nx-1)]*dx, x(nx)], shiftdim (y, 1), szy(2:end));
-    pp.orient = "first";
-    if (ispp)
-      yi = pp;
-    else
-      yi = ppval (pp, reshape (xi, szx));
-    endif
-  case "linear"
-    dy = diff (y);
-    dx = diff (x);
-    dx = repmat (dx, [1 size(dy)(2:end)]);
-    coefs = [(dy./dx).'(:), y(1:nx-1, :).'(:)];
-    xx = x;
+      if (ispp)
+        yi = pp;
+      else
+        yi = ppval (pp, reshape (xi, szx));
+      endif
+    case "*nearest"
+      pp = mkpp ([x(1), x(1)+[0.5:(nx-1)]*dx, x(nx)],
+                 shiftdim (y, 1), szy(2:end));
+      pp.orient = "first";
+      if (ispp)
+        yi = pp;
+      else
+        yi = ppval (pp, reshape (xi, szx));
+      endif
+    case "linear"
+      dy = diff (y);
+      dx = diff (x);
+      dx = repmat (dx, [1 size(dy)(2:end)]);
+      coefs = [(dy./dx).'(:), y(1:nx-1, :).'(:)];
+      xx = x;
 
-    if (have_jumps)
-      ## Omit zero-size intervals.
-      coefs(jumps, :) = [];
-      xx(jumps) = [];
-    endif
+      if (have_jumps)
+        ## Omit zero-size intervals.
+        coefs(jumps, :) = [];
+        xx(jumps) = [];
+      endif
 
-    pp = mkpp (xx, coefs, szy(2:end));
-    pp.orient = "first";
+      pp = mkpp (xx, coefs, szy(2:end));
+      pp.orient = "first";
 
-    if (ispp)
-      yi = pp;
-    else
-      yi = ppval (pp, reshape (xi, szx));
-    endif
+      if (ispp)
+        yi = pp;
+      else
+        yi = ppval (pp, reshape (xi, szx));
+      endif
 
-  case "*linear"
-    dy = diff (y);
-    coefs = [(dy/dx).'(:), y(1:nx-1, :).'(:)];
-    pp = mkpp (x, coefs, szy(2:end));
-    pp.orient = "first";
+    case "*linear"
+      dy = diff (y);
+      coefs = [(dy/dx).'(:), y(1:nx-1, :).'(:)];
+      pp = mkpp (x, coefs, szy(2:end));
+      pp.orient = "first";
 
-    if (ispp)
-      yi = pp;
-    else
-      yi = ppval (pp, reshape (xi, szx));
-    endif
+      if (ispp)
+        yi = pp;
+      else
+        yi = ppval (pp, reshape (xi, szx));
+      endif
 
-  case {"pchip", "*pchip", "cubic", "*cubic"}
-    if (nx == 2 || starmethod)
-      x = linspace (x(1), x(nx), ny);
-    endif
+    case {"pchip", "*pchip", "cubic", "*cubic"}
+      if (nx == 2 || starmethod)
+        x = linspace (x(1), x(nx), ny);
+      endif
 
-    if (ispp)
-      y = shiftdim (reshape (y, szy), 1);
-      yi = pchip (x, y);
-      yi.orient = "first";
-    else
-      y = shiftdim (y, 1);
-      yi = pchip (x, y, reshape (xi, szx));
-      if (! isvector (y))
-        yi = shiftdim (yi, 1);
+      if (ispp)
+        y = shiftdim (reshape (y, szy), 1);
+        yi = pchip (x, y);
+        yi.orient = "first";
+      else
+        y = shiftdim (y, 1);
+        yi = pchip (x, y, reshape (xi, szx));
+        if (! isvector (y))
+          yi = shiftdim (yi, 1);
+        endif
+      endif
+    case {"spline", "*spline"}
+      if (nx == 2 || starmethod)
+        x = linspace (x(1), x(nx), ny);
       endif
-    endif
-  case {"spline", "*spline"}
-    if (nx == 2 || starmethod)
-      x = linspace (x(1), x(nx), ny);
-    endif
 
-    if (ispp)
-      y = shiftdim (reshape (y, szy), 1);
-      yi = spline (x, y);
-      yi.orient = "first";
-    else
-      y = shiftdim (y, 1);
-      yi = spline (x, y, reshape (xi, szx));
-      if (! isvector (y))
-        yi = shiftdim (yi, 1);
+      if (ispp)
+        y = shiftdim (reshape (y, szy), 1);
+        yi = spline (x, y);
+        yi.orient = "first";
+      else
+        y = shiftdim (y, 1);
+        yi = spline (x, y, reshape (xi, szx));
+        if (! isvector (y))
+          yi = shiftdim (yi, 1);
+        endif
       endif
-    endif
-  otherwise
-    error ("interp1: invalid method '%s'", method);
+    otherwise
+      error ("interp1: invalid method '%s'", method);
   endswitch
 
   if (! ispp)
--- a/scripts/general/interp1q.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interp1q.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,9 +21,10 @@
 ## One-dimensional linear interpolation without error checking.
 ## Interpolates @var{y}, defined at the points @var{x}, at the points
 ## @var{xi}.  The sample points @var{x} must be a strictly monotonically
-## increasing column vector.  If @var{y} is an array, treat the columns
-## of @var{y} separately.  If @var{y} is a vector, it must be a column
-## vector of the same length as @var{x}.
+## increasing column vector.  If @var{y} is a matrix or an N-dimensional
+## array, the interpolation is performed on each column of @var{y}.  If
+## @var{y} is a vector, it must be a column vector of the same length as
+## @var{x}.
 ##
 ## Values of @var{xi} beyond the endpoints of the interpolation result
 ## in NA being returned.
--- a/scripts/general/interp2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interp2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -36,8 +36,9 @@
 ## matrices @var{xi}, @var{yi}.
 ##
 ## If the last argument is a string, the interpolation method can
-## be specified.  The method can be "linear", "nearest" or "cubic".
-## If it is omitted "linear" interpolation is assumed.
+## be specified.  The method can be @qcode{"linear"}, @qcode{"nearest"} or
+## @qcode{"cubic"}.  If it is omitted @qcode{"linear"} interpolation is
+## assumed.
 ##
 ## @item interp2 (@var{z}, @var{xi}, @var{yi})
 ## Assumes @code{@var{x} = 1:rows (@var{z})} and @code{@var{y} =
@@ -52,19 +53,19 @@
 ## interpolation.  It can take one of the following values
 ##
 ## @table @asis
-## @item "nearest"
+## @item @qcode{"nearest"}
 ## Return the nearest neighbor.
 ##
-## @item "linear"
+## @item @qcode{"linear"}
 ## Linear interpolation from nearest neighbors.
 ##
-## @item "pchip"
+## @item @qcode{"pchip"}
 ## Piecewise cubic Hermite interpolating polynomial.
 ##
-## @item "cubic"
+## @item @qcode{"cubic"}
 ## Cubic interpolation from four nearest neighbors.
 ##
-## @item "spline"
+## @item @qcode{"spline"}
 ## Cubic spline interpolation---smooth first and second derivatives
 ## throughout the curve.
 ## @end table
--- a/scripts/general/interp3.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interp3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,9 +28,9 @@
 ## array @var{v} represents a value at a location given by the parameters
 ## @var{x}, @var{y}, and @var{z}.  The parameters @var{x}, @var{x}, and
 ## @var{z} are either 3-dimensional arrays of the same size as the array
-## @var{v} in the "meshgrid" format or vectors.  The parameters @var{xi}, etc.
-## respect a similar format to @var{x}, etc., and they represent the points
-## at which the array @var{vi} is interpolated.
+## @var{v} in the @qcode{"meshgrid"} format or vectors.  The parameters
+## @var{xi}, etc. respect a similar format to @var{x}, etc., and they
+## represent the points at which the array @var{vi} is interpolated.
 ##
 ## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
 ## @code{x = 1 : size (@var{v}, 2)}, @code{y = 1 : size (@var{v}, 1)} and
@@ -42,25 +42,25 @@
 ## Method is one of:
 ##
 ## @table @asis
-## @item "nearest"
+## @item @qcode{"nearest"}
 ## Return the nearest neighbor.
 ##
-## @item "linear"
+## @item @qcode{"linear"}
 ## Linear interpolation from nearest neighbors.
 ##
-## @item "cubic"
+## @item @qcode{"cubic"}
 ## Cubic interpolation from four nearest neighbors (not implemented yet).
 ##
-## @item "spline"
+## @item @qcode{"spline"}
 ## Cubic spline interpolation---smooth first and second derivatives
 ## throughout the curve.
 ## @end table
 ##
-## The default method is "linear".
+## The default method is @qcode{"linear"}.
 ##
-## If @var{extrap} is the string "extrap", then extrapolate values beyond
-## the endpoints.  If @var{extrap} is a number, replace values beyond the
-## endpoints with that number.  If @var{extrap} is missing, assume NA.
+## If @var{extrap} is the string @qcode{"extrap"}, then extrapolate values
+## beyond the endpoints.  If @var{extrap} is a number, replace values beyond
+## the endpoints with that number.  If @var{extrap} is missing, assume NA.
 ## @seealso{interp1, interp2, spline, meshgrid}
 ## @end deftypefn
 
--- a/scripts/general/interpft.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interpft.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,9 +22,9 @@
 ##
 ## Fourier interpolation.  If @var{x} is a vector, then @var{x} is
 ## resampled with @var{n} points.  The data in @var{x} is assumed to be
-## equispaced.  If @var{x} is an array, then operate along each column of
-## the array separately.  If @var{dim} is specified, then interpolate
-## along the dimension @var{dim}.
+## equispaced.  If @var{x} is a matrix or an N-dimensional array, the
+## interpolation is performed on each column of @var{x}.  If @var{dim} is
+## specified, then interpolate along the dimension @var{dim}.
 ##
 ## @code{interpft} assumes that the interpolated function is periodic,
 ## and so assumptions are made about the endpoints of the interpolation.
@@ -68,9 +68,9 @@
   x = permute (x, perm);
   m = rows (x);
 
-  inc = max (1, fix (m/n));
+  inc = ceil (m/n);
   y = fft (x) / m;
-  k = floor (m / 2);
+  k = ceil (m / 2);
   sz = size (x);
   sz(1) = n * inc - m;
 
@@ -79,6 +79,18 @@
   z = cat (1, y(idx{:}), zeros (sz));
   idx{1} = k+1:m;
   z = cat (1, z, y(idx{:}));
+
+  ## When m is an even number of rows, the FFT has a single Nyquist bin.
+  ## If zero-padded above, distribute the value of the Nyquist bin evenly
+  ## between the new corresponding positive and negative frequency bins.
+  if (sz(1) > 0 && k == m/2)
+    idx{1} = n * inc - k + 1;
+    tmp = z(idx{:}) / 2;
+    z(idx{:}) = tmp;
+    idx{1} = k + 1;
+    z(idx{:}) = tmp;
+  endif
+
   z = n * ifft (z);
 
   if (inc != 1)
@@ -108,6 +120,18 @@
 %!assert (interpft (y', n), y', 20*eps);
 %!assert (interpft ([y,y],n), [y,y], 20*eps);
 
+%% Test case with complex input from bug #39566
+%!test
+%! x = (1 + j) * [1:4]';
+%! y = ifft ([15 + 15*j; -6; -1.5 - 1.5*j; 0; -1.5 - 1.5*j; -6*j]);
+%! assert (interpft (x, 6), y, 10*eps);
+
+%% Test for correct spectral symmetry with even/odd lengths
+%!assert (max (abs (imag (interpft ([1:8], 20)))), 0, 20*eps);
+%!assert (max (abs (imag (interpft ([1:8], 21)))), 0, 21*eps);
+%!assert (max (abs (imag (interpft ([1:9], 20)))), 0, 20*eps);
+%!assert (max (abs (imag (interpft ([1:9], 21)))), 0, 21*eps);
+
 %% Test input validation
 %!error interpft ()
 %!error interpft (1)
--- a/scripts/general/interpn.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/interpn.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,9 +29,9 @@
 ## at a location given by the parameters @var{x1}, @var{x2}, @dots{}, @var{xn}.
 ## The parameters @var{x1}, @var{x2}, @dots{}, @var{xn} are either
 ## @var{n}-dimensional arrays of the same size as the array @var{v} in
-## the "ndgrid" format or vectors.  The parameters @var{y1}, etc. respect a
-## similar format to @var{x1}, etc., and they represent the points at which
-## the array @var{vi} is interpolated.
+## the @qcode{"ndgrid"} format or vectors.  The parameters @var{y1}, etc.
+## respect a similar format to @var{x1}, etc., and they represent the points
+## at which the array @var{vi} is interpolated.
 ##
 ## If @var{x1}, @dots{}, @var{xn} are omitted, they are assumed to be
 ## @code{x1 = 1 : size (@var{v}, 1)}, etc.  If @var{m} is specified, then
@@ -42,21 +42,21 @@
 ## Method is one of:
 ##
 ## @table @asis
-## @item "nearest"
+## @item @qcode{"nearest"}
 ## Return the nearest neighbor.
 ##
-## @item "linear"
+## @item @qcode{"linear"}
 ## Linear interpolation from nearest neighbors.
 ##
-## @item "cubic"
+## @item @qcode{"cubic"}
 ## Cubic interpolation from four nearest neighbors (not implemented yet).
 ##
-## @item "spline"
+## @item @qcode{"spline"}
 ## Cubic spline interpolation---smooth first and second derivatives
 ## throughout the curve.
 ## @end table
 ##
-## The default method is "linear".
+## The default method is @qcode{"linear"}.
 ##
 ## If @var{extrapval} is the scalar value, use it to replace the values
 ## beyond the endpoints with that number.  If @var{extrapval} is missing,
--- a/scripts/general/isa.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/isa.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,13 +23,14 @@
 ## @var{classname} may also be one of the following class categories: 
 ##
 ## @table @asis
-## @item "float"
-## Floating point value comprising classes "double" and "single".
+## @item @qcode{"float"}
+## Floating point value comprising classes @qcode{"double"} and
+## @qcode{"single"}.
 ##
-## @item "integer"
+## @item @qcode{"integer"}
 ## Integer value comprising classes (u)int8, (u)int16, (u)int32, (u)int64.
 ##
-## @item "numeric"
+## @item @qcode{"numeric"}
 ## Numeric value comprising either a floating point or integer value.
 ## @end table
 ## @seealso{class, typeinfo}
--- a/scripts/general/isdir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/isdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} isdir (@var{f})
 ## Return true if @var{f} is a directory.
-## @seealso{is_absolute_filename, is_rooted_relative_filename}
+## @seealso{exist, stat, is_absolute_filename, is_rooted_relative_filename}
 ## @end deftypefn
 
 function retval = isdir (f)
@@ -32,6 +32,7 @@
 
 endfunction
 
+
 %!assert (isdir (pwd ()))
 %!assert (! isdir ("this is highly unlikely to be a directory name"))
 
--- a/scripts/general/isequal.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/isequal.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} isequal (@var{x1}, @var{x2}, @dots{})
 ## Return true if all of @var{x1}, @var{x2}, @dots{} are equal.
-## @seealso{isequalwithequalnans}
+## @seealso{isequaln}
 ## @end deftypefn
 
 function retval = isequal (x1, varargin)
@@ -74,3 +74,12 @@
 ## test for inequality (struct)
 %!assert (isequal (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), false)
 
+## test for sparse matrices
+%!assert (isequal (sparse (0,1), sparse (0,1)), true)
+%!assert (isequal (sparse (0,1), sparse (1,0)), false)
+%!assert (isequal (sparse (2, 2), sparse (2, 2)), true)
+
+## Input validation
+%!error isequal ()
+%!error isequal (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/general/isequaln.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,51 @@
+## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isequaln (@var{x1}, @var{x2}, @dots{})
+## Return true if all of @var{x1}, @var{x2}, @dots{} are equal under the
+## additional assumption that NaN == NaN (no comparison of NaN placeholders
+## in dataset).
+## @seealso{isequal}
+## @end deftypefn
+
+function retval = isequaln (x1, varargin)
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  retval = __isequal__ (true, x1, varargin{:});
+
+endfunction
+
+
+## test for equality
+%!assert (isequaln ({1,2,NaN,4},{1,2,NaN,4}), true)
+%!assert (isequaln ([1,2,NaN,4],[1,2,NaN,4]), true)
+## test for inequality
+%!assert (isequaln ([1,2,NaN,4],[1,NaN,3,4]), false)
+%!assert (isequaln ([1,2,NaN,4],[1,2,3,4]), false)
+## test for equality (struct)
+%!assert (isequaln (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true)
+%!assert (isequaln (1,2,1), false)
+
+## Input validation
+%!error isequaln ()
+%!error isequaln (1)
+
--- a/scripts/general/isequalwithequalnans.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} isequalwithequalnans (@var{x1}, @var{x2}, @dots{})
-## Assuming NaN == NaN, return true if all of @var{x1}, @var{x2}, @dots{}
-## are equal.
-## @seealso{isequal}
-## @end deftypefn
-
-function retval = isequalwithequalnans (x1, varargin)
-
-  if (nargin < 2)
-    print_usage ();
-  endif
-
-  retval = __isequal__ (true, x1, varargin{:});
-
-endfunction
-
-
-## test for equality
-%!assert (isequalwithequalnans ({1,2,NaN,4},{1,2,NaN,4}), true)
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,NaN,4]), true)
-## test for inequality
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,NaN,3,4]), false)
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,3,4]), false)
-## test for equality (struct)
-%!assert (isequalwithequalnans (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true)
-%!assert (isequalwithequalnans (1,2,1), false)
-
--- a/scripts/general/loadobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/loadobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,3 +39,4 @@
 function b = loadobj (a)
   error ('loadobj: not defined for class "%s"', class (a));
 endfunction
+
--- a/scripts/general/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -46,7 +46,7 @@
   general/iscolumn.m \
   general/isdir.m \
   general/isequal.m \
-  general/isequalwithequalnans.m \
+  general/isequaln.m \
   general/isrow.m \
   general/isscalar.m \
   general/issquare.m \
--- a/scripts/general/num2str.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/num2str.m	Sat Oct 05 11:22:09 2013 -0400
@@ -92,10 +92,9 @@
       if (isnumeric (x))
         ## Setup a suitable format string, ignoring inf entries
         dgt = floor (log10 (max (abs (x(!isinf (x(:)))))));
-
-        ## If the whole input array is inf...
         if (isempty (dgt))
-          dgt = 0;
+          ## If the whole input array is inf...
+          dgt = 1;
         endif
 
         if (any (x(:) != fix (x(:))))
@@ -115,14 +114,14 @@
         fmt = "%3d";
       endif
     endif
-    fmt = cstrcat (deblank (repmat (fmt, 1, columns (x))), "\n");
+    fmt = [deblank(repmat(fmt, 1, columns(x))), "\n"];
     nd = ndims (x);
     tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
     retval = strtrim (char (ostrsplit (tmp(1:end-1), "\n")));
   else   # Complex matrix input
     if (nargin == 2)
       if (ischar (arg))
-        fmt = cstrcat (arg, "%-+", arg(2:end), "i");
+        fmt = [arg "%-+" arg(2:end) "i"];
       elseif (isnumeric (arg) && isscalar (arg) && arg >= 0)
         fmt = sprintf ("%%%d.%dg%%-+%d.%dgi", arg+7, arg, arg+7, arg);
       else
@@ -130,8 +129,13 @@
       endif
     else
       ## Setup a suitable format string
-      dgt = floor (log10 (max (max (abs (real (x(:)))),
-                               max (abs (imag (x(:)))))));
+      dgt = floor (log10 (max (max (abs (real (x(!isinf (real (x(:))))))),
+                               max (abs (imag (x(!isinf (imag (x(:))))))))));
+      if (isempty (dgt))
+        ## If the whole input array is inf...
+        dgt = 1;
+      endif
+
       if (any (x(:) != fix (x(:))))
         ## Floating point input
           dgt = max (dgt + 4, 5);   # Keep 4 sig. figures after decimal point
@@ -157,7 +161,7 @@
     x = horzcat (real (x), imag (x));
     x = x(idx{:});
 
-    fmt = cstrcat (deblank (repmat (fmt, 1, nc)), "\n");
+    fmt = [deblank(repmat(fmt, 1, nc)), "\n"];
     tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
 
     ## Put the "i"'s where they are supposed to be.
@@ -183,7 +187,16 @@
 %!assert (num2str (2^33+1i), "8589934592+1i")
 %!assert (num2str (-2^33+1i), "-8589934592+1i")
 %!assert (num2str (inf), "Inf")
+%!assert (num2str ([inf -inf]), "Inf -Inf")
+%!assert (num2str ([complex(Inf,0), complex(0,-Inf)]), "Inf+0i   0-Infi")
+%!assert (num2str (complex(Inf,1)), "Inf+1i")
+%!assert (num2str (complex(1,Inf)), "1+Infi")
 %!assert (num2str (nan), "NaN")
+%!assert (num2str (complex (NaN, 1)), "NaN+1i")
+%!assert (num2str (complex (1, NaN)), "1+NaNi")
+%!assert (num2str (NA), "NA")
+%!assert (num2str (complex (NA, 1)), "NA+1i")
+%!assert (num2str (complex (1, NA)), "1+NAi")
 
 ## FIXME: Integers greater than bitmax() should be masked to show just
 ##        16 digits of precision.
--- a/scripts/general/pol2cart.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/pol2cart.m	Sat Oct 05 11:22:09 2013 -0400
@@ -55,7 +55,7 @@
       r = theta(:,2);
       theta = theta(:,1);
     else
-      error ("pol2car: matrix input must have 2 or 3 columns [THETA, R (, Z)]");
+      error ("pol2cart: matrix input must have 2 or 3 columns [THETA, R (, Z)]");
     endif
   elseif (nargin == 2)
     if (! ((ismatrix (theta) && ismatrix (r))
--- a/scripts/general/private/__isequal__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/private/__isequal__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -48,10 +48,6 @@
 
 function t = __isequal__ (nans_compare_equal, x, varargin)
 
-  if (nargin < 3)
-    print_usage ();
-  endif
-
   l_v = nargin - 2;
 
   ## Generic tests.
@@ -160,7 +156,7 @@
 
         t = (l_f_x == length (f_y)) && all (f_x == f_y);
         if (!t)
-          return;
+          break;
         endif
 
         y = y(f_y);
@@ -172,11 +168,18 @@
         endif
 
         if (!t)
-          return;
+          break;
         endif
       endfor
 
     endif
   endif
 
+  if (!t)
+    t = false;
+  else
+    t = true;
+  endif
+
 endfunction
+
--- a/scripts/general/private/__splinen__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/private/__splinen__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,14 +26,11 @@
 ## FIXME: Allow arbitrary grids..
 
 function yi = __splinen__ (x, y, xi, extrapval, f)
-  if (nargin != 5)
-    error ("__splinen__: Incorrect number of arguments");
-  endif
   ## ND isvector function.
   isvec = @(x) numel (x) == length (x);
   if (!iscell (x) || length (x) < ndims (y) || any (! cellfun (isvec, x))
       || !iscell (xi) || length (xi) < ndims (y) || any (! cellfun (isvec, xi)))
-    error ("__splinen__: %s: non gridded data or dimensions inconsistent", f);
+    error ("__splinen__: %s: non-gridded data or dimensions inconsistent", f);
   endif
   yi = y;
   for i = length (x):-1:1
@@ -47,3 +44,4 @@
   endfor
   yi(idx) = extrapval;
 endfunction
+
--- a/scripts/general/profexplore.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/profexplore.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,13 +17,15 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} profexplore (@var{data})
+## @deftypefn  {Function File} {} profexplore ()
+## @deftypefnx {Function File} {} profexplore (@var{data})
 ## Interactively explore hierarchical profiler output.
 ##
 ## Assuming @var{data} is the structure with profile data returned by
-## @code{profile ("info")}, this command opens an interactive prompt
+## @code{profile (@qcode{"info"})}, this command opens an interactive prompt
 ## that can be used to explore the call-tree.  Type @kbd{help} to get a list
-## of possible commands.
+## of possible commands.  If @var{data} is omitted, @code{profile ("info")}
+## is called and used in its place.
 ## @seealso{profile, profshow}
 ## @end deftypefn
 
@@ -32,7 +34,9 @@
 
 function profexplore (data)
 
-  if (nargin != 1)
+  if (nargin == 0)
+    data = profile ("info");
+  elseif (nargin != 1)
     print_usage ();
   endif
 
@@ -78,12 +82,13 @@
     cmd = input ("profexplore> ", "s");
     option = fix (str2double (cmd));
 
-    if (strcmp (cmd, "exit"))
+    if (strcmp (cmd, "exit") || strcmp (cmd, "quit"))
       rv = 0;
       return;
     elseif (strcmp (cmd, "help"))
       printf ("\nCommands for profile explorer:\n\n");
       printf ("exit   Return to Octave prompt.\n");
+      printf ("quit   Return to Octave prompt.\n");
       printf ("help   Display this help message.\n");
       printf ("up [N] Go up N levels, where N is an integer.  Default is 1.\n");
       printf ("N      Go down a level into option N.\n");
@@ -130,3 +135,4 @@
 
   endwhile
 endfunction
+
--- a/scripts/general/profile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/profile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -44,7 +44,7 @@
 ## @item @var{S} = profile ("status")
 ## Return a structure filled with certain information about the current status
 ## of the profiler.  At the moment, the only field is @code{ProfilerStatus}
-## which is either "on" or "off".
+## which is either @qcode{"on"} or @qcode{"off"}.
 ##
 ## @item @var{T} = profile ("info")
 ## Return the collected profiling statistics in the structure @var{T}.
--- a/scripts/general/quadgk.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/quadgk.m	Sat Oct 05 11:22:09 2013 -0400
@@ -61,7 +61,7 @@
 ## for the integral @var{q}.
 ##
 ## Alternatively, properties of @code{quadgk} can be passed to the function as
-## pairs @code{"@var{prop}", @var{val}}.  Valid properties are
+## pairs @qcode{"@var{prop}", @var{val}}.  Valid properties are
 ##
 ## @table @code
 ## @item AbsTol
@@ -78,12 +78,12 @@
 ## unacceptable error are subdivided and re-evaluated.  If the number of
 ## subintervals exceeds 650 subintervals at any point then a poor
 ## convergence is signaled and the current estimate of the integral is
-## returned.  The property "MaxIntervalCount" can be used to alter the
+## returned.  The property @qcode{"MaxIntervalCount"} can be used to alter the
 ## number of subintervals that can exist before exiting.
 ##
 ## @item WayPoints
 ## Discontinuities in the first derivative of the function to integrate can be
-## flagged with the  @code{"WayPoints"} property.  This forces the ends of
+## flagged with the @qcode{"WayPoints"} property.  This forces the ends of
 ## a subinterval to fall on the breakpoints of the function and can result in
 ## significantly improved estimation of the error in the integral, faster
 ## computation, or both.  For example,
@@ -454,6 +454,7 @@
 %!assert (quadgk (@(x) exp (-x .^ 2),-Inf,Inf), sqrt (pi), 1e-6)
 %!assert (quadgk (@(x) exp (-x .^ 2),-Inf,0), sqrt (pi)/2, 1e-6)
 
-%error (quadgk (@sin))
-%error (quadgk (@sin, -pi))
-%error (quadgk (@sin, -pi, pi, "DummyArg"))
+%!error (quadgk (@sin))
+%!error (quadgk (@sin, -pi))
+%!error (quadgk (@sin, -pi, pi, "DummyArg"))
+
--- a/scripts/general/quadv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/quadv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -106,7 +106,7 @@
 
   if (nfun > 10000)
     warning ("maximum iteration count reached");
-  elseif (any (isnan (q)(:) | isinf (q)(:)))
+  elseif (any (! isfinite (q(:))))
     warning ("infinite or NaN function evaluations were returned");
   elseif (hmin < (b - a) * myeps)
     warning ("minimum step size reached -- possibly singular integral");
--- a/scripts/general/randi.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/randi.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,8 +34,8 @@
 ## with a lower and upper bound in which case the returned integers will be
 ## on the interval @w{[@var{imin}, @var{imax}]}.
 ##
-## The optional argument "@var{class}" will return a matrix of the requested
-## type.  The default is "double".
+## The optional argument @var{class} will return a matrix of the requested
+## type.  The default is @qcode{"double"}.
 ##
 ## The following example returns 150 integers in the range 1-10.
 ##
@@ -44,7 +44,7 @@
 ## @end example
 ##
 ## Implementation Note: @code{randi} relies internally on @code{rand} which
-## uses class "double" to represent numbers.  This limits the maximum
+## uses class @qcode{"double"} to represent numbers.  This limits the maximum
 ## integer (@var{imax}) and range (@var{imax} - @var{imin}) to the value
 ## returned by the @code{bitmax} function.  For IEEE floating point numbers
 ## this value is @w{@math{2^{53} - 1}}.
@@ -111,6 +111,7 @@
 
 endfunction
 
+
 %!test
 %! ri = randi (10, 1000, 1);
 %! assert (ri, fix (ri));
--- a/scripts/general/repmat.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/repmat.m	Sat Oct 05 11:22:09 2013 -0400
@@ -117,7 +117,7 @@
       cidx{2,i} = ones (1, idx (i));
     endfor
     aaidx = aidx;
-    # add singleton dims
+    ## add singleton dims
     aaidx(2,:) = 1;
     A = reshape (A, aaidx(:));
     x = reshape (A (cidx{:}), idx .* aidx);
@@ -125,6 +125,7 @@
 
 endfunction
 
+
 # Tests for ML compatibility
 %!shared x
 %! x = [1 2 3];
--- a/scripts/general/saveobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/saveobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -42,3 +42,4 @@
 function b = saveobj (a)
   error ('saveobj: not defined for class "%s"', class (a));
 endfunction
+
--- a/scripts/general/structfun.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/structfun.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,12 +34,11 @@
 ## a string value.  If the function returns more than one argument, they are
 ## returned as separate output variables.
 ##
-## If the parameter "UniformOutput" is set to true (the default), then the
-## function
-## must return a single element which will be concatenated into the
-## return value.  If "UniformOutput" is false, the outputs are placed into a
-## structure
-## with the same fieldnames as the input structure.
+## If the parameter @qcode{"UniformOutput"} is set to true (the default),
+## then the function must return a single element which will be concatenated
+## into the return value.  If @qcode{"UniformOutput"} is false, the outputs
+## are placed into a structure with the same fieldnames as the input
+## structure.
 ##
 ## @example
 ## @group
@@ -55,8 +54,9 @@
 ## @end group
 ## @end example
 ##
-## Given the parameter "ErrorHandler", @var{errfunc} defines a function to
-## call in case @var{func} generates an error.  The form of the function is
+## Given the parameter @qcode{"ErrorHandler"}, @var{errfunc} defines a
+## function to call in case @var{func} generates an error.  The form of the
+## function is
 ##
 ## @example
 ## function [@dots{}] = errfunc (@var{se}, @dots{})
@@ -65,10 +65,10 @@
 ## @noindent
 ## where there is an additional input argument to @var{errfunc} relative to
 ## @var{func}, given by @nospell{@var{se}}.  This is a structure with the
-## elements "identifier", "message" and "index", giving respectively the error
-## identifier, the error message, and the index into the input arguments
-## of the element that caused the error.  For an example on how to use
-## an error handler, @pxref{docXcellfun, @code{cellfun}}.
+## elements @qcode{"identifier"}, @qcode{"message"} and @qcode{"index"},
+## giving respectively the error identifier, the error message, and the index
+## into the input arguments of the element that caused the error.  For an
+## example on how to use an error handler, @pxref{XREFcellfun,,cellfun}.
 ##
 ## @seealso{cellfun, arrayfun, spfun}
 ## @end deftypefn
--- a/scripts/general/subsindex.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/subsindex.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,7 @@
 ## overloading method that allows the conversion of this class object to
 ## a valid indexing vector.  It is important to note that
 ## @code{subsindex} must return a zero-based real integer vector of the
-## class "double".  For example, if the class constructor
+## class @qcode{"double"}.  For example, if the class constructor
 ##
 ## @example
 ## @group
--- a/scripts/general/triplequad.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/general/triplequad.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,8 @@
 ## is @code{quadcc}.
 ##
 ## Additional arguments, are passed directly to @var{f}.  To use the default
-## value for @var{tol} or @var{quadf} one may pass ':' or an empty matrix ([]).
+## value for @var{tol} or @var{quadf} one may pass @qcode{':'} or an empty
+## matrix ([]).
 ## @seealso{dblquad, quad, quadv, quadl, quadgk, quadcc, trapz}
 ## @end deftypefn
 
--- a/scripts/geometry/delaunay.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/delaunay.m	Sat Oct 05 11:22:09 2013 -0400
@@ -18,12 +18,15 @@
 
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {} delaunay (@var{x}, @var{y})
-## @deftypefnx {Function File} {@var{tri} =} delaunay (@var{x}, @var{y})
-## @deftypefnx {Function File} {@var{tri} =} delaunay (@var{x}, @var{y}, @var{options})
+## @deftypefnx {Function File} {} delaunay (@var{x})
+## @deftypefnx {Function File} {} delaunay (@dots{}, @var{options})
+## @deftypefnx {Function File} {@var{tri} =} delaunay (@dots{})
 ## Compute the Delaunay triangulation for a 2-D set of points.
 ## The return value @var{tri} is a set of triangles which satisfies the
 ## Delaunay circum-circle criterion, i.e., only a single data point from
 ## [@var{x}, @var{y}] is within the circum-circle of the defining triangle.
+## The input @var{x} may also be a matrix with two columns where the first
+## column contains x-data and the second y-data.
 ##
 ## The set of triangles @var{tri} is a matrix of size [n, 3].  Each
 ## row defines a triangle and the three columns are the three vertices
@@ -31,7 +34,7 @@
 ## @var{x} and @var{y} for the location of the j-th vertex of the i-th
 ## triangle.
 ##
-## An optional third argument, which must be a string or cell array of strings,
+## The optional last argument, which must be a string or cell array of strings,
 ## contains options passed to the underlying qhull command.
 ## See the documentation for the Qhull library for details
 ## @url{http://www.qhull.org/html/qh-quick.htm#options}.
@@ -61,24 +64,56 @@
 
 ## Author: Kai Habel <kai.habel@gmx.de>
 
-function tri = delaunay (x, y, options)
+function tri = delaunay (varargin)
 
-  if (nargin != 2 && nargin != 3)
+  if (nargin < 1 || nargin > 3)
     print_usage ();
   endif
 
-  if (! (isvector (x) && isvector (y) && length (x) == length (y))
-      && ! size_equal (x, y))
+  options = [];
+
+  switch (nargin)
+
+    case 1
+      if (! ismatrix (varargin{1}) || columns (varargin{1}) != 2)
+          error ("delaunay: X must be a matrix with 2 columns");
+      else
+        x = varargin{1}(:,1);
+        y = varargin{1}(:,2);
+      endif
+    
+    case 2
+      if (isnumeric (varargin{2}))
+        x = varargin{1};
+        y = varargin{2};
+      elseif (ischar (varargin{2}) || iscellstr (varargin{2}))
+        options = varargin{2};
+        if (! ismatrix (varargin{1}) && columns (varargin{1}) != 2)
+            error ("delaunay: X must be a matrix with 2 columns");
+        else
+          x = varargin{1}(:,1);
+          y = varargin{1}(:,2);
+        endif
+      else
+        error ("delaunay: OPTIONS must be a string or cell array of strings");
+      endif
+
+    case 3
+      x = varargin{1};
+      y = varargin{2};
+      options = varargin{3};
+
+      if (! (ischar (options) || iscellstr (options)))
+        error ("delaunay: OPTIONS must be a string or cell array of strings");
+      endif
+
+  endswitch
+
+  if (! (isequal(size(x),size(y))))
     error ("delaunay: X and Y must be the same size");
-  elseif (nargin == 3 && ! (ischar (options) || iscellstr (options)))
-    error ("delaunay: OPTIONS must be a string or cell array of strings");
   endif
 
-  if (nargin == 2)
-    T = delaunayn ([x(:), y(:)]);
-  else
-    T = delaunayn ([x(:), y(:)], options);
-  endif
+  T = delaunayn ([x(:), y(:)], options);
 
   if (nargout == 0)
     x = x(:).';
@@ -112,9 +147,23 @@
 %! assert (sortrows (sort (delaunay (x, y), 2)), [1,2,4;2,3,4]);
 
 %!testif HAVE_QHULL
+%! x = [-1, 0, 1, 0];
+%! y = [0, 1, 0, -1];
+%! assert (sortrows (sort (delaunay ([x(:) y(:)]), 2)), [1,2,4;2,3,4]);
+
+%!testif HAVE_QHULL
 %! x = [-1, 0, 1, 0, 0];
 %! y = [0, 1, 0, -1, 0];
 %! assert (sortrows (sort (delaunay (x, y), 2)), [1,2,5;1,4,5;2,3,5;3,4,5]);
 
+%!testif HAVE_QHULL
+%! x = [-1, 0; 0, 1; 1, 0; 0, -1; 0, 0];
+%! assert (sortrows (sort (delaunay (x), 2)), [1,2,5;1,4,5;2,3,5;3,4,5]);
+
+%!testif HAVE_QHULL
+%! x = [1 5 2; 5 6 7];
+%! y = [5 7 8; 1 2 3];
+%! assert (sortrows (sort (delaunay (x, y), 2)), [1,2,4;1,3,4;1,3,5;3,4,6]);
+
 %% FIXME: Need input validation tests
 
--- a/scripts/geometry/griddata.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/griddata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,8 +29,8 @@
 ## The interpolation points are all @code{(@var{xi}, @var{yi})}.  If
 ## @var{xi}, @var{yi} are vectors then they are made into a 2-D mesh.
 ##
-## The interpolation method can be @code{"nearest"}, @code{"cubic"} or
-## @code{"linear"}.  If method is omitted it defaults to @code{"linear"}.
+## The interpolation method can be @qcode{"nearest"}, @qcode{"cubic"} or
+## @qcode{"linear"}.  If method is omitted it defaults to @qcode{"linear"}.
 ## @seealso{griddata3, griddatan, delaunay}
 ## @end deftypefn
 
--- a/scripts/geometry/griddata3.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/griddata3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,8 +25,8 @@
 ## The function is defined by @code{@var{v} = f (@var{x}, @var{y}, @var{z})}.
 ## The interpolation points are specified by @var{xi}, @var{yi}, @var{zi}.
 ##
-## The interpolation method can be @code{"nearest"} or @code{"linear"}.
-## If method is omitted it defaults to @code{"linear"}.
+## The interpolation method can be @qcode{"nearest"} or @qcode{"linear"}.
+## If method is omitted it defaults to @qcode{"linear"}.
 ##
 ## The optional argument @var{options} is passed directly to Qhull when
 ## computing the Delaunay triangulation used for interpolation.  See
--- a/scripts/geometry/griddatan.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/griddatan.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,8 +25,8 @@
 ## The function is defined by @code{@var{y} = f (@var{x})}.
 ## The interpolation points are all @var{xi}.
 ##
-## The interpolation method can be @code{"nearest"} or @code{"linear"}.
-## If method is omitted it defaults to @code{"linear"}.
+## The interpolation method can be @qcode{"nearest"} or @qcode{"linear"}.
+## If method is omitted it defaults to @qcode{"linear"}.
 ## 
 ## The optional argument @var{options} is passed directly to Qhull when
 ## computing the Delaunay triangulation used for interpolation.  See
--- a/scripts/geometry/inpolygon.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/inpolygon.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,5 +1,5 @@
 ## Copyright (C) 2006-2012 Frederick (Rick) A Niles
-##               and S�ren Hauberg
+##               and Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -30,7 +30,7 @@
 ## Author: Frederick (Rick) A Niles <niles@rickniles.com>
 ## Created: 14 November 2006
 
-## Vectorized by S�ren Hauberg <soren@hauberg.org>
+## Vectorized by Søren Hauberg <soren@hauberg.org>
 
 ## The method for determining if a point is in in a polygon is based on
 ## the algorithm shown on
--- a/scripts/geometry/voronoi.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/geometry/voronoi.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,9 +26,10 @@
 ## Plot the Voronoi diagram of points @code{(@var{x}, @var{y})}.
 ## The Voronoi facets with points at infinity are not drawn.
 ## 
-## If "linespec" is given it is used to set the color and line style of the
-## plot.  If an axis graphics handle @var{hax} is supplied then the Voronoi
-## diagram is drawn on the specified axis rather than in a new figure.
+## If @qcode{"linespec"} is given it is used to set the color and line style
+## of the plot.  If an axis graphics handle @var{hax} is supplied then the
+## Voronoi diagram is drawn on the specified axis rather than in a new
+## figure.
 ##
 ## The @var{options} argument, which must be a string or cell array of strings,
 ## contains options passed to the underlying qhull command.
@@ -74,13 +75,13 @@
 
   narg = 1;
   if (isscalar (varargin{1}) && ishandle (varargin{1}))
-    handl = varargin{1};
-    if (! strcmp (get (handl, "type"), "axes"))
-      error ("voronoi: expecting first argument to be an axes object");
+    hax = varargin{1};
+    if (! isaxes (harg))
+      error ("imagesc: HAX argument must be an axes object");
     endif
     narg++;
   elseif (nargout < 2)
-    handl = gca ();
+    hax = gca ();
   endif
 
   if (nargin < 1 + narg || nargin > 3 + narg)
@@ -154,7 +155,7 @@
   Vvy = reshape (p(edges, 2), size (edges));
 
   if (nargout < 2)
-    h = plot (handl, Vvx, Vvy, linespec{:}, x, y, '+');
+    h = plot (hax, Vvx, Vvy, linespec{:}, x, y, '+');
     lim = [xmin, xmax, ymin, ymax];
     axis (lim + 0.1 * [[-1, 1] * xdelta, [-1, 1] * ydelta]);
     if (nargout == 1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/guidata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,67 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{data} =} guidata (@var{h})
+## @deftypefnx {Function File} {} guidata (@var{h}, @var{data})
+## Query or set user-custom GUI data.
+##
+## The GUI data is stored in the figure handle @var{h}.  If @var{h} is not a
+## figure handle then it's parent figure will be used for storage.
+##
+## @var{data} must be a single object which means it is usually preferable
+## for it to be a data container such as a cell array or struct so that
+## additional data items can be added easily.
+##
+## @seealso{getappdata, setappdata, get, set, getpref, setpref}
+## @end deftypefn
+
+## Author: goffioul
+
+function dataout = guidata (h, data)
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+  endif
+
+  if (! ishandle (h))
+    error ("guidata: H must be a valid object handle");
+  endif
+  h = ancestor (h, "figure");
+  if (isempty (h))
+    error ("guidata: no ancestor figure of H found");
+  endif
+
+  if (nargin == 1)
+    dataout = get (h, "__guidata__");
+  else
+    set (h, "__guidata__", data);
+    if (nargout == 1)
+      dataout = data;
+    endif
+  endif
+
+endfunction
+
+
+%% Test input validation
+%!error guidata ()
+%!error guidata (1,2,3)
+%!error <H must be a valid object handle> guidata ({1})
+%!error <no ancestor figure of H found> guidata (0)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/guihandles.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,80 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hdata} =} guihandles (@var{h})
+## @deftypefnx {Function File} {@var{hdata} =} guihandles
+## Return a structure of object handles for the figure associated with
+## handle @var{h}.
+## 
+## If no handle is specified the current figure returned by @code{gcf} is used.
+##
+## The fieldname for each entry of @var{hdata} is taken from the @qcode{"tag"}
+## property of the graphic object.  If the tag is empty then the handle is not
+## returned.  If there are multiple graphic objects with the same tag then
+## the entry in @var{hdata} will be a vector of handles.  @code{guihandles}
+## includes all possible handles, including those for
+## which @qcode{"HandleVisibility"} is @qcode{"off"}.
+## @seealso{guidata, findobj, findall, allchild}
+## @end deftypefn
+
+## Author: goffioul
+
+function hdata = guihandles (h)
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    if (! ishandle (h))
+      error ("guidata: H must be a valid object handle");
+    endif
+    h = ancestor (h, "figure");
+    if (isempty (h))
+      error ("guidata: no ancestor figure of H found");
+    endif
+  else
+    h = gcf ();
+  endif
+
+  hdata = __make_guihandles_struct__ (h, []);
+
+endfunction
+
+function hdata = __make_guihandles_struct__ (h, hdata)
+
+  tag = get (h, "tag");
+  if (! isempty (tag))
+    if (isfield (hdata, tag))
+      hdata.(tag) = [hdata.(tag), h];
+    else
+      try
+        hdata.(tag) = h;
+      catch
+      end_try_catch
+    endif
+  endif
+
+  kids = allchild (h);
+  for hkid = kids'
+    hdata = __make_guihandles_struct__ (hkid, hdata);
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,35 @@
+FCN_FILE_DIRS += gui
+
+gui_PRIVATE_FCN_FILES = \
+  gui/private/__file_filter__.m \
+  gui/private/__fltk_file_filter__.m \
+  gui/private/__is_function__.m \
+  gui/private/__uigetdir_fltk__.m \
+  gui/private/__uigetfile_fltk__.m \
+  gui/private/__uiobject_split_args__.m \
+  gui/private/__uiputfile_fltk__.m
+
+gui_FCN_FILES = \
+  gui/guidata.m \
+  gui/guihandles.m \
+  gui/uicontextmenu.m \
+  gui/uicontrol.m \
+  gui/uigetdir.m \
+  gui/uigetfile.m \
+  gui/uimenu.m \
+  gui/uipanel.m \
+  gui/uipushtool.m \
+  gui/uiputfile.m \
+  gui/uiresume.m \
+  gui/uitoggletool.m \
+  gui/uitoolbar.m \
+  gui/uiwait.m \
+  gui/waitbar.m \
+  gui/waitforbuttonpress.m \
+  $(gui_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(gui_FCN_FILES)
+
+PKG_ADD_FILES += gui/PKG_ADD
+
+DIRSTAMP_FILES += gui/$(octave_dirstamp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__file_filter__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,94 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __file_filter__ (@var{file_filter})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retval, defname, defdir] = __file_filter__ (file_filter, name)
+
+  revtal = {};
+  defname = "";
+  defdir = "";
+
+  if (iscell (file_filter))
+    [r, c] = size (file_filter);
+    if (c != 1 && c != 2)
+      error ("%s: invalid filter specification", name);
+    endif
+    if (c == 1)
+      retval = cell (r, 2);
+      for i = 1:r
+        retval{i, 1} = file_filter{i};
+        retval{i, 2} = __default_filtername__ (file_filter{i});
+      endfor
+    else
+      retval = file_filter;
+      for i = 1:r
+        if (isempty (retval{i, 2}))
+          retval{i, 2} = __default_filtername__ (retval{i, 1});
+        endif
+      endfor
+    endif
+  elseif (ischar (file_filter))
+    [defdir, fname, fext] = fileparts (file_filter);
+    if (! strcmp (fname, "*"))
+      defname = strcat (fname, fext);
+    endif
+    if (length (fext) > 0)
+      fext = strcat ("*", fext);
+      retval = {fext, __default_filtername__(fext)};
+    endif
+  endif
+
+  retval(end+1,:) = {"*", __default_filtername__("*")};
+
+endfunction
+
+function name = __default_filtername__ (filterext)
+
+  name = "";
+
+  switch (filterext)
+    case "*"
+      name = "All Files";
+    case "*.m"
+      name = "Octave Source Files";
+    case "*.c"
+      name = "C Source Files";
+    case {"*.cc" "*.c++" "*.cpp"}
+      name = "C++ Source Files";
+    case "*.oct"
+      name = "Octave Compiled Files";
+  endswitch
+
+  if (isempty (name))
+    extlist = ostrsplit (filterext, ";");
+    extlist = strrep (extlist, "*.", "");
+    extlist = toupper (extlist);
+    extlist(end+1, :) = repmat ({","}, 1, length (extlist));
+    extlist = strcat (extlist{:});
+    extlist = extlist(1:end-1);
+    name = strcat (extlist, "-Files");
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__fltk_file_filter__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,65 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function retval = __fltk_file_filter__ (file_filter)
+
+  retval = "";
+  [r, c] = size (file_filter);
+  if ((c == 0) || (c > 2))
+    error ("expecting 1 or to 2 columns for file filter cell");
+  endif
+  fltk_str = "";
+  for idx = 1 : r
+
+    curr_ext = file_filter{idx, 1};
+    curr_ext = ostrsplit (curr_ext, ";");
+
+    if (length (curr_ext) > 1)
+      curr_ext = regexprep (curr_ext, '\*\.', ',');
+      curr_ext = strcat (curr_ext{:})(2 : end);
+      curr_ext = strcat ("*.{", curr_ext, "}");
+    else
+      curr_ext = curr_ext{:};
+    endif
+
+    curr_desc = strcat (curr_ext(3:end), "-Files");
+
+    if (c == 2)
+      curr_desc = file_filter{idx, 2};
+      curr_desc = regexprep (curr_desc, '\(', '<');
+      curr_desc = regexprep (curr_desc, '\)', '>');
+    endif
+
+    if (length (fltk_str) > 0)
+      fltk_str = strcat (fltk_str, "\t", curr_desc, " (", curr_ext, ")");
+    else
+      fltk_str = strcat (curr_desc, " (", curr_ext, ")");
+    endif
+
+  endfor
+  retval = fltk_str;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__is_function__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function result = __is_function__ (func)
+
+  existval = exist (func);
+  result = (existval == 2 || existval == 3 || existval == 5 || existval == 6);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uigetdir_fltk__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,35 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function dirname = __uigetdir_fltk__ (start_path, dialog_title)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uigetdir: fltk graphics toolkit required");
+  endif
+
+  dirname = __fltk_uigetfile__ ("", dialog_title, start_path, [240, 120], "dir");
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uigetfile_fltk__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,39 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function [retval, retpath, retindex] = __uigetfile_fltk__ (filters, title, defval, position, multiselect, defdir)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uigetfile: fltk graphics toolkit required");
+  endif
+
+  filters = __fltk_file_filter__ (filters);
+  if (length (defdir) > 0)
+    defval = fullfile (defdir, defval);
+  endif
+  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, multiselect);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uiobject_split_args__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,67 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf})
+## @end deftypefn
+
+## Author: goffioul
+
+function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1)
+
+  parent = [];
+  args = {};
+  offset = 1;
+
+  if (! isempty (in_args))
+    if (ishandle (in_args{1}))
+      parent = in_args{1};
+      offset = 2;
+    elseif (! ischar (in_args{1}))
+      error ("%s: invalid parent handle.", who);
+    endif
+
+    args = in_args(offset:end);
+  endif
+
+  if (rem (length (args), 2))
+    error ("%s: expecting PROPERTY/VALUE pairs", who);
+  endif
+
+  if (! isempty (args))
+    i = find (strcmpi (args(1:2:end), "parent"), 1, "first");
+    if (! isempty (i) && length (args) >= 2*i)
+      parent = args{2*i};
+      if (! ishandle (parent))
+        error ("%s: invalid parent handle.", who);
+      endif
+      args([2*i-1, 2*i]) = [];
+    endif
+  endif
+
+  if (! isempty (parent))
+    if (! isempty (parent_type) && isempty (find (strcmpi (get (parent, "type"), parent_type))))
+      error ("%s: invalid parent, the parent type must be: %s", ...
+             who, sprintf ("%s, ", parent_type{:})(1:end-2));
+    endif
+  elseif (use_gcf)
+    parent = gcf ();
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/private/__uiputfile_fltk__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,39 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michael Goffioul
+
+function [retval, retpath, retindex] = __uiputfile_fltk__ (filters, title, defval, position, tag, defdir)
+
+  if (exist ("__fltk_uigetfile__") != 3)
+    error ("uiputfile: fltk graphics toolkit required");
+  endif
+
+  filters = __fltk_file_filter__ (filters);
+  if (length (defdir) > 0)
+    defval = fullfile (defdir, defval);
+  endif
+  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, tag);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uicontextmenu.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,31 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{handle} =} uicontextmenu ("Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uicontextmenu (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uicontextmenu", varargin, {"figure"});
+  handle = __go_uicontextmenu__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uicontrol.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,37 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uicontrol ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uicontrol (@var{parent}, "Name", value, @dots{})
+## @deftypefnx {Function File} {} uicontrol (@var{handle})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uicontrol (varargin)
+
+  if (nargin == 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "uicontrol"))
+    error ("uicontrol focusing not implemented yet.");
+  else
+    [h, args] = __uiobject_split_args__ ("uicontrol", varargin, {"figure", "uipanel", "uibuttongroup"});
+    handle = __go_uicontrol__ (h, args{:});
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uigetdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,81 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{dirname} =} uigetdir ()
+## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path})
+## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name})
+## Open a GUI dialog for selecting a directory.  If @var{init_path} is not
+## given the current working directory is used.  @var{dialog_name} may be
+## used to customize the dialog title.
+## @seealso{uigetfile, uiputfile}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open")
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uigetdir_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uigetdir_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uigetdir: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uigetdir: no implementation for toolkit '%s', using 'fltk' instead",
+                 defaulttoolkit);
+      endif
+    endif
+  endif
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (!ischar (init_path) || !ischar (dialog_name))
+    error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments");
+  endif
+
+  if (!isdir (init_path))
+    init_path = fileparts (init_path);
+  endif
+
+  if (__octave_link_enabled__ ())
+    file_filter = cell (0, 2);
+    default_file_name = "";
+    dialog_position = [240, 120];
+    dialog_mode = "dir";
+
+    [filename, dirname, filterindex] ...
+      = __octave_link_file_dialog__ (file_filter, dialog_name,
+                                     default_file_name, dialog_position,
+                                     dialog_mode, init_path);
+  else
+    dirname = feval (funcname, init_path, dialog_name);
+  endif
+endfunction
+
+
+%!demo
+%! uigetdir (pwd, 'Select Directory');
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uigetfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,203 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uigetfile ()
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}, @var{default_file})
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "Position", [@var{px} @var{py}])
+## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "MultiSelect", @var{mode})
+##
+## Open a GUI dialog for selecting a file and return the filename @var{fname},
+## the path to this file @var{fpath}, and the filter index @var{fltidx}.
+## @var{flt} contains a (list of) file filter string(s) in one of the following
+## formats:
+##
+## @table @asis
+## @item @qcode{"/path/to/filename.ext"}
+## If a filename is given then the file extension is extracted and used as
+## filter.  In addition, the path is selected as current path and the filename
+## is selected as default file.  Example: @code{uigetfile ("myfun.m")}
+##
+## @item A single file extension @qcode{"*.ext"}
+## Example: @code{uigetfile ("*.ext")}
+##
+## @item A 2-column cell array
+## containing a file extension in the first column and a brief description
+## in the second column.
+## Example: @code{uigetfile (@{"*.ext", "My Description";"*.xyz",
+## "XYZ-Format"@})}
+##
+## The filter string can also contain a semicolon separated list of filter
+## extensions.
+## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture
+## Formats"@})}
+## @end table
+##
+## @var{dialog_name} can be used to customize the dialog title.
+## If @var{default_file} is given then it will be selected in the GUI dialog.
+## If, in addition, a path is given it is also used as current path.
+##
+## The screen position of the GUI dialog can be set using the
+## @qcode{"Position"} key and a 2-element vector containing the pixel
+## coordinates.  Two or more files can be selected when setting the
+## @qcode{"MultiSelect"} key to @qcode{"on"}.  In that case @var{fname} is a
+## cell array containing the files.
+## @seealso{uiputfile, uigetdir}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retfile, retpath, retindex] = uigetfile (varargin)
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uigetfile_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uigetfile_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uigetfile: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uigetfile: no implementation for toolkit '%s', using 'fltk' instead",
+               defaulttoolkit);
+      endif
+    endif
+  endif
+  
+  if (nargin > 7)
+    error ("uigetfile: number of input arguments must be less than eight");
+  endif
+
+  defaultvals = {cell(0, 2),         # File Filter
+                 "Open File",        # Dialog Title
+                 "",                 # Default file name
+                 [240, 120],         # Dialog Position (pixel x/y)
+                 "off",              # MultiSelect on/off
+                 pwd};               # Default directory
+
+  outargs = cell (6, 1);
+  for i = 1 : 6
+    outargs{i} = defaultvals{i};
+  endfor
+
+  idx1 = idx2 = [];
+  if (length (varargin) > 0)
+    for i = 1 : length (varargin)
+      val = varargin{i};
+      if (ischar (val))
+        val = tolower (val);
+        if (strcmp (val, "multiselect"))
+          idx1 = i;
+        elseif (strcmp (val, "position"))
+          idx2 = i;
+        endif
+      endif
+    endfor
+  endif
+
+  stridx = [idx1, idx2, 0];
+  if (length (stridx) > 1)
+    stridx = min (stridx(1 : end - 1));
+  endif
+
+  args = varargin;
+  if (stridx)
+    args = varargin(1 : stridx - 1);
+  endif
+
+  len = length (args);
+  if (len > 0)
+    file_filter = args{1};
+    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
+    if (length (defdir) > 0)
+      outargs{6} = defdir;
+    endif
+  else
+    outargs{1} = __file_filter__ (outargs{1});
+  endif
+
+  if (len > 1)
+    if (ischar (args{2}))
+      if (length (args{2}) > 0)
+        outargs{2} = args{2};
+      endif
+    elseif (! isempty (args{2}))
+      print_usage ();
+    endif
+  endif
+
+  if (len > 2)
+    if (ischar (args{3}))
+      [fdir, fname, fext] = fileparts (args{3});
+      if (length (fdir) > 0)
+        outargs{6} = fdir;
+      endif
+      if (length (fname) > 0 || length (fext) > 0)
+        outargs{3} = strcat (fname, fext);
+      endif
+    elseif (! isempty (args{3}))
+      print_usage ();
+    endif
+  endif
+
+  if (stridx)
+    ## we have string arguments ("position" or "multiselect")
+
+    ## check for even number of remaining arguments, prop/value pair(s)
+    if (rem (nargin - stridx + 1, 2))
+      error ("uigetfile: expecting property/value pairs");
+    endif
+
+    for i = stridx : 2 : nargin
+      prop = varargin{i};
+      val = varargin{i + 1};
+      if (strcmpi (prop, "position"))
+        if (ismatrix (val) && length (val) == 2)
+          outargs{4} = val;
+        else
+          error ("uigetfile: expecting 2-element vector for position argument");
+        endif
+      elseif (strcmpi (prop, "multiselect"))
+        if (ischar (val))
+          outargs{5} = tolower (val);
+        else
+          error ("uigetfile: expecting string argument (on/off) for multiselect");
+        endif
+      else
+        error ("uigetfile: unknown argument");
+      endif
+    endfor
+  endif
+
+  if (__octave_link_enabled__ ())
+    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
+  else
+    [retfile, retpath, retindex] = feval (funcname, outargs{:});
+  endif
+
+endfunction
+
+
+%!demo
+%! uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uimenu.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,147 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
+## Create a uimenu object and return a handle to it.  If @var{h} is omitted
+## then a top-level menu for the current figure is created.  If @var{h}
+## is given then a submenu relative to @var{h} is created.
+##
+## uimenu objects have the following specific properties:
+##
+## @table @asis
+## @item @qcode{"accelerator"}
+## A string containing the key combination together with CTRL to execute this
+## menu entry (e.g., @qcode{"x"} for CTRL+x).
+##
+## @item @qcode{"callback"}
+## Is the function called when this menu entry is executed.  It can be either a
+## function string (e.g., @qcode{"myfun"}), a function handle (e.g., @@myfun)
+## or a cell array containing the function handle and arguments for the
+## callback function (e.g., @{@@myfun, arg1, arg2@}).
+##
+## @item @qcode{"checked"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  Sets a mark at this menu entry.
+##
+## @item @qcode{"enable"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  If disabled the menu entry
+## cannot be selected and it is grayed out.
+##
+## @item @qcode{"foregroundcolor"}
+## A color value setting the text color for this menu entry.
+##
+## @item @qcode{"label"}
+## A string containing the label for this menu entry.  A @qcode{"&"}-symbol
+## can be used to mark the @qcode{"accelerator"} character (e.g.,
+## @nospell{@qcode{"E&xit"}})
+##
+## @item @qcode{"position"}
+## An scalar value containing the relative menu position.  The entry with the
+## lowest value is at the first position starting from left or top.
+##
+## @item @qcode{"separator"}
+## Can be set @qcode{"on"} or @qcode{"off"}.  If enabled it draws a separator
+## line above the current position.  It is ignored for top level entries.
+##
+## @end table
+##
+## Examples:
+##
+## @example
+## @group
+## f = uimenu ("label", "&File", "accelerator", "f");
+## e = uimenu ("label", "&Edit", "accelerator", "e");
+## uimenu (f, "label", "Close", "accelerator", "q", ...
+##            "callback", "close (gcf)");
+## uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
+##            "callback", "grid (gca)");
+## @end group
+## @end example
+## @seealso{figure}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function hui = uimenu (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uimenu", varargin, {"figure", "uicontextmenu", "uimenu"});
+
+  tmp = __go_uimenu__ (h, args{:});
+
+  if (nargout > 0)
+    hui = tmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! surfl (peaks);
+%! colormap (copper (64));
+%! shading ('interp');
+%! f = uimenu ('label', '&File', 'accelerator', 'f');
+%! e = uimenu ('label', '&Edit', 'accelerator', 'e');
+%! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)');
+%! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)');
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ui = uimenu ("label", "mylabel");
+%!   assert (findobj (hf, "type", "uimenu"), ui);
+%!   assert (get (ui, "label"), "mylabel");
+%!   assert (get (ui, "checked"), "off");
+%!   assert (get (ui, "separator"), "off");
+%!   assert (get (ui, "enable"), "on");
+%!   assert (get (ui, "position"), 9);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%% check for top level menus file, edit, and help
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   uif = findall (hf, "label", "&file");
+%!   assert (ishghandle (uif));
+%!   uie = findall (hf, "label", "&edit");
+%!   assert (ishghandle (uie));
+%!   uih = findall (hf, "label", "&help");
+%!   assert (ishghandle (uih));
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   uie = findall (hf, "label", "&edit");
+%!   myui = uimenu (uie, "label", "mylabel");
+%!   assert (ancestor (myui, "uimenu", "toplevel"), uie);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uipanel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uipanel ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uipanel (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uipanel (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uipanel", varargin, {"figure", "uipanel", "uibuttongroup"});
+  handle = __go_uipanel__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uipushtool.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,40 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uipushtool ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uipushtool (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uipushtool (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uipushtool", varargin, {"uitoolbar"}, 0);
+  if (isempty (h))
+    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
+    if (isempty (h))
+      h = uitoolbar ();
+    else
+      h = h(1);
+    endif
+  endif
+  handle = __go_uipushtool__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiputfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,136 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile ()
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt})
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name})
+## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name}, @var{default_file})
+## Open a GUI dialog for selecting a file.  @var{flt} contains a (list of) file
+## filter string(s) in one of the following formats:
+##
+## @table @asis
+## @item @qcode{"/path/to/filename.ext"}
+## If a filename is given the file extension is extracted and used as filter.
+## In addition the path is selected as current path and the filename is
+## selected as default file.  Example: @code{uiputfile ("myfun.m")}
+##
+## @item @qcode{"*.ext"}
+## A single file extension.
+## Example: @code{uiputfile ("*.ext")}
+##
+## @item @code{@{"*.ext", "My Description"@}}
+## A 2-column cell array containing the file extension in the 1st column and
+## a brief description in the 2nd column.
+## Example: @code{uiputfile (@{"*.ext","My Description";"*.xyz",
+## "XYZ-Format"@})}
+## @end table
+##
+## The filter string can also contain a semicolon separated list of filter
+## extensions.
+## Example: @code{uiputfile (@{"*.gif;*.png;*.jpg",
+## "Supported Picture Formats"@})}
+##
+## @var{dialog_name} can be used to customize the dialog title.
+## If @var{default_file} is given it is preselected in the GUI dialog.
+## If, in addition, a path is given it is also used as current path.
+## @seealso{uigetfile, uigetdir}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function [retfile, retpath, retindex] = uiputfile (varargin)
+
+  if (! __octave_link_enabled__ ())
+    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
+    funcname = ["__uiputfile_", defaulttoolkit, "__"];
+    functype = exist (funcname);
+    if (! __is_function__ (funcname))
+      funcname = "__uiputfile_fltk__";
+      if (! __is_function__ (funcname))
+        error ("uiputfile: fltk graphics toolkit required");
+      elseif (! strcmp (defaulttoolkit, "gnuplot"))
+        warning ("uiputfile: no implementation for toolkit '%s', using 'fltk' instead",
+               defaulttoolkit);
+      endif
+    endif
+  endif
+
+  if (nargin > 3)
+    print_usage ();
+  endif
+
+  defaultvals = {cell(0, 2),     # File Filter
+                 "Save File",    # Dialog Title
+                 "",             # Default file name
+                 [240, 120],     # Dialog Position (pixel x/y)
+                 "create",
+                 pwd};           # Default directory
+
+  outargs = cell (6, 1);
+  for i = 1 : 6
+    outargs{i} = defaultvals{i};
+  endfor
+
+  if (nargin > 0)
+    file_filter = varargin{1};
+    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
+    if (length (defdir) > 0)
+      outargs{6} = defdir;
+    endif
+  else
+    outargs{1} = __file_filter__ (outargs{1});
+  endif
+
+  if (nargin > 1)
+    if (ischar (varargin{2}))
+      outargs{2} = varargin{2};
+    elseif (! isempty (varargin{2}))
+      print_usage ();
+    endif
+  endif
+
+  if (nargin > 2)
+    if (ischar (varargin{3}))
+      [fdir, fname, fext] = fileparts (varargin{3});
+      if (! isempty (fdir))
+        outargs{6} = fdir;
+      endif
+      if (! isempty (fname) || ! isempty (fext))
+        outargs{3} = strcat (fname, fext);
+      endif
+    elseif (! isempty (varargin{3}))
+      print_usage ();
+    endif
+  endif
+
+  if (__octave_link_enabled__ ())
+    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
+  else
+    [retfile, retpath, retindex] = feval (funcname, outargs{:});
+  endif
+
+endfunction
+
+
+%!demo
+%! uiputfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiresume.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,46 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} uiresume (@var{h})
+## Resume program execution suspended with @code{uiwait}.  The handle @var{h}
+## must be the same as the on specified in @code{uiwait}.  If the handle
+## is invalid or there is no @code{uiwait} call pending for the figure
+## with handle @var{h}, this function does nothing.
+## @seealso{uiwait}
+## @end deftypefn
+
+## Author: goffioul
+
+function uiresume (h)
+
+  if (! isfigure (h))
+    error ("uiresume: invalid figure handle H");
+  endif
+
+  try
+    uiwait_state = get (h, "__uiwait_state__");
+    if (strcmp (uiwait_state, "active"))
+      set (h, "__uiwait_state__", "triggered");
+    endif
+  catch
+    ## Ignore exception
+  end_try_catch
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uitoggletool.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,40 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uitoggletool ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uitoggletool (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uitoggletool (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0);
+  if (isempty (h))
+    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
+    if (isempty (h))
+      h = uitoolbar ();
+    else
+      h = h(1);
+    endif
+  endif
+  handle = __go_uitoggletool__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uitoolbar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,32 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{handle} =} uitoolbar ("Name", value, @dots{})
+## @deftypefnx {Function File} {@var{handle} =} uitoolbar (@var{parent}, "Name", value, @dots{})
+## @end deftypefn
+
+## Author: goffioul
+
+function handle = uitoolbar (varargin)
+
+  [h, args] = __uiobject_split_args__ ("uitoolbar", varargin, {"figure"});
+  handle = __go_uitoolbar__ (h, args{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/uiwait.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,81 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} uiwait
+## @deftypefnx {Function File} {} uiwait (@var{h})
+## @deftypefnx {Function File} {} uiwait (@var{h}, @var{timeout})
+## Suspend program execution until the figure with handle @var{h} is
+## deleted or @code{uiresume} is called.  When no figure handle is specified,
+## this function uses the current figure.
+##
+## If the figure handle is invalid or there is no current figure, this
+## functions returns immediately.
+##
+## When specified, @var{timeout} defines the number of seconds to wait
+## for the figure deletion or the @code{uiresume} call.  The timeout value
+## must be at least 1.  If a smaller value is specified, a warning is issued
+## and a timeout value of 1 is used instead.  If a non-integer value is
+## specified, it is truncated towards 0.  If @var{timeout} is not specified,
+## the program execution is suspended indefinitely.
+## @seealso{uiresume, waitfor}
+## @end deftypefn
+
+## Author: goffioul
+
+function uiwait (varargin)
+
+  h = [];
+  timeout = [];
+
+  if (nargin == 0)
+    h = get (0, "currentfigure");
+  else
+    h = varargin{1};
+    if (! isfigure (h))
+      error ("uiwait: invalid figure handle H");
+    endif
+    if (nargin > 1)
+      timeout = varargin{2};
+    endif
+  endif
+
+  if (! isempty (h))
+    unwind_protect
+      try
+        addproperty ("__uiwait_state__", h, "radio", "none|{active}|triggered");
+      catch
+        if (! strcmp (get (h, "__uiwait_state__"), "none"))
+          error ("uiwait: an active uiwait call for this figure already exists");
+        endif
+        set (h, "__uiwait_state__", "active");
+      end_try_catch
+      waitfor_args = {h, "__uiwait_state__", "triggered"};
+      if (! isempty (timeout))
+        waitfor_args(end+1:end+2) = {"timeout", timeout};
+      endif
+      waitfor (waitfor_args{:});
+    unwind_protect_cleanup
+      if (ishandle (h) && isprop (h, "__uiwait_state__"))
+        set (h, "__uiwait_state__", "none");
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/waitbar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,199 @@
+## Copyright (C) 2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} waitbar (@var{frac})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@var{frac}, @var{msg})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "FigureProperty", "Value", @dots{})
+## @deftypefnx {Function File} {} waitbar (@var{frac})
+## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar})
+## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar}, @var{msg})
+## Return a handle @var{h} to a new waitbar object.
+##
+## The waitbar is filled to fraction @var{frac} which must be in the range
+## [0, 1].  The optional message @var{msg} is centered and displayed above the
+## waitbar.  The appearance of the waitbar figure window can be configured by
+## passing property/value pairs to the function.
+## 
+## When called with a single input the current waitbar, if it exists, is
+## updated to the new value @var{frac}.  If there are multiple outstanding
+## waitbars they can be updated individually by passing the handle @var{hwbar}
+## of the specific waitbar to modify.
+## @end deftypefn
+
+## Author: jwe
+
+function h = waitbar (varargin)
+
+  persistent curr_waitbar;
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  frac = varargin{1};
+  varargin(1) = [];
+
+  if (! (isnumeric (frac) && isscalar (frac) && frac >= 0 && frac <= 1))
+    error ("waitbar: FRAC must be between 0 and 1");
+  endif
+
+  ## Use existing waitbar if it still points to a valid graphics handle.
+  if (nargin == 1 && ishandle (curr_waitbar))
+    hf = curr_waitbar;
+  else
+    hf = false;
+  endif
+
+  if (! isempty (varargin) && isnumeric (varargin{1}))
+    hf = varargin{1};
+    varargin(1) = [];
+    if (! isfigure (hf) || ! strcmp (get (hf, "tag"), "waitbar"))
+      error ("waitbar: H must be a handle to a waitbar object");
+    endif
+  endif
+
+  msg = false;
+
+  if (! isempty (varargin))
+    msg = varargin{1};
+    varargin(1) = [];
+    if (! (ischar (msg) || iscellstr (msg)))
+      error ("waitbar: MSG must be a character string or cell array of strings");
+    endif
+  endif
+
+  if (rem (numel (varargin), 2) != 0)
+    error ("waitbar: invalid number of property/value pairs");
+  endif
+
+  if (hf)
+    gd = get (hf, "__guidata__");
+    ## Get the cached handles.
+    ax = gd(1);
+    hp = gd(2);
+
+    set (hp, "xdata", [0; frac; frac; 0]);
+
+    if (ischar (msg) || iscellstr (msg))
+      th = get (ax, "title");
+      curr_msg = get (th, "string");
+      ## graphics handles always store data as column vectors
+      if (iscellstr (msg))
+        msg = msg(:);  
+      endif
+      cmp = strcmp (msg, curr_msg);
+      if (! all (cmp(:)))
+        set (th, "string", msg);
+      endif
+    endif
+  else
+    ## Save and restore current figure
+    cf = get (0, "currentfigure");
+
+    hf = figure ("position", [250, 500, 400, 100],
+                 "numbertitle", "off",
+                 "menubar", "none", "toolbar", "none",
+                 "integerhandle", "off",
+                 "handlevisibility", "callback",
+                 "tag", "waitbar",
+                 varargin{:});
+
+    ax = axes ("parent", hf,
+               "xtick", [], "ytick", [],
+               "xlim", [0, 1], "ylim", [0, 1],
+               "position", [0.1, 0.3, 0.8, 0.2]);
+
+    hp = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]);
+
+    ## Cache the axes and patch handles.
+    set (hf, "__guidata__", [ax hp]);
+
+    if (! (ischar (msg) || iscellstr (msg)))
+      msg = "Please wait...";
+    endif
+    title (ax, msg);
+
+    if (! isempty (cf))
+      set (0, "currentfigure", cf);
+    endif
+  endif
+
+  drawnow ();
+
+  if (nargout > 0)
+    h = hf;
+  endif
+
+  ## If there were no errors, update current waitbar.
+  curr_waitbar = hf;
+
+endfunction
+
+
+%!demo
+%! h = waitbar (0, '0.00%');
+%! for i = 0:0.01:1
+%!   waitbar (i, h, sprintf ('%.2f%%', 100*i));
+%! end
+%! close (h);
+
+%!demo
+%! h = waitbar (0, 'please wait...');
+%! for i = 0:0.01:0.6
+%!   waitbar (i);
+%! end
+%! i = 0.3;
+%! waitbar (i, h, 'don''t you hate taking a step backward?');
+%! pause (0.5);
+%! for i = i:0.005:0.7
+%!   waitbar (i, h);
+%! end
+%! waitbar (i, h, 'or stalling?');
+%! pause (1);
+%! for i = i:0.003:0.8
+%!   waitbar (i, h, 'just a little longer now');
+%! end
+%! for i = i:0.001:1
+%!   waitbar (i, h, 'please don''t be impatient');
+%! end
+%! close (h);
+
+%!demo
+%! h1 = waitbar (0, 'Waitbar #1');
+%! h2 = waitbar (0, 'Waitbar #2');
+%! h2pos = get (h2, 'position');
+%! h2pos(1) = h2pos(1) + (h2pos(3) + 50);
+%! set (h2, 'position', h2pos);
+%! pause (0.5);
+%! for i = 1:4
+%!   waitbar (i/4, h1);
+%!   pause (0.5);
+%!   waitbar (i/4, h2);
+%!   pause (0.5);
+%! end
+%! pause (0.5);
+%! close (h1);
+%! close (h2);
+
+%% Test input validation
+%!error <FRAC must be between 0 and 1> waitbar (-0.5)
+%!error <FRAC must be between 0 and 1> waitbar (1.5)
+%!error <MSG must be a character string> waitbar (0.5, struct ())
+%!error <invalid number of property/value pairs> waitbar (0.5, "msg", "Name")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/gui/waitforbuttonpress.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,55 @@
+## Copyright (C) 2004-2012 Petr Mikulik
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} waitforbuttonpress ()
+## @deftypefnx {Function File} {@var{a} =} waitforbuttonpress ()
+## Wait for mouse click or key press over the current figure window.
+##
+## The return value of @var{b} is 0 if a mouse button was pressed or 1 if a
+## key was pressed.
+## @seealso{waitfor, ginput, kbhit}
+## @end deftypefn
+
+## The original version of this code bore the copyright
+## Author: Petr Mikulik
+## License: public domain
+
+function b = waitforbuttonpress ()
+
+  if (nargin != 0 || nargout > 1)
+    print_usage ();
+  endif
+
+  [x, y, k] = ginput (1);
+
+  if (nargout == 1)
+    if (k <= 5)
+      b = 0;
+    else
+      b = 1;
+    endif
+  endif
+
+endfunction
+
+
+%% Test input validation
+%!error waitforbuttonpress (1)
+%!error [a,b,c] = waitforbuttonpress ()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/help/__gripe_missing_component__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,56 @@
+## Copyright (C) 2013 Mike Miller
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} __gripe_missing_component__ (@var{caller}, @var{component})
+## Undocumented internal function.
+## @end deftypefn
+
+function __gripe_missing_component__ (caller, component)
+
+  if (nargin != 2)
+    print_usage ();
+  endif
+
+  msg = "";
+  fcn = missing_component_hook ();
+
+  ftype = exist (fcn);
+  if (ftype == 2 || ftype == 3 || ftype == 5 || ftype == 103)
+    msg = feval (fcn, component);
+  endif
+
+  if (isempty (msg))
+    switch (component)
+      case "info-file"
+        msg = "unable to find the Octave info manual, Octave installation is incomplete";
+      case "mkoctfile"
+        msg = "unable to find the mkoctfile command, Octave installation is incomplete";
+      case "octave"
+        msg = "unable to find the octave executable, Octave installation is incomplete";
+      case "octave-config"
+        msg = "unable to find the octave-config command, Octave installation is incomplete";
+      otherwise
+        msg = ["unable to find required Octave component \"" component "\""];
+    endswitch
+  endif
+
+  error ("%s: %s\n", caller, msg);
+
+endfunction
+
--- a/scripts/help/__makeinfo__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/__makeinfo__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -72,6 +72,9 @@
     error ("__makeinfo__: second input argument must be a string");
   endif
 
+  ## NOTE: The 3rd argument is used by Octave-Forge function
+  ##       generate_package_html, not by core Octave.  This functionality
+  ##       can only be removed when that function has been updated.
   if (nargin < 3)
     if (strcmpi (output_type, "plain text"))
       fsee_also = @(T) strcat ...
@@ -100,7 +103,7 @@
     error ("unable to open %s for reading", file);
   else
     macros_text = fread (fid, Inf, "*char")';
-    text = cstrcat (macros_text, text);
+    text = [macros_text text];
   endif
   fclose (fid);
 
--- a/scripts/help/__unimplemented__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/__unimplemented__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,59 +40,464 @@
 
   ## Some smarter cases, add more as needed.
   switch (fcn)
+    case {"avifile", "aviinfo", "aviread"}
+      txt = ["Basic video file support is provided in the video package.  ", ...
+             "See @url{http://octave.sf.net/video/}."];
 
-  case "quad2d"
-    txt = ["quad2d is not implemented.  Consider using dblquad."];
+    case "exifread"
+      txt = ["exifread is deprecated.  " ...
+             "The functionality is available in the imfinfo function."];
+
+    case "gsvd"
+      txt = ["gsvd is not currently part of core Octave.  ", ...
+             "See the linear-algebra package at ", ...
+             "@url{http://octave.sourceforge.net/linear-algebra/}."];
+
+    case "funm"
+      txt = ["funm is not currently part of core Octave.  ", ...
+             "See the linear-algebra package at ", ...
+             "@url{http://octave.sourceforge.net/linear-algebra/}."];
+
+    case "griddedInterpolant"
+      txt = ["griddedInterpolant is not implemented.  ", ...
+             "Consider using griddata."];
+
+    case "integral"
+      txt = ["Octave provides many routines for 1-D numerical integration.  ", ...
+             "Consider quadcc, quad, quadv, quadl, quadgk."];
+
+    case "integral2"
+      txt = ["integral2 is not implemented.  Consider using dblquad."];
 
-  case "gsvd"
-    txt = ["gsvd is not currently part of core Octave.  See the ",...
-    "linear-algebra package at ",...
-    "@url{http://octave.sourceforge.net/linear-algebra/}."];
+    case "integral3"
+      txt = ["integral3 is not implemented.  Consider using triplequad"];
+
+    case "linprog"
+      txt = ["Octave does not currently provide linprog.  ", ...
+             "Linear programming problems may be solved using @code{glpk}.  ", ...
+             "Try @code{help glpk} for more info."];
+
+    case "matlabrc"
+      txt = ["matlabrc is not implemented.  ", ...
+             'Octave uses the file ".octaverc" instead.'];
+
+    case {"ode113", "ode15i", "ode15s", "ode23", "ode23s", "ode23t", ...
+          "ode23tb", "ode45", "odeget", "odeset"}
+      txt = ["Octave provides lsode for solving differential equations.  ", ...
+             "For more information try @code{help lsode}.  ", ...
+             "Matlab-compatible ODE functions are provided by the odepkg ", ...
+             "package.  See @url{http://octave.sourceforge.net/odepkg/}."];
+
+    case "startup"
+      txt = ["startup is not implemented.  ", ...
+             'Octave uses the file ".octaverc" instead.'];
+
+    case "quad2d"
+      txt = ["quad2d is not implemented.  Consider using dblquad."];
+
+    case {"xlsread", "xlsfinfo", "xlswrite", "wk1read", "wk1finfo", "wk1write"}
+      txt = ["Functions for spreadsheet style I/O ", ...
+             "(.xls .xlsx .sxc .ods .dbf .wk1 etc.) " , ...
+             "are provided in the io package. ", ...
+             "See @url{http://octave.sf.net/io/}."];
 
-  case "funm"
-    txt = ["funm is not currently part of core Octave.  See the ",...
-    "linear-algebra package at @url{http://octave.sf.net/linear-algebra/}."];
+    ## control system
+    case {"absorbDelay", "allmargin", "append", "augstate", "balreal", ...
+          "balred", "balredOptions", "bandwidth", "bdschur", "bode", ...
+          "bodemag", "bodeoptions", "bodeplot", "c2d", "c2dOptions", ...
+          "canon", "care", "chgFreqUnit", "chgTimeUnit", "connect", ...
+          "connectOptions", "covar", "ctrb", "ctrbf", "ctrlpref", "d2c", ...
+          "d2cOptions", "d2d", "d2dOptions", "damp", "dare", "db2mag", ...
+          "dcgain", "delay2z", "delayss", "dlqr", "dlyap", "dlyapchol", ...
+          "drss", "dsort", "dss", "dssdata", "esort", "estim", "evalfr", ...
+          "feedback", "filt", "frd", "frdata", "freqresp", "gcare", "gdare", ...
+          "genfrd", "genmat", "gensig", "genss", "get", "getBlockValue", ...
+          "getDelayModel", "getGainCrossover", "getIOTransfer", ...
+          "getLFTModel", "getLoopTransfer", "getNominal", "getoptions", ...
+          "getPeakGain", "getSwitches", "getValue", "gram", "hasdelay", ...
+          "hasInternalDelay", "hsvd", "hsvdOptions", "hsvoptions", ...
+          "hsvplot", "imp2exp", "impulse", "impulseplot", "initial", ...
+          "initialplot", "iopzmap", "iopzplot", "isct", "isdt", "isempty", ...
+          "isfinite", "isParametric", "isproper", "isreal", "issiso", ...
+          "isstable", "isstatic", "kalman", "kalmd", "lft", "loopswitch", ...
+          "lqg", "lqgreg", "lqgtrack", "lqi", "lqr", "lqrd", "lqry", "lsim", ...
+          "lsiminfo", "lsimplot", "ltiview", "lyap", "lyapchol", "mag2db", ...
+          "margin", "minreal", "modred", "modsep", "nblocks", "ndims", ...
+          "ngrid", "nichols", "nicholsoptions", "nicholsplot", "nmodels", ...
+          "norm", "nyquist", "nyquistoptions", "nyquistplot", "obsv", ...
+          "obsvf", "order", "pade", "parallel", "permute", "pid", "piddata", ...
+          "pidstd", "pidstddata", "pidtool", "pidtune", "pidtuneOptions", ...
+          "place", "pole", "prescale", "pzmap", "pzoptions", "pzplot", ...
+          "realp", "reg", "replaceBlock", "repsys", "reshape", "rlocus", ...
+          "rlocusplot", "rss", "series", "set", "setBlockValue", ...
+          "setDelayModel", "setoptions", "setValue", "sgrid", ...
+          "showBlockValue", "showTunable", "sigma", "sigmaoptions", ...
+          "sigmaplot", "sisoinit", "sisotool", "size", "sminreal", "ss", ...
+          "ss2ss", "ssdata", "stabsep", "stabsepOptions", "stack", "step", ...
+          "stepDataOptions", "stepinfo", "stepplot", "sumblk", "tf", ...
+          "tfdata", "thiran", "timeoptions", "totaldelay", "tzero", ...
+          "updateSystem", "upsample", "xperm", "zero", "zgrid", "zpk", ...
+          "zpkdata"}
+      txt = check_package (fcn, "control");
 
-  case "linprog"
-    txt = ["Octave does not currently provide linprog.  ",...
-    "Linear programming problems may be solved using @code{glpk}.  ",...
-    "Try @code{help glpk} for more info."];
-
-  case {"ode113", "ode15i", "ode15s", "ode23", "ode23s", "ode23t", "ode45", "odeget", "odeset"}
-    txt = ["Octave provides lsode for solving differential equations.  ",...
-    "For more information try @code{help lsode}.  ",...
-    "Matlab-compatible ODE functions are provided by the odepkg package.  ",...
-    "See @url{http://octave.sourceforge.net/odepkg/}."];
+    ## communications
+    case {"algdeintrlv", "algintrlv", "alignsignals", "amdemod", "ammod", ...
+          "arithdeco", "arithenco", "awgn", "bchdec", "bchenc", ...
+          "bchgenpoly", "bchnumerr", "berawgn", "bercoding", "berconfint", ...
+          "berfading", "berfit", "bersync", "bertool", "bi2de", "bin2gray", ...
+          "biterr", "bsc", "cma", "commscope", "compand", "convdeintrlv", ...
+          "convenc", "convintrlv", "convmtx", "cosets", "cyclgen", ...
+          "cyclpoly", "de2bi", "decode", "deintrlv", "dfe", "dftmtx", ...
+          "distspec", "doppler", "dpcmdeco", "dpcmenco", "dpcmopt", ...
+          "dpskdemod", "dpskmod", "dvbs2ldpc", "encode", "equalize", ...
+          "eyediagram", "EyeScope", "finddelay", "fmdemod", "fmmod", ...
+          "fskdemod", "fskmod", "gaussdesign", "gen2par", "genqamdemod", ...
+          "genqammod", "gf", "gfadd", "gfconv", "gfcosets", "gfdeconv", ...
+          "gfdiv", "gffilter", "gflineq", "gfminpol", "gfmul", "gfpretty", ...
+          "gfprimck", "gfprimdf", "gfprimfd", "gfrank", "gfrepcov", ...
+          "gfroots", "gfsub", "gftable", "gftrunc", "gftuple", "gfweight", ...
+          "gray2bin", "hammgen", "heldeintrlv", "helintrlv", ...
+          "helscandeintrlv", "helscanintrlv", "huffmandeco", "huffmandict", ...
+          "huffmanenco", "intdump", "intrlv", "iscatastrophic", ...
+          "isprimitive", "istrellis", "legacychannelsim", "lineareq", ...
+          "lloyds", "lms", "log", "lteZadoffChuSeq", "marcumq", ...
+          "mask2shift", "matdeintrlv", "matintrlv", "minpol", "mldivide", ...
+          "mlseeq", "modnorm", "muxdeintrlv", "muxintrlv", "noisebw", ...
+          "normlms", "oct2dec", "oqpskdemod", "oqpskmod", "pamdemod", ...
+          "pammod", "pmdemod", "pmmod", "poly2trellis", "primpoly", ...
+          "pskdemod", "pskmod", "qamdemod", "qammod", "qfunc", "qfuncinv", ...
+          "quantiz", "randdeintrlv", "randerr", "randintrlv", "randsrc", ...
+          "rayleighchan", "rcosdesign", "rectpulse", "reset", "ricianchan", ...
+          "rls", "rsdec", "rsenc", "rsgenpoly", "rsgenpolycoeffs", ...
+          "scatterplot", "sdrexamples", "sdrfgensysace", "sdrfroot", ...
+          "sdrinfo", "sdrload", "sdrsetup", "semianalytic", "shift2mask", ...
+          "signlms", "ssbdemod", "ssbmod", "stdchan", ...
+          "supportPackageInstaller", "symerr", "syndtable", "varlms", ...
+          "vec2mat", "vitdec", "wgn"}
+      txt = check_package (fcn, "communications");
 
-  case {"javaArray", "javaMethod", "javaMethodEDT", "javaObject", "javaObjectEDT", "javaaddpath", "javaclasspath", "javarmpath"}
-    txt = ["Java objects and methods can be used with the java package. ",...
-    "See @url{http://octave.sf.net/java/}."];
-
-  case {"errordlg", "helpdlg", "inputdlg", "listdlg", "questdlg", "warndlg"}
-    txt = ["Several dialog functions are provided in the java package. ",...
-    "See @url{http://octave.sf.net/java/}."];
+    ## finance
+    case {"abs2active", "accrfrac", "acrubond", "acrudisc", "active2abs", ...
+          "addEquality", "addEquality", "addEquality", "addGroupRatio", ...
+          "addGroupRatio", "addGroupRatio", "addGroups", "addGroups", ...
+          "addGroups", "addInequality", "addInequality", "addInequality", ...
+          "adline", "adosc", "amortize", "annurate", "annuterm", ...
+          "arith2geom", "ascii2fts", "beytbill", "binprice", "blkimpv", ...
+          "blkprice", "blsdelta", "blsgamma", "blsimpv", "blslambda", ...
+          "blsprice", "blsrho", "blstheta", "blsvega", "bndconvp", ...
+          "bndconvy", "bnddurp", "bnddury", "bndkrdur", "bndprice", ...
+          "bndspread", "bndtotalreturn", "bndyield", "bolling", "bollinger", ...
+          "boxcox", "busdate", "busdays", "candle", "cdai", "cdprice", ...
+          "cdyield", "cfamounts", "cfbyzero", "cfconv", "cfdates", "cfdur", ...
+          "cfplot", "cfport", "cfprice", "cfspread", "cftimes", "cfyield", ...
+          "chaikosc", "chaikvolat", "chartfts", "checkFeasibility", ...
+          "checkFeasibility", "checkFeasibility", "chfield", "convert2sur", ...
+          "convertto", "corr2cov", "cov2corr", "cpncount", "cpndaten", ...
+          "cpndatenq", "cpndatep", "cpndaysp", "cpnpersz", "createholidays", ...
+          "cumsum", "cur2frac", "cur2str", "date2time", "dateaxis", ...
+          "datedisp", "datefind", "datemnth", "datewrkdy", "day", "days360", ...
+          "days360e", "days360isda", "days360psa", "days365", "daysact", ...
+          "daysadd", "daysdif", "dec2thirtytwo", "depfixdb", "depgendb", ...
+          "deprdv", "depsoyd", "depstln", "diff", "disc2zero", "discrate", ...
+          "ecmmvnrfish", "ecmmvnrmle", "ecmmvnrobj", "ecmmvnrstd", ...
+          "ecmnfish", "ecmnhess", "ecmninit", "ecmnmle", "ecmnobj", ...
+          "ecmnstd", "effrr", "elpm", "emaxdrawdown", "end", "eomdate", ...
+          "estimateAssetMoments", "estimateBounds", "estimateBounds", ...
+          "estimateBounds", "estimateFrontier", "estimateFrontier", ...
+          "estimateFrontier", "estimateFrontierByReturn", ...
+          "estimateFrontierByReturn", "estimateFrontierByReturn", ...
+          "estimateFrontierByRisk", "estimateFrontierByRisk", ...
+          "estimateFrontierByRisk", "estimateFrontierLimits", ...
+          "estimateFrontierLimits", "estimateFrontierLimits", ...
+          "estimateMaxSharpeRatio", "estimatePortMoments", ...
+          "estimatePortReturn", "estimatePortReturn", "estimatePortReturn", ...
+          "estimatePortRisk", "estimatePortRisk", "estimatePortRisk", ...
+          "estimatePortStd", "estimatePortStd", "estimatePortVaR", ...
+          "estimateScenarioMoments", "estimateScenarioMoments", "ewstats", ...
+          "exp", "extfield", "fbusdate", "fetch", "fieldnames", "fillts", ...
+          "fints", "floatdiscmargin", "floatmargin", "fpctkd", "frac2cur", ...
+          "freqnum", "freqstr", "frontcon", "frontier", "fts2ascii", ...
+          "fts2mat", "ftsbound", "ftsgui", "ftsinfo", "ftstool", "ftsuniq", ...
+          "fvdisc", "fvfix", "fvvar", "fwd2zero", "geom2arith", ...
+          "getAssetMoments", "getBounds", "getBounds", "getBounds", ...
+          "getBudget", "getBudget", "getBudget", "getCosts", "getCosts", ...
+          "getCosts", "getEquality", "getEquality", "getEquality", ...
+          "getGroupRatio", "getGroupRatio", "getGroupRatio", "getGroups", ...
+          "getGroups", "getGroups", "getInequality", "getInequality", ...
+          "getInequality", "getnameidx", "getOneWayTurnover", ...
+          "getOneWayTurnover", "getOneWayTurnover", "getScenarios", ...
+          "getScenarios", "hhigh", "highlow", "holdings2weights", ...
+          "holidays", "horzcat", "hour", "inforatio", "irr", "isbusday", ...
+          "iscompatible", "isempty", "isfield", "issorted", "kagi", "lagts", ...
+          "lbusdate", "leadts", "length", "linebreak", "llow", "log", ...
+          "log10", "log2", "lpm", "lweekdate", "m2xdate", "macd", ...
+          "maxdrawdown", "medprice", "merge", "minus", "minute", "mirr", ...
+          "month", "months", "movavg", "mrdivide", "mtimes", "mvnrfish", ...
+          "mvnrmle", "mvnrobj", "mvnrstd", "nancov", "nanmax", "nanmean", ...
+          "nanmedian", "nanmin", "nanstd", "nansum", "nanvar", "negvolidx", ...
+          "nomrr", "nweekdate", "nyseclosures", "onbalvol", "opprofit", ...
+          "payadv", "payodd", "payper", "payuni", "pcalims", "pcgcomp", ...
+          "pcglims", "pcpval", "peravg", "periodicreturns", "plotFrontier", ...
+          "plotFrontier", "plotFrontier", "plus", "pointfig", "portalloc", ...
+          "portalpha", "portcons", "Portfolio", "PortfolioCVaR", ...
+          "PortfolioMAD", "portopt", "portrand", "portror", "portsim", ...
+          "portstats", "portvar", "portvrisk", "posvolidx", "power", ...
+          "prbyzero", "prcroc", "prdisc", "priceandvol", "prmat", "prtbill", ...
+          "pvfix", "pvtrend", "pvvar", "pyld2zero", "rdivide", "renko", ...
+          "resamplets", "ret2tick", "rmfield", "rsindex", "selectreturn", ...
+          "setAssetList", "setAssetList", "setAssetList", "setAssetMoments", ...
+          "setBounds", "setBounds", "setBounds", "setBudget", "setBudget", ...
+          "setBudget", "setCosts", "setCosts", "setCosts", ...
+          "setDefaultConstraints", "setDefaultConstraints", ...
+          "setDefaultConstraints", "setEquality", "setEquality", ...
+          "setEquality", "setGroupRatio", "setGroupRatio", "setGroupRatio", ...
+          "setGroups", "setGroups", "setGroups", "setInequality", ...
+          "setInequality", "setInequality", "setInitPort", "setInitPort", ...
+          "setInitPort", "setOneWayTurnover", "setOneWayTurnover", ...
+          "setOneWayTurnover", "setProbabilityLevel", "setScenarios", ...
+          "setScenarios", "setSolver", "setSolver", "setSolver", ...
+          "setTurnover", "setTurnover", "setTurnover", "sharpe", ...
+          "simulateNormalScenariosByData", "simulateNormalScenariosByData", ...
+          "simulateNormalScenariosByMoments", ...
+          "simulateNormalScenariosByMoments", "size", "smoothts", "sortfts", ...
+          "spctkd", "stochosc", "subsasgn", "subsref", "targetreturn", ...
+          "taxedrr", "tbilldisc2yield", "tbillprice", "tbillrepo", ...
+          "tbillval01", "tbillyield", "tbillyield2disc", "tbl2bond", ...
+          "thirdwednesday", "thirtytwo2dec", "tick2ret", "time2date", ...
+          "times", "toannual", "todaily", "today", "todecimal", "tomonthly", ...
+          "toquarterly", "toquoted", "tosemi", "totalreturnprice", ...
+          "toweekly", "tr2bonds", "transprob", "transprobbytotals", ...
+          "transprobfromthresholds", "transprobgrouptotals", ...
+          "transprobprep", "transprobtothresholds", "tsaccel", "tsmom", ...
+          "tsmovavg", "typprice", "ugarch", "ugarchllf", "ugarchpred", ...
+          "ugarchsim", "uicalendar", "uminus", "uplus", "vertcat", ...
+          "volarea", "volroc", "wclose", "weeknum", "weights2holdings", ...
+          "willad", "willpctr", "wrkdydif", "x2mdate", "xirr", "year", ...
+          "yeardays", "yearfrac", "ylddisc", "yldmat", "yldtbill", ...
+          "zbtprice", "zbtyield", "zero2disc", "zero2fwd", "zero2pyld"}
+      txt = check_package (fcn, "financial");
 
-  case {"xlsread", "xlsfinfo", "xlswrite", "wk1read", "wk1finfo", "wk1write"}
-    txt = ["Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1 etc.) " , ...
-    "are provided in the io package. ",...
-    "See @url{http://octave.sf.net/io/}."];
+    ## image processing
+    case {"activecontour", "adapthisteq", "affine2d", "affine3d", ...
+          "analyze75info", "analyze75read", "applycform", "applylut", ...
+          "axes2pix", "bestblk", "blockproc", "bwarea", "bwareaopen", ...
+          "bwboundaries", "bwconncomp", "bwconvhull", "bwdist", ...
+          "bwdistgeodesic", "bweuler", "bwhitmiss", "bwlabel", "bwlabeln", ...
+          "bwlookup", "bwmorph", "bwpack", "bwperim", "bwselect", ...
+          "bwtraceboundary", "bwulterode", "bwunpack", "checkerboard", ...
+          "col2im", "colfilt", "conndef", "convmtx2", "corner", ...
+          "cornermetric", "corr2", "cp2tform", "cpcorr", "cpselect", ...
+          "cpstruct2pairs", "dct2", "dctmtx", "deconvblind", "deconvlucy", ...
+          "deconvreg", "deconvwnr", "decorrstretch", "demosaic", ...
+          "dicomanon", "dicomdict", "dicominfo", "dicomlookup", "dicomread", ...
+          "dicomuid", "dicomwrite", "edge", "edgetaper", "entropy", ...
+          "entropyfilt", "fan2para", "fanbeam", "findbounds", "fitgeotrans", ...
+          "fliptform", "freqz2", "fsamp2", "fspecial", "ftrans2", "fwind1", ...
+          "fwind2", "getheight", "getimage", "getimagemodel", "getline", ...
+          "getneighbors", "getnhood", "getpts", "getrect", "getsequence", ...
+          "graycomatrix", "graycoprops", "graydist", "grayslice", ...
+          "graythresh", "hdrread", "hdrwrite", "histeq", "hough", ...
+          "houghlines", "houghpeaks", "iccfind", "iccread", "iccroot", ...
+          "iccwrite", "idct2", "ifanbeam", "im2bw", "im2col", "im2double", ...
+          "im2int16", "im2java2d", "im2single", "im2uint16", "im2uint8", ...
+          "imabsdiff", "imadd", "imadjust", "ImageAdapter", "imageinfo", ...
+          "imapplymatrix", "imapprox", "imattributes", "imbothat", ...
+          "imclearborder", "imclose", "imcolormaptool", "imcomplement", ...
+          "imcontour", "imcontrast", "imcrop", "imdilate", "imdisplayrange", ...
+          "imdistline", "imdivide", "imellipse", "imerode", "imextendedmax", ...
+          "imextendedmin", "imfill", "imfilter", "imfindcircles", ...
+          "imfreehand", "imfuse", "imgca", "imgcf", "imgetfile", ...
+          "imgradient", "imgradientxy", "imhandles", "imhist", ...
+          "imhistmatch", "imhmax", "imhmin", "imimposemin", "imlincomb", ...
+          "imline", "immagbox", "immovie", "immultiply", "imnoise", ...
+          "imopen", "imoverview", "imoverviewpanel", "impixel", ...
+          "impixelinfo", "impixelinfoval", "impixelregion", ...
+          "impixelregionpanel", "implay", "impoint", "impoly", "improfile", ...
+          "impyramid", "imquantize", "imreconstruct", "imrect", "imref2d", ...
+          "imref3d", "imregconfig", "imregionalmax", "imregionalmin", ...
+          "imregister", "imregtform", "imresize", "imroi", "imrotate", ...
+          "imsave", "imscrollpanel", "imsharpen", "imshowpair", ...
+          "imsubtract", "imtool", "imtophat", "imtransform", "imwarp", ...
+          "interfileinfo", "interfileread", "intlut", "iptaddcallback", ...
+          "iptcheckconn", "iptcheckhandle", "iptgetapi", ...
+          "iptGetPointerBehavior", "iptgetpref", "ipticondir", ...
+          "iptPointerManager", "iptprefs", "iptremovecallback", ...
+          "iptSetPointerBehavior", "iptsetpref", "iptwindowalign", "iradon", ...
+          "isflat", "isicc", "isrset", "lab2double", "lab2uint16", ...
+          "lab2uint8", "label2rgb", "labelmatrix", "makecform", ...
+          "makeConstrainToRectFcn", "makehdr", "makelut", "makeresampler", ...
+          "maketform", "mat2gray", "mean2", "medfilt2", "montage", ...
+          "multithresh", "nitfinfo", "nitfread", "nlfilter", "normxcorr2", ...
+          "openrset", "ordfilt2", "otf2psf", "padarray", "para2fan", ...
+          "phantom", "poly2mask", "projective2d", "psf2otf", "qtdecomp", ...
+          "qtgetblk", "qtsetblk", "radon", "rangefilt", "reflect", ...
+          "regionprops", "rgb2gray", "rgb2ycbcr", "roicolor", "roifill", ...
+          "roifilt2", "roipoly", "rsetwrite", "std2", "stdfilt", "strel", ...
+          "stretchlim", "subimage", "tformarray", "tformfwd", "tforminv", ...
+          "tonemap", "translate", "truesize", "viscircles", "warp", ...
+          "watershed", "whitepoint", "wiener2", "xyz2double", "xyz2uint16", ...
+          "ycbcr2rgb"}
+      txt = check_package (fcn, "image");
+
+    ## signal processing
+    case {"ac2poly", "ac2rc", "angle", "arburg", "arcov", "armcov", ...
+          "aryule", "bandpower", "barthannwin", "besselap", "besself", ...
+          "bilinear", "bitrevorder", "blackmanharris", "bohmanwin", ...
+          "buffer", "buttap", "butter", "buttord", "cceps", "cconv", ...
+          "cell2sos", "cfirpm", "cheb1ap", "cheb1ord", "cheb2ap", ...
+          "cheb2ord", "chebwin", "cheby1", "cheby2", "chirp", "convmtx", ...
+          "corrmtx", "cpsd", "czt", "db", "db2mag", "db2pow", "dct", ...
+          "decimate", "demod", "design", "designmethods", "designopts", ...
+          "dfilt", "dftmtx", "digitrevorder", "diric", "downsample", "dpss", ...
+          "dpssclear", "dpssdir", "dpssload", "dspdata", "dspfwiz", ...
+          "dutycycle", "ellip", "ellipap", "ellipord", "enbw", "equiripple", ...
+          "falltime", "fdatool", "fdesign", "filt2block", "filterbuilder", ...
+          "filternorm", "filtfilt", "filtic", "filtord", "findpeaks", ...
+          "fir1", "fir2", "fircls", "fircls1", "firls", "firpm", "firpmord", ...
+          "firrcos", "firtype", "flattopwin", "freqs", "freqsamp", "fvtool", ...
+          "fwht", "gauspuls", "gaussdesign", "gaussfir", "gausswin", ...
+          "gmonopuls", "goertzel", "grpdelay", "hann", "hilbert", "icceps", ...
+          "idct", "ifwht", "impinvar", "impz", "impzlength", "interp", ...
+          "intfilt", "invfreqs", "invfreqz", "is2rc", "isallpass", ...
+          "islinphase", "ismaxphase", "isminphase", "isstable", "kaiser", ...
+          "kaiserord", "kaiserwin", "lar2rc", "latc2tf", "latcfilt", ...
+          "levinson", "lp2bp", "lp2bs", "lp2hp", "lp2lp", "lpc", "lsf2poly", ...
+          "mag2db", "marcumq", "maxflat", "medfilt1", "midcross", ...
+          "modulate", "mscohere", "nuttallwin", "overshoot", "parzenwin", ...
+          "pburg", "pcov", "peak2peak", "peak2rms", "peig", "phasedelay", ...
+          "phasez", "pmcov", "pmtm", "pmusic", "poly2ac", "poly2lsf", ...
+          "poly2rc", "polyscale", "polystab", "pow2db", "prony", ...
+          "pulseperiod", "pulsesep", "pulsewidth", "pulstran", "pwelch", ...
+          "pyulear", "rc2ac", "rc2is", "rc2lar", "rc2poly", "rceps", ...
+          "rcosdesign", "realizemdl", "rectpuls", "rectwin", "resample", ...
+          "residuez", "risetime", "rlevinson", "rms", "rooteig", ...
+          "rootmusic", "rssq", "sawtooth", "schurrc", "seqperiod", ...
+          "setspecs", "settlingtime", "sfdr", "sgolay", "sgolayfilt", ...
+          "shiftdata", "sigwin", "sinad", "slewrate", "snr", "sos2cell", ...
+          "sos2ss", "sos2tf", "sos2zp", "sosfilt", "spectrogram", ...
+          "spectrum", "sptool", "square", "ss2sos", "ss2tf", "ss2zp", ...
+          "statelevels", "stepz", "stmcb", "strips", "taylorwin", "tf2latc", ...
+          "tf2sos", "tf2ss", "tf2zp", "tf2zpk", "tfestimate", "thd", "toi", ...
+          "triang", "tripuls", "tukeywin", "udecode", "uencode", ...
+          "undershoot", "unshiftdata", "upfirdn", "upsample", ...
+          "validstructures", "vco", "window", "wintool", "wvtool", "xcorr", ...
+          "xcorr2", "xcov", "yulewalk", "zerophase", "zp2sos", "zp2ss", ...
+          "zp2tf", "zplane"}
+      txt = check_package (fcn, "signal");
 
-  case {"avifile", "aviinfo", "aviread"}
-    txt = ["Basic video file support is provided in the video package. ",...
-    "See @url{http://octave.sf.net/video/}."];
+    ## statistics
+    case {"addedvarplot", "addlevels", "addTerms", "addTerms", "adtest", ...
+          "andrewsplot", "anova1", "anova2", "anovan", "ansaribradley", ...
+          "aoctool", "barttest", "bbdesign", "betafit", "betalike", ...
+          "betastat", "binofit", "binostat", "biplot", "bootci", "bootstrp", ...
+          "boxplot", "candexch", "candgen", "canoncorr", "capability", ...
+          "capaplot", "caseread", "casewrite", "ccdesign", "cdf", "cdf", ...
+          "cdfplot", "cell2dataset", "chi2gof", "chi2stat", "cholcov", ...
+          "ClassificationBaggedEnsemble", "ClassificationDiscriminant", ...
+          "ClassificationEnsemble", "ClassificationKNN", ...
+          "ClassificationPartitionedEnsemble", ...
+          "ClassificationPartitionedModel", "ClassificationTree", ...
+          "classify", "classregtree", "cluster", "clusterdata", "cmdscale", ...
+          "coefCI", "coefCI", "coefCI", "coefCI", "coefTest", "coefTest", ...
+          "coefTest", "coefTest", "combnk", "compact", ...
+          "CompactClassificationDiscriminant", ...
+          "CompactClassificationEnsemble", "CompactClassificationTree", ...
+          "CompactRegressionEnsemble", "CompactRegressionTree", ...
+          "CompactTreeBagger", "compare", "confusionmat", "controlchart", ...
+          "controlrules", "cophenet", "copulacdf", "copulafit", ...
+          "copulaparam", "copulapdf", "copularnd", "copulastat", "cordexch", ...
+          "corrcov", "covarianceParameters", "coxphfit", "createns", ...
+          "crosstab", "crossval", "cvpartition", "datasample", "dataset", ...
+          "dataset2cell", "dataset2struct", "dataset2table", "datasetfun", ...
+          "daugment", "dcovary", "dendrogram", "designMatrix", ...
+          "devianceTest", "dfittool", "disp", "disp", "disp", "disp", ...
+          "disttool", "droplevels", "dummyvar", "dwtest", "dwtest", "ecdf", ...
+          "ecdfhist", "evalclusters", "evcdf", "evfit", "evinv", "evlike", ...
+          "evpdf", "evrnd", "evstat", "ExhaustiveSearcher", "expfit", ...
+          "explike", "export", "expstat", "factoran", "feval", "feval", ...
+          "feval", "ff2n", "fitdist", "fitensemble", "fitglm", "fitlm", ...
+          "fitlme", "fitlmematrix", "fitnlm", "fitted", "fixedEffects", ...
+          "fracfact", "fracfactgen", "friedman", "fsurfht", "fullfact", ...
+          "gagerr", "gamfit", "gamlike", "gamstat", ...
+          "GeneralizedLinearModel", "geomean", "geostat", "getlabels", ...
+          "getlevels", "gevcdf", "gevfit", "gevinv", "gevlike", "gevpdf", ...
+          "gevrnd", "gevstat", "gline", "glmfit", "glmval", "glyphplot", ...
+          "gmdistribution", "gname", "gpcdf", "gpfit", "gpinv", "gplike", ...
+          "gplotmatrix", "gppdf", "gprnd", "gpstat", "grp2idx", "grpstats", ...
+          "gscatter", "haltonset", "harmmean", "hist3", "histfit", ...
+          "hmmdecode", "hmmestimate", "hmmgenerate", "hmmtrain", ...
+          "hmmviterbi", "hougen", "hygestat", "icdf", "icdf", ...
+          "inconsistent", "interactionplot", "invpred", "islevel", ...
+          "ismissing", "isundefined", "iwishrnd", "jackknife", "jbtest", ...
+          "johnsrnd", "join", "KDTreeSearcher", "kmeans", "knnsearch", ...
+          "kruskalwallis", "ksdensity", "kstest", "kstest2", "labels", ...
+          "lasso", "lassoglm", "lassoPlot", "levelcounts", "leverage", ...
+          "lhsdesign", "lhsnorm", "lillietest", "LinearMixedModel", ...
+          "LinearModel", "linhyptest", "linkage", "lognfit", "lognlike", ...
+          "lognstat", "lsline", "mad", "mahal", "maineffectsplot", ...
+          "makedist", "manova1", "manovacluster", "mat2dataset", "mdscale", ...
+          "mergelevels", "mhsample", "mle", "mlecov", "mnpdf", "mnrfit", ...
+          "mnrnd", "mnrval", "multcompare", "multivarichart", "mvncdf", ...
+          "mvnpdf", "mvnrnd", "mvregress", "mvregresslike", "mvtcdf", ...
+          "mvtpdf", "mvtrnd", "NaiveBayes", "nancov", "nanmax", "nanmean", ...
+          "nanmedian", "nanmin", "nanstd", "nansum", "nanvar", "nbinfit", ...
+          "nbinstat", "ncfcdf", "ncfinv", "ncfpdf", "ncfrnd", "ncfstat", ...
+          "nctcdf", "nctinv", "nctpdf", "nctrnd", "nctstat", "ncx2cdf", ...
+          "ncx2inv", "ncx2pdf", "ncx2rnd", "ncx2stat", "negloglik", ...
+          "negloglik", "nlinfit", "nlintool", "nlmefit", "nlmefitsa", ...
+          "nlparci", "nlpredci", "nnmf", "nominal", "NonLinearModel", ...
+          "normfit", "normlike", "normplot", "normspec", "normstat", ...
+          "optimalleaforder", "ordinal", "parallelcoords", "paramci", ...
+          "paretotails", "partialcorr", "partialcorri", "pca", "pcacov", ...
+          "pcares", "pdf", "pdf", "pdist", "pdist2", "pearsrnd", ...
+          "perfcurve", "plotAdded", "plotAdjustedResponse", ...
+          "plotDiagnostics", "plotDiagnostics", "plotDiagnostics", ...
+          "plotEffects", "plotInteraction", "plotResiduals", ...
+          "plotResiduals", "plotResiduals", "plotResiduals", "plotSlice", ...
+          "plotSlice", "plotSlice", "plsregress", "poissfit", "poisstat", ...
+          "polyconf", "polytool", "ppca", "predict", "predict", "predict", ...
+          "predict", "predict", "predict", "predict", "predict", "princomp", ...
+          "ProbDistUnivKernel", "ProbDistUnivParam", "probplot", ...
+          "procrustes", "proflik", "qrandset", "qrandstream", "random", ...
+          "random", "random", "random", "random", "random", "randomEffects", ...
+          "randsample", "randtool", "rangesearch", "ranksum", "raylcdf", ...
+          "raylfit", "raylinv", "raylpdf", "raylrnd", "raylstat", "rcoplot", ...
+          "refcurve", "refline", "regress", "RegressionBaggedEnsemble", ...
+          "RegressionEnsemble", "RegressionPartitionedEnsemble", ...
+          "RegressionPartitionedModel", "RegressionTree", "regstats", ...
+          "relieff", "removeTerms", "removeTerms", "residuals", "response", ...
+          "ridge", "robustdemo", "robustfit", "rotatefactors", "rowexch", ...
+          "rsmdemo", "rstool", "runstest", "sampsizepwr", "scatterhist", ...
+          "sequentialfs", "setlabels", "signrank", "signtest", "silhouette", ...
+          "slicesample", "sobolset", "squareform", "statget", "statset", ...
+          "step", "step", "stepwise", "stepwisefit", "stepwiseglm", ...
+          "stepwiselm", "struct2dataset", "surfht", "svmclassify", ...
+          "svmtrain", "table2dataset", "tabulate", "tblread", "tblwrite", ...
+          "tdfread", "tiedrank", "TreeBagger", "trimmean", "truncate", ...
+          "tstat", "ttest", "ttest2", "unidstat", "unifit", "unifstat", ...
+          "vartest", "vartest2", "vartestn", "wblfit", "wbllike", "wblplot", ...
+          "wblstat", "wishrnd", "x2fx", "xlsread", "xptread", "ztest"}
+      txt = check_package (fcn, "statistics");
 
-  otherwise
-    if (ismember (fcn, missing_functions ()))
-      txt = sprintf ("the '%s' function is not yet implemented in Octave", fcn);
-    else
-      is_matlab_function = false;
-      txt = "";
-    endif
+    ## optimization
+    case {"bintprog", "color", "fgoalattain", "fmincon", "fminimax", ...
+          "fminsearch", "fseminf", "fzmult", "gangstr", "ktrlink", ...
+          "linprog", "lsqcurvefit", "lsqlin", "lsqnonlin", "optimoptions", ...
+          "optimtool", "quadprog"}
+      txt = check_package (fcn, "optim");
+
+    otherwise
+      if (ismember (fcn, missing_functions ()))
+        txt = ["the '" fcn "' function is not yet implemented in Octave"];
+      else
+        is_matlab_function = false;
+        txt = "";
+      endif
   endswitch
 
   if (is_matlab_function)
-    txt = [txt, "\n\n@noindent\nPlease read ",...
-           "@url{http://www.octave.org/missing.html} to learn how ",...
+    txt = [txt, "\n\n@noindent\nPlease read ", ...
+           "@url{http://www.octave.org/missing.html} to learn how ", ...
            "you can contribute missing functionality."];
     txt = __makeinfo__ (txt);
   endif
@@ -103,24 +508,43 @@
 
 endfunction
 
+function txt = check_package (fcn, name)
+  txt = sprintf ("the '%s' function belongs to the %s package from Octave Forge",
+                 fcn, name);
+
+  [~, status] = pkg ("describe", name);
+  switch (tolower (status{1}))
+    case "loaded",
+      txt = sprintf ("%s but has not yet been implemented.", txt);
+    case "not loaded",
+      txt = sprintf (["%s which you have installed but not loaded. To ", ...
+                      "load the package, run `pkg load %s' from the ", ...
+                      "Octave prompt."], txt, name);
+    otherwise
+      ## this includes "not installed" and anything else if pkg changes
+      ## the output of describe
+      txt = sprintf ("%s which seems to not be installed in your system.", txt);
+  endswitch
+endfunction
+
 function list = missing_functions ()
   persistent list = {
-  "DelaunayTri",
   "MException",
   "RandStream",
-  "TriRep",
-  "TriScatteredInterp",
+  "Tiff",
+  "VideoReader",
+  "VideoWriter",
   "align",
   "alim",
   "alpha",
   "alphamap",
   "annotation",
   "audiodevinfo",
+  "audioinfo",
   "audioplayer",
+  "audioread",
   "audiorecorder",
-  "aufinfo",
-  "auread",
-  "auwrite",
+  "audiowrite",
   "bar3",
   "bar3h",
   "bench",
@@ -155,50 +579,50 @@
   "cdfwrite",
   "cellplot",
   "checkin",
+  "checkcode",
   "checkout",
   "cholinc",
   "clearvars",
   "clipboard",
   "cmopts",
-  "cmpermute",
-  "cmunique",
   "colordef",
   "colormapeditor",
   "commandhistory",
   "commandwindow",
   "condeig",
   "coneplot",
+  "containers.Map",
   "contourslice",
   "createClassFromWsdl",
   "createSoapMessage",
   "customverctrl",
-  "daqread",
   "datacursormode",
-  "datatipinfo",
   "dbmex",
   "dde23",
   "ddeget",
+  "ddensd",
   "ddesd",
   "ddeset",
   "decic",
+  "delaunayTriangulation",
   "depdir",
   "depfun",
   "deval",
   "dialog",
   "dither",
-  "docopt",
   "docsearch",
   "dragrect",
   "dynamicprops",
   "echodemo",
   "evalc",
-  "exifread",
   "export2wsdlg",
   "figurepalette",
   "filebrowser",
   "fill3",
+  "fitsdisp",
   "fitsinfo",
   "fitsread",
+  "fitswrite",
   "flow",
   "frame2im",
   "freqspace",
@@ -206,41 +630,44 @@
   "gammaincinv",
   "getframe",
   "getpixelposition",
+  "gobjects",
   "grabcode",
   "graymon",
+  "griddedInterpolant",
   "gsvd",
   "guidata",
   "guide",
   "guihandles",
   "handle",
-  "hdf",
-  "hdf5",
-  "hdf5info",
-  "hdf5read",
-  "hdf5write",
+  "h5create",
+  "h5disp",
+  "h5info",
+  "h5read",
+  "h5readatt",
+  "h5write",
+  "h5writeatt",
   "hdfinfo",
   "hdfread",
-  "hdftool",
-  "helpbrowser",
-  "helpdesk",
-  "helpwin",
   "hgexport",
   "hgload",
   "hgsave",
   "hgsetget",
   "hgtransform",
-  "hostid",
+  "ichol",
   "ilu",
   "im2frame",
   "im2java",
   "imapprox",
-  "imformats",
   "import",
   "inmem",
   "inputParser",
   "inspect",
+  "instrcallback",
   "instrfind",
   "instrfindall",
+  "integral",
+  "integral2",
+  "integral3",
   "interpstreamspeed",
   "iscom",
   "isinterface",
@@ -259,32 +686,37 @@
   "lighting",
   "linkaxes",
   "linkdata",
-  "linsolve",
   "listfonts",
   "loadlibrary",
   "lscov",
   "lsqr",
   "makehgtform",
   "material",
+  "matfile",
   "matlabrc",
-  "maxNumCompThreads",
   "memmapfile",
   "memory",
   "metaclass",
   "methodsview",
   "minres",
-  "mlint",
   "mlintrpt",
   "mmfileinfo",
-  "mmreader",
   "movegui",
   "movie",
   "movie2avi",
-  "msgbox",
   "multibandread",
   "multibandwrite",
   "native2unicode",
+  "nccreate",
+  "ncdisp",
+  "ncinfo",
+  "ncread",
+  "ncreadatt",
+  "ncwrite",
+  "ncwriteatt",
+  "ncwriteschema",
   "noanimate",
+  "notebook",
   "ode113",
   "ode15i",
   "ode15s",
@@ -293,7 +725,6 @@
   "ode23t",
   "ode23tb",
   "ode45",
-  "odefile",
   "odeget",
   "odeset",
   "odextend",
@@ -305,38 +736,37 @@
   "ordqz",
   "ordschur",
   "padecoef",
-  "pagesetupdlg",
   "pan",
   "parseSoapResponse",
-  "path2rc",
   "pathtool",
   "pcode",
   "pdepe",
   "pdeval",
-  "playshow",
   "plotbrowser",
   "plotedit",
   "plottools",
-  "prefdir",
-  "preferences",
   "printdlg",
   "printopt",
   "printpreview",
   "profsave",
   "propedit",
   "propertyeditor",
+  "psi",
   "publish",
   "qmr",
   "quad2d",
   "rbbox",
   "reducepatch",
   "reducevolume",
-  "root",
+  "readasync",
+  "rng",
   "rotate",
   "rotate3d",
+  "scatteredInterpolant",
   "selectmoveresize",
   "sendmail",
   "serial",
+  "serialbreak",
   "setpixelposition",
   "showplottool",
   "smooth3",
@@ -344,6 +774,8 @@
   "sound",
   "soundsc",
   "ss2tf",
+  "startup",
+  "stopasync",
   "stream2",
   "stream3",
   "streamline",
@@ -354,7 +786,6 @@
   "strings",
   "subvolume",
   "superclasses",
-  "support",
   "surf2patch",
   "symmlq",
   "syntax",
@@ -362,10 +793,10 @@
   "textwrap",
   "tfqmr",
   "timer",
-  "timerfind",
-  "timerfindall",
   "timeseries",
+  "todatenum",
   "toolboxdir",
+  "triangulation",
   "tscollection",
   "tstool",
   "uibuttongroup",
@@ -392,19 +823,15 @@
   "unmesh",
   "userpath",
   "validateattributes",
+  "verctrl",
   "verLessThan",
   "viewmtx",
   "visdiff",
   "volumebounds",
-  "waitfor",
-  "wavfinfo",
-  "wavplay",
-  "wavrecord",
   "web",
   "whatsnew",
-  "wk1finfo",
-  "wk1read",
-  "wk1write",
+  "winopen",
+  "winqueryreg",
   "workspace",
   "xmlread",
   "xmlwrite",
@@ -421,3 +848,4 @@
 %! assert (str(1:51), "quad2d is not implemented.  Consider using dblquad.");
 %! str = __unimplemented__ ("MException");
 %! assert (str(1:58), "the 'MException' function is not yet implemented in Octave");
+
--- a/scripts/help/doc.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/doc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2012 Søren Hauberg
+## Copyright (C) 2005-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -53,53 +53,64 @@
       fname = "";
     endif
 
-    if (ftype == 2 || ftype == 3)
-      ffile = which (fname);
-    else
-      ffile = "";
-    endif
-
-    if (isempty (ffile))
-      info_dir = octave_config_info ("infodir");
+    ## if GUI is running, let it display the function
+    if isguirunning ()
+      __octave_link_show_doc__ (fname);
     else
-      info_dir = fileparts (ffile);
-    endif
-
-    ## Determine if a file called doc.info exist in the same
-    ## directory as the function.
+  
+      if (ftype == 2 || ftype == 3)
+        ffile = which (fname);
+      else
+        ffile = "";
+      endif
 
-    info_file_name = fullfile (info_dir, "doc.info");
-
-    [stat_info, err] = stat (info_file_name);
+      if (isempty (ffile))
+        info_dir = octave_config_info ("infodir");
+      else
+        info_dir = fileparts (ffile);
+      endif
 
-    if (err < 0)
-      info_file_name = info_file ();
-    endif
+      ## Determine if a file called doc.info exist in the same
+      ## directory as the function.
+
+      info_file_name = fullfile (info_dir, "doc.info");
+
+      [stat_info, err] = stat (info_file_name);
+
+      if (err < 0)
+        info_file_name = info_file ();
 
-    ## FIXME -- don't change the order of the arguments below because
-    ## the info-emacs-info script currently expects --directory DIR as
-    ## the third and fourth arguments.  Someone should fix that.
+        if (! exist (info_file_name, "file"))
+          __gripe_missing_component__ ("doc", "info-file");
+        endif
+      endif
+
+      ## FIXME -- don't change the order of the arguments below because
+      ## the info-emacs-info script currently expects --directory DIR as
+      ## the third and fourth arguments.  Someone should fix that.
+
+      cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"",
+                     info_program (), info_file_name, info_dir);
+
+      have_fname = ! isempty (fname);
 
-    cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"",
-                   info_program (), info_file_name, info_dir);
+      if (have_fname)
+        status = system (sprintf ("%s --index-search \"%s\"", cmd, fname));
+      endif
+   
 
-    have_fname = ! isempty (fname);
+      if (! (have_fname && status == 0))
+        status = system (cmd);
+        if (status == 127)
+          warning ("unable to find info program '%s'", info_program ());
+        endif
+      endif
 
-    if (have_fname)
-      status = system (sprintf ("%s --index-search \"%s\"", cmd, fname));
+      if (nargout > 0)
+        retval = status;
+      endif
+
     endif
-
-    if (! (have_fname && status == 0))
-      status = system (cmd);
-      if (status == 127)
-        warning ("unable to find info program '%s'", info_program ());
-      endif
-    endif
-
-    if (nargout > 0)
-      retval = status;
-    endif
-
   else
     print_usage ();
   endif
--- a/scripts/help/doc_cache_create.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/doc_cache_create.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -42,7 +42,7 @@
   if (isempty (directory))
     cache = gen_builtin_cache ();
   elseif (iscell (directory))
-    if (all (cellfun (@ischar, directory)))
+    if (all (cellfun ("isclass", directory, "char")))
       cache = gen_doc_cache_in_dir (directory);
     else
       error ("doc_cache_create: cell must contain only strings");
@@ -95,7 +95,7 @@
 
   ## For each function:
   for n = 1:length (list)
-    f = list {n};
+    f = list{n};
 
     ## Get help text
     [text, format] = get_help_text (f);
@@ -108,9 +108,9 @@
     endif
 
     ## Store the help text
-    cache (1, end+1) = f;
-    cache (2, end) = text;
-    cache (3, end) = first_sentence;
+    cache(1, end+1) = f;
+    cache(2, end) = text;
+    cache(3, end) = first_sentence;
   endfor
 endfunction
 
@@ -119,27 +119,27 @@
   ## If 'directory' is not in the current path, add it so we search it
   dir_in_path = ismember (directory, ostrsplit (path (), pathsep ()));
 
-  # dirs not in path
+  ## dirs not in path
   if (! iscell (directory))
     directory = {directory};
   endif
   dirs_notpath = {directory{!dir_in_path}};
 
-  # add them
+  ## add them
   if (! isempty (dirs_notpath))
-    cellfun (@addpath, dirs_notpath);
+    addpath (dirs_notpath{:});
   endif
 
-  # create cache
+  ## create cache
   func = @(s_) create_cache (__list_functions__ (s_));
-  cache = cellfun (func, directory, 'UniformOutput', false);
+  cache = cellfun (func, directory, "UniformOutput", false);
 
-  # concatenate results
+  ## concatenate results
   cache = [cache{:}];
 
-  #remove dirs form path
+  ## remove dirs form path
   if (! isempty (dirs_notpath))
-    cellfun (@rmpath, dirs_notpath);
+    rmpath (dirs_notpath{:});
   endif
 
 endfunction
@@ -157,3 +157,4 @@
 %% No true tests desirable for this function.
 %% Test input validation
 %!error doc_cache_create (1)
+
--- a/scripts/help/get_first_help_sentence.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/get_first_help_sentence.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -157,7 +157,8 @@
 endfunction
 
 
-%!assert (get_first_help_sentence ('get_first_help_sentence'), "Return the first sentence of a function's help text.")
+%!assert (get_first_help_sentence ('get_first_help_sentence'), ...
+%!        "Return the first sentence of a function's help text.")
 
 %% Test input validation
 %!error get_first_help_sentence ()
--- a/scripts/help/help.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/help.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -20,7 +20,7 @@
 ## @deftypefn  {Command} {} help @var{name}
 ## @deftypefnx {Command} {} help @code{--list}
 ## @deftypefnx {Command} {} help @code{.}
-## Display the help text for @var{name}.   For example, the command
+## Display the help text for @var{name}.  For example, the command
 ## @kbd{help help} prints a short message describing the @code{help}
 ## command.
 ##
@@ -155,7 +155,7 @@
     endif
   endfor
 
-  retval = cstrcat (operators, keywords, builtins, flist);
+  retval = [operators, keywords, builtins, flist];
 
 endfunction
 
@@ -209,4 +209,3 @@
 %!assert (! isempty (strfind (help ("ls"), "List directory contents")))
 %!error <invalid input> help (42)
 
-
--- a/scripts/help/lookfor.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/lookfor.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 Søren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -24,7 +24,7 @@
 ## Search for the string @var{str} in all functions found in the current
 ## function search path.  By default, @code{lookfor} searches for @var{str}
 ## in the first sentence of the help string of each function found.  The entire
-## help text of each function can be searched if the "-all" argument is
+## help text of each function can be searched if the @qcode{"-all"} argument is
 ## supplied.  All searches are case insensitive.
 ##
 ## Called with no output arguments, @code{lookfor} prints the list of
@@ -36,8 +36,9 @@
 ## sentence of the help text is dependent on the format of the
 ## function's help.  All Octave core functions are correctly
 ## formatted, but the same can not be guaranteed for external packages and
-## user-supplied functions.  Therefore, the use of the "-all" argument may
-## be necessary to find related functions that are not a part of Octave.
+## user-supplied functions.  Therefore, the use of the @qcode{"-all"}
+## argument may be necessary to find related functions that are not a part of
+## Octave.
 ## @seealso{help, doc, which}
 ## @end deftypefn
 
--- a/scripts/help/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -5,6 +5,7 @@
   help/private/__strip_html_tags__.m
 
 help_FCN_FILES = \
+  help/__gripe_missing_component__.m \
   help/__makeinfo__.m \
   help/__unimplemented__.m \
   help/doc.m \
--- a/scripts/help/print_usage.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/print_usage.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -31,22 +31,22 @@
   if (nargin == 0)
     ## Determine the name of the calling function
     if (numel (x) > 1)
-      name = x (2).name;
+      name = x(2).name;
     else
       error ("Octave:invalid-context", "print_usage: invalid function\n");
     endif
-    fullpath = evalin ("caller", "mfilename (""fullpath"")");
+    fullpath = evalin ("caller", 'mfilename ("fullpath")');
     if (strcmp (fullpath(end-length(name)+1:end), name))
-      fullname = [fullpath, ".m"];
+      fullname = [fullpath ".m"];
     endif
-  elseif (!ischar (name))
+  elseif (! ischar (name))
     error ("Octave:invalid-input-arg",
-                                "print_usage: input argument must be a string");
+           "print_usage: input argument must be a string");
   else
     fullname = name;
   endif
 
-  ## Determine if we're called from top level.
+  ## Determine if we were called from top level.
   at_toplev = length (x) < 2 || (length (x) == 2 && strcmp (x(2).name, name));
 
   ## Do the actual work
@@ -74,7 +74,8 @@
   endif
 
   if (at_toplev)
-    error ("Octave:invalid-fun-call", "Invalid call to %s.  Correct usage is:\n\n%s\n%s",
+    error ("Octave:invalid-fun-call",
+           "Invalid call to %s.  Correct usage is:\n\n%s\n%s",
            name, usage_string, __additional_help_message__ ());
   else
     msg = sprintf ("Invalid call to %s.  Correct usage is:\n\n%s",
@@ -102,25 +103,23 @@
   ## concatenated with the following line.
   help_text = strrep (help_text, "@\n", " ");
 
-  ## Find, and keep, lines that start with @def or @end def. This should include things
-  ## such as @deftypefn, @deftypefnx, @defvar, etc. and their corresponding @end's
+  ## Find, and keep, lines that start with @def or @end def. This should
+  ## include things such as @deftypefn, @deftypefnx, @defvar, etc. and their
+  ## corresponding @end's.
   def_idx = strfind (help_text, "@def");
-  if (!isempty (def_idx))
-    buffer = "";
+  if (! isempty (def_idx))
+    endf_idx = strfind (help_text, "@end def");
+    def_idx = sort ([def_idx, endf_idx]);
     endl_idx = find (help_text == "\n");
+    buffer = "";
     for k = 1:length (def_idx)
-      endl = endl_idx (find (endl_idx > def_idx (k), 1));
+      endl = endl_idx (find (endl_idx > def_idx(k), 1));
       if (isempty (endl))
-        buffer = strcat (buffer, help_text (def_idx (k):end), "\n");
+        buffer = strcat (buffer, help_text (def_idx(k):end), "\n");
       else
-        buffer = strcat (buffer, help_text (def_idx (k):endl));
+        buffer = strcat (buffer, help_text (def_idx(k):endl));
       endif
     endfor
-
-    end_def_idx = strfind (help_text, "@end def");
-    if (!isempty (end_def_idx))
-      buffer = strcat (buffer, help_text (end_def_idx:end));
-    endif
   else
     [retval, status] = get_usage_plain_text (help_text, max_len);
   endif
@@ -140,3 +139,4 @@
 
 ## Stop reporting function as missing tests.  No good tests possible.
 %!assert (1)
+
--- a/scripts/help/private/__additional_help_message__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/private/__additional_help_message__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 Søren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -37,3 +37,4 @@
   endif
 
 endfunction
+
--- a/scripts/help/private/__strip_html_tags__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/private/__strip_html_tags__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 Søren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -79,3 +79,4 @@
   ## Actually remove the elements
   text = text (keep);
 endfunction
+
--- a/scripts/help/type.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/help/type.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 S�ren Hauberg
+## Copyright (C) 2009-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -19,24 +19,24 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Command} {} type @var{name} @dots{}
 ## @deftypefnx {Command} {} type -q @var{name} @dots{}
-## @deftypefnx {Function File} {dfns =} type ("@var{name}", @dots{})
-## Display the definition of each @var{name} that refers to a function.
+## @deftypefnx {Function File} {text =} type ("@var{name}", @dots{})
+## Display the contents of @var{name} which may be a file, function (m-file),
+## variable, operator, or keyword.
 ##
-## Normally also displays whether each @var{name} is user-defined or built-in;
-## the @option{-q} option suppresses this behavior.
+## @code{type} normally prepends a header line describing the category
+## of @var{name} such as function or variable; The @option{-q} option
+## suppresses this behavior.
 ##
-## If an output argument is requested nothing is displayed.  Instead, a cell
-## array of strings is returned, where each element corresponds to the
-## definition of each requested function.
+## If no output variable is used the contents are displayed on screen.
+## Otherwise, a cell array of strings is returned, where each element
+## corresponds to the contents of each requested function.
 ## @end deftypefn
 
-function retval = type (varargin)
-  ## Parse input
+function text = type (varargin)
+
   if (nargin == 0)
-    error ("type: not enough input arguments");
-  endif
-
-  if (!iscellstr (varargin))
+    print_usage ();
+  elseif (! iscellstr (varargin))
     error ("type: input arguments must be strings");
   endif
 
@@ -44,18 +44,18 @@
   idx = strcmpi (varargin, "-q") | strcmpi (varargin, "-quiet");
   if (any (idx))
     quiet = true;
-    varargin (idx) = [];
+    varargin(idx) = [];
   endif
 
   if (nargout > 0)
-    retval = cell (size (varargin));
+    text = cell (size (varargin));
   endif
 
   for n = 1:length (varargin)
-    name = varargin {n};
+    name = varargin{n};
 
     ## Find function and get its code
-    text = "";
+    txt = "";
     cmd = sprintf ("exist ('%s')", name);
     e = evalin ("caller", cmd);
     if (e == 1)
@@ -63,17 +63,20 @@
       cmd = sprintf ("disp (%s);", name);
       desc = evalin ("caller", cmd);
       if (quiet)
-        text = desc;
+        txt = desc;
       else
-        text = sprintf ("%s is a variable\n%s", name, desc);
+        txt = sprintf ("%s is a variable\n%s", name, desc);
       endif
     elseif (e == 2)
       ## m-file or ordinary file
       file = which (name);
-      if (isempty (file))
+      if (length (file) > 2)
+        ext = file(end-1:end);
+      endif
+      if (isempty (file) || ! strcmpi (ext, ".m"))
         ## 'name' is an ordinary file, and not a function name.
-        ## FIXME: Should we just print it anyway?
-        error ("type: '%s' undefined\n", name);
+        file = file_in_loadpath (name);
+        quiet = true;
       endif
 
       ## Read the file
@@ -85,28 +88,27 @@
       fclose (fid);
 
       if (quiet)
-        text = contents;
+        txt = contents;
       else
-        text = sprintf ("%s is the user-defined function defined from: %s\n\n%s",
+        txt = sprintf ("%s is the user-defined function defined from: %s\n\n%s",
                         name, file, contents);
       endif
     elseif (e == 3)
-      text = sprintf ("%s is a dynamically-linked function", name);
+      txt = sprintf ("%s is a dynamically-linked function", name);
     elseif (e == 5)
-      text = sprintf ("%s is a built-in function", name);
+      txt = sprintf ("%s is a built-in function", name);
     elseif (any (strcmp (__operators__ (), name)))
-      text = sprintf ("%s is an operator", name);
+      txt = sprintf ("%s is an operator", name);
     elseif (any (strcmp (__keywords__ (), name)))
-      text = sprintf ("%s is a keyword", name);
+      txt = sprintf ("%s is a keyword", name);
     else
       error ("type: '%s' undefined\n", name);
     endif
 
-    ## Should we return the text or print if
     if (nargout == 0)
-      disp (text);
+      disp (txt);
     else
-      retval {n} = text;
+      text{n} = txt;
     endif
   endfor
 endfunction
@@ -114,13 +116,25 @@
 
 %!test
 %! var = 1;
-%! typestr = type ("var");
-%! typestr = typestr{1}(1:17);
+%! text = type ("var");
+%! typestr = text{1}(1:17);
 %! assert (typestr, "var is a variable");
 
+%!test
+%! text = type ("ls");
+%! typestr = text{1}(1:31);
+%! assert (typestr, "ls is the user-defined function");
+
+%!test
+%! text = type ("ls", "-q");
+%! typestr = text{1}(1:21);
+%! assert (typestr, "## Copyright (C) 2006");
+
 %!assert (type ("amd"){1}, "amd is a dynamically-linked function")
 %!assert (type ("cat"){1}, "cat is a built-in function")
 %!assert (type ("+"){1}, "+ is an operator")
 %!assert (type ("end"){1}, "end is a keyword")
-%!error (type ('NO_NAME'))
+
+%!error type ()
+%!error <'__NO_NAME__' undefined> type ('__NO_NAME__')
  
--- a/scripts/image/cmpermute.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/cmpermute.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,7 +25,7 @@
 ## When called with only two arguments, @code{cmpermute} randomly rearranges
 ## the colormap @var{map} and returns a new colormap @var{newmap}.  It also
 ## returns the indexed image @var{Y} which is the equivalent of the original
-## input image @var{X} when displayed using @var{newmap}.  
+## input image @var{X} when displayed using @var{newmap}.
 ##
 ## When called with an optional third argument the order of colors in the
 ## new colormap is defined by @var{index}.
--- a/scripts/image/cmunique.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/cmunique.m	Sat Oct 05 11:22:09 2013 -0400
@@ -78,12 +78,12 @@
     endif
   else
     switch (size (X,3))
-      case (1)
+      case 1
         ## I case
         [newmap,i,j] = unique (X);               # calculate unique colormap
         newmap = repmat (newmap,1,3);            # get a RGB colormap
         Y = reshape (j, rows (X), columns (X));  # Y is j reshaped
-      case (3)
+      case 3
         ## RGB case
         ## build a map with all values
         map = [X(:,:,1)(:), X(:,:,2)(:), X(:,:,3)(:)];
--- a/scripts/image/colorcube.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/colorcube.m	Sat Oct 05 11:22:09 2013 -0400
@@ -46,12 +46,12 @@
     return;
   endif
 
-  # Create colorcube of evenly spaced points with side length of n^1/3
+  ## Create colorcube of evenly spaced points with side length of n^1/3
   cubelen = fix (cbrt (n));
   reserve = n - cubelen^3; 
 
   if (reserve == 0)
-    # Steal space from blue to put the gray gradient
+    ## Steal space from blue to put the gray gradient
     [r, g, b] = meshgrid (linspace (0,1,cubelen),
                           linspace (0,1,cubelen),
                           linspace (0,1,cubelen-1));
@@ -61,16 +61,16 @@
                           linspace (0,1,cubelen));
   endif
 
-  # Create map and weed out grays
+  ## Create map and weed out grays
   map = [r(:), g(:), b(:)];
   idx = any (bsxfun (@ne, map(:, 1), map(:, 2:3)), 2);
   map = map(idx, :);
 
-  # Weed out pure colors
+  ## Weed out pure colors
   idx = sum (map == 0, 2);
   map = map(idx != 2, :);
 
-  # Put in remaining gradients of pure red, green, blue, and gray
+  ## Put in remaining gradients of pure red, green, blue, and gray
   reserve = n - rows (map) - 1;
   csteps = fix (reserve/4);
   cstepsz = 1 / csteps;
--- a/scripts/image/colormap.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/colormap.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,11 +21,16 @@
 ## @deftypefn  {Function File} {@var{cmap} =} colormap ()
 ## @deftypefnx {Function File} {@var{cmap} =} colormap (@var{map})
 ## @deftypefnx {Function File} {@var{cmap} =} colormap ("default")
-## @deftypefnx {Function File} {@var{cmap} =} colormap ("list")
-## @deftypefnx {Function File} {@var{cmap} =} colormap ("register", "@var{name}")
-## @deftypefnx {Function File} {@var{cmap} =} colormap ("unregister", "@var{name}")
+## @deftypefnx {Function File} {@var{cmap} =} colormap ("@var{map_name}")
+## @deftypefnx {Function File} {@var{cmap} =} colormap (@var{hax}, @dots{})
+## @deftypefnx {Command} {} colormap @var{map_name}
+## @deftypefnx {Function File} {@var{cmaps} =} colormap ("list")
+## @deftypefnx {Function File} {} colormap ("register", "@var{name}")
+## @deftypefnx {Function File} {} colormap ("unregister", "@var{name}")
 ## Query or set the current colormap.
 ##
+## With no input arguments, @code{colormap} returns the current color map.
+##
 ## @code{colormap (@var{map})} sets the current colormap to @var{map}.  The
 ## colormap should be an @var{n} row by 3 column matrix.  The columns
 ## contain red, green, and blue intensities respectively.  All entries
@@ -34,11 +39,19 @@
 ## @code{colormap ("default")} restores the default colormap (the
 ## @code{jet} map with 64 entries).  The default colormap is returned.
 ##
-## @code{colormap ("list")} returns a cell array with all the available
-## colormaps.  The options @code{"register"} and @code{"unregister"}
-## will add or remove the colormap @var{name} to it.
+## The map may also be specified by a string, @qcode{"@var{map_name}"}, where
+## @var{map_name} is the name of a function that returns a colormap.
+##
+## If the first argument @var{hax} is an axes handle, then the colormap for
+## the parent figure of @var{hax} is queried or set.
 ##
-## With no arguments, @code{colormap} returns the current color map.
+## For convenience, it is also possible to use this function with the
+## command form, @code{colormap @var{map_name}}.
+##
+## @code{colormap ("list")} returns a cell array with all of the available
+## colormaps.  The options @qcode{"register"} and @qcode{"unregister"}
+## add or remove the colormap @var{name} from this list.
+##
 ## @seealso{jet}
 ## @end deftypefn
 
@@ -46,16 +59,23 @@
 ## Created: July 1994
 ## Adapted-By: jwe
 
-function cmap = colormap (map, name)
+function cmap = colormap (varargin)
+  persistent map_list = cell ();
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("colormap", varargin{:});
 
   if (nargin > 2)
     print_usage ();
   endif
 
-  persistent map_list = cell ();
+  if (! isempty (hax))
+    cf = ancestor (hax, "figure");
+  else
+    cf = get (0, "currentfigure");
+  endif
 
   if (nargin == 1)
-
+    map = varargin{1};
     if (ischar (map))
       if (strcmp (map, "default"))
         map = jet (64);
@@ -75,28 +95,90 @@
       if (any (map(:) < 0) || any (map(:) > 1))
         error ("colormap: all MAP values must be in the range [0,1]");
       endif
+      if (isempty (cf))
+        cf = gcf ();
+      endif
       ## Set the new color map
-      set (gcf (), "colormap", map);
+      set (cf, "colormap", map);
     endif
 
   elseif (nargin == 2)
-    if (! ischar (map) || all (! strcmp (map, {"register", "unregister"})))
+    opt = varargin{1};
+    name = varargin{2};
+    if (! ischar (opt) || ! any (strcmp (opt, {"register", "unregister"})))
       print_usage ();
     elseif (! ischar (name))
       error ("colormap: to register/unregister a colormap, NAME must be a string");
-    elseif (strcmp (map, "register"))
+    elseif (strcmp (opt, "register"))
       map_list{end+1} = name;
-    elseif (strcmp (map, "unregister"))
+    elseif (strcmp (opt, "unregister"))
       map_list(strcmp (name, map_list)) = [];
     endif
   endif
 
   ## Return current color map.
   if (nargout > 0 || (nargout == 0 && nargin == 0))
-    cmap = get (gcf (), "colormap");
+    if (isempty (cf))
+      cf = gcf ();
+    endif
+    cmap = get (cf, "colormap");
   endif
 
 endfunction
 
 
-%% FIXME: Need some demos/tests
+%!demo
+%! ## Create an image for displaying a colormap
+%! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
+%! axis ([1, 64, 0, 1], "ticy", "xy");
+%! ## Show 'jet' colormap
+%! colormap (jet (64));
+%! title "colormap (jet (64))"
+%! disp ("Press a key to continue");
+%! pause ();
+%! ## Show 'colorcube' colormap
+%! colormap (colorcube (64));
+%! title "colormap (colorcube (64))"
+
+%!test
+%! hf = figure ("visible", "off");
+%! cmaptst = [0 1 0; 1 0 1; 1 1 1];
+%! cmap = colormap (cmaptst);
+%! assert (cmap, cmaptst);
+%! cmap = colormap ();
+%! assert (cmap, cmaptst);
+%! cmap = (get (gcf, "colormap"));
+%! assert (cmap, cmaptst);
+%! colormap ("default");
+%! assert (colormap (), jet (64));
+%! colormap ("ocean");
+%! assert (colormap, ocean (64));
+%! close (hf);  # done with temp. figure
+
+%!test
+%! cmaplst = colormap ("list");
+%! assert (iscell (cmaplst));
+%! colormap ("register", "__mycmap__"); 
+%! cmaplst2 = colormap ("list");
+%! assert (numel (cmaplst2), numel (cmaplst) + 1);
+%! assert (any (strcmp (cmaplst2, "__mycmap__")));
+%! colormap ("unregister", "__mycmap__"); 
+%! cmaplst2 = colormap ("list");
+%! assert (numel (cmaplst2), numel (cmaplst));
+%! assert (! any (strcmp (cmaplst2, "__mycmap__")));
+%! ## Unregister again and verify that nothing has happened
+%! colormap ("unregister", "__mycmap__"); 
+%! cmaplst3 = colormap ("list");
+%! assert (isequal (cmaplst2, cmaplst3));
+
+## Test input validation
+%!error colormap (1,2,3)
+%!error <MAP must be a real-valued N x 3> colormap ({1,2,3})
+%!error <MAP must be a real-valued N x 3> colormap ([1 i 1])
+%!error <MAP must be a real-valued N x 3> colormap (ones(3,3,3))
+%!error <MAP must be a real-valued N x 3> colormap ([1 0 1 0])
+%!error <all MAP values must be in the range> colormap ([-1 0 0])
+%!error <all MAP values must be in the range> colormap ([2 0 0])
+%!error colormap ("invalid", "name")
+%!error <NAME must be a string> colormap ("register", 1)
+
--- a/scripts/image/hsv2rgb.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/hsv2rgb.m	Sat Oct 05 11:22:09 2013 -0400
@@ -75,8 +75,8 @@
   ##        are outside range [0, 1].  We could also simply allow those values
   ##        and re-instate this code to produce saturating semantics.
   ## Trim map to range [0, 1]
-  #hsv_map(hsv_map < 0) = 0;
-  #hsv_map(hsv_map > 1) = 1;
+  ## hsv_map(hsv_map < 0) = 0;
+  ## hsv_map(hsv_map > 1) = 1;
 
   h = hsv_map(:,1);
   s = hsv_map(:,2);
--- a/scripts/image/image.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/image.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,7 +39,7 @@
 ## upper left.  For ordinary plots, the origin is located in the lower
 ## left.  Octave handles this inversion by plotting the data normally,
 ## and then reversing the direction of the y-axis by setting the
-## @code{ydir} property to "reverse".  This has implications whenever
+## @code{ydir} property to @qcode{"reverse"}.  This has implications whenever
 ## an image and an ordinary plot need to be overlaid.  The recommended
 ## solution is to display the image and then plot the reversed ydata
 ## using, for example, @code{flipud (ydata)}.
@@ -53,7 +53,11 @@
 
 function h = image (varargin)
 
-  [ax, varargin, nargin] = __plt_get_axis_arg__ ("image", varargin{:});
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("image", varargin{:});
+  
+  if (isempty (hax))
+    hax = gca ();
+  endif
 
   chararg = find (cellfun ("isclass", varargin, "char"), 1, "first");
   
@@ -71,15 +75,9 @@
     img = varargin{3};
     chararg = 4;
   endif
-
-  oldax = gca ();
-  unwind_protect
-    axes (ax);
-    htmp = __img__ (x, y, img, varargin{chararg:end});
-    set (ax, "layer", "top");
-  unwind_protect_cleanup
-    axes (oldax);
-  end_unwind_protect
+  
+  htmp = __img__ (hax, x, y, img, varargin{chararg:end});
+  set (hax, "layer", "top");
 
   if (nargout > 0)
     h = htmp;
@@ -97,9 +95,7 @@
 ## Created: July 1994
 ## Adapted-By: jwe
 
-function h = __img__ (x, y, img, varargin)
-  
-  newplot ();
+function h = __img__ (hax, x, y, img, varargin)
 
   if (isempty (img))
     error ("__img__: matrix is empty");
@@ -136,9 +132,7 @@
     endif
   endif
 
-  ca = gca ();
-
-  htmp = __go_image__ (ca, "cdata", img, "xdata", xdata, "ydata", ydata,
+  htmp = __go_image__ (hax, "cdata", img, "xdata", xdata, "ydata", ydata,
                        "cdatamapping", "direct", varargin {:});
 
   px = __image_pixel_size__ (htmp);
@@ -162,22 +156,22 @@
   ## explicitly setting the values here.  But then what information is
   ## available to axes::update_axis_limits to determine that the
   ## adjustment is necessary?
-  set (ca, "xlim", xlim, "ylim", ylim);
+  set (hax, "xlim", xlim, "ylim", ylim);
 
   if (ndims (img) == 3)
     if (isinteger (img))
       cls = class (img);
       mn = intmin (cls);
       mx = intmax (cls);
-      set (ca, "clim", double ([mn, mx]));
+      set (hax, "clim", double ([mn, mx]));
     endif
   endif
 
-  set (ca, "view", [0, 90]);
+  set (hax, "view", [0, 90]);
 
-  if (strcmp (get (ca, "nextplot"), "replace"))
-    # Always reverse y-axis for images, unless hold is on
-    set (ca, "ydir", "reverse");
+  if (strcmp (get (hax, "nextplot"), "replace"))
+    ## Always reverse y-axis for images, unless hold is on
+    set (hax, "ydir", "reverse");
   endif
 
   if (nargout > 0)
--- a/scripts/image/imagesc.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/imagesc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,12 +20,12 @@
 ## @deftypefn  {Function File} {} imagesc (@var{img})
 ## @deftypefnx {Function File} {} imagesc (@var{x}, @var{y}, @var{img})
 ## @deftypefnx {Function File} {} imagesc (@dots{}, @var{climits})
-## @deftypefnx {Function File} {} imagesc (@var{h}, @dots{})
+## @deftypefnx {Function File} {} imagesc (@var{hax}, @dots{})
 ## @deftypefnx {Function File} {@var{h} =} imagesc (@dots{})
 ## Display a scaled version of the matrix @var{img} as a color image.  The
 ## colormap is scaled so that the entries of the matrix occupy the entire
 ## colormap.  If @code{@var{climits} = [@var{lo}, @var{hi}]} is given, then that
-## range is set to the "clim" of the current axes.
+## range is set to the @qcode{"clim"} of the current axes.
 ##
 ## The axis values corresponding to the matrix elements are specified in
 ## @var{x} and @var{y}, either as pairs giving the minimum and maximum
@@ -45,14 +45,14 @@
   if (nargin < 1 || nargin > 4)
     print_usage ();
   elseif (isscalar (varargin{1}) && ishandle (varargin{1}))
-    harg = varargin{1};
-    if (! strcmp (get (harg, "type"), "axes"))
-      error ("imagesc: expecting first argument to be an axes object");
+    hax = varargin{1};
+    if (! isaxes (hax))
+      error ("imagesc: HAX argument must be an axes object");
     endif
     oldh = gca ();
     unwind_protect
       axes (h);
-      htmp = __imagesc__ (harg, varargin{2:end});
+      htmp = __imagesc__ (hax, varargin{2:end});
     unwind_protect_cleanup
       axes (oldh);
     end_unwind_protect
--- a/scripts/image/imfinfo.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/imfinfo.m	Sat Oct 05 11:22:09 2013 -0400
@@ -18,22 +18,29 @@
 
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {@var{info} =} imfinfo (@var{filename})
+## @deftypefnx {Function File} {@var{info} =} imfinfo (@var{filename}, @var{ext})
 ## @deftypefnx {Function File} {@var{info} =} imfinfo (@var{url})
 ## Read image information from a file.
 ##
 ## @code{imfinfo} returns a structure containing information about the image
-## stored in the file @var{filename}.  The output structure contains the
-## following fields.
+## stored in the file @var{filename}.  If there is no file @var{filename},
+## and @var{ext} was specified, it will look for a file named @var{filename}
+## and extension @var{ext}, i.e., a file named @var{filename}.@var{ext}.
+##
+## The output structure @var{info} contains the following fields:
 ##
 ## @table @samp
 ## @item Filename
 ## The full name of the image file.
 ##
+## @item FileModDate
+## Date of last modification to the file.
+##
 ## @item FileSize
 ## Number of bytes of the image on disk
 ##
-## @item FileModDate
-## Date of last modification to the file.
+## @item Format
+## Image format (e.g., @qcode{"jpeg"}).
 ##
 ## @item Height
 ## Image height in pixels.
@@ -44,11 +51,9 @@
 ## @item BitDepth
 ## Number of bits per channel per pixel.
 ##
-## @item Format
-## Image format (e.g., @code{"jpeg"}).
-##
-## @item LongFormat
-## Long form image format description.
+## @item ColorType
+## Image type.  Value is @qcode{"grayscale"}, @qcode{"indexed"},
+## @qcode{"truecolor"}, @qcode{"CMYK"}, or @qcode{"undefined"}.
 ##
 ## @item XResolution
 ## X resolution of the image.
@@ -56,102 +61,101 @@
 ## @item YResolution
 ## Y resolution of the image.
 ##
-## @item TotalColors
-## Number of unique colors in the image.
+## @item ResolutionUnit
+## Units of image resolution.  Value is @qcode{"Inch"},
+## @qcode{"Centimeter"}, or @qcode{"undefined"}.
 ##
-## @item TileName
-## Tile name.
-##
-## @item AnimationDelay
+## @item DelayTime
 ## Time in 1/100ths of a second (0 to 65535) which must expire before displaying
 ## the next image in an animated sequence.
 ##
-## @item AnimationIterations
-## Number of iterations to loop an animation (e.g., Netscape loop extension)
-## for.
+## @item LoopCount
+## Number of iterations to loop an animation.
 ##
 ## @item ByteOrder
-## Endian option for formats that support it.  Value is @code{"little-endian"},
-## @code{"big-endian"}, or @code{"undefined"}.
+## Endian option for formats that support it.  Value is @qcode{"little-endian"},
+## @qcode{"big-endian"}, or @qcode{"undefined"}.
 ##
 ## @item Gamma
 ## Gamma level of the image.  The same color image displayed on two different
 ## workstations may look different due to differences in the display monitor.
 ##
-## @item Matte
-## @code{true} if the image has transparency.
+## @item Quality
+## JPEG/MIFF/PNG compression level.  Value is an integer in the range [0 100].
+##
+## @item DisposalMethod
+## Only valid for GIF images, control how successive frames are rendered (how
+## the preceding frame is disposed of) when creating a GIF animation.  Values
+## can be @qcode{"doNotSpecify"}, @qcode{"leaveInPlace"}, @qcode{"restoreBG"},
+## or @qcode{"restorePrevious"}.  For non-GIF files, value is an empty string.
+##
+## @item Chromaticities
+## Value is a 1x8 Matrix with the x,y chromaticity values for white, red,
+## green, and blue points, in that order.
 ##
-## @item ModulusDepth
-## Image modulus depth (minimum number of bits required to support
-## red/green/blue components without loss of accuracy).
+## @item Comment
+## Image comment.
 ##
-## @item Quality
-## JPEG/MIFF/PNG compression level.
+## @item Compression
+## Compression type.  Value can be @qcode{"none"}, @qcode{"bzip"},
+## @qcode{"fax3"}, @qcode{"fax4"}, @qcode{"jpeg"}, @qcode{"lzw"},
+## @qcode{"rle"}, @qcode{"deflate"}, @qcode{"lzma"}, @qcode{"jpeg2000"},
+## @qcode{"jbig2"}, @qcode{"jbig2"}, or @qcode{"undefined"}.
+##
+## @item Colormap
+## Colormap for each image.
+##
+## @item Orientation
+## The orientation of the image with respect to the rows and columns.  Value
+## is an integer between 1 and 8 as defined in the TIFF 6 specifications, and
+## for @sc{matlab} compatibility.
 ##
-## @item QuantizeColors
-## Preferred number of colors in the image.
+## @item Software
+## Name and version of the software or firmware of the camera or image input
+## device used to generate the image.
 ##
-## @item ResolutionUnits
-## Units of image resolution.  Value is @code{"pixels per inch"},
-## @code{"pixels per centimeter"}, or @code{"undefined"}.
+## @item Make
+## The manufacturer of the recording equipment.  This is the manufacture of the
+## @nospell{DSC}, scanner, video digitizer or other equipment that generated
+## the image.
+##
+## @item Model
+## The model name or model number of the recording equipment as mentioned
+## on the field @qcode{"Make"}.
 ##
-## @item ColorType
-## Image type.  Value is @code{"grayscale"}, @code{"indexed"},
-## @code{"truecolor"}, or @code{"undefined"}.
+## @item DateTime
+## The date and time of image creation as defined by the Exif standard, i.e.,
+## it is the date and time the file was changed.
+##
+## @item ImageDescription
+## The title of the image as defined by the Exif standard.
 ##
-## @item View
-## FlashPix viewing parameters.
+## @item Artist
+## Name of the camera owner, photographer or image creator.
+##
+## @item Copyright
+## Copyright notice of the person or organization claiming rights to the image.
+##
+## @item DigitalCamera
+## A struct with information retrieved from the Exif tag.
+##
+## @item GPSInfo
+## A struct with geotagging information retrieved from the Exif tag.
 ## @end table
 ##
-## @seealso{imread, imwrite, imshow}
+## @seealso{imread, imwrite, imshow, imformats}
 ## @end deftypefn
 
 ## Author: Soren Hauberg <hauberg@gmail.com>
 
-function info = imfinfo (filename)
-
-  if (nargin < 1)
+function info = imfinfo (varargin)
+  if (nargin < 1 || nargin > 2)
     print_usage ();
-  endif
-
-  if (! ischar (filename))
+  elseif (! ischar (varargin{1}))
     error ("imfinfo: FILENAME must be a string");
+  elseif (nargin > 1 && ! ischar (varargin{2}))
+    error ("imfinfo: EXT must be a string");
   endif
-
-  filename = tilde_expand (filename);
-
-  delete_file = false;
-
-  unwind_protect
-
-    fn = file_in_path (IMAGE_PATH, filename);
-
-    if (isempty (fn))
-
-      ## Couldn't find file. See if it's an URL.
-
-      tmp = tmpnam ();
+  info = imageIO (@__imfinfo__, "info", varargin, varargin{:});
+endfunction
 
-      [fn, status, msg] = urlwrite (filename, tmp);
-
-      if (! status)
-        error ("imfinfo: cannot find %s", filename);
-      endif
-
-      if (! isempty (fn))
-        delete_file = true;
-      endif
-
-    endif
-
-    info = __magick_finfo__ (fn);
-
-  unwind_protect_cleanup
-
-    if (delete_file)
-      unlink (fn);
-    endif
-
-  end_unwind_protect
-
-endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/imformats.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,329 @@
+## Copyright (C) 2013 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} imformats ()
+## @deftypefnx {Function File} {@var{formats} =} imformats (@var{ext})
+## @deftypefnx {Function File} {@var{formats} =} imformats (@var{format})
+## @deftypefnx {Function File} {@var{formats} =} imformats ("add", @var{format})
+## @deftypefnx {Function File} {@var{formats} =} imformats ("remove", @var{ext})
+## @deftypefnx {Function File} {@var{formats} =} imformats ("update", @var{ext}, @var{format})
+## @deftypefnx {Function File} {@var{formats} =} imformats ("factory")
+## Manage supported image formats.
+##
+## @var{formats} is a structure with information about each supported file
+## format, or from a specific format @var{ext}, the value displayed on the
+## field @code{ext}.  It contains the following fields:
+##
+## @table @asis
+## @item ext
+## The name of the file format.  This may match the file extension but Octave
+## will automatically detect the file format.
+##
+## @item description
+## A long description of the file format.
+##
+## @item @nospell{isa}
+## A function handle to confirm if a file is of the specified format.
+##
+## @item write
+## A function handle to write if a file is of the specified format.
+##
+## @item read
+## A function handle to open files the specified format.
+##
+## @item info
+## A function handle to obtain image information of the specified format.
+##
+## @item alpha
+## Logical value if format supports alpha channel (transparency or matte).
+##
+## @item multipage
+## Logical value if format supports multipage (multiple images per file).
+## @end table
+##
+## It is possible to change the way Octave manages file formats with the options
+## @qcode{"add"}, @qcode{"remove"}, and @qcode{"update"}, and supplying a
+## structure @var{format} with the required fields.  The option
+## @qcode{"factory"} resets the configuration to the default.
+##
+## This can be used by Octave packages to extend the image reading capabilities
+## Octave, through use of the PKG_ADD and PKG_DEL commands.
+##
+## @seealso{imfinfo, imread, imwrite}
+## @end deftypefn
+
+## Author: Carnë Draug <carandraug@octave.org>
+
+function varargout = imformats (arg1, arg2, arg3)
+  if (nargin > 3)
+    print_usage ();
+  endif
+
+  persistent formats = default_formats ();
+
+  if (nargin == 0 && nargout == 0)
+    error ("imformats: pretty print not yet implemented.");
+  elseif (nargin >= 1)
+    if (isstruct (arg1))
+      arrayfun (@is_valid_format, arg1);
+      ## FIXME: what is the return value in this situation?
+      formats = arg1;
+
+    elseif (ischar (arg1))
+      switch (tolower (arg1))
+        case "add",
+          if (! isstruct (arg2))
+            error ("imformats: FORMAT to %s must be a structure.", arg1);
+          endif
+          arrayfun (@is_valid_format, arg2);
+          formats(end + 1: end + numel (arg2)) = arg2;
+          varargout{1} = formats;
+
+        case {"remove", "update"},
+          if (! ischar (arg2))
+            error ("imformats: EXT to %s must be a string.", arg1);
+          endif
+          ## FIXME: suppose a format with multiple extensions. If one of
+          ##        them is requested to be removed, should we remove the
+          ##        whole format, or just that extension from the format?
+          match = find_ext_idx (formats, arg2);
+          if (! any (match))
+            error ("imformats: no EXT `%s' found.", arg2);
+          endif
+          if (strcmpi (arg1, "remove"))
+            formats(match) = [];
+          else
+            ## then it's update
+            if (! isstruct (arg3))
+              error ("imformats: FORMAT to update must be a structure.");
+            endif
+            is_valid_format (arg3);
+            formats(match) = arg3;
+          endif
+          varargout{1} = formats;
+
+        case "factory",
+          formats = default_formats ();
+        otherwise
+          ## then we look for a format with that extension.
+          match = find_ext_idx (formats, arg1);
+          ## For matlab compatibility, if we don't find any format we must
+          ## return an empty struct with NO fields. We can't use match as mask
+          if (any (match))
+            varargout{1} = formats(match);
+          else
+            varargout{1} = struct ();
+          endif
+      endswitch
+    else
+      error ("imformats: first argument must be either a structure or string.");
+    endif
+  else
+    varargout{1} = formats;
+  endif
+endfunction
+
+function formats = default_formats ()
+
+  ## The available formats are dependent on what the user has installed at
+  ## a given time, and how GraphicsMagick was built. Checking for
+  ## GraphicsMagick features when building Octave is not enough since it
+  ## delegates some of them to external programs which can be removed or
+  ## installed at any time.
+  ## The recommended method would be to use CoderInfoList() to get a list of
+  ## all available coders and try to write and read back a small test image.
+  ## But this will not work since some coders are readable or writable only.
+  ## It will still fail if we test only the ones marked as readable and
+  ## writable because some RW coders are not of image formats (NULL, 8BIM,
+  ## or EXIF for example).
+  ## So we'd need a blacklist (unacceptable because a `bad' coder may be
+  ## added later) or a whitelist. A whitelist means that even with a
+  ## super-fancy recent build of GraphicsMagick, some formats won't be listed
+  ## by imformats but in truth, we will still be able to read and write them
+  ## since imread() and imwrite() will give it a try anyway.
+  ##
+  ## For more info and comments from the GraphicsMagick main developer, see
+  ## http://sourceforge.net/mailarchive/forum.php?thread_name=alpine.GSO.2.01.1304301916050.2267%40freddy.simplesystems.org&forum_name=graphicsmagick-help
+
+  persistent formats = struct ( "coder", {},
+                                "ext", {},
+                                "isa", {},
+                                "info", {},
+                                "read", {},
+                                "write", {},
+                                "alpha", {},
+                                "description", {},
+                                "multipage", {});
+
+  ## Image IO abilities won't change during the same Octave session,
+  ## there's no need to go and calculate it all over again if we are
+  ## requested to reset back to factory.
+  if (! isempty (formats))
+    return;
+  endif
+
+  ##      Building the formats info
+  ##
+  ## As mentioned above we start with a whitelist of coders. Since the
+  ## GraphicsMagick build may be missing some coders, we will remove those
+  ## from the list. Some info can be obtained directly from GraphicsMagick
+  ## through the CoderInfo object. However, some will need to be hardcoded.
+  ##
+  ## The association between file extensions and coders needs to be done
+  ## with a manually coded list (file extensions do not define the image
+  ## format and GraphicsMagick will not be fooled by changing the extension).
+  ##
+  ## We can get the read, write, description and multipage fields from
+  ## CoderInfo in C++. We should do the same for alpha (GraphicsMagick
+  ## calls it matte) but it's not available from CoderInfo. The only way to
+  ## check it is to create a sample image with each coder, then try to read
+  ## it back with GraphicsMagick and use the matte method on the Image class.
+  ## But making such test for each Octave session... meh! While technically
+  ## it may be possible that the same coder has different support for alpha
+  ## channel in different versions and builds, this doesn't seem to happen.
+  ## So we also hardcode those. In the future, maybe the CoderInfo class will
+  ## have a matte method like it does for multipage.
+  ##
+  ## Other notes: some formats have more than one coder that do the same. For
+  ## example, for jpeg images there is both the JPG and JPEG coders. However,
+  ## it seems that when reading images, GraphicsMagick only uses one of them
+  ## and that's the one we list (it's the one reported by imfinfo and that we
+  ## can use for isa). However, in some cases GraphicsMagick seems to rely
+  ## uniquely on the file extension ((JBIG and JBG at least. Create an image
+  ## with each of those coders, swap their extension and it will report the
+  ## other coder). We don't have such cases on the whitelist but if we did, we
+  ## would need two entries for such cases.
+
+  ## each row: 1st => Coder, 2nd=> file extensions, 3rd=> alpha
+  coders = {"BMP",  {"bmp"},          true;
+            "CUR",  {"cur"},          false;
+            "GIF",  {"gif"},          true;
+            "ICO",  {"ico"},          true;
+            "JBG",  {"jbg"},          false;
+            "JBIG", {"jbig"},         false;
+            "JP2",  {"jp2", "jpx"},   true;
+            "JPEG", {"jpg", "jpeg"},  false; # there is also a JPG coder
+            "PBM",  {"pbm"},          false;
+            "PCX",  {"pcx"},          true;
+            "PGM",  {"pgm"},          false;
+            "PGM",  {"pgm"},          false;
+            "PNG",  {"png"},          true;
+            ## PNM is a family of formats supporting portable bitmaps (PBM),
+            ## graymaps (PGM), and pixmaps (PPM). There is no file format
+            ## associated with pnm itself. If PNM is used as the output format
+            ## specifier, then GraphicsMagick automatically selects the most
+            ## appropriate format to represent the image.
+            "PNM",  {"pnm"},          true;
+            "PPM",  {"ppm"},          false;
+            "SUN",  {"ras"},          true; # SUN Rasterfile
+            "TGA",  {"tga", "tpic"},  true;
+            "TIFF", {"tif", "tiff"},  true;
+            "XBM",  {"xbm"},          false;
+            "XPM",  {"xpm"},          true;
+            "XWD",  {"xwd"},          false;
+            };
+
+  for fidx = 1: rows(coders)
+    formats(fidx).coder = coders{fidx, 1};
+    formats(fidx).ext   = coders{fidx, 2};
+    formats(fidx).alpha = coders{fidx, 3};
+    ## default isa is to check if the format returned by imfinfo is the coder
+    formats(fidx).isa   = @(x) isa_magick (coders{fidx,1}, x);
+  endfor
+
+  ## the default info, read, and write functions
+  [formats.info ] = deal (@__imfinfo__);
+  [formats.read ] = deal (@__imread__);
+  [formats.write] = deal (@__imwrite__);
+
+  ## fills rest of format information by checking with GraphicsMagick
+  formats = __magick_formats__ (formats);
+endfunction
+
+function is_valid_format (format)
+  ## the minimal list of fields required in the structure. We don't
+  ## require multipage because it doesn't exist in matlab
+  min_fields  = {"ext", "read", "isa", "write", "info", "alpha", "description"};
+  fields_mask = isfield (format, min_fields);
+  if (! all (fields_mask))
+    error ("imformats: structure has missing field `%s'.", min_fields(! fields_mask){1});
+  endif
+endfunction
+
+function match = find_ext_idx (formats, ext)
+  ## FIXME: is matlab sensitive to file extensions?
+  ## XXX: what should we do if there's more than one hit?
+  ##      Should this function prevent the addition of
+  ##      duplicated extensions?
+  match = cellfun (@(x) any (strcmp (x, ext)), {formats.ext});
+endfunction
+
+function bool = isa_magick (coder, filename)
+  bool = false;
+  try
+    info = __magick_ping__ (filename, 1);
+    bool = strcmp (coder, info.Format);
+  end_try_catch
+endfunction
+
+
+## changing the function to read
+%!testif HAVE_MAGICK
+%! fmt = imformats ("jpg");
+%! fmt.read = @(x) size (x, 2);
+%! imformats ("update", "jpg", fmt);
+%! assert (imread ("this is 30 characters long.jpg"), 30);
+
+## adding a new format
+%!testif HAVE_MAGICK
+%! fmt = imformats ("jpg");
+%! fmt.ext = "junk";
+%! fmt.read = @(x) true();
+%! imformats ("add", fmt);
+%! assert (imread ("some file.junk"), true);
+
+## adding multiple formats in one way
+%!testif HAVE_MAGICK
+%! fmt = imformats ("jpg");
+%! fmt.ext = "junk1";
+%! fmt.read = @(x) true();
+%! fmt(2) = fmt(1);
+%! fmt(2).ext = "junk2";
+%! imformats ("add", fmt);
+%! assert (imread ("some file.junk1"), true);
+%! assert (imread ("some file.junk2"), true);
+
+## changing format
+%!testif HAVE_MAGICK
+%! ori_fmt = mod_fmt = imformats ("jpg");
+%! mod_fmt.description = "Another description";
+%! imformats ("update", "jpg", mod_fmt);
+%! new_fmt = imformats ("jpg");
+%! assert (new_fmt.description, mod_fmt.description);
+%! imformats ("factory");
+%! new_fmt = imformats ("jpg");
+%! assert (new_fmt.description, ori_fmt.description);
+
+## FIXME: how to test for error together with testif?
+## update to an invalid format
+#%!testif HAVE_MAGICK
+#%! fmt = imformats ("jpg");
+#%! fmt = rmfield (fmt, "read");
+#%! error imformats ("update", "jpg", fmt);
+
--- a/scripts/image/imread.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/imread.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,3 +1,4 @@
+## Copyright (C) 2013 Carnë Draug
 ## Copyright (C) 2008-2012 Thomas L. Scofield
 ## Copyright (C) 2008 Kristian Rumberg
 ## Copyright (C) 2006 Thomas Weber
@@ -20,79 +21,90 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{img}, @var{map}, @var{alpha}] =} imread (@var{filename})
+## @deftypefnx {Function File} {[@dots{}] =} imread (@var{filename}, @var{ext})
+## @deftypefnx {Function File} {[@dots{}] =} imread (@var{url})
+## @deftypefnx {Function File} {[@dots{}] =} imread (@dots{}, @var{idx})
+## @deftypefnx {Function File} {[@dots{}] =} imread (@dots{}, @var{param1}, @var{val1}, @dots{})
+## Read images from various file formats.
+##
+## Reads an image as a matrix from the file @var{filename}.  If there is
+## no file @var{filename}, and @var{ext} was specified, it will look for
+## a file named @var{filename} and extension @var{ext}, i.e., a file named
+## @var{filename}.@var{ext}.
+##
+## The size and class of the output depends on the
+## format of the image.  A color image is returned as an
+## @nospell{MxNx3} matrix.  Gray-level and black-and-white images are
+## of size @nospell{MxN}.  Multipage images will have an additional 4th
+## dimension.
+##
+## The bit depth of the image determines the
+## class of the output: @qcode{"uint8"}, @qcode{"uint16"} or @qcode{"single"}
+## for gray and color, and @qcode{"logical"} for black and white.
+## Note that indexed images always return the indexes for a colormap,
+## independent if @var{map} is a requested output.  To obtain the actual
+## RGB image, use @code{ind2rgb}.  When more than one indexed image is being
+## read, @var{map} is obtained from the first.  In some rare cases this
+## may be incorrect and @code{imfinfo} can be used to obtain the colormap of
+## each image.
+##
+## See the Octave manual for more information in representing images.
+##
+## Some file formats, such as TIFF and GIF, are able to store multiple
+## images in a single file.  @var{idx} can be a scalar or vector
+## specifying the index of the images to read.  By default, Octave
+## will only read the first page.
+##
+## Depending on the file format, it is possible to configure the reading
+## of images with @var{param}, @var{val} pairs.  The following options
+## are supported:
+##
+## @table @samp
+## @item @qcode{"Frames"} or @qcode{"Index"}
+## This is an alternative method to specify @var{idx}.  When specifying it
+## in this way, its value can also be the string @qcode{"all"}.
+##
+## @item @qcode{"Info"}
+## This option exists for @sc{matlab} compatibility and has no effect.  For
+## maximum performance while reading multiple images from a single file,
+## use the Index option.
+##
+## @item @qcode{"PixelRegion"}
+## Controls the image region that is read.  Takes as value a cell array
+## with two arrays of 3 elements @code{@{@var{rows} @var{cols}@}}.  The
+## elements in the array are the start, increment and end pixel to be
+## read.  If the increment value is omitted, defaults to 1.
+## @end table
+##
+## @seealso{imwrite, imfinfo, imformats}
+## @end deftypefn
+
+## Author: Carnë Draug <carandraug@octave.org>
 ## Author: Thomas L. Scofield <scofield@calvin.edu>
 ## Author: Kristian Rumberg <kristianrumberg@gmail.com>
 ## Author: Thomas Weber <thomas.weber.mail@gmail.com>
 ## Author: Stefan van der Walt <stefan@sun.ac.za>
 ## Author: Andy Adler
 
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{img}, @var{map}, @var{alpha}] =} imread (@var{filename})
-## Read images from various file formats.
-##
-## The size and numeric class of the output depends on the
-## format of the image.  A color image is returned as an
-## @nospell{MxNx3} matrix.  Gray-level and black-and-white images are
-## of size @nospell{MxN}.
-## The color depth of the image determines the numeric
-## class of the output: "uint8" or "uint16" for gray
-## and color, and "logical" for black and white.
-##
-## @seealso{imwrite, imfinfo}
-## @end deftypefn
-
-function varargout = imread (filename, varargin)
-
+function [img, varargout] = imread (varargin)
   if (nargin < 1)
     print_usage ();
-  endif
-
-  if (! ischar (filename))
+  elseif (! ischar (varargin{1}))
     error ("imread: FILENAME must be a string");
   endif
-
-  filename = tilde_expand (filename);
-
-  fn = file_in_path (IMAGE_PATH, filename);
-
-  if (isempty (fn))
-    error ("imread: cannot find %s", filename);
+  ## In case the file format was specified as a separate argument we
+  ## do this. imageIO() will ignore the second part if filename on its
+  ## own is enough. And if the second argument was a parameter name instead
+  ## of an extension, it is still going to be passed to the next function
+  ## since we are passing the whole function input as well.
+  filename = {varargin{1}};
+  if (nargin > 1 && ischar (varargin {2}))
+    filename{2} = varargin{2};
   endif
 
-  try
-    [varargout{1:nargout}] = __magick_read__ (fn, varargin{:});
-  catch
-
-    magick_error = lasterr ();
-
-    img_field = false;
-    x_field = false;
-    map_field = false;
-
-    try
-      vars = load (fn);
-      if (isstruct (vars))
-        img_field = isfield (vars, "img");
-        x_field = isfield (vars, "X");
-        map_field = isfield (vars, "map");
-      endif
-    catch
-      error ("imread: invalid image file: %s", magick_error);
-    end_try_catch
-
-    if (map_field && (img_field || x_field))
-      varargout{2} = vars.map;
-      if (img_field)
-        varargout{1} = vars.img;
-      else
-        varargout{1} = vars.X;
-      endif
-    else
-      error ("imread: invalid Octave image file format");
-    endif
-
-  end_try_catch
-
+  [img, varargout{1:nargout-1}] = imageIO (@__imread__, "read", filename, varargin{:});
 endfunction
 
 
@@ -114,11 +126,15 @@
 %!   16,  28, 160,  16,   0, 197, 214,  13,  34,  74, ...
 %!  117, 213,  17,   0,   0,   0,   0,  73,  69,  78, ...
 %!   68, 174,  66,  96, 130];
-%! fid = fopen ("test.png", "wb");
-%! fwrite (fid, vpng);
-%! fclose (fid);
-%! A = imread ("test.png");
-%! delete ("test.png");
+%! filename = [tmpnam() ".png"];
+%! unwind_protect
+%!   fid = fopen (filename, "wb");
+%!   fwrite (fid, vpng);
+%!   fclose (fid);
+%!   A = imread (filename);
+%! unwind_protect_cleanup
+%!   unlink (filename);
+%! end_unwind_protect
 %! assert (A(:,:,1), uint8 ([0, 255, 0; 255, 237, 255; 0, 255, 0]));
 %! assert (A(:,:,2), uint8 ([0, 255, 0; 255,  28, 255; 0, 255, 0]));
 %! assert (A(:,:,3), uint8 ([0, 255, 0; 255,  36, 255; 0, 255, 0]));
--- a/scripts/image/imshow.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/imshow.m	Sat Oct 05 11:22:09 2013 -0400
@@ -43,7 +43,7 @@
 ## @var{value1}.  @var{string_param1} can be any of the following:
 ##
 ## @table @asis
-## @item "displayrange"
+## @item @qcode{"displayrange"}
 ## @var{value1} is the display range as described above.
 ## @end table
 ##
--- a/scripts/image/imwrite.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/imwrite.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,5 @@
 ## Copyright (C) 2008-2012 John W. Eaton
+## Copyright (C) 2013 Carnë Draug
 ##
 ## This file is part of Octave.
 ##
@@ -18,166 +19,75 @@
 
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {} imwrite (@var{img}, @var{filename})
-## @deftypefnx {Function File} {} imwrite (@var{img}, @var{filename}, @var{fmt})
-## @deftypefnx {Function File} {} imwrite (@var{img}, @var{filename}, @var{fmt}, @var{p1}, @var{v1}, @dots{})
-## @deftypefnx {Function File} {} imwrite (@var{img}, @var{map}, @var{filename}, @dots{})
+## @deftypefnx {Function File} {} imwrite (@var{img}, @var{filename}, @var{ext})
+## @deftypefnx {Function File} {} imwrite (@var{img}, @var{map}, @var{filename})
+## @deftypefnx {Function File} {} imwrite (@dots{}, @var{param1}, @var{val1}, @dots{})
 ## Write images in various file formats.
 ##
-## If @var{fmt} is not supplied, the file extension of @var{filename} is used
-## to determine the format.
+## The image @var{img} can be a binary, grayscale, RGB, or multi-dimensional
+## image.  The size and class of @var{img} should be the same as what should
+## be expected when reading it with @code{imread}: the 3rd and 4th dimensions
+## reserved for color space, and multiple pages respectively.  If it's an
+## indexed image, the colormap @var{map} must also be specified.
 ##
-## The parameter-value pairs (@var{p1}, @var{v1}, @dots{}) are optional.
-## Currently the following options are supported for @t{JPEG} images:
+## If @var{ext} is not supplied, the file extension of @var{filename} is used
+## to determine the format.  The actual supported formats are dependent on
+## options made during the build of Octave.  Use @code{imformats} to check
+## the support of the different image formats.
+##
+## Depending on the file format, it is possible to configure the writing
+## of images with @var{param}, @var{val} pairs.  The following options
+## are supported:
 ##
 ## @table @samp
+## @item Alpha
+## Alpha (transparency) channel for the image.  This must be a matrix with
+## same class, and number of rows and columns of @var{img}.  In case of a
+## multipage image, the size of the 4th dimension must also match and the third
+## dimension must be a singleton.  By default, image will be completely
+## opaque.
+##
 ## @item Quality
 ## Set the quality of the compression.  The value should be an
 ## integer between 0 and 100, with larger values indicating higher visual
-## quality and lower compression.
+## quality and lower compression.  Defaults to 75.
+##
+## @item WriteMode
+## Some file formats, such as TIFF and GIF, are able to store multiple
+## images in a single file.  This option specifies if @var{img} should be
+## appended to the file (if it exists) or if a new file should be created
+## for it (possibly overwriting an existing file).  The value should be
+## the string @qcode{"Overwrite"} (default), or @qcode{"Append"}.
+##
+## Despite this option, the most efficient method of writing a multipage
+## image is to pass a 4 dimensional @var{img} to @code{imwrite}, the
+## same matrix that could be expected when using @code{imread} with the
+## option @qcode{"Index"} set to @qcode{"all"}.
+##
 ## @end table
 ##
-## @strong{Supported Formats}
-## @multitable @columnfractions .33 .66
-## @headitem Extension @tab Format
-## @item bmp @tab Windows Bitmap
-## @item gif @tab Graphics Interchange Format
-## @item jpg and jpeg @tab Joint Photographic Experts Group
-## @item pbm @tab Portable Bitmap
-## @item pcx @tab
-## @item pgm @tab Portable Graymap
-## @item png @tab Portable Network Graphics
-## @item pnm @tab Portable Anymap
-## @item ppm @tab Portable Pixmap
-## @item ras @tab Sun Raster
-## @item tif and tiff @tab Tagged Image File Format
-## @item xwd @tab X11 Dump
-## @end multitable
-##
-## @strong{Unsupported Formats}
-## @multitable @columnfractions .33 .66
-## @headitem Extension @tab Format
-## @item hdf @tab Hierarchical Data Format V4
-## @item @nospell{jp2} and jpx @tab Joint Photographic Experts Group 2000
-## @end multitable
-##
-## @seealso{imread, imfinfo}
+## @seealso{imread, imfinfo, imformats}
 ## @end deftypefn
 
-function imwrite (img, varargin)
-
-  persistent imwrite_possible_formats = {
-    "bmp"; "gif"; "jp2"; "jpg"; "jpx"; "jpeg"; "hdf"; "pbm"; "pcx";
-    "pgm"; "png"; "pnm"; "ppm"; "ras"; "tif"; "tiff"; "xwd" };
-
-  persistent accepted_formats = __magick_format_list__ (imwrite_possible_formats);
-
-  if (nargin < 2 || ! (isnumeric (img) || islogical (img)))
-    print_usage ();
-  endif
-
-  map = [];
-  fmt = "";
-
-  offset = 1;
-  if (isnumeric (varargin{1}))
-    map = varargin{1};
-    if (isempty (map))
-      error ("imwrite: colormap must not be empty");
-    endif
-    offset = 2;
-  endif
-  if (offset <= length (varargin) && ischar (varargin{offset}))
-    filename = varargin{offset};
-    offset++;
-    if (rem (length (varargin) - offset, 2) == 0 && ischar (varargin{offset}))
-      fmt = varargin{offset};
-      offset++;
-    endif
-  else
+function imwrite (varargin)
+  if (nargin < 2)
     print_usage ();
   endif
-  if (offset < length (varargin))
-    has_param_list = 1;
-    for ii = offset:2:(length (varargin) - 1)
-      options.(varargin{ii}) = varargin{ii + 1};
-    endfor
-  else
-    has_param_list = 0;
-  endif
-
-  filename = tilde_expand (filename);
-
-  if (isempty (fmt))
-    [d, n, fmt] = fileparts (filename);
-    if (! isempty (fmt))
-      fmt = fmt(2:end);
-    endif
-  endif
-
-  if (isempty (img))
-    error ("imwrite: invalid empty image");
-  endif
-
-  if (issparse (img) || issparse (map))
-    error ("imwrite: sparse images not supported");
-  endif
-
-  if (! strcmp (fmt, accepted_formats))
-    error ("imwrite: %s: unsupported or invalid image format", fmt);
-  endif
-
-  img_class = class (img);
-  map_class = class (map);
-  nd = ndims (img);
+  [filename, ext] = imwrite_filename (varargin{2:end});
 
-  if (isempty (map))
-    if (any (strcmp (img_class, {"logical", "uint8", "uint16", "double"})))
-      if ((nd == 2 || nd == 3) && strcmp (img_class, "double"))
-        img = uint8 (img * 255);
-      endif
-      ## FIXME: should we handle color images with alpha channel here?
-      if (nd == 3 && size (img, 3) < 3)
-        error ("imwrite: invalid dimensions for truecolor image");
-      endif
-      if (nd > 5)
-        error ("imwrite: invalid %d-dimensional image data", nd);
-      endif
-    else
-      error ("imwrite: %s: invalid class for truecolor image", img_class);
+  fmt = imformats (ext);
+  ## When there is no match, fmt will be a 1x1 structure with
+  ## no fields, so we can't just use `isempty (fmt)'.
+  if (isempty (fieldnames (fmt)))
+    if (isempty (ext))
+      error ("imwrite: no extension found for %s to identify the image format",
+             filename);
     endif
-    if (has_param_list)
-      __magick_write__ (filename, fmt, img, options);
-    else
-      __magick_write__ (filename, fmt, img);
-    endif
+    warning ("imwrite: unlisted image format %s (see imformats). Trying to save anyway.",
+             ext);
+    __imwrite__ (varargin{:});
   else
-    if (any (strcmp (img_class, {"uint8", "uint16", "double"})))
-      if (strcmp (img_class, "double"))
-        img = uint8 (img - 1);
-      endif
-      if (nd != 2 && nd != 4)
-        error ("imwrite: invalid size for indexed image");
-      endif
-    else
-      error ("imwrite: %s: invalid class for indexed image data", img_class);
-    endif
-    if (! iscolormap (map))
-      error ("imwrite: invalid indexed image colormap");
-    endif
-
-    ## FIXME: we should really be writing indexed images here but
-    ##        __magick_write__ needs to be fixed to handle them.
-
-    [r, g, b] = ind2rgb (img, map);
-    tmp = uint8 (cat (3, r, g, b) * 255);
-
-    if (has_param_list)
-      __magick_write__ (filename, fmt, tmp, options);
-      ## __magick_write__ (filename, fmt, img, map, options);
-    else
-      __magick_write__ (filename, fmt, tmp);
-      ## __magick_write__ (filename, fmt, img, map);
-    endif
+    fmt.write (varargin{:});
   endif
 
 endfunction
@@ -194,3 +104,14 @@
 %!error imwrite ([], "filename.jpg")          # Empty img matrix
 %!error imwrite (spones (2), "filename.jpg")  # Invalid sparse img
 
+%!testif HAVE_MAGICK
+%! imw = randi (255, 100, "uint8");
+%! filename = [tmpnam() ".png"];
+%! unwind_protect
+%!   imwrite (imw, filename);
+%!   imr = imread (filename);
+%! unwind_protect_cleanup
+%!   unlink (filename);
+%! end_unwind_protect
+%! assert (imw, imr)
+
--- a/scripts/image/ind2gray.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/ind2gray.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,7 +30,7 @@
 ##
 ## Implementation Note: There are several ways of converting colors to
 ## grayscale intensities.  This functions uses the luminance value obtained
-## from @code{rgb2ntsc} which is @code{I = 0.299*R + 0.587*G + 0.114*B}.  
+## from @code{rgb2ntsc} which is @code{I = 0.299*R + 0.587*G + 0.114*B}.
 ## Other possibilities include the value component from @code{rgb2hsv} or
 ## using a single color channel from @code{ind2rgb}.
 ## @seealso{gray2ind, ind2rgb}
--- a/scripts/image/lines.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/lines.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,7 +20,7 @@
 ## @deftypefn  {Function File} {@var{map} =} lines ()
 ## @deftypefnx {Function File} {@var{map} =} lines (@var{n})
 ## Create color colormap.  This colormap is composed of the list of colors
-## in the current axes "ColorOrder" property.  The default is blue,
+## in the current axes @qcode{"ColorOrder"} property.  The default is blue,
 ## green, red, cyan, pink, yellow, and gray.
 ## The argument @var{n} must be a scalar.
 ## If unspecified, the length of the current colormap, or 64, is used.
--- a/scripts/image/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,11 @@
 FCN_FILE_DIRS += image
 
 image_PRIVATE_FCN_FILES = \
+  image/private/__imfinfo__.m \
+  image/private/__imread__.m \
+  image/private/__imwrite__.m \
+  image/private/imageIO.m \
+  image/private/imwrite_filename.m \
   image/private/ind2x.m
 
 image_FCN_FILES = \
@@ -25,6 +30,7 @@
   image/image.m \
   image/imagesc.m \
   image/imfinfo.m \
+  image/imformats.m \
   image/imread.m \
   image/imshow.m \
   image/imwrite.m \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/private/__imfinfo__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,72 @@
+## Copyright (C) 2008-2012 Soren Hauberg
+## Copyright (C) 2013 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## This function does al the work of imfinfo. It exists here as private
+## function so that imfinfo can use other functions if imformats is
+## configured to. It is also needed so that imformats can create a
+## function handle for it.
+
+## Author: Soren Hauberg <hauberg@gmail.com>
+
+function info = __imfinfo__ (filename, ext)
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ("imfinfo");
+  endif
+
+  if (! ischar (filename))
+    error ("imfinfo: FILENAME must be a string");
+  elseif (nargin >= 2 && ! ischar (ext))
+    error ("imfinfo: EXT must be a string");
+  endif
+  filename = tilde_expand (filename);
+
+  delete_file = false;
+  unwind_protect
+
+    fn = file_in_path (IMAGE_PATH, filename);
+    if (isempty (fn))
+      ## We couldn't find the file so...
+      if (nargin >= 2)
+        ## try adding a possible file extesion
+        filename  = [filename "." ext];
+        fn        = file_in_path (IMAGE_PATH, filename);
+        if (isempty (fn))
+          error ("imfinfo: cannot find file %s", filename);
+        endif
+      else
+        ## try filename as an URL
+        [fn, status, msg] = urlwrite (filename, tmpnam ());
+        if (! status)
+          error ("imfinfo: cannot find or download %s: %s", filename, msg);
+        endif
+        delete_file = true;
+      endif
+    endif
+
+    info = __magick_finfo__ (fn);
+
+  unwind_protect_cleanup
+    if (delete_file)
+      unlink (fn);
+    endif
+  end_unwind_protect
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/private/__imread__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,207 @@
+## Copyright (C) 2013 Carnë Draug
+## Copyright (C) 2008-2012 Thomas L. Scofield
+## Copyright (C) 2008 Kristian Rumberg
+## Copyright (C) 2006 Thomas Weber
+## Copyright (C) 2005 Stefan van der Walt
+## Copyright (C) 2002 Andy Adler
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## This function does all the work of imread. It exists here as private
+## function so that imread can use other functions if imformats is
+## configured to. It is also needed so that imformats can create a
+## function handle for it.
+
+## Author: Carnë Draug <carandraug@octave.org>
+## Author: Thomas L. Scofield <scofield@calvin.edu>
+## Author: Kristian Rumberg <kristianrumberg@gmail.com>
+## Author: Thomas Weber <thomas.weber.mail@gmail.com>
+## Author: Stefan van der Walt <stefan@sun.ac.za>
+## Author: Andy Adler
+
+function varargout = __imread__ (filename, varargin)
+
+  if (nargin < 1)
+    print_usage ("imread");
+  elseif (! ischar (filename))
+    error ("imread: FILENAME must be a string");
+  endif
+
+  ## keep track of the varargin offset we're looking at each moment
+  offset    = 1;
+
+  filename  = tilde_expand (filename);
+  fn        = file_in_path (IMAGE_PATH, filename);
+  if (isempty (fn) && nargin >= offset + 1 && ischar (varargin{offset}))
+    ## if we can't find the file, check if the next input is the file extension
+    filename  = [filename "." varargin{offset}];
+    fn        = file_in_path (IMAGE_PATH, filename);
+    offset++;
+  endif
+  if (isempty (fn))
+    error ("imread: cannot find %s", filename);
+  endif
+
+  ## It is possible for an file with multiple pages to have very different
+  ## images on each page. Specifically, they may have different sizes. Because
+  ## of this, we need to first find out the index of the images to read so
+  ## we can set up defaults for things such as PixelRegion later on.
+  options = struct ("index", 1);  # default image index
+
+  ## Index is the only option that can be defined without the parameter/value
+  ## pair style. When defining it here, the string "all" is invalid though.
+  ## Also, for matlab compatibility, if index is defined both as an option here
+  ## and parameter/value pair, silently ignore the first.
+  if (nargin >= offset + 1 && ! ischar (varargin{offset}))
+    if (! is_valid_index_option (options.index))
+      error ("imread: IDX must be a numeric vector");
+    endif
+    options.index = varargin{offset};
+    offset++;
+  endif
+
+  if (rem (numel (varargin) - offset + 1, 2) != 0)
+    error ("imread: no pair for all arguments (odd number left over)");
+  endif
+
+  ## Check key/value options.
+  indexes = cellfun ("isclass", varargin, "char");
+  indexes(indexes) &= ismember (varargin(indexes), {"frames", "index"});
+  indexes = find (indexes);
+  if (indexes)
+    options.index = varargin{indexes+1};
+    if (! (is_valid_index_option (options.index)) &&
+        ! (ischar (options.index) && strcmpi (options.index, "all")))
+      error ("imread: value for %s must be a vector or the string `all'");
+    endif
+  endif
+
+  try
+    ## Use information from the first image to be read to set defaults.
+    info = __magick_ping__ (fn, options.index(1));
+
+    ## Set default for options.
+    options.region = {1:1:info.rows 1:1:info.columns};
+
+    for idx = offset:2:(numel (varargin) - offset + 1)
+      switch (tolower (varargin{idx}))
+
+        case "pixelregion",
+          options.region = varargin{idx+1};
+          if (! iscell (options.region) || numel (options.region) != 2)
+            error ("imread: value for %s must be a 2 element cell array",
+                   varargin{idx});
+          endif
+          for reg_idx = 1:2
+            if (numel (options.region{reg_idx}) == 3)
+              ## do nothing
+            elseif (numel (options.region{reg_idx}) == 2)
+              options.region{reg_idx}(3) = options.region{reg_idx}(2);
+              options.region{reg_idx}(2) = 1;
+            else
+              error ("imread: range for %s must be a 2 or 3 element vector",
+                     varargin{idx});
+            endif
+            options.region{reg_idx} = floor (options.region{reg_idx}(1)): ...
+                                      floor (options.region{reg_idx}(2)): ...
+                                      floor (options.region{reg_idx}(3));
+          endfor
+          if (options.region{1}(end) > info.rows)
+            error ("imread: end ROWS for PixelRegions option is larger than image height");
+          elseif (options.region{2}(end) > info.columns)
+            error ("imread: end COLS for PixelRegions option is larger than image width");
+          endif
+
+        case "info",
+          ## We ignore this option. This parameter exists in Matlab to
+          ## speed up the reading of multipage TIFF by passing a structure
+          ## that contains information about the start on the file of each
+          ## page.  We can't control it through GraphicsMagic but at least
+          ## we allow to load multiple pages with one command.
+
+        otherwise
+          error ("imread: invalid PARAMETER `%s'", varargin{idx});
+
+      endswitch
+    endfor
+
+    [varargout{1:nargout}] = __magick_read__ (fn, options);
+
+  catch
+    ## If we can't read it with Magick, maybe the image is in Octave's
+    ## native image format.  This is from back before Octave had 'imread'
+    ## and 'imwrite'. Then we had the functions 'loadimage' and 'saveimage'.
+    ##
+    ## This "image format" seems to be any file that can be read with
+    ## load() and contains 2 variables.  The variable named "map" is a
+    ## colormap and must exist whether the image is indexed or not. The
+    ## other variable must be named "img" or "X" for a "normal" or
+    ## indexed image.
+    ##
+    ## FIXME: this has been deprecated for the next major release (3.8 or 4.0).
+    ##        If someone wants to revive this as yet another image format, a
+    ##        separate Octave package can be written for it, that register the
+    ##        format through imformats.
+
+    magick_error = lasterr ();
+
+    img_field = false;
+    x_field   = false;
+    map_field = false;
+
+    try
+      vars = load (fn);
+      if (isstruct (vars))
+        img_field = isfield (vars, "img");
+        x_field   = isfield (vars, "X");
+        map_field = isfield (vars, "map");
+      endif
+    catch
+      error ("imread: invalid image file: %s", magick_error);
+    end_try_catch
+
+    if (map_field && (img_field || x_field))
+      varargout{2} = vars.map;
+      if (img_field)
+        varargout{1} = vars.img;
+      else
+        varargout{1} = vars.X;
+      endif
+      persistent warned = false;
+      if (! warned)
+        warning ("Octave's native image format has been deprecated.");
+        warned = true;
+      endif
+    else
+      error ("imread: invalid Octave image file format");
+    endif
+
+  end_try_catch
+
+endfunction
+
+## Tests if the value passed to the Index or Frames is valid. This option
+## can be defined in two places, but only in one place can it also be the
+## string "all"
+function bool = is_valid_index_option (arg)
+  ## is the index option
+  bool = false;
+  if (isvector (arg) && isnumeric (arg) && isreal (arg))
+    bool = true;
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/private/__imwrite__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,119 @@
+## Copyright (C) 2008-2012 John W. Eaton
+## Copyright (C) 2013 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## This function does all the work of imwrite. It exists here as private
+## function so that imwrite can use other functions if imformats is
+## configured to. It is also needed so that imformats can create a
+## function handle for it.
+
+function __imwrite__ (img, varargin)
+
+  if (nargin < 2 || ! (isnumeric (img) || islogical (img)))
+    print_usage ("imwrite");
+  endif
+
+  [filename, ext, map, param_list] = imwrite_filename (varargin{:});
+
+  if (isempty (img))
+    error ("imwrite: invalid empty image");
+  elseif (issparse (img) || issparse (map))
+    error ("imwrite: sparse images are not supported");
+  endif
+
+  if (rem (numel (param_list), 2) != 0)
+    error ("imwrite: no pair for all arguments (odd number left)");
+  endif
+
+  ## set default for options
+  options = struct ("writemode", "overwrite",
+                    "quality",   75,
+                    "alpha",     cast ([], class (img)));
+
+  for idx = 1:2:numel (param_list)
+
+    switch (tolower (param_list{idx}))
+
+      case "alpha"
+        options.alpha = param_list{idx+1};
+        if (! isnumeric (options.alpha))
+          error ("imwrite: value for %s option must be a numeric matrix",
+                 param_list{idx});
+        elseif (size (options.alpha, 3) != 1)
+          error ("imwrite: 3rd dimension of matrix for %s must be singleton",
+                 param_list{idx});
+        elseif (ndims (options.alpha) > 4 ||
+                any (size (options.alpha)([1 2]) != size (img)([1 2])) ||
+                size (options.alpha, 4) != size (img, 4))
+          error ("imwrite: matrix for %s must have same dimension as image",
+                 param_list{idx});
+        endif
+
+      case "writemode",
+        options.writemode = param_list{idx+1};
+        if (! ischar (options.writemode)
+            || ! any (strcmpi (options.writemode, {"append", "overwrite"})))
+          error ('imwrite: value for %s option must be "append" or "overwrite"',
+                 param_list{idx});
+        endif
+        options.writemode = tolower (options.writemode);
+
+      case "quality",
+        options.quality = param_list{idx+1};
+        if (! isnumeric (options.quality) || ! isscalar (options.quality)
+            || options.quality < 0 || options.quality > 100)
+          error ("imwrite: value for %s option must be a scalar between 0 and 100",
+                 param_list{idx});
+        endif
+        options.quality = round (options.quality);
+
+      otherwise
+        error ("imwrite: invalid PARAMETER `%s'", varargin{idx});
+
+    endswitch
+  endfor
+
+  if (! isempty (map))
+    if (! iscolormap (map))
+      error ("imwrite: invalid MAP for indexed image");
+    elseif (ndims (img) != 2 && ndims (img) != 4)
+      error ("imwrite: indexed image must have 2 or 4 dimensions (found %i)", ndims (img));
+    endif
+    ## If the image is floating point, then we convert it to integer (makes
+    ## it easier in __magick_write__ since it only handles integers. Also,
+    ## if it's floating point, it has an offset of 1
+    if (isfloat (img))
+      if (rows (map) <= 256)
+        img = uint8 (img - 1);
+      else
+        img = uint16 (img - 1);
+      endif
+    endif
+  endif
+
+  if (ndims (img) > 4)
+    error ("imwrite: invalid %d-dimensional image data", ndims (img));
+  elseif (all (size (img, 3) != [1 3 4]))
+    ## 1, 3, or 4 for grayscle, RGB, and CMYK respectively
+    error ("imwrite: IMG 3rd dimension must be 1, 3, or 4");
+  endif
+
+  __magick_write__ (filename, ext, img, map, options);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/private/imageIO.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,69 @@
+## Copyright (C) 2013 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## This function simply connects imread and imfinfo() to the function
+## to be used based on their format. It does it by checking the file extension
+## of the file and redirecting to the appropriate function after checking
+## with imformats.
+##
+## First argument is a function handle for the default imageIO function (what
+## to use if the file extension for the image file is not listed by imformats).
+## Second argument is the fieldname in the struct returned by imformats with a
+## function handle for the function to use. Third argument is a cell array, its
+## first element the filename, and the second, an optional file extension to
+## add to filename, if filename alone does not exist. All the others are the
+## original input arguments passed to the original imageIO function which will
+## be passed on to the destination function.
+##
+## No input checking whatsoever is performed. That should be performed by the
+## function calling it.
+
+function varargout = imageIO (core_func, fieldname, filename, varargin)
+
+  ## It should not be this function job to check if the file exists or not.
+  ## However, we need to know the file extension to use with imformats and
+  ## that means we need to know the actual filename that will be used which
+  ## is dependent on whether a file exists.
+  ##
+  ## If a file named filename{1} exists, then that's it, we will use that
+  ## wether it has an extension or not. If it does not exist and we have
+  ## something in filename{2}, then we will consider it the file extension.
+  ## Note the detail that if we find a file using filename{1} only, then we
+  ## should completely ignore filename{2}. It won't even be used by
+  ## imformats() at all, even if filename{1} has no extension to use with
+  ## imformats().
+  if (isscalar (filename) || ! isempty (file_in_path (IMAGE_PATH, filename{1})))
+    [~, ~, ext] = fileparts (filename{1});
+    if (! isempty (ext))
+      ## remove dot from extension
+      ext = ext(2:end);
+    endif
+  else
+    ext = filename{2};
+  endif
+
+  fmt = imformats (ext);
+  ## When there is no match, fmt will be a 1x1 structure with no fields,
+  ## so we can't just use `isempty (fmt)'.
+  if (isempty (fieldnames (fmt)))
+    [varargout{1:nargout}] = core_func (varargin{:});
+  else
+    [varargout{1:nargout}] = fmt.(fieldname) (varargin{:});
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/private/imwrite_filename.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,69 @@
+## Copyright (C) 2013 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## The input check for imwrite needs to be done twice, once when imwrite
+## is called the first time to find where the filename is, and a second
+## time by __imwrite__ after imformats decides what function to use.
+## Because a user can, and is encouraged to, get a function handle to
+## __imwrite__, the input check is also done there.
+## In addition, the input check for imwrite is not that straightforward
+## in order to support the multiple ways the function can be called,
+## and interpretations of Matlab documentation.
+##
+## Anyway, this will only do the input check until it finds the filename
+## to be used, the only part that imwrite actually needs.
+
+function [filename, ext, cmap, options] = imwrite_filename (varargin)
+
+  ## First, we check if the first argument is a colormap or a filename.
+  cmap = [];
+  if (ischar (varargin{1}))
+    filename_idx = 1;
+  elseif (numel (varargin) >= 2 && iscolormap (varargin{1}) && ischar (varargin{2}))
+    filename_idx = 2;
+    cmap = varargin{1};
+  else
+    error ("imwrite: no FILENAME specified");
+  endif
+  filename = tilde_expand (varargin{filename_idx});
+
+  ## Next, we get the file extension.
+  ## if we have an odd number of leftover arguments, and the next argument
+  ## is a string, we consider it the file extension. Otherwise we will
+  ## extract what we can from the previously found filename.
+  options_idx = filename_idx + 1;
+  if (numel (varargin) > filename_idx &&
+      rem (length (varargin) - filename_idx, 2) != 0 &&
+      ischar (varargin{filename_idx + 1}))
+    ext = varargin{filename_idx + 1};
+    filename = [filename "." ext];
+    options_idx++;
+  else
+    [~, ~, ext] = fileparts (filename);
+    if (! isempty (ext))
+      ## remove dot from extension
+      ext = ext(2:end);
+    endif
+  endif
+
+  ## After all the work finding where the filename was, we might as well
+  ## send the leftovers list (they should be in key value pairs)
+  options = varargin(options_idx:end);
+
+endfunction
+
--- a/scripts/image/private/ind2x.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/private/ind2x.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,8 +22,8 @@
 function [x, map] = ind2x (caller, x, map)
 
   ## Check if X is an indexed image.
-  ## an indexed image is defined has having only 2D, and that's how matlab
-  ## behaves. But we want to support ND images, so we will allow up to 4D
+  ## an indexed image is defined has having only 2D, and that's how Matlab
+  ## behaves.  But we want to support ND images, so we will allow up to 4D
   ## and check that the 3rd is a singleton
   if (all (ndims (x) != [2 4]) || size (x, 3) != 1 || issparse (x) ||
       (isfloat (x) && ! isindex (x)) ||
@@ -51,9 +51,10 @@
 
   num_colors = rows (map);
   if (num_colors < maxidx)
-    ## Pad with the last color in the map for matlab compatibility
+    ## Pad with the last color in the map for Matlab compatibility
     pad = repmat (map(end,:), maxidx - num_colors, 1);
     map(end+1:maxidx, :) = pad;
   endif
 
 endfunction
+
--- a/scripts/image/rgb2ind.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/rgb2ind.m	Sat Oct 05 11:22:09 2013 -0400
@@ -37,19 +37,17 @@
 ##
 ## The input image @var{rgb} must be an N-dimensional RGB image
 ## (@nospell{MxNxO}@dots{}x3 array) where M,N,O@dots{} are the image
-## dimensions, and the
-## final dimension contains the values in the red, green and blue
-## channels.  Alternatively, the red, green and blue color channels can
-## be input as separate arrays @var{R}, @var{G} and  @var{B}.
+## dimensions, and the final dimension contains the values in the red, green
+## and blue channels.  Alternatively, the red, green and blue color channels
+## can be input as separate arrays @var{R}, @var{G}, and @var{B}.
 ##
-## The input @var{map} defines the colormap to be used.  Alternatively,
-## @var{n} or @var{tol} may be used to define the maximum number of
-## colors to use in an automatically generated colormap.  @var{n} is
-## related to @var{tol} by:  @var{n} = (floor (1/@var{tol}) + 1)^3;
-## @var{tol} must be >0 and @leq{}1.
+## The input @var{map} defines the colormap to be used.  Alternatively, @var{n}
+## or @var{tol} may be used to define the maximum number of colors to use in an
+## automatically generated colormap.  @var{n} is related to @var{tol} by:
+## @var{n} = (floor (1/@var{tol}) + 1)^3; where 0 < @var{tol} @leq{} 1.
 ##
 ## @var{dither_option} is a string which enables or disables dithering:
-## 'dither' (default) or 'nodither'.
+## @qcode{"dither"} (default) or @qcode{"nodither"}.
 ##
 ## @seealso{ind2rgb, rgb2hsv, rgb2ntsc}
 ## @end deftypefn
@@ -66,7 +64,7 @@
   else
 
     ## Test for dither_option, by checking if the final input is a string
-    if ischar (varargin{end})
+    if (ischar (varargin{end}))
       dither_option = varargin{end};
       dither_check  = true;
     else
@@ -143,14 +141,14 @@
   
     ## If image is an ND array, convert it to a tiled 2D image
     ## before processing it with Graphicsmagick
-    if numel (sz)>3
+    if (numel (sz) > 3)
      rgb = reshape (rgb, [prod(sz(1:end-2)), sz(end-1), 3]);
-    end
+    endif
 
     ## Prepare the Graphicsmagick dithering option
-    if strcmp (dither_option, "nodither")
+    if (strcmp (dither_option, "nodither"))
       ditherstr = "+dither";
-    elseif strcmp (dither_option, "dither")
+    elseif (strcmp (dither_option, "dither"))
       ditherstr = "-dither";
     endif
       
@@ -167,7 +165,7 @@
   ## Conversion of rgb image to x,map
   pr = prod (sz(1:end-1));
   x = zeros (sz(1:end-1));
-  [map,~,x(:)] = unique (reshape(rgb, [pr, 3]), "rows");
+  [map,~,x(:)] = unique (reshape (rgb, [pr, 3]), "rows");
 
   ## a colormap is of class double and values between 0 and 1
   switch (class (rgb))
--- a/scripts/image/rgb2ntsc.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/rgb2ntsc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -98,9 +98,9 @@
 
 
 %% Test pure RED, GREEN, BLUE colors
-%assert (rgb2ntsc ([1 0 0]), [.299  .587  .114])
-%assert (rgb2ntsc ([0 1 0]), [.596 -.274 -.322])
-%assert (rgb2ntsc ([1 0 1]), [.211 -.523  .312])
+%!assert (rgb2ntsc ([1 0 0]), [.299  .596  .211])
+%!assert (rgb2ntsc ([0 1 0]), [.587 -.274 -.523])
+%!assert (rgb2ntsc ([0 0 1]), [.114 -.322  .312])
 
 %!test
 %! rgb_map = rand (64, 3);
--- a/scripts/image/spinmap.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/image/spinmap.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,7 @@
 ## @deftypefnx {Function File} {} spinmap ("inf")
 ## Cycle the colormap for @var{t} seconds with a color increment of @var{inc}.
 ## Both parameters are optional.  The default cycle time is 5 seconds and the
-## default increment is 2.  If the option "inf" is given then cycle
+## default increment is 2.  If the option @qcode{"inf"} is given then cycle
 ## continuously until @kbd{Control-C} is pressed.
 ##
 ## When rotating the original color 1 becomes color 2, color 2 becomes
--- a/scripts/io/beep.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/beep.m	Sat Oct 05 11:22:09 2013 -0400
@@ -36,3 +36,4 @@
 
 
 %!error (beep (1))
+
--- a/scripts/io/csvwrite.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/csvwrite.m	Sat Oct 05 11:22:09 2013 -0400
@@ -41,14 +41,15 @@
 
 %!test
 %! csvwrite (fname, magic (3));
-%! assert (csvread (fname), magic (3));
+%! data = csvread (fname);
 %! unlink (fname);
+%! assert (data, magic (3));
 
 %!test
 %! csvwrite (fname, magic (3), "precision", "%2.1f", "newline", "unix");
 %! fid = fopen (fname, "rt");
 %! txt = char (fread (fid,Inf,'char')');
 %! fclose (fid);
+%! unlink (fname);
 %! assert (txt, "8.0,1.0,6.0\n3.0,5.0,7.0\n4.0,9.0,2.0\n");
-%! unlink (fname);
 
--- a/scripts/io/dlmwrite.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/dlmwrite.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,32 +35,32 @@
 ## The value of @var{c} specifies the number of delimiters to prepend to
 ## each line of data.
 ##
-## If the argument @code{"-append"} is given, append to the end of
+## If the argument @qcode{"-append"} is given, append to the end of
 ## @var{file}.
 ##
 ## In addition, the following keyword value pairs may appear at the end
 ## of the argument list:
 ##
 ## @table @asis
-## @item "append"
-## Either @samp{"on"} or @samp{"off"}.  See @samp{"-append"} above.
+## @item @qcode{"append"}
+## Either @qcode{"on"} or @qcode{"off"}.  See @qcode{"-append"} above.
 ##
-## @item "delimiter"
+## @item @qcode{"delimiter"}
 ## See @var{delim} above.
 ##
-## @item "newline"
+## @item @qcode{"newline"}
 ## The character(s) to use to separate each row.  Three special cases
-## exist for this option.  @samp{"unix"} is changed into "\n",
-## @samp{"pc"} is changed into "\r\n", and @samp{"mac"} is changed
-## into "\r".  Other values for this option are kept as is.
+## exist for this option.  @qcode{"unix"} is changed into @qcode{"\n"},
+## @qcode{"pc"} is changed into @qcode{"\r\n"}, and @qcode{"mac"} is changed
+## into @qcode{"\r"}.  Other values for this option are kept as is.
 ##
-## @item "roffset"
+## @item @qcode{"roffset"}
 ## See @var{r} above.
 ##
-## @item "coffset"
+## @item @qcode{"coffset"}
 ## See @var{c} above.
 ##
-## @item "precision"
+## @item @qcode{"precision"}
 ## The precision to use when writing the file.  It can either be a
 ## format string (as used by fprintf) or a number of significant digits.
 ## @end table
@@ -151,6 +151,11 @@
     endif
   endwhile
 
+  ## Expand '\t' to TAB for Matlab compatibility
+  if (strcmp (delim, '\t'))
+    delim = "\t";
+  endif
+
   if (ischar (file))
     [fid, msg] = fopen (file, opentype);
   elseif (isscalar (file) && isnumeric (file))
--- a/scripts/io/fileread.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/fileread.m	Sat Oct 05 11:22:09 2013 -0400
@@ -53,8 +53,8 @@
 %! fprintf (fid, "%s\n", cstr{:});
 %! fclose (fid);
 %! str = fileread (fname);
+%! unlink (fname);
 %! assert (str, [cstr{1} "\n" cstr{2} "\n" cstr{3} "\n"]);
-%! unlink (fname);
 
 %% Test input validation
 %!error fileread ()
--- a/scripts/io/importdata.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/importdata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,22 +22,21 @@
 ## @deftypefnx {Function File} {@var{A} =} importdata (@var{fname}, @var{delimiter}, @var{header_rows})
 ## @deftypefnx {Function File} {[@var{A}, @var{delimiter}] =} importdata (@dots{})
 ## @deftypefnx {Function File} {[@var{A}, @var{delimiter}, @var{header_rows}] =} importdata (@dots{})
-## Importing data from file.
-##
-## Importing the contents of file @var{fname} into workspace.
+## Import data from the file @var{fname}.
 ##
 ## Input parameters:
 ##
 ## @itemize
 ## @item @var{fname}
-## The file name for the file to import.
+## The name of the file containing data.
 ## 
 ## @item @var{delimiter}
 ## The character separating columns of data.  Use @code{\t} for tab.
-## (Only valid for ascii files)
+## (Only valid for ASCII files)
 ##
 ## @item @var{header_rows}
-## Number of header rows before the data begins.  (Only valid for ascii files)
+## The number of header rows before the data begins.  (Only valid for ASCII
+## files)
 ## @end itemize
 ##
 ## Different file types are supported:
@@ -45,7 +44,7 @@
 ## @itemize
 ## @item ASCII table
 ##
-## Importing ASCII table using the specified number of header rows and
+## Import ASCII table using the specified number of header rows and
 ## the specified delimiter.
 ##
 ## @item Image file
@@ -63,79 +62,57 @@
 
 ## Author: Erik Kjellson <erikiiofph7@users.sourceforge.net>
 
-function [output, delimiter, header_rows] = importdata (varargin)
+function [output, delimiter, header_rows] = importdata (fname, delimiter = "", header_rows = -1)
 
-  ## Default values
-  fname   = "";
-  delimiter  = "";
-  header_rows = -1;
-
-  ##########
-
-  ## Check input arguments
-
-  if (nargin < 1)
+  if (nargin < 1 || nargin > 3)
     print_usage ();
   endif
 
-  fname = varargin{1};
-  ## Check that the file name really is a string
   if (! ischar (fname))
-    error ("importdata: file name needs to be a string");
-  endif
-  if ( strcmpi (fname, "-pastespecial"))
+    error ("importdata: FNAME must be a string");
+  elseif (strcmpi (fname, "-pastespecial"))
     error ("importdata: option -pastespecial not implemented");
   endif
 
   if (nargin > 1)
-    delimiter = varargin{2};
-    ## Check that the delimiter really is a string
-    if (!ischar (delimiter))
-      error("importdata: delimiter needs to be a character");
+    if (! ischar (delimiter)
+        || (length (delimiter) > 1 && ! strcmp (delimiter, '\t')))
+      error("importdata: DELIMITER must be a single character");
     endif
-    if (length (delimiter) > 1 && !strcmpi (delimiter, "\\t"))
-      error("importdata: delimiter cannot be longer than 1 character");
-    endif
-    if (strcmpi (delimiter, "\\"))
-      delimiter = "\\\\";
+    if (strcmp (delimiter, '\t'))
+      delimiter = "\t";
     endif
   endif
 
   if (nargin > 2)
-    header_rows = varargin{3};
-    if (!isnumeric (header_rows) || header_rows < 0)
-      error ("importdata: number of header rows needs to be an integer number >= 0");
+    if (! isnumeric (header_rows) || header_rows < 0
+        || header_rows != fix (header_rows))
+      error ("importdata: HEADER_ROWS must be an integer >= 0");
     endif
   endif
 
-  if (nargin > 3)
-    error ("importdata: too many input arguments");
-  endif
-
-  ##########
-
   ## Check file format
   ## Get the extension from the file name.
-  [d n fileExt v] = fileparts (fname);
-  ## Make sure file extension is in lower case.
-  fileExt = lower (fileExt);
+  [~, ~, ext, ~] = fileparts (fname);
+  ext = lower (ext);
 
-  switch fileExt
-    case {".au", ".snd"}
-      error ("importdata: not implemented for file format %s", fileExt);
-    case ".avi"
-      error ("importdata: not implemented for file format %s", fileExt);
-    case {".bmp", ".cur", ".gif", ".hdf", ".ico", ".jpe", ".jpeg", ".jpg", \
-          ".pbm", ".pcx", ".pgm", ".png", ".pnm", ".ppm", ".ras", \
-          ".tif", ".tiff", ".xwd"}
-      delimiter  = NaN;
+  switch (ext)
+    case {".au", ".snd", ".flac", ".ogg"}
+      error ("importdata: not implemented for file format %s", ext);
+    case {".avi", ".mj2", ".mpg", ".asf", ".asx", ".wmv", ".mp4", ".m4v", ...
+          ".mov"} 
+      error ("importdata: not implemented for file format %s", ext);
+    case {".bmp", ".cur", ".gif", ".hdf", ".ico", ".jpe", ".jpeg", ".jpg", ...
+          ".jp2", ".jpf", ".jpx", ".j2c", ".j2k", ".pbm", ".pcx", ".pgm", ...
+          ".png", ".pnm", ".ppm", ".ras", ".tif", ".tiff", ".xwd"}
+      delimiter = NaN;
       header_rows = 0;
       [output.cdata, output.colormap, output.alpha] = imread (fname);
     case ".mat"
-      delimiter  = NaN;
+      delimiter = NaN;
       header_rows = 0;
       output = load (fname);
-    case {".wk1", ".xls", ".xlsx", ".dbf", ".pxl"}
+    case {".xls", ".xlsx", ".wk1", ".dbf", ".pxl"}
       ## If there's no Excel file support simply fall back to unimplemented.m
       output = xlsread (fname);
     case {".ods", ".sxc", ".fods", ".uos", ".xml"}
@@ -147,228 +124,285 @@
         output = xlsread (fname);
       end_try_catch
     case {".wav", ".wave"}
-      delimiter  = NaN;
+      delimiter = NaN;
       header_rows = 0;
       [output.data, output.fs] = wavread (fname);
     otherwise
-      ## Assume the file is in ascii format.
-      [output, delimiter, header_rows]  = \
+      ## Assume the file is in ASCII format.
+      [output, delimiter, header_rows]  = ...
           importdata_ascii (fname, delimiter, header_rows);
   endswitch
 
   ## If there are any empty fields in the output structure, then remove them
-  if (isstruct (output) && length (output) == 1)
+  if (isstruct (output) && numel (output) == 1)
     fields = fieldnames (output);
     for i=1:length (fields)
-      if (isempty (getfield (output, fields{i})))
+      if (isempty (output.(fields{i})))
         output = rmfield (output, fields{i});
       endif
     endfor
 
     ## If only one field is left, replace the structure with the field,
-    ## i.e. output = output.onlyFieldLeft
+    ## i.e., output = output.onlyFieldLeft
 
     ## Update the list of fields
     fields = fieldnames (output);
-    if (length (fields) == 1)
-      output = getfield (output, fields{1});
+    if (numel (fields) == 1)
+      output = output.(fields{1});
     endif
   endif
-endfunction
-
-
-########################################
-
-function [output, delimiter, header_rows] = \
-      importdata_ascii (fname, delimiter, header_rows)
-
-  ## Define the fields in the output structure so that the order will be
-  ## correct.
-
-  output.data       = [];
-  output.textdata   = [];
-  output.rowheaders = [];
-  output.colheaders = [];
-
-  ## Read file into string and count the number of header rows
-  file_content = fileread (fname);
-
-  ## Split the file into rows (using \n and/or \r as delimiters between rows).
-  file_content_rows = regexp (file_content, "\n|\n\r|\r|\r\n", "split");
-
-  ## FIXME: guess delimiter, if it isn't defined
-  if (isempty (delimiter))
-    error ("importdata: Guessing delimiter is not implemented yet, you have to specify it.");
-  endif
 
-  ## FIXME: A more intelligent way to count number of header rows. This
-  ## is needed e.g. when delimiter=' ' and the header contains spaces...
+endfunction
+
+function [output, delimiter, header_rows] = importdata_ascii (fname, delimiter, num_header_rows)
 
-  ## If number of header rows is undefined, then count the number of
-  ## header rows by step through row by row and look for the delimiter.
-  ## Assume that the header can't contain any delimiter.
-  if (header_rows < 0)
-    header_rows = 0;
-    for i=1:length (file_content_rows)
-      if (isempty (regexp(file_content_rows{i}, delimiter, "once")))
-        header_rows++;
-      else
-        ## Data part has begun and therefore no more header rows can be
-        ## found
-        break;
-      endif
-    endfor
-  endif
+  ## Define fields in the output structure so that the order will be correct.
+  output.data       = [];
+  output.textdata   = {};
+  output.rowheaders = {};
+  output.colheaders = {};
 
-  ## Put the header rows in output.textdata.
-  if (header_rows > 0)
-    output.textdata   = file_content_rows (1:header_rows)';
-  endif
-
-  ## If space is the delimiter, then remove spaces in the beginning of
-  ## each data row.
-  if (strcmpi (delimiter, " "))
-    for i=(header_rows+1):length (file_content_rows)
-      ## strtrim does not only remove the leading spaces but also the
-      ## tailing spaces, but that doesn't really matter.
-      file_content_rows{i} = strtrim (file_content_rows{i});
-    endfor
+  [fid, msg] = fopen (fname, "r");
+  if (fid == -1)
+    error (msg);
   endif
 
-  ## Remove empty data rows. Go through them backwards so that you wont
-  ## get out of bounds.
-  for i=length (file_content_rows):-1:(header_rows + 1)
-    if (length (file_content_rows{i}) < 1)
-      file_content_rows = [file_content_rows(1:i-1), \
-                           file_content_rows(i+1:length(file_content_rows))];
-    endif
-  endfor
+  header_rows = 0;
+  header_cols = 0;
+    
+  ## Work through first few rows line by line until a delimiter is found.
+  while (ischar (row = fgetl (fid)))
 
-  ## Count the number of data columns. If there are different number of
-  ## columns, use the greatest value.
-  data_columns = 0;
-  delimiter_pattern = delimiter;
-  ## If space is the delimiter, then multiple spaces should count as ONE
-  ## delimiter. Also ignore leading spaces.
-  if (strcmpi (delimiter, " "))
-    delimiter_pattern = ' +';
-  endif
-  for i=(header_rows+1):length(file_content_rows)
-    data_columns = max (data_columns,
-                        length (regexp (file_content_rows{i},
-                                        delimiter_pattern, "split")));
-  endfor
+    ## If no delimiter determined yet, make a guess.
+    if (isempty (delimiter))
+      ## This pattern can be fooled, but mostly does the job just fine.
+      delim = regexp (row, '[+-\d.eE\*ij ]+([^+-\d.ij])[+-\d.ij]',
+                           'tokens', 'once');
+      if (! isempty (delim))
+        delimiter = delim{1};
+      endif
+    endif
 
-  ## FIXME: Make it behave like Matlab when importing a table where a whole
-  ## column is text only. E.g.
-  ##    abc  12  34
-  ##    def  56  78
-  ## This would give a 3x2 data matrix with the left column = nan(2,1), and 
-  ## the text would end up in textdata.
-  ## In Matlab the data matrix would only be a 2x2 matrix, see example at:
-  ## http://www.mathworks.se/help/matlab/import_export/import-numeric-data-and-header-text-from-a-text-file.html
-
-  ## Go through the data and put it in either output.data or
-  ## output.textdata depending on if it is numeric or not.
-  output.data = NaN (length (file_content_rows) - header_rows, data_columns);
-  for i=(header_rows+1):length(file_content_rows)
-    ## Only use the row if it contains anything other than white-space
-    ## characters.
-    if (any (file_content_rows{i} != " "))
-      row_data = regexp (file_content_rows{i}, delimiter_pattern, "split");
+    if (delimiter == " ")
+      row_entries = regexp (strtrim (row), ' +', 'split');
+    else
+      row_entries = ostrsplit (row, delimiter);
+    endif
+    row_data = str2double (row_entries);
+    if (all (isnan (row_data)) || header_rows < num_header_rows)
+      header_rows++;
+      output.textdata{end+1, 1} = row;
+    else
+      if (! isempty (output.textdata))
+        if (delimiter == " ")
+          output.colheaders = regexp (strtrim (output.textdata{end}),
+                                      ' +', 'split');
+        else
+          output.colheaders = ostrsplit (output.textdata{end}, delimiter);
+        endif
+      endif
+      header_cols = find (! isnan (row_data), 1) - 1;
+      ## The number of header rows and header columns is now known.
+      break;
+    endif
 
-      for j=1:length(row_data)
-        ## Try to convert the column to a number, if it works put it in
-        ## output.data, otherwise in output.textdata
-        if (!isempty (row_data{j}))
-          data_numeric = str2double (row_data{j});
-          if (!isnan (data_numeric))
-            output.data(i-header_rows, j) = data_numeric;
-          else
-            output.textdata{i,j} = row_data{j};
-          endif
-        endif
-      endfor
+  endwhile
+
+  fclose (fid);
 
-    endif
-  endfor
-
-  ## Check wether rowheaders or colheaders should be used
-  if ((header_rows == data_columns) && (size (output.textdata, 2) == 1))
-    output.rowheaders = output.textdata;
-  elseif (size (output.textdata, 2) == data_columns)
-    output.colheaders = output.textdata(end,:);
+  if (row == -1)
+    error ("importdata: Unable to determine delimiter");
+  endif
+  if (num_header_rows >= 0)
+    header_rows = num_header_rows;
   endif
 
-  ## When delimiter = "\\t" convert it to a tab, done for Matlab compatibility.
-  if (strcmp (delimiter, '\t'))
-    delimiter = "\t";
+  ## Now, let the efficient built-in routine do the bulk of the work.
+  if (delimiter == " ")
+    output.data = dlmread (fname, "", header_rows, header_cols,
+                           "emptyvalue", NA);
+  else
+    output.data = dlmread (fname, delimiter, header_rows, header_cols,
+                           "emptyvalue", NA);
+  endif
+
+  ## Go back and correct any individual values that did not convert.
+  na_idx = isna (output.data);
+  if (header_cols > 0)
+    na_idx = [(true (rows (na_idx), header_cols)), na_idx];
+  endif
+  if (any (na_idx(:)))
+
+    file_content = ostrsplit (fileread (fname), "\n");
+
+    na_rows = find (any (na_idx, 2));
+    for ridx = na_rows(:)'
+      row = file_content{ridx+header_rows};
+      if (delimiter == " ")
+        fields = regexp (strtrim (row), ' +', 'split');
+      else
+        fields = ostrsplit (row, delimiter);
+      endif
+      
+      text = fields(na_idx(ridx,:));
+      text = text(! strcmpi (text, "NA"));  #  Remove valid "NA" entries
+      if (! isempty (text))
+        output.textdata(end+1:end+numel (text), 1) = text;
+      endif
+      if (header_cols)
+        output.rowheaders(end+1, :) = fields(1:header_cols);
+      endif
+    endfor
+
+  endif
+
+  ## Final cleanup to satisfy output configuration
+  if (all (cellfun ("isempty", output.textdata)))
+    output = output.data;
+  elseif (! isempty (output.rowheaders) && ! isempty (output.colheaders))
+    output = struct ("data", {output.data}, "textdata", {output.textdata});
   endif
 
 endfunction
 
 
-########################################
-
 %!test
-%! # Comma separated values
+%! ## Comma separated values
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "3.1,-7.2,0\n0.012,6.5,128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, ",");
+%! [a1,d1,h1] = importdata (fn, ",");
+%! [a2,d2,h2] = importdata (fn);
 %! unlink (fn);
-%! assert (a, A);
-%! assert (d, ",");
-%! assert (h, 0);
+%! assert (a1, A);
+%! assert (d1, ",");
+%! assert (h1, 0);
+%! assert (a2, A);
+%! assert (d2, ",");
+%! assert (h2, 0);
 
 %!test
-%! # Tab separated values
+%! ## Tab separated values
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "3.1\t-7.2\t0\n0.012\t6.5\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a1,d1,h1] = importdata (fn, "\t");
+%! [a2,d2,h2] = importdata (fn);
+%! unlink (fn);
+%! assert (a1, A);
+%! assert (d1, "\t");
+%! assert (h1, 0);
+%! assert (a2, A);
+%! assert (d2, "\t");
+%! assert (h2, 0);
+
+%!test
+%! ## Space separated values, using multiple spaces to align in columns.
+%! A = [3.1 -7.2 0; 0.012 6.5 128];
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fprintf (fid, "%10.3f %10.3f %10.3f\n", A');
+%! fclose (fid);
+%! [a1,d1,h1] = importdata (fn, " ");
+%! [a2,d2,h2] = importdata (fn);
+%! unlink (fn);
+%! assert (a1, A);
+%! assert (d1, " ");
+%! assert (h1, 0);
+%! assert (a2, A);
+%! assert (d2, " ");
+%! assert (h2, 0);
+
+%!test
+%! ## No separator, 1 column of data only
+%! A = [3.1;-7.2;0;0.012;6.5;128];
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fprintf (fid, "%f\n", A);
+%! fclose (fid);
+%! [a1,d1,h1] = importdata (fn, "");
+%! [a2,d2,h2] = importdata (fn);
+%! unlink (fn);
+%! assert (a1, A);
+%! assert (d1, "");
+%! assert (h1, 0);
+%! assert (a2, A);
+%! assert (d2, "");
+%! assert (h2, 0);
+
+%!test
+%! ## Header text
+%! A.data = [3.1 -7.2 0; 0.012 6.5 128];
+%! A.textdata = {"This is a header row."; ...
+%!               "this row does not contain any data, but the next one does."};
+%! A.colheaders = A.textdata (2);
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fprintf (fid, "%s\n", A.textdata{:});
+%! fputs (fid, "3.1\t-7.2\t0\n0.012\t6.5\t128");
+%! fclose (fid);
+%! [a,d,h] = importdata (fn, '\t');
+%! unlink (fn);
+%! assert (a, A);
+%! assert (d, "\t");
+%! assert (h, 2);
+
+%!test
+%! ## Column headers, only last row is returned in colheaders
+%! A.data = [3.1 -7.2 0; 0.012 6.5 128];
+%! A.textdata = {"Label1\tLabel2\tLabel3";
+%!               "col 1\tcol 2\tcol 3"};
+%! A.colheaders = {"col 1", "col 2", "col 3"};
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fprintf (fid, "%s\n", A.textdata{:});
+%! fputs (fid, "3.1\t-7.2\t0\n0.012\t6.5\t128");
+%! fclose (fid);
+%! [a,d,h] = importdata (fn, '\t');
+%! unlink (fn);
+%! assert (a, A);
+%! assert (d, "\t");
+%! assert (h, 2);
+
+%!test
+%! ## Row headers
+%! A.data = [3.1 -7.2 0; 0.012 6.5 128];
+%! A.textdata = {"row1"; "row2"};
+%! A.rowheaders = A.textdata;
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fputs (fid, "row1\t3.1\t-7.2\t0\nrow2\t0.012\t6.5\t128");
+%! fclose (fid);
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
 %!test
-%! # Space separated values, using multiple spaces to align in columns.
-%! A = [3.1 -7.2 0; 0.012 6.5 128];
+%! ## Row/Column headers and Header Text
+%! A.data = [3.1 -7.2 0; 0.012 6.5 128];
+%! A.textdata = {"This is introductory header text"
+%!               "      col1 col2 col3"
+%!               "row1"
+%!               "row2"};
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
-%! fprintf (fid, "%10.3f %10.3f %10.3f\n", A(1,:));
-%! fprintf (fid, "%10.3f %10.3f %10.3f\n", A(2,:));
+%! fprintf (fid, "%s\n", A.textdata{1:2});
+%! fputs (fid, "row1\t3.1\t-7.2\t0\nrow2\t0.012\t6.5\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, " ");
-%! unlink (fn);
-%! assert (a, A);
-%! assert (d, " ");
-%! assert (h, 0);
-
-%!test
-%! # Header
-%! A.data = [3.1 -7.2 0; 0.012 6.5 128];
-%! A.textdata = {"This is a header row."; \
-%!               "this row does not contain any data, but the next one does."};
-%! fn  = tmpnam ();
-%! fid = fopen (fn, "w");
-%! fputs (fid, [A.textdata{1} "\n"]);
-%! fputs (fid, [A.textdata{2} "\n"]);
-%! fputs (fid, "3.1\t-7.2\t0\n0.012\t6.5\t128");
-%! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 2);
 
 %!test
-%! # Ignore empty rows containing only spaces
+%! ## Ignore empty rows containing only spaces
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
@@ -383,67 +417,93 @@
 %! assert (h, 0);
 
 %!test
-%! # Exponentials
+%! ## Exponentials
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "+3.1e0\t-72E-1\t0\n12e-3\t6.5\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
 %!test
-%! # Complex numbers
+%! ## Complex numbers
 %! A = [3.1 -7.2 0-3.4i; 0.012 -6.5+7.2i 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "3.1\t-7.2\t0-3.4i\n0.012\t-6.5+7.2i\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
+%! unlink (fn);
+%! assert (a, A);
+%! assert (d, "\t");
+%! assert (h, 0);
+
+%!test
+%! ## Exceptional values (Inf, NaN, NA)
+%! A = [3.1 Inf NA; -Inf NaN 128];
+%! fn  = tmpnam ();
+%! fid = fopen (fn, "w");
+%! fputs (fid, "3.1\tInf\tNA\n-Inf\tNaN\t128");
+%! fclose (fid);
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
 %!test
-%! # Missing values
-%! A = [3.1 NaN 0; 0.012 6.5 128];
+%! ## Missing values and Text Values
+%! A.data = [3.1 NA 0; 0.012 NA 128];
+%! A.textdata = {char(zeros(1,0))
+%!               "NO DATA"};
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
-%! fputs (fid, "3.1\t\t0\n0.012\t6.5\t128");
+%! fputs (fid, "3.1\t\t0\n0.012\tNO DATA\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
-%!test
-%! # CRLF for line breaks
+%!#test
+%! ## CRLF for line breaks
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "3.1\t-7.2\t0\r\n0.012\t6.5\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
-%!test
-%! # CR for line breaks
+%!#test
+%! ## CR for line breaks
 %! A = [3.1 -7.2 0; 0.012 6.5 128];
 %! fn  = tmpnam ();
 %! fid = fopen (fn, "w");
 %! fputs (fid, "3.1\t-7.2\t0\r0.012\t6.5\t128");
 %! fclose (fid);
-%! [a,d,h] = importdata (fn, "\\t");
+%! [a,d,h] = importdata (fn, '\t');
 %! unlink (fn);
 %! assert (a, A);
 %! assert (d, "\t");
 %! assert (h, 0);
 
+%!error importdata ()
+%!error importdata (1,2,3,4)
+%!error <FNAME must be a string> importdata (1)
+%!error <option -pastespecial not implemented> importdata ("-pastespecial")
+%!error <DELIMITER must be a single character> importdata ("foo", 1)
+%!error <DELIMITER must be a single character> importdata ("foo", "ab")
+%!error <HEADER_ROWS must be an integer> importdata ("foo", " ", "1")
+%!error <HEADER_ROWS must be an integer> importdata ("foo", " ", 1.5)
+%!error <not implemented for file format .au> importdata ("foo.au")
+%!error <not implemented for file format .avi> importdata ("foo.avi")
+
--- a/scripts/io/strread.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/strread.m	Sat Oct 05 11:22:09 2013 -0400
@@ -99,21 +99,21 @@
 ## pairs.  The following properties are recognized:
 ##
 ## @table @asis
-## @item "commentstyle"
+## @item @qcode{"commentstyle"}
 ## Parts of @var{str} are considered comments and will be skipped.
 ## @var{value} is the comment style and can be any of the following.
 ##
 ## @itemize
-## @item "shell"
+## @item @qcode{"shell"}
 ## Everything from @code{#} characters to the nearest end-of-line is skipped.
 ##
-## @item "c"
+## @item @qcode{"c"}
 ## Everything between @code{/*} and @code{*/} is skipped.
 ##
-## @item "c++"
+## @item @qcode{"c++"}
 ## Everything from @code{//} characters to the nearest end-of-line is skipped.
 ##
-## @item "matlab"
+## @item @qcode{"matlab"}
 ## Everything from @code{%} characters to the nearest end-of-line is skipped.
 ##
 ## @item user-supplied.  Two options:
@@ -122,34 +122,34 @@
 ## is skipped.
 ## @end itemize
 ##
-## @item "delimiter"
+## @item @qcode{"delimiter"}
 ## Any character in @var{value} will be used to split @var{str} into words
 ## (default value = any whitespace).
 ##
-## @item "emptyvalue":
+## @item @qcode{"emptyvalue"}:
 ## Value to return for empty numeric values in non-whitespace delimited data.
 ## The default is NaN@.  When the data type does not support NaN
 ## (int32 for example), then default is zero.
 ##
-## @item "multipledelimsasone"
+## @item @qcode{"multipledelimsasone"}
 ## Treat a series of consecutive delimiters, without whitespace in between,
 ## as a single delimiter.  Consecutive delimiter series need not be vertically
-## "aligned".
+## @qcode{"aligned"}.
 ##
-## @item "treatasempty"
+## @item @qcode{"treatasempty"}
 ## Treat single occurrences (surrounded by delimiters or whitespace) of the
 ## string(s) in @var{value} as missing values.
 ##
-## @item "returnonerror"
+## @item @qcode{"returnonerror"}
 ## If @var{value} true (1, default), ignore read errors and return normally.
 ## If false (0), return an error.
 ##
-## @item "whitespace"
+## @item @qcode{"whitespace"}
 ## Any character in @var{value} will be interpreted as whitespace and
 ## trimmed; the string defining whitespace must be enclosed in double
 ## quotes for proper processing of special characters like \t.
-## The default value for whitespace = " \b\r\n\t" (note the space).
-## Unless whitespace is set to '' (empty) AND at least one "%s" format
+## The default value for whitespace = @qcode{" \b\r\n\t"} (note the space).
+## Unless whitespace is set to '' (empty) AND at least one @qcode{"%s"} format
 ## conversion specifier is supplied, a space is always part of whitespace.
 ##
 ## @end table
@@ -159,11 +159,11 @@
 ## depends on the last character of @var{str}:
 ##
 ## @table @asis
-## @item last character = "\n"
+## @item last character = @qcode{"\n"}
 ## Data columns are padded with empty fields or Nan so that all columns
 ## have equal length 
 ##
-## @item last character is not "\n"
+## @item last character is not @qcode{"\n"}
 ## Data columns are not padded; strread returns columns of unequal length
 ##
 ## @end table
@@ -479,7 +479,7 @@
       iwrd = 1; iwrdp = 0; iwrdl = length (words{1});
       fwptr = zeros (1, numel (fmt_words));
       ii = 1;
-      while ii <= numel (fmt_words)
+      while (ii <= numel (fmt_words))
 
         nxt_wrd = 0;
         ## Keep track of which words nr. every fmt_words{} is (starts) in.
@@ -679,7 +679,7 @@
       ## Map to format
       ## FIXME - add support for formats like "<%s>", "%[a-zA-Z]"
       ##         Someone with regexp experience is needed.
-      switch fmt_words{m}(1:min (2, length (fmt_words{m})))
+      switch (fmt_words{m}(1:min (2, length (fmt_words{m}))))
         case "%s"
           if (pad_out)
             data(end+1:num_lines) = {""};
@@ -706,7 +706,7 @@
           ew = regexp (fmt_words{m}, '[nfudsq]') - 1;
           nfmt = ostrsplit (fmt_words{m}(2:ew), ".");
           swidth = str2double (nfmt{1});
-          switch fmt_words{m}(ew+1)
+          switch (fmt_words{m}(ew+1))
             case {"d", "u", "f", "n"}
               n = cellfun ("isempty", data);
               ### FIXME - erroneously formatted data lead to NaN, not an error
@@ -840,14 +840,14 @@
 %! assert (a, {"a b c"; "d e"; ""; "f"});
 
 %!test
-%! # Bug #33536
+%! ## Bug #33536
 %! [a, b, c] = strread ("1,,2", "%s%s%s", "delimiter", ",");
 %! assert (a{1}, "1");
 %! assert (b{1}, "");
 %! assert (c{1}, "2");
 
 %!test
-%! # Bug #33536
+%! ## Bug #33536
 %! a = strread ("[SomeText]", "[%s", "delimiter", "]");
 %! assert (a{1}, "SomeText");
 
@@ -868,7 +868,7 @@
 %! assert (d, int32 ([0; 0]));
 
 %!test
-%! # Default format (= %f)
+%! ## Default format (= %f)
 %1 [a, b, c] = strread ("0.12 0.234 0.3567");
 %1 assert (a, 0.12);
 %1 assert (b, 0.234);
@@ -879,13 +879,13 @@
 %1 assert (a, [0.41; 3.57]);
 
 %!test
-%! # TreatAsEmpty
+%! ## TreatAsEmpty
 %! [a, b, c, d] = strread ("1,2,3,NN,5,6\n", "%d%d%d%f", "delimiter", ",", "TreatAsEmpty", "NN");
 %! assert (c, int32 ([3; 0]));
 %! assert (d, [NaN; NaN]);
 
 %!test
-%! # No delimiters at all besides EOL.  Plain reading numbers & strings
+%! ## No delimiters at all besides EOL.  Plain reading numbers & strings
 %! str = "Text1Text2Text\nText398Text4Text\nText57Text";
 %! [a, b] = strread (str, "Text%dText%1sText");
 %! assert (a, int32 ([1; 398; 57]));
@@ -958,14 +958,14 @@
 %! assert (b, NaN);
 
 %!test
-%! # Bug #35999
+%! ## Bug #35999
 %! [a, b, c] = strread ("", "%f");
 %! assert (isempty (a));
 %! assert (isempty (b));
 %! assert (isempty (c));
 
-%% bug #37023
 %!test
+%! ## bug #37023
 %! [a, b] = strread (" 1. 1 \n  2 3 \n", "%f %f", "endofline", "\n");
 %! assert (a, [1; 2], 1e-15);
 %! assert (b, [1; 3], 1e-15);
@@ -994,3 +994,4 @@
 %% Illegal format specifiers
 %!test
 %!error <unknown format specifier> strread ("1.0", "%z")
+
--- a/scripts/io/textread.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/textread.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,13 +32,13 @@
 ## supports two more:
 ##
 ## @itemize
-## @item "headerlines":
+## @item @qcode{"headerlines"}:
 ## The first @var{value} number of lines of @var{filename} are skipped.
 ##
-## @item "endofline":
-## Specify a single character or "\r\n".  If no value is given, it will be
-## inferred from the file.  If set to "" (empty string) EOLs are ignored as
-## delimiters.
+## @item @qcode{"endofline"}:
+## Specify a single character or @qcode{"\r\n"}.  If no value is given, it
+## will be inferred from the file.  If set to "" (empty string) EOLs are
+## ignored as delimiters.
 ## @end itemize
 ##
 ## The optional input @var{n} specifies the number of data lines to read; in
@@ -73,7 +73,7 @@
   if (nlines < 1)
     printf ("textread: N = 0, no data read\n");
     varargout = cell (1, nargout);
-    return
+    return;
   endif
 
   ## Read file
@@ -219,6 +219,7 @@
 
 endfunction
 
+
 %!test
 %! f = tmpnam ();
 %! d = rand (5, 3);
@@ -315,3 +316,4 @@
 %!error <missing or illegal value for> textread (file_in_loadpath ("textread.m"), "", "headerlines")
 %!error <missing or illegal value for> textread (file_in_loadpath ("textread.m"), "", "headerlines", 'hh')
 %!error <character value required for> textread (file_in_loadpath ("textread.m"), "%s", "endofline", true)
+
--- a/scripts/io/textscan.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/io/textscan.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,20 +34,21 @@
 ## supports a few more:
 ##
 ## @itemize
-## @item "collectoutput":
+## @item @qcode{"collectoutput"}:
 ## A value of 1 or true instructs textscan to concatenate consecutive columns
 ## of the same class in the output cell array.  A value of 0 or false (default)
 ## leaves output in distinct columns.
 ##
-## @item "endofline":
-## Specify "\r", "\n" or "\r\n" (for CR, LF, or CRLF).  If no value is given,
-## it will be inferred from the file.  If set to "" (empty string) EOLs are
-## ignored as delimiters and added to whitespace.
+## @item @qcode{"endofline"}:
+## Specify @qcode{"\r"}, @qcode{"\n"} or @qcode{"\r\n"} (for CR, LF, or
+## CRLF).  If no value is given, it will be inferred from the file.  If set
+## to "" (empty string) EOLs are ignored as delimiters and added to
+## whitespace.
 ##
-## @item "headerlines":
+## @item @qcode{"headerlines"}:
 ## The first @var{value} number of lines of @var{fid} are skipped.
 ##
-## @item "returnonerror":
+## @item @qcode{"returnonerror"}:
 ## If set to numerical 1 or true (default), return normally when read errors
 ## have been encountered.  If set to 0 or false, return an error and no data.
 ## As the string or file is read by columns rather than by rows, and because
@@ -79,8 +80,8 @@
 
 function [C, position] = textscan (fid, format = "%f", varargin)
 
-  BUFLENGTH = 4096;               ## Read buffer
-  emptfmt = 0;                    ## Signals deliberately empty format string
+  BUFLENGTH = 4096;               # Read buffer
+  emptfmt = 0;                    # Signals deliberately empty format string
 
   ## Check input
   if (nargin < 1)
@@ -112,8 +113,7 @@
   endif
   if (nlines < 1)
     printf ("textscan: N = 0, no data read\n");
-    return
-  endif
+    return;  endif
 
   if (! any (strcmpi (args, "emptyvalue")))
     ## Matlab returns NaNs for missing values
@@ -276,7 +276,7 @@
         data_size = nblks * BUFLENGTH + count;
       else
         ## Compute data size to read incl complete EOL
-        data_size = (nblks * BUFLENGTH) + eoi(end + min (nlines, n_eoi) - n_eoi) \
+        data_size = (nblks * BUFLENGTH) + eoi(end + min (nlines, n_eoi) - n_eoi) ...
                     + l_eol_char - 1;
       endif
       fseek (fid, st_pos, "bof");
@@ -439,7 +439,7 @@
 %! assert (int8 (c{:}{:}), int8 ([ 76,  49,  10,  76,  50 ]));
 
 %!test
-%! # No delimiters at all besides EOL.  Skip fields, even empty fields
+%! ## No delimiters at all besides EOL.  Skip fields, even empty fields
 %! str = "Text1Text2Text\nTextText4Text\nText57Text";
 %! c = textscan (str, "Text%*dText%dText");
 %! assert (c{1}, int32 ([2; 4; 0]));
@@ -660,3 +660,4 @@
 %! fclose (fid);
 %! unlink (f);
 %! assert (msg1, lasterr);
+
--- a/scripts/java/javaclasspath.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/java/javaclasspath.m	Sat Oct 05 11:22:09 2013 -0400
@@ -42,13 +42,13 @@
 ## If called with a single input parameter @var{what}:
 ##
 ## @table @asis
-## @item "-dynamic"
+## @item @qcode{"-dynamic"}
 ## Return the dynamic classpath.
 ##
-## @item "-static"
+## @item @qcode{"-static"}
 ## Return the static classpath.
 ##
-## @item "-all"
+## @item @qcode{"-all"}
 ## Return both the static and dynamic classpath in a single cellstr.
 ## @end table
 ## @seealso{javaaddpath, javarmpath}
--- a/scripts/java/usejava.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/java/usejava.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,25 +24,25 @@
 ## Possible features are:
 ##
 ## @table @asis
-## @item "awt"
+## @item @qcode{"awt"}
 ## Abstract Window Toolkit for GUIs.
 ##
-## @item "desktop"
+## @item @qcode{"desktop"}
 ## Interactive desktop is running.
 ##
-## @item "jvm"
+## @item @qcode{"jvm"}
 ## Java Virtual Machine.
 ##
-## @item "swing"
+## @item @qcode{"swing"}
 ## Swing components for lightweight GUIs.
 ## @end table
 ##
 ## @code{usejava} determines if specific Java features are available in an
 ## Octave session.  This function is provided for scripts which may alter
-## their behavior based on the availability of Java.  The feature "desktop"
-## always returns @code{false} as Octave has no Java-based desktop.  Other
-## features may be available if Octave was compiled with the Java Interface
-## and Java is installed.
+## their behavior based on the availability of Java.  The feature
+## @qcode{"desktop"} always returns @code{false} as Octave has no Java-based
+## desktop.  Other features may be available if Octave was compiled with the
+## Java Interface and Java is installed.
 ## @end deftypefn
 
 ## Author: Rik Wehbring
--- a/scripts/linear-algebra/cond.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/cond.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,7 +21,7 @@
 ## @deftypefnx {Function File} {} cond (@var{A}, @var{p})
 ## Compute the @var{p}-norm condition number of a matrix.
 ##
-## @code{cond (@var{A})} is ## defined as
+## @code{cond (@var{A})} is defined as
 ## @tex
 ## $ {\parallel A \parallel_p * \parallel A^{-1} \parallel_p .} $
 ## @end tex
@@ -29,47 +29,49 @@
 ## @code{norm (@var{A}, @var{p}) * norm (inv (@var{A}), @var{p})}.
 ## @end ifnottex
 ##
-## By default @code{@var{p} = 2} is used which implies a (relatively slow)
+## By default, @code{@var{p} = 2} is used which implies a (relatively slow)
 ## singular value decomposition.  Other possible selections are
 ## @code{@var{p} = 1, Inf, "fro"} which are generally faster.  See
 ## @code{norm} for a full discussion of possible @var{p} values.
+##
+## The condition number of a matrix quantifies the sensitivity of the matrix
+## inversion operation when small changes are made to matrix elements.  Ideally
+## the condition number will be close to 1.  When the number is large this
+## indicates small changes (such as underflow or round-off error) will produce
+## large changes in the resulting output.  In such cases the solution results
+## from numerical computing are not likely to be accurate.
 ## @seealso{condest, rcond, norm, svd}
 ## @end deftypefn
 
 ## Author: jwe
 
-function retval = cond (A, p)
+function retval = cond (A, p = 2)
 
-  if (nargin && nargin < 3)
-    if (ndims (A) > 2)
-      error ("cond: only valid on 2-D objects");
-    endif
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+  endif
 
-    if (nargin <2)
-      p = 2;
-    endif
+  if (ndims (A) > 2)
+    error ("cond: A must be a 2-D matrix");
+  endif
 
-    if (! ischar (p) && p == 2)
-      [nr, nc] = size (A);
-      if (nr == 0 || nc == 0)
-        retval = 0.0;
-      elseif (any (any (isinf (A) | isnan (A))))
-        error ("cond: argument must not contain Inf or NaN values");
+  if (p == 2)
+    if (isempty (A))
+      retval = 0.0;
+    elseif (any (! isfinite (A(:))))
+      error ("cond: A must not contain Inf or NaN values");
+    else
+      sigma   = svd (A);
+      sigma_1 = sigma(1);
+      sigma_n = sigma(end);
+      if (sigma_1 == 0 || sigma_n == 0)
+        retval = Inf;
       else
-        sigma   = svd (A);
-        sigma_1 = sigma(1);
-        sigma_n = sigma(end);
-        if (sigma_1 == 0 || sigma_n == 0)
-          retval = Inf;
-        else
-          retval = sigma_1 / sigma_n;
-        endif
+        retval = sigma_1 / sigma_n;
       endif
-    else
-      retval = norm (A, p) * norm (inv (A), p);
     endif
   else
-    print_usage ();
+    retval = norm (A, p) * norm (inv (A), p);
   endif
 
 endfunction
@@ -89,4 +91,7 @@
 
 %!error cond ()
 %!error cond (1, 2, 3)
+%!error <A must be a 2-D matrix> cond (ones (1,3,3))
+%!error <A must not contain Inf or NaN value> cond ([1, 2;Inf 4])
+%!error <A must not contain Inf or NaN value> cond ([1, 2;NaN 4])
 
--- a/scripts/linear-algebra/expm.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/expm.m	Sat Oct 05 11:22:09 2013 -0400
@@ -83,10 +83,10 @@
 
   if (isscalar (A))
     r = exp (A);
-    return
+    return;
   elseif (strfind (typeinfo (A), "diagonal matrix"))
     r = diag (exp (diag (A)));
-    return
+    return;
   endif
 
   n = rows (A);
--- a/scripts/linear-algebra/krylov.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/krylov.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,8 +28,8 @@
 ## Using Householder reflections to guard against loss of orthogonality.
 ##
 ## If @var{V} is a vector, then @var{h} contains the Hessenberg matrix
-## such that @nospell{@xcode{a*u == u*h+rk*ek'}}, in which @code{rk =
-## a*u(:,k)-u*h(:,k)}, and @nospell{@xcode{ek'}} is the vector
+## such that @nospell{@tcode{a*u == u*h+rk*ek'}}, in which @code{rk =
+## a*u(:,k)-u*h(:,k)}, and @nospell{@tcode{ek'}} is the vector
 ## @code{[0, 0, @dots{}, 1]} of length @code{k}.  Otherwise, @var{h} is
 ## meaningless.
 ##
@@ -244,3 +244,4 @@
   b1 = a;
 
 endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/linear-algebra/linsolve.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,135 @@
+## Copyright (C) 2013 Nir Krakauer
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; If not, see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{x} =} linsolve (@var{A}, @var{b})
+## @deftypefnx {Function File} {@var{x} =} linsolve (@var{A}, @var{b}, @var{opts})
+## @deftypefnx {Function File} {[@var{x}, @var{R}] =} linsolve (@dots{})
+## Solve the linear system @code{A*x = b}.
+##
+## With no options, this function is equivalent to the left division operator
+## @w{(@code{x = A \ b})} or the matrix-left-divide function
+## @w{(@code{x = mldivide (A, b)})}.
+##
+## Octave ordinarily examines the properties of the matrix @var{A} and chooses
+## a solver that best matches the matrix.  By passing a structure @var{opts}
+## to @code{linsolve} you can inform Octave directly about the matrix @var{A}.
+## In this case Octave will skip the matrix examination and proceed directly
+## to solving the linear system.
+##
+## @strong{Warning:} If the matrix @var{A} does not have the properties
+## listed in the @var{opts} structure then the result will not be accurate
+## AND no warning will be given.  When in doubt, let Octave examine the matrix
+## and choose the appropriate solver as this step takes little time and the
+## result is cached so that it is only done once per linear system.
+##
+## Possible @var{opts} fields (set value to true/false):
+##
+## @table @asis
+## @item LT
+##   @var{A} is lower triangular
+##
+## @item UT
+##   @var{A} is upper triangular
+##
+## @item UHESS
+##   @var{A} is upper Hessenberg (currently makes no difference)
+##
+## @item SYM
+##   @var{A} is symmetric or complex Hermitian (currently makes no difference)
+##
+## @item POSDEF
+##   @var{A} is positive definite
+##
+## @item RECT
+##   @var{A} is general rectangular (currently makes no difference)
+##
+## @item TRANSA
+##   Solve @code{A'*x = b} by @code{transpose (A) \ b}
+## @end table
+##
+## The optional second output @var{R} is the inverse condition number of
+## @var{A} (zero if matrix is singular).
+## @seealso{mldivide, matrix_type, rcond}
+## @end deftypefn
+
+## Author: Nir Krakauer <nkrakauer@ccny.cuny.edu>
+
+function [x, R] = linsolve (A, b, opts)
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (! (isnumeric (A) && isnumeric (b)))
+    error ("linsolve: A and B must be numeric");
+  endif
+
+  ## Process any opts
+  if (nargin > 2)
+    if (! isstruct (opts))
+      error ("linsolve: OPTS must be a structure");
+    endif
+    trans_A = false;
+    if (isfield (opts, "TRANSA") && opts.TRANSA)
+      trans_A = true;
+      A = A';
+    endif
+    if (isfield (opts, "POSDEF") && opts.POSDEF)
+      A = matrix_type (A, "positive definite");
+    endif  
+    if (isfield (opts, "LT") && opts.LT)
+      if (trans_A)
+        A = matrix_type (A, "upper");
+      else
+        A = matrix_type (A, "lower");
+      endif
+    endif
+    if (isfield (opts, "UT") && opts.UT)
+      if (trans_A)
+        A = matrix_type (A, "lower");
+      else
+        A = matrix_type (A, "upper");
+      endif
+    endif        
+  endif
+
+  x = A \ b;
+
+  if (nargout > 1)
+    if (issquare (A))
+      R = rcond (A);
+    else
+      R = 0;
+    endif
+  endif
+endfunction
+
+
+%!test
+%! n = 4;
+%! A = triu (rand (n));
+%! x = rand (n, 1);
+%! b = A' * x;
+%! opts.UT = true;
+%! opts.TRANSA = true;
+%! assert (linsolve (A, b, opts), A' \ b);
+
+%!error linsolve ()
+%!error linsolve (1)
+%!error linsolve (1,2,3)
+%!error <A and B must be numeric> linsolve ({1},2)
+%!error <A and B must be numeric> linsolve (1,{2})
+%!error <OPTS must be a structure> linsolve (1,2,3)
--- a/scripts/linear-algebra/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -12,6 +12,7 @@
   linear-algebra/ishermitian.m \
   linear-algebra/issymmetric.m \
   linear-algebra/krylov.m \
+  linear-algebra/linsolve.m \
   linear-algebra/logm.m \
   linear-algebra/normest.m \
   linear-algebra/null.m \
--- a/scripts/linear-algebra/qzhess.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/qzhess.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,6 +39,8 @@
 ##
 ## Algorithm taken from Golub and Van Loan,
 ## @cite{Matrix Computations, 2nd edition}.
+## 
+## @seealso{lu, chol, hess, qr, qz, schur, svd}
 ## @end deftypefn
 
 ## Author: A. S. Hodel <scotte@eng.auburn.edu>
--- a/scripts/linear-algebra/rank.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/rank.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,8 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {} rank (@var{A})
 ## @deftypefnx {Function File} {} rank (@var{A}, @var{tol})
-## Compute the rank of @var{A}, using the singular value decomposition.
+## Compute the rank of matrix @var{A}, using the singular value decomposition.
+##
 ## The rank is taken to be the number of singular values of @var{A} that
 ## are greater than the specified tolerance @var{tol}.  If the second
 ## argument is omitted, it is taken to be
@@ -31,6 +32,29 @@
 ## @noindent
 ## where @code{eps} is machine precision and @code{sigma(1)} is the largest
 ## singular value of @var{A}.
+##
+## The rank of a matrix is the number of linearly independent rows or
+## columns and determines how many particular solutions exist to a system
+## of equations.  Use @code{null} for finding the remaining homogenous
+## solutions.
+##
+## Example:
+##
+## @example
+## @group
+## x = [1 2 3
+##      4 5 6
+##      7 8 9];
+## rank (x)
+##   @result{} 2
+## @end group
+## @end example
+##
+## @noindent
+## The number of linearly independent rows is only 2 because the final row
+## is a linear combination of -1*row1 + 2*row2.
+##
+## @seealso{null, sprank, svd}
 ## @end deftypefn
 
 ## Author: jwe
@@ -104,6 +128,10 @@
 %! A = eye (100);
 %! assert (rank (A), 100);
 
+%!assert (rank ([]), 0)
+%!assert (rank ([1:9]), 1)
+%!assert (rank ([1:9]'), 1)
+
 %!test
 %! A = [1, 2, 3; 1, 2.001, 3; 1, 2, 3.0000001];
 %! assert (rank (A), 3);
--- a/scripts/linear-algebra/subspace.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/subspace.m	Sat Oct 05 11:22:09 2013 -0400
@@ -59,3 +59,4 @@
   endif
 
 endfunction
+
--- a/scripts/linear-algebra/trace.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/linear-algebra/trace.m	Sat Oct 05 11:22:09 2013 -0400
@@ -18,7 +18,11 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} trace (@var{A})
-## Compute the trace of @var{A}, @code{sum (diag (@var{A}))}.
+## Compute the trace of @var{A}, the sum of the elements along the main
+## diagonal.
+##
+## The implementation is straightforward: @code{sum (diag (@var{A}))}.
+## @seealso{eig}
 ## @end deftypefn
 
 ## Author: jwe
@@ -33,7 +37,7 @@
     error ("trace: only valid on 2-D objects");
   elseif (isempty (A))
     y = 0;
-  elseif (any (size (A) == 1))
+  elseif (isvector (A))
     y = A(1);
   else
     y = sum (diag (A));
@@ -46,7 +50,8 @@
 %!assert (trace ([1, 2; 3, 4; 5, 6]), 5)
 %!assert (trace ([1, 3, 5; 2, 4, 6]), 5)
 %!assert (trace ([]), 0)
-%!assert (trace (randn (1,0)), 0)
+%!assert (trace (rand (1,0)), 0)
+%!assert (trace ([3:10]), 3)
 
 %!error trace ()
 %!error trace (1, 2)
--- a/scripts/miscellaneous/bug_report.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/bug_report.m	Sat Oct 05 11:22:09 2013 -0400
@@ -47,3 +47,4 @@
 
 ## Mark file as being tested.  No real test needed for this function.
 %!assert (1)
+
--- a/scripts/miscellaneous/bunzip2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/bunzip2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,3 +40,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/bzip2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/bzip2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,10 +21,10 @@
 ## @deftypefn  {Function File} {@var{entries} =} bzip2 (@var{files})
 ## @deftypefnx {Function File} {@var{entries} =} bzip2 (@var{files}, @var{outdir})
 ## Compress the list of files specified in @var{files}.
-## Each file is compressed separately and a new file with a ".bz2" extension
-## is created.  The original files are not modified.  Existing compressed files
-## are silently overwritten.  If @var{outdir} is defined the compressed
-## files are placed in this directory.
+## Each file is compressed separately and a new file with a @file{".bz2"}
+## extension is created.  The original files are not modified.  Existing
+## compressed files are silently overwritten.  If @var{outdir} is defined the
+## compressed files are placed in this directory.
 ## @seealso{bunzip2, gzip, zip, tar}
 ## @end deftypefn
 
@@ -44,7 +44,7 @@
 
 
 %!xtest
-%! # test for correct cleanup of temporary files
+%! ## test for correct cleanup of temporary files
 %! unwind_protect
 %!   filename = tmpnam;
 %!   dummy    = 1;
--- a/scripts/miscellaneous/cast.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/cast.m	Sat Oct 05 11:22:09 2013 -0400
@@ -43,3 +43,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/compare_versions.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/compare_versions.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,51 +22,51 @@
 ##
 ## This function assumes that versions @var{v1} and @var{v2} are
 ## arbitrarily long strings made of numeric and period characters
-## possibly followed by an arbitrary string (e.g., "1.2.3", "0.3",
-## "0.1.2+", or "1.2.3.4-test1").
+## possibly followed by an arbitrary string (e.g., @qcode{"1.2.3"},
+## @qcode{"0.3"}, @qcode{"0.1.2+"}, or @qcode{"1.2.3.4-test1"}).
 ##
 ## The version is first split into numeric and character portions
-## and then the parts are padded to be the same length (i.e., "1.1" would be
-## padded to be "1.1.0" when being compared with "1.1.1", and
-## separately, the character parts of the strings are padded with
-## nulls).
+## and then the parts are padded to be the same length (i.e., @qcode{"1.1"}
+## would be padded to be @qcode{"1.1.0"} when being compared with
+## @qcode{"1.1.1"}, and separately, the character parts of the strings are
+## padded with nulls).
 ##
 ## The operator can be any logical operator from the set
 ##
 ## @itemize @bullet
 ## @item
-## "=="
+## @qcode{"=="}
 ## equal
 ##
 ## @item
-## "<"
+## @qcode{"<"}
 ## less than
 ##
 ## @item
-## "<="
+## @qcode{"<="}
 ## less than or equal to
 ##
 ## @item
-## ">"
+## @qcode{">"}
 ## greater than
 ##
 ## @item
-## ">="
+## @qcode{">="}
 ## greater than or equal to
 ##
 ## @item
-## "!="
+## @qcode{"!="}
 ## not equal
 ##
 ## @item
-## "~="
+## @qcode{"~="}
 ## not equal
 ## @end itemize
 ##
-## Note that version "1.1-test2" will compare as greater than
-## "1.1-test10".  Also, since the numeric part is compared first, "a"
-## compares less than "1a" because the second string starts with a
-## numeric part even though @code{double ("a")} is greater than
+## Note that version @qcode{"1.1-test2"} will compare as greater than
+## @qcode{"1.1-test10"}.  Also, since the numeric part is compared first,
+## @qcode{"a"} compares less than @qcode{"1a"} because the second string
+## starts with a numeric part even though @code{double ("a")} is greater than
 ## @code{double ("1").}
 ## @end deftypefn
 
--- a/scripts/miscellaneous/computer.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/computer.m	Sat Oct 05 11:22:09 2013 -0400
@@ -38,10 +38,10 @@
 ## of elements for an array.
 ##
 ## If three output arguments are requested, also return the byte order
-## of the current system as a character (@code{"B"} for big-endian or
-## @code{"L"} for little-endian).
+## of the current system as a character (@qcode{"B"} for big-endian or
+## @qcode{"L"} for little-endian).
 ##
-## If the argument @code{"arch"} is specified, return a string
+## If the argument @qcode{"arch"} is specified, return a string
 ## indicating the architecture of the computer on which Octave is
 ## running.
 ## @end deftypefn
--- a/scripts/miscellaneous/copyfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/copyfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,26 +19,33 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {[@var{status}, @var{msg}, @var{msgid}] =} copyfile (@var{f1}, @var{f2})
 ## @deftypefnx {Function File} {[@var{status}, @var{msg}, @var{msgid}] =} copyfile (@var{f1}, @var{f2}, 'f')
-## Copy the file @var{f1} to the new name @var{f2}.  The name @var{f1}
-## may contain globbing patterns.  If @var{f1} expands to multiple file
-## names, @var{f2} must be a directory.  If the force flag 'f' is given then
-## existing destination files will be overwritten without prompting.
+## Copy the file @var{f1} to the destination @var{f2}.
+##
+## The name @var{f1} may contain globbing patterns.  If @var{f1} expands to
+## multiple file names, @var{f2} must be a directory.
+## when the force flag @qcode{'f'} is given any existing files will be
+## overwritten without prompting.
 ##
-## If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty
-## character strings.  Otherwise, @var{status} is 0, @var{msg} contains a
-## system-dependent error message, and @var{msgid} contains a unique
-## message identifier.
-## @seealso{movefile}
+## If successful, @var{status} is 1, and @var{msg}, @var{msgid} are empty
+## character strings ("").  Otherwise, @var{status} is 0, @var{msg} contains a
+## system-dependent error message, and @var{msgid} contains a unique message
+## identifier.  Note that the status code is exactly opposite that of the
+## @code{system} command.
+## @seealso{movefile, rename, unlink, delete, glob}
 ## @end deftypefn
 
 function [status, msg, msgid] = copyfile (f1, f2, force)
 
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
   max_cmd_line = 1024;
   status = true;
   msg = "";
   msgid = "";
 
-  ## FIXME -- maybe use the same method as in ls to allow users control
+  ## FIXME: maybe use the same method as in ls to allow users control
   ## over the command that is executed.
 
   if (ispc () && ! isunix ()
@@ -51,80 +58,77 @@
     cmd_force_flag = "-f";
   endif
 
-  if (nargin == 2 || nargin == 3)
-    ## Input type check.
-    if (! (ischar (f1) || iscellstr (f1)))
-      error ("copyfile: first argument must be a character string or a cell array of character strings");
-    endif
+  ## Input type check.
+  if (! (ischar (f1) || iscellstr (f1)))
+    error ("copyfile: F1 must be a character string or a cell array of character strings");
+  endif
 
-    if (! ischar (f2))
-      error ("copyfile: second argument must be a character string");
-    endif
+  if (! ischar (f2))
+    error ("copyfile: F2 must be a character string");
+  endif
 
-    if (nargin == 3 && strcmp (force, "f"))
-      cmd = cstrcat (cmd, " ", cmd_force_flag);
-    endif
+  if (nargin == 3 && strcmp (force, "f"))
+    cmd = [cmd " " cmd_force_flag];
+  endif
 
-    ## If f1 isn't a cellstr convert it to one.
-    if (ischar (f1))
-      f1 = cellstr (f1);
-    endif
-
-    ## If f1 has more than 1 element f2 must be a directory
-    isdir = (exist (f2, "dir") != 0);
-    if (length (f1) > 1 && ! isdir)
-      error ("copyfile: when copying multiple files, second argument must be a directory");
-    endif
+  ## If f1 isn't a cellstr convert it to one.
+  if (ischar (f1))
+    f1 = cellstr (f1);
+  endif
 
-    ## Protect the file name(s).
-    f1 = glob (f1);
-    if (isempty (f1))
-      error ("copyfile: no files to move");
-    endif
-    p1 = sprintf ("\"%s\" ", f1{:});
-    p2 = tilde_expand (f2);
+  ## If f1 has more than 1 element f2 must be a directory
+  isdir = (exist (f2, "dir") != 0);
+  if (length (f1) > 1 && ! isdir)
+    error ("copyfile: when copying multiple files, F2 must be a directory");
+  endif
 
-    if (isdir && length (p1) > max_cmd_line)
-      l2 = length (p2) + length (cmd) + 6;
-      while (! isempty (f1))
-        p1 = sprintf ("\"%s\" ", f1{1});
+  ## Protect the file name(s).
+  f1 = glob (f1);
+  if (isempty (f1))
+    error ("copyfile: no files to move");
+  endif
+  p1 = sprintf ('"%s" ', f1{:});
+  p2 = tilde_expand (f2);
+
+  if (isdir && length (p1) > max_cmd_line)
+    l2 = length (p2) + length (cmd) + 6;
+    while (! isempty (f1))
+      p1 = sprintf ('"%s" ', f1{1});
+      f1(1) = [];
+      while (! isempty (f1)
+             && (length (p1) + length (f1{1}) + l2 < max_cmd_line))
+        p1 = sprintf ('%s"%s" ', p1, f1{1});
         f1(1) = [];
-        while (!isempty (f1) && (length (p1) + length (f1{1}) + l2 <
-                                 max_cmd_line))
-          p1 = sprintf ("%s\"%s\" ", p1, f1{1});
-          f1(1) = [];
-        endwhile
+      endwhile
 
-        if (ispc () && ! isunix ()
-            && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
-          p1 = strrep (p1, "\\", "/");
-          p2 = strrep (p2, "\\", "/");
-        endif
-
-        ## Copy the files.
-        [err, msg] = system (sprintf ("%s %s\"%s\"", cmd, p1, p2));
-        if (err < 0)
-          status = false;
-          msgid = "copyfile";
-          break;
-        endif
-      endwhile
-    else
       if (ispc () && ! isunix ()
           && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
-        p1 = strrep (p1, "\\", "/");
-        p2 = strrep (p2, "\\", "/");
+        p1 = strrep (p1, '\', '/');
+        p2 = strrep (p2, '\', '/');
       endif
 
       ## Copy the files.
-      [err, msg] = system (sprintf ("%s %s\"%s\"", cmd, p1, p2));
-      if (err < 0)
+      [err, msg] = system (sprintf ('%s %s"%s"', cmd, p1, p2));
+      if (err != 0)
         status = false;
         msgid = "copyfile";
+        break;
       endif
+    endwhile
+  else
+    if (ispc () && ! isunix ()
+        && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
+      p1 = strrep (p1, '\', '/');
+      p2 = strrep (p2, '\', '/');
     endif
-  else
-    print_usage ();
+
+    ## Copy the files.
+    [err, msg] = system (sprintf ('%s %s"%s"', cmd, p1, p2));
+    if (err != 0)
+      status = false;
+      msgid = "copyfile";
+    endif
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/debug.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/debug.m	Sat Oct 05 11:22:09 2013 -0400
@@ -79,15 +79,16 @@
 ##
 ## @noindent
 ## When Octave encounters a breakpoint, or other reason to enter debug
-## mode, the prompt changes to @code{"debug>"}.  The workspace of the function
+## mode, the prompt changes to @qcode{"debug>"}.  The workspace of the function
 ## where the breakpoint was encountered becomes available and any Octave
 ## command that is valid in that workspace context may be executed.
 ##
 ## @seealso{dbstop, dbclear, dbstatus, dbwhere, dbtype, dbcont, dbquit,
-##          dbstack, dbup, dbdown, keyboard, debug_on_error, debug_on_warning,
-##          debug_on_interrupt, isdebugmode}
+## dbstack, dbup, dbdown, keyboard, debug_on_error, debug_on_warning,
+## debug_on_interrupt, isdebugmode}
 ## @end deftypefn
 
 function debug ()
   help ("debug");
 endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/miscellaneous/desktop.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,50 @@
+## Copyright (C) 2013 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} @var{used} = desktop ("-inuse")
+## Return true if the desktop (GUI) is currently in use.
+## @seealso{isguirunning}
+## @end deftypefn
+
+function retval = desktop (arg)
+
+  if (nargin == 0)
+    if (isguirunning ())
+      return;  # desktop() is a NOP when GUI running
+    else
+      print_usage ();
+    endif
+  elseif (nargin > 1)
+    error ('desktop: only one argument, "-inuse", is allowed');
+  endif
+  
+  switch (tolower (arg))
+    case "-inuse"
+      retval = isguirunning ();
+    otherwise
+      print_usage ();
+  endswitch
+
+endfunction
+
+
+## Test input validation
+%!error <only one argument, "-inuse", is allowed> desktop (1,2)
+%!error desktop ("-invalid_option")
+
--- a/scripts/miscellaneous/dir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/dir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,40 +17,51 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {} dir (@var{directory})
+## @deftypefn  {Function File} {} dir
+## @deftypefnx {Function File} {} dir (@var{directory})
 ## @deftypefnx {Function File} {[@var{list}] =} dir (@var{directory})
-## Display file listing for directory @var{directory}.  If a return
-## value is requested, return a structure array with the fields
+## Display file listing for directory @var{directory}.
+##
+## If @var{directory} is not specified then list the present working directory.
+##
+## If a return value is requested, return a structure array with the fields
+##
+## @table @asis
+## @item name
+## File or directory name. 
+##
+## @item date
+## Timestamp of file modification (string value).
 ##
-## @example
-## @group
-## name
-## bytes
-## date
-## isdir
-## statinfo
-## @end group
-## @end example
+## @item bytes
+## File size in bytes.
+##
+## @item isdir
+## True if name is a directory. 
+##
+## @item datenum
+## Timestamp of file modification as serial date number (double).
 ##
-## @noindent
-## where @code{statinfo} is the structure returned from @code{stat}.
+## @item statinfo
+## Information structure returned from @code{stat}.
+## @end table
 ##
-## If @var{directory} is not a directory, return information about the
-## named @var{filename}.  @var{directory} may be a list of directories
-## specified either by name or with wildcard characters (like * and ?)
-## which will be expanded with glob.
+## If @var{directory} is a filename, rather than a directory, then return
+## information about the named file.  @var{directory} may be a list of
+## directories specified either by name or with wildcard characters (like *
+## and ?) which will be expanded with @code{glob}.
 ##
 ## Note that for symbolic links, @code{dir} returns information about
-## the file that the symbolic link points to instead of the link itself.
+## the file that the symbolic link points to rather than the link itself.
 ## However, if the link points to a nonexistent file, @code{dir} returns
 ## information about the link.
-## @seealso{ls, stat, lstat, readdir, glob, filesep}
+## @seealso{ls, readdir, glob, what, stat}
 ## @end deftypefn
 
 ## Author: jwe
 
-## FIXME -- this is quite slow for large directories, so perhaps
-## it should be converted to C++.
+## FIXME: This is quite slow for large directories, so perhaps
+##        it should be converted to C++.
 
 function retval = dir (directory)
 
@@ -111,7 +122,7 @@
             endif
           endif
           [dummy, fn, ext] = fileparts (fn);
-          fn = cstrcat (fn, ext);
+          fn = [fn ext];
           info(i,1).name = fn;
           lt = localtime (st.mtime);
           info(i,1).date = strftime ("%d-%b-%Y %T", lt);
@@ -140,3 +151,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/dos.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/dos.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## Execute a system command if running under a Windows-like operating
 ## system, otherwise do nothing.  Return the exit status of the program
 ## in @var{status} and any output from the command in @var{text}.
-## When called with no output argument, or the "-echo" argument is
+## When called with no output argument, or the @qcode{"-echo"} argument is
 ## given, then @var{text} is also sent to standard output.
 ## @seealso{unix, system, isunix, ispc}
 ## @end deftypefn
--- a/scripts/miscellaneous/dump_prefs.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/dump_prefs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -96,3 +96,4 @@
   endfor
 
 endfunction
+
--- a/scripts/miscellaneous/edit.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/edit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,7 +30,7 @@
 ## If the function @var{name} is available in a file on your path and
 ## that file is modifiable, then it will be edited in place.  If it
 ## is a system function, then it will first be copied to the directory
-## @env{HOME} (see further down) and then edited.
+## @env{HOME} (see below) and then edited.
 ## If no file is found, then the m-file
 ## variant, ending with ".m", will be considered.  If still no file
 ## is found, then variants with a leading "@@" and then with both a
@@ -42,26 +42,27 @@
 ## to contain that function along with its current definition.
 ##
 ## @item
-## If @code{name.cc} is specified, then it will search for @code{name.cc}
-## in the path and try to modify it, otherwise it will create a new
-## @file{.cc} file in @env{HOME}.  If @var{name} happens to be an
+## If @code{@var{name}.cc} is specified, then it will search for
+## @code{@var{name}.cc} in the path and try to modify it, otherwise it will
+## create a new @file{.cc} file in @env{HOME}.  If @var{name} happens to be an
 ## m-file or interpreter defined function, then the text of that
 ## function will be inserted into the .cc file as a comment.
 ##
 ## @item
-## If @var{name.ext} is on your path then it will be edited, otherwise
-## the editor will be started with @file{HOME/name.ext} as the
-## filename.  If @file{name.ext} is not modifiable, it will be copied to
+## If @file{@var{name}.ext} is on your path then it will be edited, otherwise
+## the editor will be started with @file{@env{HOME}/@var{name}.ext} as the
+## filename.  If @file{@var{name}.ext} is not modifiable, it will be copied to
 ## @env{HOME} before editing.
 ##
-## @strong{Warning:} You may need to clear name before the new definition
+## @strong{Warning:} You may need to clear @var{name} before the new definition
 ## is available.  If you are editing a .cc file, you will need
-## to mkoctfile @file{name.cc} before the definition will be available.
+## to execute @code{mkoctfile @file{@var{name}.cc}} before the definition
+## will be available.
 ## @end itemize
 ##
 ## If @code{edit} is called with @var{field} and @var{value} variables,
-## the value of the control field @var{field} will be @var{value}.
-## If an output argument is requested and the first argument is @code{get}
+## the value of the control field @var{field} will be set to @var{value}.
+## If an output argument is requested and the first input argument is @code{get}
 ## then @code{edit} will return the value of the control field @var{field}.
 ## If the control field does not exist, edit will return a structure
 ## containing all fields and values.  Thus, @code{edit get all} returns
@@ -75,18 +76,19 @@
 ## @code{getenv ("EDITOR")} and defaults to @code{emacs}.  Use @code{%s}
 ## In place of the function name.  For example,
 ##
-## @table @samp
-## @item [EDITOR, " %s"]
+## @table @asis
+## @item @code{[EDITOR, " %s"]}
 ## Use the editor which Octave uses for @code{edit_history}.
 ##
-## @item "xedit %s &"
+## @item @nospell{"xedit %s &"}
 ## pop up simple X11 editor in a separate window
 ##
-## @item "gnudoit -q \"(find-file \\\"%s\\\")\""
+## @item @nospell{"gnudoit -q \"(find-file \\\"%s\\\")\""}
 ## Send it to current Emacs; must have @code{(gnuserv-start)} in @file{.emacs}.
 ## @end table
 ##
-## See also field 'mode', which controls how the editor is run by Octave.
+## See also field @qcode{"mode"}, which controls how the editor is run by
+## Octave.
 ##
 ## On Cygwin, you will need to convert the Cygwin path to a Windows
 ## path if you are using a native Windows editor.  For example:
@@ -97,18 +99,18 @@
 ## @end smallexample
 ##
 ## @item home
-## This is the location of user local m-files.  Be be sure it is in your
+## This is the location of user local m-files.  Be sure it is in your
 ## path.  The default is @file{~/octave}.
 ##
 ## @item author
 ## This is the name to put after the "## Author:" field of new functions.
-## By default it guesses from the @code{gecos} field of password database.
+## By default it guesses from the @code{gecos} field of the password database.
 ##
 ## @item email
 ## This is the e-mail address to list after the name in the author field.
 ## By default it guesses @code{<$LOGNAME@@$HOSTNAME>}, and if @code{$HOSTNAME}
 ## is not defined it uses @code{uname -n}.  You probably want to override this.
-## Be sure to use @code{<user@@host>} as your format.
+## Be sure to use the format @code{<user@@host>}.
 ##
 ## @item license
 ##
@@ -132,8 +134,9 @@
 ## @item mode
 ## This value determines whether the editor should be started in async mode
 ## (editor is started in the background and Octave continues) or sync mode
-## (Octave waits until the editor exits).  Set it to "sync" to start the editor
-## in sync mode.  The default is "async" (see also "system").
+## (Octave waits until the editor exits).  Set it to @qcode{"sync"} to start
+## the editor in sync mode.  The default is @qcode{"async"}
+## (@pxref{XREFsystem,,system}).
 ##
 ## @item editinplace
 ## Determines whether files should be edited in place, without regard to
@@ -150,11 +153,11 @@
 
   ## Pick up globals or default them.
 
-  persistent FUNCTION = struct ("EDITOR", cstrcat (EDITOR (), " %s"),
+  persistent FUNCTION = struct ("EDITOR", [EDITOR() " %s"],
                                 "HOME", fullfile (default_home, "octave"),
                                 "AUTHOR", default_user(1),
-                                "EMAIL",  [],
-                                "LICENSE",  "GPL",
+                                "EMAIL", [],
+                                "LICENSE", "GPL",
                                 "MODE", "async",
                                 "EDITINPLACE", false);
   ## Make sure the stateval variables survive "clear functions".
@@ -162,85 +165,84 @@
 
   if (nargin == 1)
     ## User has supplied one arg, this can be a single file name
-    ## or a cell array of strings containing multiple files to be
-    ## opened
-    if (iscellstr(varargin{1}))
-      ## If first arg is a cell array of strings, it becomes the
-      ## list of files to be edited
+    ## or a cell array of strings containing multiple files to be opened
+    if (iscellstr (varargin{1}))
+      ## If first arg is a cell array of strings, 
+      ## it becomes the list of files to be edited
       editfilelist = varargin{1};
-    elseif (ischar(varargin{1}))
+    elseif (ischar (varargin{1}))
       ## If first arg is a string, create a cell array of strings
-      ## of length one (by copying the input cell array)
+      ## of length 1 (by copying the input cell array)
       editfilelist = varargin(1);
     else
-      error('edit: expected file to be a string or cell array of strings');
+      error ("edit: expected file to be a string or cell array of strings");
     endif
   elseif (nargin == 2)
-    ## User has supplied two arguments, these could be two file
-    ## names, or a combination of editor state name and new value
-    ## for that state, so first check for the various states
+    ## User has supplied two arguments, these could be two file names,
+    ## or a combination of editor state name and new value for that state,
+    ## so first check for the various states
     statevar = varargin{1};
     stateval = varargin{2};
     switch (toupper (statevar))
-    case "EDITOR"
-      FUNCTION.EDITOR = stateval;
-      return
-    case "HOME"
-      if (! isempty (stateval) && stateval(1) == "~")
-        stateval = [ default_home, stateval(2:end) ];
-      endif
-      FUNCTION.HOME = stateval;
-      return
-    case "AUTHOR"
-      FUNCTION.AUTHOR = stateval;
-      return
-    case "EMAIL"
-      FUNCTION.EMAIL = stateval;
-      return
-    case "LICENSE"
-      FUNCTION.LICENSE = stateval;
-      return
-    case "MODE"
-      if (strcmp (stateval, "sync") || strcmp (stateval, "async"))
-        FUNCTION.MODE = stateval;
-      else
-        error ('edit: expected "edit MODE sync|async"');
-      endif
-      return
-    case "EDITINPLACE"
-      if (ischar (stateval))
-        if (strcmpi (stateval, "true"))
-          stateval = true;
-        elseif (strcmpi (stateval, "false"))
-          stateval = false;
+      case "EDITOR"
+        FUNCTION.EDITOR = stateval;
+        return;
+      case "HOME"
+        if (! isempty (stateval) && stateval(1) == "~")
+          stateval = [ default_home, stateval(2:end) ];
+        endif
+        FUNCTION.HOME = stateval;
+        return;
+      case "AUTHOR"
+        FUNCTION.AUTHOR = stateval;
+        return;
+      case "EMAIL"
+        FUNCTION.EMAIL = stateval;
+        return;
+      case "LICENSE"
+        FUNCTION.LICENSE = stateval;
+        return;
+      case "MODE"
+        if (strcmp (stateval, "sync") || strcmp (stateval, "async"))
+          FUNCTION.MODE = stateval;
         else
-          stateval = eval (stateval);
+          error ('edit: expected "edit MODE sync|async"');
+        endif
+        return;
+      case "EDITINPLACE"
+        if (ischar (stateval))
+          if (strcmpi (stateval, "true"))
+            stateval = true;
+          elseif (strcmpi (stateval, "false"))
+            stateval = false;
+          else
+            stateval = eval (stateval);
+          endif
         endif
-      endif
-      FUNCTION.EDITINPLACE = stateval;
-      return
-    case "GET"
-      if (isfield (FUNCTION, toupper (stateval)))
-        ret = FUNCTION.(toupper (stateval));
-      else
-        ret = FUNCTION;
-      endif
-      return
-    otherwise
-      ## If none of the states match, assume both inputs are
-      ## actually both file names to be opened
-      editfilelist = varargin;
+        FUNCTION.EDITINPLACE = stateval;
+        return;
+      case "GET"
+        if (isfield (FUNCTION, toupper (stateval)))
+          ret = FUNCTION.(toupper (stateval));
+        else
+          ret = FUNCTION;
+        endif
+        return;
+      otherwise
+        ## If none of the states match, assume both inputs are
+        ## actually both file names to be opened
+        editfilelist = varargin;
     endswitch
   elseif (nargin > 2)
-    if (iscellstr(varargin))
+    if (iscellstr (varargin))
       editfilelist = varargin;
     else
-      error('edit: if supplying more than one input all inputs must be strings containing fiel names to open.');
+      error ("edit: if supplying more than one input all inputs must be strings containing field names to open.");
     endif
   endif
 
   ## Start the editor without a file if no file is given.
-  if (nargin < 1)
+  if (nargin == 0)
     if (exist (FUNCTION.HOME, "dir") == 7)
       curr_dir = pwd ();
       unwind_protect
@@ -255,11 +257,11 @@
     return;
   endif
 
-  if (numel(editfilelist) > 1)
+  if (numel (editfilelist) > 1)
 
     ## Call edit on each of the files in the list if there are more than 1
-    for i = 1:numel(editfilelist)
-      edit(editfilelist{i});
+    for i = 1:numel (editfilelist)
+      edit (editfilelist{i});
     endfor
 
   else
@@ -296,15 +298,13 @@
     ## If file has no extension, add file.m and file.cc to the list.
     idx = rindex (file, ".");
     if (idx == 0)
-      ## Create the list of files to look for
-      filelist = {file};
       if (isempty (regexp (file, '\.m$')))
         ## No ".m" at the end of the file, add to the list.
-        filelist{end+1} = cat (2, file, ".m");
+        filelist{end+1} = [file ".m"];
       endif
       if (isempty (regexp (file, '\.cc$')))
         ## No ".cc" at the end of the file, add to the list.
-        filelist{end+1} = cat (2, file, ".cc");
+        filelist{end+1} = [file ".cc"];
       endif
     endif
 
@@ -313,7 +313,7 @@
       ## No "@" at the beginning of the file, add to the list.
       numfiles = numel (filelist);
       for n = 1:numfiles
-        filelist{n+numfiles} = cat (2, "@", filelist{n});
+        filelist{n+numfiles} = ["@" filelist{n}];
       endfor
     endif
 
@@ -335,12 +335,12 @@
         do_edit (FUNCTION.EDITOR, fileandpath, FUNCTION.MODE);
         return;
       else
-        ## If the file is modifiable in place then edit it, otherwise make
-        ## a copy in HOME and then edit it.
+        ## If the file is modifiable in place then edit it,
+        ## otherwise make a copy in HOME and then edit it.
         fid = fopen (fileandpath, "r+t");
         if (fid < 0)
           from = fileandpath;
-          fileandpath = cstrcat (FUNCTION.HOME, from (rindex (from, filesep):end));
+          fileandpath = [FUNCTION.HOME, from(rindex(from, filesep):end)];
           [status, msg] = copyfile (from, fileandpath, 1);
           if (status == 0)
             error (msg);
@@ -359,16 +359,14 @@
     idx = rindex (file, ".");
     name = file(1:idx-1);
     ext = file(idx+1:end);
-    switch (ext)
-      case {"cc", "m"}
-        0;
-      otherwise
-        do_edit (FUNCTION.EDITOR, fileandpath, FUNCTION.MODE);
-        return;
-    endswitch
+    if (! any (strcmp (ext, {"cc", "m"})))
+      ## Some unknown file.  Just open it up.
+      do_edit (FUNCTION.EDITOR, fileandpath, FUNCTION.MODE);
+      return;
+    endif
 
-    ## The file doesn't exist in path so create it, put in the function
-    ## template and edit it.
+    ## The file doesn't exist in path so
+    ## create it, put in the function template, and edit it.
 
     ## Guess the email name if it was not given.
     if (isempty (FUNCTION.EMAIL))
@@ -377,7 +375,7 @@
         host = getenv ("COMPUTERNAME");
       endif
       if (isempty (host))
-        [status, host] = system ("uname -n");
+        [~, host] = system ("uname -n");
         ## trim newline from end of hostname
         if (! isempty (host))
           host = host(1:end-1);
@@ -386,76 +384,75 @@
       if (isempty (host))
         FUNCTION.EMAIL = " ";
       else
-        FUNCTION.EMAIL = cstrcat ("<", default_user(0), "@", host, ">");
+        FUNCTION.EMAIL = ["<" default_user(0) "@" host ">"];
       endif
     endif
 
     ## Fill in the revision string.
     now = localtime (time);
-    revs = cstrcat ("Created: ", strftime ("%Y-%m-%d", now));
+    revs = ["Created: " strftime("%Y-%m-%d",now)];
 
     ## Fill in the copyright string.
-    copyright = cstrcat (strftime ("Copyright (C) %Y ", now), FUNCTION.AUTHOR);
+    copyright = [strftime("Copyright (C) %Y ",now) FUNCTION.AUTHOR];
 
     ## Fill in the author tag field.
-    author = cstrcat ("Author: ", FUNCTION.AUTHOR, " ", FUNCTION.EMAIL);
+    author = ["Author: " FUNCTION.AUTHOR " " FUNCTION.EMAIL];
 
     ## Fill in the header.
     uclicense = toupper (FUNCTION.LICENSE);
     switch (uclicense)
       case "GPL"
         head = cstrcat (copyright, "\n\n", "\
-  This program is free software; you can redistribute it and/or modify\n\
-  it under the terms of the GNU General Public License as published by\n\
-  the Free Software Foundation; either version 3 of the License, or\n\
-  (at your option) any later version.\n\
-  \n\
-  This program is distributed in the hope that it will be useful,\n\
-  but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
-  GNU General Public License for more details.\n\
-  \n\
-  You should have received a copy of the GNU General Public License\n\
-  along with Octave; see the file COPYING.  If not, see\n\
-  <http://www.gnu.org/licenses/>.\
-  ");
-        tail = cstrcat (author, "\n", revs);
+This program is free software; you can redistribute it and/or modify\n\
+it under the terms of the GNU General Public License as published by\n\
+the Free Software Foundation; either version 3 of the License, or\n\
+(at your option) any later version.\n\
+\n\
+This program is distributed in the hope that it will be useful,\n\
+but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
+GNU General Public License for more details.\n\
+\n\
+You should have received a copy of the GNU General Public License\n\
+along with Octave; see the file COPYING.  If not, see\n\
+<http://www.gnu.org/licenses/>.\
+");
+        tail = [author, "\n", revs];
 
       case "BSD"
         head = cstrcat (copyright, "\n\n", "\
-  This program is free software; redistribution and use in source and\n\
-  binary forms, with or without modification, are permitted provided that\n\
-  the following conditions are met:\n\
-  \n\
-     1.Redistributions of source code must retain the above copyright\n\
-       notice, this list of conditions and the following disclaimer.\n\
-     2.Redistributions in binary form must reproduce the above copyright\n\
-       notice, this list of conditions and the following disclaimer in the\n\
-       documentation and/or other materials provided with the distribution.\n\
-  \n\
-  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n\
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\
-  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
-  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n\
-  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n\
-  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n\
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\
-  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n\
-  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n\
-  SUCH DAMAGE.\
-  ");
-        tail = cstrcat (author, "\n", revs);
+This program is free software; redistribution and use in source and\n\
+binary forms, with or without modification, are permitted provided that\n\
+the following conditions are met:\n\
+\n\
+   1.Redistributions of source code must retain the above copyright\n\
+     notice, this list of conditions and the following disclaimer.\n\
+   2.Redistributions in binary form must reproduce the above copyright\n\
+     notice, this list of conditions and the following disclaimer in the\n\
+     documentation and/or other materials provided with the distribution.\n\
+\n\
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n\
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n\
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n\
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n\
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n\
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n\
+SUCH DAMAGE.\
+");
+        tail = [author, "\n", revs];
 
       case "PD"
         head = "";
-        tail = cstrcat (author, "\n", revs, "\n\n",
-                       "This program is granted to the public domain.");
+        tail = [author, "\n", revs, "\n\n", ...
+                "This program is granted to the public domain."];
 
       otherwise
         head = "";
-        tail = cstrcat (copyright, "\n\n", FUNCTION.LICENSE, "\n",
-                       author, "\n", revs);
+        tail = [copyright, "\n\n", FUNCTION.LICENSE, "\n", author, "\n", revs];
     endswitch
 
     ## Generate the function template.
@@ -463,45 +460,44 @@
     switch (ext)
       case {"cc", "C", "cpp"}
         if (isempty (head))
-          comment = cstrcat ("/*\n", tail, "\n\n*/\n\n");
+          comment = ["/*\n\n", tail, "\n\n*/\n\n"];
         else
-          comment = cstrcat ("/*\n", head, "\n\n", tail, "\n\n*/\n\n");
+          comment = ["/*\n\n", head, "\n\n", tail, "\n\n*/\n\n"];
         endif
         ## If we are shadowing an m-file, paste the code for the m-file.
         if (any (exists == [2, 103]))
-          code = cstrcat ("\\ ", strrep (type (name){1}, "\n", "\n// "));
+          code = ['\ ', strrep(type(name){1}, "\n", "\n// ")];
         else
           code = " ";
         endif
-        body = cstrcat ("#include <octave/oct.h>\n\n",
-                       "DEFUN_DLD(", name, ",args,nargout,\"\\\n",
-                       name, "\\n\\\n\")\n{\n",
-                       "  octave_value_list retval;\n",
-                       "  int nargin = args.length ();\n\n",
-                       code, "\n  return retval;\n}\n");
+        body = ["#include <octave/oct.h>\n\n",               ...
+                "DEFUN_DLD(" name ", args, nargout, \"\\\n", ...
+                name, "\\n\\\n\")\n{\n",                     ...
+                "  octave_value_list retval;\n",             ...
+                "  int nargin = args.length ();\n\n",        ...
+                code, "\n  return retval;\n}\n"];
 
-        text = cstrcat (comment, body);
+        text = [comment, body];
       case "m"
-        ## If we are editing a function defined on the fly, paste the
-        ## code.
+        ## If we are editing a function defined on the fly, paste the code.
         if (any (exists == [2, 103]))
           body = type (name){1};
         else
-          body = cstrcat ("function [ret] = ", name, " ()\n\nendfunction\n");
+          body = ["function [retval] = " name " ()\n\nendfunction\n"];
         endif
         if (isempty (head))
-          comment = cstrcat ("## -*- texinfo -*- \n## @deftypefn {Function File}", 
-                             "{@var{ret} =}", name, "(@var{x}, @var{y})\n##\n",
-                             "## @seealso{}\n## @end deftypefn\n\n",
-                             "## ", strrep (tail, "\n", "\n## "), "\n\n");
+          comment = ["## -*- texinfo -*- \n## @deftypefn {Function File} " ...
+                     "{@var{retval} =} " name " (@var{x}, @var{y})\n##\n"  ...
+                     "## @seealso{}\n## @end deftypefn\n\n"                ...
+                     "## " strrep(tail, "\n", "\n## ") "\n\n"];
         else
-          comment = cstrcat ("## ", strrep (head,"\n","\n## "), "\n\n", ...
-                             "## -*- texinfo -*- \n## @deftypefn {Function File}", 
-                             "{@var{ret} =}", name, "(@var{x}, @var{y})\n##\n",
-                             "## @seealso{}\n## @end deftypefn\n\n",
-                             "## ", strrep (tail, "\n", "\n## "), "\n\n");
+          comment = ["## " strrep(head,"\n","\n## ") "\n\n"                ...
+                     "## -*- texinfo -*- \n## @deftypefn {Function File} " ...
+                     "{@var{retval} =} " name " (@var{x} @var{y})\n##\n"   ...
+                     "## @seealso{}\n## @end deftypefn\n\n"                ...
+                     "## " strrep(tail, "\n", "\n## ") "\n\n"];
         endif
-        text = cstrcat (comment, body);
+        text = [comment, body];
     endswitch
 
     ## Write the initial file (if there is anything to write)
@@ -518,15 +514,15 @@
 
 endfunction
 
-function ret = default_home ()
+function retval = default_home ()
 
-  ret = getenv ("HOME");
-  if (isempty (ret))
-    ret = glob ("~");
-    if (! isempty (ret))
-      ret = ret{1};
+  retval = getenv ("HOME");
+  if (isempty (retval))
+    retval = glob ("~");
+    if (! isempty (retval))
+      retval = retval{1};
     else
-      ret = "";
+      retval = "";
     endif
   endif
 
@@ -538,37 +534,35 @@
 ## default author.  Otherwise return the login name.
 ## login@host will be the default email address.
 
-function ret = default_user (long_form)
+function retval = default_user (long_form)
 
   ent = getpwuid (getuid);
   if (! isstruct (ent))
-    ret = getenv ("USER");
-    if (isempty (ret))
-      ret = getenv ("USERNAME");
+    retval = getenv ("USER");
+    if (isempty (retval))
+      retval = getenv ("USERNAME");
     endif
   elseif (long_form)
-    ret = ent.gecos;
-    pos = strfind (ret, ",");
+    retval = ent.gecos;
+    pos = strfind (retval, ",");
     if (! isempty (pos))
-      ret = ret(1:pos-1);
+      retval = retval(1:pos-1);
     endif
   else
-    ret = ent.name;
+    retval = ent.name;
   endif
 
 endfunction
 
 function do_edit (editor, file, mode)
 
-  ## Give the hook function a chance.  If that fails, fall back
-  ## on running an editor with the system function.
+  ## Give the hook function a chance.
+  ## If that fails, fall back on running an editor with the system function.
 
   status = __octave_link_edit_file__ (file);
 
   if (! status)
-    system (sprintf (undo_string_escapes (editor),
-                     cstrcat ("\"", file, "\"")),
-            [], mode);
+    system (sprintf (undo_string_escapes (editor), ['"' file '"']), [], mode);
   endif
 
 endfunction
--- a/scripts/miscellaneous/error_ids.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/error_ids.m	Sat Oct 05 11:22:09 2013 -0400
@@ -44,6 +44,7 @@
 ## exist but Octave is unable to find it in the search path.
 ##
 ## @end table
+##
 
 
 function error_ids ()
@@ -53,3 +54,4 @@
 
 ## Remove from test statistics.  No real tests possible
 %!assert (1)
+
--- a/scripts/miscellaneous/fact.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/fact.m	Sat Oct 05 11:22:09 2013 -0400
@@ -90,7 +90,7 @@
        "Richard Stallman doesn’t code; he dares the computer to not do his bidding.";
        "Global warming is caused by Richard Stallman's rage towards non-free software.";
        "Rather than being birthed like a normal child, Richard Stallman instead instantiated himself polymorphically. Shortly thereafter he grew a beard.";
-       "Richard Stallman discovered extra-terrestrial life but killed them because they used non-free software.";
+       "Richard Stallman discovered extra-terrestrial life but killed them because they distributed non-free software.";
        "Richard Stallman doesn't evaluate expressions; expressions evaluate to Richard Stallman.";
        "Richard Stallman can see Russia from his house.";
        "Richard Stallman proved P=NP, twice!";
@@ -237,6 +237,24 @@
        "Richard Stallman exists because he compiled himself into being.";
        "Richard Stallman's first words were in binary. When they couldn't understand him, he wrote a parser.";
        "Richard Stallman doesn't need any codecs, he just opens a multimedia file with Emacs, and reads the bytes of the file as plain text. He then performs all the necessary decoding in his mind. But he refuses to decode files encrypted with DRM, although his mind is able to.";
+       "Richard Stallman was right. Sadly.";
+       "Richard Stallman can wiretap the NSA.";
+       "This is how Richard Stallman created Emacs: http://stallman.org/photos/rms-working/img_0631.jpg";
+       "Join Richard Stallman now and share the software, you'll be a free hacker, you'll be free!";
+       "Richard Stallman has not agreed to the terms and conditions and privacy policy because only he can actually read all of it.";
+       "Richard Stallman knows how of a backdoor to AES, but he respects your freedom and privacy too much to actually use it.";
+       "Richard Stallman will never get tired of being mocked for the foot cheese incident.";
+       "You like to release non-free software around Richard Stallman? I too like to live dangerously...";
+       "Yeah, if could just go ahead and make all software free for Richard Stallman, that'd be great, thanks.";
+       "Richard Stallman knows exactly what you mean when you talk about the cloud. But do you?";
+       "Richard Stallman satisfies Greenspun's Tenth Rule of programming, since his DNA also contains a complete implementation of all of Common Lisp.";
+       "Richard Stallman can violate the GPL. In a vulgar display of power, he once did so with the Emacs source code, but he undid the violation before most people noticed.";
+       "Good guy Richard Stallman does not try to shake you down for money. He will just kindly ask you to comply with the GPL.";
+       "Richard Stallman is in fact also a little sad that Steve Jobs is gone because it has diminished the size of the loyal opposition.";
+       "Richard Stallman can release LLVM and clang under the GPL.";
+       "No, really, Richard Stallman has a katana.";
+       "Every day Richard Stallman finds at least fifteen things in the world to rage about. You can read his findings here: http://stallman.org/archives/polnotes.html"
+       "Some of these Richard Stallman facts are completely true. Seriously.";
        };
 
   w = wisdom{randi([1, numel(wisdom)])};
@@ -257,12 +275,13 @@
   while (i <= numwords);
     line = wc{i};
     while (i < numwords
-           && length (newline = cstrcat (line, " ", wc{i+1})) < cols)
+           && length (newline = [line " " wc{i+1}]) < cols)
       line = newline;
       i++;
     endwhile
-    out = cstrcat (out, line, "\n");
+    out = [out, line, "\n"];
     i++;
   endwhile
-  out = cstrcat (out, "\n");
+  out = [out, "\n"];
 endfunction
+
--- a/scripts/miscellaneous/fileattrib.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/fileattrib.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,19 +39,19 @@
 ## @item directory
 ## True if @var{file} is a directory.
 ##
-## @item UserRead
+## @item  UserRead
 ## @itemx GroupRead
 ## @itemx OtherRead
 ## True if the user (group; other users) has read permission for
 ## @var{file}.
 ##
-## @item UserWrite
+## @item  UserWrite
 ## @itemx GroupWrite
 ## @itemx OtherWrite
 ## True if the user (group; other users) has write permission for
 ## @var{file}.
 ##
-## @item UserExecute
+## @item  UserExecute
 ## @itemx GroupExecute
 ## @itemx OtherExecute
 ## True if the user (group; other users) has execute permission for
@@ -143,3 +143,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/fileparts.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/fileparts.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,38 +25,38 @@
 
 function [directory, name, extension, version] = fileparts (filename)
 
-  if (nargin == 1)
-    if (ischar (filename))
-      ds = strchr (filename, filesep ("all"), 1, "last");
-      if (isempty (ds))
-        ds = 0;
-      endif
-      es = rindex (filename, ".");
-      ## These can be the same if they are both 0 (no dir or ext).
-      if (es <= ds)
-        es = length (filename)+1;
-      endif
-      if (ds == 0)
-        directory = "";
-      elseif (ds == 1)
-        directory = filename(1);
-      else
-        directory = filename(1:ds-1);
-      endif
-      name = filename(ds+1:es-1);
-      if (es > 0 && es <= length (filename))
-        extension = filename(es:end);
-      else
-        extension = "";
-      endif
-      version = "";
-    else
-      error ("fileparts: expecting FILENAME argument to be a string");
-    endif
-  else
+  if (nargin != 1)
     print_usage ();
   endif
 
+  if (! ischar (filename) || rows (filename) > 1)
+    error ("fileparts: FILENAME must be a single string");
+  endif
+
+  ds = strchr (filename, filesep ("all"), 1, "last");
+  if (isempty (ds))
+    ds = 0;
+  endif
+  es = rindex (filename, ".");
+  ## These can be the same if they are both 0 (no dir or ext).
+  if (es <= ds)
+    es = length (filename)+1;
+  endif
+  if (ds == 0)
+    directory = "";
+  elseif (ds == 1)
+    directory = filename(1);
+  else
+    directory = filename(1:ds-1);
+  endif
+  name = filename(ds+1:es-1);
+  if (es > 0 && es <= length (filename))
+    extension = filename(es:end);
+  else
+    extension = "";
+  endif
+  version = "";
+
 endfunction
 
 
@@ -96,3 +96,9 @@
 %! [d, n, e] = fileparts (".ext");
 %! assert (strcmp (d, "") && strcmp (n, char (zeros (1, 0))) && strcmp (e, ".ext"));
 
+%% Test input validation
+%!error fileparts ()
+%!error fileparts (1,2)
+%!error <FILENAME must be a single string> fileparts (1)
+%!error <FILENAME must be a single string> fileparts (["a"; "b"])
+
--- a/scripts/miscellaneous/fullfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/fullfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,7 @@
         elseif (i == nargs && strcmp (tmp, filesep))
           tmp = "";
         endif
-        filename = cstrcat (filename, filesep, tmp);
+        filename = [filename filesep tmp];
       endfor
     elseif (nargs == 1)
       filename = varargin{1};
@@ -56,10 +56,10 @@
 
 %!shared fs, fsx, xfs, fsxfs, xfsy
 %! fs = filesep ();
-%! fsx = cstrcat (fs, "x");
-%! xfs = cstrcat ("x", fs);
-%! fsxfs = cstrcat (fs, "x", fs);
-%! xfsy = cstrcat ("x", fs, "y");
+%! fsx = [fs "x"];
+%! xfs = ["x" fs];
+%! fsxfs = [fs "x" fs];
+%! xfsy = ["x" fs "y"];
 %!assert (fullfile (""), "")
 %!assert (fullfile (fs), fs)
 %!assert (fullfile ("", fs), fs)
--- a/scripts/miscellaneous/getappdata.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/getappdata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,6 +23,8 @@
 ## 
 ## @code{getappdata(@var{h})} returns a structure, @var{appdata}, whose fields
 ## correspond to the appdata properties.
+##
+## @seealso{setappdata, guidata, get, set, getpref, setpref}
 ## @end deftypefn
 
 ## Author: Ben Abbott <bpabbott@mac.com>
--- a/scripts/miscellaneous/gunzip.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/gunzip.m	Sat Oct 05 11:22:09 2013 -0400
@@ -41,3 +41,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/gzip.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/gzip.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,10 +20,10 @@
 ## @deftypefn  {Function File} {@var{entries} =} gzip (@var{files})
 ## @deftypefnx {Function File} {@var{entries} =} gzip (@var{files}, @var{outdir})
 ## Compress the list of files and/or directories specified in @var{files}.
-## Each file is compressed separately and a new file with a ".gz" extension
-## is created.  The original files are not modified.  Existing compressed
-## files are silently overwritten.  If @var{outdir} is defined the compressed
-## files are placed in this directory.
+## Each file is compressed separately and a new file with a @file{".gz"}
+## extension is created.  The original files are not modified.  Existing
+## compressed files are silently overwritten.  If @var{outdir} is defined the
+## compressed files are placed in this directory.
 ## @seealso{gunzip, bzip2, zip, tar}
 ## @end deftypefn
 
@@ -42,7 +42,7 @@
 
 
 %!xtest
-%! # test gzip together with gunzip
+%! ## test gzip together with gunzip
 %! unwind_protect
 %!   filename = tmpnam;
 %!   dummy    = 1;
--- a/scripts/miscellaneous/isdeployed.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/isdeployed.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,3 +30,4 @@
 
 
 %!assert (isdeployed (), false)
+
--- a/scripts/miscellaneous/ismac.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/ismac.m	Sat Oct 05 11:22:09 2013 -0400
@@ -36,3 +36,4 @@
 %!assert (islogical (ismac ()))
 
 %!error ismac (1)
+
--- a/scripts/miscellaneous/license.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/license.m	Sat Oct 05 11:22:09 2013 -0400
@@ -46,11 +46,11 @@
 ## @var{toggle}, which may be one of:
 ##
 ## @table @asis
-## @item "enable"
+## @item @qcode{"enable"}
 ## Future tests for the specified license of @var{feature} are conducted
 ## as usual.
 ##
-## @item "disable"
+## @item @qcode{"disable"}
 ## Future tests for the specified license of @var{feature} return 0.
 ## @end table
 ##
--- a/scripts/miscellaneous/ls.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/ls.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,7 +32,7 @@
 ## The @code{dir} and @code{ls} commands are implemented by calling your
 ## system's directory listing command, so the available options may vary
 ## from system to system.
-## @seealso{dir, stat, readdir, glob, filesep, ls_command}
+## @seealso{dir, readdir, glob, what, stat, filesep, ls_command}
 ## @end deftypefn
 
 ## Author: jwe
--- a/scripts/miscellaneous/mex.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/mex.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,7 +17,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} mex [options] file @dots{}
+## @deftypefn {Command} {} mex [options] file @dots{}
 ## Compile source code written in C, C++, or Fortran, to a MEX file.
 ## This is equivalent to @code{mkoctfile --mex [options] file}.
 ## @seealso{mkoctfile}
@@ -27,3 +27,4 @@
   args = {"--mex", varargin{:}};
   mkoctfile (args{:});
 endfunction
+
--- a/scripts/miscellaneous/mexext.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/mexext.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,3 +28,4 @@
 
 
 %!assert (mexext (), "mex")
+
--- a/scripts/miscellaneous/mkoctfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/mkoctfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -46,7 +46,7 @@
 ## @item -L DIR
 ## Add the library directory DIR to the link command.
 ##
-## @item -M
+## @item  -M
 ## @itemx --depend
 ## Generate dependency files (.d) for C and C++ source files.
 ##
@@ -67,13 +67,13 @@
 ## @item -g
 ## Enable debugging options for compilers.
 ##
-## @item -o FILE
+## @item  -o FILE
 ## @itemx --output FILE
 ## Output file name.  Default extension is .oct
 ## (or .mex if @samp{--mex} is specified) unless linking
 ## a stand-alone executable.
 ##
-## @item -p VAR
+## @item  -p VAR
 ## @itemx --print VAR
 ## Print the configuration variable VAR@.  Recognized variables are:
 ##
@@ -87,18 +87,18 @@
 ##    CFLAGS                    LD_CXX
 ##    CPICFLAG                  LD_STATIC_FLAG
 ##    CPPFLAGS                  LFLAGS
-##    CXX                       LIBOCTAVE       
-##    CXXFLAGS                  LIBOCTINTERP    
-##    CXXPICFLAG                LIBS            
-##    DEPEND_EXTRA_SED_PATTERN  OCTAVE_LIBS     
+##    CXX                       LIBOCTAVE
+##    CXXFLAGS                  LIBOCTINTERP
+##    CXXPICFLAG                LIBS
+##    DEPEND_EXTRA_SED_PATTERN  OCTAVE_LIBS
 ##    DEPEND_FLAGS              OCTAVE_LINK_DEPS
-##    DL_LD                     OCT_LINK_DEPS   
-##    DL_LDFLAGS                RDYNAMIC_FLAG   
-##    EXEEXT                    READLINE_LIBS   
-##    F77                       SED             
-##    F77_INTEGER_8_FLAG        XTRA_CFLAGS     
-##    FFLAGS                    XTRA_CXXFLAGS   
-##    FFTW3_LDFLAGS             
+##    DL_LD                     OCT_LINK_DEPS
+##    DL_LDFLAGS                RDYNAMIC_FLAG
+##    EXEEXT                    READLINE_LIBS
+##    F77                       SED
+##    F77_INTEGER_8_FLAG        XTRA_CFLAGS
+##    FFLAGS                    XTRA_CXXFLAGS
+##    FFTW3_LDFLAGS
 ##    FFTW3_LIBS
 ##    FFTW3F_LDFLAGS
 ##
@@ -111,11 +111,11 @@
 ## Assume we are creating a MEX file.  Set the default output extension
 ## to ".mex".
 ##
-## @item -s
+## @item  -s
 ## @itemx --strip
 ## Strip the output file.
 ##
-## @item -v
+## @item  -v
 ## @itemx --verbose
 ## Echo commands as they are executed.
 ##
@@ -146,9 +146,13 @@
 
   shell_script = fullfile (bindir, sprintf ("mkoctfile-%s", OCTAVE_VERSION));
 
-  cmd = cstrcat ("\"", shell_script, "\"");
+  if (! exist (shell_script, "file"))
+    __gripe_missing_component__ ("mkoctfile", "mkoctfile");
+  endif
+
+  cmd = ['"' shell_script '"'];
   for i = 1:nargin
-    cmd = cstrcat (cmd, " \"", varargin{i}, "\"");
+    cmd = [cmd ' "' varargin{i} '"'];
   endfor
 
   [sys, out] = system (cmd);
@@ -159,11 +163,9 @@
     printf ("%s", out);
   endif
 
-  if (sys == 127)
-    warning ("unable to find mkoctfile in expected location: '%s'",
-             shell_script);
-
+  if (sys != 0)
     warning ("mkoctfile exited with failure status");
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -18,6 +18,7 @@
   miscellaneous/copyfile.m \
   miscellaneous/debug.m \
   miscellaneous/delete.m \
+  miscellaneous/desktop.m \
   miscellaneous/dir.m \
   miscellaneous/dos.m \
   miscellaneous/dump_prefs.m \
--- a/scripts/miscellaneous/movefile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/movefile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,28 +17,39 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{status}, @var{msg}, @var{msgid}] =} movefile (@var{f1}, @var{f2})
-## @deftypefnx {Function File} {[@var{status}, @var{msg}, @var{msgid}] =} movefile (@var{f1}, @var{f2}, 'f')
-## Move the file @var{f1} to the new name @var{f2}.  The name @var{f1}
-## may contain globbing patterns.  If @var{f1} expands to multiple file
-## names, @var{f2} must be a directory.  If the force flag 'f' is given
-## then any existing files will be overwritten without prompting.
+## @deftypefn  {Function File} {} movefile (@var{f1})
+## @deftypefnx {Function File} {} movefile (@var{f1}, @var{f2})
+## @deftypefnx {Function File} {} movefile (@var{f1}, @var{f2}, 'f')
+## @deftypefnx {Function File} {[@var{status}, @var{msg}, @var{msgid}] =} movefile (@dots{})
+## Move the file @var{f1} to the destination @var{f2}.
 ##
-## If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty
-## character strings.  Otherwise, @var{status} is 0, @var{msg} contains a
-## system-dependent error message, and @var{msgid} contains a unique
-## message identifier.
-## @seealso{rename, copyfile}
+## The name @var{f1} may contain globbing patterns.  If @var{f1} expands to
+## multiple file names, @var{f2} must be a directory.  If no destination
+## @var{f2} is specified then the destination is the present working directory.
+## If @var{f2} is a file name then @var{f1} is renamed to @var{f2}.
+## When the force flag @qcode{'f'} is given any existing files will be
+## overwritten without prompting.
+##
+## If successful, @var{status} is 1, and @var{msg}, @var{msgid} are empty
+## character strings ("").  Otherwise, @var{status} is 0, @var{msg} contains a
+## system-dependent error message, and @var{msgid} contains a unique message
+## identifier.  Note that the status code is exactly opposite that of the
+## @code{system} command.
+## @seealso{rename, copyfile, unlink, delete, glob}
 ## @end deftypefn
 
 function [status, msg, msgid] = movefile (f1, f2, force)
 
+  if (nargin < 1 || nargin > 3)
+    print_usage ();
+  endif
+
   max_cmd_line = 1024;
   status = true;
   msg = "";
   msgid = "";
 
-  ## FIXME -- maybe use the same method as in ls to allow users control
+  ## FIXME: maybe use the same method as in ls to allow users control
   ## over the command that is executed.
 
   if (ispc () && ! isunix ()
@@ -51,78 +62,78 @@
     cmd_force_flag = "-f";
   endif
 
-  if (nargin == 2 || nargin == 3)
-    ## Input type check.
-    if (! (ischar (f1) || iscellstr (f1)))
-      error ("movefile: first argument must be a character string or a cell array of character strings");
-    endif
-
-    if (! ischar (f2))
-      error ("movefile: second argument must be a character string");
-    endif
+  ## Input type check.
+  if (! (ischar (f1) || iscellstr (f1)))
+    error ("movefile: F1 must be a character string or a cell array of character strings");
+  endif
 
-    if (nargin == 3 && strcmp (force, "f"))
-      cmd = cstrcat (cmd, " ", cmd_force_flag);
-    endif
+  if (nargin == 1)
+    f2 = pwd ();
+  elseif (! ischar (f2))
+    error ("movefile: F2 must be a character string");
+  endif
 
-    ## If f1 isn't a cellstr convert it to one.
-    if (ischar (f1))
-      f1 = cellstr (f1);
-    endif
+  if (nargin == 3 && strcmp (force, "f"))
+    cmd = [cmd " " cmd_force_flag];
+  endif
 
-    ## If f1 has more than 1 element f2 must be a directory
-    isdir = (exist (f2, "dir") != 0);
-    if (length (f1) > 1 && ! isdir)
-      error ("movefile: when moving multiple files, second argument must be a directory");
-    endif
+  ## If f1 isn't a cellstr convert it to one.
+  if (ischar (f1))
+    f1 = cellstr (f1);
+  endif
 
-    ## Protect the file name(s).
-    f1 = glob (f1);
-    if (isempty (f1))
-      error ("movefile: no files to move");
-    endif
-    p1 = sprintf ("\"%s\" ", f1{:});
-    p2 = tilde_expand (f2);
+  ## If f1 has more than 1 element f2 must be a directory
+  isdir = (exist (f2, "dir") != 0);
+  if (length (f1) > 1 && ! isdir)
+    error ("movefile: when moving multiple files, F2 must be a directory");
+  endif
 
-    if (isdir && length (p1) > max_cmd_line)
-      l2 = length (p2) + length (cmd) + 6;
-      while (! isempty (f1))
-        p1 = sprintf ("\"%s\" ", f1{1});
+  ## Protect the file name(s).
+  f1 = glob (f1);
+  if (isempty (f1))
+    error ("movefile: no files to move");
+  endif
+  p1 = sprintf ('"%s" ', f1{:});
+  p2 = tilde_expand (f2);
+
+  if (isdir && length (p1) > max_cmd_line)
+    l2 = length (p2) + length (cmd) + 6;
+    while (! isempty (f1))
+      p1 = sprintf ('"%s" ', f1{1});
+      f1(1) = [];
+      while (! isempty (f1)
+             && (length (p1) + length (f1{1}) + l2 < max_cmd_line))
+        p1 = sprintf ('%s"%s" ', p1, f1{1});
         f1(1) = [];
-        while (!isempty (f1) && (length (p1) + length (f1{1}) + l2 <
-                                 max_cmd_line))
-          p1 = sprintf ("%s\"%s\" ", p1, f1{1});
-          f1(1) = [];
-        endwhile
+      endwhile
 
-        if (ispc () && ! isunix ()
-            && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
-          p1 = strrep (p1, "\\", "/");
-          p2 = strrep (p2, "\\", "/");
-        endif
-
-        ## Move the file(s).
-        [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2));
-        if (err < 0)
-          status = false;
-          msgid = "movefile";
-        endif
-      endwhile
-    else
       if (ispc () && ! isunix ()
           && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
-        p1 = strrep (p1, "\\", "/");
-        p2 = strrep (p2, "\\", "/");
+        p1 = strrep (p1, '\', '/');
+        p2 = strrep (p2, '\', '/');
       endif
 
       ## Move the file(s).
-      [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2));
-      if (err < 0)
+      [err, msg] = system (sprintf ('%s %s "%s"', cmd, p1, p2));
+      if (err != 0)
         status = false;
         msgid = "movefile";
       endif
-    endif
+    endwhile
   else
-    print_usage ();
+    if (ispc () && ! isunix ()
+        && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
+      p1 = strrep (p1, '\', '/');
+      p2 = strrep (p2, '\', '/');
+    endif
+
+    ## Move the file(s).
+    [err, msg] = system (sprintf ('%s %s "%s"', cmd, p1, p2));
+    if (err != 0)
+      status = false;
+      msgid = "movefile";
+    endif
   endif
+
 endfunction
+
--- a/scripts/miscellaneous/namelengthmax.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/namelengthmax.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,3 +32,4 @@
 
 
 %!assert (namelengthmax (), 63)
+
--- a/scripts/miscellaneous/news.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/news.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,3 +40,4 @@
 %!error news (1, 2)
 %!error <news: PACKAGE must be a string> news (1)
 %!error <news: package .* is not installed> news ("__NOT_A_VALID_PKG_NAME__")
+
--- a/scripts/miscellaneous/pack.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/pack.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,3 +27,4 @@
 function pack ()
 
 endfunction
+
--- a/scripts/miscellaneous/parseparams.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/parseparams.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,8 +40,8 @@
 ## @end group
 ## @end example
 ##
-## The parseparams function may be used to separate "regular"
-## arguments and additional arguments given as property/value pairs of
+## The parseparams function may be used to separate regular numeric
+## arguments from additional arguments given as property/value pairs of
 ## the @var{varargin} cell array.
 ##
 ## In the second form of the call, available options are specified directly
--- a/scripts/miscellaneous/perl.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/perl.m	Sat Oct 05 11:22:09 2013 -0400
@@ -41,10 +41,11 @@
       scriptfile = file_in_loadpath (scriptfile);
     endif
 
-    [status, output] = system (cstrcat ("perl ", scriptfile,
-                                        sprintf (" %s", varargin{:})));
+    [status, output] = system (["perl " scriptfile ...
+                                sprintf(" %s", varargin{:})]);
   else
     error ("perl: invalid arguments");
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/private/__xzip__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/private/__xzip__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,14 +33,6 @@
 function entries = __xzip__ (commandname, extension,
                              commandtemplate, files, outdir)
 
-  if (nargin != 4 && nargin != 5)
-    print_usage ();
-  endif
-
-  if (! ischar (extension) || length (extension) == 0)
-    error ("__xzip__: EXTENSION must be a string with finite length");
-  endif
-
   if (nargin == 5 && ! exist (outdir, "dir"))
     error ("__xzip__: OUTDIR output directory does not exist");
   endif
@@ -116,6 +108,7 @@
   f(idx) = files(idx);
 endfunction
 
+
 ## FIXME -- reinstate these tests if we invent a way to test private
 ## functions directly.
 ##
@@ -137,3 +130,4 @@
 ## %!    delete (filename);
 ## %!    rmdir (dirname);
 ## %!  end_unwind_protect
+
--- a/scripts/miscellaneous/private/display_info_file.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/private/display_info_file.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,10 +21,6 @@
 
 function display_info_file (func, package, file)
 
-  if (nargin != 3)
-    print_usage ();
-  endif
-
   if (! ischar (package))
     error ("%s: PACKAGE must be a string", func);
   endif
@@ -57,3 +53,4 @@
   fclose (fid);
 
 endfunction
+
--- a/scripts/miscellaneous/python.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/python.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,10 +40,11 @@
       scriptfile = file_in_loadpath (scriptfile);
     endif
 
-    [status, output] = system (cstrcat ("python ", scriptfile,
-                                        sprintf (" %s", varargin{:})));
+    [status, output] = system (["python ", scriptfile, ...
+                                sprintf(" %s", varargin{:})]);
   else
     error ("python: invalid arguments");
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/rmappdata.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/rmappdata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -45,6 +45,7 @@
 
 endfunction
 
+
 %!test
 %! setappdata (0, "hello", "world");
 %! rmappdata (0, "hello");
--- a/scripts/miscellaneous/run.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/run.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,7 +39,7 @@
       wd = pwd ();
       unwind_protect
         cd (d);
-        if (! exist (cstrcat (f, ext), "file"))
+        if (! exist ([f ext], "file"))
           error ("run: file SCRIPT must exist and be a valid Octave scriptfile");
         endif
         evalin ("caller", sprintf ("source (\"%s%s\");", f, ext),
@@ -59,3 +59,4 @@
     endif
   endif
 endfunction
+
--- a/scripts/miscellaneous/setappdata.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/setappdata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,6 +19,7 @@
 ## Set the named application data to @var{value} for the object(s) with
 ## handle(s) @var{h}.  If the application data with the specified name does
 ## not exist, it is created.
+## @seealso{getappdata, guidata, get, set, getpref, setpref}
 ## @end deftypefn
 
 ## Author: Ben Abbott <bpabbott@mac.com>
--- a/scripts/miscellaneous/setfield.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/setfield.m	Sat Oct 05 11:22:09 2013 -0400
@@ -43,7 +43,7 @@
 ## used here, as the field name is not a valid Octave identifier.  Using
 ## arbitrary strings for field name is incompatible with @sc{matlab}, so
 ## this usage will warn if the @code{Octave:matlab-incompatible} warning
-## is set.  @xref{docXwarning_ids}.
+## is set.  @xref{XREFwarning_ids}.
 ##
 ## With the second calling form, set a field on a structure array,
 ## possibly nested, with successive nested indices @var{idx1},
--- a/scripts/miscellaneous/tar.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/tar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2012 Søren Hauberg
+## Copyright (C) 2005-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -30,7 +30,7 @@
 ## @seealso{untar, bzip2, gzip, zip}
 ## @end deftypefn
 
-## Author: Søren Hauberg <hauberg@gmail.com>
+## Author: Søren Hauberg <hauberg@gmail.com>
 
 function entries = tar (tarfile, files, root = ".")
 
@@ -64,3 +64,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/tempdir.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/tempdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,7 +29,7 @@
   endif
 
   if (! strcmp (dirname(end), filesep))
-    dirname = cstrcat (dirname, filesep);
+    dirname = [dirname filesep];
   endif
 
   if (! isdir (dirname))
--- a/scripts/miscellaneous/tempname.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/tempname.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,3 +33,4 @@
 
 %% No tests needed for alias.
 %!assert (1)
+
--- a/scripts/miscellaneous/unix.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/unix.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## Execute a system command if running under a Unix-like operating
 ## system, otherwise do nothing.  Return the exit status of the program
 ## in @var{status} and any output from the command in @var{text}.
-## When called with no output argument, or the "-echo" argument is
+## When called with no output argument, or the @qcode{"-echo"} argument is
 ## given, then @var{text} is also sent to standard output.
 ## @seealso{dos, system, isunix, ispc}
 ## @end deftypefn
--- a/scripts/miscellaneous/unpack.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/unpack.m	Sat Oct 05 11:22:09 2013 -0400
@@ -75,10 +75,10 @@
 
     ## Check to see if it's .tar.gz, .tar.Z, etc.
     if (any (strcmpi ({".gz" ".Z" ".bz2" ".bz"}, ext)))
-      [tmppathstr, tmpname, tmpext] = fileparts (name);
+      [~, tmpname, tmpext] = fileparts (name);
       if (strcmpi (tmpext, ".tar"))
         name = tmpname;
-        ext = cstrcat (tmpext, ext);
+        ext = [tmpext ext];
       endif
     endif
 
@@ -88,10 +88,10 @@
       urlfile = file;
       ## FIXME -- should we name the file that we download with the
       ## same file name as the URL requests?
-      tmpfile = cstrcat (tmpnam (), ext);
+      tmpfile = [tmpnam() ext];
       [file, success, msg] = urlwrite (urlfile, tmpfile);
       if (! success)
-        error ("unpack: could not get \"%s\": %s", urlfile, msg);
+        error ('unpack: could not get "%s": %s', urlfile, msg);
       endif
     endif
 
@@ -102,7 +102,7 @@
   cfile = canonicalize_file_name (file);
 
   if (isempty (cfile))
-    error ("unpack: file \"%s\" not found", file);
+    error ('unpack: file "%s" not found', file);
   else
     file = cfile;
   endif
@@ -112,40 +112,44 @@
   ## The field names are the file extension without periods.
   ## The first cell is what is executed to unpack an archive verbosely.
   ## The second cell is what is executed to unpack an archive quietly.
-  ## The third cell is the function to execute on output to get the
-  ##   files list.
+  ## The third cell is the function to execute on output to get the files list.
   ## The fourth cell indicates if the files may need to be manually moved
-  ##   (i.e. tar and unzip decompress into the current directory while
-  ##   bzip2 and gzip decompress the file at its location).
+  ##   (i.e., tar and unzip decompress into the current directory while
+  ##    bzip2 and gzip decompress the file at its location).
   persistent commandlist;
   if (isempty (commandlist))
-    commandlist.gz = {"gzip -d -v -r \"%s\"", ...
-                      "gzip -d -r \"%s\"", ...
+    commandlist.gz = {'gzip -d -v -r "%s"', ...
+                      'gzip -d -r "%s"', ...
                       @__parse_gzip__, true};
     commandlist.z = commandlist.gz;
-    commandlist.bz2 = {"bzip2 -d -v \"%s\"", ...
-                       "bzip2 -d \"%s\"", ...
+    commandlist.bz2 = {'bzip2 -d -v "%s"', ...
+                       'bzip2 -d "%s"', ...
                        @__parse_bzip2__, true};
     commandlist.bz = commandlist.bz2;
-    commandlist.tar = {"tar xvf \"%s\"", ...
-                       "tar xf \"%s\"", ...
+    commandlist.tar = {'tar xvf "%s"', ...
+                       'tar xf "%s"', ...
                        @__parse_tar__, false};
-    commandlist.targz = {"gzip -d -c \"%s\" | tar xvf -", ...
-                         "gzip -d -c \"%s\" | tar xf -", ...
+    commandlist.targz = {'gzip -d -c "%s" | tar xvf -', ...
+                         'gzip -d -c "%s" | tar xf -', ...
                          @__parse_tar__, false};
     commandlist.tgz = commandlist.targz;
-    commandlist.tarbz2 = {"bzip2 -d -c \"%s\" | tar xvf -", ...
-                          "bzip2 -d -c \"%s\" | tar xf -", ...
+    commandlist.tarbz2 = {'bzip2 -d -c "%s" | tar xvf -', ...
+                          'bzip2 -d -c "%s" | tar xf -', ...
                           @__parse_tar__, false};
     commandlist.tarbz = commandlist.tarbz2;
     commandlist.tbz2 = commandlist.tarbz2;
     commandlist.tbz = commandlist.tarbz2;
-    commandlist.zip = {"unzip \"%s\"", ...
-                       "unzip -q \"%s\"", ...
+    commandlist.zip = {'unzip -n "%s"', ...
+                       'unzip -nq "%s"', ...
                        @__parse_zip__, false};
   endif
 
-  nodotext = ext(! ismember (ext, "."));
+  ## Unzip doesn't actually care about the extension
+  if (strcmp (filetype, "unzip"))
+    nodotext = "zip";
+  else
+    nodotext = ext(ext != '.');
+  endif
 
   origdir = pwd ();
 
@@ -178,7 +182,7 @@
 
   unwind_protect
     cd (dir);
-    [status, output] = system (sprintf (cstrcat (command, " 2>&1"), file));
+    [status, output] = system (sprintf ([command " 2>&1"], file));
   unwind_protect_cleanup
     cd (origdir);
   end_unwind_protect
@@ -189,19 +193,18 @@
   endif
 
   if (nargout > 0 || needmove)
-    ## Trim the last cr if needed.
+    ## Trim the last CR if needed.
     ## FIXME -- will this need to change to a check for "\r\n" for windows?
-    if (output(length (output)) == "\n")
-      output(length (output)) = [];
+    if (output(end) == "\n")
+      output(end) = [];
     endif
     files = parser (ostrsplit (output, "\n"))';
 
     ## Move files if necessary
     if (needmove)
-      [st, msg, msgid] = movefile (files, dir);
+      [st, msg, ~] = movefile (files, dir);
       if (! st)
-        error ("unpack: unable to move files to \"%s\": %s",
-               dir, msg);
+        error ('unpack: unable to move files to "%s": %s', dir, msg);
       endif
 
       ## Fix the names for the files since they were moved.
@@ -222,54 +225,27 @@
   ## Parse the output from zip and unzip.
 
   ## Skip first line which is Archive header
-  output(1) = [];
-  for i = 1:length (output)
-    files{i} = output{i}(14:length (output{i}));
-  endfor
+  files = char (output(2:end));
+  ## Trim constant width prefix and return cell array
+  files = cellstr (files(:,14:end))
 endfunction
 
 function output = __parse_tar__ (output)
-  ## This is a noop, but it makes things simpler for other cases.
+  ## This is a no-op, but it makes things simpler for other cases.
 endfunction
 
 function files = __parse_gzip__ (output)
   ## Parse the output from gzip and gunzip returning the files
   ## commpressed (or decompressed).
 
-  files = {};
-  ## The middle ": " should indicate a good place to start looking for
-  ## the filename.
-  for i = 1:length (output)
-    colons = strfind (output{i}, ":");
-    if (isempty (colons))
-      warning ("unpack:parsing",
-               "Unable to parse line (gzip missing colon):\n%s", output{i});
-    else
-      midcolon = colons(ceil (length (colons)/2));
-      thisstr = output{i}(midcolon+2:length (output{i}));
-      idx = index (thisstr, "with") + 5;
-      if (isempty (idx))
-        warning ("unpack:parsing",
-                 "Unable to parse line (gzip missing with):\n%s", output{i});
-      else
-        files{i} = thisstr(idx:length (thisstr));
-      endif
-    endif
-  endfor
+  files = regexprep (output, '^.+ with (.*)$', '$1');
 endfunction
 
 function files = __parse_bzip2__ (output)
   ## Parse the output from bzip2 and bunzip2 returning the files
   ## commpressed (or decompressed).
 
-  files = {};
-  for i = 1:length (output)
-    ## the -5 is to remove the ".bz2:"
-    endoffilename = rindex (output{i}, ": ") - 5;
-    if (isempty (endoffilename))
-      warning ("unpack:parsing", "Unable to parse line:\n%s", output{i});
-    else
-      files{i} = output{i}(3:endoffilename);
-    endif
-  endfor
+  ## Strip leading blanks and .bz2 extension from file name
+  files = regexprep (output, '^\s+(.*)\.bz2: .*', '$1');
 endfunction
+
--- a/scripts/miscellaneous/untar.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/untar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2012 Søren Hauberg
+## Copyright (C) 2005-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -24,7 +24,7 @@
 ## @seealso{tar, unpack, bunzip2, gunzip, unzip}
 ## @end deftypefn
 
-## Author: Søren Hauberg <hauberg@gmail.com>
+## Author: Søren Hauberg <hauberg@gmail.com>
 ## Adapted-By: jwe, Bill Denney
 
 function varargout = untar (tarfile, dir = ".")
@@ -41,3 +41,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/unzip.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/unzip.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2012 Søren Hauberg
+## Copyright (C) 2005-2012 Søren Hauberg
 ##
 ## This file is part of Octave.
 ##
@@ -24,7 +24,7 @@
 ## @seealso{zip, unpack, bunzip2, gunzip, untar}
 ## @end deftypefn
 
-## Author: Søren Hauberg <hauberg@gmail.com>
+## Author: Søren Hauberg <hauberg@gmail.com>
 ## Adapted-By: jwe, Bill Denney
 
 function varargout = unzip (zipfile, dir = ".")
@@ -41,3 +41,4 @@
   endif
 
 endfunction
+
--- a/scripts/miscellaneous/warning_ids.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/warning_ids.m	Sat Oct 05 11:22:09 2013 -0400
@@ -177,7 +177,7 @@
 ## compatibility problems with @sc{matlab}.
 ## By default, the @code{Octave:matlab-incompatible} warning is disabled.
 ## The --traditional or --braindead startup options for Octave may also
-## be of use, @xref{Command Line Options}.
+## be of use, @pxref{Command Line Options}.
 ##
 ## @item Octave:md5sum-file-in-path
 ## By default, the @code{Octave:md5sum-file-in-path} warning is enabled.
@@ -333,6 +333,8 @@
 ## expression.
 ## By default, the @code{Octave:variable-switch-label} warning is disabled.
 ## @end table
+##
+
 
 function warning_ids ()
   help ("warning_ids");
--- a/scripts/miscellaneous/what.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/what.m	Sat Oct 05 11:22:09 2013 -0400
@@ -63,13 +63,13 @@
       [dummy, f, e] = fileparts (n);
       if (strcmp (e, ".m"))
         w.m{end+1} = n;
-      elseif (strcmp (e, mexext ()))
-        w.mex{end+1} = n;
       elseif (strcmp (e, ".oct"))
         w.oct{end+1} = n;
+      elseif (strcmp (e, mexext ()))
+        w.mex{end+1} = n;
       elseif (strcmp (e, ".mat"))
         w.mat{end+1} = n;
-      elseif(strcmp (n(1), "@"))
+      elseif (strcmp (n(1), "@"))
         w.classes{end+1} = n;
       endif
     endif
@@ -108,3 +108,4 @@
     endfor
   endif
 endfunction
+
--- a/scripts/miscellaneous/zip.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/miscellaneous/zip.m	Sat Oct 05 11:22:09 2013 -0400
@@ -66,3 +66,4 @@
   endif
 
 endfunction
+
--- a/scripts/mkdoc.pl	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/mkdoc.pl	Sat Oct 05 11:22:09 2013 -0400
@@ -52,7 +52,7 @@
   @help_txt = gethelp ($fcn, $full_fname);
   next MFILE if ($help_txt[0] eq "");
 
-  print "$fcn\n";
+  print "\x{1d}$fcn\n";
   print "\@c $fcn scripts/$m_fname\n";
 
   foreach $_ (@help_txt)
--- a/scripts/mkinstalldirs	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@gnu.org>
-# Created: 1993-05-16
-# Last modified: Wed Jan 25 09:35:21 1995
-# Public domain
-
-errstatus=0
-
-dirmode=0755
-
-for file in ${1+"$@"} ; do 
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-   shift
-
-   pathcomp=
-   for d in ${1+"$@"} ; do
-     pathcomp="$pathcomp$d"
-     case "$pathcomp" in
-       -* ) pathcomp=./$pathcomp ;;
-     esac
-
-     if test ! -d "$pathcomp"; then
-        echo "mkdir $pathcomp" 1>&2
-        mkdir "$pathcomp" || errstatus=$?
-        echo "chmod $dirmode $pathcomp" 1>&2
-        chmod $dirmode "$pathcomp" || errstatus=$?
-     fi
-
-     pathcomp="$pathcomp/"
-   done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
--- a/scripts/optimization/__all_opts__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/__all_opts__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -49,7 +49,7 @@
         fn = fieldnames (opts).';
         names = [names, fn];
       catch
-        # throw the error as a warning.
+        ## throw the error as a warning.
         warning (lasterr ());
       end_try_catch
     endfor
--- a/scripts/optimization/fminbnd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/fminbnd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,8 +25,9 @@
 ## @var{fun} should be a function handle or name.  @var{a}, @var{b} specify a
 ## starting interval.  @var{options} is a structure specifying additional
 ## options.  Currently, @code{fminbnd} recognizes these options:
-## "FunValCheck", "OutputFcn", "TolX", "MaxIter", "MaxFunEvals".  For a
-## description of these options, see @ref{docXoptimset,,optimset}.
+## @qcode{"FunValCheck"}, @qcode{"OutputFcn"}, @qcode{"TolX"},
+## @qcode{"MaxIter"}, @qcode{"MaxFunEvals"}.  For a description of these
+## options, see @ref{XREFoptimset,,optimset}.
 ##
 ## On exit, the function returns @var{x}, the approximate minimum point
 ## and @var{fval}, the function value thereof.
@@ -210,7 +211,7 @@
   iter(1).procedure = "initial";
 
   ## Handle the "Display" option
-  switch displ
+  switch (displ)
     case "iter"
       print_formatted_table (iter);
       print_exit_msg (info, struct("TolX", tolx, "fx", fval));
@@ -259,7 +260,7 @@
 ## Print either a success termination message or bad news
 function print_exit_msg (info, opt=struct())
   printf ("");
-  switch info
+  switch (info)
     case 1
       printf ("Optimization terminated:\n");
       printf (" the current x satisfies the termination criteria using OPTIONS.TolX of %e\n", opt.TolX);
@@ -268,7 +269,7 @@
       printf ("         - increase MaxIter option.\n");
       printf ("         Current function value: %.6f\n", opt.fx);
     case -1
-      "FIXME"; ## FIXME: what's the message MATLAB prints for this case?
+      "FIXME"; # FIXME: what's the message MATLAB prints for this case?
     otherwise
       error ("internal error - fminbnd() is bug, sorry!");
   endswitch
--- a/scripts/optimization/fminsearch.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/fminsearch.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,8 +30,9 @@
 ##
 ## Options for the search are provided in the parameter @var{options} using 
 ## the function @code{optimset}.  Currently, @code{fminsearch} accepts the
-## options: "TolX", "MaxFunEvals", "MaxIter", "Display".  For a description of
-## these options, see @code{optimset}.
+## options: @qcode{"TolX"}, @qcode{"MaxFunEvals"}, @qcode{"MaxIter"},
+## @qcode{"Display"}.  For a description of these options, see
+## @code{optimset}.
 ##
 ## On exit, the function returns @var{x}, the minimum point,
 ## and @var{fval}, the function value thereof.
--- a/scripts/optimization/fminunc.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/fminunc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,17 +33,17 @@
 ## in all calls to @var{fcn}, but otherwise is treated as a column vector.
 ## @var{options} is a structure specifying additional options.
 ## Currently, @code{fminunc} recognizes these options:
-## @code{"FunValCheck"}, @code{"OutputFcn"}, @code{"TolX"},
-## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"},
-## @code{"GradObj"}, @code{"FinDiffType"},
-## @code{"TypicalX"}, @code{"AutoScaling"}.
+## @qcode{"FunValCheck"}, @qcode{"OutputFcn"}, @qcode{"TolX"},
+## @qcode{"TolFun"}, @qcode{"MaxIter"}, @qcode{"MaxFunEvals"},
+## @qcode{"GradObj"}, @qcode{"FinDiffType"},
+## @qcode{"TypicalX"}, @qcode{"AutoScaling"}.
 ##
-## If @code{"GradObj"} is @code{"on"}, it specifies that @var{fcn},
+## If @qcode{"GradObj"} is @qcode{"on"}, it specifies that @var{fcn},
 ## called with 2 output arguments, also returns the Jacobian matrix
-## of right-hand sides at the requested point.  @code{"TolX"} specifies
+## of right-hand sides at the requested point.  @qcode{"TolX"} specifies
 ## the termination tolerance in the unknown variables, while
-## @code{"TolFun"} is a tolerance for equations.  Default is @code{1e-7}
-## for both @code{"TolX"} and @code{"TolFun"}.
+## @qcode{"TolFun"} is a tolerance for equations.  Default is @code{1e-7}
+## for both @qcode{"TolX"} and @qcode{"TolFun"}.
 ##
 ## For description of the other options, see @code{optimset}.
 ##
@@ -427,3 +427,4 @@
     x = alpha * x + ((1-alpha) * min (snm, delta)) * s;
   endif
 endfunction
+
--- a/scripts/optimization/fsolve.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/fsolve.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,31 +31,30 @@
 ## in all calls to @var{fcn}, but otherwise it is treated as a column vector.
 ## @var{options} is a structure specifying additional options.
 ## Currently, @code{fsolve} recognizes these options:
-## @code{"FunValCheck"}, @code{"OutputFcn"}, @code{"TolX"},
-## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"},
-## @code{"Jacobian"}, @code{"Updating"}, @code{"ComplexEqn"}
-## @code{"TypicalX"}, @code{"AutoScaling"} and @code{"FinDiffType"}.
+## @qcode{"FunValCheck"}, @qcode{"OutputFcn"}, @qcode{"TolX"},
+## @qcode{"TolFun"}, @qcode{"MaxIter"}, @qcode{"MaxFunEvals"},
+## @qcode{"Jacobian"}, @qcode{"Updating"}, @qcode{"ComplexEqn"}
+## @qcode{"TypicalX"}, @qcode{"AutoScaling"} and @qcode{"FinDiffType"}.
 ##
-## If @code{"Jacobian"} is @code{"on"}, it specifies that @var{fcn},
+## If @qcode{"Jacobian"} is @qcode{"on"}, it specifies that @var{fcn},
 ## called with 2 output arguments, also returns the Jacobian matrix
-## of right-hand sides at the requested point.  @code{"TolX"} specifies
+## of right-hand sides at the requested point.  @qcode{"TolX"} specifies
 ## the termination tolerance in the unknown variables, while
-## @code{"TolFun"} is a tolerance for equations.  Default is @code{1e-7}
-## for both @code{"TolX"} and @code{"TolFun"}.
+## @qcode{"TolFun"} is a tolerance for equations.  Default is @code{1e-7}
+## for both @qcode{"TolX"} and @qcode{"TolFun"}.
 ##
-## If @code{"AutoScaling"} is on, the variables will be automatically scaled
+## If @qcode{"AutoScaling"} is on, the variables will be automatically scaled
 ## according to the column norms of the (estimated) Jacobian.  As a result,
 ## TolF becomes scaling-independent.  By default, this option is off, because
 ## it may sometimes deliver unexpected (though mathematically correct) results.
 ##
-## If @code{"Updating"} is "on", the function will attempt to use Broyden
-## updates to update the Jacobian, in order to reduce the amount of Jacobian
-## calculations.
-## If your user function always calculates the Jacobian (regardless of number
-## of output arguments), this option provides no advantage and should be set to
-## false.
+## If @qcode{"Updating"} is @qcode{"on"}, the function will attempt to use
+## @nospell{Broyden} updates to update the Jacobian, in order to reduce the
+## amount of Jacobian calculations.  If your user function always calculates the
+## Jacobian (regardless of number of output arguments), this option provides
+## no advantage and should be set to false.
 ##
-## @code{"ComplexEqn"} is @code{"on"}, @code{fsolve} will attempt to solve
+## @qcode{"ComplexEqn"} is @qcode{"on"}, @code{fsolve} will attempt to solve
 ## complex equations in complex variables, assuming that the equations possess a
 ## complex derivative (i.e., are holomorphic).  If this is not what you want,
 ## should unpack the real and imaginary parts of the system to get a real
@@ -134,7 +133,7 @@
 
   ## Get default options if requested.
   if (nargin == 1 && ischar (fcn) && strcmp (fcn, 'defaults'))
-    x = optimset ("MaxIter", 400, "MaxFunEvals", Inf, \
+    x = optimset ("MaxIter", 400, "MaxFunEvals", Inf, ...
     "Jacobian", "off", "TolX", 1e-7, "TolFun", 1e-7,
     "OutputFcn", [], "Updating", "on", "FunValCheck", "off",
     "ComplexEqn", "off", "FinDiffType", "central",
@@ -462,6 +461,7 @@
   endif
 endfunction
 
+
 %!function retval = __f (p)
 %!  x = p(1);
 %!  y = p(2);
--- a/scripts/optimization/fzero.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/fzero.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,9 +40,9 @@
 ## is not successful, the function fails.
 ## @var{options} is a structure specifying additional options.
 ## Currently, @code{fzero}
-## recognizes these options: @code{"FunValCheck"}, @code{"OutputFcn"},
-## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}.
-## For a description of these options, see @ref{docXoptimset,,optimset}.
+## recognizes these options: @qcode{"FunValCheck"}, @qcode{"OutputFcn"},
+## @qcode{"TolX"}, @qcode{"MaxIter"}, @qcode{"MaxFunEvals"}.
+## For a description of these options, see @ref{XREFoptimset,,optimset}.
 ##
 ## On exit, the function returns @var{x}, the approximate zero point
 ## and @var{fval}, the function value thereof.
@@ -196,70 +196,70 @@
   mba = mu*(b - a);
   while (niter < maxiter && nfev < maxfev)
     switch (itype)
-    case 1
-      ## The initial test.
-      if (b - a <= 2*(2 * abs (u) * eps + tolx))
-        x = u; fval = fu;
-        info = 1;
-        break;
-      endif
-      if (abs (fa) <= 1e3*abs (fb) && abs (fb) <= 1e3*abs (fa))
-        ## Secant step.
-        c = u - (a - b) / (fa - fb) * fu;
-      else
+      case 1
+        ## The initial test.
+        if (b - a <= 2*(2 * abs (u) * eps + tolx))
+          x = u; fval = fu;
+          info = 1;
+          break;
+        endif
+        if (abs (fa) <= 1e3*abs (fb) && abs (fb) <= 1e3*abs (fa))
+          ## Secant step.
+          c = u - (a - b) / (fa - fb) * fu;
+        else
+          ## Bisection step.
+          c = 0.5*(a + b);
+        endif
+        d = u; fd = fu;
+        itype = 5;
+      case {2, 3}
+        l = length (unique ([fa, fb, fd, fe]));
+        if (l == 4)
+          ## Inverse cubic interpolation.
+          q11 = (d - e) * fd / (fe - fd);
+          q21 = (b - d) * fb / (fd - fb);
+          q31 = (a - b) * fa / (fb - fa);
+          d21 = (b - d) * fd / (fd - fb);
+          d31 = (a - b) * fb / (fb - fa);
+          q22 = (d21 - q11) * fb / (fe - fb);
+          q32 = (d31 - q21) * fa / (fd - fa);
+          d32 = (d31 - q21) * fd / (fd - fa);
+          q33 = (d32 - q22) * fa / (fe - fa);
+          c = a + q31 + q32 + q33;
+        endif
+        if (l < 4 || sign (c - a) * sign (c - b) > 0)
+          ## Quadratic interpolation + newton.
+          a0 = fa;
+          a1 = (fb - fa)/(b - a);
+          a2 = ((fd - fb)/(d - b) - a1) / (d - a);
+          ## Modification 1: this is simpler and does not seem to be worse.
+          c = a - a0/a1;
+          if (a2 != 0)
+            c = a - a0/a1;
+            for i = 1:itype
+              pc = a0 + (a1 + a2*(c - b))*(c - a);
+              pdc = a1 + a2*(2*c - a - b);
+              if (pdc == 0)
+                c = a - a0/a1;
+                break;
+              endif
+              c -= pc/pdc;
+            endfor
+          endif
+        endif
+        itype += 1;
+      case 4
+        ## Double secant step.
+        c = u - 2*(b - a)/(fb - fa)*fu;
+        ## Bisect if too far.
+        if (abs (c - u) > 0.5*(b - a))
+          c = 0.5 * (b + a);
+        endif
+        itype = 5;
+      case 5
         ## Bisection step.
-        c = 0.5*(a + b);
-      endif
-      d = u; fd = fu;
-      itype = 5;
-    case {2, 3}
-      l = length (unique ([fa, fb, fd, fe]));
-      if (l == 4)
-        ## Inverse cubic interpolation.
-        q11 = (d - e) * fd / (fe - fd);
-        q21 = (b - d) * fb / (fd - fb);
-        q31 = (a - b) * fa / (fb - fa);
-        d21 = (b - d) * fd / (fd - fb);
-        d31 = (a - b) * fb / (fb - fa);
-        q22 = (d21 - q11) * fb / (fe - fb);
-        q32 = (d31 - q21) * fa / (fd - fa);
-        d32 = (d31 - q21) * fd / (fd - fa);
-        q33 = (d32 - q22) * fa / (fe - fa);
-        c = a + q31 + q32 + q33;
-      endif
-      if (l < 4 || sign (c - a) * sign (c - b) > 0)
-        ## Quadratic interpolation + newton.
-        a0 = fa;
-        a1 = (fb - fa)/(b - a);
-        a2 = ((fd - fb)/(d - b) - a1) / (d - a);
-        ## Modification 1: this is simpler and does not seem to be worse.
-        c = a - a0/a1;
-        if (a2 != 0)
-          c = a - a0/a1;
-          for i = 1:itype
-            pc = a0 + (a1 + a2*(c - b))*(c - a);
-            pdc = a1 + a2*(2*c - a - b);
-            if (pdc == 0)
-              c = a - a0/a1;
-              break;
-            endif
-            c -= pc/pdc;
-          endfor
-        endif
-      endif
-      itype += 1;
-    case 4
-      ## Double secant step.
-      c = u - 2*(b - a)/(fb - fa)*fu;
-      ## Bisect if too far.
-      if (abs (c - u) > 0.5*(b - a))
         c = 0.5 * (b + a);
-      endif
-      itype = 5;
-    case 5
-      ## Bisection step.
-      c = 0.5 * (b + a);
-      itype = 2;
+        itype = 2;
     endswitch
 
     ## Don't let c come too close to a or b.
@@ -357,6 +357,7 @@
   endif
 endfunction
 
+
 %!shared opt0
 %! opt0 = optimset ("tolx", 0);
 %!assert (fzero (@cos, [0, 3], opt0), pi/2, 10*eps)
--- a/scripts/optimization/glpk.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/glpk.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,5 @@
 ## Copyright (C) 2005-2012 Nicolo' Giorgetti
+## Copyright (C) 2013 Sébastien Villemot <sebastien@debian.org>
 ##
 ## This file is part of Octave.
 ##
@@ -17,7 +18,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{xopt}, @var{fmin}, @var{status}, @var{extra}] =} glpk (@var{c}, @var{A}, @var{b}, @var{lb}, @var{ub}, @var{ctype}, @var{vartype}, @var{sense}, @var{param})
+## @deftypefn {Function File} {[@var{xopt}, @var{fmin}, @var{errnum}, @var{extra}] =} glpk (@var{c}, @var{A}, @var{b}, @var{lb}, @var{ub}, @var{ctype}, @var{vartype}, @var{sense}, @var{param})
 ## Solve a linear program using the GNU @sc{glpk} library.  Given three
 ## arguments, @code{glpk} solves the following standard LP:
 ## @tex
@@ -108,19 +109,19 @@
 ## following values
 ##
 ## @table @asis
-## @item "F"
+## @item @qcode{"F"}
 ## A free (unbounded) constraint (the constraint is ignored).
 ##
-## @item "U"
+## @item @qcode{"U"}
 ## An inequality constraint with an upper bound (@code{A(i,:)*x <= b(i)}).
 ##
-## @item "S"
+## @item @qcode{"S"}
 ## An equality constraint (@code{A(i,:)*x = b(i)}).
 ##
-## @item "L"
+## @item @qcode{"L"}
 ## An inequality with a lower bound (@code{A(i,:)*x >= b(i)}).
 ##
-## @item "D"
+## @item @qcode{"D"}
 ## An inequality constraint with both upper and lower bounds
 ## (@code{A(i,:)*x >= -b(i)} @emph{and} (@code{A(i,:)*x <= b(i)}).
 ## @end table
@@ -129,10 +130,10 @@
 ## A column array containing the types of the variables.
 ##
 ## @table @asis
-## @item "C"
+## @item @qcode{"C"}
 ## A continuous variable.
 ##
-## @item "I"
+## @item @qcode{"I"}
 ## An integer variable.
 ## @end table
 ##
@@ -149,112 +150,120 @@
 ## Integer parameters:
 ##
 ## @table @code
-## @item msglev (@w{@code{LPX_K_MSGLEV}}, default: 1)
+## @item msglev (default: 1)
 ## Level of messages output by solver routines:
 ##
 ## @table @asis
-## @item 0
+## @item 0 (@w{@code{GLP_MSG_OFF}})
 ## No output.
 ##
-## @item 1
-## Error messages only.
+## @item 1 (@w{@code{GLP_MSG_ERR}})
+## Error and warning messages only.
 ##
-## @item 2
+## @item 2 (@w{@code{GLP_MSG_ON}})
 ## Normal output.
 ##
-## @item 3
+## @item 3 (@w{@code{GLP_MSG_ALL}})
 ## Full output (includes informational messages).
 ## @end table
 ##
-## @item scale (@w{@code{LPX_K_SCALE}}, default: 1)
-## Scaling option:
+## @item scale (default: 16)
+## Scaling option.  The values can be combined with the bitwise OR operator and
+## may be the following:
 ##
 ## @table @asis
-## @item 0
-## No scaling.
+## @item 1 (@w{@code{GLP_SF_GM}})
+## Geometric mean scaling.
 ##
-## @item 1
+## @item 16 (@w{@code{GLP_SF_EQ}})
 ## Equilibration scaling.
 ##
-## @item 2
-## Geometric mean scaling, then equilibration scaling.
+## @item 32 (@w{@code{GLP_SF_2N}})
+## Round scale factors to power of two.
+##
+## @item 64 (@w{@code{GLP_SF_SKIP}})
+## Skip if problem is well scaled.
 ## @end table
 ##
-## @item dual    (@w{@code{LPX_K_DUAL}}, default: 0)
-## Dual simplex option:
+## Alternatively, a value of 128 (@w{@env{GLP_SF_AUTO}}) may be also
+## specified, in which case the routine chooses the scaling options
+## automatically.
+##
+## @item dual (default: 1)
+## Simplex method option:
 ##
 ## @table @asis
-## @item 0
-## Do not use the dual simplex.
+## @item 1 (@w{@code{GLP_PRIMAL}})
+## Use two-phase primal simplex.
 ##
-## @item 1
-## If initial basic solution is dual feasible, use the dual simplex.
+## @item 2 (@w{@code{GLP_DUALP}})
+## Use two-phase dual simplex, and if it fails, switch to the primal simplex.
+##
+## @item 3 (@w{@code{GLP_DUAL}})
+## Use two-phase dual simplex.
 ## @end table
 ##
-## @item price   (@w{@code{LPX_K_PRICE}}, default: 1)
+## @item price (default: 34)
 ## Pricing option (for both primal and dual simplex):
 ##
 ## @table @asis
-## @item 0
+## @item 17 (@w{@code{GLP_PT_STD}})
 ## Textbook pricing.
 ##
-## @item 1
+## @item 34 (@w{@code{GLP_PT_PSE}})
 ## Steepest edge pricing.
 ## @end table
 ##
-## @item round   (@w{@code{LPX_K_ROUND}}, default: 0)
-## Solution rounding option:
-##
-## @table @asis
-## @item 0
-## Report all primal and dual values "as is".
+## @item itlim (default: intmax)
+## Simplex iterations limit.  It is decreased by one each time when one simplex
+## iteration has been performed, and reaching zero value signals the solver to
+## stop the search.
 ##
-## @item 1
-## Replace tiny primal and dual values by exact zero.
-## @end table
-##
-## @item itlim   (@w{@code{LPX_K_ITLIM}}, default: -1)
-## Simplex iterations limit.  If this value is positive, it is decreased by
-## one each time when one simplex iteration has been performed, and
-## reaching zero value signals the solver to stop the search.  Negative
-## value means no iterations limit.
-##
-## @item itcnt (@w{@code{LPX_K_OUTFRQ}}, default: 200)
+## @item outfrq (default: 200)
 ## Output frequency, in iterations.  This parameter specifies how
 ## frequently the solver sends information about the solution to the
 ## standard output.
 ##
-## @item branch (@w{@code{LPX_K_BRANCH}}, default: 2)
-## Branching heuristic option (for MIP only):
+## @item branch (default: 4)
+## Branching technique option (for MIP only):
 ##
 ## @table @asis
-## @item 0
-## Branch on the first variable.
+## @item 1 (@w{@code{GLP_BR_FFV}})
+## First fractional variable.
+##
+## @item 2 (@w{@code{GLP_BR_LFV}})
+## Last fractional variable.
 ##
-## @item 1
-## Branch on the last variable.
+## @item 3 (@w{@code{GLP_BR_MFV}})
+## Most fractional variable.
 ##
-## @item 2
-## Branch using a heuristic by Driebeck and Tomlin.
+## @item 4 (@w{@code{GLP_BR_DTH}})
+## Heuristic by Driebeck and Tomlin.
+##
+## @item 5 (@w{@code{GLP_BR_PCH}})
+## Hybrid @nospell{pseudocost} heuristic.
 ## @end table
 ##
-## @item btrack (@w{@code{LPX_K_BTRACK}}, default: 2)
-## Backtracking heuristic option (for MIP only):
+## @item btrack (default: 4)
+## Backtracking technique option (for MIP only):
 ##
 ## @table @asis
-## @item 0
+## @item 1 (@w{@code{GLP_BT_DFS}})
 ## Depth first search.
 ##
-## @item 1
+## @item 2 (@w{@code{GLP_BT_BFS}})
 ## Breadth first search.
 ##
-## @item 2
-## Backtrack using the best projection heuristic.
+## @item 3 (@w{@code{GLP_BT_BLB}})
+## Best local bound.
+##
+## @item 4 (@w{@code{GLP_BT_BPH}})
+## Best projection heuristic.
 ## @end table
 ##
-## @item presol (@w{@code{LPX_K_PRESOL}}, default: 1)
-## If this flag is set, the routine lpx_simplex solves the problem using
-## the built-in LP presolver.  Otherwise the LP presolver is not used.
+## @item presol (default: 1)
+## If this flag is set, the simplex solver uses the built-in LP presolver.
+## Otherwise the LP presolver is not used.
 ##
 ## @item lpsolver (default: 1)
 ## Select which solver to use.  If the problem is a MIP problem this flag
@@ -268,6 +277,25 @@
 ## Interior point method.
 ## @end table
 ##
+## @item rtest (default: 34)
+## Ratio test technique:
+##
+## @table @asis
+## @item 17 (@w{@code{GLP_RT_STD}})
+## Standard ("textbook").
+##
+## @item 34 (@w{@code{GLP_RT_HAR}})
+## Harris' two-pass ratio test.
+## @end table
+##
+## @item tmlim (default: intmax)
+## Searching time limit, in milliseconds.
+##
+## @item outdly (default: 0)
+## Output delay, in seconds.  This parameter specifies how long the solver
+## should delay sending information about the solution to the standard
+## output.
+##
 ## @item save (default: 0)
 ## If this parameter is nonzero, save a copy of the problem in
 ## CPLEX LP format to the file @file{"outpb.lp"}.  There is currently no
@@ -277,58 +305,37 @@
 ## Real parameters:
 ##
 ## @table @code
-## @item relax (@w{@code{LPX_K_RELAX}}, default: 0.07)
-## Relaxation parameter used in the ratio test.  If it is zero, the textbook
-## ratio test is used.  If it is non-zero (should be positive), Harris'
-## two-pass ratio test is used.  In the latter case on the first pass of the
-## ratio test basic variables (in the case of primal simplex) or reduced
-## costs of non-basic variables (in the case of dual simplex) are allowed
-## to slightly violate their bounds, but not more than
-## @code{relax*tolbnd} or @code{relax*toldj (thus, @code{relax} is a
-## percentage of @code{tolbnd} or @code{toldj}}.
-##
-## @item tolbnd (@w{@code{LPX_K_TOLBND}}, default: 10e-7)
+## @item tolbnd (default: 1e-7)
 ## Relative tolerance used to check if the current basic solution is primal
 ## feasible.  It is not recommended that you change this parameter unless you
 ## have a detailed understanding of its purpose.
 ##
-## @item toldj (@w{@code{LPX_K_TOLDJ}}, default: 10e-7)
+## @item toldj (default: 1e-7)
 ## Absolute tolerance used to check if the current basic solution is dual
 ## feasible.  It is not recommended that you change this parameter unless you
 ## have a detailed understanding of its purpose.
 ##
-## @item tolpiv (@w{@code{LPX_K_TOLPIV}}, default: 10e-9)
+## @item tolpiv (default: 1e-10)
 ## Relative tolerance used to choose eligible pivotal elements of the
 ## simplex table.  It is not recommended that you change this parameter unless
 ## you have a detailed understanding of its purpose.
 ##
-## @item objll (@w{@code{LPX_K_OBJLL}}, default: -DBL_MAX)
-## Lower limit of the objective function.  If on the phase II the objective
+## @item objll (default: -DBL_MAX)
+## Lower limit of the objective function.  If the objective
 ## function reaches this limit and continues decreasing, the solver stops
 ## the search.  This parameter is used in the dual simplex method only.
 ##
-## @item objul (@w{@code{LPX_K_OBJUL}}, default: +DBL_MAX)
-## Upper limit of the objective function.  If on the phase II the objective
+## @item objul (default: +DBL_MAX)
+## Upper limit of the objective function.  If the objective
 ## function reaches this limit and continues increasing, the solver stops
 ## the search.  This parameter is used in the dual simplex only.
 ##
-## @item tmlim (@w{@code{LPX_K_TMLIM}}, default: -1.0)
-## Searching time limit, in seconds.  If this value is positive, it is
-## decreased each time when one simplex iteration has been performed by the
-## amount of time spent for the iteration, and reaching zero value signals
-## the solver to stop the search.  Negative value means no time limit.
-##
-## @item outdly (@w{@code{LPX_K_OUTDLY}}, default: 0.0)
-## Output delay, in seconds.  This parameter specifies how long the solver
-## should delay sending information about the solution to the standard
-## output.  Non-positive value means no delay.
-##
-## @item tolint (@w{@code{LPX_K_TOLINT}}, default: 10e-5)
+## @item tolint (default: 1e-5)
 ## Relative tolerance used to check if the current basic solution is integer
 ## feasible.  It is not recommended that you change this parameter unless
 ## you have a detailed understanding of its purpose.
 ##
-## @item tolobj (@w{@code{LPX_K_TOLOBJ}}, default: 10e-7)
+## @item tolobj (default: 1e-7)
 ## Relative tolerance used to check if the value of the objective function
 ## is not better than in the best known integer feasible solution.  It is
 ## not recommended that you change this parameter unless you have a
@@ -345,94 +352,69 @@
 ## @item fopt
 ## The optimum value of the objective function.
 ##
-## @item status
-## Status of the optimization.
-##
-## Simplex Method:
-##
-## @table @asis
-## @item 180 (@w{@code{LPX_OPT}})
-## Solution is optimal.
-##
-## @item 181 (@w{@code{LPX_FEAS}})
-## Solution is feasible.
-##
-## @item 182 (@w{@code{LPX_INFEAS}})
-## Solution is infeasible.
-##
-## @item 183 (@w{@code{LPX_NOFEAS}})
-## Problem has no feasible solution.
-##
-## @item 184 (@w{@code{LPX_UNBND}})
-## Problem has no unbounded solution.
-##
-## @item 185 (@w{@code{LPX_UNDEF}})
-## Solution status is undefined.
-## @end table
-##
-## Interior Point Method:
-##
-## @table @asis
-## @item 150 (@w{@code{LPX_T_UNDEF}})
-## The interior point method is undefined.
-##
-## @item 151 (@w{@code{LPX_T_OPT}})
-## The interior point method is optimal.
-## @end table
-##
-## Mixed Integer Method:
+## @item errnum
+## Error code.
 ##
 ## @table @asis
-## @item 170 (@w{@code{LPX_I_UNDEF}})
-## The status is undefined.
+## @item 0
+## No error.
 ##
-## @item 171 (@w{@code{LPX_I_OPT}})
-## The solution is integer optimal.
+## @item 1 (@w{@code{GLP_EBADB}})
+## Invalid basis.
 ##
-## @item 172 (@w{@code{LPX_I_FEAS}})
-## Solution integer feasible but its optimality has not been proven
+## @item 2 (@w{@code{GLP_ESING}})
+## Singular matrix.
 ##
-## @item 173 (@w{@code{LPX_I_NOFEAS}})
-## No integer feasible solution.
-## @end table
+## @item 3 (@w{@code{GLP_ECOND}})
+## Ill-conditioned matrix.
 ##
-## @noindent
-## If an error occurs, @var{status} will contain one of the following
-## codes:
+## @item 4 (@w{@code{GLP_EBOUND}})
+## Invalid bounds.
 ##
-## @table @asis
-## @item 204 (@w{@code{LPX_E_FAULT}})
-## Unable to start the search.
+## @item 5 (@w{@code{GLP_EFAIL}})
+## Solver failed.
 ##
-## @item 205 (@w{@code{LPX_E_OBJLL}})
+## @item 6 (@w{@code{GLP_EOBJLL}})
 ## Objective function lower limit reached.
 ##
-## @item 206 (@w{@code{LPX_E_OBJUL}})
+## @item 7 (@w{@code{GLP_EOBJUL}})
 ## Objective function upper limit reached.
 ##
-## @item 207 (@w{@code{LPX_E_ITLIM}})
+## @item 8 (@w{@code{GLP_EITLIM}})
 ## Iterations limit exhausted.
 ##
-## @item 208 (@w{@code{LPX_E_TMLIM}})
+## @item 9 (@w{@code{GLP_ETMLIM}})
 ## Time limit exhausted.
 ##
-## @item 209 (@w{@code{LPX_E_NOFEAS}})
-## No feasible solution.
+## @item 10 (@w{@code{GLP_ENOPFS}})
+## No primal feasible solution.
+##
+## @item 11 (@w{@code{GLP_ENODFS}})
+## No dual feasible solution.
+##
+## @item 12 (@w{@code{GLP_EROOT}})
+## Root LP optimum not provided.
 ##
-## @item 210 (@w{@code{LPX_E_INSTAB}})
+## @item 13 (@w{@code{GLP_ESTOP}})
+## Search terminated by application.
+##
+## @item 14 (@w{@code{GLP_EMIPGAP}})
+## Relative MIP gap tolerance reached.
+##
+## @item 15 (@w{@code{GLP_ENOFEAS}})
+## No primal/dual feasible solution.
+##
+## @item 16 (@w{@code{GLP_ENOCVG}})
+## No convergence.
+##
+## @item 17 (@w{@code{GLP_EINSTAB}})
 ## Numerical instability.
 ##
-## @item 211 (@w{@code{LPX_E_SING}})
-## Problems with basis matrix.
-##
-## @item 212 (@w{@code{LPX_E_NOCONV}})
-## No convergence (interior).
+## @item 18 (@w{@code{GLP_EDATA}})
+## Invalid data.
 ##
-## @item 213 (@w{@code{LPX_E_NOPFS}})
-## No primal feasible solution (LP presolver).
-##
-## @item 214 (@w{@code{LPX_E_NODFS}})
-## No dual feasible solution (LP presolver).
+## @item 19 (@w{@code{GLP_ERANGE}})
+## Result out of range.
 ## @end table
 ##
 ## @item extra
@@ -448,9 +430,28 @@
 ## @item time
 ## Time (in seconds) used for solving LP/MIP problem.
 ##
-## @item mem
-## Memory (in bytes) used for solving LP/MIP problem (this is not
-## available if the version of @sc{glpk} is 4.15 or later).
+## @item status
+## Status of the optimization.
+##
+## @table @asis
+## @item 1 (@w{@code{GLP_UNDEF}})
+## Solution status is undefined.
+##
+## @item 2 (@w{@code{GLP_FEAS}})
+## Solution is feasible.
+##
+## @item 3 (@w{@code{GLP_INFEAS}})
+## Solution is infeasible.
+##
+## @item 4 (@w{@code{GLP_NOFEAS}})
+## Problem has no feasible solution.
+##
+## @item 5 (@w{@code{GLP_OPT}})
+## Solution is optimal.
+##
+## @item 6 (@w{@code{GLP_UNBND}})
+## Problem has no unbounded solution.
+## @end table
 ## @end table
 ## @end table
 ##
@@ -481,7 +482,7 @@
 ## Author: Nicolo' Giorgetti <giorgetti@dii.unisi.it>
 ## Adapted-by: jwe
 
-function [xopt, fmin, status, extra] = glpk (c, A, b, lb, ub, ctype, vartype, sense, param)
+function [xopt, fmin, errnum, extra] = glpk (c, A, b, lb, ub, ctype, vartype, sense, param)
 
   ## If there is no input output the version and syntax
   if (nargin < 3 || nargin > 9)
@@ -608,7 +609,8 @@
     param = struct ();
   endif
 
-  [xopt, fmin, status, extra] = ...
+  [xopt, fmin, errnum, extra] = ...
     __glpk__ (c, A, b, lb, ub, ctype, vartype, sense, param);
 
 endfunction
+
--- a/scripts/optimization/lsqnonneg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/lsqnonneg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,8 +31,8 @@
 ## @code{@var{x} >= 0}.  @var{c} and @var{d} must be real.  @var{x0} is an
 ## optional initial guess for @var{x}.
 ## Currently, @code{lsqnonneg}
-## recognizes these options: @code{"MaxIter"}, @code{"TolX"}.
-## For a description of these options, see @ref{docXoptimset,,optimset}.
+## recognizes these options: @qcode{"MaxIter"}, @qcode{"TolX"}.
+## For a description of these options, see @ref{XREFoptimset,,optimset}.
 ##
 ## Outputs:
 ##
@@ -57,9 +57,9 @@
 ## A structure with two fields:
 ##
 ## @itemize @bullet
-## @item "algorithm": The algorithm used ("nnls")
+## @item @qcode{"algorithm"}: The algorithm used (@qcode{"nnls"})
 ##
-## @item "iterations": The number of iterations taken.
+## @item @qcode{"iterations"}: The number of iterations taken.
 ## @end itemize
 ##
 ## @item lambda
@@ -79,7 +79,7 @@
 
   if (nargin == 1 && ischar (c) && strcmp (c, 'defaults'))
     x = optimset ("MaxIter", 1e5);
-    return
+    return;
   endif
 
   if (! (nargin >= 2 && nargin <= 4 && ismatrix (c) && ismatrix (d) && isstruct (options)))
--- a/scripts/optimization/optimget.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/optimget.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,7 +33,7 @@
   endif
 
   opts = __all_opts__ ();
-  idx = strncmpi (opts, parname, numel (parname));
+  idx = strncmpi (opts, parname, length (parname));
 
   nmatch = sum (idx);
 
@@ -56,6 +56,7 @@
 
 endfunction
 
+
 %!error optimget ()
 
 %!shared opts
@@ -65,3 +66,4 @@
 %!assert (optimget (opts, "MaxITer"), 100);
 %!warning (optimget (opts, "Max"));
 %!warning (optimget (opts, "foobar"));
+
--- a/scripts/optimization/optimset.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/optimset.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,16 +35,16 @@
 ## Request verbose display of results from optimizations.  Values are:
 ##
 ## @table @asis
-## @item "off" [default]
+## @item @qcode{"off"} [default]
 ## No display.
 ##
-## @item "iter"
+## @item @qcode{"iter"}
 ## Display intermediate results for every loop iteration.
 ##
-## @item "final"
+## @item @qcode{"final"}
 ## Display the result of the final loop iteration.
 ##
-## @item "notify"
+## @item @qcode{"notify"}
 ## Display the result of the final loop iteration if the function has
 ## failed to converge.
 ## @end table
@@ -53,22 +53,22 @@
 ##
 ## @item FunValCheck
 ## When enabled, display an error if the objective function returns an invalid
-## value (a complex number, NaN, or Inf).  Must be set to "on" or "off"
-## [default].  Note: the functions @code{fzero} and @code{fminbnd} correctly
-## handle Inf values and only complex values or NaN will cause an error in this
-## case. 
+## value (a complex number, NaN, or Inf).  Must be set to @qcode{"on"} or
+## @qcode{"off"} [default].  Note: the functions @code{fzero} and
+## @code{fminbnd} correctly handle Inf values and only complex values or NaN
+## will cause an error in this case. 
 ##
 ## @item GradObj
-## When set to "on", the function to be minimized must return a second argument
-## which is the gradient, or first derivative, of the function at the point
-## @var{x}.  If set to "off" [default], the gradient is computed via finite
-## differences.
+## When set to @qcode{"on"}, the function to be minimized must return a
+## second argument which is the gradient, or first derivative, of the
+## function at the point @var{x}.  If set to @qcode{"off"} [default], the
+## gradient is computed via finite differences.
 ##
 ## @item Jacobian
-## When set to "on", the function to be minimized must return a second argument
-## which is the Jacobian, or first derivative, of the function at the point
-## @var{x}.  If set to "off" [default], the Jacobian is computed via finite
-## differences.
+## When set to @qcode{"on"}, the function to be minimized must return a
+## second argument which is the Jacobian, or first derivative, of the
+## function at the point @var{x}.  If set to @qcode{"off"} [default], the
+## Jacobian is computed via finite differences.
 ##
 ## @item MaxFunEvals
 ## Maximum number of function evaluations before optimization stops.
@@ -172,3 +172,4 @@
 %!warning (optimset ("foobar", 13));
 
 %!error (optimset ("%NOT_A_REAL_FUNCTION_NAME%"))
+
--- a/scripts/optimization/pqpnonneg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/pqpnonneg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -48,9 +48,9 @@
 ## A structure with two fields:
 ##
 ## @itemize @bullet
-## @item "algorithm": The algorithm used ("nnls")
+## @item @qcode{"algorithm"}: The algorithm used (@qcode{"nnls"})
 ##
-## @item "iterations": The number of iterations taken.
+## @item @qcode{"iterations"}: The number of iterations taken.
 ## @end itemize
 ##
 ## @item lambda
@@ -72,7 +72,7 @@
 
   if (nargin == 1 && ischar (c) && strcmp (c, 'defaults'))
     x = optimset ("MaxIter", 1e5);
-    return
+    return;
   endif
 
   if (! (nargin >= 2 && nargin <= 4 && ismatrix (c) && ismatrix (d) && isstruct (options)))
--- a/scripts/optimization/qp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/qp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -405,3 +405,4 @@
   endif
 
 endfunction
+
--- a/scripts/optimization/sqp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/optimization/sqp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -186,8 +186,7 @@
 
 function [x, obj, info, iter, nf, lambda] = sqp (x0, objf, cef, cif, lb, ub, maxiter, tolerance)
 
-  globals = struct (); # data and handles, needed and changed by
-                       # subfunctions
+  globals = struct (); # data and handles, needed and changed by subfunctions
 
   if (nargin < 2 || nargin > 8 || nargin == 5)
     print_usage ();
@@ -203,19 +202,19 @@
   have_hess = 0;
   if (iscell (objf))
     switch (numel (objf))
-     case 1
-       obj_fun = objf{1};
-       obj_grd = @ (x) fd_obj_grd (x, obj_fun);
-     case 2
-       obj_fun = objf{1};
-       obj_grd = objf{2};
-     case 3
-       obj_fun = objf{1};
-       obj_grd = objf{2};
-       obj_hess = objf{3};
-       have_hess = 1;
-     otherwise
-      error ("sqp: invalid objective function specification");
+      case 1
+        obj_fun = objf{1};
+        obj_grd = @ (x) fd_obj_grd (x, obj_fun);
+      case 2
+        obj_fun = objf{1};
+        obj_grd = objf{2};
+      case 3
+        obj_fun = objf{1};
+        obj_grd = objf{2};
+        obj_hess = objf{3};
+        have_hess = 1;
+      otherwise
+        error ("sqp: invalid objective function specification");
     endswitch
   else
     obj_fun = objf;   # No cell array, only obj_fun set
@@ -227,14 +226,14 @@
   if (nargin > 2)
     if (iscell (cef))
       switch (numel (cef))
-       case 1
-         ce_fun = cef{1};
-         ce_grd = @ (x) fd_ce_jac (x, ce_fun);
-       case 2
-         ce_fun = cef{1};
-         ce_grd = cef{2};
-       otherwise
-         error ("sqp: invalid equality constraint function specification");
+        case 1
+          ce_fun = cef{1};
+          ce_grd = @ (x) fd_ce_jac (x, ce_fun);
+        case 2
+          ce_fun = cef{1};
+          ce_grd = cef{2};
+        otherwise
+          error ("sqp: invalid equality constraint function specification");
       endswitch
     elseif (! isempty (cef))
       ce_fun = cef;   # No cell array, only constraint equality function set
@@ -261,14 +260,14 @@
       ## constraint inequality function only without any bounds
       ci_grd = @ (x) fd_ci_jac (x, globals.cifcn);
       if (iscell (cif))
-        switch length (cif)
-         case {1}
-           ci_fun = cif{1};
-         case {2}
-           ci_fun = cif{1};
-           ci_grd = cif{2};
-        otherwise
-          error ("sqp: invalid inequality constraint function specification");
+        switch (length (cif))
+          case 1
+            ci_fun = cif{1};
+          case 2
+            ci_fun = cif{1};
+            ci_grd = cif{2};
+          otherwise
+           error ("sqp: invalid inequality constraint function specification");
         endswitch
       elseif (! isempty (cif))
         ci_fun = cif;   # No cell array, only constraint inequality function set
@@ -425,8 +424,8 @@
 
     ## Choose mu such that p is a descent direction for the chosen
     ## merit function phi.
-    [x_new, alpha, obj_new, globals] = \
-        linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, \
+    [x_new, alpha, obj_new, globals] = ...
+        linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, ...
                        obj, globals);
 
     ## Evaluate objective function, constraints, and gradients at x_new.
@@ -520,7 +519,7 @@
 endfunction
 
 
-function [merit, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, \
+function [merit, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, ...
                                          x, mu, globals)
 
   ce = feval (ce_fun, x);
@@ -545,8 +544,8 @@
 endfunction
 
 
-function [x_new, alpha, obj, globals] = \
-      linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, \
+function [x_new, alpha, obj, globals] = ...
+      linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, ...
                      obj, globals)
 
   ## Choose parameters
@@ -570,7 +569,7 @@
   c = feval (obj_grd, x);
   ce = feval (ce_fun, x);
 
-  [phi_x_mu, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, x, \
+  [phi_x_mu, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, x, ...
                                      mu, globals);
 
   D_phi_x_mu = c' * p;
@@ -584,7 +583,7 @@
   endif
 
   while (1)
-    [p1, obj, globals] = phi_L1 ([], obj_fun, ce_fun, ci_fun, \
+    [p1, obj, globals] = phi_L1 ([], obj_fun, ce_fun, ci_fun, ...
                                  x+alpha*p, mu, globals);
     p2 = phi_x_mu+eta*alpha*D_phi_x_mu;
     if (p1 > p2)
@@ -768,3 +767,4 @@
 %!error sqp (1, cell (3,1), cell (2,1), cell (2,1),[],[],1.5)
 %!error sqp (1, cell (3,1), cell (2,1), cell (2,1),[],[],[], ones (2,2))
 %!error sqp (1, cell (3,1), cell (2,1), cell (2,1),[],[],[],-1)
+
--- a/scripts/path/pathdef.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/path/pathdef.m	Sat Oct 05 11:22:09 2013 -0400
@@ -124,3 +124,4 @@
   endif
 
 endfunction
+
--- a/scripts/pkg/pkg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/pkg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,4 +1,4 @@
-## Copyright (C) 2005-2012 S�ren Hauberg
+## Copyright (C) 2005-2012 Søren Hauberg
 ## Copyright (C) 2010 VZLU Prague, a.s.
 ## Copyright (C) 2012 Carlo de Falco
 ##
@@ -137,8 +137,9 @@
 ## [user_packages, system_packages] = pkg ("list")
 ## @end example
 ##
-## The option "-forge" lists packages available at the Octave-Forge repository.
-## This requires an internet connection and the cURL library.  For example:
+## The option @qcode{"-forge"} lists packages available at the Octave-Forge
+## repository.  This requires an internet connection and the cURL library. 
+## For example:
 ##
 ## @example
 ## oct_forge_pkgs = pkg ("list", "-forge")
@@ -146,7 +147,7 @@
 ##
 ## @item describe
 ## Show a short description of the named installed packages, with the option
-## "-verbose" also list functions provided by the package.  For example,
+## @qcode{"-verbose"} also list functions provided by the package.  For example,
 ##
 ## @example
 ## pkg describe -verbose all
@@ -171,8 +172,9 @@
 ## @end example
 ##
 ## @noindent
-## @var{flag} will take one of the values "Not installed", "Loaded" or
-## "Not loaded" for each of the named packages.
+## @var{flag} will take one of the values @qcode{"Not installed"},
+## @qcode{"Loaded"}, or
+## @qcode{"Not loaded"} for each of the named packages.
 ##
 ## @item prefix
 ## Set the installation prefix directory.  For example,
@@ -554,3 +556,4 @@
       error ("you must specify a valid action for 'pkg'. See 'help pkg' for details");
   endswitch
 endfunction
+
--- a/scripts/pkg/private/build.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/build.m	Sat Oct 05 11:22:09 2013 -0400
@@ -61,3 +61,4 @@
     endif
   end_unwind_protect
 endfunction
+
--- a/scripts/pkg/private/configure_make.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/configure_make.m	Sat Oct 05 11:22:09 2013 -0400
@@ -37,25 +37,34 @@
             "INSTALLDIR"; desc.dir};
     scenv = sprintf ("%s=\"%s\" ", cenv{:});
 
+    if (! exist (mkoctfile_program, "file"))
+      __gripe_missing_component__ ("pkg", "mkoctfile");
+    endif
+    if (! exist (octave_config_program, "file"))
+      __gripe_missing_component__ ("pkg", "octave-config");
+    endif
+    if (! exist (octave_binary, "file"))
+      __gripe_missing_component__ ("pkg", "octave");
+    endif
+
     ## Configure.
     if (exist (fullfile (src, "configure"), "file"))
       flags = "";
       if (isempty (getenv ("CC")))
-        flags = cstrcat (flags, " CC=\"", mkoctfile ("-p", "CC"), "\"");
+        flags = [flags ' CC="' mkoctfile("-p", "CC") '"'];
       endif
       if (isempty (getenv ("CXX")))
-        flags = cstrcat (flags, " CXX=\"", mkoctfile ("-p", "CXX"), "\"");
+        flags = [flags ' CXX="' mkoctfile("-p", "CXX") '"'];
       endif
       if (isempty (getenv ("AR")))
-        flags = cstrcat (flags, " AR=\"", mkoctfile ("-p", "AR"), "\"");
+        flags = [flags ' AR="' mkoctfile("-p", "AR") '"'];
       endif
       if (isempty (getenv ("RANLIB")))
-        flags = cstrcat (flags, " RANLIB=\"", mkoctfile ("-p", "RANLIB"), "\"");
+        flags = [flags ' RANLIB="' mkoctfile("-p", "RANLIB") '"'];
       endif
-      [status, output] = shell (cstrcat ("cd '", src, "'; ", scenv,
-                                         "./configure --prefix=\"",
-                                         desc.dir, "\"", flags),
-                                verbose);
+      cmd = ["cd '" src "'; " ...
+             scenv "./configure --prefix=\"" desc.dir "\"" flags];
+      [status, output] = shell (cmd, verbose);
       if (status != 0)
         rmdir (desc.dir, "s");
         disp (output);
@@ -65,8 +74,7 @@
 
     ## Make.
     if (exist (fullfile (src, "Makefile"), "file"))
-      [status, output] = shell (cstrcat (scenv, "make -C '", src, "'"),
-                                verbose);
+      [status, output] = shell ([scenv "make -C '" src "'"], verbose);
       if (status != 0)
         rmdir (desc.dir, "s");
         disp (output);
--- a/scripts/pkg/private/create_pkgadddel.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/create_pkgadddel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,8 +29,8 @@
   ## architecture dependent directory so that the autoload/mfilename
   ## commands work as expected. The only part that doesn't is the
   ## part in the main directory.
-  archdir = fullfile (getarchprefix (desc, global_install), cstrcat (desc.name,
-                      "-", desc.version), getarch ());
+  archdir = fullfile (getarchprefix (desc, global_install), 
+                      [desc.name "-" desc.version], getarch ());
   if (exist (getarchdir (desc, global_install), "dir"))
     archpkg = fullfile (getarchdir (desc, global_install), nm);
     archfid = fopen (archpkg, "at");
--- a/scripts/pkg/private/describe.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/describe.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,7 +29,6 @@
   installed_pkgs_lst = installed_packages(local_list, global_list);
   num_packages = length (installed_pkgs_lst);
 
-
   describe_all = false;
   if (any (strcmp ("all", pkgnames)))
     describe_all = true;
@@ -85,3 +84,4 @@
   endif
 
 endfunction
+
--- a/scripts/pkg/private/dirempty.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/dirempty.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,7 +40,7 @@
       endfor
       if (! found)
         emp = false;
-        return
+        return;
       endif
     endfor
     emp = true;
@@ -48,3 +48,4 @@
     emp = true;
   endif
 endfunction
+
--- a/scripts/pkg/private/extract_pkg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/extract_pkg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,12 +31,12 @@
       if (ln > 0)
         t = regexp (ln, pat, "tokens");
         if (! isempty (t))
-          pkg = cstrcat (pkg, "\n", t{1}{1});
+          pkg = [pkg "\n" t{1}{1}];
         endif
       endif
     endwhile
     if (! isempty (pkg))
-      pkg = cstrcat (pkg, "\n");
+      pkg = [pkg "\n"];
     endif
     fclose (fid);
   endif
--- a/scripts/pkg/private/fix_depends.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/fix_depends.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,38 +28,40 @@
 function deps_cell = fix_depends (depends)
   deps = strtrim (ostrsplit (tolower (depends), ","));
   deps_cell = cell (1, length (deps));
+  dep_pat = ...
+  '\s*(?<name>\w+)+\s*(\(\s*(?<op>[<>=]+)\s*(?<ver>\d+\.\d+(\.\d+)*)\s*\))*\s*';
 
   ## For each dependency.
   for i = 1:length (deps)
     dep = deps{i};
-    lpar = find (dep == "(");
-    rpar = find (dep == ")");
-    ## Does the dependency specify a version
-    ## Example: package(>= version).
-    if (length (lpar) == 1 && length (rpar) == 1)
-      package = tolower (strtrim (dep(1:lpar-1)));
-      sub = dep(lpar(1)+1:rpar(1)-1);
-      parts = strsplit (sub, " ", true);
-      if (length (parts) != 2)
-        error ("incorrect syntax for dependency '%s' in the DESCRIPTION file\n",
-               dep);
+    [start, nm] = regexp (dep, dep_pat, 'start', 'names');
+    ## Is the dependency specified 
+    ## in the correct format?
+    if (! isempty (start))
+      package = tolower (strtrim (nm.name));
+      ## Does the dependency specify a version
+      ## Example: package(>= version).
+      if (! isempty (nm.ver))
+        operator = nm.op;
+        if (! any (strcmp (operator, {">", ">=", "<=", "<", "=="})))
+          error ("unsupported operator: %s", operator);
+        endif
+        version = fix_version (nm.ver);
+        ## If no version is specified for the dependency
+        ## we say that the version should be greater than
+        ## or equal to "0.0.0".
+      else
+        package = tolower (strtrim (dep));
+        operator = ">=";
+        version  = "0.0.0";
       endif
-      operator = parts{1};
-      if (! any (strcmp (operator, {">", ">=", "<=", "<", "=="})))
-        error ("unsupported operator: %s", operator);
-      endif
-      version  = fix_version (parts{2});
-
-  ## If no version is specified for the dependency
-  ## we say that the version should be greater than
-  ## or equal to "0.0.0".
-  else
-    package = tolower (strtrim (dep));
-    operator = ">=";
-    version  = "0.0.0";
-  endif
-  deps_cell{i} = struct ("package", package, "operator", operator,
-                         "version", version);
+      deps_cell{i} = struct ("package", package, 
+                             "operator", operator,
+                             "version", version);
+    else
+      error ("incorrect syntax for dependency '%s' in the DESCRIPTION file\n",
+             dep);
+    endif
   endfor
 endfunction
 
--- a/scripts/pkg/private/fix_version.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/fix_version.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,23 +25,17 @@
 ## Make sure the version string v is a valid x.y.z version string
 ## Examples: "0.1" => "0.1.0", "monkey" => error(...).
 function out = fix_version (v)
-  dots = find (v == ".");
-  if (length (dots) == 1)
-    major = str2num (v(1:dots-1));
-    minor = str2num (v(dots+1:end));
-    if (length (major) != 0 && length (minor) != 0)
-      out = sprintf ("%d.%d.0", major, minor);
-      return;
+
+  if (regexp (v, '^\d+(\.\d+){1,2}$') == 1)
+    parts = ostrsplit (v, '.', true);
+    if (numel (parts) == 2)
+      out = strcat (v, ".0");
+    else
+      out = v;
     endif
-  elseif (length (dots) == 2)
-    major = str2num (v(1:dots(1)-1));
-    minor = str2num (v(dots(1)+1:dots(2)-1));
-    rev = str2num (v(dots(2)+1:end));
-    if (length (major) != 0 && length (minor) != 0 && length (rev) != 0)
-      out = sprintf ("%d.%d.%d", major, minor, rev);
-      return;
-    endif
+  else
+    error ("bad version string: %s", v);
   endif
-  error ("bad version string: %s", v);
+
 endfunction
 
--- a/scripts/pkg/private/get_description.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/get_description.m	Sat Oct 05 11:22:09 2013 -0400
@@ -38,7 +38,7 @@
     elseif (isspace (line(1)))
       ## Continuation lines
       if (exist ("keyword", "var") && isfield (desc, keyword))
-        desc.(keyword) = cstrcat (desc.(keyword), " ", deblank (line));
+        desc.(keyword) = [desc.(keyword) " " deblank(line)];
       endif
     else
       ## Keyword/value pair
--- a/scripts/pkg/private/get_forge_download.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/get_forge_download.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,3 +26,4 @@
   [ver, url] = get_forge_pkg (name);
   local_file = [name, "-", ver, ".tar.gz"];
 endfunction
+
--- a/scripts/pkg/private/get_forge_pkg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/get_forge_pkg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,9 +26,7 @@
 ## @end deftypefn
 
 function [ver, url] = get_forge_pkg (name)
-  if (nargin != 1)
-    print_usage ();
-  endif
+
   ## Verify that name is valid.
   if (! (ischar (name) && rows (name) == 1 && ndims (name) == 2))
     error ("get_forge_pkg: package NAME must be a string");
@@ -51,9 +49,9 @@
     else
       ver = t{1}{1};
       if (nargout > 1)
-        # Build download string.
+        ## Build download string.
         pkg_file = sprintf ("%s-%s.tar.gz", name, ver);
-        url = cstrcat ("http://packages.octave.org/download/", pkg_file);
+        url = ["http://packages.octave.org/download/" pkg_file];
         ## Verify that the package string exists on the page.
         if (isempty (strfind (html, pkg_file)))
           warning ("get_forge_pkg: download URL not verified");
@@ -80,3 +78,4 @@
   endif
 
 endfunction
+
--- a/scripts/pkg/private/get_unsatisfied_deps.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/get_unsatisfied_deps.m	Sat Oct 05 11:22:09 2013 -0400
@@ -52,3 +52,4 @@
     endif
   endfor
 endfunction
+
--- a/scripts/pkg/private/getarch.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/getarch.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,8 +23,8 @@
 ## @end deftypefn
 
 function arch = getarch ()
-  persistent _arch = cstrcat (octave_config_info ("canonical_host_type"),
-                              "-", octave_config_info ("api_version"));
+  persistent _arch = [octave_config_info("canonical_host_type"), "-", ...
+                      octave_config_info("api_version")];
   arch = _arch;
 endfunction
 
--- a/scripts/pkg/private/getarchprefix.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/getarchprefix.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,7 +25,7 @@
 function archprefix = getarchprefix (desc, global_install)
   if (global_install)
     archprefix = fullfile (octave_config_info ("libdir"), "octave",
-                           "packages", cstrcat (desc.name, "-", desc.version));
+                           "packages", [desc.name "-" desc.version]);
   else
     archprefix = desc.dir;
   endif
--- a/scripts/pkg/private/install.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/install.m	Sat Oct 05 11:22:09 2013 -0400
@@ -121,11 +121,10 @@
         endif
 
         ## Set default installation directory.
-        desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version));
+        desc.dir = fullfile (prefix, [desc.name "-" desc.version]);
 
         ## Set default architectire dependent installation directory.
-        desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
-                                                         desc.version));
+        desc.archprefix = fullfile (archprefix, [desc.name "-" desc.version]);
 
         ## Save desc.
         descriptions{end+1} = desc;
@@ -172,9 +171,8 @@
         ok = false;
         for i = 1:length (bad_deps)
           dep = bad_deps{i};
-          error_text = cstrcat (error_text, " ", desc.name, " needs ",
-                               dep.package, " ", dep.operator, " ",
-                               dep.version, "\n");
+          error_text = [error_text " " desc.name " needs " ...
+                        dep.package " " dep.operator " " dep.version "\n"];
         endfor
       endif
     endfor
@@ -343,3 +341,4 @@
   endif
 
 endfunction
+
--- a/scripts/pkg/private/installed_packages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/installed_packages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -140,10 +140,9 @@
       first_char = length (cur_dir) - max_dir_length + 4;
       first_filesep = strfind (cur_dir(first_char:end), filesep ());
       if (! isempty (first_filesep))
-        cur_dir = cstrcat ("...",
-                          cur_dir((first_char + first_filesep(1) - 1):end));
+        cur_dir = ["..." cur_dir((first_char + first_filesep(1) - 1):end)];
       else
-        cur_dir = cstrcat ("...", cur_dir(first_char:end));
+        cur_dir = ["..." cur_dir(first_char:end)];
       endif
     endif
     if (installed_pkgs_lst{idx(i)}.loaded)
--- a/scripts/pkg/private/is_architecture_dependent.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/is_architecture_dependent.m	Sat Oct 05 11:22:09 2013 -0400
@@ -44,3 +44,4 @@
     endif
   endfor
 endfunction
+
--- a/scripts/pkg/private/list_forge_packages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/list_forge_packages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -42,3 +42,4 @@
     endfor
   endif
 endfunction
+
--- a/scripts/pkg/private/load_packages_and_dependencies.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/load_packages_and_dependencies.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,13 +31,13 @@
     ndir = installed_pkgs_lst{i}.dir;
     dirs{end+1} = ndir;
     if (exist (fullfile (dirs{end}, "bin"), "dir"))
-      execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, "bin"));
+      execpath = [execpath pathsep() fullfile(dirs{end}, "bin")];
     endif
     tmpdir = getarchdir (installed_pkgs_lst{i});
     if (exist (tmpdir, "dir"))
       dirs{end + 1} = tmpdir;
       if (exist (fullfile (dirs{end}, "bin"), "dir"))
-        execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, "bin"));
+        execpath = [execpath pathsep() fullfile(dirs{end}, "bin")];
       endif
     endif
   endfor
--- a/scripts/pkg/private/rebuild.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/rebuild.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,7 +35,7 @@
     wd = pwd ();
     unwind_protect
       cd (prefix);
-      dirlist = glob (cellfun(@(x) cstrcat (x, '-*'), files, 'uniformoutput', 0));
+      dirlist = glob (strcat (files, '-*'));
     unwind_protect_cleanup
       cd (wd);
     end_unwind_protect
@@ -49,8 +49,7 @@
     if (exist (descfile, "file"))
       desc = get_description (descfile);
       desc.dir = fullfile (prefix, dirlist{k});
-      desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
-                                  desc.version));
+      desc.archprefix = fullfile (archprefix, [desc.name "-" desc.version]);
       if (auto != 0)
         if (exist (fullfile (desc.dir, "packinfo", ".autoload"), "file"))
           unlink (fullfile (desc.dir, "packinfo", ".autoload"));
@@ -98,3 +97,4 @@
     endif
   endif
 endfunction
+
--- a/scripts/pkg/private/repackage.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/repackage.m	Sat Oct 05 11:22:09 2013 -0400
@@ -44,8 +44,8 @@
       if (exist (fullfile (pack.name, "inst", "bin"), "dir"))
         movefile (fullfile (pack.name, "inst", "bin"), pack.name);
       endif
-      archdir = fullfile (pack.archprefix, cstrcat (pack.name, "-",
-                          pack.version), getarch ());
+      archdir = fullfile (pack.archprefix, [pack.name "-" pack.version],
+                          getarch ());
       if (exist (archdir, "dir"))
         if (exist (fullfile (pack.name, "inst", "PKG_ADD"), "file"))
           unlink (fullfile (pack.name, "inst", "PKG_ADD"));
@@ -71,7 +71,7 @@
                     fullfile (pack.name, "PKG_DEL"));
         endif
       endif
-      tfile = cstrcat (pack.name, "-", pack.version, ".tar");
+      tfile = [pack.name "-" pack.version ".tar"];
       tar (tfile, pack.name);
       try
         gzip (tfile);
--- a/scripts/pkg/private/shell.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/shell.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,14 +30,14 @@
   cmd = strrep (cmd, "\\", "/");
   if (ispc () && ! isunix ())
     if (isempty (have_sh))
-      if (system ("sh.exe -c \"exit\""))
+      if (system ('sh.exe -c "exit"'))
         have_sh = false;
       else
         have_sh = true;
       endif
     endif
     if (have_sh)
-      cmd = cstrcat ("sh.exe -c \"", cmd, "\"");
+      cmd = ['sh.exe -c "' cmd '"'];
     else
       error ("pkg: unable to find the command shell.");
     endif
@@ -54,3 +54,4 @@
     [status, output] = system (cmd);
   endif
 endfunction
+
--- a/scripts/pkg/private/uninstall.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/uninstall.m	Sat Oct 05 11:22:09 2013 -0400
@@ -81,9 +81,8 @@
       if (! isempty (bad_deps))
         for i = 1:length (bad_deps)
           dep = bad_deps{i};
-          error_text = cstrcat (error_text, " ", desc.name, " needs ",
-                               dep.package, " ", dep.operator, " ",
-                               dep.version, "\n");
+          error_text = [error_text " " desc.name " needs " ...
+                        dep.package " " dep.operator " " dep.version "\n"];
         endfor
       endif
     endfor
@@ -145,3 +144,4 @@
   endif
 
 endfunction
+
--- a/scripts/pkg/private/unload_packages.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/pkg/private/unload_packages.m	Sat Oct 05 11:22:09 2013 -0400
@@ -73,8 +73,7 @@
     idx = strcmp (p, d);
     if (any (idx))
       rmpath (d);
-      ## FIXME: We should also check if we need to remove items from
-      ## EXEC_PATH.
+      ## FIXME: We should also check if we need to remove items from EXEC_PATH.
     endif
   endfor
 endfunction
--- a/scripts/plot/__gnuplot_drawnow__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __gnuplot_drawnow__ (@var{h}, @var{term}, @var{file}, @var{mono}, @var{debug_file})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __gnuplot_drawnow__ (h, term, file, mono = false, debug_file)
-
-  if (nargin < 1 || nargin > 5 || nargin == 2)
-    print_usage ();
-  endif
-
-  if (nargin >= 3 && nargin <= 5)
-    ## Produce various output formats, or redirect gnuplot stream to a
-    ## debug file.
-    plot_stream = [];
-    fid = [];
-    default_plot_stream = get (h, "__plot_stream__");
-    unwind_protect
-      plot_stream = __gnuplot_open_stream__ (2, h);
-      gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream);
-      if (gnuplot_supports_term)
-        enhanced = gnuplot_set_term (plot_stream(1), true, h, term, file);
-        __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
-        if (nargin == 5)
-          fid = fopen (debug_file, "wb");
-          enhanced = gnuplot_set_term (fid, true, h, term, file);
-          __go_draw_figure__ (h, fid, enhanced, mono);
-        endif
-      else
-        error ('__gnuplot_drawnow__: the gnuplot terminal, "%s", is not available',
-               gnuplot_trim_term (term));
-      endif
-    unwind_protect_cleanup
-      set (h, "__plot_stream__", default_plot_stream);
-      if (! isempty (plot_stream))
-        pclose (plot_stream(1));
-        if (numel (plot_stream) > 1)
-          pclose (plot_stream(2));
-        endif
-        if (numel (plot_stream) > 2)
-          waitpid (plot_stream(3));
-        endif
-      endif
-      if (! isempty (fid))
-        fclose (fid);
-      endif
-    end_unwind_protect
-  else  # nargin == 1
-    ##  Graphics terminal for display.
-    plot_stream = get (h, "__plot_stream__");
-    if (isempty (plot_stream))
-      plot_stream = __gnuplot_open_stream__ (2, h);
-      new_stream = true;
-    else
-      new_stream = false;
-    endif
-    term = gnuplot_default_term (plot_stream);
-    if (strcmp (term, "dumb"))
-      ## popen2 eats stdout of gnuplot, use temporary file instead
-      dumb_tmp_file = tmpnam ();
-      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h,
-                                   term, dumb_tmp_file);
-    else
-      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h, term);
-    endif
-    __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
-    fflush (plot_stream(1));
-    if (strcmp (term, "dumb"))
-      fid = -1;
-      while (fid < 0)
-        pause (0.1);
-        fid = fopen (dumb_tmp_file, 'r');
-      endwhile
-      ## reprint the plot on screen
-      [a, count] = fscanf (fid, '%c', Inf);
-      fclose (fid);
-      if (count > 0)
-        if (a(1) == 12)
-          a = a(2:end);  # avoid ^L at the beginning
-        endif
-        puts (a);
-      endif
-      unlink (dumb_tmp_file);
-    endif
-  endif
-
-endfunction
-
-function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
-  ## Generate the gnuplot "set terminal <term> ..." command.
-  ## When "term" originates from print.m, it may include other options.
-  if (nargin < 4)
-    ## This supports the gnuplot graphics toolkit.
-    term = gnuplot_default_term (plot_stream);
-    opts_str = "";
-  else
-    ## Get the one word terminal id and save the remaining as options to be
-    ## passed on to gnuplot.  The terminal may respect the graphics toolkit.
-    [term, opts_str] = gnuplot_trim_term (term);
-    term = lower (term);
-    if (strcmp (term, "lua"))
-      ## Replace "lua tikz" with just "tikz"
-      term = "tikz";
-      opts_str = strrep (opts_str, "tikz", "");
-    endif
-  endif
-
-  if (strfind (opts_str, "noenhanced"))
-    enhanced = false;
-  else
-    enhanced = gnuplot_is_enhanced_term (plot_stream, term);
-  endif
-
-  ## Set the terminal.
-  if (! isempty (term))
-
-    if (enhanced)
-      enh_str = "enhanced";
-    else
-      enh_str = "";
-    endif
-
-    if (! isempty (h) && isfigure (h))
-
-      ## Generate gnuplot title string for plot windows.
-      if (output_to_screen (term) && ! strcmp (term, "dumb"))
-        fig.numbertitle = get (h, "numbertitle");
-        fig.name = strrep (get (h, "name"), '"', '\"');
-        if (strcmp (get (h, "numbertitle"), "on"))
-          title_str = sprintf ("Figure %d", h);
-        else
-          title_str = "";
-        endif
-        if (! isempty (fig.name) && ! isempty (title_str))
-          title_str = sprintf ("%s: %s", title_str, fig.name);
-        elseif (! isempty (fig.name) && isempty (title_str))
-          title_str = fig.name;
-        endif
-        if (! isempty (title_str))
-          title_str = sprintf ('title "%s"', title_str);
-        endif
-        if (strcmp (term, "aqua"))
-          ## Adjust axes-label and tick-label spacing.
-          opts_str = sprintf ('%s font "%s,%d"', opts_str,
-                              get (0, "defaultaxesfontname"),
-                              get (0, "defaultaxesfontsize") / 1.5);
-        endif
-      else
-        title_str = "";
-      endif
-
-      if (! (any (strfind (opts_str, " size ") > 0)
-          || any (strfind (opts_str, "size ") == 1)))
-        ## Get figure size in pixels.  Rely on listener to handle coversion.
-        units = get (h, "units");
-        unwind_protect
-          set (h, "units", "pixels");
-          position_in_pixels = get (h, "position");
-        unwind_protect_cleanup
-          set (h, "units", units);
-        end_unwind_protect
-        gnuplot_pos = position_in_pixels(1:2);
-        gnuplot_size = position_in_pixels(3:4);
-        if (! (output_to_screen (term)
-               || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
-                                      "pbm", "png", "pngcairo", "svg"}))))
-          ## Convert to inches
-          gnuplot_pos = gnuplot_pos / 72;
-          gnuplot_size = gnuplot_size / 72;
-        endif
-        if (all (gnuplot_size > 0))
-          terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
-                                 "gif", "jpeg", "latex", "pbm", "pdf", ...
-                                 "pdfcairo", "postscript", "png", ...
-                                 "pngcairo", "pstex", "pslatex", "svg", "tikz"};
-          if (__gnuplot_has_feature__ ("windows_figure_position"))
-            terminals_with_size{end+1} = "windows";
-          endif
-          if (__gnuplot_has_feature__ ("x11_figure_position"))
-            terminals_with_size{end+1} = "x11";
-          endif
-          if (__gnuplot_has_feature__ ("wxt_figure_size"))
-            terminals_with_size{end+1} = "wxt";
-          endif
-          switch (term)
-            case terminals_with_size
-              size_str = sprintf ("size %.12g,%.12g", gnuplot_size);
-            case "tikz"
-              size_str = sprintf ("size %gin,%gin", gnuplot_size);
-            case "dumb"
-              new_stream = 1;
-              if (! isempty (getenv ("COLUMNS")) && ! isempty (getenv ("LINES")))
-                ## Let dumb use full text screen size (minus prompt lines).
-                n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n")));
-                ## n = the number of times \n appears in PS1
-                size_str = ["size ", getenv("COLUMNS"), ",", getenv("LINES"), n];
-              else
-                ## Use the gnuplot default.
-                size_str = "";
-              endif
-            case {"aqua", "fig", "corel"}
-              size_str = sprintf ("size %g %g", gnuplot_size);
-            case "dxf"
-              size_str = "";
-            otherwise
-              size_str = "";
-          endswitch
-          if ((strncmpi (term, "x11", 3)
-               && __gnuplot_has_feature__ ("x11_figure_position"))
-              || (strcmpi (term, "windows")
-                  && __gnuplot_has_feature__ ("windows_figure_position")))
-            ## X11/Windows allows the window to be positioned as well.
-            units = get (0, "units");
-            unwind_protect
-              set (0, "units", "pixels");
-              screen_size = get (0, "screensize")(3:4);
-            unwind_protect_cleanup
-              set (0, "units", units);
-            end_unwind_protect
-            if (all (screen_size > 0))
-              ## For X11/Windows, set the figure positon as well as the size
-              ## gnuplot position is UL, Octave's is LL (same for screen/window)
-              gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
-              gnuplot_pos = max (gnuplot_pos, 1);
-              size_str = sprintf ("%s position %d,%d", size_str,
-                                  gnuplot_pos(1), gnuplot_pos(2));
-            endif
-          endif
-        else
-          size_str = "";
-          warning ("gnuplot_set_term: size is zero");
-        endif
-      else
-        ## A specified size take priority over the figure properies.
-        size_str = "";
-      endif
-    else
-      if (isempty (h))
-        disp ("gnuplot_set_term: figure handle is empty");
-      elseif (! isfigure (h))
-        disp ("gnuplot_set_term: not a figure handle");
-      endif
-      title_str = "";
-      size_str = "";
-    endif
-
-    ## Set the gnuplot terminal (type, enhanced, title, options & size).
-    term_str = ["set terminal " term];
-    if (! isempty (enh_str))
-      term_str = [term_str " " enh_str];
-    endif
-    if (! isempty (title_str))
-      term_str = [term_str " " title_str];
-    endif
-    if (isempty (strfind (term, "corel")))
-      if (! isempty (size_str) && new_stream)
-        ## size_str comes after other options to permit specification of
-        ## the canvas size for terminals cdr/corel.
-        term_str = [term_str " " size_str];
-      endif
-      if (nargin > 3 && ischar (opts_str))
-        ## Options must go last.
-        term_str = [term_str " " opts_str];
-      endif
-    else
-      if (nargin > 3 && ischar (opts_str))
-        ## Options must go last.
-        term_str = [term_str " " opts_str];
-      endif
-      if (! isempty (size_str) && new_stream)
-        ## size_str comes after other options to permit specification of
-        ## the canvas size for terminals cdr/corel.
-        term_str = [term_str " " size_str];
-      endif
-    endif
-    if (! __gnuplot_has_feature__ ("has_termoption_dashed"))
-      ## If "set termoption dashed" isn't available add "dashed" option
-      ## to the "set terminal ..." command, if it is supported.
-      if (any (strcmp (term, {"aqua", "cgm", "eepic", "emf", "epslatex", \
-                              "fig", "pcl5", "mp", "next", "openstep", "pdf", \
-                              "pdfcairo", "pngcairo", "postscript", \
-                              "pslatex", "pstext", "svg", "tgif", "x11"})))
-        term_str = [term_str " dashed"];
-      endif
-    end
-    if (any (strcmp (term, {"aqua", "wxt"})))
-      term_str = [term_str, " ", "dashlength 1"];
-    elseif (any (strcmp (term, {"epslatex", "postscript", "pslatex"})))
-      term_str = [term_str, " ", "dashlength 2"];
-    endif
-
-    ## Work around the gnuplot feature of growing the x11 window and
-    ## flickering window (x11, windows, & wxt) when the mouse and
-    ## multiplot are set in gnuplot.
-    fputs (plot_stream, "unset multiplot;\n");
-    flickering_terms = {"x11", "windows", "wxt", "dumb"};
-    if (! any (strcmp (term, flickering_terms))
-        || have_non_legend_axes (h)
-        || numel (findall (h, "type", "image")) > 0)
-      fprintf (plot_stream, "%s\n", term_str);
-      if (nargin == 5)
-        if (! isempty (file))
-          fprintf (plot_stream, "set output '%s';\n", file);
-        endif
-      endif
-      fputs (plot_stream, "set multiplot;\n");
-    elseif (any (strcmp (term, flickering_terms)))
-      fprintf (plot_stream, "%s\n", term_str);
-      if (nargin == 5)
-        if (! isempty (file))
-          fprintf (plot_stream, "set output '%s';\n", file);
-        endif
-      endif
-    endif
-    if (__gnuplot_has_feature__ ("has_termoption_dashed"))
-      fprintf (plot_stream, "set termoption dashed\n")
-    endif
-  else
-    ## gnuplot will pick up the GNUTERM environment variable itself
-    ## so no need to set the terminal type if not also setting the
-    ## figure title, enhanced mode, or position.
-  endif
-
-endfunction
-
-function term = gnuplot_default_term (plot_stream)
-  term = lower (getenv ("GNUTERM"));
-  ## If not specified, guess the terminal type.
-  if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
-    if (isguirunning () && __gnuplot_has_terminal__ ("qt", plot_stream))
-      term = "qt";
-    elseif (ismac ())
-      term = "aqua";
-    elseif (! isunix ())
-      term = "windows";
-    elseif (! isempty (getenv ("DISPLAY")))
-      term = "x11";
-    else
-      term = "dumb";
-    endif
-  endif
-endfunction
-
-function [term, opts] = gnuplot_trim_term (string)
-  ## Extract the terminal type and terminal options (from print.m)
-  string = strtrim (string);
-  [term, opts] = strtok (string, ' ');
-  if (! isempty (opts))
-    opts(1) = "";  # trim extra space from strtok
-  endif
-endfunction
-
-function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
-  ## Don't include pstex, pslatex or epslatex here as the TeX commands
-  ## should not be interpreted in that case.
-  persistent enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", ...
-                                   "jpeg", "pdf", "pdfcairo", "pm", "png", ...
-                                   "pngcairo", "postscript", "qt", "svg",  ...
-                                   "windows", "wxt", "x11"};
-
-  if (nargin < 2)
-    ## Determine the default gnuplot terminal.
-    term = gnuplot_default_term (plot_stream);
-  endif
-  have_enhanced = any (strcmp (term, enhanced_terminals));
-endfunction
-
-function ret = output_to_screen (term)
-  ret = any (strcmpi (term, 
-                     {"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}));
-endfunction
-
-function retval = have_non_legend_axes (h)
-  retval = false;
-  all_axes = findall (h, "type", "axes");
-  if (! isempty (all_axes))
-    n_all_axes = numel (all_axes);
-    all_axes_tags = get (all_axes, "tag");
-    legend_axes = strcmp (all_axes_tags, "legend");
-    if (! isempty (legend_axes))
-      n_legend_axes = sum (legend_axes);
-      retval = (n_all_axes - n_legend_axes) > 1;
-    endif
-  endif
-endfunction
-
-
-## No test needed for internal helper function.
-%!assert (1)
-
--- a/scripts/plot/__plt_get_axis_arg__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{varargin}, @var{narg}] =} __plt_get_axis_arg__ (@var{caller}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
-
-  if (islogical (caller))
-    nogca = caller;
-    caller = varargin{1};
-    varargin(1) = [];
-  else
-    nogca = false;
-  endif
-
-  ## Figure handles are integers, but object handles are non-integer,
-  ## therefore ignore integer scalars.
-  if (nargin > 1 && length (varargin) > 0 && isnumeric (varargin{1})
-      && numel (varargin{1}) == 1 && ishandle (varargin{1}(1))
-      && varargin{1}(1) != 0 && ! isfigure (varargin{1}(1)))
-    tmp = varargin{1};
-    obj = get (tmp);
-    if ((strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend"))
-        || strcmp (obj.type, "hggroup"))
-      h = ancestor (tmp, "axes");
-      varargin(1) = [];
-      if (isempty (varargin))
-        varargin = {};
-      endif
-    else
-      error ("%s: expecting first argument to be axes handle", caller);
-    endif
-  else
-    f = get (0, "currentfigure");
-    if (isempty (f))
-      h = [];
-    else
-      h = get (f, "currentaxes");
-    endif
-    if (isempty (h))
-      if (nogca)
-        h = NaN;
-      else
-        h = gca ();
-      endif
-    endif
-    if (nargin < 2)
-      varargin = {};
-    endif
-  endif
-
-  if (ishandle (h) && strcmp (get (h, "nextplot"), "new"))
-    h = axes ();
-  endif
-
-  narg = length (varargin);
-
-endfunction
-
-
-## No test needed for internal helper function.
-%!assert (1)
-
--- a/scripts/plot/allchild.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-## Copyright (C) 2008-2012 Bill Denney
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} allchild (@var{handles})
-## Find all children, including hidden children, of a graphics object.
-##
-## This function is similar to @code{get (h, "children")}, but also
-## returns hidden objects.  If @var{handles} is a scalar,
-## @var{h} will be a vector.  Otherwise, @var{h} will be a cell matrix
-## of the same size as @var{handles} and each cell will contain a
-## vector of handles.
-## @seealso{get, set, findall, findobj}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-
-function h = allchild (handles)
-
-  shh = get (0, "showhiddenhandles");
-  unwind_protect
-    set (0, "showhiddenhandles", "on");
-    h = get (handles, "children");
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", shh);
-  end_unwind_protect
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"});
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/ancestor.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{parent} =} ancestor (@var{h}, @var{type})
-## @deftypefnx {Function File} {@var{parent} =} ancestor (@var{h}, @var{type}, "toplevel")
-## Return the first ancestor of handle object @var{h} whose type matches
-## @var{type}, where @var{type} is a character string.  If @var{type} is a
-## cell array of strings, return the first parent whose type matches
-## any of the given type strings.
-##
-## If the handle object @var{h} is of type @var{type}, return @var{h}.
-##
-## If @code{"toplevel"} is given as a 3rd argument, return the highest
-## parent in the object hierarchy that matches the condition, instead
-## of the first (nearest) one.
-## @seealso{get, set}
-## @end deftypefn
-
-function p = ancestor (h, type, toplevel)
-
-  if (nargin == 2 || nargin == 3)
-    p = cell (numel (h), 1);
-    if (ischar (type))
-      type = { type };
-    endif
-    if (iscellstr (type))
-      look_first = true;
-      if (nargin == 3)
-        if (ischar (toplevel) && strcmpi (toplevel, "toplevel"))
-          look_first = false;
-        else
-          error ("ancestor: third argument must be \"toplevel\"");
-        endif
-      endif
-      h = num2cell (h);
-      for nh = 1:numel (h)
-        while (true)
-          if (isempty (h{nh}) || ! ishandle (h{nh}))
-            break;
-          endif
-          if (any (strcmpi (get (h{nh}, "type"), type)))
-            p{nh} = h{nh};
-            if (look_first)
-              break;
-            endif
-          endif
-          h{nh} = get (h{nh}, "Parent");
-        endwhile
-      endfor
-      if (nh == 1)
-        p = p{1};
-      endif
-    else
-      error ("ancestor: second argument must be a string or cell array of strings");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (ancestor (l, "axes"), gca);
-%!   assert (ancestor (l, "figure"), hf);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/__clabel__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,129 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __clabel__ (@var{c}, @var{v}, @var{hparent}, @var{label_spacing}, @var{z}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+function h = __clabel__ (c, v, hparent, label_spacing, z, varargin)
+
+  hax = ancestor (hparent, "axes");
+  units = get (hax, "units");
+  set (hax, "units", "points");
+  axpos = get (hax, "position");
+  set (hax, "units", units);
+  lims = axis ();
+  xspacing = axpos(3) / (lims(2) - lims (1));
+  yspacing = axpos(4) / (lims(4) - lims (3));
+
+  if (isscalar (hparent) && ishandle (hparent)
+      && strcmp (get (hparent, "type"), "hggroup"))
+    x = get (hparent, "xdata");
+    xmin = min (x(:));
+    xmax = max (x(:));
+    y = get (hparent, "ydata");
+    ymin = min (y(:));
+    ymax = max (y(:));
+  else
+    xmin = xmax = ymin = ymax = NaN;
+    i = 1;
+    while (i < length (c))
+      clen = c(2,i);
+      data = c(:, i+(1:clen));
+
+      xmin = min ([xmin, data(1,:)]);
+      xmax = max ([xmax, data(1,:)]);
+      ymin = min ([ymin, data(2,:)]);
+      ymax = max ([ymax, data(2,:)]);
+
+      i += clen+1;
+    endwhile
+  endif
+
+  ## Decode contourc output format and place labels.
+  h = [];
+  i = 1;
+  while (i < length (c))
+    clev = c(1,i);
+    clen = c(2,i);
+
+    if (! isempty (v) && ! any (v == clev))
+      i += clen+1;
+      continue;
+    endif
+
+    p = bsxfun (@times, c(:, i+(1:clen)), [xspacing; yspacing]);
+    d = sqrt (sumsq (diff (p, 1, 2)));
+    cumd = cumsum (d);
+    td = cumd(end);
+    ntag = ceil (td / label_spacing);
+
+    if (all (c(:,i+1) == c(:,i+clen)))
+      ## Closed contour
+      ## FIXME: This spreads the tags uniformly around the contour which
+      ## looks nice, but it does not respect the label_spacing attribute.
+      ## Should we follow user input, which can result in two labels being
+      ## quite close to each other?
+      spacing = td / ntag;
+      pos = spacing/2 + spacing*[0:ntag-1];
+    else
+      ## Open contour
+      pos = zeros (1, ntag);
+      pos(1) = (td - label_spacing*(ntag - 1)) / 2;
+      pos(2:ntag) = pos(1) + label_spacing*[1:ntag-1];
+    endif
+
+    tlabel = sprintf ("%.5g", clev);
+
+    for tagpos = pos
+
+      j = find (cumd > tagpos, 1);
+      if (isempty (j))
+        j = clen;
+      endif
+      tpos = sum (c(:,i+j-1:i+j), 2) / 2;
+
+      if (   tpos(1) != xmin && tpos(1) != xmax
+          && tpos(2) != ymin && tpos(2) != ymax)
+        trot = 180 / pi * atan2 (diff (c(2,i+j-1:i+j)),
+                                 diff (c(1,i+j-1:i+j)));
+        if (abs (trot) > 90)
+          trot += 180;
+        endif
+        if (ischar (z))
+          ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        elseif (! isempty (z))
+          ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        else
+          ht = text (tpos(1), tpos(2), tlabel, "rotation", trot,
+                     "horizontalalignment", "center", "userdata", clev,
+                     "parent", hparent, varargin{:});
+        endif
+        h = [h; ht];
+      endif
+    endfor
+    i += clen+1;
+  endwhile
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/__getlegenddata__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,61 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
+## Undocumented internal function.
+## @end deftypefn
+
+function [hplots, text_strings] = __getlegenddata__ (hlegend)
+
+  hplots = [];
+  text_strings = {};
+  ca = getfield (get (hlegend, "userdata"), "handle");
+  if (numel (ca) == 1)
+    kids = get (ca, "children");
+  else
+    kids = [get(kids, "children"){:}];
+  endif
+
+  for i = numel (kids):-1:1
+    typ = get (kids(i), "type");
+    if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
+      if (strcmp (typ, "hggroup"))
+        hgkids = get (kids(i), "children");
+        for j = 1 : length (hgkids)
+          try
+            dname = get (hgkids(j), "DisplayName");
+            if (! isempty (dname))
+              hplots(end+1) = hgkids(j);
+              text_strings(end+1) = dname;
+              break;  # break from j-loop over hgkids
+            endif
+          end_try_catch
+        endfor
+      else
+        dname = get (kids(i), "DisplayName");
+        if (! isempty (dname))
+          hplots(end+1) = kids(i);
+          text_strings(end+1) = dname;
+        endif
+      endif
+    endif
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/axis.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,627 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} axis ()
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi])
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi])
+## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi @var{z}_lo @var{z}_hi])
+## @deftypefnx {Function File} {} axis (@var{option})
+## @deftypefnx {Function File} {} axis (@dots{}, @var{option})
+## @deftypefnx {Function File} {} axis (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{limits} =} axis ()
+## Set axis limits and appearance.
+##
+## The argument @var{limits} should be a 2-, 4-, or 6-element vector.  The
+## first and second elements specify the lower and upper limits for the
+## x-axis.  The third and fourth specify the limits for the y-axis, and the
+## fifth and sixth specify the limits for the z-axis.
+##
+## Without any arguments, @code{axis} turns autoscaling on.
+##
+## With one output argument, @code{@var{limits} = axis} returns the current
+## axis limits.
+##
+## The vector argument specifying limits is optional, and additional
+## string arguments may be used to specify various axis properties.  For
+## example,
+##
+## @example
+## axis ([1, 2, 3, 4], "square");
+## @end example
+##
+## @noindent
+## forces a square aspect ratio, and
+##
+## @example
+## axis ("tic", "labely");
+## @end example
+##
+## @noindent
+## turns tic marks on for all axes and tic mark labels on for the y-axis
+## only.
+##
+## @noindent
+## The following options control the aspect ratio of the axes.
+##
+## @table @asis
+## @item @qcode{"square"}
+## Force a square aspect ratio.
+##
+## @item @qcode{"equal"}
+## Force x distance to equal y-distance.
+##
+## @item @qcode{"normal"}
+## Restore default aspect ratio.
+## @end table
+##
+## @noindent
+## The following options control the way axis limits are interpreted.
+##
+## @table @asis
+## @item @qcode{"auto"}
+## Set the specified axes to have nice limits around the data
+## or all if no axes are specified.
+##
+## @item @qcode{"manual"}
+## Fix the current axes limits.
+##
+## @item @qcode{"tight"}
+## Fix axes to the limits of the data.
+##
+## @item @qcode{"image"}
+## Equivalent to @qcode{"tight"} and @qcode{"equal"}.
+## @end table
+##
+## @noindent
+## The following options affect the appearance of tic marks.
+##
+## @table @asis
+## @item @qcode{"on"}
+## Turn tic marks and labels on for all axes.
+##
+## @item @qcode{"off"}
+## Turn tic marks off for all axes.
+##
+## @item @qcode{"tic[xyz]"}
+## Turn tic marks on for all axes, or turn them on for the
+## specified axes and off for the remainder.
+##
+## @item @qcode{"label[xyz]"}
+## Turn tic labels on for all axes, or turn them on for the
+## specified axes and off for the remainder.
+##
+## @item @qcode{"nolabel"}
+## Turn tic labels off for all axes.
+## @end table
+##
+## Note, if there are no tic marks for an axis, there can be no labels.
+##
+## @noindent
+## The following options affect the direction of increasing values on the axes.
+##
+## @table @asis
+## @item @qcode{"ij"}
+## Reverse y-axis, so lower values are nearer the top.
+##
+## @item @qcode{"xy"}
+## Restore y-axis, so higher values are nearer the top.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axes rather than the current axes returned by @code{gca}.
+##
+## @seealso{xlim, ylim, zlim, daspect, pbaspect, box, grid}
+## @end deftypefn
+
+## Author: jwe
+
+function limits = axis (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    if (nargin == 0)
+      limits = __axis__ (hax, varargin{:});
+    else
+      __axis__ (hax, varargin{:});
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function limits = __axis__ (ca, ax, varargin)
+
+  if (nargin == 1)
+    if (nargout == 0)
+      set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
+    else
+      xlim = get (ca, "xlim");
+      ylim = get (ca, "ylim");
+      view = get (ca, "view");
+      if (view(2) == 90)
+        limits = [xlim, ylim];
+      else
+        zlim = get (ca, "zlim");
+        limits = [xlim, ylim, zlim];
+      endif
+    endif
+
+  elseif (ischar (ax))
+    len = length (ax);
+
+    ## 'matrix mode' to reverse the y-axis
+    if (strcmpi (ax, "ij"))
+      set (ca, "ydir", "reverse");
+    elseif (strcmpi (ax, "xy"))
+      set (ca, "ydir", "normal");
+
+      ## aspect ratio
+    elseif (strcmpi (ax, "image"))
+      __axis__ (ca, "equal");
+      __do_tight_option__ (ca);
+    elseif (strcmpi (ax, "square"))
+      set (ca, "plotboxaspectratio", [1, 1, 1]);
+    elseif (strcmp (ax, "equal"))
+      if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot"))
+        ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
+        set (ca, "activepositionproperty", "position");
+        ## The following line is a trick used to trigger the recalculation of
+        ## aspect related magnitudes even if the aspect ratio is the same
+        ## (useful with the x11 gnuplot terminal after a window resize)
+        set (ca, "dataaspectratiomode", "auto");
+      endif
+      set (ca, "dataaspectratio", [1, 1, 1]);
+    elseif (strcmpi (ax, "normal"))
+      set (ca, "plotboxaspectratio", [1, 1, 1]);
+      set (ca, "plotboxaspectratiomode", "auto");
+
+      ## axis limits
+    elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
+      if (len > 4)
+        if (any (ax == "x"))
+          set (ca, "xlimmode", "auto");
+        endif
+        if (any (ax == "y"))
+          set (ca, "ylimmode", "auto");
+        endif
+        if (any (ax == "z"))
+          set (ca, "zlimmode", "auto");
+        endif
+      else
+        set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
+      endif
+    elseif (strcmpi (ax, "manual"))
+      ## fixes the axis limits, like axis(axis) should;
+      set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
+    elseif (strcmpi (ax, "tight"))
+      ## sets the axis limits to the min and max of all data.
+      __do_tight_option__ (ca);
+      ## tic marks
+    elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
+      set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
+      if (strcmpi (ax, "on"))
+        set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
+           "zticklabelmode", "auto");
+      endif
+      set (ca, "visible", "on");
+    elseif (strcmpi (ax, "off"))
+      set (ca, "xtick", [], "ytick", [], "ztick", []);
+      set (ca, "visible", "off");
+    elseif (len > 3 && strcmpi (ax(1:3), "tic"))
+      if (any (ax == "x"))
+        set (ca, "xtickmode", "auto");
+      else
+        set (ca, "xtick", []);
+      endif
+      if (any (ax == "y"))
+        set (ca, "ytickmode", "auto");
+      else
+        set (ca, "ytick", []);
+      endif
+      if (any (ax == "z"))
+        set (ca, "ztickmode", "auto");
+      else
+        set (ca, "ztick", []);
+      endif
+    elseif (strcmpi (ax, "label"))
+      set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
+           "zticklabelmode", "auto");
+    elseif (strcmpi (ax, "nolabel"))
+      set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
+    elseif (len > 5 && strcmpi (ax(1:5), "label"))
+      if (any (ax == "x"))
+        set (ca, "xticklabelmode", "auto");
+      else
+        set (ca, "xticklabel", "");
+      endif
+      if (any (ax == "y"))
+        set (ca, "yticklabelmode", "auto");
+      else
+        set (ca, "yticklabel", "");
+      endif
+      if (any (ax == "z"))
+        set (ca, "zticklabelmode", "auto");
+      else
+        set (ca, "zticklabel", "");
+      endif
+
+    else
+      warning ("unknown axis option '%s'", ax);
+    endif
+
+  elseif (isvector (ax))
+
+    len = length (ax);
+
+    if (len != 2 && len != 4 && len != 6)
+      error ("axis: expecting vector with 2, 4, or 6 elements");
+    endif
+
+    for i = 1:2:len
+      if (ax(i) >= ax(i+1))
+        error ("axis: limits(%d) must be less than limits(%d)", i, i+1);
+      endif
+    endfor
+
+    if (len > 1)
+      set (ca, "xlim", [ax(1), ax(2)]);
+    endif
+
+    if (len > 3)
+      set (ca, "ylim", [ax(3), ax(4)]);
+    endif
+
+    if (len > 5)
+      set (ca, "zlim", [ax(5), ax(6)]);
+    endif
+
+  else
+    error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
+  endif
+
+  if (! isempty (varargin))
+    __axis__ (ca, varargin{:});
+  endif
+
+endfunction
+
+function lims = __get_tight_lims__ (ca, ax)
+
+  ## Get the limits for axis ("tight").
+  ## AX should be one of "x", "y", or "z".
+  kids = findobj (ca, "-property", strcat (ax, "data"));
+  ## The data properties for hggroups mirror their children.
+  ## Exclude the redundant hgroup values.
+  hg_kids = findobj (kids, "type", "hggroup");
+  kids = setdiff (kids, hg_kids);
+  if (isempty (kids))
+    ## Return the current limits.
+    lims = get (ca, strcat (ax, "lim"));
+  else
+    data = get (kids, strcat (ax, "data"));
+    scale = get (ca, strcat (ax, "scale"));
+    if (! iscell (data))
+      data = {data};
+    endif
+    if (strcmp (scale, "log"))
+      tmp = data;
+      data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false);
+      n = cellfun ("isempty", data);
+      data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false);
+    endif
+    data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false);
+    data = data(! cellfun ("isempty", data));
+    if (! isempty (data))
+      ## Change data from cell array of various sizes to a single column vector
+      data = cat (1, cellindexmat (data, ":"){:});
+      lims = [min(data), max(data)];
+    else
+      lims = [0, 1];
+    endif
+  endif
+
+endfunction
+
+function __do_tight_option__ (ca)
+
+  xlim = __get_tight_lims__ (ca, "x");
+  if (all (xlim == 0))
+    xlim = eps () * [-1 1];
+  elseif (diff (xlim == 0))
+    xlim = xlim .* (1 + eps () * [-1, 1]);
+  endif
+  ylim = __get_tight_lims__ (ca, "y");
+  if (all (ylim == 0))
+    ylim = eps () * [-1 1];
+  elseif (diff (ylim == 0))
+    ylim = ylim .* (1 + eps () * [-1, 1]);
+  endif
+  set (ca, "xlim", xlim, "ylim", ylim)
+  nd = __calc_dimensions__ (ca);
+  is3dview = (get (ca, "view")(2) != 90);
+  if (nd > 2 && is3dview)
+    zlim = __get_tight_lims__ (ca, "z");
+    if (all (zlim == 0))
+      zlim = eps () * [-1 1];
+    elseif (diff (zlim == 0))
+      zlim = zlim .* (1 + eps () * [-1, 1]);
+    endif
+    set (ca, "zlim", zlim);
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (221);
+%!  plot (t, x);
+%!  title ('normal plot');
+%!
+%! subplot (222);
+%!  plot (t, x);
+%!  title ('square plot');
+%!  axis ('square');
+%!
+%! subplot (223);
+%!  plot (t, x);
+%!  title ('equal plot');
+%!  axis ('equal');
+%!
+%! subplot (224);
+%!  plot (t, x);
+%!  title ('normal plot again');
+%!  axis ('normal');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (121);
+%!  plot (t, x);
+%!  title ('ij plot');
+%!  axis ('ij');
+%!
+%! subplot (122);
+%!  plot (t, x);
+%!  title ('xy plot');
+%!  axis ('xy');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (331);
+%!  plot (t, x);
+%!  title ('x tics and labels');
+%!  axis ('ticx');
+%!
+%! subplot (332);
+%!  plot (t, x);
+%!  title ('y tics and labels');
+%!  axis ('ticy');
+%!
+%! subplot (333);
+%!  plot (t, x);
+%!  title ('axis off');
+%!  axis ('off');
+%!
+%! subplot (334);
+%!  plot (t, x);
+%!  title ('x and y tics, x labels');
+%!  axis ('labelx','tic');
+%!
+%! subplot (335);
+%!  plot (t, x);
+%!  title ('x and y tics, y labels');
+%!  axis ('labely','tic');
+%!
+%! subplot (336);
+%!  plot (t, x);
+%!  title ('all tics but no labels');
+%!  axis ('nolabel','tic');
+%!
+%! subplot (337);
+%!  plot (t, x);
+%!  title ('x tics, no labels');
+%!  axis ('nolabel','ticx');
+%!
+%! subplot (338);
+%!  plot (t, x);
+%!  title ('y tics, no labels');
+%!  axis ('nolabel','ticy');
+%!
+%! subplot (339);
+%!  plot (t, x);
+%!  title ('all tics and labels');
+%!  axis ('on');
+
+%!demo
+%! clf;
+%! t = 0:0.01:2*pi;
+%! x = sin (t);
+%!
+%! subplot (321);
+%!  plot (t, x);
+%!  title ('axes at [0 3 0 1]');
+%!  axis ([0,3,0,1]);
+%!
+%! subplot (322);
+%!  plot (t, x);
+%!  title ('auto');
+%!  axis ('auto');
+%!
+%! subplot (323);
+%!  plot (t, x, ';sine [0:2pi];'); hold on;
+%!  plot (-3:3,-3:3, ';line (-3,-3)->(3,3);'); hold off;
+%!  title ('manual');
+%!  axis ('manual');
+%!
+%! subplot (324);
+%!  plot (t, x, ';sine [0:2pi];');
+%!  title ('axes at [0 3 0 1], then autox');
+%!  axis ([0,3,0,1]);
+%!  axis ('autox');
+%!
+%! subplot (325);
+%!  plot (t, x, ';sine [0:2pi];');
+%!  title ('axes at [3 6 0 1], then autoy');
+%!  axis ([3,6,0,1]);
+%!  axis ('autoy');
+%!
+%! subplot (326);
+%!  plot (t, sin(t), t, -2*sin(t/2));
+%!  axis ('tight');
+%!  title ('tight');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin(x));
+%! axis image;
+%! title ({'image', 'equivalent to "tight" & "equal"'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x,y,z] = peaks (50);
+%! x1 = max (x(:));
+%! pcolor (x-x1, y-x1/2, z);
+%! hold on;
+%! [x,y,z] = sombrero ();
+%! s = x1 / max (x(:));
+%! pcolor (s*x+x1, s*y+x1/2, 5*z);
+%! axis tight;
+
+%!demo
+%! clf;
+%! x = -10:10;
+%! plot (x,x, x,-x);
+%! set (gca, 'yscale', 'log');
+%! legend ({'x >= 1', 'x <= 1'}, 'location', 'north');
+%! title ('ylim = [1, 10]');
+
+%!demo
+%! clf;
+%! loglog (1:20, '-s');
+%! axis tight;
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = zero'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'left');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = left'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! title ('no plot box');
+%! set (gca, 'xaxislocation', 'zero');
+%! set (gca, 'yaxislocation', 'right');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = zero, yaxislocation = right'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'bottom');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = bottom, yaxislocation = zero'});
+
+%!demo
+%! clf;
+%! x = -10:0.1:10;
+%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
+%! plot (x, y);
+%! set (gca, 'xaxislocation', 'top');
+%! set (gca, 'yaxislocation', 'zero');
+%! box off;
+%! title ({'no plot box', 'xaxislocation = top, yaxislocation = zero'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (11:20, [21:24, NaN, -Inf, 27:30]);
+%!   hold all;
+%!   plot (11:20, 25.5 + rand (10));
+%!   axis tight;
+%!   assert (axis (), [11 20 21 30]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   loglog (a, -a);
+%!   axis tight;
+%!   assert (axis (), [1e-5, 10, -10, -1e-5]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## Test 'axis tight' with differently oriented, differently numbered data vecs
+## Bug #40036.
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   Z = peaks (linspace (-3, 3, 49), linspace (-2, 2, 29));
+%!   surf (Z);
+%!   axis tight;
+%!   assert (axis (), [1 49 1 29 min(Z(:)) max(Z(:))]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/box.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,71 @@
+## Copyright (C) 2006-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} box on
+## @deftypefnx {Command} {} box off
+## @deftypefnx {Command} {} box
+## @deftypefnx {Function File} {} box (@var{hax}, @dots{})
+## Control display of the axis border.
+##
+## The argument may be either @qcode{"on"} or @qcode{"off"}.  If it is
+## omitted, the current box state is toggled.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{axis, grid}
+## @end deftypefn
+
+## Author: jwe
+
+function box (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (nargs == 0)
+    box_state = get (hax, "box");
+    if (strcmp (box_state, "on"))
+      box_state = "off";
+    else
+      box_state = "on";
+    endif
+  elseif (nargs == 1)
+    state = varargin{1};
+    if (ischar (state))
+      if (strcmpi (state, "off"))
+        box_state = "off";
+      elseif (strcmpi (state, "on"))
+        box_state = "on";
+      else
+        error ('box: argument must be "on" or "off"');
+      endif
+    else
+      error ('box: argument must be "on" or "off"');
+    endif
+  else
+    print_usage ();
+  endif
+
+  set (hax, "box", box_state);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/caxis.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,97 @@
+## Copyright (C)  2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} caxis ([cmin cmax])
+## @deftypefnx {Function File} {} caxis ("auto")
+## @deftypefnx {Function File} {} caxis ("manual")
+## @deftypefnx {Function File} {} caxis (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{limits} =} caxis ()
+## Query or set color axis limits for plots.
+##
+## The limits argument should be a 2-element vector specifying the
+## lower and upper limits to assign to the first and last value in the
+## colormap.  Data values outside this range are clamped to the first and last
+## colormap entries.
+##
+## If the @qcode{"auto"} option is given then automatic colormap limits are
+## applied.  The automatic algorithm sets @var{cmin} to the minimum data value
+## and @var{cmax} to the maximum data value.  If @qcode{"manual"} is specified
+## then the @qcode{"climmode"} property is set to @qcode{"manual"} and the
+## numeric values in the @qcode{"clim"} property are used for limits.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## Called without arguments the current color axis limits are returned.
+## @seealso{colormap}
+## @end deftypefn
+
+function limits = caxis (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    if (nargin == 0)
+      limits = __caxis__ (hax);
+    else
+      __caxis__ (hax, varargin{:});
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function limits = __caxis__ (ca, ax, varargin)
+
+  if (nargin == 1)
+    limits = get (ca, "clim");
+  elseif (ischar (ax))
+    if (strcmpi (ax, "auto"))
+      set (ca, "climmode", "auto");
+    elseif (strcmpi (ax, "manual"))
+      set (ca, "climmode", "manual");
+    endif
+  elseif (isvector (ax))
+    len = length (ax);
+    if (len != 2)
+      error ("caxis: expecting vector with 2 elements");
+    endif
+
+    set (ca, "clim", [ax(1), ax(2)]);
+  else
+    error ("caxis: expecting no args, a string, or a 2 element vector");
+  endif
+
+  ## FIXME: Why should it be possible to call __caxis__ recursively?
+  if (nargin > 2)
+    __caxis__ (ca, varargin{:})';
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/clabel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,153 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} clabel (@var{c}, @var{h})
+## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, @var{v})
+## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, "manual")
+## @deftypefnx {Function File} {} clabel (@var{c})
+## @deftypefnx {Function File} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} clabel (@dots{})
+## Add labels to the contours of a contour plot.
+##
+## The contour levels are specified by the contour matrix @var{c} which is
+## returned by @code{contour}, @code{contourc}, @code{contourf}, and
+## @code{contour3}.  Contour labels are rotated to match the local line 
+## orientation and centered on the line.  The position of labels along the
+## contour line is chosen randomly.
+##
+## If the argument @var{h} is a handle to a contour group object, then label
+## this plot rather than the one in the current axes returned by @code{gca}.
+##
+## By default, all contours are labeled.  However, the contours to label can be
+## specified by the vector @var{v}.  If the @qcode{"manual"} argument is
+## given then the contours to label can be selected with the mouse.
+##
+## Additional property/value pairs that are valid properties of text objects
+## can be given and are passed to the underlying text objects.  Moreover,
+## the contour group property @qcode{"LabelSpacing"} is available which
+## determines the spacing between labels on a contour to be specified.  The
+## default is 144 points, or 2 inches.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the text objects representing each label.
+## The @qcode{"userdata"} property of the text objects contains the numerical
+## value of the contour label.
+##
+## An example of the use of @code{clabel} is
+##
+## @example
+## @group
+## [c, h] = contour (peaks (), -4 : 6);
+## clabel (c, h, -4:2:6, "fontsize", 12);
+## @end group
+## @end example
+##
+## @seealso{contour, contourf, contour3, meshc, surfc, text}
+## @end deftypefn
+
+function h = clabel (c, varargin)
+
+  have_hg = false;
+  have_labelspacing = false;
+  label_spacing = 144;  # 2 inches in points
+
+  if (nargin < 1)
+    print_usage ();
+  elseif (nargin == 1)
+    hparent = gca ();
+  else
+    arg = varargin{1};
+    if (isscalar (arg) && ishandle (arg)
+        && strcmp (get (arg, "type"), "hggroup"))
+      try
+        get (arg, "contourmatrix");
+      catch
+        error ("clabel: H must be a handle to a contour group");
+      end_try_catch
+      have_hg = true;
+      hg = arg;
+      varargin(1) = [];
+    else
+      hparent = gca ();
+    endif
+  endif
+
+  if (length (varargin) > 0 && isnumeric (varargin{1}))
+    v = varargin{1}(:);
+    varargin(1) = [];
+  else
+    v = [];
+  endif
+
+  idx = strcmpi (varargin(1:2:end), "manual");
+  if (any (idx))
+    error ('clabel: "manual" contour mode is not supported');
+  endif
+
+  idx = find (strcmpi (varargin(1:2:end), "labelspacing"), 1);
+  if (! isempty (idx))
+    have_labelspacing = true;
+    label_spacing = varargin{2*idx};
+    varargin(2*idx+(-1:0)) = [];
+  endif    
+
+  if (have_hg)
+    if (! isempty (v))
+      if (have_labelspacing)
+        set (hg, "textlistmode", "manual", "textlist", v,
+                 "labelspacing", label_spacing, "showtext", "on");
+      else
+        set (hg, "textlistmode", "manual", "textlist", v, "showtext", "on");
+      endif
+    else
+      if (have_labelspacing)
+        set (hg, "showtext", "on", "labelspacing", label_spacing);
+      else
+        set (hg, "showtext", "on");
+      endif
+    endif
+    htmp = findobj (hg, "type", "text");
+    if (! isempty (varargin))
+      set (htmp, varargin{:});
+    endif
+  else
+    htmp =  __clabel__ (c, v, hparent, label_spacing, [], varargin{:});
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [c, h] = contour (peaks (), -4:6);
+%! clabel (c, h, -4:2:6, 'fontsize', 12);
+%! title ('clabel() labeling every other contour');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [c, h] = contourf (peaks (), -7:6);
+%! clabel (c, h, -6:2:6, 'fontsize', 12);
+%! title ('clabel() labeling every other contour');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/daspect.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,143 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{data_aspect_ratio} =} daspect ()
+## @deftypefnx {Function File} {} daspect (@var{data_aspect_ratio})
+## @deftypefnx {Function File} {} daspect (@var{mode})
+## @deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
+## @deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
+## Query or set the data aspect ratio of the current axes.
+##
+## The aspect ratio is a normalized 3-element vector representing the span of
+## the x, y, and z-axis limits.
+## 
+## @code{(daspect (@var{mode}))}
+##
+## Set the data aspect ratio mode of the current axes.  @var{mode} is
+## either @qcode{"auto"} or @qcode{"manual"}.
+## 
+## @code{daspect (@qcode{"mode"})}
+##
+## Return the data aspect ratio mode of the current axes.
+## 
+## @code{daspect (@var{hax}, @dots{})}
+##
+## Operate on the axes in handle @var{hax} instead of the current axes.
+## 
+## @seealso{axis, pbaspect, xlim, ylim, zlim}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-01-26
+
+function daratio = daspect (varargin)
+
+  ## Grab axes handle if present
+  if (nargin > 0)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      varargin = varargin(2:end);
+    else
+      hax = gca ();
+    endif
+  else
+    hax = gca ();
+  endif
+
+  nargin = numel (varargin);
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    daratio = get (hax, "dataaspectratio");
+  else
+    arg = varargin{1};
+    if (isreal (arg))
+      if (numel (arg) == 2)
+        set (hax, "dataaspectratio", [arg, 1]);
+      elseif (numel (arg) == 3)
+        set (hax, "dataaspectratio", arg);
+      else
+        error ("daspect: DATA_ASPECT_RATIO must be a 2 or 3 element vector");
+      endif
+    elseif (ischar (arg))
+      arg = tolower (arg);
+      switch (arg)
+        case "auto"
+          set (hax, "dataaspectratiomode", "auto");
+        case "manual"
+          set (hax, "dataaspectratiomode", "manual");
+        case "mode"
+          daratio = get (hax, "dataaspectratiomode");
+        otherwise
+          error ("daspect: Invalid mode <%s>", arg);
+      endswitch
+    else
+      print_usage ();
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! axis square;
+%! daspect ([1 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos (x), x,sin (x));
+%! axis ([0 4 -1 1]);
+%! daspect ([2 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -1, 1]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! daspect ([1 2 1]);
+%! pbaspect ([2 1 1]);
+%! title ('2x1 plot box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x, sin(x));
+%! axis square;
+%! set (gca, 'activepositionproperty', 'position');
+%! daspect ([1 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -2, 2]');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! axis ([0 4 -1 1]);
+%! set (gca, 'activepositionproperty', 'position');
+%! daspect ([2 1 1]);
+%! title ('square plot-box with axis limits [0, 4, -1, 1]');
+
+## FIXME: need some input validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/diffuse.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,59 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv})
+## Calculate diffuse reflection strength of a surface defined by the normal
+## vector elements @var{sx}, @var{sy}, @var{sz}.
+##
+## The light source location vector @var{lv} can be given as 2-element vector
+## [azimuth, elevation] in degrees or as 3-element vector [lx, ly, lz].
+## @seealso{specular, surfl}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = diffuse (sx, sy, sz, lv)
+
+  if (nargin != 4)
+    print_usage ();
+  endif
+
+  ## check for normal vector
+  if (!size_equal (sx, sy, sz))
+    error ("diffuse: SX, SY, and SZ must have same size");
+  endif
+
+  ## check for light vector (lv) argument
+  if (length (lv) < 2 || length (lv) > 3)
+    error ("diffuse: light vector LV must be a 2- or 3-element vector");
+  elseif (length (lv) == 2)
+    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
+  endif
+
+  ## Normalize view and light vector.
+  if (sum (abs (lv)) > 0)
+    lv  /= norm (lv);
+  endif
+
+  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
+  retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
+  retval(retval < 0) = 0;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/grid.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,142 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} grid
+## @deftypefnx {Command} {} grid on
+## @deftypefnx {Command} {} grid off
+## @deftypefnx {Command} {} grid minor
+## @deftypefnx {Command} {} grid minor on
+## @deftypefnx {Command} {} grid minor off
+## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
+## Control the display of plot grid lines.
+##
+## The function state input may be either @qcode{"on"} or @qcode{"off"}.
+## If it is omitted, the current grid state is toggled.
+##
+## When the first argument is @qcode{"minor"} all subsequent commands
+## modify the minor grid rather than the major grid.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## To control the grid lines for an individual axis use the @code{set}
+## function.  For example:
+##
+## @example
+## set (gca, "ygrid", "on");
+## @end example
+## @seealso{axis, box}
+## @end deftypefn
+
+## Author: jwe
+
+function grid (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (nargs > 2)
+    print_usage ();
+  endif
+
+  grid_on = (   strcmp (get (hax, "xgrid"), "on")
+             && strcmp (get (hax, "ygrid"), "on")
+             && strcmp (get (hax, "zgrid"), "on"));
+
+  minor_on = (   strcmp (get (hax, "xminorgrid"), "on")
+              && strcmp (get (hax, "yminorgrid"), "on")
+              && strcmp (get (hax, "zminorgrid"), "on"));
+
+  minor_auto = true;
+  if (nargs == 0)
+    grid_on = ! grid_on;
+  else
+    arg1 = varargin{1};
+    if (! ischar (arg1))
+      error ("grid: argument 1 must be an axis handle or a string");
+    endif
+    if (strcmpi (arg1, "off"))
+      grid_on = false;
+    elseif (strcmpi (arg1, "on"))
+      grid_on = true;
+    elseif (strcmpi (arg1, "minor"))
+      minor_auto = false;
+      if (nargs == 2)
+        arg2 = varargin{2};
+        if (strcmpi (arg2, "on"))
+          minor_on = true;
+          grid_on = true;
+        elseif (strcmpi (arg2, "off"))
+          minor_on = false;
+        else
+          print_usage ();
+        endif
+      else
+        minor_on = ! minor_on;
+        if (minor_on)
+          grid_on = true;
+        endif
+      endif
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (grid_on)
+    set (hax, "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    if (minor_on)
+      set (hax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on");
+    elseif (minor_auto)
+      xmg = ifelse (strcmp (get (hax, "xscale"), "log"), "on", "off");
+      ymg = ifelse (strcmp (get (hax, "yscale"), "log"), "on", "off");
+      zmg = ifelse (strcmp (get (hax, "zscale"), "log"), "on", "off");
+      set (hax, "xminorgrid", xmg, "yminorgrid", ymg, "zminorgrid", zmg);
+    else
+      set (hax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
+    endif
+  else
+    set (hax, "xgrid", "off", "ygrid", "off", "zgrid", "off",
+              "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! subplot (2,2,1);
+%!  plot (1:100);
+%!  grid off;
+%!  title ('no grid');
+%! subplot (2,2,2);
+%!  plot (1:100);
+%!  grid on;
+%!  title ('grid on');
+%! subplot (2,2,3);
+%!  plot (1:100);
+%!  grid minor;
+%!  title ('grid minor');
+%! subplot (2,2,4);
+%!  semilogy (1:100);
+%!  grid minor;
+%!  title ('grid minor');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/gtext.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,72 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} gtext (@var{s})
+## @deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@})
+## @deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@})
+## @deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} gtext (@dots{})
+## Place text on the current figure using the mouse.
+##
+## The text is defined by the string @var{s}.  If @var{s} is a cell string
+## organized as a row vector then each string of the cell array is written to a
+## separate line.  If @var{s} is organized as a column vector then one string
+## element of the cell array is placed for every mouse click.
+##
+## Optional property/value pairs are passed directly to the underlying text
+## objects.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## text object(s).
+## @seealso{ginput, text}
+## @end deftypefn
+
+function h = gtext (s, varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  if (! (ischar (s) || iscellstr (s)))
+    error ("gtext: S must be a string or cell array of strings");
+  endif
+
+  htmp = -1;
+  if (! isempty (s))
+    if (ischar (s) || isrow (s))
+      [x, y] = ginput (1);
+      htmp = text (x, y, s, varargin{:});
+    else
+      for i = 1:numel (s)
+        [x, y] = ginput (1);
+        htmp = text (x, y, s{i}, varargin{:});
+      endfor
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+## Remove from test statistics.  No real tests possible.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/hidden.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,87 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} hidden
+## @deftypefnx {Command} {} hidden "on"
+## @deftypefnx {Command} {} hidden "off"
+## @deftypefnx {Function File} {@var{mode} =} hidden (@dots{})
+## Control mesh hidden line removal.
+##
+## When called with no argument the hidden line removal state is toggled.
+## When called with one of the modes @qcode{"on"} or @qcode{"off"} the state
+## is set accordingly.
+##
+## The optional output argument @var{mode} is the current state.
+##
+## Hidden Line Removal determines what graphic objects behind a mesh plot
+## are visible.  The default is for the mesh to be opaque and lines behind
+## the mesh are not visible.  If hidden line removal is turned off then
+## objects behind the mesh can be seen through the faces (openings) of the
+## mesh, although the mesh grid lines are still opaque.
+##
+## @seealso{mesh, meshc, meshz, ezmesh, ezmeshc, trimesh, waterfall}
+## @end deftypefn
+
+function state = hidden (mode = "toggle")
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 1)
+    if (! ischar (mode))
+      error ("hidden: expecting MODE to be a string");
+    elseif (! any (strcmpi (mode, {"on", "off"})))
+      error ('hidden: MODE must be "on" or "off"');
+    endif
+  endif
+
+  for h = (get (gca (), "children")).';
+    htype = get (h, "type");
+    htag = get (h, "tag");
+    if (strcmp (htype, "surface") || strcmp (htag, "trimesh"))
+      fc = get (h, "facecolor");
+      if ((! ischar (fc) && is_white (fc))
+          || (ischar (fc) && strcmp (fc, "none")))
+        switch (mode)
+          case "on"
+            set (h, "facecolor", "w");
+          case "off"
+            set (h, "facecolor", "none");
+          case "toggle"
+            if (ischar (fc))
+              set (h, "facecolor", "w");
+              mode = "on";
+            else
+              set (h, "facecolor", "none");
+              mode = "off";
+            endif
+        endswitch
+      endif
+    endif
+  endfor
+
+  if (nargout > 0)
+    state = mode;
+  endif
+
+endfunction
+
+function retval = is_white (color)
+  retval = all (color == 1);
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/legend.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,1595 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} legend (@var{str1}, @var{str2}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{matstr})
+## @deftypefnx {Function File} {} legend (@var{cellstr})
+## @deftypefnx {Function File} {} legend (@dots{}, "location", @var{pos})
+## @deftypefnx {Function File} {} legend (@dots{}, "orientation", @var{orient})
+## @deftypefnx {Function File} {} legend (@var{hax}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{hobjs}, @dots{})
+## @deftypefnx {Function File} {} legend (@var{hax}, @var{hobjs}, @dots{})
+## @deftypefnx {Function File} {} legend ("@var{option}")
+## @deftypefnx {Function File} {[@var{hleg}, @var{hleg_obj}, @var{hplot}, @var{labels}] =} legend (@dots{})
+##
+## Display a legend for the current axes using the specified strings as labels.
+##
+## Legend entries may be specified as individual character string arguments,
+## a character array, or a cell array of character strings.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.  If the handles,
+## @var{hobjs}, are not specified then the legend's strings will be associated
+## with the axes' descendants.  @code{legend} works on line graphs,
+## bar graphs, etc.  A plot must exist before legend is called.
+##
+## The optional parameter @var{pos} specifies the location of the legend
+## as follows:
+##
+## @multitable @columnfractions 0.06 0.14 0.80
+## @headitem @tab pos @tab location of the legend
+## @item @tab north @tab center top
+## @item @tab south @tab center bottom
+## @item @tab east @tab right center
+## @item @tab west @tab left center
+## @item @tab northeast @tab right top (default)
+## @item @tab northwest @tab left top
+## @item @tab southeast @tab right bottom
+## @item @tab southwest @tab left bottom
+## @item
+## @item @tab outside @tab can be appended to any location string
+## @end multitable
+##
+## The optional parameter @var{orient} determines if the key elements
+## are placed vertically or horizontally.  The allowed values are
+## @qcode{"vertical"} (default) or @qcode{"horizontal"}.
+##
+## The following customizations are available using @var{option}:
+##
+## @table @asis
+## @item @qcode{"show"}
+##   Show legend on the plot
+##
+## @item @qcode{"hide"}
+##   Hide legend on the plot
+##
+## @item @qcode{"toggle"}
+##   Toggles between @qcode{"hide"} and @qcode{"show"}
+##
+## @item @qcode{"boxon"}
+##   Show a box around legend (default)
+##
+## @item @qcode{"boxoff"}
+##   Hide the box around legend
+##
+## @item @qcode{"right"}
+##   Place label text to the right of the keys (default)
+##
+## @item @qcode{"left"}
+##   Place label text to the left of the keys
+##
+## @item @qcode{"off"}
+##   Delete the legend object
+## @end table
+##
+## The optional output values are
+##
+## @table @var
+## @item hleg
+##   The graphics handle of the legend object.
+##
+## @item hleg_obj
+##   Graphics handles to the text and line objects which make up the legend.
+##
+## @item hplot
+##   Graphics handles to the plot objects which were used in making the legend.
+##
+## @item labels
+##   A cell array of strings of the labels in the legend.
+## @end table
+##
+## The legend label text is either provided in the call to @code{legend} or
+## is taken from the DisplayName property of graphics objects.  If no
+## labels or DisplayNames are available, then the label text is simply
+## @qcode{"data1"}, @qcode{"data2"}, @dots{}, @nospell{@qcode{"dataN"}}.
+##
+## Implementation Note: A legend is implemented as an additional axes object
+## of the current figure with the @qcode{"tag"} set to @qcode{"legend"}.
+## Properties of the legend object may be manipulated directly by using
+## @code{set}.
+## @end deftypefn
+
+function [hleg, hleg_obj, hplot, labels] = legend (varargin)
+
+  if (nargin > 0
+      && (! ishandle (varargin{1})
+          || (strcmp (get (varargin{1}, "type"), "axes")
+              && ! strcmp (get (varargin{1}, "tag"), "legend"))))
+    [ca, varargin, nargin] = __plt_get_axis_arg__ ("legend", varargin{:});
+    if (isempty (ca))
+      ca = gca ();
+    endif
+    fig = get (ca, "parent");
+  else
+    fig = get (0, "currentfigure");
+    if (isempty (fig))
+      fig = gcf ();
+    endif
+    ca = gca ();
+  endif
+
+  ## Special handling for plotyy which has two axes objects
+  if (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
+    plty = get (ca, "__plotyy_axes__");
+    if (isscalar (plty) && ishandle (plty))
+      ca = [ca, plty];
+    elseif (iscell (plty))
+      ca = [ca, plty{:}];
+    elseif (all (ishandle (plty)))
+      ca = [ca, plty(:).'];
+    else
+      error ("legend.m: This should not happen. File a bug report.");
+    endif
+    ## Remove duplicates while preserving order
+    [~, n] = unique (ca);
+    ca = ca(sort (n));
+  endif
+
+  if (nargin > 0 && all (ishandle (varargin{1})))
+    kids = flipud (varargin{1}(:));
+    varargin(1) = [];
+  else
+    kids = ca;
+    kids(strcmp (get (ca, "tag"), "legend")) = [];
+    if (isscalar (kids))
+      kids = get (kids, "children")(:);
+    else
+      kids = flipud ([get(kids, "children"){:}](:));
+    endif
+  endif
+  nargs = numel (varargin);
+  nkids = numel (kids);
+
+  orientation = "default";
+  location = "default";
+  show = "create";
+  textpos = "default";
+  box = "default";
+
+  ## Process old way of specifying location with a number rather than a string.
+  if (nargs > 0)
+    pos = varargin{nargs};
+    if (isnumeric (pos) && isscalar (pos) && pos == fix (pos))
+      if (pos >= -1 && pos <= 4)
+        location = [{"northeastoutside", "best", "northeast",
+                     "northwest", "southwest", "southeast"}] {pos + 2};
+        nargs--;
+      else
+        error ("legend: invalid location specified");
+      endif
+    endif
+  endif
+
+  ## Find location and orientation property/value pairs
+  while (nargs > 1)
+    pos = varargin{nargs-1};
+    str = varargin{nargs};
+    if (strcmpi (pos, "location") && ischar (str))
+      location = lower (str);
+      nargs -= 2;
+    elseif (strcmpi (pos, "orientation") && ischar (str))
+      orientation = lower (str);
+      nargs -= 2;
+    else
+      break;
+    endif
+  endwhile
+
+  ## Validate the orientation
+  switch (orientation)
+    case {"vertical", "horizontal", "default"}
+      ## These are all accepted orientations.
+    otherwise
+      error ("legend: unrecognized legend orientation");
+  endswitch
+
+  ## Validate the location type
+  outside = false;
+  inout = strfind (location, "outside");
+  if (! isempty (inout))
+    outside = true;
+    location = location(1:inout-1);
+  else
+    outside = false;
+  endif
+
+  switch (location)
+    case {"north", "south", "east", "west", "northeast", "northwest", ...
+          "southeast", "southwest", "default"}
+    case "best"
+      warning ("legend: 'best' not yet implemented for location specifier\n");
+      location = "northeast";
+    otherwise
+      error ("legend: unrecognized legend location");
+  endswitch
+
+  ## Find any existing legend object on figure
+  hlegend = [];
+  fkids = get (fig, "children");
+  for i = 1 : numel (fkids)
+    if (   strcmp (get (fkids(i), "type"), "axes")
+        && strcmp (get (fkids(i), "tag"), "legend"))
+      udata = get (fkids(i), "userdata");
+      if (any (udata.handle == ca))
+        hlegend = fkids(i);
+        break;
+      endif
+    endif
+  endfor
+
+  if (nargs == 1)
+    arg = varargin{1};
+    if (ischar (arg))
+      if (rows (arg) == 1)
+        str = tolower (strtrim (arg));
+        switch (str)
+          case "off"
+            delete (hlegend);
+            return;
+          case "hide"
+            show = "off";
+            nargs--;
+          case "show"
+            if (! isempty (hlegend))
+              show = "on";
+            else
+              show = "create";
+              textpos = "right";
+            endif
+            nargs--;
+          case "toggle"
+            if (isempty (hlegend))
+              show = "create";
+              textpos = "right";
+            elseif (strcmp (get (hlegend, "visible"), "off"))
+              show = "on";
+            else
+              show = "off";
+            endif
+            nargs--;
+          case "boxon"
+            box = "on";
+            nargs--;
+          case "boxoff"
+            box = "off";
+            nargs--;
+          case "left"
+            textpos = "left";
+            nargs--;
+          case "right"
+            textpos = "right";
+            nargs--;
+        endswitch
+      else
+        ## Character matrix of labels
+        varargin = cellstr (arg);
+        nargs = numel (varargin);
+      endif
+    elseif (iscellstr (arg))
+      ## Cell array of labels
+      varargin = arg;
+      nargs = numel (varargin);
+    else
+      error ("legend: expecting argument to be a character string");
+    endif
+  elseif (nargs > 1 && iscellstr (varargin{1}))
+    ## Cell array of labels followed by property/value pairs
+    varargin = {varargin{1}{:}, varargin{2:end}};
+    nargs = numel (varargin);
+  endif
+
+  have_labels = (nargs > 0);
+
+  if (strcmp (show, "off"))
+    if (! isempty (hlegend))
+      set (findobj (hlegend), "visible", "off");
+      hlegend = [];
+    endif
+    hobjects = [];
+    hplots  = [];
+    text_strings = {};
+  elseif (strcmp (show, "on"))
+    if (! isempty (hlegend))
+      set (findobj (hlegend), "visible", "on");
+      ## NOTE - Matlab sets both "visible", and "box" to "on"
+      set (hlegend, "visible", get (hlegend, "box"));
+    else
+      hobjects = [];
+      hplots  = [];
+      text_strings = {};
+    endif
+  elseif (strcmp (box, "on"))
+    if (! isempty (hlegend))
+      set (hlegend, "box", "on", "visible", "on");
+    endif
+  elseif (strcmp (box, "off"))
+    if (! isempty (hlegend))
+      set (hlegend, "box", "off", "visible", "off");
+    endif
+  elseif (! have_labels && ! (strcmp (location, "default") &&
+                              strcmp (orientation, "default")))
+    ## Changing location or orientation of existing legend
+    if (! isempty (hlegend))
+      if (strcmp (location, "default"))
+        set (hlegend, "orientation", orientation);
+      elseif (strcmp (orientation, "default"))
+        if (outside)
+          set (hlegend, "location", [location "outside"]);
+        else
+          set (hlegend, "location", location);
+        endif
+      else
+        if (outside)
+          set (hlegend, "location", [location "outside"],
+                        "orientation", orientation);
+        else
+          set (hlegend, "location", location,
+                        "orientation", orientation);
+        endif
+      endif
+    endif
+  else
+    ## Create new legend
+    hobjects = [];
+    hplots  = [];
+    text_strings = {};
+
+    if (have_labels)
+      ## Check for valid data that can be labeled.
+      have_data = false;
+      have_dname = false;
+      for k = 1 : nkids
+        typ = get (kids(k), "type");
+        if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"})))
+          have_data = true;
+          break;
+        endif
+      endfor
+
+      if (! have_data)
+        warning ("legend: plot data is empty; setting key labels has no effect");
+      endif
+    else
+      ## No labels.  Search for DisplayName property.
+      have_dname = false;
+      for k = 1 : nkids
+        hkid = kids(k);
+        typ = get (hkid, "type");
+        if (any (strcmp (typ, {"line", "patch", "surface"})))
+          if (! isempty (get (hkid, "displayname")))
+            have_dname = true;
+            break;
+          endif
+        elseif (strcmp (typ, "hggroup"))
+          hgkids = get (hkid, "children");
+          for j = 1 : length (hgkids)
+            try
+              dname = get (hgkids(j), "DisplayName");
+              if (! isempty (dname))
+                have_dname = true;
+                break;  # break from j-loop over hgkids
+              endif
+            end_try_catch
+          endfor
+          if (have_dname)
+            break;  # break from k loop over nkids
+          endif
+        endif  # elseif hggroup
+      endfor   # for loop k = 1 : nkids
+    endif      # else branch of if (have_labels)
+
+    if (have_labels || ! have_dname)
+      k = nkids;
+      if (! have_labels)
+        varargin = arrayfun (@(x) sprintf ("data%d", x), [1:nkids]',
+                             "uniformoutput", false);
+        have_labels = true;
+        nargs = nkids;
+      endif
+      for i = 1 : nargs
+        arg = varargin{i};
+        if (ischar (arg))
+          typ = get (kids(k), "type");
+          while (k > 0
+                 && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+            typ = get (kids(--k), "type");
+          endwhile
+          if (k > 0)
+            if (strcmp (get (kids(k), "type"), "hggroup"))
+              hgkids = get (kids(k), "children");
+              for j = 1 : length (hgkids)
+                hgobj = get (hgkids(j));
+                if (isfield (hgobj, "displayname"))
+                  if (have_labels)
+                    set (hgkids(j), "displayname", arg);
+                  endif
+                  hplots(end+1) = hgkids(j);
+                  text_strings(end+1) = arg;
+                  break;
+                endif
+              endfor
+            else
+              if (have_labels)
+                set (kids(k), "displayname", arg);
+              endif
+              hplots(end+1) = kids(k);
+              text_strings(end+1) = arg;
+            endif
+
+            if (--k == 0)
+              break;
+            endif
+          else
+            break;  # k = 0, no further handles to process
+          endif
+        else
+          error ("legend: expecting argument to be a character string");
+        endif
+      endfor
+      if (have_labels && i < nargs)
+        warning ("legend: ignoring extra labels");
+      endif
+    else
+      ## No labels specified but objects have DisplayName property set.
+      k = nkids;
+      while (k > 0)
+        typ = get (kids(k), "type");
+        while (k > 1
+               && ! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+          typ = get (kids(--k), "type");
+        endwhile
+        if (! any (strcmp (typ, {"line","patch","surface","hggroup"})))
+          break;
+        endif
+        if (k > 0)
+          if (strcmp (get (kids(k), "type"), "hggroup"))
+            hgkids = get (kids(k), "children");
+            for j = 1 : length (hgkids)
+              hgobj = get (hgkids(j));
+              if (isfield (hgobj, "displayname")
+                  && ! isempty (hgobj.displayname))
+                hplots(end+1) = hgkids(j);
+                text_strings(end+1) = hgobj.displayname;
+                break;
+              endif
+            endfor
+          else
+            if (! isempty (get (kids(k), "displayname")))
+              hplots(end+1) = kids(k);
+              text_strings(end+1) = get (kids(k), "displayname");
+            endif
+          endif
+          if (--k == 0)
+            break;
+          endif
+        endif
+      endwhile
+    endif
+
+    if (isempty (hplots))
+      if (! isempty (hlegend))
+        fkids = get (fig, "children");
+        delete (fkids(fkids == hlegend));
+        hlegend = [];
+        hobjects = [];
+        hplots  = [];
+        text_strings = {};
+      endif
+    else
+      ## Preserve the old legend if it exists
+      if (! isempty (hlegend))
+        if (strcmp (textpos, "default"))
+          textpos = get (hlegend, "textposition");
+        endif
+        if (strcmp (location, "default"))
+          location = get (hlegend, "location");
+          inout = strfind (location, "outside");
+          if (! isempty (inout))
+            outside = true;
+            location = location(1:inout-1);
+          else
+            outside = false;
+          endif
+        endif
+        if (strcmp (orientation, "default"))
+          orientation = get (hlegend, "orientation");
+        endif
+        box = get (hlegend, "box");
+      else
+        if (strcmp (textpos, "default"))
+          textpos = "right";
+        endif
+        if (strcmp (location, "default"))
+          location = "northeast";
+        endif
+        if (strcmp (orientation, "default"))
+          orientation = "vertical";
+        endif
+        box = "on";
+      endif
+
+      ## Get axis size and fontsize in points.
+      ## Rely on listener to handle coversion.
+      units = get (ca(1), "units");
+      unwind_protect
+        set (ca(1), "units", "points");
+        set (ca(1), "fontunits", "points");
+        if (isempty (hlegend) || ! isprop (hlegend, "unmodified_axes_position"))
+          unmodified_axes_position = get (ca(1), "position");
+          unmodified_axes_outerposition = get (ca(1), "outerposition");
+        else
+          unmodified_axes_position = get (hlegend, "unmodified_axes_position");
+          unmodified_axes_outerposition = get (hlegend, ...
+                                               "unmodified_axes_outerposition");
+        endif
+        ca_pos = unmodified_axes_position;
+        ca_outpos = unmodified_axes_outerposition;
+        tightinset = get (ca(1), "tightinset");
+        for i = 2 : numel (ca)
+          tightinset = max (tightinset, get (ca(i), "tightinset"));
+        endfor
+      unwind_protect_cleanup
+        set (ca(1), "units", units);
+      end_unwind_protect
+
+      ## Padding between legend entries horizontally and vertically
+      xpad = 2;
+      ypad = 2;
+
+      linelength = 15;
+
+      ## Create the axis first
+      curaxes = get (fig, "currentaxes");
+      unwind_protect
+        ud = ancestor (hplots, "axes");
+        if (! isscalar (ud))
+          ud = unique ([ud{:}]);
+        endif
+        if (isempty (hlegend))
+          addprops = true;
+          hlegend = axes ("tag", "legend", "userdata", struct ("handle", ud),
+                          "box", box,
+                          "xtick", [], "ytick", [],
+                          "xlim", [0, 1], "ylim", [0, 1],
+                          "visible", ifelse (strcmp (box, "on"), "on", "off"),
+                          "activepositionproperty", "position",
+                          "interpreter", "tex");
+          ## Inherit properties from current axis
+          ## "fontunits" shoud be first because it affects interpretation
+          ## of "fontsize" property
+          proplist = {"fontunits", "fontangle", "fontname", "fontsize", ...
+                      "fontweight"};
+          ca_props = get (ca(1), proplist); 
+          set (hlegend, proplist, ca_props);
+        else
+          addprops = false;
+          axes (hlegend);
+          delete (get (hlegend, "children"));
+        endif
+        if (addprops)
+          addproperty ("edgecolor", hlegend, "color", [0, 0, 0]);
+          addproperty ("textcolor", hlegend, "color", [0, 0, 0]);
+          locations = {"north", "south", "east", "west", ...
+                       "{northeast}", "southeast", "northwest", "southwest", ...
+                       "northoutside", "southoutside", ...
+                       "eastoutside", "westoutside", ...
+                       "northeastoutside", "southeastoutside", ...
+                       "northwestoutside", "southwestoutside"};
+          addproperty ("location", hlegend, "radio", strjoin (locations, "|"));
+          addproperty ("orientation", hlegend, "radio",
+                       "{vertical}|horizontal");
+          addproperty ("string", hlegend, "any", text_strings);
+          addproperty ("textposition", hlegend, "radio", "left|{right}");
+        endif
+        ## Inherit visual properties from legend object
+        fontunits = get (hlegend, "fontunits");
+        fontangle = get (hlegend, "fontangle");
+        fontname = get (hlegend, "fontname");
+        fontsize = get (hlegend, "fontsize");
+        fontweight = get (hlegend, "fontweight");
+        interpreter = get (hlegend, "interpreter");
+        textcolor = get (hlegend, "textcolor");
+        ## Add text label to the axis first, checking their extents
+        nentries = numel (hplots);
+        texthandle = [];
+        maxwidth = 0;
+        maxheight = 0;
+        for k = 1 : nentries
+          halign = ifelse (strcmp (textpos, "right"), "left", "right");
+          texthandle(end+1) = text (0, 0, text_strings{k},
+                                    "color", textcolor,
+                                    "horizontalalignment", halign,
+                                    "interpreter", interpreter,
+                                    "fontunits", fontunits,
+                                    "fontangle", fontangle,
+                                    "fontname", fontname,
+                                    "fontsize", fontsize,
+                                    "fontweight", fontweight,
+                                    "userdata", hplots(k));
+          units = get (texthandle(end), "units");
+          unwind_protect
+            set (texthandle(end), "units", "points");
+            extents = get (texthandle(end), "extent");
+            maxwidth = max (maxwidth, extents(3));
+            maxheight = max (maxheight, extents(4));
+          unwind_protect_cleanup
+            set (texthandle(end), "units", units);
+          end_unwind_protect
+        endfor
+
+        num1 = nentries;
+        if (strcmp (orientation, "vertical"))
+          height = nentries * (ypad + maxheight);
+          if (outside)
+            if (height > ca_pos(4))
+              ## Avoid shrinking the height of the axis to zero if outside
+              num1 = ca_pos(4) / (maxheight + ypad) / 2;
+            endif
+          else
+            if (height > 0.9 * ca_pos(4))
+              num1 = 0.9 * ca_pos(4) / (maxheight + ypad);
+            endif
+          endif
+        else
+          width = nentries * (ypad + maxwidth);
+          if (outside)
+            if (width > ca_pos(3))
+              ## Avoid shrinking the width of the axis to zero if outside
+              num1 = ca_pos(3) / (maxwidth + ypad) / 2;
+            endif
+          else
+            if (width > 0.9 * ca_pos(3))
+              num1 = 0.9 * ca_pos(3) / (maxwidth + ypad);
+            endif
+          endif
+        endif
+        num2 = ceil (nentries / num1);
+
+        xstep = 3 * xpad + (maxwidth + linelength);
+        if (strcmp (textpos, "right"))
+          xoffset = xpad;
+          txoffset = 2 * xpad + linelength;
+        else
+          xoffset = 2 * xpad + maxwidth;
+          txoffset = xpad + maxwidth;
+        endif
+        ystep = (ypad + maxheight);
+        yoffset = ystep / 2;
+
+        ## Place the legend in the desired location
+        if (strcmp (orientation, "vertical"))
+          lpos = [0, 0, num2 * xstep, num1 * ystep];
+        else
+          lpos = [0, 0, num1 * xstep, num2 * ystep];
+        endif
+
+        gnuplot = strcmp (get (fig, "__graphics_toolkit__"), "gnuplot");
+        if (gnuplot)
+          ## Gnuplot places the key (legend) at edge of the figure window.
+          ## OpenGL places the legend box at edge of the unmodified axes
+          ## position.
+          if (isempty (strfind (location, "east")))
+            gnuplot_offset = unmodified_axes_outerposition(1) ...
+                           + unmodified_axes_outerposition(3) ...
+                           - unmodified_axes_position(1) ...
+                           - unmodified_axes_position(3);
+          else
+            gnuplot_offset = unmodified_axes_position(1) ...
+                           - unmodified_axes_outerposition(1);
+          endif
+          ## FIXME: The "fontsize" is added to match the behavior of OpenGL.
+          ## This implies that a change in fontsize should trigger a listener
+          ## to update the legend.  The "2" was determined using a long legend
+          ## key in the absence of any subplots.
+          gnuplot_offset = gnuplot_offset - 2 * fontsize;
+        else
+          gnuplot_offset = 0;
+        endif
+
+        ## For legend's outside the associated axes postion,
+        ## align their edge to the unmodified_axes_outerpostion,
+        ## and adjust the axes postion accordingly.
+        switch (location)
+          case "north"
+            if (outside)
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_outpos(2) + ca_outpos(4) - lpos(4) - ypad, lpos(3), ...
+                      lpos(4)];
+
+              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3), ca_pos(4) - lpos(4)];
+            else
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "south"
+            if (outside)
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_outpos(2) + ypad, lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), lpos(2) + lpos(4) + 2 * ypad ...
+                      + tightinset(2), ca_pos(3), ...
+                         ca_pos(4) - lpos(4)];
+            else
+              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
+                      ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+          case "east"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+            endif
+          case "west"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, ...
+                      lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+                         ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) +  ypad, ...
+                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
+            endif
+          case "northeast"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4), lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - tightinset(3) - ca_pos(1), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "northwest"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad , ca_pos(2) + ca_pos(4) - lpos(4), ...
+                      lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ypad, ...
+                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
+            endif
+          case "southeast"
+            if (outside)
+              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
+                      ca_pos(2), lpos(3), lpos(4)];
+              new_pos = [ca_pos(1), ca_pos(2), ...
+                         lpos(1) - 2 * xpad - ca_pos(1) - tightinset(3), ...
+                         ca_pos(4)];
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
+                      ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+          case "southwest"
+            if (outside)
+              lpos = [ca_outpos(1) + ypad, ca_pos(2), lpos(3), lpos(4)];
+              new_pos = [lpos(1) + lpos(3) + 2 * xpad + tightinset(1), ...
+              ca_pos(2), ca_pos(3) - lpos(3) - 2 * xpad, ca_pos(4)];
+              new_pos(1) = new_pos(1) - gnuplot_offset;
+              new_pos(3) = new_pos(3) + gnuplot_offset;
+            else
+              lpos = [ca_pos(1) + ypad, ca_pos(2) + ypad, lpos(3), lpos(4)];
+            endif
+        endswitch
+
+        units = get (hlegend, "units");
+        unwind_protect
+          set (hlegend, "units", "points");
+          set (hlegend, "position", lpos);
+        unwind_protect_cleanup
+          set (hlegend, "units", units);
+        end_unwind_protect
+
+        ## Now write the line segments and place the text objects correctly
+        xk = 0;
+        yk = 0;
+        for k = 1 : numel (hplots)
+          hobjects(end+1) = texthandle(k);
+          switch (get (hplots(k), "type"))
+
+            case "line"
+              color = get (hplots(k), "color");
+              style = get (hplots(k), "linestyle");
+              if (! strcmp (style, "none"))
+                l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3),
+                           "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4),
+                           "color", color, "linestyle", style,
+                           "marker", "none",
+                           "userdata", hplots(k));
+                hobjects(end+1) = l1;
+              endif
+              marker = get (hplots(k), "marker");
+              if (! strcmp (marker, "none"))
+                l1 = line ("xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3),
+                           "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4),
+                           "color", color, "linestyle", "none",
+                           "marker", marker,
+                           "markeredgecolor",get (hplots(k), "markeredgecolor"),
+                           "markerfacecolor",get (hplots(k), "markerfacecolor"),
+                           "markersize", get (hplots(k), "markersize"),
+                           "userdata", hplots(k));
+                hobjects(end+1) = l1;
+              endif
+
+              if (addprops)
+                addlistener (hplots(k), "color",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "linestyle",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "marker",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markeredgecolor",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markerfacecolor",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "markersize",
+                             {@updateline, hlegend, linelength, false});
+                addlistener (hplots(k), "displayname",
+                             {@updateline, hlegend, linelength, true});
+              endif
+
+            case "patch"
+              facecolor = get (hplots(k), "facecolor");
+              edgecolor = get (hplots(k), "edgecolor");
+              cdata = get (hplots(k), "cdata");
+              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
+                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
+                                      xoffset + xk * xstep) / lpos(3),
+                            "ydata", (lpos(4) - yoffset -
+                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
+                           "facecolor", facecolor, "edgecolor", edgecolor,
+                           "cdata", cdata, "userdata", hplots(k));
+                hobjects(end+1) = p1;
+              endif
+              ## FIXME: Probably need listeners, as for line objects
+
+            case "surface"
+              facecolor = get (hplots(k), "facecolor");
+              edgecolor = get (hplots(k), "edgecolor");
+              cdata = sum (get (ca(1), "clim")) / 2;
+              if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
+                p1 = patch ("xdata", ([0, linelength, linelength, 0] +
+                                      xoffset + xk * xstep) / lpos(3),
+                            "ydata", (lpos(4) - yoffset -
+                                      [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
+                           "facecolor", facecolor, "edgecolor", edgecolor,
+                           "cdata", cdata, "userdata", hplots(k));
+                hobjects(end+1) = p1;
+              endif
+              ## FIXME: Probably need listeners, as for line objects
+
+          endswitch
+
+          set (texthandle(k), "position",
+                              [(txoffset + xk * xstep) / lpos(3), ...
+                               (lpos(4) - yoffset - yk * ystep) / lpos(4)]);
+          if (strcmp (orientation, "vertical"))
+            yk++;
+            if (yk > num1)
+              yk = 0;
+              xk++;
+            endif
+          else
+            xk++;
+            if (xk > num1)
+              xk = 0;
+              yk++;
+            endif
+          endif
+        endfor
+
+        ## Add an invisible text object to original axis
+        ## that when it is destroyed will remove the legend
+        props = {"parent", ca(1), "tag", "legend", ...
+                 "handlevisibility", "off", "visible", "off", ...
+                 "xliminclude", "off", "yliminclude", "off"};
+        t1 = findall (ca(1), "tag", "legend", "type", "text");
+        if (isempty (t1))
+          t1 = text (0, 0, "", props{:});
+          set (t1, "deletefcn", {@deletelegend1, hlegend});
+        endif
+        if (isprop (hlegend, "unmodified_axes_position"))
+          set (hlegend, "unmodified_axes_position",
+                         unmodified_axes_position,
+                        "unmodified_axes_outerposition",
+                         unmodified_axes_outerposition);
+        else
+          addproperty ("unmodified_axes_position", hlegend,
+                       "data", unmodified_axes_position);
+          addproperty ("unmodified_axes_outerposition", hlegend,
+                       "data", unmodified_axes_outerposition);
+        endif
+
+        ## Resize the axis that the legend is attached to if the legend is
+        ## "outside" the plot and create a listener to resize axis to original
+        ## size if the legend is deleted, hidden, or shown.
+        if (outside)
+          for i = 1 : numel (ca)
+            units = get (ca(i), "units");
+            unwind_protect
+              set (ca(i), "units", "points");
+              if (gnuplot && numel (ca) == 1)
+                ## Let Gnuplot handle the positioning of the keybox.
+                ## This violates strict Matlab compatibility, but reliably
+                ## renders an esthetic result.
+                set (ca(i), "position",  unmodified_axes_position);
+                set (ca(i), "activepositionproperty", "outerposition")
+              else
+                ## numel (ca) > 1 for axes overlays (like plotyy)
+                set (ca(i), "position", new_pos);
+              endif
+            unwind_protect_cleanup
+              set (ca(i), "units", units);
+            end_unwind_protect
+          endfor
+
+          set (hlegend, "deletefcn", {@deletelegend2, ca, ...
+                                      unmodified_axes_position, ...
+                                      unmodified_axes_outerposition, ...
+                                      t1, hplots});
+          addlistener (hlegend, "visible", {@hideshowlegend, ca, ...
+                                            unmodified_axes_position, ...
+                                            new_pos});
+        else
+          set (hlegend, "deletefcn", {@deletelegend2, ca, [], [], t1, hplots});
+        endif
+
+        if (! addprops)
+          ## Remove listeners on existing legend temporarily to stop recursion.
+          dellistener (hlegend, "location");
+          dellistener (hlegend, "orientation");
+          dellistener (hlegend, "string");
+          dellistener (hlegend, "textposition");
+        endif
+
+        if (! addprops)
+          set (hlegend, "string", text_strings);
+        endif
+
+        if (outside)
+          set (hlegend, "location", [location "outside"],
+                        "orientation", orientation, "textposition", textpos);
+        else
+          set (hlegend, "location", location, "orientation", orientation,
+                        "textposition", textpos);
+        endif
+
+        if (addprops)
+          addlistener (hlegend, "edgecolor", @updatelegendtext);
+          addlistener (hlegend, "fontangle", @updatelegendtext);
+          addlistener (hlegend, "fontname", @updatelegendtext);
+          addlistener (hlegend, "fontweight", @updatelegendtext);
+          addlistener (hlegend, "textcolor", @updatelegendtext);
+          ## Properties which could change size of box, such as fontsize,
+          ## require legend to be redrawn.
+          addlistener (hlegend, "fontsize", @updatelegend);
+          addlistener (hlegend, "fontunits", @updatelegend);
+          addlistener (hlegend, "interpreter", @updatelegend);
+          addlistener (hlegend, "location", @updatelegend);
+          addlistener (hlegend, "orientation", @updatelegend);
+          addlistener (hlegend, "string", @updatelegend);
+          addlistener (hlegend, "textposition", @updatelegend);
+          ## FIXME: need to add listeners for tightinset and position
+          ##        addlistener (ca, "tightinset", @update????);
+          ##        addlistener (ca, "position", @update????);
+        else
+          ## Restore certain listeners
+          addlistener (hlegend, "location", @updatelegend);
+          addlistener (hlegend, "orientation", @updatelegend);
+          addlistener (hlegend, "string", @updatelegend);
+          addlistener (hlegend, "textposition", @updatelegend);
+        endif
+      unwind_protect_cleanup
+        set (fig, "currentaxes", curaxes);
+      end_unwind_protect
+    endif
+  endif
+
+  if (nargout > 0)
+    hleg = hlegend;
+    hleg_obj = hobjects;
+    hplot = hplots;
+    labels = text_strings;
+  endif
+
+endfunction
+
+function updatelegend (h, ~)
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+    unwind_protect
+      hax = getfield (get (h, "userdata"), "handle");
+      [hplots, ~] = __getlegenddata__ (h);
+      position = get (h, "unmodified_axes_position");
+      outerposition = get (h, "unmodified_axes_outerposition");
+      units = get (hax, "units");
+      set (hax, "units", "points");
+      switch (get (hax, "activepositionproperty"))
+        case "position"
+          set (hax, "outerposition", outerposition);
+          set (hax, "position", position);
+        case "outerposition"
+          set (hax, "position", position);
+          set (hax, "outerposition", outerposition);
+      endswitch
+      set (hax, "units", units);
+      h = legend (hax, hplots, get (h, "string"));
+    unwind_protect_cleanup
+      recursive = false;
+    end_unwind_protect
+  endif
+
+endfunction
+
+function updatelegendtext (h, ~)
+  kids = get (h, "children");
+  htext = [];
+  for i = 1:numel (kids)
+    if (strcmp (get (kids(i), "type"), "text"))
+      htext(end+1) = kids(i);
+    endif
+  endfor
+
+  tprops = {"fontangle", "fontname", "fontweight", "color"};
+  lprops = {"fontangle", "fontname", "fontweight", "textcolor"};
+  set (htext, tprops, get (h, lprops));
+
+  ec = get (h, "edgecolor");
+  set (h, "xcolor", ec, "ycolor", ec);
+endfunction
+
+function hideshowlegend (h, ~, ca, pos1, pos2)
+  isvisible = strcmp (get (h, "visible"), "off");
+  if (! isvisible)
+    kids = get (h, "children");
+    if (any (! strcmp (get (kids, "visible"), "off")))
+      isvisible = true;
+    endif
+  endif
+
+  for i = 1 : numel (ca)
+    if (isaxes (ca(i))
+        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
+        && strcmp (get (ca(i), "beingdeleted"), "off"))
+      units = get (ca(i), "units");
+      unwind_protect
+        set (ca(i), "units", "points");
+        if (isvisible)
+          set (ca(i), "position", pos2);
+        else
+          set (ca(i), "position", pos1);
+        endif
+      unwind_protect_cleanup
+        set (ca(i), "units", units);
+      end_unwind_protect
+    endif
+  endfor
+endfunction
+
+function deletelegend1 (h, ~, ca)
+  if (isaxes (ca)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
+      && strcmp (get (ca, "beingdeleted"), "off"))
+    delete (ca);
+  endif
+endfunction
+
+function deletelegend2 (h, ~, ca, pos, outpos, t1, hplots)
+  for i = 1 : numel (ca)
+    if (isaxes (ca(i))
+        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
+        && strcmp (get (ca(i), "beingdeleted"), "off"))
+      if (! isempty (pos) && ! isempty (outpos))
+        units = get (ca(i), "units");
+        unwind_protect
+          set (ca(i), "units", "points");
+          set (ca(i), "position", pos, "deletefcn", "");
+        unwind_protect_cleanup
+          set (ca(i), "units", units);
+        end_unwind_protect
+      endif
+    endif
+  endfor
+  set (t1, "deletefcn", "");
+  delete (t1);
+  for i = 1 : numel (hplots)
+    if (ishandle (hplots(i)) && strcmp (get (hplots(i), "type"), "line"))
+      dellistener (hplots(i), "color");
+      dellistener (hplots(i), "linestyle");
+      dellistener (hplots(i), "marker");
+      dellistener (hplots(i), "markeredgecolor");
+      dellistener (hplots(i), "markerfacecolor");
+      dellistener (hplots(i), "markersize");
+      dellistener (hplots(i), "displayname");
+    endif
+  endfor
+endfunction
+
+function updateline (h, ~, hlegend, linelength, update_name)
+
+  if (update_name)
+    ## When string changes, have to rebuild legend completely
+    [hplots, text_strings] = __getlegenddata__ (hlegend);
+    legend (hplots, text_strings);
+  else
+    kids = get (hlegend, "children");
+    ll = lm = [];
+    for i = 1 : numel (kids)
+      if (get (kids(i), "userdata") == h
+          && strcmp (get (kids(i), "type"), "line"))
+        if (strcmp (get (kids(i), "marker"), "none"))
+          ll = kids(i);
+        else
+          lm = kids(i);
+        endif
+      endif
+    endfor
+
+    [linestyle, marker, displayname] = ...
+      get (h, {"linestyle", "marker", "displayname"}){:};
+
+    if (! isempty (ll))
+      [xpos1, ypos1] = get (ll, {"xdata", "ydata"}){:};
+      xpos2 = sum (xpos1) / 2;
+      ypos2 = ypos1(1);
+      delete (ll);
+      if (! isempty (lm))
+        delete (lm);
+      endif
+    else
+      [xpos2, ypos2] = get (lm, {"xdata", "ydata"}){:};
+      xpos1 = xpos2 + [-0.5, 0.5] * linelength;
+      ypos1 = [ypos2, ypos2];
+      delete (lm);
+    endif
+
+    if (! strcmp (linestyle, "none"))
+      line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"),
+            "linestyle", get (h, "linestyle"), "marker", "none",
+            "userdata", h, "parent", hlegend);
+    endif
+    if (! strcmp (marker, "none"))
+      line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"),
+            "marker", marker, "markeredgecolor", get (h, "markeredgecolor"),
+            "markerfacecolor", get (h, "markerfacecolor"),
+            "markersize", get (h, "markersize"), "linestyle", "none",
+            "userdata", h, "parent", hlegend);
+    endif
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('legend called with cellstr and string inputs for labels');
+%! h = legend ({'foo'}, 'bar');
+%! legend location northeastoutside
+%! set (h, 'fontsize', 20);
+
+%!demo
+%! clf;
+%! plot (rand (3));
+%! title ('legend() without inputs creates default labels');
+%! h = legend ();
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x,x,';I am Blue;', x,2*x, x,3*x,';I am Red;');
+%! legend location northeastoutside
+%! ## Placing legend inside should return axes to original size
+%! legend location northeast
+%! title ('Blue and Red keys, with Green missing');
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('incline is blue and decline is green');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend hide
+%! legend show
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with keys in horizontal orientation');
+%! legend ({'I am blue', 'I am green'}, ...
+%!         'location', 'east', 'orientation', 'horizontal');
+%! legend boxoff
+%! legend boxon
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with box off');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend boxoff
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend with text to the left of key');
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend left
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ({'Use properties to place legend text to the left of key', ...
+%!         'Legend text color is magenta'});
+%! h = legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend ('right');
+%! set (h, 'textposition', 'left');
+%! set (h, 'textcolor', [1 0 1]);
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10, 1:10, fliplr (1:10));
+%! title ('Legend is hidden')
+%! legend ({'I am blue', 'I am green'}, 'location', 'east');
+%! legend hide
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x,x,';I am Blue;', x,2*x,';I am Green;', x,3*x,';I am Red;');
+%! title ({'Labels are embedded in call to plot', ...
+%!         'Legend is hidden and then shown'});
+%! legend boxon
+%! legend hide
+%! legend show
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! plot (x, x, ';\alpha;',  ...
+%!       x, 2*x, ';\beta=2\alpha;',  ...
+%!       x, 3*x, ';\gamma=3\alpha;');
+%! h = legend ();
+%! set (h, 'interpreter', 'tex');
+%! title ('Labels with interpreted Greek text');
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('Labels with TeX interpreter turned off');
+%! h = legend ('Hello_World', 'foo^bar');
+%! set (h, 'interpreter', 'none');
+
+%!demo
+%! clf;
+%! plot (1:10, 1:10);
+%! title ('a very long label can sometimes cause problems');
+%! legend ('hello very big world', 'location', 'northeastoutside');
+
+%!demo
+%! clf;
+%! labels = {};
+%! colororder = get (gca, 'colororder');
+%! for i = 1:5
+%!   h = plot (1:100, i + rand (100,1)); hold on;
+%!   set (h, 'color', colororder(i,:));
+%!   labels = {labels{:}, ['Signal ', num2str(i)]};
+%! end
+%! hold off;
+%! title ({'Signals with random offset and uniform noise';
+%!         'Legend shown below and outside of plot'});
+%! xlabel ('Sample Nr [k]'); ylabel ('Amplitude [V]');
+%! legend (labels, 'location', 'southoutside');
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x);
+%! hold on;
+%! stem (x, x.^2, 'g');
+%! title ('First created object gets first label');
+%! legend ('linear');
+%! hold off;
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x, x, x.^2);
+%! title ('First created object gets first label');
+%! legend ('linear');
+
+%!demo
+%! clf;
+%! x = linspace (0, 10);
+%! plot (x, x, x, x.^2);
+%! title ('Labels are applied in order of object creation');
+%! legend ('linear', 'quadratic');
+
+%!demo
+%! clf;
+%! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
+%! bar (rand_2x3_data1);
+%! ylim ([0 1.0]);
+%! title ('legend() works for bar graphs (hggroups)');
+%! legend ({'1st Bar', '2nd Bar', '3rd Bar'});
+
+%!demo
+%! clf;
+%! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531];
+%! bar (rand_2x3_data2);
+%! ylim ([0 1.2]);
+%! title ('legend() works for bar graphs (hggroups)');
+%! legend ('1st Bar', '2nd Bar', '3rd Bar');
+%! legend right;
+
+%!demo
+%! clf;
+%! x = 0:0.1:7;
+%! h = plot (x,sin(x), x,cos(x), x,sin(x.^2/10), x,cos(x.^2/10));
+%! title ('Only the sin() objects have keylabels');
+%! legend (h([1, 3]), {'sin (x)', 'sin (x^2/10)'}, 'location', 'southwest');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin (x), ';sin (x);');
+%! hold all;
+%! plot (x, cos (x), ';cos (x);');
+%! hold off;
+%! title ('legend constructed from multiple plot calls');
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! plot (x, sin (x), ';sin (x);');
+%! hold all;
+%! plot (x, cos (x), ';cos (x);');
+%! hold off;
+%! title ('Specified label text overrides previous labels');
+%! legend ({'Sine', 'Cosine'}, 'location', 'northeastoutside');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! plot (x, rand (11));
+%! xlabel ('Indices');
+%! ylabel ('Random Values');
+%! title ('Legend ''off'' deletes the legend');
+%! legend (cellstr (num2str ((1:10)')), 'location', 'northeastoutside');
+%! legend off;
+%! axis ([0, 10, 0 1]);
+
+%!demo
+%! clf;
+%! x = (1:5)';
+%! subplot (2,2,1);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'northwestoutside');
+%! subplot (2,2,2);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'northeastoutside');
+%! subplot (2,2,3);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'southwestoutside');
+%! subplot (2,2,4);
+%!  plot (x, rand (numel (x)));
+%!  legend (cellstr (num2str (x)), 'location', 'southeastoutside');
+
+%!demo
+%! clf;
+%! plot (rand (2));
+%! title ('legend() will warn if extra labels are specified');
+%! legend ('Hello', 'World', 'interpreter', 'foobar');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #1: Blue and Green labels');
+%! legend ([h1, h2], {'Blue', 'Green'}, 'location', 'south');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #2: Blue and Green labels');
+%! legend ({'Blue', 'Green'}, 'location', 'south');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y1 = rand (size (x));
+%! y2 = rand (size (x));
+%! [ax, h1, h2] = plotyy (x, y1, x, y2);
+%! title ('plotyy legend test #3: Blue and Green labels');
+%! legend ('Blue', 'Green', 'location', 'south');
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northeastoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  legend ({'1234567890'}, 'location', 'eastoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  xlabel xlabel;
+%!  ylabel ylabel;
+%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northeastoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'eastoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southeastoutside');
+%!  legend (option);
+
+%!demo % bug 36408
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'yaxislocation', 'right');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 36408;
+%! clf;
+%! option = 'right';
+%! subplot (3,1,1);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  title ('Subplots should adjust to the legend placed outside');
+%!  legend ({'1'}, 'location', 'northwestoutside');
+%!  legend (option);
+%! subplot (3,1,2);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'1234567890'}, 'location', 'westoutside');
+%!  legend (option);
+%! subplot (3,1,3);
+%!  plot (rand (1,4));
+%!  set (gca (), 'xaxislocation', 'top');
+%!  xlabel ('xlabel');
+%!  ylabel ('ylabel');
+%!  legend ({'12345678901234567890'}, 'location', 'southwestoutside');
+%!  legend (option);
+
+%!demo % bug 39697
+%! clf;
+%! plot (1:10);
+%! legend ('Legend Text');
+%! title ({'Multi-line', 'titles', 'are a', 'problem'});
+
+%!demo
+%! clf;
+%! colormap (cool (64));
+%! surf (peaks ());
+%! legend ('peaks()')
+%! title ('legend() works for surface objects too');
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! h = figure ("visible", "off");
+%! unwind_protect
+%!   position = get (h, "position");
+%!   plot (rand (3));
+%!   legend ();
+%!   filename = sprintf ("%s.eps", tmpnam ());
+%!   print (filename);
+%!   unlink (filename);
+%!   assert (get (h, "position"), position);
+%! unwind_protect_cleanup
+%!   close (h);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,41 @@
+FCN_FILE_DIRS += plot/appearance
+
+plot_appearance_PRIVATE_FCN_FILES = \
+  plot/appearance/private/__axis_limits__.m \
+  plot/appearance/private/__axis_label__.m
+
+plot_appearance_FCN_FILES = \
+  plot/appearance/__clabel__.m \
+  plot/appearance/__getlegenddata__.m \
+  plot/appearance/axis.m \
+  plot/appearance/box.m \
+  plot/appearance/caxis.m \
+  plot/appearance/clabel.m \
+  plot/appearance/daspect.m \
+  plot/appearance/diffuse.m \
+  plot/appearance/grid.m \
+  plot/appearance/gtext.m \
+  plot/appearance/hidden.m \
+  plot/appearance/legend.m \
+  plot/appearance/orient.m \
+  plot/appearance/pbaspect.m \
+  plot/appearance/shading.m \
+  plot/appearance/specular.m \
+  plot/appearance/text.m \
+  plot/appearance/title.m \
+  plot/appearance/view.m \
+  plot/appearance/whitebg.m \
+  plot/appearance/xlabel.m \
+  plot/appearance/xlim.m \
+  plot/appearance/ylabel.m \
+  plot/appearance/ylim.m \
+  plot/appearance/zlabel.m \
+  plot/appearance/zlim.m \
+  $(plot_appearance_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_appearance_FCN_FILES)
+
+PKG_ADD_FILES += plot/appearance/PKG_ADD
+
+DIRSTAMP_FILES += plot/appearance/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/orient.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,126 @@
+## Copyright (C) 2001-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} orient (@var{orientation})
+## @deftypefnx {Function File} {} orient (@var{hfig}, @var{orientation})
+## @deftypefnx {Function File} {@var{orientation} =} orient ()
+## @deftypefnx {Function File} {@var{orientation} =} orient (@var{hfig})
+## Query or set the default print orientation.
+##
+## Valid values for @var{orientation} are @qcode{"landscape"},
+## @qcode{"portrait"}, and @qcode{"tall"}.
+##
+## The @qcode{"tall"} option sets the orientation to portrait and fills
+## the page with the plot, while leaving a 0.25 inch border.
+##
+## When called with no arguments, return the default print orientation.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on this
+## figure rather than the current figure returned by @code{gcf}.
+## @seealso{print, saveas}
+## @end deftypefn
+
+## Author: Paul Kienzle
+## Adapted-By: jwe
+
+function retval = orient (varargin)
+
+  nargs = nargin;
+
+  if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1}))
+    cf = varargin{1};
+    varargin(1) = [];
+    nargs--;
+  else
+    cf = gcf ();
+  endif
+
+  if (nargs == 0)
+    retval = get (cf, "paperorientation");
+  elseif (nargin == 1)
+    orientation = varargin{1};
+    if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait"))
+      if (! strcmpi (get (cf, "paperorientation"), orientation))
+        ## FIXME: with the proper listeners in place there won't be a need to
+        ##        set the papersize and paperpostion here.
+        papersize = get (cf, "papersize");
+        paperposition = get (cf, "paperposition");
+        set (cf, "paperorientation", orientation);
+        set (cf, "papersize", papersize([2, 1]));
+        set (cf, "paperposition", paperposition([2, 1, 4, 3]));
+      endif
+    elseif (strcmpi (varargin{1}, 'tall'))
+      orient ("portrait");
+      papersize = get (cf, "papersize");
+      set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]);
+    else
+      error ("orient: unknown ORIENTATION");
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!shared papersize, paperposition, tallpaperposition, hfig
+%! papersize = [8.5, 11];
+%! paperposition = [0.25, 2.5, 8, 6];
+%! tallpaperposition = [0.25, 0.25, (papersize-0.5)];
+%! hfig = figure ("visible", "off");
+%! set (hfig, "paperorientation", "portrait");
+%! set (hfig, "papersize", papersize);
+%! set (hfig, "paperposition", paperposition);
+
+%!test
+%! orient portrait;
+%! assert (orient, "portrait")   # default
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), paperposition);
+
+%!test
+%! orient landscape;
+%! assert (orient,"landscape")   # change to landscape
+%! assert (get (hfig, "papersize"), papersize([2, 1]));
+%! assert (get (hfig, "paperposition"), paperposition([2, 1, 4, 3]));
+
+%!test
+%! orient portrait   # change back to portrait
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), paperposition);
+
+%!test
+%! orient landscape;
+%! orient tall;
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), tallpaperposition);
+
+%!fail ("orient ('nobody')", "unknown ORIENTATION")
+
+%!test
+%! orient portrait   # errors don't change the state
+%! assert (orient, "portrait");
+%! assert (get (hfig, "papersize"), papersize);
+%! assert (get (hfig, "paperposition"), tallpaperposition);
+
+%!test
+%! close (hfig);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/pbaspect.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,122 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
+## @deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio})
+## @deftypefnx {Function File} {} pbaspect (@var{mode})
+## @deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
+## @deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
+##
+## Query or set the plot box aspect ratio of the current axes.
+##
+## The aspect ratio is a normalized 3-element vector representing the rendered
+## lengths of the x, y, and z axes.
+##
+## @code{pbaspect(@var{mode})}
+##
+## Set the plot box aspect ratio mode of the current axes.  @var{mode} is
+## either @qcode{"auto"} or @qcode{"manual"}.
+##
+## @code{pbaspect ("mode")}
+##
+## Return the plot box aspect ratio mode of the current axes.
+##
+## @code{pbaspect (@var{hax}, @dots{})}
+##
+## Operate on the axes in handle @var{hax} instead of the current axes.
+##
+## @seealso{axis, daspect, xlim, ylim, zlim}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-01-26
+
+function pbratio = pbaspect (varargin)
+
+  ## Grab axes handle if present
+  if (nargin > 0)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      varargin = varargin(2:end);
+    else
+      hax = gca ();
+    endif
+  else
+    hax = gca ();
+  endif
+
+  nargin = numel (varargin);
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    pbratio = get (hax, "plotboxaspectratio");
+  else
+    arg = varargin{1};
+    if (isreal (arg))
+      if (numel (arg) == 2)
+        set (hax, "plotboxaspectratio", [arg, 1]);
+      elseif (numel (arg) == 3)
+        set (hax, "plotboxaspectratio", arg);
+      else
+        error ("pbaspect: PLOT_BOX_ASPECT_RATIO must be a 2 or 3 element vector");
+      endif
+    elseif (ischar (arg))
+      arg = tolower (arg);
+      switch (arg)
+        case "auto"
+          set (hax, "plotboxaspectratiomode", "auto");
+        case "manual"
+          set (hax, "plotboxaspectratiomode", "manual");
+        case "mode"
+          pbratio = get (hax, "plotboxaspectratiomode");
+        otherwise
+          error ("pbaspect: Invalid mode <%s>", arg);
+      endswitch
+    else
+      print_usage ();
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! pbaspect ([1 1 1]);
+%! title ('plot box is square');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;;
+%! plot (x,cos(x), x,sin(x));
+%! pbaspect ([2 1 1]);
+%! title ('plot box aspect ratio is 2x1');
+
+%!demo
+%! clf;
+%! x = 0:0.01:4;
+%! plot (x,cos(x), x,sin(x));
+%! daspect ([1 1 1]);
+%! pbaspect ([2 1 1]);
+%! title ('plot box is 2x1, and axes [0 4 -1 1]');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/private/__axis_label__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,43 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __axis_label__ (@var{caller}, @var{h}, @var{txt}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = __axis_label__ (hax, caller, txt, varargin)
+
+  h = get (hax, caller);
+
+  set (h, "fontangle", get (hax, "fontangle"),
+          "fontname", get (hax, "fontname"),
+          "fontunits", get (hax, "fontunits"),   # must precede fontsize
+          "fontsize", get (hax, "fontsize"),
+          "fontweight", get (hax, "fontweight"),
+          "string", txt,
+          varargin{:});
+
+  if (nargout > 0)
+    retval = h;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/private/__axis_limits__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,58 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __axis_limits__ (@var{fcn}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function retval = __axis_limits__ (fcn, varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (fcn, varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  if (nargin == 0)
+    retval = get (hax, fcn);
+  else
+    retval = [];
+    fcnmode = [fcn "mode"];
+    arg = varargin{1};
+    if (ischar (arg))
+      if (strcmpi (arg, "mode"))
+        retval = get (hax, fcnmode);
+      elseif (any (strcmpi (arg, {"auto", "manual"})))
+        set (hax, fcnmode, arg);
+      endif
+    else
+      if (!isnumeric (arg) && any (size (arg(:)) != [2, 1]))
+        error ("%s: LIMITS must be a 2-element vector", fcn);
+      else
+        if (arg(1) >= arg(2))
+          error ("%s: axis limits must be increasing", fcn);
+        else
+          set (hax, fcn, arg(:));
+        endif
+      endif
+    endif
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/shading.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,142 @@
+## Copyright (C) 2006-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} shading (@var{type})
+## @deftypefnx {Function File} {} shading (@var{hax}, @var{type})
+## Set the shading of patch or surface graphic objects.
+##
+## Valid arguments for @var{type} are
+##
+## @table @asis
+## @item @qcode{"flat"}
+## Single colored patches with invisible edges.
+##
+## @item @qcode{"faceted"}
+## Single colored patches with visible edges.
+##
+## @item @qcode{"interp"}
+## Color between patch vertices are interpolated and the patch edges are
+## invisible.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{fill, mesh, patch, pcolor, surf, surface, hidden}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function shading (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("shading", varargin{:});
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  mode = varargin{1};
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  ## Find all patch and surface objects that are descendants of hax
+  ## and  which are not part of a contour plot hggroup.
+  hlist = [];
+  kids = get (hax, "children");
+  while (! isempty (kids))
+    types = get (kids, "type");
+    hlist = [hlist; kids(strcmp(types, "patch"))];
+    hlist = [hlist; kids(strcmp(types, "surface"))];
+    parents = kids(strcmp (types, "axes"));
+    hglist = kids(strcmp (types, "hggroup"));
+    for i = 1 : numel (hglist)
+      props = get (hglist(i));
+      if (! isfield (props, "levelstep"))
+        parents(end+1) = hglist(i); 
+      endif
+    endfor
+    kids = get (parents, "children");
+  endwhile
+
+  ## FIXME: This is the old, simple code.
+  ##        Unfortunately, it also shades contour plots which is not desirable.
+  ##hp = findobj (hax, "type", "patch");
+  ##hs = findobj (hax, "type", "surface");
+  ##hlist = [hp(:); hs(:)];
+
+  switch (lower (mode))
+    case "flat"
+      set (hlist, "facecolor", "flat");
+      set (hlist, "edgecolor", "none");
+    case "interp"
+      set (hlist, "facecolor", "interp");
+      set (hlist, "edgecolor", "none");
+    case "faceted"
+      set (hlist, "facecolor", "flat");
+      set (hlist, "edgecolor", [0 0 0]);
+    otherwise
+      error ('shading: Invalid MODE "%s"', mode);
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading faceted;
+%! title ('shading ''faceted''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading flat;
+%! title ('shading ''flat''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! shading interp;
+%! title ('shading ''interp''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading faceted;
+%! title ('shading ''faceted''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading flat;
+%! title ('shading ''flat''');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks ());
+%! shading interp;
+%! title ('shading ''interp''');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/specular.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,94 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv})
+## @deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se})
+## Calculate specular reflection strength of a surface defined by the normal
+## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation.
+##
+## The light source location and viewer location vectors can be specified using
+## parameter @var{lv} and @var{vv} respectively.  The location vectors can
+## given as 2-element vectors [azimuth, elevation] in degrees or as 3-element
+## vectors [x, y, z].
+##
+## An optional sixth argument describes the specular exponent (spread) @var{se}.
+## @seealso{diffuse, surfl}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = specular (sx, sy, sz, lv, vv, se)
+
+  if (nargin < 5 || nargin > 6)
+    print_usage ();
+  endif
+
+  ## Checks for specular exponent (se).
+  if (nargin < 6)
+    se = 10;
+  else
+    if (!isnumeric (se) || numel (se) != 1 || se <= 0)
+      error ("specular: exponent must be positive scalar");
+    endif
+  endif
+
+  ## Checks for normal vector.
+  if (!size_equal (sx, sy, sz))
+    error ("specular: SX, SY, and SZ must have same size");
+  endif
+
+  ## Check for light vector (lv) argument.
+  if (length (lv) < 2 || length (lv) > 3)
+    error ("specular: light vector LV must be a 2- or 3-element vector");
+  elseif (length (lv) == 2)
+    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
+  endif
+
+  ## Check for view vector (vv) argument.
+  if (length (vv) < 2 || length (lv) > 3)
+    error ("specular: view vector VV must be a 2- or 3-element vector");
+  elseif (length (vv) == 2)
+    [vv(1), vv(2), vv(3)] = sph2cart (vv(1) * pi / 180, vv(2) * pi / 180, 1.0);
+  endif
+
+  ## Normalize view and light vector.
+  if (sum (abs (lv)) > 0)
+    lv  /= norm (lv);
+  endif
+  if (sum (abs (vv)) > 0)
+    vv  /= norm (vv);
+  endif
+
+  ## Calculate normal vector lengths and dot-products.
+  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
+  l_dot_n = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
+  v_dot_n = (sx * vv(1) + sy * vv(2) + sz * vv(3)) ./ ns;
+
+  ## Calculate specular reflection using Phong's approximation.
+  retval = 2 * l_dot_n .* v_dot_n - dot (lv, vv);
+
+  ## Set zero if light is on the other side.
+  retval(l_dot_n < 0) = 0;
+
+  ## Allow postive values only.
+  retval(retval < 0) = 0;
+  retval = retval .^ se;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/text.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,338 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} text (@var{x}, @var{y}, @var{string})
+## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{string})
+## @deftypefnx {Function File} {} text (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} text (@dots{})
+## Create a text object with text @var{string} at position @var{x}, @var{y},
+## (@var{z}) on the current axes.
+##
+## Multiple locations can be specified if @var{x}, @var{y}, (@var{z}) are
+## vectors.  Multiple strings can be specified with a character matrix or
+## a cell array of strings.
+##
+## Optional property/value pairs may be used to control the appearance of the
+## text.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## created text objects.
+## @seealso{gtext, title, xlabel, ylabel, zlabel}
+## @end deftypefn
+
+## Author: jwe
+
+## Note: The following code is rigged for Matlab compatibility and is
+##       full of hidden assumptions.  Be very wary when modifying.
+
+function h = text (varargin)
+
+  nargs = nargin;
+  offset = 0;
+
+  if (nargs > 2 && isnumeric (varargin{1}) && isnumeric (varargin{2}))
+    x = varargin{1};
+    y = varargin{2};
+
+    if (nargin > 3 && isnumeric (varargin{3}))
+      z = varargin{3};
+      offset = 4;
+    else
+      z = zeros (size (x));
+      offset = 3;
+    endif
+
+    string = varargin{offset};
+    varargin(1:offset) = [];
+
+    nx = numel (x);
+    ny = numel (y);
+    nz = numel (z);
+    if (ischar (string))
+
+      do_keyword_repl = true;
+      nt = rows (string);
+      if (nx == 1 && nt == 1)
+        ## Single text object with one line
+        string = {string};
+      elseif (nx == 1 && nt > 1)
+        ## Single text object with multiple lines
+        ## FIXME: "default" or "factory" as first row
+        ##        should be escaped to "\default" or "\factory"
+        ##        Other rows do not require escaping.
+        do_keyword_repl = false;
+        string = {string};
+      elseif (nx > 1 && nt == nx)
+        ## Mutiple text objects with different strings
+        string = cellstr (string);
+      else 
+        ## Mutiple text objects with same string
+        string = repmat ({string}, [nx, 1]);
+        nt = nx;
+      endif
+
+      ## Escape special keywords
+      if (do_keyword_repl)
+        string = regexprep (string, '^(default|factory)$', '\\$1');
+      endif
+
+    elseif (iscell (string))
+
+      nt = numel (string);
+      if (nx == 1)      
+        ## Single text object with one or more lines
+        string = {string};
+        nt = 1;
+      elseif (nx > 1 && nt == nx)
+        ## Mutiple text objects with different strings
+      else
+        ## Mutiple text objects with same string
+        string = repmat ({string}, [nx, 1]);
+        nt = nx;
+      endif
+
+    else
+
+      error ("text: STRING must be a character string or cell array of character strings");
+
+    endif
+  else  # Only PROP/VALUE pairs
+    x = y = z = 0;
+    nx = ny = nz = 1;
+    string = {""};
+    nt = 1;
+  endif
+
+  ## Any remaining inputs must occur as PROPERTY/VALUE pairs
+  if (rem (numel (varargin), 2) != 0)
+    print_usage ();
+  endif
+
+  ## Get axis argument which may be in a 'parent' PROP/VAL pair
+  [hax, varargin] = __plt_get_axis_arg__ ("text", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  ## Position argument may alse be in PROP/VAL pair
+  idx = find (strcmpi (varargin, "position"), 1);
+  if (idx)
+    pos = varargin{idx+1};
+    varargin(idx:idx+1) = [];
+  else
+    pos = [x(:), y(:), z(:)];
+  endif
+
+  if (nx == ny && nx == nz && (nt == nx || nt == 1 || nx == 1))
+    htmp = zeros (nt, 1);
+    if (nx == 1)
+      htmp = __go_text__ (hax, "string", string{1},
+                               ## varargin first, in case "Units" set for pos.
+                               varargin{:},
+                               "position", pos);
+    elseif (nx == nt)
+      for n = 1:nt
+        htmp(n) = __go_text__ (hax, "string", string{n},
+                                    varargin{:},
+                                    "position", pos(n,:));
+      endfor
+      __request_drawnow__ ();
+    else
+      error ("text: dimension mismatch for coordinates and STRING");
+    endif
+  elseif (nt == nx || nt == 1 || nx == 1)
+    error ("text: dimension mismatch for coordinates");
+  else
+    error ("text: dimension mismatch between coordinates and strings");
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ha = {'left', 'center', 'right'};
+%! va = {'bottom', 'middle', 'top'};
+%! x = [0.25 0.5 0.75];
+%! y = x;
+%! for t = 0:30:359;
+%!   for nh = 1:numel (ha)
+%!     for nv = 1:numel (va)
+%!       text (x(nh), y(nv), 'Hello World', ...
+%!             'rotation', t, ...
+%!             'horizontalalignment', ha{nh}, ...
+%!             'verticalalignment', va{nv});
+%!     end
+%!   end
+%! end
+%! set (gca, 'xtick', [0.25, 0.5, 0.75], ...
+%!           'xticklabel', ha, ...
+%!           'ytick', [0.25, 0.5, 0.75], ...
+%!           'yticklabel', va);
+%! axis ([0 1 0 1]);
+%! xlabel ('horizontal alignment');
+%! ylabel ('vertical alignment');
+%! title ('text alignment and rotation (0:30:360 degrees)');
+
+%!demo
+%! clf;
+%! h = mesh (peaks, 'edgecolor', 0.7 * [1 1 1], ...
+%!                  'facecolor', 'none', ...
+%!                  'facealpha', 0);
+%! for t = 0:45:359;
+%!   text (25, 25, 0, 'Vertical Alignment = Bottom', ...
+%!                    'rotation', t, ...
+%!                    'horizontalalignment', 'left', ...
+%!                    'verticalalignment', 'bottom');
+%! end
+%! caxis ([-100 100]);
+%! title ('Vertically Aligned at Bottom');
+
+%!demo
+%! clf;
+%! axis ([0 8 0 8]);
+%! title (['1st title';'2nd title']);
+%! xlabel (['1st xlabel';'2nd xlabel']);
+%! ylabel (['1st ylabel';'2nd ylabel']);
+%! text (4, 4, {'Hello', 'World'}, ...
+%!       'horizontalalignment', 'center', ...
+%!       'verticalalignment', 'middle');
+%! grid on;
+
+%!demo
+%! clf;
+%! h = mesh (peaks (), 'edgecolor', 0.7 * [1 1 1], ...
+%!                     'facecolor', 'none', ...
+%!                     'facealpha', 0);
+%! title (['1st title';'2nd title']);
+%! xlabel (['1st xlabel';'2nd xlabel']);
+%! ylabel (['1st ylabel';'2nd ylabel']);
+%! zlabel (['1st zlabel';'2nd zlabel']);
+%! text (0, 0, 5, {'Hello', 'World'}, ...
+%!       'horizontalalignment', 'center', ...
+%!       'verticalalignment', 'middle');
+%! hold on;
+%! plot3 (0, 0, 5, '+k');
+
+%!demo
+%! clf;
+%! h = text (0.5, 0.3, 'char');
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.5, 0.4, ['char row 1'; 'char row 2']);
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.5, 0.6, {'cell2str (1,1)', 'cell2str (1,2)'; 'cell2str (2,1)', 'cell2str (2,2)'});
+%! assert ('cell', class (get (h, 'string')));
+%! h = text (0.5, 0.8, 'foobar');
+%! set (h, 'string', 1:3);
+%! h = text ([0.1, 0.1], [0.3, 0.4], 'one string & two objects');
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.5, 0.6], {'one cellstr & two objects'});
+%! assert ('cell', class (get (h(1), 'string')));
+%! assert ('cell', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr 1 object 1', 'cellstr 2 object 2'});
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text ([0.1, 0.1], [0.1, 0.2], ['1st string & 1st object'; '2nd string & 2nd object']);
+%! assert ('char', class (get (h(1), 'string')));
+%! assert ('char', class (get (h(2), 'string')));
+%! h = text (0.7, 0.6, 'single string');
+%! assert ('char', class (get (h, 'string')));
+%! h = text (0.7, 0.5, {'single cell-string'});
+%! assert ('cell', class (get (h, 'string')));
+%! xlabel (1:2);
+%! ylabel (1:2);
+%! title (1:2);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ## Single object with one line
+%!   h = text (0.5, 0.3, "single object with one line");
+%!   obs = get (h, "string");
+%!   assert (class (obs), "char");
+%!   assert (obs, "single object with one line");
+%!
+%!   ## Single object with multiple lines
+%!   h = text (0.5, 0.4, ["char row 1"; "char row 2"]);
+%!   obs = get (h, "string");
+%!   assert (class (obs), "char");
+%!   assert (obs, ["char row 1"; "char row 2"]);
+%!
+%!   ## Multiple objects with single line
+%!   h = text ([0.1, 0.1], [0.3, 0.4], "two objects with same string");
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "two objects with same string");
+%!   assert (get (h(2), "string"), "two objects with same string");
+%!
+%!   ## Multiple objects with multiple lines
+%!   h = text ([0.1, 0.1], [0.3, 0.4], ["string1"; "string2"]);
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "string1");
+%!   assert (get (h(2), "string"), "string2");
+%!
+%!   ### Tests repeated with cell input ###
+%!
+%!   ## Single object with one line
+%!   h = text (0.5, 0.3, {"single object with one line"});
+%!   obs = get (h, "string");
+%!   assert (class (obs), "cell");
+%!   assert (obs, {"single object with one line"});
+%!
+%!   ## Single object with multiple lines
+%!   h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)";
+%!                        "cell2str (2,1)", "cell2str (2,2)"});
+%!   obs = get (h, "string");
+%!   assert (class (obs), "cell");
+%!   assert (obs, {"cell2str (1,1)"; "cell2str (2,1)";
+%!                 "cell2str (1,2)"; "cell2str (2,2)"});
+%!
+%!   ## Multiple objects with single line
+%!   h = text ([0.1, 0.1], [0.5, 0.6], {"two objects with same cellstr"});
+%!   assert (class (get (h(1), "string")), "cell");
+%!   assert (class (get (h(2), "string")), "cell");
+%!   ## FIXME: is return value of cellstr, rather than string, Matlab-verified?
+%!   assert (get (h(1), "string"), {"two objects with same cellstr"});
+%!   assert (get (h(2), "string"), {"two objects with same cellstr"});
+%!
+%!   ## Multiple objects with multiple lines
+%!   h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr1", "cellstr2"});
+%!   ## FIXME: is return value really char in Matlab?
+%!   assert (class (get (h(1), "string")), "char");
+%!   assert (class (get (h(2), "string")), "char");
+%!   assert (get (h(1), "string"), "cellstr1");
+%!   assert (get (h(2), "string"), "cellstr2");
+%!
+%!   ## Test special keyword processing
+%!   h = text (0.5, 0.5, "default");
+%!   assert (get (h, "string"), "default")
+%!   h = text (0.5, 0.5, "factory");
+%!   assert (get (h, "string"), "factory")
+%!
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/title.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,112 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} title (@var{string})
+## @deftypefnx {Function File} {} title (@var{string}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} title (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} title (@dots{})
+## Specify the string used as a title for the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the appearance of the created title text object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, ylabel, zlabel, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = title (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("title", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "title", varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ax = axes ();
+%! h = get (ax, 'title');
+%! title ('Test Title Text');
+
+%!demo
+%! clf;
+%! ax = axes ();
+%! h = get (ax, 'title');
+%! title ({'Multi-line'; 'Title'; 'Text'});
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! h = get (gca, 'title');
+%! title ('Test FontSize Property', 'fontsize', 16);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ax = axes ();
+%!   h = get (ax, "title");
+%!   title ("Test Title Text");
+%!   assert (get (h, "string"), "Test Title Text");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ax = axes ();
+%!   h = get (ax, "title");
+%!   title ({'Multi-line'; 'Title'; 'Text'});
+%!   assert (get (h, "string"), {'Multi-line'; 'Title'; 'Text'});
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   h = get (gca, "title");
+%!   title ("Test FontSize Property", "fontsize", 16);
+%!   assert (get (h, "string"), "Test FontSize Property");
+%!   assert (get (h, "fontsize"), 16);
+
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/view.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,128 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} view (@var{azimuth}, @var{elevation})
+## @deftypefnx {Function File} {} view ([@var{azimuth} @var{elevation}])
+## @deftypefnx {Function File} {} view ([@var{x} @var{y} @var{z}])
+## @deftypefnx {Function File} {} view (2)
+## @deftypefnx {Function File} {} view (3)
+## @deftypefnx {Function File} {} view (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{azimuth}, @var{elevation}] =} view ()
+## Query or set the viewpoint for the current axes.
+##
+## The parameters @var{azimuth} and @var{elevation} can be given as two
+## arguments or as 2-element vector.  The viewpoint can also be specified with
+## Cartesian coordinates @var{x}, @var{y}, and @var{z}.
+##
+## The call @code{view (2)} sets the viewpoint to @w{@var{azimuth} = 0}
+## and @w{@var{elevation} = 90}, which is the default for 2-D graphs.
+##
+## The call @code{view (3)} sets the viewpoint to @w{@var{azimuth} = -37.5}
+## and @w{@var{elevation} = 30}, which is the default for 3-D graphs.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## If no inputs are given, return the current @var{azimuth} and @var{elevation}.
+## @end deftypefn
+
+## Author: jwe
+
+function [azimuth, elevation] = view (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("view", varargin{:});
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  if (nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    x = get (hax, "view");
+    az = x(1);
+    el = x(2);
+  elseif (length (varargin) == 1)
+    x = varargin{1};
+    if (length (x) == 2)
+      az = x(1);
+      el = x(2);
+    elseif (length (x) == 3)
+      [az, el] = cart2sph (x(1), x(2), x(3));
+      az *= 180/pi;
+      az += 90;
+      el *= 180/pi;
+    elseif (x == 2)
+      az = 0;
+      el = 90;
+    elseif (x == 3)
+      az = -37.5;
+      el = 30;
+    else
+      print_usage ();
+    endif
+  elseif (length (varargin) == 2)
+    az = varargin{1};
+    el = varargin{2};
+  endif
+
+  if (nargin > 0)
+    set (hax, "view", [az, el]);
+  else
+    if (nargout == 1)
+      azimuth = [az, el];
+    elseif (nargout == 2)
+      azimuth = az;
+      elevation = el;
+    endif
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   [az, el] = view;
+%!   assert ([az, el], [-37.5, 30], eps);
+%!   view (2);
+%!   [az, el] = view;
+%!   assert ([az, el], [0, 90], eps);
+%!   view ([1 1 0]);
+%!   [az, el] = view;
+%!   assert ([az, el], [135, 0], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   line;
+%!   [az, el] = view;
+%!   assert ([az, el], [0, 90], eps);
+%!   view (3);
+%!   [az, el] = view;
+%!   assert ([az, el], [-37.5, 30], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/whitebg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,167 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} whitebg ()
+## @deftypefnx {Function File} {} whitebg (@var{color})
+## @deftypefnx {Function File} {} whitebg ("none")
+## @deftypefnx {Function File} {} whitebg (@var{hfig}, @dots{})
+## Invert the colors in the current color scheme.
+##
+## The root properties are also inverted such that all subsequent plot use the
+## new color scheme.
+##
+## If the optional argument @var{color} is present then the background color
+## is set to @var{color} rather than inverted.  @var{color} may be a string
+## representing one of the eight known colors or an RGB triplet.  The special
+## string argument @qcode{"none"} restores the plot to the default colors.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on
+## this figure rather than the current figure returned by @code{gcf}.  The
+## root properties will not be changed.
+## @seealso{reset, get, set}
+## @end deftypefn
+
+function whitebg (varargin)
+  h = 0;
+  color = NaN;
+
+  if (nargin > 0 && nargin < 3)
+    if (ishandle (varargin{1}))
+      h = varargin{1};
+      if (nargin == 2)
+        color = varargin{2};
+      endif
+    elseif (nargin == 1)
+      color = varargin{1};
+    else
+      print_usage ();
+    endif
+  elseif (nargin != 0)
+    print_usage ();
+  endif
+
+  typ = get (h, "type");
+
+  if (strcmp (typ, "root"))
+    isroot = true;
+    fig = gcf ();
+  elseif (strcmp (typ, "figure"))
+    isroot = false;
+    fig = h;
+  else
+    error ("expecting a figure handle");
+  endif
+
+  axes = findall (fig, "type", "axes");
+  if (isnan (color))
+    ## Root figure. Set the default axes and figure properties so that
+    ## subsequent plots have the new color scheme
+    if (isroot)
+      fac = get (0, "factory");
+      fields = fieldnames (fac);
+      fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*')))));
+
+      ## Check whether the factory value has been replaced
+      for nf = 1 : numel (fieldindex);
+        defaultfield = strrep (fields {fieldindex (nf)}, "factory", "default");
+        try
+          defaultvalue = 1 - get (0, defaultfield {n});
+        catch
+          field = fields {fieldindex (nf)};
+          defaultvalue = 1 - subsref (fac, struct ("type", ".", "subs", field));
+        end_try_catch
+        set (0, defaultfield, defaultvalue);
+      endfor
+    endif
+
+    ## Load all objects which qualify for being searched.
+    handles = fig;
+    h = fig;
+    while (numel (handles))
+      children = [];
+      for n = 1 : numel (handles)
+        children = union (children, get (handles(n), "children"));
+      endfor
+      handles = children;
+      h = union (h, children);
+    endwhile
+
+    for nh = 1 : numel (h)
+      p = get (h (nh));
+      fields = fieldnames (p);
+      fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
+      if (numel (fieldindex))
+        for nf = 1 : numel (fieldindex);
+          field = fields {fieldindex (nf)};
+          c = subsref (p, struct ("type", ".", "subs", field));
+          if (! ischar (c) && columns (c) == 3)
+            set (h (nh), field, 1 - c);
+          endif
+        endfor
+      endif
+
+      ## If h(nh) is a figure or axes invert default color properties
+      typ = subsref (p, struct ("type", ".", "subs", "type"));
+      if (strcmp (typ, "axes") || strcmp (typ, "figure"))
+        def = get (h (nh), "default");
+        fields = fieldnames (def);
+        if (! isempty (fields))
+          fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
+          for nf = 1 : numel (fieldindex)
+            defaultfield = fields {fieldindex (nf)};
+            defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield));
+            set (h (nh), defaultfield, defaultvalue);
+          endfor
+        endif
+      endif
+    endfor
+  else
+    ## FIXME
+    ## Is this the right thing to do in this case?
+    set (findall (fig, "type", "axes"), "color", color);
+    if (isroot)
+      defs = get (0, "default");
+      if (isfield (defs, "defaultaxescolor")
+          && strcmp (defs.defaultaxescolor, "none"))
+        set (0, "defaultaxescolor", color);
+      endif
+    endif
+  endif
+endfunction
+
+
+%!test
+%! dac = get (0, "defaultaxescolor");
+%! dfc = get (0, "defaultfigurecolor");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   assert (get (hf, "color"), dfc);
+%!   assert (get (gca, "color"), dac);
+%!   whitebg (hf);
+%!   assert (get (hf, "color"), 1 - dfc);
+%!   assert (get (gca, "color"), 1 - dac);
+%!   c = [0.2 0.2 0.2];
+%!   whitebg (hf, c);
+%!   assert (get (hf, "color"), 1 - dfc);
+%!   assert (get (gca, "color"), c);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/xlabel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,73 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} xlabel (@var{string})
+## @deftypefnx {Function File} {} xlabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} xlabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
+## Specify the string used to label the x-axis of the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{ylabel, zlabel, datetick, title, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = xlabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "xlabel", varargin{1},
+                         "color", get (hax, "xcolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   x = xlabel ("xlabel_string", "color", "r");
+%!   assert (get (gca, "xlabel"), x);
+%!   assert (get (x, "type"), "text");
+%!   assert (get (x, "visible"), "on");
+%!   assert (get (x, "string"), "xlabel_string");
+%!   assert (get (x, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/xlim.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,100 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{xlimits} =} xlim ()
+## @deftypefnx {Function File} {@var{xmode} =} xlim ("mode")
+## @deftypefnx {Function File} {} xlim ([@var{x_lo} @var{x_hi}])
+## @deftypefnx {Function File} {} xlim ("auto")
+## @deftypefnx {Function File} {} xlim ("manual")
+## @deftypefnx {Function File} {} xlim (@var{hax}, @dots{})
+## Query or set the limits of the x-axis for the current plot.
+##
+## Called without arguments @code{xlim} returns the x-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## x-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{x_lo} @var{x_hi}], the limits of the
+## x-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{ylim, zlim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = xlim (varargin)
+  ret = __axis_limits__ ("xlim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! xlim ([0.2, 0.8]);
+%! title ('xlim is [0.2, 0.8]');
+%! assert (xlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! xlim ('auto');
+%! title ('xlim is auto');
+%! assert (xlim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! xlim ([0.2, 0.8]);
+%! title ('xlim is [0.2, 0.8]');
+%! assert (xlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! xlim ('auto');
+%! title ('xlim is auto');
+%! assert (xlim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   xlim ([0, 1.1]);
+%!   assert (get (gca, "xlim"), [0, 1.1], eps);
+%!   assert (xlim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot3 ([0,1.1], [0,1], [0, 1]);
+%!   assert (get (gca, "xlim"), [0, 1.4], eps);
+%!   assert (xlim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/ylabel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,75 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ylabel (@var{string})
+## @deftypefnx {Function File} {} ylabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} ylabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ylabel (@dots{})
+## Specify the string used to label the y-axis of the current axis.
+##
+## If @var{hax} is specified then label the axis defined by @var{hax}.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, zlabel, datetick, title, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = ylabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ylabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "ylabel", varargin{1},
+                         "color", get (hax, "ycolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   y = ylabel ("ylabel_string", "color", "r");
+%!   assert (get (gca, "ylabel"), y);
+%!   assert (get (y, "type"), "text");
+%!   assert (get (y, "visible"), "on");
+%!   assert (get (y, "string"), "ylabel_string");
+%!   assert (get (y, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/ylim.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,101 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{ylimits} =} ylim ()
+## @deftypefnx {Function File} {@var{xmode} =} ylim ("mode")
+## @deftypefnx {Function File} {} ylim ([@var{y_lo} @var{y_hi}])
+## @deftypefnx {Function File} {} ylim ("auto")
+## @deftypefnx {Function File} {} ylim ("manual")
+## @deftypefnx {Function File} {} ylim (@var{hax}, @dots{})
+## Query or set the limits of the y-axis for the current plot.
+##
+## Called without arguments @code{ylim} returns the y-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## y-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{y_lo} @var{y_hi}], the limits of the
+## y-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{xlim, zlim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = ylim (varargin)
+  ret = __axis_limits__ ("ylim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! ylim ([0.2, 0.8]);
+%! title ('ylim is [0.2, 0.8]');
+%! assert (ylim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! ylim ('auto');
+%! title ('ylim is auto');
+%! assert (ylim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! ylim ([0.2, 0.8]);
+%! title ('ylim is [0.2, 0.8]');
+%! assert (ylim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! ylim ('auto');
+%! title ('ylim is auto');
+%! assert (ylim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   limy = [0, 1.1];
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   ylim (limy);
+%!   assert (get (gca, "ylim"), limy, eps);
+%!   assert (ylim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1.1], [0, 1]);
+%!   assert (get (gca, "ylim"), [0, 1.4], eps);
+%!   assert (ylim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/zlabel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,84 @@
+## Copyright (C) 1995-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} zlabel (@var{string})
+## @deftypefnx {Function File} {} zlabel (@var{string}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} zlabel (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} zlabel (@dots{})
+## Specify the string used to label the z-axis of the current axis.
+##
+## An optional list of @var{property}/@var{value} pairs can be used to change
+## the properties of the created text label.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created text
+## object.
+## @seealso{xlabel, ylabel, datetick, title, text}
+## @end deftypefn
+## Author: jwe
+
+function h = zlabel (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("zlabel", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  if (rem (nargin, 2) != 1)
+    print_usage ();
+  endif
+
+  htmp = __axis_label__ (hax, "zlabel", varargin{1},
+                         "color", get (hax, "zcolor"), varargin{2:end});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   z = zlabel ("zlabel_string", "color", "r");
+%!   assert (get (gca, "zlabel"), z);
+%!   assert (get (z, "type"), "text");
+%!   assert (get (z, "visible"), "off");
+%!   assert (get (z, "string"), "zlabel_string");
+%!   assert (get (z, "color"), [1 0 0]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! plot3 (0, 0, 0);
+%! unwind_protect
+%!   z = zlabel ("zlabel_string");
+%!   assert (get (gca, "zlabel"), z);
+%!   assert (get (z, "type"), "text");
+%!   assert (get (z, "string"), "zlabel_string");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/appearance/zlim.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,101 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{zlimits} =} zlim ()
+## @deftypefnx {Function File} {@var{xmode} =} zlim ("mode")
+## @deftypefnx {Function File} {} zlim ([@var{z_lo} @var{z_hi}])
+## @deftypefnx {Function File} {} zlim ("auto")
+## @deftypefnx {Function File} {} zlim ("manual")
+## @deftypefnx {Function File} {} zlim (@var{hax}, @dots{})
+## Query or set the limits of the z-axis for the current plot.
+##
+## Called without arguments @code{zlim} returns the z-axis limits of the
+## current plot.  With the input query @qcode{"mode"}, return the current
+## z-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
+##
+## If passed a 2-element vector [@var{z_lo} @var{z_hi}], the limits of the
+## x-axis are set to these values and the mode is set to @qcode{"manual"}.
+##
+## The current plotting mode can be changed by using either @qcode{"auto"}
+## or @qcode{"manual"} as the argument.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{xlim, ylim, axis, set, get, gca}
+## @end deftypefn
+
+function retval = zlim (varargin)
+  ret = __axis_limits__ ("zlim", varargin{:});
+
+  if (! isempty (ret))
+    retval = ret;
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! line ();
+%! zlim ([0.2, 0.8]);
+%! title ('zlim is [0.2, 0.8]');
+%! assert (zlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! line ();
+%! zlim ('auto');
+%! title ('zlim is auto');
+%! assert (zlim ('mode'), 'auto');
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! zlim ([0.2, 0.8]);
+%! title ('zlim is [0.2, 0.8]');
+%! assert (zlim (), [0.2, 0.8]);
+
+%!demo
+%! clf;
+%! plot3 ([0,1], [0,1], [0,1]);
+%! zlim ('auto');
+%! title ('zlim is auto');
+%! assert (zlim ('mode'), 'auto');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   limz = [0, 1.1];
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   zlim (limz);
+%!   assert (get (gca, "zlim"), limz, eps);
+%!   assert (zlim ("mode"), "manual");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0, 1.1]);
+%!   assert (get (gca, "zlim"), [0, 1.4], eps);
+%!   assert (zlim ("mode"), "auto");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- a/scripts/plot/area.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-## Copyright (C) 2007-2009 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} area (@var{y})
-## @deftypefnx {Function File} {} area (@var{x}, @var{y})
-## @deftypefnx {Function File} {} area (@dots{}, @var{lvl})
-## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {} area (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} area (@dots{})
-## Area plot of the columns of @var{y}.  This shows the
-## contributions of each column value to the row sum.  It is functionally
-## similar to @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the
-## area under the curve is shaded.
-##
-## If the @var{x} argument is omitted it defaults to 
-## @code{1 : rows (@var{y})}.  A value @var{lvl} can be defined that determines
-## where the base level of the shading under the curve should be defined.  The
-## default level is 0.
-##
-## Additional arguments to the @code{area} function are passed directly to
-## @code{patch}.  
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## object representing the area patch objects.  The "BaseValue" property
-## of the hggroup can be used to adjust the level where shading begins.
-##
-## Example: Verify identity sin^2 + cos^2 = 1
-##
-## @example
-## @group
-## t = linspace (0, 2*pi, 100)';
-## y = [sin(t).^2, cos(t).^2)];
-## area (t, y);
-## legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');  
-## @end group
-## @end example
-## @seealso{plot, patch}
-## @end deftypefn
-
-function h = area (varargin)
-
-  [ax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
-
-  if (nargin == 0)
-    print_usage ();
-  endif
-
-  idx = 1;
-  x = y = [];
-  bv = 0;
-  args = {};
-  ## Check for (X) or (X,Y) arguments and possible base value.
-  if (nargin >= idx && ismatrix (varargin{idx}))
-    y = varargin{idx};
-    idx++;
-    if (nargin >= idx)
-      if (isscalar (varargin{idx}))
-        bv = varargin{idx};
-        idx++;
-      elseif (ismatrix (varargin{idx}))
-        x = y;
-        y = varargin{idx};
-        idx++;
-        if (nargin >= idx && isscalar (varargin{idx}))
-          bv = varargin{idx};
-          idx++;
-        endif
-      endif
-    endif
-  else
-    print_usage ();
-  endif
-  ## Check for additional args.
-  if (nargin >= idx)
-    args = {varargin{idx:end}};
-  endif
-  newplot ();
-  if (isvector (y))
-    y = y(:);
-  endif
-  if (isempty (x))
-    x = repmat ([1:rows(y)]', 1, columns (y));
-  elseif (isvector (x))
-    x = repmat (x(:),  1, columns (y));
-  endif
-
-  oldax = gca ();
-  unwind_protect
-    axes (ax);
-    tmp = __area__ (ax, x, y, bv, args{:});
-  unwind_protect_cleanup
-    axes (oldax);
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-function retval = __area__ (ax, x, y, bv, varargin)
-
-  y0 = bv * ones (1, rows (y));
-  y0 = zeros (1, rows (y));
-  retval = [];
-  for i = 1: columns (y);
-    hg = hggroup ();
-    retval = [retval; hg];
-    args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:});
-
-    x1 = x(:, 1).';
-    y1 = y (:, i).';
-    addproperty ("xdata", hg, "data", x1);
-    addproperty ("ydata", hg, "data", y1);
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-
-    if (i == 1)
-      h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))],
-                 __next_line_color__ (), "parent", hg);
-    else
-      y1 = y0 + y1;
-      h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)],
-                 __next_line_color__ (), "parent", hg);
-    endif
-
-    y0 = y1;
-
-    addproperty ("basevalue", hg, "data", bv);
-    addlistener (hg, "basevalue", @move_baseline);
-
-    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-
-    addlistener (hg, "edgecolor", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "facecolor", @update_props);
-
-    addproperty ("areagroup", hg, "data");
-    set (retval, "areagroup", retval);
-
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-  endfor
-
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids, "edgecolor", get (h, "edgecolor"),
-             "linewidth", get (h, "linewidth"),
-             "linestyle", get (h, "linestyle"),
-             "facecolor", get (h, "facecolor"));
-endfunction
-
-function move_baseline (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "areagroup");
-      b0 = get (h, "basevalue");
-
-      for hh = hlist(:)'
-        if (hh != h)
-          b1 = get (hh, "basevalue");
-          if (b1 != b0)
-            set (hh, "basevalue", b0);
-          endif
-        endif
-      endfor
-      update_data (h, d);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_data (h, d)
-  hlist = get (h, "areagroup");
-  bv = get (h, "basevalue");
-  for i = 1 : length (hlist)
-    hh = hlist(i);
-    x1 = get (hh, "xdata")(:);
-    y1 = get (hh, "ydata")(:);
-
-    set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]);
-    if (i == 1)
-      set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]);
-    else
-      y1 = y0 + y1;
-      set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]);
-    endif
-
-    y0 = y1;
-  endfor
-endfunction
-
-
-%!demo
-%! # Verify identity sin^2 + cos^2 = 1
-%! clf;
-%! t = linspace (0, 2*pi, 100)';
-%! y = [sin(t).^2, cos(t).^2];
-%! area (t, y);
-%! legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');  
-
-%!demo
-%! # Show effects of setting BaseValue
-%! clf;
-%! x = [-2:0.1:2]';
-%! y = x.^2 - 1;
-%! subplot (1, 2, 1)
-%! area (x, y);
-%! title ({'Parabola y = x^2 -1';'BaseValue = 0'});
-%! subplot (1, 2, 2)
-%! h = area (x, y);
-%! set (h, 'basevalue', -1);
-%! title ({'Parabola y = x^2 -1';'BaseValue = -1'});
-
--- a/scripts/plot/axes.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} axes ()
-## @deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} axes (@var{h})
-## Create an axes object and return a handle to it.
-## @end deftypefn
-
-## Author: jwe
-
-function h = axes (varargin)
-
-  if (nargin == 0 || nargin > 1)
-    ## Create an axes object.
-    idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first");
-    if (! isempty (idx) && length (varargin) >= 2*idx)
-      cf = varargin{2*idx};
-      varargin([2*idx-1, 2*idx]) = [];
-    else
-      cf = gcf ();
-    endif
-    tmp = __go_axes__ (cf, varargin{:});
-    if (__is_handle_visible__ (tmp))
-      set (ancestor (cf, "figure"), "currentaxes", tmp);
-    endif
-  else
-    ## arg is axes handle.
-    tmp = varargin{1};
-    if (length (tmp) == 1 && ishandle (tmp)
-        && strcmp (get (tmp, "type"), "axes"))
-      if (__is_handle_visible__ (tmp))
-        parent = ancestor (tmp, "figure");
-        set (0, "currentfigure", parent);
-        set (parent, "currentaxes", tmp);
-      endif
-    else
-      error ("axes: expecting argument to be a scalar axes handle");
-    endif
-  endif
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
--- a/scripts/plot/axis.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,588 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} axis ()
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi])
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi])
-## @deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi @var{z}_lo @var{z}_hi])
-## @deftypefnx {Function File} {} axis (@var{option})
-## @deftypefnx {Function File} {} axis (@dots{}, @var{option})
-## @deftypefnx {Function File} {} axis (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{limits} =} axis ()
-## Set axis limits for plots.
-##
-## The argument @var{limits} should be a 2-, 4-, or 6-element vector.  The
-## first and second elements specify the lower and upper limits for the
-## x-axis.  The third and fourth specify the limits for the y-axis, and the
-## fifth and sixth specify the limits for the z-axis.
-##
-## Without any arguments, @code{axis} turns autoscaling on.
-##
-## With one output argument, @code{x = axis} returns the current axes.
-##
-## The vector argument specifying limits is optional, and additional
-## string arguments may be used to specify various axis properties.  For
-## example,
-##
-## @example
-## axis ([1, 2, 3, 4], "square");
-## @end example
-##
-## @noindent
-## forces a square aspect ratio, and
-##
-## @example
-## axis ("tic", "labely");
-## @end example
-##
-## @noindent
-## turns tic marks on for all axes and tic mark labels on for the y-axis
-## only.
-##
-## @noindent
-## The following options control the aspect ratio of the axes.
-##
-## @table @asis
-## @item "square"
-## Force a square aspect ratio.
-##
-## @item "equal"
-## Force x distance to equal y-distance.
-##
-## @item "normal"
-## Restore the balance.
-## @end table
-##
-## @noindent
-## The following options control the way axis limits are interpreted.
-##
-## @table @asis
-## @item "auto"
-## Set the specified axes to have nice limits around the data
-## or all if no axes are specified.
-##
-## @item "manual"
-## Fix the current axes limits.
-##
-## @item "tight"
-## Fix axes to the limits of the data.
-## @end table
-##
-## @noindent
-## The option @code{"image"} is equivalent to @code{"tight"} and
-## @code{"equal"}.
-##
-## @noindent
-## The following options affect the appearance of tic marks.
-##
-## @table @asis
-## @item "on"
-## Turn tic marks and labels on for all axes.
-##
-## @item "off"
-## Turn tic marks off for all axes.
-##
-## @item "tic[xyz]"
-## Turn tic marks on for all axes, or turn them on for the
-## specified axes and off for the remainder.
-##
-## @item "label[xyz]"
-## Turn tic labels on for all axes, or turn them on for the
-## specified axes and off for the remainder.
-##
-## @item "nolabel"
-## Turn tic labels off for all axes.
-## @end table
-##
-## Note, if there are no tic marks for an axis, there can be no labels.
-##
-## @noindent
-## The following options affect the direction of increasing values on
-## the axes.
-##
-## @table @asis
-## @item "ij"
-## Reverse y-axis, so lower values are nearer the top.
-##
-## @item "xy"
-## Restore y-axis, so higher values are nearer the top.
-## @end table
-##
-## If an axes handle is passed as the first argument, then operate on
-## this axes rather than the current axes.
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = axis (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    varargout = cell (max (nargin == 0, nargout), 1);
-    if (isempty (varargout))
-      __axis__ (h, varargin{:});
-    else
-      [varargout{:}] = __axis__ (h, varargin{:});
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-function curr_axis = __axis__ (ca, ax, varargin)
-
-  if (nargin == 1)
-    if (nargout == 0)
-      set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
-    else
-      xlim = get (ca, "xlim");
-      ylim = get (ca, "ylim");
-      view = get (ca, "view");
-      if (view(2) == 90)
-        curr_axis = [xlim, ylim];
-      else
-        zlim = get (ca, "zlim");
-        curr_axis = [xlim, ylim, zlim];
-      endif
-    endif
-
-  elseif (ischar (ax))
-    len = length (ax);
-
-    ## 'matrix mode' to reverse the y-axis
-    if (strcmpi (ax, "ij"))
-      set (ca, "ydir", "reverse");
-    elseif (strcmpi (ax, "xy"))
-      set (ca, "ydir", "normal");
-
-      ## aspect ratio
-    elseif (strcmpi (ax, "image"))
-      __axis__ (ca, "equal");
-      __do_tight_option__ (ca);
-    elseif (strcmpi (ax, "square"))
-      set (ca, "plotboxaspectratio", [1, 1, 1]);
-    elseif (strcmp (ax, "equal"))
-      if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot"))
-        ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
-        set (ca, "activepositionproperty", "position");
-        ## The following line is a trick used to trigger the recalculation of
-        ## aspect related magnitudes even if the aspect ratio is the same
-        ## (useful with the x11 gnuplot terminal after a window resize)
-        set (ca, "dataaspectratiomode", "auto");
-      endif
-      set (ca, "dataaspectratio", [1, 1, 1]);
-    elseif (strcmpi (ax, "normal"))
-      set (ca, "plotboxaspectratio", [1, 1, 1]);
-      set (ca, "plotboxaspectratiomode", "auto");
-
-      ## axis limits
-    elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
-      if (len > 4)
-        if (any (ax == "x"))
-          set (ca, "xlimmode", "auto");
-        endif
-        if (any (ax == "y"))
-          set (ca, "ylimmode", "auto");
-        endif
-        if (any (ax == "z"))
-          set (ca, "zlimmode", "auto");
-        endif
-      else
-        set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
-      endif
-    elseif (strcmpi (ax, "manual"))
-      ## fixes the axis limits, like axis(axis) should;
-      set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
-    elseif (strcmpi (ax, "tight"))
-      ## sets the axis limits to the min and max of all data.
-      __do_tight_option__ (ca);
-      ## tic marks
-    elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
-      set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
-      if (strcmpi (ax, "on"))
-        set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
-           "zticklabelmode", "auto");
-      endif
-      set (ca, "visible", "on");
-    elseif (strcmpi (ax, "off"))
-      set (ca, "xtick", [], "ytick", [], "ztick", []);
-      set (ca, "visible", "off");
-    elseif (len > 3 && strcmpi (ax(1:3), "tic"))
-      if (any (ax == "x"))
-        set (ca, "xtickmode", "auto");
-      else
-        set (ca, "xtick", []);
-      endif
-      if (any (ax == "y"))
-        set (ca, "ytickmode", "auto");
-      else
-        set (ca, "ytick", []);
-      endif
-      if (any (ax == "z"))
-        set (ca, "ztickmode", "auto");
-      else
-        set (ca, "ztick", []);
-      endif
-    elseif (strcmpi (ax, "label"))
-      set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
-           "zticklabelmode", "auto");
-    elseif (strcmpi (ax, "nolabel"))
-      set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
-    elseif (len > 5 && strcmpi (ax(1:5), "label"))
-      if (any (ax == "x"))
-        set (ca, "xticklabelmode", "auto");
-      else
-        set (ca, "xticklabel", "");
-      endif
-      if (any (ax == "y"))
-        set (ca, "yticklabelmode", "auto");
-      else
-        set (ca, "yticklabel", "");
-      endif
-      if (any (ax == "z"))
-        set (ca, "zticklabelmode", "auto");
-      else
-        set (ca, "zticklabel", "");
-      endif
-
-    else
-      warning ("unknown axis option '%s'", ax);
-    endif
-
-  elseif (isvector (ax))
-
-    len = length (ax);
-
-    if (len != 2 && len != 4 && len != 6)
-      error ("axis: expecting vector with 2, 4, or 6 elements");
-    endif
-
-    for i = 1:2:len
-      if (ax(i) >= ax(i+1))
-        error ("axis: limits(%d) must be less than limits(%d)", i, i+1);
-      endif
-    endfor
-
-    if (len > 1)
-      set (ca, "xlim", [ax(1), ax(2)]);
-    endif
-
-    if (len > 3)
-      set (ca, "ylim", [ax(3), ax(4)]);
-    endif
-
-    if (len > 5)
-      set (ca, "zlim", [ax(5), ax(6)]);
-    endif
-
-  else
-    error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
-  endif
-
-  if (! isempty (varargin))
-    __axis__ (ca, varargin{:});
-  endif
-
-endfunction
-
-function lims = __get_tight_lims__ (ca, ax)
-
-  ## Get the limits for axis ("tight").
-  ## AX should be one of "x", "y", or "z".
-  kids = findobj (ca, "-property", strcat (ax, "data"));
-  ## The data properties for hggroups mirror their children.
-  ## Exclude the redundant hgroup values.
-  hg_kids = findobj (kids, "type", "hggroup");
-  kids = setdiff (kids, hg_kids);
-  if (isempty (kids))
-    ## Return the current limits.
-    lims = get (ca, strcat (ax, "lim"));
-  else
-    data = get (kids, strcat (ax, "data"));
-    scale = get (ca, strcat (ax, "scale"));
-    if (! iscell (data))
-      data = {data};
-    endif
-    if (strcmp (scale, "log"))
-      tmp = data;
-      data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false);
-      n = cellfun (@isempty, data);
-      data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false);
-    endif
-    data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false);
-    data = data(! cellfun ("isempty", data));
-    if (! isempty (data))
-      lims_min = min (cellfun (@(x) min (x(:)), data(:)));
-      lims_max = max (cellfun (@(x) max (x(:)), data(:)));
-      lims = [lims_min, lims_max];
-    else
-      lims = [0, 1];
-    endif
-  endif
-
-endfunction
-
-function __do_tight_option__ (ca)
-
-  set (ca,
-       "xlim", __get_tight_lims__ (ca, "x"),
-       "ylim", __get_tight_lims__ (ca, "y"));
-  if (__calc_dimensions__ (ca) > 2)
-    set (ca, "zlim", __get_tight_lims__ (ca, "z"));
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (221);
-%!  plot (t, x);
-%!  title ('normal plot');
-%!
-%! subplot (222);
-%!  plot (t, x);
-%!  title ('square plot');
-%!  axis ('square');
-%!
-%! subplot (223);
-%!  plot (t, x);
-%!  title ('equal plot');
-%!  axis ('equal');
-%!
-%! subplot (224);
-%!  plot (t, x);
-%!  title ('normal plot again');
-%!  axis ('normal');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (121);
-%!  plot (t, x);
-%!  title ('ij plot');
-%!  axis ('ij');
-%!
-%! subplot (122);
-%!  plot (t, x);
-%!  title ('xy plot');
-%!  axis ('xy');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (331);
-%!  plot (t, x);
-%!  title ('x tics and labels');
-%!  axis ('ticx');
-%!
-%! subplot (332);
-%!  plot (t, x);
-%!  title ('y tics and labels');
-%!  axis ('ticy');
-%!
-%! subplot (333);
-%!  plot (t, x);
-%!  title ('axis off');
-%!  axis ('off');
-%!
-%! subplot (334);
-%!  plot (t, x);
-%!  title ('x and y tics, x labels');
-%!  axis ('labelx','tic');
-%!
-%! subplot (335);
-%!  plot (t, x);
-%!  title ('x and y tics, y labels');
-%!  axis ('labely','tic');
-%!
-%! subplot (336);
-%!  plot (t, x);
-%!  title ('all tics but no labels');
-%!  axis ('nolabel','tic');
-%!
-%! subplot (337);
-%!  plot (t, x);
-%!  title ('x tics, no labels');
-%!  axis ('nolabel','ticx');
-%!
-%! subplot (338);
-%!  plot (t, x);
-%!  title ('y tics, no labels');
-%!  axis ('nolabel','ticy');
-%!
-%! subplot (339);
-%!  plot (t, x);
-%!  title ('all tics and labels');
-%!  axis ('on');
-
-%!demo
-%! clf;
-%! t = 0:0.01:2*pi;
-%! x = sin (t);
-%!
-%! subplot (321);
-%!  plot (t, x);
-%!  title ('axes at [0 3 0 1]');
-%!  axis ([0,3,0,1]);
-%!
-%! subplot (322);
-%!  plot (t, x);
-%!  title ('auto');
-%!  axis ('auto');
-%!
-%! subplot (323);
-%!  plot (t, x, ';sine [0:2pi];'); hold on;
-%!  plot (-3:3,-3:3, ';line (-3,-3)->(3,3);'); hold off;
-%!  title ('manual');
-%!  axis ('manual');
-%!
-%! subplot (324);
-%!  plot (t, x, ';sine [0:2pi];');
-%!  title ('axes at [0 3 0 1], then autox');
-%!  axis ([0,3,0,1]);
-%!  axis ('autox');
-%!
-%! subplot (325);
-%!  plot (t, x, ';sine [0:2p];');
-%!  title ('axes at [3 6 0 1], then autoy');
-%!  axis ([3,6,0,1]);
-%!  axis ('autoy');
-%!
-%! subplot (326);
-%!  plot (t, sin(t), t, -2*sin(t/2));
-%!  axis ('tight');
-%!  title ('tight');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin(x));
-%! axis image;
-%! title ('image');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x,y,z] = peaks (50);
-%! x1 = max (x(:));
-%! pcolor (x-x1, y-x1/2, z);
-%! hold on;
-%! [x,y,z] = sombrero ();
-%! s = x1 / max (x(:));
-%! pcolor (s*x+x1, s*y+x1/2, 5*z);
-%! axis tight;
-
-%!demo
-%! clf;
-%! x = -10:10;
-%! plot (x,x, x,-x);
-%! set (gca, 'yscale', 'log');
-%! legend ({'x >= 1', 'x <= 1'}, 'location', 'north');
-%! title ('ylim = [1, 10]');
-
-%!demo
-%! clf;
-%! loglog (1:20, '-s');
-%! axis tight;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1 + abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'left');
-%! box off;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'zero');
-%! set (gca, 'yaxislocation', 'right');
-%! box off;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'bottom');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-
-%!demo
-%! clf;
-%! x = -10:0.1:10;
-%! y = sin (x)./(1+abs (x)) + 0.1*x - 0.4;
-%! plot (x, y);
-%! title ('no plot box');
-%! set (gca, 'xaxislocation', 'top');
-%! set (gca, 'yaxislocation', 'zero');
-%! box off;
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot (11:20, [21:24, NaN, -Inf, 27:30]);
-%!   hold all;
-%!   plot (11:20, 25.5 + rand (10));
-%!   axis tight;
-%!   assert (axis (), [11 20 21 30]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   loglog (a, -a);
-%!   axis tight;
-%!   assert (axis (), [1e-5, 10, -10, -1e-5]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/bar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} bar (@var{x}, @var{y})
-## @deftypefnx {Function File} {} bar (@var{y})
-## @deftypefnx {Function File} {} bar (@var{x}, @var{y}, @var{w})
-## @deftypefnx {Function File} {} bar (@var{x}, @var{y}, @var{w}, @var{style})
-## @deftypefnx {Function File} {} bar (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} bar (@dots{}, @var{prop}, @var{val})
-## Produce a bar graph from two vectors of x-y data.
-##
-## If only one argument is given, @var{y}, it is taken as a vector of y-values
-## and the x coordinates are taken to be the indices of the elements.
-##
-## The default width of 0.8 for the bars can be changed using @var{w}.
-##
-## If @var{y} is a matrix, then each column of @var{y} is taken to be a
-## separate bar graph plotted on the same graph.  By default the columns
-## are plotted side-by-side.  This behavior can be changed by the @var{style}
-## argument, which can take the values @code{"grouped"} (the default),
-## or @code{"stacked"}.
-##
-## Passing the optional input handle @var{h} will draw the resulting plot
-## in the specified handle.
-##
-## The optional return value @var{h} is a handle to the created "bar series"
-## object with one handle per column of the variable @var{y}.  This
-## series allows common elements of the group of bar series objects to
-## be changed in a single bar series and the same properties are changed
-## in the other "bar series".  For example,
-##
-## @example
-## @group
-## h = bar (rand (5, 10));
-## set (h(1), "basevalue", 0.5);
-## @end group
-## @end example
-##
-## @noindent
-## changes the position on the base of all of the bar series.
-##
-## The bar graph's appearance may be modified by specifying property/value
-## pairs.  The following example modifies the face and edge colors.
-##
-## @example
-## bar (randn (1, 100), "facecolor", "r", "edgecolor", "b")
-## @end example
-##
-## @noindent
-## The color of the bars is taken from the figure's colormap, such that
-##
-## @example
-## @group
-## bar (rand (10, 3));
-## colormap (summer (64));
-## @end group
-## @end example
-##
-## @noindent
-## will change the colors used for the bars.  The color of bars can also be set
-## manually using the "facecolor" property as shown below.
-##
-## @example
-## @group
-## h = bar (rand (10, 3));
-## set (h(1), "facecolor", "r")
-## set (h(2), "facecolor", "g")
-## set (h(3), "facecolor", "b")
-## @end group
-## @end example
-##
-## @seealso{barh, plot}
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = bar (varargin)
-  varargout = cell (nargout, 1);
-  [varargout{:}] = __bar__ (true, "bar", varargin{:});
-endfunction
-
-
-%!demo
-%! clf;
-%! y = rand (10, 1);
-%! bar (y);
-
-%!demo
-%! clf;
-%! h = bar (rand (5, 3));
-%! set (h(1), 'facecolor', 'r')
-%! set (h(2), 'facecolor', 'g')
-%! set (h(3), 'facecolor', 'b')
-
--- a/scripts/plot/barh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} barh (@var{x}, @var{y})
-## @deftypefnx {Function File} {} barh (@var{y})
-## @deftypefnx {Function File} {} barh (@var{x}, @var{y}, @var{w})
-## @deftypefnx {Function File} {} barh (@var{x}, @var{y}, @var{w}, @var{style})
-## @deftypefnx {Function File} {} barh (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} barh (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} barh (@dots{})
-## Produce a horizontal bar graph from two vectors of x-y data.
-##
-## If only one argument is given, it is taken as a vector of y-values
-## and the x coordinates are taken to be the indices of the elements.
-##
-## The default width of 0.8 for the bars can be changed using @var{w}.
-##
-## If @var{y} is a matrix, then each column of @var{y} is taken to be a
-## separate bar graph plotted on the same graph.  By default the columns
-## are plotted side-by-side.  This behavior can be changed by the @var{style}
-## argument, which can take the values @code{"grouped"} (the default),
-## or @code{"stacked"}.
-##
-## Passing the optional input handle @var{h} will draw the resulting plot
-## in the specified handle.
-## 
-## Properties of the patch graphics object can be changed using
-## @var{prop}, @var{val} pairs.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## bar series object.  See @code{bar} for a description of the use of the
-## bar series.
-## @seealso{bar, plot}
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = barh (varargin)
-  varargout = cell (nargout, 1);
-  [varargout{:}] = __bar__ (false, "barh", varargin{:});
-endfunction
-
-
-%!demo
-%! clf;
-%! x = rand (10, 1);
-%! barh (x);
-
-%!demo
-%! clf;
-%! h = barh (rand (5, 3));
-%! set (h(1), 'facecolor', 'r')
-%! set (h(2), 'facecolor', 'g')
-%! set (h(3), 'facecolor', 'b')
-
--- a/scripts/plot/box.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2006-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} box
-## @deftypefnx {Function File} {} box ("on")
-## @deftypefnx {Function File} {} box ("off")
-## @deftypefnx {Function File} {} box (@var{hax}, @dots{})
-## Control the display of a border around the plot.
-## The argument may be either @code{"on"} or @code{"off"}.  If it is
-## omitted, the current box state is toggled.
-##
-## If the first argument is an axis handle, @var{hax}, operate on the
-## specified axis object.
-## @seealso{grid}
-## @end deftypefn
-
-## Author: jwe
-
-function box (varargin)
-
-  [ax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:});
-
-  if (nargs == 0)
-    box_state = get (ax, "box");
-    if (strcmp (box_state, "on"))
-      box_state = "off";
-    else
-      box_state = "on";
-    endif
-  elseif (nargs == 1)
-    state = varargin{1};
-    if (ischar (state))
-      if (strcmpi (state, "off"))
-        box_state = "off";
-      elseif (strcmpi (state, "on"))
-        box_state = "on";
-      else
-        error ('box: argument must be "on" or "off"');
-      endif
-    else
-      error ('box: argument must be "on" or "off"');
-    endif
-  else
-    print_usage ();
-  endif
-
-  set (ax, "box", box_state);
-
-endfunction
--- a/scripts/plot/caxis.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C)  2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} caxis (@var{limits})
-## @deftypefnx {Function File} {} caxis (@var{h}, @dots{})
-## Set color axis limits for plots.
-##
-## The argument @var{limits} should be a 2-element vector specifying the
-## lower and upper limits to assign to the first and last value in the
-## colormap.  Values outside this range are clamped to the first and last
-## colormap entries.
-##
-## If @var{limits} is "auto", then automatic colormap scaling is applied,
-## whereas if @var{limits} is "manual" the colormap scaling is set to manual.
-##
-## Called without any arguments to current color axis limits are returned.
-##
-## If an axes handle is passed as the first argument, then operate on
-## this axes rather than the current axes.
-## @end deftypefn
-
-function varargout = caxis (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    varargout = cell (max (nargin == 0, nargout), 1);
-    if (isempty (varargout))
-      __caxis__ (h, varargin{:});
-    else
-      [varargout{:}] = __caxis__ (h, varargin{:});
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-function [cmin, cmax] = __caxis__ (ca, ax, varargin)
-
-  if (nargin == 1)
-    cmin = get (ca, "clim");
-    if (nargout > 1)
-      cmax = cmin(2);
-      cmin = cmin(1);
-    endif
-  elseif (ischar (ax))
-    if (strcmpi (ax, "auto"))
-      set (ca, "climmode", "auto");
-    elseif (strcmpi (ax, "manual"))
-      set (ca, "climmode", "manual");
-    endif
-  elseif (isvector (ax))
-    len = length (ax);
-
-    if (len != 2)
-      error ("caxis: expecting vector with 2 elements");
-    endif
-
-    set (ca, "clim", [ax(1), ax(2)]);
-  else
-    error ("caxis: expecting no args, a string or a 2 element vector");
-  endif
-
-  if (nargin > 2)
-    __caxis__ (ca, varargin{:})';
-  endif
-
-endfunction
-
--- a/scripts/plot/cla.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-## Copyright (C) 2008-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} cla ()
-## @deftypefnx {Function File} {} cla ("reset")
-## @deftypefnx {Function File} {} cla (@var{hax})
-## @deftypefnx {Function File} {} cla (@var{hax}, "reset")
-## Delete the children of the current axes with visible handles.
-## If @var{hax} is specified and is an axes object handle, operate on it
-## instead of the current axes.  If the optional argument @code{"reset"}
-## is specified, also delete the children with hidden handles.
-## @seealso{clf}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2008-10-03
-
-function cla (varargin)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin > 1)
-    if (ishandle (varargin{1})
-        && strcmp (get (varargin{1}, "type"), "axes")
-        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
-      oldhax = gca;
-      hax = varargin{1};
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  elseif (nargin == 1)
-    if (ishandle (varargin{1})
-        && strcmp (get (varargin{1}, "type"), "axes"))
-      oldhax = gca;
-      hax = varargin{1};
-      do_reset = false;
-    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
-      hax = gca;
-      oldhax = hax;
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  else
-    hax = gca;
-    oldhax = hax;
-    do_reset = false;
-  endif
-
-  hc = get (hax, "children");
-
-  if (! do_reset && ! isempty (hc))
-    hc = findobj (hc, "flat", "visible", "on");
-    hc = setdiff (hc, hax);
-  endif
-
-  if (! isempty (hc))
-    ## Delete the children of the axis.
-    delete (hc);
-  endif
-
-  ## FIXME: The defaults should be "reset()" below, but so far there is
-  ## no method to determine the defaults, much less return an object's
-  ## properties to their default values.  Instead make a close
-  ## approximation.
-
-  axes (hax);
-  axis ("auto");
-
-  ## Set the current axis back to where it was upon entry.
-  axes (oldhax);
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot (1:10);
-%!   cla ();
-%!   kids = get (gca, "children");
-%!   cla ();
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-%! assert (numel (kids), 0);
-
--- a/scripts/plot/clabel.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} clabel (@var{c}, @var{h})
-## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, @var{v})
-## @deftypefnx {Function File} {} clabel (@var{c}, @var{h}, "manual")
-## @deftypefnx {Function File} {} clabel (@var{c})
-## @deftypefnx {Function File} {} clabel (@var{c}, @var{h})
-## @deftypefnx {Function File} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} clabel (@dots{})
-## Add labels to the contours of a contour plot.  The contour plot is specified
-## by the contour matrix @var{c} and optionally the contourgroup object @var{h}
-## that are returned by @code{contour}, @code{contourf} and @code{contour3}.
-## The contour labels are rotated and placed in the contour itself.
-##
-## By default, all contours are labeled.  However, the contours to label can be
-## specified by the vector @var{v}.  If the "manual" argument is given then
-## the contours to label can be selected with the mouse.
-##
-## Additional property/value pairs that are valid properties of text objects
-## can be given and are passed to the underlying text objects.  Additionally,
-## the property "LabelSpacing" is available allowing the spacing between labels
-## on a contour (in points) to be specified.  The default is 144 points, or 2
-## inches.
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the text objects representing each label.  
-## The "userdata" property of the text objects contains the numerical value of
-## the contour label.
-##
-## An example of the use of @code{clabel} is
-##
-## @example
-## @group
-## [c, h] = contour (peaks (), -4 : 6);
-## clabel (c, h, -4:2:6, "fontsize", 12);
-## @end group
-## @end example
-##
-## @seealso{contour, contourf, contour3, meshc, surfc, text}
-## @end deftypefn
-
-function retval = clabel (c, varargin)
-  label_spacing = 2 * 72;
-  have_hg = false;
-  have_labelspacing = false;
-
-  if (nargin < 1)
-    print_usage ();
-  elseif (nargin == 1)
-    hparent = gca ();
-  else
-    arg = varargin{1};
-    if (isscalar (arg) && ishandle (arg)
-        && strcmp (get (arg, "type"), "hggroup"))
-      obj = get (arg);
-      if (! isfield (obj, "contourmatrix"))
-        error ("clabel: expecting the handle to be a contour group");
-      endif
-      hg = arg;
-      have_hg = true;
-      varargin(1) = [];
-    else
-      hparent = gca ();
-    endif
-  endif
-
-  if (length (varargin) > 0 && isnumeric (varargin{1}))
-    v = varargin{1}(:);
-    varargin(1) = [];
-  else
-    v = [];
-  endif
-
-  for i = 1 : length (varargin) - 1
-    arg = varargin{i};
-    if (strcmpi (arg, "labelspacing"))
-      label_spacing = varargin{i+1};
-      have_labelspacing = true;
-      varargin(i:i+1) = [];
-      break;
-    endif
-  endfor
-
-  for i = 1 : length (varargin)
-    arg = varargin{i};
-    if (strcmpi (arg, "manual"))
-      error ("clabel: manual contouring mode not supported");
-    endif
-  endfor
-
-  if (have_hg)
-    if (! isempty (v))
-      if (have_labelspacing)
-        set (hg, "textlistmode", "manual", "textlist", v,
-             "labelspacing", label_spacing, "showtext", "on");
-      else
-        set (hg, "textlistmode", "manual", "textlist", v, "showtext", "on");
-      endif
-    else
-      if (have_labelspacing)
-        set (hg,"showtext", "on", "labelspacing", label_spacing);
-      else
-        set (hg,"showtext", "on");
-      endif
-    endif
-    retval = findobj (hg, "type", "text");
-    if (! isempty (varargin))
-      set (retval, varargin {:});
-    endif
-  else
-    retval =  __clabel__ (c, v, hparent, label_spacing, [], varargin{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [c, h] = contour (peaks (), -4:6);
-%! clabel (c, h, -4:2:6, 'fontsize', 12);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [c, h] = contourf (peaks (), -7:6);
-%! clabel (c, h, -6:2:6, 'fontsize', 12);
-
--- a/scripts/plot/clf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} clf ()
-## @deftypefnx {Function File} {} clf ("reset")
-## @deftypefnx {Function File} {} clf (@var{hfig})
-## @deftypefnx {Function File} {} clf (@var{hfig}, "reset")
-## @deftypefnx {Function File} {@var{h} =} clf (@dots{})
-## Clear the current figure window.  @code{clf} operates by deleting child
-## graphics objects with visible handles (@code{handlevisibility} = on).
-## If @var{hfig} is specified operate on it instead of the current figure.
-## If the optional argument @code{"reset"} is specified, all objects including
-## those with hidden handles are deleted.
-## 
-## The optional return value @var{h} is the graphics handle of the figure
-## window that was cleared.
-## @seealso{cla, close, delete}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = clf (varargin)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (nargin > 1)
-    if (isfigure (varargin{1}) && ischar (varargin{2})
-        && strcmpi (varargin{2}, "reset"))
-      oldfig = gcf;
-      hfig = varargin{1};
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  elseif (nargin == 1)
-    if (isfigure (varargin{1}))
-      oldfig = gcf;
-      hfig = varargin{1};
-      do_reset = false;
-    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
-      hfig = gcf;
-      oldfig = hfig;
-      do_reset = true;
-    else
-      print_usage ();
-    endif
-  else
-    hfig = gcf;
-    oldfig = hfig;
-    do_reset = false;
-  endif
-
-  if (do_reset)
-    ## Select all the children, including the one with hidden handles.
-    hc = allchild (hfig);
-    reset (hfig);
-  else
-    ## Select only the chilren with visible handles.
-    hc = get (hfig, "children");
-  endif
-
-  ## Delete the children.
-  delete (hc);
-
-  if (nargout > 0)
-    retval = hfig;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (! isempty (get (gcf, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   clf;
-%!   assert (isempty (get (gcf, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/close.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2002-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} close
-## @deftypefnx {Command} {} close (@var{n})
-## @deftypefnx {Command} {} close all
-## @deftypefnx {Command} {} close all hidden
-## Close figure window(s) by calling the function specified by the
-## @code{"closerequestfcn"} property for each figure.  By default, the
-## function @code{closereq} is used.
-## @seealso{closereq}
-## @end deftypefn
-
-## Author: jwe
-## 2010-05-02   PBig    allow empty argument
-
-function retval = close (arg1, arg2)
-
-  figs = [];
-
-  if (nargin == 0)
-    ## Close current figure.  Don't use gcf because that will open a new
-    ## plot window if one doesn't exist.
-    figs = get (0, "currentfigure");
-    if (! isempty (figs) && figs == 0)
-      figs = [];
-    endif
-  elseif (nargin == 1)
-    if (ischar (arg1) && strcmpi (arg1, "all"))
-      close_all_figures (false);
-    elseif (isfigure (arg1))
-      figs = arg1;
-    elseif (isempty (arg1))
-      figs = [];
-    else
-      error ("close: expecting argument to be \"all\" or a figure handle");
-    endif
-  elseif (nargin == 2
-          && ischar (arg1) && strcmpi (arg1, "all")
-          && ischar (arg2) && strcmpi (arg2, "hidden"))
-    close_all_figures (true);
-  else
-    print_usage ();
-  endif
-
-  for h = figs
-    __go_execute_callback__ (h, "closerequestfcn");
-  endfor
-
-  if (nargout > 0)
-    retval = 1;
-  endif
-
-endfunction
-
-function close_all_figures (close_hidden_figs)
-
-  while (! isempty (fig = get (0, "currentfigure")))
-    ## handlevisibility = get (fig, "handlevisibility")
-    ## if (close_hidden_figs || ! strcmpi (handlevisibility, "off"))
-    close (fig);
-    ## endif
-  endwhile
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   close (hf);
-%!   objs = findobj ("type", "figure");
-%!   assert (isempty (intersect (objs, hf)));
-%! unwind_protect_cleanup
-%!   if (isfigure (hf))
-%!     close (hf);
-%!   endif
-%! end_unwind_protect
-
--- a/scripts/plot/closereq.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} closereq ()
-## Close the current figure and delete all graphics objects associated
-## with it.
-## @seealso{close, delete}
-## @end deftypefn
-
-## Author: jwe
-
-function closereq ()
-
-  if (nargin == 0)
-    cf = gcbf ();
-    if (isempty (cf))
-      warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
-      cf = get (0, "currentfigure");
-    endif
-    if (! isempty (cf) && isfigure (cf))
-      delete (cf);
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
--- a/scripts/plot/colorbar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,651 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} colorbar (@var{s})
-## @deftypefnx {Function File} {} colorbar ("peer", @var{h}, @dots{})
-## Add a colorbar to the current axes.  Valid values for @var{s} are
-##
-## @table @asis
-## @item "EastOutside"
-## Place the colorbar outside the plot to the right.  This is the default.
-##
-## @item "East"
-## Place the colorbar inside the plot to the right.
-##
-## @item "WestOutside"
-## Place the colorbar outside the plot to the left.
-##
-## @item "West"
-## Place the colorbar inside the plot to the left.
-##
-## @item "NorthOutside"
-## Place the colorbar above the plot.
-##
-## @item "North"
-## Place the colorbar at the top of the plot.
-##
-## @item "SouthOutside"
-## Place the colorbar under the plot.
-##
-## @item "South"
-## Place the colorbar at the bottom of the plot.
-##
-## @item "Off", "None"
-## Remove any existing colorbar from the plot.
-## @end table
-##
-## If the argument "peer" is given, then the following argument is treated
-## as the axes handle on which to add the colorbar.
-## @end deftypefn
-
-function h = colorbar (varargin)
-  ax = [];
-  loc = "eastoutside";
-  args = {};
-  deleting = false;
-
-  i = 1;
-  while (i <= nargin)
-    arg = varargin {i++};
-    if (ischar (arg))
-      if (strcmpi (arg, "peer"))
-        if (i > nargin)
-          error ("colorbar: missing axes handle after \"peer\"");
-        else
-          ax = varargin{i++};
-          if (!isscalar (ax) || ! ishandle (ax)
-              || ! strcmp (get (ax, "type"), "axes"))
-            error ("colorbar: expecting an axes handle following \"peer\"");
-          endif
-        endif
-      elseif (strcmpi (arg, "north") || strcmpi (arg, "south")
-              || strcmpi (arg, "east") || strcmpi (arg, "west")
-              || strcmpi (arg, "northoutside") || strcmpi (arg, "southoutside")
-              || strcmpi (arg, "eastoutside") || strcmpi (arg, "westoutside"))
-        loc = tolower (arg);
-      elseif (strcmpi (arg, "location") && i <= nargin)
-        loc = tolower (varargin{i++});
-      elseif (strcmpi (arg, "off") || strcmpi (arg, "none"))
-        deleting = true;
-      else
-        args{end+1} = arg;
-      endif
-    else
-      args{end+1} = arg;
-    endif
-  endwhile
-
-  if (isempty (ax))
-    ax = gca ();
-  endif
-
-  showhiddenhandles = get (0, "showhiddenhandles");
-  unwind_protect
-    set (0, "showhiddenhandles", "on");
-    cax = findobj (get (ax, "parent"), "tag", "colorbar", "type", "axes", "axes", ax);
-    if (! isempty (cax))
-      delete (cax);
-    endif
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", showhiddenhandles);
-  end_unwind_protect
-
-  if (! deleting)
-    ## FIXME - Matlab does not require the "position" property to be active.
-    ##         Is there a way to determine the plotbox position for the
-    ##         gnuplot graphics toolkit with the outerposition is active?
-    set (ax, "activepositionproperty", "position");
-    obj = get (ax);
-    obj.__my_handle__ = ax;
-    position = obj.position;
-    clen = rows (get (get (ax, "parent"), "colormap"));
-    cext = get (ax, "clim");
-    cdiff = (cext(2) - cext(1)) / clen / 2;
-    cmin = cext(1) + cdiff;
-    cmax = cext(2) - cdiff;
-
-    [pos, cpos, vertical, mirror] =  ...
-        __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
-    set (ax, "position", pos);
-
-    cax = __go_axes__ (get (ax, "parent"), "tag", "colorbar",
-                       "handlevisibility", "on",
-                       "activepositionproperty", "position",
-                       "position", cpos);
-    addproperty ("location", cax, "radio",
-                 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south",
-                 loc);
-    addproperty ("axes", cax, "handle", ax);
-
-    if (vertical)
-      hi = image (cax, [0,1], [cmin, cmax], [1 : clen]');
-      if (mirror)
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-             "ylim", cext, "ylimmode", "manual",
-             "yaxislocation", "right", args{:});
-      else
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-             "ylim", cext, "ylimmode", "manual",
-             "yaxislocation", "left", args{:});
-      endif
-    else
-      hi = image (cax, [cmin, cmax], [0,1], [1 : clen]);
-      if (mirror)
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-             "xlim", cext, "xlimmode", "manual",
-             "xaxislocation", "top", args{:});
-      else
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-             "xlim", cext, "xlimmode", "manual",
-             "xaxislocation", "bottom", args{:});
-      endif
-    endif
-
-    ctext = text (0, 0, "", "tag", "colorbar","visible", "off",
-                  "handlevisibility", "off", "xliminclude", "off",
-                  "yliminclude", "off", "zliminclude", "off",
-                  "deletefcn", {@deletecolorbar, cax, obj});
-
-    set (cax, "deletefcn", {@resetaxis, ax, obj});
-
-    addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical});
-    addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "plotboxaspectratiomode", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "dataaspectratiomode", {@update_colorbar_axis, cax, obj});
-    addlistener (ax, "position", {@update_colorbar_axis, cax, obj});
-
-  endif
-
-  if (nargout > 0)
-    h = cax;
-  endif
-endfunction
-
-function deletecolorbar (h, d, hc, orig_props)
-  ## Don't delete the colorbar and reset the axis size if the
-  ## parent figure is being deleted.
-  if (ishandle (hc) && strcmp (get (hc, "type"), "axes")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
-    if (strcmp (get (hc, "beingdeleted"), "off"))
-      delete (hc);
-    endif
-    if (!isempty (ancestor (h, "axes"))
-        && strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
-      set (ancestor (h, "axes"), "position", orig_props.position, ...
-                            "outerposition", orig_props.outerposition, ...
-                    "activepositionproperty", orig_props.activepositionproperty);
-    endif
-  endif
-endfunction
-
-function resetaxis (cax, d, ax, orig_props)
-  if (ishandle (ax) && strcmp (get (ax, "type"), "axes"))
-    dellistener (ax, "position");
-    units = get (ax, "units");
-    set (ax, "units", orig_props.units);
-    set (ax, "position", orig_props.position, ...
-             "outerposition", orig_props.outerposition, ...
-             "activepositionproperty", orig_props.activepositionproperty);
-    set (ax, "units", units);
-  endif
-endfunction
-
-function update_colorbar_clim (h, d, hi, vert)
-  if (ishandle (h) && strcmp (get (h, "type"), "image")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
-    clen = rows (get (get (h, "parent"), "colormap"));
-    cext = get (h, "clim");
-    cdiff = (cext(2) - cext(1)) / clen / 2;
-    cmin = cext(1) + cdiff;
-    cmax = cext(2) - cdiff;
-
-    if (vert)
-      set (hi, "ydata", [cmin, cmax]);
-      set (get (hi, "parent"), "ylim", cext);
-    else
-      set (hi, "xdata", [cmin, cmax]);
-      set (get (hi, "parent"), "xlim", cext);
-    endif
-  endif
-endfunction
-
-function update_colorbar_axis (h, d, cax, orig_props)
-
-  if (ishandle (cax) && strcmp (get (cax, "type"), "axes")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
-    loc = get (cax, "location");
-    obj = get (h);
-    obj.__my_handle__ = h;
-    obj.position = orig_props.position;
-    obj.outerposition = orig_props.outerposition;
-    [pos, cpos, vertical, mirror] =  ...
-        __position_colorbox__ (loc, obj, ancestor (h, "figure"));
-
-    if (vertical)
-      if (mirror)
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-             "yaxislocation", "right", "position", cpos);
-      else
-        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
-             "yaxislocation", "left", "position", cpos);
-      endif
-    else
-      if (mirror)
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-             "xaxislocation", "top", "position", cpos);
-      else
-        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
-             "xaxislocation", "bottom", "position", cpos);
-      endif
-    endif
-
-  endif
-endfunction
-
-function [pos, cpos, vertical, mirr] = __position_colorbox__ (cbox, obj, cf)
-
-  ## This will always represent the position prior to adding the colorbar.
-  pos = obj.position;
-  sz = pos(3:4);
-
-  if (strcmpi (obj.plotboxaspectratiomode, "manual")
-      || strcmpi (obj.dataaspectratiomode, "manual"))
-    if (isempty (strfind (cbox, "outside")))
-      scale = 1.0;
-    else
-      scale = 0.8;
-    endif
-    if (isempty (strfind (cbox, "east")) && isempty (strfind (cbox, "west")))
-      scale = [1, scale];
-    else
-      scale = [scale, 1];
-    endif
-    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")
-        && strcmp (obj.activepositionproperty, "outerposition"))
-      obj.outerposition = obj.outerposition .* [1, 1, scale];
-      off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
-    else
-      obj.position = obj.position .* [1, 1, scale];
-      off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
-    endif
-  else
-    off = 0.0;
-  endif
-
-  switch (cbox)
-    case "northoutside"
-      origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06];
-      pos(4) = 0.8 * pos(4);
-      mirr = true;
-      vertical = false;
-    case "north"
-      origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06] * 0.9;
-      mirr = false;
-      vertical = false;
-    case "southoutside"
-      origin = pos(1:2) + off;
-      sz = sz .* [1.0, 0.06];
-      pos(2) = pos(2) + pos(4) * 0.2;
-      pos(4) = 0.8 * pos(4);
-      mirr = false;
-      vertical = false;
-    case "south"
-      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [1.0, 0.06] * 0.9;
-      mirr = true;
-      vertical = false;
-    case "eastoutside"
-      origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0];
-      pos(3) = 0.8 * pos(3);
-      mirr = true;
-      vertical = true;
-    case "east"
-      origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0] * 0.9;
-      mirr = false;
-      vertical = true;
-    case "westoutside"
-      origin = pos(1:2) + off;
-      sz = sz .* [0.06, 1.0];
-      pos(1) = pos(1) + pos(3) * 0.2;
-      pos(3) = 0.8 * pos(3);
-      mirr = false;
-      vertical = true;
-    case "west"
-      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [0.06, 1.0] .* 0.9;
-      mirr = true;
-      vertical = true;
-  endswitch
-
-  cpos = [origin, sz];
-
-  if (strcmpi (obj.plotboxaspectratiomode, "manual")
-      || strcmpi (obj.dataaspectratiomode, "manual"))
-    obj.position = pos;
-    actual_pos = __actual_axis_position__ (obj);
-    if (strfind (cbox, "outside"))
-      scale = 1.0;
-    else
-      scale = 0.9;
-    endif
-    if (sz(1) > sz(2))
-      ## Ensure north or south colorbars are the proper length
-      dx = (1-scale)*actual_pos(3);
-      cpos(1) = actual_pos(1) + dx/2;
-      cpos(3) = actual_pos(3) - dx;
-    else
-      ## Ensure east or west colorbars are the proper height
-      dy = (1-scale)*actual_pos(4);
-      cpos(2) = actual_pos(2) + dy/2;
-      cpos(4) = actual_pos(4) - dy;
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('peer', gca, 'northoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! imagesc (x);
-%! colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! contour (peaks ());
-%! colorbar ('west');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! subplot (2,2,1);
-%!  contour (peaks ());
-%!  colorbar ('east');
-%! subplot (2,2,2);
-%!  contour (peaks ());
-%!  colorbar ('west');
-%! subplot (2,2,3);
-%!  contour (peaks ());
-%!  colorbar ('north');
-%! subplot (2,2,4);
-%!  contour (peaks ());
-%!  colorbar ('south');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,2,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (2,2,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-%! subplot (2,2,3);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (2,2,4);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ();
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('northoutside');
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ();
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('northoutside');
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  axis square;
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (1,2,2);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  colorbar ();
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  colorbar ('westoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (2,1,1);
-%!  imagesc (x);
-%!  colorbar ('northoutside');
-%! subplot (2,1,2);
-%!  imagesc (x);
-%!  colorbar ('southoutside');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! subplot (1,2,1);
-%!  contour (x);
-%!  axis square;
-%!  colorbar ('east');
-%!  xlim ([1, 64]);
-%!  ylim ([1, 64]);
-%! subplot (1,2,2);
-%!  contour (x);
-%!  colorbar ('west');
-%!  xlim ([1, 64]);
-%!  ylim ([1, 64]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! contour (x);
-%! xlim ([1, 64]);
-%! ylim ([1, 64]);
-%! colorbar ();
-%! colorbar off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
-%! contour (x);
-%! xlim ([1, 64]);
-%! ylim ([1, 64]);
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! imagesc (1 ./ hilb (99));
-%! h = colorbar ();
-%! set (h, 'yscale', 'log');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! imagesc (log10 (1 ./ hilb (99)));
-%! h = colorbar ();
-%! ytick = get (h, 'ytick');
-%! set (h, 'yticklabel', sprintf ('10^{%g}|', ytick));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (x, y, 1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
-%! imagesc (y, x, 1 ./ hilb (n));
-%! axis equal;
-%! colorbar ();
-
-## This requires that the axes position be properly determined for 'axis equal'
-%!demo
-%! clf;
-%! colormap ('default');
-%! axes;
-%! colorbar ();
-%! hold on;
-%! contour (peaks ());
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('east');
-%! axis square;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('eastoutside');
-%! axis square;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks (20));
-%! shading interp;
-%! axis ('tight', 'square');
-%! colorbar ();
-#%! axes ('color','none','box','on','activepositionproperty','position');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('east');
-%! axis equal;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! plot ([0, 2]);
-%! colorbar ('eastoutside');
-%! axis equal;
-
--- a/scripts/plot/colstyle.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-## Copyright (C) 2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{style}, @var{color}, @var{marker}, @var{msg}] =} colstyle (@var{linespec})
-## Parse @var{linespec} and return the line style, color, and markers given.
-## In the case of an error, the string @var{msg} will return the text of the
-## error.
-## @end deftypefn
-
-function [l, c, m, msg] = colstyle (style)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  if (! ischar (style))
-    error ("colstyle: STYLE must be a string");
-  endif
-
-  try
-    opt = __pltopt__ ("colstyle", style);
-    l = opt.linestyle;
-    c = opt.color;
-    m = opt.marker;
-    msg = [];
-    switch (c)
-      case [0 0 0]
-        c = "k";
-      case [1 0 0]
-        c = "r";
-      case [0 1 0]
-        c = "g";
-      case [0 0 1]
-        c = "b";
-      case [1 1 0]
-        c = "y";
-      case [1 0 1]
-        c = "m";
-      case [0 1 1]
-        c = "c";
-      case [0 1 1]
-        c = "w";
-    endswitch
-  catch
-    l = c = m = [];
-    msg = lasterr ();
-  end_try_catch
-
-endfunction
-
-
-%!test
-%! [l, c, m, msg] = colstyle ("r:x");
-%! assert (isempty (msg));
-%! assert (l, ":");
-%! assert (c, "r");
-%! assert (m, "x");
-
-%!test
-%! [l, c, m, msg] = colstyle (".");
-%! assert (isempty (msg));
-%! assert (l, "none");
-%! assert (c, []);
-%! assert (m, ".");
-
-%!test
-%! [l, c, m, msg] = colstyle ("~");
-%! assert (msg, "colstyle: unrecognized format character: '~'");
-
-%% Test input validation
-%!error colstyle ()
-%!error colstyle (1, 2)
-%!error colstyle (1.5)
-
--- a/scripts/plot/comet.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-## Copyright (C) 2008-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} comet (@var{y})
-## @deftypefnx {Function File} {} comet (@var{x}, @var{y})
-## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
-## @deftypefnx {Function File} {} comet (@var{hax}, @dots{})
-## Produce a simple comet style animation along the trajectory provided by
-## the input coordinate vectors (@var{x}, @var{y}).  If @var{x} is not
-## specified it defaults to the indices of @var{y}.
-##
-## The speed of the comet may be controlled by @var{p}, which represents the
-## time each point is displayed before moving to the next one.  The default for
-## @var{p} is 0.1 seconds.
-##
-## If @var{hax} is specified the animation is produced in that axis rather than
-## the current axis.
-## @seealso{comet3}
-## @end deftypefn
-
-## Author: Ben Abbott bpabbott@mac.com
-## Created: 2008-09-21
-
-function comet (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:});
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1)
-    y = varargin{1};
-    x = 1:numel (y);
-    p = 0.1;
-  elseif (nargin == 2)
-    x = varargin{1};
-    y = varargin{2};
-    p = 0.1;
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    p = varargin{3};
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    theaxis = [min(x), max(x), min(y), max(y)];
-    num = numel (y);
-    dn = round (num/10);
-    for n = 1:(num+dn);
-      m = n - dn;
-      m = max ([m, 1]);
-      k = min ([n, num]);
-      h = plot (x(1:m), y(1:m), "r", x(m:k), y(m:k), "g", x(k), y(k), "ob");
-      axis (theaxis);
-      drawnow ();
-      pause (p);
-    endfor
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 0:.1:2*pi;
-%! x = cos (2*t) .* (cos (t).^2);
-%! y = sin (2*t) .* (sin (t).^2);
-%! comet (x, y);
-
--- a/scripts/plot/comet3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott and John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} comet3 (@var{z})
-## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
-## @deftypefnx {Function File} {} comet3 (@var{hax}, @dots{})
-## Produce a simple comet style animation along the trajectory provided by
-## the input coordinate vectors (@var{x}, @var{y}, @var{z}).  If only @var{z}
-## is specified then @var{x}, @var{y} default to the indices of @var{z}.
-##
-## The speed of the comet may be controlled by @var{p}, which represents the
-## time each point is displayed before moving to the next one.  The default for
-## @var{p} is 0.1 seconds.
-##
-## If @var{hax} is specified the animation is produced in that axis rather than
-## the current axis.
-## @seealso{comet}
-## @end deftypefn
-
-## Author: jwe
-## Created: 2010-12-17
-
-function comet3 (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:});
-
-  if (nargin == 0 || nargin == 2 || nargin > 4)
-    print_usage ();
-  elseif (nargin == 1)
-    z = varargin{1};
-    x = y = 1:numel (z);
-    p = 0.1;
-  elseif (nargin == 3)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    p = 0.1;
-  elseif (nargin == 4)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    p = varargin{4};
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    theaxis = [min(x), max(x), min(y), max(y), min(z), max(z)];
-    num = numel (y);
-    dn = round (num/10);
-    for n = 1:(num+dn);
-      m = n - dn;
-      m = max ([m, 1]);
-      k = min ([n, num]);
-      h = plot3 (x(1:m), y(1:m), z(1:m), "r", x(m:k), y(m:k), z(m:k), "g",
-                 x(k), y(k), z(k), "ob");
-      axis (theaxis);
-      drawnow ();
-      pause (p);
-    endfor
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 0:pi/20:5*pi;
-%! comet3 (cos (t), sin (t), t, 0.01);
-
--- a/scripts/plot/compass.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} compass (@var{u}, @var{v})
-## @deftypefnx {Function File} {} compass (@var{z})
-## @deftypefnx {Function File} {} compass (@dots{}, @var{style})
-## @deftypefnx {Function File} {} compass (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} compass (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
-## from the origin of a polar plot.  If a single complex argument @var{z} is
-## given, then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag
-## (@var{z})}.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing the drawn vectors.
-##
-## @example
-## @group
-## a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
-## compass (eig (a));
-## @end group
-## @end example
-##
-## @seealso{polar, quiver, feather, plot}
-## @end deftypefn
-
-function retval = compass (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("compass", varargin{:});
-
-  arrowsize = 0.25;
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
-    ioff = 2;
-    z = varargin{1}(:).';
-    u = real (z);
-    v = imag (z);
-  elseif (nargin > 1 && isnumeric (varargin{2}))
-    ioff = 3;
-    u = varargin{1}(:).';
-    v = varargin{2}(:).';
-  endif
-
-  line_spec = "b-";
-  have_line_spec = false;
-  while (ioff <= nargin)
-    arg = varargin{ioff++};
-    if ((ischar (arg) || iscell (arg)) && ! have_line_spec)
-      [linespec, valid] = __pltopt__ ("compass", arg, false);
-      if (valid)
-        line_spec = arg;
-        have_line_spec = true;
-        break;
-      else
-        error ("compass: invalid linespec");
-      endif
-    else
-      error ("compass: unrecognized argument");
-    endif
-  endwhile
-
-  ## Matlab draws compass plots, with the arrow head as one continous
-  ## line, and each arrow separately. This is completely different than
-  ## quiver and quite ugly.
-  n = length (u);
-  xend = u;
-  xtmp = u .* (1 - arrowsize);
-  yend = v;
-  ytmp = v .* (1 - arrowsize);
-  x = [zeros(1, n); xend; xtmp  - v * arrowsize / 3; xend; ...
-       xtmp + v * arrowsize / 3];
-  y = [zeros(1, n); yend; ytmp  + u * arrowsize / 3; yend; ...
-       ytmp - u * arrowsize / 3];
-  [r, p] = cart2pol (x, y);
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    hlist = polar (h, r, p, line_spec);
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = hlist;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! randn_9x1_data = [-2.555884; 0.394974; -0.191871; -1.147024; 1.355425; -0.437335; -0.014370; -0.941312; 1.240300];
-%! randn_1x9_data = [1.42934, -1.10821, -1.70404, 0.63357, -0.68337, -1.19771, -0.96502, -1.12810, 0.22457];
-%! a = toeplitz ([1;randn_9x1_data], [1,randn_1x9_data]);
-%! compass (eig (a));
-
--- a/scripts/plot/contour.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-## Copyright (C) 1993-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contour (@var{z})
-## @deftypefnx {Function File} {} contour (@var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour (@dots{}, @var{style})
-## @deftypefnx {Function File} {} contour (@var{h}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
-## Plot level curves (contour lines) of the matrix @var{z}, using the
-## contour matrix @var{c} computed by @code{contourc} from the same
-## arguments; see the latter for their interpretation.  The set of
-## contour levels, @var{c}, is only returned if requested.  For example:
-##
-## @example
-## @group
-## x = 0:2;
-## y = x;
-## z = x' * y;
-## contour (x, y, z, 2:3)
-## @end group
-## @end example
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-## Any markers defined by @var{style} are ignored.
-##
-## The optional input and output argument @var{h} allows an axis handle to
-## be passed to @code{contour} and the handles to the contour objects to be
-## returned.
-## @seealso{contourc, contourf, contour3, patch, plot}
-## @end deftypefn
-
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [c, h] = contour (varargin)
-
-  [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (xh);
-    newplot ();
-    [ctmp, htmp] = __contour__ (xh, "none", varargin{:});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks ();
-%! contour (x, y, z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
-%! [X, Y] = pol2cart (theta, r);
-%! Z = sin (2*theta) .* (1-r);
-%! contour (X, Y, abs (Z), 10);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = linspace (-2, 2);
-%! [x, y] = meshgrid (x);
-%! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2 + 1);
-%! contourf (x, y, z, [0.4, 0.4]);
-%! title ('The hole should be filled with the background color');
-
--- a/scripts/plot/contour3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C) 2007-2012 David BAteman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contour3 (@var{z})
-## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
-## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} contour3 (@var{h}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
-## Plot level curves (contour lines) of the matrix @var{z}, using the
-## contour matrix @var{c} computed by @code{contourc} from the same
-## arguments; see the latter for their interpretation.  The contours are
-## plotted at the Z level corresponding to their contour.  The set of
-## contour levels, @var{c}, is only returned if requested.  For example:
-##
-## @example
-## @group
-## contour3 (peaks (19));
-## hold on;
-## surface (peaks (19), "facecolor", "none", "EdgeColor", "black");
-## colormap hot;
-## @end group
-## @end example
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-## Any markers defined by @var{style} are ignored.
-##
-## The optional input and output argument @var{h} allows an axis handle to
-## be passed to @code{contour} and the handles to the contour objects to be
-## returned.
-## @seealso{contourc, contour, contourf, patch, plot}
-## @end deftypefn
-
-function [c, h] = contour3 (varargin)
-
-  [xh, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (xh);
-    newplot ();
-    [ctmp, htmp] = __contour__ (xh, "auto", varargin{:});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (! ishold ())
-    set (xh, "view", [-37.5, 30],
-         "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! contour3 (peaks (19));
-%! hold on;
-%! surface (peaks (19), 'facecolor', 'none', 'edgecolor', 'black');
-%! colormap (hot (64));
-%! axis tight;
-%! zlim auto;
-%! box off;
-%! hold off;
-
--- a/scripts/plot/contourc.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-## Copyright (C) 2003-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
-## Compute isolines (contour lines) of the matrix @var{z}.
-## Parameters @var{x}, @var{y}, and @var{vn} are optional.
-##
-## The return value @var{lev} is a vector of the contour levels.
-## The return value @var{c} is a 2x@var{n} matrix containing the
-## contour lines in the following format
-##
-## @example
-## @group
-## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
-##      len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
-## @end group
-## @end example
-##
-## @noindent
-## in which contour line @var{n} has a level (height) of @var{levn} and
-## length of @var{lenn}.
-##
-## If @var{x} and @var{y} are omitted they are taken as the row/column
-## indices of @var{z}.  @var{vn} is either a scalar denoting the number of
-## contour lines to compute or a vector containing the values of the lines.
-## If only one value is desired, set @code{@var{vn} = [val, val]};
-## If @var{vn} is omitted it defaults to 10.
-##
-## For example:
-##
-## @example
-## @group
-## x = 0:2;
-## y = x;
-## z = x' * y;
-## contourc (x, y, z, 2:3)
-##    @result{}   2.0000   2.0000   1.0000   3.0000   1.5000   2.0000
-##         2.0000   1.0000   2.0000   2.0000   2.0000   1.5000
-## @end group
-## @end example
-## @seealso{contour, contourf, contour3}
-## @end deftypefn
-
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [cout, lev] = contourc (varargin)
-
-  if (nargin == 1)
-    vn = 10;
-    z = varargin{1};
-    [nr, nc] = size (z);
-    x = 1:nc;
-    y = 1:nr;
-  elseif (nargin == 2)
-    vn = varargin{2};
-    z = varargin{1};
-    [nr, nc] = size (z);
-    x = 1:nc;
-    y = 1:nr;
-  elseif (nargin == 3)
-    vn = 10;
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-  elseif (nargin == 4)
-    vn = varargin{4};
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-  else
-    print_usage ();
-  endif
-
-  if (!ismatrix (z) || isvector (z) || isscalar (z))
-    error ("contourc: Z argument must be a matrix");
-  endif
-
-  if (isscalar (vn))
-    vv = linspace (min (z(:)), max (z(:)), vn+2)(2:end-1);
-  else
-    vv = unique (sort (vn));
-  endif
-
-  if (isvector (x) && isvector (y))
-    c = __contourc__ (x(:)', y(:)', z, vv);
-  else
-    ## Indexes x,y for the purpose of __contourc__.
-    ii = 1:columns (z);
-    jj = 1:rows (z);
-
-    ## Now call __contourc__ for the real work...
-    c = __contourc__ (ii, jj, z, vv);
-
-    ## Map the contour lines from index space (i,j) back
-    ## to the original grid (x,y)
-    i = 1;
-
-    while (i < columns (c))
-      clen = c(2, i);
-      ind = i + [1 : clen];
-
-      ci = c(1, ind);
-      cj = c(2,ind);
-
-      ## due to rounding errors some elements of ci and cj
-      ## can fall out of the range of ii and jj and interp2 would
-      ## return NA for those values.
-      ## The permitted range is enforced here:
-
-      ci = max (ci, 1); ci = min (ci, columns (z));
-      cj = max (cj, 1); cj = min (cj, rows (z));
-
-      c(1, ind) = interp2 (ii, jj, x, ci, cj);
-      c(2, ind) = interp2 (ii, jj, y, ci, cj);
-
-      i = i + clen + 1;
-    endwhile
-  endif
-
-  if (nargout > 0)
-    cout = c;
-    lev = vv;
-  endif
-
-endfunction
-
-
-%!test
-%! x = 0:2;
-%! y = x;
-%! z = x' * y;
-%! [c_actual, lev_actual]= contourc (x, y, z, 2:3);
-%! c_expected = [2, 1, 1, 2, 2, 3, 1.5, 2; 4, 2, 2, 1, 1, 2, 2, 1.5];
-%! lev_expected = [2 3];
-%! assert (c_actual, c_expected, eps);
-%! assert (lev_actual, lev_expected, eps);
-
--- a/scripts/plot/contourf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-## Copyright (C) 2003 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{lvl})
-## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{n})
-## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} contourf (@var{z}, @var{n})
-## @deftypefnx {Function File} {} contourf (@var{z}, @var{lvl})
-## @deftypefnx {Function File} {} contourf (@var{z})
-## @deftypefnx {Function File} {} contourf (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} contourf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contourf (@dots{})
-## Compute and plot filled contours of the matrix @var{z}.
-## Parameters @var{x}, @var{y} and @var{n} or @var{lvl} are optional.
-##
-## If @var{x} and @var{y} are omitted they are taken as the row/column
-## indices of @var{z}.  @var{n} is a scalar denoting the number of contour
-## lines to compute.  Alternatively @var{lvl} is a vector containing the
-## contour levels.  If only one value (e.g., lvl0) is desired, set
-## @var{lvl} to [lvl0, lvl0].  If both @var{n} or @var{lvl} are omitted
-## a default value of 10 contour levels is assumed.
-##
-## The appearance of the plot can be customized by passing
-## property/value pairs to the function. 
-##
-## If provided, the filled contours are added to the axes object
-## @var{hax} instead of the current axis.
-##
-## The return value @var{c} is a 2xn matrix containing the contour lines
-## as described in the documentation on the @code{contourc} function.
-##
-## The return value @var{h} is handle-vector to the patch objects creating
-## the filled contours.
-##
-## The following example plots filled contours of the @code{peaks}
-## function.
-##
-## @example
-## @group
-## [x, y, z] = peaks (50);
-## contourf (x, y, z, -7:9)
-## @end group
-## @end example
-## @seealso{contourc, contour, contour3, patch}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-## Author: Shai Ayal <shaiay@users.sourceforge.net>
-
-function [c, h] = contourf (varargin)
-
-  [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (xh);
-    newplot ();
-    [ctmp, htmp] = __contour__ (xh, "none", "fill", "on",
-                                "linecolor", "black", varargin{:});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    c = ctmp;
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (50);
-%! contourf (x, y, z, -7:9);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
-%! [X, Y] = pol2cart (theta, r);
-%! Z = sin (2*theta) .* (1-r);
-%! contourf (X, Y, abs (Z), 10);
-
--- a/scripts/plot/copyobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{hnew} =} copyobj (@var{horig})
-## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
-## Construct a copy of the object associated with handle @var{horig}
-## and return a handle @var{hnew} to the new object.
-## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
-## specified, the copied object will be created as a child to @var{hparent}.
-## @seealso{findobj, get, set, struct2hdl, hdl2struct}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-04-01
-
-function hnew = copyobj (horig, hparent = 0)
-
-  partypes = {"root", "figure", "axes", "hggroup"};
-  othertypes = {"line", "patch", "surface", "image", "text"};
-  alltypes = [partypes othertypes];
-
-  if (! ishandle (horig) || nargin > 2)
-    print_usage ();
-  elseif (! ishandle (hparent))
-    hparent = figure (fix (hparent));
-  elseif (! any (strcmpi (get (hparent).type, partypes)))
-    print_usage ();
-  endif
-
-  ## current figure and axes
-  cf = gcf ();
-  ca = gca ();
-  
-  ## compatibility of input handles
-  kididx = find (strcmp (alltypes, get (horig).type));
-  paridx = find (strcmp (alltypes, get (hparent).type));
-
-  if (kididx <= paridx)
-    error ("copyobj: %s object can't be children to %s.",
-           alltypes{kididx}, alltypes{paridx});
-  elseif (nargin == 1)
-    str = hdl2struct (horig);
-    hnew = struct2hdl (str);
-  else
-    str = hdl2struct (horig);
-    hnew = struct2hdl (str, hparent);
-  endif
-
-  ## reset current figure (and eventually axes) to original
-  set (0, "currentfigure", cf);
-  if (get (hnew, "parent") == cf)
-    set (cf, "currentaxes", ca)
-  endif
-  
-endfunction
-
-
-%!demo
-%! hdl = figure (1234);
-%! clf;
-%! hold on;
-%! x = 1:10;
-%! y = x.^2;
-%! dy = 2 * (.2 * x);
-%! y2 = (x - 3).^2;
-%! hg = errorbar (x, y, dy,'#~');
-%! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
-%! plot (x, y2, 'ok-');
-%! legend ('errorbar', 'line');
-%! hnew = copyobj (hdl);
-
-%!demo
-%! ## FIXME: This demo fails occasionally for an obscure reason.
-%! ## It appears that there is something wrong with Octave code for patches.
-%! hdl = figure (1234);
-%! clf;
-%! subplot (2,2,1);
-%! hold on;
-%! contourf (rand (10, 10));
-%! colorbar;
-%! subplot (2,2,2);
-%! quiver (rand (10, 10), rand (10, 10));
-%! subplot (2,2,3);
-%! colormap (jet (64));
-%! hold on;
-%! sombrero;
-%! colorbar ('peer', gca, 'NorthOutside');
-%! subplot (2,2,4);
-%! imagesc (rand (30, 30));
-%! text (15, 15, 'Rotated text', ...
-%!      'HorizontAlalignment', 'Center', 'Rotation', 30);
-%! hnew = copyobj (hdl);
-
-%!testif HAVE_MAGICK
-%! h1 = figure ();
-%! set (h1, "visible", "off");
-%! x = 0:0.1:2*pi;
-%! y1 = sin (x);
-%! y2 = exp (x - 1);
-%! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
-%! xlabel ("X");
-%! ylabel (ax(1), "Axis 1");
-%! ylabel (ax(2), "Axis 2");
-%! axes (ax(1));
-%! text (0.5, 0.5, "Left Axis", ...
-%!       "color", [0 0 1], "horizontalalignment", "center");
-%! axes (ax(2));
-%! text (4.5, 80, "Right Axis", ...
-%!       "color", [0 0.5 0], "horizontalalignment", "center");
-%! s1 = hdl2struct (h1);
-%! h2 = struct2hdl (s1);
-%! s2 = hdl2struct (h2);
-%! png1 = strcat (tmpnam (), ".png");
-%! png2 = strcat (tmpnam (), ".png");
-%! unwind_protect
-%!   print (h1, png1);
-%!   [img1, map1, alpha1] = imread (png1);
-%!   print (h2, png2);
-%!   [img2, map2, alpha2] = imread (png2);
-%! unwind_protect_cleanup
-%!   unlink (png1);
-%!   unlink (png2);
-%! end_unwind_protect
-%! assert (img1, img2);
-%! assert (map1, map2);
-%! assert (alpha1, alpha2);
--- a/scripts/plot/cylinder.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul and Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} cylinder
-## @deftypefnx {Function File} {} cylinder (@var{r})
-## @deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
-## @deftypefnx {Function File} {} cylinder (@var{ax}, @dots{})
-## Generate three matrices in @code{meshgrid} format, such that
-## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit cylinder.
-## The matrices are of size @code{@var{n}+1}-by-@code{@var{n}+1}.
-## @var{r} is a vector containing the radius along the z-axis.
-## If @var{n} or @var{r} are omitted then default values of 20 or [1 1]
-## are assumed.
-##
-## Called with no return arguments, @code{cylinder} calls directly
-## @code{surf (@var{x}, @var{y}, @var{z})}.  If an axes handle @var{ax}
-## is passed as the first argument, the surface is plotted to this set
-## of axes.
-##
-## Examples:
-##
-## @example
-## @group
-## [x, y, z] = cylinder (10:-1:0, 50);
-## surf (x, y, z);
-## title ("a cone");
-## @end group
-## @end example
-## @seealso{sphere}
-## @end deftypefn
-
-function [xx, yy, zz] = cylinder (varargin)
-
-  [ax, args, nargs] = __plt_get_axis_arg__ ((nargout > 0), "cylinder",
-                                            varargin{:});
-
-  if (nargs == 0)
-    n = 20;
-    r = [1, 1];
-  elseif (nargs == 1)
-    n = 20;
-    r = args{1};
-  elseif (nargs == 2)
-    r = args{1};
-    n = args{2};
-  else
-    print_usage ();
-  endif
-
-  if (length (r) < 2)
-    error ("cylinder: length (R) must be larger than 2");
-  endif
-
-  phi = linspace (0, 2*pi, n+1);
-  idx = 1:length (r);
-  [phi, idx] = meshgrid (phi, idx);
-  z = (idx - 1) / (length (r) - 1);
-  r = r(idx);
-  [x, y] = pol2cart (phi, r);
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    surf (ax, x, y, z);
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = cylinder (10:-1:0,50);
-%! surf (x, y, z);
-%! title ('a cone');
-
--- a/scripts/plot/daspect.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{data_aspect_ratio} =} daspect ()
-## @deftypefnx {Function File} {} daspect (@var{data_aspect_ratio})
-## @deftypefnx {Function File} {} daspect (@var{mode})
-## @deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
-## @deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
-## Query or set the data aspect ratio of the current axes.  The aspect 
-## ratio is a normalized 3-element vector representing the span of the x, y,
-## and z-axis limits.
-## 
-## @code{(daspect (@var{mode}))}
-##
-## Set the data aspect ratio mode of the current axes.  @var{mode} is
-## either "auto" or "manual".
-## 
-## @code{daspect ("mode")}
-##
-## Return the data aspect ratio mode of the current axes.
-## 
-## @code{daspect (@var{hax}, @dots{})}
-##
-## Operate on the axes in handle @var{hax} instead of the current axes.
-## 
-## @seealso{axis, pbaspect, xlim, ylim, zlim}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-01-26
-
-function varargout = daspect (varargin)
-
-  hax = gca ();
-
-  if (nargin > 0)
-    if (isscalar (varargin{1}) && ishandle (varargin{1}))
-      hax = varargin{1};
-      varargin = varargin(2:end);
-    endif
-  endif
-  if (numel (varargin) > 0)
-    if (numel (varargin) == 1)
-      if (ischar (varargin{1})
-          && any (strcmpi (varargin{1}, {"mode", "manual", "auto"})))
-        switch (varargin{1})
-        case "mode"
-          if (nargout < 2)
-            varargout{1} = get (hax, "dataaspectratiomode");
-            return
-          else
-            error ("daspect: only one output is allowed");
-          endif
-        case "manual"
-          set (hax, "dataaspectratiomode", "manual");
-        case "auto"
-          set (hax, "dataaspectratiomode", "auto");
-        endswitch
-      elseif (isreal (varargin{1}) && numel (varargin{1}) == 2)
-        set (hax, "dataaspectratio", [varargin{1}, 1]);
-      elseif (isreal (varargin{1}) && numel (varargin{1}) == 3)
-        set (hax, "dataaspectratio", varargin{1});
-      else
-        error ("daspect: invalid input");
-      endif
-    elseif (numel (varargin) > 1)
-      error ("daspect: too many inputs");
-    endif
-  elseif (nargout == 0)
-    print_usage ();
-  endif
-
-  if (nargout == 1)
-    varargout{1} = get (hax, "dataaspectratio");
-  elseif (nargout > 1)
-    error ("daspect: only one output is allowed");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! axis square;
-%! daspect ([1 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos (x), x,sin (x));
-%! axis ([0 4 -1 1]);
-%! daspect ([2 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -1, 1]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! daspect ([1 2 1]);
-%! pbaspect ([2 1 1]);
-%! title ('2x1 plot box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x, sin(x));
-%! axis square;
-%! set (gca, 'activepositionproperty', 'position');
-%! daspect ([1 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -2, 2]');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! axis ([0 4 -1 1]);
-%! set (gca, 'activepositionproperty', 'position');
-%! daspect ([2 1 1]);
-%! title ('square plot-box with axis limits [0, 4, -1, 1]');
-
--- a/scripts/plot/diffuse.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv})
-## Calculate diffuse reflection strength of a surface defined by the normal
-## vector elements @var{sx}, @var{sy}, @var{sz}.
-## The light vector can be specified using parameter @var{lv}.  It can be
-## given as 2-element vector [azimuth, elevation] in degrees or as 3-element
-## vector [lx, ly, lz].
-## @seealso{specular, surfl}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = diffuse (sx, sy, sz, lv)
-
-  if (nargin != 4)
-    print_usage ();
-  endif
-
-  ## check for normal vector
-  if (!size_equal (sx, sy, sz))
-    error ("diffuse: SX, SY, and SZ must have same size");
-  endif
-
-  ## check for light vector (lv) argument
-  if (length (lv) < 2 || length (lv) > 3)
-    error ("diffuse: light vector LV must be a 2- or 3-element vector");
-  elseif (length (lv) == 2)
-    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
-  endif
-
-  ## Normalize view and light vector.
-  if (sum (abs (lv)) > 0)
-    lv  /= norm (lv);
-  endif
-
-  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
-  retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
-  retval(retval < 0) = 0;
-
-endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/area.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,283 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+## Copyright (C) 2007-2009 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} area (@var{y})
+## @deftypefnx {Function File} {} area (@var{x}, @var{y})
+## @deftypefnx {Function File} {} area (@dots{}, @var{lvl})
+## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} area (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} area (@dots{})
+## Area plot of the columns of @var{y}.
+##
+## This plot shows the contributions of each column value to the row sum.  It
+## is functionally similar to @code{plot (@var{x}, cumsum (@var{y}, 2))},
+## except that the area under the curve is shaded.
+##
+## If the @var{x} argument is omitted it defaults to @code{1:rows (@var{y})}.
+## A value @var{lvl} can be defined that determines where the base level of
+## the shading under the curve should be defined.  The default level is 0.
+##
+## Additional property/value pairs are passed directly to the underlying patch
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## object comprising the area patch objects.  The @qcode{"BaseValue"} property
+## of the hggroup can be used to adjust the level where shading begins.
+##
+## Example: Verify identity sin^2 + cos^2 = 1
+##
+## @example
+## @group
+## t = linspace (0, 2*pi, 100)';
+## y = [sin(t).^2, cos(t).^2)];
+## area (t, y);
+## legend ("sin^2", "cos^2", "location", "NorthEastOutside");
+## @end group
+## @end example
+## @seealso{plot, patch}
+## @end deftypefn
+
+function h = area (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  endif
+
+  x = y = [];
+  bv = 0;
+
+  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
+  if (isempty (num_numeric))
+    num_numeric = nargin;     
+  endif
+
+  switch (num_numeric)
+    case 1
+      y = varargin{1};
+    case 2
+      if (isscalar (varargin{2})) 
+        y = varargin{1};
+        bv = varargin{2};
+      else
+        x = varargin{1};
+        y = varargin{2};
+      endif
+    case 3
+      x = varargin{1};
+      y = varargin{2};
+      bv = varargin{3};
+    otherwise
+      print_usage ();
+  endswitch
+
+  if (! isreal (x) || ! isreal (y))
+    error ("area: X and Y must be real vectors or matrices");
+  endif
+  if (! isreal (bv) || ! isscalar (bv))
+    error ("area: LVL must be a real scalar");
+  endif
+
+  if (isvector (y))
+    y = y(:);
+  endif
+  if (isempty (x))
+    x = repmat ([1:rows(y)]', 1, columns (y));
+  elseif (isvector (x))
+    x = repmat (x(:), 1, columns (y));
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __area__ (hax, x, y, bv, varargin{num_numeric+1:end});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function retval = __area__ (ax, x, y, bv, varargin)
+
+  y0 = bv * ones (1, rows (y));
+  y0 = zeros (1, rows (y));
+  retval = [];
+  for i = 1: columns (y);
+
+    lc = __next_line_color__ ();
+
+    ## Must occur after __next_line_color__ in order to work correctly.
+    hg = hggroup ();
+    retval = [retval; hg];
+    args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:});
+
+    x1 = x(:, 1)';
+    y1 = y(:, i)';
+    addproperty ("xdata", hg, "data", x1);
+    addproperty ("ydata", hg, "data", y1);
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+
+    if (i == 1)
+      h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))],
+                     lc, "parent", hg);
+    else
+      y1 = y0 + y1;
+      h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)],
+                     lc, "parent", hg);
+    endif
+
+    y0 = y1;
+
+    addproperty ("basevalue", hg, "data", bv);
+    addlistener (hg, "basevalue", @move_baseline);
+
+    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+
+    addlistener (hg, "edgecolor", @update_props);
+    addlistener (hg, "facecolor", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+
+    addproperty ("areagroup", hg, "data");
+    set (retval, "areagroup", retval);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  endfor
+
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+  set (kids, "edgecolor", get (h, "edgecolor"),
+             "facecolor", get (h, "facecolor"),
+             "linestyle", get (h, "linestyle"),
+             "linewidth", get (h, "linewidth"));
+endfunction
+
+function move_baseline (h, d)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "areagroup");
+      b0 = get (h, "basevalue");
+
+      for hh = hlist(:)'
+        if (hh != h)
+          b1 = get (hh, "basevalue");
+          if (b1 != b0)
+            set (hh, "basevalue", b0);
+          endif
+        endif
+      endfor
+      update_data (h, d);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_data (h, d)
+  hlist = get (h, "areagroup");
+  bv = get (h, "basevalue");
+  for i = 1 : length (hlist)
+    hh = hlist(i);
+    x1 = get (hh, "xdata")(:);
+    y1 = get (hh, "ydata")(:);
+
+    set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]);
+    if (i == 1)
+      set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]);
+    else
+      y1 = y0 + y1;
+      set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]);
+    endif
+
+    y0 = y1;
+  endfor
+endfunction
+
+
+%!demo
+%! ## Verify identity sin^2 + cos^2 = 1
+%! clf;
+%! t = linspace (0, 2*pi, 100)';
+%! y = [sin(t).^2, cos(t).^2];
+%! area (t, y);
+%! axis tight
+%! legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside');  
+%! title ('area() plot');
+
+%!demo
+%! ## Show effects of setting BaseValue
+%! clf;
+%! x = [-2:0.1:2]';
+%! y = x.^2 - 1;
+%! subplot (1, 2, 1)
+%! area (x, y);
+%! title ({'Parabola y = x^2 -1';'BaseValue = 0'});
+%! subplot (1, 2, 2)
+%! h = area (x, y);
+%! set (h, 'basevalue', -1);
+%! title ({'Parabola y = x^2 -1';'BaseValue = -1'});
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! y = rand (size (x));
+%! h = area (x, y);
+%! set (h, 'ydata', sort (get (h, 'ydata')))
+%! title ('area() plot of sorted data');
+
+%% Test input validation
+%!error area ()
+%!error area (1,2,3,4)
+%!error <X and Y must be real vectors or matrices> area ({1})
+%!error <X and Y must be real vectors or matrices> area (1+i)
+%!error <X and Y must be real vectors or matrices> area (1:2, {1, 2})
+%!error <X and Y must be real vectors or matrices> area (1:2, [1 1+i])
+%!error <LVL must be a real scalar> area (1, i)
+%!error <LVL must be a real scalar> area (1, 2, ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/bar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,140 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} bar (@var{y})
+## @deftypefnx {Function File} {} bar (@var{x}, @var{y})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{w})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{style})
+## @deftypefnx {Function File} {} bar (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} bar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} bar (@dots{}, @var{prop}, @var{val}, @dots{})
+## Produce a bar graph from two vectors of X-Y data.
+##
+## If only one argument is given, @var{y}, it is taken as a vector of Y values
+## and the X coordinates are the range @code{1:numel (@var{y})}.
+##
+## The optional input @var{w} controls the width of the bars.  A value of
+## 1.0 will cause each bar to exactly touch any adjacent bars.
+## The default width is 0.8.
+##
+## If @var{y} is a matrix, then each column of @var{y} is taken to be a
+## separate bar graph plotted on the same graph.  By default the columns
+## are plotted side-by-side.  This behavior can be changed by the @var{style}
+## argument which can take the following values:
+##
+## @table @asis
+## @item @qcode{"grouped"} (default) 
+## Side-by-side bars with a gap between bars and centered over the X-coordinate.
+## 
+## @item  @qcode{"stacked"}
+## Bars are stacked so that each X value has a single bar composed of
+## multiple segments.
+##
+## @item @qcode{"hist"}
+## Side-by-side bars with no gap between bars and centered over the
+## X-coordinate.
+##
+## @item @qcode{"histc"}
+## Side-by-side bars with no gap between bars and left-aligned to the
+## X-coordinate.
+## @end table
+##
+## Optional property/value pairs are passed directly to the underlying patch
+## objects.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of handles to the created
+## "bar series" hggroups with one handle per column of the variable @var{y}.
+## This series makes it possible to change a common element in one bar series
+## object and have the change reflected in the other "bar series".
+## For example,
+##
+## @example
+## @group
+## h = bar (rand (5, 10));
+## set (h(1), "basevalue", 0.5);
+## @end group
+## @end example
+##
+## @noindent
+## changes the position on the base of all of the bar series.
+##
+## The following example modifies the face and edge colors using
+## property/value pairs.
+##
+## @example
+## bar (randn (1, 100), "facecolor", "r", "edgecolor", "b");
+## @end example
+##
+## @noindent
+## The color of the bars is taken from the figure's colormap, such that
+##
+## @example
+## @group
+## bar (rand (10, 3));
+## colormap (summer (64));
+## @end group
+## @end example
+##
+## @noindent
+## will change the colors used for the bars.  The color of bars can also be set
+## manually using the @qcode{"facecolor"} property as shown below.
+##
+## @example
+## @group
+## h = bar (rand (10, 3));
+## set (h(1), "facecolor", "r")
+## set (h(2), "facecolor", "g")
+## set (h(3), "facecolor", "b")
+## @end group
+## @end example
+##
+## @seealso{barh, hist, pie, plot, patch}
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = bar (varargin)
+  varargout = cell (nargout, 1);
+  [varargout{:}] = __bar__ (true, "bar", varargin{:});
+endfunction
+
+
+%!demo
+%! clf;
+%! y = rand (11, 1);
+%! h = bar (y);
+%! set (h, 'ydata', sort (rand (11, 1)));
+%! title ('bar() graph');
+
+%!demo
+%! clf;
+%! h = bar (rand (5, 3));
+%! set (h(1), 'facecolor', 'r');
+%! set (h(2), 'facecolor', 'g');
+%! set (h(3), 'facecolor', 'b');
+%! title ('bar() graph w/multiple bars');
+
+%!demo
+%! clf;
+%! h = bar (rand (5, 3), 'stacked');
+%! title ('bar() graph with stacked style');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/barh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,91 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} barh (@var{y})
+## @deftypefnx {Function File} {} barh (@var{x}, @var{y})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{w})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{style})
+## @deftypefnx {Function File} {} barh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} barh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} barh (@dots{}, @var{prop}, @var{val}, @dots{})
+## Produce a horizontal bar graph from two vectors of X-Y data.
+##
+## If only one argument is given, it is taken as a vector of Y values
+## and the X coordinates are the range @code{1:numel (@var{y})}.
+##
+## The optional input @var{w} controls the width of the bars.  A value of
+## 1.0 will cause each bar to exactly touch any adjacent bars.
+## The default width is 0.8.
+##
+## If @var{y} is a matrix, then each column of @var{y} is taken to be a
+## separate bar graph plotted on the same graph.  By default the columns
+## are plotted side-by-side.  This behavior can be changed by the @var{style}
+## argument which can take the following values:
+##
+## @table @asis
+## @item @qcode{"grouped"} (default) 
+## Side-by-side bars with a gap between bars and centered over the Y-coordinate.
+## 
+## @item  @qcode{"stacked"}
+## Bars are stacked so that each Y value has a single bar composed of
+## multiple segments.
+##
+## @item @qcode{"hist"}
+## Side-by-side bars with no gap between bars and centered over the
+## Y-coordinate.
+##
+## @item @qcode{"histc"}
+## Side-by-side bars with no gap between bars and left-aligned to the
+## Y-coordinate.
+## @end table
+##
+## Optional property/value pairs are passed directly to the underlying patch
+## objects.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## 
+## The optional return value @var{h} is a graphics handle to the created
+## bar series hggroup.  For a description of the use of the
+## bar series, @pxref{XREFbar,,bar}.
+## @seealso{bar, hist, pie, plot, patch}
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = barh (varargin)
+  varargout = cell (nargout, 1);
+  [varargout{:}] = __bar__ (false, "barh", varargin{:});
+endfunction
+
+
+%!demo
+%! clf;
+%! x = rand (10, 1);
+%! barh (x);
+%! title ('barh() graph')
+
+%!demo
+%! clf;
+%! h = barh (rand (5, 3));
+%! set (h(1), 'facecolor', 'r')
+%! set (h(2), 'facecolor', 'g')
+%! set (h(3), 'facecolor', 'b')
+%! title ('barh() graph w/multiple bars')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/colorbar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,772 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} colorbar
+## @deftypefnx {Function File} {} colorbar (@var{loc})
+## @deftypefnx {Function File} {} colorbar (@var{delete_option})
+## @deftypefnx {Function File} {} colorbar (@var{hcb}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, "peer", @var{hax}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, "location", @var{loc}, @dots{})
+## @deftypefnx {Function File} {} colorbar (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} colorbar (@dots{})
+## Add a colorbar to the current axes.
+##
+## A colorbar displays the current colormap along with numerical rulings
+## so that the color scale can be interpreted.
+##
+## The optional input @var{loc} determines the location of the colorbar.
+## Valid values for @var{loc} are
+##
+## @table @asis
+## @item @qcode{"EastOutside"}
+## Place the colorbar outside the plot to the right.  This is the default.
+##
+## @item @qcode{"East"}
+## Place the colorbar inside the plot to the right.
+##
+## @item @qcode{"WestOutside"}
+## Place the colorbar outside the plot to the left.
+##
+## @item @qcode{"West"}
+## Place the colorbar inside the plot to the left.
+##
+## @item @qcode{"NorthOutside"}
+## Place the colorbar above the plot.
+##
+## @item @qcode{"North"}
+## Place the colorbar at the top of the plot.
+##
+## @item @qcode{"SouthOutside"}
+## Place the colorbar under the plot.
+##
+## @item @qcode{"South"}
+## Place the colorbar at the bottom of the plot.
+## @end table
+##
+## To remove a colorbar from a plot use any one of the following keywords for
+## the @var{delete_option}: @qcode{"delete"}, @qcode{"hide"}, @qcode{"off"}.
+## 
+## If the argument @qcode{"peer"} is given, then the following argument is
+## treated as the axes handle in which to add the colorbar.  Alternatively,
+## If the first argument @var{hax} is an axes handle, then the colorbar is
+## added to this axis, rather than the current axes returned by @code{gca}.
+##
+## If the first argument @var{hcb} is a handle to a colorbar object, then
+## operate on this colorbar directly.
+##
+## Additional property/value pairs are passed directly to the underlying axes
+## object.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## colorbar object.
+##
+## Implementation Note: A colorbar is created as an additional axes to the
+## current figure with the @qcode{"tag"} property set to @qcode{"colorbar"}. 
+## The created axes object has the extra property @qcode{"location"} which
+## controls the positioning of the colorbar.
+## @seealso{colormap}
+## @end deftypefn
+
+function h = colorbar (varargin)
+
+  [hcb, varargin, nargin] = __plt_get_axis_arg__ ("colorbar", varargin{:});
+
+  if (hcb && ! strcmp (get (hcb, "tag"), "colorbar"))
+    ax = hcb;
+    hcb = [];
+  else
+    ax = [];
+  endif
+  loc = "";
+  args = {};
+  deleting = false;
+
+  i = 1;
+  while (i <= nargin)
+    arg = varargin{i++};
+    if (ischar (arg))
+      switch (tolower (arg))
+        case "peer"
+          if (i > nargin)
+            error ('colorbar: missing axes handle after "peer"');
+          else
+            ax = varargin{i++};
+            if (! isscalar (ax) && ! isaxes (ax))
+              error ('colorbar: expecting an axes handle following "peer"');
+            endif
+          endif
+        case {"north", "south", "east", "west",
+              "northoutside", "southoutside", "eastoutside", "westoutside"}
+          loc = tolower (arg);
+        case "location"
+          if (i > nargin)
+            error ('colorbar: missing value after "location"');
+          else
+            loc = tolower (varargin{i++});
+          endif
+        case {"delete", "hide", "off", "none"}
+          deleting = true;
+        otherwise
+          args{end+1} = arg;
+      endswitch
+    else
+      args{end+1} = arg;
+    endif
+  endwhile
+
+  ## Handle changes to existing colorbar
+  if (! isempty (hcb))
+    if (deleting)
+      delete (hcb);
+      if (nargout > 0)
+        h = hcb;
+      endif
+      return;
+    else
+      ## FIXME: No listener on location property so have to re-create
+      ##        colorbar whenever an option changes.
+      ##        re-instate this code if listener is developed.
+      # if (! isempty (loc))
+      #   set (hcb, "location", loc);
+      # endif
+      # if (! isempty (args))
+      #   set (hcb, args{:});
+      # endif
+      ax = get (get (hcb, "parent"), "currrentaxes");      
+    endif
+  endif
+    
+  if (isempty (loc))
+    loc = "eastoutside";
+  endif
+  if (isempty (ax))
+    ax = gca ();
+  endif
+
+  showhiddenhandles = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    cax = findobj (get (ax, "parent"), "tag", "colorbar", "type", "axes", "axes", ax);
+    if (! isempty (cax))
+      delete (cax);
+    endif
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", showhiddenhandles);
+  end_unwind_protect
+
+  if (! deleting)
+    ## FIXME: Matlab does not require the "position" property to be active.
+    ##        Is there a way to determine the plotbox position for the
+    ##        gnuplot graphics toolkit with the outerposition is active?
+    set (ax, "activepositionproperty", "position");
+    obj = get (ax);
+    obj.__cbar_hax__ = ax;
+    position = obj.position;
+    ## FIXME: Should this be ancestor to accommodate hggroups?
+    hpar = get (ax, "parent");  
+    clen = rows (get (hpar, "colormap"));
+    cext = get (ax, "clim");
+    cdiff = (cext(2) - cext(1)) / clen / 2;
+    cmin = cext(1) + cdiff;
+    cmax = cext(2) - cdiff;
+
+    [pos, cpos, vertical, mirror] =  ...
+        __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
+    set (ax, "position", pos);
+
+    cax = __go_axes__ (hpar, "tag", "colorbar",
+                             "handlevisibility", "on",
+                             "activepositionproperty", "position",
+                             "position", cpos);
+    addproperty ("location", cax, "radio",
+                 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south",
+                 loc);
+    addproperty ("axes", cax, "handle", ax);
+
+    if (vertical)
+      hi = image (cax, [0,1], [cmin, cmax], [1 : clen]');
+      if (mirror)
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "ylim", cext, "ylimmode", "manual",
+                  "yaxislocation", "right", args{:});
+      else
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "ylim", cext, "ylimmode", "manual",
+                  "yaxislocation", "left", args{:});
+      endif
+    else
+      hi = image (cax, [cmin, cmax], [0,1], [1 : clen]);
+      if (mirror)
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xlim", cext, "xlimmode", "manual",
+                  "xaxislocation", "top", args{:});
+      else
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xlim", cext, "xlimmode", "manual",
+                  "xaxislocation", "bottom", args{:});
+      endif
+    endif
+
+    ## Dummy object placed in axis to delete colorbar when axis is deleted.
+    ctext = text (0, 0, "", "tag", "colorbar",
+                  "visible", "off", "handlevisibility", "off",
+                  "xliminclude", "off", "yliminclude", "off",
+                  "zliminclude", "off",
+                  "deletefcn", {@deletecolorbar, cax, obj});
+
+    set (cax, "deletefcn", {@resetaxis, ax, obj});
+
+    addlistener (hpar, "colormap", {@update_colorbar_cmap, hi, vertical, clen});
+    addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical});
+    addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "dataaspectratiomode", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "plotboxaspectratiomode", {@update_colorbar_axis, cax, obj});
+    addlistener (ax, "position", {@update_colorbar_axis, cax, obj});
+
+  endif
+
+  if (nargout > 0)
+    h = cax;
+  endif
+
+endfunction
+
+function deletecolorbar (h, d, hc, orig_props)
+  ## Don't delete the colorbar and reset the axis size if the
+  ## parent figure is being deleted.
+  if (isaxes (hc)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    if (strcmp (get (hc, "beingdeleted"), "off"))
+      delete (hc);
+    endif
+    if (!isempty (ancestor (h, "axes"))
+        && strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
+      ax = ancestor (h, "axes");
+      units = get (ax, "units");
+      set (ax, "units", orig_props.units);
+      set (ancestor (h, "axes"), "position", orig_props.position,
+                            "outerposition", orig_props.outerposition,
+                   "activepositionproperty", orig_props.activepositionproperty);
+      set (ax, "units", units);
+    endif
+  endif
+endfunction
+
+function resetaxis (cax, d, ax, orig_props)
+  if (isaxes (ax))
+    ## FIXME: Probably don't want to delete everyone's listeners on colormap.
+    dellistener (get (ax, "parent"), "colormap");
+    dellistener (ax, "clim");
+    dellistener (ax, "dataaspectratio");
+    dellistener (ax, "dataaspectratiomode");
+    dellistener (ax, "plotboxaspectratio");
+    dellistener (ax, "plotboxaspectratiomode");
+    dellistener (ax, "position");
+
+    units = get (ax, "units");
+    set (ax, "units", orig_props.units);
+    set (ax, "position", orig_props.position,
+             "outerposition", orig_props.outerposition,
+             "activepositionproperty", orig_props.activepositionproperty);
+    set (ax, "units", units);
+  endif
+endfunction
+
+function update_colorbar_clim (hax, d, hi, vert)
+  if (isaxes (hax)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    clen = rows (get (get (hax, "parent"), "colormap"));
+    cext = get (hax, "clim");
+    cdiff = (cext(2) - cext(1)) / clen / 2;
+    cmin = cext(1) + cdiff;
+    cmax = cext(2) - cdiff;
+
+    hiax = get (hi, "parent");
+    if (vert)
+      set (hi, "ydata", [cmin, cmax]);
+      set (hiax, "ylim", cext);
+    else
+      set (hi, "xdata", [cmin, cmax]);
+      set (hiax, "xlim", cext);
+    endif
+
+    ## FIXME: Setting xlim or ylim from within a listener callback
+    ##        causes the axis to change size rather than change limits.
+    ##        Workaround it by jiggling the position property which forces
+    ##        a redraw of the axis object.
+    ##
+    ## Debug Example:
+    ## Uncomment the line below.
+    ##   keyboard;
+    ## Now run the the following code.
+    ##   clf; colorbar (); contour (peaks ())
+    ## Once the keyboard command has been hit in the debugger try
+    ##   set (hiax, "ylim", [0 0.5]) 
+    pos = get (hiax, "position");
+    pos(1) += eps;
+    set (hiax, "position", pos);
+    pos(1) -= eps;
+    set (hiax, "position", pos);
+  endif
+endfunction
+
+function update_colorbar_cmap (hf, d, hi, vert, init_sz)
+  persistent sz = init_sz;
+
+  if (ishandle (hf) && strcmp (get (hf, "type"), "figure")
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
+    clen = rows (get (hf, "colormap"));
+    if (clen != sz)
+      if (vert)
+        set (hi, "cdata", [1:clen]');
+      else
+        set (hi, "cdata", [1:clen]);
+      endif
+      sz = clen;
+      ## Also update limits on axis or there will be white gaps
+      update_colorbar_clim (get (hi, "parent"), d, hi, vert);
+    endif
+  endif
+endfunction
+
+function update_colorbar_axis (h, d, cax, orig_props)
+  if (isaxes (cax)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
+    loc = get (cax, "location");
+    obj = get (h);
+    obj.__cbar_hax__ = h;
+    obj.position = orig_props.position;
+    obj.outerposition = orig_props.outerposition;
+    [pos, cpos, vertical, mirror] =  ...
+        __position_colorbox__ (loc, obj, ancestor (h, "figure"));
+
+    if (vertical)
+      if (mirror)
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "yaxislocation", "right", "position", cpos);
+      else
+        set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
+                  "yaxislocation", "left", "position", cpos);
+      endif
+    else
+      if (mirror)
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xaxislocation", "top", "position", cpos);
+      else
+        set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
+                  "xaxislocation", "bottom", "position", cpos);
+      endif
+    endif
+
+  endif
+endfunction
+
+function [pos, cpos, vertical, mirr] = __position_colorbox__ (cbox, obj, cf)
+
+  ## This will always represent the position prior to adding the colorbar.
+  pos = obj.position;
+  sz = pos(3:4);
+
+  if (strcmp (obj.plotboxaspectratiomode, "manual")
+      || strcmp (obj.dataaspectratiomode, "manual"))
+    if (isempty (strfind (cbox, "outside")))
+      scale = 1.0;
+    else
+      scale = 0.8;
+    endif
+    if (isempty (strfind (cbox, "east")) && isempty (strfind (cbox, "west")))
+      scale = [1, scale];
+    else
+      scale = [scale, 1];
+    endif
+    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")
+        && strcmp (obj.activepositionproperty, "outerposition"))
+      obj.outerposition = obj.outerposition .* [1, 1, scale];
+      off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
+    else
+      obj.position = obj.position .* [1, 1, scale];
+      off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
+    endif
+  else
+    off = 0.0;
+  endif
+
+  switch (cbox)
+    case "northoutside"
+      origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
+      sz = sz .* [1.0, 0.06];
+      pos(4) = 0.8 * pos(4);
+      mirr = true;
+      vertical = false;
+    case "north"
+      origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
+      sz = sz .* [1.0, 0.06] * 0.9;
+      mirr = false;
+      vertical = false;
+    case "southoutside"
+      origin = pos(1:2) + off;
+      sz = sz .* [1.0, 0.06];
+      pos(2) = pos(2) + pos(4) * 0.2;
+      pos(4) = 0.8 * pos(4);
+      mirr = false;
+      vertical = false;
+    case "south"
+      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
+      sz = sz .* [1.0, 0.06] * 0.9;
+      mirr = true;
+      vertical = false;
+    case "eastoutside"
+      origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
+      sz = sz .* [0.06, 1.0];
+      pos(3) = 0.8 * pos(3);
+      mirr = true;
+      vertical = true;
+    case "east"
+      origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
+      sz = sz .* [0.06, 1.0] * 0.9;
+      mirr = false;
+      vertical = true;
+    case "westoutside"
+      origin = pos(1:2) + off;
+      sz = sz .* [0.06, 1.0];
+      pos(1) = pos(1) + pos(3) * 0.2;
+      pos(3) = 0.8 * pos(3);
+      mirr = false;
+      vertical = true;
+    case "west"
+      origin = pos(1:2) + [0.05, 0.05] .* sz + off;
+      sz = sz .* [0.06, 1.0] .* 0.9;
+      mirr = true;
+      vertical = true;
+  endswitch
+
+  cpos = [origin, sz];
+
+  if (strcmp (obj.plotboxaspectratiomode, "manual")
+      || strcmp (obj.dataaspectratiomode, "manual"))
+    obj.position = pos;
+    actual_pos = __actual_axis_position__ (obj);
+    if (strfind (cbox, "outside"))
+      scale = 1.0;
+    else
+      scale = 0.9;
+    endif
+    if (sz(1) > sz(2))
+      ## Ensure north or south colorbars are the proper length
+      dx = (1-scale)*actual_pos(3);
+      cpos(1) = actual_pos(1) + dx/2;
+      cpos(3) = actual_pos(3) - dx;
+    else
+      ## Ensure east or west colorbars are the proper height
+      dy = (1-scale)*actual_pos(4);
+      cpos(2) = actual_pos(2) + dy/2;
+      cpos(4) = actual_pos(4) - dy;
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ();
+%! title ('colorbar() example');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('peer', gca, 'northoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! imagesc (x);
+%! colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! contour (peaks ());
+%! colorbar ('west');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! subplot (2,2,1);
+%!  contour (peaks ());
+%!  colorbar ('east');
+%! subplot (2,2,2);
+%!  contour (peaks ());
+%!  colorbar ('west');
+%! subplot (2,2,3);
+%!  contour (peaks ());
+%!  colorbar ('north');
+%! subplot (2,2,4);
+%!  contour (peaks ());
+%!  colorbar ('south');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,2,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (2,2,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+%! subplot (2,2,3);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (2,2,4);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ();
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('northoutside');
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ();
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('northoutside');
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  axis square;
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (1,2,2);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  colorbar ();
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  colorbar ('westoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (2,1,1);
+%!  imagesc (x);
+%!  colorbar ('northoutside');
+%! subplot (2,1,2);
+%!  imagesc (x);
+%!  colorbar ('southoutside');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! subplot (1,2,1);
+%!  contour (x);
+%!  axis square;
+%!  colorbar ('east');
+%!  xlim ([1, 64]);
+%!  ylim ([1, 64]);
+%! subplot (1,2,2);
+%!  contour (x);
+%!  colorbar ('west');
+%!  xlim ([1, 64]);
+%!  ylim ([1, 64]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! contour (x);
+%! xlim ([1, 64]);
+%! ylim ([1, 64]);
+%! colorbar ();
+%! colorbar off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
+%! contour (x);
+%! xlim ([1, 64]);
+%! ylim ([1, 64]);
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! imagesc (1 ./ hilb (99));
+%! h = colorbar ();
+%! set (h, 'yscale', 'log');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! imagesc (log10 (1 ./ hilb (99)));
+%! h = colorbar ();
+%! ytick = get (h, 'ytick');
+%! set (h, 'yticklabel', sprintf ('10^{%g}|', ytick));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (x, y, 1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
+%! imagesc (y, x, 1 ./ hilb (n));
+%! axis equal;
+%! colorbar ();
+
+## This requires that the axes position be properly determined for 'axis equal'
+%!demo
+%! clf;
+%! colormap ('default');
+%! axes;
+%! colorbar ();
+%! hold on;
+%! contour (peaks ());
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('east');
+%! axis square;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('eastoutside');
+%! axis square;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! pcolor (peaks (20));
+%! shading interp;
+%! axis ('tight', 'square');
+%! colorbar ();
+#%! axes ('color','none','box','on','activepositionproperty','position');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('east');
+%! axis equal;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! plot ([0, 2]);
+%! colorbar ('eastoutside');
+%! axis equal;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/comet.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,104 @@
+## Copyright (C) 2008-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} comet (@var{y})
+## @deftypefnx {Function File} {} comet (@var{x}, @var{y})
+## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
+## @deftypefnx {Function File} {} comet (@var{hax}, @dots{})
+## Produce a simple comet style animation along the trajectory provided by
+## the input coordinate vectors (@var{x}, @var{y}).  If @var{x} is not
+## specified it defaults to the indices of @var{y}.
+##
+## The speed of the comet may be controlled by @var{p}, which represents the
+## time each point is displayed before moving to the next one.  The default for
+## @var{p} is 0.1 seconds.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{comet3}
+## @end deftypefn
+
+## Author: Ben Abbott bpabbott@mac.com
+## Created: 2008-09-21
+
+function comet (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  elseif (nargin == 1)
+    y = varargin{1};
+    x = 1:numel (y);
+    p = 0.1;
+  elseif (nargin == 2)
+    x = varargin{1};
+    y = varargin{2};
+    p = 0.1;
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    p = varargin{3};
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    limits = [min(x), max(x), min(y), max(y)];
+    num = numel (y);
+    dn = round (num/10);
+
+    hl = plot (x(1), y(1), "color", "r", "marker", "none",
+               x(1), y(1), "color", "g", "marker", "none",
+               x(1), y(1), "color", "b", "marker", "o");
+    axis (limits);  # set manual limits to speed up plotting
+
+    for n = 2:(num+dn);
+      m = n - dn;
+      m = max ([m, 1]);
+      k = min ([n, num]);
+      set (hl(1), "xdata", x(1:m), "ydata", y(1:m));
+      set (hl(2), "xdata", x(m:k), "ydata", y(m:k));
+      set (hl(3), "xdata", x(k),   "ydata", y(k));
+      drawnow ();
+      pause (p);
+    endfor
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+
+%!demo
+%! clf;
+%! title ('comet() animation');
+%! hold on;
+%! t = 0:.1:2*pi;
+%! x = cos (2*t) .* (cos (t).^2);
+%! y = sin (2*t) .* (sin (t).^2);
+%! comet (x, y, 0.05);
+%! hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/comet3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,103 @@
+## Copyright (C) 2010-2012 Ben Abbott and John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} comet3 (@var{z})
+## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
+## @deftypefnx {Function File} {} comet3 (@var{hax}, @dots{})
+## Produce a simple comet style animation along the trajectory provided by
+## the input coordinate vectors (@var{x}, @var{y}, @var{z}).  If only @var{z}
+## is specified then @var{x}, @var{y} default to the indices of @var{z}.
+##
+## The speed of the comet may be controlled by @var{p}, which represents the
+## time each point is displayed before moving to the next one.  The default for
+## @var{p} is 0.1 seconds.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{comet}
+## @end deftypefn
+
+## Author: jwe
+## Created: 2010-12-17
+
+function comet3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:});
+
+  if (nargin == 0 || nargin == 2 || nargin > 4)
+    print_usage ();
+  elseif (nargin == 1)
+    z = varargin{1};
+    x = y = 1:numel (z);
+    p = 0.1;
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    p = 0.1;
+  elseif (nargin == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    p = varargin{4};
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    limits = [min(x), max(x), min(y), max(y), min(z), max(z)];
+    num = numel (y);
+    dn = round (num/10);
+
+    hl = plot3 (x(1), y(1), z(1), "color", "r", "marker", "none",
+                x(1), y(1), z(1), "color", "g", "marker", "none",
+                x(1), y(1), z(1), "color", "b", "marker", "o");
+    axis (limits);  # set manual limits to speed up plotting
+
+    for n = 2:(num+dn);
+      m = n - dn;
+      m = max ([m, 1]);
+      k = min ([n, num]);
+      set (hl(1), "xdata", x(1:m), "ydata", y(1:m), "zdata", z(1:m));
+      set (hl(2), "xdata", x(m:k), "ydata", y(m:k), "zdata", z(m:k));
+      set (hl(3), "xdata", x(k)  , "ydata", y(k)  , "zdata", z(k));
+      drawnow ();
+      pause (p);
+    endfor
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+
+%!demo
+%! clf;
+%! title ('comet3() animation');
+%! view (3); hold on;
+%! t = 0:pi/20:5*pi;
+%! comet3 (cos (t), sin (t), t, 0.05);
+%! hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/compass.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,137 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} compass (@var{u}, @var{v})
+## @deftypefnx {Function File} {} compass (@var{z})
+## @deftypefnx {Function File} {} compass (@dots{}, @var{style})
+## @deftypefnx {Function File} {} compass (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} compass (@dots{})
+##
+## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+## from the origin of a polar plot.
+##
+## The arrow representing each vector has one end at the origin and the tip at
+## [@var{u}(i), @var{v}(i)].  If a single complex argument @var{z} is given,
+## then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing the drawn vectors.
+##
+## @example
+## @group
+## a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
+## compass (eig (a));
+## @end group
+## @end example
+##
+## @seealso{polar, feather, quiver, rose, plot}
+## @end deftypefn
+
+function h = compass (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("compass", varargin{:});
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
+    z = varargin{1}(:).';
+    u = real (z);
+    v = imag (z);
+    have_line_spec = (nargin == 2);
+  elseif (nargin >= 2 && isnumeric (varargin{2}))
+    u = varargin{1}(:).';
+    v = varargin{2}(:).';
+    have_line_spec = (nargin == 3);
+  else
+    print_usage ();
+  endif
+
+  arrowsize = 0.20;
+  line_spec = "-b";
+
+  if (have_line_spec)
+    arg = varargin{end};
+    if (ischar (arg) || iscellstr (arg))
+      [~, valid] = __pltopt__ ("compass", arg, false);
+      if (valid)
+        line_spec = arg;
+      else
+        error ("compass: invalid linestyle STYLE");
+      endif
+    else
+      error ("compass: invalid linestyle STYLE");
+    endif
+  endif
+
+  ## Matlab draws compass plots with the arrow head as one continous line,
+  ## and each arrow separately.  This is completely different from quiver
+  ## and quite ugly.
+  n = length (u);
+  xend = u;
+  xtmp = u .* (1 - arrowsize);
+  yend = v;
+  ytmp = v .* (1 - arrowsize);
+  x = [zeros(1, n); xend; xtmp - v * arrowsize / 3; xend; ...
+       xtmp + v * arrowsize / 3];
+  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
+       ytmp - u * arrowsize / 3];
+  [r, p] = cart2pol (x, y);
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hlist = polar (r, p, line_spec);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! randn_9x1_data = [-2.555884; 0.394974; -0.191871; -1.147024; 1.355425; -0.437335; -0.014370; -0.941312; 1.240300];
+%! randn_1x9_data = [1.42934, -1.10821, -1.70404, 0.63357, -0.68337, -1.19771, -0.96502, -1.12810, 0.22457];
+%! a = toeplitz ([1;randn_9x1_data], [1,randn_1x9_data]);
+%! compass (eig (a));
+
+%% Test input validation
+%!error compass ()
+%!error compass (1,2,3,4)
+%!error compass (1, "-r", 2)
+%!error <invalid linestyle STYLE> compass (1, "abc")
+%!error <invalid linestyle STYLE> compass (1, {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contour.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,140 @@
+## Copyright (C) 1993-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contour (@var{z})
+## @deftypefnx {Function File} {} contour (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
+## Create a 2-D contour plot.
+##
+## Plot level curves (contour lines) of the matrix @var{z}, using the
+## contour matrix @var{c} computed by @code{contourc} from the same
+## arguments; see the latter for their interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## Example:
+##
+## @example
+## @group
+## x = 0:2;
+## y = x;
+## z = x' * y;
+## contour (x, y, z, 2:3)
+## @end group
+## @end example
+##
+## @seealso{ezcontour, contourc, contourf, contour3, clabel, meshc, surfc, caxis, colormap, plot}
+##
+## @end deftypefn
+
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, h] = contour (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "none", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks ();
+%! contour (x, y, z);
+%! title ({'contour() plot (isolines of constant Z)'; 'Z = peaks()'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
+%! [X, Y] = pol2cart (theta, r);
+%! Z = sin (2*theta) .* (1-r);
+%! contour (X, Y, abs (Z), 10);
+%! title ({'contour() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! z = peaks ();
+%! contour (z, [0 0]);
+%! title ({'contour() plot with single isoline at Z == 0'; 'Z = peaks()'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levellist = -6:6;
+%!   set (h, "levellist", levellist);
+%!   assert (get (h, "levellist"), levellist)
+%!   assert (get (h, "levellistmode"), "manual")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levelstep = 3;
+%!   set (h, "levelstep", levelstep);
+%!   assert (get (h, "levelstep"), levelstep)
+%!   assert (get (h, "levelstepmode"), "manual")
+%!   assert (get (h, "levellist"), -6:levelstep:6)
+%!   assert (get (h, "levellistmode"), "auto")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contour3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,106 @@
+## Copyright (C) 2007-2012 David BAteman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contour3 (@var{z})
+## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contour3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
+## Create a 3-D contour plot.
+##
+## @code{contour3} plots level curves (contour lines) of the matrix @var{z}
+## at a Z level corresponding to each contour.  This is in contrast to
+## @code{contour} which plots all of the contour lines at the same Z level
+## and produces a 2-D plot.
+##
+## The level curves are taken from the contour matrix @var{c} computed by
+## @code{contourc} for the same arguments; see the latter for their
+## interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## Example:
+##
+## @example
+## @group
+## contour3 (peaks (19));
+## colormap cool;
+## hold on;
+## surf (peaks (19), "facecolor", "none", "edgecolor", "black");
+## @end group
+## @end example
+##
+## @seealso{contour, contourc, contourf, clabel, meshc, surfc, caxis, colormap, plot}
+## @end deftypefn
+
+function [c, h] = contour3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "auto", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off",
+              "xgrid", "on", "ygrid", "on", "zgrid", "on");
+  endif
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap (cool (64));
+%! surf (peaks (19), 'facecolor', 'none', 'edgecolor', [0.85 0.85 0.85]);
+%! hold on;
+%! contour3 (peaks (19));
+%! hold off;
+%! axis tight;
+%! zlim auto;
+%! view (315, 17);
+%! title ({'contour3 of peaks() function', 'gray surf() shows peaks function'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contourc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,171 @@
+## Copyright (C) 2003-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
+## Compute contour lines (isolines of constant Z value).
+##
+## The matrix @var{z} contains height values above the rectangular grid
+## determined by @var{x} and @var{y}.  If only a single input @var{z} is
+## provided then @var{x} is taken to be @code{1:rows (@var{z})} and @var{y} is
+## taken to be @code{1:columns (@var{z})}.
+##
+## The optional input @var{vn} is either a scalar denoting the number of
+## contour lines to compute or a vector containing the Z values where lines
+## will be computed.  When @var{vn} is a vector the number of contour lines
+## is @code{numel (@var{vn})}.  However, to compute a single contour line
+## at a given value use @code{@var{vn} = [val, val]}.  If @var{vn} is omitted
+## it defaults to 10.
+##
+## The return value @var{c} is a 2x@var{n} matrix containing the
+## contour lines in the following format
+##
+## @example
+## @group
+## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
+##      len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
+## @end group
+## @end example
+##
+## @noindent
+## in which contour line @var{n} has a level (height) of @var{levn} and
+## length of @var{lenn}.
+##
+## The optional return value @var{lev} is a vector with the Z values of
+## of the contour levels.
+##
+## Example:
+##
+## @example
+## @group
+## x = 0:2;
+## y = x;
+## z = x' * y;
+## contourc (x, y, z, 2:3)
+##    @result{}   2.0000   2.0000   1.0000   3.0000   1.5000   2.0000
+##         2.0000   1.0000   2.0000   2.0000   2.0000   1.5000
+## @end group
+## @end example
+## @seealso{contour, contourf, contour3, clabel}
+## @end deftypefn
+
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, lev] = contourc (varargin)
+
+  if (nargin < 1 || nargin > 4)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    z = varargin{1};
+    x = 1:columns (z);
+    y = 1:rows (z);
+    vn = 10;
+  elseif (nargin == 2)
+    z = varargin{1};
+    x = 1:columns (z);
+    y = 1:rows (z);
+    vn = varargin{2};
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    vn = 10;
+  elseif (nargin == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    vn = varargin{4};
+  endif
+
+  if (! ismatrix (z) || ! ismatrix (x) || ! ismatrix (y))
+    error ("contourc: X, Y, and Z must be matrices");
+  endif
+
+  if (isscalar (vn))
+    vv = linspace (min (z(:)), max (z(:)), vn+2)(2:end-1);
+  else
+    vv = unique (sort (vn));
+  endif
+
+  if (isvector (x) && isvector (y))
+    cdat = __contourc__ (x(:)', y(:)', z, vv);
+  elseif (! any (bsxfun (@minus, x, x(1,:))(:))
+          && ! any (bsxfun (@minus, y, y(:,1))(:)))
+    ## x,y are uniform grid (such as from meshgrid)
+    cdat = __contourc__ (x(1,:), y(:,1)', z, vv);
+  else
+    ## Data is sampled over non-uniform mesh.
+    ## Algorithm calculates contours for uniform grid
+    ## and then interpolates values back to the non-uniform mesh.
+
+    ## Uniform grid for __contourc__.
+    [nr, nc] = size (z);
+    ii = 1:nc;
+    jj = 1:nr;
+
+    cdat = __contourc__ (ii, jj, z, vv);
+
+    ## Map the contour lines from index space (i,j)
+    ## back to the original grid (x,y)
+    i = 1;
+
+    while (i < columns (cdat))
+      clen = cdat(2, i);
+      idx = i + (1:clen);
+
+      ci = cdat(1, idx);
+      cj = cdat(2, idx);
+
+      ## Due to rounding errors, some elements of ci and cj
+      ## can fall out of the range of ii and jj and
+      ## interp2 would return NA for those values.
+      ## The permitted range is enforced here:
+
+      ci = max (ci, 1); ci = min (ci, nc);
+      cj = max (cj, 1); cj = min (cj, nr);
+
+      cdat(1, idx) = interp2 (ii, jj, x, ci, cj);
+      cdat(2, idx) = interp2 (ii, jj, y, ci, cj);
+
+      i += clen + 1;
+    endwhile
+  endif
+
+  if (nargout > 0)
+    c = cdat;
+    lev = vv;
+  endif
+
+endfunction
+
+
+%!test
+%! x = 0:2;
+%! y = x;
+%! z = x' * y;
+%! c_exp = [2, 1, 1, 2, 2, 3, 1.5, 2; 4, 2, 2, 1, 1, 2, 2, 1.5];
+%! lev_exp = [2 3];
+%! [c_obs, lev_obs] = contourc (x, y, z, 2:3);
+%! assert (c_obs, c_exp, eps);
+%! assert (lev_obs, lev_exp, eps);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/contourf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,114 @@
+## Copyright (C) 2007-2012 Kai Habel
+## Copyright (C) 2003 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} contourf (@var{z})
+## @deftypefnx {Function File} {} contourf (@var{z}, @var{vn})
+## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{vn})
+## @deftypefnx {Function File} {} contourf (@dots{}, @var{style})
+## @deftypefnx {Function File} {} contourf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contourf (@dots{})
+## Create a 2-D contour plot with filled intervals.
+##
+## Plot level curves (contour lines) of the matrix @var{z} and fill the region
+## between lines with colors from the current colormap.
+##
+## The level curves are taken from the contour matrix @var{c} computed by
+## @code{contourc} for the same arguments; see the latter for their
+## interpretation.
+##
+## The appearance of contour lines can be defined with a line style @var{style}
+## in the same manner as @code{plot}.  Only line style and color are used;
+## Any markers defined by @var{style} are ignored.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional output @var{c} are the contour levels in @code{contourc} format.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## comprising the contour lines.
+##
+## The following example plots filled contours of the @code{peaks} function.
+##
+## @example
+## @group
+## [x, y, z] = peaks (50);
+## contourf (x, y, z, -7:9)
+## @end group
+## @end example
+## @seealso{ezcontourf, contour, contourc, contour3, clabel, meshc, surfc, caxis, colormap, plot}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+## Author: Shai Ayal <shaiay@users.sourceforge.net>
+
+function [c, h] = contourf (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "none", "fill", "on",
+                                     "linecolor", "black", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    c = ctmp;
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (50);
+%! contourf (x, y, z, -7:9);
+%! title ({'contourf() plot (filled contour lines)'; 'Z = peaks()'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [theta, r] = meshgrid (linspace (0,2*pi,64), linspace (0,1,64));
+%! [X, Y] = pol2cart (theta, r);
+%! Z = sin (2*theta) .* (1-r);
+%! contourf (X, Y, abs (Z), 10);
+%! title ({'contourf() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = linspace (-2, 2);
+%! [x, y] = meshgrid (x);
+%! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2 + 1);
+%! contourf (x, y, z, [0.4, 0.4]);
+%! title ('Hole should be filled with the background color');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/cylinder.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,109 @@
+## Copyright (C) 2007-2012 Michael Goffioul and Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} cylinder
+## @deftypefnx {Function File} {} cylinder (@var{r})
+## @deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
+## @deftypefnx {Function File} {} cylinder (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
+## Plot a 3-D unit cylinder.
+##
+## The optional input @var{r} is a vector specifying the radius along the
+## unit z-axis.  The default is [1 1] indicating radius 1 at @code{Z == 0}
+## and at @code{Z == 1}.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the cylinder.  The default value is 20.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{cylinder} returns three matrices in
+## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates a unit cylinder.
+##
+## Example:
+##
+## @example
+## @group
+## [x, y, z] = cylinder (10:-1:0, 50);
+## surf (x, y, z);
+## title ("a cone");
+## @end group
+## @end example
+## @seealso{ellipsoid, rectangle, sphere}
+## @end deftypefn
+
+function [xx, yy, zz] = cylinder (varargin)
+
+  [hax, args, nargs] = __plt_get_axis_arg__ ("cylinder", varargin{:});
+
+  if (nargs == 0)
+    r = [1, 1];
+    n = 20;
+  elseif (nargs == 1)
+    r = args{1};
+    n = 20;
+  elseif (nargs == 2)
+    r = args{1};
+    n = args{2};
+  else
+    print_usage ();
+  endif
+
+  if (length (r) < 2)
+    error ("cylinder: length (R) must be larger than 2");
+  endif
+
+  phi = linspace (0, 2*pi, n+1);
+  idx = 1:length (r);
+  [phi, idx] = meshgrid (phi, idx);
+  z = (idx - 1) / (length (r) - 1);
+  r = r(idx);
+  [x, y] = pol2cart (phi, r);
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = cylinder (10:-1:0, 50);
+%! surf (x, y, z);
+%! title ('cylinder() with linearly shrinking radius produces a cone');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ellipsoid.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,99 @@
+## Copyright (C) 2007-2012 Sylvain Pelissier
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ellipsoid (@var{xc}, @var{yc}, @var{zc}, @var{xr}, @var{yr}, @var{zr}, @var{n})
+## @deftypefnx {Function File} {} ellipsoid (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ellipsoid (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} ellipsoid (@dots{})
+## Plot a 3-D ellipsoid.
+##
+## The inputs @var{xc}, @var{yc}, @var{zc} specify the center of the ellipsoid.
+## The inputs @var{xr}, @var{yr}, @var{zr} specify the semi-major axis lengths.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the cylinder.  The default value is 20.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{ellipsoid} returns three matrices in
+## @code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates the ellipsoid.
+## @seealso{cylinder, rectangle, sphere}
+## @end deftypefn
+
+## Author: Sylvain Pelissier <sylvain.pelissier@gmail.com>
+
+function [xx, yy, zz] = ellipsoid (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ellipsoid", varargin{:});
+
+  if (nargin != 6 && nargin != 7)
+    print_usage ();
+  endif
+
+  xc = varargin{1};
+  yc = varargin{2};
+  zc = varargin{3};
+  xr = varargin{4};
+  yr = varargin{5};
+  zr = varargin{6};
+
+  if (nargin == 6)
+    n = 20;
+  else
+    n = varargin{7};
+  endif
+
+  theta = linspace (0, 2 * pi, n + 1);
+  phi = linspace (-pi / 2, pi / 2, n + 1);
+  [theta, phi] = meshgrid (theta, phi);
+
+  x = xr .* cos (phi) .* cos (theta) + xc;
+  y = yr .* cos (phi) .* sin (theta) + yc;
+  z = zr .* sin (phi) + zc;
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+    
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ellipsoid (0, 0, 1, 2, 3, 4, 20);
+%! title ('ellipsoid()');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/errorbar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,220 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} errorbar (@var{args})
+## @deftypefnx {Function File} {} errorbar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} errorbar (@dots{})
+## Create a 2-D with errorbars.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## errorbar (@var{y}, @var{ey})
+## @end example
+##
+## @noindent
+## where the first argument is taken as the set of @var{y} coordinates
+## and the second argument @var{ey} is taken as the errors of the
+## @var{y} values.  @var{x} coordinates are taken to be the indices
+## of the elements, starting with 1.
+##
+## If more than two arguments are given, they are interpreted as
+##
+## @example
+## errorbar (@var{x}, @var{y}, @dots{}, @var{fmt}, @dots{})
+## @end example
+##
+## @noindent
+## where after @var{x} and @var{y} there can be up to four error
+## parameters such as @var{ey}, @var{ex}, @var{ly}, @var{uy}, etc.,
+## depending on the plot type.  Any number of argument sets may appear,
+## as long as they are separated with a format string @var{fmt}.
+##
+## If @var{y} is a matrix, @var{x} and error parameters must also be matrices
+## having same dimensions.  The columns of @var{y} are plotted versus the
+## corresponding columns of @var{x} and errorbars are drawn from
+## the corresponding columns of error parameters.
+##
+## If @var{fmt} is missing, yerrorbars ("~") plot style is assumed.
+##
+## If the @var{fmt} argument is supplied, it is interpreted as in
+## normal plots.  In addition, @var{fmt} may include an errorbar style
+## which must precede the line and marker format.  The following plot
+## styles are supported by errorbar:
+##
+## @table @samp
+## @item ~
+## Set yerrorbars plot style (default).
+##
+## @item >
+## Set xerrorbars plot style.
+##
+## @item ~>
+## Set xyerrorbars plot style.
+##
+## @item #
+## Set boxes plot style.
+##
+## @item #~
+## Set boxerrorbars plot style.
+##
+## @item #~>
+## Set boxxyerrorbars plot style.
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to the hggroup object
+## representing the data plot and errorbars.
+##
+## Examples:
+##
+## @example
+## errorbar (@var{x}, @var{y}, @var{ex}, ">")
+## @end example
+##
+## @noindent
+## produces an xerrorbar plot of @var{y} versus @var{x} with @var{x}
+## errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}.
+##
+## @example
+## @group
+## errorbar (@var{x}, @var{y1}, @var{ey}, "~",
+##           @var{x}, @var{y2}, @var{ly}, @var{uy})
+## @end group
+## @end example
+##
+## @noindent
+## produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
+## Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
+## @var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
+## @var{y2}+@var{uy}.
+##
+## @example
+## @group
+## errorbar (@var{x}, @var{y}, @var{lx}, @var{ux},
+##           @var{ly}, @var{uy}, "~>")
+## @end group
+## @end example
+##
+## @noindent
+## produces an xyerrorbar plot of @var{y} versus @var{x} in which
+## @var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux}
+## and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}.
+## @seealso{semilogxerr, semilogyerr, loglogerr, plot}
+## @end deftypefn
+
+## Created: 18.7.2000
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = errorbar (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = __errcomm__ ("errorbar", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270];
+%! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112];
+%! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2);
+%! title ('errorbar() with Y errorbars');
+
+%!demo
+%! clf;
+%! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850];
+%! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149];
+%! errorbar (0:10, rand_1x11_data3, rand_1x11_data4, '>');
+%! title ('errorbar() with X errorbars');
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, '~', x, y2, err, '>');
+%! legend ("Y errbar", "X errbar");
+%! title ('errorbar() with 2 datasets');
+
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, err, '#r', x, y2, err, err, '#~');
+%! legend ("X errbox", "Y errbox");
+%! title ('errorbar() with error boxes');
+
+%!demo
+%! clf;
+%! x = 0:0.5:2*pi;
+%! err = x/30;
+%! y1 = sin (x);
+%! y2 = cos (x);
+%! errorbar (x, y1, err, err, err, err, '~>', ...
+%!           x, y2, err, err, err, err, '#~>-*');
+%! legend ("X-Y errbars", "X-Y errboxes");
+%! title ('errorbar() with X-Y errorbars and error boxes');
+
+## Invisible figure used for tests
+%!shared hf, hax
+%! hf = figure ("visible", "off");
+%! hax = axes;
+
+%!error errorbar ()
+%!error errorbar (1)
+%!error <data argument 1 must be numeric> errorbar (hax, {1}, 2)
+%!error <data argument 2 must be numeric> errorbar (hax, 1, {2})
+%!error <size of argument 2 does not match others> errorbar (hax, 1, 1:2)
+%!error <size of argument 3 does not match others> errorbar (hax, 1, 2, 3:4)
+%!error <too many arguments to plot> errorbar (1,2,3,4,5,6,7)
+
+%!error <2 column errorplot is only valid for xerr> errorbar (1,2, "~>")
+%!error <6 columns only valid for xyerr and boxxy> errorbar (1,2,3,4,5,6, "~")
+%!error <error plot requires 2, 3, 4, or 6 arguments> errorbar (1,2,3,4,5)
+
+## Close figure used for testing
+%!test
+%! close (hf);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezcontour.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,75 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezcontour (@var{f})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontour (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
+##
+## Plot the contour lines of a function.
+## 
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontour (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{contour, ezcontourf, ezplot, ezmeshc, ezsurfc}
+## @end deftypefn
+
+function h = ezcontour (varargin)
+
+  [htmp, needusage] = __ezplot__ ("contour", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontour (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezcontourf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,75 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezcontourf (@var{f})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontourf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
+##
+## Plot the filled contour lines of a function.
+## 
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontourf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{contourf, ezcontour, ezplot, ezmeshc, ezsurfc}
+## @end deftypefn
+
+function h = ezcontourf (varargin)
+
+  [htmp, needusage] = __ezplot__ ("contourf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontourf (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezmesh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,104 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezmesh (@var{f})
+## @deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezmesh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
+##
+## Plot the mesh defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created 
+## surface object.
+##
+## Example 1: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmesh (f, [-3, 3]);
+## @end group
+## @end example
+##
+## Example 2: parametrically defined function
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos (t);
+## fy = @@(s,t) sin (s) .* cos (t);
+## fz = @@(s,t) sin (t);
+## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{mesh, ezmeshc, ezplot, ezsurf, ezsurfc, hidden}
+## @end deftypefn
+
+function h = ezmesh (varargin)
+
+  [htmp, needusage] = __ezplot__ ("mesh", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmesh (f, [-3, 3]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! fx = @(s,t) cos (s) .* cos (t);
+%! fy = @(s,t) sin (s) .* cos (t);
+%! fz = @(s,t) sin (t);
+%! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezmeshc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,86 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezmeshc (@var{f})
+## @deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezmeshc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
+##
+## Plot the mesh and contour lines defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created mesh plot and a second handle for the created contour
+## plot.
+##
+## Example: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmeshc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{meshc, ezmesh, ezplot, ezsurf, ezsurfc, hidden}
+## @end deftypefn
+
+function h = ezmeshc (varargin)
+
+  [htmp, needusage] = __ezplot__ ("meshc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmeshc (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,108 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezplot (@var{f})
+## @deftypefnx {Function File} {} ezplot (@var{f2v})
+## @deftypefnx {Function File} {} ezplot (@var{fx}, @var{fy})
+## @deftypefnx {Function File} {} ezplot (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezplot (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezplot (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezplot (@dots{})
+##
+## Plot the 2-D curve defined by the function @var{f}.
+##
+## The function @var{f} may be a string, inline function, or function handle
+## and can have either one or two variables.  If @var{f} has one variable, then
+## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi}
+## with 500 points.
+##
+## If @var{f2v} is a function of two variables then the implicit function
+## @code{@var{f}(@var{x},@var{y}) = 0} is calculated over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## For example:
+##
+## @example
+## ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1)
+## @end example
+##
+## If two functions are passed as inputs then the parametric function
+##
+## @example
+## @group
+## @var{x} = @var{fx} (@var{t})
+## @var{y} = @var{fy} (@var{t})
+## @end group
+## @end example
+##
+## @noindent
+## is plotted over the domain @code{-2*pi <= @var{t} <= 2*pi} with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}, or @var{t} for a parametric plot.  If
+## @var{dom} is a four element vector, then the minimum and maximum values are
+## @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting
+## the function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created line objects.
+##
+## @seealso{plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc}
+## @end deftypefn
+
+function h = ezplot (varargin)
+
+  [htmp, needusage] = __ezplot__ ("plot", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% sinc function using function handle
+%! f = @(x) sin (pi*x) ./ (pi*x);
+%! ezplot (f);
+
+%!demo
+%! %% example of a function string and explicit limits
+%! clf;
+%! ezplot ('1/x', [-2 2]);
+
+%!demo
+%! %% parameterized function example over -2*pi <= t <= +2*pi
+%! clf;
+%! ezplot (@cos, @sin);
+
+%!demo
+%! %% implicit function of 2 variables
+%! clf;
+%! ezplot (inline ('x^2 - y^2 - 1'));
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezplot3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,84 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezplot3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
+##
+## Plot a parametrically defined curve in three dimensions.
+##
+## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions,
+## or function handles with one argument defining the function.  By
+## default the plot is over the domain @code{0 <= @var{t} <= 2*pi}
+## with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of @var{t}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting the
+## function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## @example
+## @group
+## fx = @@(t) cos (t);
+## fy = @@(t) sin (t);
+## fz = @@(t) t;
+## ezplot3 (fx, fy, fz, [0, 10*pi], 100);
+## @end group
+## @end example
+##
+## @seealso{plot3, ezplot, ezmesh, ezsurf}
+## @end deftypefn
+
+function h = ezplot3 (varargin)
+
+  [htmp, needusage] = __ezplot__ ("plot3", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! fx = @(t) cos (t);
+%! fy = @(t) sin (t);
+%! fz = @(t) t;
+%! ezplot3 (fx, fy, fz, [0, 10*pi], 100);
+
+%!demo
+%! clf;
+%! fx = @(t) cos (t);
+%! fy = @(t) sin (t);
+%! fz = @(t) t;
+%! ezplot3 (fx, fy, fz, [0, 5*pi], 100, 'animate');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezpolar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,72 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezpolar (@var{f})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
+##
+## Plot a 2-D function in polar coordinates.
+## 
+## The function @var{f} is a string, inline function, or function handle with
+## a single argument.  The expected form of the function is
+## @code{@var{rho} = @var{f}(@var{theta})}.
+## By default the plot is over the domain @code{0 <= @var{theta} <= 2*pi}
+## with 500 points.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of @var{theta}.
+##
+## @var{n} is a scalar defining the number of points to use in plotting
+## the function.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## ezpolar (@@(t) sin (5/4 * t), [0, 8*pi]);
+## @end example
+##
+## @seealso{polar, ezplot}
+## @end deftypefn
+
+function h = ezpolar (varargin)
+
+  [htmp, needusage] = __ezplot__ ("polar", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! ezpolar (@(t) sin (5/4 * t), [0, 8*pi]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezsurf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,116 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezsurf (@var{f})
+## @deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezsurf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
+##
+## Plot the surface defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Example 1: 2-argument function
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## Example 2: parametrically defined function
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos (t);
+## fy = @@(s,t) sin (s) .* cos (t);
+## fz = @@(s,t) sin (t);
+## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{surf, ezsurfc, ezplot, ezmesh, ezmeshc, shading}
+## @end deftypefn
+
+function h = ezsurf (varargin)
+
+  [htmp, needusage] = __ezplot__ ("surf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurf (f, [-3, 3]);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! fx = @(s,t) cos (s) .* cos (t);
+%! fy = @(s,t) sin (s) .* cos (t);
+%! fz = @(s,t) sin (t);
+%! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
+%! axis equal;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) x.^2 + y.^2;
+%! subplot (1,2,1);
+%!  ezsurf (f, [-2,2]);
+%!  title ({'x^2 + y^2'; 'plotted over rectangular grid (default)'});
+%! subplot (1,2,2);
+%!  ezsurf (f, [-2,2], 'circ');
+%!  title ({'x^2 + y^2'; 'plotted over circular disk with "circ"'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ezsurfc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,86 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ezsurfc (@var{f})
+## @deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, "circ")
+## @deftypefnx {Function File} {} ezsurfc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
+##
+## Plot the surface and contour lines defined by a function.
+##
+## @var{f} is a string, inline function, or function handle with two arguments
+## defining the function.  By default the plot is over the meshed domain
+## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
+## @var{fz} (@var{s}, @var{t})]}.
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## values of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
+## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If the argument @qcode{"circ"} is given, then the function is plotted over
+## a disk centered on the middle of the domain @var{dom}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created surface plot and a second handle for the created
+## contour plot.
+##
+## Example:
+##
+## @example
+## @group
+## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurfc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{surfc, ezsurf, ezplot, ezmesh, ezmeshc, shading}
+## @end deftypefn
+
+function h = ezsurfc (varargin)
+
+  [htmp, needusage] = __ezplot__ ("surfc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurfc (f, [-3, 3]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/feather.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,136 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} feather (@var{u}, @var{v})
+## @deftypefnx {Function File} {} feather (@var{z})
+## @deftypefnx {Function File} {} feather (@dots{}, @var{style})
+## @deftypefnx {Function File} {} feather (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} feather (@dots{})
+##
+## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+## from equidistant points on the x-axis.
+##
+## If a single complex argument @var{z} is given, then
+## @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing the drawn vectors.
+##
+## @example
+## @group
+## phi = [0 : 15 : 360] * pi/180;
+## feather (sin (phi), cos (phi));
+## @end group
+## @end example
+##
+## @seealso{plot, quiver, compass}
+## @end deftypefn
+
+function h = feather (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("feather", varargin{:});
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
+    z = varargin{1}(:).';
+    u = real (z);
+    v = imag (z);
+    have_line_spec = (nargin == 2);
+  elseif (nargin >= 2 && isnumeric (varargin{2}))
+    ioff = 3;
+    u = varargin{1}(:).';
+    v = varargin{2}(:).';
+    have_line_spec = (nargin == 3);
+  else
+    print_usage ();
+  endif
+
+  arrowsize = 0.20;
+  line_spec = "-b";
+
+  if (have_line_spec)
+    arg = varargin{end};
+    if (ischar (arg) || iscellstr (arg))
+      [~, valid] = __pltopt__ ("feather", arg, false);
+      if (valid)
+        line_spec = arg;
+      else
+        error ("feather: invalid linestyle STYLE");
+      endif
+    else
+      error ("feather: invalid linestyle STYLE");
+    endif
+  endif
+
+  ## Matlab draws feather plots, with the arrow head as one continous
+  ## line, and each arrow separately. This is completely different from
+  ## quiver and quite ugly.
+  n = length (u);
+  xend = [1 : n] + u;
+  xtmp = [1 : n] + u .* (1 - arrowsize);
+  yend = v;
+  ytmp = v .* (1 - arrowsize);
+  x = [[1 : n]; xend; xtmp - v * arrowsize / 3; xend; ...
+       xtmp + v * arrowsize / 3];
+  y = [zeros(1, n); yend; ytmp + u * arrowsize / 3; yend; ...
+       ytmp - u * arrowsize / 3];
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hlist = plot (x, y, line_spec, [1, n], [0, 0], line_spec);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! phi = [0 : 15 : 360] * pi/180;
+%! feather (sin (phi), cos (phi));
+%! axis tight;
+%! title ('feather plot');
+
+%% Test input validation
+%!error feather ()
+%!error feather (1,2,3,4)
+%!error feather (1, "-r", 2)
+%!error <invalid linestyle STYLE> feather (1, "abc")
+%!error <invalid linestyle STYLE> feather (1, {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/fill.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,165 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} fill (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
+## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
+## @deftypefnx {Function File} {} fill (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} fill (@dots{})
+## Create one or more filled 2-D polygons.
+##
+## The inputs @var{x} and @var{y} are the coordinates of the polygon vertices.
+## If the inputs are matrices then the rows represent different vertices and
+## each column produces a different polygon.  @code{fill} will close any open
+## polygons before plotting. 
+##
+## The input @var{c} determines the color of the polygon.  The simplest form
+## is a single color specification such as a @code{plot} format or an
+## RGB-triple.  In this case the polygon(s) will have one unique color.  If
+## @var{c} is a vector or matrix then the color data is first scaled using
+## @code{caxis} and then indexed into the current colormap.  A row vector will
+## color each polygon (a column from matrices @var{x} and @var{y}) with a
+## single computed color.  A matrix @var{c} of the same size as @var{x} and
+## @var{y} will compute the color of each vertex and then interpolate the face
+## color between the vertices.
+##
+## Multiple property/value pairs for the underlying patch object may be
+## specified, but they must appear in pairs.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created patch objects.
+##
+## Example: red square
+##
+## @example
+## @group
+## vertices = [0 0
+##             1 0
+##             1 1
+##             0 1];
+## fill (vertices(:,1), vertices(:,2), "r");
+## axis ([-0.5 1.5, -0.5 1.5])
+## axis equal
+## @end group
+## @end example
+##
+## @seealso{patch, caxis, colormap}
+## @end deftypefn
+
+function h = fill (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("fill", varargin{:});
+
+  hlist = [];
+  iargs = __find_patches__ (varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    old_nxtplt = get (hax, "nextplot");
+    set (hax, "nextplot", "add");
+
+    for i = 1 : length (iargs)
+      if (i == length (iargs))
+        args = varargin(iargs(i):end);
+      else
+        args = varargin(iargs(i):iargs(i+1)-1);
+      endif
+      [htmp, fail] = __patch__ (hax, args{:});
+      if (fail)
+        print_usage ();
+      endif
+      hlist(end + 1, 1) = htmp;
+    endfor
+
+    if (strcmp (old_nxtplt, "replace"))
+      set (hax, "nextplot", old_nxtplt);
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hlist;
+  endif
+
+endfunction
+
+function iargs = __find_patches__ (varargin)
+  iargs = [];
+  i = 1;
+  while (i < nargin)
+    iargs(end + 1) = i;
+    if (ischar (varargin{i})
+        && (strcmpi (varargin{i}, "faces")
+            || strcmpi (varargin{i}, "vertices")))
+      i += 4;
+    elseif (isnumeric (varargin{i}))
+      i += 2;
+    endif
+
+    if (i <= nargin)
+      while (true);
+        if (ischar (varargin{i})
+            && (strcmpi (varargin{i}, "faces")
+                || strcmpi (varargin{i}, "vertices")))
+          break;
+        elseif (isnumeric (varargin{i}))
+          ## Assume its the colorspec
+          i++;
+          break;
+        elseif (ischar (varargin{i}))
+          colspec = tolower (varargin{i});
+          collen = length (colspec);
+          if (any (strncmp (colspec, 
+                            {"blue", "black", "k", "red", "green", ...
+                             "yellow", "magenta", "cyan", "white"},
+                            collen)))
+            i++;
+            break;
+          endif
+        else
+          i += 2;
+        endif
+      endwhile
+    endif
+  endwhile
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t1 = (1/16:1/8:1) * 2*pi;
+%! t2 = ((1/16:1/8:1) + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! h = fill (x1,y1,'r', x2,y2,'g');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/fplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,219 @@
+## Copyright (C) 2005-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} fplot (@var{fn}, @var{limits})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{tol})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{n})
+## @deftypefnx {Function File} {} fplot (@dots{}, @var{fmt})
+## @deftypefnx {Function File} {[@var{x}, @var{y}] =} fplot (@dots{})
+## Plot a function @var{fn} within the range defined by @var{limits}.
+##
+## @var{fn} is a function handle, inline function, or string containing the
+## name of the function to evaluate.
+##
+## The limits of the plot are of the form @w{@code{[@var{xlo}, @var{xhi}]}} or
+## @w{@code{[@var{xlo}, @var{xhi}, @var{ylo}, @var{yhi}]}}.
+##
+## The next three arguments are all optional and any number of them may be
+## given in any order.
+##
+## @var{tol} is the relative tolerance to use for the plot and defaults
+## to 2e-3 (.2%).
+##
+## @var{n} is the minimum number of points to use.  When @var{n} is specified,
+## the maximum stepsize will be @code{@var{xhi} - @var{xlo} / @var{n}}.  More
+## than @var{n} points may still be used in order to meet the relative
+## tolerance requirement.
+##
+## The @var{fmt} argument specifies the linestyle to be used by the plot
+## command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## With no output arguments the results are immediately plotted.  With two
+## output arguments the 2-D plot data is returned.  The data can subsequently
+## be plotted manually with @code{plot (@var{x}, @var{y})}.
+##
+## Example:
+##
+## @example
+## @group
+## fplot (@@cos, [0, 2*pi])
+## fplot ("[cos(x), sin(x)]", [0, 2*pi])
+## @end group
+## @end example
+##
+## Note: @code{fplot} works best with continuous functions.  Functions with
+## discontinuities are unlikely to plot well.  This restriction may be removed
+## in the future.
+## @seealso{ezplot, plot}
+## @end deftypefn
+
+## Author: Paul Kienzle <pkienzle@users.sf.net>
+
+function [X, Y] = fplot (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("fplot", varargin{:});
+
+  if (nargin < 2 || nargin > 5)
+    print_usage ();
+  endif
+
+  fn = varargin{1};
+  limits = varargin{2};
+  varargin = varargin(3:end);
+
+  if (strcmp (typeinfo (fn), "inline function"))
+    fn = vectorize (fn);
+    nam = formula (fn);
+  elseif (isa (fn, "function_handle"))
+    nam = func2str (fn);
+  elseif (all (isalnum (fn)))
+    nam = fn;
+  elseif (ischar (fn))
+    fn = vectorize (inline (fn));
+    nam = formula (fn);
+  else
+    error ("fplot: FN must be a function handle, inline function, or string");
+  endif
+
+  if (iscomplex (limits) || (numel (limits) != 2 && numel (limits) != 4))
+    error ("fplot: LIMITS must be a real vector with 2 or 4 elements");
+  endif
+
+  n = 5;
+  tol = 2e-3;
+  fmt = "";
+  for i = 1:numel (varargin)
+    arg = varargin{i};
+    if (ischar (arg))
+      fmt = arg;
+    elseif (isnumeric (arg) && isscalar (arg) && arg > 0)
+      if (arg == fix (arg))
+        n = arg;
+      else
+        tol = arg;
+      endif
+    else
+      error ("fplot: bad input in position %d", i+2);
+    endif
+  endfor
+
+  if (n != 5) 
+    ## n was specified 
+    x0 = linspace (limits(1), limits(2), n/2 + 1)';
+    y0 = feval (fn, x0);
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  else
+    x0 = linspace (limits(1), limits(2), 5)';
+    y0 = feval (fn, x0);
+    n = 8;
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  endif
+
+  if (rows (x0) != rows (y0))
+    ## FN is a constant value function
+    y0 = repmat (y0, size (x0));
+    y = repmat (y, size (x));
+  endif
+
+  err0 = Inf;
+
+  ## FIXME: This algorithm should really use adaptive scaling as the 
+  ##        the numerical quadrature algorithms do so that extra points are
+  ##        used where they are needed and not spread evenly over the entire
+  ##        x-range.  Try any function with a discontinuity, such as
+  ##        fplot (@tan, [-2, 2]) or fplot ("1./x", [-3, 2]), to see the
+  ##        problems with the current solution.
+
+  while (n < 2^18)    # Something is wrong if we need more than 250K points
+    yi = interp1 (x0, y0, x, "linear");
+    ## relative error calculation using average of [yi,y] as reference
+    ## since neither estimate is known a priori to be better than the other.
+    err = 0.5 * max (abs ((yi - y) ./ (yi + y))(:));
+    if (err < tol || abs (err - err0) < tol/2)
+      ## Either relative tolerance has been met OR
+      ## algorithm has stopped making any reasonable progress per iteration.
+      break;
+    endif
+    x0 = x;
+    y0 = y;
+    err0 = err;
+    n = 2 * (n - 1) + 1;
+    x = linspace (limits(1), limits(2), n)';
+    y = feval (fn, x);
+  endwhile
+
+  if (nargout == 2)
+    X = x;
+    Y = y;
+  else
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    plot (hax, x, y, fmt);
+    axis (hax, limits);
+    if (isvector (y))
+      legend (hax, nam);
+    else
+      for i = 1:columns (y)
+        nams{i} = sprintf ("%s(:,%i)", nam, i);
+      endfor
+      legend (hax, nams{:});
+    endif
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! fplot (@cos, [0, 2*pi]);
+%! title ('fplot() single function');
+
+%!demo
+%! clf;
+%! fplot ('[cos(x), sin(x)]', [0, 2*pi]);
+%! title ('fplot() multiple functions');
+
+%!demo
+%! clf;
+%! %% sinc function
+%! fh = @(x) sin (pi*x) ./ (pi*x);
+%! fplot (fh, [-5, 5]);
+%! title ('fplot() sinc function');
+
+%!test
+%! [x, y] = fplot ("[cos(x), sin(x)]", [0, 2*pi]);
+%! assert (columns (y) == 2);
+%! assert (rows (x) == rows (y));
+%! assert (y, [cos(x), sin(x)], -2e-3);
+
+%% Test input validation
+%!error fplot (1)
+%!error fplot (1,2,3,4,5,6)
+%!error <FN must be a function handle> fplot (1, [0 1])
+%!error <LIMITS must be a real vector> fplot (@cos, [i, 2*i])
+%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1])
+%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1 2 3])
+%!error <bad input in position 3> fplot (@cos,[-1,1], {1})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/hist.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,212 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} hist (@var{y})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{x})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{nbins})
+## @deftypefnx {Function File} {} hist (@var{y}, @var{x}, @var{norm})
+## @deftypefnx {Function File} {} hist (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} hist (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{nn}, @var{xx}] =} hist (@dots{})
+## Produce histogram counts or plots.
+##
+## With one vector input argument, @var{y}, plot a histogram of the values
+## with 10 bins.  The range of the histogram bins is determined by the
+## range of the data.  With one matrix input argument, @var{y}, plot a
+## histogram where each bin contains a bar per input column.
+##
+## Given a second vector argument, @var{x}, use that as the centers of
+## the bins, with the width of the bins determined from the adjacent
+## values in the vector.
+##
+## If scalar, the second argument, @var{nbins}, defines the number of bins.
+##
+## If a third argument is provided, the histogram is normalized such that
+## the sum of the bars is equal to @var{norm}.
+##
+## Extreme values are lumped into the first and last bins.
+##
+## The histogram's appearance may be modified by specifying property/value
+## pairs.  For example the face and edge color may be modified.
+##
+## @example
+## @group
+## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
+## @end group
+## @end example
+##
+## @noindent
+## The histogram's colors also depend upon the current colormap.
+##
+## @example
+## @group
+## hist (rand (10, 3));
+## colormap (summer ());
+## @end group
+## @end example
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## With two output arguments, produce the values @var{nn} (numbers of elements)
+## and @var{xx} (bin centers) such that @code{bar (@var{xx}, @var{nn})} will
+## plot the histogram.
+##
+## @seealso{histc, bar, pie, rose}
+## @end deftypefn
+
+## Author: jwe
+
+function [nn, xx] = hist (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("hist", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+  
+  y = varargin{1};
+  varargin = varargin(2:end);
+
+  arg_is_vector = isvector (y);
+
+  if (arg_is_vector)
+    y = y(:);
+  endif
+
+  if (! isreal (y))
+    error ("hist: Y must be real valued");
+  endif
+
+  max_val = max (y(:));
+  min_val = min (y(:));
+
+  iarg = 1;
+  if (nargin == 1 || ischar (varargin{iarg}))
+    n = 10;
+    x = [0.5:n]'/n;
+    x = x * (max_val - min_val) + ones (size (x)) * min_val;
+  else
+    ## nargin is either 2 or 3
+    x = varargin{iarg++};
+    if (isscalar (x))
+      n = x;
+      if (n <= 0)
+        error ("hist: number of bins NBINS must be positive");
+      endif
+      x = [0.5:n]'/n;
+      x = x * (max_val - min_val) + ones (size (x)) * min_val;
+    elseif (isreal (x))
+      if (isvector (x))
+        x = x(:);
+      endif
+      xsort = sort (x);
+      if (any (xsort != x))
+        warning ("hist: bin values not sorted on input");
+        x = xsort;
+      endif
+    else
+      error ("hist: second argument must be a scalar or a vector");
+    endif
+  endif
+
+  ## Avoid issues with integer types for x and y
+  x = double (x);
+  y = double (y);
+
+  cutoff = (x(1:end-1,:) + x(2:end,:)) / 2;
+  n = rows (x);
+  y_nc = columns (y);
+  if (n < 30 && columns (x) == 1)
+    ## The following algorithm works fastest for n less than about 30.
+    chist = zeros (n+1, y_nc);
+    for i = 1:n-1
+      chist(i+1,:) = sum (y <= cutoff(i));
+    endfor
+    chist(n+1,:) = sum (! isnan (y));
+  else
+    ## The following algorithm works fastest for n greater than about 30.
+    ## Put cutoff elements between boundaries, integrate over all
+    ## elements, keep totals at boundaries.
+    [s, idx] = sort ([y; repmat(cutoff, 1, y_nc)]);
+    len = rows (y);
+    chist = cumsum (idx <= len);
+    chist = [(zeros (1, y_nc));
+             (reshape (chist(idx > len), rows (cutoff), y_nc));
+             (chist(end,:) - sum (isnan (y)))];
+  endif
+
+  freq = diff (chist);
+
+  if (nargin > 2 && ! ischar (varargin{iarg}))
+    ## Normalize the histogram.
+    norm = varargin{iarg++};
+    freq *= norm / sum (! isnan (y));
+  endif
+
+  if (nargout > 0)
+    if (arg_is_vector)  
+      ## Matlab compatibility requires a row vector return
+      nn = freq';  
+      xx = x';
+    else
+      nn = freq;
+      xx = x;
+    endif
+  else
+    if (isempty (hax))
+      hax = gca ();
+    endif
+    bar (hax, x, freq, "hist", varargin{iarg:end});
+  endif
+
+endfunction
+
+
+%!test
+%! [nn,xx] = hist ([1:4], 3);
+%! assert (xx, [1.5,2.5,3.5]);
+%! assert (nn, [2,1,1]);
+%!test
+%! [nn,xx] = hist ([1:4]', 3);
+%! assert (xx, [1.5,2.5,3.5]);
+%! assert (nn, [2,1,1]);
+%!test
+%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3]);
+%! assert (xx, [1,2,3]);
+%! assert (nn, [3,2,1]);
+%!test
+%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3], 6);
+%! assert (xx, [1,2,3]);
+%! assert (nn, [3,2,1]);
+%!test
+%! [nn,xx] = hist ([[1:4]', [1:4]'], 3);
+%! assert (xx, [1.5;2.5;3.5]);
+%! assert (nn, [[2,1,1]',[2,1,1]']);
+%!test
+%! for n = [10, 30, 100, 1000]
+%!   assert (sum (hist ([1:n], n)), n);
+%!   assert (sum (hist ([1:n], [2:n-1])), n);
+%!   assert (sum (hist ([1:n], [1:n])), n);
+%!   assert (sum (hist ([1:n], 29)), n);
+%!   assert (sum (hist ([1:n], 30)), n);
+%! endfor
+%!assert (hist (1,1), 1)
+%!assert (size (hist (randn (750,240), 200)), [200,240])
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isocolors.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,173 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{cd}] =} isocolors (@var{c}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{r}, @var{g}, @var{b}, @var{v})
+## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@dots{}, @var{p})
+## @deftypefnx {Function File} {} isocolors (@dots{})
+##
+## If called with one output argument and the first input argument
+## @var{c} is a three-dimensional array that contains color values and
+## the second input argument @var{v} keeps the vertices of a geometry
+## then return a matrix @var{cd} with color data information for the
+## geometry at computed points
+## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
+## @var{cd} can be taken to manually set FaceVertexCData of a patch.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays of the same size than @var{c}
+## then the color data is taken at those given points.  Instead of the
+## color data @var{c} this function can also be called with RGB values
+## @var{r}, @var{g}, @var{b}.  If input argumnets @var{x}, @var{y},
+## @var{z} are not given then again @command{meshgrid} computed values
+## are taken.
+##
+## Optionally, the patch handle @var{p} can be given as the last input
+## argument to all variations of function calls instead of the vertices
+## data @var{v}.  Finally, if no output argument is given then directly
+## change the colors of a patch that is given by the patch handle
+## @var{p}.
+##
+## For example:
+##
+## @example
+## function [] = isofinish (p)
+##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##             "PlotBoxAspectRatio", [1 1 1]);
+##   set (p, "FaceColor", "interp");
+##   ## set (p, "FaceLighting", "flat");
+##   ## light ("Position", [1 1 5]); ## Available with JHandles
+## endfunction
+##
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v] = isosurface (x, y, z, c, iso);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## cdat = rand (size (c));       # Compute random patch color data
+## isocolors (x, y, z, cdat, p); # Directly set colors of patch
+## isofinish (p);                # Call user function isofinish
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## [r, g, b] = meshgrid (lin, 2-lin, 2-lin);
+## cdat = isocolors (x, y, z, c, v); # Compute color data vertices
+## set (p, "FaceVertexCData", cdat); # Set color data manually
+## isofinish (p);
+##
+## subplot (2,2,3); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## cdat = isocolors (r, g, b, c, p); # Compute color data patch
+## set (p, "FaceVertexCData", cdat); # Set color data manually
+## isofinish (p);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white
+## cdat = isocolors (x, y, z, r, g, b, v);
+## set (p, "FaceVertexCData", cdat);
+## isofinish (p);
+## @end example
+##
+## @seealso{isosurface, isonormals}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isocolors (varargin)
+  calc_rgb = false;
+  switch (nargin)
+    case 2
+      c = varargin{1};
+      vp = varargin{2};
+      x = 1:size (c, 2);
+      y = 1:size (c, 1);
+      z = 1:size (c, 3);
+    case 4
+      calc_rgb = true;
+      R = varargin{1};
+      G = varargin{2};
+      B = varargin{3};
+      vp = varargin{4};
+      x = 1:size (R, 1);
+      y = 1:size (R, 2);
+      z = 1:size (R, 3);
+    case 5
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      c = varargin{4};
+      vp = varargin{5};
+    case 7
+      calc_rgb = true;
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      R = varargin{4};
+      G = varargin{5};
+      B = varargin{6};
+      vp = varargin{7};
+    otherwise
+      print_usage ();
+  endswitch
+  if (ismatrix (vp) && columns (vp) == 3)
+    pa = [];
+    v = vp;
+  elseif ( ishandle (vp) )
+    pa = vp;
+    v = get (pa, "Vertices");
+  else
+    error ("isocolors: last argument is not a vertex list or patch handle");
+  endif
+  if (calc_rgb)
+    new_col = zeros (rows (v), 3);
+    new_col(:,1) = __interp_cube__ (x, y, z, R, v, "values" );
+    new_col(:,2) = __interp_cube__ (x, y, z, G, v, "values" );
+    new_col(:,3) = __interp_cube__ (x, y, z, B, v, "values" );
+  else
+    new_col = __interp_cube__ (x, y, z, c, v, "values" );
+  endif
+  switch (nargout)
+    case 0
+      if (!isempty (pa))
+        set (pa, "FaceVertexCData", new_col);
+      endif
+    case 1
+      varargout = {new_col};
+    otherwise
+      print_usage ();
+  endswitch
+endfunction
+
+
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
+%! [f, v] = isosurface (x, y, z, c, .4);
+%! cdat = isocolors (x, y, z, c, v);
+%! assert (rows (cdat) == rows (v));
+## Can't create a patch handle for tests without a figure
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isonormals.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,165 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{n}] =} isonormals (@var{val}, @var{v})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{val}, @var{p})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{p})
+## @deftypefnx {Function File} {[@var{n}] =} isonormals (@dots{}, "negate")
+## @deftypefnx {Function File} {} isonormals (@dots{}, @var{p})
+##
+## If called with one output argument and the first input argument
+## @var{val} is a three-dimensional array that contains the data for an
+## isosurface geometry and the second input argument @var{v} keeps the
+## vertices of an isosurface then return the normals @var{n} in form of
+## a matrix with the same size than @var{v} at computed points
+## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
+## @var{n} can be taken to manually set @var{VertexNormals} of a patch.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays with the same size than @var{val}
+## then the volume data is taken at those given points.  Instead of the
+## vertices data @var{v} a patch handle @var{p} can be passed to this
+## function.
+##
+## If given the string input argument @qcode{"negate"} as last input argument
+## then compute the reverse vector normals of an isosurface geometry.
+##
+## If no output argument is given then directly redraw the patch that is
+## given by the patch handle @var{p}.
+##
+## For example:
+## @c Set example in small font to prevent overfull line
+##
+## @smallexample
+## function [] = isofinish (p)
+##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##             "PlotBoxAspectRatio", [1 1 1]);
+##   set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals
+##   set (p, "FaceColor", "interp");
+##   ## set (p, "FaceLighting", "phong");
+##   ## light ("Position", [1 1 5]); # Available with JHandles
+## endfunction
+##
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v, cdat] = isosurface (x, y, z, c, iso, y);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isofinish (p); ## Call user function isofinish
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isonormals (x, y, z, c, p); # Directly modify patch
+## isofinish (p);
+##
+## subplot (2,2,3); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## n = isonormals (x, y, z, c, v); # Compute normals of isosurface
+## set (p, "VertexNormals", n);    # Manually set vertex normals
+## isofinish (p);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## isonormals (x, y, z, c, v, "negate"); # Use reverse directly
+## isofinish (p);
+## @end smallexample
+##
+## @seealso{isosurface, isocolors}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isonormals (varargin)
+  na = nargin;
+  negate = false;
+  if (ischar (varargin{nargin}))
+    na = nargin-1;
+    if (strcmp (lower (varargin{nargin}), "negate"))
+      negate = true;
+    else
+      error ("isonormals: Unknown option '%s'", varargin{nargin});
+    endif
+  endif
+  switch (na)
+    case 2
+      c = varargin{1};
+      vp = varargin{2};
+      x = 1:size (c, 2);
+      y = 1:size (c, 1);
+      z = 1:size (c, 3);
+    case 5
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+      c = varargin{4};
+      vp = varargin{5};
+    otherwise
+      print_usage ();
+  endswitch
+  if (ismatrix (vp) && columns (vp) == 3)
+    pa = [];
+    v = vp;
+  elseif (ishandle (vp))
+    pa = vp;
+    v = get (pa, "Vertices");
+  else
+    error ("isonormals: Last argument is not a vertex list or a patch handle");
+  endif
+  if (negate)
+    normals = -__interp_cube__ (x, y, z, c, v, "normals");
+  else
+    normals = __interp_cube__ (x, y, z, c, v, "normals");
+  endif
+  switch (nargout)
+    case 0
+      if (!isempty (pa))
+        set (pa, "VertexNormals", normals);
+      endif
+    case 1
+      varargout = {normals};
+    otherwise
+      print_usage ();
+  endswitch
+endfunction
+
+
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
+%! n = isonormals (x, y, z, c, v);
+%! assert (size (v), size (n));
+%!test
+%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
+%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
+%! np = isonormals (x, y, z, c, v);
+%! nn = isonormals (x, y, z, c, v, "negate");
+%! assert (np, -nn);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/isosurface.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,231 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{fv}] =} isosurface (@var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@dots{}, "noshare", "verbose")
+## @deftypefnx {Function File} {[@var{fvc}] =} isosurface (@dots{}, @var{col})
+## @deftypefnx {Function File} {[@var{f}, @var{v}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{f}, @var{v}, @var{c}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+## @deftypefnx {Function File} {} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col}, @var{opt})
+##
+## If called with one output argument and the first input argument
+## @var{val} is a three-dimensional array that contains the data of an
+## isosurface geometry and the second input argument @var{iso} keeps the
+## isovalue as a scalar value then return a structure array @var{fv}
+## that contains the fields @var{Faces} and @var{Vertices} at computed
+## points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output
+## argument @var{fv} can directly be taken as an input argument for the
+## @command{patch} function.
+##
+## If called with further input arguments @var{x}, @var{y} and @var{z}
+## which are three--dimensional arrays with the same size than @var{val}
+## then the volume data is taken at those given points.
+##
+## The string input argument @qcode{"noshare"} is only for compatibility and
+## has no effect.  If given the string input argument
+## @qcode{"verbose"} then print messages to the command line interface about the
+## current progress.
+##
+## If called with the input argument @var{col} which is a
+## three-dimensional array of the same size than @var{val} then take
+## those values for the interpolation of coloring the isosurface
+## geometry.  Add the field @var{FaceVertexCData} to the structure
+## array @var{fv}.
+##
+## If called with two or three output arguments then return the
+## information about the faces @var{f}, vertices @var{v} and color data
+## @var{c} as separate arrays instead of a single structure array.
+##
+## If called with no output argument then directly process the
+## isosurface geometry with the @command{patch} command.
+##
+## For example,
+##
+## @example
+## @group
+## [x, y, z] = meshgrid (1:5, 1:5, 1:5);
+## val = rand (5, 5, 5);
+## isosurface (x, y, z, val, .5);
+## @end group
+## @end example
+##
+## @noindent
+## will directly draw a random isosurface geometry in a graphics window.
+## Another example for an isosurface geometry with different additional
+## coloring
+## @c Set example in small font to prevent overfull line
+##
+## @smallexample
+## N = 15;    # Increase number of vertices in each direction
+## iso = .4;  # Change isovalue to .1 to display a sphere
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
+## figure (); # Open another figure window
+##
+## subplot (2,2,1); view (-38, 20);
+## [f, v] = isosurface (x, y, z, c, iso);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceColor", "green", "FaceLighting", "phong");
+## # light ("Position", [1 1 5]); # Available with the JHandles package
+##
+## subplot (2,2,2); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceColor", "none", "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+##
+## subplot (2,2,3); view (-38, 20);
+## [f, v, c] = isosurface (x, y, z, c, iso, y);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
+##            "FaceColor", "interp", "EdgeColor", "none");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+##
+## subplot (2,2,4); view (-38, 20);
+## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
+##            "FaceColor", "interp", "EdgeColor", "blue");
+## set (gca, "PlotBoxAspectRatioMode", "manual", ...
+##           "PlotBoxAspectRatio", [1 1 1]);
+## # set (p, "FaceLighting", "phong");
+## # light ("Position", [1 1 5]);
+## @end smallexample
+##
+## @seealso{isonormals, isocolors}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function varargout = isosurface (varargin)
+
+  if (nargin < 2 || nargin > 8 || nargout > 3)
+    print_usage ();
+  endif
+
+  calc_colors = false;
+  f = v = c = [];
+  verbose = false;
+  noshare = false;
+  if (nargin >= 5)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    val = varargin{4};
+    iso = varargin{5};
+    if (nargin >= 6 && ismatrix (varargin{6}))
+      colors = varargin{6};
+      calc_colors = true;
+    endif
+  else
+    val = varargin{1};
+    [n2, n1, n3] = size (val);
+    [x, y, z] = meshgrid (1:n1, 1:n2, 1:n3);
+    iso = varargin{2};
+    if (nargin >= 3 && ismatrix (varargin{3}))
+        colors = varargin{3};
+        calc_colors = true;
+    endif
+  endif
+  if (calc_colors)
+    if (nargout == 2)
+      warning ("isosurface: colors will be calculated, but no output argument to receive it.");
+    endif
+    [fvc.faces, fvc.vertices, fvc.facevertexcdata] = __marching_cube__ (x, y, z, val, iso, colors);
+  else
+    [fvc.faces, fvc.vertices] = __marching_cube__ (x, y, z, val, iso);
+  endif
+
+  if (isempty (fvc.vertices) || isempty (fvc.faces))
+    warning ("isosurface: triangulation is empty");
+  endif
+
+  switch (nargout)
+    case 0
+      ## plot the calculated surface
+      hax = newplot ();
+      if (calc_colors)
+        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
+                    "FaceVertexCData", fvc.facevertexcdata,
+                    "FaceColor", "flat", "EdgeColor", "none");
+      else
+        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
+                    "FaceColor", "g", "EdgeColor", "k");
+      endif
+      if (! ishold ())
+        set (hax, "view", [-37.5, 30],
+                  "xgrid", "on", "ygrid", "on", "zgrid", "on");
+      endif
+    case 1
+      varargout = {fvc};
+    case 2
+      varargout = {fvc.faces, fvc.vertices};
+    case 3
+      varargout = {fvc.faces, fvc.vertices, fvc.facevertexcdata};
+    otherwise
+      print_usage ();
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
+%! v = x.^2 + y.^2 + z.^2;
+%! isosurface (x, y, z, v, 1);
+%! title ('isosurface of a sphere');
+
+%!shared x, y, z, val
+%! [x, y, z]  = meshgrid (0:1, 0:1, 0:1); # Points for single
+%! val        = [0, 0; 0, 0];             # cube and a 3-D
+%! val(:,:,2) = [0, 0; 1, 0];             # array of values
+
+%!test
+%! fv = isosurface (x, y, z, val, 0.3);
+%! assert (isfield (fv, "vertices"), true);
+%! assert (isfield (fv, "faces"), true);
+%! assert (size (fv.vertices), [3 3]);
+%! assert (size (fv.faces), [1 3]);
+
+%!test
+%! fvc = isosurface (x, y, z, val, .3, y);
+%! assert (isfield (fvc, "vertices"), true);
+%! assert (isfield (fvc, "faces"), true);
+%! assert (isfield (fvc, "facevertexcdata"), true);
+%! assert (size (fvc.vertices), [3 3]);
+%! assert (size (fvc.faces), [1 3]);
+%! assert (size (fvc.facevertexcdata), [3 1]);
+
+%!test
+%! [f, v] = isosurface (x, y, z, val, .3);
+%! assert (size (f), [1 3]);
+%! assert (size (v), [3 3]);
+
+%!test
+%! [f, v, c] = isosurface (x, y, z, val, .3, y);
+%! assert (size (f), [1 3]);
+%! assert (size (v), [3 3]);
+%! assert (size (c), [3 1]);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/line.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,92 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} line ()
+## @deftypefnx {Function File} {} line (@var{x}, @var{y})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} line (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} line (@dots{})
+## Create line object from @var{x} and @var{y} (and possibly @var{z}) and
+## insert in the current axes.
+##
+## Multiple property-value pairs may be specified for the line object, but they
+## must appear in pairs.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle (or vector of handles)
+## to the line objects created.
+##
+## @seealso{image, patch, rectangle, surface, text}
+## @end deftypefn
+
+## Author: jwe
+
+function h = line (varargin)
+
+  ## Get axis argument which may be in a 'parent' PROP/VAL pair
+  [hax, varargin] = __plt_get_axis_arg__ ("line", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+
+  htmp = __line__ (hax, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf
+%! x = 0:0.3:10;
+%! y1 = cos (x);
+%! y2 = sin (x);
+%! subplot (3,1,1);
+%!  args = {'color', 'b', 'marker', 's'};
+%!  line ([x(:), x(:)], [y1(:), y2(:)], args{:});
+%!  title ('Test broadcasting for line()');
+%! subplot (3,1,2);
+%!  line (x(:), [y1(:), y2(:)], args{:});
+%! subplot (3,1,3);
+%!  line ([x(:), x(:)+pi/2], y1(:), args{:});
+%!  xlim ([0 10]);
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = line;
+%!   assert (findobj (hf, "type", "line"), h);
+%!   assert (get (h, "xdata"), [0 1], eps);
+%!   assert (get (h, "ydata"), [0 1], eps);
+%!   assert (get (h, "type"), "line");
+%!   assert (get (h, "color"), get (0, "defaultlinecolor"));
+%!   assert (get (h, "linestyle"), get (0, "defaultlinelinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/loglog.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,120 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} loglog (@var{y})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{prop}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} loglog (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} loglog (@dots{})
+## Produce a 2-D plot using logarithmic scales for both axes.
+##
+## See the documentation of @code{plot} for a description of the arguments
+## that @code{loglog} will accept.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogx, semilogy}
+## @end deftypefn
+
+## Author: jwe
+
+function h = loglog (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log", "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on", "yminortick", "on");
+    endif
+
+    htmp = __plt__ ("loglog", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = 1:0.01:10;
+%! x = sort ((t .* (1 + rand (size (t)))) .^ 2);
+%! y = (t .* (1 + rand (size (t)))) .^ 2;
+%! loglog (x, y);
+%! title ({'loglog() plot', 'Both axes are logarithmic'});
+
+%!demo
+%! clf;
+%! a = logspace (-5, 1, 10);
+%! b =-logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  loglog (a, b);
+%!  xlabel ('loglog (a, b)');
+%!
+%! subplot (1,2,2);
+%!  loglog (a, abs (b));
+%!  set (gca, 'ydir', 'reverse');
+%!  xlabel ('loglog (a, abs (b))');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   loglog (a, b);
+%!   assert (get (gca, "yscale"), "log");
+%!   assert (get (gca, "xscale"), "log");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b =-logspace (-5, 1, 10);
+%!   loglog (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "ytick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/loglogerr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,87 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} loglogerr (@var{args})
+## @deftypefnx {Function File} {} loglogerr (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} loglogerr (@dots{})
+## Produce 2-D plots on a double logarithm axis with errorbars.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a double logarithm plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+## @seealso{errorbar, semilogxerr, semilogyerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = loglogerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log", "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on", "yminortick", "on");
+    endif
+    htmp = __errcomm__ ("loglogerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = exp (log (0.01):0.2:log (10));
+%! y = wblpdf (x, 3, 2);
+%! eyu = 2*rand (size (y)) .* y;
+%! eyl = 0.5*rand (size (y)) .* y;
+%! loglogerr (x, y, eyl, eyu, '#~x-');
+%! xlim (x([1, end]));
+%! title ({'loglogerr(): loglog() plot with errorbars', ...
+%!         'Both axes are logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/mesh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,127 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} mesh (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} mesh (@var{z})
+## @deftypefnx {Function File} {} mesh (@dots{}, @var{c})
+## @deftypefnx {Function File} {} mesh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} mesh (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} mesh (@dots{})
+## Plot a 3-D wireframe mesh.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{ezmesh, meshc, meshz, trimesh, contour, surf, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: jwe
+
+function h = mesh (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("mesh: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("mesh", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+
+    set (htmp, "facecolor", "w");
+    set (htmp, "edgecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z);
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'Z-axis';
+%! title ('mesh() with color proportional to height');
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z, z.^2);
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'linear scale';
+%! title ('mesh() with color proportional to Z^2');
+
+%!demo
+%! clf;
+%! x = logspace (0,1,11);
+%! z = x'*x;
+%! mesh (x, x, z, z.^2);
+%! set (gca, 'zscale', 'log');
+%! xlabel 'X-axis';
+%! ylabel 'Y-axis';
+%! zlabel 'log scale';
+%! title ({'mesh() with color proportional to Z^2', 'Z-axis is log scale'});
+%! if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
+%!   title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'});
+%! endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/meshc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,111 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} meshc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} meshc (@var{z})
+## @deftypefnx {Function File} {} meshc (@dots{}, @var{c})
+## @deftypefnx {Function File} {} meshc (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} meshc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} meshc (@dots{})
+## Plot a 3-D wireframe mesh with underlying contour lines.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+## 
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle to the created surface object and to the created contour plot.
+##
+## @seealso{ezmeshc, mesh, meshz, contour, surfc, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = meshc (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("meshc: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+
+    ## FIXME - gnuplot does not support a filled surface and a
+    ## non-filled contour.  3D filled patches are also not supported.
+    ## Thus, the facecolor will be transparent for the gnuplot backend.
+    set (htmp, "facecolor", "w");
+    set (htmp, "edgecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on",
+                "xlimmode", "manual", "ylimmode", "manual");
+    endif
+
+    drawnow ();
+
+    zmin = get (hax, "zlim")(1);
+    [~, htmp2] = __contour__ (hax, zmin, varargin{:});
+
+    htmp = [htmp; htmp2];
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X, Y] = meshgrid (linspace (-3, 3, 40));
+%! Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
+%! meshc (X, Y, Z);
+%! title ('meshc() combines mesh/contour plots');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/meshz.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,162 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} meshz (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} meshz (@var{z})
+## @deftypefnx {Function File} {} meshz (@dots{}, @var{c})
+## @deftypefnx {Function File} {} meshz (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} meshz (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} meshz (@dots{})
+## Plot a 3-D wireframe mesh with a surrounding curtain.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{mesh, meshc, contour, surf, surface, waterfall, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = meshz (varargin)
+
+  if (! all (cellfun ("isreal", varargin)))
+    error ("meshz: X, Y, Z, C arguments must be real");
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshz", varargin{:});
+
+  ## Find where property/value pairs start
+  charidx = find (cellfun ("isclass", varargin, "char"), 1);
+
+  have_c = false;
+  if (isempty (charidx))
+    if (nargin == 2 || nargin == 4) 
+      have_c = true;
+      charidx = nargin;   # bundle C matrix back into varargin 
+    else
+      charidx = nargin + 1;
+    endif
+  endif
+
+  if (charidx == 2)
+    z = varargin{1};
+    [m, n] = size (z);
+    x = 1:n;
+    y = (1:m).';
+  else
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+  endif
+
+  if (isvector (x) && isvector (y))
+    x = [x(1), x(:).', x(end)];
+    y = [y(1); y(:); y(end)];
+  else
+    x = [x(1,1), x(1,:), x(1,end);
+         x(:,1), x, x(:,end);
+         x(end,1), x(end,:), x(end,end)];
+    y = [y(1,1), y(1,:), y(1,end);
+         y(:,1), y, y(:,end);
+         y(end,1), y(end,:), y(end,end)];
+  endif
+
+  zref = min (z(isfinite (z)));
+  z = [zref .* ones(1, columns(z) + 2);
+       zref .* ones(rows(z), 1), z, zref .* ones(rows(z), 1);
+       zref .* ones(1, columns(z) + 2)];
+
+  if (have_c)
+    c = varargin{charidx};
+    cref = min (c(isfinite (c)));
+    c = [cref .* ones(1, columns(c) + 2);
+         cref .* ones(rows(c), 1), c, cref .* ones(rows(c), 1);
+         cref .* ones(1, columns(c) + 2)];
+    varargin(charidx) = c;
+  endif
+    
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = mesh (x, y, z, varargin{charidx:end});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! meshz (Z);
+%! title ('meshz() plot of peaks() function');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! subplot (1,2,1)
+%!  mesh (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('mesh() plot');
+%! subplot (1,2,2)
+%!  meshz (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('meshz() plot');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = peaks ();
+%! [fx, fy] = gradient (Z); 
+%! C = sqrt (fx.^2 + fy.^2);
+%! meshz (X,Y,Z,C);
+%! title ('meshz() plot with color determined by gradient');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,104 @@
+FCN_FILE_DIRS += plot/draw
+
+plot_draw_PRIVATE_FCN_FILES = \
+  plot/draw/private/__add_datasource__.m \
+  plot/draw/private/__bar__.m \
+  plot/draw/private/__contour__.m \
+  plot/draw/private/__errcomm__.m \
+  plot/draw/private/__errplot__.m \
+  plot/draw/private/__ezplot__.m \
+  plot/draw/private/__interp_cube__.m \
+  plot/draw/private/__line__.m \
+  plot/draw/private/__marching_cube__.m \
+  plot/draw/private/__patch__.m \
+  plot/draw/private/__pie__.m \
+  plot/draw/private/__plt__.m \
+  plot/draw/private/__quiver__.m \
+  plot/draw/private/__scatter__.m \
+  plot/draw/private/__stem__.m
+
+plot_draw_FCN_FILES = \
+  plot/draw/area.m \
+  plot/draw/barh.m \
+  plot/draw/bar.m \
+  plot/draw/colorbar.m \
+  plot/draw/comet3.m \
+  plot/draw/comet.m \
+  plot/draw/compass.m \
+  plot/draw/contour3.m \
+  plot/draw/contourc.m \
+  plot/draw/contourf.m \
+  plot/draw/contour.m \
+  plot/draw/cylinder.m \
+  plot/draw/ellipsoid.m \
+  plot/draw/errorbar.m \
+  plot/draw/ezcontourf.m \
+  plot/draw/ezcontour.m \
+  plot/draw/ezmeshc.m \
+  plot/draw/ezmesh.m \
+  plot/draw/ezplot3.m \
+  plot/draw/ezplot.m \
+  plot/draw/ezpolar.m \
+  plot/draw/ezsurfc.m \
+  plot/draw/ezsurf.m \
+  plot/draw/feather.m \
+  plot/draw/fill.m \
+  plot/draw/fplot.m \
+  plot/draw/hist.m \
+  plot/draw/isocolors.m \
+  plot/draw/isonormals.m \
+  plot/draw/isosurface.m \
+  plot/draw/line.m \
+  plot/draw/loglogerr.m \
+  plot/draw/loglog.m \
+  plot/draw/meshc.m \
+  plot/draw/mesh.m \
+  plot/draw/meshz.m \
+  plot/draw/pareto.m \
+  plot/draw/patch.m \
+  plot/draw/pcolor.m \
+  plot/draw/peaks.m \
+  plot/draw/pie3.m \
+  plot/draw/pie.m \
+  plot/draw/plot3.m \
+  plot/draw/plot.m \
+  plot/draw/plotmatrix.m \
+  plot/draw/plotyy.m \
+  plot/draw/polar.m \
+  plot/draw/quiver3.m \
+  plot/draw/quiver.m \
+  plot/draw/rectangle.m \
+  plot/draw/ribbon.m \
+  plot/draw/rose.m \
+  plot/draw/scatter3.m \
+  plot/draw/scatter.m \
+  plot/draw/semilogxerr.m \
+  plot/draw/semilogx.m \
+  plot/draw/semilogyerr.m \
+  plot/draw/semilogy.m \
+  plot/draw/shrinkfaces.m \
+  plot/draw/slice.m \
+  plot/draw/sombrero.m \
+  plot/draw/sphere.m \
+  plot/draw/stairs.m \
+  plot/draw/stem3.m \
+  plot/draw/stemleaf.m \
+  plot/draw/stem.m \
+  plot/draw/surface.m \
+  plot/draw/surfc.m \
+  plot/draw/surfl.m \
+  plot/draw/surf.m \
+  plot/draw/surfnorm.m \
+  plot/draw/tetramesh.m \
+  plot/draw/trimesh.m \
+  plot/draw/triplot.m \
+  plot/draw/trisurf.m \
+  plot/draw/waterfall.m \
+  $(plot_draw_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_draw_FCN_FILES)
+
+PKG_ADD_FILES += plot/draw/PKG_ADD
+
+DIRSTAMP_FILES += plot/draw/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pareto.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,132 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2003 Alberto Terruzzi
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pareto (@var{y})
+## @deftypefnx {Function File} {} pareto (@var{y}, @var{x})
+## @deftypefnx {Function File} {} pareto (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} pareto (@dots{})
+## Draw a Pareto chart.
+##
+## A Pareto chart is a bar graph that arranges information in such a way
+## that priorities for process improvement can be established; It organizes
+## and displays information to show the relative importance of data.  The chart
+## is similar to the histogram or bar chart, except that the bars are arranged
+## in decreasing magnitude from left to right along the x-axis.
+##
+## The fundamental idea (Pareto principle) behind the use of Pareto
+## diagrams is that the majority of an effect is due to a small subset of the
+## causes.  For quality improvement, the first few contributing causes 
+## (leftmost bars as presented on the diagram) to a problem usually account for
+## the majority of the result.  Thus, targeting these "major causes" for
+## elimination results in the most cost-effective improvement scheme.
+##
+## Typically only the magnitude data @var{y} is present in which case
+## @var{x} is taken to be the range @code{1 : length (@var{y})}.  If @var{x}
+## is given it may be a string array, a cell array of strings, or a numerical
+## vector.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a 2-element vector with a graphics
+## handle for the created bar plot and a second handle for the created line
+## plot.
+##
+## An example of the use of @code{pareto} is
+##
+## @example
+## @group
+## Cheese = @{"Cheddar", "Swiss", "Camembert", ...
+##           "Munster", "Stilton", "Blue"@};
+## Sold = [105, 30, 70, 10, 15, 20];
+## pareto (Sold, Cheese);
+## @end group
+## @end example
+## @seealso{bar, barh, hist, pie, plot}
+## @end deftypefn
+
+function h = pareto (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pareto", varargin{:});
+
+  if (nargin != 1 && nargin != 2)
+    print_usage ();
+  endif
+
+  y = varargin{1}(:).';
+  if (nargin == 2)
+    x = varargin{2}(:).';
+    if (! iscell (x))
+      if (ischar (x))
+        x = cellstr (x);
+      else
+        x = cellstr (num2str (x(:)));
+      endif
+    endif
+  else
+    x = cellstr (int2str ([1:numel(y)]'));
+  endif
+
+  [y, idx] = sort (y, "descend");
+  x = x(idx);
+  cdf = cumsum (y);
+  maxcdf = cdf(end);
+  cdf ./= maxcdf;
+  idx95 = find (cdf < 0.95, 1, "last") + 1;
+
+  if (isempty (hax))
+    [ax, hbar, hline] = plotyy (1 : idx95, y(1:idx95),
+                                1 : length (cdf), 100 * cdf,
+                                @bar, @plot);
+  else
+    [ax, hbar, hline] = plotyy (hax, 1 : idx95, y(1:idx95),
+                                     1 : length (cdf), 100 * cdf,
+                                     @bar, @plot);
+  endif
+
+  axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]);
+  axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]);
+  set (ax(2), "ytick", [0, 20, 40, 60, 80, 100],
+              "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"});
+  set (ax(1:2), "xtick", 1:idx95, "xticklabel", x(1:idx95));
+
+  if (nargout > 0)
+    h = [hbar; hline];
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! Cheese = {'Cheddar', 'Swiss', 'Camembert', 'Munster', 'Stilton', 'Blue'};
+%! Sold = [105, 30, 70, 10, 15, 20];
+%! pareto (Sold, Cheese);
+
+%!demo
+%! clf;
+%! % Suppose that we want establish which products makes 80% of turnover.
+%! Codes = {'AB4','BD7','CF8','CC5','AD11','BB5','BB3','AD8','DF3','DE7'};
+%! Value = [2.35 7.9 2.45 1.1 0.15 13.45 5.4 2.05 0.85  1.65]';
+%! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
+%!              1084118 55576]';
+%! pareto (Value.*SoldUnits, Codes);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/patch.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,270 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} patch ()
+## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} patch (@var{fv})
+## @deftypefnx {Function File} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
+## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} patch (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
+## Create patch object in the current axes with vertices at locations
+## (@var{x}, @var{y}) and of color @var{c}.
+##
+## If the vertices are matrices of size @nospell{MxN} then each polygon patch
+## has M vertices and a total of N polygons will be created.  If some polygons
+## do not have M vertices use NaN to represent "no vertex".  If the @var{z}
+## input is present then 3-D patches will be created.
+##
+## The color argument @var{c} can take many forms.  To create polygons
+## which all share a single color use a string value (e.g., @qcode{"r"} for
+## red), a scalar value which is scaled by @code{caxis} and indexed into the
+## current colormap, or a 3-element RGB vector with the precise TrueColor.
+##
+## If @var{c} is a vector of length N then the ith polygon will have a color
+## determined by scaling entry @var{c}(i) according to @code{caxis} and then
+## indexing into the current colormap.  More complicated coloring situations
+## require directly manipulating patch property/value pairs.
+##
+## Instead of specifying polygons by matrices @var{x} and @var{y}, it is
+## possible to present a unique list of vertices and then a list of polygon
+## faces created from those vertices.  In this case the
+## @qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
+## @nospell{Nx3} (3-D path).  The @nospell{MxN} @qcode{"Faces"} matrix
+## describes M polygons having N vertices---each row describes a
+## single polygon and each column entry is an index into the
+## @qcode{"Vertices"} matrix to identify a vertex.  The patch object
+## can be created by directly passing the property/value pairs
+## @qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
+## inputs.
+##
+## A third input form is to create a structure @var{fv} with the fields
+## @qcode{"vertices"}, @qcode{"faces"}, and optionally
+## @qcode{"facevertexcdata"}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+##
+## Implementation Note: Patches are highly configurable objects.  To truly
+## customize them requires setting patch properties directly.  Useful patch
+## properties are: @qcode{"cdata"}, @qcode{"edgecolor"},
+## @qcode{"facecolor"}, @qcode{"faces"}, @qcode{"facevertexcdata"}.
+## @seealso{fill, get, set}
+## @end deftypefn
+
+## Author: jwe
+
+function h = patch (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
+  
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  [htmp, failed] = __patch__ (hax, varargin{:});
+
+  if (failed)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% Patches with same number of vertices
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! patch ([x1,x2], [y1,y2], 'r');
+
+%!demo
+%! %% Unclosed patch
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], 'r');
+
+%!demo
+%! %% Specify vertices and faces separately
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! vert = [x1, y1; x2, y2];
+%! fac = [1:8,NaN(1,8);9:24];
+%! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
+
+%!demo
+%! %% Specify vertices and faces separately
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! vert = [x1, y1; x2, y2];
+%! fac = [1:8,NaN(1,8);9:24];
+%! patch ('Faces',fac, 'Vertices',vert, 'FaceVertexCData',[0, 1, 0; 0, 0, 1]);
+
+%!demo
+%! %% Property change on multiple patches
+%! clf;
+%! t1 = (1/16:1/8:1)' * 2*pi;
+%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
+%! x1 = sin (t1) - 0.8;
+%! y1 = cos (t1);
+%! x2 = sin (t2) + 0.8;
+%! y2 = cos (t2);
+%! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
+%! pause (1);
+%! set (h, 'FaceColor', 'r');
+
+%!demo
+%! clf;
+%! vertices = [0, 0, 0;
+%!             1, 0, 0;
+%!             1, 1, 0;
+%!             0, 1, 0;
+%!             0.5, 0.5, 1];
+%! faces = [1, 2, 5;
+%!          2, 3, 5;
+%!          3, 4, 5;
+%!          4, 1, 5];
+%! patch ('Vertices', vertices, 'Faces', faces, ...
+%!        'FaceVertexCData', jet (4), 'FaceColor', 'flat');
+%! view (-37.5, 30);
+
+%!demo
+%! clf;
+%! vertices = [0, 0, 0;
+%!             1, 0, 0;
+%!             1, 1, 0;
+%!             0, 1, 0;
+%!             0.5, 0.5, 1];
+%! faces = [1, 2, 5;
+%!          2, 3, 5;
+%!          3, 4, 5;
+%!          4, 1, 5];
+%! patch  ('Vertices', vertices, 'Faces', faces, ...
+%!        'FaceVertexCData', jet (5), 'FaceColor', 'interp');
+%! view (-37.5, 30);
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [0 1 1 0];
+%! y = [0 0 1 1];
+%! subplot (2,1,1);
+%!  title ('Blue, Light-Green, and Red Horizontal Bars');
+%!  patch (x, y + 0, 1);
+%!  patch (x, y + 1, 2);
+%!  patch (x, y + 2, 3);
+%! subplot (2,1,2);
+%!  title ('Blue, Light-Green, and Red Vertical Bars');
+%!  patch (x + 0, y, 1 * ones (size (x)));
+%!  patch (x + 1, y, 2 * ones (size (x)));
+%!  patch (x + 2, y, 3 * ones (size (x)));
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [0 1 1 0];
+%! y = [0 0 1 1];
+%! subplot (2,1,1);
+%!  title ('Blue horizontal bars: Dark to Light');
+%!  patch (x, y + 0, 1, 'cdatamapping', 'direct');
+%!  patch (x, y + 1, 9, 'cdatamapping', 'direct');
+%!  patch (x, y + 2, 17, 'cdatamapping', 'direct');
+%! subplot (2,1,2);
+%!  title ('Blue vertical bars: Dark to Light');
+%!  patch (x + 0, y, 1 * ones (size (x)), 'cdatamapping', 'direct');
+%!  patch (x + 1, y, 9 * ones (size (x)), 'cdatamapping', 'direct');
+%!  patch (x + 2, y, 17 * ones (size (x)), 'cdatamapping', 'direct');
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [ 0 0; 1 1; 1 0 ];
+%! y = [ 0 0; 0 1; 1 1 ];
+%! p = patch (x, y, 'facecolor', 'b');
+%! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
+%! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
+
+%!demo
+%! clf;
+%! colormap (jet (64));
+%! x = [ 0 0; 1 1; 1 0 ];
+%! y = [ 0 0; 0 1; 1 1 ];
+%! p = patch (x, y, [1 32]);
+%! title ('Autoscaling of colors: Red UL and Blue LR triangles');
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = patch ();
+%!   assert (findobj (hf, "type", "patch"), h);
+%!   assert (get (h, "xdata"), [0; 1; 0], eps);
+%!   assert (get (h, "ydata"), [1; 1; 0], eps);
+%!   assert (isempty (get (h, "zdata")));
+%!   assert (isempty (get (h, "cdata")));
+%!   assert (get (h, "faces"), [1, 2, 3], eps);
+%!   assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
+%!   assert (get (h, "type"), "patch");
+%!   assert (get (h, "facecolor"), [0 0 0]);
+%!   assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
+%!   assert (get (h, "marker"), get (0, "defaultpatchmarker"));
+%!   assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! c = 0.9;
+%! unwind_protect
+%!   h = patch ([0 1 0], [0 1 1], c);
+%!   assert (get (gca, "clim"), [c - 1, c + 1]);
+%!   h = patch ([0 1 0], [0 1 1], 2 * c);
+%!   assert (get (gca, "clim"), [c, 2 * c]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pcolor.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,119 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
+## @deftypefnx {Function File} {} pcolor (@var{c})
+## @deftypefnx {Function File} {} pcolor (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} pcolor (@dots{})
+## Produce a 2-D density plot.
+##
+## A @code{pcolor} plot draws rectangles with colors from the matrix @var{c}
+## over the two-dimensional region represented by the matrices @var{x} and
+## @var{y}.  @var{x} and @var{y} are the coordinates of the mesh's vertices
+## and are typically the output of @code{meshgrid}.  If @var{x} and @var{y} are
+## vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)).
+## Thus, columns of @var{c} correspond to different @var{x} values and rows
+## of @var{c} correspond to different @var{y} values.
+##
+## The values in @var{c} are scaled to span the range of the current
+## colormap.  Limits may be placed on the color axis by the command
+## @code{caxis}, or by setting the @code{clim} property of the parent axis.
+##
+## The face color of each cell of the mesh is determined by interpolating
+## the values of @var{c} for each of the cell's vertices; Contrast this with
+## @code{imagesc} which renders one cell for each element of @var{c}.
+##
+## @code{shading} modifies an attribute determining the manner by which the
+## face color of each cell is interpolated from the values of @var{c},
+## and the visibility of the cells' edges.  By default the attribute is
+## @qcode{"faceted"}, which renders a single color for each cell's face with
+## the edge visible.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{caxis, shading, meshgrid, contour, imagesc}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = pcolor (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pcolor", varargin{:});
+
+  if (nargin == 1)
+    c = varargin{1};
+    [nr, nc] = size (c);
+    [x, y] = meshgrid (1:nc, 1:nr);
+    z = zeros (nr, nc);
+  elseif (nargin == 3)
+    x = varargin{1};
+    y = varargin{2};
+    c = varargin{3};
+    z = zeros (size (c));
+  else
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = surface (x, y, z, c);
+
+    set (htmp, "facecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [0, 90], "box", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! pcolor (Z);
+%! title ('pcolor() of peaks with facet shading');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! pcolor (X,Y,Fx+Fy);
+%! shading interp;
+%! axis tight;
+%! title ('pcolor() of peaks with interp shading');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/peaks.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,95 @@
+## Copyright (C) 2007-2012 Paul Kienzle
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} peaks ()
+## @deftypefnx {Function File} {} peaks (@var{n})
+## @deftypefnx {Function File} {} peaks (@var{x}, @var{y})
+## @deftypefnx {Function File} {@var{z} =} peaks (@dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} peaks (@dots{})
+## Plot a function with lots of local maxima and minima.
+##
+## The function has the form
+##
+## @tex
+## $$f(x,y) = 3 (1 - x) ^ 2 e ^ {\left(-x^2 - (y+1)^2\right)} - 10 \left({x \over 5} - x^3 - y^5)\right) - {1 \over 3} e^{\left(-(x+1)^2 - y^2\right)}$$
+## @end tex
+## @ifnottex
+## @verbatim
+## f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
+##          - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
+##          - 1/3*exp(-(x+1)^2 - y^2)
+## @end verbatim
+## @end ifnottex
+##
+## Called without a return argument, @code{peaks} plots the surface of the
+## above function using @code{surf}.
+## 
+## If @var{n} is a scalar, @code{peaks} plots the value of the above
+## function on an @var{n}-by-@var{n} mesh over the range [-3,3].  The
+## default value for @var{n} is 49.
+##
+## If @var{n} is a vector, then it represents the grid values over which
+## to calculate the function.  If @var{x} and @var{y} are specified then
+## the function value is calculated over the specified grid of vertices.
+##
+## When called with output arguments, return the data for the function
+## evaluated over the meshgrid.  This can subsequently be plotted with
+## @code{surf (@var{x}, @var{y}, @var{z})}.
+## 
+## @seealso{sombrero, meshgrid, mesh, surf}
+## @end deftypefn
+
+## Expression for the peaks function was taken from the following paper:
+## http://www.control.hut.fi/Kurssit/AS-74.115/Material/GENALGgoga.pdf
+
+function [X_out, Y_out, Z_out] = peaks (x, y)
+
+  if (nargin == 0)
+    x = y = linspace (-3, 3, 49);
+  elseif (nargin == 1)
+    if (length (x) > 1)
+      y = x;
+    else
+      x = y = linspace (-3, 3, x);
+    endif
+  endif
+
+  if (isvector (x) && isvector (y))
+    [X, Y] = meshgrid (x, y);
+  else
+    X = x;
+    Y = y;
+  endif
+
+  Z = 3 * (1 - X) .^ 2 .* exp (- X .^ 2 - (Y + 1) .^ 2) ...
+      - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp (- X .^ 2 - Y .^ 2) ...
+      - 1 / 3 * exp (- (X + 1) .^ 2 - Y .^ 2);
+
+  if (nargout == 0)
+    surf (x, y, Z);
+  elseif (nargout == 1)
+    X_out = Z;
+  else
+    X_out = X;
+    Y_out = Y;
+    Z_out = Z;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pie.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,103 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pie (@var{x})
+## @deftypefnx {Function File} {} pie (@dots{}, @var{explode})
+## @deftypefnx {Function File} {} pie (@dots{}, @var{labels})
+## @deftypefnx {Function File} {} pie (@var{hax}, @dots{});
+## @deftypefnx {Function File} {@var{h} =} pie (@dots{});
+## Plot a 2-D pie chart.
+##
+## When called with a single vector argument, produce a pie chart of the
+## elements in @var{x}.  The size of the ith slice is the percentage that the
+## element @var{x}i represents of the total sum of @var{x}:
+## @code{pct = @var{x}(i) / sum (@var{x})}. 
+##
+## The optional input @var{explode} is a vector of the same length as @var{x}
+## that, if non-zero, "explodes" the slice from the pie chart.
+##
+## The optional input @var{labels} is a cell array of strings of the same
+## length as @var{x} specifying the label for each slice.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a list of handles to the patch
+## and text objects generating the plot.
+##
+## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
+## interpreted as percentages directly and are not normalized by @code{sum (x)}.
+## Furthermore, if the sum is less than 1 then there will be a missing slice
+## in the pie plot to represent the missing, unspecified percentage.
+##
+## @seealso{pie3, bar, hist, rose}
+## @end deftypefn
+
+## Very roughly based on pie.m from octave-forge whose author was
+## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+
+function h = pie (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __pie__ ("pie", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! pie ([3, 2, 1], [0, 0, 1]);
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! title ('pie() with exploded wedge');
+
+%!demo
+%! clf;
+%! pie ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie() with labels');
+
+
+%!demo
+%! clf;
+%! pie ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie() with missing slice');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/pie3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,103 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2010 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} pie3 (@var{x})
+## @deftypefnx {Function File} {} pie3 (@dots{}, @var{explode})
+## @deftypefnx {Function File} {} pie3 (@dots{}, @var{labels})
+## @deftypefnx {Function File} {} pie3 (@var{hax}, @dots{});
+## @deftypefnx {Function File} {@var{h} =} pie3 (@dots{});
+## Plot a 3-D pie chart.
+##
+## Called with a single vector argument, produces a 3-D pie chart of the
+## elements in @var{x}.  The size of the ith slice is the percentage that the
+## element @var{x}i represents of the total sum of @var{x}:
+## @code{pct = @var{x}(i) / sum (@var{x})}. 
+##
+## The optional input @var{explode} is a vector of the same length as @var{x}
+## that, if non-zero, "explodes" the slice from the pie chart.
+##
+## The optional input @var{labels} is a cell array of strings of the same
+## length as @var{x} specifying the label for each slice.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a list of graphics handles to the
+## patch, surface, and text objects generating the plot.
+##
+## Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
+## interpreted as percentages directly and are not normalized by @code{sum (x)}.
+## Furthermore, if the sum is less than 1 then there will be a missing slice
+## in the pie plot to represent the missing, unspecified percentage.
+##
+## @seealso{pie, bar, hist, rose}
+## @end deftypefn
+
+## Very roughly based on pie.m from octave-forge whose author was
+## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+
+function h = pie3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("pie3", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __pie__ ("pie3", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! pie3 ([5:-1:1], [0, 0, 1, 0, 0]);
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! title ('pie3() with exploded wedge');
+
+%!demo
+%! clf;
+%! pie3 ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie3() with labels');
+
+%!demo
+%! clf;
+%! pie3 ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
+%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
+%! axis ([-2,2,-2,2]);
+%! title ('pie3() with missing slice');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,285 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plot (@var{y})
+## @deftypefnx {Function File} {} plot (@var{x}, @var{y})
+## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} plot (@dots{}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} plot (@var{x1}, @var{y1}, @dots{}, @var{xn}, @var{yn})
+## @deftypefnx {Function File} {} plot (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} plot (@dots{})
+## Produce 2-D plots.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## plot (@var{y})
+## @end example
+##
+## @noindent
+## where the argument is taken as the set of @var{y} coordinates and the
+## @var{x} coordinates are taken to be the range @code{1:numel (@var{y})}.
+##
+## If more than one argument is given, they are interpreted as
+##
+## @example
+## plot (@var{y}, @var{property}, @var{value}, @dots{})
+## @end example
+##
+## @noindent
+## or
+##
+## @example
+## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @end example
+##
+## @noindent
+## or
+##
+## @example
+## plot (@var{x}, @var{y}, @var{fmt}, @dots{})
+## @end example
+##
+## @noindent
+## and so on.  Any number of argument sets may appear.  The @var{x} and
+## @var{y} values are interpreted as follows:
+##
+## @itemize @bullet
+## @item
+## If a single data argument is supplied, it is taken as the set of @var{y}
+## coordinates and the @var{x} coordinates are taken to be the indices of
+## the elements, starting with 1.
+##
+## @item
+## If @var{x} and @var{y} are scalars, a single point is plotted.
+##
+## @item
+## @code{squeeze()} is applied to arguments with more than two dimensions,
+## but no more than two singleton dimensions.
+## 
+## @item
+## If both arguments are vectors, the elements of @var{y} are plotted versus
+## the elements of @var{x}.
+##
+## @item
+## If @var{x} is a vector and @var{y} is a matrix, then
+## the columns (or rows) of @var{y} are plotted versus @var{x}.
+## (using whichever combination matches, with columns tried first.)
+##
+## @item
+## If the @var{x} is a matrix and @var{y} is a vector,
+## @var{y} is plotted versus the columns (or rows) of @var{x}.
+## (using whichever combination matches, with columns tried first.)
+##
+## @item
+## If both arguments are matrices, the columns of @var{y} are plotted
+## versus the columns of @var{x}.  In this case, both matrices must have
+## the same number of rows and columns and no attempt is made to transpose
+## the arguments to make the number of rows match.
+## @end itemize
+##
+## Multiple property-value pairs may be specified, but they must appear
+## in pairs.  These arguments are applied to the line objects drawn by
+## @code{plot}.  Useful properties to modify are @qcode{"linestyle"},
+## @qcode{"linewidth"}, @qcode{"color"}, @qcode{"marker"},
+## @qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.
+##
+## The @var{fmt} format argument can also be used to control the plot style.
+## The format is composed of three parts: linestyle, markerstyle, color. 
+## When a markerstyle is specified, but no linestyle, only the markers are
+## plotted.  Similarly, if a linestyle is specified, but no markerstyle, then
+## only lines are drawn.  If both are specified then lines and markers will
+## be plotted.  If no @var{fmt} and no @var{property}/@var{value} pairs are
+## given, then the default plot style is solid lines with no markers and the
+## color determined by the @qcode{"colororder"} property of the current axes.
+##
+## Format arguments:
+##
+## @table @asis
+## @item linestyle
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{-}  @tab Use solid lines (default).
+## @item @samp{--} @tab Use dashed lines.
+## @item @samp{:}  @tab Use dotted lines.
+## @item @samp{-.} @tab Use dash-dotted lines.
+## @end multitable
+##
+## @item markerstyle
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{+} @tab crosshair
+## @item @samp{o} @tab circle
+## @item @samp{*} @tab star
+## @item @samp{.} @tab point
+## @item @samp{x} @tab cross
+## @item @samp{s} @tab square
+## @item @samp{d} @tab diamond
+## @item @samp{^} @tab upward-facing triangle
+## @item @samp{v} @tab downward-facing triangle
+## @item @samp{>} @tab right-facing triangle
+## @item @samp{<} @tab left-facing triangle
+## @item @samp{p} @tab pentagram
+## @item @samp{h} @tab hexagram
+## @end multitable
+##
+## @item color
+##
+## @multitable @columnfractions 0.06 0.94
+## @item @samp{k} @tab blacK
+## @item @samp{r} @tab Red
+## @item @samp{g} @tab Green
+## @item @samp{b} @tab Blue
+## @item @samp{m} @tab Magenta
+## @item @samp{c} @tab Cyan
+## @item @samp{w} @tab White
+## @end multitable
+##
+## @item @qcode{";key;"}
+## Here @qcode{"key"} is the label to use for the plot legend.
+## @end table
+##
+## The @var{fmt} argument may also be used to assign legend keys.
+## To do so, include the desired label between semicolons after the
+## formatting sequence described above, e.g., @qcode{"+b;Key Title;"}.
+## Note that the last semicolon is required and Octave will generate
+## an error if it is left out.
+##
+## Here are some plot examples:
+##
+## @example
+## plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")
+## @end example
+##
+## This command will plot @code{y} with red circles, @code{y2} with solid
+## lines, @code{y3} with solid magenta lines, and @code{y4} with points
+## displayed as @samp{+}.
+##
+## @example
+## plot (b, "*", "markersize", 10)
+## @end example
+##
+## This command will plot the data in the variable @code{b},
+## with points displayed as @samp{*} and a marker size of 10.
+##
+## @example
+## @group
+## t = 0:0.1:6.3;
+## plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");
+## @end group
+## @end example
+##
+## This will plot the cosine and sine functions and label them accordingly
+## in the legend.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the created line objects.
+##
+## To save a plot, in one of several image formats such as PostScript
+## or PNG, use the @code{print} command.
+##
+## @seealso{axis, box, grid, hold, legend, title, xlabel, ylabel, xlim, ylim, ezplot, errorbar, fplot, line, plot3, polar, loglog, semilogx, semilogy, subplot}
+## @end deftypefn
+
+## Author: jwe
+
+function h = plot (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    htmp = __plt__ ("plot", hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g');
+%! title ('plot() of green line at 45 degrees');
+
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g*');
+%! title ('plot() of green stars along a line at 45 degrees');
+
+%!demo
+%! x1 = 1:5;  y1 = 1:5;
+%! x2 = 5:9; y2 = 5:-1:1;
+%! plot (x1,y1,'bo-', x2,y2,'rs-');
+%! axis ('tight');
+%! title ({'plot() of blue circles ascending and red squares descending';
+%!         'connecting lines drawn'}); 
+
+%!demo
+%! x = 0:10;
+%! plot (x, rand (numel (x), 3))
+%! axis ([0 10 0 1])
+%! title ({'Three random variables', 'x[1x11], y[11x3]'})
+
+%!demo
+%! x = 0:10;
+%! plot (x, rand (3, numel (x)))
+%! axis ([0 10 0 1])
+%! title ({'Three random variables', 'x[1x11], y[3x11]'})
+
+%!demo
+%! x = 0:10;
+%! plot (repmat (x, 2, 1), rand (2, numel (x)), '-s')
+%! axis ([0 10 0 1])
+%! title ({'Vertical lines with random height and lengths', ...
+%!         'x[2x11], y[2,11]'})
+
+%!demo
+%! x = 0:10;
+%! plot (repmat (x(:), 1, 2), rand (numel (x), 2))
+%! axis ([0 10 0 1])
+%! title ({'Two random variables', 'x[11x2], y[11x2]'})
+
+%!demo
+%! x = 0:10;
+%! shape = [1, 1, numel(x), 2];
+%! x = reshape (repmat (x(:), 1, 2), shape);
+%! y = rand (shape);
+%! plot (x, y)
+%! axis ([0 10 0 1])
+%! title ({'Two random variables', 'squeezed from 4-d arrays'})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plot3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,388 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plot3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
+## @deftypefnx {Function File} {} plot3 (@var{x}, @var{cplx})
+## @deftypefnx {Function File} {} plot3 (@var{cplx})
+## @deftypefnx {Function File} {} plot3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} plot3 (@dots{})
+## Produce 3-D plots.
+##
+## Many different combinations of arguments are possible.  The simplest
+## form is
+##
+## @example
+## plot3 (@var{x}, @var{y}, @var{z})
+## @end example
+##
+## @noindent
+## in which the arguments are taken to be the vertices of the points to
+## be plotted in three dimensions.  If all arguments are vectors of the
+## same length, then a single continuous line is drawn.  If all arguments
+## are matrices, then each column of is treated as a separate line.  No attempt
+## is made to transpose the arguments to make the number of rows match.
+##
+## If only two arguments are given, as
+##
+## @example
+## plot3 (@var{x}, @var{cplx})
+## @end example
+##
+## @noindent
+## the real and imaginary parts of the second argument are used
+## as the @var{y} and @var{z} coordinates, respectively.
+##
+## If only one argument is given, as
+##
+## @example
+## plot3 (@var{cplx})
+## @end example
+##
+## @noindent
+## the real and imaginary parts of the argument are used as the @var{y}
+## and @var{z} values, and they are plotted versus their index.
+##
+## Arguments may also be given in groups of three as
+##
+## @example
+## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
+## @end example
+##
+## @noindent
+## in which each set of three arguments is treated as a separate line or
+## set of lines in three dimensions.
+##
+## To plot multiple one- or two-argument groups, separate each group
+## with an empty format string, as
+##
+## @example
+## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
+## @end example
+##
+## Multiple property-value pairs may be specified which will affect the line
+## objects drawn by @code{plot3}.  If the @var{fmt} argument is supplied it
+## will format the line objects in the same manner as @code{plot}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## Example:
+##
+## @example
+## @group
+## z = [0:0.05:5];
+## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
+## plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
+## @end group
+## @end example
+## @seealso{ezplot3, plot}
+## @end deftypefn
+
+## Author: Paul Kienzle
+##         (modified from __plt__.m)
+
+function retval = plot3 (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot3", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    x_set = 0;
+    y_set = 0;
+    z_set = 0;
+    property_set = 0;
+    fmt_set = 0;
+    properties = {};
+    tlgnd = {};
+    hlgnd = [];
+    idx = 0;
+
+    ## Gather arguments, decode format, and plot lines.
+    arg = 0;
+    while (arg++ < nargs)
+      new = varargin{arg};
+      new_cell = varargin(arg);
+
+      if (property_set)
+        properties = [properties, new_cell];
+        property_set = 0;
+        continue;
+      endif
+
+      if (ischar (new))
+        if (! z_set)
+          if (! y_set)
+            if (! x_set)
+              error ("plot3: needs X, [ Y, [ Z ] ]");
+            else
+              y = real (x);
+              z = imag (x);
+              y_set = 1;
+              z_set = 1;
+              if (rows (x) > 1)
+                x = repmat ((1:rows (x))', 1, columns (x));
+              else
+                x = 1:columns (x);
+              endif
+            endif
+          else
+            z = imag (y);
+            y = real (y);
+            z_set = 1;
+          endif
+        endif
+
+        if (! fmt_set)
+          [options, valid] = __pltopt__ ("plot3", new, false);
+          if (! valid)
+            properties = [properties, new_cell];
+            property_set = 1;
+            continue;
+          else
+            fmt_set = 1;
+            while (arg < nargs && ischar (varargin{arg+1}))
+              if (nargs - arg < 2)
+                error ("plot3: properties must appear followed by a value");
+              endif
+              properties = [properties, varargin(arg+1:arg+2)];
+              arg += 2;
+            endwhile
+          endif
+        else
+          properties = [properties, new_cell];
+          property_set = 1;
+          continue;
+        endif
+
+        if (isvector (x) && isvector (y))
+          if (isvector (z))
+            x = x(:);
+            y = y(:);
+            z = z(:);
+          elseif (length (x) == rows (z) && length (y) == columns (z))
+            [x, y] = meshgrid (x, y);
+          else
+            error ("plot3: [length(X), length(Y)] must match size (Z)");
+          endif
+        endif
+
+        if (! size_equal (x, y, z))
+          error ("plot3: X, Y, and Z must have the same shape");
+        elseif (ndims (x) > 2)
+          error ("plot3: X, Y, and Z must not have more than two dimensions");
+        endif
+
+        for i = 1 : columns (x)
+          linestyle = options.linestyle;
+          marker = options.marker;
+          if (isempty (marker) && isempty (linestyle))
+             [linestyle, marker] = __next_line_style__ ();
+          endif
+          color = options.color;
+          if (isempty (color))
+            color = __next_line_color__ ();
+          endif
+
+          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                              "color", color, "linestyle", linestyle,
+                              "marker", marker, properties{:});
+          key = options.key;
+          if (! isempty (key))
+            hlgnd = [hlgnd, htmp(idx)];
+            tlgnd = {tlgnd{:}, key};
+          endif
+        endfor
+
+        x_set = 0;
+        y_set = 0;
+        z_set = 0;
+        fmt_set = 0;
+        properties = {};
+      elseif (! x_set)
+        x = new;
+        x_set = 1;
+      elseif (! y_set)
+        y = new;
+        y_set = 1;
+      elseif (! z_set)
+        z = new;
+        z_set = 1;
+      else
+        if (isvector (x) && isvector (y))
+          if (isvector (z))
+            x = x(:);
+            y = y(:);
+            z = z(:);
+          elseif (length (x) == rows (z) && length (y) == columns (z))
+            [x, y] = meshgrid (x, y);
+          else
+            error ("plot3: [length(X), length(Y)] must match size (Z)");
+          endif
+        endif
+
+        if (! size_equal (x, y, z))
+          error ("plot3: X, Y, and Z must have the same shape");
+        elseif (ndims (x) > 2)
+          error ("plot3: X, Y, and Z must not have more than two dimensions");
+        endif
+
+        options = __default_plot_options__ ();
+        for i = 1 : columns (x)
+          linestyle = options.linestyle;
+          marker = options.marker;
+          if (isempty (marker) && isempty (linestyle))
+            [linestyle, marker] = __next_line_style__ ();
+          endif
+          color = options.color;
+          if (isempty (color))
+            color = __next_line_color__ ();
+          endif
+
+          htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                              "color", color, "linestyle", linestyle,
+                              "marker", marker, properties{:});
+          key = options.key;
+          if (! isempty (key))
+            hlgnd = [hlgnd, htmp(idx)];
+            tlgnd = {tlgnd{:}, key};
+          endif
+        endfor
+
+        x = new;
+        y_set = 0;
+        z_set = 0;
+        fmt_set = 0;
+        properties = {};
+      endif
+
+    endwhile
+
+    if (property_set)
+      error ("plot3: properties must appear followed by a value");
+    endif
+
+    ## Handle last plot.
+
+    if (x_set)
+      if (y_set)
+        if (! z_set)
+          z = imag (y);
+          y = real (y);
+          z_set = 1;
+        endif
+      else
+        y = real (x);
+        z = imag (x);
+        y_set = 1;
+        z_set = 1;
+        if (rows (x) > 1)
+          x = repmat ((1:rows (x))', 1, columns (x));
+        else
+          x = 1:columns (x);
+        endif
+      endif
+
+      if (isvector (x) && isvector (y))
+        if (isvector (z))
+          x = x(:);
+          y = y(:);
+          z = z(:);
+        elseif (length (x) == rows (z) && length (y) == columns (z))
+          [x, y] = meshgrid (x, y);
+        else
+          error ("plot3: [length(X), length(Y)] must match size (Z)");
+        endif
+      endif
+
+      if (! size_equal (x, y, z))
+        error ("plot3: X, Y, and Z must have the same shape");
+      elseif (ndims (x) > 2)
+        error ("plot3: X, Y, and Z must not have more than two dimensions");
+      endif
+
+      options = __default_plot_options__ ();
+
+      for i = 1 : columns (x)
+        linestyle = options.linestyle;
+        marker = options.marker;
+        if (isempty (marker) && isempty (linestyle))
+          [linestyle, marker] = __next_line_style__ ();
+        endif
+        color = options.color;
+        if (isempty (color))
+          color = __next_line_color__ ();
+        endif
+
+        htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
+                            "color", color, "linestyle", linestyle,
+                            "marker", marker, properties{:});
+        key = options.key;
+        if (! isempty (key))
+          hlgnd = [hlgnd, htmp(idx)];
+          tlgnd = {tlgnd{:}, key};
+        endif
+      endfor
+    endif
+
+    if (! isempty (hlgnd))
+      legend (hax, hlgnd, tlgnd);
+    endif
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30]);
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0 && idx > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! z = [0:0.05:5];
+%! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
+%! title ('plot3() of a helix');
+
+%!demo
+%! clf;
+%! z = [0:0.05:5];
+%! plot3 (z, exp (2i*pi*z), ';complex sinusoid;');
+%! title ('plot3() with complex input');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plotmatrix.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,198 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plotmatrix (@var{x}, @var{y})
+## @deftypefnx {Function File} {} plotmatrix (@var{x})
+## @deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
+## @deftypefnx {Function File} {} plotmatrix (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
+## Scatter plot of the columns of one matrix against another.
+##
+## Given the arguments @var{x} and @var{y}, that have a matching number of
+## rows, @code{plotmatrix} plots a set of axes corresponding to
+##
+## @example
+## plot (@var{x}(:, i), @var{y}(:, j))
+## @end example
+##
+## Given a single argument @var{x} this is equivalent to
+##
+## @example
+## plotmatrix (@var{x}, @var{x})
+## @end example
+##
+## @noindent
+## except that the diagonal of the set of axes will be replaced with the
+## histogram @code{hist (@var{x}(:, i))}.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} provides handles to the individual
+## graphics objects in the scatter plots, whereas @var{ax} returns the
+## handles to the scatter plot axis objects.  @var{bigax} is a hidden
+## axis object that surrounds the other axes, such that the commands
+## @code{xlabel}, @code{title}, etc., will be associated with this hidden
+## axis.  Finally, @var{p} returns the graphics objects associated with
+## the histogram and @var{pax} the corresponding axes objects.
+##
+## Example:
+##
+## @example
+## plotmatrix (randn (100, 3), "g+")
+## @end example
+##
+## @seealso{scatter, plot}
+## @end deftypefn
+
+function [h, ax, bigax, p, pax] = plotmatrix (varargin)
+
+  [bigax2, varargin, nargin] = __plt_get_axis_arg__ ("plotmatrix", varargin{:});
+
+  if (nargin > 3 || nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (bigax2))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    bigax2 = newplot (bigax2);
+
+    [h2, ax2, p2, pax2] = __plotmatrix__ (bigax2, varargin{:});
+
+    axes (bigax2);
+    ctext = text (0, 0, "", "visible", "off",
+                  "handlevisibility", "off", "xliminclude", "off",
+                  "yliminclude", "off", "zliminclude", "off",
+                  "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
+    set (bigax2, "visible", "off");
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = h2;
+    ax = ax2;
+    bigax = bigax2;
+    p = p2;
+    pax = pax2;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! plotmatrix (randn (100, 3), 'g+');
+
+
+function plotmatrixdelete (h, d, ax)
+  for i = 1 : numel (ax)
+    hc = ax(i);
+    if (isaxes (hc) && strcmpi (get (hc, "beingdeleted"), "off"))
+      parent = get (hc, "parent");
+      ## If the parent is invalid or being deleted, then do nothing
+      if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
+        delete (hc);
+      endif
+    endif
+  endfor
+endfunction
+
+function [h, ax, p, pax] = __plotmatrix__ (bigax, varargin)
+  have_line_spec = false;
+  have_hist = false;
+  parent = get (bigax, "parent");
+  for i = 1 : nargin - 1
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
+      if (valid)
+        have_line_spec = true;
+        linespec = varargin(i);
+        varargin(i) = [];
+        nargin = nargin - 1;
+        break;
+      else
+        print_usage ("plotmatrix");
+      endif
+    endif
+  endfor
+
+  if (nargin == 2)
+    X = varargin{1};
+    Y = X;
+    have_hist = true;
+  elseif (nargin == 3)
+    X = varargin{1};
+    Y = varargin{2};
+  else
+    print_usage ("plotmatrix");
+  endif
+
+  if (rows (X) != rows (Y))
+    error ("plotmatrix: dimension mismatch in the arguments");
+  endif
+
+  [dummy, m] = size (X);
+  [dummy, n] = size (Y);
+
+  h = [];
+  ax = [];
+  p = [];
+  pax = [];
+
+  xsize = 0.9 / m;
+  ysize = 0.9 / n;
+  xoff = 0.05;
+  yoff = 0.05;
+  border = [0.130, 0.110, 0.225, 0.185] .* [xsize, ysize, xsize, ysize];
+  border(3:4) = - border(3:4) - border(1:2);
+
+  for i = 1 : m
+    for j = 1 : n
+      pos = [xsize * (i - 1) + xoff, ysize * (n - j) + yoff, xsize, ysize];
+      tmp = axes ("outerposition", pos, "position", pos + border,
+                  "parent", parent);
+      if (i == j && have_hist)
+        pax = [pax ; tmp];
+        [nn, xx] = hist (X(:, i));
+        tmp = bar (xx, nn, 1.0);
+        p = [p; tmp];
+      else
+        ax = [ax ; tmp];
+        if (have_line_spec)
+          tmp = plot (X (:, i), Y (:, j), linespec);
+        else
+          tmp = plot (X (:, i), Y (:, j), ".");
+        endif
+        h = [h ; tmp];
+      endif
+    endfor
+  endfor
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/plotyy.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,364 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
+## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun})
+## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
+## @deftypefnx {Function File} {} plotyy (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
+## Plot two sets of data with independent y-axes.
+##
+## The arguments @var{x1} and @var{y1} define the arguments for the first plot
+## and @var{x1} and @var{y2} for the second.
+##
+## By default the arguments are evaluated with
+## @code{feval (@@plot, @var{x}, @var{y})}.  However the type of plot can be
+## modified with the @var{fun} argument, in which case the plots are
+## generated by @code{feval (@var{fun}, @var{x}, @var{y})}.  @var{fun} can be
+## a function handle, an inline function, or a string of a function name.
+##
+## The function to use for each of the plots can be independently defined
+## with @var{fun1} and @var{fun2}.
+##
+## If the first argument @var{hax} is an axes handle, then it defines
+## the principal axis in which to plot the @var{x1} and @var{y1} data.
+##
+## The return value @var{ax} is a vector with the axis handles of the two
+## y axes.  @var{h1} and @var{h2} are handles to the objects generated by the
+## plot commands.
+##
+## @example
+## @group
+## x = 0:0.1:2*pi;
+## y1 = sin (x);
+## y2 = exp (x - 1);
+## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
+## xlabel ("X");
+## ylabel (ax(1), "Axis 1");
+## ylabel (ax(2), "Axis 2");
+## @end group
+## @end example
+## @seealso{plot}
+## @end deftypefn
+
+function [Ax, H1, H2] = plotyy (varargin)
+
+  ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy
+  if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1))
+      && ishandle (varargin{1}(2))
+      && all (floor (varargin{1}) != varargin{1}))
+    obj1 = get (varargin{1}(1));
+    obj2 = get (varargin{1}(2));
+    if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
+      ax = [obj1, obj2];
+      varargin(1) = [];
+      if (isempty (varargin))
+        varargin = {};
+      endif
+    else
+      error ("plotyy: expecting first argument to be axes handle");
+    endif
+    oldh = gca ();
+  else
+    f = get (0, "currentfigure");
+    if (isempty (f))
+      f = figure ();
+    endif
+    ca = get (f, "currentaxes");
+    if (isempty (ca))
+      ax = [];
+    elseif (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
+      ax = get (ca, "__plotyy_axes__");
+    else
+      ax = ca;
+    endif
+    if (length (ax) > 2)
+      for i = 3 : length (ax)
+        delete (ax (i));
+      endfor
+      ax = ax(1:2);
+    elseif (length (ax) == 1)
+      ax(2) = axes ();
+      set (ax(2), "nextplot", get (ax(1), "nextplot"));
+    elseif (isempty (ax))
+      ax(1) = axes ();
+      ax(2) = axes ();
+      ca = ax(2);
+    endif
+    if (nargin < 2)
+      varargin = {};
+    endif
+    oldh = ca;
+  endif
+
+  if (nargin < 4)
+    print_usage ();
+  endif
+
+  unwind_protect
+    [ax, h1, h2] = __plotyy__ (ax, varargin{:});
+  unwind_protect_cleanup
+    ## Only change back to the old axis if we didn't delete it
+    if (isaxes (oldh))
+      axes (oldh);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    Ax = ax;
+    H1 = h1;
+    H2 = h2;
+  endif
+
+endfunction
+
+function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin)
+  if (nargin > 5)
+    fun1 = varargin{1};
+  else
+    fun1 = @plot;
+  endif
+  if (nargin > 6)
+    fun2 = varargin{2};
+  else
+    fun2 = fun1;
+  endif
+
+  xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
+
+  if (isaxes (ax(1)))
+    axes (ax(1));
+  else
+    ax(1) = axes ();
+  endif
+  newplot ();
+  h1 = feval (fun1, x1, y1);
+
+  set (ax(1), "ycolor", getcolor (h1(1)));
+  set (ax(1), "xlim", xlim);
+  set (ax(1), "color", "none");
+
+  cf = gcf ();
+  set (cf, "nextplot", "add");
+
+  if (isaxes (ax(2)))
+    axes (ax(2));
+  else
+    ax(2) = axes ();
+    set (ax(2), "nextplot", get (ax(1), "nextplot"));
+  endif
+  newplot ();
+
+  colors = get (ax(1), "colororder");
+  set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
+
+  if (strcmp (get (ax(1), "autopos_tag"), "subplot"))
+    set (ax(2), "autopos_tag", "subplot");
+  else
+    set (ax, "activepositionproperty", "position");
+  endif
+
+  ## Kluge, until __plt_get_axis_arg__ and newplot are reworked. 
+  set (ax(2), "nextplot", "replacechildren");
+  h2 = feval (fun2, ax(2), x2, y2);
+  set (ax(2), "yaxislocation", "right");
+  set (ax(2), "ycolor", getcolor (h2(1)));
+
+  if (strcmp (get(ax(1), "activepositionproperty"), "position"))
+    set (ax(2), "position", get (ax(1), "position"));
+  else
+    set (ax(2), "outerposition", get (ax(1), "outerposition"));
+    set (ax(2), "looseinset", get (ax(1), "looseinset"));
+  endif
+
+  set (ax(2), "xlim", xlim);
+  set (ax(2), "color", "none");
+  set (ax(2), "box", "off");
+
+  ## Add invisible text objects that when destroyed,
+  ## also remove the other axis
+  t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
+             "handlevisibility", "off", "visible", "off",
+             "xliminclude", "off", "yliminclude", "off");
+  t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
+             "handlevisibility", "off", "visible", "off",
+             "xliminclude", "off", "yliminclude", "off");
+
+  set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
+  set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
+
+  addlistener (ax(1), "position", {@update_position, ax(2)});
+  addlistener (ax(2), "position", {@update_position, ax(1)});
+  addlistener (ax(1), "outerposition", {@update_position, ax(2)});
+  addlistener (ax(2), "outerposition", {@update_position, ax(1)});
+  addlistener (ax(1), "looseinset", {@update_position, ax(2)});
+  addlistener (ax(2), "looseinset", {@update_position, ax(1)});
+  addlistener (ax(1), "view", {@update_position, ax(2)});
+  addlistener (ax(2), "view", {@update_position, ax(1)});
+  addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)});
+  addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)});
+  addlistener (ax(1), "plotboxaspectratiomode", {@update_position, ax(2)});
+  addlistener (ax(2), "plotboxaspectratiomode", {@update_position, ax(1)});
+  addlistener (ax(1), "nextplot", {@update_nextplot, ax(2)});
+  addlistener (ax(2), "nextplot", {@update_nextplot, ax(1)});
+
+  ## Store the axes handles for the sister axes.
+  if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__"))
+    addproperty ("__plotyy_axes__", ax(1), "data", ax);
+  elseif (ishandle (ax(1)))
+    set (ax(1), "__plotyy_axes__", ax);
+  else
+    error ("plotyy.m: This shouldn't happen. File a bug report.");
+  endif
+  if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__"))
+    addproperty ("__plotyy_axes__", ax(2), "data", ax);
+  elseif (ishandle (ax(2)))
+    set (ax(2), "__plotyy_axes__", ax);
+  else
+    error ("plotyy.m: This shouldn't happen. File a bug report.");
+  endif
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.1:2*pi;
+%! y1 = sin (x);
+%! y2 = exp (x - 1);
+%! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
+%! xlabel ('X');
+%! ylabel (ax(1), 'Axis 1');
+%! ylabel (ax(2), 'Axis 2');
+%! axes (ax(1));
+%! text (0.5, 0.5, 'Left Axis', ...
+%!       'color', [0 0 1], 'horizontalalignment', 'center');
+%! axes (ax(2));
+%! text (4.5, 80, 'Right Axis', ...
+%!       'color', [0 0.5 0], 'horizontalalignment', 'center');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = linspace (-1, 1, 201);
+%! subplot (2,2,1);
+%!  plotyy (x,sin(pi*x), x,10*cos(pi*x));
+%! subplot (2,2,2);
+%!  surf (peaks (25));
+%! subplot (2,2,3);
+%!  contour (peaks (25));
+%! subplot (2,2,4);
+%!  plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
+%! axis square;
+
+%!demo
+%! clf;
+%! x = linspace (-1, 1, 201);
+%! hax = plotyy (x, sin (pi*x), x, cos (pi*x));
+%! ylabel (hax(1), 'Blue on the Left');
+%! ylabel (hax(2), 'Green on the Right');
+%! xlabel ('xlabel');
+
+%!demo
+%! clf
+%! hold on
+%! t = (0:0.1:9);
+%! x = sin (t);
+%! y = 5 * cos (t);
+%! [hax, h1, h2] = plotyy (t, x, t, y);
+%! [~, h3, h4] = plotyy (t+1, x, t+1, y);
+%! set ([h3, h4], 'linestyle', '--');
+%! xlabel (hax(1), 'xlabel');
+%! title (hax(2), 'title');
+%! ylabel (hax(1), 'Left axis is Blue');
+%! ylabel (hax(2), 'Right axis is Green');
+
+function deleteplotyy (h, d, ax2, t2)
+  if (isaxes (ax2)
+      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
+      && strcmp (get (ax2, "beingdeleted"), "off"))
+    set (t2, "deletefcn", []);
+    delete (ax2);
+  endif
+endfunction
+
+function update_nextplot (h, d, ax2)
+  persistent recursion = false;
+  prop = "nextplot";
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      set (ax2, prop, get (h, prop));
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_position (h, d, ax2)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      view = get (h, "view");
+      oldview = get (ax2, "view");
+      plotboxaspectratio = get (h, "plotboxaspectratio");
+      oldplotboxaspectratio = get (ax2, "plotboxaspectratio");
+      plotboxaspectratiomode = get (h, "plotboxaspectratiomode");
+      oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode");
+
+      if (strcmp (get(h, "activepositionproperty"), "position"))
+        position = get (h, "position");
+        oldposition = get (ax2, "position");
+        if (! (isequal (position, oldposition) && isequal (view, oldview)))
+          set (ax2, "position", position, "view", view);
+        endif
+      else
+        outerposition = get (h, "outerposition");
+        oldouterposition = get (ax2, "outerposition");
+        if (! (isequal (outerposition, oldouterposition) && isequal (view, oldview)))
+          set (ax2, "outerposition", outerposition, "view", view);
+        endif
+      endif
+
+      if (! (isequal (plotboxaspectratio, oldplotboxaspectratio)
+             && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode)))
+        set (ax2, "plotboxaspectratio", plotboxaspectratio);
+        set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode);
+      endif
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function color = getcolor (ax)
+  obj = get (ax);
+  if (isfield (obj, "color"))
+    color = obj.color;
+  elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor))
+    color = obj.facecolor;
+  elseif (isfield (obj, "edgecolor") && !  ischar (obj.edgecolor))
+    color = obj.edgecolor;
+  else
+    color = [0, 0, 0];
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/polar.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,217 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} polar (@var{theta}, @var{rho})
+## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
+## @deftypefnx {Function File} {} polar (@var{cplx})
+## @deftypefnx {Function File} {} polar (@var{cplx}, @var{fmt})
+## @deftypefnx {Function File} {} polar (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} polar (@dots{})
+## Create a 2-D plot from polar coordinates @var{theta} and @var{rho}.
+##
+## If a single complex input @var{cplx} is given then the real part is used
+## for @var{theta} and the imaginary part is used for @var{rho}.
+##
+## The optional argument @var{fmt} specifies the line format in the same way
+## as @code{plot}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+##
+## @seealso{rose, compass, plot}
+## @end deftypefn
+
+## Author: jwe
+
+function h = polar (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    if (nargs == 3)
+      if (! ischar (varargin{3}))
+        error ("polar: FMT argument must be a string");
+      endif
+      htmp = __plr2__ (hax, varargin{:});
+      maxr = max (varargin{2}(:));
+    elseif (nargs == 2)
+      if (ischar (varargin{2}))
+        htmp = __plr1__ (hax, varargin{:});
+        if (iscomplex (varargin{1}))
+          maxr = max (imag (varargin{1})(:));
+        else
+          maxr = max (varargin{1}(:));
+        endif
+      else
+        fmt = "";
+        htmp = __plr2__ (hax, varargin{:}, fmt);
+        maxr = max (varargin{2}(:));
+      endif
+    elseif (nargs == 1)
+      fmt = "";
+      htmp = __plr1__ (hax, varargin{:}, fmt);
+      if (iscomplex (varargin{1}))
+        maxr = max (imag (varargin{1})(:));
+      else
+        maxr = max (varargin{1}(:));
+      endif
+    else
+      print_usage ();
+    endif
+
+    set (hax, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr],
+              "xaxislocation", "zero", "yaxislocation", "zero",
+              "plotboxaspectratio", [1, 1, 1]);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function retval = __plr1__ (h, theta, fmt)
+
+  theta = theta(:);
+  if (iscomplex (theta))
+    rho = imag (theta);
+    theta = real (theta);
+  else
+    rho = theta;
+    theta = (1:rows (rho))';
+  endif
+
+  retval = __plr2__ (h, theta, rho, fmt);
+
+endfunction
+
+function retval = __plr2__ (h, theta, rho, fmt)
+
+  if (ndims (theta) > 2 || ndims (rho) > 2)
+    error ("polar: THETA and RHO must be 2-D objects");
+  endif
+  theta = real (theta);
+  rho = real (rho);
+
+  if (isscalar (theta))
+    if (isscalar (rho))
+      x = rho * cos (theta);
+      y = rho * sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: Can't plot constant THETA with varying RHO");
+    endif
+  elseif (isvector (theta))
+    if (isvector (rho))
+      if (length (theta) != length (rho))
+        error ("polar: THETA and RHO vector lengths must match");
+      endif
+      rho = rho(:);
+      theta = theta(:);
+      x = rho .* cos (theta);
+      y = rho .* sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    elseif (ismatrix (rho))
+      theta = theta(:);
+      t_nr = rows (theta);
+      [r_nr, r_nc] = size (rho);
+      if (t_nr != r_nr)
+        rho = rho';
+        r_nr = r_nc;
+      endif
+      if (t_nr != r_nr)
+        error ("polar: THETA vector and RHO matrix sizes must match");
+      endif
+      x = diag (cos (theta)) * rho;
+      y = diag (sin (theta)) * rho;
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: invalid data for plotting");
+    endif
+  elseif (ismatrix (theta))
+    if (isvector (rho))
+      rho = rho(:);
+      r_nr = rows (rho);
+      [t_nr, t_nc] = size (theta);
+      if (r_nr != t_nr)
+        theta = theta';
+        t_nr = t_nc;
+      endif
+      if (r_nr != t_nr)
+        error ("polar: THETA matrix and RHO vector sizes must match");
+      endif
+      diag_r = diag (rho);
+      x = diag_r * cos (theta);
+      y = diag_r * sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    elseif (ismatrix (rho))
+      if (! size_equal (rho, theta))
+        error ("polar: THETA and RHO matrix dimensions must match");
+      endif
+      x = rho .* cos (theta);
+      y = rho .* sin (theta);
+      retval = __plt__ ("polar", h, x, y, fmt);
+    else
+      error ("polar: invalid data for plotting");
+    endif
+  else
+    error ("polar: invalid data for plotting");
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! theta = linspace (0,2*pi,1000);
+%! rho = sin (7*theta);
+%! polar (theta, rho);
+%! title ('polar() plot');
+
+%!demo
+%! clf;
+%! theta = linspace (0,2*pi,1000);
+%! cplx = theta + i*sin (7*theta);
+%! polar (cplx, 'g');
+%! title ('polar() plot of complex data');
+
+%!demo
+%! clf;
+%! theta = linspace (0,8*pi,1000);
+%! rho = sin (5/4*theta);
+%! polar (theta, rho);
+%! title ('polar() plot');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__add_datasource__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,52 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{newargs} =} __add_datasource__ (@var{fcn}, @var{h}, @var{data}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+function newargs = __add_datasource__ (fcn, h, data, varargin)
+
+  if (ischar (data))
+    data = {data};
+  endif
+
+  for i = 1 : numel (data)
+    addproperty (strcat (data{i}, "datasource"), h, "string", "");
+  endfor
+
+  i = 0;
+  newargs = {};
+  while (i < numel (varargin))
+    arg = varargin{++i};
+    if (i != numel (varargin) && ischar (arg)
+        && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
+      arg = tolower (arg);
+      val = varargin{++i};
+      if (ischar (val))
+        set (h, arg, val);
+      else
+        error ("%s: expecting data source to be a string", fcn);
+      endif
+    else
+      newargs{end + 1} = arg;
+    endif
+  endwhile
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__bar__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,479 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __bar__ (@var{vertical}, @var{func}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function varargout = __bar__ (vertical, func, varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (func, varargin{:});
+
+  ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0
+  width = 0.8 - 10 * eps;
+  group = true;
+  histc = NA;
+  bv = 0;  # BaseValue
+
+  if (nargin > 1 && isnumeric (varargin{2}))
+    x = varargin{1};
+    if (isvector (x))
+      x = x(:);
+    endif
+    y = varargin{2};
+    if (isvector (y))
+      y = y(:);
+    endif
+    if (rows (x) != rows (y))
+      y = varargin{1};
+      if (isvector (y))
+        y = y(:);
+      endif
+      x = [1:rows(y)]';
+      idx = 2;
+    else
+      if (! isvector (x))
+        error ("%s: X must be a vector", func);
+      endif
+      idx = 3;
+    endif
+  else
+    y = varargin{1};
+    if (isvector (y))
+      y = y(:);
+    endif
+    x = [1:rows(y)]';
+    idx = 2;
+  endif
+
+  newargs = {};
+  have_line_spec = false;
+  while (idx <= nargin)
+    if (ischar (varargin{idx}) && strcmpi (varargin{idx}, "grouped"))
+      group = true;
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "stacked"))
+      group = false;
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "histc"))
+      group = true;
+      histc = true; 
+      idx++;
+    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "hist"))
+      group = true;
+      histc = false;
+      idx++;
+    else
+      if ((ischar (varargin{idx}) || iscellstr (varargin{idx}))
+          && ! have_line_spec)
+        [linespec, valid] = __pltopt__ (func, varargin{idx}, false);
+        if (valid)
+          have_line_spec = true;
+          ## FIXME: strange parse error requires semicolon to be spaced
+          ##        away from closing ']' on next line.
+          newargs = [{"facecolor", linespec.color}, newargs] ;
+          idx++;
+          continue;
+        endif
+      endif
+      if (isscalar (varargin{idx}))
+        width = varargin{idx++};
+      elseif (idx == nargin)
+        newargs = [newargs, varargin(idx++)];
+      elseif (ischar (varargin{idx})
+              && strcmpi (varargin{idx}, "basevalue")
+              && isscalar (varargin{idx+1}))
+        bv = varargin{idx+1};
+        idx += 2;
+      else
+        newargs = [newargs, varargin(idx:idx+1)];
+        idx += 2;
+      endif
+    endif
+  endwhile
+
+  ngrp = rows (x);
+  if (ngrp != rows (y))
+    error ("%s: length of X and Y must be equal", func);
+  endif
+  if (any (x(2:end) < x(1:end-1)))
+    error ("%s: X vector values must be in ascending order", func);
+  endif
+
+  nbars = columns (y);
+
+  ## Column width is 1 for 'hist*' styles.  Otherwise, same as group width.
+  if (nbars == 1)
+    cwidth = 1;
+    gwidth = width;
+  elseif (islogical (histc))
+    cwidth = 1;
+    gwidth = width^2;
+  else
+    cwidth = gwidth = width;
+  endif
+
+  ## Complicated algorithm sizes bars with unitless parameter width.
+  ## If width is 1.0, adjacent bars in a group are touching.
+  ## Otherwise, bar size is cwidth and the remaining space is split evenly on
+  ## either side of the bar.  For the default 0.8, spacing is [0.1 0.8 0.1].
+  ## Groups of bars are spaced by gwidth.  If gwidth is 1.0 then adjacent
+  ## groups will just touch.
+  if (numel (x) > 1)
+    cutoff = min (diff (double (x))) / 2;
+  else
+    cutoff = 1;
+  endif
+  if (group)
+    gdelta = cutoff * gwidth / nbars; 
+    cdelta = repmat ((1 - ((1 - cwidth) / 2)) * gdelta, size (x));
+  else
+    cdelta = repmat (cutoff * gwidth, size (x));
+  endif
+  x1 = (x - cdelta)(:)';
+  x2 = (x + cdelta)(:)';
+  xb = repmat ([x1; x1; x2; x2](:), 1, nbars);
+
+  if (group)
+    if (islogical (histc) && histc)
+      offset = 2*cdelta * [0:(nbars-1)] + cdelta(1);  # not centered
+    else
+      offset = 2*cdelta * [-(nbars - 1) / 2 : (nbars - 1) / 2];
+    endif
+
+    xb(1:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
+    xb(2:4:4*ngrp,:) += offset + (1-cwidth) / 2 * (2 * gdelta);
+    xb(3:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
+    xb(4:4:4*ngrp,:) += offset - (1-cwidth) / 2 * (2 * gdelta);
+
+    y0 = zeros (size (y)) + bv;
+    y1 = y;
+  else
+    y1 = cumsum (y,2);
+    y0 = [zeros(ngrp,1)+bv, y1(:,1:end-1)];
+  endif
+
+  yb = zeros (4*ngrp, nbars);
+  yb(1:4:4*ngrp,:) = y0;
+  yb(2:4:4*ngrp,:) = y1;
+  yb(3:4:4*ngrp,:) = y1;
+  yb(4:4:4*ngrp,:) = y0;
+
+  xb = reshape (xb, [4, ngrp, nbars]);
+  yb = reshape (yb, [4, ngrp, nbars]);
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+
+      htmp = bars (hax, vertical, x, y, xb, yb, gwidth, group,
+                   have_line_spec, bv, newargs{:});
+
+      if (! ishold (hax))
+        if (all (x(:,1) == fix (x(:,1))))
+          if (vertical)
+            set (hax, "xtick", x(:,1));
+          else
+            set (hax, "ytick", x(:,1));
+          endif
+        endif
+        ## Hack prevents color and xlim setting changes when basevalue changes.
+        if (vertical)
+          set (hax, "clim", [0 1], "xlimmode", "manual");
+        else
+          set (hax, "clim", [0 1], "ylimmode", "manual");
+        endif
+      endif
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+    if (nargout == 1)
+      varargout{1} = htmp;
+    endif
+  else
+    if (vertical)
+      varargout{1} = xb;
+      varargout{2} = yb;
+    else
+      varargout{1} = yb;
+      varargout{2} = xb;
+    endif
+  endif
+
+endfunction
+
+function hglist = bars (hax, vertical, x, y, xb, yb, width, group, have_color_spec, base_value, varargin)
+
+  nbars = columns (y);
+  clim = get (hax, "clim");
+  hglist = [];
+
+  for i = 1:nbars
+    hg = hggroup ();
+    hglist = [hglist; hg];
+    args = __add_datasource__ ("bar", hg, {"x", "y"}, varargin{:});
+
+    if (vertical)
+      if (! have_color_spec)
+        if (nbars == 1)
+          lev = clim(1);
+        else
+          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
+        endif
+        h = patch (hax, xb(:,:,i), yb(:,:,i),
+                        "FaceColor", "flat", "cdata", lev, "parent", hg);
+      else
+        h = patch (hax, xb(:,:,i), yb(:,:,i), "parent", hg);
+      endif
+    else
+      if (! have_color_spec)
+        if (nbars == 1)
+          lev = clim(1);
+        else
+          lev = (i - 1) * (clim(2) - clim(1)) / (nbars - 1) - clim(1);
+        endif
+        h = patch (hax, yb(:,:,i), xb(:,:,i),
+                        "FaceColor", "flat", "cdata", lev, "parent", hg);
+      else
+        h = patch (hax, yb(:,:,i), xb(:,:,i), "parent", hg);
+      endif
+    endif
+
+    if (i == 1)
+      ## Add baseline object the first time through loop
+      x_axis_range = get (hax, "xlim");
+      h_baseline = line (hax, x_axis_range, [base_value, base_value],
+                             "color", [0, 0, 0]);
+      set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
+      set (h_baseline, "parent", get (hg, "parent"));
+    endif
+
+    ## Setup the hggroup and listeners
+    addproperty ("showbaseline", hg, "radio", "{on}|off");
+    addproperty ("basevalue", hg, "data", base_value);
+    addproperty ("baseline", hg, "data", h_baseline);
+
+    addlistener (hg, "showbaseline", {@show_baseline, "showbl"});
+    addlistener (hg, "visible", {@show_baseline, "visib"});
+    addlistener (hg, "basevalue", @move_baseline);
+
+    addproperty ("barwidth", hg, "data", width);
+    if (group)
+      addproperty ("barlayout", hg, "radio", "stacked|{grouped}", "grouped");
+    else
+      addproperty ("barlayout", hg, "radio", "{stacked}|grouped", "stacked");
+    endif
+    if (vertical)
+      addproperty ("horizontal", hg, "radio", "on|{off}", "off");
+    else
+      addproperty ("horizontal", hg, "radio", "{on}|off", "on");
+    endif
+
+    addlistener (hg, "barwidth", @update_group);
+    addlistener (hg, "barlayout", @update_group);
+    addlistener (hg, "horizontal", @update_group);
+
+    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+
+    addlistener (hg, "edgecolor", @update_props);
+    addlistener (hg, "facecolor", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+
+    if (isvector (x))
+      addproperty ("xdata", hg, "data", x);
+    else
+      addproperty ("xdata", hg, "data", x(:, i));
+    endif
+    addproperty ("ydata", hg, "data", y(:, i));
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+
+    addproperty ("bargroup", hg, "data");
+    set (hglist, "bargroup", hglist);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  endfor
+
+  update_xlim (hax, []);
+  ## Add listeners outside of for loop to prevent constant updating during
+  ## creation of plot when patch objects are added.
+  addlistener (hax, "xlim", @update_xlim);
+  addlistener (h_baseline, "ydata", @update_baseline);
+  addlistener (h_baseline, "visible", @update_baseline);
+
+endfunction
+
+function update_xlim (h, ~)
+  kids = get (h, "children");
+  xlim = get (h, "xlim");
+
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
+      if (any (get (obj.baseline, "xdata") != xlim))
+        set (obj.baseline, "xdata", xlim);
+      endif
+    endif
+  endfor
+endfunction
+
+function update_baseline (h, ~)
+  visible = get (h, "visible");
+  ydata = get (h, "ydata")(1);
+
+  ## Search axis for a bargroup that contains this baseline handle
+  kids = get (get (h, "parent"), "children");
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
+        && obj.baseline == h)
+      set (obj.bargroup, "showbaseline", visible, "basevalue", ydata);
+      break;
+    endif
+  endfor
+endfunction
+
+function show_baseline (h, ~, prop = "")
+  persistent recursion = false;
+  
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      if (strcmp (prop, "showbl"))
+        showbaseline = get (h, "showbaseline");
+        hlist = hlist(hlist != h);  # remove current handle being updated
+        set (hlist, "showbaseline", showbaseline);
+      elseif (strcmp (prop, "visib"))
+        showbaseline = "on";
+        if (all (strcmp (get (hlist, "visible"), "off")))
+          showbaseline = "off";
+        endif
+      endif
+      set (get (h, "baseline"), "visible", showbaseline);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function move_baseline (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    recursion = true;
+    unwind_protect
+      b0 = get (h, "basevalue");
+      bl = get (h, "baseline");
+      set (bl, "ydata", [b0, b0]);
+
+      if (strcmp (get (h, "barlayout"), "grouped"))
+        update_data (h);
+      endif
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_props (h, ~)
+  kids = get (h, "children");
+  set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor"},
+       get (h, {"edgecolor", "linewidth", "linestyle", "facecolor"}));
+endfunction
+
+function update_data (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      x = get (h, "xdata");
+      if (! isvector (x))
+        x = x(:);
+      endif
+      ydat = get (hlist, "ydata");
+      if (iscell (ydat))
+        y = cell2mat (ydat.');
+      else
+        y = ydat;
+      endif
+
+      [xb, yb] = bar (x, y, get (h, "barwidth"), get (h, "barlayout"),
+                      "basevalue", get (h, "basevalue"));
+
+      vertical = strcmp (get (h, "horizontal"), "off");
+      for i = 1:columns (y)
+        hp = get (hlist(i), "children");
+        if (vertical)
+          set (hp, "xdata", xb(:,:,i), "ydata", yb(:,:,i));
+        else
+          set (hp, "xdata", yb(:,:,i), "ydata", xb(:,:,i));
+        endif
+      endfor
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_group (h, ~)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      hlist = get (h, "bargroup");
+      barwidth = get (h, "barwidth");
+      barlayout = get (h, "barlayout");
+      horizontal = get (h, "horizontal");
+
+      hlist = hlist(hlist != h);  # remove current handle being updated
+      set (hlist, "barwidth", barwidth, "barlayout", barlayout,
+                  "horizontal", horizontal);
+      update_data (h);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__contour__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,558 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{c}, @var{hg}] =} __contour__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function [c, hg] = __contour__ (varargin)
+  ax = varargin{1};
+  zlevel = varargin{2};
+  filled = "off";
+
+  linespec.color = "auto";
+  linespec.linestyle = "-";
+  for i = 3:2:nargin
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [lspec, valid] = __pltopt__ ("__contour__", arg, false);
+      if (valid)
+        have_line_spec = true;
+        varargin(i) = [];
+        linespec = lspec;
+        if (isempty (linespec.color))
+          linespec.color = "auto";
+        endif
+        if (isempty (linespec.linestyle))
+          linespec.linestyle = "-";
+        endif
+        break;
+      endif
+    endif
+  endfor
+
+  opts = {};
+  i = 3;
+  while (i < length (varargin))
+    if (ischar (varargin{i}))
+      if (strcmpi (varargin{i}, "fill"))
+        filled = varargin{i+1};
+        varargin(i:i+1) = [];
+      elseif (strcmpi (varargin{i}, "linecolor"))
+        linespec.color = varargin{i+1};
+        varargin(i:i+1) = [];
+      else
+        opts(end+(1:2)) = varargin(i:i+1);
+        varargin(i:i+1) = [];
+      endif
+    else
+      i++;
+    endif
+  endwhile
+
+  if (length (varargin) < 5)
+    z1 = varargin{3};
+    x1 = 1 : columns (z1);
+    y1 = 1 : rows (z1);
+  else
+    x1 = varargin{3};
+    y1 = varargin{4};
+    z1 = varargin{5};
+  endif
+  if (! ismatrix (z1) || ! ismatrix (x1) || ! ismatrix (y1))
+    error ("__contour__: X, Y, and Z must be matrices");
+  endif
+  if (length (varargin) == 4 || length (varargin) == 6)
+    vn = varargin{end};
+    vnauto = false;
+  else
+    vn = 10;
+    vnauto = true;
+  endif
+
+  if (isscalar (vn))
+    ## FIXME: The levels should be determined similarly to {x,y,z}ticks
+    ##        so that they aren't set at extremely odd values.
+    lvl = linspace (min (z1(!isinf (z1))), max (z1(!isinf (z1))), vn + 2);
+    ## Strip off max outlier, min must stay for contourf hole algorithm.
+    lvl = lvl(1:end-1);
+  else
+    lvl = sort (vn);
+  endif
+
+  if (strcmpi (filled, "on"))
+    if (isvector (x1) || isvector (y1))
+      [x1, y1] = meshgrid (x1, y1);
+    endif
+    [nr, nc] = size (z1);
+    x0 = prepad (x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2);
+    x0 = postpad (x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2);
+    x0 = [x0(1, :); x0; x0(1, :)];
+    y0 = prepad (y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1);
+    y0 = postpad (y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1));
+    y0 = [y0(:, 1), y0, y0(:, 1)];
+    z0 = -Inf (nr+2, nc+2);
+    z0(2:nr+1, 2:nc+1) = z1;
+    [c, lev] = contourc (x0, y0, z0, lvl);
+  else
+    [c, lev] = contourc (x1, y1, z1, lvl);
+  endif
+
+  hg = hggroup ();
+  opts = __add_datasource__ ("__countour__", hg, {"x", "y", "z"}, opts{:});
+
+  addproperty ("xdata", hg, "data", x1);
+  addproperty ("ydata", hg, "data", y1);
+  addproperty ("zdata", hg, "data", z1);
+  addproperty ("contourmatrix", hg, "data", c);
+
+  addlistener (hg, "xdata", @update_data);
+  addlistener (hg, "ydata", @update_data);
+  addlistener (hg, "zdata", @update_data);
+  addlistener (hg, "contourmatrix", @update_data);
+
+  addproperty ("fill", hg, "radio", "on|{off}", filled);
+
+  ## The properties zlevel and zlevelmode don't exist in matlab, but allow the
+  ## use of contourgroups with the contour3, meshc, and surfc functions.
+  if (isnumeric (zlevel))
+    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual");
+    addproperty ("zlevel", hg, "data", zlevel);
+  else
+    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", zlevel);
+    addproperty ("zlevel", hg, "data", 0.);
+  endif
+
+  lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
+
+  addproperty ("levellist", hg, "data", lev);
+  addproperty ("levelstep", hg, "double", lvlstep);
+  if (vnauto)
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
+  elseif (isscalar (vn))
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "manual");
+  else
+    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "manual");
+    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
+  endif
+
+  addproperty ("labelspacing", hg, "double", 144);
+  addproperty ("textlist", hg, "data", lev);
+  addproperty ("textlistmode", hg, "radio", "{auto}|manual", "auto");
+  addproperty ("textstep", hg, "double", lvlstep);
+  addproperty ("textstepmode", hg, "radio", "{auto}|manual", "auto");
+  addproperty ("showtext", hg, "radio", "on|{off}", "off");
+
+  addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none");
+  addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
+  addproperty ("linewidth", hg, "linelinewidth", 0.5);
+
+  ## Matlab property, although Octave does not implement it.
+  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+  addlistener (hg, "fill", {@update_data, "fill"});
+
+  addlistener (hg, "zlevelmode", @update_zlevel);
+  addlistener (hg, "zlevel", @update_zlevel);
+
+  addlistener (hg, "levellist", {@update_data, "levellist"});
+  addlistener (hg, "levelstep", {@update_data, "levelstep"});
+  addlistener (hg, "levellistmode", @update_data);
+  addlistener (hg, "levelstepmode", @update_data);
+
+  addlistener (hg, "labelspacing", @update_text);
+  addlistener (hg, "textlist", {@update_text, "textlist"});
+  addlistener (hg, "textlistmode", @update_text);
+  addlistener (hg, "textstep", {@update_text, "textstep"});
+  addlistener (hg, "textstepmode", @update_text);
+  addlistener (hg, "showtext", @update_text);
+
+  addlistener (hg, "linecolor", @update_line);
+  addlistener (hg, "linestyle", @update_line);
+  addlistener (hg, "linewidth", @update_line);
+
+  ## Set axis before adding patches so that each new patch does not trigger
+  ## new axis calculation.  No need if mode is already "manual".
+  if (all (strcmp (get (gca (), {"xlimmode", "ylimmode"}), "auto")))
+    axis ([min(x1(:)) max(x1(:)) min(y1(:)) max(y1(:))]);
+  endif
+
+  add_patch_children (hg);
+
+  if (! isempty (opts))
+    set (hg, opts{:});
+  endif
+
+endfunction
+
+function add_patch_children (hg)
+  c = get (hg, "contourmatrix");
+  lev = get (hg, "levellist");
+  fill = get (hg, "fill");
+  zlev = get (hg, "zlevel");
+  zmode = get (hg, "zlevelmode");
+  lc = get (hg, "linecolor");
+  lw = get (hg, "linewidth");
+  ls = get (hg, "linestyle");
+  filled = get (hg, "fill");
+  ca = gca ();
+
+  ## Turn off automatic updating of clim while adding patches
+  climmode = get (ca, "climmode");
+  set (ca, "climmode", "manual"); 
+
+  if (strcmp (lc, "auto"))
+    lc = "flat";
+  endif
+
+  if (strcmp (filled, "on"))
+
+    lvl_eps = get_lvl_eps (lev);
+
+    ## Decode contourc output format.
+    i = 1;
+    ncont = 0;
+    while (i < columns (c))
+      ncont++;
+      cont_lev(ncont) = c(1, i);
+      cont_len(ncont) = c(2, i);
+      cont_idx(ncont) = i+1;
+      ii = i + (1:cont_len(ncont));
+      cont_area(ncont) = polyarea (c(1, ii), c(2, ii));
+      i += cont_len(ncont) + 1;
+    endwhile
+
+    ## Handle for each level the case where we have (a) hole(s) in a patch.
+    ## Those are to be filled with the color of level below or with the
+    ## background colour.
+    for k = 1:numel (lev)
+      lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps);
+      len = numel (lvl_idx);
+      if (len > 1)
+        mark = false (size (lvl_idx));
+        a = 1;
+        while (a < len)
+          ## take 1st patch
+          pa_idx = lvl_idx(a);
+          ## get pointer to contour start, and contour length
+          curr_ct_idx = cont_idx(pa_idx);
+          curr_ct_len = cont_len(pa_idx);
+          ## get contour
+          curr_ct = c(:, curr_ct_idx:curr_ct_idx+curr_ct_len-1);
+          b_vec = (a+1):len;
+          next_ct_pt_vec = c(:, cont_idx(lvl_idx(b_vec)));
+          in = inpolygon (next_ct_pt_vec(1,:), next_ct_pt_vec(2,:),
+                          curr_ct(1, :), curr_ct(2, :));
+          mark(b_vec(in)) = ! mark(b_vec(in));
+          a++;
+        endwhile
+        if (numel (mark) > 0)
+          ## All marked contours describe a hole in a larger contour of
+          ## the same level and must be filled with colour of level below.
+          ma_idx = lvl_idx(mark);
+          if (k > 1)
+            ## Find color of level below.
+            tmp = find (abs (cont_lev - lev(k - 1)) < lvl_eps);
+            lvl_bel_idx = tmp(1);
+            ## Set color of patches found.
+            cont_lev(ma_idx) = cont_lev(lvl_bel_idx);
+          else
+            ## Set lowest level contour to NaN.
+            cont_lev(ma_idx) = NaN;
+          endif
+        endif
+      endif
+    endfor
+
+    ## The algorithm can create patches with the size of the plotting
+    ## area, we would like to draw only the patch with the highest level.
+    del_idx = [];
+    max_idx = find (cont_area == max (cont_area));
+    if (numel (max_idx) > 1)
+      ## delete double entries
+      del_idx = max_idx(1:end-1);
+      cont_area(del_idx) = cont_lev(del_idx) = [];
+      cont_len(del_idx) = cont_idx(del_idx) = [];
+    endif
+
+    ## Now we have everything together and can start plotting the patches
+    ## beginning with largest area.
+    [~, svec] = sort (cont_area);
+    len = ncont - numel (del_idx);
+    h = [];
+    for n = len:-1:1
+      idx = svec(n);
+      ctmp = c(:, cont_idx(idx):cont_idx(idx) + cont_len(idx) - 1);
+      if (all (ctmp(:,1) == ctmp(:,end)))
+        ## patch() doesn't need/want closed contour.  It will do it itself.
+        ctmp(:,end) = [];
+      endif
+      if (isnan (cont_lev(idx)))
+        fc = get (ca, "color");
+        if (strcmp (fc, "none"))
+          fc = get (ancestor (ca, "figure"), "color");
+        endif
+      else
+        fc = "flat";
+      endif
+      h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:),
+                           "vertices", ctmp.', "faces", 1:(cont_len(idx)-1),
+                           "facevertexcdata", cont_lev(idx), "facecolor", fc,
+                           "cdata", cont_lev(idx), "edgecolor", lc,
+                           "linestyle", ls, "linewidth", lw,
+                           "parent", hg)];
+    endfor
+
+    if (min (lev) == max (lev))
+      set (ca, "clim", [min(lev)-1, max(lev)+1], "layer", "top");
+    else
+      set (ca, "clim", [min(lev), max(lev)], "layer", "top");
+    endif
+  else
+    ## Decode contourc output format.
+    h = [];
+    i = 1;
+    while (i < length (c))
+      clev = c(1,i);
+      clen = c(2,i);
+
+      if (all (c(:,i+1) == c(:,i+clen)))
+        p = c(:, i+1:i+clen-1).';
+      else
+        p = [c(:, i+1:i+clen), NaN(2, 1)].';
+      endif
+
+      switch (zmode)
+        case "none"
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", [],
+                               "vertices", p, "faces", 1:rows (p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+        case "auto"
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", clev * ones (rows (p),1),
+                               "vertices", [p, clev * ones(rows(p),1)],
+                               "faces", 1:rows(p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+        otherwise
+          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
+                               "zdata", zlev * ones (rows (p), 1),
+                               "vertices", [p, zlev * ones(rows(p),1)],
+                               "faces", 1:rows (p),
+                               "facevertexcdata", clev, "facecolor", "none",
+                               "cdata", clev, "edgecolor", lc,
+                               "linestyle", ls, "linewidth", lw,
+                               "parent", hg)];
+      endswitch
+      i += clen + 1;
+    endwhile
+  endif
+
+  set (ca, "climmode", climmode);
+
+endfunction
+
+function update_zlevel (h, ~)
+  z = get (h, "zlevel");
+  zmode = get (h, "zlevelmode");
+  kids = get (h, "children");
+
+  switch (zmode)
+    case "none"
+      set (kids, "zdata", []);
+    case "auto"
+      for i = 1 : length (kids)
+        set (kids(i), "zdata", get (kids(i), "cdata") .*
+             ones (size (get (kids(i), "xdata"))));
+      endfor
+    otherwise
+      for i = 1 : length (kids)
+        set (kids(i), "zdata", z .* ones (size (get (kids(i), "xdata"))));
+      endfor
+  endswitch
+endfunction
+
+function update_line (h, ~)
+  lc = get (h, "linecolor");
+  if (strcmp (lc, "auto"))
+    lc = "flat";
+  endif
+  set (findobj (h, "type", "patch"), "edgecolor", lc,
+       "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
+endfunction
+
+function update_data (h, ~, prop = "")
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+
+    delete (get (h, "children"));
+
+    switch (prop)
+      case "levellist"
+        set (h, "levellistmode", "manual")
+      case "levelstep"
+        set (h, "levelstepmode", "manual")
+      case "fill"
+        ## Switching from filled ('k' linespec) to unfilled, reset linecolor
+        if (strcmp (get (h, "fill"), "off"))
+          set (h, "linecolor", "auto");
+        else
+          set (h, "linecolor", "black");
+        endif
+    endswitch
+
+    if (strcmp (get (h, "levellistmode"), "manual")
+        && ! strcmp (prop, "levelstep"))
+      lvl = get (h, "levellist");
+    elseif (strcmp (get (h, "levelstepmode"), "manual"))
+      z = get (h, "zdata");
+      lvs = get (h, "levelstep");
+      lvl(1) = ceil (min (z(:)) / lvs) * lvs;
+      lvl(2) = floor (max (z(:)) / lvs) * lvs;
+      if (lvl(1) >= lvl(2))
+        lvl = median (z(:));
+      else
+        lvl = lvl(1) : lvs : lvl(2);
+      endif
+      set (h, "levellist", lvl);
+      set (h, "levellistmode", "auto");
+    else
+      z = get (h, "zdata");
+      ## FIXME: The levels should be determined similarly to {x,y,z}ticks
+      ##        so that they aren't set at extremely odd values.
+      lvl = linspace (min (z(!isinf (z))), max (z(!isinf (z))), 10 + 2);
+      ## Strip off max outlier, min must stay for contourf hole algorithm.
+      lvl = lvl(1:end-1);
+    endif
+
+    if (strcmp (get (h, "fill"), "on"))
+      X = get (h, "xdata");
+      Y = get (h, "ydata");
+      Z = get (h, "zdata");
+      if (isvector (X) || isvector (Y))
+        [X, Y] = meshgrid (X, Y);
+      endif
+      [nr, nc] = size (Z);
+      X0 = prepad (X, nc+1, 2 * X(1, 1) - X(1, 2), 2);
+      X0 = postpad (X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2);
+      X0 = [X0(1, :); X0; X0(1, :)];
+      Y0 = prepad (Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1);
+      Y0 = postpad (Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1));
+      Y0 = [Y0(:, 1), Y0, Y0(:, 1)];
+      Z0 = -Inf (nr+2, nc+2);
+      Z0(2:nr+1, 2:nc+1) = Z;
+      [c, lev] = contourc (X0, Y0, Z0, lvl);
+    else
+      [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"),
+                           get (h, "zdata"), lvl);
+    endif
+    set (h, "contourmatrix", c);
+
+    if (strcmp (get (h, "levellistmode"), "manual"))
+      ## Do nothing
+    elseif (strcmp (get (h, "levelstepmode"), "manual"))
+      set (h, "levellist", lev);
+    else
+      set (h, "levellist", lev);
+      lvlstep = sum (diff (lvl)) / (length (lvl) - 1);
+      set (h, "levelstep", lvlstep);
+    endif
+
+    add_patch_children (h);
+    update_text (h);
+    recursive = false;
+  endif
+
+endfunction
+
+function update_text (h, ~, prop = "")
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+
+    delete (findobj (h, "type", "text"));
+
+    switch (prop)
+      case "textlist"
+        set (h, "textlistmode", "manual")
+      case "textstep"
+        set (h, "textstepmode", "manual")
+    endswitch
+
+    if (strcmp (get (h, "textlistmode"), "manual"))
+      lvl = get (h, "textlist");
+    elseif (strcmp (get (h, "textstepmode"), "manual"))
+      lev = get (h, "levellist");
+
+      lvl_eps = get_lvl_eps (lev);
+
+      stp = get (h, "textstep");
+      t = [0, floor(cumsum(diff (lev)) / (abs(stp) - lvl_eps))];
+      lvl = lev([true, t(1:end-1) != t(2:end)]);
+      set (h, "textlist", lvl);
+    else
+      lvl = get (h, "levellist");
+      set (h, "textlist", lvl, "textstep", get (h, "levelstep"));
+    endif
+
+    if (strcmp (get (h, "showtext"), "on"))
+      switch (get (h, "zlevelmode"))
+        case "manual"
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), get (h, "zlevel"));
+        case "auto"
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), "auto");
+        otherwise
+          __clabel__ (get (h, "contourmatrix"), lvl, h,
+                      get (h, "labelspacing"), []);
+      endswitch
+    endif
+
+    recursive = false;
+  endif
+endfunction
+
+function lvl_eps = get_lvl_eps (lev)
+  ## FIXME: is this the right thing to do for this tolerance?  Should
+  ## it be an absolute or relative tolerance, or switch from one to the
+  ## other depending on the value of lev?
+  if (isscalar (lev))
+    lvl_eps = abs (lev) * sqrt (eps) + sqrt (eps);
+  else
+    tmp = min (abs (diff (lev)));
+    if (tmp < 10*eps)
+      lvl_eps = sqrt (eps);
+    else
+      lvl_eps = tmp / 1000.0;
+    endif
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__errcomm__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,79 @@
+## Copyright (C) 2001-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{hax}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Created: 20.02.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function retval = __errcomm__ (caller, hax, varargin)
+
+  if (nargin < 4)
+    print_usage (caller);
+  endif
+
+  retval = [];
+  data = cell (6,1);
+  nargs = numel (varargin);
+  k = 1;
+  while (k <= nargs)
+    arg = varargin{k++};
+    if (! ismatrix (arg))
+      error ("%s: data argument %d must be numeric", caller, k-1);
+    endif
+    if (isvector (arg))
+      arg = arg(:);
+    endif
+    sz = size (arg);
+    ndata = 1;
+    data{ndata} = arg;
+    while (k <= nargs)
+      arg = varargin{k++};
+      if (ischar (arg) || iscellstr (arg))
+        retval(end+1,1) = __errplot__(arg, hax, data{1:ndata});
+        break;
+      endif
+      if (! ismatrix (arg))
+        error ("%s: data argument %d must be numeric", caller, k-1);
+      endif
+      if (isvector (arg))
+        arg = arg(:);
+      endif
+      if (any (size (arg) != sz))
+        error ("%s: size of argument %d does not match others", caller, k-1);
+      endif
+      data{++ndata} = arg;
+      if (ndata > 6)
+        error ("%s: too many arguments to plot", caller);
+      endif
+    endwhile
+  endwhile
+
+  ## No format code found, use yerrorbar
+  if (! (ischar (arg) || iscellstr (arg)))
+    retval = [retval; __errplot__("~", hax, data{1:ndata})];
+  endif
+
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__errplot__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,349 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{hax}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## Created: 18.7.2000
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = __errplot__ (fstr, hax, varargin)
+
+  fmt = __pltopt__ ("__errplot__", fstr);
+
+  ## Set the plot type based on linestyle.
+  switch (fmt.errorstyle) 
+    case "~"
+      ifmt = "yerr";
+    case ">"
+      ifmt = "xerr";
+    case "~>"
+      ifmt = "xyerr";
+    case "#"
+      ifmt = "box";
+    case "#~"
+      ifmt = "boxy";
+    case "#~>"
+      ifmt = "boxxy";
+    otherwise
+      ifmt = "yerr";
+  endswitch
+
+  h = [];
+  nplots = columns (varargin{1});
+  for i = 1:nplots
+
+    if (isempty (fmt.color))
+      lc = __next_line_color__ ();
+    else
+      lc = fmt.color ();
+    endif
+    if (isempty (fmt.marker) && isempty (fmt.linestyle))
+      [ls, mk] = __next_line_style__ ();
+    else
+      ls = fmt.linestyle;
+      mk = fmt.marker;
+    endif
+
+    ## Must occur after __next_line_color__ in order to work correctly.
+    hg = hggroup ("parent", hax);
+    h = [h; hg];
+    args = __add_datasource__ ("__errplot__", hg,
+                               {"x", "y", "l", "u", "xl", "xu"});
+
+    hl = [(__line__ (hg, "color", lc, "linestyle", ls, "marker", mk)),
+          (__line__ (hg, "color", lc, "linestyle", "-", "marker", "none"))];
+
+    switch (numel (varargin))
+      case 2
+        ydata = varargin{1}(:,i);
+        xdata = 1:numel (ydata);
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          ldata  = varargin{2}(:,i);
+          udata  = ldata;
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
+          xldata = varargin{2}(:,i);
+          xudata = ldata;
+          ldata  = [];
+          udata  = [];
+        else
+          error ("errorbar: 2 column errorplot is only valid for xerr or yerr");
+        endif
+      case 3
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          ldata  = varargin{3}(:,i);
+          udata  = ldata;
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          ydata  = varargin{1}(:,i);
+          xdata  = 1:numel (ydata);
+          xldata = varargin{2}(:,i);
+          xudata = xldata;
+          ldata  = varargin{3}(:,i);
+          udata  = ldata;
+        else  # xerr or box
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = xldata;
+          ldata  = [];
+          udata  = [];
+        endif
+      case 4
+        if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          ldata  = varargin{3}(:,i);
+          udata  = varargin{4}(:,i);
+          xldata = [];
+          xudata = [];
+        elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = xldata;
+          ldata  = varargin{4}(:,i);
+          udata  = ldata;
+        else  # xerr or box
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = varargin{4}(:,i);
+          ldata  = [];
+          udata  = [];
+        endif
+      case 6  # xyerr, boxxy
+        if (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy"))
+          xdata  = varargin{1}(:,i);
+          ydata  = varargin{2}(:,i);
+          xldata = varargin{3}(:,i);
+          xudata = varargin{4}(:,i);
+          ldata  = varargin{5}(:,i);
+          udata  = varargin{6}(:,i);
+        else
+          error ("errorbar: error plot with 6 columns only valid for xyerr and boxxy");
+        endif
+      otherwise
+        error ("errorbar: error plot requires 2, 3, 4, or 6 arguments");
+    endswitch
+
+    addproperty ("xdata", hg, "data", xdata(:));
+    addproperty ("ydata", hg, "data", ydata(:));
+    addproperty ("ldata", hg, "data", ldata(:));
+    addproperty ("udata", hg, "data", udata(:));
+    addproperty ("xldata", hg, "data", xldata(:));
+    addproperty ("xudata", hg, "data", xudata(:));
+    addproperty ("format", hg, "string", ifmt);
+
+    addproperty ("color", hg, "linecolor", get (hl(1), "color"));
+    addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle"));
+    addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth"));
+    addproperty ("marker", hg, "linemarker", get (hl(1), "marker"));
+    addproperty ("markeredgecolor", hg, "linemarkerfacecolor",
+                 get (hl(1), "markeredgecolor"));
+    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                 get (hl(1), "markerfacecolor"));
+    addproperty ("markersize", hg, "linemarkersize",
+                 get (hl(1), "markersize"));
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    fcn = {@update_props, hl};
+    addlistener (hg, "color", fcn);
+    addlistener (hg, "linestyle", fcn);
+    addlistener (hg, "linewidth", fcn);
+    addlistener (hg, "marker", fcn);
+    addlistener (hg, "markeredgecolor", fcn);
+    addlistener (hg, "markerfacecolor", fcn);
+    addlistener (hg, "markersize", fcn);
+
+    fcn = {@update_data, hl};
+    addlistener (hg, "xdata", fcn);
+    addlistener (hg, "ydata", fcn);
+    addlistener (hg, "ldata", fcn);
+    addlistener (hg, "udata", fcn);
+    addlistener (hg, "xldata", fcn);
+    addlistener (hg, "xudata", fcn);
+    addlistener (hg, "format", fcn);
+
+    hax = ancestor (hg, "axes");
+    addlistener (hax, "xscale", fcn);
+    addlistener (hax, "yscale", fcn);
+
+    update_data (hg, [], hl);
+
+  endfor
+
+  ## Process legend key
+  if (! isempty (fmt.key))    
+    hlegend = [];
+    fkids = get (gcf (), "children");
+    for i = 1 : numel (fkids)
+      if (   strcmp (get (fkids(i), "type"), "axes")
+          && strcmp (get (fkids(i), "tag"), "legend"))
+        udata = get (fkids(i), "userdata");
+        if (! isempty (intersect (udata.handle, gca ())))
+          hlegend = fkids (i);
+          break;
+        endif
+      endif
+    endfor
+
+    if (isempty (hlegend))
+      hlgnd = [];
+      tlgnd = {};
+    else
+      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
+    endif
+ 
+    hlgnd(end+1) = hg;
+    tlgnd(end+1) = fmt.key;
+
+    legend (gca (), hlgnd, tlgnd);
+  endif
+
+endfunction
+
+function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata,
+                                         xldata, xudata, ifmt,
+                                         xscale, yscale)
+  if (strcmp (xscale, "linear"))
+    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
+    xlo = xdata - dx;
+    xhi = xdata + dx;
+  else
+    n = xdata > 0;
+    if (! any (n))
+      n = xdata < 0;
+    endif
+    logdata = log (abs (xdata(n)));
+    rx = exp (0.01 * (max (logdata) - min (logdata)));
+    xlo = xdata/rx;
+    xhi = xdata*rx;
+  endif
+  if (strcmp (yscale, "linear"))
+    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
+    ylo = ydata - dy;
+    yhi = ydata + dy;
+  else
+    n = ydata > 0;
+    if (! any (n))
+      n = ydata < 0;
+    endif
+    logdata = log (abs (ydata(n)));
+    ry = exp (0.01 * (max (logdata) - min (logdata)));
+    ylo = ydata/ry;
+    yhi = ydata*ry;
+  endif
+  nans = NaN + xdata(:);  # fast way to do NaN (size (xdata(:)))
+  if (strcmp (ifmt, "yerr"))
+    xdata = [xdata, xdata, nans, ...
+             xlo, xhi, nans, ...
+             xlo, xhi, nans];
+    ydata = [ydata-ldata, ydata+udata, nans, ...
+             ydata+udata, ydata+udata, nans, ...
+             ydata-ldata, ydata-ldata, nans];
+  elseif (strcmp (ifmt, "xerr"))
+    xdata = [xdata-xldata, xdata+xudata, nans, ...
+             xdata+xudata, xdata+xudata, nans, ...
+             xdata-xldata, xdata-xldata, nans];
+    ydata = [ydata, ydata, nans, ...
+             ylo, yhi, nans, ...
+             ylo, yhi, nans];
+  elseif (strcmp (ifmt, "boxy"))
+    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
+    xdata = [xlo, xhi, xhi, xlo, xlo, nans];
+    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
+             ydata-ldata, nans];
+  elseif (strcmp (ifmt, "box"))
+    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
+    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
+             xdata-xldata, nans];
+    ydata = [ylo, ylo, yhi, yhi, ylo, nans];
+  elseif (strcmp (ifmt, "boxxy"))
+    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
+             xdata-xldata, nans];
+    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
+             ydata-ldata, nans];
+  elseif (strcmp (ifmt, "xyerr"))
+    [x1, y1] = errorbar_data (xdata, ydata, ldata, udata,
+                              xldata, xudata, "xerr", xscale, yscale);
+    [x2, y2] = errorbar_data (xdata, ydata, ldata, udata,
+                              xldata, xudata, "yerr", xscale, yscale);
+    xdata = [x1; x2];
+    ydata = [y1; y2];
+    return;
+  else
+    error ("errorbar: valid error bar types are xerr, yerr, xyerr, box, boxy, boxxy");
+  endif
+
+  xdata = xdata.'(:);
+  ydata = ydata.'(:);
+
+endfunction
+
+function update_props (hg, ~, hl)
+  set (hl, "color", get (hg, "color"),
+           "linewidth", get (hg, "linewidth"));
+  set (hl(1), "linestyle", get (hg, "linestyle"),
+              "marker", get (hg, "marker"),
+              "markeredgecolor", get (hg, "markeredgecolor"),
+              "markerfacecolor", get (hg, "markerfacecolor"),
+              "markersize", get (hg, "markersize"));
+endfunction
+
+function update_data (hg, ~, hl)
+
+  if (strcmp (get (hg, "type"), "axes"))
+    hax = hg;
+    hg = ancestor (hl(1), "hggroup");
+  else
+    hax = ancestor (hg, "axes");
+  endif
+  xscale = get (hax, "xscale");
+  yscale = get (hax, "yscale");
+
+  xdata  = get (hg, "xdata");
+  ydata  = get (hg, "ydata");
+  ldata  = get (hg, "ldata");
+  udata  = get (hg, "udata");
+  xldata = get (hg, "xldata");
+  xudata = get (hg, "xudata");
+  ifmt = get (hg, "format");
+
+  set (hl(1), "xdata", xdata);
+  set (hl(1), "ydata", ydata);
+
+  [errorbar_xdata, errorbar_ydata] = ...
+          errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ...
+                         ifmt, xscale, yscale);
+
+  set (hl(2), "xdata", errorbar_xdata);
+  set (hl(2), "ydata", errorbar_ydata);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__ezplot__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,565 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{needusage}] =} __ezplot__ (@var{pltfunc}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Overview: This function is the back-end for the 9 ez* plot functions.
+##           As such, most of the function is actually dedicated to sorting
+##           out the inputs and verifying that the particular ez* function
+##           called was called correctly.  The actual plotting occurs near
+##           the end in an unwind_protect block. 
+
+function [h, needusage] = __ezplot__ (pltfunc, varargin)
+
+  ezfunc = ["ez" pltfunc];
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (ezfunc, varargin{:});
+
+  ## Define outputs early in case of shorting out of function with return;
+  h = [];
+  needusage = false;
+  if (nargin < 1)
+    needusage = true;
+    return;
+  endif
+
+  iscontour = strncmp (pltfunc, "contour", 7);
+
+  ## Defaults for ezplot
+  isplot  = true;
+  isplot3 = false;
+  ispolar = false;
+  nargs = 1;
+  switch (pltfunc)
+    case "plot"
+      ## defaults already set
+
+    case "plot3"
+      isplot  = false;
+      isplot3 = true;
+  
+    case "polar"
+      isplot  = false;
+      ispolar = true;
+    
+    otherwise
+      ## contour, mesh, surf plots
+      isplot  = false;
+      nargs = 2;
+
+  endswitch
+
+  parametric = false;
+  fun = varargin{1};
+  if (ischar (fun))
+    if (exist (fun, "file") || exist (fun, "builtin"))
+      fun = inline ([fun "(t)"]);
+    else
+      fun = vectorize (inline (fun));
+    endif
+    argids = argnames (fun);
+    if (isplot && length (argids) == 2)
+      nargs = 2;
+    elseif (numel (argids) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    fstr = formula (fun);
+    if (isplot)
+      xarg = argids{1};
+      if (nargs == 2)
+        yarg = argids{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argids{1};
+      yarg = argids{2};
+    endif
+  elseif (strcmp (typeinfo (fun), "inline function"))
+    argids = argnames (fun);
+    if (isplot && length (argids) == 2)
+      nargs = 2;
+    elseif (numel (argids) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    fun = vectorize (fun);
+    fstr = formula (fun);
+    if (isplot)
+      xarg = argids{1};
+      if (nargs == 2)
+        yarg = argids{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (isplot || ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argids{1};
+      yarg = argids{2};
+    endif
+  elseif (isa (fun, "function_handle"))
+    fstr = func2str (fun);
+    idx = index (fstr, ')');
+    if (idx != 0)
+      args = regexp (fstr(3:(idx-1)), '\w+', 'match');
+      fstr = fstr(idx+2:end);  # remove '@(x) ' from string name
+    else
+      args = {"x"};
+    endif
+    if (isplot && length (args) == 2)
+      nargs = 2;
+    elseif (numel (args) != nargs)
+      error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+    endif
+    if (isplot)
+      xarg = args{1};
+      if (nargs == 2)
+        yarg = args{2};
+      else
+        yarg = "";
+      endif
+    elseif (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = args{1};
+      yarg = args{2};
+    endif
+  else
+    error ("%s: expecting string, inline function, or function handle", ezfunc);
+  endif
+
+  if (nargin > 2 || (nargin == 2 && isplot))
+    funx = fun;
+    fstrx = fstr;
+    funy = varargin{2};
+    if (ischar (funy) && ! strcmp (funy, "circ") && ! strcmp (funy, "animate"))
+      parametric = true;
+      if (exist (funy, "file") || exist (funy, "builtin"))
+        funy = inline ([funy "(t)"]);
+      else
+        funy = vectorize (inline (funy));
+      endif
+      if (numel (argnames (funy)) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+      fstry = formula (funy);
+    elseif (strcmp (typeinfo (funy), "inline function"))
+      parametric = true;
+      if (numel (argnames (funy)) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+      funy = vectorize (funy);
+      fstry = formula (funy);
+    elseif (isa (funy, "function_handle"))
+      parametric = true;
+      fstry = func2str (funy);
+      idx = index (fstry, ')');
+      if (idx != 0)
+        args = regexp (fstry(3:(idx-1)), '\w+', 'match');
+        fstry = fstry(idx+2:end);  # remove '@(x) ' from string name
+      else
+        args = {"y"};
+      endif
+      if (numel (args) != nargs)
+        error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+      endif
+    endif
+
+    if (! parametric && isplot3)
+      needusage = true;  # Can't call non-parametric ezplot3
+      return;
+    elseif (parametric && isplot)
+      if (nargs == 2)
+        error ("%s: can not define a parametric function in this manner", ezfunc);
+      else
+        xarg = "x";
+        yarg = "y";
+      endif
+    elseif (parametric)
+      funz = varargin{3};
+      if (ischar (funz) && ! strcmp (funz, "circ")
+          && ! strcmp (funz, "animate"))
+        if (exist (funz, "file") || exist (funz, "builtin"))
+          funz = inline ([funz "(t)"]);
+        else
+          funz = vectorize (inline (funz));
+        endif
+        if (numel (argnames (funz)) > nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+        fstrz = formula (funz);
+      elseif (strcmp (typeinfo (funz), "inline function"))
+        if (numel (argnames (funz)) != nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+        funz = vectorize (funz);
+        fstrz = formula (funz);
+      elseif (isa (funz, "function_handle"))
+        fstrz = func2str (funz);
+        idx = index (fstrz, ')');
+        if (idx != 0)
+          args = regexp (fstrz(3:(idx-1)), '\w+', 'match');
+          fstrz = fstrz(idx+2:end);  # remove '@(x) ' from string name
+        else
+          args = {"z"};
+        endif
+        if (numel (args) != nargs)
+          error ("%s: expecting a function of %d arguments", ezfunc, nargs);
+        endif
+      else
+        error ("%s: parametric plots expect 3 functions", ezfunc);
+      endif
+    endif
+  endif
+
+  if ((isplot && nargs != 2) || isplot3 || ispolar)
+    n = 500;   # default for point-style functions like plot
+  else
+    n = 60;    # default for meshgrid style functions like contour, surf
+  endif
+  domain = [];
+  circ = false;
+  animate = false;
+  if (parametric)
+    if (isplot)
+      iarg = 3;
+    else
+      iarg = 4;
+    endif
+  else
+    iarg = 2;
+  endif
+  while (iarg <= nargin)
+    arg = varargin{iarg++};
+    if (ischar (arg) && strcmp (arg, "circ"))
+      circ = true;
+    elseif (ischar (arg) && strcmp (arg, "animate"))
+      animate = true;
+    elseif (isscalar (arg))
+      n = arg;
+    elseif (numel (arg) == 2)
+      domain = [arg(1) arg(2) arg(1) arg(2)];
+    elseif (numel (arg) == 4)
+      domain = arg(:).';
+    else
+      error ("%s: expecting scalar, 2-, or 4-element vector", ezfunc);
+    endif
+  endwhile
+
+  if (circ && (iscontour || isplot3 || isplot))
+    needusage = true;
+    return;
+  elseif (circ && parametric)
+    error ("%s: can not have both circular domain and parametric function",
+           ezfunc);
+  endif
+
+  if (animate && ! isplot3)
+    error ("%s: animate option only valid for ezplot3", ezfunc);
+  endif
+
+  if (parametric)
+    ## Make the label strings pretty by removing extra spaces between base
+    ## and exponent, the '.' in vectorized code, and the '*' for multiply.
+    fstrx = regexprep (regexprep (regexprep (fstrx,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    fstry = regexprep (regexprep (regexprep (fstry,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    if (isplot)
+      fstr = ["x = " fstrx ", y = " fstry];
+    else
+      fstrz = regexprep (regexprep (regexprep (fstrz,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+      fstr = ["x = " fstrx ",y = " fstry ", z = " fstrz];
+    endif
+  else
+    fstr = regexprep (regexprep (regexprep (fstr,
+           '\s*\.?(?:\^|\*\*)\s*','^'), '\.([/+-])', '$1'), '\s*\.?\*\s*', ' ');
+    if (isplot && nargs == 2)
+      fstr = [fstr " = 0"];  # make title string of implicit function
+    endif
+  endif
+
+  if (isempty (domain))
+    auto_domain = true;
+    if (isplot3 || ispolar)
+      domain = [0, 2*pi, 0, 2*pi];
+    else
+      domain = [-2*pi, 2*pi, -2*pi, 2*pi];
+    endif
+  else
+    auto_domain = false;
+  endif
+
+  auto_domain_done = false;
+  do
+    domain_ok = true;
+
+    if ((isplot && nargs == 1) || isplot3 || ispolar)
+      X = linspace (domain(1), domain(2), n);
+    elseif (isplot && numel (domain) == 2)
+      x = linspace (domain(1), domain(2), n);
+      [X, Y] = meshgrid (x, x);
+    elseif (circ)
+      ## To plot on circular domain develop grid in polar coordinates
+      ## and then switch these to Cartesian coordinates.
+      cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2;
+      rmax = sqrt ((domain(2) - cent(1))^2 + (domain(4) - cent(2))^2);
+      r = linspace (0, rmax, n);
+      t = linspace (0, 2*pi, n);
+      [T, R] = meshgrid (t, r);
+      X = R .* cos (T) + cent(1);
+      Y = R .* sin (T) + cent(2);
+      domain = [-rmax+cent(1), +rmax+cent(1), -rmax+cent(2), +rmax+cent(2)];
+    else  # contour, mesh, surf plots
+      x = linspace (domain(1), domain(2), n);
+      y = linspace (domain(3), domain(4), n);
+      [X, Y] = meshgrid (x, y);
+    endif
+
+    if (parametric)
+      if (isplot)
+        XX = feval (funx, X);
+        Z = feval (funy, X);
+        X = XX;
+      elseif (isplot3)
+        Z = feval (funz, X);
+        XX = feval (funx, X);
+        YY = feval (funy, X);
+        X = XX;
+        Y = YY;
+      else
+        Z = feval (funz, X, Y);
+        XX = feval (funx, X, Y);
+        YY = feval (funy, X, Y);
+        X = XX;
+        Y = YY;
+
+        ## Eliminate the singularities
+        X = __eliminate_sing__ (X);
+        Y = __eliminate_sing__ (Y);
+        Z = __eliminate_sing__ (Z);
+      endif
+    else  ## non-parametric plots
+      if (isplot && nargs == 2)
+        Z = feval (fun, X, Y);
+
+        ## Matlab returns line objects for this case and so can't call
+        ## contour directly as it returns patch objects to allow colormaps
+        ## to work with contours.  Therefore recreate the lines from the
+        ## output for contourc, and store in cell arrays.
+        [c, ~] = contourc (X, Y, Z, [0, 0]);
+
+        i = 1;
+        XX = YY = {};
+        while (i < length (c))
+          clev = c(1,i);
+          clen = c(2,i);
+          XX = [XX, {c(1, i+1:i+clen)}];
+          YY = [YY, {c(2, i+1:i+clen)}];
+          i += clen+1;
+        endwhile
+      else
+        if (ispolar)
+          Z = feval (fun, X);
+          ## FIXME: Why aren't singularities eliminated for polar plots?
+        elseif (isplot)
+          Z = feval (fun, X);
+          ## Eliminate the singularities
+          Z = __eliminate_sing__ (Z);
+          domain = find_valid_domain (X, [], Z);
+        elseif (iscontour)
+          Z = feval (fun, X, Y);
+          Z = __eliminate_sing__ (Z);
+        else  #  mesh, surf plots
+          Z = feval (fun, X, Y);
+          Z = __eliminate_sing__ (Z);
+          if (circ)
+            ## Use domain calculated at the start.
+            ## The X, Y grids are non-monotonic after conversion from polar
+            ## coordinates and find_valid_domain fails.
+
+          elseif (auto_domain && ! auto_domain_done)
+            valid_domain = find_valid_domain (X, Y, Z);
+            domain_ok = isequal (domain, valid_domain);
+            domain = valid_domain;
+            auto_domain_done = true;  # ensures only 1 round of do loop done
+          else
+            if (! auto_domain_done)
+              domain = find_valid_domain (X, Y, Z);
+            endif
+          endif
+        endif
+      endif
+    endif
+  until (domain_ok)
+
+  ## Now, actually call the correct plot function with valid data and domain.
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    if (iscontour)
+      [~, h] = feval (pltfunc, hax, X, Y, Z);
+    elseif (isplot && nargs == 2)
+      h = zeros (length (XX), 1);
+      hold_state = get (hax, "nextplot");
+      for i = 1 : length (XX)
+        h(i) = plot(hax, XX{i}, YY{i});
+        if (i == 1)
+          set (hax, "nextplot", "add");
+        endif
+      endfor
+      set (hax, "nextplot", hold_state);
+      axis (hax, domain);
+    elseif (isplot || ispolar)
+      h = feval (pltfunc, hax, X, Z);
+      if (isplot && ! parametric)
+        axis (hax, domain);
+      endif
+    elseif (isplot3)
+      if (animate)
+        ## draw animation, then replace with true plot3
+        comet3 (hax, X, Y, Z, .05);
+      endif
+      h = feval (pltfunc, hax, X, Y, Z);
+      set (hax, "box", "off");
+      grid (hax, "on");
+      zlabel (hax, "z");
+    else  # mesh and surf plots
+      h = feval (pltfunc, hax, X, Y, Z);
+      ## FIXME: surf, mesh should really do a better job of setting zlim
+      if (! parametric)
+        axis (hax, domain);
+      endif
+    endif
+    xlabel (hax, xarg);
+    ylabel (hax, yarg);
+    title (hax, fstr);
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+## Eliminate bad data (complex values, infinities, singularities)
+function x = __eliminate_sing__ (x)
+  if (iscomplex (x))
+    x(imag (x) != 0) = NaN;
+  endif
+  x(isinf (x)) = NaN;
+  ## High rates of curvature are treated as singularities
+  threshold = 0.2 * (max (x(:)) - min (x(:)));
+  x(abs (del2 (x)) > threshold) = NaN;
+endfunction
+
+## Find: 1) range of function where there are not NaN values,
+##       2) function is changing (not just flat surface)
+function domain = find_valid_domain (X, Y, Z);
+
+  if (isvector (Z))
+    ## 2-D data for isplot
+    domain = [X(1) X(end)];
+
+    ## Guess a range which includes the "mass" of the data by using a 
+    ## median-based approach.  The center 3/4 of the data is used to
+    ## determine the range of the data.
+    ## This seems to be vaguely what Matlab does, but can't be sure.
+    XX = sort (Z(isfinite (Z)));
+    if (length (X) > 4)
+      irlo = XX(fix (1/8 * length (XX)));
+      irhi = XX(fix (7/8 * length (XX)));
+      d = irhi - irlo;
+      domain(3) = max (XX(1) - d/8, irlo - d);
+      domain(4) = min (XX(end) + d/8, irhi + d);
+    else
+      domain(3:4) = [XX(1), XX(end)];
+    endif
+
+    #{
+    ## FIXME: Old algorithm for removing singularities
+    ## Deprecated in 3.8.  Can be removed if no problems appear in ezplot.
+    idx = 2 : length (Z);
+    idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) |
+                ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange(2) / 2)));
+    Z(idx) = NaN;
+    #}
+
+  else
+    ## 3-D data such as mesh, surf
+    Zfinite = ! isnan (Z); 
+    Zrows = any (Zfinite, 2); 
+    rmin = find (Zrows, 1, "first"); 
+    rmax = find (Zrows, 1, "last"); 
+    Zcols = any (Zfinite, 1); 
+    cmin = find (Zcols, 1, "first"); 
+    cmax = find (Zcols, 1, "last"); 
+
+    ## Handle nasty case of all NaNs 
+    if (isempty (rmin))
+      rmin = 1, rmax = rows (Z);
+    endif
+    if (isempty (cmin))
+      cmin = 1, cmax = columns (Z);
+    endif
+
+    if (   ! any (isnan (Z([rmin, rmax],:)(:)))
+        && ! any (isnan (Z(:, [cmin, cmax])(:))))
+      ## Exclude surfaces along borders which are flat (gradient =~ 0).
+      ## Technically, this calculation might be better done with actual
+      ## deltaX, deltaY values.  But, data is usually meshgridded
+      ## (constant spacing) so working with deltaROW#, deltaCOL# is fine.
+      [Zx, Zy] = gradient (Z(rmin:rmax, cmin:cmax));
+      Zgrad = sqrt (Zx.^2 + Zy.^2);
+      slope = ((max (Z(:)) - min (Z(:)))
+                / sqrt ((rmax - rmin)^2 + (cmax - cmin)^2));
+      slope /= 125;  # threshold for discarding points.
+      Zrows = any (Zgrad > slope, 2); 
+      rmin += find (Zrows, 1, "first") - 1; 
+      rmax += find (Zrows, 1, "last") - rows (Zrows); 
+      Zcols = any (Zgrad > slope, 1); 
+      cmin += find (Zcols, 1, "first") - 1; 
+      cmax += find (Zcols, 1, "last") - columns (Zcols); 
+    endif
+
+    domain = [X(1,cmin) X(1,cmax) Y(rmin,1) Y(rmax,1)];
+  endif
+  
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__interp_cube__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,185 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## Author: Martin Helm <martin@mhelm.de>
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
+## Undocumented internal function.
+## @end deftypefn
+
+function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" )
+  if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3
+       && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val))
+    x = squeeze (x(1,:,1))(:);
+    y = squeeze (y(:,1,1))(:);
+    z = squeeze (z(1,1,:))(:);
+  elseif (isvector (x) && isvector (y) && isvector (z))
+    x = x(:);
+    y = y(:);
+    z = z(:);
+  else
+    error ("__interp_cube__: X, Y, Z have wrong dimensions");
+  endif
+  if (size (val) != [length(x), length(y), length(z)])
+    error ("__interp_cube__: VAL has wrong dimensions");
+  endif
+  if (columns (v) != 3)
+    error ( "V has to be Nx3 matrix");
+  endif
+  ##if (!ischar (req))
+  ## error ('__interp_cube__: Invalid request parameter use "values", "normals" or "normals8"');
+  ##endif
+  if (isempty (v))
+    Vxyz = idx = frac = [];
+    return;
+  endif
+
+  switch (req)
+    case "normals"
+      [idx, frac] = cube_idx (x, y, z, v);
+
+      dx = x(2:end) - x(1:end-1);
+      dy = y(2:end) - y(1:end-1);
+      dz = z(2:end) - z(1:end-1);
+      dx = 0.5 .* [dx;dx(end)](idx(:,2));
+      dy = 0.5 .* [dy;dy(end)](idx(:,1));
+      dz = 0.5 .* [dz;dz(end)](idx(:,3));
+
+      p000 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) - dz];
+      p100 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) - dz];
+      p010 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) - dz];
+      p001 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) + dz];
+      p011 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) + dz];
+      p101 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) + dz];
+      p110 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) - dz];
+      p111 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) + dz];
+
+      v000 = interp_cube_trilin (x, y, z, val, p000);
+      v100 = interp_cube_trilin (x, y, z, val, p100);
+      v010 = interp_cube_trilin (x, y, z, val, p010);
+      v001 = interp_cube_trilin (x, y, z, val, p001);
+      v011 = interp_cube_trilin (x, y, z, val, p011);
+      v101 = interp_cube_trilin (x, y, z, val, p101);
+      v110 = interp_cube_trilin (x, y, z, val, p110);
+      v111 = interp_cube_trilin (x, y, z, val, p111);
+
+      Dx = -v000 .+ v100 .- v010 .- v001 .- v011 .+ v101 .+ v110 .+ v111;
+      Dy = -v000 .- v100 .+ v010 .- v001 .+ v011 .- v101 .+ v110 .+ v111;
+      Dz = -v000 .- v100 .- v010 .+ v001 .+ v011 .+ v101 .- v110 .+ v111;
+      Vxyz = 0.5 .* [Dx./dx, Dy./dy, Dz./dz];
+    case "normals8"
+      [idx, frac] = cube_idx (x, y, z, v);
+
+      dx = x(2:end) - x(1:end-1);
+      dy = y(2:end) - y(1:end-1);
+      dz = z(2:end) - z(1:end-1);
+      dx = [dx;dx(end)](idx(:,2));
+      dy = [dy;dy(end)](idx(:,1));
+      dz = [dz;dz(end)](idx(:,3));
+      [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v);
+      Vxyz = [Dx./dx, Dy./dy, Dz./dz];
+    case "values"
+      [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
+   otherwise
+     error ('__interp_cube__: Invalid request type "%s", use "values", "normals" or "normals8"', req);
+  endswitch
+endfunction
+
+function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v)
+  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
+  sval = size (val);
+  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
+  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
+  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
+  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
+  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
+  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
+  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
+  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
+  Bx = frac(:, 1);
+  By = frac(:, 2);
+  Bz = frac(:, 3);
+  Vxyz = ...
+    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i100 ) .* Bx .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i010 ) .* (1 .- Bx) .* By .* (1 .- Bz) .+ ...
+    val( i001 ) .* (1 .- Bx) .* (1 .- By) .* Bz .+ ...
+    val( i011 ) .* (1 .- Bx) .* By .* Bz .+ ...
+    val( i101 ) .* Bx .* (1 .- By) .* Bz .+ ...
+    val( i110 ) .* Bx .* By .* (1 .- Bz) .+ ...
+    val( i111 ) .* Bx .* By .* Bz;
+endfunction
+
+function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v)
+  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
+  sval = size (val);
+  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
+  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
+  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
+  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
+  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
+  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
+  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
+  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
+  Bx = frac(:, 1);
+  By = frac(:, 2);
+  Bz = frac(:, 3);
+  Dx = ...
+    val( i000 ) .* -1 .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i100 ) .* (1 .- By) .* (1 .- Bz) .+ ...
+    val( i010 ) .* -1 .* By .* (1 .- Bz) .+ ...
+    val( i001 ) .* -1 .* (1 .- By) .* Bz .+ ...
+    val( i011 ) .* -1 .* By .* Bz .+ ...
+    val( i101 ) .* (1 .- By) .* Bz .+ ...
+    val( i110 ) .* By .* (1 .- Bz) .+ ...
+    val( i111 ) .* By .* Bz;
+  Dy = ...
+    val( i000 ) .* (1 .- Bx) .* -1 .* (1 .- Bz) .+ ...
+    val( i100 ) .* Bx .* -1 .* (1 .- Bz) .+ ...
+    val( i010 ) .* (1 .- Bx) .* (1 .- Bz) .+ ...
+    val( i001 ) .* (1 .- Bx) .* -1 .* Bz .+ ...
+    val( i011 ) .* (1 .- Bx) .* Bz .+ ...
+    val( i101 ) .* Bx .* -1 .* Bz .+ ...
+    val( i110 ) .* Bx .* (1 .- Bz) .+ ...
+    val( i111 ) .* Bx .* Bz;
+  Dz = ...
+    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* -1 .+ ...
+    val( i100 ) .* Bx .* (1 .- By) .* -1 .+ ...
+    val( i010 ) .* (1 .- Bx) .* By .* -1 .+ ...
+    val( i001 ) .* (1 .- Bx) .* (1 .- By) .+ ...
+    val( i011 ) .* (1 .- Bx) .* By + ...
+    val( i101 ) .* Bx .* (1 .- By) .+ ...
+    val( i110 ) .* Bx .* By .* -1 .+ ...
+    val( i111 ) .* Bx .* By;
+endfunction
+
+function [idx, frac] = cube_idx (x, y, z, v)
+  idx = zeros (size (v));
+  frac = zeros (size (v));
+  idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1;
+  frac(:, 2) = (v(:, 1) - x(idx(:, 2)) )...
+      ./ (x(idx(:, 2)+1) - x(idx(:, 2)));
+  idx(:, 1) = lookup (y(2:end-1), v(:, 2)) + 1;
+  frac(:, 1) = (v(:, 2) - y(idx(:, 1))) ...
+      ./ (y(idx(:, 1)+1) - y(idx(:, 1)));
+  idx(:, 3) = lookup (z(2:end-1), v(:, 3)) + 1;
+  frac(:, 3) = (v(:, 3) - z(idx(:, 3))) ...
+      ./ (z(idx(:, 3)+1) - z(idx(:, 3)));
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__line__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,128 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __line__ (@var{p}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## __line__ (p, x, y, z)
+## Create line object from x, y, and z with parent p.
+## Return handle to line object.
+
+## Author: jwe
+
+function h = __line__ (p, varargin)
+
+  nvargs = numel (varargin);
+
+  if (nvargs > 1 && ! ischar (varargin{1}) && ! ischar (varargin{2}))
+    if (nvargs > 2 && ! ischar (varargin{3}))
+      num_data_args = 3;
+    else
+      num_data_args = 2;
+    endif
+  else
+    num_data_args = 0;
+  endif
+
+  if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args}))
+    n = 1:num_data_args;
+    m = cellfun (@numel, varargin(1:num_data_args));
+    [~, m] = max (m);
+    b = ones (size (varargin{m(1)}));
+    try
+      varargin(n) = cellfun (@(x) bsxfun (@times, b, x), varargin(n), "uniformoutput", false);
+    catch
+      error ("line: number of X, Y, and Z points must be equal");
+    end_try_catch
+  endif
+
+  if (rem (nvargs - num_data_args, 2) != 0)
+    error ("line: invalid number of PROPERTY / VALUE pairs");
+  endif
+
+  other_args = {};
+  if (nvargs > num_data_args)
+    other_args = varargin(num_data_args+1:end);
+  endif
+
+  nlines = 0;
+  nvecpts = 0;
+  ismat = false (1, 3);
+  for i = 1:num_data_args
+    tmp = varargin{i}(:,:);
+    if (isvector (tmp))
+      nlines = max (1, nlines);
+      if (! isscalar (tmp))
+        if (nvecpts == 0)
+          nvecpts = numel (tmp);
+        elseif (nvecpts != numel (tmp))
+          error ("line: data size mismatch");
+        endif
+      endif
+    else
+      ismat(i) = true;
+      nlines = max (columns (tmp), nlines);
+    endif
+    varargin{i} = tmp;
+  endfor
+
+  if (num_data_args == 0)
+    varargin = {[0, 1], [0, 1]};
+    num_data_args = 2;
+    nlines = 1;
+  endif
+
+  handles = zeros (nlines, 1);
+
+  data = cell (1, 3);
+
+  if (num_data_args > 1)
+    data(1:num_data_args) = varargin(1:num_data_args);
+    for i = 1:num_data_args
+      if (islogical (data{i}))
+        data(i) = double (data{i});
+      elseif (iscomplex (data{i}))
+        data(i) = real (data{i});
+      endif
+    endfor
+  endif
+
+  data_args = reshape ({"xdata", "ydata", "zdata"; data{:}}, [1, 6]);
+  mask = reshape ([false(1,3); ismat], [1, 6]);
+
+  for i = 1:nlines
+    tmp = data(ismat);
+    if (! size_equal (tmp)
+        || (nvecpts != 0 && any (nvecpts != cellfun ("size", tmp, 1))))
+      error ("line: data size_mismatch");
+    endif
+    data_args(mask) = cellfun (@(x) x(:,i), data(ismat),
+                               "uniformoutput", false);
+
+    handles(i) = __go_line__ (p, data_args{:}, other_args{:});
+
+  endfor
+
+  if (nargout > 0)
+    h = handles;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__marching_cube__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,531 @@
+## Copyright (C) 2009-2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+## Undocumented internal function.
+## @end deftypefn
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
+## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+##
+## Return the triangulation information @var{t} at points @var{p} for
+## the isosurface values resp. the volume data @var{val} and the iso
+## level @var{iso}.  It is considered that the volume data @var{val} is
+## given at the points @var{x}, @var{y} and @var{z} which are of type
+## three--dimensional numeric arrays.  The orientation of the triangles
+## is choosen such that the normals point from the higher values to the
+## lower values.
+##
+## Optionally the color data @var{col} can be passed to this function
+## whereas computed vertices color data @var{c} is returned as third
+## argument.
+##
+## The marching cube algorithm is well known and described, for example, at
+## Wikipedia.  The triangulation lookup table and the edge table used
+## here are based on Cory Gene Bloyd's implementation and can be found
+## beyond other surface and geometry stuff at Paul Bourke's website
+## @uref{http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise}.
+##
+## For example:
+##
+## @example
+## @group
+## N = 20;
+## lin = linspace (0, 2, N);
+## [x, y, z] = meshgrid (lin, lin, lin);
+##
+## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
+## [t, p] = __marching_cube__ (x, y, z, c, .5);
+##
+## figure ();
+## trimesh (t, p(:,1), p(:,2), p(:,3));
+## @end group
+## @end example
+##
+## Instead of the @command{trimesh} function the @command{patch}
+## function can be used to visualize the geometry.  For example:
+##
+## @example
+## @group
+## figure (); view (-38, 20);
+## pa = patch ("Faces", t, "Vertices", p, "FaceVertexCData", p, ...
+##             "FaceColor", "interp", "EdgeColor", "none");
+##
+## ## Revert normals
+## set (pa, "VertexNormals", -get (pa, "VertexNormals"));
+##
+## ## Set lightning (available with the JHandles package)
+## # set (pa, "FaceLighting", "gouraud");
+## # light ( "Position", [1 1 5]);
+## @end group
+## @end example
+##
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors)
+
+  persistent edge_table=[];
+  persistent tri_table=[];
+
+  calc_cols = false;
+  lindex = 4;
+
+  if (isempty (tri_table) || isempty (edge_table))
+    [edge_table, tri_table] = init_mc ();
+  endif
+
+  if ((nargin != 5 && nargin != 6) || (nargout != 2 && nargout != 3))
+    print_usage ();
+  endif
+
+  if (!ismatrix (xx) || !ismatrix (yy) || !ismatrix (zz) || !ismatrix (c) || ...
+    ndims (xx) != 3 || ndims (yy) != 3 || ndims (zz) != 3 || ndims (c) != 3)
+    error ("__marching_cube__: XX, YY, ZZ, C must be matrices of dim 3");
+  endif
+
+  if (!size_equal (xx, yy, zz, c))
+    error ("__marching_cube__: XX, YY, ZZ, C must be of equal size");
+  endif
+
+  if (any (size (xx) < [2 2 2]))
+    error ("__marching_cube__: grid size must be at least 2x2x2");
+  endif
+
+  if (!isscalar (iso))
+    error ("__marching_cube__: ISO must be scalar value");
+  endif
+
+  if (nargin == 6)
+    if ( !ismatrix (colors) || ndims (colors) != 3 || size (colors) != size (c) )
+      error ( "COLORS must be a matrix of dim 3 and of same size as C" );
+    endif
+    calc_cols = true;
+    lindex = 5;
+  endif
+
+  n = size (c) - 1;
+
+  ## phase I: assign information to each voxel which edges are intersected by
+  ## the isosurface
+  cc = zeros (n(1), n(2), n(3), "uint16");
+  cedge = zeros (size (cc), "uint16");
+
+  vertex_idx = {1:n(1), 1:n(2), 1:n(3); ...
+    2:n(1)+1, 1:n(2), 1:n(3); ...
+    2:n(1)+1, 2:n(2)+1, 1:n(3); ...
+    1:n(1), 2:n(2)+1, 1:n(3); ...
+    1:n(1), 1:n(2), 2:n(3)+1; ...
+    2:n(1)+1, 1:n(2), 2:n(3)+1; ...
+    2:n(1)+1, 2:n(2)+1, 2:n(3)+1; ...
+    1:n(1), 2:n(2)+1, 2:n(3)+1 };
+
+  ## calculate which vertices have values higher than iso
+  for ii=1:8
+    idx = c(vertex_idx{ii, :}) > iso;
+    cc(idx) = bitset (cc(idx), ii);
+  endfor
+
+  cedge = edge_table(cc+1); # assign the info about intersected edges
+  id =  find (cedge); # select only voxels which are intersected
+  if (isempty (id))
+    T = p = col = [];
+    return;
+  endif
+
+  ## phase II: calculate the list of intersection points
+  xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2;  2, 1, 2; 2, 2, 2; 1, 2, 2];
+  edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8];
+  offset = sub2ind (size (c), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) -1;
+  pp = zeros (length (id), lindex, 12);
+  ccedge = [vec(cedge(id)), id];
+  ix_offset=0;
+  for jj=1:12
+    id__ = bitget (ccedge(:, 1), jj);
+    id_ = ccedge(id__, 2);
+    [ix iy iz] = ind2sub (size (cc), id_);
+    id_c = sub2ind (size (c), ix, iy, iz);
+    id1 = id_c + offset(edges(jj, 1));
+    id2 = id_c + offset(edges(jj, 2));
+    if (calc_cols)
+      pp(id__, 1:5, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
+        xx(id2), yy(id2), zz(id2), c(id1), c(id2), colors(id1), colors(id2)), ...
+        (1:rows (id_))' + ix_offset ];
+    else
+      pp(id__, 1:4, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
+        xx(id2), yy(id2), zz(id2), c(id1), c(id2)), ...
+        (1:rows (id_))' + ix_offset ];
+    endif
+    ix_offset += rows (id_);
+  endfor
+
+  ## phase III: calculate the triangulation from the point list
+  T = [];
+  tri = tri_table(cc(id)+1, :);
+  for jj=1:3:15
+    id_ = find (tri(:, jj)>0);
+    p = [id_, lindex*ones(rows (id_), 1),tri(id_, jj:jj+2)];
+    if (!isempty (p))
+      p1 = sub2ind (size (pp), p(:,1), p(:,2), p(:,3));
+      p2 = sub2ind (size (pp), p(:,1), p(:,2), p(:,4));
+      p3 = sub2ind (size (pp), p(:,1), p(:,2), p(:,5));
+      T = [T; pp(p1), pp(p2), pp(p3)];
+    endif
+  endfor
+
+  p = [];
+  col = [];
+  for jj = 1:12
+    idp = pp(:, lindex, jj) > 0;
+    if (any (idp))
+      p(pp(idp, lindex, jj), 1:3) = pp(idp, 1:3, jj);
+      if (calc_cols)
+        col(pp(idp, lindex, jj),1) = pp(idp, 4, jj);
+      endif
+    endif
+  endfor
+endfunction
+
+function p = vertex_interp (isolevel,p1x, p1y, p1z,...
+  p2x, p2y, p2z,valp1,valp2, col1, col2)
+
+  if (nargin == 9)
+    p = zeros (length (p1x), 3);
+  elseif (nargin == 11)
+    p = zeros (length (p1x), 4);
+  else
+    error ("__marching_cube__: wrong number of arguments");
+  endif
+  mu = zeros (length (p1x), 1);
+  id = abs (valp1-valp2) < (10*eps) .* (abs (valp1) .+ abs (valp2));
+  if (any (id))
+    p(id, 1:3) = [ p1x(id), p1y(id), p1z(id) ];
+    if (nargin == 11)
+      p(id, 4) = col1(id);
+    endif
+  endif
+  nid = !id;
+  if (any (nid))
+    mu(nid) = (isolevel - valp1(nid)) ./ (valp2(nid) - valp1(nid));
+    p(nid, 1:3) = [p1x(nid) + mu(nid) .* (p2x(nid) - p1x(nid)), ...
+      p1y(nid) + mu(nid) .* (p2y(nid) - p1y(nid)), ...
+      p1z(nid) + mu(nid) .* (p2z(nid) - p1z(nid))];
+    if (nargin == 11)
+      p(nid, 4) = col1(nid) + mu(nid) .* (col2(nid) - col1(nid));
+    endif
+  endif
+endfunction
+
+function [edge_table, tri_table] = init_mc ()
+  edge_table = [
+  0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, ...
+  0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, ...
+  0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, ...
+  0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, ...
+  0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, ...
+  0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, ...
+  0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, ...
+  0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, ...
+  0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, ...
+  0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, ...
+  0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, ...
+  0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, ...
+  0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, ...
+  0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, ...
+  0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , ...
+  0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, ...
+  0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, ...
+  0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, ...
+  0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, ...
+  0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, ...
+  0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, ...
+  0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, ...
+  0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, ...
+  0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, ...
+  0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, ...
+  0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, ...
+  0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, ...
+  0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, ...
+  0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, ...
+  0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, ...
+  0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, ...
+  0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   ];
+
+  tri_table =[
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1;
+  3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1;
+  3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1;
+  3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1;
+  9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
+  2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1;
+  8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
+  4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1;
+  3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1;
+  1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1;
+  4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1;
+  4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
+  5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1;
+  2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1;
+  9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
+  0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
+  2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1;
+  10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1;
+  5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1;
+  5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1;
+  9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1;
+  1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1;
+  10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1;
+  8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1;
+  2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1;
+  7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1;
+  2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1;
+  11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1;
+  5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1;
+  11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1;
+  11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1;
+  9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1;
+  2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1;
+  6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1;
+  3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1;
+  6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
+  10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1;
+  6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1;
+  8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1;
+  7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1;
+  3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
+  5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1;
+  0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1;
+  9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1;
+  8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1;
+  5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1;
+  0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1;
+  6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1;
+  10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1;
+  10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1;
+  8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1;
+  1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1;
+  0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1;
+  10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1;
+  3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1;
+  6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1;
+  9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1;
+  8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1;
+  3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1;
+  6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1;
+  0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1;
+  10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1;
+  10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1;
+  2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1;
+  7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1;
+  7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1;
+  2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1;
+  1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1;
+  11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1;
+  8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1;
+  0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1;
+  7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
+  10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
+  2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
+  6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1;
+  7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1;
+  2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1;
+  1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1;
+  10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1;
+  10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1;
+  0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1;
+  7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1;
+  6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1;
+  8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1;
+  9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1;
+  6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1;
+  4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1;
+  10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1;
+  8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1;
+  0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1;
+  1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1;
+  8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1;
+  10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1;
+  4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1;
+  10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
+  5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
+  11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1;
+  9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
+  6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1;
+  7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1;
+  3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1;
+  7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1;
+  3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1;
+  6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1;
+  9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1;
+  1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1;
+  4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1;
+  7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1;
+  6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1;
+  3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1;
+  0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1;
+  6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1;
+  0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1;
+  11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1;
+  6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1;
+  5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1;
+  9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1;
+  1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1;
+  1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1;
+  10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1;
+  0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1;
+  5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1;
+  10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1;
+  11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1;
+  9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1;
+  7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1;
+  2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1;
+  8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1;
+  9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1;
+  9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1;
+  1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1;
+  9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1;
+  9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1;
+  5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1;
+  0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1;
+  10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1;
+  2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1;
+  0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1;
+  0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1;
+  9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1;
+  5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1;
+  3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1;
+  5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1;
+  8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1;
+  0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1;
+  9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1;
+  0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1;
+  1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1;
+  3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1;
+  4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1;
+  9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1;
+  11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1;
+  11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1;
+  2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1;
+  9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1;
+  3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1;
+  1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1;
+  4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1;
+  4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1;
+  0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1;
+  3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1;
+  3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1;
+  0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1;
+  9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1;
+  1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ] + 1;
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__patch__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,370 @@
+## Copyright (C) 2007-2012 John W. Eaton, Shai Ayal, Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+## __patch__ (p, x, y, c)
+## Create patch object from x and y with color c and parent p.
+## Return handle to patch object.
+
+## Author: Kai Habel
+
+function [h, failed] = __patch__ (p, varargin)
+
+  h = NaN;
+  failed = false;
+
+  is_numeric_arg = cellfun (@isnumeric, varargin);
+
+  if (isempty (varargin))
+    args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]};
+    args = setvertexdata (args);
+  elseif (isstruct (varargin{1}))
+    if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
+      args{1} = "faces";
+      args{2} = getfield (varargin{1}, "faces");
+      args{3} = "vertices";
+      args{4} = getfield (varargin{1}, "vertices");
+      args{5} = "facevertexcdata";
+      if (isfield (varargin{1}, "facevertexcdata"))
+        args{6} = getfield (varargin{1}, "facevertexcdata");
+      else
+        args{6} = [];
+      endif
+      args = [args; varargin(2:end)];
+      args = setdata (args);
+    else
+      failed = true;
+    endif
+  elseif (is_numeric_arg(1))
+    if (nargin < 3 || ! is_numeric_arg(2))
+      failed = true;
+    else
+
+      if (nargin > 4 && all (is_numeric_arg(1:4)))
+        x = varargin{1};
+        y = varargin{2};
+        z = varargin{3};
+        c = varargin{4};
+        iarg = 5;
+      elseif (nargin > 3 && all (is_numeric_arg(1:3)))
+        x = varargin{1};
+        y = varargin{2};
+        iarg = 4;
+        if (rem (nargin - iarg, 2) == 1)
+          c = varargin {iarg};
+          z = varargin{3};
+          iarg = 5;
+        else
+          z = [];
+          c = varargin{3};
+        endif
+      elseif (nargin > 2 && all (is_numeric_arg(1:2)))
+        x = varargin{1};
+        y = varargin{2};
+        z = [];
+        iarg = 3;
+        if (rem (nargin - iarg, 2) == 1)
+          c = varargin {iarg};
+          iarg++; 
+        else
+          c = [];
+        endif
+      endif
+
+      if (isvector (x))
+        x = x(:);
+        y = y(:);
+        z = z(:);
+        if (isnumeric (c))
+          if (isvector (c) && numel (c) == numel (x))
+            c = c(:);
+          elseif (rows (c) != numel (x) && columns (c) == numel (x))
+            c = c.';
+          endif
+        endif
+      endif
+      args{1} = "xdata";
+      args{2} = x;
+      args{3} = "ydata";
+      args{4} = y;
+      args{5} = "zdata";
+      args{6} = z;
+
+      if (isnumeric (c))
+
+        if (ndims (c) == 3 && columns (c) == 1)
+          c = permute (c, [1, 3, 2]);
+        endif
+
+        if (isvector (c) && numel (c) == columns (x))
+          if (isnan (c))
+            args{7} = "facecolor";
+            args{8} = [1, 1, 1];
+            args{9} = "cdata";
+            args{10} = c;
+          elseif (isnumeric (c))
+            args{7} = "facecolor";
+            args{8} = "flat";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: color value not valid");
+          endif
+        elseif (isvector (c) && numel (c) == 3)
+          args{7} = "facecolor";
+          args{8} = c;
+          args{9} = "cdata";
+          args{10} = [];
+        elseif (ndims (c) == 3 && size (c, 3) == 3)
+          ## CDATA is specified as RGB data
+          if ((rows (c) == 1 && columns (c) == 1) ...
+              || (rows (c) == 1 && columns (c) == columns (x)))
+            ## Single patch color or per-face color
+            args{7} = "facecolor";
+            args{8} = "flat";
+            args{9} = "cdata";
+            args{10} = c;
+          elseif (rows (c) == rows (x) && columns (c) == columns (x))
+            ## Per-vertex color
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: color value not valid");
+          endif
+        else
+          ## Color Vectors
+          if (isempty (c))
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = [];
+          elseif (isequal (size (c), size (x)) && isequal (size (c), size (y)))
+            args{7} = "facecolor";
+            args{8} = "interp";
+            args{9} = "cdata";
+            args{10} = c;
+          else
+            error ("patch: size of x, y, and c must be equal");
+          endif
+        endif
+      elseif (ischar (c) && rem (nargin - iarg, 2) == 0)
+        ## Assume that any additional argument over an even number is
+        ## color string.
+        args{7} = "facecolor";
+        args{8} =  tolower (c);
+        args{9} = "cdata";
+        args{10} = [];
+      else
+        args{7} = "facecolor";
+        args{8} = [0, 1, 0];
+        args{9} = "cdata";
+        args{10} = [];
+      endif
+
+      args = [args, varargin(iarg:end)];
+      args = setvertexdata (args);
+    endif
+  else
+    args = varargin;
+    if (any (strcmpi (args, "faces") | strcmpi (args, "vertices")))
+      args = setdata (args);
+    else
+      args = setvertexdata (args);
+    endif
+  endif
+
+  if (!failed)
+    h = __go_patch__ (p, args {:});
+
+    ## Setup listener functions
+    addlistener (h, "xdata", @update_data);
+    addlistener (h, "ydata", @update_data);
+    addlistener (h, "zdata", @update_data);
+    addlistener (h, "cdata", @update_data);
+
+    addlistener (h, "faces", @update_fvc);
+    addlistener (h, "vertices", @update_fvc);
+    addlistener (h, "facevertexcdata", @update_fvc);
+  endif
+endfunction
+
+function args = delfields (args, flds)
+  idx = cellfun ("isclass", args, "char");
+  idx(idx) = ismember (args(idx), flds);
+  if (rows (idx) == 1)
+    idx |= [false, idx(1:end-1)];
+  else
+    idx |= [false; idx(1:end-1)];
+  endif
+  args(idx) = [];
+endfunction
+
+function args = setdata (args)
+  args = delfields (args, {"xdata", "ydata", "zdata", "cdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
+  nargs = length (args);
+  idx = find (strcmpi (args, "faces"), 1, "last") + 1;
+  if (idx > nargs)
+    faces = [];
+  else
+    faces = args {idx};
+  endif
+  idx = find (strcmpi (args, "vertices"), 1, "last") + 1;
+  if (idx > nargs)
+    vert = [];
+  else
+    vert = args {idx};
+  endif
+  idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    fvc = [];
+  else
+    fvc = args {idx};
+  endif
+  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    if (!isempty (fvc))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  endif
+
+  nc = rows (faces);
+  idx = faces .';
+  t1 = isnan (idx);
+  for i = find (any (t1))
+    first_idx_in_column = find (t1(:,i), 1);
+    idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i);
+  endfor
+  x = reshape (vert(:,1)(idx), size (idx));
+  y = reshape (vert(:,2)(idx), size (idx));
+  if (columns (vert) > 2)
+    z = reshape (vert(:,3)(idx), size (idx));
+  else
+    z = [];
+  endif
+
+  if (rows (fvc) == nc || rows (fvc) == 1)
+    c = reshape (fvc, [1, size(fvc)]);
+  else
+    if (columns (fvc) == 3)
+      c = cat (3, reshape (fvc(idx, 1), size (idx)),
+               reshape (fvc(idx, 2), size (idx)),
+               reshape (fvc(idx, 3), size (idx)));
+    elseif (isempty (fvc))
+      c = [];
+    else ## if (columnns (fvc) == 1)
+      c = permute (fvc(faces), [2, 1]);
+    endif
+  endif
+  args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}};
+endfunction
+
+function args = setvertexdata (args)
+  args = delfields (args, {"vertices", "faces", "facevertexcdata"});
+  ## Remove the readonly fields as well
+  args = delfields (args, {"type", "uicontextmenu"});
+  nargs = length (args);
+  idx = find (strcmpi (args, "xdata"), 1, "last") + 1;
+  if (idx > nargs)
+    x = [];
+  else
+    x = args {idx};
+  endif
+  idx = find (strcmpi (args, "ydata"), 1, "last") + 1;
+  if (idx > nargs)
+    y = [];
+  else
+    y = args {idx};
+  endif
+  idx = find (strcmpi (args, "zdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    z = [];
+  else
+    z = args {idx};
+  endif
+  idx = find (strcmpi (args, "cdata"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    c = [];
+  else
+    c = args {idx};
+  endif
+  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
+  if (isempty (idx) || idx > nargs)
+    if (!isempty (c))
+      fc = "flat";
+    else
+      fc = [0, 1, 0];
+    endif
+    args = {"facecolor", fc, args{:}};
+  endif
+
+  [nr, nc] = size (x);
+  if (nr == 1 && nc > 1)
+    nr = nc;
+    nc = 1;
+  endif
+  if (!isempty (z))
+    vert = [x(:), y(:), z(:)];
+  else
+    vert = [x(:), y(:)];
+  endif
+  faces = reshape (1:numel (x), nr, nc);
+  faces = faces';
+
+  if (ndims (c) == 3)
+    fvc = reshape (c, rows (c) * columns (c), size (c, 3));
+  else
+    fvc = c(:);
+  endif
+
+  args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};
+endfunction
+
+function update_data (h, d)
+  update_handle (h, false);
+endfunction
+
+function update_fvc (h, d)
+  update_handle (h, true);
+endfunction
+
+function update_handle (h, isfv)
+  persistent recursive = false;
+
+  if (! recursive)
+    recursive = true;
+    f = get (h);
+    if (isfv)
+      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+    else
+      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
+    endif
+    recursive = false;
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__pie__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,201 @@
+## Copyright (C) 2007-2012 David Bateman
+## Copyright (C) 2010 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hlist} =} __pie__ (caller, @dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hlist = __pie__ (caller, varargin)
+
+  h = varargin{1};
+  x = abs (varargin{2});
+  iarg = 3;
+
+  if (! isvector (x))
+    error ("%s: expecting vector argument", caller);
+  endif
+
+  len = length (x);
+
+  have_explode = false;
+  have_labels = false;
+
+  while (iarg <= nargin - 1)
+    arg = varargin{iarg++};
+    if (iscell (arg))
+      labels = arg;
+      have_labels = true;
+      if (numel (x) != numel (labels))
+        error ("%s: mismatch in number of labels and data", caller);
+      endif
+    elseif (isnumeric (arg) || islogical (arg))
+      explode = arg;
+      have_explode = true;
+      if (! size_equal (x, explode))
+        error ("%s: mismatch in number of elements in explode and data",
+               caller);
+      endif
+    else
+      error ("%s: %s is invalid as an optional argument", caller, class (arg));
+    endif
+  endwhile
+
+  if (! have_explode)
+    explode = zeros (size (x));
+  endif
+
+  normalize = true;
+  if (sum (x(:)) < 1)
+    normalize = false;
+  endif
+
+  if (! have_labels)
+    if (normalize)
+      xp = round (100 * x ./ sum (x));
+    else
+      xp = round (100 * x);
+    endif
+    for i = 1:len
+      labels{i} = sprintf ("%d%%", xp(i));
+    endfor
+  endif
+
+  hlist = [];
+  refinement = 90;
+  phi = 0:refinement:360;
+  if (normalize)
+    xphi = cumsum (x / sum (x) * 360);
+  else
+    xphi = cumsum (x * 360);
+  endif
+
+  for i = 1:len
+    if (i == 1)
+      xn = 0 : 360 / refinement : xphi(i);
+    else
+      xn = xphi(i-1) : 360 / refinement : xphi(i);
+    endif
+
+    if (xn(end) != xphi(i))
+      xn = [xn, xphi(i)];
+    endif
+
+    xn2 = (xn(1) + xn(end)) / 2;
+    if (explode (i))
+      xoff = - 0.1 * sind (xn2);
+      yoff = 0.1 * cosd (xn2);
+    else
+      xoff = 0;
+      yoff = 0;
+    endif
+    xt = - 1.2 * sind (xn2);
+    yt = 1.2 * cosd (xn2);
+
+    if (len == 1)
+      set (h, "clim", [1, 2]);
+    else
+      set (h, "clim", [1, len]);
+    endif
+
+    if (strcmp (caller, "pie3"))
+      ln = length (xn);
+      zlvl = 0.35;
+      sx = repmat (xoff + [0, -sind(xn), 0], [2, 1]);
+      sy = repmat (yoff + [0, cosd(xn), 0], [2, 1]);
+      sz = [zeros(1, ln + 2); zlvl * ones(1, ln + 2)];
+      sc = i * ones (size (sz));
+
+      hlist = [hlist;
+        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i);
+        surface(sx, sy, sz, sc);
+        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i);
+        text(xt, yt, zlvl, labels{i})];
+
+    elseif (strcmp (caller, "pie"))
+      if (xt > 0)
+        align = "left";
+      else
+        align = "right";
+      endif
+
+      hlist = [hlist; patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], i);
+               text(xt, yt, labels{i}, "horizontalalignment", align)];
+
+    else
+      error ("__pie__: unknown caller '%s'", caller);
+    endif
+  endfor
+
+  addlistener (gca, "view", {@update_text_pos, hlist});
+
+  if (strcmp (caller, "pie3"))
+    axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off");
+    view (-37.5, 30);
+  elseif (strcmp (caller, "pie"))
+    axis ([-1.5, 1.5, -1.5, 1.5], "square", "off");
+  endif
+endfunction
+
+function update_text_pos (all_handles)
+  ## Text objects in the foreground should be at the base level.
+  ## Text objects in the background should be at the top level.
+  ## Text objects on the right side should be aligned to the right
+  ## and on the left side to the left.
+  tobj = findobj (all_handles, "type", "text");
+
+  ## check if we are called from pie3
+  s = findobj (all_handles, "type", "surface");
+  is_pie3 = false;
+  if (length (s) > 0)
+    is_pie3 = true;
+  endif
+
+  if (length (tobj) > 0)
+    ax = get (tobj(1), "parent");
+    azel = get (ax, "view");
+    pos = get (tobj, "position");
+    if (iscell (pos))
+      pos = cell2mat (pos);
+    endif
+    phi = atand (pos(:,1) ./ pos(:,2));
+    [theta, r] = cart2pol (pos(:,1), pos(:,2));
+    theta *= 180/pi;
+    theta -= azel(1);
+    theta = mod (theta, 360);
+    ud_mask = (theta > 180);
+    lr_mask = (theta > 90) & (theta < 270);
+    for i = 1 : length (tobj)
+      if (is_pie3)
+        if (ud_mask(i))
+          set (tobj(i), "position", [pos(i,1), pos(i,2), -0.05]);
+        else
+          set (tobj(i), "position", [pos(i,1), pos(i,2), 0.40]);
+        endif
+      endif
+
+      if (lr_mask(i))
+        set (tobj(i), "horizontalalignment", "right");
+      else
+        set (tobj(i), "horizontalalignment", "left");
+      endif
+    endfor
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__plt__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,502 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __plt__ (@var{caller}, @var{h}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = __plt__ (caller, h, varargin)
+
+  persistent warned_callers = {};
+  nargs = nargin - 2;
+
+  if (nargs > 0)
+
+    k = 1;
+
+    x_set = false;
+    y_set = false;
+    property_set = false;
+    properties = {};
+
+    hlegend = [];
+    fkids = get (gcf (), "children");
+    for i = 1 : numel (fkids)
+      if (   strcmp (get (fkids(i), "type"), "axes")
+          && strcmp (get (fkids(i), "tag"), "legend"))
+        udata = get (fkids(i), "userdata");
+        if (! isempty (intersect (udata.handle, gca ())))
+          hlegend = fkids(i);
+          break;
+        endif
+      endif
+    endfor
+
+    setlgnd = false;
+    if (isempty (hlegend))
+      hlgnd = [];
+      tlgnd = {};
+    else
+      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
+    endif
+
+    ## Gather arguments, decode format, gather plot strings, and plot lines.
+
+    retval = [];
+
+    while (nargs > 0 || x_set)
+
+      if (nargs == 0)
+        ## Force the last plot when input variables run out.
+        next_cell = {};
+        next_arg = {""};
+      else
+        next_cell = varargin(k);
+        next_arg = varargin{k++};
+      endif
+
+      if (isnumeric (next_arg) && ndims (next_arg) > 2
+          && any (size (next_arg) == 1))
+        next_arg = squeeze (next_arg);
+        if (! any (strcmp (caller, warned_callers)) && ndims (next_arg) < 3)
+          warning (["%s: N-d inputs have been squeezed to less than " ...
+                    "three dimensions"], caller)
+          warned_callers(end+1) = caller;
+        endif
+      endif
+      if (isnumeric (next_arg) && ndims (next_arg) > 2)
+        error ("%s: plot arrays must have less than 2 dimensions", caller)
+      endif
+
+      nargs--;
+
+      if (ischar (next_arg) || iscellstr (next_arg))
+        if (x_set)
+          [options, valid] = __pltopt__ (caller, next_arg, false);
+          if (! valid)
+            if (nargs == 0)
+              error ("%s: properties must appear followed by a value", caller);
+            endif
+            properties = [properties, [next_cell, varargin(k++)]];
+            nargs--;
+            continue;
+          else
+            while (nargs > 0 && ischar (varargin{k}))
+              if (nargs < 2)
+                error ("%s: properties must appear followed by a value",
+                       caller);
+              endif
+              properties = [properties, varargin(k:k+1)];
+              k += 2;
+              nargs -= 2;
+            endwhile
+          endif
+          if (y_set)
+            tmp = __plt2__ (h, x, y, options, properties);
+            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+            properties = {};
+            retval = [retval; tmp];
+          else
+            tmp = __plt1__ (h, x, options, properties);
+            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+            properties = {};
+            retval = [retval; tmp];
+          endif
+          x_set = false;
+          y_set = false;
+        else
+          error ("plot: no data to plot");
+        endif
+      elseif (x_set)
+        if (y_set)
+          options = __pltopt__ (caller, {""});
+          tmp = __plt2__ (h, x, y, options, properties);
+          [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
+          retval = [retval; tmp];
+          x = next_arg;
+          y_set = false;
+          properties = {};
+        else
+          y = next_arg;
+          y_set = true;
+        endif
+      else
+        x = next_arg;
+        x_set = true;
+      endif
+
+    endwhile
+
+    if (setlgnd)
+      legend (gca (), hlgnd, tlgnd);
+    endif
+  else
+    error ("__plt__: invalid number of arguments");
+  endif
+
+endfunction
+
+function [hlgnd, tlgnd, setlgnd] = __plt_key__ (h, options, hlgnd, tlgnd, setlgnd)
+  n = numel (h);
+  if (numel (options) == 1)
+    options = repmat (options(:), n, 1);
+  endif
+
+  for i = 1 : n
+    key = options(i).key;
+    if (! isempty (key))
+      hlgnd = [hlgnd(:); h(i)];
+      tlgnd = {tlgnd{:}, key};
+      setlgnd = true;
+    endif
+  endfor
+endfunction
+
+function retval = __plt1__ (h, x1, options, properties = {})
+
+  if (nargin < 3 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (! isstruct (options))
+    error ("__plt1__: options must be a struct array");
+  endif
+
+  [nr, nc] = size (x1);
+  if (nr == 1)
+    x1 = x1.';
+    [nr, nc] = deal (nc, nr);   # Swap rows and columns
+  endif
+  if (iscomplex (x1))
+    x1_i = imag (x1);
+    if (any ((x1_i(:))))
+      x2 = x1_i;
+      x1 = real (x1);
+    else
+      x2 = x1;
+      x1 = (1:nr)';
+    endif
+  else
+    x2 = x1;
+    x1 = (1:nr)';
+  endif
+
+  retval = __plt2__ (h, x1, x2, options, properties);
+
+endfunction
+
+function retval = __plt2__ (h, x1, x2, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (! isstruct (options))
+    error ("__plt2__: options must be a struct array");
+  endif
+
+  if (islogical (x1))
+    x1 = int8 (x1);
+  elseif (iscomplex ((x1)))
+    x1 = real (x1);
+  endif
+
+  if (islogical (x2))
+    x2 = int8 (x2);
+  elseif (iscomplex (x2))
+    x2 = real (x2);
+  endif
+
+  h_set = false;
+  if (isempty (x1) && isempty (x2))
+    retval = zeros (0, 1);
+  elseif (isscalar (x1))
+    if (isscalar (x2))
+      retval = __plt2ss__ (h, x1, x2, options, properties);
+    elseif (isvector (x2))
+      retval = __plt2sv__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  elseif (isvector (x1))
+    if (isscalar (x2))
+      retval = __plt2vs__ (h, x1, x2, options, properties);
+    elseif (isvector (x2))
+      retval = __plt2vv__ (h, x1, x2, options, properties);
+    elseif (ismatrix (x2))
+      retval = __plt2vm__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  elseif (ismatrix (x1))
+    if (isvector (x2))
+      retval = __plt2mv__ (h, x1, x2, options, properties);
+    elseif (ismatrix (x2))
+      retval = __plt2mm__ (h, x1, x2, options, properties);
+    else
+      error ("__plt2__: invalid data for plotting");
+    endif
+  else
+    error ("__plt2__: invalid data for plotting");
+  endif
+
+endfunction
+
+function retval = __plt2mm__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  [x_nr, x_nc] = size (x);
+  [y_nr, y_nc] = size (y);
+
+  if (x_nr != y_nr && x_nc != y_nc)
+    error ("__plt2mm__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), x_nc, 1);
+  endif
+  retval = zeros (x_nc, 1);
+  for i = 1:x_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(:,i), y(:,i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2mv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  y = y(:);
+  [y_nr, y_nc] = size (y);
+  [x_nr, x_nc] = size (x);
+
+  if (x_nr == y_nr)
+    ## Correctly oriented.  Do nothing.
+  elseif (x_nc == y_nr)
+    x = x.';
+    [x_nr, x_nc] = deal (x_nc, x_nr);
+  else
+    error ("__plt2mv__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), x_nc, 1);
+  endif
+  retval = zeros (x_nc, 1);
+  for i = 1:x_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(:,i), y, "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2ss__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (numel (options) > 1)
+    options = options(1);
+  endif
+
+  linestyle = options.linestyle;
+  marker = options.marker;
+  if (isempty (marker) && isempty (linestyle))
+    ## If unspecified, marker for a single point is always "."
+    linestyle = "-";
+    marker = ".";
+  endif
+  color = options.color;
+  if (isempty (color))
+    color = __next_line_color__ ();
+  endif
+
+  retval = line (x, y, "color", color,
+                 "linestyle", linestyle,
+                 "marker", marker, properties{:});
+
+endfunction
+
+function retval = __plt2sv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  len = numel (y);
+  if (numel (options) == 1)
+    options = repmat (options(:), len, 1);
+  endif
+  retval = zeros (len, 1);
+  for i = 1:len
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      ## If unspecified, marker for a point is always "."
+      linestyle = "-";
+      marker = ".";
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x, y(i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vm__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  x = x(:);
+  [x_nr, x_nc] = size (x);
+  [y_nr, y_nc] = size (y);
+
+  if (x_nr == y_nr)
+    ## Correctly oriented.  Do nothing.
+  elseif (x_nr == y_nc)
+    y = y.';
+    [y_nr, y_nc] = deal (y_nc, y_nr);
+  else
+    error ("__plt2vm__: matrix dimensions must match");
+  endif
+
+  if (numel (options) == 1)
+    options = repmat (options(:), y_nc, 1);
+  endif
+  retval = zeros (y_nc, 1);
+  for i = 1:y_nc
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      [linestyle, marker] = __next_line_style__ ();
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x, y(:,i), "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vs__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  len = numel (x);
+  if (numel (options) == 1)
+    options = repmat (options(:), len, 1);
+  endif
+  retval = zeros (len, 1);
+  for i = 1:len
+    linestyle = options(i).linestyle;
+    marker = options(i).marker;
+    if (isempty (marker) && isempty (linestyle))
+      ## If unspecified, marker for a point is always "."
+      linestyle = "-";
+      marker = ".";
+    endif
+    color = options(i).color;
+    if (isempty (color))
+      color = __next_line_color__ ();
+    endif
+
+    retval(i) = line (x(i), y, "color", color,
+                      "linestyle", linestyle,
+                      "marker", marker, properties{:});
+  endfor
+
+endfunction
+
+function retval = __plt2vv__ (h, x, y, options, properties = {})
+
+  if (nargin < 4 || isempty (options))
+    options = __default_plot_options__ ();
+  endif
+
+  if (numel (options) > 1)
+    options = options(1);
+  endif
+
+  x = x(:);
+  y = y(:);
+
+  if (length (x) != length (y))
+    error ("__plt2vv__: vector lengths must match");
+  endif
+
+  linestyle = options.linestyle;
+  marker = options.marker;
+  if (isempty (marker) && isempty (linestyle))
+    [linestyle, marker] = __next_line_style__ ();
+  endif
+  color = options.color;
+  if (isempty (color))
+    color = __next_line_color__ ();
+  endif
+
+  retval = line (x, y, "color", color,
+                 "linestyle", linestyle,
+                 "marker", marker, properties{:});
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__quiver__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,448 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hg} =} __quiver__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hg = __quiver__ (varargin)
+
+  h = varargin{1};
+  is3d = varargin{2};
+
+  autoscale = 0.9;
+  arrowsize = 0.2;
+
+  firstnonnumeric = Inf;
+  for i = 3:nargin
+    if (! isnumeric (varargin{i}))
+      firstnonnumeric = i;
+      break;
+    endif
+  endfor
+
+  ioff = 3;
+  if (nargin < (6 + is3d) || firstnonnumeric < (6 + is3d))
+    u = varargin{ioff++};
+    v = varargin{ioff++};
+    if (is3d)
+      w = varargin{ioff++};
+      [x, y, z] = meshgrid (1:columns (u), 1:rows (u), 1:max (size (w)));
+    else
+      [x, y] = meshgrid (1:columns (u), 1:rows (u));
+    endif
+    if (nargin >= ioff && isnumeric (varargin{ioff})
+        && isscalar (varargin{ioff}))
+      autoscale = varargin{ioff++};
+    endif
+  else
+    x = varargin{ioff++};
+    y = varargin{ioff++};
+    if (is3d)
+      z = varargin{ioff++};
+    endif
+    u = varargin{ioff++};
+    v = varargin{ioff++};
+    if (is3d)
+      w = varargin{ioff++};
+      if (isvector (x) && isvector (y) && isvector (z)
+          && (! isvector (u) || ! isvector (v) || ! isvector (w)))
+        [x, y, z] = meshgrid (x, y, z);
+      endif
+    else
+      if (isvector (x) && isvector (y) && (! isvector (u) || ! isvector (v)))
+        [x, y] = meshgrid (x, y);
+      endif
+    endif
+    if (nargin >= ioff && isnumeric (varargin{ioff})
+        && isscalar (varargin{ioff}))
+      autoscale = varargin{ioff++};
+    endif
+  endif
+
+  have_filled = false;
+  have_line_spec = false;
+  args = {};
+  while (ioff <= nargin)
+    arg = varargin{ioff++};
+    if (ischar (arg) && strcmpi (arg, "filled"))
+      have_filled = true;
+    elseif ((ischar (arg) || iscellstr (arg))
+            && ! have_line_spec)
+      [linespec, valid] = __pltopt__ ("quiver", arg, false);
+      if (valid)
+        have_line_spec = true;
+        if (strcmp (linespec.linestyle, "none"))
+          linespec.linestyle = "-";
+        endif
+      else
+        args {end + 1} = arg;
+        if (ioff <= nargin)
+          args {end + 1} = varargin{ioff++};
+        endif
+      endif
+    else
+      args {end + 1} = arg;
+      if (ioff <= nargin)
+        args {end + 1} = varargin{ioff++};
+      endif
+    endif
+  endwhile
+
+  if (autoscale && numel (u) > 1)
+    ## Scale the arrows to fit in the grid
+    if (isvector (x))
+      ny = nx = length (x);
+    else
+      [nx, ny] = size (x);
+    endif
+    dx = (max (x(:)) - min (x(:))) ./ nx;
+    dy = (max (y(:)) - min (y(:))) ./ ny;
+    if (is3d)
+      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
+      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
+    else
+      dz = 0;
+      len = max (sqrt (u(:).^2 + v(:).^2));
+    endif
+    if (len > 0)
+      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
+      if (sd != 0)
+        s = sqrt (2) * autoscale * sd;
+      else # special case of identical points with multiple vectors
+        s = autoscale;
+      endif
+      uu = s * u;
+      vv = s * v;
+      if (is3d)
+        ww = s*w;
+      endif
+    endif
+  else
+    uu = u;
+    vv = v;
+    if (is3d)
+      ww = w;
+    endif
+  endif
+
+  hstate = get (h, "nextplot");
+  unwind_protect
+    hg = hggroup ();
+    if (is3d)
+      args = __add_datasource__ ("quiver3", hg,
+                                 {"x", "y", "z", "u", "v", "w"}, args{:});
+    else
+      args = __add_datasource__ ("quiver", hg,
+                                 {"x", "y", "z", "u", "v", "w"}, args{:});
+    endif
+    hold on;
+
+    addproperty ("xdata", hg, "data", x);
+    addproperty ("ydata", hg, "data", y);
+
+    addproperty ("udata", hg, "data", u);
+    addproperty ("vdata", hg, "data", v);
+    if (is3d)
+      addproperty ("zdata", hg, "data", z);
+      addproperty ("wdata", hg, "data", w);
+    else
+      addproperty ("zdata", hg, "data", []);
+      addproperty ("wdata", hg, "data", []);
+    endif
+
+    addlistener (hg, "xdata", @update_data);
+    addlistener (hg, "ydata", @update_data);
+    addlistener (hg, "zdata", @update_data);
+    addlistener (hg, "udata", @update_data);
+    addlistener (hg, "vdata", @update_data);
+    addlistener (hg, "wdata", @update_data);
+
+    x = x(:);
+    y = y(:);
+    xend = x + uu(:);
+    yend = y + vv(:);
+    if (is3d)
+      z = z(:);
+      zend = z + ww(:);
+    endif
+
+    if (have_line_spec)
+      if (is3d)
+        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
+                    [y.'; yend.'; NaN(1, length (y))](:),
+                    [z.'; zend.'; NaN(1, length (z))](:),
+                    "linestyle", linespec.linestyle,
+                    "color", linespec.color, "parent", hg);
+      else
+        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
+                   [y.'; yend.'; NaN(1, length (y))](:),
+                   "linestyle", linespec.linestyle,
+                    "color", linespec.color, "parent", hg);
+      endif
+    else
+      if (is3d)
+        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
+                    [y.'; yend.'; NaN(1, length (y))](:),
+                    [z.'; zend.'; NaN(1, length (z))](:),
+                    "color", "black", "parent", hg);
+      else
+        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
+                   [y.'; yend.'; NaN(1, length (y))](:),
+                   "parent", hg);
+      endif
+    endif
+
+    xtmp = x + uu(:) .* (1 - arrowsize);
+    ytmp = y + vv(:) .* (1 - arrowsize);
+
+    if (is3d)
+      xarrw1 = xtmp + sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
+      xarrw2 = xtmp - sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
+      yarrw1 = ytmp - sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
+      yarrw2 = ytmp + sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
+
+      zarrw1 = zarrw2 = zend - ww(:) * arrowsize;
+    else
+      xarrw1 = xtmp + (y - yend) * arrowsize / 3;
+      xarrw2 = xtmp - (y - yend) * arrowsize / 3;
+      yarrw1 = ytmp - (x - xend) * arrowsize / 3;
+      yarrw2 = ytmp + (x - xend) * arrowsize / 3;
+    endif
+
+    if (have_line_spec)
+      if (isfield (linespec, "marker")
+          && ! strcmp (linespec.marker, "none"))
+        if (is3d)
+          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                      "linestyle", "none", "parent", hg);
+        else
+          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                     "linestyle", "none", "parent", hg);
+        endif
+      else
+        if (is3d)
+          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                      "linestyle", linespec.linestyle,
+                      "color", linespec.color, "parent", hg);
+        else
+          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                     "linestyle", linespec.linestyle,
+                      "color", linespec.color, "parent", hg);
+        endif
+      endif
+    elseif (is3d)
+      h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                  [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                  [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
+                  "color", "black", "parent", hg);
+    else
+      h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
+                 [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
+                 "parent", hg);
+    endif
+
+    if (! have_line_spec
+        || (isfield (linespec, "marker")
+            && strcmp (linespec.marker, "none")))
+      if (is3d)
+        h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none",
+                    "parent", hg);
+      else
+        h3 = plot (x, y, "linestyle", "none", "marker", "none", "parent", hg);
+      endif
+    else
+      if (is3d)
+        h3 = plot3 (x, y, z, "linestyle", "none", "marker", linespec.marker,
+                    "parent", hg);
+      else
+
+        h3 = plot (x, y, "linestyle", "none", "marker", linespec.marker,
+                   "parent", hg);
+      endif
+    endif
+    if (have_filled)
+      ## FIXME: gnuplot doesn't respect the markerfacecolor field
+      set (h3, "markerfacecolor", get (h1, "color"));
+    endif
+
+    ## Set up the hggroup properties and listeners
+    if (autoscale)
+      addproperty ("autoscale", hg, "radio", "{on}|off", "on");
+      addproperty ("autoscalefactor", hg, "data", autoscale);
+    else
+      addproperty ("autoscale", hg, "radio", "{on}|off", "off");
+      addproperty ("autoscalefactor", hg, "data", 1.0);
+    endif
+    addlistener (hg, "autoscale", @update_data);
+    addlistener (hg, "autoscalefactor", @update_data);
+
+    addproperty ("maxheadsize", hg, "data", arrowsize);
+    addlistener (hg, "maxheadsize", @update_data);
+
+    addproperty ("showarrowhead", hg, "radio", "{on}|off", "on");
+    addlistener (hg, "showarrowhead", @update_props);
+
+    addproperty ("color", hg, "linecolor", get (h1, "color"));
+    addproperty ("linewidth", hg, "linelinewidth", get (h1, "linewidth"));
+    addproperty ("linestyle", hg, "linelinestyle", get (h1, "linestyle"));
+    addproperty ("marker", hg, "linemarker", get (h3, "marker"));
+    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                 get (h3, "markerfacecolor"));
+    addproperty ("markersize", hg, "linemarkersize", get (h3, "markersize"));
+
+    addlistener (hg, "color", @update_props);
+    addlistener (hg, "linewidth", @update_props);
+    addlistener (hg, "linestyle", @update_props);
+    addlistener (hg, "marker", @update_props);
+    addlistener (hg, "markerfacecolor", @update_props);
+    addlistener (hg, "markersize", @update_props);
+
+    ## Matlab property, although Octave does not implement it.
+    addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+    if (! isempty (args))
+      set (hg, args{:});
+    endif
+  unwind_protect_cleanup
+    set (h, "nextplot", hstate);
+  end_unwind_protect
+
+endfunction
+
+function update_data (h, d)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+
+  u = get (h, "udata");
+  v = get (h, "vdata");
+  w = get (h, "wdata");
+
+  s = get (h, "autoscalefactor");
+  arrowsize = get (h, "maxheadsize");
+
+  kids = get (h, "children");
+
+  if (isempty (z) || isempty (w))
+    is3d = false;
+  else
+    is3d = true;
+  endif
+
+  if (strcmpi (get (h, "autoscale"), "on") && s != 0)
+    ## Scale the arrows to fit in the grid
+    if (isvector (x))
+      ny = nx = length (x);
+    else
+      [nx, ny] = size (x);
+    endif
+    dx = (max (x(:)) - min (x(:))) ./ nx;
+    dy = (max (y(:)) - min (y(:))) ./ ny;
+    if (is3d)
+      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
+      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
+    else
+      dz = 0;
+      len = max (sqrt (u(:).^2 + v(:).^2));
+    endif
+    if (len > 0)
+      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
+      if (sd != 0)
+        s *= sqrt (2) * sd;
+      endif
+      u = s * u;
+      v = s * v;
+      if (is3d)
+        w = s*w;
+      endif
+    endif
+  endif
+
+  x = x(:);
+  y = y(:);
+  xend = x + u(:);
+  yend = y + v(:);
+  if (is3d)
+    z = z(:);
+    zend = z + w(:);
+  endif
+
+  set (kids (3), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
+  set (kids (3), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (3), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
+  endif
+
+  xtmp = x + u(:) .* (1 - arrowsize);
+  ytmp = y + v(:) .* (1 - arrowsize);
+  xarrw1 = xtmp + (y - yend) * arrowsize / 3;
+  xarrw2 = xtmp - (y - yend) * arrowsize / 3;
+  yarrw1 = ytmp - (x - xend) * arrowsize / 3;
+  yarrw2 = ytmp + (x - xend) * arrowsize / 3;
+  if (is3d)
+    zarrw1 = zarrw2 = zend - w(:) * arrowsize;
+  endif
+
+  set (kids (2), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
+  set (kids (2), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (2), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
+  endif
+
+  set (kids (2), "xdata", [xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:));
+  set (kids (2), "ydata", [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:));
+  if (is3d)
+    set (kids (2), "zdata", [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:));
+  endif
+
+  set (kids (1), "xdata", x);
+  set (kids (1), "ydata", y);
+  if (is3d)
+    set (kids (1), "zdata", z);
+  endif
+
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+
+  set (kids(3), "color", get (h, "color"),
+       "linewidth", get (h, "linewidth"),
+       "linestyle", get (h, "linestyle"));
+  set (kids(2), "color", get (h, "color"),
+       "linewidth", get (h, "linewidth"),
+       "linestyle", get (h, "linestyle"));
+  if (strcmpi (get (h, "showarrowhead"), "on"))
+    set (kids (2), "visible", "on");
+  else
+    set (kids (2), "visible", "off");
+  endif
+  set (kids(1), "color", get (h, "color"),
+       "marker", get (h, "marker"),
+       "markerfacecolor", get (h, "markerfacecolor"),
+       "markersize", get (h, "markersize"));
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__scatter__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,374 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hg} =} __scatter__ (@dots{})
+## Undocumented internal function.
+## @end deftypefn
+
+function hg = __scatter__ (varargin)
+
+  hax = varargin{1};  # We don't do anything with this.  Could remove it.
+  nd  = varargin{2};
+  fcn = varargin{3};
+  x   = varargin{4}(:);
+  y   = varargin{5}(:);
+
+  if (nd == 2)
+    istart = 6;
+  else
+    z = varargin{6}(:);
+    istart = 7;
+  endif
+
+  if (istart <= nargin)
+    s = varargin{istart}(:);
+    if (isempty (s) || ischar (s))
+      s = 6;
+    endif
+    if (! ischar (varargin{istart}))
+      istart++;
+    endif
+  else
+    s = 6;
+  endif
+
+  ## Remove NaNs
+  idx = isnan (x) | isnan (y) | isnan (s);
+  if (nd == 3)
+    idx |= isnan (z);
+    z(idx) = [];
+  endif
+  x(idx) = [];
+  y(idx) = [];
+  if (nd == 2)
+    z = zeros (length (x), 0);
+  endif
+  if (numel (s) > 1)
+    s(idx) = [];
+  endif
+
+  firstnonnumeric = find (! cellfun ("isnumeric", varargin(istart:nargin)), 1);
+  if (isempty (firstnonnumeric))
+    firstnonnumeric = Inf;
+  else
+    firstnonnumeric += istart - 1;
+  endif
+
+  if (istart <= nargin && firstnonnumeric > istart)
+    c = varargin{istart};
+    if (isvector (c) && columns (c) != 3)
+      c = c(:);
+    endif
+  elseif (firstnonnumeric == istart && ischar (varargin{istart})
+          && ! (   strcmpi (varargin{istart}, "filled")
+                || strcmpi (varargin{istart}, "fill")))
+    c = varargin{istart};
+    firstnonnumeric++;
+  else
+    c = [];
+  endif
+
+  newargs = {};
+  filled = false;
+  have_marker = false;
+  marker = "o";
+  iarg = firstnonnumeric;
+  while (iarg <= nargin)
+    arg = varargin{iarg++};
+    if (ischar (arg) && (strcmpi (arg, "filled") || strcmpi (arg, "fill")))
+      filled = true;
+    elseif ((ischar (arg) || iscellstr (arg)) && ! have_marker)
+      [linespec, valid] = __pltopt__ (fcn, arg, false);
+      if (valid)
+        have_marker = true;
+        marker = linespec.marker;
+        if (strcmp (marker, "none"))
+          marker = "o";
+        elseif (isempty (marker))
+          have_marker = false;
+          [~, marker] = __next_line_style__ ();
+        endif
+      else
+        error ("%s: invalid linespec", fcn);
+      endif
+    else
+      newargs{end+1} = arg;
+      if (iarg <= nargin)
+        newargs{end+1} = varargin{iarg++};
+      endif
+    endif
+  endwhile
+
+  if (isempty (c))
+    c = __next_line_color__ ();
+  endif
+
+  ## Must occur after __next_line_color__ in order to work correctly.
+  hg = hggroup ();
+  newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"},
+                                newargs{:});
+
+  addproperty ("xdata", hg, "data", x);
+  addproperty ("ydata", hg, "data", y);
+  addproperty ("zdata", hg, "data", z);
+  if (ischar (c))
+    ## For single explicit color, cdata is unused
+    addproperty ("cdata", hg, "data", []);
+  else
+    addproperty ("cdata", hg, "data", c);
+  endif
+  addproperty ("sizedata", hg, "data", s);
+  addlistener (hg, "xdata", @update_data);
+  addlistener (hg, "ydata", @update_data);
+  addlistener (hg, "zdata", @update_data);
+  addlistener (hg, "cdata", @update_data);
+  addlistener (hg, "sizedata", @update_data);
+
+  one_explicit_color = ischar (c) || isequal (size (c), [1, 3]);
+
+  if (numel (x) <= 100)
+
+    ## For small number of points, we'll construct an object for each point.
+
+    if (numel (s) == 1)
+      s = repmat (s, numel (x), 1);
+    endif
+
+    if (one_explicit_color)
+      for i = 1 : numel (x)
+        if (filled)
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker,  "markersize", s(i),
+                        "markeredgecolor", c, "markerfacecolor", c,
+                        "linestyle", "none");
+        else
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker,  "markersize", s(i),
+                        "markeredgecolor", c, "markerfacecolor", "none",
+                        "linestyle", "none");
+        endif
+      endfor
+    else
+      if (rows (c) == 1)
+        c = repmat (c, rows (x), 1);
+      endif
+      for i = 1 : numel (x)
+        if (filled)
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker, "markersize", s(i),
+                        "markeredgecolor", "none",
+                        "markerfacecolor", "flat",
+                        "cdata", c(i,:), "facevertexcdata", c(i,:),
+                        "linestyle", "none");
+        else
+          __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
+                        "faces", 1, "vertices", [x(i), y(i), z(i,:)],
+                        "facecolor", "none", "edgecolor", "none",
+                        "marker", marker, "markersize", s(i),
+                        "markeredgecolor", "flat",
+                        "markerfacecolor", "none",
+                        "cdata", c(i,:), "facevertexcdata", c(i,:),
+                        "linestyle", "none");
+        endif
+      endfor
+    endif
+
+  else
+
+    ## For larger numbers of points, we split the points by common color.
+
+    vert = [x, y, z];
+    if (one_explicit_color)
+      render_size_color (hg, vert, s, c, marker, filled, true);
+    else
+      if (rows (c) == 1)
+        c = repmat (c, rows (x), 1);
+      endif
+      ## We want to group points by color.  So first get all the unique colors
+      [cc, ~, c_to_cc] = unique (c, "rows");
+
+      for i = 1 : rows (cc)
+        ## Now for each possible unique color, get the logical index of
+        ## points that correspond to that color
+        idx = (i == c_to_cc);
+        if (isscalar (s))
+          render_size_color (hg, vert(idx, :), s, c(idx,:),
+                                 marker, filled, true);
+        else
+          render_size_color (hg, vert(idx, :), s(idx), c(idx,:),
+                                 marker, filled, true);
+        endif
+      endfor
+
+    endif
+  endif
+
+  if (! ischar (c) && rows (c) > 1)
+    ax = get (hg, "parent");
+    clim = get (ax, "clim");
+    if (min (c(:)) < clim(1))
+      clim(1) = min (c(:));
+      set (ax, "clim", clim);
+    endif
+    if (max (c(:)) > clim(2))
+      set (ax, "clim", [clim(1), max(c(:))]);
+    endif
+  endif
+
+  addproperty ("linewidth", hg, "patchlinewidth", 0.5);
+  addproperty ("marker", hg, "patchmarker", marker);
+  if (filled)
+    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "none");
+    if (one_explicit_color)
+      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", c);
+    else
+      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "flat");
+    endif
+  else
+    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "none");
+    if (one_explicit_color)
+      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", c);
+    else
+      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "flat");
+    endif
+  endif
+  addlistener (hg, "linewidth", @update_props);
+  addlistener (hg, "marker", @update_props);
+  addlistener (hg, "markerfacecolor", @update_props);
+  addlistener (hg, "markeredgecolor", @update_props);
+
+  ## Matlab property, although Octave does not implement it.
+  addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+  if (! isempty (newargs))
+    set (hg, newargs{:});
+  endif
+
+endfunction
+
+function render_size_color (hg, vert, s, c, marker, filled, isflat)
+  if (isscalar (s))
+    x = vert(:,1);
+    y = vert(:,2);
+    z = vert(:,3:end);
+    toolkit = get (ancestor (hg, "figure"), "__graphics_toolkit__");
+    ## Does gnuplot only support triangles with different vertex colors ?
+    ## TODO: Verify gnuplot can only support one color.  If RGB triplets
+    ##       can be assigned to each vertex, then fix __go_draw_axes__.m
+    gnuplot_hack = (numel (x) > 1 && columns (c) == 3
+                    && strcmp (toolkit, "gnuplot"));
+    if (ischar (c) || ! isflat || gnuplot_hack)
+      if (filled)
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker,
+                          "markeredgecolor", "none",
+                          "markerfacecolor", c(1,:),
+                          "markersize", s, "linestyle", "none");
+      else
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker,
+                          "markeredgecolor", c(1,:),
+                          "markerfacecolor", "none",
+                          "markersize", s, "linestyle", "none");
+      endif
+    else
+      if (filled)
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker, "markersize", s,
+                          "markeredgecolor", "none",
+                          "markerfacecolor", "flat",
+                          "cdata", c, "facevertexcdata", c,
+                          "linestyle", "none");
+      else
+        __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
+                          "faces", 1:numel (x), "vertices", vert,
+                          "facecolor", "none", "edgecolor", "none",
+                          "marker", marker, "markersize", s,
+                          "markeredgecolor", "flat",
+                          "markerfacecolor", "none",
+                          "cdata", c, "facevertexcdata", c,
+                          "linestyle", "none");
+      endif
+    endif
+  else
+    ## Round size to one decimal place.
+    [ss, ~, s_to_ss] = unique (ceil (s*10) / 10);
+    for i = 1:rows (ss)
+      idx = (i == s_to_ss);
+      render_size_color (hg, vert(idx,:), ss(i), c,
+                             marker, filled, isflat);
+    endfor
+  endif
+endfunction
+
+function update_props (h, d)
+  lw = get (h, "linewidth");
+  m  = get (h, "marker");
+  fc = get (h, "markerfacecolor");
+  ec = get (h, "markeredgecolor");
+  kids = get (h, "children");
+
+  set (kids, "linewidth", lw, "marker", m,
+             "markerfacecolor", fc, "markeredgecolor", ec);
+endfunction
+
+function update_data (h, d)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+  c = get (h, "cdata");
+  if (rows (c) == 1)
+    c = repmat (c, numel (x), 1);
+  endif
+  s = get (h, "sizedata");
+  if (numel (s) == 1)
+    s = repmat (s, numel (x), 1);
+  endif
+  hlist = get (h, "children");
+
+  if (isempty (z))
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x(i), y(i)],
+                     "cdata", reshape (c(i,:),[1, size(c)(2:end)]),
+                     "facevertexcdata", c(i,:),
+                     "markersize", s(i));
+    endfor
+  else
+    for i = 1 : length (hlist)
+      set (hlist(i), "vertices", [x(i), y(i), z(i)],
+                     "cdata", reshape (cd(i,:),[1, size(cd)(2:end)]),
+                     "facevertexcdata", cd(i,:),
+                     "markersize", s(i));
+    endfor
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/private/__stem__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,430 @@
+## Copyright (C) 2006-2012 Michel D. Schmid
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} __stem__ (@var{have_z}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
+## Adapted-by: jwe
+
+function h = __stem__ (have_z, varargin)
+
+  if (have_z)
+    caller = "stem3";
+  else
+    caller = "stem";
+  endif
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:});
+
+  [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
+                                           check_stem_arg (have_z, varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    hold_state = get (hax, "nextplot");
+    set (hax, "nextplot", "add");
+
+    h = [];
+    nx = rows (x);
+    for i = 1 : columns (x)
+      if (have_z)
+        xt = x(:)';
+        xt = [xt; xt; NaN(1, nx)](:);
+        yt = y(:)';
+        yt = [yt; yt; NaN(1, nx)](:);
+        zt = z(:)';
+        zt = [zeros(1, nx); zt; NaN(1, nx)](:);
+      else
+        xt = x(:, i)';
+        xt = [xt; xt; NaN(1, nx)](:);
+        yt = y(:, i)';
+        yt = [zeros(1, nx); yt; NaN(1, nx)](:);
+      endif
+
+      if (isempty (llc))
+        lc = __next_line_color__ ();
+      else
+        lc = llc;
+      endif
+
+      if (isempty (mmc))
+        mc = lc;
+      else
+        mc = mmc;
+      endif
+
+      if (dofill)
+        fc = mc;
+      else
+        fc = "none";
+      endif
+
+      ## Must occur after __next_line_color__ in order to work correctly.
+      hg = hggroup ();
+      h = [h; hg];
+      args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
+
+      if (have_z)
+        __line__ (hax, xt, yt, zt, "color", lc, "linestyle", ls, "parent", hg);
+        __line__ (hax, x, y, z, "color", mc, "linestyle", "none",
+                       "marker", ms, "markerfacecolor", fc, "parent", hg);
+        h_baseline = [];
+      else
+        __line__ (hax, xt, yt, "color", lc, "linestyle", ls, "parent", hg);
+        __line__ (hax, x(:,i), y(:, i), "color", mc, "linestyle", "none",
+                       "marker", ms, "markerfacecolor", fc, "parent", hg);
+        x_axis_range = get (hax, "xlim");
+        h_baseline = line (hax, x_axis_range, [0, 0], "color", [0, 0, 0]);
+        set (h_baseline, "handlevisibility", "off", "xliminclude", "off");
+        addlistener (hax, "xlim", @update_xlim);
+        addproperty ("basevalue", h_baseline, "data", 0);
+        addlistener (h_baseline, "basevalue", {@update_baseline, 0});
+        addlistener (h_baseline, "ydata", {@update_baseline, 1});
+        addlistener (h_baseline, "visible", {@update_baseline, 2});
+      endif
+
+      ## Setup the hggroup and listeners.
+      addproperty ("showbaseline", hg, "radio", "{on}|off");
+      addproperty ("baseline", hg, "data", h_baseline);
+      addproperty ("basevalue", hg, "data", 0);
+
+      if (! have_z)
+        addlistener (hg, "showbaseline", @show_baseline);
+        addlistener (hg, "basevalue", @move_baseline);
+      endif
+
+      addproperty ("color", hg, "linecolor", lc);
+      addproperty ("linestyle", hg, "linelinestyle", ls);
+      addproperty ("linewidth", hg, "linelinewidth", 0.5);
+      addproperty ("marker", hg, "linemarker", ms);
+      addproperty ("markeredgecolor", hg, "linemarkerfacecolor", mc);
+      addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
+      addproperty ("markersize", hg, "linemarkersize", 6);
+
+      addlistener (hg, "color", @update_props);
+      addlistener (hg, "linestyle", @update_props);
+      addlistener (hg, "linewidth", @update_props);
+      addlistener (hg, "marker", @update_props);
+      addlistener (hg, "markeredgecolor", @update_props);
+      addlistener (hg, "markerfacecolor", @update_props);
+      addlistener (hg, "markersize", @update_props);
+
+      addproperty ("xdata", hg, "data", x(:, i));
+      addproperty ("ydata", hg, "data", y(:, i));
+      if (have_z)
+        addproperty ("zdata", hg, "data", z(:, i));
+      else
+        addproperty ("zdata", hg, "data", []);
+      endif
+
+      addlistener (hg, "xdata", @update_data);
+      addlistener (hg, "ydata", @update_data);
+      addlistener (hg, "zdata", @update_data);
+
+      ## Matlab property, although Octave does not implement it.
+      addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+      if (! isempty (args))
+        set (hg, args{:});
+      endif
+      if (i == 1 && ! isempty (h_baseline))
+        set (h_baseline, "parent", get (hg, "parent"));
+      endif
+    endfor
+
+    if (! strcmp (hold_state, "add") && have_z)
+      set (hax, "view", [-37.5 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+    set (hax, "nextplot", hold_state);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+endfunction
+
+function [x, y, z, dofill, lc, ls, mc, ms, args] = check_stem_arg (have_z, varargin)
+
+  if (have_z)
+    caller = "stem3";
+  else
+    caller = "stem";
+  endif
+  nargin = nargin - 1;  # account for have_z argument 
+
+  num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
+  if (isempty (num_numeric))
+    num_numeric = nargin;     
+  endif
+
+  if (num_numeric < 1 || num_numeric > 3)
+    print_usage (caller);
+  endif
+
+  x = y = z = [];
+  if (num_numeric == 1)
+    if (have_z)
+      z = varargin{1};
+    else
+      y = varargin{1};
+    endif
+  elseif (num_numeric == 2)
+    if (have_z)
+      error ("stem3: must define X, Y, and Z");
+    else
+      x = varargin{1};
+      y = varargin{2};
+    endif
+  else  # nun_numeric == 3
+    if (have_z)
+      x = varargin{1};
+      y = varargin{2};
+      z = varargin{3};
+    else
+      error ("stem: can not define Z for 2-D stem plot");
+    endif
+  endif
+
+  ## Validate numeric data
+  if (have_z)
+    if (isempty (x))
+      [nr, nc] = size (z);
+      if (nr >= nc)
+        x = repmat ([1:nc], nr, 1);
+        y = repmat ([1:nr]', 1, nc);
+      else
+        x = repmat ([1:nc], nr, 1);
+        y = repmat ([1:nr]', 1, nc);
+      endif
+    endif
+    if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
+      error ("stem3: X, Y, and Z must be numeric");
+    endif
+  else
+    if (isempty (x))
+      if (isvector (y))
+        x = 1:length (y);
+      elseif (ismatrix (y))
+        x = 1:rows (y);
+      endif
+    endif
+    if (! (ismatrix (x) && ismatrix (y)))
+      error ("stem: X and Y must be numeric");
+    endif
+  endif
+
+  ## Check sizes of x, y and z.
+  if (have_z)
+    if (! size_equal (x, y, z))
+      error ("stem3: inconsistent sizes for X, Y, and Z");
+    endif
+    x = x(:);
+    y = y(:);
+    z = z(:);
+  else
+    if (isvector (x))
+      x = x(:);
+      if (isvector (y))
+        if (length (x) != length (y))
+          error ("stem: inconsistent sizes for X and Y");
+        endif
+        y = y(:);
+      else
+        if (length (x) == rows (y))
+          x = repmat (x(:), 1, columns (y));
+        else
+          error ("stem: inconsistent sizes for X and Y");
+        endif
+      endif
+    elseif (! size_equal (x, y))
+      error ("stem: inconsistent sizes for X and Y");
+    endif
+  endif
+
+  dofill = false;
+  have_line_spec = false;
+  ## set specifiers to default values.
+  [lc, ls, mc, ms] = set_default_values ();
+
+  args = {};
+  ioff = num_numeric + 1;
+  while (ioff <= nargin)
+    arg = varargin{ioff++};
+    if (ischar (arg) && any (strcmpi (arg, {"fill", "filled"})))
+      dofill = true;
+    elseif ((ischar (arg) || iscellstr (arg)) && ! have_line_spec)
+      [linespec, valid] = __pltopt__ (caller, arg, false);
+      if (valid)
+        have_line_spec = true;
+        [lc, ls, mc, ms] = stem_line_spec (linespec);
+      else
+        args{end+1} = arg;
+        if (ioff <= nargin)
+          args{end+1} = varargin{ioff++};
+        else
+          error ('%s: No value specified for property "%s"', caller, arg);
+        endif
+      endif
+    else
+      args{end+1} = arg;
+      if (ioff <= nargin)
+        args{end+1} = varargin{ioff++};
+      else
+        error ('%s: No value specified for property "%s"', caller, arg);
+      endif
+    endif
+  endwhile
+
+endfunction
+
+function [lc, ls, mc, ms] = stem_line_spec (lspec)
+
+  [lc, ls, mc, ms] = set_default_values ();
+
+  if (! isempty (lspec.color))
+    lc = mc = lspec.color;
+  endif
+
+  if (! isempty (lspec.linestyle) && ! strcmp (lspec.linestyle, "none"))
+    ls = lspec.linestyle;
+  endif
+
+  if (! isempty (lspec.marker) && ! strcmp (lspec.marker, "none"))
+    ms = lspec.marker;
+  endif
+
+endfunction
+
+function [lc, ls, mc, ms] = set_default_values ()
+  mc = [];
+  lc = [];
+  ls = "-";
+  ms = "o";
+endfunction
+
+function update_xlim (h, ~)
+  kids = get (h, "children");
+  xlim = get (h, "xlim");
+
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
+      if (any (get (obj.baseline, "xdata") != xlim))
+        set (obj.baseline, "xdata", xlim);
+      endif
+    endif
+  endfor
+endfunction
+
+function update_baseline (h, ~, src)
+  visible = get (h, "visible");
+  if (src == 0)
+    basevalue = get (h, "basevalue");
+  else
+    basevalue = get (h, "ydata")(1);
+  endif
+
+  kids = get (get (h, "parent"), "children");
+  for i = 1 : length (kids)
+    obj = get (kids(i));
+    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
+        && obj.baseline == h)
+      ## Avoid lots of unnecessary listener updates
+      if (! strcmp (get (kids(i), "showbaseline"), visible))
+        set (kids(i), "showbaseline", visible);
+      endif
+      if (get (kids(i), "basevalue") != basevalue)
+        set (kids(i), "basevalue", basevalue);
+      endif
+    endif
+  endfor
+endfunction
+
+function show_baseline (h, ~)
+  set (get (h, "baseline"), "visible", get (h, "showbaseline"));
+endfunction
+
+function move_baseline (h, ~)
+  b0 = get (h, "basevalue");
+  bl = get (h, "baseline");
+
+  set (bl, "ydata", [b0, b0]);
+
+  kids = get (h, "children");
+  yt = get (h, "ydata")(:)';
+  ny = length (yt);
+  yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
+  set (kids(2), "ydata", yt);
+endfunction
+
+function update_props (h, ~)
+  kids = get (h, "children");
+  set (kids(2), "color", get (h, "color"),
+                "linestyle", get (h, "linestyle"),
+                "linewidth", get (h, "linewidth"));
+  set (kids(1), "color", get (h, "markeredgecolor"),
+                "marker", get (h, "marker"),
+                "markerfacecolor", get (h, "markerfacecolor"),
+                "markersize", get (h, "markersize"));
+endfunction
+
+function update_data (h, ~)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+  z = get (h, "zdata");
+
+  if (!isempty (z) && size_equal (x, y, z))
+    sz = min ([size(x); size(y); size(z)]);
+    x = x(1:sz(1),1:sz(2));
+    y = y(1:sz(1),1:sz(2));
+    z = z(1:sz(1),1:sz(2));
+  elseif (numel (x) != numel (y));
+    sz = min ([size(x); size(y)]);
+    x = x(1:sz(1),1:sz(2));
+    y = y(1:sz(1),1:sz(2));
+  endif
+  bl = get (h, "basevalue");
+  nx = numel (x);
+  x = x(:)';
+  xt = [x; x; NaN(1, nx)](:);
+  if (! isempty (z))
+    y = y(:)';
+    yt = [y; y; NaN(1, nx)](:);
+    z = z(:)';
+    zt = [bl * ones(1, nx); z; NaN(1, nx)](:);
+  else
+    y = y(:)';
+    yt = [bl * ones(1, nx); y; NaN(1, nx)](:);
+    zt = [];
+  endif
+
+  kids = get (h, "children");
+  set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt);
+  set (kids(1), "xdata", x, "ydata", y, "zdata", z);
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/quiver.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,106 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} quiver (@var{u}, @var{v})
+## @deftypefnx {Function File} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
+## @deftypefnx {Function File} {} quiver (@dots{}, @var{s})
+## @deftypefnx {Function File} {} quiver (@dots{}, @var{style})
+## @deftypefnx {Function File} {} quiver (@dots{}, "filled")
+## @deftypefnx {Function File} {} quiver (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} quiver (@dots{})
+##
+## Plot the (@var{u}, @var{v}) components of a vector field in
+## an (@var{x}, @var{y}) meshgrid.  If the grid is uniform, you can
+## specify @var{x} and @var{y} as vectors.
+##
+## If @var{x} and @var{y} are undefined they are assumed to be
+## @code{(1:@var{m}, 1:@var{n})} where
+## @code{[@var{m}, @var{n}] = size (@var{u})}.
+##
+## The variable @var{s} is a scalar defining a scaling factor to use for
+## the arrows of the field relative to the mesh spacing.  A value of 0
+## disables all scaling.  The default value is 1.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+## If a marker is specified then markers at the grid points of the vectors are
+## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
+## markers are filled.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to a quiver object.
+## A quiver object regroups the components of the quiver plot (body, arrow,
+## and marker), and allows them to be changed together.
+##
+## @example
+## @group
+## [x, y] = meshgrid (1:2:20);
+## h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
+## set (h, "maxheadsize", 0.33);
+## @end group
+## @end example
+##
+## @seealso{quiver3, compass, feather, plot}
+## @end deftypefn
+
+function retval = quiver (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  else
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = __quiver__ (hax, false, varargin{:});
+    unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+    end_unwind_protect
+  endif
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x,y] = meshgrid (1:2:20);
+%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
+%! set (h, 'maxheadsize', 0.33);
+
+%!demo
+%! clf;
+%! axis ('equal');
+%! x = linspace (0, 3, 80);
+%! y = sin (2*pi*x);
+%! theta = 2*pi*x + pi/2;
+%! quiver (x, y, sin (theta)/10, cos (theta)/10);
+%! hold on; plot (x,y,'r'); hold off;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/quiver3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,132 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
+## @deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} quiver3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} quiver3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
+##
+## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field in
+## an (@var{x}, @var{y}, @var{z}) meshgrid.  If the grid is uniform, you
+## can specify @var{x}, @var{y}, and @var{z} as vectors.
+##
+## If @var{x}, @var{y}, and @var{z} are undefined they are assumed to be
+## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
+## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}.
+##
+## The variable @var{s} is a scalar defining a scaling factor to use for
+## the arrows of the field relative to the mesh spacing.  A value of 0
+## disables all scaling.  The default value is 1.
+##
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+## If a marker is specified then markers at the grid points of the vectors are
+## drawn rather than arrows.  If the argument @qcode{"filled"} is given then the
+## markers are filled.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to a quiver object.
+## A quiver object regroups the components of the quiver plot (body, arrow,
+## and marker), and allows them to be changed together.
+##
+## @example
+## @group
+## [x, y, z] = peaks (25);
+## surf (x, y, z);
+## hold on;
+## [u, v, w] = surfnorm (x, y, z / 10);
+## h = quiver3 (x, y, z, u, v, w);
+## set (h, "maxheadsize", 0.33);
+## @end group
+## @end example
+##
+## @seealso{quiver, compass, feather, plot}
+## @end deftypefn
+
+function retval = quiver3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  else
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = __quiver__ (hax, true, varargin{:});
+
+      if (! ishold (hax))
+        set (hax, "view", [-37.5, 30]);  # 3D view
+      endif
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x,y] = meshgrid (-1:0.1:1);
+%! z = sin (2*pi * sqrt (x.^2 + y.^2));
+%! theta = 2*pi * sqrt (x.^2 + y.^2) + pi/2;
+%! mesh (x, y, z);
+%! hold on;
+%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z)));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (25);
+%! surf (x, y, z);
+%! hold on;
+%! [u, v, w] = surfnorm (x, y, z / 10);
+%! h = quiver3 (x, y, z, u, v, w);
+%! set (h, 'maxheadsize', 0.33);
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (25);
+%! surf (x, y, z);
+%! hold on;
+%! [u, v, w] = surfnorm (x, y, z / 10);
+%! h = quiver3 (x, y, z, u, v, w);
+%! set (h, 'maxheadsize', 0.33);
+%! hold off;
+%! shading interp;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/rectangle.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,242 @@
+## Copyright (C) 2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} rectangle ()
+## @deftypefnx {Function File} {} rectangle (@dots{}, "Position", @var{pos})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "Curvature", @var{curv})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "EdgeColor", @var{ec})
+## @deftypefnx {Function File} {} rectangle (@dots{}, "FaceColor", @var{fc})
+## @deftypefnx {Function File} {} rectangle (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} rectangle (@dots{})
+##
+## Draw a rectangular patch defined by @var{pos} and @var{curv}.
+## 
+## The variable @code{@var{pos}(1:2)} defines the lower left-hand corner of
+## the patch and @code{@var{pos}(3:4)} defines its width and height.  By
+## default, the value of @var{pos} is @code{[0, 0, 1, 1]}.
+##
+## The variable @var{curv} defines the curvature of the sides of the rectangle
+## and may be a scalar or two-element vector with values between 0 and 1.
+## A value of 0 represents no curvature of the side, whereas a value of 1
+## means that the side is entirely curved into the arc of a circle.
+## If @var{curv} is a two-element vector, then the first element is the
+## curvature along the x-axis of the patch and the second along y-axis.
+##
+## If @var{curv} is a scalar, it represents the curvature of the shorter of the
+## two sides of the rectangle and the curvature of the other side is defined
+## by
+##
+## @example
+## min (pos (1:2)) / max (pos (1:2)) * curv
+## @end example
+##
+## Additional property/value pairs are passed to the underlying patch command. 
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## rectangle object.
+## @end deftypefn
+## @seealso{patch, line, cylinder, ellipsoid, sphere}
+
+function h = rectangle (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = __rectangle__ (hax, varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+endfunction
+
+function hg = __rectangle__ (hax, varargin)
+
+  iarg = 1;
+  pos = [0, 0, 1, 1];
+  curv2 = [0, 0];
+  ec = [0, 0, 0];
+  fc = "none";
+
+  while (iarg < length (varargin))
+    arg = varargin{iarg};
+    if (ischar (arg))
+      if (strcmpi (arg, "position"))
+        pos = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+        if (!isvector (pos) || numel (pos) != 4)
+          error ("rectangle: position must be a 4 element vector");
+        endif
+      elseif (strcmpi (arg, "curvature"))
+        curv2 = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+        if (!isnumeric (curv2) || (numel (curv2) != 1 && numel (curv2) != 2))
+          error ("rectangle: curvature must be a 2 element vector or a scalar");
+        endif
+        if (any (curv2 < 0) || any (curv2 > 1))
+          error ("rectangle: curvature values must be between 0 and 1");
+        endif
+      elseif (strcmpi (arg, "edgecolor"))
+        ec = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+      elseif (strcmpi (arg, "facecolor"))
+        fc = varargin{iarg+1};
+        varargin(iarg:iarg+1) = [];
+      else
+        iarg ++;
+      endif
+    else
+      iarg ++;
+    endif
+  endwhile
+
+  if (numel (curv2) == 1)
+    [a, ai] = min (pos (3 : 4));
+    [b, bi] = max (pos (3 : 4));
+    if (ai < bi)
+      curv = [curv2, curv2 .* a ./ b];
+    else
+      curv = [curv2 .* a ./ b, curv2];
+    endif
+  else
+    curv = curv2;
+  endif
+
+  if (all (curv) < 0.01)
+    ## Special case : no curvature
+    x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
+    y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
+  else
+    p = pi / 2 * [0 : 15] / 15;
+    c = curv .* pos(3 : 4) / 2;
+    cx = c(1) * sin (p) - c(1);
+    cy = c(2) * cos (p) - c(2);
+    x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
+         pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
+    y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
+         pos(2) + pos(4) + cy, pos(2) + c(2)];
+  endif
+
+  hg = hggroup ();
+
+  h = patch ("xdata", x(:), "ydata", y(:), "facecolor", fc, "edgecolor", ec, ...
+             "parent", hg, varargin{:});
+
+  addproperty ("curvature", hg, "data", curv2);
+  addproperty ("position",  hg, "data", pos);
+  addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
+  addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+  addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
+  addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
+
+  addlistener (hg, "curvature", @update_data);
+  addlistener (hg, "position",  @update_data);
+  addlistener (hg, "edgecolor", @update_props);
+  addlistener (hg, "linewidth", @update_props);
+  addlistener (hg, "linestyle", @update_props);
+  addlistener (hg, "facecolor", @update_props);
+endfunction
+
+function update_data (h, d)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (!recursion)
+    unwind_protect
+      recursion = true;
+
+      kids = get (h, "children");
+      pos = get (h, "position");
+      curv2 = get (h, "curvature");
+
+      if (numel (curv2) == 1)
+        [a, ai] = min (pos (3 : 4));
+        [b, bi] = max (pos (3 : 4));
+        if (ai < bi)
+          curv = [curv2, curv2 .* a ./ b];
+        else
+          curv = [curv2 .* a ./ b, curv2];
+        endif
+      else
+        curv = curv2;
+      endif
+
+      if (all (curv) < 0.01)
+        ## Special case : no curvature
+        x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
+        y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
+      else
+        p = pi / 2 * [0 : 15] / 15;
+        c = curv .* pos(3 : 4) / 2;
+        cx = c(1) * sin (p) - c(1);
+        cy = c(2) * cos (p) - c(2);
+        x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
+             pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
+        y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
+             pos(2) + pos(4) + cy, pos(2) + c(2)];
+      endif
+
+      set (kids, "xdata", x, "ydata", y);
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function update_props (h, d)
+  kids = get (h, "children");
+  set (kids, "edgecolor", get (h, "edgecolor"),
+             "linewidth", get (h, "linewidth"),
+             "linestyle", get (h, "linestyle"),
+             "facecolor", get (h, "facecolor"));
+endfunction
+
+
+%!demo
+%! clf;
+%! axis equal;
+%! rectangle ('Position', [0.05, 0.05, 0.9, 0.9], 'Curvature', [0.5, 0.5]);
+%! title ('rectangle() with corners curved');
+
+%!demo
+%! clf;
+%! axis equal;
+%! rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
+%! title ('rectangle() with sides as complete arcs');
+
+%!demo
+%! clf;
+%! axis equal;
+%! h = rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
+%! set (h, 'FaceColor', [0, 1, 0]);
+%! title ('rectangle() with FaceColor = green');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/ribbon.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,124 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} ribbon (@var{y})
+## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y})
+## @deftypefnx {Function File} {} ribbon (@var{x}, @var{y}, @var{width})
+## @deftypefnx {Function File} {} ribbon (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ribbon (@dots{})
+## Plot a ribbon plot for the columns of @var{y} vs. @var{x}.
+##
+## The optional parameter @var{width} specifies the width of a single ribbon
+## (default is 0.75).  If @var{x} is omitted, a vector containing the
+## row numbers is assumed (@code{1:rows (Y)}).
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to
+## the surface objects representing each ribbon.
+## @seealso{surface, waterfall}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel at gmx.de>
+
+function h = ribbon (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ribbon", varargin{:});
+
+  if (nargin < 1 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    y = varargin{1};
+    if (isvector (y))
+      y = y(:);
+    endif
+    [nr, nc] = size (y);
+    x = repmat ((1:nr)', 1, nc);
+    width = 0.75;
+  elseif (nargin == 2)
+    x = varargin{1};
+    y = varargin{2};
+    width = 0.75;
+  else
+    x = varargin{1};
+    y = varargin{2};
+    width = varargin{3};
+  endif
+
+  if (isvector (x) && isvector (y))
+    if (length (x) != length (y))
+      error ("ribbon: vectors X and Y must have the same length");
+    else
+      [x, y] = meshgrid (x, y);
+    endif
+  else
+    if (! size_equal (x, y))
+      error ("ribbon: matrices X and Y must have the same size");
+    endif
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    [nr, nc] = size (y);
+    htmp = zeros (nc, 1);
+
+    for c = nc:-1:1
+      zz = [y(:,c), y(:,c)];
+      yy = x(:,c);
+      xx = [c - width / 2, c + width / 2];
+      [xx, yy] = meshgrid (xx, yy);
+      cc = repmat (c, size (zz));
+      htmp(c) = surface (xx, yy, zz, cc);
+    endfor
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30], "box", "off", 
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = sombrero ();
+%! ribbon (y, z);
+%! title ('ribbon() plot of sombrero()');
+
+%!FIXME: Could have some input validation tests here
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/rose.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,121 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} rose (@var{th})
+## @deftypefnx {Function File} {} rose (@var{th}, @var{nbins})
+## @deftypefnx {Function File} {} rose (@var{th}, @var{bins})
+## @deftypefnx {Function File} {} rose (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} rose (@dots{})
+## @deftypefnx {Function File} {[@var{thout} @var{rout}] =} rose (@dots{})
+## Plot an angular histogram.
+##
+## With one vector argument, @var{th}, plot the histogram with 20 angular bins.
+## If @var{th} is a matrix then each column of @var{th} produces a separate
+## histogram.
+##
+## If @var{nbins} is given and is a scalar, then the histogram is produced with
+## @var{nbin} bins.  If @var{bins} is a vector, then the center of each bin is
+## defined by the values of @var{bins} and the number of bins is
+## given by the number of elements in @var{bins}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## line objects representing each histogram.
+##
+## If two output arguments are requested then no plot is made and 
+## the polar vectors necessary to plot the histogram are returned instead.
+##
+## @example
+## @group
+## [th, r] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
+## polar (th, r);
+## @end group
+## @end example
+##
+## @seealso{hist, polar}
+## @end deftypefn
+
+function [thout, rout] = rose (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("rose", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  ## Force theta to [0,2*pi] range
+  th = varargin{1};
+  th = atan2 (sin (th), cos (th)) + pi;
+
+  if (nargin > 1)
+    x = varargin{2};
+    if (isscalar (x))
+      x = [0.5/x : 1/x : 1] * 2*pi;
+    else
+      ## Force theta to [0,2*pi] range
+      x = atan2 (sin (x), cos (x)) + pi;
+    endif
+  else
+    x = [1/40 : 1/20 : 1] * 2*pi;
+  endif
+
+  [nn, xx] = hist (th, x);
+  xx = xx(:).';
+  if (isvector (nn))
+    nn = nn(:);
+  endif
+  x1 = xx(1:end-1) + diff (xx, 1) / 2;
+  x1 = [x1 ; x1; x1; x1](:);
+  th = [0; 0; x1; 2*pi ; 2*pi];
+  r = zeros (4 * rows (nn), columns (nn));
+  r(2:4:end, :) = nn;
+  r(3:4:end, :) = nn;
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      htmp = polar (th, r);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+
+    if (nargout > 0)
+      thout = htmp;
+    endif
+  else
+    thout = th;
+    rout = r;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
+%! title ('rose() angular histogram plot');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/scatter.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,217 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} scatter (@var{x}, @var{y})
+## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s})
+## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c})
+## @deftypefnx {Function File} {} scatter (@dots{}, @var{style})
+## @deftypefnx {Function File} {} scatter (@dots{}, "filled")
+## @deftypefnx {Function File} {} scatter (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} scatter (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} scatter (@dots{})
+## Draw a 2-D scatter plot.
+##
+## A marker is plotted at each point defined by the coordinates in the vectors
+## @var{x} and @var{y}.
+##
+## The size of the markers is determined by @var{s}, which can be a scalar
+## or a vector of the same length as @var{x} and @var{y}.  If @var{s}
+## is not given, or is an empty matrix, then a default value of 8 points is
+## used.
+##
+## The color of the markers is determined by @var{c}, which can be a string
+## defining a fixed color; a 3-element vector giving the red, green, and blue
+## components of the color; a vector of the same length as @var{x} that gives
+## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
+## the RGB color of each marker individually.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+## If no marker is specified it defaults to @qcode{"o"} or circles.
+## If the argument @qcode{"filled"} is given then the markers are filled.
+##
+## Additional property/value pairs are passed directly to the underlying
+## patch object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## 
+## Example:
+##
+## @example
+## @group
+## x = randn (100, 1);
+## y = randn (100, 1);
+## scatter (x, y, [], sqrt (x.^2 + y.^2));
+## @end group
+## @end example
+##
+## @seealso{scatter3, patch, plot}
+## @end deftypefn
+
+function retval = scatter (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = __scatter__ (hax, 2, "scatter", varargin{:});
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! scatter (x, y, 'r');
+%! title ('scatter() plot with red bubbles');
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! c = x .* y;
+%! scatter (x, y, 20, c, 'filled');
+%! title ('scatter() with colored filled bubbles');
+
+%!demo
+%! clf;
+%! x = randn (100, 1);
+%! y = randn (100, 1);
+%! scatter (x, y, [], sqrt (x.^2 + y.^2));
+%! title ({'scatter() plot'; ...
+%!         'bubble color determined by distance from origin'});
+
+%!demo
+%! clf;
+%! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
+%! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
+%! x = rand_10x1_data5;
+%! y = rand_10x1_data6;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, [], 'r', 's');
+%! title ({'scatter() plot'; ...
+%!         'marker is square, color is red'});
+
+%!demo
+%! clf;
+%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726];
+%! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
+%! x = rand_10x1_data3;
+%! y = rand_10x1_data4;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, [], 'r', 's', 'filled');
+%! title ({'scatter() plot'; ...
+%!         'marker is square, marker is filled, color is red'});
+
+%!demo
+%! clf;
+%! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
+%! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
+%! x = rand_10x1_data1;
+%! y = rand_10x1_data2;
+%! s = 10 - 10*log (x.^2 + y.^2);
+%! h = scatter (x, y, s, s, 's', 'filled');
+%! title ({'scatter() plot with filled square markers', ...
+%!         'size and color of markers determined by algorithm'});
+
+%!demo
+%! clf;
+%! k = 1;
+%! for m = [1, 3]
+%!   for n = [101, 50, 1]
+%!     x = rand (n, 1);
+%!     y = rand (n, 1);
+%!     if (m > 1)
+%!       str = 'Three Colors';
+%!       idx = ceil (rand (n, 1) * 3);
+%!       colors = eye (3);
+%!       colors = colors(idx, :);
+%!     else
+%!       str = 'Random Colors';
+%!       colors = rand (n, m);
+%!     end
+%!     if (n == 1)
+%!       str = sprintf ('%s: 1 point', str);
+%!     elseif (n < 100)
+%!       str = sprintf ('%s: < 100 points', str);
+%!     else
+%!       str = sprintf ('%s: > 100 points', str);
+%!     end
+%!     subplot (2,3,k);
+%!     k = k + 1;
+%!     scatter (x, y, 15, colors, 'filled');
+%!     axis ([0 1 0 1]);
+%!     title (str);
+%!   end
+%! end
+
+%!demo
+%! clf;
+%! k = 1;
+%! for m = [1, 3]
+%!   for n = [101, 50, 1]
+%!     x = rand (n, 1);
+%!     y = rand (n, 1);
+%!     if (m > 1)
+%!       str = 'Three Colors';
+%!       idx = ceil (rand (n, 1) * 3);
+%!       colors = eye (3);
+%!       colors = colors(idx, :);
+%!     else
+%!       str = 'Random Colors';
+%!       colors = rand (n, m);
+%!     end
+%!     if (n == 1)
+%!       str = sprintf ('%s: 1 point', str);
+%!     elseif (n < 100)
+%!       str = sprintf ('%s: < 100 points', str);
+%!     else
+%!       str = sprintf ('%s: > 100 points', str);
+%!     end
+%!     subplot (2,3,k);
+%!     k = k + 1;
+%!     scatter (x, y, 15, colors);
+%!     axis ([0 1 0 1]);
+%!     title (str);
+%!   end
+%! end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/scatter3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,129 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} scatter3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s})
+## @deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
+## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
+## @deftypefnx {Function File} {} scatter3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})
+## @deftypefnx {Function File} {} scatter3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{})
+## Draw a 3-D scatter plot.
+##
+## A marker is plotted at each point defined by the coordinates in the vectors
+## @var{x}, @var{y}, and @var{z}.
+##
+## The size of the markers is determined by @var{s}, which can be a scalar
+## or a vector of the same length as @var{x}, @var{y}, and @var{z}.  If @var{s}
+## is not given, or is an empty matrix, then a default value of 8 points is
+## used.
+##
+## The color of the markers is determined by @var{c}, which can be a string
+## defining a fixed color; a 3-element vector giving the red, green, and blue
+## components of the color; a vector of the same length as @var{x} that gives
+## a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
+## the RGB color of each marker individually.
+##
+## The marker to use can be changed with the @var{style} argument, that is a
+## string defining a marker in the same manner as the @code{plot} command.
+## If no marker is specified it defaults to @qcode{"o"} or circles.
+## If the argument @qcode{"filled"} is given then the markers are filled.
+##
+## Additional property/value pairs are passed directly to the underlying
+## patch object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the hggroup
+## object representing the points.
+##
+## @example
+## @group
+## [x, y, z] = peaks (20);
+## scatter3 (x(:), y(:), z(:), [], z(:));
+## @end group
+## @end example
+##
+## @seealso{scatter, patch, plot}
+## @end deftypefn
+
+function retval = scatter3 (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:});
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = __scatter__ (hax, 3, "scatter3", varargin{:});
+
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [x, y, z] = peaks (20);
+%! scatter3 (x(:), y(:), z(:), [], z(:));
+%! title ({'Default scatter3() plot', ...
+%!         'constant size bubbles and color determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 10, z(:), 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size is 10, color determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 20*z(:), [], 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size is determined by Z'});
+
+%!demo
+%! clf;
+%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
+%! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), 's');
+%! title ({'scatter3() plot', ...
+%!         'marker is square, size and color determined by Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogx.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,133 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogx (@var{y})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} semilogx (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} semilogx (@dots{})
+## Produce a 2-D plot using a logarithmic scale for the x-axis.
+##
+## See the documentation of @code{plot} for a description of the
+## arguments that @code{semilogx} will accept.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogy, loglog}
+## @end deftypefn
+
+## Author: jwe
+
+function h = semilogx (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on");
+    endif
+
+    htmp = __plt__ ("semilogx", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 1:0.01:10;
+%! y = (x .* (1 + rand (size (x)))) .^ 2;
+%! semilogx (y, x);
+%! title ({'semilogx() plot', 'X-axis is logarithmic'});
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  semilogx (x, y);
+%!  xlabel ('semilogx (x, y)');
+%!
+%! subplot (1,2,2);
+%!  semilogx (-x, y);
+%!  xlabel ('semilogx (-x, y)');
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (1,2,1);
+%!  semilogx (x, y);
+%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  xlabel ({'semilogx (x, y)', 'xdir = reversed'});
+%!
+%! subplot (1,2,2);
+%!  semilogx (-x, y);
+%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  xlabel ({'semilogx (-x, y)', 'xdir = reversed'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogx (a, b);
+%!   assert (get (gca, "xscale"), "log");
+%!   assert (get (gca, "yscale"), "linear");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a =-logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogx (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "xtick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogxerr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,89 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogxerr (@var{args})
+## @deftypefnx {Function File} {} semilogxerr (@var{hax}, @var{args})
+## @deftypefnx {Function File} {@var{h} =} semilogxerr (@var{args})
+## Produce 2-D plots using a logarithmic scale for the x-axis and
+## errorbars at each data point.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a semi-logarithmic plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## @seealso{errorbar, semilogyerr, loglogerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = semilogxerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "xscale", "log");
+    if (! ishold (hax))
+      set (hax, "xminortick", "on");
+    endif
+
+    htmp = __errcomm__ ("semilogxerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = exp (log (0.01):0.2:log (10));
+%! y = wblpdf (x, 2, 2);
+%! ey = 0.5*rand (size (y)) .* y;
+%! semilogxerr (x, y, ey, '#~x-');
+%! xlim (x([1, end]));
+%! title ({'semilogxerr(): semilogx() plot with errorbars', ...
+%!         'X-axis is logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogy.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,133 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogy (@var{y})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
+## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
+## Produce a 2-D plot using a logarithmic scale for the y-axis.
+##
+## See the documentation of @code{plot} for a description of the
+## arguments that @code{semilogy} will accept.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created plot.
+## @seealso{plot, semilogx, loglog}
+## @end deftypefn
+
+## Author: jwe
+
+function h = semilogy (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:});
+
+  if (nargs < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "yminortick", "on");
+    endif
+
+    htmp = __plt__ ("semilogy", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 1:0.01:10;
+%! y = (x .* (1 + rand (size (x)))) .^ 2;
+%! semilogy (x, y);
+%! title ({'semilogx() plot', 'Y-axis is logarithmic'});
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (2,1,1);
+%!  semilogy (x, y);
+%!  ylabel ('semilogy (x, y)');
+%!
+%! subplot (2,1,2);
+%!  semilogy (x, -y);
+%!  ylabel ('semilogy (x, -y)');
+
+%!demo
+%! clf;
+%! x = logspace (-5, 1, 10);
+%! y = logspace (-5, 1, 10);
+%!
+%! subplot (2,1,1);
+%!  semilogy (x, y);
+%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  ylabel ({'semilogy (x, y)', 'ydir = reversed'});
+%!
+%! subplot (2,1,2);
+%!  semilogy (x, -y);
+%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
+%!  ylabel ({'semilogy (x, -y)', 'ydir = reversed'});
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b = logspace (-5, 1, 10);
+%!   semilogy (a, b);
+%!   assert (get (gca, "yscale"), "log");
+%!   assert (get (gca, "xscale"), "linear");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   a = logspace (-5, 1, 10);
+%!   b =-logspace (-5, 1, 10);
+%!   semilogy (a, b);
+%!   axis tight;
+%!   assert (all (get (gca, "ytick") < 0));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/semilogyerr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,90 @@
+## Copyright (C) 2000-2012 Teemu Ikonen
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} semilogyerr (@var{args})
+## @deftypefnx {Function File} {} semilogyerr (@var{hax}, @var{args})
+## @deftypefnx {Function File} {@var{h} =} semilogyerr (@var{args})
+## Produce 2-D plots using a logarithmic scale for the y-axis and
+## errorbars at each data point.
+##
+## Many different combinations of arguments are possible.  The most common
+## form is
+##
+## @example
+## semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
+## @end example
+##
+## @noindent
+## which produces a semi-logarithmic plot of @var{y} versus @var{x}
+## with errors in the @var{y}-scale defined by @var{ey} and the plot
+## format defined by @var{fmt}.  @xref{XREFerrorbar,,errorbar}, for available
+## formats and additional information.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## @seealso{errorbar, semilogxerr, loglogerr}
+## @end deftypefn
+
+## Created: 20.2.2001
+## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
+## Keywords: errorbar, plotting
+
+function h = semilogyerr (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    set (hax, "yscale", "log");
+    if (! ishold (hax))
+      set (hax, "yminortick", "on");
+    endif
+
+    htmp = __errcomm__ ("semilogyerr", hax, varargin{:});
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0.25:0.25:10;
+%! y = wblpdf (x, 4, 2);
+%! eyu = rand (size (y));
+%! eyl = 1.0 - 1./(1+eyu);
+%! semilogyerr (x, y, eyl.*y, eyu.*y, '~-d');
+%! xlim ([0 10]);
+%! title ({'semilogyerr(): semilogy() plot with errorbars', ...
+%!         'Y-axis is logarithmic'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/shrinkfaces.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,218 @@
+## Copyright (C) 2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} shrinkfaces (@var{p}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{p}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{fv}, @var{sf})
+## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{f}, @var{v}, @var{sf})
+## @deftypefnx {Function File} {[@var{nf}, @var{nv}] =} shrinkfaces (@dots{})
+##
+## Reduce the faces area for a given patch, structure or explicit faces
+## and points matrices by a scale factor @var{sf}.  The structure
+## @var{fv} must contain the fields @qcode{"faces"} and @qcode{"vertices"}. 
+## If the factor @var{sf} is omitted then a default of 0.3 is used.
+##
+## Given a patch handle as the first input argument and no output
+## parameters, perform the shrinking of the patch faces in place and
+## redraw the patch.
+##
+## If called with one output argument, return a structure with fields
+## @qcode{"faces"}, @qcode{"vertices"}, and @qcode{"facevertexcdata"}
+## containing the data after shrinking which can then directly be used as an
+## input argument for the @code{patch} function.
+##
+## Performing the shrinking on faces which are not convex can lead to
+## undesired results.
+##
+## For example,
+##
+## @example
+## @group
+## [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
+## tri = delaunay (phi(:), r(:));
+## v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
+## clf ()
+## p = patch ("Faces", tri, "Vertices", v, "FaceColor", "none");
+## fv = shrinkfaces (p);
+## patch (fv)
+## axis equal
+## grid on
+## @end group
+## @end example
+##
+## @noindent
+## draws a triangulated 3/4 circle and the corresponding shrunken
+## version.
+## @seealso{patch}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function [nf, nv] = shrinkfaces (varargin)
+
+  if (nargin < 1 || nargin > 3 || nargout > 2)
+    print_usage ();
+  endif
+  
+  sf = 0.3;
+  p = varargin{1};
+  colors = [];
+
+  if (ishandle (p) && nargin < 3)
+    faces = get (p, "Faces");
+    vertices = get (p, "Vertices");
+    colors = get (p, "FaceVertexCData");
+    if (nargin == 2)
+      sf = varargin{2};
+    endif
+  elseif (isstruct (p) && nargin < 3)
+    faces = p.faces;
+    vertices = p.vertices;
+    if (isfield (p, "facevertexcdata"))
+      colors = p.facevertexcdata;
+    endif
+    if (nargin == 2)
+      sf = varargin{2};
+    endif
+  elseif (ismatrix (p) && nargin >= 2 && ismatrix (varargin{2}))
+    faces = p;
+    vertices = varargin{2};
+    if (nargin == 3)
+      sf = varargin{3};
+    endif
+  else
+    print_usage ();
+  endif
+  
+  if (! isscalar (sf) || sf <= 0)
+    error ("shrinkfaces: scale factor must be a positive scalar");
+  endif
+
+  n = columns (vertices);
+  if (n < 2 || n > 3)
+    error ("shrinkfaces: only 2-D and 3-D patches are supported");
+  endif
+
+  m = columns (faces);
+  if (m < 3)
+    error ("shrinkfaces: faces must consist of at least 3 vertices");
+  endif
+
+  v = vertices(faces'(:), :);
+  if (isempty (colors) || rows (colors) == rows (faces))
+    c = colors;
+  elseif (rows (colors) == rows (vertices))
+    c = colors(faces'(:), :);
+  else
+    ## Discard inconsistent color data.
+    c = [];
+  endif
+  sv = rows (v);
+  ## we have to deal with a probably very large number of vertices, so
+  ## use sparse we use as midpoint (1/m, ..., 1/m) in generalized
+  ## barycentric coordinates.
+  midpoints = full (kron ( speye (sv / m), ones (m, m) / m) * sparse (v));
+  v = sqrt (sf) * (v - midpoints) + midpoints;
+  f = reshape (1:sv, m, sv / m)';
+  
+  switch (nargout)
+    case 0
+      if (ishandle (p))
+        ## avoid exceptions
+        set (p, "FaceVertexCData", [], "CData", []);
+        set (p, "Vertices", v, "Faces", f, "FaceVertexCData", c);
+      else
+        nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
+      endif
+    case 1
+      nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
+    case 2
+      nf = f;
+      nv = v;
+  endswitch
+
+endfunction
+
+
+%!demo
+%! clf;
+%! faces = [1 2 3; 1 3 4];
+%! vertices = [0 0; 1 0; 1 1; 0 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+
+%!demo
+%! clf;
+%! faces = [1 2 3 4; 5 6 7 8];
+%! vertices = [0 0; 1 0; 2 1; 1 1; 2 0; 3 0; 4 1; 3.5 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+
+%!demo
+%! clf;
+%! faces = [1 2 3 4];
+%! vertices = [-1 2; 0 0; 1 2; 0 1];
+%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
+%! fv = shrinkfaces (faces, vertices, 0.25);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+%! title 'faces which are not convex are clearly not allowed'
+
+%!demo
+%! clf;
+%! [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
+%! tri = delaunay (phi(:), r(:));
+%! v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
+%! p = patch ('Faces', tri, 'Vertices', v, 'FaceColor', 'none');
+%! fv = shrinkfaces (p);
+%! patch (fv);
+%! axis equal;
+%! grid on;
+
+%!demo
+%! clf;
+%! N = 10;  % N intervals per axis
+%! [x, y, z] = meshgrid (linspace (-4,4,N+1));
+%! val = x.^3 + y.^3 + z.^3;
+%! fv = isosurface (x, y, z, val, 3, z);
+%!
+%! p = patch ('Faces', fv.faces, 'Vertices', fv.vertices, 'FaceVertexCData', ...
+%!            fv.facevertexcdata, 'FaceColor', 'interp', 'EdgeColor', 'black');
+%! axis equal;
+%! view (115, 30);
+%! drawnow;
+%! shrinkfaces (p, 0.6);
+
+%!shared faces, vertices, nfv, nfv2
+%! faces = [1 2 3];
+%! vertices = [0 0 0; 1 0 0; 1 1 0];
+%! nfv = shrinkfaces (faces, vertices, 0.7);
+%! nfv2 = shrinkfaces (nfv, 1/0.7);
+%!assert (isfield (nfv, "faces"))
+%!assert (isfield (nfv, "vertices"))
+%!assert (size (nfv.faces), [1 3])
+%!assert (size (nfv.vertices), [3 3])
+%!assert (norm (nfv2.vertices - vertices), 0, 2*eps)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/slice.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,217 @@
+## Copyright (C) 2007-2012 Kai Habel, David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
+## @deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
+## @deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
+## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
+## @deftypefnx {Function File} {} slice (@dots{}, @var{method})
+## @deftypefnx {Function File} {} slice (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} slice (@dots{})
+## Plot slices of 3-D data/scalar fields.
+##
+## Each element of the 3-dimensional array @var{v} represents a scalar value at
+## a location given by the parameters @var{x}, @var{y}, and @var{z}.  The
+## parameters @var{x}, @var{x}, and @var{z} are either 3-dimensional arrays of
+## the same size as the array @var{v} in the @qcode{"meshgrid"} format or
+## vectors.  The parameters @var{xi}, etc. respect a similar format to
+## @var{x}, etc., and they represent the points at which the array @var{vi}
+## is interpolated using interp3.  The vectors @var{sx}, @var{sy}, and
+## @var{sz} contain points of orthogonal slices of the respective axes.
+##
+## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
+## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
+## @code{z = 1:size (@var{v}, 3)}.
+##
+## @var{method} is one of:
+##
+## @table @asis
+## @item @qcode{"nearest"}
+## Return the nearest neighbor.
+##
+## @item @qcode{"linear"}
+## Linear interpolation from nearest neighbors.
+##
+## @item @qcode{"cubic"}
+## Cubic interpolation from four nearest neighbors (not implemented yet).
+##
+## @item @qcode{"spline"}
+## Cubic spline interpolation---smooth first and second derivatives
+## throughout the curve.
+## @end table
+##
+## The default method is @qcode{"linear"}.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Examples:
+##
+## @example
+## @group
+## [x, y, z] = meshgrid (linspace (-8, 8, 32));
+## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+## slice (x, y, z, v, [], 0, []);
+##
+## [xi, yi] = meshgrid (linspace (-7, 7));
+## zi = xi + yi;
+## slice (x, y, z, v, xi, yi, zi);
+## @end group
+## @end example
+## @seealso{interp3, surface, pcolor}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = slice (varargin)
+
+  [hax, varargin, nargs] = __plt_get_axis_arg__ ("slice", varargin{:});
+
+  method = "linear";
+
+  if (ischar (varargin{end}))
+    method = varargin{end};
+    nargs -= 1;
+  endif
+
+  if (nargs == 4)
+    v = varargin{1};
+    if (ndims (v) != 3)
+      error ("slice: V must be a 3-dimensional array of values");
+    endif
+    [nx, ny, nz] = size (v);
+    [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz);
+    sx = varargin{2};
+    sy = varargin{3};
+    sz = varargin{4};
+  elseif (nargs == 7)
+    v = varargin{4};
+    if (ndims (v) != 3)
+      error ("slice: V must be a 3-dimensional array of values");
+    endif
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    if (isvector (x) && isvector (y) && isvector (z))
+      [x, y, z] = meshgrid (x, y, z);
+    elseif (ndims (x) == 3 && size_equal (x, y, z))
+      ## Do nothing.
+    else
+      error ("slice: X, Y, Z size mismatch");
+    endif
+    sx = varargin{5};
+    sy = varargin{6};
+    sz = varargin{7};
+  else
+    print_usage ();
+  endif
+
+  if (any ([isvector(sx), isvector(sy), isvector(sz)]))
+    have_sval = true;
+  elseif (ndims (sx) == 2 && size_equal (sx, sy, sz))
+    have_sval = false;
+  else
+    error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    sidx = 1;
+    minv = min (v(:));
+    maxv = max (v(:));
+    set (hax, "clim", [minv, maxv]);
+
+    if (have_sval)
+      ns = length (sx) + length (sy) + length (sz);
+      hs = zeros (ns,1);
+      [ny, nx, nz] = size (v);
+      if (length (sz) > 0)
+        for i = 1:length (sz)
+          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
+                                   squeeze (y(:,1,1)), sz(i));
+          vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (xi, yi, sz(i) * ones (size (yi)), vz);
+        endfor
+      endif
+
+      if (length (sy) > 0)
+        for i = length (sy):-1:1
+          [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:)));
+          vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (squeeze (xi),
+                                  squeeze (sy(i) * ones (size (zi))),
+                                  squeeze (zi), vy);
+        endfor
+      endif
+
+      if (length (sx) > 0)
+        for i = length (sx):-1:1
+          [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:)));
+          vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
+          htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))),
+                                  squeeze (yi), squeeze(zi), vx);
+        endfor
+      endif
+    else
+      vi = interp3 (x, y, z, v, sx, sy, sz);
+      htmp = surface (sx, sy, sz, vi);
+    endif
+
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30.0], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
+%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+%! slice (x, y, z, v, [], 0, []);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
+%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
+%! [xi, yi] = meshgrid (linspace (-7, 7));
+%! zi = xi + yi;
+%! slice (x, y, z, v, xi, yi, zi);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/sombrero.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,86 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} sombrero ()
+## @deftypefnx {Function File} {} sombrero (@var{n})
+## @deftypefnx {Function File} {@var{z} =} sombrero (@dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sombrero (@dots{})
+## Plot the familiar 3-D sombrero function.
+##
+## The function plotted is
+## @tex
+## $$z = { \rm{sin} (\sqrt {(x^2 + y^2)}) \over \sqrt {(x^2 + y^2)} }$$
+## @end tex
+## @ifnottex
+##
+## @example
+## z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
+## @end example
+##
+## @end ifnottex
+## Called without a return argument, @code{sombrero} plots the surface of the
+## above function over the meshgrid [-8,8] using @code{surf}.
+## 
+## If @var{n} is a scalar the plot is made with @var{n} grid lines.
+## The default value for @var{n} is 41.
+##
+## When called with output arguments, return the data for the function
+## evaluated over the meshgrid.  This can subsequently be plotted with
+## @code{surf (@var{x}, @var{y}, @var{z})}.
+##
+## @seealso{peaks, meshgrid, mesh, surf}
+## @end deftypefn
+
+## Author: jwe
+
+function [x, y, z] = sombrero (n = 41)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (n <= 1)
+    error ("sombrero: number of grid lines N must be greater than 1");
+  endif
+
+  [xx, yy] = meshgrid (linspace (-8, 8, n));
+  r = sqrt (xx.^2 + yy.^2) + eps;  # eps prevents div/0 errors
+  zz = sin (r) ./ r;
+
+  if (nargout == 0)
+    surf (xx, yy, zz);
+  elseif (nargout == 1)
+    x = zz;
+  else
+    x = xx;
+    y = yy;
+    z = zz;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! sombrero ();
+%! title ('sombrero() function');
+
+## Test input validation
+%!error sombrero (1,2,3)
+%!error <N must be greater than 1> sombrero (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/sphere.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,90 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} sphere ()
+## @deftypefnx {Function File} {} sphere (@var{n})
+## @deftypefnx {Function File} {} sphere (@var{hax}, @dots{})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@dots{})
+## Plot a 3-D unit sphere.
+##
+## The optional input @var{n} determines the number of faces around the
+## the circumference of the sphere.  The default value is 20.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## If outputs are requested @code{sphere} returns three matrices in
+## @code{meshgrid} format such that @code{surf (@var{x}, @var{y}, @var{z})}
+## generates a unit sphere.
+##
+## Example:
+##
+## @example
+## @group
+## [x, y, z] = sphere (40);
+## surf (3*x, 3*y, 3*z);
+## axis equal;
+## title ("sphere of radius 3");
+## @end group
+## @end example
+## @seealso{cylinder, ellipsoid, rectangle}
+## @end deftypefn
+
+function [xx, yy, zz] = sphere (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("sphere", varargin{:});
+
+  if (nargin > 1)
+    print_usage ();
+  elseif (nargin == 1)
+    n = varargin{1};
+  else
+    n = 20;
+  endif
+
+  theta = linspace (0, 2*pi, n+1);
+  phi = linspace (-pi/2, pi/2, n+1);
+  [theta,phi] = meshgrid (theta, phi);
+
+  x = cos (phi) .* cos (theta);
+  y = cos (phi) .* sin (theta);
+  z = sin (phi);
+
+  if (nargout > 0)
+    xx = x;
+    yy = y;
+    zz = z;
+  else
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+    
+      surf (x, y, z);
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stairs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,332 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stairs (@var{y})
+## @deftypefnx {Function File} {} stairs (@var{x}, @var{y})
+## @deftypefnx {Function File} {} stairs (@dots{}, @var{style})
+## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stairs (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stairs (@dots{})
+## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
+## Produce a stairstep plot.
+##
+## The arguments @var{x} and @var{y} may be vectors or matrices.
+## If only one argument is given, it is taken as a vector of Y values
+## and the X coordinates are taken to be the indices of the elements.
+## 
+## The style to use for the plot can be defined with a line style @var{style}
+## of the same format as the @code{plot} command.
+##
+## Multiple property/value pairs may be specified, but they must appear in
+## pairs.
+##
+## If the first argument @var{hax} is an axis handle, then plot into this axis,
+## rather than the current axis handle returned by @code{gca}.
+##
+## If one output argument is requested, return a graphics handle to the
+## created plot.  If two output arguments are specified, the data are generated
+## but not plotted.  For example,
+##
+## @example
+## stairs (x, y);
+## @end example
+##
+## @noindent
+## and
+##
+## @example
+## @group
+## [xs, ys] = stairs (x, y);
+## plot (xs, ys);
+## @end group
+## @end example
+##
+## @noindent
+## are equivalent.
+## @seealso{bar, hist, plot, stem}
+## @end deftypefn
+
+## Author: jwe
+
+function [xs, ys] = stairs (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  if (nargout < 2)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      [htmp, xxs, yys] = __stairs__ (true, varargin{:});
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+    if (nargout == 1)
+      xs = htmp;
+    endif
+  else
+    [~, xs, ys] = __stairs__ (false, varargin{:});
+  endif
+
+endfunction
+
+function [h, xs, ys] = __stairs__ (doplot, varargin)
+
+  if (nargin == 2 || ischar (varargin{2}))
+    y = varargin{1};
+    varargin(1) = [];
+    if (! ismatrix (y) || ndims (y) > 2)
+      error ("stairs: Y must be a numeric 2-D vector or matrix");
+    endif
+    if (isvector (y))
+      y = y(:);
+    endif
+    x = 1:rows (y);
+  else
+    x = varargin{1};
+    y = varargin{2};
+    varargin(1:2) = [];
+    if (! ismatrix (x) || ! ismatrix (y) || ndims (x) > 2 || ndims (y) > 2)
+      error ("stairs: X and Y must be numeric 2-D vectors or matrices");
+    endif
+  endif
+
+  vec_x = isvector (x);
+  if (vec_x)
+    x = x(:);
+  endif
+
+  if (isvector (y))
+    y = y(:);
+  elseif (ismatrix (y) && vec_x)
+    x = repmat (x, [1, columns(y)]);
+  endif
+
+  if (! size_equal (x, y))
+    error ("stairs: X and Y sizes must match");
+  endif
+
+  [nr, nc] = size (y);
+
+  len = 2*nr - 1;
+
+  xs = ys = zeros (len, nc);
+
+  xs(1,:) = x(1,:);
+  ys(1,:) = y(1,:);
+
+  xtmp = x(2:nr,:);
+  ridx = 2:2:len-1;
+  xs(ridx,:) = xtmp;
+  ys(ridx,:) = y(1:nr-1,:);
+
+  ridx = 3:2:len;
+  xs(ridx,:) = xtmp;
+  ys(ridx,:) = y(2:nr,:);
+
+  have_line_spec = false;
+  for i = 1:2:numel (varargin)
+    arg = varargin{i};
+    if (ischar (arg) || iscellstr (arg))
+      [linespec, valid] = __pltopt__ ("stairs", arg, false);
+      if (valid)
+        have_line_spec = true;
+        varargin(i) = [];
+        break;
+      endif
+    endif
+  endfor
+
+  if (doplot)
+    h = [];
+    hold_state = get (gca (), "nextplot");
+    unwind_protect
+      for i = 1 : columns (y)
+
+        if (have_line_spec)
+          lc = linespec.color;
+          if (isempty (lc))
+            lc = __next_line_color__ ();
+          endif
+          ls = linespec.linestyle;
+          if (isempty (ls))
+            ls = "-";
+          endif
+          mk = linespec.marker;
+          if (isempty (mk))
+            mk = "none";
+          endif
+        else
+          lc = __next_line_color__ ();
+          ls = "-";
+          mk = "none";
+        endif
+
+        ## Must occur after __next_line_color__ in order to work correctly.
+        hg = hggroup ();
+        h = [h; hg];
+        args = __add_datasource__ ("stairs", hg, {"x", "y"}, varargin{:});
+
+        addproperty ("xdata", hg, "data", x(:,i).');
+        addproperty ("ydata", hg, "data", y(:,i).');
+
+        addlistener (hg, "xdata", @update_data);
+        addlistener (hg, "ydata", @update_data);
+
+        htmp = line (xs(:,i).', ys(:,i).', "color", lc, "linestyle", ls,
+                                           "marker", mk, "parent", hg);
+
+        addproperty ("color", hg, "linecolor", get (htmp, "color"));
+        addproperty ("linestyle", hg, "linelinestyle", get (htmp, "linestyle"));
+        addproperty ("linewidth", hg, "linelinewidth", get (htmp, "linewidth"));
+
+        addproperty ("marker", hg, "linemarker", get (htmp, "marker"));
+        addproperty ("markeredgecolor", hg, "linemarkeredgecolor",
+                     get (htmp, "markeredgecolor"));
+        addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
+                     get (htmp, "markerfacecolor"));
+        addproperty ("markersize", hg, "linemarkersize",
+                     get (htmp, "markersize"));
+
+        addlistener (hg, "color", @update_props);
+        addlistener (hg, "linestyle", @update_props);
+        addlistener (hg, "linewidth", @update_props);
+        addlistener (hg, "marker", @update_props);
+        addlistener (hg, "markeredgecolor", @update_props);
+        addlistener (hg, "markerfacecolor", @update_props);
+        addlistener (hg, "markersize", @update_props);
+
+        ## Matlab property, although Octave does not implement it.
+        addproperty ("hittestarea", hg, "radio", "on|{off}", "off");
+
+        if (! isempty (args))
+          set (hg, args{:});
+        endif
+      endfor
+    unwind_protect_cleanup
+      set (gca (), "nextplot", hold_state);
+    end_unwind_protect
+  else
+    h = 0;
+  endif
+
+endfunction
+
+function update_props (h, ~)
+  set (get (h, "children"),
+       {"color", "linestyle", "linewidth", "marker", ...
+        "markeredgecolor", "markerfacecolor", "markersize"},
+       get (h, {"color", "linestyle", "linewidth", "marker", ...
+                "markeredgecolor", "markerfacecolor", "markersize"}));
+endfunction
+
+function update_data (h, ~)
+  x = get (h, "xdata");
+  y = get (h, "ydata");
+
+  sz = min ([size(x); size(y)]);
+  x = x(1:sz(1), 1:sz(2));
+  y = y(1:sz(1), 1:sz(2));
+
+  nr = length (x);
+  len = 2 * nr - 1;
+  xs = ys = zeros (1, len);
+
+  xs(1) = x(1);
+  ys(1) = y(1);
+
+  xtmp = x(2:nr);
+  ridx = 2:2:len-1;
+  xs(ridx) = xtmp;
+  ys(ridx) = y(1:nr-1);
+
+  ridx = 3:2:len;
+  xs(ridx) = xtmp;
+  ys(ridx) = y(2:nr);
+
+  set (get (h, "children"), "xdata", xs, "ydata", ys);
+endfunction
+
+
+%!demo
+%! clf;
+%! rand_1x10_data1 = [0.073, 0.455, 0.837, 0.124, 0.426, 0.781, 0.004, 0.024, 0.519, 0.698];
+%! y = rand_1x10_data1;
+%! stairs (y);
+%! title ('stairs() plot of y-data');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! rand_1x10_data2 = [0.014, 0.460, 0.622, 0.394, 0.531, 0.378, 0.466, 0.788, 0.342, 0.893];
+%! y = rand_1x10_data2;
+%! [xs, ys] = stairs (x, y);
+%! plot (xs, ys);
+%! title ('plot() of stairs() generated data');
+
+%!demo
+%! clf;
+%! stairs (1:9, '-o');
+%! title ('stairs() plot with linespec to modify marker');
+
+%!demo
+%! clf;
+%! stairs (9:-1:1, 'marker', 's', 'markersize', 10, 'markerfacecolor', 'm');
+%! title ('stairs() plot with prop/val pairs to modify appearance');
+
+%!demo
+%! clf;
+%! N = 11;
+%! x = 0:(N-1);
+%! y = rand (1, N);
+%! hs = stairs (x(1), y(1));
+%! axis ([1, N-1 0, 1]);
+%! title ('stairs plot data modified through handle');
+%! for k = 2:N
+%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k));
+%!   drawnow ();
+%!   pause (0.2);
+%! end
+
+## Invisible figure used for tests
+%!shared hf, hax
+%! hf = figure ("visible", "off");
+%! hax = axes;
+
+%!error stairs ()
+%!error <Y must be a numeric 2-D vector> stairs (hax, {1})
+%!error <Y must be a numeric 2-D vector> stairs (ones (2,2,2))
+%!error <X and Y must be numeric 2-D vector> stairs ({1}, 1)
+%!error <X and Y must be numeric 2-D vector> stairs (1, {1})
+%!error <X and Y must be numeric 2-D vector> stairs (ones (2,2,2), 1)
+%!error <X and Y must be numeric 2-D vector> stairs (1, ones (2,2,2))
+%!error <X and Y sizes must match> stairs (1:2, 1:3)
+
+## Close figure used for testing
+%!test
+%! close (hf);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stem.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,215 @@
+## Copyright (C) 2006-2012 Michel D. Schmid
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stem (@var{y})
+## @deftypefnx {Function File} {} stem (@var{x}, @var{y})
+## @deftypefnx {Function File} {} stem (@dots{}, @var{linespec})
+## @deftypefnx {Function File} {} stem (@dots{}, "filled")
+## @deftypefnx {Function File} {} stem (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stem (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stem (@dots{})
+## Plot a 2-D stem graph.
+##
+## If only one argument is given, it is taken as the y-values and the
+## x-coordinates are taken from the indices of the elements.
+##
+## If @var{y} is a matrix, then each column of the matrix is plotted as
+## a separate stem graph.  In this case @var{x} can either be a vector,
+## the same length as the number of rows in @var{y}, or it can be a
+## matrix of the same size as @var{y}.
+##
+## The default color is @qcode{"b"} (blue), the default line style is
+## @qcode{"-"}, and the default marker is @qcode{"o"}.  The line style can
+## be altered by the @code{linespec} argument in the same manner as the
+## @code{plot} command.  If the @qcode{"filled"} argument is present the
+## markers at the top of the stems will be filled in.  For example,
+##
+## @example
+## @group
+## x = 1:10;
+## y = 2*x;
+## stem (x, y, "r");
+## @end group
+## @end example
+##
+## @noindent
+## plots 10 stems with heights from 2 to 20 in red;
+##
+## Optional property/value pairs may be specified to control the appearance
+## of the plot.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to a @nospell{"stem series"}
+## hggroup.  The single hggroup handle has all of the graphical elements
+## comprising the plot as its children; This allows the properties of
+## multiple graphics objects to be changed by modifying just a single
+## property of the @nospell{"stem series"} hggroup.
+##
+## For example,
+##
+## @example
+## @group
+## x = [0:10]';
+## y = [sin(x), cos(x)]
+## h = stem (x, y);
+## set (h(2), "color", "g");
+## set (h(1), "basevalue", -1)
+## @end group
+## @end example
+##
+## @noindent
+## changes the color of the second @nospell{"stem series"} and moves the base
+## line of the first.
+##
+## Stem Series Properties
+##
+## @table @asis
+## @item linestyle
+## The linestyle of the stem.  (Default: @qcode{"-"})
+##
+## @item linewidth
+## The width of the stem.  (Default: 0.5)
+##
+## @item color
+## The color of the stem, and if not separately specified, the marker.
+## (Default: @qcode{"b"} [blue])
+##
+## @item marker
+## The marker symbol to use at the top of each stem.  (Default: @qcode{"o"})
+##
+## @item markeredgecolor
+## The edge color of the marker.  (Default: @qcode{"color"} property)
+##
+## @item markerfacecolor
+## The color to use for @nospell{"filling"} the marker.  
+## (Default: @qcode{"none"} [unfilled])
+##
+## @item markersize
+## The size of the marker.  (Default: 6)
+##
+## @item baseline
+## The handle of the line object which implements the baseline.  Use @code{set}
+## with the returned handle to change graphic properties of the baseline.
+##
+## @item basevalue
+## The y-value where the baseline is drawn.  (Default: 0)
+## @end table
+## @seealso{stem3, bar, hist, plot, stairs}
+## @end deftypefn
+
+## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
+## Adapted-by: jwe
+
+function h = stem (varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  htmp = __stem__ (false, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! y = 1:10;
+%! stem (y);
+%! title ('stem plot of y-values only');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! stem (x, y);
+%! title ('stem plot of x and y-values');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'r');
+%! title ('stem plot with modified color');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, '-.k');
+%! title ('stem plot with modified line style and color');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, '-.ks');
+%! title ('stem plot with modified line style, color, and marker');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'filled');
+%! title ('stem plot with "filled" markers');
+
+%!demo
+%! clf;
+%! x = 1:10;
+%! y = 2*x;
+%! h = stem (x, y, 'markerfacecolor', [1 0 1]);
+%! title ('stem plot modified with property/value pair');
+
+%!demo
+%! clf;
+%! x = (0 : 10)';
+%! y = [sin(x), cos(x)];
+%! h = stem (x, y);
+%! set (h(2), 'color', 'g');
+%! set (h(1), 'basevalue', -1);
+%! title ('stem plots modified through hggroup handle');
+
+%!demo
+%! clf;
+%! N = 11;
+%! x = 0:(N-1);
+%! y = rand (1, N);
+%! hs = stem (x(1), y(1));
+%! set (gca (), 'xlim', [1, N-1], 'ylim', [0, 1]);
+%! title ('stem plot data modified through hggroup handle');
+%! for k=2:N
+%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k))
+%!   drawnow ();
+%!   pause (0.2);
+%! end
+
+%!error stem ()
+%!error <can not define Z for 2-D stem plot> stem (1,2,3)
+%!error <X and Y must be numeric> stem ({1})
+%!error <X and Y must be numeric> stem (1, {1})
+%!error <inconsistent sizes for X and Y> stem (1:2, 1:3)
+%!error <inconsistent sizes for X and Y> stem (1:2, ones (3,3))
+%!error <inconsistent sizes for X and Y> stem (ones (2,2), ones (3,3))
+%!error <No value specified for property "FOO"> stem (1, "FOO")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stem3.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,92 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stem3 (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} stem3 (@dots{}, @var{linespec})
+## @deftypefnx {Function File} {} stem3 (@dots{}, "filled")
+## @deftypefnx {Function File} {} stem3 (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} stem3 (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} stem3 (@dots{})
+## Plot a 3-D stem graph.
+##
+## Stems are drawn from the height @var{z} to the location in the x-y plane
+## determined by @var{x} and @var{y}.  The default color is @qcode{"b"} (blue),
+## the default line style is @qcode{"-"}, and the default marker is @qcode{"o"}.
+##
+## The line style can be altered by the @code{linespec} argument in the same
+## manner as the @code{plot} command.  If the @qcode{"filled"} argument is
+## present the markers at the top of the stems will be filled in.
+##
+## Optional property/value pairs may be specified to control the appearance
+## of the plot.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a handle to the @nospell{"stem series"}
+## hggroup containing the line and marker objects used for the plot.
+## @xref{XREFstem,,stem}, for a description of the @nospell{"stem series"}
+## object.
+##
+## Example:
+##
+## @example
+## @group
+## theta = 0:0.2:6;
+## stem3 (cos (theta), sin (theta), theta);
+## @end group
+## @end example
+##
+## @noindent
+## plots 31 stems with heights from 0 to 6 lying on a circle.
+##
+## Implementation Note: Color definitions with RGB-triples are not valid.
+## @seealso{stem, bar, hist, plot}
+## @end deftypefn
+
+function h = stem3 (varargin)
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  htmp = __stem__ (true, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! theta = 0:0.2:6;
+%! stem3 (cos (theta), sin (theta), theta);
+%! title ('stem3() plot');
+
+%!error stem3 ()
+%!error <must define X, Y, and Z> stem3 (1,2)
+%!error <X, Y, and Z must be numeric> stem3 ({1}, 1, 1)
+%!error <X, Y, and Z must be numeric> stem3 (1, {1}, 1)
+%!error <X, Y, and Z must be numeric> stem3 (1, 1, {1})
+%!error <inconsistent sizes for X, Y, and Z> stem3 (ones (2,2), 1, 1);
+%!error <inconsistent sizes for X, Y, and Z> stem3 (1, ones (2,2), 1);
+%!error <inconsistent sizes for X, Y, and Z> stem3 (1, 1, ones (2,2));
+%!error <No value specified for property "FOO"> stem3 (1, "FOO")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/stemleaf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,596 @@
+## Copyright (C) 2013 Michael D. Godfrey
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public
+## License as published by the Free Software Foundation;
+## either version 3 of the License, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied
+## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+## PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public
+## License along with Octave; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} stemleaf (@var{x}, @var{caption})
+## @deftypefnx {Function File} {} stemleaf (@var{x}, @var{caption}, @var{stem_sz})
+## @deftypefnx {Function File} {@var{plotstr} =} stemleaf (@dots{})
+## Compute and display a stem and leaf plot of the vector @var{x}.
+##
+## The input @var{x} should be a vector of integers.  Any non-integer values
+## will be converted to integer by @code{@var{x} = fix (@var{x})}.  By default
+## each element of @var{x} will be plotted with the last digit of the element
+## as a leaf value and the remaining digits as the stem.  For example, 123
+## will be plotted with the stem @samp{12} and the leaf @samp{3}.  The second
+## argument, @var{caption}, should be a character array which provides a
+## description of the data.  It is included as a heading for the output.
+##
+## The optional input @var{stem_sz} sets the width of each stem.
+## The stem width is determined by @code{10^(@var{stem_sz} + 1)}.
+## The default stem width is 10.
+##
+## The output of @code{stemleaf} is composed of two parts: a
+## "Fenced Letter Display," followed by the stem-and-leaf plot itself.
+## The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
+## Briefly, the entries are as shown:
+##
+## @example
+## @group
+##
+##         Fenced Letter Display
+## #% nx|___________________     nx = numel (x)
+## M% mi|       md         |     mi median index, md median
+## H% hi|hl              hu| hs  hi lower hinge index, hl,hu hinges,
+## 1    |x(1)         x(nx)|     hs h_spreadx(1), x(nx) first 
+##            _______            and last data value.
+##      ______|step |_______     step 1.5*h_spread
+##     f|ifl            ifh|     inner fence, lower and higher
+##      |nfl            nfh|     no.\ of data points within fences
+##     F|ofl            ofh|     outer fence, lower and higher
+##      |nFl            nFh|     no.\ of data points outside outer
+##                               fences
+## @end group
+## @end example
+##
+## The stem-and-leaf plot shows on each line the stem value followed by the
+## string made up of the leaf digits.  If the @var{stem_sz} is not 1 the
+## successive leaf values are separated by ",".
+##
+## With no return argument, the plot is immediately displayed.  If an output
+## argument is provided, the plot is returned as an array of strings. 
+##
+## The leaf digits are not sorted.  If sorted leaf values are desired, use
+## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}.
+##
+## The stem and leaf plot and associated displays are described in: 
+## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977.
+## @seealso{hist, printd}
+## @end deftypefn
+
+## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
+## Description: Compute stem and leaf plot
+
+function plotstr = stemleaf (x, caption, stem_sz)
+  ## Compute and display a stem and leaf plot of the vector x.  The x
+  ## vector is converted to integer by x = fix(x).  If an output argument
+  ## is provided, the plot is returned as an array of strings.  The
+  ## first element is the heading followed by an element for each stem.
+  ##
+  ## The default stem step is 10.  If stem_sz is provided the stem
+  ## step is set to: 10^(stem_sz+1).  The x vector should be integers.
+  ## It will be treated so that the last digit is the leaf value and the
+  ## other digits are the stems.
+  ##
+  ## When we first implemented stem and leaf plots in the early 1960's
+  ## there was some discussion about sorting vs. leaving the leaf
+  ## entries in the original order in the data.  We decided in favor of
+  ## sorting the leaves for most purposes.  This is the choice
+  ## implemented in the SNAP/IEDA system that was written at that time.
+  ##
+  ## SNAP/IEDA, and particularly its stem and leaf plotting, were further
+  ## developed by Hale Trotter, David Hoagland (at Princeton and MIT),
+  ## and others.
+  ##
+  ## Tukey, in EDA, generally uses unsorted leaves.  In addition, he
+  ## described a wide range of additional display formats.  This
+  ## implementation does not sort the leaves, but if the x vector is
+  ## sorted then the leaves come out sorted.  A simple display format is
+  ## used.
+  ##
+  ## I doubt if providing other options is worthwhile.  The code can
+  ## quite easily be modified to provide specific display results.  Or,
+  ## the returned output string can be edited.  The returned output is an
+  ## array of strings with each row containing a line of the plot
+  ## preceded by the lines of header text as the first row.  This
+  ## facilitates annotation.
+  ##
+  ## Note that the code has some added complexity due to the need to
+  ## distinguish both + and - 0 stems.  The +- stem values are essential
+  ## for all plots which span 0. After dealing with +-0 stems, the added
+  ## complexity of putting +- data values in the correct stem is minor,
+  ## but the sign of 0 leaves must be checked.  And, the cases where the
+  ## stems start or end at +- 0 must also be considered.
+  ##
+  ## The fact that IEEE floating point defines +- 0 helps make this
+  ## easier.
+  ##
+  ## Michael D. Godfrey   January 2013
+
+  ## More could be implemented for better data scaling.  And, of course,
+  ## other options for the kinds of plots described by Tukey could be
+  ## provided.  This may best be left to users.
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (! isvector (x))
+    error ("stemleaf: X must be a vector");
+  endif
+
+  if (isinteger (x))
+    ## Avoid use of integers because rounding rules do not use fix():
+    ## Example: floor (int32 (-44)/10) == -4, floor (int32 (-46)/10) = -5 !!!
+    x = single (x);
+  elseif (isfloat (x))
+    xint = fix (x);
+    if (any (x != xint))
+      warning ("stemleaf: X truncated to integer values");
+      x = xint;
+    endif
+  else
+    error ("stemleaf: X must be a numeric vector");
+  endif
+
+  if (! ischar (caption))
+    error ("stemleaf: CAPTION must be a character array");
+  endif
+
+  if (nargin == 2)
+    stem_step = 10;
+  else
+    if (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz))
+      stem_sz = fix (stem_sz);
+      stem_step = 10^(stem_sz+1);
+    else
+      error ("stemleaf: STEM_SZ must be a real integer >= 0");
+    endif
+  endif
+
+  ## Note that IEEE 754 states that -+ 0 should compare equal. This has
+  ## led to C sort (and therefore Octave) treating them as equal.  Thus,
+  ## sort([-1 0 -0 1]) yields [-1 0 -0 1], and sort([-1 -0 0 1])
+  ## yields: [-1 -0 0 1].  This means that stem-and-leaf plotting cannot
+  ## rely on sort to order the data as needed for display.
+  ## This also applies to min()/max() so these routines can't be relied
+  ## upon if the max or min is -+ 0.
+
+  ## Compute hinges and fences based on ref: EDA pgs. 33 and 44.
+  ## Note that these outlier estimates are meant to be "distribution free".
+
+  nx = numel (x);
+  xs = sort (x);                # Note that sort preserves -0
+  mdidx = fix ((nx + 1)/2);     # median index
+  hlidx = fix ((mdidx + 1)/2);  # lower hinge index
+  huidx = fix (nx + 1 - hlidx); # upper hinge index
+  md = xs(mdidx);               # median
+  hl = xs(hlidx);               # lower hinge
+  hu = xs(huidx);               # upper hinge
+  h_spread = hu - hl;           # h_spread: difference between hinges
+  step = 1.5*h_spread;          # step: 1.5 * h_spread
+  i_fence_l = hl - step;        # inner fences: outside hinges + step
+  o_fence_l = hl - 2*step;      # outer fences: outside hinges + 2*step
+  i_fence_h = hu + step;
+  o_fence_h = hu + 2*step;
+  n_out_l   = sum (x<i_fence_l) - sum (x<o_fence_l);
+  n_out_h   = sum (x>i_fence_h) - sum (x>o_fence_h);
+  n_far_l   = sum (x<o_fence_l);
+  n_far_h   = sum (x>o_fence_h);
+
+  ## display table similar to that on pg. 33
+  plot_out = sprintf ("       Data: %s", caption);
+  plot_out = [plot_out; sprintf(" ")];
+  plot_out = [plot_out; sprintf("         Fenced Letter Display")];
+  plot_out = [plot_out; sprintf(" ")];
+  plot_out = [plot_out; sprintf("     #%3d|___________________", nx)];
+  plot_out = [plot_out; sprintf("     M%3d|       %5d      |", mdidx, md)];
+  plot_out = [plot_out; sprintf("     H%3d|%5d        %5d|   %d", hlidx, hl, hu, h_spread)];
+  plot_out = [plot_out; sprintf("     1   |%5d        %5d|", xs(1), xs(nx))];
+  plot_out = [plot_out; sprintf("               _______")];   
+  plot_out = [plot_out; sprintf("         ______|%5d|_______",step)];
+  plot_out = [plot_out; sprintf("        f|%5d        %5d|", i_fence_l, i_fence_h)];
+  plot_out = [plot_out; sprintf("         |%5d        %5d|  out", n_out_l, n_out_h)];
+  plot_out = [plot_out; sprintf("        F|%5d        %5g|", o_fence_l, o_fence_h)];
+  plot_out = [plot_out; sprintf("         |%5d        %5d|  far",n_far_l,n_far_h)];
+  plot_out = [plot_out; " "];
+
+  ## Determine stem values
+  min_x = min (x);
+  max_x = max (x);
+  if (min_x > 0)      # all stems > 0
+    stems = [fix(min(x)/stem_step) : (fix(max(x)/stem_step)+1)];
+  elseif (max_x < 0)  # all stems < 0
+    stems = [(fix(min_x/stem_step)-1) : fix(max_x/stem_step)];
+  elseif (min_x < 0 && max_x > 0)  # range crosses 0
+    stems = [(fix(min_x/stem_step)-1) : -0, 0 : fix(max_x/stem_step)+1 ];
+  else   # one endpoint is a zero which may be +0 or -0
+    if (min_x == 0)
+      if (any (x == 0 & signbit (x)))
+        min_x = -0;
+      else
+        min_x = +0;
+      endif
+    endif
+    if (max_x == 0)
+      if (any (x == 0 & ! signbit (x)))
+        max_x = +0;
+      else
+        max_x = -0;
+      endif
+    endif
+    stems = [];
+    if (signbit (min_x))
+      stems = [(fix(min_x/stem_step)-1) : -0];
+    endif
+    if (! signbit (max_x))
+      stems = [stems, 0 : fix(max_x/stem_step)+1 ];
+    endif
+  endif
+
+  ## Vectorized version provided by Rik Wehbring (rik@octave.org)
+  ## Determine leaves for each stem:
+  new_line  = 1;
+  for kx = 2: numel (stems)
+
+    stem_sign = signbit (stems(kx));
+    if (stems(kx) <= 0)
+      idx = ((x <= stems(kx)*stem_step) & (x > (stems(kx-1)*stem_step))
+              & (signbit (x) == stem_sign));
+      xlf = abs (x(idx) - stems(kx)*stem_step);
+    else
+      idx = ((x < stems(kx)*stem_step) & (x >= (stems(kx-1)*stem_step))
+              & (signbit (x) == stem_sign));
+      xlf = abs (x(idx) - stems(kx-1)*stem_step);
+    endif
+    ## Convert leaves to a string
+    if (stem_step == 10)
+      lf_str = sprintf ("%d", xlf);
+    else
+      lf_str = "";
+      if (! isempty (xlf))
+        lf_str = sprintf ("%d", xlf(1));
+        if (numel (xlf) > 1)
+          lf_str = [lf_str sprintf(",%d", xlf(2:end))];
+        endif
+      endif
+    endif
+
+    ## Set correct -0
+    if (stems(kx) == 0 && signbit (stems(kx)))
+      line = sprintf ("  -0 | %s",  lf_str);  # -0 stem.
+    elseif (stems(kx) < 0)
+      line = sprintf ("%4d | %s", stems(kx), lf_str);
+    elseif (stems(kx) > 0)
+      line = sprintf ("%4d | %s", stems(kx-1), lf_str);
+    else
+      line = "";
+    endif
+
+    if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0)
+      plot_out = [plot_out; line];
+      new_line = 1;
+    else
+      if (new_line == 1) 
+        plot_out = [plot_out; "     :"];  # just print one : if no leaves
+        new_line = 0;
+      endif
+    endif
+
+  endfor    # kx = 2: numel (stems)
+
+  if (nargout == 0)
+    disp (plot_out);
+  else
+    plotstr = plot_out;
+  endif
+
+endfunction
+
+
+%!demo
+%! %% Unsorted plot:
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
+%! stemleaf (x, 'Unsorted plot');
+
+%!demo
+%! %% Sorted leaves:
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
+%! y = sort (x);
+%! stemleaf (y, 'Sorted leaves');
+
+%!demo
+%! %% Sorted leaves (large dataset):
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48     ...
+%!      127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119   ...
+%!      58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 ...
+%!      121 58 114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7   ...
+%!      68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40    ...
+%!      119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114   ...
+%!      34 133 45 120 30 127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20  ...
+%!      0];
+%! y = sort (x);
+%! stemleaf (y, 'Sorted leaves (large dataset)');
+
+%!demo
+%! %% Gaussian leaves:
+%! x = fix (30 * randn (300,1));
+%! stemleaf (x, 'Gaussian leaves');
+
+%!test
+%! ## test minus to plus
+%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48 127   ...
+%!      36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109  ...
+%!      23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58   ...
+%!      114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7 68 40 31   ...
+%!      115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 ...
+%!      122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30  ...
+%!      127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20 0];
+%! x = sort (x);
+%! rexp = char (
+%! "       Data: test minus to plus"    ,
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     #138|___________________"      ,     
+%! "     M 69|          52      |"      ,     
+%! "     H 35|   30          116|   86" ,
+%! "     1   |  -28          146|"      ,
+%! "               _______"             ,
+%! "         ______|  129|_______"      ,
+%! "        f|  -99          245|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F| -228          374|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -2 | 82"                          ,
+%! "  -1 | 3"                           ,
+%! "  -0 | 2"                           ,
+%! "   0 | 00177"                       ,
+%! "   1 | 00112288"                    ,
+%! "   2 | 001133577777899"             ,
+%! "   3 | 000111123456777889"          ,
+%! "   4 | 00122233344456788"           ,
+%! "   5 | 223788"                      ,
+%! "   6 | 138"                         ,
+%! "   7 | 11"                          ,
+%! "     : "                            ,
+%! "   9 | 69"                          ,
+%! "  10 | 04555567999"                 ,
+%! "  11 | 0133344455566667777899"      ,
+%! "  12 | 0011223444555677788"         ,
+%! "  13 | 1239"                        ,
+%! "  14 | 16"                          );
+%! r = stemleaf (x, "test minus to plus", 0);
+%! assert (r, rexp);
+
+%!test
+%! ## positive values above 0
+%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
+%! rexp = char (
+%! "       Data: positive values above 0",
+%! " "                                   ,
+%! "         Fenced Letter Display"      ,
+%! " "                                   ,
+%! "     # 14|___________________"       ,     
+%! "     M  7|          22      |"       ,     
+%! "     H  4|   12           42|   30"  ,
+%! "     1   |    5           52|"       ,
+%! "               _______"              ,
+%! "         ______|   45|_______"       ,
+%! "        f|  -33           87|"       ,     
+%! "         |    0            0|  out"  ,
+%! "        F|  -78          132|"       ,
+%! "         |    0            0|  far"  ,
+%! " "                                   ,
+%! "   0 | 5"                            ,
+%! "   1 | 22118"                        ,
+%! "   2 | 28"                           ,
+%! "   3 | 98"                           ,
+%! "   4 | 244"                          ,
+%! "   5 | 2"                            );
+%! r = stemleaf (x, "positive values above 0");
+%! assert (r, rexp);
+
+%!test
+%! ## negative values below 0
+%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
+%! x = -x;
+%! rexp = char (
+%! "       Data: negative values below 0",
+%! " "                                   ,
+%! "         Fenced Letter Display"      ,
+%! " "                                   ,
+%! "     # 14|___________________"       ,     
+%! "     M  7|         -28      |"       ,     
+%! "     H  4|  -42          -12|   30"  ,
+%! "     1   |  -52           -5|"       ,
+%! "               _______"              ,
+%! "         ______|   45|_______"       ,
+%! "        f|  -87           33|"       ,     
+%! "         |    0            0|  out"  ,
+%! "        F| -132           78|"       ,
+%! "         |    0            0|  far"  ,
+%! " "                                   ,
+%! "  -5 | 2"                            ,
+%! "  -4 | 244"                          ,
+%! "  -3 | 98"                           ,
+%! "  -2 | 28"                           ,
+%! "  -1 | 22118"                        ,
+%! "  -0 | 5"                            );
+%! r = stemleaf (x, "negative values below 0");
+%! assert (r, rexp);
+
+%!test
+%! ## positive values from 0
+%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
+%! rexp = char (
+%! "       Data: positive values from 0",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     # 15|___________________"      ,     
+%! "     M  8|          22      |"      ,     
+%! "     H  4|   11           42|   31" ,
+%! "     1   |    0           52|"      ,
+%! "               _______"             ,
+%! "         ______|   46|_______"      ,
+%! "        f|  -35           88|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F|  -82          135|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "   0 | 20"                          ,
+%! "   1 | 22118"                       ,
+%! "   2 | 28"                          ,
+%! "   3 | 98"                          ,
+%! "   4 | 244"                         ,
+%! "   5 | 2"                           );
+%! r = stemleaf (x, "positive values from 0");
+%! assert (r, rexp);
+
+%!test
+%! ## negative values from 0
+%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
+%! x = -x;
+%! rexp = char (
+%! "       Data: negative values from 0",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     # 15|___________________"      ,     
+%! "     M  8|         -22      |"      ,     
+%! "     H  4|  -42          -11|   31" ,
+%! "     1   |  -52            0|"      ,
+%! "               _______"             ,
+%! "         ______|   46|_______"      ,
+%! "        f|  -88           35|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F| -135           82|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -5 | 2"                           ,
+%! "  -4 | 244"                         ,
+%! "  -3 | 98"                          ,
+%! "  -2 | 28"                          ,
+%! "  -1 | 22118"                       ,
+%! "  -0 | 20"                          );
+%! r = stemleaf (x, "negative values from 0");
+%! assert (r, rexp);
+
+%!test
+%! ## both +0 and -0 present
+%! x = [-9 -7 -0 0 -0];
+%! rexp = char (
+%! "       Data: both +0 and -0 present",
+%! " "                                  ,
+%! "         Fenced Letter Display"     ,
+%! " "                                  ,
+%! "     #  5|___________________"      ,     
+%! "     M  3|           0      |"      ,     
+%! "     H  2|   -7            0|   7"  ,
+%! "     1   |   -9            0|"      ,
+%! "               _______"             ,
+%! "         ______|   10|_______"      ,
+%! "        f|  -17           10|"      ,     
+%! "         |    0            0|  out" ,
+%! "        F|  -28           21|"      ,
+%! "         |    0            0|  far" ,
+%! " "                                  ,
+%! "  -0 | 9700"                        ,
+%! "   0 | 0"                           );
+%! r = stemleaf (x, "both +0 and -0 present");
+%! assert (r, rexp);
+
+%!test
+%! ## both <= 0 and -0 present
+%! x = [-9 -7 0 -0];
+%! rexp = char (
+%! "       Data: both <= 0 and -0 present",
+%! " "                                    ,
+%! "         Fenced Letter Display"       ,
+%! " "                                    ,
+%! "     #  4|___________________"        ,     
+%! "     M  2|          -7      |"        ,     
+%! "     H  1|   -9            0|   9"    ,
+%! "     1   |   -9            0|"        ,
+%! "               _______"               ,
+%! "         ______|   13|_______"        ,
+%! "        f|  -22           13|"        ,     
+%! "         |    0            0|  out"   ,
+%! "        F|  -36           27|"        ,
+%! "         |    0            0|  far"   ,
+%! " "                                    ,
+%! "  -0 | 970"                           ,
+%! "   0 | 0"                             );
+%! r = stemleaf (x, "both <= 0 and -0 present");
+%! assert (r, rexp);
+
+%!test
+%! ##   Example from EDA: Chevrolet Prices pg. 30
+%! x = [150 250 688 695 795 795 895 895 895 ...
+%!      1099 1166 1333 1499 1693 1699 1775 1995];
+%! rexp = char (
+%! "       Data: Chevrolet Prices EDA pg.30",
+%! " "                                      ,
+%! "         Fenced Letter Display"         ,
+%! " "                                      ,
+%! "     # 17|___________________"          ,          
+%! "     M  9|         895      |"          ,
+%! "     H  5|  795         1499|   704"    ,
+%! "     1   |  150         1995|"          ,
+%! "               _______"                 ,
+%! "         ______| 1056|_______"          ,
+%! "        f| -261         2555|"          ,
+%! "         |    0            0|  out"     ,
+%! "        F|-1317         3611|"          ,
+%! "         |    0            0|  far"     ,
+%! " "                                      ,
+%! "   1 | 50"                              ,
+%! "   2 | 50"                              ,
+%! "     :"                                 ,
+%! "   6 | 88,95"                           ,
+%! "   7 | 95,95"                           ,
+%! "   8 | 95,95,95"                        ,
+%! "     :"                                 ,
+%! "  10 | 99"                              ,
+%! "  11 | 66"                              ,
+%! "     :"                                 ,
+%! "  13 | 33"                              ,
+%! "  14 | 99"                              ,
+%! "     :"                                 ,
+%! "  16 | 93,99"                           ,
+%! "  17 | 75"                              ,
+%! "     :"                                 ,
+%! "  19 | 95"                              );
+%! r = stemleaf (x, "Chevrolet Prices EDA pg.30", 1);
+%! assert (r, rexp);
+
+## Test input validation
+%!error stemleaf ()
+%!error stemleaf (1, 2, 3, 4)
+%!error <X must be a vector> stemleaf (ones (2,2), "")
+%!warning <X truncated to integer values> tmp = stemleaf ([0 0.5 1],"");
+%!error <X must be a numeric vector> stemleaf ("Hello World", "data")
+%!error <CAPTION must be a character array> stemleaf (1, 2)
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", ones (2,2))
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", -1)
+%!error <STEM_SZ must be a real integer> stemleaf (1, "", 1+i)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,118 @@
+## Copyright (C) 2007-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surf (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surf (@var{z})
+## @deftypefnx {Function File} {} surf (@dots{}, @var{c})
+## @deftypefnx {Function File} {} surf (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surf (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surf (@dots{})
+## Plot a 3-D surface mesh.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the surface is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the surface can be specified independently of
+## @var{z} by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Note: The exact appearance of the surface can be controlled with the
+## @code{shading} command or by using @code{set} to control surface object
+## properties.
+## @seealso{ezsurf, surfc, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function retval = surf (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = surface (varargin{:});
+
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    retval = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! surf (Z);
+%! title ({'surf() plot of peaks() function'; 'color determined by height Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! surf (Z, Fx+Fy);
+%! shading interp;
+%! title ({'surf() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by gradient of Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [~,Fy] = gradient (Z);
+%! surf (X, Y, Z, Fy);
+%! shading interp;
+%! title ({'surf() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surface.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,211 @@
+## Copyright (C) 1993-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
+## @deftypefnx {Function File} {} surface (@var{z})
+## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surface (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
+## Create a surface graphic object given matrices @var{x} and @var{y} from
+## @code{meshgrid} and a matrix of values @var{z} corresponding to the
+## @var{x} and @var{y} coordinates of the surface.
+##
+## If @var{x} and @var{y} are vectors, then a typical vertex is
+## (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z} correspond
+## to different @var{x} values and rows of @var{z} correspond to different
+## @var{y} values.  If only a single input @var{z} is given then @var{x} is
+## taken to be @code{1:rows (@var{z})} and @var{y} is
+## @code{1:columns (@var{z})}.
+##
+## Any property/value input pairs are assigned to the surface object.
+## 
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+## @seealso{surf, mesh, patch, line}
+## @end deftypefn
+
+## Author: jwe
+
+function h = surface (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
+
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  [htmp, bad_usage] = __surface__ (hax, varargin{:});
+
+  if (bad_usage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+function [h, bad_usage] = __surface__ (ax, varargin)
+
+  h = 0;
+  bad_usage = false;
+  firststring = nargin;
+  for i = 1 : (nargin - 1)
+    if (ischar (varargin{i}))
+      firststring = i;
+      break;
+    endif
+  endfor
+
+  if (firststring > 5)
+    bad_usage = true;
+    return;
+  elseif (firststring == 5)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    c = varargin{4};
+
+    if (iscomplex (x) || iscomplex (y) || iscomplex (z) || iscomplex (c))
+      error ("mesh: X, Y, Z, C arguments must be real");
+    endif
+
+    [z_nr, z_nc] = size (z);
+    [c_nr, c_nc, c_np] = size (c);
+    if (! (z_nr == c_nr && z_nc == c_nc && (c_np == 1 || c_np == 3)))
+      error ("surface: Z and C must have the same size");
+    endif
+
+    if (isvector (x) && isvector (y) && ismatrix (z))
+      if (rows (z) == length (y) && columns (z) == length (x))
+        x = x(:)';
+        y = y(:);
+      else
+        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
+      endif
+    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
+      if (! size_equal (x, y, z))
+        error ("surface: X, Y, and Z must have the same dimensions");
+      endif
+    else
+      error ("surface: X and Y must be vectors and Z must be a matrix");
+    endif
+  elseif (firststring == 4)
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    c = z;
+
+    if (iscomplex (x) || iscomplex (y) || iscomplex (z))
+      error ("mesh: X, Y, Z arguments must be real");
+    endif
+
+    if (isvector (x) && isvector (y) && ismatrix (z))
+      if (rows (z) == length (y) && columns (z) == length (x))
+        x = x(:)';
+        y = y(:);
+      else
+        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
+      endif
+    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
+      if (! size_equal (x, y, z))
+        error ("surface: X, Y, and Z must have the same dimensions");
+      endif
+    else
+      error ("surface: X and Y must be vectors and Z must be a matrix");
+    endif
+  elseif (firststring == 3)
+    z = varargin{1};
+    c = varargin{2};
+
+    if (iscomplex (z) || iscomplex (c))
+      error ("mesh: X, C arguments must be real");
+    endif
+
+    if (ismatrix (z) && !isvector (z) && !isscalar (z))
+      [nr, nc] = size (z);
+      x = 1:nc;
+      y = (1:nr)';
+    else
+      error ("surface: Z argument must be a matrix");
+    endif
+  elseif (firststring == 2)
+    z = varargin{1};
+    c = z;
+
+    if (iscomplex (z))
+      error ("mesh: Z argument must be real");
+    endif
+
+    if (ismatrix (z) && !isvector (z) && !isscalar (z))
+      [nr, nc] = size (z);
+      x = 1:nc;
+      y = (1:nr)';
+    else
+      error ("surface: Z argument must be a matrix");
+    endif
+  elseif (firststring == 1)
+    x = 1:3;
+    y = x';
+    c = z = eye (3);
+  else
+    bad_usage = true;
+    return;
+  endif
+
+  if (firststring < nargin)
+    other_args = varargin(firststring:end);
+  else
+    other_args = {};  # make a default surface object.
+  endif
+  h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
+                      other_args{:});
+
+  if (! ishold ())
+    set (ax, "view", [0, 90], "box", "off");
+  endif
+
+endfunction
+
+
+## Functional tests for surface() are in surf.m, surfc.m, surfl.m, and pcolor.m
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = surface;
+%!   assert (findobj (hf, "type", "surface"), h);
+%!   assert (get (h, "xdata"), 1:3, eps);
+%!   assert (get (h, "ydata"), (1:3)', eps);
+%!   assert (get (h, "zdata"), eye (3));
+%!   assert (get (h, "cdata"), eye (3));
+%!   assert (get (h, "type"), "surface");
+%!   assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle"));
+%!   assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps);
+%!   assert (get (h, "marker"), get (0, "defaultsurfacemarker"));
+%!   assert (get (h, "markersize"), get (0, "defaultsurfacemarkersize"));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfc.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,142 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfc (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfc (@var{z})
+## @deftypefnx {Function File} {} surfc (@dots{}, @var{c})
+## @deftypefnx {Function File} {} surfc (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} surfc (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surfc (@dots{})
+## Plot a 3-D surface mesh with underlying contour lines.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the surface is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the surface can be specified independently of
+## @var{z} by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Note: The exact appearance of the surface can be controlled with the
+## @code{shading} command or by using @code{set} to control surface object
+## properties.
+## @seealso{ezsurfc, surf, surfl, surfnorm, trisurf, contour, mesh, surface, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+function h = surfc (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfc", varargin{:});
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+    
+    htmp = surface (varargin{:});
+
+    set (htmp, "facecolor", "flat");
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on",
+                "xlimmode", "manual", "ylimmode", "manual");
+    endif
+
+    drawnow ();
+
+    ## don't pass string arguments to __contour__()
+    stop_idx = find (cellfun ("isclass", varargin, "char"), 1);
+    if (isempty (stop_idx))
+      stop_idx = nargin;
+    else
+      stop_idx--;
+    endif
+
+    if (stop_idx - 1 == 1 || stop_idx - 1 == 3)
+      ## Don't pass a color matrix c to __contour__
+      stop_idx -= 1;
+    endif
+
+    zmin = get (hax, "zlim")(1);
+    [~, htmp2] = __contour__ (hax, zmin, varargin{1:stop_idx});
+
+    htmp = [htmp; htmp2];
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! surfc (Z);
+%! title ('surfc() combines surf/contour plots');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = sombrero ();
+%! [Fx,Fy] = gradient (Z);
+%! surfc (Z, Fx+Fy);
+%! shading interp;
+%! title ({'surfc() plot of sombrero() function'; ...
+%!         'facecolor is interpolated, color determined by gradient of Z'});
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [X,Y,Z] = sombrero ();
+%! [~,Fy] = gradient (Z);
+%! surfc (X,Y,Z,Fy);
+%! shading interp;
+%! title ({'surfc() plot of peaks() function'; ...
+%!         'facecolor is interpolated, color determined by Y-gradient of Z'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfl.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,213 @@
+## Copyright (C) 2009-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfl (@var{z})
+## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfl (@dots{}, @var{lsrc})
+## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{lsrc}, @var{P})
+## @deftypefnx {Function File} {} surfl (@dots{}, "cdata")
+## @deftypefnx {Function File} {} surfl (@dots{}, "light")
+## @deftypefnx {Function File} {} surfl (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} surfl (@dots{})
+##
+## Plot a 3-D surface using shading based on various lighting models.
+##
+## The surface mesh is plotted using shaded rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The default lighting mode @qcode{"cdata"}, changes the cdata property of the
+## surface object to give the impression of a lighted surface.
+## @strong{Warning:} The alternative mode @qcode{"light"} mode which creates a
+## light object to illuminate the surface is not implemented (yet).
+##
+## The light source location can be specified using @var{lsrc}.  It can be given
+## as a 2-element vector [azimuth, elevation] in degrees, or as a 3-element
+## vector [lx, ly, lz].  The default value is rotated 45 degrees
+## counterclockwise to the current view.
+##
+## The material properties of the surface can specified using a 4-element
+## vector @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to
+## @var{p} = [0.55 0.6 0.4 10].
+##
+## @table @asis
+## @item @qcode{"AM"} strength of ambient light
+##
+## @item @qcode{"D"} strength of diffuse reflection
+##
+## @item @qcode{"SP"} strength of specular reflection
+##
+## @item @qcode{"EXP"} specular exponent
+## @end table
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## Example:
+##
+## @example
+## @group
+## colormap (bone (64));
+## surfl (peaks);
+## shading interp;
+## @end group
+## @end example
+## @seealso{diffuse, specular, surf, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+function h = surfl (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfl", varargin{:});
+
+  if (nargin == 0)
+    print_usage ();
+  endif
+
+  ## Check for lighting type.
+  use_cdata = true;
+  if (ischar (varargin{end}))
+    switch (tolower (varargin{end}))
+      case "light"
+        warning ("surfl: light method not supported (yet), using cdata method instead");
+        ## This can be implemented when light objects are supported.
+        use_cdata = false;
+      case "cdata"
+        use_cdata = true;
+      otherwise
+        error ("surfl: unknown lighting method");
+    endswitch
+    varargin(end) = [];
+  endif
+
+  ## Check for reflection properties argument.
+  ##
+  ## r = [ambient light strength,
+  ##      diffuse reflection strength,
+  ##      specular reflection strength,
+  ##      specular shine]
+  if (isnumeric (varargin{end}) && length (varargin{end}) == 4)
+    r = varargin{end};
+    varargin(end) = [];
+  else
+    ## Default values.
+    r = [0.55, 0.6, 0.4, 10];
+  endif
+
+  ## Check for light vector (lv) argument.
+  have_lv = false;
+  if (isnumeric (varargin{end}))
+    len = numel (varargin{end});
+    lastarg = varargin{end};
+    if (len == 3)
+      lv = lastarg;
+      varargin(end) = [];
+      have_lv = true;
+    elseif (len == 2)
+      [lv(1), lv(2), lv(3)] = sph2cart ((lastarg(1) - 90) * pi/180, 
+                                         lastarg(2) * pi/180,
+                                         1.0);
+      varargin(end) = [];
+      have_lv = true;
+    endif
+  endif
+
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  unwind_protect
+    hax = newplot (hax);
+
+    htmp = surface (varargin{:});
+    if (! ishold (hax))
+      set (hax, "view", [-37.5, 30],
+                "xgrid", "on", "ygrid", "on", "zgrid", "on", "clim", [0 1]);
+    endif
+
+    ## Get view vector (vv).
+    [az, el] = view ();
+    vv = sph2cart ((az - 90) * pi/180.0, el * pi/180.0, 1.0);
+
+    if (! have_lv)
+      ## Calculate light vector (lv) from view vector.
+      phi = pi / 4;  # 45 degrees
+      R = [cos(phi), -sin(phi), 0;
+           sin(phi),  cos(phi), 0;
+           0,         0,        1];
+      lv = (R * vv.').';
+    endif
+
+    vn = get (htmp, "vertexnormals");
+    dar = get (hax, "plotboxaspectratio");
+    vn(:,:,1) *= dar(1);
+    vn(:,:,2) *= dar(2);
+    vn(:,:,3) *= dar(3);
+
+    ## Normalize vn.
+    vn ./= repmat (sqrt (sumsq (vn, 3)), [1, 1, 3]);
+    [nr, nc] = size (get (htmp, "zdata"));
+
+    ## Ambient, diffuse, and specular term.
+    cdata = (  r(1) * ones (nr, nc)
+             + r(2) * diffuse  (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv)
+             + r(3) * specular (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv, vv, r(4)));
+    cdata ./= sum (r(1:3));
+
+    set (htmp, "cdata", cdata);
+
+  unwind_protect_cleanup
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! [X,Y,Z] = sombrero ();
+%! colormap (copper (64));
+%! surfl (X,Y,Z);
+%! shading interp;
+%! title ('surfl() with defaults');
+
+%!demo
+%! clf;
+%! [X,Y,Z] = sombrero ();
+%! colormap (copper (64));
+%! [az, el] = view ();
+%! surfl (X,Y,Z, [az+225,el], [0.2 0.6 0.4 25]);
+%! shading interp;
+%! title ('surfl() with lighting vector and material properties');
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/surfnorm.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,166 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} surfnorm (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} surfnorm (@var{z})
+## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{})
+## @deftypefnx {Function File} {} surfnorm (@var{h}, @dots{})
+## Find the vectors normal to a meshgridded surface.  The meshed gridded
+## surface is defined by @var{x}, @var{y}, and @var{z}.  If @var{x} and
+## @var{y} are not defined, then it is assumed that they are given by
+##
+## @example
+## @group
+## [@var{x}, @var{y}] = meshgrid (1:rows (@var{z}),
+##                    1:columns (@var{z}));
+## @end group
+## @end example
+##
+## If no return arguments are requested, a surface plot with the normal
+## vectors to the surface is plotted.  Otherwise the components of the normal
+## vectors at the mesh gridded points are returned in @var{nx}, @var{ny},
+## and @var{nz}.
+##
+## The normal vectors are calculated by taking the cross product of the
+## diagonals of each of the quadrilaterals in the meshgrid to find the
+## normal vectors of the centers of these quadrilaterals.  The four nearest
+## normal vectors to the meshgrid points are then averaged to obtain the
+## normal to the surface at the meshgridded points.
+##
+## An example of the use of @code{surfnorm} is
+##
+## @example
+## surfnorm (peaks (25));
+## @end example
+## @seealso{surf, quiver3}
+## @end deftypefn
+
+function [Nx, Ny, Nz] = surfnorm (varargin)
+
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("surfnorm", varargin{:});
+
+  if (nargin != 1 && nargin != 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    z = varargin{1};
+    [x, y] = meshgrid (1:rows (z), 1:columns (z));
+    ioff = 2;
+  else
+    x = varargin{1};
+    y = varargin{2};
+    z = varargin{3};
+    ioff = 4;
+  endif
+
+  if (!ismatrix (z) || isvector (z) || isscalar (z))
+    error ("surfnorm: Z argument must be a matrix");
+  endif
+  if (! size_equal (x, y, z))
+    error ("surfnorm: X, Y, and Z must have the same dimensions");
+  endif
+
+  ## Make life easier, and avoid having to do the extrapolation later, do
+  ## a simpler linear extrapolation here. This is approximative, and works
+  ## badly for closed surfaces like spheres.
+  xx = [2 .* x(:,1) - x(:,2), x, 2 .* x(:,end) - x(:,end-1)];
+  xx = [2 .* xx(1,:) - xx(2,:); xx; 2 .* xx(end,:) - xx(end-1,:)];
+  yy = [2 .* y(:,1) - y(:,2), y, 2 .* y(:,end) - y(:,end-1)];
+  yy = [2 .* yy(1,:) - yy(2,:); yy; 2 .* yy(end,:) - yy(end-1,:)];
+  zz = [2 .* z(:,1) - z(:,2), z, 2 .* z(:,end) - z(:,end-1)];
+  zz = [2 .* zz(1,:) - zz(2,:); zz; 2 .* zz(end,:) - zz(end-1,:)];
+
+  u.x = xx(1:end-1,1:end-1) - xx(2:end,2:end);
+  u.y = yy(1:end-1,1:end-1) - yy(2:end,2:end);
+  u.z = zz(1:end-1,1:end-1) - zz(2:end,2:end);
+  v.x = xx(1:end-1,2:end) - xx(2:end,1:end-1);
+  v.y = yy(1:end-1,2:end) - yy(2:end,1:end-1);
+  v.z = zz(1:end-1,2:end) - zz(2:end,1:end-1);
+
+  c = cross ([u.x(:), u.y(:), u.z(:)], [v.x(:), v.y(:), v.z(:)]);
+  w.x = reshape (c(:,1), size (u.x));
+  w.y = reshape (c(:,2), size (u.y));
+  w.z = reshape (c(:,3), size (u.z));
+
+  ## Create normal vectors as mesh vectices from normals at mesh centers
+  nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) +
+        w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4;
+  ny = (w.y(1:end-1,1:end-1) + w.y(1:end-1,2:end) +
+        w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4;
+  nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) +
+        w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4;
+
+  ## Normalize the normal vectors
+  len = sqrt (nx.^2 + ny.^2 + nz.^2);
+  nx = nx ./ len;
+  ny = ny ./ len;
+  nz = nz ./ len;
+
+  if (nargout == 0)
+    oldfig = [];
+    if (! isempty (hax))
+      oldfig = get (0, "currentfigure");
+    endif
+    unwind_protect
+      hax = newplot (hax);
+      
+      surf (x, y, z, varargin{ioff:end});
+      old_hold_state = get (hax, "nextplot");
+      unwind_protect
+        set (hax, "nextplot", "add");
+        plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
+               [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
+               [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:),
+               varargin{ioff:end});
+      unwind_protect_cleanup
+        set (hax, "nextplot", old_hold_state);
+      end_unwind_protect
+      
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
+  else
+    Nx = nx;
+    Ny = ny;
+    Nz = nz;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! [x, y, z] = peaks (10);
+%! surfnorm (x, y, z);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! surfnorm (peaks (10));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! surfnorm (peaks (32));
+%! shading interp;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/tetramesh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,158 @@
+## Copyright (C) 2012 Martin Helm
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} tetramesh (@var{T}, @var{X})
+## @deftypefnx {Function File} {} tetramesh (@var{T}, @var{X}, @var{C})
+## @deftypefnx {Function File} {} tetramesh (@dots{}, @var{property}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} tetramesh (@dots{})
+## Display the tetrahedrons defined in the m-by-4 matrix @var{T} as 3-D patches.
+##
+## @var{T} is typically the output of a Delaunay triangulation
+## of a 3-D set of points.  Every row of @var{T} contains four indices into
+## the n-by-3 matrix @var{X} of the vertices of a tetrahedron.  Every row in
+## @var{X} represents one point in 3-D space. 
+##
+## The vector @var{C} specifies the color of each tetrahedron as an index
+## into the current colormap.  The default value is 1:m where m is the number
+## of tetrahedrons; the indices are scaled to map to the full range of the
+## colormap.  If there are more tetrahedrons than colors in the colormap then
+## the values in @var{C} are cyclically repeated.
+## 
+## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all
+## property/value pairs directly to the patch function as additional arguments.
+##
+## The optional return value @var{h} is a vector of patch handles where each
+## handle represents one tetrahedron in the order given by @var{T}. 
+## A typical use case for @var{h} is to turn the respective patch
+## @qcode{"visible"} property @qcode{"on"} or @qcode{"off"}.
+##
+## Type @code{demo tetramesh} to see examples on using @code{tetramesh}.
+## @seealso{trimesh, delaunay3, delaunayn, patch}
+## @end deftypefn
+
+## Author: Martin Helm <martin@mhelm.de>
+
+function h = tetramesh (varargin)
+
+  [reg, prop] = parseparams (varargin);
+
+  if (length (reg) < 2 || length (reg) > 3)
+    print_usage ();
+  endif
+
+  T = reg{1};
+  X = reg{2};
+
+  if (! ismatrix (T) || columns (T) != 4)
+    error ("tetramesh: T must be an n-by-4 matrix");
+  elseif (! ismatrix (X) || columns (X) != 3)
+    error ("tetramesh: X must be an n-by-3 matrix");
+  endif
+
+  size_T = rows (T);
+  cmap = colormap ();
+  
+  if (length (reg) < 3)
+    size_cmap = rows (cmap);
+    C = mod ((1:size_T)' - 1, size_cmap) + 1;
+    if (size_T < size_cmap && size_T > 1) 
+      ## expand to the available range of colors
+      C = floor ((C - 1) * (size_cmap - 1) / (size_T - 1)) + 1;
+    endif
+  else
+    C = reg{3};
+    if (! isvector (C) || size_T != length (C))
+      error ("tetramesh: C must be a vector of the same length as T");
+    endif
+  endif
+
+  hax = newplot ();
+
+  hvec = zeros (size_T, 1);
+  if (strcmp (graphics_toolkit (), "gnuplot"))
+    ## Tiny reduction of the tetrahedron size to help gnuplot by
+    ## avoiding identical faces with different colors
+    for i = 1:size_T
+      [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7);
+      hvec(i) = patch ("Faces", th, "Vertices", p, 
+                       "FaceColor", cmap(C(i), :), "FaceAlpha", 0.9,
+                       prop{:});
+    endfor
+  else
+    ## FLTK does not support FaceAlpha.
+    for i = 1:size_T
+      th = [1 2 3; 2 3 4; 3 4 1; 4 1 2];
+      hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), 
+                       "FaceColor", cmap(C(i), :), "FaceAlpha", 1.0,
+                       prop{:});
+    endfor
+  endif
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off");
+  endif
+
+  if (nargout > 0)
+    h = hvec;
+  endif
+
+endfunction
+
+## shrink the tetrahedron relative to its center of gravity
+function [tri, p] = __shrink__ (T, X, sf)
+  midpoint = repmat (sum (X(T, :), 1) / 4, 12, 1);
+  p = [X([1 2 3], :); X([2 3 4], :); X([3 4 1], :); X([4 1 2], :)];
+  p = sf * (p - midpoint) + midpoint;
+  tri = reshape (1:12, 3, 4)';
+endfunction
+
+
+%!demo
+%! clf;
+%! d = [-1 1];
+%! [x,y,z] = meshgrid (d, d, d);
+%! x = [x(:); 0];
+%! y = [y(:); 0];
+%! z = [z(:); 0];
+%! tetra = delaunay3 (x, y, z);
+%! X = [x(:) y(:) z(:)];
+%! colormap (jet (64));
+%! h = tetramesh (tetra, X);
+%! set (h(1:2:end), 'Visible', 'off');
+%! axis equal;
+%! view (30, 20);
+%! title ({'tetramesh() plot', ...
+%!         'colormap = jet (64), every other tetrahedron invisible'});
+
+%!demo
+%! clf;
+%! d = [-1 1];
+%! [x,y,z] = meshgrid (d, d, d);
+%! x = [x(:); 0];
+%! y = [y(:); 0];
+%! z = [z(:); 0];
+%! tetra = delaunay3 (x, y, z);
+%! X = [x(:) y(:) z(:)];
+%! colormap (gray (256));
+%! tetramesh (tetra, X, 21:20:241, 'EdgeColor', 'w');
+%! axis equal;
+%! view (30, 20);
+%! title ({'tetramesh() plot', ...
+%!         'colormap = gray (256) with white edges'});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/trimesh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,120 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} trimesh (@var{tri}, @var{x}, @var{y})
+## @deftypefnx {Function File} {} trimesh (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
+## Plot a 3-D triangular wireframe mesh.
+## 
+## In contrast to @code{mesh}, which plots a mesh using rectangles,
+## @code{trimesh} plots the mesh using triangles.
+##
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If no @var{z} input is given then
+## the triangles are plotted as a 2-D figure.
+## 
+## The color of the trimesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
+## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
+## RGB data.
+##
+## Any property/value pairs are passed directly to the underlying patch object.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## @seealso{mesh, tetramesh, triplot, trisurf, delaunay, patch, hidden}
+## @end deftypefn
+
+function h = trimesh (tri, x, y, z, varargin)
+
+  if (nargin < 3)
+    print_usage ();
+  endif
+
+  if (nargin == 3)
+    htmp = triplot (tri, x, y);
+  elseif (ischar (z))
+    htmp = triplot (tri, x, y, z, varargin{:});
+  else
+    ## Process color argument
+    if (nargin > 4 && isnumeric (varargin{1}))
+      c = varargin{1};
+      varargin(1) = [];
+      if (isvector (c))
+        if (numel (c) != numel (z))
+          error ("trimesh: C must have 'numel (Z)' elements");
+        endif
+        c = c(:);
+      elseif (rows (c) != numel (z) || columns (c) != 3)
+        error ("trimesh: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
+      endif
+    else
+      c = z(:);
+    endif
+
+    hax = newplot ();
+
+    ## Tag object as "trimesh" so that hidden() can find it.
+    htmp = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
+                  "FaceVertexCdata", c, "EdgeColor", "flat", "FaceColor", "w",
+                  "Tag", "trimesh", varargin{:});
+    if (! ishold ())
+      set (hax, "view", [-37.5, 30], "box", "off",
+                "xgrid", "on", "ygrid", "on", "zgrid", "on");
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 10);
+%! N = 10;
+%! x = 3 - 6 * rand (N, N);
+%! y = 3 - 6 * rand (N, N);
+%! z = peaks (x, y);
+%! tri = delaunay (x(:), y(:));
+%! trimesh (tri, x(:), y(:), z(:));
+
+%% Test input validation
+%!error trimesh ()
+%!error trimesh (1)
+%!error trimesh (1,2)
+%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6])
+%!error <C must have 'numel \(Z\)' elements> trimesh (1,2,3,4,[5 6]')
+%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
+%!error <TrueColor C matrix must> trimesh ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/triplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,66 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} triplot (@var{tri}, @var{x}, @var{y})
+## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec})
+## @deftypefnx {Function File} {@var{h} =} triplot (@dots{})
+## Plot a 2-D triangular mesh.
+## 
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.
+##
+## The linestyle to use for the plot can be defined with the argument
+## @var{linespec} of the same format as the @code{plot} command.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## patch object.
+## @seealso{plot, trimesh, trisurf, delaunay}
+## @end deftypefn
+
+function h = triplot (tri, x, y, varargin)
+
+  if (nargin < 3)
+    print_usage ();
+  endif
+
+  idx = tri(:, [1, 2, 3, 1]).';
+  nt = rows (tri);
+  handle = plot ([x(idx); NaN(1, nt)](:),
+                 [y(idx); NaN(1, nt)](:), varargin{:});
+
+  if (nargout > 0)
+    h = handle;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 2);
+%! N = 20;
+%! x = rand (N, 1);
+%! y = rand (N, 1);
+%! tri = delaunay (x, y);
+%! triplot (tri, x, y);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/trisurf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,174 @@
+## Copyright (C) 2007-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c})
+## @deftypefnx {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} trisurf (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{})
+## Plot a 3-D triangular surface.
+## 
+## In contrast to @code{surf}, which plots a surface mesh using rectangles,
+## @code{trisurf} plots the mesh using triangles.
+##
+## @var{tri} is typically the output of a Delaunay triangulation over the
+## grid of @var{x}, @var{y}.  Every row of @var{tri} represents one triangle
+## and contains three indices into [@var{x}, @var{y}] which are the
+## vertices of the triangles in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.
+## 
+## The color of the trimesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally, the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.  If @var{z} has N elements, then
+## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for
+## RGB data.
+##
+## Any property/value pairs are passed directly to the underlying patch object.
+##
+## The optional return value @var{h} is a graphics handle to the created patch
+## object.
+## @seealso{surf, triplot, trimesh, delaunay, patch, shading}
+## @end deftypefn
+
+function h = trisurf (tri, x, y, z, varargin)
+
+  if (nargin < 4)
+    print_usage ();
+  endif
+
+  if (nargin > 4 && isnumeric (varargin{1}))
+    c = varargin{1};
+    varargin(1) = [];
+    if (isvector (c))
+      if (numel (c) != numel (z))
+        error ("trisurf: C must have 'numel (Z)' elements");
+      endif
+      c = c(:);
+    elseif (rows (c) != numel (z) || columns (c) != 3)
+      error ("trisurf: TrueColor C matrix must be 'numel (Z)' rows by 3 columns");
+    endif
+  else
+    c = z(:);
+  endif
+  ## FIXME: Is all this extra input parsing necessary?
+  ##        Is it for Matlab compatibility?
+  if (! any (strcmpi (varargin, "FaceColor")))
+    nfc = numel (varargin) + 1;
+    varargin(nfc+(0:1)) = {"FaceColor", "flat"};
+  else
+    nfc = find (any (strcmpi (varargin, "FaceColor")), 1);
+  endif
+  if (! any (strcmpi (varargin, "EdgeColor"))
+      && strcmpi (varargin{nfc+1}, "interp"))
+    varargin(end+(1:2)) = {"EdgeColor", "none"};
+  endif
+
+  hax = newplot ();
+
+  htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)],
+                "FaceVertexCData", c, varargin{:});
+
+  if (! ishold ())
+    set (hax, "view", [-37.5, 30], "box", "off",
+              "xgrid", "on", "ygrid", "on", "zgrid", "on");
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! N = 31;
+%! [x, y] = meshgrid (1:N);
+%! tri = delaunay (x(:), y(:));
+%! z = peaks (N);
+%! h = trisurf (tri, x, y, z, 'facecolor', 'interp');
+%! axis tight;
+%! zlim auto;
+%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! N = 31;
+%! [x, y] = meshgrid (1:N);
+%! tri = delaunay (x(:), y(:));
+%! z = peaks (N);
+%! h = trisurf (tri, x, y, z, 'facecolor', 'flat');
+%! axis tight;
+%! zlim auto;
+%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! old_state = rand ('state');
+%! restore_state = onCleanup (@() rand ('state', old_state));
+%! rand ('state', 10);
+%! N = 10;
+%! x = 3 - 6 * rand (N, N);
+%! y = 3 - 6 * rand (N, N);
+%! z = peaks (x, y);
+%! tri = delaunay (x(:), y(:));
+%! trisurf (tri, x(:), y(:), z(:));
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z);
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z, 'facecolor', 'interp');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! x = rand (100, 1);
+%! y = rand (100, 1);
+%! z = x.^2 + y.^2;
+%! tri = delaunay (x, y);
+%! trisurf (tri, x, y, z, 'facecolor', 'interp', 'edgecolor', 'k');
+
+%% Test input validation
+%!error trisurf ()
+%!error trisurf (1)
+%!error trisurf (1,2)
+%!error trisurf (1,2,3)
+%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6])
+%!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6]')
+%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(3,3))
+%!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/draw/waterfall.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,99 @@
+## Copyright (C) 2013 Mike Miller
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} waterfall (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {} waterfall (@var{z})
+## @deftypefnx {Function File} {} waterfall (@dots{}, @var{c})
+## @deftypefnx {Function File} {} waterfall (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {} waterfall (@var{hax}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} waterfall (@dots{})
+## Plot a 3-D waterfall plot.
+##
+## A waterfall plot is similar to a @code{meshz} plot except only
+## mesh lines for the rows of @var{z} (x-values) are shown.
+##
+## The wireframe mesh is plotted using rectangles.  The vertices of the
+## rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
+## over a 2-D rectangular region in the x-y plane.  @var{z} determines the
+## height above the plane of each vertex.  If only a single @var{z} matrix is
+## given, then it is plotted over the meshgrid
+## @code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
+## Thus, columns of @var{z} correspond to different @var{x} values and rows
+## of @var{z} correspond to different @var{y} values.
+##
+## The color of the mesh is computed by linearly scaling the @var{z} values
+## to fit the range of the current colormap.  Use @code{caxis} and/or
+## change the colormap to control the appearance.
+##
+## Optionally the color of the mesh can be specified independently of @var{z}
+## by supplying a color matrix, @var{c}.
+##
+## Any property/value pairs are passed directly to the underlying surface
+## object.
+##
+## If the first argument @var{hax} is an axes handle, then plot into this axis,
+## rather than the current axes returned by @code{gca}.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## surface object.
+##
+## @seealso{meshz, mesh, meshc, contour, surf, surface, ribbon, meshgrid, hidden, shading, colormap, caxis}
+## @end deftypefn
+
+## Author: Mike Miller <mtmiller@ieee.org>
+
+function h = waterfall (varargin)
+
+  htmp = meshz (varargin{:});
+
+  set (htmp, "meshstyle", "row");
+
+  ## The gnuplot toolkit does nothing with the meshstyle property currently.
+  toolkit = get (ancestor (htmp, "figure"), "__graphics_toolkit__");
+  if (strcmp (toolkit, "gnuplot"))
+    warning ("waterfall: may not render correctly using toolkit '%s'", toolkit);
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! waterfall (Z);
+%! title ('waterfall() plot of peaks() function');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! Z = peaks ();
+%! subplot (1,2,1)
+%!  meshz (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('meshz() plot');
+%! subplot (1,2,2)
+%!  waterfall (Z);
+%!  daspect ([2.5, 2.5, 1]);
+%!  title ('waterfall() plot');
+
--- a/scripts/plot/ellipsoid.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-## Copyright (C) 2007-2012 Sylvain Pelissier
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{x}, @var{y}, @var{z}] =} ellipsoid (@var{xc}, @var{yc}, @var{zc}, @var{xr}, @var{yr}, @var{zr}, @var{n})
-## @deftypefnx {Function File} {} ellipsoid (@var{h}, @dots{})
-## Generate three matrices in @code{meshgrid} format that define an
-## ellipsoid.  Called with no return arguments, @code{ellipsoid} calls
-## directly @code{surf (@var{x}, @var{y}, @var{z})}.  If an axes handle
-## is passed as the first argument, the surface is plotted to this
-## set of axes.
-## @seealso{sphere}
-## @end deftypefn
-
-## Author: Sylvain Pelissier <sylvain.pelissier@gmail.com>
-
-function [xx, yy, zz] = ellipsoid (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "ellipsoid",
-                                                varargin{:});
-
-  if (nargin != 6 && nargin != 7)
-    print_usage ();
-  endif
-
-  xc = varargin{1};
-  yc = varargin{2};
-  zc = varargin{3};
-  xr = varargin{4};
-  yr = varargin{5};
-  zr = varargin{6};
-
-  if (nargin == 6)
-    n = 20;
-  else
-    n = varargin{7};
-  endif
-
-  theta = linspace (0, 2 * pi, n + 1);
-  phi = linspace (-pi / 2, pi / 2, n + 1);
-  [theta, phi] = meshgrid (theta, phi);
-
-  x = xr .* cos (phi) .* cos (theta) + xc;
-  y = yr .* cos (phi) .* sin (theta) + yc;
-  z = zr .* sin (phi) + zc;
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    surf (h, x, y, z);
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ellipsoid (0, 0, 1, 2, 3, 4, 20);
-
--- a/scripts/plot/errorbar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} errorbar (@var{args})
-## @deftypefnx {Function File} {@var{h} =} errorbar (@var{args})
-## This function produces two-dimensional plots with errorbars.  Many
-## different combinations of arguments are possible.  The simplest form is
-##
-## @example
-## errorbar (@var{y}, @var{ey})
-## @end example
-##
-## @noindent
-## where the first argument is taken as the set of @var{y} coordinates
-## and the second argument @var{ey} is taken as the errors of the
-## @var{y} values.  @var{x} coordinates are taken to be the indices
-## of the elements, starting with 1.
-##
-## If more than two arguments are given, they are interpreted as
-##
-## @example
-## errorbar (@var{x}, @var{y}, @dots{}, @var{fmt}, @dots{})
-## @end example
-##
-## @noindent
-## where after @var{x} and @var{y} there can be up to four error
-## parameters such as @var{ey}, @var{ex}, @var{ly}, @var{uy}, etc.,
-## depending on the plot type.  Any number of argument sets may appear,
-## as long as they are separated with a format string @var{fmt}.
-##
-## If @var{y} is a matrix, @var{x} and error parameters must also be matrices
-## having same dimensions.  The columns of @var{y} are plotted versus the
-## corresponding columns of @var{x} and errorbars are drawn from
-## the corresponding columns of error parameters.
-##
-## If @var{fmt} is missing, yerrorbars ("~") plot style is assumed.
-##
-## If the @var{fmt} argument is supplied, it is interpreted as in
-## normal plots.  In addition, @var{fmt} may include an errorbar style
-## which must precede the line and marker format.  The following plot
-## styles are supported by errorbar:
-##
-## @table @samp
-## @item ~
-## Set yerrorbars plot style (default).
-##
-## @item >
-## Set xerrorbars plot style.
-##
-## @item ~>
-## Set xyerrorbars plot style.
-##
-## @item #
-## Set boxes plot style.
-##
-## @item #~
-## Set boxerrorbars plot style.
-##
-## @item #~>
-## Set boxxyerrorbars plot style.
-## @end table
-##
-## Examples:
-##
-## @example
-## errorbar (@var{x}, @var{y}, @var{ex}, ">")
-## @end example
-##
-## @noindent
-## produces an xerrorbar plot of @var{y} versus @var{x} with @var{x}
-## errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}.
-##
-## @example
-## @group
-## errorbar (@var{x}, @var{y1}, @var{ey}, "~",
-##           @var{x}, @var{y2}, @var{ly}, @var{uy})
-## @end group
-## @end example
-##
-## @noindent
-## produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
-## Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
-## @var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
-## @var{y2}+@var{uy}.
-##
-## @example
-## @group
-## errorbar (@var{x}, @var{y}, @var{lx}, @var{ux},
-##           @var{ly}, @var{uy}, "~>")
-## @end group
-## @end example
-##
-## @noindent
-## produces an xyerrorbar plot of @var{y} versus @var{x} in which
-## @var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux}
-## and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}.
-## @seealso{semilogxerr, semilogyerr, loglogerr}
-## @end deftypefn
-
-## Created: 18.7.2000
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = errorbar (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    tmp = __errcomm__ ("errorbar", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270];
-%! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112];
-%! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2);
-
-%!demo
-%! clf;
-%! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850];
-%! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149];
-%! errorbar (0:10, rand_1x11_data3, rand_1x11_data4, '>');
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/100;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! hg = errorbar (x, y1, err, '~', x, y2, err, '>');
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/100;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! hg = errorbar (x, y1, err, err, '#r', x, y2, err, err, '#~');
-
-%!demo
-%! clf;
-%! x = 0:0.5:2*pi;
-%! err = x/100;
-%! y1 = sin (x);
-%! y2 = cos (x);
-%! hg = errorbar (x, y1, err, err, err, err, '~>', ...
-%!                x, y2, err, err, err, err, '#~>-*');
-
--- a/scripts/plot/ezcontour.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezcontour (@var{f})
-## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezcontour (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
-##
-## Plot the contour lines of a function.  @var{f} is a string, inline function
-## or function handle with two arguments defining the function.  By default the
-## plot is over the domain @code{-2*pi < @var{x} < 2*pi} and @code{-2*pi <
-## @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezcontour (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezcontourf, ezsurfc, ezmeshc}
-## @end deftypefn
-
-function retval = ezcontour (varargin)
-
-  [h, needusage] = __ezplot__ ("contour", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezcontour (f, [-3, 3]);
-
--- a/scripts/plot/ezcontourf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezcontourf (@var{f})
-## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezcontourf (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
-##
-## Plot the filled contour lines of a function.  @var{f} is a string, inline
-## function or function handle with two arguments defining the function.  By
-## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
-## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezcontourf (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezcontour, ezsurfc, ezmeshc}
-## @end deftypefn
-
-function retval = ezcontourf (varargin)
-
-  [h, needusage] = __ezplot__ ("contourf", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezcontourf (f, [-3, 3]);
-
--- a/scripts/plot/ezmesh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezmesh (@var{f})
-## @deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezmesh (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezmesh (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
-##
-## Plot the mesh defined by a function.  @var{f} is a string, inline
-## function or function handle with two arguments defining the function.  By
-## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
-## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If the argument "circ" is given, then the function is plotted over a disk
-## centered on the middle of the domain @var{dom}.
-##
-## The optional return value @var{h} is a graphics handle to the created 
-## surface object.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezmesh (f, [-3, 3]);
-## @end group
-## @end example
-##
-## An example of a parametrically defined function is
-##
-## @example
-## @group
-## fx = @@(s,t) cos (s) .* cos (t);
-## fy = @@(s,t) sin (s) .* cos (t);
-## fz = @@(s,t) sin (t);
-## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezmeshc, ezsurf, ezsurfc}
-## @end deftypefn
-
-function retval = ezmesh (varargin)
-
-  [h, needusage] = __ezplot__ ("mesh", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezmesh (f, [-3, 3]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! fx = @(s,t) cos (s) .* cos (t);
-%! fy = @(s,t) sin (s) .* cos (t);
-%! fz = @(s,t) sin (t);
-%! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
-
--- a/scripts/plot/ezmeshc.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezmeshc (@var{f})
-## @deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezmeshc (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezmeshc (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
-##
-## Plot the mesh and contour lines defined by a function.  @var{f} is a string,
-## inline function or function handle with two arguments defining the function.
-## By default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
-## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If the argument "circ" is given, then the function is plotted over a disk
-## centered on the middle of the domain @var{dom}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle for the created mesh plot and a second handle for the created contour
-## plot.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezmeshc (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezsurfc, ezsurf, ezmesh}
-## @end deftypefn
-
-function retval = ezmeshc (varargin)
-
-  [h, needusage] = __ezplot__ ("meshc", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezmeshc (f, [-3, 3]);
-
--- a/scripts/plot/ezplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezplot (@var{f})
-## @deftypefnx {Function File} {} ezplot (@var{fx}, @var{fy})
-## @deftypefnx {Function File} {} ezplot (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezplot (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezplot (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezplot (@dots{})
-##
-## Plot the curve defined by @var{f} in two dimensions.  The function
-## @var{f} may be a string, inline function or function handle and can
-## have either one or two variables.  If @var{f} has one variable, then
-## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi}
-## with 500 points.
-##
-## If @var{f} has two variables then @code{@var{f}(@var{x},@var{y}) = 0}
-## is calculated over the meshed domain @code{-2*pi < @var{x} | @var{y}
-## < 2*pi} with 60 by 60 in the mesh.  For example:
-##
-## @example
-## ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1)
-## @end example
-##
-## If two functions are passed as strings, inline functions or function
-## handles, then the parametric function
-##
-## @example
-## @group
-## @var{x} = @var{fx} (@var{t})
-## @var{y} = @var{fy} (@var{t})
-## @end group
-## @end example
-##
-## @noindent
-## is plotted over the domain @code{-2*pi < @var{t} < 2*pi} with 500
-## points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of @var{x}, @var{y} and @var{t}.  If it is a four element
-## vector, then the minimum and maximum values of @var{x} and @var{t}
-## are determined by the first two elements and the minimum and maximum
-## of @var{y} by the second pair of elements.
-##
-## @var{n} is a scalar defining the number of points to use in plotting
-## the function.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @seealso{plot, ezplot3}
-## @end deftypefn
-
-function retval = ezplot (varargin)
-
-  [h, needusage] = __ezplot__ ("plot", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ezplot (@cos, @sin);
-
-%!demo
-%! clf;
-%! ezplot ('1/x');
-
-%!demo
-%! clf;
-%! ezplot (inline ('x^2 - y^2 = 1'));
-
--- a/scripts/plot/ezplot3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezplot3 (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
-##
-## Plot a parametrically defined curve in three dimensions.
-## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions
-## or function handles with one arguments defining the function.  By
-## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi}
-## with 60 points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of @var{t}.  @var{n} is a scalar defining the number of points to use.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @example
-## @group
-## fx = @@(t) cos (t);
-## fy = @@(t) sin (t);
-## fz = @@(t) t;
-## ezplot3 (fx, fy, fz, [0, 10*pi], 100);
-## @end group
-## @end example
-##
-## @seealso{plot3, ezplot, ezsurf, ezmesh}
-## @end deftypefn
-
-function retval = ezplot3 (varargin)
-
-  [h, needusage] = __ezplot__ ("plot3", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! fx = @(t) cos (t);
-%! fy = @(t) sin (t);
-%! fz = @(t) t;
-%! ezplot3 (fx, fy, fz, [0, 10*pi], 100);
-
--- a/scripts/plot/ezpolar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezpolar (@var{f})
-## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
-##
-## Plot a function in polar coordinates.  The function @var{f} is
-## a string, inline function, or function handle with a single argument.
-## The expected form of the function is
-## @code{@var{rho} = @var{f}(@var{theta})}.
-## By default the plot is over the domain @code{0 < @var{theta} < 2*pi} with 60
-## points.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## values of @var{theta}.  @var{n} is a scalar defining the number of points to
-## use.  If the optional input @var{hax} is given then the plot is placed into
-## the specified axes rather than the current axes.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## Example:
-##
-## @example
-## ezpolar (@@(t) 1 + sin (t));
-## @end example
-##
-## @seealso{polar, ezplot, ezsurf, ezmesh}
-## @end deftypefn
-
-function retval = ezpolar (varargin)
-
-  [h, needusage] = __ezplot__ ("polar", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ezpolar (@(t) 1 + sin (t));
-
--- a/scripts/plot/ezsurf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezsurf (@var{f})
-## @deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezsurf (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezsurf (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
-##
-## Plot the surface defined by a function.  @var{f} is a string, inline
-## function or function handle with two arguments defining the function.  By
-## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
-## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If the argument "circ" is given, then the function is plotted over a disk
-## centered on the middle of the domain @var{dom}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezsurf (f, [-3, 3]);
-## @end group
-## @end example
-##
-## An example of a parametrically defined function is
-##
-## @example
-## @group
-## fx = @@(s,t) cos (s) .* cos (t);
-## fy = @@(s,t) sin (s) .* cos (t);
-## fz = @@(s,t) sin (t);
-## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezmesh, ezsurfc, ezmeshc}
-## @end deftypefn
-
-function retval = ezsurf (varargin)
-
-  [h, needusage] = __ezplot__ ("surf", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezsurf (f, [-3, 3]);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! fx = @(s,t) cos (s) .* cos (t);
-%! fy = @(s,t) sin (s) .* cos (t);
-%! fz = @(s,t) sin (t);
-%! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
-
--- a/scripts/plot/ezsurfc.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ezsurfc (@var{f})
-## @deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
-## @deftypefnx {Function File} {} ezsurfc (@dots{}, "circ")
-## @deftypefnx {Function File} {} ezsurfc (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
-##
-## Plot the surface and contour lines defined by a function.  @var{f} is a
-## string, inline function or function handle with two arguments defining the
-## function.  By default the plot is over the domain @code{-2*pi < @var{x} <
-## 2*pi} and @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension.
-##
-## If @var{dom} is a two element vector, it represents the minimum and maximum
-## value of both @var{x} and @var{y}.  If @var{dom} is a four element vector,
-## then the minimum and maximum value of @var{x} and @var{y} are specify
-## separately.
-##
-## @var{n} is a scalar defining the number of points to use in each dimension.
-##
-## If three functions are passed, then plot the parametrically defined
-## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
-## @var{fz} (@var{s}, @var{t})]}.
-##
-## If the argument "circ" is given, then the function is plotted over a disk
-## centered on the middle of the domain @var{dom}.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## for the created surface plot and a second handle for the created contour
-## plot.
-##
-## @example
-## @group
-## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-## ezsurfc (f, [-3, 3]);
-## @end group
-## @end example
-##
-## @seealso{ezplot, ezmeshc, ezsurf, ezmesh}
-## @end deftypefn
-
-function retval = ezsurfc (varargin)
-
-  [h, needusage] = __ezplot__ ("surfc", varargin{:});
-
-  if (needusage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
-%! ezsurfc (f, [-3, 3]);
-
--- a/scripts/plot/feather.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} feather (@var{u}, @var{v})
-## @deftypefnx {Function File} {} feather (@var{z})
-## @deftypefnx {Function File} {} feather (@dots{}, @var{style})
-## @deftypefnx {Function File} {} feather (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} feather (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
-## from equidistant points on the x-axis.  If a single complex argument
-## @var{z} is given, then @code{@var{u} = real (@var{z})} and
-## @code{@var{v} = imag (@var{z})}.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing the drawn vectors.
-##
-## @example
-## @group
-## phi = [0 : 15 : 360] * pi/180;
-## feather (sin (phi), cos (phi));
-## @end group
-## @end example
-##
-## @seealso{plot, quiver, compass}
-## @end deftypefn
-
-function retval = feather (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("feather", varargin{:});
-
-  arrowsize = 0.25;
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1 || (nargin == 2 && ! isnumeric (varargin{2})))
-    ioff = 2;
-    z = varargin{1}(:).';
-    u = real (z);
-    v = imag (z);
-  elseif (nargin > 1 && isnumeric (varargin{2}))
-    ioff = 3;
-    u = varargin{1}(:).';
-    v = varargin{2}(:).';
-  endif
-
-  line_spec = "b-";
-  have_line_spec = false;
-  while (ioff <= nargin)
-    arg = varargin{ioff++};
-    if ((ischar (arg) || iscell (arg)) && ! have_line_spec)
-      [linespec, valid] = __pltopt__ ("feather", arg, false);
-      if (valid)
-        line_spec = arg;
-        have_line_spec = false;
-        break;
-      else
-        error ("feather: invalid linespec");
-      endif
-    else
-      error ("feather: unrecognized argument");
-    endif
-  endwhile
-
-  ## Matlab draws feather plots, with the arrow head as one continous
-  ## line, and each arrow separately. This is completely different than
-  ## quiver and quite ugly.
-  n = length (u);
-  xend = [1 : n] + u;
-  xtmp = [1 : n] + u .* (1 - arrowsize);
-  yend = v;
-  ytmp = v .* (1 - arrowsize);
-  x = [[1 : n]; xend; xtmp  - v * arrowsize; xend; ...
-       xtmp + v * arrowsize];
-  y = [zeros(1, n); yend; ytmp  + u * arrowsize / 3; yend; ...
-       ytmp - u * arrowsize / 3];
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    hlist = plot (h, x, y, line_spec, [1, n], [0, 0], line_spec);
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = hlist;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! phi = [0 : 15 : 360] * pi/180;
-%! feather (sin (phi), cos (phi));
-
--- a/scripts/plot/figure.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} figure
-## @deftypefnx {Command} {} figure @var{n}
-## @deftypefnx {Function File} {} figure (@var{n})
-## @deftypefnx {Function File} {} figure (@var{n}, "@var{property}", @var{value}, @dots{})
-## Set the current plot window to plot window @var{n}.  If no arguments are
-## specified, the next available window number is chosen.
-##
-## Multiple property-value pairs may be specified for the figure, but they
-## must appear in pairs.
-## @end deftypefn
-
-## Author: jwe, Bill Denney
-
-function h = figure (varargin)
-
-  nargs = nargin;
-
-  f = NaN;
-
-  init_new_figure = false;
-  if (mod (nargs, 2) == 1)
-    tmp = varargin{1};
-    if (ischar (tmp))
-      tmp = str2double (tmp);
-    endif
-    if (isfigure (tmp))
-      f = tmp;
-      varargin(1) = [];
-      nargs--;
-    elseif (isnumeric (tmp) && tmp > 0 && tmp == fix (tmp))
-      f = tmp;
-      init_new_figure = true;
-      varargin(1) = [];
-      nargs--;
-    else
-      error ("figure: expecting figure handle or figure number");
-    endif
-  endif
-
-  ## Check to see if we already have a figure on the screen.  If we do,
-  ## then update it if it is different from the figure we are creating
-  ## or switching to.
-  cf = get (0, "currentfigure");   # Can't use gcf () because it calls figure ()
-  if (! isempty (cf) && cf != 0)
-    if (isnan (f) || cf != f)
-      drawnow ();
-    endif
-  endif
-
-  if (rem (nargs, 2) == 0)
-    if (isnan (f) || init_new_figure)
-      if (ismac () && strcmp (graphics_toolkit (), "fltk"))
-        ## FIXME - Hack for fltk-aqua to work around bug #31931
-        f = __go_figure__ (f);
-        drawnow ();
-        if (! isempty (varargin))
-          set (f, varargin{:});
-        endif
-      else
-        f = __go_figure__ (f, varargin{:});
-      endif
-    elseif (nargs > 0)
-      set (f, varargin{:});
-    endif
-    set (0, "currentfigure", f);
-  else
-    print_usage ();
-  endif
-
-  if (strcmp (get (f, "__graphics_toolkit__"), "fltk"))
-    __add_default_menu__ (f);
-  endif
-
-  if (nargout > 0)
-    h = f;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (gcf, hf);
-%!   assert (isfigure (hf));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/fill.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} fill (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
-## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} fill (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} fill (@dots{})
-## Create one or more filled patch objects.
-##
-## The optional return value @var{h} is an array of graphics handles to
-## the created patch objects.
-## @seealso{patch}
-## @end deftypefn
-
-function retval = fill (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("fill", varargin{:});
-
-  htmp = [];
-  iargs = __find_patches__ (varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-
-    nextplot = get (h, "nextplot");
-    for i = 1 : length (iargs)
-      if (i > 1 && strncmp (nextplot, "replace", 7))
-        set (h, "nextplot", "add");
-      endif
-      if (i == length (iargs))
-        args = varargin(iargs(i):end);
-      else
-        args = varargin(iargs(i):iargs(i+1)-1);
-      endif
-      newplot ();
-      [tmp, fail] = __patch__ (h, args{:});
-      if (fail)
-        print_usage ();
-      endif
-      htmp(end + 1, 1) = tmp;
-    endfor
-    if (strncmp (nextplot, "replace", 7))
-      set (h, "nextplot", nextplot);
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-function iargs = __find_patches__ (varargin)
-  iargs = [];
-  i = 1;
-  while (i < nargin)
-    iargs(end + 1) = i;
-    if (ischar (varargin{i})
-        && (strcmpi (varargin{i}, "faces")
-            || strcmpi (varargin{i}, "vertices")))
-      i += 4;
-    elseif (isnumeric (varargin{i}))
-      i += 2;
-    endif
-
-    if (i <= nargin)
-      while (true);
-        if (ischar (varargin{i})
-            && (strcmpi (varargin{i}, "faces")
-                || strcmpi (varargin{i}, "vertices")))
-          break;
-        elseif (isnumeric (varargin{i}))
-          ## Assume its the colorspec
-          i++;
-          break;
-        elseif (ischar (varargin{i}))
-          colspec = tolower (varargin{i});
-          collen = length (colspec);
-          if (any (strncmp (colspec, 
-                            {"blue", "black", "k", "red", "green", ...
-                             "yellow", "magenta", "cyan", "white"},
-                            collen)))
-            i++;
-            break;
-          endif
-        else
-          i += 2;
-        endif
-      endwhile
-    endif
-  endwhile
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t1 = (1/16:1/8:1) * 2*pi;
-%! t2 = ((1/16:1/8:1) + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! h = fill (x1,y1,'r', x2,y2,'g');
-
--- a/scripts/plot/findall.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-## Copyright (C) 2008-2012 Bill Denney
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} findall ()
-## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findall (@var{h}, "-depth", @var{d}, @dots{})
-## Find graphics object with specified property values including hidden handles.
-##
-## This function performs the same function as @code{findobj}, but it
-## includes hidden objects in its search.  For full documentation, see
-## @code{findobj}.
-## @seealso{get, set, findobj, allchild}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-
-function h = findall (varargin)
-
-  unwind_protect
-    shh = get (0, "showhiddenhandles");
-    set (0, "showhiddenhandles", "on");
-    h = findobj (varargin{:});
-  unwind_protect_cleanup
-    set (0, "showhiddenhandles", shh);
-  end_unwind_protect
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = findall (hf);
-%!   all_handles(1:13,1) = {"uimenu"};
-%!   all_handles(14) = {"figure"};
-%!   assert (get (h, "type"), all_handles);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/findfigs.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2008 Bill Denney
-## Copyright (C) 2012 Carnë Draug
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} findfigs ()
-## Find all visible figures that are currently off the screen and move them
-## onto the screen.
-## @seealso{allchild, figure, get, set}
-## @end deftypefn
-
-## Author: Bill Denney <bill@denney.ws>
-## Modified by: Carnë Draug <carandraug+dev@gmail.com>
-
-function findfigs ()
-
-  figh  = allchild (0);
-  units = get (0, "units");
-  unwind_protect
-    if (!strcmp (units, "pixels"))
-      set (0, "units", "pixels");
-    endif
-    screensize = get (0, "screensize");
-  unwind_protect_cleanup
-    set (0, "units", units);
-  end_unwind_protect
-
-  ## give the monitor a margin so that the figure must not just
-  ## marginally be on the monitor.
-  margin = 30;
-  screensize(1:2) += margin;
-  screensize(3:4) -= margin;
-
-  for i = 1:numel (figh)
-    if (strcmp (get (figh(i), "visible"), "on"))
-
-      units = get (figh(i), "units");
-      unwind_protect
-        if (!strcmp (units, "pixels"))
-          set (figh(i), "units", "pixels");
-        endif
-        pos = get (figh(i), "position");
-        ## Test if (in order):
-        ## The left side is outside the right side of the screen
-        ## The bottom is above the top of the screen
-        ## The right side is outside the left of the screen
-        ## the top is below the bottom of the screen
-        if (pos(1) > screensize(3)
-            || pos(2) > screensize(4)
-            || pos(1)+pos(3) < screensize(1)
-            || pos(2)+pos(4) < screensize(2))
-
-          ## the new position will be at the top left of the screen
-          ## (all moved figures will overlap).  The bottom left is chosen
-          ## instead of the top left because that allows for the unknown
-          ## amount of space for the menu bar and the title bar.
-          pos(1) = screensize(1);
-          pos(2) = screensize(2);
-          set (figh(i), "position", pos);
-        endif
-      unwind_protect_cleanup
-        set (figh(i), "units", units);
-      end_unwind_protect
-    endif
-  endfor
-endfunction
--- a/scripts/plot/findobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,301 +0,0 @@
-## Copyright (C) 2007-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} findobj ()
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value})
-## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name})
-## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern})
-## @deftypefnx {Function File} {@var{h} =} findobj ("flat", @dots{})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} findobj (@var{h}, "-depth", @var{d}, @dots{})
-## Find graphics object with specified property values.  The simplest form is
-##
-## @example
-## findobj (@var{prop_name}, @var{prop_value})
-## @end example
-##
-## @noindent
-## which returns all of the handles to the objects with the name
-## @var{prop_name} and the name @var{prop_value}.  The search can be limited
-## to a particular object or set of objects and their descendants by
-## passing a handle or set of handles @var{h} as the first argument to
-## @code{findobj}.
-##
-## The depth of hierarchy of objects to which to search to can be limited
-## with the "-depth" argument.  To limit the number depth of the hierarchy
-## to search to @var{d} generations of children, and example is
-##
-## @example
-## findobj (@var{h}, "-depth", @var{d}, @var{prop_name}, @var{prop_value})
-## @end example
-##
-## Specifying a depth @var{d} of 0, limits the search to the set of object
-## passed in @var{h}.  A depth @var{d} of 0 is equivalent to the "-flat"
-## argument.
-##
-## A specified logical operator may be applied to the pairs of @var{prop_name}
-## and @var{prop_value}.  The supported logical operators are "-and", "-or",
-## "-xor", "-not".
-##
-## The objects may also be matched by comparing a regular expression to the
-## property values, where property values that match @code{regexp
-## (@var{prop_value}, @var{pattern})} are returned.  Finally, objects may be
-## matched by property name only, using the "-property" option.
-## @seealso{get, set}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-
-function h = findobj (varargin)
-
-  depth = NaN;
-  if (nargin == 0)
-    handles = 0;
-    n1 = 0;
-  else
-    if (! isempty (varargin{1}))
-      if (ishandle (varargin{1}(1)))
-        handles = varargin{1};
-        n1 = 2;
-      else
-        handles = 0;
-        n1 = 1;
-      endif
-    else
-      ## Return [](0x1) for compatibility.
-      h = zeros (0, 1);
-      return;
-    endif
-    if (n1 <= nargin)
-      if (ischar (varargin{n1}))
-        if (strcmpi (varargin{n1}, "flat"))
-          depth = 0;
-          n1 = n1 + 1;
-        elseif (strcmpi (varargin{n1}, "-depth"))
-          depth = varargin{n1+1};
-          n1 = n1 + 2;
-        endif
-      else
-        error ("findobj: properties and options must be strings");
-      endif
-    endif
-  endif
-
-  if (n1 <= nargin && nargin > 0)
-    args = varargin(n1 : nargin);
-  else
-    args = {};
-  endif
-
-  regularexpression = [];
-  property          = [];
-  logicaloperator   = {};
-  pname             = {};
-  pvalue            = {};
-  np = 1;
-  na = 1;
-
-  while (na <= numel (args))
-    regularexpression(np) = 0;
-    property(np) = 0;
-    logicaloperator{np} = "and";
-    if (ischar (args{na}))
-      if (strcmpi (args{na}, "-regexp"))
-        if (na + 2 <= numel (args))
-          regularexpression(np) = 1;
-          na = na + 1;
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = args{na};
-          na = na + 1;
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      elseif (strcmpi (args{na}, "-property"))
-        if (na + 1 <= numel (args))
-          na = na + 1;
-          property(np) = 1;
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = [];
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      elseif (! strcmp (args{na}(1), "-"))
-        ## Parameter/value pairs.
-        if (na + 1 <= numel (args))
-          pname{np} = args{na};
-          na = na + 1;
-          pvalue{np} = args{na};
-          na = na + 1;
-          if (na <= numel (args))
-            if (ischar (args{na}))
-              if (strcmpi (args{na}, "-and"))
-                logicaloperator{np} = "and";
-                na = na+1;
-              elseif (strcmpi (args{na}, "-or"))
-                logicaloperator{np} = "or";
-                na = na+1;
-              elseif (strcmpi (args{na}, "-xor"))
-                logicaloperator{np} = "xor";
-                na = na+1;
-              elseif (strcmpi (args{na}, "-not"))
-                logicaloperator{np} = "not";
-                na = na+1;
-              endif
-            else
-              error ("findobj: properties and options must be strings");
-            endif
-          else
-            logicaloperator{np} = "and";
-          endif
-          np = np + 1;
-        else
-          error ("findobj: inconsistent number of arguments");
-        endif
-      else
-        ## This is sloppy ... but works like Matlab.
-        if (strcmpi (args{na}, "-not"))
-          h = [];
-          return
-        endif
-        na = na + 1;
-      endif
-    else
-      error ("findobj: properties and options must be strings");
-    endif
-  endwhile
-
-  numpairs = np - 1;
-  if (~ isempty (logicaloperator))
-    logicaloperator = shift (logicaloperator, 1);
-  endif
-
-  ## Load all objects which qualify for being searched.
-  idepth = 0;
-  h = handles;
-  while (numel (handles) && ! (idepth >= depth))
-    children = [];
-    for n = 1 : numel (handles)
-      children = union (children, get (handles(n), "children"));
-    endfor
-    handles = children;
-    h = union (h, children);
-    idepth = idepth + 1;
-  endwhile
-
-  keepers = ones (size (h));
-  if (numpairs > 0)
-    for nh = 1 : numel (h)
-      p = get (h (nh));
-      for np = 1 : numpairs
-        fields = fieldnames (p);
-        fieldindex = find (strcmpi (fields, pname{np}), 1);
-        if (numel (fieldindex))
-          pname{np} = fields{fieldindex};
-          if (property(np))
-            match = 1;
-          else
-            if (regularexpression(np))
-              match = regexp (p.(pname{np}), pvalue{np});
-              if (isempty (match))
-                match = 0;
-              endif
-            elseif (numel (p.(pname{np})) == numel (pvalue{np}))
-              if (ischar (pvalue{np}) && ischar (p.(pname{np})))
-                match = strcmpi (pvalue{np}, p.(pname{np}));
-              elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np}))))
-                match = (pvalue{np} == p.(pname{np}));
-              else
-                match = isequal (pvalue{np}, p.(pname{np}));
-              endif
-            else
-              match = 0;
-            endif
-            match = all (match);
-          endif
-          if (strcmpi (logicaloperator{np}, "not"))
-            keepers(nh) = ! keepers(nh) & ! match;
-          else
-            keepers(nh) = feval (logicaloperator{np}, keepers(nh), match);
-          endif
-        else
-          keepers(nh) = 0;
-        endif
-      endfor
-    endfor
-  endif
-
-  h = h (keepers != 0);
-  h = reshape (h, [numel(h), 1]);
-endfunction
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = plot (1:10);
-%!   set (h, "tag", "foobar")
-%!   g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]);
-%!   assert (g, h)
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   obj = findobj (hf, "type", "line");
-%!   assert (l, obj);
-%!   assert (gca, findobj (hf, "type", "axes"));
-%!   assert (hf, findobj (hf, "type", "figure"));
-%!   assert (isempty (findobj (hf, "type", "xyzxyz")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   subplot (2, 2, 1)
-%!   imagesc (rand (10))
-%!   subplot (2, 2, 2)
-%!   surf (peaks)
-%!   subplot (2, 2, 3)
-%!   contour (peaks)
-%!   subplot (2, 2, 4)
-%!   plot (peaks)
-%!   h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup");
-%!   h2 = findobj (gcf (), "Type", "image", "-or", "Type", "surface", "-or", "Type", "hggroup");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-%! assert (h2, h1)
-
-%!test
-%! hf = figure ("visible", "off");
-%! h1 = subplot (2, 2, 1);
-%! h2 = subplot (2, 2, 2);
-%! h3 = subplot (2, 2, 3);
-%! h4 = subplot (2, 2, 4);
-%! userdata = struct ("foo", "bar");
-%! set (h3, "userdata", userdata);
-%! assert (findobj (hf, "userdata", userdata), h3)
--- a/scripts/plot/fplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-## Copyright (C) 2005-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} fplot (@var{fn}, @var{limits})
-## @deftypefnx {Function File} {} fplot (@var{fn}, @var{limits}, @var{tol})
-## @deftypefnx {Function File} {} fplot (@var{fn}, @var{limits}, @var{n})
-## @deftypefnx {Function File} {} fplot (@dots{}, @var{fmt})
-## Plot a function @var{fn} within defined limits.
-## @var{fn} is a function handle, inline function, or string
-## containing the name of the function to evaluate.
-## The limits of the plot are given by @var{limits} of the form
-## @code{[@var{xlo}, @var{xhi}]} or @code{[@var{xlo}, @var{xhi},
-## @var{ylo}, @var{yhi}]}.  @var{tol} is the default tolerance to use for the
-## plot, and if @var{tol} is an integer it is assumed that it defines the
-## number points to use in the plot.  The @var{fmt} argument is passed
-## to the plot command.
-##
-## @example
-## @group
-## fplot ("cos", [0, 2*pi])
-## fplot ("[cos(x), sin(x)]", [0, 2*pi])
-## @end group
-## @end example
-## @seealso{plot}
-## @end deftypefn
-
-## Author: Paul Kienzle <pkienzle@users.sf.net>
-
-function fplot (fn, limits, n = 0.002, fmt = "")
-
-  if (nargin < 2 || nargin > 4)
-    print_usage ();
-  endif
-
-  if (iscomplex (limits) || (numel (limits) != 2 && numel (limits) != 4))
-    error ("fplot: LIMITS must be a real vector with 2 or 4 elements");
-  endif
-
-  if (ischar (n))
-    fmt = n;
-    n = 0.002;
-  endif
-
-  if (strcmp (typeinfo (fn), "inline function"))
-    fn = vectorize (fn);
-    nam = formula (fn);
-  elseif (isa (fn, "function_handle"))
-    nam = func2str (fn);
-  elseif (all (isalnum (fn)))
-    nam = fn;
-  elseif (ischar (fn))
-    fn = vectorize (inline (fn));
-    nam = formula (fn);
-  else
-    error ("fplot: FN must be a function handle, inline function, or string");
-  endif
-
-  if (n != fix (n))
-    tol = n;
-    x0 = linspace (limits(1), limits(2), 5)';
-    y0 = feval (fn, x0);
-    err0 = Inf;
-    n = 8;
-    x = linspace (limits(1), limits(2), n)';
-    y = feval (fn, x);
-   
-    if (! size_equal (x0, y0))
-      ## FN is a constant value function
-      y0 = repmat (y0, size (x0));
-      y = repmat (y, size (x));
-    endif
-
-    while (n < 2 .^ 20)
-      y00 = interp1 (x0, y0, x, "linear");
-      err = 0.5 * max (abs ((y00 - y) ./ (y00 + y))(:));
-      if (err == err0 || err < tol)
-        break;
-      endif
-      x0 = x;
-      y0 = y;
-      err0 = err;
-      n = 2 * (n - 1) + 1;
-      x = linspace (limits(1), limits(2), n)';
-      y = feval (fn, x);
-    endwhile
-  else
-    x = linspace (limits(1), limits(2), n)';
-    y = feval (fn, x);
-  endif
-
-  plot (x, y, fmt);
-
-  if (length (limits) > 2)
-    axis (limits);
-  endif
-
-  if (isvector (y))
-    legend (nam);
-  else
-    for i = 1:columns (y)
-      nams{i} = sprintf ("%s(:,%i)", nam, i);
-    endfor
-    legend (nams{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! fplot ('cos', [0, 2*pi]);
-
-%!demo
-%! clf;
-%! fplot ('[cos(x), sin(x)]', [0, 2*pi]);
-
-%% Test input validation
-%!error fplot (1)
-%!error fplot (1,2,3,4,5)
-%!error <LIMITS must be a real vector> fplot (@cos, [i, 2*i])
-%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1])
-%!error <LIMITS must be a real vector with 2 or 4> fplot (@cos, [1 2 3])
-%!error <FN must be a function handle> fplot (1, [0 1])
-
--- a/scripts/plot/gca.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} gca ()
-## Return a handle to the current axis object.  If no axis object
-## exists, create one and return its handle.  The handle may then be
-## used to examine or set properties of the axes.  For example,
-##
-## @example
-## @group
-## ax = gca ();
-## set (ax, "position", [0.5, 0.5, 0.5, 0.5]);
-## @end group
-## @end example
-##
-## @noindent
-## creates an empty axes object, then changes its location and size in
-## the figure window.
-## @seealso{gcf, gco, get, set}
-## @end deftypefn
-
-## Author: jwe
-
-function h = gca ()
-
-  if (nargin == 0)
-    h = get (gcf (), "currentaxes");
-    if (isempty (h))
-      h = axes ();
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! ax = axes;
-%! unwind_protect
-%!   assert (gca, ax);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/gcbf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{fig} =} gcbf ()
-## Return a handle to the figure containing the object whose callback
-## is currently executing.  If no callback is executing, this function
-## returns the empty matrix.  The handle returned by this function is
-## the same as the second output argument of @code{gcbo}.
-##
-##@seealso{gcbo, gcf, gca}
-##@end deftypefn
-
-function fig = gcbf ()
-
-  [dummy, fig] = gcbo ();
-
-endfunction
-
-
-%!assert (isempty (gcbf))
-
--- a/scripts/plot/gcbo.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} gcbo ()
-## @deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo ()
-## Return a handle to the object whose callback is currently
-## executing.  If no callback is executing, this function returns the
-## empty matrix.  This handle is obtained from the root object property
-## "CallbackObject".
-##
-## When called with a second output argument, return the handle of the figure
-## containing the object whose callback is currently executing.  If no callback
-## is executing the second output is also set to the empty matrix.
-##
-##@seealso{gcbf, gco, gcf, gca}
-##@end deftypefn
-
-function [h, fig] = gcbo ()
-
-  h = get (0, "callbackobject");
-  fig = [];
-
-  if (! isempty (h) && nargout > 1)
-    fig = ancestor (h, "figure");
-  endif
-
-endfunction
-
-
-%!test
-%! assert (isempty (gcbo));
-
--- a/scripts/plot/gcf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} gcf ()
-## Return the current figure handle.  If a figure does not exist, create
-## one and return its handle.  The handle may then be used to examine or
-## set properties of the figure.  For example,
-##
-## @example
-## @group
-## fplot (@@sin, [-10, 10]);
-## fig = gcf ();
-## set (fig, "visible", "off");
-## @end group
-## @end example
-##
-## @noindent
-## plots a sine wave, finds the handle of the current figure, and then
-## makes that figure invisible.  Setting the visible property of the
-## figure to @code{"on"} will cause it to be displayed again.
-## @seealso{gca, gco, get, set}
-## @end deftypefn
-
-## Author: jwe, Bill Denney
-
-function h = gcf ()
-
-  if (nargin == 0)
-    h = get (0, "currentfigure");
-    if (isempty (h) || h == 0)
-      ## We only have a root figure object, so create a new figure
-      ## object and make it the current figure.
-      h = figure (1);
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (gcf, hf);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/gco.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} gco ()
-## @deftypefnx {Function File} {@var{h} =} gco (@var{fig})
-## Return a handle to the current object of the current figure, or a handle
-## to the current object of the figure with handle @var{fig}.  The current
-## object of a figure is the object that was last clicked on.  It is stored
-## in the CurrentObject property of the target figure.
-##
-## If the last mouse click didn't occur on any child object of the figure,
-## the current object is the figure itself.
-##
-## If no mouse click occurred in the target figure, this function returns an
-## empty matrix.
-##
-## Note that the value returned by this function is not necessarily the same
-## as the one returned by gcbo during callback execution.  An executing
-## callback can be interrupted by another callback and the current object
-## can be modified.
-##
-##@seealso{gcbo, gcf, gca, get, set}
-##@end deftypefn
-
-function h = gco ()
-
-  h = get (get (0, "currentfigure"), "currentobject");
-
-endfunction
--- a/scripts/plot/ginput.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n})
-## Return which mouse buttons were pressed and keys were hit on the current
-## figure.  If @var{n} is defined, then wait for @var{n} mouse clicks
-## before returning.  If @var{n} is not defined, then @code{ginput} will
-## loop until the return key @key{RET} is pressed.
-## @end deftypefn
-
-function varargout = ginput (n)
-
-  if (nargin > 1)
-    print_usage ();
-  endif
-
-  f = gcf ();
-  drawnow ();
-  toolkit = (get (f, "__graphics_toolkit__"));
-
-  varargout = cell (1, nargout);
-  if (nargin == 0)
-    [varargout{:}] = feval (strcat ("__", toolkit, "_ginput__"), f);
-  else
-    [varargout{:}] = feval (strcat ("__", toolkit, "_ginput__"), f, n);
-  endif
-
-endfunction
-
-
-## Remove from test statistics.  No real tests possible.
-%!test
-%! assert (1);
-
--- a/scripts/plot/gnuplot_binary.in	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2008-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
-## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
-## Query or set the name of the program invoked by the plot command
-## when the graphics toolkit is set to "gnuplot".  Additional arguments to
-## pass to the external plotting program may also be given.
-## The default value is @code{"gnuplot"} with no additional arguments.
-## @xref{Installation}.
-## @seealso{graphics_toolkit}
-## @end deftypefn
-
-## Author: jwe
-
-function [prog, args] = gnuplot_binary (new_prog, varargin)
-
-  persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
-  persistent gp_args = {};
-
-  if (nargout > 0 || nargin == 0)
-    prog = gp_binary;
-    args = gp_args;
-  endif
-
-  if (nargin == 1)
-    if (! ischar (new_prog) || isempty (new_prog))
-      error ("gnuplot_binary: NEW_PROG must be a non-empty string");
-    endif
-    gp_binary = new_prog;
-  endif
-
-  if (nargin > 1)
-    if (! iscellstr (varargin))
-      error ("gnuplot_binary: arguments must be character strings");
-    endif
-    gp_args = varargin;
-  endif
-
-endfunction
-
-
-%!test
-%! orig_val = gnuplot_binary ();
-%! old_val = gnuplot_binary ("X");
-%! assert (orig_val, old_val);
-%! assert (gnuplot_binary (), "X");
-%! gnuplot_binary (orig_val);
-%! assert (gnuplot_binary (), orig_val);
--- a/scripts/plot/graphics_toolkit.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{name} =} graphics_toolkit ()
-## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
-## @deftypefnx {Function File} {} graphics_toolkit (@var{name})
-## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
-## Return the default graphics toolkit.  The default graphics toolkit value
-## is assigned to new figures.
-## 
-## @code{graphics_toolkit (@var{hlist})}
-## 
-## Return the graphics toolkits for the figures with handles @var{hlist}.
-## 
-## @code{graphics_toolkit (@var{name})}
-## 
-## Set the default graphics toolkit to @var{name}.  If the toolkit is not
-## already loaded, it is initialized by calling the function
-## @code{__init_@var{name}__}.
-## 
-## @code{graphics_toolkit (@var{hlist}, @var{name})}
-##
-## Set the graphics toolkit for the figures with handles @var{hlist} to
-## @var{name}.
-## 
-## @seealso{available_graphics_toolkits}
-## @end deftypefn
-
-function retval = graphics_toolkit (name, hlist = [])
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  if (nargout > 0 || nargin == 0)
-    retval = get (0, "defaultfigure__graphics_toolkit__");
-  endif
-
-  if (nargin == 0)
-    return;
-  elseif (nargin == 1)
-    if (all (isfigure (name)))
-      hlist = name;
-      retval = get (hlist, "__graphics_toolkit__");
-      return
-    elseif (! ischar (name))
-      error ("graphics_toolkit: invalid graphics toolkit NAME");
-    endif
-  elseif (nargin == 2)
-    ## Swap input arguments
-    [hlist, name] = deal (name, hlist);
-    if (! all (isfigure (hlist)))
-      error ("graphics_toolkit: invalid figure handle list HLIST");
-    elseif (! ischar (name))
-      error ("graphics_toolkit: invalid graphics toolkit NAME");
-    endif
-  endif
-
-  if (! any (strcmp (loaded_graphics_toolkits (), name)))
-    feval (["__init_", name, "__"]);
-    if (! any (strcmp (loaded_graphics_toolkits (), name)))
-      error ("graphics_toolkit: %s toolkit was not correctly loaded", name);
-    endif
-  endif
-
-  if (isempty (hlist))
-    set (0, "defaultfigure__graphics_toolkit__", name);
-  else
-    set (hlist, "__graphics_toolkit__", name);
-  endif
-
-endfunction
-
-
-%!testif HAVE_FLTK
-%! unwind_protect
-%!   hf = figure ("visible", "off"); 
-%!   toolkit = graphics_toolkit ();
-%!   assert (get (0, "defaultfigure__graphics_toolkit__"), toolkit);
-%!   graphics_toolkit (hf, "fltk"); 
-%!   assert (graphics_toolkit (hf), "fltk");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!testif HAVE_FLTK
-%! old_toolkit = graphics_toolkit ();
-%! switch old_toolkit
-%!   case {"gnuplot"}
-%!     new_toolkit = "fltk";
-%!   otherwise
-%!     new_toolkit = "gnuplot";
-%! endswitch
-%! assert (graphics_toolkit (new_toolkit), old_toolkit);
-%! assert (graphics_toolkit (old_toolkit), new_toolkit);
-
--- a/scripts/plot/grid.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} grid (@var{arg})
-## @deftypefnx {Function File} {} grid ("minor", @var{arg2})
-## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
-## Force the display of a grid on the plot.
-## The argument may be either @code{"on"}, or @code{"off"}.
-## If it is omitted, the current grid state is toggled.
-##
-## If @var{arg} is @code{"minor"} then the minor grid is toggled.  When
-## using a minor grid a second argument @var{arg2} is allowed, which can
-## be either @code{"on"} or @code{"off"} to explicitly set the state of
-## the minor grid.
-##
-## If the first argument is an axis handle, @var{hax}, operate on the
-## specified axis object.
-## @seealso{plot}
-## @end deftypefn
-
-## Author: jwe
-
-function grid (varargin)
-
-  [ax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
-
-  grid_on = (strcmp (get (ax, "xgrid"), "on")
-             && strcmp (get (ax, "ygrid"), "on")
-             && strcmp (get (ax, "zgrid"), "on"));
-
-  minor_on = (strcmp (get (ax, "xminorgrid"), "on")
-              && strcmp (get (ax, "yminorgrid"), "on")
-              && strcmp (get (ax, "zminorgrid"), "on"));
-
-  if (nargs > 2)
-    print_usage ();
-  elseif (nargs == 0)
-    grid_on = ! grid_on;
-  else
-    x = varargin{1};
-    if (ischar (x))
-      if (strcmpi (x, "off"))
-        grid_on = false;
-      elseif (strcmpi (x, "on"))
-        grid_on = true;
-      elseif (strcmpi (x, "minor"))
-        if (nargs == 2)
-          x2 = varargin{2};
-          if (strcmpi (x2, "on"))
-            minor_on = true;
-            grid_on = true;
-          elseif (strcmpi (x2, "off"))
-            minor_on = false;
-          else
-            print_usage ();
-          endif
-        else
-           minor_on = ! minor_on;
-           if (minor_on)
-             grid_on = true;
-           endif
-        endif
-      else
-        print_usage ();
-      endif
-    else
-      error ("grid: argument must be a string");
-    endif
-  endif
-
-  if (grid_on)
-    set (ax, "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    if (minor_on)
-      set (ax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on");
-    else
-      set (ax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
-    endif
-  else
-    set (ax, "xgrid", "off", "ygrid", "off", "zgrid", "off");
-    set (ax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! subplot (2,2,1);
-%!  plot (1:100);
-%!  grid off;
-%!  title ('no grid');
-%! subplot (2,2,2);
-%!  plot (1:100);
-%!  grid on;
-%!  title ('grid on');
-%! subplot (2,2,3);
-%!  plot (1:100);
-%!  grid minor;
-%!  title ('grid minor');
-%! subplot (2,2,4);
-%!  semilogy (1:100);
-%!  grid minor;
-%!  title ('grid minor');
-
--- a/scripts/plot/gtext.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} gtext (@var{s})
-## @deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@})
-## @deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@})
-## @deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {@var{h} =} gtext (@dots{})
-## Place text on the current figure using the mouse.  The text is defined
-## by the string @var{s}.  If @var{s} is a cell string organized as a row
-## vector then each string of the cell array is written to a separate line.
-## If @var{s} is organized as a column vector then one string element of the
-## cell array is placed for every mouse click.  Additional inputs besides a
-## string or cellstr are passed to the underlying text object as Property-value
-## pairs.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## text object.
-## @seealso{ginput, text}
-## @end deftypefn
-
-function h = gtext (s, varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  if (! (ischar (s) || iscellstr (s)))
-    error ("gtext: S must be a string or cell array of strings");
-  endif
-
-  htmp = -1;
-  if (! isempty (s))
-    if (ischar (s) || isrow (s))
-      [x, y] = ginput (1);
-      htmp = text (x, y, s, varargin{:});
-    else
-      for i = 1:numel (s)
-        [x, y] = ginput (1);
-        htmp = text (x, y, s{i}, varargin{:});
-      endfor
-    endif
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/guidata.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{data} =} guidata (@var{handle})
-## @deftypefnx {Function File} {} guidata (@var{handle}, @var{data})
-## @end deftypefn
-
-## Author: goffioul
-
-function varargout = guidata (varargin)
-
-  if (nargin == 1 || nargin == 2)
-    h = varargin{1};
-    if (ishandle (h))
-      h = ancestor (h, "figure");
-      if (! isempty (h))
-        if (nargin == 1)
-          varargout{1} = get (h, "__guidata__");
-        else
-          data = varargin{2};
-          set (h, "__guidata__", data);
-          if (nargout == 1)
-            varargout{1} = data;
-          endif
-        endif
-      else
-        error ("no ancestor figure found");
-      endif
-    else
-      error ("invalid object handle");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
--- a/scripts/plot/guihandles.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{hdata} =} guihandles (@var{handle})
-## @deftypefnx {Function File} {@var{hdata} =} guihandles
-## @end deftypefn
-
-## Author: goffioul
-
-function hdata = guihandles (varargin)
-
-  hdata = [];
-
-  if (nargin == 0 || nargin == 1)
-    if (nargin == 1)
-      h = varargin{1};
-      if (ishandle (h))
-        h = ancestor (h, "figure");
-        if (isempty (h))
-          error ("no ancestor figure found");
-        endif
-      else
-        error ("invalid object handle");
-      endif
-    else
-      h = gcf ();
-    endif
-    hdata = __make_guihandles_struct__ (h, hdata);
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-function hdata = __make_guihandles_struct__ (h, hdata)
-
-  tag = get (h, "tag");
-  if (! isempty (tag))
-    if (isfield (hdata, tag))
-      hdata.(tag) = [hdata.(tag), h];
-    else
-      try
-        hdata.(tag) = h;
-      catch
-      end_try_catch
-    endif
-  endif
-
-  kids = allchild (h);
-  for i = 1 : length (kids)
-    hdata = __make_guihandles_struct__ (kids(i), hdata);
-  endfor
-
-endfunction
--- a/scripts/plot/hdl2struct.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
-## Return a structure, @var{s}, whose fields describe the properties
-## of the object, and its children, associated with the handle, @var{h}.
-## The fields of the structure, @var{s}, are "type", "handle", "properties",
-## "children" and "special".
-## @seealso{findobj, get, set, struct2hdl}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-03-04
-
-function s = hdl2struct (h)
-
-  if (nargin != 1 || !ishandle (h))
-    print_usage ();
-  endif
-
-  hiddenh = get (0, "showhiddenhandles");
-  if (strcmp (hiddenh, "on"))
-    set (0, "showhiddenhandles", "off");
-  endif
-
-  ## main object
-  main = get (h);
-  s.handle = h;
-  s.type =  main.type;
-  s.properties  = getprops (h);
-  s.children = [];
-  s.special = [];
-
-  ## sweep all children but legends, colorbars, uimenu and hggroup children
-  ## in reverse order
-  kids = main.children;
-  lg = findobj (h, "-depth", 1, "tag", "legend");
-  cb = findobj (h, "-depth", 1, "tag", "colorbar");
-  ui = findobj (h, "-depth", 1, "type", "uimenu");
-  nkids = length (kids);
-  ii = 0;
-  while (nkids)
-    if (! any (kids (nkids) == lg) && ! any (kids (nkids) == cb)
-          && ! any (kids (nkids) == ui) && ! strcmp (main.type, "hggroup"))
-      ii++;
-      s.children(ii) = hdl2struct (kids(nkids));
-    endif
-    nkids--;
-  endwhile
-
-  ## add non "children" children objects (title, xlabel, ...) and
-  ## hggroup children and tag theim in "special"
-  special = [];
-  if (strcmp (main.type, "hggroup"))
-    special = main.children;
-  endif
-  special = [special getspecial(h)];
-  nsp = length (special);
-  while (nsp)
-    ii++;
-    s.children(ii) = hdl2struct (special(nsp));
-    s.special(nsp) = ii;
-    nsp--;
-  endwhile
-
-  ## look for legends and colorbars among "main"'s brothers and add them
-  ## to the children list
-  if (strcmp (main.type, "axes"))
-    par = main.parent;
-    lg = findobj (par, "-depth", 1, "tag", "legend");
-    if (! isempty (lg))
-      idx = arrayfun (@(x) get(x).userdata.handle(end) == h, lg);
-      lg = lg(find (idx));
-    endif
-    nlg = length (lg);
-    if (nlg == 1)
-      ii++;
-      s.children(ii) = hdl2struct (lg);
-    elseif (nlg > 1)
-      error ("hdl2struct: more than one legend found");
-    endif
-
-    cb = findobj (par, "-depth", 1, "tag", "colorbar");
-    if (! isempty (cb))
-      idx = arrayfun (@(x) get(x).axes == h, cb);
-      cb = cb(find (idx));
-    endif
-
-    ncb = length (cb);
-    if (ncb == 1)
-      ii++;
-      s.children(ii) = hdl2struct (cb);
-    elseif (nlg > 1)
-      error ("hdl2struct: more than one colorbar found");
-    endif
-  endif
-
-  set (0, "showhiddenhandles", hiddenh);
-
-endfunction
-
-function hdlist = getspecial (h)
-  obj = get (h);
-  ## return handles to special children
-  fields = fieldnames (obj);
-  hdlist = [];
-
-  regkids = get ( h, "children");
-  set (0, "showhiddenhandles", "on");
-  allkids = get ( h, "children");
-  set (0, "showhiddenhandles", "off");
-  speckids = arrayfun (@(x) ! any (x == regkids), allkids);
-  hdlist = allkids (find (speckids));
-  hdlist = reshape (hdlist, 1, numel (hdlist));
-
-endfunction
-
-function prpstr = getprops (h)
-  obj = get (h);
-  ## get usefull properties rejecting readonly, children, handles ...
-  fields = fieldnames (obj);
-  hdlist = [];
-
-  forbid = {"beingdeleted", "busyaction", "buttondownfcn", ...
-            "children", "clipping", "createfcn", ...
-            "deletefcn", "handlevisibility", "hittest", ...
-            "interruptible", "parent", "selected" ,...
-            "selectionhighlight", "type", "__modified__", ...
-            "uicontextmenu", "__graphics_toolkit__", "currentaxes", ...
-            "currentcharacter", "currentobject","tightinset", ...
-            "currentpoint", "extent"};
-
-  nflds = length (fields);
-  ii = 0;
-  while nflds
-    prop = fields{nflds};
-    val = obj.(fields{nflds});
-    ii++;
-    if (! any (strcmp (prop, forbid)))
-      prpstr.(prop) = val;
-    endif
-    nflds--;
-  endwhile
-
-  ## hidden properties
-  hidden = {"autopos_tag", "looseinset"};
-  for ii = 1:numel (hidden)
-    if (isprop (h, hidden{ii}))
-      prpstr.(hidden{ii}) = get (h, hidden{ii});
-    endif
-  endfor
-
-endfunction
-
-
-## FIXME: need validation tests
--- a/scripts/plot/hggroup.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-## Copyright (C) 2008-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} hggroup ()
-## @deftypefnx {Function File} {} hggroup (@var{h})
-## @deftypefnx {Function File} {} hggroup (@dots{}, @var{property}, @var{value}, @dots{})
-## Create group object with parent @var{h}.  If no parent is specified,
-## the group is created in the current axes.  Return the handle of the
-## group object created.
-##
-## Multiple property-value pairs may be specified for the group, but they
-## must appear in pairs.
-## @end deftypefn
-
-## Author: goffioul
-
-function h = hggroup (varargin)
-
-  [ax, varargin] = __plt_get_axis_arg__ ("hggroup", varargin{:});
-
-  tmp = __go_hggroup__ (ax, varargin{:});
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = hggroup;
-%!   assert (findobj (hf, "type", "hggroup"), h);
-%!   assert (get (h, "type"), "hggroup");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/hidden.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} hidden (@var{mode})
-## @deftypefnx {Function File} {} hidden ()
-## Manipulation the mesh hidden line removal.  Called with no argument
-## the hidden line removal is toggled.  The argument @var{mode} can be either
-## "on" or "off" and the set of the hidden line removal is set accordingly.
-## @seealso{mesh, meshc, surf}
-## @end deftypefn
-
-function retval = hidden (mode)
-
-  if (nargin == 0)
-    mode = "swap";
-  elseif (nargin == 1);
-    if (ischar (mode))
-      mode = tolower (mode);
-      if (! strcmp (mode, "on") && ! strcmp (mode, "off"))
-        error ("hidden: MODE expected to be 'on' or 'off'");
-      endif
-    else
-      error ("hidden: expecting MODE to be a string");
-    endif
-  else
-    print_usage ();
-  endif
-
-  for h = get (gca (), "children");
-    htype = lower (get (h, "type"));
-    if (strcmp (htype, "surface"))
-      fc = get (h, "facecolor");
-      if ((! ischar (fc) && is_white (fc))
-          || (ischar (fc) && strcmpi (fc, "none")))
-        switch (mode)
-        case "on"
-          set (h, "facecolor", "w");
-        case "off"
-          set (h, "facecolor", "none");
-        case "swap"
-          if (ischar (fc))
-            set (h, "facecolor", "w");
-            mode = "on";
-          else
-            set (h, "facecolor", "none");
-            mode = "off";
-          endif
-        endswitch
-      endif
-    endif
-  endfor
-
-  if (nargout > 0)
-    retval = mode;
-  endif
-
-endfunction
-
-function retval = is_white (color)
-  retval = all (color == 1);
-endfunction
--- a/scripts/plot/hist.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} hist (@var{y})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{x})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{nbins})
-## @deftypefnx {Function File} {} hist (@var{y}, @var{x}, @var{norm})
-## @deftypefnx {Function File} {[@var{nn}, @var{xx}] =} hist (@dots{})
-## @deftypefnx {Function File} {[@dots{}] =} hist (@dots{}, @var{prop}, @var{val})
-##
-## Produce histogram counts or plots.
-##
-## With one vector input argument, @var{y}, plot a histogram of the values
-## with 10 bins.  The range of the histogram bins is determined by the
-## range of the data.  With one matrix input argument, @var{y}, plot a
-## histogram where each bin contains a bar per input column.
-##
-## Given a second vector argument, @var{x}, use that as the centers of
-## the bins, with the width of the bins determined from the adjacent
-## values in the vector.
-##
-## If scalar, the second argument, @var{nbins}, defines the number of bins.
-##
-## If a third argument is provided, the histogram is normalized such that
-## the sum of the bars is equal to @var{norm}.
-##
-## Extreme values are lumped in the first and last bins.
-##
-## With two output arguments, produce the values @var{nn} and @var{xx} such
-## that @code{bar (@var{xx}, @var{nn})} will plot the histogram.
-##
-## The histogram's appearance may be modified by specifying property/value
-## pairs, @var{prop} and @var{val} pairs.  For example the face and edge
-## color may be modified.
-##
-## @example
-## @group
-## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
-## @end group
-## @end example
-##
-## @noindent
-## The histograms colors also depend upon the colormap.
-##
-## @example
-## @group
-## hist (rand (10, 3));
-## colormap (summer ());
-## @end group
-## @end example
-##
-## @seealso{bar}
-## @end deftypefn
-
-## Author: jwe
-
-function [nn, xx] = hist (y, varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  arg_is_vector = isvector (y);
-
-  if (rows (y) == 1)
-    y = y(:);
-  endif
-
-  if (isreal (y))
-    max_val = max (y(:));
-    min_val = min (y(:));
-  else
-    error ("hist: first argument must be real valued");
-  endif
-
-  iarg = 1;
-  if (nargin == 1 || ischar (varargin{iarg}))
-    n = 10;
-    x = [0.5:n]'/n;
-    x = x * (max_val - min_val) + ones (size (x)) * min_val;
-  else
-    ## nargin is either 2 or 3
-    x = varargin{iarg++};
-    if (isscalar (x))
-      n = x;
-      if (n <= 0)
-        error ("hist: number of bins must be positive");
-      endif
-      x = [0.5:n]'/n;
-      x = x * (max_val - min_val) + ones (size (x)) * min_val;
-    elseif (isreal (x))
-      if (isvector (x))
-        x = x(:);
-      endif
-      tmp = sort (x);
-      if (any (tmp != x))
-        warning ("hist: bin values not sorted on input");
-        x = tmp;
-      endif
-    else
-      error ("hist: second argument must be a scalar or a vector");
-    endif
-  endif
-
-  ## Avoid issues with integer types for x and y
-  x = double (x);
-  y = double (y);
-
-  cutoff = (x(1:end-1,:) + x(2:end,:)) / 2;
-  n = rows (x);
-  y_nc = columns (y);
-  if (n < 30 && columns (x) == 1)
-    ## The following algorithm works fastest for n less than about 30.
-    chist = zeros (n+1, y_nc);
-    for i = 1:n-1
-      chist(i+1,:) = sum (y <= cutoff(i));
-    endfor
-    chist(n+1,:) = sum (! isnan (y));
-  else
-    ## The following algorithm works fastest for n greater than about 30.
-    ## Put cutoff elements between boundaries, integrate over all
-    ## elements, keep totals at boundaries.
-    [s, idx] = sort ([y; repmat(cutoff, 1, y_nc)]);
-    len = rows (y);
-    chist = cumsum (idx <= len);
-    chist = [(zeros (1, y_nc));
-             (reshape (chist(idx > len), rows (cutoff), y_nc));
-             (chist(end,:) - sum (isnan (y)))];
-  endif
-
-  freq = diff (chist);
-
-  if (nargin > 2 && ! ischar (varargin{iarg}))
-    ## Normalise the histogram.
-    norm = varargin{iarg++};
-    freq = freq / sum(! isnan (y)) * norm;
-  endif
-
-  if (nargout > 0)
-    if (arg_is_vector)
-      nn = freq';
-      xx = x';
-    else
-      nn = freq;
-      xx = x;
-    endif
-  elseif (columns (freq) != 1)
-    bar (x, freq, 0.8, varargin{iarg:end});
-  else
-    bar (x, freq, 1.0, varargin{iarg:end});
-  endif
-
-endfunction
-
-
-%!test
-%! [nn,xx] = hist ([1:4], 3);
-%! assert (xx, [1.5,2.5,3.5]);
-%! assert (nn, [2,1,1]);
-%!test
-%! [nn,xx] = hist ([1:4]', 3);
-%! assert (xx, [1.5,2.5,3.5]);
-%! assert (nn, [2,1,1]);
-%!test
-%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3]);
-%! assert (xx, [1,2,3]);
-%! assert (nn, [3,2,1]);
-%!test
-%! [nn,xx] = hist ([1 1 1 NaN NaN NaN 2 2 3],[1 2 3], 6);
-%! assert (xx, [1,2,3]);
-%! assert (nn, [3,2,1]);
-%!test
-%! [nn,xx] = hist ([[1:4]', [1:4]'], 3);
-%! assert (xx, [1.5;2.5;3.5]);
-%! assert (nn, [[2,1,1]',[2,1,1]']);
-%!test
-%! for n = [10, 30, 100, 1000]
-%!   assert (sum (hist ([1:n], n)), n);
-%!   assert (sum (hist ([1:n], [2:n-1])), n);
-%!   assert (sum (hist ([1:n], [1:n])), n);
-%!   assert (sum (hist ([1:n], 29)), n);
-%!   assert (sum (hist ([1:n], 30)), n);
-%! endfor
-%!assert (hist (1,1), 1)
-%!assert (size (hist (randn (750,240), 200)), [200,240])
-
--- a/scripts/plot/hold.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} hold
-## @deftypefnx {Command} {} hold @var{state}
-## @deftypefnx {Function File} {} hold (@var{hax}, @dots{})
-## Toggle or set the "hold" state of the plotting engine which determines
-## whether new graphic objects are added to the plot or replace the existing
-## objects.
-##
-## @table @code
-## @item hold on
-## Retain plot data and settings so that subsequent plot commands are displayed
-## on a single graph.
-##
-## @item hold all
-## Retain plot line color, line style, data and settings so that subsequent
-## plot commands are displayed on a single graph with the next line color and
-## style.
-##
-## @item hold off
-## Clear plot and restore default graphics settings before each new plot
-## command.  (default).
-##
-## @item hold
-## Toggle the current hold state.
-## @end table
-##
-## When given the additional argument @var{hax}, the hold state is modified
-## only for the given axis handle.
-##
-## To query the current hold state use the @code{ishold} function.
-## @seealso{ishold, cla, newplot, clf}
-## @end deftypefn
-
-function hold (varargin)
-
-  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1})
-      && strcmp (get (varargin{1}, "type"), "axes"))
-    [ax, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
-    fig = get (ax, "parent");
-  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}))
-    print_usage ();
-  else
-    ax = gca ();
-    fig = gcf ();
-    nargs = numel (varargin);
-  endif
-
-  hold_all = false;
-  if (nargs == 0)
-    turn_hold_off = ishold (ax);
-  elseif (nargs == 1)
-    state = varargin{1};
-    if (ischar (state))
-      if (strcmpi (state, "off"))
-        turn_hold_off = true;
-      elseif (strcmpi (state, "all"))
-        turn_hold_off = false;
-        hold_all = true;
-      elseif (strcmpi (state, "on"))
-        turn_hold_off = false;
-      else
-        error ("hold: invalid hold STATE");
-      endif
-    endif
-  else
-    print_usage ();
-  endif
-
-  if (turn_hold_off)
-    set (ax, "nextplot", "replace");
-  else
-    set (ax, "nextplot", "add");
-    set (fig, "nextplot", "add");
-  endif
-  set (ax, "__hold_all__", hold_all);
-
-endfunction
-
-
-%!demo
-%! clf;
-%! A = rand (100);
-%! [X, Y] = find (A > 0.9);
-%! imshow (A);
-%! hold on;
-%! plot (X, Y, 'o');
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! imagesc (1 ./ hilb (4));
-%! plot (1:4, '-s');
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! imagesc (1 ./ hilb (2));
-%! imagesc (1 ./ hilb (4));
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! hold on;
-%! plot (1:4, '-s');
-%! imagesc (1 ./ hilb (4));
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! t = linspace (-3, 3, 50);
-%! [x, y] = meshgrid (t, t);
-%! z = peaks (x, y);
-%! contourf (x, y, z, 10);
-%! hold on;
-%! plot (x(:), y(:), '^');
-%! patch ([-1.0 1.0 1.0 -1.0 -1.0], [-1.0 -1.0 1.0 1.0 -1.0], 'red');
-%! xlim ([-2.0 2.0]);
-%! ylim ([-2.0 2.0]);
-%! colorbar ('SouthOutside');
-%! title ('Test script for some plot functions');
-
-##hold on
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0 1]);
-%!   assert (! ishold);
-%!   hold on;
-%!   assert (ishold);
-%!   p1 = fill ([0 1 1], [0 0 1], "black");
-%!   p2 = fill ([0 1 0], [0 1 1], "red");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 3);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-##hold off
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0 1]);
-%!   assert (! ishold);
-%!   hold on;
-%!   assert (ishold);
-%!   p1 = fill ([0 1 1], [0 0 1], "black");
-%!   hold off;
-%!   p2 = fill ([0 1 0], [0 1 1], "red");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 1);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/isfigure.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} isfigure (@var{h})
-## Return true if @var{h} is a graphics handle that contains a figure
-## object.
-## @seealso{ishandle}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = isfigure (h)
-
-  if (nargin == 1)
-    retval = (ishandle (h) && strcmp (get (h, "type"), "figure"));
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (isfigure (hf));
-%!   assert (! isfigure (-hf));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ishghandle.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} ishghandle (@var{h})
-## Return true if @var{h} is a graphics handle and false otherwise.  This
-## function is equivalent to @code{ishandle} and is provided for compatibility
-## with @sc{matlab}.
-## @seealso{ishandle}
-## @end deftypefn
-
-function retval = ishghandle (h)
-  ## This function is just included for compatibility as Octave has
-  ## no simulink equivalent.
-  retval = ishandle (h);
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (ishghandle (hf));
-%!   assert (! ishghandle (-hf));
-%!   l = line;
-%!   ax = gca;
-%!   assert (ishghandle (ax));
-%!   assert (! ishghandle (-ax));
-%!   assert (ishghandle (l));
-%!   assert (! ishghandle (-l));
-%!   p = patch;
-%!   assert (ishghandle (p));
-%!   assert (! ishghandle (-p));
-%!   s = surface;
-%!   assert (ishghandle (s));
-%!   assert (! ishghandle (-s));
-%!   t = text;
-%!   assert (ishghandle (t));
-%!   assert (! ishghandle (-t));
-%!   i = image;
-%!   assert (ishghandle (i));
-%!   assert (! ishghandle (-i));
-%!   hg = hggroup;
-%!   assert (ishghandle (hg));
-%!   assert (! ishghandle (-hg));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ishold.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Command} {} ishold
-## @deftypefnx {Function File} {} ishold (@var{h})
-## Return true if the next plot will be added to the current plot, or
-## false if the plot device will be cleared before drawing the next plot.
-##
-## Optionally, operate on the graphics handle @var{h} rather than the current
-## plot.
-## @seealso{hold}
-## @end deftypefn
-
-function retval = ishold (h)
-
-  if (nargin == 0)
-    fig = gcf ();
-    ax = get (fig, "currentaxes");
-  elseif (nargin == 1)
-    if (ishandle (h))
-      if (isfigure (h))
-        ax = get (h, "currentaxes");
-        fig = h;
-      elseif (strcmpi (get (h, "type"), "axes"))
-        ax = h;
-        fig = get (h, "parent");
-      else
-        error ("ishold: expecting argument to be axes or figure graphics handle");
-      endif
-    else
-      error ("ishold: expecting argument to be axes or figure graphics handle");
-    endif
-  else
-    print_usage ();
-  endif
-
-  retval = (strcmpi (get (fig, "nextplot"), "add")
-            && ! isempty (ax) && strcmpi (get (ax, "nextplot"), "add"));
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   assert (! ishold);
-%!   assert (isempty (get (hf, "currentaxes")));
-%!   assert (get (hf, "NextPlot"), "add");
-%!   l = plot ([0 1]);
-%!   assert (! ishold);
-%!   assert (! ishold (gca));
-%!   assert (get (gca, "NextPlot"), "replace");
-%!   assert (get (hf, "NextPlot"), "add");
-%!   hold;
-%!   assert (ishold);
-%!   assert (ishold (gca));
-%!   assert (get (gca, "NextPlot"), "add");
-%!   assert (get (hf, "NextPlot"), "add");
-%!   p = fill ([0 1 1], [0 0 1],"black");
-%!   assert (length (get (hf, "children")), 1);
-%!   assert (length (get (gca, "children")), 2);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/isocolors.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{cd}] =} isocolors (@var{c}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{r}, @var{g}, @var{b}, @var{v})
-## @deftypefnx {Function File} {[@var{cd}] =} isocolors (@dots{}, @var{p})
-## @deftypefnx {Function File} {} isocolors (@dots{})
-##
-## If called with one output argument and the first input argument
-## @var{c} is a three-dimensional array that contains color values and
-## the second input argument @var{v} keeps the vertices of a geometry
-## then return a matrix @var{cd} with color data information for the
-## geometry at computed points
-## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
-## @var{cd} can be taken to manually set FaceVertexCData of a patch.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays of the same size than @var{c}
-## then the color data is taken at those given points.  Instead of the
-## color data @var{c} this function can also be called with RGB values
-## @var{r}, @var{g}, @var{b}.  If input argumnets @var{x}, @var{y},
-## @var{z} are not given then again @command{meshgrid} computed values
-## are taken.
-##
-## Optionally, the patch handle @var{p} can be given as the last input
-## argument to all variations of function calls instead of the vertices
-## data @var{v}.  Finally, if no output argument is given then directly
-## change the colors of a patch that is given by the patch handle
-## @var{p}.
-##
-## For example:
-##
-## @example
-## function [] = isofinish (p)
-##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##             "PlotBoxAspectRatio", [1 1 1]);
-##   set (p, "FaceColor", "interp");
-##   ## set (p, "FaceLighting", "flat");
-##   ## light ("Position", [1 1 5]); ## Available with JHandles
-## endfunction
-##
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v] = isosurface (x, y, z, c, iso);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## cdat = rand (size (c));       # Compute random patch color data
-## isocolors (x, y, z, cdat, p); # Directly set colors of patch
-## isofinish (p);                # Call user function isofinish
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## [r, g, b] = meshgrid (lin, 2-lin, 2-lin);
-## cdat = isocolors (x, y, z, c, v); # Compute color data vertices
-## set (p, "FaceVertexCData", cdat); # Set color data manually
-## isofinish (p);
-##
-## subplot (2,2,3); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## cdat = isocolors (r, g, b, c, p); # Compute color data patch
-## set (p, "FaceVertexCData", cdat); # Set color data manually
-## isofinish (p);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white
-## cdat = isocolors (x, y, z, r, g, b, v);
-## set (p, "FaceVertexCData", cdat);
-## isofinish (p);
-## @end example
-##
-## @seealso{isosurface, isonormals}
-##
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isocolors (varargin)
-  calc_rgb = false;
-  switch (nargin)
-    case 2
-      c = varargin{1};
-      vp = varargin{2};
-      x = 1:size (c, 2);
-      y = 1:size (c, 1);
-      z = 1:size (c, 3);
-    case 4
-      calc_rgb = true;
-      R = varargin{1};
-      G = varargin{2};
-      B = varargin{3};
-      vp = varargin{4};
-      x = 1:size (R, 1);
-      y = 1:size (R, 2);
-      z = 1:size (R, 3);
-    case 5
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      c = varargin{4};
-      vp = varargin{5};
-    case 7
-      calc_rgb = true;
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      R = varargin{4};
-      G = varargin{5};
-      B = varargin{6};
-      vp = varargin{7};
-    otherwise
-      print_usage ();
-  endswitch
-  if (ismatrix (vp) && columns (vp) == 3)
-    pa = [];
-    v = vp;
-  elseif ( ishandle (vp) )
-    pa = vp;
-    v = get (pa, "Vertices");
-  else
-    error ("isocolors: last argument is not a vertex list or patch handle");
-  endif
-  if (calc_rgb)
-    new_col = zeros (rows (v), 3);
-    new_col(:,1) = __interp_cube__ (x, y, z, R, v, "values" );
-    new_col(:,2) = __interp_cube__ (x, y, z, G, v, "values" );
-    new_col(:,3) = __interp_cube__ (x, y, z, B, v, "values" );
-  else
-    new_col = __interp_cube__ (x, y, z, c, v, "values" );
-  endif
-  switch (nargout)
-    case 0
-      if (!isempty (pa))
-        set (pa, "FaceVertexCData", new_col);
-      endif
-    case 1
-      varargout = {new_col};
-    otherwise
-      print_usage ();
-  endswitch
-endfunction
-
-
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
-%! [f, v] = isosurface (x, y, z, c, .4);
-%! cdat = isocolors (x, y, z, c, v);
-%! assert (rows (cdat) == rows (v));
-## Can't create a patch handle for tests without a figure
-
--- a/scripts/plot/isonormals.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{n}] =} isonormals (@var{val}, @var{v})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{val}, @var{p})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{p})
-## @deftypefnx {Function File} {[@var{n}] =} isonormals (@dots{}, "negate")
-## @deftypefnx {Function File} {} isonormals (@dots{}, @var{p})
-##
-## If called with one output argument and the first input argument
-## @var{val} is a three-dimensional array that contains the data for an
-## isosurface geometry and the second input argument @var{v} keeps the
-## vertices of an isosurface then return the normals @var{n} in form of
-## a matrix with the same size than @var{v} at computed points
-## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output argument
-## @var{n} can be taken to manually set @var{VertexNormals} of a patch.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays with the same size than @var{val}
-## then the volume data is taken at those given points.  Instead of the
-## vertices data @var{v} a patch handle @var{p} can be passed to this
-## function.
-##
-## If given the string input argument "negate" as last input argument
-## then compute the reverse vector normals of an isosurface geometry.
-##
-## If no output argument is given then directly redraw the patch that is
-## given by the patch handle @var{p}.
-##
-## For example:
-## @c Set example in small font to prevent overfull line
-##
-## @smallexample
-## function [] = isofinish (p)
-##   set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##             "PlotBoxAspectRatio", [1 1 1]);
-##   set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals
-##   set (p, "FaceColor", "interp");
-##   ## set (p, "FaceLighting", "phong");
-##   ## light ("Position", [1 1 5]); # Available with JHandles
-## endfunction
-##
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v, cdat] = isosurface (x, y, z, c, iso, y);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isofinish (p); ## Call user function isofinish
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isonormals (x, y, z, c, p); # Directly modify patch
-## isofinish (p);
-##
-## subplot (2,2,3); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## n = isonormals (x, y, z, c, v); # Compute normals of isosurface
-## set (p, "VertexNormals", n);    # Manually set vertex normals
-## isofinish (p);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## isonormals (x, y, z, c, v, "negate"); # Use reverse directly
-## isofinish (p);
-## @end smallexample
-##
-## @seealso{isosurface, isocolors}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isonormals (varargin)
-  na = nargin;
-  negate = false;
-  if (ischar (varargin{nargin}))
-    na = nargin-1;
-    if (strcmp (lower (varargin{nargin}), "negate"))
-      negate = true;
-    else
-      error ("isonormals: Unknown option '%s'", varargin{nargin});
-    endif
-  endif
-  switch (na)
-    case 2
-      c = varargin{1};
-      vp = varargin{2};
-      x = 1:size (c, 2);
-      y = 1:size (c, 1);
-      z = 1:size (c, 3);
-    case 5
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      c = varargin{4};
-      vp = varargin{5};
-    otherwise
-      print_usage ();
-  endswitch
-  if (ismatrix (vp) && columns (vp) == 3)
-    pa = [];
-    v = vp;
-  elseif (ishandle (vp))
-    pa = vp;
-    v = get (pa, "Vertices");
-  else
-    error ("isonormals: Last argument is not a vertex list or a patch handle");
-  endif
-  if (negate)
-    normals = -__interp_cube__ (x, y, z, c, v, "normals");
-  else
-    normals = __interp_cube__ (x, y, z, c, v, "normals");
-  endif
-  switch (nargout)
-    case 0
-      if (!isempty (pa))
-        set (pa, "VertexNormals", normals);
-      endif
-    case 1
-      varargout = {normals};
-    otherwise
-      print_usage ();
-  endswitch
-endfunction
-
-
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
-%! n = isonormals (x, y, z, c, v);
-%! assert (size (v), size (n));
-%!test
-%! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2);
-%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-%! [f, v, cdat] = isosurface (x, y, z, c, .4, y);
-%! np = isonormals (x, y, z, c, v);
-%! nn = isonormals (x, y, z, c, v, "negate");
-%! assert (np, -nn);
-
--- a/scripts/plot/isosurface.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fv}] =} isosurface (@var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{fv}] =} isosurface (@dots{}, "noshare", "verbose")
-## @deftypefnx {Function File} {[@var{fvc}] =} isosurface (@dots{}, @var{col})
-## @deftypefnx {Function File} {[@var{f}, @var{v}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{f}, @var{v}, @var{c}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-## @deftypefnx {Function File} {} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col}, @var{opt})
-##
-## If called with one output argument and the first input argument
-## @var{val} is a three-dimensional array that contains the data of an
-## isosurface geometry and the second input argument @var{iso} keeps the
-## isovalue as a scalar value then return a structure array @var{fv}
-## that contains the fields @var{Faces} and @var{Vertices} at computed
-## points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}.  The output
-## argument @var{fv} can directly be taken as an input argument for the
-## @command{patch} function.
-##
-## If called with further input arguments @var{x}, @var{y} and @var{z}
-## which are three--dimensional arrays with the same size than @var{val}
-## then the volume data is taken at those given points.
-##
-## The string input argument "noshare" is only for compatibility and
-## has no effect.  If given the string input argument
-## "verbose" then print messages to the command line interface about the
-## current progress.
-##
-## If called with the input argument @var{col} which is a
-## three-dimensional array of the same size than @var{val} then take
-## those values for the interpolation of coloring the isosurface
-## geometry.  Add the field @var{FaceVertexCData} to the structure
-## array @var{fv}.
-##
-## If called with two or three output arguments then return the
-## information about the faces @var{f}, vertices @var{v} and color data
-## @var{c} as separate arrays instead of a single structure array.
-##
-## If called with no output argument then directly process the
-## isosurface geometry with the @command{patch} command.
-##
-## For example,
-##
-## @example
-## @group
-## [x, y, z] = meshgrid (1:5, 1:5, 1:5);
-## val = rand (5, 5, 5);
-## isosurface (x, y, z, val, .5);
-## @end group
-## @end example
-##
-## @noindent
-## will directly draw a random isosurface geometry in a graphics window.
-## Another example for an isosurface geometry with different additional
-## coloring
-## @c Set example in small font to prevent overfull line
-##
-## @smallexample
-## N = 15;    # Increase number of vertices in each direction
-## iso = .4;  # Change isovalue to .1 to display a sphere
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
-## figure (); # Open another figure window
-##
-## subplot (2,2,1); view (-38, 20);
-## [f, v] = isosurface (x, y, z, c, iso);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceColor", "green", "FaceLighting", "phong");
-## # light ("Position", [1 1 5]); # Available with the JHandles package
-##
-## subplot (2,2,2); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceColor", "none", "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-##
-## subplot (2,2,3); view (-38, 20);
-## [f, v, c] = isosurface (x, y, z, c, iso, y);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
-##            "FaceColor", "interp", "EdgeColor", "none");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-##
-## subplot (2,2,4); view (-38, 20);
-## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
-##            "FaceColor", "interp", "EdgeColor", "blue");
-## set (gca, "PlotBoxAspectRatioMode", "manual", ...
-##           "PlotBoxAspectRatio", [1 1 1]);
-## # set (p, "FaceLighting", "phong");
-## # light ("Position", [1 1 5]);
-## @end smallexample
-##
-## @seealso{isonormals, isocolors}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function varargout = isosurface (varargin)
-
-  if (nargin < 2 || nargin > 8 || nargout > 3)
-    print_usage ();
-  endif
-
-  calc_colors = false;
-  f = v = c = [];
-  verbose = false;
-  noshare = false;
-  if (nargin >= 5)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    val = varargin{4};
-    iso = varargin{5};
-    if (nargin >= 6 && ismatrix (varargin{6}))
-      colors = varargin{6};
-      calc_colors = true;
-    endif
-  else
-    val = varargin{1};
-    [n2, n1, n3] = size (val);
-    [x, y, z] = meshgrid (1:n1, 1:n2, 1:n3);
-    iso = varargin{2};
-    if (nargin >= 3 && ismatrix (varargin{3}))
-        colors = varargin{3};
-        calc_colors = true;
-    endif
-  endif
-  if (calc_colors)
-    if (nargout == 2)
-      warning ( "Colors will be calculated, but you did not specify an output argument for it!" );
-    endif
-    [fvc.faces, fvc.vertices, fvc.facevertexcdata] = __marching_cube__ (x, y, z, val, iso, colors);
-  else
-    [fvc.faces, fvc.vertices] = __marching_cube__ (x, y, z, val, iso);
-  endif
-
-  if (isempty (fvc.vertices) || isempty (fvc.faces))
-    warning ( "The resulting triangulation is empty" );
-  endif
-
-  switch (nargout)
-    case 0
-      ## plot the calculated surface
-      newplot ();
-      if (calc_colors)
-        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
-                    "FaceVertexCData", fvc.facevertexcdata,
-                    "FaceColor", "flat", "EdgeColor", "none");
-      else
-        pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices,
-                    "FaceColor", "g", "EdgeColor", "k");
-      endif
-      if (! ishold ())
-        set (gca (), "view", [-37.5, 30],
-             "xgrid", "on", "ygrid", "on", "zgrid", "on");
-      endif
-    case 1
-      varargout = {fvc};
-    case 2
-      varargout = {fvc.faces, fvc.vertices};
-    case 3
-      varargout = {fvc.faces, fvc.vertices, fvc.facevertexcdata};
-    otherwise
-      print_usage ();
-  endswitch
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
-%! v = x.^2 + y.^2 + z.^2;
-%! isosurface (x, y, z, v, 1);
-
-%!shared x, y, z, val
-%! [x, y, z]  = meshgrid (0:1, 0:1, 0:1); # Points for single
-%! val        = [0, 0; 0, 0];             # cube and a 3-D
-%! val(:,:,2) = [0, 0; 1, 0];             # array of values
-%!test
-%! fv = isosurface (x, y, z, val, 0.3);
-%! assert (isfield (fv, "vertices"), true);
-%! assert (isfield (fv, "faces"), true);
-%! assert (size (fv.vertices), [3 3]);
-%! assert (size (fv.faces), [1 3]);
-%!test
-%! fvc = isosurface (x, y, z, val, .3, y);
-%! assert (isfield (fvc, "vertices"), true);
-%! assert (isfield (fvc, "faces"), true);
-%! assert (isfield (fvc, "facevertexcdata"), true);
-%! assert (size (fvc.vertices), [3 3]);
-%! assert (size (fvc.faces), [1 3]);
-%! assert (size (fvc.facevertexcdata), [3 1]);
-%!test
-%! [f, v] = isosurface (x, y, z, val, .3);
-%! assert (size (f), [1 3]);
-%! assert (size (v), [3 3]);
-%!test
-%! [f, v, c] = isosurface (x, y, z, val, .3, y);
-%! assert (size (f), [1 3]);
-%! assert (size (v), [3 3]);
-%! assert (size (c), [3 1]);
-
--- a/scripts/plot/isprop.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{res} =} isprop (@var{h}, @var{prop})
-## Return true if @var{prop} is a property of the object with handle @var{h}.
-## @seealso{get, set}
-## @end deftypefn
-
-## Author: Ben Abbott  <bpabbott@mac.com>
-
-function res = isprop (h, prop)
-  ## Check input
-  if (nargin < 1 || nargin > 2)
-    print_usage ();
-  endif
-
-  if (! all (ishandle (h)))
-    error ("isprop: first input argument must be a handle");
-  elseif (! ischar (prop))
-    error ("isprop: second input argument must be string");
-  endif
-
-  res = false (size (h));
-  for n = 1:numel (res)
-    res(n) = true;
-    try
-      v = get (h(n), prop);
-    catch
-      res(n) = false;
-    end_try_catch
-  endfor
-endfunction
-
-
-%!assert (isprop (0, "foobar"), false)
-%!assert (isprop (0, "screenpixelsperinch"), true)
-%!assert (isprop (zeros (2, 3), "visible"), true (2, 3))
-
--- a/scripts/plot/legend.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1447 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} legend (@var{str1}, @var{str2}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{matstr})
-## @deftypefnx {Function File} {} legend (@var{cellstr})
-## @deftypefnx {Function File} {} legend (@dots{}, "location", @var{pos})
-## @deftypefnx {Function File} {} legend (@dots{}, "orientation", @var{orient})
-## @deftypefnx {Function File} {} legend (@var{hax}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{hobjs}, @dots{})
-## @deftypefnx {Function File} {} legend (@var{hax}, @var{hobjs}, @dots{})
-## @deftypefnx {Function File} {} legend ("@var{option}")
-## @deftypefnx {Function File} {[@var{hleg}, @var{hleg_obj}, @var{hplot}, @var{labels}] =} legend (@dots{})
-##
-## Display a legend for the axes with handle @var{hax}, or the current axes,
-## using the specified strings as labels.  Legend entries may be specified
-## as individual character string arguments, a character array, or a cell
-## array of character strings.  If the handles, @var{hobjs}, are not specified
-## then the legend's strings will be associated with the axes' descendants.
-## @code{legend} works on line graphs, bar graphs, etc.
-## A plot must exist before legend is called.
-##
-## The optional parameter @var{pos} specifies the location of the legend
-## as follows:
-##
-## @multitable @columnfractions 0.06 0.14 0.80
-##
-## @headitem @tab @var{pos} @tab
-##   location of the legend
-##
-## @item @tab north @tab
-##   center top
-##
-## @item @tab south @tab
-##   center bottom
-##
-## @item @tab east @tab
-##   right center
-##
-## @item @tab west @tab
-##   left center
-##
-## @item @tab northeast @tab
-##   right top (default)
-##
-## @item @tab northwest @tab
-##   left top
-##
-## @item @tab southeast @tab
-##   right bottom
-##
-## @item @tab southwest @tab
-##   left bottom
-##
-## @item
-##
-## @item @tab outside @tab
-##   can be appended to any location string
-## @end multitable
-##
-## The optional parameter @var{orient} determines if the key elements
-## are placed vertically or horizontally.  The allowed values are
-## "vertical" (default) or "horizontal".
-##
-## The following customizations are available using @var{option}:
-##
-## @table @asis
-## @item "show"
-##   Show legend on the plot
-##
-## @item "hide"
-##   Hide legend on the plot
-##
-## @item "toggle"
-##   Toggles between "hide" and "show"
-##
-## @item "boxon"
-##   Show a box around legend
-##
-## @item "boxoff"
-##   Hide the box around legend
-##
-## @item "left"
-##   Place label text to the left of the keys
-##
-## @item "right"
-##   Place label text to the right of the keys
-##
-## @item  "off"
-##   Delete the legend object
-## @end table
-##
-## The optional output values are
-##
-## @table @var
-## @item hleg
-##   The graphics handle of the legend object.
-##
-## @item hleg_obj
-##   Graphics handles to the text and line objects which make up the legend.
-##
-## @item hplot
-##   Graphics handles to the plot objects which were used in making the legend.
-##
-## @item labels
-##   A cell array of strings of the labels in the legend.
-## @end table 
-##
-## The legend label text is either provided in the call to @code{legend} or
-## is taken from the DisplayName property of graphics objects.  If no
-## labels or DisplayNames are available, then the label text is simply
-## "data1", "data2", @dots{}, @nospell{"dataN"}.
-## @end deftypefn
-
-function [hlegend2, hobjects2, hplot2, text_strings2] = legend (varargin)
-
-  if (nargin > 0
-      && (! ishandle (varargin{1})
-          || (strcmp (get (varargin{1}, "type"), "axes")
-              && ! strcmp (get (varargin{1}, "tag"), "legend"))))
-    [ca, varargin, nargs] = __plt_get_axis_arg__ ("legend", varargin{:});
-    fig = get (ca, "parent");
-  else
-    fig = get (0, "currentfigure");
-    if (isempty (fig))
-      fig = gcf ();
-    endif
-    ca = gca ();
-  endif
-
-  ## Special handling for plotyy which has two axes objects
-  if (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
-    plty = get (ca, "__plotyy_axes__");
-    if (isscalar (plty) && ishandle (plty))
-      ca = [ca, plty];
-    elseif (iscell (plty))
-      ca = [ca, plty{:}];
-    elseif (all (ishandle (plty)))
-      ca = [ca, plty(:).'];
-    else
-      error ("legend.m: This should not happen. File a bug report.");
-    endif
-    ## Remove duplicates while preserving order
-    [~, n] = unique (ca);
-    ca = ca(sort (n));
-  endif
-
-  if (nargin > 0 && all (ishandle (varargin{1})))
-    kids = flipud (varargin{1}(:));
-    varargin(1) = [];
-  else
-    kids = ca;
-    kids(strcmp (get (ca, "tag"), "legend")) = [];
-    if (isscalar (kids))
-      kids = get (kids, "children")(:);
-    else
-      kids = flipud ([get(kids, "children"){:}](:));
-    endif
-  endif
-  nargs = numel (varargin);
-  nkids = numel (kids);
-
-  orientation = "default";
-  location = "default";
-  show = "create";
-  textpos = "default";
-  box = "default";
-
-  ## Process old way of specifying location with a number rather than a string.
-  if (nargs > 0)
-    pos = varargin{nargs};
-    if (isnumeric (pos) && isscalar (pos) && pos == fix (pos))
-      if (pos >= -1 && pos <= 4)
-        location = [{"northeastoutside", "best", "northeast",
-                     "northwest", "southwest", "southeast"}] {pos + 2};
-        nargs--;
-      else
-        error ("legend: invalid location specified");
-      endif
-    endif
-  endif
-
-  ## Find location and orientation property/value pairs
-  while (nargs > 1)
-    pos = varargin{nargs-1};
-    str = varargin{nargs};
-    if (strcmpi (pos, "location") && ischar (str))
-      location = lower (str);
-      nargs -= 2;
-    elseif (strcmpi (pos, "orientation") && ischar (str))
-      orientation = lower (str);
-      nargs -= 2;
-    else
-      break;
-    endif
-  endwhile
-
-  ## Validate the orientation
-  switch (orientation)
-    case {"vertical", "horizontal", "default"}
-      ## These are all accepted orientations.
-    otherwise
-      error ("legend: unrecognized legend orientation");
-  endswitch
-
-  ## Validate the location type
-  outside = false;
-  inout = strfind (location, "outside");
-  if (! isempty (inout))
-    outside = true;
-    location = location(1:inout-1);
-  else
-    outside = false;
-  endif
-
-  switch (location)
-    case {"north", "south", "east", "west", "northeast", "northwest", ...
-          "southeast", "southwest", "default"}
-    case "best"
-      warning ("legend: 'best' not yet implemented for location specifier\n");
-      location = "northeast";
-    otherwise
-      error ("legend: unrecognized legend location");
-  endswitch
-
-  ## Find any existing legend object on figure
-  hlegend = [];
-  fkids = get (fig, "children");
-  for i = 1 : numel (fkids)
-    if (ishandle (fkids(i)) && strcmp (get (fkids(i), "type"), "axes")
-        && (strcmp (get (fkids(i), "tag"), "legend")))
-      udata = get (fkids(i), "userdata");
-      if (! isempty (intersect (udata.handle, ca)))
-        hlegend = fkids(i);
-        break;
-      endif
-    endif
-  endfor
-
-  if (nargs == 1)
-    arg = varargin{1};
-    if (ischar (arg))
-      if (rows (arg) == 1)
-        str = tolower (strtrim (arg));
-        switch (str)
-          case "off"
-            delete (hlegend);
-            return;
-          case "hide"
-            show = "off";
-            nargs--;
-          case "show"
-            if (! isempty (hlegend))
-              show = "on";
-            else
-              show = "create";
-              textpos = "left";
-            endif
-            nargs--;
-          case "toggle"
-            if (isempty (hlegend))
-              show = "create";
-              textpos = "left";
-            elseif (strcmp (get (hlegend, "visible"), "off"))
-              show = "on";
-            else
-              show = "off";
-            endif
-            nargs--;
-          case "boxon"
-            box = "on";
-            nargs--;
-          case "boxoff"
-            box = "off";
-            nargs--;
-          case "left"
-            textpos = "left";
-            nargs--;
-          case "right"
-            textpos = "right";
-            nargs--;
-        endswitch
-      else
-        ## Character matrix of labels
-        varargin = cellstr (arg);
-        nargs = numel (varargin);
-      endif
-    elseif (iscellstr (arg))
-      ## Cell array of labels
-      varargin = arg;
-      nargs = numel (varargin);
-    else
-      error ("legend: expecting argument to be a character string");
-    endif
-  elseif (nargs > 1 && iscellstr (varargin{1}))
-    ## Cell array of labels followed by property/value pairs
-    varargin = {varargin{1}{:}, varargin{2:end}};
-    nargs = numel (varargin);
-  endif
-
-  have_labels = (nargs > 0);
-
-  if (strcmp (show, "off"))
-    if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "off");
-      hlegend = [];
-    endif
-    hobjects = [];
-    hplots  = [];
-    text_strings = {};
-  elseif (strcmp (show, "on"))
-    if (! isempty (hlegend))
-      set (findobj (hlegend), "visible", "on");
-      ## NOTE - Matlab sets both "visible", and "box" to "on"
-      set (hlegend, "visible", get (hlegend, "box"));
-    else
-      hobjects = [];
-      hplots  = [];
-      text_strings = {};
-    endif
-  elseif (strcmp (box, "on"))
-    if (! isempty (hlegend))
-      set (hlegend, "box", "on", "visible", "on");
-    endif
-  elseif (strcmp (box, "off"))
-    if (! isempty (hlegend))
-      set (hlegend, "box", "off", "visible", "off");
-    endif
-  elseif (! have_labels && !(strcmp (location, "default") &&
-                             strcmp (orientation, "default")))
-    ## Changing location or orientation of existing legend
-    if (! isempty (hlegend))
-      hax = getfield (get (hlegend, "userdata"), "handle");
-      [hplots, text_strings] = __getlegenddata__ (hlegend);
-
-      if (strcmp (location, "default"))
-        h = legend (hax, hplots, text_strings, "orientation", orientation);
-      elseif (strcmp (orientation, "default"))
-        if (outside)
-          h = legend (hax, hplots, text_strings, "location",
-                      strcat (location, "outside"));
-        else
-          h = legend (hax, hplots, text_strings, "location", location);
-        endif
-      else
-        if (outside)
-          h = legend (hax, hplots, text_strings, "location",
-                      strcat (location, "outside"), "orientation", orientation);
-        else
-          h = legend (hax, hplots, text_strings, "location", location,
-                      "orientation", orientation);
-        endif
-      endif
-    endif
-  else
-    ## Create new legend
-    hobjects = [];
-    hplots  = [];
-    text_strings = {};
-
-    if (have_labels)
-      ## Check for valid data that can be labeled.
-      have_data = false;
-      have_dname = false;
-      for k = 1 : nkids
-        typ = get (kids(k), "type");
-        if (strcmp (typ, "line") || strcmp (typ, "surface")
-            || strcmp (typ, "patch") || strcmp (typ, "hggroup"))
-          have_data = true;
-          break;
-        endif
-      endfor
-
-      if (! have_data)
-        warning ("legend: plot data is empty; setting key labels has no effect");
-      endif
-    else
-      ## No labels.  Search for DisplayName property.
-      have_dname = false;
-      for k = 1 : nkids
-        hkid = kids(k);
-        typ = get (hkid, "type");
-        if (strcmp (typ, "line") || strcmp (typ, "surface")
-            || strcmp (typ, "patch"))
-          if (! isempty (get (hkid, "displayname")))
-            have_dname = true;
-            break;
-          endif
-        elseif (strcmp (typ, "hggroup"))
-          hgkids = get (hkid, "children");
-          for j = 1 : length (hgkids)
-            hgobj = get (hgkids(j));
-            if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname))
-              have_dname = true;
-              break;  # break from j-loop over hgkids
-            endif
-          endfor
-          if (have_dname)
-            break;  # break from k loop over nkids
-          endif
-        endif  # elseif hggroup
-      endfor   # for loop k = 1 : nkids
-    endif      # else branch of if (have_labels)
-
-    if (have_labels || ! have_dname)
-      k = nkids;
-      if (! have_labels)
-        varargin = arrayfun (@(x) sprintf ("data%d", x), [1:nkids]',
-                             "uniformoutput", false);
-        have_labels = true;
-        nargs = nkids;
-      endif
-      for i = 1 : nargs
-        arg = varargin{i};
-        if (ischar (arg))
-          typ = get (kids(k), "type");
-          while (k > 0
-                 && ! (strcmp (typ, "line") || strcmp (typ, "surface")
-                       || strcmp (typ, "patch") || strcmp (typ, "hggroup")))
-            typ = get (kids(--k), "type");
-          endwhile
-          if (k > 0)
-            if (strcmp (get (kids(k), "type"), "hggroup"))
-              hgkids = get (kids(k), "children");
-              for j = 1 : length (hgkids)
-                hgobj = get (hgkids(j));
-                if (isfield (hgobj, "displayname"))
-                  if (have_labels)
-                    set (hgkids(j), "displayname", arg);
-                  endif
-                  hplots = [hplots, hgkids(j)];
-                  text_strings = {text_strings{:}, arg};
-                  break;
-                endif
-              endfor
-            else
-              if (have_labels)
-                set (kids(k), "displayname", arg);
-              endif
-              hplots = [hplots, kids(k)];
-              text_strings = {text_strings{:}, arg};
-            endif
-
-            if (--k == 0)
-              break;
-            endif
-          else
-            break;  # k = 0, no further handles to process
-          endif
-        else
-          error ("legend: expecting argument to be a character string");
-        endif
-      endfor
-      if (have_labels && i < nargs)
-        warning ("legend: ignoring extra labels");
-      endif
-    else
-      ## No labels specified but objects have DisplayName property set.
-      k = nkids;
-      while (k > 0)
-        typ = get (kids(k), "type");
-        while (k > 1
-               && ! (strcmp (typ, "line") || strcmp (typ, "surface")
-                     || strcmp (typ, "patch") || strcmp (typ, "hggroup")))
-          typ = get (kids(--k), "type");
-        endwhile
-        if (! (strcmp (typ, "line") || strcmp (typ, "surface")
-               || strcmp (typ, "patch") || strcmp (typ, "hggroup")))
-          break;
-        endif
-        if (k > 0)
-          if (strcmp (get (kids(k), "type"), "hggroup"))
-            hgkids = get (kids(k), "children");
-            for j = 1 : length (hgkids)
-              hgobj = get (hgkids(j));
-              if (isfield (hgobj, "displayname")
-                  && ! isempty (hgobj.displayname))
-                hplots = [hplots, hgkids(j)];
-                text_strings = {text_strings{:}, hgobj.displayname};
-                break;
-              endif
-            endfor
-          else
-            if (! isempty (get (kids(k), "displayname")))
-              hplots = [hplots, kids(k)];
-              text_strings = {text_strings{:}, get(kids(k), "displayname")};
-            endif
-          endif
-          if (--k == 0)
-            break;
-          endif
-        endif
-      endwhile
-    endif
-
-    if (isempty (hplots))
-      if (! isempty (hlegend))
-        fkids = get (fig, "children");
-        delete (fkids(fkids == hlegend));
-        hlegend = [];
-        hobjects = [];
-        hplots  = [];
-        text_strings = {};
-      endif
-    else
-      ## Preserve the old legend if it exists
-      if (! isempty (hlegend))
-        if (strcmp (textpos, "default"))
-          textpos = get (hlegend, "textposition");
-        endif
-        if (strcmp (location, "default"))
-          location = get (hlegend, "location");
-          inout = strfind (location, "outside");
-          if (! isempty (inout))
-            outside = true;
-            location = location(1:inout-1);
-          else
-            outside = false;
-          endif
-        endif
-        if (strcmp (orientation, "default"))
-          orientation = get (hlegend, "orientation");
-        endif
-        box = get (hlegend, "box");
-      else
-        if (strcmp (textpos, "default"))
-          textpos = "left";
-        endif
-        if (strcmp (location, "default"))
-          location = "northeast";
-        endif
-        if (strcmp (orientation, "default"))
-          orientation = "vertical";
-        endif
-        box = "on";
-      endif
-
-      ## Get axis size and fontsize in points.
-      ## Rely on listener to handle coversion.
-      units = get (ca(1), "units");
-      fontunits = get (ca(1), "fontunits");
-      unwind_protect
-        set (ca(1), "units", "points");
-        set (ca(1), "fontunits", "points");
-        if (isempty (hlegend) || ! isprop (hlegend, "unmodified_axes_position"))
-          unmodified_axes_position = get (ca(1), "position");
-          unmodified_axes_outerposition = get (ca(1), "outerposition");
-        else
-          unmodified_axes_position = get (hlegend, "unmodified_axes_position");
-          unmodified_axes_outerposition = get (hlegend, ...
-                                               "unmodified_axes_outerposition");
-        endif
-        ca_pos = unmodified_axes_position;
-        ca_outpos = unmodified_axes_outerposition;
-        ca_fontsize = get (ca(1), "fontsize");
-      unwind_protect_cleanup
-        set (ca(1), "units", units);
-        set (ca(1), "fontunits", fontunits);
-      end_unwind_protect
-
-      ## Padding between legend entries horizontally and vertically
-      xpad = 2;
-      ypad = 2;
-
-      linelength = 15;
-
-      ## Create the axis first
-      ## FIXME hlegend should inherit properties from "ca"
-      curaxes = get (fig, "currentaxes");
-      unwind_protect
-        ud = ancestor (hplots, "axes");
-        if (!isscalar (ud))
-          ud = unique ([ud{:}]);
-        endif
-        if (isempty (hlegend))
-          addprops = true;
-          hlegend = axes ("tag", "legend", "userdata", struct ("handle", ud),
-                          "box", box,
-                          "xtick", [], "ytick", [],
-                          "xticklabel", "", "yticklabel", "", "zticklabel", "",
-                          "xlim", [0, 1], "ylim", [0, 1],
-                          "visible", ifelse (strcmp (box, "on"), "on", "off"),
-                          "activepositionproperty", "position",
-                          "fontsize", ca_fontsize);
-        else
-          addprops = false;
-          axes (hlegend);
-          delete (get (hlegend, "children"));
-        endif
-        fontsize = get (hlegend, "fontsize");
-        ## Add text label to the axis first, checking their extents
-        nentries = numel (hplots);
-        texthandle = [];
-        maxwidth = 0;
-        maxheight = 0;
-        for k = 1 : nentries
-          if (strcmp (textpos, "right"))
-            texthandle = [texthandle, text(0, 0, text_strings{k},
-                                           "horizontalalignment", "left",
-                                           "userdata", hplots(k),
-                                           "fontsize", fontsize)];
-          else
-            texthandle = [texthandle, text(0, 0, text_strings{k},
-                                           "horizontalalignment", "right",
-                                           "userdata", hplots(k),
-                                           "fontsize", fontsize)];
-          endif
-          units = get (texthandle(end), "units");
-          unwind_protect
-            set (texthandle(end), "units", "points");
-            extents = get (texthandle(end), "extent");
-            maxwidth = max (maxwidth, extents(3));
-            maxheight = max (maxheight, extents(4));
-          unwind_protect_cleanup
-            set (texthandle(end), "units", units);
-          end_unwind_protect
-        endfor
-
-        num1 = nentries;
-        if (strcmp (orientation, "vertical"))
-          height = nentries * (ypad + maxheight);
-          if (outside)
-            if (height > ca_pos(4))
-              ## Avoid shrinking the height of the axis to zero if outside
-              num1 = ca_pos(4) / (maxheight + ypad) / 2;
-            endif
-          else
-            if (height > 0.9 * ca_pos(4))
-              num1 = 0.9 * ca_pos(4) / (maxheight + ypad);
-            endif
-          endif
-        else
-          width = nentries * (ypad + maxwidth);
-          if (outside)
-            if (width > ca_pos(3))
-              ## Avoid shrinking the width of the axis to zero if outside
-              num1 = ca_pos(3) / (maxwidth + ypad) / 2;
-            endif
-          else
-            if (width > 0.9 * ca_pos(3))
-              num1 = 0.9 * ca_pos(3) / (maxwidth + ypad);
-            endif
-          endif
-        endif
-        num2 = ceil (nentries / num1);
-
-        xstep = 3 * xpad + (maxwidth + linelength);
-        if (strcmp (textpos, "right"))
-          xoffset = xpad;
-          txoffset = 2 * xpad + linelength;
-        else
-          xoffset = 2 * xpad + maxwidth;
-          txoffset = xpad + maxwidth;
-        endif
-        ystep = (ypad + maxheight);
-        yoffset = ystep / 2;
-
-        ## Place the legend in the desired location
-        if (strcmp (orientation, "vertical"))
-          lpos = [0, 0, num2 * xstep, num1 * ystep];
-        else
-          lpos = [0, 0, num1 * xstep, num2 * ystep];
-        endif
-
-        if (strcmp (get (fig, "__graphics_toolkit__"), "gnuplot"))
-          ## Gnuplot places the key (legend) at edge of the figure window.
-          ## OpenGL places the legend box at edge of the unmodified axes
-          ## position.
-          if (isempty (strfind (location, "east")))
-            extra_offset = unmodified_axes_outerposition(1) ...
-                         + unmodified_axes_outerposition(3) ...
-                         - unmodified_axes_position(1) ...
-                         - unmodified_axes_position(3);
-          else
-            extra_offset = unmodified_axes_position(1) ...
-                         - unmodified_axes_outerposition(1);
-          endif
-          ## FIXME - the "fontsize" is added to match the behavior of OpenGL.
-          ## This implies that a change in fontsize should trigger a listener
-          ## to update the legend.  The "2" was determined using a long legend
-          ## key in the absence of any subplots.
-          extra_offset = extra_offset - 2 * fontsize;
-        else
-          extra_offset = 0;
-        endif
-
-        switch (location)
-          case "north"
-            if (outside)
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_outpos(2) + ca_outpos(4) - lpos(4) - ypad, lpos(3), ...
-                      lpos(4)];
-
-              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3), ca_pos(4) - lpos(4)];
-            else
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "south"
-            if (outside)
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_outpos(2) + ypad, lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2) + lpos(4), ca_pos(3), ...
-                         ca_pos(4) - lpos(4)];
-            else
-              lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ...
-                      ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-          case "east"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-            endif
-          case "west"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, ...
-                      lpos(3), lpos(4)];
-              new_pos = [ca_pos(1) + lpos(3), ca_pos(2), ...
-                         ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(1) = new_pos(1) - extra_offset;
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) +  ypad, ...
-                      ca_pos(2) + (ca_pos(4) - lpos(4)) / 2, lpos(3), lpos(4)];
-            endif
-          case "northeast"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4), lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "northwest"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad , ca_pos(2) + ca_pos(4) - lpos(4), ...
-                      lpos(3), lpos(4)];
-              new_pos = [ca_pos(1) + lpos(3), ca_pos(2), ...
-                         ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(1) = new_pos(1) - extra_offset;
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) + ypad, ...
-                      ca_pos(2) + ca_pos(4) - lpos(4) - ypad, lpos(3), lpos(4)];
-            endif
-          case "southeast"
-            if (outside)
-              lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3) - ypad, ...
-                      ca_pos(2), lpos(3), lpos(4)];
-              new_pos = [ca_pos(1), ca_pos(2), ...
-                         ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) + ca_pos(3) - lpos(3) - ypad, ...
-                      ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-          case "southwest"
-            if (outside)
-              lpos = [ca_outpos(1) + ypad, ca_pos(2), lpos(3), lpos(4)];
-              new_pos = [ca_pos(1) + lpos(3), ca_pos(2), ...
-                         ca_pos(3) - lpos(3), ca_pos(4)];
-              new_pos(1) = new_pos(1) - extra_offset;
-              new_pos(3) = new_pos(3) + extra_offset;
-            else
-              lpos = [ca_pos(1) + ypad, ca_pos(2) + ypad, lpos(3), lpos(4)];
-            endif
-        endswitch
-
-        units = get (hlegend, "units");
-        unwind_protect
-          set (hlegend, "units", "points");
-          set (hlegend, "position", lpos);
-        unwind_protect_cleanup
-          set (hlegend, "units", units);
-        end_unwind_protect
-
-        ## Now write the line segments and place the text objects correctly
-        xk = 0;
-        yk = 0;
-        for k = 1 : numel (hplots)
-          hobjects = [hobjects, texthandle(k)];
-          switch (get (hplots(k), "type"))
-          case "line"
-            color = get (hplots(k), "color");
-            style = get (hplots(k), "linestyle");
-            if (! strcmp (style, "none"))
-              l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3),
-                         "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                         "color", color, "linestyle", style, "marker", "none",
-                         "userdata", hplots (k));
-              hobjects = [hobjects, l1];
-            endif
-            marker = get (hplots(k), "marker");
-            if (! strcmp (marker, "none"))
-              l1 = line ("xdata", (xoffset + 0.5 * linelength  + xk * xstep) / lpos(3),
-                         "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4),
-                         "color", color, "linestyle", "none", "marker", marker,
-                         "markeredgecolor", get (hplots (k), "markeredgecolor"),
-                         "markerfacecolor", get (hplots (k), "markerfacecolor"),
-                         "markersize", get (hplots (k), "markersize"),
-                         "userdata", hplots (k));
-              hobjects = [hobjects, l1];
-            endif
-
-            addlistener (hplots(k), "color",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "linestyle",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "marker",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "markeredgecolor",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "markerfacecolor",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "markersize",
-                         {@updateline, hlegend, linelength});
-            addlistener (hplots(k), "displayname",
-                         {@updateline, hlegend, linelength});
-          case "patch"
-            facecolor = get (hplots(k), "facecolor");
-            edgecolor = get (hplots(k), "edgecolor");
-            cdata = get (hplots(k), "cdata");
-            if (! strcmp (facecolor, "none") || ! strcmp (edgecolor, "none"))
-              p1 = patch ("xdata", ([0, linelength, linelength, 0] +
-                                   xoffset + xk * xstep) / lpos(3),
-                         "ydata", (lpos(4) - yoffset -
-                                   [yk-0.3, yk-0.3, yk+0.3, yk+0.3] .* ystep) / lpos(4),
-                         "facecolor", facecolor, "edgecolor", edgecolor,
-                         "cdata", cdata, "userdata", hplots(k));
-              hobjects = [hobjects, p1];
-            endif
-          case "surface"
-          endswitch
-          set (texthandle (k), "position", [(txoffset + xk * xstep) / lpos(3), ...
-                                            (lpos(4) - yoffset - yk * ystep) / lpos(4)]);
-          if (strcmp (orientation, "vertical"))
-            yk++;
-            if (yk > num1)
-              yk = 0;
-              xk++;
-            endif
-          else
-            xk++;
-            if (xk > num1)
-              xk = 0;
-              yk++;
-            endif
-          endif
-        endfor
-
-        ## Add an invisible text object to original axis
-        ## that when it is destroyed will remove the legend
-        props = {"parent", ca(1), "tag", "legend", ...
-                 "handlevisibility", "off", "visible", "off", ...
-                 "xliminclude", "off", "yliminclude", "off"};
-        t1 = findall (ca(1), props{3:4}, "type", "text");
-        if (isempty (t1))
-          t1 = text (0, 0, "", props{:});
-          set (t1, "deletefcn", {@deletelegend1, hlegend});
-        endif
-        if (isprop (hlegend, "unmodified_axes_position"))
-          set (hlegend, "unmodified_axes_position", unmodified_axes_position);
-          set (hlegend, "unmodified_axes_outerposition", 
-               unmodified_axes_outerposition);
-        else
-          addproperty ("unmodified_axes_position", hlegend,
-                       "data", unmodified_axes_position);
-          addproperty ("unmodified_axes_outerposition", hlegend,
-                       "data", unmodified_axes_outerposition);
-        endif
-
-        ## Resize the axis that the legend is attached to if the
-        ## legend is "outside" the plot and create a listener to
-        ## resize axis to original size if the legend is deleted,
-        ## hidden, or shown.
-        if (outside)
-          for i = 1 : numel (ca)
-            units = get (ca(i), "units");
-            unwind_protect
-              set (ca(i), "units", "points");
-              set (ca(i), "position", new_pos);
-            unwind_protect_cleanup
-              set (ca(i), "units", units);
-            end_unwind_protect
-          endfor
-
-          set (hlegend, "deletefcn", {@deletelegend2, ca, ...
-                                      unmodified_axes_position, ...
-                                      unmodified_axes_outerposition, t1, hplots});
-          addlistener (hlegend, "visible", {@hideshowlegend, ca, ...
-                                            unmodified_axes_position, new_pos});
-        else
-          set (hlegend, "deletefcn", {@deletelegend2, ca, [], [], t1, hplots});
-        endif
-
-        if (addprops)
-          addproperty ("edgecolor", hlegend, "color", [0, 0, 0]);
-          addproperty ("textcolor", hlegend, "color", [0, 0, 0]);
-          locations = {"north", "south", "east", "west", ...
-                       "northeast", "southeast", "northwest", "southwest", ...
-                       "northoutside", "southoutside", ...
-                       "eastoutside", "westoutside", ...
-                       "northeastoutside", "southeastoutside", ...
-                       "northwestoutside", "southwestoutside"};
-          addproperty ("location", hlegend, "radio", strjoin (locations, "|"));
-          addproperty ("orientation", hlegend, "radio",
-                       "{vertical}|horizontal");
-          addproperty ("string", hlegend, "any", text_strings);
-          addproperty ("textposition", hlegend, "radio", "{left}|right");
-        else
-          set (hlegend, "string", text_strings);
-        endif
-
-        if (outside)
-          set (hlegend, "location", strcat (location, "outside"),
-               "orientation", orientation, "textposition", textpos);
-        else
-          set (hlegend, "location", location, "orientation", orientation,
-               "textposition", textpos);
-        endif
-        if (addprops)
-          addlistener (hlegend, "edgecolor", @updatelegendtext);
-          addlistener (hlegend, "textcolor", @updatelegendtext);
-          addlistener (hlegend, "fontsize", @updatelegendtext);
-          addlistener (hlegend, "interpreter", @updatelegendtext);
-          addlistener (hlegend, "location", @updatelegend);
-          addlistener (hlegend, "orientation", @updatelegend);
-          addlistener (hlegend, "string", @updatelegend);
-          addlistener (hlegend, "textposition", @updatelegend);
-        endif
-      unwind_protect_cleanup
-        set (fig, "currentaxes", curaxes);
-      end_unwind_protect
-    endif
-  endif
-
-  if (nargout > 0)
-    hlegend2 = hlegend;
-    hobjects2 = hobjects;
-    hplot2 = hplots;
-    text_strings2 = text_strings;
-  endif
-
-endfunction
-
-function updatelegend (h, d)
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-    unwind_protect
-      hax = getfield (get (h, "userdata"), "handle");
-      [hplots, text_strings] = __getlegenddata__ (h);
-      position = get (h, "unmodified_axes_position");
-      outerposition = get (h, "unmodified_axes_outerposition");
-      units = get (hax, "units");
-      set (hax, "units", "points");
-      switch get (hax, "activepositionproperty")
-      case "position"
-        set (hax, "outerposition", outerposition);
-        set (hax, "position", position);
-      case "outerposition"
-        set (hax, "position", position);
-        set (hax, "outerposition", outerposition);
-      endswitch
-      set (hax, "units", units);
-      h = legend (hax, hplots, get (h, "string"));
-    unwind_protect_cleanup
-      recursive = false;
-    end_unwind_protect
-  endif
-
-endfunction
-
-function updatelegendtext (h, d)
-  hax = get (h, "userdata").handle;
-  kids = get (h, "children");
-  text_kids = findobj (kids, "-property", "interpreter", "type", "text");
-  interpreter = get (h, "interpreter");
-  textcolor = get (h, "textcolor");
-  fontsize = get (h, "fontsize");
-  set (text_kids, "interpreter", interpreter,
-                  "fontsize", fontsize,
-                  "color", textcolor);
-endfunction
-
-function hideshowlegend (h, d, ca, pos1, pos2)
-  isvisible = strcmp (get (h, "visible"), "off");
-  if (! isvisible)
-    kids = get (h, "children");
-    for i = 1 : numel (kids)
-      if (! strcmp (get (kids(i), "visible"), "off"))
-        isvisible = true;
-        break;
-      endif
-    endfor
-  endif
-
-  for i = 1 : numel (ca)
-    if (ishandle (ca(i)) && strcmp (get (ca(i), "type"), "axes")
-        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
-        && strcmp (get (ca(i), "beingdeleted"), "off"))
-      units = get (ca(i), "units");
-      unwind_protect
-        set (ca(i), "units", "points");
-        if (isvisible)
-          set (ca(i), "position", pos2);
-        else
-          set (ca(i), "position", pos1);
-        endif
-      unwind_protect_cleanup
-        set (ca(i), "units", units);
-      end_unwind_protect
-    endif
-  endfor
-endfunction
-
-function deletelegend1 (h, d, ca)
-  if (ishandle (ca) && strcmp (get (ca, "type"), "axes")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
-      && strcmp (get (ca, "beingdeleted"), "off"))
-    delete (ca);
-  endif
-endfunction
-
-function deletelegend2 (h, d, ca, pos, outpos, t1, hplots)
-  for i = 1 : numel (ca)
-    if (ishandle (ca(i)) && strcmp (get (ca(i), "type"), "axes")
-        && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))
-        && strcmp (get (ca(i), "beingdeleted"), "off"))
-      if (!isempty (pos) && !isempty(outpos))
-        units = get (ca(i), "units");
-        unwind_protect
-          set (ca(i), "units", "points");
-          set (ca(i), "position", pos, "deletefcn", "");
-        unwind_protect_cleanup
-          set (ca(i), "units", units);
-        end_unwind_protect
-      endif
-    endif
-  endfor
-  set (t1, "deletefcn", "");
-  delete (t1);
-  for i = 1 : numel (hplots)
-    if (ishandle (hplots(i)) && strcmp (get (hplots (i), "type"), "line"))
-      dellistener (hplots(i), "color");
-      dellistener (hplots(i), "linestyle");
-      dellistener (hplots(i), "marker");
-      dellistener (hplots(i), "markeredgecolor");
-      dellistener (hplots(i), "markerfacecolor");
-      dellistener (hplots(i), "markersize");
-      dellistener (hplots(i), "displayname");
-    endif
-  endfor
-endfunction
-
-function updateline (h, d, hlegend, linelength)
-  lm = [];
-  ll = [];
-  kids = get (hlegend, "children");
-  for i = 1 : numel (kids)
-    if (get (kids(i), "userdata") == h
-        && strcmp (get (kids(i), "type"), "line"))
-      if (strcmp (get (kids (i), "marker"), "none"))
-        ll = kids(i);
-      else
-        lm = kids(i);
-      endif
-    endif
-  endfor
-
-  linestyle = get (h, "linestyle");
-  marker = get (h, "marker");
-  displayname = get (h, "displayname");
-
-  if ((isempty (displayname)
-       || (strcmp (marker, "none") && strcmp (linestyle, "none")))
-       && (! isempty (lm) || isempty (ll)))
-    ## An element was removed from the legend. Need to recall the
-    ## legend function to recreate a new legend
-    [hplots, text_strings] = __getlegenddata__ (hlegend);
-    for i = 1 : numel (hplots)
-      if (hplots(i) == h)
-        hplots(i) = [];
-        text_strings(i) = [];
-        break;
-      endif
-    endfor
-    legend (hplots, text_strings);
-  elseif ((!isempty (displayname)
-           && (! strcmp (marker, "none") || ! strcmp (linestyle, "none")))
-          && isempty (lm) && isempty (ll))
-    ## An element was added to the legend.  Need to re-call the
-    ## legend function to recreate a new legend.
-    [hplots, text_strings] = __getlegenddata__ (hlegend);
-    hplots = [hplots, h];
-    text_strings = {text_strings{:}, displayname};
-    legend (hplots, text_strings);
-  else
-    if (! isempty (ll))
-      ypos1 = get (ll,"ydata");
-      xpos1 = get (ll,"xdata");
-      ypos2 = ypos1(1);
-      xpos2 = sum (xpos1) / 2;
-      delete (ll);
-      if (! isempty (lm))
-        delete (lm);
-      endif
-    else
-      ypos2 = get (lm,"ydata");
-      xpos2 = get (lm,"xdata");
-      ypos1 = [ypos2, ypos2];
-      xpos1 = xpos2 + [-0.5, 0.5] * linelength;
-      delete (lm);
-    endif
-    if (! strcmp (linestyle, "none"))
-      line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"),
-            "linestyle", get (h, "linestyle"), "marker", "none",
-            "userdata", h, "parent", hlegend);
-    endif
-    if (! strcmp (marker, "none"))
-      line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"),
-            "marker", marker, "markeredgecolor", get (h, "markeredgecolor"),
-            "markerfacecolor", get (h, "markerfacecolor"),
-            "markersize", get (h, "markersize"), "linestyle", "none",
-            "userdata", h, "parent", hlegend);
-    endif
-  endif
-endfunction
-
-%!test
-%! graphics_toolkit ("gnuplot");
-%! h = figure ("visible", "off", "__graphics_toolkit__", "gnuplot");
-%! unwind_protect
-%!   position = get (h, "position");
-%!   plot (rand (3))
-%!   legend ()
-%!   filename = sprintf ("%s.eps", tmpnam ());
-%!   print (filename)
-%!   unlink (filename);
-%!   assert (get (h, "position"), position)
-%! unwind_protect_cleanup
-%!   close (h)
-%! end_unwind_protect
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('legend called with cellstr and string inputs for labels');
-%! h = legend ({'foo'}, 'bar');
-%! legend location northeastoutside
-%! set (h, 'fontsize', 20);
-
-%!demo
-%! clf;
-%! plot (rand (3));
-%! title ('legend() without inputs creates default labels');
-%! h = legend ();
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x,x,';I am Blue;', x,2*x, x,3*x,';I am Red;');
-%! legend location northeastoutside
-%! ## Placing legend inside should return axes to original size
-%! legend location northeast
-%! title ('Blue and Red keys, with Green missing');
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('incline is blue and decline is green');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend hide
-%! legend show
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with keys in horizontal orientation');
-%! legend ({'I am blue', 'I am green'}, ...
-%!         'location', 'east', 'orientation', 'horizontal');
-%! legend boxoff
-%! legend boxon
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with box off');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend boxoff
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with text to the right of key');
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend right
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ({'Use properties to place legend text to the right of key', ...
-%!         'Legend text color is magenta'});
-%! h = legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend ('left');
-%! set (h, 'textposition', 'right');
-%! set (h, 'textcolor', [1 0 1]);
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend is hidden')
-%! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend hide
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x,x,';I am Blue;', x,2*x,';I am Green;', x,3*x,';I am Red;');
-%! title ({'Labels are embedded in call to plot', ...
-%!         'Legend is hidden and then shown'});
-%! legend boxon
-%! legend hide
-%! legend show
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! plot (x, x, ';\alpha;',  ...
-%!       x, 2*x, ';\beta=2\alpha;',  ...
-%!       x, 3*x, ';\gamma=3\alpha;');
-%! title ('Labels with interpreted Greek text');
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('Labels with TeX interpreter turned off');
-%! h = legend ('Hello_World', 'foo^bar');
-%! set (h, 'interpreter', 'none');
-
-%!demo
-%! clf;
-%! plot (1:10, 1:10);
-%! title ('a very long label can sometimes cause problems');
-%! legend ('hello very big world', 'location', 'northeastoutside');
-
-%!demo
-%! clf;
-%! labels = {};
-%! colororder = get (gca, 'colororder');
-%! for i = 1:5
-%!   h = plot (1:100, i + rand (100,1)); hold on;
-%!   set (h, 'color', colororder(i,:));
-%!   labels = {labels{:}, ['Signal ', num2str(i)]};
-%! end
-%! hold off;
-%! title ({'Signals with random offset and uniform noise';
-%!         'Legend shown below and outside of plot'});
-%! xlabel ('Sample Nr [k]'); ylabel ('Amplitude [V]');
-%! legend (labels, 'location', 'southoutside');
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x);
-%! hold on;
-%! stem (x, x.^2, 'g');
-%! title ('First created object gets first label');
-%! legend ('linear');
-%! hold off;
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x, x, x.^2);
-%! title ('First created object gets first label');
-%! legend ('linear');
-
-%!demo
-%! clf;
-%! x = linspace (0, 10);
-%! plot (x, x, x, x.^2);
-%! title ('Labels are applied in order of object creation');
-%! legend ('linear', 'quadratic');
-
-%!demo
-%! clf;
-%! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
-%! bar (rand_2x3_data1);
-%! ylim ([0 1.0]);
-%! title ('legend() works for bar graphs (hgobjects)');
-%! legend ({'1st Bar', '2nd Bar', '3rd Bar'});
-
-%!demo
-%! clf;
-%! rand_2x3_data2 = [0.44804, 0.84368, 0.23012; 0.72311, 0.58335, 0.90531];
-%! bar (rand_2x3_data2);
-%! ylim ([0 1.2]);
-%! title ('legend() works for bar graphs (hgobjects)');
-%! legend ('1st Bar', '2nd Bar', '3rd Bar');
-%! legend right;
-
-%!demo
-%! clf;
-%! x = 0:0.1:7;
-%! h = plot (x,sin(x), x,cos(x), x,sin(x.^2/10), x,cos(x.^2/10));
-%! title ('Only the sin() objects have keylabels');
-%! legend (h([1, 3]), {'sin (x)', 'sin (x^2/10)'}, 'location', 'southwest');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin (x), ';sin (x);');
-%! hold all;
-%! plot (x, cos (x), ';cos (x);');
-%! hold off;
-%! title ('legend constructed from multiple plot calls');
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! plot (x, sin (x), ';sin (x);');
-%! hold all;
-%! plot (x, cos (x), ';cos (x);');
-%! hold off;
-%! title ('Specified label text overrides previous labels');
-%! legend ({'Sine', 'Cosine'}, 'location', 'northeastoutside');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! plot (x, rand (11));
-%! xlabel ('Indices');
-%! ylabel ('Random Values');
-%! title ('Legend ''off'' deletes the legend');
-%! legend (cellstr (num2str ((1:10)')), 'location', 'northeastoutside');
-%! legend off;
-%! axis ([0, 10, 0 1]);
-
-%!demo
-%! clf;
-%! x = (1:5)';
-%! subplot (2,2,1);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'northwestoutside');
-%! subplot (2,2,2);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'northeastoutside');
-%! subplot (2,2,3);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'southwestoutside');
-%! subplot (2,2,4);
-%!  plot (x, rand (numel (x)));
-%!  legend (cellstr (num2str (x)), 'location', 'southeastoutside');
-
-%!demo
-%! clf;
-%! plot (rand (2));
-%! title ('legend() will warn if extra labels are specified');
-%! legend ('Hello', 'World', 'interpreter', 'foobar');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #1: Blue and Green labels');
-%! legend ([h1, h2], {'Blue', 'Green'}, 'location', 'south');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #2: Blue and Green labels');
-%! legend ({'Blue', 'Green'}, 'location', 'south');
-
-%!demo
-%! clf;
-%! x = 0:10;
-%! y1 = rand (size (x));
-%! y2 = rand (size (x));
-%! [ax, h1, h2] = plotyy (x, y1, x, y2);
-%! title ('plotyy legend test #3: Blue and Green labels');
-%! legend ('Blue', 'Green', 'location', 'south');
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1);
-%! plot (rand (1,4));
-%! title ('Subplots should adjust to the legend placed outside');
-%! legend ({'1'}, 'location', 'northeastoutside');
-%! legend (option);
-%! subplot (3,1,2);
-%! plot (rand (1,4));
-%! legend ({'1234567890'}, 'location', 'eastoutside');
-%! legend (option);
-%! subplot (3,1,3);
-%! plot (rand (1,4));
-%! legend ({'12345678901234567890'}, 'location', 'southeastoutside');
-%! legend (option);
-
-%!demo % bug 36408
-%! clf;
-%! option = 'right';
-%! subplot (3,1,1)
-%! plot (rand (1,4));
-%! title ('Subplots should adjust to the legend placed outside');
-%! legend ({'1'}, 'location', 'northwestoutside');
-%! legend (option);
-%! subplot (3,1,2);
-%! plot (rand (1,4));
-%! legend ({'1234567890'}, 'location', 'westoutside');
-%! legend (option);
-%! subplot (3,1,3);
-%! plot (rand (1,4));
-%! legend ({'12345678901234567890'}, 'location', 'southwestoutside');
-%! legend (option);
-
--- a/scripts/plot/line.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} line ()
-## @deftypefnx {Function File} {} line (@var{x}, @var{y})
-## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{})
-## Create line object from @var{x} and @var{y} and insert in current
-## axes object.  Return a handle (or vector of handles) to the line
-## objects created.
-##
-## Multiple property-value pairs may be specified for the line, but they
-## must appear in pairs.
-## @end deftypefn
-
-## Author: jwe
-
-function h = line (varargin)
-
-  ## make a default line object, and make it the current axes for
-  ## the current figure.
-  tmp = __line__ (gca (), varargin{:});
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf
-%! x = 0:0.3:10;
-%! y1 = cos (x);
-%! y2 = sin (x);
-%! subplot (3,1,1);
-%!  args = {'color', 'b', 'marker', 's'};
-%!  line ([x(:), x(:)], [y1(:), y2(:)], args{:});
-%!  title ('Test broadcasting for line()');
-%! subplot (3,1,2);
-%!  line (x(:), [y1(:), y2(:)], args{:});
-%! subplot (3,1,3);
-%!  line ([x(:), x(:)+pi/2], y1(:), args{:});
-%!  xlim ([0 10]);
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = line;
-%!   assert (findobj (hf, "type", "line"), h);
-%!   assert (get (h, "xdata"), [0 1], eps);
-%!   assert (get (h, "ydata"), [0 1], eps);
-%!   assert (get (h, "type"), "line");
-%!   assert (get (h, "color"), get (0, "defaultlinecolor"));
-%!   assert (get (h, "linestyle"), get (0, "defaultlinelinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultlinelinewidth"), eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/linkprop.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hlink} =} linkprop (@var{h}, @var{prop})
-## Link graphics object properties, such that a change in one is
-## propagated to the others.  The properties to link are given as a
-## string of cell string array by @var{prop} and the objects containing
-## these properties by the handle array @var{h}.
-##
-## An example of the use of linkprop is
-##
-## @example
-## @group
-## x = 0:0.1:10;
-## subplot (1,2,1);
-## h1 = plot (x, sin (x));
-## subplot (1,2,2);
-## h2 = plot (x, cos (x));
-## hlink = linkprop ([h1, h2], @{"color","linestyle"@});
-## set (h1, "color", "green");
-## set (h2, "linestyle", "--");
-## @end group
-## @end example
-##
-## @end deftypefn
-
-function hlink = linkprop (h, prop)
-  if (ischar (prop))
-    prop = {prop};
-  elseif (!iscellstr (prop))
-    error ("linkprop: properties must be a string or cell string array");
-  endif
-
-  for i = 1 : numel (h)
-    for j = 1 : numel (prop)
-      addlistener (h(i), prop{j}, {@update_prop, h, prop{j}});
-    endfor
-  endfor
-
-  ## This should be an object that when destroyed removes the links
-  ## The below is not quite right. As when you call "clear hlink" the
-  ## hggroup continues to exist.
-  hlink = hggroup ();
-  set (hlink, "deletefcn", {@delete_prop, h, prop});
-endfunction
-
-function update_prop (h, d, hlist, prop)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      val = get (h, prop);
-      for hh = hlist(:)'
-        if (hh != h)
-          oldval = get (hh, prop);
-          if (! isequal (val, oldval))
-            set (hh, prop, val);
-          endif
-        endif
-      endfor
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function delete_prop (h, d, hlist, prop)
-  ## FIXME. Actually need to delete the linked properties.
-  ## However, only warn if the graphics objects aren't being deleted.
-  warn = false;
-  for h = hlist(:)'
-    if (ishandle (h) && !strcmpi (get (h, "beingdeleted"), "on"))
-      warn = true;
-      break;
-    endif
-  endfor
-  if (warn)
-    warning ("linkprop: can not remove linked properties");
-  endif
-endfunction
--- a/scripts/plot/loglog.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} loglog (@var{y})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} loglog (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} loglog (@dots{})
-## Produce a two-dimensional plot using log scales for both axes.  See
-## the documentation of @code{plot} for a description of the arguments
-## that @code{loglog} will accept.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogx, semilogy}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = loglog (varargin)
-
-  [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "xscale", "log", "yscale", "log");
-    if (any( strcmp (get (gca, "nextplot"), {"new", "replace"})))
-      set (h, "xminortick", "on", "yminortick", "on");
-    endif
-
-    tmp = __plt__ ("loglog", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! t = 1:0.01:10;
-%! x = sort ((t .* (1 + rand (size (t)))) .^ 2);
-%! y = (t .* (1 + rand (size (t)))) .^ 2;
-%! loglog (x, y);
-
-%!demo
-%! clf;
-%! a = logspace (-5, 1, 10);
-%! b =-logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  loglog (a, b);
-%!  xlabel ('loglog (a, b)');
-%!
-%! subplot (1,2,2);
-%!  loglog (a, abs (b));
-%!  set (gca, 'ydir', 'reverse');
-%!  xlabel ('loglog (a, abs (b))');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   loglog (a, b);
-%!   assert (get (gca, "yscale"), "log");
-%!   assert (get (gca, "xscale"), "log");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b =-logspace (-5, 1, 10);
-%!   loglog (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "ytick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/loglogerr.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} loglogerr (@var{args})
-## @deftypefnx {Function File} {@var{h} =} loglogerr (@var{args})
-## Produce two-dimensional plots on double logarithm axis with
-## errorbars.  Many different combinations of arguments are possible.
-## The most common form is
-##
-## @example
-## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a double logarithm plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  See errorbar for available formats and
-## additional information.
-## @seealso{errorbar, semilogxerr, semilogyerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = loglogerr (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "xscale", "log", "yscale", "log");
-
-    tmp = __errcomm__ ("loglogerr", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = exp (log (0.01):0.2:log (10));
-%! y = wblpdf (x, 3, 2);
-%! eyu = 2*rand (size (y)) .* y;
-%! eyl = 0.5*rand (size (y)) .* y;
-%! loglogerr (x, y, eyl, eyu, '#~x-');
-%! xlim (x([1, end]));
-
--- a/scripts/plot/mesh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} mesh (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} mesh (@var{z})
-## @deftypefnx {Function File} {} mesh (@dots{}, @var{c})
-## @deftypefnx {Function File} {} mesh (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} mesh (@dots{})
-## Plot a mesh given matrices @var{x}, and @var{y} from @code{meshgrid} and
-## a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of
-## the mesh.  If @var{x} and @var{y} are vectors, then a typical vertex
-## is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z}
-## correspond to different @var{x} values and rows of @var{z} correspond
-## to different @var{y} values.
-##
-## The color of the mesh is derived from the @code{colormap}
-## and the value of @var{z}.  Optionally the color of the mesh can be
-## specified independent of @var{z}, by adding a fourth matrix, @var{c}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-## @seealso{colormap, contour, meshgrid, surf}
-## @end deftypefn
-
-## Author: jwe
-
-function h = mesh (varargin)
-
-  newplot ();
-
-  tmp = surface (varargin{:});
-
-  ax = get (tmp, "parent");
-
-  set (tmp, "facecolor", "w");
-  set (tmp, "edgecolor", "flat");
-
-  if (! ishold ())
-    set (ax, "view", [-37.5, 30],
-         "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = logspace (0,1,11);
-%! z = x'*x;
-%! mesh (x, x, z, z.^2);
-%! xlabel xlabel;
-%! ylabel ylabel;
-%! zlabel 'linear scale';
-
-%!demo
-%! clf;
-%! x = logspace (0,1,11);
-%! z = x'*x;
-%! mesh (x, x, z, z.^2);
-%! set (gca, 'zscale', 'log');
-%! xlabel xlabel;
-%! ylabel ylabel;
-%! zlabel 'log scale';
-%! if (strcmp (get (gcf, '__graphics_toolkit__'), 'gnuplot'))
-%!   title ({'Gnuplot: mesh color is wrong', 'This a Gnuplot bug'});
-%! endif
-
--- a/scripts/plot/meshc.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} meshc (@var{x}, @var{y}, @var{z})
-## Plot a mesh and contour given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh.  If @var{x} and @var{y} are vectors,
-## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus,
-## columns of @var{z} correspond to different @var{x} values and rows of
-## @var{z} correspond to different @var{y} values.
-## @seealso{meshgrid, mesh, contour}
-## @end deftypefn
-
-function h = meshc (varargin)
-
-  newplot ();
-
-  tmp = surface (varargin{:});
-
-  ax = get (tmp, "parent");
-
-  set (tmp, "facecolor", "w");
-  set (tmp, "edgecolor", "flat");
-  ## FIXME - gnuplot does not support a filled surface and a
-  ## non-filled contour. 3D filled patches are also not supported.
-  ## Thus, the facecolor will be transparent for the gnuplot
-  ## backend.
-
-  if (! ishold ())
-    set (ax, "view", [-37.5, 30],
-         "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  drawnow ();
-  zmin = get (ax, "zlim")(1);
-
-  [c, tmp2] = __contour__ (ax, zmin, varargin{:});
-
-  tmp = [tmp; tmp2];
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
--- a/scripts/plot/meshgrid.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
-## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
-## Given vectors of @var{x} and @var{y} and @var{z} coordinates, and
-## returning 3 arguments, return three-dimensional arrays corresponding
-## to the @var{x}, @var{y}, and @var{z} coordinates of a mesh.  When
-## returning only 2 arguments, return matrices corresponding to the
-## @var{x} and @var{y} coordinates of a mesh.  The rows of @var{xx} are
-## copies of @var{x}, and the columns of @var{yy} are copies of @var{y}.
-## If @var{y} is omitted, then it is assumed to be the same as @var{x},
-## and @var{z} is assumed the same as @var{y}.
-## @seealso{mesh, contour}
-## @end deftypefn
-
-## Author: jwe
-
-function [xx, yy, zz] = meshgrid (x, y, z)
-
-  if (nargin == 0 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin < 2)
-    y = x;
-  endif
-
-  ## Use repmat to ensure that the result values have the same type as
-  ## the arguments.
-
-  if (nargout < 3)
-    if (isvector (x) && isvector (y))
-      xx = repmat (x(:).', length (y), 1);
-      yy = repmat (y(:), 1, length (x));
-    else
-      error ("meshgrid: arguments must be vectors");
-    endif
-  else
-    if (nargin < 3)
-      z = y;
-    endif
-    if (isvector (x) && isvector (y) && isvector (z))
-       lenx = length (x);
-       leny = length (y);
-       lenz = length (z);
-       xx = repmat (repmat (x(:).', leny, 1), [1, 1, lenz]);
-       yy = repmat (repmat (y(:), 1, lenx), [1, 1, lenz]);
-       zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz);
-    else
-      error ("meshgrid: arguments must be vectors");
-    endif
-  endif
-
-endfunction
-
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! z = 1:4;
-%! [XX, YY, ZZ] = meshgrid (x, y, z);
-%! assert (size_equal (XX, YY, ZZ));
-%! assert (ndims (XX), 3);
-%! assert (size (XX), [3, 2, 4]);
-%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
-%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! [XX, YY] = meshgrid (x, y);
-%! assert (size_equal (XX, YY));
-%! assert (ndims (XX), 2);
-%! assert (size (XX), [3, 2]);
-%! assert (XX(1) * YY(1), x(1) * y(1));
-%! assert (XX(end) * YY(end), x(end) * y(end));
-
-%!test
-%! x = 1:3;
-%! [XX1, YY1] = meshgrid (x, x);
-%! [XX2, YY2] = meshgrid (x);
-%! assert (size_equal (XX1, XX2, YY1, YY2));
-%! assert (ndims (XX1), 2);
-%! assert (size (XX1), [3, 3]);
-%! assert (XX1, XX2);
-%! assert (YY1, YY2);
-
--- a/scripts/plot/meshz.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} meshz (@var{x}, @var{y}, @var{z})
-## Plot a curtain mesh given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh.  If @var{x} and @var{y} are vectors,
-## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus,
-## columns of @var{z} correspond to different @var{x} values and rows of
-## @var{z} correspond to different @var{y} values.
-## @seealso{meshgrid, mesh, contour}
-## @end deftypefn
-
-function retval = meshz (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("meshz", varargin{:});
-
-  ioff = nargin + 1;
-  for i = 1:nargin
-    if (ischar (varargin{i}))
-      ioff = i;
-      break;
-    endif
-  endfor
-
-  ## Bundle C matrix back into varargin
-  if (ioff == 3 || ioff == 5)
-    ioff --;
-  endif
-
-  if (ioff == 2)
-    z = varargin{1};
-    [m, n] = size (z);
-    x = 1:n;
-    y = (1:m).';
-  else
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-  endif
-
-
-  if (isvector (x) && isvector (y))
-    x = [x(1), x(:).', x(end)];
-    y = [y(1); y(:); y(end)];
-  else
-    x = [x(1, 1), x(1, :), x(1, end);
-         x(:, 1), x, x(:, end);
-         x(end, 1), x(end, :), x(end, end)];
-    y = [y(1, 1), y(1, :), y(1, end);
-         y(:, 1), y, y(:, end);
-         y(end, 1), y(end, :), y(end, end)];
-  endif
-
-  zref = min (z(isfinite (z)));
-  z = [zref .* ones(1, columns(z) + 2);
-       zref .* ones(rows(z), 1), z, zref .* ones(rows(z), 1);
-       zref.* ones(1, columns(z) + 2)];
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    tmp = mesh (x, y, z, varargin{ioff:end});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
--- a/scripts/plot/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/plot/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -13,7 +13,6 @@
   plot/private/__axis_label__.m \
   plot/private/__bar__.m \
   plot/private/__clabel__.m \
-  plot/private/__color_str_rgb__.m \
   plot/private/__contour__.m \
   plot/private/__default_plot_options__.m \
   plot/private/__errcomm__.m \
@@ -118,6 +117,7 @@
   plot/hidden.m \
   plot/hist.m \
   plot/hold.m \
+  plot/isaxes.m \
   plot/isfigure.m \
   plot/ishghandle.m \
   plot/ishold.m \
--- a/scripts/plot/ndgrid.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-## Copyright (C) 2006-2012 Alexander Barth
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
-## @deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
-## Given n vectors @var{x1}, @dots{} @var{x}n, @code{ndgrid} returns
-## n arrays of dimension n.  The elements of the i-th output argument
-## contains the elements of the vector @var{x}i repeated over all
-## dimensions different from the i-th dimension.  Calling ndgrid with
-## only one input argument @var{x} is equivalent of calling ndgrid with
-## all n input arguments equal to @var{x}:
-##
-## [@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
-## @seealso{meshgrid}
-## @end deftypefn
-
-## Author: Alexander Barth <abarth@marine.usf.edu>
-
-function varargout = ndgrid (varargin)
-
-  if (nargin == 0)
-    print_usage ();
-  elseif (nargin == 1)
-    n = max ([nargout, 1]);
-    ## If only one input argument is given, repeat it n-times
-    varargin(1:n) = varargin(1);
-  elseif (nargin >= nargout)
-    n = max ([nargin, 1]);
-  else
-    error ("ndgrid: wrong number of input arguments");
-  endif
-
-  ## Determine the size of the output arguments
-
-  shape = zeros (1, n);
-  for i = 1:n
-    if (! isvector (varargin{i}) && ! isempty (varargin{i}))
-      error ("ndgrid: arguments must be vectors");
-    endif
-    shape(i) = length (varargin{i});
-  endfor
-
-  for i = 1:n
-    ## size for reshape
-    r = ones (1, n);
-    r(i) = shape(i);
-
-    ## size for repmat
-    s = shape;
-    s(i) = 1;
-
-    varargout{i} = repmat (reshape (varargin{i}, r), s);
-  endfor
-
-endfunction
-
-
-%!test
-%! x = 1:3;
-%! assert (isequal (ndgrid (x), x(:)));
-
-%!test
-%! x = 1:3;
-%! [XX, YY] = ndgrid (x);
-%! assert (size_equal (XX, YY));
-%! assert (isequal (XX, repmat(x(:), 1, numel(x))));
-%! assert (isequal (YY, repmat(x, numel(x), 1)));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! z = 1:4;
-%! [XX, YY, ZZ] = ndgrid (x, y, z);
-%! assert (size_equal (XX, YY, ZZ));
-%! assert (ndims (XX), 3);
-%! assert (size (XX), [2, 3, 4]);
-%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
-%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
-
-%!test
-%! x = 1:2;
-%! y = 1:3;
-%! [XX1, YY1] = meshgrid (x, y);
-%! [XX2, YY2] = ndgrid (x, y);
-%! assert (size_equal (XX1, YY1));
-%! assert (size_equal (XX2, YY2));
-%! assert (ndims (XX1), 2);
-%! assert (size (XX1), [3, 2]);
-%! assert (size (XX2), [2, 3]);
-%! assert (XX2(1) * YY2(1), x(1) * y(1));
-%! assert (XX2(end) * YY2(end), x(end) * y(end));
-%! assert (XX1, XX2.');
-%! assert (YY1, YY2.');
-
-%!assert (ndgrid ([]), zeros(0,1))
-%!assert (ndgrid ([], []), zeros(0,0))
-
-%% Test input validation
-%!error ndgrid ()
-%!error <wrong number of input arguments> [a,b,c] = ndgrid (1:3,1:3)
-%!error <arguments must be vectors> ndgrid (ones (2,2))
-
--- a/scripts/plot/newplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} newplot ()
-## @deftypefnx {Function File} {@var{h} =} newplot ()
-## Prepare graphics engine to produce a new plot.  This function is
-## called at the beginning of all high-level plotting functions.
-## It is not normally required in user programs.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## axes (not figure).
-## @end deftypefn
-
-function h = newplot ()
-
-  if (nargin == 0)
-    cf = gcf ();
-    fnp = get (cf, "nextplot");
-    switch (fnp)
-      ## FIXME -- probably we should do more than validate the nextplot
-      ## property value...
-      case "new"
-      case "add"
-      case "replacechildren"
-        delete (get (cf, "children"));
-      case "replace"
-      otherwise
-        error ("newplot: unrecognized nextplot property for current figure");
-    endswitch
-    ca = gca ();
-    anp = get (ca, "nextplot");
-    if (strcmp (get (ca, "__hold_all__"), "off"))
-      __next_line_color__ (true);
-      __next_line_style__ (true);
-    else
-      __next_line_color__ (false);
-      __next_line_style__ (false);
-    endif
-    switch (anp)
-      case "new"
-      case "add"
-      case "replacechildren"
-        delete (get (ca, "children"));
-      case "replace"
-        __go_axes_init__ (ca, "replace");
-        __request_drawnow__ ();
-      otherwise
-        error ("newplot: unrecognized nextplot property for current axes");
-    endswitch
-    if (nargout > 0)
-      h = ca;
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   p = plot ([0, 1]);
-%!   ha = newplot ();
-%!   assert (ha, gca);
-%!   assert (isempty (get (gca, "children")));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/orient.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-## Copyright (C) 2001-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} orient (@var{orientation})
-## Set the default print orientation.  Valid values for
-## @var{orientation} include @code{"landscape"}, @code{"portrait"},
-## and @code{"tall"}.
-##
-## The @code{"tall"} option sets the orientation to portait and fills
-## the page with the plot, while leaving a 0.25in border.
-##
-## If called with no arguments, return the default print orientation.
-## @end deftypefn
-
-## Author: Paul Kienzle
-## Adapted-By: jwe
-
-function retval = orient (varargin)
-
-  nargs = nargin;
-
-  if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1}))
-    cf = varargin{1};
-    varargin(1) = [];
-    nargs--;
-  else
-    cf = gcf ();
-  endif
-
-  if (nargs == 0)
-    retval = get (cf, "paperorientation");
-  elseif (nargin == 1)
-    orientation = varargin{1};
-    if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait"))
-      if (! strcmpi (get (cf, "paperorientation"), orientation))
-        ## FIXME - with the proper listeners in place there won't be a need to set
-        ##         the papersize and paperpostion here.
-        papersize = get (cf, "papersize");
-        paperposition = get (cf, "paperposition");
-        set (cf, "paperorientation", orientation);
-        set (cf, "papersize", papersize([2, 1]));
-        set (cf, "paperposition", paperposition([2, 1, 4, 3]));
-      endif
-    elseif (strcmpi (varargin{1}, 'tall'))
-      orient ("portrait");
-      papersize = get (cf, "papersize");
-      set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]);
-    else
-      error ("orient: unknown ORIENTATION");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!shared papersize, paperposition, tallpaperposition, hfig
-%! papersize = [8.5, 11];
-%! paperposition = [0.25, 2.5, 8, 6];
-%! tallpaperposition = [0.25, 0.25, (papersize-0.5)];
-%! hfig = figure ();
-%! set (hfig, "visible", "off");
-%! set (hfig, "paperorientation", "portrait");
-%! set (hfig, "papersize", papersize);
-%! set (hfig, "paperposition", paperposition);
-%!test
-%! orient portrait;
-%! assert (orient, "portrait")   # default
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), paperposition);
-%!test
-%! orient landscape;
-%! assert (orient,"landscape")   # change to landscape
-%! assert (get (hfig, "papersize"), papersize([2, 1]));
-%! assert (get (hfig, "paperposition"), paperposition([2, 1, 4, 3]));
-%!test
-%! orient portrait   # change back to portrait
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), paperposition);
-%!test
-%! orient landscape;
-%! orient tall;
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), tallpaperposition);
-%!fail ("orient ('nobody')", "unknown ORIENTATION")
-%!test
-%! orient portrait   # errors don't change the state
-%! assert (orient, "portrait");
-%! assert (get (hfig, "papersize"), papersize);
-%! assert (get (hfig, "paperposition"), tallpaperposition);
-%! close (hfig);
-
--- a/scripts/plot/pareto.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2003 Alberto Terruzzi
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pareto (@var{x})
-## @deftypefnx {Function File} {} pareto (@var{x}, @var{y})
-## @deftypefnx {Function File} {} pareto (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} pareto (@dots{})
-## Draw a Pareto chart, also called ABC chart.  A Pareto chart is a bar graph
-## used to arrange information in such a way that priorities for process
-## improvement can be established.  It organizes and displays information
-## to show the relative importance of data.  The chart is similar to the
-## histogram or bar chart, except that the bars are arranged in decreasing
-## order from left to right along the abscissa.
-##
-## The fundamental idea (Pareto principle) behind the use of Pareto
-## diagrams is that the majority of an effect is due to a small subset of the
-## causes, so for quality improvement the first few (as presented on the
-## diagram) contributing causes to a problem usually account for the majority
-## of the result.  Thus, targeting these "major causes" for elimination
-## results in the most cost-effective improvement scheme.
-##
-## The data are passed as @var{x} and the abscissa as @var{y}.  If @var{y} is
-## absent, then the abscissa are assumed to be @code{1 : length (@var{x})}.
-## @var{y} can be a string array, a cell array of strings, or a numerical
-## vector.
-##
-## The optional return value @var{h} is a 2-element vector with a graphics
-## handle for the created bar plot and a second handle for the created line
-## plot.
-##
-## An example of the use of @code{pareto} is
-##
-## @example
-## @group
-## Cheese = @{"Cheddar", "Swiss", "Camembert", ...
-##           "Munster", "Stilton", "Blue"@};
-## Sold = [105, 30, 70, 10, 15, 20];
-## pareto (Sold, Cheese);
-## @end group
-## @end example
-## @seealso{bar, barh, pie, plot}
-## @end deftypefn
-
-function h = pareto (varargin)
-
-  if (nargin != 1 && nargin != 2)
-    print_usage ();
-  endif
-
-  x = varargin {1}(:).';
-  if (nargin == 2)
-    y = varargin {2}(:).';
-    if (! iscell (y))
-      if (ischar (y))
-        y = cellstr (y);
-      else
-        y = cellfun ("num2str", num2cell (y), "uniformoutput", false);
-      endif
-    endif
-  else
-    y = cellfun ("int2str", num2cell (1 : numel (x)),
-                 "uniformoutput", false);
-  endif
-
-  [x, idx] = sort (x, "descend");
-  y = y (idx);
-  cdf = cumsum (x);
-  maxcdf = max (cdf);
-  cdf = cdf ./ maxcdf;
-  cdf95 = cdf - 0.95;
-  idx95 = find (sign (cdf95(1:end-1)) != sign (cdf95(2:end)))(1);
-
-  [ax, hbar, hline] = plotyy (1 : idx95, x (1 : idx95),
-                              1 : length (cdf), 100 .* cdf,
-                              @bar, @plot);
-
-  axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]);
-  axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]);
-  set (ax(2), "ytick", [0, 20, 40, 60, 80, 100],
-       "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"});
-  set (ax(1), "xtick", 1 : idx95, "xticklabel", y (1: idx95));
-  set (ax(2), "xtick", 1 : idx95, "xticklabel", y (1: idx95));
-
-  if (nargout > 0)
-    h = [hbar; hline];
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! Cheese = {'Cheddar', 'Swiss', 'Camembert', 'Munster', 'Stilton', 'Blue'};
-%! Sold = [105, 30, 70, 10, 15, 20];
-%! pareto (Sold, Cheese);
-
-%!demo
-%! clf;
-%! % Suppose that we want establish which products makes 80% of turnover.
-%! Codes = {'AB4','BD7','CF8','CC5','AD11','BB5','BB3','AD8','DF3','DE7'};
-%! Value = [2.35 7.9 2.45 1.1 0.15 13.45 5.4 2.05 0.85  1.65]';
-%! SoldUnits = [54723 41114 16939 1576091 168000 687197 120222 168195, ...
-%!              1084118 55576]';
-%! pareto (Value.*SoldUnits, Codes);
-
--- a/scripts/plot/patch.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} patch ()
-## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} patch (@var{fv})
-## @deftypefnx {Function File} {} patch ("Faces", @var{f}, "Vertices", @var{v}, @dots{})
-## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} patch (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
-## Create patch object from @var{x} and @var{y} with color @var{c} and
-## insert in the current axes object.  Return handle to patch object.
-##
-## For a uniform colored patch, @var{c} can be given as an RGB vector,
-## scalar value referring to the current colormap, or string value (for
-## example, "r" or "red").
-##
-## If passed a structure @var{fv} contain the fields "vertices", "faces"
-## and optionally "facevertexcdata", create the patch based on these
-## properties.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-## @seealso{fill}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = patch (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
-
-  [tmp, failed] = __patch__ (h, varargin{:});
-
-  if (failed)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! %% Patches with same number of vertices
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! patch ([x1,x2], [y1,y2], 'r');
-
-%!demo
-%! %% Unclosed patch
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], 'r');
-
-%!demo
-%! %% Specify vertices and faces separately
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! vert = [x1, y1; x2, y2];
-%! fac = [1:8,NaN(1,8);9:24];
-%! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
-
-%!demo
-%! %% Specify vertices and faces separately
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! vert = [x1, y1; x2, y2];
-%! fac = [1:8,NaN(1,8);9:24];
-%! patch ('Faces',fac, 'Vertices',vert, 'FaceVertexCData',[0, 1, 0; 0, 0, 1]);
-
-%!demo
-%! %% Property change on multiple patches
-%! clf;
-%! t1 = (1/16:1/8:1)' * 2*pi;
-%! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
-%! x1 = sin (t1) - 0.8;
-%! y1 = cos (t1);
-%! x2 = sin (t2) + 0.8;
-%! y2 = cos (t2);
-%! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
-%! pause (1);
-%! set (h, 'FaceColor', 'r');
-
-%!demo
-%! clf;
-%! vertices = [0, 0, 0;
-%!             1, 0, 0;
-%!             1, 1, 0;
-%!             0, 1, 0;
-%!             0.5, 0.5, 1];
-%! faces = [1, 2, 5;
-%!          2, 3, 5;
-%!          3, 4, 5;
-%!          4, 1, 5];
-%! patch ('Vertices', vertices, 'Faces', faces, ...
-%!        'FaceVertexCData', jet (4), 'FaceColor', 'flat');
-%! view (-37.5, 30);
-
-%!demo
-%! clf;
-%! vertices = [0, 0, 0;
-%!             1, 0, 0;
-%!             1, 1, 0;
-%!             0, 1, 0;
-%!             0.5, 0.5, 1];
-%! faces = [1, 2, 5;
-%!          2, 3, 5;
-%!          3, 4, 5;
-%!          4, 1, 5];
-%! patch  ('Vertices', vertices, 'Faces', faces, ...
-%!        'FaceVertexCData', jet (5), 'FaceColor', 'interp');
-%! view (-37.5, 30);
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [0 1 1 0];
-%! y = [0 0 1 1];
-%! subplot (2,1,1);
-%!  title ('Blue, Light-Green, and Red Horizontal Bars');
-%!  patch (x, y + 0, 1);
-%!  patch (x, y + 1, 2);
-%!  patch (x, y + 2, 3);
-%! subplot (2,1,2);
-%!  title ('Blue, Light-Green, and Red Vertical Bars');
-%!  patch (x + 0, y, 1 * ones (size (x)));
-%!  patch (x + 1, y, 2 * ones (size (x)));
-%!  patch (x + 2, y, 3 * ones (size (x)));
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [0 1 1 0];
-%! y = [0 0 1 1];
-%! subplot (2,1,1);
-%!  title ('Blue horizontal bars: Dark to Light');
-%!  patch (x, y + 0, 1, 'cdatamapping', 'direct');
-%!  patch (x, y + 1, 9, 'cdatamapping', 'direct');
-%!  patch (x, y + 2, 17, 'cdatamapping', 'direct');
-%! subplot (2,1,2);
-%!  title ('Blue vertical bars: Dark to Light');
-%!  patch (x + 0, y, 1 * ones (size (x)), 'cdatamapping', 'direct');
-%!  patch (x + 1, y, 9 * ones (size (x)), 'cdatamapping', 'direct');
-%!  patch (x + 2, y, 17 * ones (size (x)), 'cdatamapping', 'direct');
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [ 0 0; 1 1; 1 0 ];
-%! y = [ 0 0; 0 1; 1 1 ];
-%! p = patch (x, y, 'facecolor', 'b');
-%! title ('Two blue triangles');
-%! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
-%! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
-
-%!demo
-%! clf;
-%! colormap (jet (64));
-%! x = [ 0 0; 1 1; 1 0 ];
-%! y = [ 0 0; 0 1; 1 1 ];
-%! p = patch (x, y, [1 32]);
-%! title ('Autoscaling of colors: Red UL and Blue LR triangles');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = patch ();
-%!   assert (findobj (hf, "type", "patch"), h);
-%!   assert (get (h, "xdata"), [0; 1; 0], eps);
-%!   assert (get (h, "ydata"), [1; 1; 0], eps);
-%!   assert (isempty (get (h, "zdata")));
-%!   assert (isempty (get (h, "cdata")));
-%!   assert (get (h, "faces"), [1, 2, 3], eps);
-%!   assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
-%!   assert (get (h, "type"), "patch");
-%!   assert (get (h, "facecolor"), [0 0 0]);
-%!   assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
-%!   assert (get (h, "marker"), get (0, "defaultpatchmarker"));
-%!   assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! c = 0.9;
-%! unwind_protect
-%!   h = patch ([0 1 0], [0 1 1], c);
-%!   assert (get (gca, "clim"), [c - 1, c + 1]);
-%!   h = patch ([0 1 0], [0 1 1], 2 * c);
-%!   assert (get (gca, "clim"), [c, 2 * c]);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/pbaspect.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
-## @deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio})
-## @deftypefnx {Function File} {} pbaspect (@var{mode})
-## @deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
-## @deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
-##
-## Query or set the plot box aspect ratio of the current axes.  The aspect
-## ratio is a normalized 3-element vector representing the rendered lengths of
-## the x, y, and z axes.
-##
-## @code{pbaspect(@var{mode})}
-##
-## Set the plot box aspect ratio mode of the current axes.  @var{mode} is
-## either "auto" or "manual".
-##
-## @code{pbaspect ("mode")}
-##
-## Return the plot box aspect ratio mode of the current axes.
-##
-## @code{pbaspect (@var{hax}, @dots{})}
-##
-## Operate on the axes in handle @var{hax} instead of the current axes.
-##
-## @seealso{axis, daspect, xlim, ylim, zlim}
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-01-26
-
-function varargout = pbaspect (varargin)
-
-  hax = gca ();
-
-  if (nargin > 0)
-    if (isscalar (varargin{1}) && ishandle (varargin{1}))
-      hax = varargin{1};
-      varargin = varargin(2:end);
-    endif
-  endif
-  if (numel (varargin) > 0)
-    if (numel (varargin) == 1)
-      if (ischar (varargin{1})
-          && any (strcmpi (varargin{1}, {"mode", "manual", "auto"})))
-        switch (varargin{1})
-        case "mode"
-          if (nargout < 2)
-            varargout{1} = get (hax, "plotboxaspectratiomode");
-            return
-          else
-            error ("pbaspect: only one output is allowed");
-          endif
-        case "manual"
-          set (hax, "plotboxaspectratiomode", "manual");
-        case "auto"
-          set (hax, "plotboxaspectratiomode", "auto");
-        endswitch
-      elseif (isreal (varargin{1}) && numel (varargin{1}) == 2)
-        set (hax, "plotboxaspectratio", [varargin{1}, 1]);
-      elseif (isreal (varargin{1}) && numel (varargin{1}) == 3)
-        set (hax, "plotboxaspectratio", varargin{1});
-      else
-        error ("pbaspect: invalid input");
-      endif
-    elseif (numel (varargin) > 1)
-      error ("pbaspect: too many inputs");
-    endif
-  elseif (nargout == 0)
-    print_usage ();
-  endif
-
-  if (nargout == 1)
-    varargout{1} = get (hax, "plotboxaspectratio");
-  elseif (nargout > 1)
-    error ("pbaspect: only one output is allowed");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! pbaspect ([1 1 1]);
-%! title ('plot box is square');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;;
-%! plot (x,cos(x), x,sin(x));
-%! pbaspect ([2 1 1]);
-%! title ('plot box aspect ratio is 2x1');
-
-%!demo
-%! clf;
-%! x = 0:0.01:4;
-%! plot (x,cos(x), x,sin(x));
-%! daspect ([1 1 1]);
-%! pbaspect ([2 1 1]);
-%! title ('plot box is 2x1, and axes [0 4 -1 1]');
-
--- a/scripts/plot/pcolor.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
-## @deftypefnx {Function File} {} pcolor (@var{c})
-## Produce a density plot for matrices @var{x} and @var{y} from
-## @code{meshgrid}, and a matrix @var{c} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh's vertices.  If @var{x} and @var{y} are
-## vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)). 
-## Thus, columns of @var{c} correspond to different @var{x} values and rows
-## of @var{c} correspond to different @var{y} values.
-##
-## The @code{colormap} is scaled to the extents of @var{c}.
-## Limits may be placed on the color axis by the command @code{caxis}, or by
-## setting the @code{clim} property of the parent axis.
-##
-## The face color of each cell of the mesh is determined by interpolating
-## the values of @var{c} for the cell's vertices.  Contrast this with
-## @code{imagesc} which renders one cell for each element of @var{c}.
-##
-## @code{shading} modifies an attribute determining the manner by which the
-## face color of each cell is interpolated from the values of @var{c},
-## and the visibility of the cells' edges.  By default the attribute is
-## "faceted", which renders a single color for each cell's face with the edge
-## visible.
-##
-## The optional return value @var{h} is a handle to the surface object.
-##
-## @seealso{caxis, contour, meshgrid, imagesc, shading}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function h = pcolor (x, y, c)
-
-  newplot ();
-
-  if (nargin == 1)
-    c = x;
-    [nr, nc] = size (c);
-    z = zeros (nr, nc);
-    [x, y] = meshgrid (1:nc, 1:nr);
-  elseif (nargin == 3)
-    z = zeros (size (c));
-  else
-    print_usage ();
-  endif
-
-  tmp = surface (x, y, z, c);
-
-  ax = get (tmp, "parent");
-
-  set (tmp, "facecolor", "flat");
-  set (ax, "box", "on");
-
-  if (! ishold ())
-    set (ax, "view", [0, 90]);
-  endif
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = peaks ();
-%! pcolor (Z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! pcolor (X,Y,Fx+Fy);
-%! shading interp;
-
--- a/scripts/plot/peaks.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2007-2012 Paul Kienzle
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} peaks ()
-## @deftypefnx {Function File} {} peaks (@var{n})
-## @deftypefnx {Function File} {} peaks (@var{x}, @var{y})
-## @deftypefnx {Function File} {@var{z} =} peaks (@dots{})
-## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} peaks (@dots{})
-## Generate a function with lots of local maxima and minima.  The function
-## has the form
-##
-## @tex
-## $f(x,y) = 3 (1 - x) ^ 2 e ^ {\left(-x^2 - (y+1)^2\right)} - 10 \left({x \over 5} - x^3 - y^5)\right) - {1 \over 3} e^{\left(-(x+1)^2 - y^2\right)}$
-## @end tex
-## @ifnottex
-## @verbatim
-## f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
-##          - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
-##          - 1/3*exp(-(x+1)^2 - y^2)
-## @end verbatim
-## @end ifnottex
-##
-## Called without a return argument, @code{peaks} plots the surface of the
-## above function using @code{mesh}.  If @var{n} is a scalar, the @code{peaks}
-## returns the values of the above function on a @var{n}-by-@var{n} mesh over
-## the range @code{[-3,3]}.  The default value for @var{n} is 49.
-##
-## If @var{n} is a vector, then it represents the @var{x} and @var{y} values
-## of the grid on which to calculate the above function.  The @var{x} and
-## @var{y} values can be specified separately.
-## @seealso{surf, mesh, meshgrid}
-## @end deftypefn
-
-## Expression for the peaks function was taken from the following paper:
-## http://www.control.hut.fi/Kurssit/AS-74.115/Material/GENALGgoga.pdf
-
-function [X_out, Y_out, Z_out] = peaks (x, y)
-
-  if (nargin == 0)
-    x = y = linspace (-3, 3, 49);
-  elseif (nargin == 1)
-    if (length (x) > 1)
-      y = x;
-    else
-      x = y = linspace (-3, 3, x);
-    endif
-  endif
-
-  if (isvector (x) && isvector (y))
-    [X, Y] = meshgrid (x, y);
-  else
-    X = x;
-    Y = y;
-  endif
-
-  Z = 3 * (1 - X) .^ 2 .* exp (- X .^ 2 - (Y + 1) .^ 2) ...
-      - 10 * (X / 5 - X .^ 3 - Y .^ 5) .* exp (- X .^ 2 - Y .^ 2) ...
-      - 1 / 3 * exp (- (X + 1) .^ 2 - Y .^ 2);
-
-  if (nargout == 0)
-    surf (x, y, Z);
-  elseif (nargout == 1)
-    X_out = Z;
-  else
-    X_out = X;
-    Y_out = Y;
-    Z_out = Z;
-  endif
-
-endfunction
--- a/scripts/plot/pie.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pie (@var{x})
-## @deftypefnx {Function File} {} pie (@var{x}, @var{explode})
-## @deftypefnx {Function File} {} pie (@dots{}, @var{labels})
-## @deftypefnx {Function File} {} pie (@var{h}, @dots{});
-## @deftypefnx {Function File} {@var{h} =} pie (@dots{});
-## Plot a 2-D pie chart.
-##
-## When called with a single vector argument, produce a pie chart of the
-## elements in @var{x}.  The size of the ith slice is the percentage that the
-## element @var{x}i represents of the total sum of @var{x}.
-##
-## The variable @var{explode} is a vector of the same length as @var{x} that,
-## if non-zero, "explodes" the slice from the pie chart.
-##
-## The optional input @var{labels} is a cell array of strings of the same
-## length as @var{x} specifying the label for each slice.
-##
-## The optional return value @var{h} is a list of handles to the patch
-## and text objects generating the plot.
-##
-## @seealso{pie3, bar, stem}
-## @end deftypefn
-
-## Very roughly based on pie.m from octave-forge whose author was
-## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-
-function retval = pie (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("pie", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __pie__ ("pie", h, varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! pie ([3, 2, 1], [0, 0, 1]);
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-
-%!demo
-%! clf;
-%! pie ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-
-%!demo
-%! clf;
-%! pie ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('missing slice');
-
--- a/scripts/plot/pie3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2010 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} pie3 (@var{x})
-## @deftypefnx {Function File} {} pie3 (@var{x}, @var{explode})
-## @deftypefnx {Function File} {} pie3 (@dots{}, @var{labels})
-## @deftypefnx {Function File} {} pie3 (@var{h}, @dots{});
-## @deftypefnx {Function File} {@var{h} =} pie3 (@dots{});
-## Plot a 3-D pie chart.
-##
-## Called with a single vector argument, produces a 3-D pie chart of the
-## elements in @var{x}.  The size of the ith slice is the percentage that the
-## element @var{x}i represents of the total sum of @var{x}.
-##
-## The variable @var{explode} is a vector of the same length as @var{x} that,
-## if non-zero, "explodes" the slice from the pie chart.
-##
-## The optional input @var{labels} is a cell array of strings of the same
-## length as @var{x} specifying the label for each slice.
-##
-## The optional return value @var{h} is a list of graphics handles to the patch,
-## surface, and text objects generating the plot.
-##
-## @seealso{pie, bar, stem}
-## @end deftypefn
-
-## Very roughly based on pie.m from octave-forge whose author was
-## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-
-function retval = pie3 (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("pie", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __pie__ ("pie3", h, varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! pie3 ([5:-1:1], [0, 0, 1, 0, 0]);
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-
-%!demo
-%! clf;
-%! pie3 ([3, 2, 1], [0, 0, 1], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-
-%!demo
-%! clf;
-%! pie3 ([0.17, 0.34, 0.41], {'Cheddar', 'Swiss', 'Camembert'});
-%! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]);
-%! axis ([-2,2,-2,2]);
-%! title ('missing slice');
-
--- a/scripts/plot/plot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plot (@var{y})
-## @deftypefnx {Function File} {} plot (@var{x}, @var{y})
-## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} plot (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} plot (@dots{})
-## Produce two-dimensional plots.
-##
-## Many different combinations of arguments are possible.  The simplest
-## form is
-##
-## @example
-## plot (@var{y})
-## @end example
-##
-## @noindent
-## where the argument is taken as the set of @var{y} coordinates and the
-## @var{x} coordinates are taken to be the indices of the elements
-## starting with 1.
-##
-## To save a plot, in one of several image formats such as PostScript
-## or PNG, use the @code{print} command.
-##
-## If more than one argument is given, they are interpreted as
-##
-## @example
-## plot (@var{y}, @var{property}, @var{value}, @dots{})
-## @end example
-##
-## @noindent
-## or
-##
-## @example
-## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @end example
-##
-## @noindent
-## or
-##
-## @example
-## plot (@var{x}, @var{y}, @var{fmt}, @dots{})
-## @end example
-##
-## @noindent
-## and so on.  Any number of argument sets may appear.  The @var{x} and
-## @var{y} values are interpreted as follows:
-##
-## @itemize @bullet
-## @item
-## If a single data argument is supplied, it is taken as the set of @var{y}
-## coordinates and the @var{x} coordinates are taken to be the indices of
-## the elements, starting with 1.
-##
-## @item
-## If the @var{x} is a vector and @var{y} is a matrix, then
-## the columns (or rows) of @var{y} are plotted versus @var{x}.
-## (using whichever combination matches, with columns tried first.)
-##
-## @item
-## If the @var{x} is a matrix and @var{y} is a vector,
-## @var{y} is plotted versus the columns (or rows) of @var{x}.
-## (using whichever combination matches, with columns tried first.)
-##
-## @item
-## If both arguments are vectors, the elements of @var{y} are plotted versus
-## the elements of @var{x}.
-##
-## @item
-## If both arguments are matrices, the columns of @var{y} are plotted
-## versus the columns of @var{x}.  In this case, both matrices must have
-## the same number of rows and columns and no attempt is made to transpose
-## the arguments to make the number of rows match.
-##
-## If both arguments are scalars, a single point is plotted.
-## @end itemize
-##
-## Multiple property-value pairs may be specified, but they must appear
-## in pairs.  These arguments are applied to the lines drawn by
-## @code{plot}.
-##
-## If the @var{fmt} argument is supplied, it is interpreted as
-## follows.  If @var{fmt} is missing, the default gnuplot line style
-## is assumed.
-##
-## @table @samp
-## @item -
-## Set lines plot style (default).
-##
-## @item .
-## Set dots plot style.
-##
-## @item @var{n}
-## Interpreted as the plot color if @var{n} is an integer in the range 1 to
-## 6.
-##
-## @item @var{nm}
-## If @var{nm} is a two digit integer and @var{m} is an integer in the
-## range 1 to 6, @var{m} is interpreted as the point style.  This is only
-## valid in combination with the @code{@@} or @code{-@@} specifiers.
-##
-## @item @var{c}
-## If @var{c} is one of @code{"k"} (black), @code{"r"} (red), @code{"g"}
-## (green), @code{"b"} (blue), @code{"m"} (magenta), @code{"c"} (cyan),
-## or @code{"w"} (white), it is interpreted as the line plot color.
-##
-## @item ";title;"
-## Here @code{"title"} is the label for the key.
-##
-## @item +
-## @itemx *
-## @itemx o
-## @itemx x
-## @itemx ^
-## Used in combination with the points or linespoints styles, set the point
-## style.
-##
-## @item @@
-## Select the next unused point style.
-## @end table
-##
-## The @var{fmt} argument may also be used to assign key titles.
-## To do so, include the desired title between semi-colons after the
-## formatting sequence described above, e.g., "+3;Key Title;"
-## Note that the last semi-colon is required and will generate an error if
-## it is left out.
-##
-## Here are some plot examples:
-##
-## @example
-## plot (x, y, "@@12", x, y2, x, y3, "4", x, y4, "+")
-## @end example
-##
-## This command will plot @code{y} with points of type 2 (displayed as
-## @samp{+}) and color 1 (red), @code{y2} with lines, @code{y3} with lines of
-## color 4 (magenta) and @code{y4} with points displayed as @samp{+}.
-##
-## @example
-## plot (b, "*", "markersize", 3)
-## @end example
-##
-## This command will plot the data in the variable @code{b},
-## with points displayed as @samp{*} with a marker size of 3.
-##
-## @example
-## @group
-## t = 0:0.1:6.3;
-## plot (t, cos(t), "-;cos(t);", t, sin(t), "+3;sin(t);");
-## @end group
-## @end example
-##
-## This will plot the cosine and sine functions and label them accordingly
-## in the key.
-##
-## If the first argument is an axis handle, then plot into these axes,
-## rather than the current axis handle returned by @code{gca}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, bar,
-## stairs, errorbar, xlabel, ylabel, title, print}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = plot (varargin)
-
-  [h, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    tmp = __plt__ ("plot", h, varargin{:});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! x = 1:5;  y = 1:5;
-%! plot (x,y,'g');
-%! title ('plot of green line at 45 degrees');
-
-%!demo
-%! x = 1:5;  y = 1:5;
-%! plot (x,y,'g*');
-%! title ('plot of green stars along a line at 45 degrees');
-
-%!demo
-%! x1 = 1:5;  y1 = 1:5;
-%! x2 = 5:9; y2 = 5:-1:1;
-%! plot (x1,y1,'bo-', x2,y2,'rs-');
-%! axis ('tight');
-%! title ('plot of blue circles ascending and red squares descending with connecting lines drawn'); 
-
--- a/scripts/plot/plot3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} plot3 (@var{args})
-## Produce three-dimensional plots.  Many different combinations of
-## arguments are possible.  The simplest form is
-##
-## @example
-## plot3 (@var{x}, @var{y}, @var{z})
-## @end example
-##
-## @noindent
-## in which the arguments are taken to be the vertices of the points to
-## be plotted in three dimensions.  If all arguments are vectors of the
-## same length, then a single continuous line is drawn.  If all arguments
-## are matrices, then each column of the matrices is treated as a
-## separate line.  No attempt is made to transpose the arguments to make
-## the number of rows match.
-##
-## If only two arguments are given, as
-##
-## @example
-## plot3 (@var{x}, @var{c})
-## @end example
-##
-## @noindent
-## the real and imaginary parts of the second argument are used
-## as the @var{y} and @var{z} coordinates, respectively.
-##
-## If only one argument is given, as
-##
-## @example
-## plot3 (@var{c})
-## @end example
-##
-## @noindent
-## the real and imaginary parts of the argument are used as the @var{y}
-## and @var{z} values, and they are plotted versus their index.
-##
-## Arguments may also be given in groups of three as
-##
-## @example
-## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
-## @end example
-##
-## @noindent
-## in which each set of three arguments is treated as a separate line or
-## set of lines in three dimensions.
-##
-## To plot multiple one- or two-argument groups, separate each group
-## with an empty format string, as
-##
-## @example
-## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
-## @end example
-##
-## An example of the use of @code{plot3} is
-##
-## @example
-## @group
-## z = [0:0.05:5];
-## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
-## plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
-## @end group
-## @end example
-## @seealso{plot, xlabel, ylabel, zlabel, title, print}
-## @end deftypefn
-
-## Author: Paul Kienzle
-##         (modified from __plt__.m)
-
-function retval = plot3 (varargin)
-
-  newplot ();
-
-  x_set = 0;
-  y_set = 0;
-  z_set = 0;
-  property_set = 0;
-  fmt_set = 0;
-  properties = {};
-  tlgnd = {};
-  hlgnd = [];
-  idx = 0;
-
-  ## Gather arguments, decode format, and plot lines.
-  arg = 0;
-  while (arg++ < nargin)
-    new = varargin{arg};
-    new_cell = varargin(arg);
-
-    if (property_set)
-      properties = [properties, new_cell];
-      property_set = 0;
-      continue;
-    endif
-
-    if (ischar (new))
-      if (! z_set)
-        if (! y_set)
-          if (! x_set)
-            error ("plot3: needs x, [ y, [ z ] ]");
-          else
-            z = imag (x);
-            y = real (x);
-            y_set = 1;
-            z_set = 1;
-            if (rows (x) > 1)
-              x = repmat ((1:rows (x))', 1, columns (x));
-            else
-              x = 1:columns (x);
-            endif
-          endif
-        else
-          z = imag (y);
-          y = real (y);
-          z_set = 1;
-        endif
-      endif
-
-      if (! fmt_set)
-        [options, valid] = __pltopt__ ("plot3", new, false);
-        if (! valid)
-          properties = [properties, new_cell];
-          property_set = 1;
-          continue;
-        else
-          fmt_set = 1;
-          while (arg < nargin && ischar (varargin{arg+1}))
-            if (nargin - arg < 2)
-              error ("plot3: properties must appear followed by a value");
-            endif
-            properties = [properties, varargin(arg+1:arg+2)];
-            arg += 2;
-          endwhile
-        endif
-      else
-        properties = [properties, new_cell];
-        property_set = 1;
-        continue;
-      endif
-
-      if (isvector (x) && isvector (y))
-        if (isvector (z))
-          x = x(:);
-          y = y(:);
-          z = z(:);
-        elseif (length (x) == rows (z) && length (y) == columns (z))
-          [x, y] = meshgrid (x, y);
-        else
-          error ("plot3: [length(x), length(y)] must match size (z)");
-        endif
-      endif
-
-      if (! size_equal (x, y, z))
-        error ("plot3: x, y, and z must have the same shape");
-      elseif (ndims (x) > 2)
-        error ("plot3: x, y, and z must not have more than two dimensions");
-      endif
-
-      for i = 1 : columns (x)
-        linestyle = options.linestyle;
-        marker = options.marker;
-        if (isempty (marker) && isempty (linestyle))
-           [linestyle, marker] = __next_line_style__ ();
-        endif
-        color = options.color;
-        if (isempty (color))
-          color = __next_line_color__ ();
-        endif
-
-        tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                           "color", color, "linestyle", linestyle,
-                           "marker", marker, properties{:});
-        key = options.key;
-        if (! isempty (key))
-          hlgnd = [hlgnd, tmp(idx)];
-          tlgnd = {tlgnd{:}, key};
-        endif
-      endfor
-
-      x_set = 0;
-      y_set = 0;
-      z_set = 0;
-      fmt_set = 0;
-      properties = {};
-    elseif (! x_set)
-      x = new;
-      x_set = 1;
-    elseif (! y_set)
-      y = new;
-      y_set = 1;
-    elseif (! z_set)
-      z = new;
-      z_set = 1;
-    else
-      if (isvector (x) && isvector (y))
-        if (isvector (z))
-          x = x(:);
-          y = y(:);
-          z = z(:);
-        elseif (length (x) == rows (z) && length (y) == columns (z))
-          [x, y] = meshgrid (x, y);
-        else
-          error ("plot3: [length(x), length(y)] must match size (z)");
-        endif
-      endif
-
-      if (! size_equal (x, y, z))
-        error ("plot3: x, y, and z must have the same shape");
-      elseif (ndims (x) > 2)
-        error ("plot3: x, y, and z must not have more than two dimensions");
-      endif
-
-      options =  __default_plot_options__ ();
-      for i = 1 : columns (x)
-        linestyle = options.linestyle;
-        marker = options.marker;
-        if (isempty (marker) && isempty (linestyle))
-           [linestyle, marker] = __next_line_style__ ();
-        endif
-        color = options.color;
-        if (isempty (color))
-          color = __next_line_color__ ();
-        endif
-
-        tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                           "color", color, "linestyle", linestyle,
-                           "marker", marker, properties{:});
-        key = options.key;
-        if (! isempty (key))
-          hlgnd = [hlgnd, tmp(idx)];
-          tlgnd = {tlgnd{:}, key};
-        endif
-      endfor
-
-      x = new;
-      y_set = 0;
-      z_set = 0;
-      fmt_set = 0;
-      properties = {};
-    endif
-
-  endwhile
-
-  if (property_set)
-    error ("plot3: properties must appear followed by a value");
-  endif
-
-  ## Handle last plot.
-
-  if (x_set)
-    if (y_set)
-      if (! z_set)
-        z = imag (y);
-        y = real (y);
-        z_set = 1;
-      endif
-    else
-      z = imag (x);
-      y = real (x);
-      y_set = 1;
-      z_set = 1;
-      if (rows (x) > 1)
-        x = repmat ((1:rows (x))', 1, columns (x));
-      else
-        x = 1:columns (x);
-      endif
-    endif
-
-    if (isvector (x) && isvector (y))
-      if (isvector (z))
-        x = x(:);
-        y = y(:);
-        z = z(:);
-      elseif (length (x) == rows (z) && length (y) == columns (z))
-        [x, y] = meshgrid (x, y);
-      else
-        error ("plot3: [length(x), length(y)] must match size (z)");
-      endif
-    endif
-
-    if (! size_equal (x, y, z))
-      error ("plot3: x, y, and z must have the same shape");
-    elseif (ndims (x) > 2)
-      error ("plot3: x, y, and z must not have more than two dimensions");
-    endif
-
-    options =  __default_plot_options__ ();
-
-    for i = 1 : columns (x)
-      linestyle = options.linestyle;
-      marker = options.marker;
-      if (isempty (marker) && isempty (linestyle))
-        [linestyle, marker] = __next_line_style__ ();
-      endif
-      color = options.color;
-      if (isempty (color))
-        color = __next_line_color__ ();
-      endif
-
-      tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
-                         "color", color, "linestyle", linestyle,
-                         "marker", marker, properties{:});
-      key = options.key;
-      if (! isempty (key))
-        hlgnd = [hlgnd, tmp(idx)];
-        tlgnd = {tlgnd{:}, key};
-      endif
-    endfor
-  endif
-
-  if (!isempty (hlgnd))
-    legend (gca (), hlgnd, tlgnd);
-  endif
-
-  set (gca (), "view", [-37.5, 30]);
-
-  if (nargout > 0 && idx > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! z = [0:0.05:5];
-%! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
-%! plot3 (z, exp (2i*pi*z), ';complex sinusoid;');
-
--- a/scripts/plot/plotmatrix.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plotmatrix (@var{x}, @var{y})
-## @deftypefnx {Function File} {} plotmatrix (@var{x})
-## @deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
-## @deftypefnx {Function File} {} plotmatrix (@var{h}, @dots{})
-## @deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
-## Scatter plot of the columns of one matrix against another.  Given the
-## arguments @var{x} and @var{y}, that have a matching number of rows,
-## @code{plotmatrix} plots a set of axes corresponding to
-##
-## @example
-## plot (@var{x}(:, i), @var{y}(:, j))
-## @end example
-##
-## Given a single argument @var{x} this is equivalent to
-##
-## @example
-## plotmatrix (@var{x}, @var{x})
-## @end example
-##
-## @noindent
-## except that the diagonal of the set of axes will be replaced with the
-## histogram @code{hist (@var{x}(:, i))}.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot}
-## command.  If a leading axes handle @var{h} is passed to
-## @code{plotmatrix}, then this axis will be used for the plot.
-##
-## The optional return value @var{h} provides handles to the individual
-## graphics objects in the scatter plots, whereas @var{ax} returns the
-## handles to the scatter plot axis objects.  @var{bigax} is a hidden
-## axis object that surrounds the other axes, such that the commands
-## @code{xlabel}, @code{title}, etc., will be associated with this hidden
-## axis.  Finally @var{p} returns the graphics objects associated with
-## the histogram and @var{pax} the corresponding axes objects.
-##
-## @example
-## plotmatrix (randn (100, 3), "g+")
-## @end example
-##
-## @seealso{plot}
-## @end deftypefn
-
-function [h, ax, bigax, p, pax] = plotmatrix (varargin)
-
-  [bigax2, varargin, nargin] = __plt_get_axis_arg__ ("plotmatrix", varargin{:});
-
-  if (nargin > 3 || nargin < 1)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (bigax2);
-      newplot ();
-      [h2, ax2, p2, pax2, need_usage] = __plotmatrix__ (bigax2, varargin{:});
-      if (need_usage)
-        print_usage ();
-      endif
-      if (nargout > 0)
-        h = h2;
-        ax = ax2;
-        bigax = bigax2;
-        p = p2;
-        pax = pax2;
-      endif
-      axes (bigax2);
-      ctext = text (0, 0, "", "visible", "off",
-                    "handlevisibility", "off", "xliminclude", "off",
-                    "yliminclude", "off", "zliminclude", "off",
-                    "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
-      set (bigax2, "visible", "off");
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-endfunction
-
-%!demo
-%! clf;
-%! plotmatrix (randn (100, 3), 'g+');
-
-function plotmatrixdelete (h, d, ax)
-  for i = 1 : numel (ax)
-    hc = ax(i);
-    if (ishandle (hc) && strcmp (get (hc, "type"), "axes")
-        && strcmpi (get (hc, "beingdeleted"), "off"))
-      parent = get (hc, "parent");
-      ## If the parent is invalid or being deleted, then do nothing
-      if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
-        delete (hc);
-      endif
-    endif
-  endfor
-endfunction
-
-function [h, ax, p, pax, need_usage] = __plotmatrix__ (bigax, varargin)
-  need_usage = false;
-  have_line_spec = false;
-  have_hist = false;
-  parent = get (bigax, "parent");
-  for i = 1 : nargin - 1
-    arg = varargin{i};
-    if (ischar (arg) || iscell (arg))
-      [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
-      if (valid)
-        have_line_spec = true;
-        linespec = varargin(i);
-        varargin(i) = [];
-        nargin = nargin - 1;
-        break;
-      else
-        need_usage = true;
-        returm;
-      endif
-    endif
-  endfor
-
-  if (nargin == 2)
-    X = varargin{1};
-    Y = X;
-    have_hist = true;
-  elseif (nargin == 3)
-    X = varargin{1};
-    Y = varargin{2};
-  else
-    need_usage = true;
-    returm;
-  endif
-
-  if (rows (X) != rows (Y))
-    error ("plotmatrix: dimension mismatch in the arguments");
-  endif
-
-  [dummy, m] = size (X);
-  [dummy, n] = size (Y);
-
-  h = [];
-  ax = [];
-  p = [];
-  pax = [];
-
-  xsize = 0.9 / m;
-  ysize = 0.9 / n;
-  xoff = 0.05;
-  yoff = 0.05;
-  border = [0.130, 0.110, 0.225, 0.185] .* [xsize, ysize, xsize, ysize];
-  border(3:4) = - border(3:4) - border(1:2);
-
-  for i = 1 : m
-    for j = 1 : n
-      pos = [xsize * (i - 1) + xoff, ysize * (n - j) + yoff, xsize, ysize];
-      tmp = axes ("outerposition", pos, "position", pos + border,
-                  "parent", parent);
-      if (i == j && have_hist)
-        pax = [pax ; tmp];
-        [nn, xx] = hist (X(:, i));
-        tmp = bar (xx, nn, 1.0);
-        p = [p; tmp];
-      else
-        ax = [ax ; tmp];
-        if (have_line_spec)
-          tmp = plot (X (:, i), Y (:, j), linespec);
-        else
-          tmp = plot (X (:, i), Y (:, j), ".");
-        endif
-        h = [h ; tmp];
-      endif
-    endfor
-  endfor
-endfunction
--- a/scripts/plot/plotyy.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,359 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
-## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun})
-## @deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
-## @deftypefnx {Function File} {} plotyy (@var{h}, @dots{})
-## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
-## Plot two sets of data with independent y-axes.  The arguments @var{x1} and
-## @var{y1} define the arguments for the first plot and @var{x1} and @var{y2}
-## for the second.
-##
-## By default the arguments are evaluated with
-## @code{feval (@@plot, @var{x}, @var{y})}.  However the type of plot can be
-## modified with the @var{fun} argument, in which case the plots are
-## generated by @code{feval (@var{fun}, @var{x}, @var{y})}.  @var{fun} can be
-## a function handle, an inline function or a string of a function name.
-##
-## The function to use for each of the plots can be independently defined
-## with @var{fun1} and @var{fun2}.
-##
-## If given, @var{h} defines the principal axis in which to plot the @var{x1}
-## and @var{y1} data.  The return value @var{ax} is a two element vector with
-## the axis handles of the two plots.  @var{h1} and @var{h2} are handles to
-## the objects generated by the plot commands.
-##
-## @example
-## @group
-## x = 0:0.1:2*pi;
-## y1 = sin (x);
-## y2 = exp (x - 1);
-## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
-## xlabel ("X");
-## ylabel (ax(1), "Axis 1");
-## ylabel (ax(2), "Axis 2");
-## @end group
-## @end example
-## @seealso{plot}
-## @end deftypefn
-
-function [Ax, H1, H2] = plotyy (varargin)
-
-  ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy
-  if (nargin > 1 && length (varargin{1}) == 2 && ishandle (varargin{1}(1))
-      && ishandle (varargin{1}(2))
-      && all (floor (varargin{1}) != varargin{1}))
-    obj1 = get (varargin{1}(1));
-    obj2 = get (varargin{1}(2));
-    if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
-      ax = [obj1, obj2];
-      varargin(1) = [];
-      if (isempty (varargin))
-        varargin = {};
-      endif
-    else
-      error ("plotyy: expecting first argument to be axes handle");
-    endif
-    oldh = gca ();
-  else
-    f = get (0, "currentfigure");
-    if (isempty (f))
-      f = figure ();
-    endif
-    ca = get (f, "currentaxes");
-    if (isempty (ca))
-      ax = [];
-    elseif (ishandle (ca) && isprop (ca, "__plotyy_axes__"))
-      ax = get (ca, "__plotyy_axes__");
-    else
-      ax = ca;
-    endif
-    if (length (ax) > 2)
-      for i = 3 : length (ax)
-        delete (ax (i));
-      endfor
-      ax = ax(1:2);
-    elseif (length (ax) == 1)
-      ax(2) = axes ();
-      set (ax(2), "nextplot", get (ax(1), "nextplot"));
-    elseif (isempty (ax))
-      ax(1) = axes ();
-      ax(2) = axes ();
-      ca = ax(2);
-    endif
-    if (nargin < 2)
-      varargin = {};
-    endif
-    oldh = ca;
-  endif
-
-  if (nargin < 4)
-    print_usage ();
-  endif
-
-  unwind_protect
-    [ax, h1, h2] = __plotyy__ (ax, varargin{:});
-  unwind_protect_cleanup
-    ## Only change back to the old axis if we didn't delete it
-    if (ishandle (oldh) && strcmp (get (oldh, "type"), "axes"))
-      axes (oldh);
-    endif
-  end_unwind_protect
-
-  if (nargout > 0)
-    Ax = ax;
-    H1 = h1;
-    H2 = h2;
-  endif
-
-endfunction
-
-function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, varargin)
-  if (nargin > 5)
-    fun1 = varargin{1};
-  else
-    fun1 = @plot;
-  endif
-  if (nargin > 6)
-    fun2 = varargin{2};
-  else
-    fun2 = fun1;
-  endif
-
-  xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
-
-  if (ishandle (ax(1)) && strcmp (get (ax(1), "type"), "axes"))
-    axes (ax(1));
-  else
-    ax(1) = axes ();
-  endif
-  newplot ();
-  h1 = feval (fun1, x1, y1);
-
-  set (ax(1), "ycolor", getcolor (h1(1)));
-  set (ax(1), "xlim", xlim);
-  set (ax(1), "color", "none");
-
-  cf = gcf ();
-  set (cf, "nextplot", "add");
-
-  if (ishandle (ax(2)) && strcmp (get (ax(2), "type"), "axes"))
-    axes (ax(2));
-  else
-    ax(2) = axes ();
-    set (ax(2), "nextplot", get (ax(1), "nextplot"));
-  endif
-  newplot ();
-
-  colors = get (ax(1), "colororder");
-  set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
-
-  if (strcmp (get (ax(1), "autopos_tag"), "subplot"))
-    set (ax(2), "autopos_tag", "subplot");
-  else
-    set (ax, "activepositionproperty", "position");
-  endif
-
-  h2 = feval (fun2, x2, y2);
-  set (ax(2), "yaxislocation", "right");
-  set (ax(2), "ycolor", getcolor (h2(1)));
-
-  if (strcmp (get(ax(1), "activepositionproperty"), "position"))
-    set (ax(2), "position", get (ax(1), "position"));
-  else
-    set (ax(2), "outerposition", get (ax(1), "outerposition"));
-    set (ax(2), "looseinset", get (ax(1), "looseinset"));
-  endif
-
-  set (ax(2), "xlim", xlim);
-  set (ax(2), "color", "none");
-  set (ax(2), "box", "off");
-
-  ## Add invisible text objects that when destroyed,
-  ## also remove the other axis
-  t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
-             "handlevisibility", "off", "visible", "off",
-             "xliminclude", "off", "yliminclude", "off");
-  t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
-             "handlevisibility", "off", "visible", "off",
-             "xliminclude", "off", "yliminclude", "off");
-
-  set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
-  set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
-
-  addlistener (ax(1), "position", {@update_position, ax(2)});
-  addlistener (ax(2), "position", {@update_position, ax(1)});
-  addlistener (ax(1), "outerposition", {@update_position, ax(2)});
-  addlistener (ax(2), "outerposition", {@update_position, ax(1)});
-  addlistener (ax(1), "looseinset", {@update_position, ax(2)});
-  addlistener (ax(2), "looseinset", {@update_position, ax(1)});
-  addlistener (ax(1), "view", {@update_position, ax(2)});
-  addlistener (ax(2), "view", {@update_position, ax(1)});
-  addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)});
-  addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)});
-  addlistener (ax(1), "plotboxaspectratiomode", {@update_position, ax(2)});
-  addlistener (ax(2), "plotboxaspectratiomode", {@update_position, ax(1)});
-  addlistener (ax(1), "nextplot", {@update_nextplot, ax(2)});
-  addlistener (ax(2), "nextplot", {@update_nextplot, ax(1)});
-
-  ## Store the axes handles for the sister axes.
-  if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__"))
-    addproperty ("__plotyy_axes__", ax(1), "data", ax);
-  elseif (ishandle (ax(1)))
-    set (ax(1), "__plotyy_axes__", ax);
-  else
-    error ("plotyy.m: This shouldn't happen. File a bug report.");
-  endif
-  if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__"))
-    addproperty ("__plotyy_axes__", ax(2), "data", ax);
-  elseif (ishandle (ax(2)))
-    set (ax(2), "__plotyy_axes__", ax);
-  else
-    error ("plotyy.m: This shouldn't happen. File a bug report.");
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.1:2*pi;
-%! y1 = sin (x);
-%! y2 = exp (x - 1);
-%! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
-%! xlabel ('X');
-%! ylabel (ax(1), 'Axis 1');
-%! ylabel (ax(2), 'Axis 2');
-%! axes (ax(1));
-%! text (0.5, 0.5, 'Left Axis', ...
-%!       'color', [0 0 1], 'horizontalalignment', 'center');
-%! axes (ax(2));
-%! text (4.5, 80, 'Right Axis', ...
-%!       'color', [0 0.5 0], 'horizontalalignment', 'center');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = linspace (-1, 1, 201);
-%! subplot (2,2,1);
-%!  plotyy (x,sin(pi*x), x,10*cos(pi*x));
-%! subplot (2,2,2);
-%!  surf (peaks (25));
-%! subplot (2,2,3);
-%!  contour (peaks (25));
-%! subplot (2,2,4);
-%!  plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
-%! axis square;
-
-%!demo
-%! clf;
-%! x = linspace (-1, 1, 201);
-%! hax = plotyy (x, sin (pi*x), x, cos (pi*x));
-%! ylabel (hax(1), 'Blue on the Left');
-%! ylabel (hax(2), 'Green on the Right');
-%! xlabel ('xlabel');
-
-%!demo
-%! clf
-%! hold on
-%! t = (0:0.1:9);
-%! x = sin (t);
-%! y = 5 * cos (t);
-%! [hax, h1, h2] = plotyy (t, x, t, y);
-%! [~, h3, h4] = plotyy (t+1, x, t+1, y);
-%! set ([h3, h4], 'linestyle', '--');
-%! xlabel (hax(1), 'xlabel');
-%! title (hax(2), 'title');
-%! ylabel (hax(1), 'Left axis is Blue');
-%! ylabel (hax(2), 'Right axis is Green');
-
-function deleteplotyy (h, d, ax2, t2)
-  if (ishandle (ax2) && strcmp (get (ax2, "type"), "axes")
-      && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))
-      && strcmp (get (ax2, "beingdeleted"), "off"))
-    set (t2, "deletefcn", []);
-    delete (ax2);
-  endif
-endfunction
-
-function update_nextplot (h, d, ax2)
-  persistent recursion = false;
-  prop = "nextplot";
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      set (ax2, prop, get (h, prop));
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_position (h, d, ax2)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      view = get (h, "view");
-      oldview = get (ax2, "view");
-      plotboxaspectratio = get (h, "plotboxaspectratio");
-      oldplotboxaspectratio = get (ax2, "plotboxaspectratio");
-      plotboxaspectratiomode = get (h, "plotboxaspectratiomode");
-      oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode");
-
-      if (strcmp (get(h, "activepositionproperty"), "position"))
-        position = get (h, "position");
-        oldposition = get (ax2, "position");
-        if (! (isequal (position, oldposition) && isequal (view, oldview)))
-          set (ax2, "position", position, "view", view);
-        endif
-      else
-        outerposition = get (h, "outerposition");
-        oldouterposition = get (ax2, "outerposition");
-        if (! (isequal (outerposition, oldouterposition) && isequal (view, oldview)))
-          set (ax2, "outerposition", outerposition, "view", view);
-        endif
-      endif
-
-      if (! (isequal (plotboxaspectratio, oldplotboxaspectratio)
-             && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode)))
-        set (ax2, "plotboxaspectratio", plotboxaspectratio);
-        set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode);
-      endif
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function color = getcolor (ax)
-  obj = get (ax);
-  if (isfield (obj, "color"))
-    color = obj.color;
-  elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor))
-    color = obj.facecolor;
-  elseif (isfield (obj, "edgecolor") && !  ischar (obj.edgecolor))
-    color = obj.edgecolor;
-  else
-    color = [0, 0, 0];
-  endif
-endfunction
-
--- a/scripts/plot/polar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} polar (@var{theta}, @var{rho})
-## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
-## @deftypefnx {Function File} {} polar (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} polar (@dots{})
-## Create a two-dimensional plot from polar coordinates @var{theta} and
-## @var{rho}.
-##
-## The optional argument @var{fmt} specifies the line format.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-##
-## @seealso{plot, rose, compass}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = polar (varargin)
-
-  [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    if (nargs == 3)
-      if (! ischar (varargin{3}))
-        error ("polar: third argument must be a string");
-      endif
-      tmp = __plr2__ (h, varargin{:});
-      maxr = max (varargin {2} (:));
-    elseif (nargs == 2)
-      if (ischar (varargin{2}))
-        tmp = __plr1__ (h, varargin{:});
-        if (iscomplex (varargin{1}))
-          maxr = max (imag (varargin{1})(:));
-        else
-          maxr = max (varargin{1}(:));
-        endif
-      else
-        fmt = "";
-        tmp = __plr2__ (h, varargin{:}, fmt);
-        maxr = max (varargin {2} (:));
-      endif
-    elseif (nargs == 1)
-      fmt = "";
-      tmp = __plr1__ (h, varargin{:}, fmt);
-      if (iscomplex (varargin{1}))
-        maxr = max (imag (varargin{1})(:));
-      else
-        maxr = max (varargin{1}(:));
-      endif
-    else
-      print_usage ();
-    endif
-
-    set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr],
-         "xaxislocation", "zero", "yaxislocation", "zero",
-         "plotboxaspectratio", [1, 1, 1]);
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-function retval = __plr1__ (h, theta, fmt)
-
-  if (nargin != 3)
-    print_usage ();
-  endif
-
-  [nr, nc] = size (theta);
-  if (nr == 1)
-    theta = theta';
-    tmp = nr;
-    nr = nc;
-    nc = tmp;
-  endif
-  theta_i = imag (theta);
-  if (any (theta_i))
-    rho = theta_i;
-    theta = real (theta);
-  else
-    rho = theta;
-    theta = (1:nr)';
-  endif
-
-  retval = __plr2__ (h, theta, rho, fmt);
-
-endfunction
-
-function retval = __plr2__ (h, theta, rho, fmt)
-
-  if (nargin != 4)
-    print_usage ();
-  endif
-
-  if (any (imag (theta)))
-    theta = real (theta);
-  endif
-
-  if (any (imag (rho)))
-    rho = real (rho);
-  endif
-
-  if (isscalar (theta))
-    if (isscalar (rho))
-      x = rho * cos (theta);
-      y = rho * sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("__plr2__: invalid data for plotting");
-    endif
-  elseif (isvector (theta))
-    if (isvector (rho))
-      if (length (theta) != length (rho))
-        error ("__plr2__: vector lengths must match");
-      endif
-      if (rows (rho) == 1)
-        rho = rho';
-      endif
-      if (rows (theta) == 1)
-        theta = theta';
-      endif
-      x = rho .* cos (theta);
-      y = rho .* sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    elseif (ismatrix (rho))
-      [t_nr, t_nc] = size (theta);
-      if (t_nr == 1)
-        theta = theta';
-        tmp = t_nr;
-        t_nr = t_nc;
-        t_nc = tmp;
-      endif
-      [r_nr, r_nc] = size (rho);
-      if (t_nr != r_nr)
-        rho = rho';
-        tmp = r_nr;
-        r_nr = r_nc;
-        r_nc = tmp;
-      endif
-      if (t_nr != r_nr)
-        error ("__plr2__: vector and matrix sizes must match");
-      endif
-      x = diag (cos (theta)) * rho;
-      y = diag (sin (theta)) * rho;
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("__plr2__: invalid data for plotting");
-    endif
-  elseif (ismatrix (theta))
-    if (isvector (rho))
-      [r_nr, r_nc] = size (rho);
-      if (r_nr == 1)
-        rho = rho';
-        tmp = r_nr;
-        r_nr = r_nc;
-        r_nc = tmp;
-      endif
-      [t_nr, t_nc] = size (theta);
-      if (r_nr != t_nr)
-        theta = theta';
-        tmp = t_nr;
-        t_nr = t_nc;
-        t_nc = tmp;
-      endif
-      if (r_nr != t_nr)
-        error ("__plr2__: vector and matrix sizes must match");
-      endif
-      diag_r = diag (rho);
-      x = diag_r * cos (theta);
-      y = diag_r * sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    elseif (ismatrix (rho))
-      if (! size_equal (rho, theta))
-        error ("__plr2__: matrix dimensions must match");
-      endif
-      x = rho .* cos (theta);
-      y = rho .* sin (theta);
-      retval = __plt__ ("polar", h, x, y, fmt);
-    else
-      error ("__plr2__: invalid data for plotting");
-    endif
-  else
-    error ("__plr2__: invalid data for plotting");
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! theta = linspace (0,2*pi,1000);
-%! rho = sin (7*theta);
-%! polar (theta, rho);
-
-%!demo
-%! clf;
-%! theta = linspace (0,10*pi,1000);
-%! rho = sin (5/4*theta);
-%! polar (theta, rho);
-
--- a/scripts/plot/print.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,710 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} print ()
-## @deftypefnx {Function File} {} print (@var{options})
-## @deftypefnx {Function File} {} print (@var{filename}, @var{options})
-## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
-## Print a plot, or save it to a file.  Both output formatted for 
-## printing (PDF and PostScript), and many bitmapped and vector
-## image formats are supported.
-##
-## @var{filename} defines the name of the output file.  If the
-## file name has no suffix, one is inferred from the specified
-## device and appended to the file name.  If no filename is
-## specified, the output is sent to the printer.
-##
-## @var{h} specifies the figure handle.  If no handle is specified
-## the handle for the current figure is used.
-##
-## For output to a printer, PostScript file, or PDF file,
-## the paper size is specified by the figure's @code{papersize}
-## property.  The location and size of the image on the page are
-## specified by the figure's @code{paperposition} property.  The
-## orientation of the page is specified by the figure's
-## @code{paperorientation} property.
-##
-## The width and height of images are specified by the figure's
-## @code{paperpositon(3:4)} property values.
-##
-## The @code{print} command supports many @var{options}:
-##
-## @table @code
-## @item -f@var{h}
-##   Specify the handle, @var{h}, of the figure to be printed.  The
-## default is the current figure.
-##
-## @item -P@var{printer}
-##   Set the @var{printer} name to which the plot is sent if no
-## @var{filename} is specified.
-##
-## @item -G@var{ghostscript_command}
-##   Specify the command for calling Ghostscript.  For Unix and Windows
-## the defaults are 'gs' and 'gswin32c', respectively.
-##
-## @item -color
-## @itemx -mono
-##   Monochrome or color output.
-##
-## @item -solid
-## @itemx -dashed
-##   Force all lines to be solid or dashed, respectively.
-##
-## @item -portrait
-## @itemx -landscape
-##   Specify the orientation of the plot for printed output.  For
-## non-printed output the aspect ratio of the output corresponds to
-## the plot area defined by the "paperposition" property in the
-## orientation specified.  This options is equivalent to changing
-## the figure's "paperorientation" property.
-##
-## @item -TextAlphaBits=@var{n}
-## @itemx -GraphicsAlphaBits=@var{n}
-##   Octave is able to produce output for various printers, bitmaps, and
-## vector formats by using Ghostscript.
-## For bitmap and printer output anti-aliasing is applied using
-## Ghostscript's TextAlphaBits and GraphicsAlphaBits options.
-## The default number of bits for each is 4.
-## Allowed values for @var{N} are 1, 2, or 4.
-##
-## @item -d@var{device}
-##   The available output format is specified by the option @var{device},
-## and is one of:
-##
-##   @table @code
-##   @item ps
-##   @itemx ps2
-##   @itemx psc
-##   @itemx psc2
-##     Postscript (level 1 and 2, mono and color).  The FLTK graphics
-## toolkit generates Postscript level 3.0.
-##
-##   @item eps
-##   @itemx eps2
-##   @itemx epsc
-##   @itemx epsc2
-##     Encapsulated postscript (level 1 and 2, mono and color).  The FLTK
-## graphic toolkit generates Postscript level 3.0.
-##
-##   @item tex
-##   @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.
-##
-##   @item tikz
-##     Generate a @LaTeX{} file using PGF/TikZ@.  For the FLTK toolkit
-## the result is PGF.
-##
-##   @item ill
-##   @itemx aifm
-##     Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
-##
-##   @item cdr
-##   @itemx @nospell{corel}
-##     CorelDraw
-##
-##   @item dxf
-##     AutoCAD
-##
-##   @item emf
-##   @itemx meta
-##     Microsoft Enhanced Metafile
-##
-##   @item fig
-##     XFig.  For the Gnuplot graphics toolkit, the additional options
-## @option{-textspecial} or @option{-textnormal} can be used to control
-## whether the special flag should be set for the text in
-## the figure.  (default is @option{-textnormal})
-##
-##   @item hpgl
-##     HP plotter language
-##
-##   @item mf
-##     Metafont
-##
-##   @item png
-##     Portable network graphics
-##
-##   @item jpg
-##   @itemx jpeg
-##     JPEG image
-##
-##   @item gif
-##     GIF image (only available for the Gnuplot graphics toolkit)
-##
-##   @item pbm
-##     PBMplus
-##
-##   @item svg
-##     Scalable vector graphics
-##
-##   @item pdf
-##     Portable document format
-##   @end table
-##
-##   If the device is omitted, it is inferred from the file extension,
-## or if there is no filename it is sent to the printer as postscript.
-##
-## @item -d@var{ghostscript_device}
-##   Additional devices are supported by Ghostscript.
-## Some examples are;
-##
-##   @table @code
-##   @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 @samp{system ("gs -h")} to see what formats
-## and devices are available.
-##
-##   When Ghostscript output is sent to a printer the size is determined
-## by the figure's "papersize" property.  When the output
-## is sent to a file the size is determined by the plot box defined by
-## the figure's "paperposition" property.
-##
-## @item -append
-##   Append Postscript or PDF output to a pre-existing file of the same type.
-##
-## @item -r@var{NUM}
-##   Resolution of bitmaps in pixels per inch.  For both metafiles and
-## SVG the default is the screen resolution; for other formats it is 150 dpi.
-## To specify screen resolution, use "-r0".
-##
-## @item -tight
-##   Force a tight bounding box for eps files.
-##
-## @item -@var{preview}
-##   Add a preview to eps files.  Supported formats are:
-##
-##   @table @code
-##   @item -interchange
-##     Provide an interchange preview.
-##
-##   @item -metalfile
-##     Provide a metafile preview.
-##
-##   @item -pict
-##     Provide pict preview.
-##
-##   @item -tiff
-##     Provide a tiff preview.
-##   @end table
-##
-## @item -S@var{xsize},@var{ysize}
-##   Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@.  For
-## PS, EPS, PDF, and other vector formats the plot size is in points.
-## This option is equivalent to changing the size of the plot box
-## associated with the "paperposition" property.  When using the command form
-## of the print function you must quote the @var{xsize},@var{ysize}
-## option.  For example, by writing @w{"-S640,480"}.
-##
-## @item -F@var{fontname}
-## @itemx -F@var{fontname}:@var{size}
-## @itemx -F:@var{size}
-##   Use @var{fontname} and/or @var{fontsize} for all text.
-## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc.
-## @end table
-##
-## The filename and options can be given in any order.
-##
-## Example: Print to a file using the svg device.
-##
-## @example
-## @group
-## figure (1);
-## clf ();
-## surf (peaks);
-## print -dsvg figure1.svg
-## @end group
-## @end example
-##
-## Example: Print to an HP DeskJet 550C.
-##
-## @example
-## @group
-## figure (1);
-## clf ();
-## surf (peaks);
-## print -dcdj550
-## @end group
-## @end example
-##
-## @seealso{figure, orient, saveas}
-## @end deftypefn
-
-function print (varargin)
-
-  opts = __print_parse_opts__ (varargin{:});
-
-  opts.pstoedit_cmd = @pstoedit;
-  opts.fig2dev_cmd = @fig2dev;
-  opts.latex_standalone = @latex_standalone;
-  opts.lpr_cmd = @lpr;
-  opts.epstool_cmd = @epstool;
-
-  if (! isfigure (opts.figure))
-    error ("print: no figure to print");
-  endif
-
-  orig_figure = get (0, "currentfigure");
-  figure (opts.figure);
-
-  if (opts.append_to_file)
-    [~, ~, ext] = fileparts (opts.ghostscript.output);
-    opts.ghostscript.prepend = strcat (tmpnam (), ext);
-    copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
-  endif
-
-  unwind_protect
-
-    ## Modify properties as specified by options
-    props = [];
-
-    drawnow ();
-
-    ## print() requires figure units to be "pixels"
-    props(1).h = opts.figure;
-    props(1).name = "units";
-    props(1).value = {get(opts.figure, "units")};
-    set (opts.figure, "units", "pixels");
-
-    ## graphics toolkit tranlates figure position to eps bbox in points
-    fpos = get (opts.figure, "position");
-    props(2).h = opts.figure;
-    props(2).name = "position";
-    props(2).value = {fpos};
-    fpos(3:4) = opts.canvas_size;
-    set (opts.figure, "position", fpos);
-
-    ## Set figure background to none. This is done both for
-    ## consistency with Matlab and to elliminate the visible
-    ## box along the figure's perimeter.
-    props(3).h = opts.figure;
-    props(3).name = "color";
-    props(3).value{1} = get (props(3).h, props(3).name);
-    set (props(3).h, "color", "none");
-
-    if (opts.force_solid != 0)
-      h = findall (opts.figure, "-property", "linestyle");
-      m = numel (props);
-      for n = 1:numel (h)
-        props(m+n).h = h(n);
-        props(m+n).name = "linestyle";
-        props(m+n).value = {get(h(n), "linestyle")};
-      endfor
-      if (opts.force_solid > 0)
-        linestyle = "-";
-      else
-        linestyle = "--";
-      endif
-      set (h, "linestyle", linestyle);
-    endif
-
-    if (opts.use_color < 0
-        && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot"))
-      color_props = {"color", "facecolor", "edgecolor", "colormap"};
-      for c = 1:numel (color_props)
-        h = findall (opts.figure, "-property", color_props{c});
-        hnone = findall (opts.figure, color_props{c}, "none");
-        h = setdiff (h, hnone);
-        m = numel (props);
-        for n = 1:numel (h)
-          if (ishandle (h(n)))
-            ## Need to verify objects exist since callbacks may delete objects
-            ## as the colors for others are modified.
-            rgb = get (h(n), color_props{c});
-            props(end+1).h = h(n);
-            props(end).name = color_props{c};
-            props(end).value = {get(h(n), color_props{c})};
-            if (isnumeric (rgb))
-              ## convert RGB color to RGB gray scale
-              xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1);
-              ggg = repmat (sum (xfer .* rgb, 2), 1, 3);
-              set (h(n), color_props{c}, ggg);
-            endif
-          endif
-        endfor
-      endfor
-    endif
-
-    if (! isempty (opts.font) || ! isempty (opts.fontsize))
-      h = findall (opts.figure, "-property", "fontname");
-      m = numel (props);
-      for n = 1:numel (h)
-        if (ishandle (h(n)))
-          if (! isempty (opts.font))
-            props(end+1).h = h(n);
-            props(end).name = "fontname";
-            props(end).value = {get(h(n), "fontname")};
-          endif
-        endif
-        if (ishandle (h(n)))
-          if (! isempty (opts.fontsize))
-            props(end+1).h = h(n);
-            props(end).name = "fontsize";
-            props(end).value = {get(h(n), "fontsize")};
-          endif
-        endif
-      endfor
-      if (! isempty (opts.font))
-        set (h(ishandle (h)), "fontname", opts.font);
-      endif
-      if (! isempty (opts.fontsize))
-        if (ischar (opts.fontsize))
-          fontsize = str2double (opts.fontsize);
-        else
-          fontsize = opts.fontsize;
-        endif
-        if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1)
-          ## This is done to work around the bbox being whole numbers.
-          fontsize = fontsize * opts.scalefontsize;
-        endif
-        set (h(ishandle (h)), "fontsize", fontsize);
-      endif
-    endif
-
-    ## call the graphcis toolkit print script
-    switch (get (opts.figure, "__graphics_toolkit__"))
-    case "gnuplot"
-      opts = __gnuplot_print__ (opts);
-    otherwise
-      opts = __fltk_print__ (opts);
-    endswitch
-
-  unwind_protect_cleanup
-    ## restore modified properties
-    if (isstruct (props))
-      for n = numel (props):-1:1
-        if (ishandle (props(n).h))
-          set (props(n).h, props(n).name, props(n).value{1});
-        endif
-      endfor
-    endif
-
-    ## Unlink temporary files
-    for n = 1:numel (opts.unlink)
-      [status, output] = unlink (opts.unlink{n});
-      if (status != 0)
-        warning ("print.m: %s, '%s'", output, opts.unlink{n});
-      endif
-    endfor
-  end_unwind_protect
-
-  if (isfigure (orig_figure))
-    figure (orig_figure);
-  endif
-
-endfunction
-
-function cmd = epstool (opts, filein, fileout)
-  ## As epstool does not work with pipes, a subshell is used to
-  ## permit piping. Since this solution does not work with the DOS
-  ## command shell, the -tight and -preview options are disabled if
-  ## output must be piped.
-
-  ## DOS Shell:
-  ##   gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein>
-  ## Unix Shell;
-  ##   cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
-
-  dos_shell = (ispc () && ! isunix ());
-
-  cleanup = "";
-  if (nargin < 3)
-    fileout = opts.name;
-  elseif (isempty (fileout))
-    fileout = "-";
-  endif
-
-  if (nargin < 2 || strcmp (filein, "-") || isempty (filein))
-    pipein = true;
-    filein = strcat (tmpnam (), ".eps");
-    if (dos_shell)
-      cleanup = sprintf ("& del %s ", strrep (filein, '/', '\'));
-    else
-      cleanup = sprintf ("; rm %s ", filein);
-    endif
-  else
-    pipein = false;
-    filein = strcat ("'", strtrim (filein), "'");
-  endif
-  if (strcmp (fileout, "-"))
-    pipeout = true;
-    fileout = strcat (tmpnam (), ".eps");
-    if (dos_shell)
-      cleanup = horzcat (cleanup, sprintf ("& del %s ", strrep (fileout, '/', '\')));
-    else
-      cleanup = horzcat (cleanup, sprintf ("; rm %s ", fileout));
-    endif
-  else
-    pipeout = false;
-    fileout = strcat ("'", strtrim (fileout), "'");
-  endif
-
-  if (! isempty (opts.preview) && opts.tight_flag)
-    warning ("print:previewandtight",
-             "print.m: eps preview may not be combined with -tight");
-  endif
-  if (! isempty (opts.preview) || opts.tight_flag)
-    if (! isempty (opts.epstool_binary))
-      if (opts.tight_flag)
-        cmd = "--copy --bbox";
-      elseif (! isempty (opts.preview))
-        switch opts.preview
-        case "tiff"
-          cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview);
-        case {"tiff6u", "tiff6p", "metafile"}
-          cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview);
-        case {"tiff4", "interchange"}
-          cmd = sprintf ("--add-%s-preview", opts.preview);
-        case "pict"
-          cmd = sprintf ("--add-%s-preview --mac-single", opts.preview);
-        otherwise
-          error ("print:invalidpreview",
-                 "print.m: epstool cannot include preview for format '%s'",
-                 opts.preview);
-        endswitch
-        if (! isempty (opts.ghostscript.resolution))
-          cmd = sprintf ("%s --dpi %d", cmd, opts.ghostscript.resolution);
-        endif
-      else
-        cmd = "";
-      endif
-      if (! isempty (cmd))
-        cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary,
-                       cmd, filein, fileout);
-      endif
-      if (pipein)
-        if (dos_shell)
-          filein(filein=="'") = "\"";
-          gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                                    "device", "epswrite",
-                                    "source", "-",
-                                    "output", filein);
-          cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
-        else
-          cmd = sprintf ("cat > %s ; %s", filein, cmd);
-        endif
-      endif
-      if (pipeout)
-        if (dos_shell)
-          cmd = sprintf ("%s & type %s", cmd, fileout);
-        else
-          cmd = sprintf ("%s ; cat %s", cmd, fileout);
-        endif
-      endif
-      if (! isempty (cleanup))
-        if (pipeout && dos_shell)
-          error ("print:epstoolpipe",
-                 "print.m: cannot pipe output of 'epstool' for DOS shell");
-        elseif (pipeout)
-          cmd = sprintf ("( %s %s )", cmd, cleanup);
-        else
-          cmd = sprintf ("%s %s", cmd, cleanup);
-        endif
-      endif
-    elseif (isempty (opts.epstool_binary))
-      error ("print:noepstool", "print.m: 'epstool' not found in PATH");
-    endif
-  else
-    if (pipein && pipeout)
-      if (dos_shell)
-        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                               "device", "epswrite",
-                               "source", "-",
-                               "output", "-");
-      else
-        cmd = " cat ";
-      endif
-    elseif (pipein && ! pipeout)
-      if (dos_shell)
-        ## ghostscript expects double, not single, quotes
-        fileout(fileout=="'") = "\"";
-        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
-                               "device", "epswrite",
-                               "source", "-",
-                               "output", fileout);
-      else
-        cmd = sprintf (" cat > %s ", fileout);
-      endif
-    elseif (! pipein && pipeout)
-      if (dos_shell)
-        cmd = sprintf (" type %s ", filein);
-      else
-        cmd = sprintf (" cat %s ", filein);
-      endif
-    else
-      if (dos_shell)
-        cmd = sprintf (" copy %s %s ", filein, fileout);
-      else
-        cmd = sprintf (" cp %s %s ", filein, fileout);
-      endif
-    endif
-  endif
-  if (opts.debug)
-    fprintf ("epstool command: '%s'\n", cmd);
-  endif
-endfunction
-
-function cmd = fig2dev (opts, devopt)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  dos_shell = (ispc () && ! isunix ());
-  if (! isempty (opts.fig2dev_binary))
-    if (dos_shell)
-      ## FIXME - is this the right thing to do for DOS?
-      cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt);
-    else
-      cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt);
-    endif
-  elseif (isempty (opts.fig2dev_binary))
-    error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("fig2dev command: '%s'\n", cmd);
-  endif
-endfunction
-
-function latex_standalone (opts)
-  n = find (opts.name == ".", 1, "last");
-  if (! isempty (n))
-    opts.name = opts.name(1:n-1);
-  endif
-  latexfile = strcat (opts.name, ".tex");
-  switch opts.devopt
-  case {"pdflatexstandalone"}
-    packages = "\\usepackage{graphicx,color}";
-    graphicsfile = strcat (opts.name, "-inc.pdf");
-  case {"pslatexstandalone"}
-    packages = "\\usepackage{epsfig,color}";
-    graphicsfile = strcat (opts.name, "-inc.ps");
-  otherwise
-    packages = "\\usepackage{epsfig,color}";
-    graphicsfile = strcat (opts.name, "-inc.eps");
-  endswitch
-  papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}",
-                       opts.canvas_size, opts.canvas_size);
-  prepend = {"\\documentclass{minimal}";
-             packages;
-             papersize;
-             "\\begin{document}";
-             "\\centering"};
-  postpend = {"\\end{document}"};
-  fid = fopen (latexfile, "r");
-  if (fid >= 0)
-    latex = fscanf (fid, "%c", Inf);
-    status = fclose (fid);
-    if (status != 0)
-      error ("print:errorclosingfile",
-             "print.m: error closing file '%s'", latexfile);
-    endif
-    ## TODO - should this be fixed in GL2PS?
-    latex = strrep (latex, "\\includegraphics{}",
-                    sprintf ("\\includegraphics{%s}", graphicsfile));
-  else
-    error ("print:erroropeningfile",
-           "print.m: error opening file '%s'", latexfile);
-  endif
-  fid = fopen (latexfile, "w");
-  if (fid >= 0)
-    fprintf (fid, "%s\n", prepend{:});
-    fprintf (fid, "%s", latex);
-    fprintf (fid, "%s\n", postpend{:});
-    status = fclose (fid);
-    if (status != 0)
-      error ("print:errorclosingfile",
-             "print.m: error closing file '%s'", latexfile);
-    endif
-  else
-    error ("print:erroropeningfile",
-           "print.m: error opening file '%s'", latexfile);
-  endif
-endfunction
-
-function cmd = lpr (opts)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  if (! isempty (opts.lpr_binary))
-    cmd = opts.lpr_binary;
-    if (! isempty (opts.lpr_options))
-      cmd = sprintf ("%s %s", cmd, opts.lpr_options);
-    endif
-    if (! isempty (opts.printer))
-      cmd = sprintf ("%s -P %s", cmd, opts.printer);
-    endif
-  elseif (isempty (opts.lpr_binary))
-    error ("print:nolpr", "print.m: 'lpr' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("lpr command: '%s'\n", cmd);
-  endif
-endfunction
-
-function cmd = pstoedit (opts, devopt)
-  if (nargin < 2)
-    devopt =  opts.devopt;
-  endif
-  dos_shell = (ispc () && ! isunix ());
-  if (! isempty (opts.pstoedit_binary))
-    if (dos_shell)
-      cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt);
-    else
-      ## FIXME - is this the right thing to do for DOS?
-      cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt);
-    endif
-  elseif (isempty (opts.pstoedit_binary))
-    error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH");
-  endif
-  if (opts.debug)
-    fprintf ("pstoedit command: '%s'\n", cmd);
-  endif
-endfunction
-
-
--- a/scripts/plot/printd.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-## Copyright (C) 2013 Michael D. Godfrey
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public
-## License as published by the Free Software Foundation;
-## either version 3 of the License, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied
-## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-## PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public
-## License along with Octave; see the file COPYING. If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} printd (@var{obj}, @var{filename})
-## @deftypefnx {Function File} {@var{out_file} =} printd (@dots{})
-##
-## Convert any object acceptable to @code{disp} into the format
-## selected by the suffix of @var{filename}.  If the return argument
-## @var{out_file} is given, the name of the created file is returned.
-##
-## This function is intended to facilitate manipulation of the output
-## of functions such as @code{stemleaf}.
-## @seealso{stemleaf}
-## @end deftypefn
-
-## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
-## Description: Convert objects into other file formats.
-
-function pr_out = printd (obj, filename)
-  ## Convert any object acceptable to disp() into various display formats.
-  ## obj is the input object.
-  ## filename is the output file (with required suffix).
-
-  ## Extract .suffix from filename
-  if ((sufix = rindex (filename, ".")) <= 0)
-    error ("The output filename: %s requires a suffix.\nOptions are: pdf ps eps txt jpg jpeg", filename);
-  endif
-  opt = substr (filename, sufix+1);
-  [pf, tempf, mag] = mkstemp ("oct-XXXXXX", 1);  # Safe version of tmpnam()
-  fprintf (pf, "%s", disp (obj));
-  frewind (pf);
-
-  ## It seems best to only use convert for image output.  Its ps and pdf
-  ## are badly rendered.
-  opt = lower (opt);
-  switch opt
-    case {"pdf"}
-      enscr = sprintf (
-                       "enscript --no-header -o %s.ps %s ; ps2pdf %s.ps %s.pdf; mv %s.pdf %s;exit",...
-                       tempf, tempf, tempf, tempf, tempf, filename);
-      system (enscr);
-      delete ([tempf ".ps"]);
-    case {"ps"}
-      enscr = sprintf ("enscript --no-header -o %s %s ; exit", filename, tempf);
-      system (enscr);
-    case {"eps"}
-      enscr = sprintf (
-                       "enscript --no-header -o %s.ps %s ; ps2eps --ignoreBB %s.ps; mv %s.eps %s; exit",...
-                       tempf, tempf, tempf, tempf, filename);
-      system (enscr);
-      delete ([tempf ".ps"]);
-    case {"txt"}
-      enscr = sprintf ("cp %s %s", tempf, filename);
-      system (enscr);
-    case {"jpg" "jpeg"}
-      enscr = sprintf ("convert -trim txt:%s  jpg:%s", tempf, filename);
-      system (enscr);
-    otherwise
-      fclose (pf);
-      delete (tempf);
-      error ("Unknown conversion type: %s.\nOptions are: pdf ps eps txt jpg jpeg", opt);
-
-  endswitch
-  fclose (pf);
-  delete (tempf);
-  pr_out =  sprintf ("%s file %s written\n", opt, filename);
-endfunction
-
-
-%!demo
-%! r2 = char (
-%! 'stem step: 10, data: unsorted.',
-%! 'Hinges:    lo: 12, hi: 42'     ,
-%! '   1 | 22118'                  ,
-%! '   2 | 28'                     ,
-%! '   3 | 98'                     ,
-%! '   4 | 244'                    ,
-%! '   5 | 2'                      );
-%! printd (r2, 'test_p.txt');
-%! system ('cat test_p.txt');
-%! delete ('test_p.txt');
-
-%!test
-%! r2 = char (
-%! "stem step: 10, data: unsorted.",
-%! "Hinges:    lo: 12, hi: 42"     ,
-%! "   1 | 22118"                  ,
-%! "   2 | 28"                     ,
-%! "   3 | 98"                     ,
-%! "   4 | 244"                    ,
-%! "   5 | 2"                      );
-%! printd (r2, "test_p.txt");
-%! r4 = fileread ("test_p.txt");
-%! delete ("test_p.txt");
-%! r2 = disp (r2);
-%! assert (r4, r2);
-
--- a/scripts/plot/private/__actual_axis_position__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} __actual_axis_position__ (@var{h})
-## @deftypefnx {Function File} {} __actual_axis_position__ (@var{axis_struct})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott
-
-function pos = __actual_axis_position__ (h)
-
-  if (ishandle (h))
-    axis_obj = get (h);
-  elseif (isstruct (h))
-    axis_obj = h;
-    h = axis_obj.__my_handle__;
-  endif
-
-  ## Get figure size in pixels
-  orig_fig_units = get (axis_obj.parent, "units");
-  orig_fig_position = get (axis_obj.parent, "position");
-  unwind_protect
-    set (axis_obj.parent, "units", "pixels");
-    fig_position = get (axis_obj.parent, "position");
-  unwind_protect_cleanup
-    set (axis_obj.parent, "units", orig_fig_units);
-    set (axis_obj.parent, "position", orig_fig_position);
-  end_unwind_protect
-  ## Get axes size in pixels
-  if (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
-      && strcmp (axis_obj.activepositionproperty, "outerposition"))
-    pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]);
-  else
-    pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]);
-  endif
-
-  nd = __calc_dimensions__ (h);
-
-  if (strcmp (axis_obj.plotboxaspectratiomode, "manual")
-      || strcmp (axis_obj.dataaspectratiomode, "manual"))
-    ## When using {rltb}margin, Gnuplot does not handle the specified
-    ## aspect ratio properly, so handle it here.
-    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-      aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2);
-    else
-      ## FIXME -- this works for "axis square", but has not been
-      ##          thoroughly tested for other aspect ratios.
-      aspect_ratio_2d = [max(axis_obj.plotboxaspectratio(1:2)), ...
-                             axis_obj.plotboxaspectratio(3)/sqrt(2)];
-    endif
-    orig_aspect_ratio_2d = pos_in_pixels(3:4);
-    rel_aspect_ratio_2d =  aspect_ratio_2d ./ orig_aspect_ratio_2d;
-    rel_aspect_ratio_2d = rel_aspect_ratio_2d ./ max (rel_aspect_ratio_2d);
-    if (rel_aspect_ratio_2d(1) < rel_aspect_ratio_2d(2));
-      dx = (1.0 - rel_aspect_ratio_2d(1)) * pos_in_pixels(3);
-      pos_in_pixels = pos_in_pixels + dx*[0.5, 0.0, -1.0, 0.0];
-    elseif (rel_aspect_ratio_2d(1) > rel_aspect_ratio_2d(2))
-      dy = (1.0 - rel_aspect_ratio_2d(2)) * pos_in_pixels(4);
-      pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0];
-    endif
-    pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]);
-  elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
-          && strcmp (axis_obj.activepositionproperty, "outerposition"))
-    pos = axis_obj.outerposition;
-  else
-    pos = axis_obj.position;
-  endif
-endfunction
-
--- a/scripts/plot/private/__add_datasource__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{newargs} =} __add_datasource__ (@var{fcn}, @var{h}, @var{data}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-function newargs = __add_datasource__ (fcn, h, data, varargin)
-
-  if (nargin < 3)
-    error ("__add_datasource__: a minimum of 3 inputs are required");
-  endif
-
-  if (ischar (data))
-    data = {data};
-  endif
-
-  for i = 1 : numel (data)
-    addproperty (strcat (data{i}, "datasource"), h, "string", "");
-  endfor
-
-  i = 0;
-  newargs = {};
-  while (i < numel (varargin))
-    arg = varargin{++i};
-    if (i != numel (varargin) && ischar (arg)
-        && length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
-      arg = tolower (arg);
-      val = varargin{++i};
-      if (ischar (val))
-        set (h, arg, val);
-      else
-        error ("%s: expecting data source to be a string", fcn);
-      endif
-    else
-      newargs{end + 1} = arg;
-    endif
-  endwhile
-endfunction
--- a/scripts/plot/private/__add_default_menu__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __add_default_menu__ (@var{fig})
-## Add default menu to figure.  All uimenu handles have
-## set their property "handlevisibility" to "off".
-## @end deftypefn
-
-## Author: Kai Habel
-
-function __add_default_menu__ (fig)
-
-  if (isfigure (fig))
-    obj = findall (fig, "label", "&File", "tag", "__default_menu__");
-    if (length (obj) == 0)
-      __f = uimenu (fig, "label", "&File", "handlevisibility", "off", "tag", "__default_menu__");
-        sa = uimenu (__f, "label", "Save &As", "handlevisibility", "off",
-                          "callback", @save_cb);
-        sv = uimenu (__f, "label", "&Save", "handlevisibility", "off",
-                          "callback", @save_cb);
-        cl = uimenu (__f, "label", "&Close", "handlevisibility", "off",
-                          "callback", "close(gcf)");
-
-      __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off");
-        gr = uimenu (__e, "label", "&Grid", "handlevisibility", "off",
-                          "callback", @grid_cb);
-        as = uimenu (__e, "label", "Auto&scale", "handlevisibility", "off",
-                          "callback", @autoscale_cb);
-        gm = uimenu (__e, "label", "GUI &Mode", "handlevisibility", "off");
-          gm2 = uimenu (gm, "label", "Pan+Zoom", "handlevisibility", "off",
-                            "callback", @guimode_cb);
-          gm3 = uimenu (gm, "label", "Rotate+Zoom", "handlevisibility", "off",
-                            "callback", @guimode_cb);
-          gmn = uimenu (gm, "label", "None", "handlevisibility", "off",
-                            "callback", @guimode_cb);
-      __h = uimenu (fig, "label", "&Help", "handlevisibility", "off");
-        ab = uimenu (__h, "label", "A&bout", "handlevisibility", "off", "enable", "off");
-    endif
-  else
-    error ("expecting figure handle", "handlevisibility", "off");
-  endif
-
-endfunction
-
-function grid_cb (h, e)
-  grid;
-  drawnow; # should not be required
-endfunction
-
-function save_cb (h, e)
-  lbl = get (gcbo, "label");
-  if (strcmp (lbl, "&Save"))
-    fname = get (gcbo, "userdata");
-    if (isempty (fname))
-      __save_as__ (gcbo);
-    else
-      saveas (gcbo, fname);
-    endif
-  elseif (strcmp (lbl, "Save &As"))
-    __save_as__ (gcbo);
-  endif
-endfunction
-
-function __save_as__ (caller)
-
-  [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg","Supported Graphic Formats"},
-                                  "Save Figure",
-                                  pwd);
-  if (filename != 0)
-    fname = strcat (filedir, filesep, filename);
-    obj = findall ("label", "&Save");
-    if (length (obj) > 0)
-      set (obj(1), "userdata", fname);
-    endif
-    saveas (caller, fname);
-  endif
-endfunction
-
-function autoscale_cb (h, e)
-  axis ("auto");
-  drawnow; #should not be required
-endfunction
-
-function guimode_cb (h, e)
-  lbl = get (h, "label");
-  if (strncmp (lbl, "Pan+Zoom", 8))
-    gui_mode ("2D");
-  elseif (strncmp (lbl, "Rotate+Zoom", 11))
-    gui_mode ("3D");
-  elseif (strncmp (lbl, "None", 4))
-    gui_mode ("None");
-  endif
-endfunction
--- a/scripts/plot/private/__axes_limits__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __axes_limits__ (@var{fcn}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function retval = __axes_limits__ (fcn, varargin)
-
-  retval = [];
-
-  fcnmode = sprintf ("%smode", fcn);
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ (fcn, varargin{:});
-
-  if (nargin == 0)
-    retval = get (h, fcn);
-  else
-    arg = varargin{1};
-
-    if (ischar (arg))
-      if (strcmpi (arg, "mode"))
-        retval = get (h, fcnmode);
-      elseif (strcmpi (arg, "auto") ||  strcmpi (arg, "manual"))
-        set (h, fcnmode, arg);
-      endif
-    else
-      if (!isnumeric (arg) && any (size (arg(:)) != [2, 1]))
-        error ("%s: argument must be a 2 element vector", fcn);
-      else
-        if (arg(1) >= arg(2))
-          error ("%s: axis limits must be increasing", fcn);
-        else
-          set (h, fcn, arg(:));
-        endif
-      endif
-    endif
-  endif
-
-endfunction
--- a/scripts/plot/private/__axis_label__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __axis_label__ (@var{caller}, @var{h}, @var{txt}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = __axis_label__ (ah, caller, txt, varargin)
-
-  h = get (ah, caller);
-
-  set (h, "fontangle", get (ah, "fontangle"),
-       "fontname", get (ah, "fontname"),
-       "fontsize", get (ah, "fontsize"),
-       "fontunits", get (ah, "fontunits"),
-       "fontweight", get (ah, "fontweight"),
-       "string", txt,
-       varargin{:});
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-endfunction
--- a/scripts/plot/private/__bar__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,438 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __bar__ (@var{vertical}, @var{func}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function varargout = __bar__ (vertical, func, varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ((nargout > 1), func, varargin{:});
-
-  ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0
-  width = 0.8 - 10 * eps;
-  group = true;
-  bv = 0;
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  if (nargin > 3 && isnumeric (varargin{2}))
-    x = varargin{1};
-    if (isvector (x))
-      x = x(:);
-    endif
-    y = varargin{2};
-    if (isvector (y))
-      y = y(:);
-    endif
-    if (rows (x) != rows (y))
-      y = varargin{1};
-      if (isvector (y))
-        y = y(:);
-      endif
-      x = [1:rows(y)]';
-      idx = 2;
-    else
-      if (! isvector (x))
-        error ("%s: x must be a vector", func);
-      endif
-      idx = 3;
-    endif
-  else
-    y = varargin{1};
-    if (isvector (y))
-      y = y(:);
-    endif
-    x = [1:rows(y)]';
-    idx = 2;
-  endif
-
-  newargs = {};
-  have_line_spec = false;
-  while (idx <= nargin - 2)
-    if (ischar (varargin{idx}) && strcmpi (varargin{idx}, "grouped"))
-      group = true;
-      idx++;
-    elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "stacked"))
-      group = false;
-      idx++;
-    else
-      if ((ischar (varargin{idx}) || iscell (varargin{idx}))
-          && ! have_line_spec)
-        [linespec, valid] = __pltopt__ (func, varargin{idx}, false);
-        if (valid)
-          have_line_spec = true;
-          ## FIXME: strange parse error requires semicolon to be spaced
-          ##        away from closing ']' on next line.
-          newargs = [{"facecolor", linespec.color}, newargs] ;
-          idx++;
-          continue;
-        endif
-      endif
-      if (isscalar (varargin{idx}))
-        width = varargin{idx++};
-      elseif (idx == nargin - 2)
-        newargs = [newargs,varargin(idx++)];
-      elseif (ischar (varargin{idx})
-              && strcmpi (varargin{idx}, "basevalue")
-              && isscalar (varargin{idx+1}))
-        bv = varargin{idx+1};
-        idx += 2;
-      else
-        newargs = [newargs,varargin(idx:idx+1)];
-        idx += 2;
-      endif
-    endif
-  endwhile
-
-  xlen = rows (x);
-  ylen = rows (y);
-
-  if (xlen != ylen)
-    error ("%s: length of x and y must be equal", func);
-  endif
-  if (any (x(2:end) < x(1:end-1)))
-    error ("%s: x vector values must be in ascending order", func);
-  endif
-
-  ycols = columns (y);
-  if (numel (x) > 1)
-    cutoff = min (diff (double (x))) / 2;
-  else
-    cutoff = 1;
-  endif
-  if (group)
-    delta_p = delta_m = repmat (cutoff * width / ycols, size (x));
-  else
-    delta_p = delta_m = repmat (cutoff * width, size (x));
-  endif
-  x1 = (x - delta_m)(:)';
-  x2 = (x + delta_p)(:)';
-  xb = repmat ([x1; x1; x2; x2](:), 1, ycols);
-
-  if (group)
-    offset = ((delta_p + delta_m) * [-(ycols - 1) / 2 : (ycols - 1) / 2]);
-    xb(1:4:4*ylen,:) += offset;
-    xb(2:4:4*ylen,:) += offset;
-    xb(3:4:4*ylen,:) += offset;
-    xb(4:4:4*ylen,:) += offset;
-    y0 = zeros (size (y)) + bv;
-    y1 = y;
-  else
-    y1 = cumsum (y,2);
-    y0 = [zeros(ylen,1)+bv, y1(:,1:end-1)];
-  endif
-
-  yb = zeros (4*ylen, ycols);
-  yb(1:4:4*ylen,:) = y0;
-  yb(2:4:4*ylen,:) = y1;
-  yb(3:4:4*ylen,:) = y1;
-  yb(4:4:4*ylen,:) = y0;
-
-  xb = reshape (xb, [4, numel(xb) / 4 / ycols, ycols]);
-  yb = reshape (yb, [4, numel(yb) / 4 / ycols, ycols]);
-
-  if (nargout < 2)
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-
-      tmp = bars (h, vertical, x, y, xb, yb, width, group,
-                  have_line_spec, bv, newargs{:});
-      if (nargout == 1)
-        varargout{1} = tmp;
-      endif
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  else
-    if (vertical)
-      varargout{1} = xb;
-      varargout{2} = yb;
-    else
-      varargout{1} = yb;
-      varargout{2} = xb;
-    endif
-  endif
-
-endfunction
-
-function tmp = bars (ax, vertical, x, y, xb, yb, width, group, have_color_spec, base_value, varargin)
-
-  ycols = columns (y);
-  clim = get (ax, "clim");
-  tmp = [];
-
-  for i = 1:ycols
-    hg = hggroup ();
-    tmp = [tmp; hg];
-    args = __add_datasource__ ("bar", hg, {"x", "y"}, varargin{:});
-
-    if (vertical)
-      if (! have_color_spec)
-        if (ycols == 1)
-          lev = clim(1);
-        else
-          lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1);
-        endif
-        h = patch (xb(:,:,i), yb(:,:,i), "FaceColor", "flat",
-                   "cdata", lev, "parent", hg);
-      else
-        h = patch (xb(:,:,i), yb(:,:,i), "parent", hg);
-      endif
-    else
-      if (! have_color_spec)
-        if (ycols == 1)
-          lev = clim(1);
-        else
-          lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1);
-        endif
-        h = patch (yb(:,:,i), xb(:,:,i), "FaceColor", "flat",
-                   "cdata", lev, "parent", hg);
-      else
-        h = patch (yb(:,:,i), xb(:,:,i), "parent", hg);
-      endif
-    endif
-
-    if (i == 1)
-      x_axis_range = get (ax, "xlim");
-      h_baseline = line (x_axis_range, [base_value, base_value],
-                         "color", [0, 0, 0]);
-      set (h_baseline, "handlevisibility", "off");
-      set (h_baseline, "xliminclude", "off");
-      addlistener (ax, "xlim", @update_xlim);
-      addlistener (h_baseline, "ydata", @update_baseline);
-      addlistener (h_baseline, "visible", @update_baseline);
-    endif
-
-    ## Setup the hggroup and listeners
-    addproperty ("showbaseline", hg, "radio", "{on}|off");
-    addproperty ("basevalue", hg, "data", base_value);
-    addproperty ("baseline", hg, "data", h_baseline);
-
-    addlistener (hg, "showbaseline", {@show_baseline, "showbl"});
-    addlistener (hg, "visible", {@show_baseline, "visib"});
-    addlistener (hg, "basevalue", @move_baseline);
-
-    addproperty ("barwidth", hg, "data", width);
-    if (group)
-      addproperty ("barlayout", hg, "radio", "stacked|{grouped}", "grouped");
-    else
-      addproperty ("barlayout", hg, "radio", "{stacked}|grouped", "stacked");
-    endif
-    if (vertical)
-      addproperty ("horizontal", hg, "radio", "on|{off}", "off");
-    else
-      addproperty ("horizontal", hg, "radio", "{on}|off", "on");
-    endif
-
-    addlistener (hg, "barwidth", @update_group);
-    addlistener (hg, "barlayout", @update_group);
-    addlistener (hg, "horizontal", @update_group);
-
-    addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-    addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-    addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-    addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-
-    addlistener (hg, "edgecolor", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "facecolor", @update_props);
-
-    if (isvector (x))
-      addproperty ("xdata", hg, "data", x);
-    else
-      addproperty ("xdata", hg, "data", x(:, i));
-    endif
-    addproperty ("ydata", hg, "data", y(:, i));
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-
-    addproperty ("bargroup", hg, "data");
-    set (tmp, "bargroup", tmp);
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-    if (i == 1)
-      set (h_baseline, "parent", get (hg, "parent"));
-    endif
-  endfor
-
-  update_xlim (ax, []);
-endfunction
-
-function update_xlim (h, d)
-  kids = get (h, "children");
-  xlim = get (h, "xlim");
-
-  for i = 1 : length (kids)
-    obj = get (kids (i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
-      if (any (get (obj.baseline, "xdata") != xlim))
-        set (obj.baseline, "xdata", xlim);
-      endif
-    endif
-  endfor
-endfunction
-
-function update_baseline (h, d)
-  visible = get (h, "visible");
-  ydata = get (h, "ydata")(1);
-
-  kids = get (get (h, "parent"), "children");
-  for i = 1 : length (kids)
-    obj = get (kids (i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
-        && obj.baseline == h)
-      ## Only alter if changed to avoid recursion of the listener functions
-      if (! strcmpi (get (kids(i), "showbaseline"), visible))
-        set (kids (i), "showbaseline", visible);
-      endif
-      if (! strcmpi (get (kids(i), "basevalue"), visible))
-        set (kids (i), "basevalue", ydata);
-      endif
-    endif
-  endfor
-endfunction
-
-function show_baseline (h, d, prop = "")
-  persistent recursion = false;
-  
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      if (strcmp (prop, "showbl"))
-        showbaseline = get (h, "showbaseline");
-        for hh = hlist(:)'
-          if (hh != h)
-            set (hh, "showbaseline", showbaseline);
-          endif
-        endfor
-      elseif (strcmp (prop, "visib"))
-        showbaseline = "on";
-        if (all (strcmp (get (hlist, "visible"), "off")))
-          showbaseline = "off";
-        endif
-      endif
-      set (get (h, "baseline"), "visible", showbaseline);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function move_baseline (h, d)
-  b0 = get (h, "basevalue");
-  bl = get (h, "baseline");
-
-  if (get (bl, "ydata") != [b0, b0])
-    set (bl, "ydata", [b0, b0]);
-  endif
-
-  if (strcmpi (get (h, "barlayout"), "grouped"))
-    update_data (h, d);
-  endif
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids, "edgecolor", get (h, "edgecolor"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"),
-       "facecolor", get (h, "facecolor"));
-endfunction
-
-function update_data (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      x = get (h, "xdata");
-      if (!isvector (x))
-        x = x(:);
-      endif
-      y = [];
-      for hh = hlist(:)'
-        ytmp = get (hh, "ydata");
-        y = [y ytmp(:)];
-      endfor
-
-      [xb, yb] = bar (x, y, get (h, "barwidth"), get (h, "barlayout"),
-                      "basevalue", get (h, "basevalue"));
-      ny = columns (y);
-      vert = strcmpi (get (h, "horizontal"), "off");
-
-      for i = 1:ny
-        hp = get (hlist(i), "children");
-        if (vert)
-          set (hp, "xdata", xb(:,:,i), "ydata", yb(:,:,i));
-        else
-          set (hp, "xdata", yb(:,:,i), "ydata", xb(:,:,i));
-        endif
-      endfor
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_group (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (! recursion)
-    unwind_protect
-      recursion = true;
-      hlist = get (h, "bargroup");
-      barwidth = get (h, "barwidth");
-      barlayout = get (h, "barlayout");
-      horizontal = get (h, "horizontal");
-
-      ## To prevent recursion, only change if modified
-      for hh = hlist(:)'
-        if (hh != h)
-          if (get (hh, "barwidth") != barwidth)
-            set (hh, "barwidth", barwidth);
-          endif
-          if (! strcmpi (get (hh, "barlayout"), barlayout))
-            set (hh, "barlayout", barlayout);
-          endif
-          if (! strcmpi (get (hh, "horizontal"), horizontal))
-            set (hh, "horizontal", horizontal);
-          endif
-        endif
-      endfor
-      update_data (h, d);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
--- a/scripts/plot/private/__clabel__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __clabel__ (@var{c}, @var{v}, @var{hparent}, @var{label_spacing}, @var{z}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-function h = __clabel__ (c, v, hparent, label_spacing, z, varargin)
-  ## FIXME
-  ## Assume that the plot size is 4 by 3 inches.
-  lims = axis ();
-  xspacing = 72 * 4 / abs (lims(1) - lims(2));
-  yspacing = 72 * 3 / abs (lims(3) - lims(4));
-
-  if (isscalar (hparent) && ishandle (hparent)
-      && strcmp (get (hparent, "type"), "hggroup"))
-    x = get (hparent, "xdata");
-    xmin = min (x(:));
-    xmax = max (x(:));
-    y = get (hparent, "ydata");
-    ymin = min (y(:));
-    ymax = max (y(:));
-  else
-    i1 = 1;
-    while (i1 < length (c))
-      clev = c(1,i1);
-      clen = c(2,i1);
-      p = c(:, i1+1:i1+clen);
-
-      xmin = min (c(1,:));
-      xmax = max (c(1,:));
-      ymin = min (c(2,:));
-      ymax = max (c(2,:));
-
-      i1 += clen+1;
-    endwhile
-  endif
-
-  ## Decode contourc output format and place labels.
-  i1 = 1;
-  h = [];
-  while (i1 < length (c))
-    clev = c(1,i1);
-    clen = c(2,i1);
-
-    if (!isempty (v) && ! any (find (clev == v)))
-      i1 += clen+1;
-      continue;
-    endif
-
-    p = c(:, i1+1:i1+clen) .* repmat ([xspacing; yspacing], 1, clen);
-    d = sqrt (sumsq (diff (p, 1, 2)));
-    cumd = cumsum (d);
-    td = sum (d);
-    ntag = ceil (td / label_spacing);
-
-    if (all (c(:,i1+1) == c(:,i1+clen)))
-      Spacing = td / ntag;
-      pos = Spacing / 2 + [0:ntag-1] * Spacing;
-    else
-      pos = zeros (1, ntag);
-      pos(1) = (td - label_spacing * (ntag - 1)) ./ 2;
-      pos(2:ntag) = pos(1) + [1:ntag-1] * label_spacing;
-    endif
-
-    j1 = 2;
-    tlabel = sprintf ("%g", clev);
-    for i = 1 : ntag
-      tagpos = pos(i);
-
-      while (j1 < clen && cumd(j1) < tagpos)
-        j1++;
-      endwhile
-      tpos = sum (c(:,i1+j1-1:i1+j1), 2) ./ 2;
-
-      if (tpos(1) != xmin &&  tpos(1) != xmax
-          && tpos(2) != ymin &&  tpos(2) != ymax)
-        trot = 180 / pi * atan2 (diff (c(2,i1+j1-1:i1+j1)),
-                                 diff (c(1,i1+j1-1:i1+j1)));
-
-        if (ischar (z))
-          ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot,
-                     "parent", hparent, "horizontalalignment", "center",
-                     "userdata", clev, varargin{:});
-        elseif (!isempty (z))
-          ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot,
-                     "parent", hparent, "horizontalalignment", "center",
-                     "userdata", clev, varargin{:});
-        else
-          ht = text (tpos(1), tpos(2), tlabel, "rotation", trot,
-                     "parent", hparent, "horizontalalignment", "center",
-                     "userdata", clev, varargin{:});
-        endif
-        h = [h; ht];
-      endif
-    endfor
-    i1 += clen+1;
-  endwhile
-endfunction
--- a/scripts/plot/private/__color_str_rgb__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{rgb} =} __color_str_rgb__ (@var{str})
-## Undocumented internal function.
-## @end deftypefn
-
-function rgb = __color_str_rgb__ (str)
-
-  if (ischar (str))
-    if (strncmpi (str, "black", 5))
-      rgb = [0, 0, 0];
-    elseif (strncmpi (str, "red", 3))
-      rgb = [1, 0, 0];
-    elseif (strncmpi (str, "green", 5))
-      rgb = [0, 1, 0];
-    elseif (strncmpi (str, "blue", 4))
-      rgb = [0, 0, 1];
-
-    elseif (strncmpi (str, "yellow", 6))
-      rgb = [1, 1, 0];
-    elseif (strncmpi (str, "magenta", 7))
-      rgb = [1, 0, 1];
-    elseif (strncmpi (str, "cyan", 4))
-      rgb = [0, 1, 1];
-    elseif (strncmpi (str, "white", 5))
-      rgb = [1, 1, 1];
-    else
-      rgb = [0, 0, 0];
-    endif
-  else
-    error ("__color_str_rgb__: expecting a string argument");
-  endif
-endfunction
--- a/scripts/plot/private/__contour__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,552 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{c}, @var{hg}] =} __contour__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function [c, hg] = __contour__ (varargin)
-  ax = varargin{1};
-  zlevel = varargin{2};
-  filled = "off";
-
-  linespec.linestyle = "-";
-  linespec.color = "auto";
-  edgecolor = "flat";
-  for i = 3 : nargin
-    arg = varargin {i};
-    if ((ischar (arg) || iscell (arg)))
-      [linespec, valid] = __pltopt__ ("__contour__", arg, false);
-      if (isempty (linespec.color))
-        linespec.color = "auto";
-      endif
-      if (isempty (linespec.linestyle))
-        linespec.linestyle = "-";
-      endif
-      if (valid)
-        have_line_spec = true;
-        varargin(i) = [];
-        break;
-      endif
-    endif
-  endfor
-
-  opts = {};
-  i = 3;
-  while (i < length (varargin))
-    if (ischar (varargin {i}))
-      if (strcmpi (varargin{i}, "fill"))
-        filled = varargin {i + 1};
-        varargin(i:i+1) = [];
-      elseif (strcmpi (varargin{i}, "linecolor"))
-        linespec.color = varargin {i + 1};
-        edgecolor = linespec.color;
-        if (ischar (edgecolor) && strcmpi (edgecolor, "auto"))
-          edgecolor = "flat";
-        endif
-        varargin(i:i+1) = [];
-      elseif (strcmpi (varargin{i}, "edgecolor"))
-        linespec.color = varargin {i + 1};
-        edgecolor = linespec.color;
-        if (ischar (edgecolor) && strcmpi (edgecolor, "flat"))
-          linespec.color = "auto";
-        endif
-        varargin(i:i+1) = [];
-      else
-        opts{end+1} = varargin{i};
-        varargin(i) = [];
-        opts{end+1} = varargin{i};
-        varargin(i) = [];
-      endif
-    else
-      i++;
-    endif
-  endwhile
-
-  if (length (varargin) < 5)
-    z1 = varargin{3};
-    x1 = 1 : columns (z1);
-    y1 = 1 : rows (z1);
-  else
-    x1 = varargin{3};
-    y1 = varargin{4};
-    z1 = varargin{5};
-  endif
-  if (!ismatrix (z1) || isvector (z1) || isscalar (z1))
-    error ("__contour__: z argument must be a matrix");
-  endif
-  if (length (varargin) == 4 || length (varargin) == 6)
-    vn = varargin {end};
-    vnauto = false;
-  else
-    vnauto = true;
-    vn = 10;
-  endif
-
-  if (isscalar (vn))
-    lvl = linspace (min (z1(!isinf (z1))), max (z1(!isinf (z1))),
-                    vn + 2)(1:end-1);
-  else
-    lvl = vn;
-  endif
-
-  if (strcmpi (filled, "on"))
-    if (isvector (x1) || isvector (y1))
-      [x1, y1] = meshgrid (x1, y1);
-    endif
-    [nr, nc] = size (z1);
-    x0 = prepad (x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2);
-    x0 = postpad (x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2);
-    x0 = [x0(1, :); x0; x0(1, :)];
-    y0 = prepad (y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1);
-    y0 = postpad (y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1));
-    y0 = [y0(:, 1), y0, y0(:, 1)];
-    z0 = -Inf (nr+2, nc+2);
-    z0(2:nr+1, 2:nc+1) = z1;
-    [c, lev] = contourc (x0, y0, z0, lvl);
-  else
-    [c, lev] = contourc (x1, y1, z1, lvl);
-  endif
-
-  hg = hggroup ();
-  opts = __add_datasource__ ("__countour__", hg, {"x", "y", "z"}, opts{:});
-
-  addproperty ("xdata", hg, "data", x1);
-  addproperty ("ydata", hg, "data", y1);
-  addproperty ("zdata", hg, "data", z1);
-  addproperty ("contourmatrix", hg, "data", c);
-
-  addlistener (hg, "xdata", @update_data);
-  addlistener (hg, "ydata", @update_data);
-  addlistener (hg, "zdata", @update_data);
-  addlistener (hg, "contourmatrix", @update_data);
-
-  addproperty ("fill", hg, "radio", "on|{off}", filled);
-
-  ## The properties zlevel and zlevelmode don't exist in matlab, but
-  ## allow the use of contourgroups with the contour3, meshc and surfc
-  ## functions.
-  if (isnumeric (zlevel))
-    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual");
-    addproperty ("zlevel", hg, "data", zlevel);
-  else
-    addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", zlevel);
-    if (ischar (zlevel) && strcmpi (zlevel, "manual"))
-      z = varargin{3};
-      z = 2 * (min (z(:)) - max (z(:)));
-      addproperty ("zlevel", hg, "data", z);
-    else
-      addproperty ("zlevel", hg, "data", 0.);
-    endif
-  endif
-
-  lvlstep = sum (abs (diff (lvl))) / (length (lvl) - 1);
-
-  addproperty ("levellist", hg, "data", lev);
-  addproperty ("levelstep", hg, "double", lvlstep);
-  if (vnauto)
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
-  elseif (isscalar (vn))
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "manual");
-  else
-    addproperty ("levellistmode", hg, "radio", "{auto}|manual", "manual");
-    addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto");
-  endif
-
-  addproperty ("labelspacing", hg, "double", 144);
-  addproperty ("textlist", hg, "data", lev);
-  addproperty ("textlistmode", hg, "radio", "{auto}|manual", "auto");
-  addproperty ("textstep", hg, "double", lvlstep);
-  addproperty ("textstepmode", hg, "radio", "{auto}|manual", "auto");
-  addproperty ("showtext", hg, "radio", "on|{off}", "off");
-
-  addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none");
-  addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
-  addproperty ("linewidth", hg, "linelinewidth", 0.5);
-
-  ## FIXME It would be good to hide this property which is just an undocumented
-  ## alias for linecolor
-  addproperty ("edgecolor", hg, "color", edgecolor, "{flat}|none");
-
-  addlistener (hg, "fill", @update_data);
-
-  addlistener (hg, "zlevelmode", @update_zlevel);
-  addlistener (hg, "zlevel", @update_zlevel);
-
-  addlistener (hg, "levellist", @update_data);
-  addlistener (hg, "levelstep", @update_data);
-  addlistener (hg, "levellistmode", @update_data);
-  addlistener (hg, "levelstepmode", @update_data);
-
-  addlistener (hg, "labelspacing", @update_text);
-  addlistener (hg, "textlist", @update_text);
-  addlistener (hg, "textlistmode", @update_text);
-  addlistener (hg, "textstep", @update_text);
-  addlistener (hg, "textstepmode", @update_text);
-  addlistener (hg, "showtext", @update_text);
-
-  addlistener (hg, "linecolor", @update_line);
-  addlistener (hg, "linestyle", @update_line);
-  addlistener (hg, "linewidth", @update_line);
-
-  addlistener (hg, "edgecolor", @update_edgecolor);
-
-  add_patch_children (hg);
-
-  axis ("tight");
-
-  if (!isempty (opts))
-    set (hg, opts{:});
-  endif
-endfunction
-
-function add_patch_children (hg)
-  c = get (hg, "contourmatrix");
-  lev = get (hg, "levellist");
-  fill = get (hg, "fill");
-  zlev = get (hg, "zlevel");
-  zmode = get (hg, "zlevelmode");
-  lc = get (hg, "linecolor");
-  lw = get (hg, "linewidth");
-  ls = get (hg, "linestyle");
-  filled = get (hg, "fill");
-  ca = gca ();
-
-  if (strcmpi (lc, "auto"))
-    lc = "flat";
-  endif
-
-  if (strcmpi (filled, "on"))
-
-    lvl_eps = get_lvl_eps (lev);
-
-    ## Decode contourc output format.
-    i1 = 1;
-    ncont = 0;
-    cont_lev = [];
-    cont_area = [];
-    while (i1 < columns (c))
-      ncont++;
-      cont_lev(ncont) = c(1, i1);
-      cont_len(ncont) = c(2, i1);
-      cont_idx(ncont) = i1+1;
-      ii = i1+1:i1+cont_len(ncont);
-      cont_area(ncont) = polyarea (c(1, ii), c(2, ii));
-      i1 += c(2, i1) + 1;
-    endwhile
-
-    ## Handle for each level the case where we have (a) hole(s) in a patch.
-    ## Those are to be filled with the color of level below or with the
-    ## background colour.
-    for k = 1:numel (lev)
-      lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps);
-      len = numel (lvl_idx);
-      if (len > 1)
-        ## mark = logical (zeros (size (lvl_idx)));
-        mark = false (size (lvl_idx));
-        a = 1;
-        while (a < len)
-          ## take 1st patch
-          b = a + 1;
-          pa_idx = lvl_idx(a);
-          ## get pointer to contour start, and contour length
-          curr_ct_idx = cont_idx(pa_idx);
-          curr_ct_len = cont_len(pa_idx);
-          ## get contour
-          curr_ct = c(:, curr_ct_idx:curr_ct_idx+curr_ct_len-1);
-          b_vec = (a+1):len;
-          next_ct_pt_vec = c(:, cont_idx(lvl_idx(b_vec)));
-          in = inpolygon (next_ct_pt_vec(1,:), next_ct_pt_vec(2,:),
-                          curr_ct(1, :), curr_ct(2, :));
-          mark(b_vec(in)) = !mark(b_vec(in));
-          a++;
-        endwhile
-        if (numel (mark) > 0)
-          ## All marked contours describe a hole in a larger contour of
-          ## the same level and must be filled with colour of level below.
-          ma_idx = lvl_idx(mark);
-          if (k > 1)
-            ## Find color of level below.
-            tmp = find (abs (cont_lev - lev(k - 1)) < lvl_eps);
-            lvl_bel_idx = tmp(1);
-            ## Set color of patches found.
-            cont_lev(ma_idx) = cont_lev(lvl_bel_idx);
-          else
-            ## Set lowest level contour to NaN.
-            cont_lev(ma_idx) = NaN;
-          endif
-        endif
-      endif
-    endfor
-
-    ## The algorithm can create patches with the size of the plotting
-    ## area, we would like to draw only the patch with the highest level.
-    del_idx = [];
-    max_idx = find (cont_area == max (cont_area));
-    if (numel (max_idx) > 1)
-      ## delete double entries
-      del_idx = max_idx(1:end-1);
-      cont_area(del_idx) = cont_lev(del_idx) = [];
-      cont_len(del_idx) = cont_idx(del_idx) = [];
-    endif
-
-    ## Now we have everything together and can start plotting the patches
-    ## beginning with largest area.
-    [tmp, svec] = sort (cont_area);
-    len = ncont - numel (del_idx);
-    h = [];
-    for n = len:(-1):1
-      idx = svec(n);
-      ctmp = c(:, cont_idx(idx):cont_idx(idx) + cont_len(idx) - 1);
-      if (all (ctmp(:,1) == ctmp(:,end)))
-        ctmp(:, end) = [];
-      else
-        ## Special case unclosed contours
-      endif
-      if (isnan (cont_lev (idx)))
-        fc = get (ca, "color");
-        if (strcmp (fc, "none"))
-          fc = get (ancestor (ca, "figure"), "color");
-        endif
-      else
-        fc = "flat";
-      endif
-      h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:),
-                           "vertices", ctmp.', "faces", 1:(cont_len(idx)-1),
-                           "facevertexcdata", cont_lev(idx),
-                           "facecolor", fc, "cdata", cont_lev(idx),
-                           "edgecolor", lc, "linestyle", ls,
-                           "linewidth", lw, "parent", hg)];
-    endfor
-
-    if (min (lev) == max (lev))
-      set (ca, "clim", [min(lev)-1, max(lev)+1], "layer", "top");
-    else
-      set (ca, "clim", [min(lev), max(lev)], "layer", "top");
-    endif
-  else
-    ## Decode contourc output format.
-    i1 = 1;
-    h = [];
-    while (i1 < length (c))
-      clev = c(1,i1);
-      clen = c(2,i1);
-
-      if (all (c(:,i1+1) == c(:,i1+clen)))
-        p = c(:, i1+1:i1+clen-1).';
-      else
-        p = [c(:, i1+1:i1+clen), NaN(2, 1)].';
-      endif
-
-      switch (zmode)
-        case "none"
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", [], "facecolor", "none",
-                               "vertices", p, "faces", 1:rows(p),
-                               "facevertexcdata", clev,
-                               "edgecolor", lc, "linestyle", ls,
-                               "linewidth", lw,
-                               "cdata", clev, "parent", hg)];
-        case "auto"
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", clev * ones(rows(p),1),
-                               "vertices", [p, clev * ones(rows(p),1)],
-                               "faces", 1:rows(p),
-                               "facevertexcdata", clev,
-                               "facecolor", "none", "edgecolor", lc,
-                               "linestyle", ls, "linewidth", lw,
-                               "cdata", clev, "parent", hg)];
-        otherwise
-          h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2),
-                               "zdata", zlev * ones (rows(p), 1),
-                               "vertices", [p, zlev * ones(rows(p),1)],
-                               "faces", 1:rows(p),
-                               "facevertexcdata", clev,
-                               "facecolor", "none", "edgecolor", lc,
-                               "linestyle", ls, "linewidth", lw,
-                               "cdata", clev, "parent", hg)];
-      endswitch
-      i1 += clen + 1;
-    endwhile
-  endif
-
-endfunction
-
-function update_zlevel (h, d)
-  z = get (h, "zlevel");
-  zmode = get (h, "zlevelmode");
-  kids = get (h, "children");
-
-  switch (zmode)
-    case "none"
-      set (kids, "zdata", []);
-    case "auto"
-      for i = 1 : length (kids)
-        set (kids(i), "zdata", get (kids (i), "cdata") .*
-             ones (size (get (kids (i), "xdata"))));
-      endfor
-    otherwise
-      for i = 1 : length (kids)
-        set (kids(i), "zdata", z .* ones (size (get (kids (i), "xdata"))));
-      endfor
-  endswitch
-endfunction
-
-function update_edgecolor (h, d)
-  ec = get (h, "edgecolor");
-  lc = get (h, "linecolor");
-  if (ischar (ec) && strcmpi (ec, "flat"))
-    if (! strcmpi (lc, "auto"))
-      set (h, "linecolor", "auto");
-    endif
-  elseif (! isequal (ec, lc))
-    set (h, "linecolor", ec);
-  endif
-endfunction
-
-function update_line (h, d)
-  lc = get (h, "linecolor");
-  ec = get (h, "edgecolor");
-  if (strcmpi (lc, "auto"))
-    lc = "flat";
-  endif
-  if (! isequal (ec, lc))
-    set (h, "edgecolor", lc);
-  endif
-  set (findobj (h, "type", "patch"), "edgecolor", lc,
-       "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"));
-endfunction
-
-function update_data (h, d)
-  persistent recursive = false;
-
-  if (!recursive)
-    recursive = true;
-
-    delete (get (h, "children"));
-
-    if (strcmpi (get (h, "levellistmode"), "manual"))
-      lvl = get (h, "levellist");
-    elseif (strcmpi (get (h, "levelstepmode"), "manual"))
-      z = get (h, "zdata");
-      lvl = ceil ((max(z(:)) - min (z(:)) ./ get (h, "levelstep")));
-    else
-      lvl = 10;
-    endif
-
-    if (strcmpi (get (h, "fill"), "on"))
-      X = get (h, "xdata");
-      Y = get (h, "ydata");
-      Z = get (h, "zdata");
-      if (isvector (X) || isvector (Y))
-        [X, Y] = meshgrid (X, Y);
-      endif
-      [nr, nc] = size (Z);
-      X0 = prepad (X, nc+1, 2 * X(1, 1) - X(1, 2), 2);
-      X0 = postpad (X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2);
-      X0 = [X0(1, :); X0; X0(1, :)];
-      Y0 = prepad (Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1);
-      Y0 = postpad (Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1));
-      Y0 = [Y0(:, 1), Y0, Y0(:, 1)];
-      Z0 = -Inf (nr+2, nc+2);
-      Z0(2:nr+1, 2:nc+1) = Z;
-      [c, lev] = contourc (X0, Y0, Z0, lvl);
-    else
-      [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"),
-                           get (h, "zdata"), lvl);
-    endif
-    set (h, "contourmatrix", c);
-
-    if (strcmpi (get (h, "levellistmode"), "manual"))
-      ## Do nothing
-    elseif (strcmpi (get (h, "levelstepmode"), "manual"))
-      set (h, "levellist", lev);
-    else
-      set (h, "levellist", lev);
-      z = get (h, "zdata");
-      lvlstep = (max (z(:)) - min (z(:))) / 10;
-      set (h, "levelstep", lvlstep);
-    endif
-
-    add_patch_children (h);
-    update_text (h, d);
-  endif
-
-  recursive = false;
-endfunction
-
-function update_text (h, d)
-  persistent recursive = false;
-
-  if (!recursive)
-    recursive = true;
-
-    delete (findobj (h, "type", "text"));
-
-    if (strcmpi (get (h, "textlistmode"), "manual"))
-      lvl = get (h, "textlist");
-    elseif (strcmpi (get (h, "textstepmode"), "manual"))
-      lev = get (h, "levellist");
-
-      lvl_eps = get_lvl_eps (lev);
-
-      stp = get (h, "textstep");
-      t = [0, floor(cumsum(diff (lev)) / (abs(stp) - lvl_eps))];
-      lvl = lev([true, t(1:end-1) != t(2:end)]);
-      set (h, "textlist", lvl);
-    else
-      lvl = get (h, "levellist");
-      set (h, "textlist", lvl, "textstep", get (h, "levelstep"));
-    endif
-
-    if (strcmpi (get (h, "showtext"), "on"))
-      switch (get (h, "zlevelmode"))
-        case "manual"
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), get (h, "zlevel"));
-        case "auto"
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), "auto");
-        otherwise
-          __clabel__ (get (h, "contourmatrix"), lvl, h,
-                      get (h, "labelspacing"), []);
-      endswitch
-    endif
-
-    recursive = false;
-  endif
-endfunction
-
-function lvl_eps = get_lvl_eps (lev)
-  ## FIXME -- is this the right thing to do for this tolerance?  Should
-  ## it be an absolute or relative tolerance, or switch from one to the
-  ## other depending on the value of lev?
-  if (isscalar (lev))
-    lvl_eps = abs (lev) * sqrt (eps) + sqrt (eps);
-  else
-    tmp = min (abs (diff (lev)));
-    if (tmp < 10*eps)
-      lvl_eps = sqrt (eps);
-    else
-      lvl_eps = tmp / 1000.0;
-    endif
-  endif
-endfunction
--- a/scripts/plot/private/__default_plot_options__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{options} =} __default_plot_options__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function options = __default_plot_options__ ()
-
-  options.key = "";
-  options.color = [];
-  options.linestyle = [];
-  options.marker = [];
-  options.errorstyle = [];
-
-endfunction
--- a/scripts/plot/private/__errcomm__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-## Copyright (C) 2001-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Created: 20.02.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = __errcomm__ (caller, p, varargin)
-
-  if (nargin < 4)
-    print_usage ();
-  endif
-
-  nargs = length (varargin);
-  retval = [];
-  k = 1;
-  data = cell (6,1);
-  while (k <= nargs)
-    a = varargin{k++};
-    if (isvector (a))
-      a = a(:);
-    elseif (ismatrix (a))
-      ;
-    else
-      usage ("%s (...)", caller);
-    endif
-    sz = size (a);
-    ndata = 1;
-    data{ndata} = a;
-    while (k <= nargs)
-      a = varargin{k++};
-      if (ischar (a) || iscellstr (a))
-        retval = [retval; __errplot__(a, p, data{1:ndata})];
-        break;
-      elseif (isvector (a))
-        a = a(:);
-      elseif (ismatrix (a))
-        ;
-      else
-        error ("wrong argument types");
-      endif
-      if (size (a) != sz)
-        error ("argument sizes do not match");
-      endif
-      data{++ndata} = a;
-      if (ndata > 6)
-        error ("too many arguments to a plot");
-      endif
-    endwhile
-  endwhile
-
-  if (! (ischar (a) || iscellstr (a)))
-    retval = [retval; __errplot__("~", p, data{1:ndata})];
-  endif
-
-  drawnow ();
-
-endfunction
--- a/scripts/plot/private/__errplot__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## Created: 18.7.2000
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function h = __errplot__ (fstr, p, varargin)
-
-  if (nargin < 4 || nargin > 8) # at least two data arguments needed
-    print_usage ();
-  endif
-
-  [fmt, valid] = __pltopt__ ("__errplot__", fstr);
-
-  [len, nplots] = size (varargin{1});
-  h = [];
-
-  for i = 1:nplots
-    ## Set the plot type based on linestyle.
-
-    if (strcmp (fmt.errorstyle, "~"))
-      ifmt = "yerr";
-    elseif (strcmp (fmt.errorstyle, ">"))
-      ifmt = "xerr";
-    elseif (strcmp (fmt.errorstyle, "~>"))
-      ifmt = "xyerr";
-    elseif (strcmp (fmt.errorstyle, "#"))
-      ifmt = "box";
-    elseif (strcmp (fmt.errorstyle, "#~"))
-      ifmt = "boxy";
-    elseif (strcmp (fmt.errorstyle, "#~>"))
-      ifmt = "boxxy";
-    else
-      ifmt = "yerr";
-    endif
-
-    hg = hggroup ("parent", p);
-    h = [h; hg];
-    args = __add_datasource__ ("__errplot__", hg,
-                               {"x", "y", "l", "u", "xl", "xu"});
-
-    if (isempty (fmt.color))
-      fmt.color = __next_line_color__ ();
-    endif
-    if (isempty (fmt.marker) && isempty (fmt.linestyle))
-      [fmt.linestyle, fmt.marker] = __next_line_style__ ();
-    endif
-    hl = [(__line__ (hg, "linestyle", fmt.linestyle, "marker", fmt.marker,
-                   "color", fmt.color)),
-          (__line__ (hg, "linestyle", "-", "marker", "none",
-                   "color", fmt.color))];
-
-    switch (numel (varargin))
-      case 2
-        ydata = varargin{1}(:,i);
-        xdata = 1:numel (ydata);
-        if (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
-          xldata = varargin{2}(:,i);
-          xudata = ldata;
-          ldata = [];
-          udata = [];
-        elseif (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
-          ldata = varargin{2}(:,i);
-          udata = ldata;
-          xldata = [];
-          xudata = [];
-        else
-          error ("errorbar: 2 column errorplot is only valid for xerr or yerr");
-        endif
-      case 3
-        if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
-          ydata = varargin{1}(:,i);
-          xdata = 1:numel (ydata);
-          xldata = varargin{2}(:,i);
-          xudata = xldata;
-          ldata = varargin{3}(:,i);
-          udata = ldata;
-        elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = xldata;
-          ldata = [];
-          udata = [];
-        else # yerr or boxy
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          ldata = varargin{3}(:,i);
-          udata = ldata;
-          xldata = [];
-          xudata = [];
-        endif
-      case 4
-        if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = xldata;
-          ldata = varargin{4}(:,i);
-          udata = ldata;
-        elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = varargin{4}(:,i);
-          ldata = [];
-          udata = [];
-        else # yerr or boxy
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          ldata = varargin{3}(:,i);
-          udata = varargin{4}(:,i);
-          xldata = [];
-          xudata = [];
-        endif
-      case 6 # boxxy, xyerr
-        if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
-          xdata = varargin{1}(:,i);
-          ydata = varargin{2}(:,i);
-          xldata = varargin{3}(:,i);
-          xudata = varargin{4}(:,i);
-          ldata = varargin{5}(:,i);
-          udata = varargin{6}(:,i);
-        else
-          error ("errorbar: error plot with 6 columns only valid for boxxy and xyerr");
-        endif
-      otherwise
-        error ("errorbar: error plot requires 2, 3, 4, or 6 arguments");
-    endswitch
-
-    addproperty ("xdata", hg, "data", xdata(:));
-    addproperty ("ydata", hg, "data", ydata(:));
-    addproperty ("ldata", hg, "data", ldata(:));
-    addproperty ("udata", hg, "data", udata(:));
-    addproperty ("xldata", hg, "data", xldata(:));
-    addproperty ("xudata", hg, "data", xudata(:));
-    addproperty ("format", hg, "string", ifmt);
-
-    addproperty ("color", hg, "linecolor", get (hl(1), "color"));
-    addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth"));
-    addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle"));
-    addproperty ("marker", hg, "linemarker", get (hl(1), "marker"));
-    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                 get (hl(1), "markerfacecolor"));
-    addproperty ("markeredgecolor", hg, "linemarkerfacecolor",
-                 get (hl(1), "markeredgecolor"));
-    addproperty ("markersize", hg, "linemarkersize",
-                 get (hl(1), "markersize"));
-
-    fcn = {@update_props, hl};
-    addlistener (hg, "color", fcn);
-    addlistener (hg, "linewidth", fcn);
-    addlistener (hg, "linestyle", fcn);
-    addlistener (hg, "marker", fcn);
-    addlistener (hg, "markerfacecolor", fcn);
-    addlistener (hg, "markersize", fcn);
-
-    fcn = {@update_data, hl};
-    addlistener (hg, "xdata", fcn);
-    addlistener (hg, "ydata", fcn);
-    addlistener (hg, "ldata", fcn);
-    addlistener (hg, "udata", fcn);
-    addlistener (hg, "xldata", fcn);
-    addlistener (hg, "xudata", fcn);
-    addlistener (hg, "format", fcn);
-
-    hax = ancestor (hg, "axes");
-    addlistener (hax, "xscale", fcn);
-    addlistener (hax, "yscale", fcn);
-
-    update_data (hg, [], hl);
-
-  endfor
-
-  ## Process legend key
-  if (! isempty (fmt.key))    
-    hlegend = [];
-    fkids = get (gcf (), "children");
-    for i = 1 : numel (fkids)
-      if (ishandle (fkids(i)) && strcmp (get (fkids(i), "type"), "axes")
-          && (strcmp (get (fkids(i), "tag"), "legend")))
-        udata = get (fkids(i), "userdata");
-        if (! isempty (intersect (udata.handle, gca ())))
-          hlegend = fkids (i);
-          break;
-        endif
-      endif
-    endfor
-
-    if (isempty (hlegend))
-      hlgnd = [];
-      tlgnd = {};
-    else
-      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
-    endif
- 
-    hlgnd(end+1) = hg;
-    tlgnd(end+1) = fmt.key;
-
-    legend (gca (), hlgnd, tlgnd);
-  endif
-
-endfunction
-
-function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata,
-                                         xldata, xudata, ifmt,
-                                         xscale, yscale)
-  if (strcmp (xscale, "linear"))
-    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
-    xlo = xdata - dx;
-    xhi = xdata + dx;
-  else
-    n = xdata > 0;
-    rx = exp (0.01 * (max (log (xdata(n))) - min (log (xdata(n)))));
-    xlo = xdata/rx;
-    xhi = xdata*rx;
-  endif
-  if (strcmp (yscale, "linear"))
-    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
-    ylo = ydata - dy;
-    yhi = ydata + dy;
-  else
-    n = ydata > 0;
-    ry = exp (0.01 * (max (log (ydata(n))) - min (log (ydata(n)))));
-    ylo = ydata/ry;
-    yhi = ydata*ry;
-  endif
-  nans = NaN + xdata(:);
-  if (strcmp (ifmt, "yerr"))
-    xdata = [xdata, xdata, nans, ...
-             xlo, xhi, nans, ...
-             xlo, xhi, nans];
-    ydata = [ydata-ldata, ydata+udata, nans, ...
-             ydata+udata, ydata+udata, nans, ...
-             ydata-ldata, ydata-ldata, nans];
-  elseif (strcmp (ifmt, "xerr"))
-    xdata = [xdata-xldata, xdata+xudata, nans, ...
-             xdata+xudata, xdata+xudata, nans, ...
-             xdata-xldata, xdata-xldata, nans];
-    ydata = [ydata, ydata, nans, ...
-             ylo, yhi, nans, ...
-             ylo, yhi, nans];
-  elseif (strcmp (ifmt, "boxy"))
-    dx = 0.01 * (max (xdata(:)) - min (xdata(:)));
-    xdata = [xlo, xhi, xhi, xlo, xlo, nans];
-    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
-             ydata-ldata, nans];
-  elseif (strcmp (ifmt, "box"))
-    dy = 0.01 * (max (ydata(:)) - min (ydata(:)));
-    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
-             xdata-xldata, nans];
-    ydata = [ylo, ylo, yhi, yhi, ylo, nans];
-  elseif (strcmp (ifmt, "boxxy"))
-    xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ...
-             xdata-xldata, nans];
-    ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ...
-             ydata-ldata, nans];
-  elseif (strcmp (ifmt, "xyerr"))
-    [x1, y1] = errorbar_data (xdata, ydata, ldata, udata,
-                              xldata, xudata, "xerr", xscale, yscale);
-    [x2, y2] = errorbar_data (xdata, ydata, ldata, udata,
-                              xldata, xudata, "yerr", xscale, yscale);
-    xdata = [x1; x2];
-    ydata = [y1; y2];
-    return
-  else
-    error ("errorbar: valid error bar types are xerr, yerr, boxxy, and xyerr");
-  endif
-
-  xdata = xdata.'(:);
-  ydata = ydata.'(:);
-
-endfunction
-
-function update_props (hg, dummy, hl)
-  set (hl, "color", get (hg, "color"),
-           "linewidth", get (hg, "linewidth"));,
-  set (hl(1), "linestyle", get (hg, "linestyle"),
-              "marker", get (hg, "marker"),
-              "markersize", get (hg, "markersize"),
-              "markerfacecolor", get (hg, "markerfacecolor"),
-              "markeredgecolor", get (hg, "markeredgecolor"));
-endfunction
-
-function update_data (hg, dummy, hl)
-
-  if (strcmp (get (hg, "type"), "axes"))
-    hax = hg;
-    hg = ancestor (hl(1), "hggroup");
-  else
-    hax = ancestor (hg, "axes");
-  endif
-  xscale = get (hax, "xscale");
-  yscale = get (hax, "yscale");
-
-  xdata = get (hg, "xdata");
-  ydata = get (hg, "ydata");
-  ldata = get (hg, "ldata");
-  udata = get (hg, "udata");
-  xldata = get (hg, "xldata");
-  xudata = get (hg, "xudata");
-  ifmt = get (hg, "format");
-
-  set (hl(1), "xdata", xdata);
-  set (hl(1), "ydata", ydata);
-
-  [errorbar_xdata, errorbar_ydata] = ...
-          errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ...
-                         ifmt, xscale, yscale);
-
-  set (hl(2), "xdata", errorbar_xdata);
-  set (hl(2), "ydata", errorbar_ydata);
-
-endfunction
-
--- a/scripts/plot/private/__ezplot__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{needusage}] =} __ezplot__ (@var{pfunc}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-function [h, needusage] = __ezplot__ (pfunc, varargin)
-
-  func = cstrcat ("ez", pfunc);
-  if (strncmp (pfunc, "contour", 7))
-    iscontour = true;
-  else
-    iscontour = false;
-  endif
-  if (strcmp (pfunc, "plot"))
-    isplot = true;
-    isplot3 = false;
-    ispolar = false;
-    nargs = 1;
-  elseif (strcmp (pfunc, "plot3"))
-    isplot = false;
-    isplot3 = true;
-    ispolar = false;
-    nargs = 1;
-  elseif (strcmp (pfunc, "polar"))
-    isplot = false;
-    isplot3 = false;
-    ispolar = true;
-    nargs = 1;
-  else
-    isplot = false;
-    isplot3 = false;
-    ispolar = false;
-    nargs = 2;
-  endif
-
-  [ax, varargin, nargin] = __plt_get_axis_arg__ (func, varargin{:});
-
-  needusage = false;
-  if (nargin < 1)
-    needusage = true;
-    return;
-  endif
-
-  parametric = false;
-  fun = varargin {1};
-  if (ischar (fun))
-    if (exist (fun, "file") || exist (fun, "builtin"))
-      fun = vectorize (inline (cstrcat (fun, "(t)")));
-    else
-      fun = vectorize (inline (fun));
-    endif
-    if (isplot && length (argnames (fun)) == 2)
-      nargs = 2;
-    elseif (length (argnames (fun)) != nargs)
-      error ("%s: excepting a function of %d arguments", func, nargs);
-    endif
-    fstr = formula (fun);
-    if (isplot)
-      xarg = (argnames (fun)){1};
-      if (nargs == 2)
-        yarg = (argnames (fun)){2};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = (argnames (fun)){1};
-      yarg = (argnames (fun)){2};
-    endif
-  elseif (strcmp (typeinfo (fun), "inline function"))
-    if (isplot && length (argnames (fun)) == 2)
-      nargs = 2;
-    elseif (length (argnames (fun)) != nargs)
-      error ("%s: excepting a function of %d arguments", func, nargs);
-    endif
-    fun = vectorize (fun);
-    fstr = formula (fun);
-    if (isplot)
-      xarg = (argnames (fun)){1};
-      if (nargs == 2)
-        yarg = (argnames (fun)){2};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (isplot || ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = (argnames (fun))(1);
-      yarg = (argnames (fun))(2);
-    endif
-  elseif (isa (fun, "function_handle"))
-    fstr = func2str (fun);
-    if (! isempty (strfind (fstr, ')')))
-      args = regexp (substr (fstr, 3, strfind (fstr, ')')(1) - 3),
-                     '(\w+)', 'tokens');
-    fstr = substr (fstr, strfind (fstr, ')')(1) + 1);
-    else
-      args = {{"x"}};
-    endif
-    if (isplot && length (args) == 2)
-      nargs = 2;
-    elseif (length (args) != nargs)
-      error ("%s: excepting a function of %d arguments", func, nargs);
-    endif
-    if (isplot)
-      xarg = args{1}{1};
-      if (nargs == 2)
-        yarg = args{2}{1};
-      else
-        yarg = "";
-      endif
-    elseif (isplot3)
-      xarg = "x";
-      yarg = "y";
-    elseif (ispolar)
-      xarg = "";
-      yarg = "";
-    else
-      xarg = args{1}{1};
-      yarg = args{2}{1};
-    endif
-  else
-    error ("%s: expecting string, inline function or function handle", func);
-  endif
-
-  if (nargin > 2 || (nargin == 2 && isplot))
-    funx = fun;
-    fstrx = fstr;
-    funy = varargin {2};
-    if (ischar (funy) && ! strcmp (funy, "circ") && ! strcmp (funy, "animate"))
-      parametric = true;
-      if (exist (funy, "file") || exist (funy, "builtin"))
-        funy = vectorize (inline (cstrcat (funy, "(t)")));
-      else
-        funy = vectorize (inline (funy));
-      endif
-      if (length (argnames (funy)) != nargs)
-        error ("%s: excepting a function of %d arguments", func, nargs);
-      endif
-      fstry = formula (funy);
-    elseif (strcmp (typeinfo (funy), "inline function"))
-      parametric = true;
-      if (length (argnames (funy)) != nargs)
-        error ("%s: excepting a function of %d arguments", func, nargs);
-      endif
-      funy = vectorize (funy);
-      fstry = formula (funy);
-    elseif (isa (funy, "function_handle"))
-      parametric = true;
-      fstry = func2str (funy);
-      if (! isempty (strfind (fstry, ')')))
-        args = regexp (substr (fstry, 3, strfind (fstry, ')')(1) - 3),
-                       '(\w+)', 'tokens');
-        fstry = substr (fstry, strfind (fstry, ')')(1) + 1);
-      else
-        args = {{"y"}};
-      endif
-      if (length (args) != nargs)
-        error ("%s: excepting a function of %d arguments", func, nargs);
-      endif
-    endif
-
-    if (parametric && isplot)
-      xarg = "x";
-      yarg = "y";
-      if (nargs == 2)
-        error ("%s: can not define a parametric function in this manner");
-      endif
-    endif
-
-    if (!isplot && parametric)
-      funz = varargin {3};
-      if (ischar (funz) && ! strcmp (funz, "circ")
-          && ! strcmp (funz, "animate"))
-        if (exist (funz, "file") || exist (funz, "builtin"))
-          funz = vectorize (inline (cstrcat (funz, "(t)")));
-        else
-          funz = vectorize (inline (funz));
-        endif
-        if (length (argnames (funz)) != nargs)
-          error ("%s: excepting a function of %d arguments", func, nargs);
-        endif
-        fstrz = formula (funz);
-      elseif (strcmp (typeinfo (funz), "inline function"))
-        if (length (argnames (funz)) != nargs)
-          error ("%s: excepting a function of %d arguments", func, nargs);
-        endif
-        funz = vectorize (funz);
-        fstrz = formula (funz);
-      elseif (isa (funz, "function_handle"))
-        fstrz = func2str (funz);
-        args = regexp (substr (fstrz, 3, strfind (fstrz, ')')(1) - 3),
-                       '(\w+)', 'tokens');
-        if (length (args) != nargs)
-          error ("%s: excepting a function of %d arguments", func, nargs);
-        endif
-        fstrz = substr (fstrz, strfind (fstrz, ')')(1) + 1);
-      else
-        error ("%s: parametric plots expect 3 functions", func);
-      endif
-    endif
-  endif
-
-  if (isplot && nargs != 2)
-    n = 500;
-  else
-    n = 60;
-  endif
-  domain = [];
-  circ = false;
-  animate = false;
-  if (parametric)
-    if (isplot)
-      iarg = 3;
-    else
-      iarg = 4;
-    endif
-  else
-    iarg = 2;
-  endif
-  while (iarg <= nargin)
-    arg = varargin{iarg++};
-    if (ischar (arg) && strcmp (arg, "circ"))
-      circ = true;
-    elseif (ischar (arg) && strcmp (arg, "animate"))
-      animate = true;
-    elseif (isscalar (arg))
-      n = arg;
-    elseif (numel (arg) == 2)
-      domain = [arg(:).' arg(:).'];
-    elseif (numel (arg) == 4)
-      domain = arg(:).';
-    else
-      error ("%s: expecting scalar, 2 or 4 element vector", func);
-    endif
-  endwhile
-
-  if (isempty (domain))
-    if (isplot3 || ispolar)
-      domain = [0, 2*pi, 0, 2*pi];
-    else
-      domain = [-2*pi, 2*pi, -2*pi, 2*pi];
-    endif
-  endif
-
-  if (circ)
-    if (iscontour || isplot3 || isplot)
-      needusage = true;
-      return;
-    endif
-    if (parametric)
-      error ("%s: can not have both circular domain and parametric function",
-             func);
-    endif
-    cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2;
-    funx = @(r,t) r .* cos (t) + cent (1);
-    funy = @(r,t) r .* sin (t) + cent (2);
-    domain = [0, sqrt((domain(2) - cent(1))^2 + (domain(4) - cent(2))^2), ...
-              -pi, pi];
-    funz = fun;
-    parametric = true;
-  endif
-
-  if (animate)
-    if (!isplot3)
-      error ("%s: animated graphs only valid with plot3", func);
-    endif
-    error ("%s: animated graphs not implemented", func);
-  endif
-
-  if (isplot3 || ispolar || (isplot && nargs == 1))
-    X = linspace (domain (1), domain (2), n);
-  elseif (isplot && numel (domain) == 2)
-    x = linspace (domain (1), domain (2), n);
-    [X, Y] = meshgrid (x, x);
-  else
-    x = linspace (domain (1), domain (2), n);
-    y = linspace (domain (3), domain (4), n);
-    [X, Y] = meshgrid (x, y);
-  endif
-
-  if (parametric)
-    if (isplot)
-      XX = feval (funx, X);
-      Z = feval (funy, X);
-      X = XX;
-    elseif (isplot3)
-      Z = feval (funz, X);
-      XX = feval (funx, X);
-      YY = feval (funy, X);
-      X = XX;
-      Y = YY;
-    else
-      Z = feval (funz, X, Y);
-      XX = feval (funx, X, Y);
-      YY = feval (funy, X, Y);
-      X = XX;
-      Y = YY;
-
-      ## Eliminate the singularities
-      X = __eliminate_sing__ (X);
-      Y = __eliminate_sing__ (Y);
-      Z = __eliminate_sing__ (Z);
-    endif
-
-    fstrx = regexprep (regexprep (regexprep (fstrx,'\s*\.?\^\s*','^'),
-                      '\./', '/'), '\.?\*', '');
-    fstry = regexprep (regexprep (regexprep (fstry,'\s*\.?\^\s*','^'),
-                      '\./', '/'), '\.?\*', '');
-    if (isplot)
-      fstr = cstrcat ("x = ",fstrx,", y = ",fstry);
-    else
-      fstrz = regexprep (regexprep (regexprep (fstrz,'\s*\.?\^\s*','^'),
-                                    '\./', '/'), '\.?\*', '');
-      fstr = cstrcat ("x = ",fstrx,",y = ",fstry,", z = ",fstrz);
-    endif
-  else
-    if (isplot3)
-      needusage = true;
-      return;
-    endif
-
-    fstr = regexprep (regexprep (regexprep (fstr,'\s*\.?\^\s*','^'), '\./', '/'),
-                      '\.?\*', '');
-    if (isplot && nargs == 2)
-      if (strcmp (typeinfo (fun), "inline function")
-          && !isempty (strfind (formula (fun) , "=")))
-        fun = inline (cstrcat (strrep (formula (fun), "=", "- ("), ")"));
-      else
-        fstr = cstrcat (fstr, " = 0");
-      endif
-
-      Z = feval (fun, X, Y);
-
-      ## Matlab returns line objects for this case and so can't call
-      ## contour directly as it returns patch objects to allow colormaps
-      ## to work with contours. Therefore recreate the lines from the
-      ## output for contourc, and store in cell arrays.
-      [c, lev] = contourc (X, Y, Z, [0, 0]);
-
-      i1 = 1;
-      XX = {};
-      YY = {};
-      while (i1 < length (c))
-        clev = c(1,i1);
-        clen = c(2,i1);
-        XX = [XX, {c(1, i1+1:i1+clen)}];
-        YY = [YY, {c(2, i1+1:i1+clen)}];
-        i1 += clen+1;
-      endwhile
-    else
-      if (ispolar)
-        Z = feval (fun, X);
-      elseif (isplot)
-        Z = real (feval (fun, X));
-
-        ## Eliminate the singularities. This seems to be what matlab
-        ## does, but can't be sure.
-        XX = sort (Z (isfinite (Z)));
-        if (length (X) > 4)
-          d = XX(fix (7 * length (XX) / 8)) - XX(fix (length (XX) / 8));
-          yrange = [max(XX(1) - d/8, XX(fix (length (XX) / 8)) - d), ...
-                    min(XX(end) + d/8, XX(fix (7 * length (XX) / 8)) + d)];
-        else
-          yrange = [XX(1), XX(end)];
-        endif
-
-        idx = 2 : length (Z);
-        idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) |
-                 ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange (2) / 2)));
-        if (any (idx))
-          Z(idx) = NaN;
-        endif
-      else
-        Z = feval (fun, X, Y);
-
-        ## Eliminate the singularities
-        Z = __eliminate_sing__ (Z);
-      endif
-    endif
-  endif
-
-  oldax = gca ();
-  unwind_protect
-    axes (ax);
-    if (iscontour)
-      [clev, h] = feval (pfunc, X, Y, Z);
-    elseif (isplot && nargs == 2)
-      h = [];
-      hold_state = get (ax, "nextplot");
-      for i = 1 : length (XX)
-        h = [h; plot(XX{i}, YY{i})];
-        if (i == 1)
-          set (ax, "nextplot", "add");
-        endif
-      endfor
-      set (ax, "nextplot", hold_state);
-    elseif (ispolar || isplot)
-      h = feval (pfunc, X, Z);
-      if (isplot && !parametric)
-        axis ([X(1), X(end), yrange]);
-      endif
-    else
-      h = feval (pfunc, X, Y, Z);
-    endif
-    xlabel (xarg);
-    ylabel (yarg);
-    title (fstr);
-  unwind_protect_cleanup
-    axes (oldax);
-  end_unwind_protect
-
-endfunction
-
-function x = __eliminate_sing__ (x)
-  x (isinf (x)) = NaN;
-  x (abs (del2 (x)) > 0.2 * (max (x(:)) - min (x(:)))) = NaN;
-endfunction
--- a/scripts/plot/private/__file_filter__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __file_filter__ (@var{file_filter})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retval, defname, defdir] = __file_filter__ (file_filter, name)
-
-  revtal = {};
-  defname = "";
-  defdir = "";
-
-  if (iscell (file_filter))
-    [r, c] = size (file_filter);
-    if (c != 1 && c != 2)
-      error ("%s: invalid filter specification", name);
-    endif
-    if (c == 1)
-      retval = cell (r, 2);
-      for i = 1:r
-        retval{i, 1} = file_filter{i};
-        retval{i, 2} = __default_filtername__ (file_filter{i});
-      endfor
-    else
-      retval = file_filter;
-      for i = 1:r
-        if (isempty (retval{i, 2}))
-          retval{i, 2} = __default_filtername__ (retval{i, 1});
-        endif
-      endfor
-    endif
-  elseif (ischar (file_filter))
-    [defdir, fname, fext] = fileparts (file_filter);
-    if (! strcmp (fname, "*"))
-      defname = strcat (fname, fext);
-    endif
-    if (length (fext) > 0)
-      fext = strcat ("*", fext);
-      retval = {fext, __default_filtername__(fext)};
-    endif
-  endif
-
-  retval(end+1,:) = {"*", __default_filtername__("*")};
-
-endfunction
-
-function name = __default_filtername__ (filterext)
-
-  name = "";
-
-  switch (filterext)
-    case "*"
-      name = "All Files";
-    case "*.m"
-      name = "Octave Source Files";
-    case "*.c"
-      name = "C Source Files";
-    case {"*.cc" "*.c++" "*.cpp"}
-      name = "C++ Source Files";
-    case "*.oct"
-      name = "Octave Compiled Files";
-  endswitch
-
-  if (isempty (name))
-    extlist = ostrsplit (filterext, ";");
-    extlist = strrep (extlist, "*.", "");
-    extlist = toupper (extlist);
-    extlist(end+1, :) = repmat ({","}, 1, length (extlist));
-    extlist = strcat (extlist{:});
-    extlist = extlist(1:end-1);
-    name = strcat (extlist, "-Files");
-  endif
-
-endfunction
--- a/scripts/plot/private/__fltk_file_filter__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function retval = __fltk_file_filter__ (file_filter)
-
-  retval = "";
-  [r, c] = size (file_filter);
-  if ((c == 0) || (c > 2))
-    error ("expecting 1 or to 2 columns for file filter cell");
-  endif
-  fltk_str = "";
-  for idx = 1 : r
-
-    curr_ext = file_filter{idx, 1};
-    curr_ext = ostrsplit (curr_ext, ";");
-
-    if (length (curr_ext) > 1)
-      curr_ext = regexprep (curr_ext, '\*\.', ',');
-      curr_ext = strcat (curr_ext{:})(2 : end);
-      curr_ext = strcat ("*.{", curr_ext, "}");
-    else
-      curr_ext = curr_ext{:};
-    endif
-
-    curr_desc = strcat (curr_ext(3:end), "-Files");
-
-    if (c == 2)
-      curr_desc = file_filter{idx, 2};
-      curr_desc = regexprep (curr_desc, '\(', '<');
-      curr_desc = regexprep (curr_desc, '\)', '>');
-    endif
-
-    if (length (fltk_str) > 0)
-      fltk_str = strcat (fltk_str, "\t", curr_desc, " (", curr_ext, ")");
-    else
-      fltk_str = strcat (curr_desc, " (", curr_ext, ")");
-    endif
-
-  endfor
-  retval = fltk_str;
-
-endfunction
--- a/scripts/plot/private/__fltk_ginput__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __fltk_ginput__ (@var{f}, @var{n})
-## Undocumented internal function.
-## @end deftypefn
-
-## This is ginput.m implementation for fltk.
-
-function [x, y, button] = __fltk_ginput__ (f, n = -1)
-
-  if (isempty (get (f, "currentaxes")))
-    error ("ginput: must have at least one axes");
-  endif
-
-  x = y = button = [];
-  ginput_accumulator (0, 0, 0, 0);  # initialize accumulator
-
-  unwind_protect
-
-    orig_windowbuttondownfcn = get (f, "windowbuttondownfcn");
-    set (f, "windowbuttondownfcn", @ginput_windowbuttondownfcn);
-
-    orig_ginput_keypressfcn = get (f, "keypressfcn");
-    set (f, "keypressfcn", @ginput_keypressfcn);
-
-    do
-      __fltk_redraw__ ();
-
-      ## Release CPU.
-      sleep (0.01);
-
-      [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0);
-    until (n0 == n || n0 < 0)
-
-  unwind_protect_cleanup
-    set (f, "windowbuttondownfcn", orig_windowbuttondownfcn);
-    set (f, "keypressfcn", orig_ginput_keypressfcn);
-  end_unwind_protect
-
-endfunction
-
-function [x, y, n, button] = ginput_accumulator (mode, xn, yn, btn)
-  persistent x y n button;
-
-  if (mode == 0)
-    ## Initialize.
-    x = y = button = [];
-    n = 0;
-  elseif (mode == 1)
-    ## Append mouse button or key press.
-    x = [x; xn];
-    y = [y; yn];
-    button = [button; btn];
-    n += 1;
-  elseif (mode == 2)
-    ## The end due to Enter.
-    n = -1;
- endif
-
-endfunction
-
-function ginput_windowbuttondownfcn (src, data)
-  point = get (get (src,"currentaxes"), "currentpoint");
-  button = data;
-  ginput_accumulator (1, point(1,1), point(2,1), button);
-endfunction
-
-function ginput_keypressfcn (src, evt)
-  point = get (get (src, "currentaxes"), "currentpoint");
-  key = evt.Key;
-  if (key == 10)
-    ## Enter key stops ginput.
-    ginput_accumulator (2, NaN, NaN, NaN);
-  else
-    ginput_accumulator (1, point(1,1), point(2,1), key);
-  endif
-endfunction
-
--- a/scripts/plot/private/__fltk_print__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __fltk_print__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-function opts = __fltk_print__ (opts)
-
-  dos_shell = (ispc () && ! isunix ());
-
-  figure (opts.figure);
-  drawnow ("expose");
-  __fltk_redraw__ ();
-
-  if (! isempty (opts.fig2dev_binary))
-    ## fig2dev is prefered for conversion to emf
-    fig2dev_devices = {"pstex", "mf", "emf"};
-  else
-    fig2dev_devices = {"pstex", "mf"};
-  endif
-
-  gl2ps_device = {};
-  pipeline = {};
-  switch (lower (opts.devopt))
-  case {"eps", "eps2", "epsc", "epsc2"}
-    ## format GL2PS_EPS
-    gl2ps_device = {"eps"};
-    ## FIXME - use epstool to tighten bbox and provide preview.
-    pipeline = {opts.epstool_cmd(opts, "-", opts.name)};
-  case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ...
-        "pslatexstandalone", "pdflatexstandalone"}
-    ## format GL2PS_TEX
-    n = find (opts.devopt == "l", 1);
-    suffix = opts.devopt(1:n-1);
-    dot = find (opts.name == ".", 1, "last");
-    if ((! isempty (dot))
-        && any (strcmpi (opts.name(dot:end), ...
-                {strcat(".", suffix), ".tex", "."})))
-      name = opts.name(1:dot-1);
-      if (dot < numel (opts.name)
-          && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"})))
-        ## If user provides eps/ps/pdf suffix, use it.
-        suffix = opts.name(dot+1:end);
-      endif
-    else
-      error ("print:invalid-suffix", 
-             "invalid suffix '%s' for device '%s'.",
-             opts.name(dot:end), lower (opts.devopt));
-    endif
-    gl2ps_device = {sprintf("%snotxt", lower (suffix))};
-    gl2ps_device{2} = "tex";
-    if (dos_shell)
-      ## FIXME - this will only work on MinGW with the MSYS shell
-      pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
-      pipeline{2} = sprintf ("cat > %s.tex", name);
-    else
-      pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
-      pipeline{2} = sprintf ("cat > %s.tex", name);
-    endif
-  case "tikz"
-    ## format GL2PS_PGF
-    gl2ps_device = {"pgf"};
-    pipeline = {sprintf("cat > %s", opts.name)};
-  case "svg"
-    ## format GL2PS_SVG
-    gl2ps_device = {"svg"};
-    pipeline = {sprintf("cat > %s", opts.name)};
-  case fig2dev_devices
-    cmd_pstoedit = opts.pstoedit_cmd (opts, "fig");
-    cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt);
-    if (strcmp (opts.devopt, "pstex"))
-      [~, ~, ext] = fileparts (opts.name);
-      if (any (strcmpi (ext, {".ps", ".tex", "."})))
-        opts.name = opts.name(1:end-numel(ext));
-      endif
-      opts.name = strcat (opts.name, ".ps");
-      cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
-      gl2ps_device = {"eps"};
-      pipeline = {cmd};
-      cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t");
-      gl2ps_device{2} = "eps";
-      pipeline{2} = sprintf ("%s | %s > %s", cmd_pstoedit,
-                             cmd_fig2dev, strrep(opts.name, ".ps", ".tex"));
-    else
-      cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
-      gl2ps_device = {"eps"};
-      pipeline = {cmd};
-    endif
-  case "aifm"
-    cmd = opts.pstoedit_cmd (opts, "ps2ai");
-    gl2ps_device = {"eps"};
-    pipeline = {sprintf("%s > %s", cmd, opts.name)};
-  case {"dxf", "emf", "fig", "hpgl"}
-    cmd = opts.pstoedit_cmd (opts);
-    gl2ps_device = {"eps"};
-    pipeline = {sprintf("%s > %s", cmd, opts.name)};
-  case {"corel", "gif"}
-    error ("print:unsupporteddevice",
-           "print.m: %s output is not available for the FLTK graphics toolkit",
-           upper (opts.devopt));
-  case opts.ghostscript.device
-    opts.ghostscript.source = "-";
-    opts.ghostscript.output = opts.name;
-    if (opts.send_to_printer)
-      opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = [];
-      opts.ghostscript.output = "-";
-    endif
-    [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
-    if (opts.send_to_printer || isempty (opts.name))
-      cmd_lpr = opts.lpr_cmd (opts);
-      cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr);
-    else
-      cmd = sprintf ("%s", cmd_gs);
-    endif
-    if (! isempty (cmd_cleanup))
-      gl2ps_device = {"eps"};
-      if (dos_shell)
-        pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)};
-      else
-        pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)};
-      endif
-    else
-      gl2ps_device = {"eps"};
-      pipeline = {cmd};
-    endif
-  otherwise
-    error (sprintf ("print:no%soutput", opts.devopt),
-           "print.m: %s output is not available for GL2PS output",
-           upper (opts.devopt));
-  endswitch
-
-  opts.pipeline = pipeline;
-
-  ## Tell gl2ps to use different rendering options for 2D plots
-  haxes = findall (opts.figure, "type", "axes");
-  vw = get (haxes, "view");
-  if (iscell (vw))
-    vw = vertcat (vw{:});
-  endif
-  is2D = all (abs (vw(:,2)) == 90);
-  if (is2D)
-    gl2ps_device{end} = [gl2ps_device{end}, "is2D"];
-  endif
-
-  for n = 1:numel (pipeline)
-    if (opts.debug)
-      fprintf ("fltk-pipeline: '%s'\n", pipeline{n});
-    endif
-    drawnow (gl2ps_device{n}, strcat ('|',pipeline{n}));
-  endfor
-
-  if (! isempty (strfind (opts.devopt, "standalone")))
-    opts.latex_standalone (opts);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__getlegenddata__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
-## Undocumented internal function.
-## @end deftypefn
-
-function [hplots, text_strings] = __getlegenddata__ (hlegend)
-  hplots = [];
-  text_strings = {};
-  ca = getfield (get (hlegend, "userdata"), "handle");
-  kids = [];
-  for i = 1:numel (ca)
-    kids = [kids; get(ca(i), "children")];
-  endfor
-
-  for i = numel (kids):-1:1
-    typ = get (kids(i), "type");
-    if (strcmp (typ, "line") || strcmp (typ, "surface")
-        || strcmp (typ, "patch") || strcmp (typ, "hggroup"))
-
-      if (strcmp (typ, "hggroup"))
-        hgkids = get (kids(i), "children");
-        for j = 1 : length (hgkids)
-          hgobj = get (hgkids (j));
-          if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname))
-            hplots = [hplots, hgkids(j)];
-            text_strings = {text_strings{:}, hgobj.displayname};
-            break;
-          endif
-        endfor
-      else
-        if (! isempty (get (kids (i), "displayname")))
-          hplots = [hplots, kids(i)];
-          text_strings = {text_strings{:}, get(kids (i), "displayname")};
-        endif
-      endif
-
-    endif
-  endfor
-
-endfunction
--- a/scripts/plot/private/__ghostscript__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __ghostscript__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-07-26
-
-function [gs_cmd, cleanup_cmd] = __ghostscript__ (varargin);
-
-  opts.binary = "";
-  opts.source = "-";
-  opts.output = "-";
-  opts.device = "";
-  opts.epscrop = false;
-  opts.antialiasing  = false;
-  opts.antialiasing_textalphabits = 4;,
-  opts.antialiasing_graphicsalphabits = 4;
-  opts.resolution = 150;
-  opts.papersize = "";
-  opts.pageoffset = [0 0];
-  opts.debug = false;
-  opts.level = [];
-  opts.prepend = "";
-
-  offsetfile = "";
-  offset_ps = {};
-  cleanup_cmd = "";
-
-  args = varargin;
-  n = find (cellfun ("isclass", args, "struct"));
-  if (! isempty (n))
-    f = fieldnames (args{n});
-    for m = 1:numel (f)
-      opts.(f{m}) = args{n}.(f{m});
-    endfor
-    args(n) = [];
-  endif
-  for n = 1:2:numel (args)
-    opts.(args{n}) = args{n+1};
-  endfor
-
-  if (isempty (opts.papersize))
-    format_for_printer = false;
-  else
-    format_for_printer = true;
-  endif
-
-  gs_opts = sprintf ("-dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=%s", opts.device);
-
-  if (! isempty (opts.level) && ismember (opts.level, [1, 2, 3]))
-    gs_opts = sprintf ("%s -dLanguageLevel=%d", gs_opts, round (opts.level));
-  endif
-
-  if (opts.antialiasing && isempty (strfind (opts.device, "write")))
-    ## Apply anti-aliasing to all bitmap formats/devices
-    gs_opts = sprintf ("%s -dTextAlphaBits=%d -dGraphicsAlphaBits=%d",
-                       gs_opts, opts.antialiasing_textalphabits,
-                       opts.antialiasing_graphicsalphabits);
-    gs_opts = sprintf ("%s -r%dx%d", gs_opts, [1, 1] * opts.resolution);
-  elseif (any (strcmp (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
-    gs_opts = sprintf ("%s -dEmbedAllFonts=true", gs_opts);
-    if (strcmp (opts.device, "pdfwrite"))
-      ## Optimize for loading
-      gs_opts = sprintf ("%s -dOptimize=true", gs_opts);
-    endif
-  endif
-
-  if (opts.epscrop)
-    ## papersize is specified by the eps bbox
-    gs_opts = sprintf ("%s -dEPSCrop", gs_opts);
-  endif
-  if (format_for_printer)
-    if (ischar (opts.papersize))
-      gs_opts = sprintf ("%s -sPAPERSIZE=%s", gs_opts, opts.papersize);
-    elseif (isnumeric (opts.papersize) && numel (opts.papersize) == 2)
-      gs_opts = sprintf ("%s -dDEVICEWIDTHPOINTS=%d -dDEVICEHEIGHTPOINTS=%d",
-                         gs_opts, opts.papersize);
-      if (opts.papersize(1) > opts.papersize(2))
-        ## Lanscape mode: This option will result in automatic rotation of the
-        ##                document page if the requested page size matches one
-        ##                of the default page sizes
-        gs_opts = sprintf ("%s -dNORANGEPAGESIZE", gs_opts);
-      endif
-    else
-      error ("print:badpapersize", "__ghostscript__.m: invalid 'papersize'");
-    endif
-    gs_opts = sprintf ("%s -dFIXEDMEDIA", gs_opts);
-    ## "pageoffset" is relative to the coordinates, not the BBox LLHC.
-    str = sprintf ("%s [%d %d] %s", "<< /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset",
-                   opts.pageoffset, ">> setpagedevice");
-    offset_ps = {"%!PS-Adobe-3.0", str, "%%EOF"};
-    if (isfield (opts, "offsetfile"))
-      offsetfile = opts.offsetfile;
-      cleanup_cmd = "";
-    else
-      offsetfile = strcat (tmpnam (), ".ps");
-      cleanup_cmd = sprintf ("rm %s", offsetfile);
-    endif
-    unwind_protect
-      fid = fopen (offsetfile, "w");
-      if (fid == -1)
-        error ("print:fopenfailed", "__ghostscript__.m: fopen () failed");
-      endif
-      fprintf (fid, "%s\n", offset_ps{:});
-    unwind_protect_cleanup
-      status = fclose (fid);
-      if (status == -1)
-        error ("print:fclosefailed", "__ghostscript__.m: fclose () failed");
-      endif
-    end_unwind_protect
-    if (opts.debug)
-      fprintf ("---- begin %s ----\n", offsetfile);
-      fprintf ("%s\n", offset_ps{:});
-      fprintf ("----- end %s -----\n", offsetfile);
-    endif
-  endif
-
-  if (isempty (opts.binary))
-    error ("print:no_ghostscript", "__ghostscript__.m: ghostscript is required.");
-  elseif (isempty (opts.output))
-    cmd = sprintf ("%s %s", opts.binary, gs_opts);
-  else
-    cmd = sprintf ("%s %s -sOutputFile=\"%s\"", opts.binary, gs_opts, opts.output);
-  endif
-  if (! isempty (opts.prepend)
-      && any (strcmpi (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
-    ## FIXME - Fonts get may be mangled when appending ps/ps2.
-    ##         See "How to concatenate several PS files" at the link,
-    ##         http://en.wikibooks.org/wiki/PostScript_FAQ
-    cmd = sprintf ("%s %s", cmd, opts.prepend);
-    if (isempty (cleanup_cmd))
-      cleanup_cmd = sprintf ("rm %s", opts.prepend);
-    else
-      cleanup_cmd = sprintf ("%s ; rm %s", cleanup_cmd, opts.prepend);
-    endif
-  endif
-  if (! isempty (offsetfile) && format_for_printer)
-    cmd = sprintf ("%s %s", cmd, offsetfile);
-  endif
-  if (! isempty (opts.source))
-    cmd = sprintf ("%s %s", cmd, opts.source);
-  endif
-
-  if (opts.debug)
-    fprintf ("Ghostscript command: '%s'\n", cmd);
-  endif
-
-  gs_cmd = cmd;
-
-endfunction
-
-
--- a/scripts/plot/private/__gnuplot_get_var__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{value} =} __gnuplot_get_var__ (@var{h}, @var{name}, @var{fmt})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-02-07
-
-function gp_var_value = __gnuplot_get_var__ (h, gp_var_name, fmt = "")
-
-  if (nargin < 2)
-    print_usage ();
-  endif
-
-  if (numel (h) == 1 && isfigure (h))
-    if (isempty (get (gcf, "__plot_stream__")))
-      ostream = __gnuplot_open_stream__ (2, h);
-    else
-      ostream = get (h, "__plot_stream__");
-    endif
-  else
-    ostream = h;
-  endif
-  if (numel (ostream) < 1)
-    error ("__gnuplot_get_var__: stream to gnuplot not open");
-  elseif (ispc ())
-    if (numel (ostream) == 1)
-      error ("__gnuplot_get_var__: Need mkfifo that is not implemented under Windows");
-    endif
-    use_mkfifo = false;
-    istream = ostream(2);
-    ostream = ostream(1);
-  else
-    use_mkfifo = true;
-    ostream = ostream(1);
-  endif
-
-  if (use_mkfifo)
-    gpin_name = tmpnam ();
-
-    ## Mode: 6*8*8 ==  0600
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
-
-    if (err)
-      error ("__gnuplot_get_var__: Can not make FIFO (%s)", msg);
-    endif
-  endif
-
-  gp_var_name = strtrim (gp_var_name);
-  n = min (strfind (gp_var_name, " "), strfind (gp_var_name, ",")) - 1;
-  if (isempty (n))
-    n = numel (gp_var_name);
-  endif
-
-  unwind_protect
-
-    ## Notes: Variables may be undefined if user closes gnuplot by "q"
-    ## or Alt-F4.  Further, this abrupt close also requires the leading
-    ## "\n" on the next line.
-    if (use_mkfifo)
-      fprintf (ostream, "\nset print \"%s\";\n", gpin_name);
-      fflush (ostream);
-      [gpin, err] = fopen (gpin_name, "r");
-      if (err)
-        ## Try a second time, and then give an error.
-        [gpin, err] = fopen (gpin_name, "r");
-      endif
-      if (err)
-        error ("__gnuplot_get_var__: can not open FIFO");
-      endif
-      gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n",
-                        gp_var_name(1:n), gp_var_name);
-      fputs (ostream, gp_cmd);
-
-      ## Close output file, to force it to be flushed
-      fputs (ostream, "set print;\n");
-      fflush (ostream);
-
-      ## Now read from fifo.
-      reading = true;
-      str = {};
-      while (reading)
-        str{end+1} = fgets (gpin);
-        if (isnumeric (str{end}) && (str{end} == -1))
-          reading = false;
-          str = str(1:(end-1));
-        endif
-      endwhile
-      str = strcat (str{:});
-      fclose (gpin);
-    else
-      ## Direct gnuplot to print to <STDOUT>
-      fprintf (ostream, "set print \"-\";\n");
-      fflush (ostream);
-      gp_cmd = sprintf ("\nif (exists(\"%s\")) print \"OCTAVE: \", %s; else print NaN\n",
-                        gp_var_name(1:n), gp_var_name);
-      fputs (ostream, gp_cmd);
-      fflush (ostream);
-      ## Direct gnuplot to print to <STDERR>
-      fputs (ostream, "set print;\n");
-      fflush (ostream);
-
-      str = {};
-      while (isempty (str))
-        str = fread (istream, "*char")';
-        if (isempty (str))
-          sleep (0.05);
-        else
-          str = regexp (str, 'OCTAVE:.*', "match");
-          str = str{end}(8:end);
-        endif
-        fclear (istream);
-      endwhile
-    endif
-
-    ## Strip out EOLs and the continuation character "|"
-    str(str=="\n" | str=="\r") = "";
-    n_continue = strfind (str, " \\ ");
-    if (! isempty (n_continue))
-      str(n_continue+1) = "";
-    endif
-
-    if (isempty (fmt))
-      gp_var_value = strtrim (str);
-    else
-      gp_var_value = sscanf (str, fmt);
-    endif
-
-  unwind_protect_cleanup
-    if (use_mkfifo)
-      unlink (gpin_name);
-    endif
-  end_unwind_protect
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_ginput__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-## Copyright (C) 2004-2012 Petr Mikulik
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __gnuplot_ginput__ (@var{f}, @var{n})
-## Undocumented internal function.
-## @end deftypefn
-
-## This is ginput.m implementation for gnuplot and X11.
-## It requires gnuplot 4.1 and later.
-
-## This file initially bore the copyright statement
-## Petr Mikulik
-## History: June 2006; August 2005; June 2004; April 2004
-## License: public domain
-
-function [x, y, button] = __gnuplot_ginput__ (f, n)
-
-  if (compare_versions (__gnuplot_version__ (), "4.0", "<="))
-    error ("ginput: version %s of gnuplot not supported", gnuplot_version ());
-  endif
-
-  ostream = get (f, "__plot_stream__");
-  if (numel (ostream) < 1)
-    error ("ginput: stream to gnuplot not open");
-  elseif (ispc ())
-    if (numel (ostream) == 1)
-      error ("ginput: Need mkfifo that is not implemented under Windows");
-    endif
-    use_mkfifo = false;
-    istream = ostream(2);
-    ostream = ostream(1);
-  else
-    use_mkfifo = true;
-    ostream = ostream(1);
-  endif
-
-  if (nargin == 1)
-    x = zeros (100, 1);
-    y = zeros (100, 1);
-    button = zeros (100, 1);
-  else
-    x = zeros (n, 1);
-    y = zeros (n, 1);
-    button = zeros (n, 1);
-  endif
-
-  if (use_mkfifo)
-    gpin_name = tmpnam ();
-
-    ##Mode: 6*8*8 ==  0600
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
-
-    if (err)
-      error ("ginput: Can not open fifo (%s)", msg);
-    endif
-  endif
-
-  unwind_protect
-
-    k = 0;
-    while (true)
-      k++;
-
-      ## Notes: MOUSE_* can be undefined if user closes gnuplot by "q"
-      ## or Alt-F4. Further, this abrupt close also requires the leading
-      ## "\n" on the next line.
-      if (use_mkfifo)
-        fprintf (ostream, "set print \"%s\";\n", gpin_name);
-        fflush (ostream);
-        [gpin, err] = fopen (gpin_name, "r");
-        if (err)
-          error ("ginput: Can not open FIFO (%s)", msg);
-        endif
-        fputs (ostream, "pause mouse any;\n\n");
-        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
-
-        ## Close output file, to force it to be flushed
-        fputs (ostream, "set print;\n");
-        fflush (ostream);
-
-        ## Now read from fifo.
-        [x(k), y(k), button(k), count] = fscanf (gpin, "%f %f %d", "C");
-        fclose (gpin);
-      else
-        fputs (ostream, "set print \"-\";\n");
-        fflush (ostream);
-        fputs (ostream, "pause mouse any;\n\n");
-        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print \"OCTAVE: \", MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
-
-        ## Close output file, to force it to be flushed
-        fputs (ostream, "set print;\n");
-        fflush (ostream);
-
-        str = {};
-        while (isempty (str))
-          str = fread (istream, "*char")';
-          if (isempty (str))
-            sleep (0.05);
-          else
-            str = regexp (str, 'OCTAVE:\s+[-+.\d]+\s+[-+.\d]+\s+\d*', 'match');
-          endif
-          fclear (istream);
-        endwhile
-        [x(k), y(k), button(k), count] = sscanf (str{end}(8:end), "%f %f %d", "C");
-      endif
-
-      if ([x(k), y(k), button(k)] == [0, 0, -1])
-        ## Mousing not active (no plot yet).
-        break;
-      endif
-
-      if (button(k) == 0x0D || button(k) == 0x0A)
-        ## Stop when hitting a RETURN or ENTER key.
-        x(k:end) = [];
-        y(k:end) = [];
-        button(k:end) = [];
-        break;
-      endif
-      if (nargin > 1 && k == n)
-        ## Input argument n was given, stop when k == n.
-        break;
-      endif
-
-    endwhile
-
-  unwind_protect_cleanup
-    if (use_mkfifo)
-      unlink (gpin_name);
-    endif
-  end_unwind_protect
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_has_feature__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-01-27
-
-function res = __gnuplot_has_feature__ (feature)
-  persistent features = {"x11_figure_position",
-                         "wxt_figure_size",
-                         "transparent_patches",
-                         "transparent_surface",
-                         "epslatex_implies_eps_filesuffix",
-                         "epslatexstandalone_terminal",
-                         "screen_coordinates_for_{lrtb}margin",
-                         "variable_GPVAL_TERMINALS",
-                         "key_has_font_properties",
-                         "windows_figure_position",
-                         "has_termoption_dashed"};
-  persistent has_features;
-
-  if (isempty (has_features))
-    try
-      gnuplot_version = __gnuplot_version__ ();
-    catch
-      ## Don't throw an error if gnuplot isn't installed
-      gnuplot_version = "0.0.0";
-    end_try_catch
-    versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
-    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
-    have_features = false (size (features));
-    for n = 1 : numel (have_features)
-      has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
-    endfor
-  endif
-
-  n = find (strcmpi (feature, features));
-  if (isempty (n))
-    res = NaN;
-  else
-    res = has_features(n);
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_has_terminal__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-09-13
-
-function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
-
-  term = strtrim (term);
-  term = lower (strtok (term, " "));
-
-  if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
-    if (nargin < 2)
-      plot_stream = __gnuplot_open_stream__ (2);
-    endif
-    available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
-    available_terminals = regexp (available_terminals, '\w+', "match");
-    if (nargin < 2 && ! isempty (plot_stream))
-      pclose (plot_stream(1));
-      if (numel (plot_stream) > 1)
-        pclose (plot_stream(2));
-      endif
-      if (numel (plot_stream) > 2)
-        waitpid (plot_stream(3));
-      endif
-    endif
-  else
-    ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
-    ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
-    available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
-                           "dumb", "dxf", "eepic", "emf", "epslatex", ...
-                           "epson_180dpi", "fig", "gif", "gnugraph", ...
-                           "gpic", "hp2623A", "hp2648", "hp500c", ...
-                           "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
-                           "latex", "mf", "mif", "mp", "pbm", "pdf", ...
-                           "pm", "png", "postscript", "pslatex", ...
-                           "pstex", "pstricks", "qms", "regis", "rgip", ...
-                           "svg", "texdraw", "tgif", "tkcanvas", ...
-                           "tpic", "windows", "x11", "xlib", "xterm"};
-  endif
-
-  gnuplot_supports_term = any (strcmp (term, available_terminals));
-
-endfunction
-
--- a/scripts/plot/private/__gnuplot_open_stream__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-## Copyright (C) 2009-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{stream} =} __gnuplot_open_stream__ (@var{npipes}, @var{h})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2009-04-11
-
-function plot_stream = __gnuplot_open_stream__ (npipes, h)
-  [prog, args] = gnuplot_binary ();
-  if (npipes > 1)
-    [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:});
-    if (pid < 0)
-      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
-    else
-      plot_stream(3) = pid;
-    endif
-  else
-    plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
-    if (plot_stream < 0)
-      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
-    endif
-  endif
-  if (nargin > 1)
-    set (h, "__plot_stream__", plot_stream);
-  endif
-endfunction
--- a/scripts/plot/private/__gnuplot_print__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-## Copyright (C) 1999-2012 Daniel Heiserer
-## Copyright (C) 2001 Laurent Mazet
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __gnuplot_print__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
-## Adapted-By: jwe
-
-function opts = __gnuplot_print__ (opts)
-
-  dos_shell = (ispc () && ! isunix ());
-
-  if (isempty (opts.fontsize))
-    ## If no fontsize, determine the nominal axes fontsize.
-    defaultfontsize = get (0, "defaultaxesfontsize");
-    axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize");
-    if (iscell (axesfontsize))
-      axesfontsize = round (median (cell2mat (axesfontsize)));
-    endif
-    if (isempty (axesfontsize))
-      opts.fontsize = defaultfontsize;
-    else
-      opts.fontsize = axesfontsize;
-    endif
-  endif
-  ## The axes-label and tick-label spacing is determined by
-  ## the font spec given in "set terminal ..."
-  gp_opts = font_spec (opts);
-
-  pipeline = "";
-
-  switch (lower (opts.devopt))
-  case {"eps", "eps2", "epsc", "epsc2"}
-    if (any (strcmp (opts.devopt, {"eps", "epsc"})))
-      gp_opts = [gp_opts " level1"];
-    endif
-    if (opts.tight_flag || ! isempty (opts.preview))
-      tmp_file = strcat (tmpnam (), ".eps");
-      eps_drawnow (opts, tmp_file, gp_opts);
-      if (dos_shell)
-        cleanup = [" & del " strrep(tmp_file, '/', '\')];
-      else
-        cleanup = [" ; rm " tmp_file];
-      endif
-      pipeline = {sprintf("%s %s",
-                          opts.epstool_cmd (opts, tmp_file, opts.name),
-                          cleanup)};
-    else
-      eps_drawnow (opts, opts.name, gp_opts);
-    endif
-  case {"epslatex", "pslatex", "pstex", "epslatexstandalone"}
-    dot = find (opts.name == ".", 1, "last");
-    n = find (opts.devopt == "l", 1);
-    suffix = opts.devopt(1:n-1);
-    if (! isempty (dot))
-      if (any (strcmpi (opts.name(dot:end), {strcat(".", suffix), ".tex", "."})))
-        name = opts.name(1:dot-1);
-      else
-        error ("print:invalid-suffix", 
-               "invalid suffix '%s' for device '%s'.",
-               opts.name(dot:end), lower (opts.devopt));
-      endif
-    endif
-    if (strfind (opts.devopt, "standalone"))
-      term = sprintf ("%s ",
-                      strrep (opts.devopt, "standalone", " standalone"));
-    else
-      term = sprintf ("%s ", opts.devopt);
-    endif
-    if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
-      suffix = "tex";
-    else
-      ## Gnuplot 4.0 wants a ".eps" suffix.
-      suffix = "eps";
-    endif
-    local_drawnow ([term " " gp_opts],
-                   strcat (name, ".", suffix), opts);
-  case "tikz"
-    if (__gnuplot_has_terminal__ ("tikz"))
-      local_drawnow (["lua tikz " gp_opts], opts.name, opts);
-    else
-      error (sprintf ("print:no%soutput", opts.devopt),
-             "print.m: '%s' output is not available for gnuplot-%s",
-             upper (opts.devopt), __gnuplot_version__ ());
-    endif
-  case "svg"
-    local_drawnow (["svg dynamic " gp_opts], opts.name, opts);
-  case {"aifm", "corel", "eepic", "emf", "fig"}
-    local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-  case {"pdfcairo", "pngcairo"}
-    if (__gnuplot_has_terminal__ (opts.devopt))
-      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-    else
-      error (sprintf ("print:no%soutput", opts.devopt),
-             "print.m: '%s' output is not available for gnuplot-%s",
-             upper (opts.devopt), __gnuplot_version__ ());
-    endif
-  case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"}
-    local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
-  case opts.ghostscript.device
-    gp_opts = font_spec (opts, "devopt", "eps");
-    opts.ghostscript.output = opts.name;
-    opts.ghostscript.source = strcat (tmpnam (), ".eps");
-    eps_drawnow (opts, opts.ghostscript.source, gp_opts);
-    [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
-    if (opts.send_to_printer || isempty (opts.name))
-      cmd_lpr = opts.lpr_cmd (opts);
-      cmd = [cmd_gs " | " cmd_lpr];
-    else
-      cmd = cmd_gs;
-    endif
-    if (dos_shell)
-      cmd = sprintf ("%s & del %s", cmd, strrep (opts.ghostscript.source, '/', '\'));
-    else
-      cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source);
-    endif
-    if (! isempty (cmd_cleanup))
-      if (dos_shell)
-        pipeline = {[cmd " & " cmd_cleanup]};
-      else
-        pipeline = {[cmd " ; " cmd_cleanup]};
-      endif
-    else
-      pipeline = {cmd};
-    endif
-  otherwise
-    error (sprintf ("print:no%soutput", opts.devopt),
-           "print.m: %s output is not available for the Gnuplot graphics toolkit",
-           upper (opts.devopt));
-  endswitch
-
-
-  opts.pipeline = pipeline;
-
-  for n = 1:numel (pipeline)
-    if (opts.debug)
-      fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n});
-    endif
-    [status, output] = system (pipeline{n});
-    if (status)
-      fprintf ("%s\n%s\n%s\n",
-               "---------- output begin ----------",
-               output,
-               "----------- output end -----------");
-      error ("gnuplot:failedpipe", "print: failed to print");
-    endif
-  endfor
-
-endfunction
-
-function eps_drawnow (opts, epsfile, gp_opts)
-  [h, fontsize] = get_figure_text_objs (opts);
-  unwind_protect
-    fontsize_2x = cellfun (@(x) 2*x, fontsize, "uniformoutput", false);
-    set (h, {"fontsize"}, fontsize_2x);
-    local_drawnow (["postscript eps " gp_opts], epsfile, opts);
-  unwind_protect_cleanup
-    set (h, {"fontsize"}, fontsize);
-  end_unwind_protect
-endfunction
-
-function local_drawnow (term, file, opts)
-  if (opts.use_color < 0)
-    mono = true;
-  else
-    mono = false;
-  endif
-  figure (opts.figure);
-  if (isempty (opts.debug_file) || ! opts.debug)
-    drawnow (term, file, mono);
-  else
-    drawnow (term, file, mono, opts.debug_file);
-  endif
-endfunction
-
-function f = font_spec (opts, varargin)
-  for n = 1:2:numel (varargin)
-    opts.(varargin{n}) = varargin{n+1};
-  endfor
-  f = "";
-  switch (opts.devopt)
-  case "cgm"
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("%d", opts.fontsize);
-    endif
-  case {"eps", "eps2", "epsc", "epsc2"}
-    ## Gnuplot renders fonts as half their specification, which
-    ## results in a tight spacing for the axes-labels and tick-labels.
-    ## Compensate for the half scale. This will produce the proper
-    ## spacing for the requested fontsize.
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("%d", 2 * opts.fontsize);
-    endif
-  case "svg"
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      fontsize = round (opts.fontsize * 0.75);
-      f = sprintf ('fname "%s" fsize %d', opts.font, fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('fname "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      fontsize = round (opts.fontsize * 0.75);
-      f = sprintf ("%s fsize %d", f, fontsize);
-    endif
-  case "pdf"
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("fsize %d", f, opts.fontsize);
-    endif
-  case {"pdfcairo", "pngcairo"}
-    if (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    endif
-  case {"epslatex", "epslatexstandalone"}
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("%d", opts.fontsize);
-    endif
-  case "pslatex"
-    if (! isempty (opts.fontsize))
-      f = sprintf ("%d", opts.fontsize);
-    endif
-  case {"gif", "jpeg", "png"}
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('font "%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ('font "%d"', opts.fontsize);
-    endif
-  case "emf"
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ('"%s" %d', opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ('"%s"', opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("%d", opts.fontsize);
-    endif
-  case "canvas"
-    if (! isempty (opts.fontsize))
-      f = sprintf ("fsize %d", opts.fontsize);
-    endif
-  case {"aifm", "corel"}
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ("%s %d", opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ("%s", opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("%d", opts.fontsize);
-    endif
-  case "fig"
-    if (! isempty (opts.font) && ! isempty (opts.fontsize))
-      f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize);
-    elseif (! isempty (opts.font))
-      f = sprintf ("font %s", opts.font);
-    elseif (! isempty (opts.fontsize))
-      f = sprintf ("fontsize %d", opts.fontsize);
-    endif
-  endswitch
-endfunction
-
-function [h, fontsize] = get_figure_text_objs (opts)
-  h = findall (opts.figure, "-property", "fontsize");
-  hp = get (h, "parent");
-  if (iscell (hp))
-    hp = cell2mat (hp);
-  endif
-  ## Do not change the text objects fontsizes for the children of a
-  ## legend axes.  These will be handled by the fontsize listener.
-  is_legend_key_string = strcmp (get (hp, "tag"), "legend") ...
-                       & isprop (hp, "string") ...
-                       & isprop (hp, "location") ...
-                       & strcmp (get (hp, "type"), "axes");
-  h(is_legend_key_string) = [];
-  fontsize = get (h, "fontsize");
-  switch (numel (fontsize))
-  case 0
-    fontsize = {};
-  case 1
-    fontsize = {fontsize};
-  endswitch
-endfunction
--- a/scripts/plot/private/__gnuplot_version__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-## Copyright (C) 2006-2012 Daniel Sebald
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the version of gnuplot we are using.  Note that we do not
-## attempt to handle the case of the user switching to different
-## versions of gnuplot during the same session.
-
-function version = __gnuplot_version__ ()
-
-  persistent __version__ = "";
-
-  if (isempty (__version__))
-    [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ()));
-    if (status != 0)
-      ## This message ends in a newline so that the traceback messages
-      ## are skipped and people might actually see the message, read it,
-      ## comprehend it, take the advice it gives, and stop asking us
-      ## why plotting fails when gnuplot is not found.
-      error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
-    endif
-    output = strrep (output, "gnuplot", "");
-    output = strrep (output, "patchlevel", ".");
-    output = strrep (output, "\n", "");
-    output = strrep (output, "\r", "");
-    __version__ = strrep (output, " ", "");
-  endif
-
-  version = __version__;
-
-endfunction
-
--- a/scripts/plot/private/__go_draw_axes__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2672 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __go_draw_axes__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __go_draw_axes__ (h, plot_stream, enhanced, mono,
-                           bg_is_set, fg_is_set, hlgnd)
-
-  if (nargin >= 4 && nargin <= 7)
-
-    showhiddenhandles = get (0, "showhiddenhandles");
-    unwind_protect
-      set (0, "showhiddenhandles", "on");
-      axis_obj = __get__ (h);
-    unwind_protect_cleanup
-      set (0, "showhiddenhandles", showhiddenhandles);
-    end_unwind_protect
-
-    parent_figure_obj = get (axis_obj.parent);
-    gnuplot_term = __gnuplot_get_var__ (axis_obj.parent, "GPVAL_TERM");
-
-    ## Set to false for plotyy axes.
-    ymirror = true;
-    if (isfield (axis_obj, "__plotyy_axes__"))
-      if (all (ishandle (axis_obj.__plotyy_axes__)))
-        ymirror = false;
-      else
-        h = axis_obj.__plotyy_axes__;
-        h = h(ishandle (h));
-        h = h(isprop (h, "__plotyy_axes__"));
-        rmappdata (h, "__plotyy_axes__");
-      endif
-    endif
-
-    nd = __calc_dimensions__ (h);
-
-    if (strcmp (axis_obj.dataaspectratiomode, "manual")
-        && strcmp (axis_obj.xlimmode, "manual")
-        && strcmp (axis_obj.ylimmode, "manual"))
-      ## All can't be "manual"
-      axis_obj.plotboxaspectratiomode = "auto";
-    endif
-
-    if (strcmp (axis_obj.dataaspectratiomode, "manual")
-        && strcmp (axis_obj.xlimmode, "manual")
-        && strcmp (axis_obj.ylimmode, "manual")
-        && (nd == 2 || all (mod (axis_obj.view, 90) == 0)))
-      ## FIXME - adjust plotboxaspectratio to respect other
-      fpos = get (axis_obj.parent, "position");
-      apos = axis_obj.position;
-    endif
-
-    pos = __actual_axis_position__ (h);
-
-    if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-      dr = axis_obj.dataaspectratio;
-      if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-        dr = dr(1) / dr(2);
-      else
-        ## FIXME - need to properly implement 3D
-        dr = mean (dr(1:2)) / dr(3);
-      endif
-    else
-      dr = 1;
-    endif
-
-    if (strcmp (axis_obj.activepositionproperty, "position"))
-      if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
-        if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
-          x = [1, 1];
-        else
-          ## 3D plots need to be sized down to fit in the window.
-          x = 1.0 ./ sqrt ([2, 2.5]);
-        endif
-        fprintf (plot_stream, "set tmargin screen %.15g;\n",
-                 pos(2)+pos(4)/2+x(2)*pos(4)/2);
-        fprintf (plot_stream, "set bmargin screen %.15g;\n",
-                 pos(2)+pos(4)/2-x(2)*pos(4)/2);
-        fprintf (plot_stream, "set lmargin screen %.15g;\n",
-                 pos(1)+pos(3)/2-x(1)*pos(3)/2);
-        fprintf (plot_stream, "set rmargin screen %.15g;\n",
-                 pos(1)+pos(3)/2+x(1)*pos(3)/2);
-        sz_str = "";
-      else
-        fprintf (plot_stream, "set tmargin 0;\n");
-        fprintf (plot_stream, "set bmargin 0;\n");
-        fprintf (plot_stream, "set lmargin 0;\n");
-        fprintf (plot_stream, "set rmargin 0;\n");
-
-        if (nd == 3 && all (axis_obj.view == [0, 90]))
-          ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot
-          pos(3:4) = pos(3:4) * 1.4;
-          pos(1:2) = pos(1:2) - pos(3:4) * 0.125;
-        endif
-
-        fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
-
-        if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-          sz_str = sprintf ("set size ratio %.15g", -dr);
-        else
-          sz_str = "set size noratio";
-        endif
-        sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4));
-      endif
-    else ## activepositionproperty == outerposition
-      fprintf (plot_stream, "unset tmargin;\n");
-      fprintf (plot_stream, "unset bmargin;\n");
-      fprintf (plot_stream, "unset lmargin;\n");
-      fprintf (plot_stream, "unset rmargin;\n");
-      fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2));
-      sz_str = "";
-      if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
-        sz_str = sprintf ("ratio %g", -dr);
-      else
-        sz_str = "noratio";
-      endif
-      sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4));
-    endif
-    if (! isempty (sz_str))
-      fputs (plot_stream, sz_str);
-    endif
-
-    ## Reset all labels, axis-labels, tick-labels, and title
-    ## FIXME - We should have an function to initialize the axis.
-    ##         Presently, this is dispersed in this function.
-    fputs (plot_stream, "unset label;\n");
-    fputs (plot_stream, "unset xtics;\n");
-    fputs (plot_stream, "unset ytics;\n");
-    fputs (plot_stream, "unset ztics;\n");
-    fputs (plot_stream, "unset x2tics;\n");
-    fputs (plot_stream, "unset x2tics;\n");
-
-    if (! isempty (axis_obj.title))
-      t = get (axis_obj.title);
-      if (isempty (t.string))
-        fputs (plot_stream, "unset title;\n");
-      else
-        [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-        fontspec = create_fontspec (f, s, gnuplot_term);
-        fprintf (plot_stream, "set title \"%s\" %s %s;\n",
-                 undo_string_escapes (tt), fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-      endif
-    endif
-
-    if (! isempty (axis_obj.xlabel))
-      t = get (axis_obj.xlabel);
-      angle = t.rotation;
-      colorspec = get_text_colorspec (axis_obj.xcolor, mono);
-      if (isempty (t.string))
-        fprintf (plot_stream, "unset xlabel;\n");
-        fprintf (plot_stream, "unset x2label;\n");
-      else
-        [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-        fontspec = create_fontspec (f, s, gnuplot_term);
-        if (strcmpi (axis_obj.xaxislocation, "top"))
-          fprintf (plot_stream, "set x2label \"%s\" %s %s %s",
-                   undo_string_escapes (tt), colorspec, fontspec,
-                   __do_enhanced_option__ (enhanced, t));
-        else
-          fprintf (plot_stream, "set xlabel \"%s\" %s %s %s",
-                   undo_string_escapes (tt), colorspec, fontspec,
-                   __do_enhanced_option__ (enhanced, t));
-        endif
-        fprintf (plot_stream, " rotate by %f;\n", angle);
-        if (strcmpi (axis_obj.xaxislocation, "top"))
-          fprintf (plot_stream, "unset xlabel;\n");
-        else
-          fprintf (plot_stream, "unset x2label;\n");
-        endif
-      endif
-    endif
-
-    if (! isempty (axis_obj.ylabel))
-      t = get (axis_obj.ylabel);
-      angle = t.rotation;
-      colorspec = get_text_colorspec (axis_obj.ycolor, mono);
-      if (isempty (t.string))
-        fprintf (plot_stream, "unset ylabel;\n");
-        fprintf (plot_stream, "unset y2label;\n");
-      else
-        [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-        fontspec = create_fontspec (f, s, gnuplot_term);
-        if (strcmpi (axis_obj.yaxislocation, "right"))
-          fprintf (plot_stream, "set y2label \"%s\" %s %s %s",
-                   undo_string_escapes (tt), colorspec, fontspec,
-                   __do_enhanced_option__ (enhanced, t));
-        else
-          fprintf (plot_stream, "set ylabel \"%s\" %s %s %s",
-                   undo_string_escapes (tt), colorspec, fontspec,
-                   __do_enhanced_option__ (enhanced, t));
-        endif
-        fprintf (plot_stream, " rotate by %f;\n", angle);
-        if (strcmpi (axis_obj.yaxislocation, "right"))
-          fprintf (plot_stream, "unset ylabel;\n");
-        else
-          fprintf (plot_stream, "unset y2label;\n");
-        endif
-      endif
-    endif
-
-    if (! isempty (axis_obj.zlabel))
-      t = get (axis_obj.zlabel);
-      angle = t.rotation;
-      colorspec = get_text_colorspec (axis_obj.zcolor, mono);
-      if (isempty (t.string))
-        fputs (plot_stream, "unset zlabel;\n");
-      else
-        [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
-        fontspec = create_fontspec (f, s, gnuplot_term);
-        fprintf (plot_stream, "set zlabel \"%s\" %s %s %s",
-                 undo_string_escapes (tt), colorspec, fontspec,
-                 __do_enhanced_option__ (enhanced, t));
-        fprintf (plot_stream, " rotate by %f;\n", angle);
-      endif
-    endif
-
-    if (strcmpi (axis_obj.xaxislocation, "top"))
-      xaxisloc = "x2";
-      xaxisloc_using = "x2";
-    else
-      xaxisloc = "x";
-      xaxisloc_using = "x1";
-      if (strcmpi (axis_obj.xaxislocation, "zero"))
-        fputs (plot_stream, "set xzeroaxis;\n");
-      endif
-    endif
-    if (strcmpi (axis_obj.yaxislocation, "right"))
-      yaxisloc = "y2";
-      yaxisloc_using = "y2";
-    else
-      yaxisloc = "y";
-      yaxisloc_using = "y1";
-      if (strcmpi (axis_obj.yaxislocation, "zero"))
-        fputs (plot_stream, "set yzeroaxis;\n");
-      endif
-    endif
-
-    have_grid = false;
-
-    if (strcmpi (axis_obj.xgrid, "on"))
-      have_grid = true;
-      fprintf (plot_stream, "set grid %stics;\n", xaxisloc);
-    else
-      fprintf (plot_stream, "set grid no%stics;\n", xaxisloc);
-    endif
-
-    if (strcmpi (axis_obj.ygrid, "on"))
-      have_grid = true;
-      fprintf (plot_stream, "set grid %stics;\n", yaxisloc);
-    else
-      fprintf (plot_stream, "set grid no%stics;\n", yaxisloc);
-    endif
-
-    if (strcmpi (axis_obj.zgrid, "on"))
-      have_grid = true;
-      fputs (plot_stream, "set grid ztics;\n");
-    else
-      fputs (plot_stream, "set grid noztics;\n");
-    endif
-
-    if (strcmpi (axis_obj.xminorgrid, "on"))
-      have_grid = true;
-      if (strcmp (axis_obj.xscale, "log"))
-        m = 10;
-      else
-        m = 5;
-      endif
-      fprintf (plot_stream, "set m%stics %d;\n", xaxisloc, m);
-      fprintf (plot_stream, "set grid m%stics;\n", xaxisloc);
-    else
-      fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc);
-    endif
-
-    if (strcmpi (axis_obj.yminorgrid, "on"))
-      have_grid = true;
-      if (strcmp (axis_obj.yscale, "log"))
-        m = 10;
-      else
-        m = 5;
-      endif
-      fprintf (plot_stream, "set m%stics %d;\n", yaxisloc, m);
-      fprintf (plot_stream, "set grid m%stics;\n", yaxisloc);
-    else
-      fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc);
-    endif
-
-    if (strcmpi (axis_obj.zminorgrid, "on"))
-      have_grid = true;
-      if (strcmp (axis_obj.zscale, "log"))
-        m = 10;
-      else
-        m = 5;
-      endif
-      fprintf (plot_stream, "set mztics %d;\n", m);
-      fputs (plot_stream, "set grid mztics;\n");
-    else
-      fputs (plot_stream, "set grid nomztics;\n");
-    endif
-
-    ## The grid front/back/layerdefault option also controls the
-    ## appearance of tics, so it is used even if the grid is absent.
-    if (strcmpi (axis_obj.layer, "top"))
-      fputs (plot_stream, "set grid front;\n");
-      fputs (plot_stream, "set border front;\n");
-    else
-      fputs (plot_stream, "set grid layerdefault;\n");
-      ## FIXME -- the gnuplot help says that "layerdefault" should work
-      ## for set border too, but it fails for me with gnuplot 4.2.5.  So
-      ## use "back" instead.
-      fputs (plot_stream, "set border back;\n");
-    endif
-
-    fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n",
-             axis_obj.linewidth, axis_obj.linewidth);
-
-    if (! have_grid)
-      fputs (plot_stream, "unset grid;\n");
-    endif
-
-    xlogscale = strcmpi (axis_obj.xscale, "log");
-    ylogscale = strcmpi (axis_obj.yscale, "log");
-    zlogscale = strcmpi (axis_obj.zscale, "log");
-
-    ## Detect logscale and negative lims
-    if (xlogscale && all (axis_obj.xlim < 0))
-      axis_obj.xsgn = -1;
-      if (strcmp (axis_obj.xdir, "reverse"))
-        axis_obj.xdir = "normal";
-      elseif (strcmp (axis_obj.xdir, "normal"))
-        axis_obj.xdir = "reverse";
-      endif
-      axis_obj.xtick = -flip (axis_obj.xtick);
-      axis_obj.xticklabel = flip (axis_obj.xticklabel);
-      axis_obj.xlim = -flip (axis_obj.xlim);
-    else
-      axis_obj.xsgn = 1;
-    endif
-    if (ylogscale && all (axis_obj.ylim < 0))
-      axis_obj.ysgn = -1;
-      if (strcmp (axis_obj.ydir, "reverse"))
-        axis_obj.ydir = "normal";
-      elseif (strcmp (axis_obj.ydir, "normal"))
-        axis_obj.ydir = "reverse";
-      endif
-      axis_obj.ytick = -flip (axis_obj.ytick);
-      axis_obj.yticklabel = flip (axis_obj.yticklabel);
-      axis_obj.ylim = -flip (axis_obj.ylim);
-    else
-      axis_obj.ysgn = 1;
-    endif
-    if (zlogscale && all (axis_obj.zlim < 0))
-      axis_obj.zsgn = -1;
-      if (strcmp (axis_obj.zdir, "reverse"))
-        axis_obj.zdir = "normal";
-      elseif (strcmp (axis_obj.zdir, "normal"))
-        axis_obj.zdir = "reverse";
-      endif
-      axis_obj.ztick = -flip (axis_obj.ztick);
-      axis_obj.zticklabel = flip (axis_obj.zticklabel);
-      axis_obj.zlim = -flip (axis_obj.zlim);
-    else
-      axis_obj.zsgn = 1;
-    endif
-
-    xlim = axis_obj.xlim;
-    ylim = axis_obj.ylim;
-    zlim = axis_obj.zlim;
-    clim = axis_obj.clim;
-
-    do_tics (axis_obj, plot_stream, ymirror, mono, gnuplot_term);
-
-    fputs (plot_stream, "unset logscale;\n");
-    if (xlogscale)
-      fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
-    endif
-    if (ylogscale)
-      fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
-    endif
-    if (zlogscale)
-      fputs (plot_stream, "set logscale z;\n");
-    endif
-
-    xautoscale = strcmpi (axis_obj.xlimmode, "auto");
-    yautoscale = strcmpi (axis_obj.ylimmode, "auto");
-    zautoscale = strcmpi (axis_obj.zlimmode, "auto");
-    cautoscale = strcmpi (axis_obj.climmode, "auto");
-    cdatadirect = false;
-    truecolor = false;
-
-    fputs (plot_stream, "set clip two;\n");
-
-    kids = axis_obj.children;
-    ## Remove the axis labels and title from the children, and
-    ## preserved the original order.
-    [jnk, k] = setdiff (kids, [axis_obj.xlabel; axis_obj.ylabel; ...
-                               axis_obj.zlabel; axis_obj.title]);
-    kids = kids (sort (k));
-
-    if (nd == 3)
-      fputs (plot_stream, "set parametric;\n");
-      fputs (plot_stream, "set style data lines;\n");
-      fputs (plot_stream, "set surface;\n");
-      fputs (plot_stream, "unset contour;\n");
-    endif
-
-    data_idx = 0;
-    data = cell ();
-    is_image_data = [];
-    hidden_removal = NaN;
-    view_map = false;
-
-    if (! cautoscale && clim(1) == clim(2))
-      clim(2)++;
-    endif
-    addedcmap = [];
-
-    ximg_data = {};
-    ximg_data_idx = 0;
-
-    while (! isempty (kids))
-
-      obj = get (kids(end));
-
-      if (isfield (obj, "xdata"))
-        obj.xdata = double (obj.xdata);
-      end
-      if (isfield (obj, "ydata"))
-        obj.ydata = double (obj.ydata);
-      end
-      if (isfield (obj, "zdata"))
-        obj.zdata = double (obj.zdata);
-      end
-
-      if (isfield (obj, "units"))
-        units = obj.units;
-        unwind_protect
-          set (kids(end), "units", "data");
-          obj = get (kids(end));
-        unwind_protect_cleanup
-          set (kids(end), "units", units);
-        end_unwind_protect
-      endif
-      kids = kids(1:(end-1));
-
-      if (strcmp (obj.visible, "off"))
-        continue;
-      endif
-
-      if (xlogscale && isfield (obj, "xdata"))
-        obj.xdata = axis_obj.xsgn * obj.xdata;
-        obj.xdata(obj.xdata<=0) = NaN;
-      endif
-      if (ylogscale && isfield (obj, "ydata"))
-        obj.ydata = axis_obj.ysgn * obj.ydata;
-        obj.ydata(obj.ydata<=0) = NaN;
-      endif
-      if (zlogscale && isfield (obj, "zdata"))
-        obj.zdata = axis_obj.zsgn * obj.zdata;
-        obj.zdata(obj.zdata<=0) = NaN;
-      endif
-
-      ## Check for facecolor interpolation for surfaces.
-      doing_interp_color = ...
-         isfield (obj, "facecolor") && strncmp (obj.facecolor, "interp", 6);
-
-      switch (obj.type)
-        case "image"
-          img_data = obj.cdata;
-          img_xdata = obj.xdata;
-          img_ydata = obj.ydata;
-
-          if (ndims (img_data) == 3)
-            truecolor = true;
-          elseif (strcmpi (obj.cdatamapping, "direct"))
-            cdatadirect = true;
-          endif
-          data_idx++;
-          is_image_data(data_idx) = true;
-          parametric(data_idx) = false;
-          have_cdata(data_idx) = false;
-          have_3d_patch(data_idx) = false;
-
-          if (img_xdata(2) < img_xdata(1))
-            img_xdata = img_xdata(2:-1:1);
-            img_data = img_data(:,end:-1:1,:);
-          elseif (img_xdata(1) == img_xdata(2))
-            img_xdata = img_xdata(1) + [0, columns(img_data)-1];
-          endif
-          if (img_ydata(2) < img_ydata(1))
-            img_ydata = img_ydata(2:-1:1);
-            img_data = img_data(end:-1:1,:,:);
-          elseif (img_ydata(1) == img_ydata(2))
-            img_ydata = img_ydata(1) + [0, rows(img_data)-1];
-          endif
-
-          [y_dim, x_dim] = size (img_data(:,:,1));
-          if (x_dim > 1)
-            dx = abs (img_xdata(2)-img_xdata(1))/(x_dim-1);
-          else
-            x_dim = 2;
-            img_data = [img_data, img_data];
-            dx = abs (img_xdata(2)-img_xdata(1));
-          endif
-          if (y_dim > 1)
-            dy = abs (img_ydata(2)-img_ydata(1))/(y_dim-1);
-          else
-            y_dim = 2;
-            img_data = [img_data; img_data];
-            dy = abs (img_ydata(2)-img_ydata(1));
-          endif
-
-          x_origin = min (img_xdata);
-          y_origin = min (img_ydata);
-
-          if (ndims (img_data) == 3)
-            data{data_idx} = permute (img_data, [3, 1, 2])(:);
-            format = "1:2:3";
-            imagetype = "rgbimage";
-          else
-            data{data_idx} = img_data(:);
-            format = "1";
-            imagetype = "image";
-          endif
-
-          titlespec{data_idx} = "title \"\"";
-          usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s",
-              x_dim, y_dim, x_origin, y_origin, dx, dy, format);
-          withclause{data_idx} = sprintf ("with %s;", imagetype);
-
-        case "line"
-          if (strncmp (obj.linestyle, "none", 4)
-              && (! isfield (obj, "marker")
-                  || (isfield (obj, "marker")
-                      && strncmp (obj.marker, "none", 4))))
-            continue;
-          endif
-          data_idx++;
-          is_image_data(data_idx) = false;
-          parametric(data_idx) = true;
-          have_cdata(data_idx) = false;
-          have_3d_patch(data_idx) = false;
-          if (isempty (obj.displayname))
-            titlespec{data_idx} = "title \"\"";
-          else
-            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-            titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
-          endif
-          usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
-          errbars = "";
-          if (nd == 3)
-            xdat = obj.xdata(:);
-            ydat = obj.ydata(:);
-            if (! isempty (obj.zdata))
-              zdat = obj.zdata(:);
-            else
-              zdat = zeros (size (xdat));
-            endif
-            data{data_idx} = [xdat, ydat, zdat]';
-            usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat));
-            ## fputs (plot_stream, "set parametric;\n");
-          else
-            xdat = obj.xdata(:);
-            ydat = obj.ydata(:);
-            data{data_idx} = [xdat, ydat]';
-            usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s",
-                                            rows (xdat), xaxisloc_using, yaxisloc_using);
-          endif
-
-          style = do_linestyle_command (obj, obj.color, data_idx, mono,
-                                        plot_stream, errbars);
-
-          withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                          style{1}, data_idx);
-
-          if (length (style) > 1)
-            data_idx++;
-            is_image_data(data_idx) = is_image_data(data_idx - 1);
-            parametric(data_idx) = parametric(data_idx - 1);
-            have_cdata(data_idx) = have_cdata(data_idx - 1);
-            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-            titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = usingclause{data_idx - 1};
-            data{data_idx} = data{data_idx - 1};
-            withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                          style{2}, data_idx);
-          endif
-          if (length (style) > 2)
-            data_idx++;
-            is_image_data(data_idx) = is_image_data(data_idx - 1);
-            parametric(data_idx) = parametric(data_idx - 1);
-            have_cdata(data_idx) = have_cdata(data_idx - 1);
-            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-            titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = usingclause{data_idx - 1};
-            data{data_idx} = data{data_idx - 1};
-            withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                          style{3}, data_idx);
-          endif
-
-       case "patch"
-         cmap = parent_figure_obj.colormap;
-         [nr, nc] = size (obj.xdata);
-
-         if (! isempty (obj.cdata))
-           cdat = obj.cdata;
-           if (strcmpi (obj.cdatamapping, "direct"))
-             cdatadirect = true;
-           endif
-         else
-           cdat = [];
-         endif
-
-         data_3d_idx = NaN;
-         for i = 1:nc
-           xcol = obj.xdata(:,i);
-           ycol = obj.ydata(:,i);
-           if (nd == 3)
-             if (! isempty (obj.zdata))
-               zcol = obj.zdata(:,i);
-             else
-               zcol = zeros (size (xcol));
-             endif
-           endif
-
-           if (! isnan (xcol) && ! isnan (ycol))
-             ## Is the patch closed or not
-             if (strncmp (obj.facecolor, "none", 4))
-               hidden_removal = false;
-             else
-
-               if (isnan (hidden_removal))
-                 hidden_removal = true;
-               endif
-               if (nd == 3)
-                 if (numel (xcol) > 3)
-                   error ("__go_draw_axes__: gnuplot (as of v4.2) only supports 3D filled triangular patches");
-                 else
-                   if (isnan (data_3d_idx))
-                     data_idx++;
-                     data_3d_idx = data_idx;
-                     is_image_data(data_idx) = false;
-                     parametric(data_idx) = false;
-                     have_cdata(data_idx) = true;
-                     have_3d_patch(data_idx) = true;
-                     withclause{data_3d_idx} = sprintf ("with pm3d");
-                     usingclause{data_3d_idx} =  "using 1:2:3:4";
-                     data{data_3d_idx} = [];
-                   endif
-                   local_idx = data_3d_idx;
-                   ccdat = NaN;
-                 endif
-               else
-                 data_idx++;
-                 local_idx = data_idx;
-                 is_image_data(data_idx) = false;
-                 parametric(data_idx) = false;
-                 have_cdata(data_idx) = false;
-                 have_3d_patch(data_idx) = false;
-               endif
-
-               if (i > 1 || isempty (obj.displayname))
-                 titlespec{local_idx} = "title \"\"";
-               else
-                 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-                 titlespec{local_idx} = cstrcat ("title \"", tmp, "\"");
-               endif
-               if (isfield (obj, "facecolor"))
-                 if ((strncmp (obj.facecolor, "flat", 4)
-                     || strncmp (obj.facecolor, "interp", 6))
-                     && isfield (obj, "cdata"))
-                   if (ndims (obj.cdata) == 2
-                       && (columns (obj.cdata) == nc
-                           && (rows (obj.cdata) == 1
-                               || rows (obj.cdata) == 3)))
-                     ccol = cdat (:, i);
-                   elseif (ndims (obj.cdata) == 2
-                       && (rows (obj.cdata) == nc
-                           && (columns (obj.cdata) == 1
-                               || columns (obj.cdata) == 3)))
-                     ccol = cdat (i, :);
-                   elseif (ndims (obj.cdata) == 3)
-                     ccol = permute (cdat (:, i, :), [1, 3, 2]);
-                   else
-                     ccol = cdat;
-                   endif
-                   if (strncmp (obj.facecolor, "flat", 4))
-                     if (isequal (size (ccol), [1, 3]))
-                       ## RGB Triplet
-                       color = ccol;
-                     elseif (nd == 3 && numel (xcol) == 3)
-                       ccdat = ccol;
-                     else
-                       if (cdatadirect)
-                         r = round (ccol);
-                       else
-                         r = 1 + round ((rows (cmap) - 1)
-                                        * (ccol - clim(1))/(clim(2) - clim(1)));
-                       endif
-                       r = max (1, min (r, rows (cmap)));
-                       color = cmap(r, :);
-                     endif
-                   elseif (strncmp (obj.facecolor, "interp", 6))
-                     if (nd == 3 && numel (xcol) == 3)
-                       ccdat = ccol;
-                       if (! isvector (ccdat))
-                         tmp = rows (cmap) + rows (addedcmap) + ...
-                              [1 : rows(ccdat)];
-                         addedcmap = [addedcmap; ccdat];
-                         ccdat = tmp(:);
-                       else
-                         ccdat = ccdat(:);
-                       endif
-                     else
-                       if (sum (diff (ccol)))
-                         warning ("\"interp\" not supported, using 1st entry of cdata");
-                       endif
-                       if (cdatadirect)
-                         r = round (ccol);
-                       else
-                         r = 1 + round ((rows (cmap) - 1)
-                                        * (ccol - clim(1))/(clim(2) - clim(1)));
-                       endif
-                       r = max (1, min (r, rows (cmap)));
-                       color = cmap(r(1),:);
-                     endif
-                   endif
-                 elseif (isnumeric (obj.facecolor))
-                   color = obj.facecolor;
-                 else
-                   color = [0, 1, 0];
-                 endif
-               else
-                 color = [0, 1, 0];
-               endif
-
-               if (nd == 3 && numel (xcol) == 3)
-                 if (isnan (ccdat))
-                   ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1);
-                   addedcmap = [addedcmap; reshape(color, 1, 3)];
-                 endif
-                 data{data_3d_idx} = [data{data_3d_idx}, ...
-                                      [[xcol; xcol(end)], [ycol; ycol(end)], ...
-                                      [zcol; zcol(end)], [ccdat; ccdat(end)]]'];
-               else
-                 if (mono)
-                   colorspec = "";
-                 elseif (__gnuplot_has_feature__ ("transparent_patches")
-                         && isscalar (obj.facealpha))
-                   colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f",
-                                      round (255*color), obj.facealpha);
-                 else
-                   colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                        round (255*color));
-                 endif
-
-                 withclause{data_idx} = sprintf ("with filledcurve %s",
-                                               colorspec);
-                 data{data_idx} = [xcol, ycol]';
-                 usingclause{data_idx} = sprintf ("record=%d using ($1):($2)",
-                                                  numel (xcol));
-               endif
-             endif
-           endif
-
-           ## patch outline
-           if (!(strncmp (obj.edgecolor, "none", 4)
-                  && (strncmp (obj.marker, "none", 4)
-                      || (strncmp (obj.markeredgecolor, "none", 4)
-                          && strncmp (obj.markerfacecolor, "none", 4)))))
-
-             data_idx++;
-             is_image_data(data_idx) = false;
-             parametric(data_idx) = false;
-             have_cdata(data_idx) = false;
-             have_3d_patch(data_idx) = false;
-             titlespec{data_idx} = "title \"\"";
-             usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
-
-             if (isfield (obj, "markersize"))
-               mdat = obj.markersize / 3;
-             endif
-
-             if (isfield (obj, "edgecolor"))
-               ## FIXME
-               ## This is the wrong thing to do as edgecolor, markeredgecolor
-               ## and markerfacecolor can have different values and we should
-               ## treat them seperately. However, the below allow the scatter
-               ## functions to work as expected, where only one of these values
-               ## is set
-               if (strncmp (obj.edgecolor, "none", 4))
-                 if (strncmp (obj.markeredgecolor, "none", 4))
-                   ec = obj.markerfacecolor;
-                 else
-                   ec = obj.markeredgecolor;
-                 endif
-               else
-                 ec = obj.edgecolor;
-               endif
-
-               if ((strncmp (ec, "flat", 4)
-                    || strncmp (ec, "interp", 6))
-                   && isfield (obj, "cdata"))
-                 if (ndims (obj.cdata) == 2
-                     && (columns (obj.cdata) == nc
-                         && (rows (obj.cdata) == 1
-                             || rows (obj.cdata) == 3)))
-                   ccol = cdat (:, i);
-                 elseif (ndims (obj.cdata) == 2
-                         && (rows (obj.cdata) == nc
-                             && (columns (obj.cdata) == 1
-                                 || columns (obj.cdata) == 3)))
-                   ccol = cdat (i, :);
-                 elseif (ndims (obj.cdata) == 3)
-                   ccol = permute (cdat (:, i, :), [1, 3, 2]);
-                 else
-                   ccol = cdat;
-                 endif
-                 if (strncmp (ec, "flat", 4))
-                   if (numel (ccol) == 3)
-                     color = ccol;
-                   else
-                     if (isscalar (ccol))
-                       ccol = repmat (ccol, numel (xcol), 1);
-                     endif
-                     color = "flat";
-                     have_cdata(data_idx) = true;
-                   endif
-                 elseif (strncmp (ec, "interp", 6))
-                   if (numel (ccol) == 3)
-                     warning ("\"interp\" not supported, using 1st entry of cdata");
-                     color = ccol(1,:);
-                   else
-                     if (isscalar (ccol))
-                       ccol = repmat (ccol, numel (xcol), 1);
-                     endif
-                     color = "interp";
-                     have_cdata(data_idx) = true;
-                   endif
-                 endif
-               elseif (isnumeric (ec))
-                 color = ec;
-               else
-                 color = [0, 0, 0];
-               endif
-             else
-               color = [0, 0, 0];
-             endif
-
-             if (isfield (obj, "linestyle"))
-               switch (obj.linestyle)
-                 case "-"
-                   lt = "lt 1";
-                 case "--"
-                   lt = "lt 2";
-                 case ":"
-                   lt = "lt 3";
-                 case "-."
-                   lt = "lt 6";
-                 case "none"
-                   lt = "";
-                 otherwise
-                   lt = "";
-               endswitch
-             else
-               lt = "";
-             endif
-
-             if (isfield (obj, "linewidth"))
-               lw = sprintf ("linewidth %f", obj.linewidth);
-             else
-               lw  = "";
-             endif
-
-             [pt, pt2, obj] = gnuplot_pointtype (obj);
-             if (! isempty (pt))
-               pt = sprintf ("pointtype %s", pt);
-             endif
-             if (! isempty (pt2))
-               pt2 = sprintf ("pointtype %s", pt2);
-             endif
-
-             if (mono)
-               colorspec = "";
-             else
-               if (ischar (color))
-                 colorspec = "palette";
-               else
-                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                      round (255*color));
-               endif
-             endif
-
-             sidx = 1;
-             if (isempty (lt))
-               style = "";
-             else
-               style = "lines";
-             endif
-             tmpwith = {};
-
-             facesame = true;
-             if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
-                 && !strncmp (obj.markerfacecolor, "none", 4))
-               if (strncmp (obj.markerfacecolor, "auto", 4)
-                   || ! isnumeric (obj.markerfacecolor)
-                   || (isnumeric (obj.markerfacecolor)
-                       && isequal (color, obj.markerfacecolor)))
-                 style = strcat (style, "points");
-                 if (isfield (obj, "markersize"))
-                   if (length (mdat) == nc)
-                     m = mdat(i);
-                   else
-                     m = mdat;
-                   endif
-                   ps = sprintf ("pointsize %f", m / 3);
-                 else
-                   ps = "";
-                 endif
-
-                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                          style, lw, pt2, lt, ps,
-                                          colorspec);
-               else
-                 facesame = false;
-                 if (! isempty (style))
-                   tmpwith{sidx} = sprintf ("with %s %s %s %s",
-                                            style, lw, lt,
-                                            colorspec);
-                   sidx ++;
-                 endif
-                 if (isnumeric (obj.markerfacecolor) && ! mono)
-                   colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                        round (255*obj.markerfacecolor));
-                 endif
-                 style = "points";
-                 if (isfield (obj, "markersize"))
-                   if (length (mdat) == nc)
-                     m = mdat(i);
-                   else
-                     m = mdat;
-                   endif
-                   ps = sprintf ("pointsize %f", m / 3);
-                 else
-                   ps = "";
-                 endif
-                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                          style, lw, pt2, lt, ps,
-                                          colorspec);
-               endif
-             endif
-
-             if (isfield (obj, "markeredgecolor")
-                 && !strncmp (obj.markeredgecolor, "none", 4))
-               if (facesame && !isempty (pt)
-                   && (strncmp (obj.markeredgecolor, "auto", 4)
-                       || ! isnumeric (obj.markeredgecolor)
-                       || (isnumeric (obj.markeredgecolor)
-                           && isequal (color, obj.markeredgecolor))))
-                 if (sidx == 1 && ((length (style) == 5
-                          && strncmp (style, "lines", 5))
-                         || isempty (style)))
-                   style = strcat (style, "points");
-                   if (isfield (obj, "markersize"))
-                     if (length (mdat) == nc)
-                       m = mdat(i);
-                     else
-                       m = mdat;
-                     endif
-                     ps = sprintf ("pointsize %f", m / 3);
-                   else
-                     ps = "";
-                   endif
-                   tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                            style, lw, pt, lt, ps,
-                                            colorspec);
-                 endif
-               else
-                 if (!isempty (style))
-                   if (length (tmpwith) < sidx || isempty (tmpwith{sidx}))
-                     tmpwith{sidx} = sprintf ("with %s %s %s %s",
-                                              style, lw, lt,
-                                              colorspec);
-                   endif
-                   sidx ++;
-                 endif
-
-                 if (!isempty (pt))
-                   if (! mono)
-                     if (strncmp (obj.markeredgecolor, "auto", 4))
-                       colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                            round (255*color));
-                     elseif (isnumeric (obj.markeredgecolor) && ! mono)
-                       colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                            round (255*obj.markeredgecolor));
-                     endif
-                   endif
-                   style = "points";
-                   if (isfield (obj, "markersize"))
-                     if (length (mdat) == nc)
-                       m = mdat(i);
-                     else
-                       m = mdat;
-                     endif
-                     ps = sprintf ("pointsize %f", m / 3);
-                   else
-                     ps = "";
-                   endif
-                   tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
-                                            style, lw, pt, lt, ps,
-                                            colorspec);
-                 endif
-               endif
-             endif
-
-             if (isempty (tmpwith))
-               withclause{data_idx} = sprintf ("with %s %s %s %s %s",
-                                               style, lw, pt, lt,
-                                               colorspec);
-             else
-               withclause{data_idx} = tmpwith{1};
-             endif
-             if (nd == 3)
-               if (ischar (color))
-                 if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
-                   data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                     [zcol; zcol(1)], [ccol; ccol(1)]]';
-                 else
-                   data{data_idx} = [xcol, ycol, zcol, ccol]';
-                 endif
-                 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", columns (data{data_idx}));
-               else
-                 if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
-                   data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                     [zcol; zcol(1)]]';
-                 else
-                   data{data_idx} = [xcol, ycol, zcol]';
-                 endif
-                 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
-               endif
-             else
-               if (ischar (color))
-                 if (! isnan (xcol) && ! isnan (ycol))
-                   data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
-                                     [ccol; ccol(1)]]';
-                 else
-                   data{data_idx} = [xcol, ycol, ccol]';
-                 endif
-                 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
-               else
-                 if (! isnan (xcol) && ! isnan (ycol))
-                   data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]';
-                 else
-                   data{data_idx} = [xcol, ycol]';
-                 endif
-                 usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx}));
-               endif
-             endif
-
-             if (length (tmpwith) > 1)
-               data_idx++;
-               is_image_data(data_idx) = is_image_data(data_idx - 1);
-               parametric(data_idx) = parametric(data_idx - 1);
-               have_cdata(data_idx) = have_cdata(data_idx - 1);
-               have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-               titlespec{data_idx} = "title \"\"";
-               usingclause{data_idx} = usingclause{data_idx - 1};
-               data{data_idx} = data{data_idx - 1};
-               withclause{data_idx} = tmpwith{2};
-             endif
-             if (length (tmpwith) > 2)
-               data_idx++;
-               is_image_data(data_idx) = is_image_data(data_idx - 1);
-               parametric(data_idx) = parametric(data_idx - 1);
-               have_cdata(data_idx) = have_cdata(data_idx - 1);
-               have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-               titlespec{data_idx} = "title \"\"";
-               usingclause{data_idx} = usingclause{data_idx - 1};
-               data{data_idx} = data{data_idx - 1};
-               withclause{data_idx} = tmpwith{3};
-             endif
-           endif
-         endfor
-
-        case "surface"
-          view_map = true;
-          if (! (strncmp (obj.edgecolor, "none", 4)
-                 && strncmp (obj.facecolor, "none", 4)))
-            data_idx++;
-            is_image_data(data_idx) = false;
-            parametric(data_idx) = false;
-            have_cdata(data_idx) = true;
-            have_3d_patch(data_idx) = false;
-            style = do_linestyle_command (obj, obj.edgecolor,
-                                          data_idx, mono,
-                                          plot_stream);
-
-            if (isempty (obj.displayname))
-              titlespec{data_idx} = "title \"\"";
-            else
-              tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
-              titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
-            endif
-            withclause{data_idx} = sprintf ("with pm3d linestyle %d",
-                                            data_idx);
-            withpm3d = true;
-            pm3didx = data_idx;
-
-            xdat = obj.xdata;
-            ydat = obj.ydata;
-            zdat = obj.zdata;
-            cdat = obj.cdata;
-
-            err = false;
-            if (! size_equal (zdat, cdat))
-              err = true;
-            endif
-            if (isvector (xdat) && isvector (ydat) && ismatrix (zdat))
-              if (rows (zdat) == length (ydat)
-                  && columns (zdat) == length (xdat))
-                [xdat, ydat] = meshgrid (xdat, ydat);
-              else
-                err = true;
-              endif
-            elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat))
-              if (! size_equal (xdat, ydat, zdat))
-                err = true;
-              endif
-            else
-              err = true;
-            endif
-            if (err)
-              error ("__go_draw_axes__: invalid grid data");
-            endif
-            xlen = columns (zdat);
-            ylen = rows (zdat);
-            if (xlen == columns (xdat) && xlen == columns (ydat)
-                && ylen == rows (xdat) && ylen == rows (ydat))
-              len = 4 * xlen;
-              zz = zeros (ylen, len);
-              k = 1;
-              for kk = 1:4:len
-                zz(:,kk)   = xdat(:,k);
-                zz(:,kk+1) = ydat(:,k);
-                zz(:,kk+2) = zdat(:,k);
-                zz(:,kk+3) = cdat(:,k);
-                k++;
-              endfor
-              data{data_idx} = zz.';
-            endif
-
-            if (doing_interp_color)
-              interp_str = "interpolate 0, 0";
-            else
-              ## No interpolation of facecolors.
-              interp_str = "";
-            endif
-            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3):($4)", ylen, xlen);
-
-            flat_interp_face = (strncmp (obj.facecolor, "flat", 4)
-                                || strncmp (obj.facecolor, "interp", 6));
-            flat_interp_edge = (strncmp (obj.edgecolor, "flat", 4)
-                                || strncmp (obj.edgecolor, "interp", 6));
-
-            facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4)
-                                       || (isnumeric (obj.facecolor)
-                                           && all (obj.facecolor == 1)));
-            hidden_removal = false;
-            fputs (plot_stream, "set style increment default;\n");
-            if (flat_interp_edge && facecolor_none_or_white)
-              withpm3d = false;
-              withclause{data_idx} = sprintf ("with %s palette", style {1});
-              fputs (plot_stream, "unset pm3d\n");
-              if (all (obj.facecolor == 1))
-                hidden_removal = true;
-              endif
-            elseif (facecolor_none_or_white)
-              if (all (obj.facecolor == 1))
-                hidden_removal = true;
-              endif
-              fputs (plot_stream,"unset pm3d;\n");
-              fputs (plot_stream,"set style increment user;\n");
-              withpm3d = false;
-              withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                              style{1}, data_idx);
-              fputs (plot_stream, "unset pm3d\n");
-            endif
-
-            if (doing_interp_color)
-              ## "depthorder" interferes with interpolation of colors.
-              dord = "scansautomatic";
-            else
-              dord = "depthorder";
-            endif
-
-            if (flat_interp_face && strncmp (obj.edgecolor, "flat", 4))
-              fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n",
-                       interp_str, dord);
-            elseif (!facecolor_none_or_white)
-              if (strncmp (obj.edgecolor, "none", 4))
-                if (__gnuplot_has_feature__ ("transparent_surface")
-                    && isscalar (obj.facealpha))
-                  fprintf (plot_stream,
-                           "set style fill transparent solid %f;\n",
-                           obj.facealpha);
-                endif
-                fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n",
-                         interp_str, dord);
-              else
-                fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
-                         data_idx, interp_str, dord);
-
-                if (__gnuplot_has_feature__ ("transparent_surface")
-                    && isscalar (obj.facealpha))
-                  fprintf (plot_stream,
-                           "set style fill transparent solid %f;\n",
-                           obj.facealpha);
-                endif
-              endif
-            endif
-
-            zz = [];
-            if (length (style) > 1)
-              len = 3 * xlen;
-              zz = zeros (ylen, len);
-              k = 1;
-              for kk = 1:3:len
-                zz(:,kk)   = xdat(:,k);
-                zz(:,kk+1) = ydat(:,k);
-                zz(:,kk+2) = zdat(:,k);
-                k++;
-              endfor
-              zz = zz.';
-
-              data_idx++;
-              is_image_data(data_idx) = is_image_data(data_idx - 1);
-              parametric(data_idx) = parametric(data_idx - 1);
-              have_cdata(data_idx) = false;
-              have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-              titlespec{data_idx} = "title \"\"";
-              usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-              data{data_idx} = zz;
-              withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                              style{2}, data_idx);
-
-            endif
-            if (length (style) > 2)
-              data_idx++;
-              is_image_data(data_idx) = is_image_data(data_idx - 1);
-              parametric(data_idx) = parametric(data_idx - 1);
-              have_cdata(data_idx) = false;
-              have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-              titlespec{data_idx} = "title \"\"";
-              usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-              data{data_idx} = zz;
-              withclause{data_idx} = sprintf ("with %s linestyle %d",
-                                              style{3}, data_idx);
-            endif
-            if (withpm3d && strncmp (style {1}, "linespoints", 11))
-              if (isempty (zz))
-                len = 3 * xlen;
-                zz = zeros (ylen, len);
-                k = 1;
-                for kk = 1:3:len
-                  zz(:,kk)   = xdat(:,k);
-                  zz(:,kk+1) = ydat(:,k);
-                  zz(:,kk+2) = zdat(:,k);
-                  k++;
-                endfor
-                zz = zz.';
-              endif
-              data_idx++;
-              is_image_data(data_idx) = is_image_data(data_idx - 1);
-              parametric(data_idx) = parametric(data_idx - 1);
-              have_cdata(data_idx) = false;
-              have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
-              titlespec{data_idx} = "title \"\"";
-              usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
-              data{data_idx} = zz;
-              withclause{data_idx} = sprintf ("with points linestyle %d",
-                                              pm3didx);
-            endif
-          endif
-
-        case "text"
-          [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string");
-          fontspec = create_fontspec (f, s, gnuplot_term);
-          lpos = obj.position;
-          halign = obj.horizontalalignment;
-          valign = obj.verticalalignment;
-          angle = obj.rotation;
-          units = obj.units;
-          color = obj.color;
-          if (strcmpi (units, "normalized"))
-            units = "graph";
-          elseif (strcmp (axis_obj.yaxislocation, "right")
-                  && strcmp (units, "data"))
-            units = "second";
-          else
-            units = "";
-          endif
-
-          if (isnumeric (color))
-            colorspec = get_text_colorspec (color, mono);
-          endif
-
-          if (ischar (obj.string))
-            num_lines = rows (obj.string);
-          else
-            num_lines = numel (obj.string);
-          endif
-          switch valign
-            ## Text offset in characters. This relies on gnuplot for font metrics.
-            case "top"
-              dy = -0.5;
-            case "cap"
-              dy = -0.5;
-            case "middle"
-              dy = 0.5 * (num_lines - 1);
-            case "baseline"
-              dy = 0.5 + (num_lines - 1);
-            case "bottom"
-              dy = 0.5 + (num_lines - 1);
-          endswitch
-          ## Gnuplot's Character units are different for x/y and vary with fontsize. The aspect ratio
-          ## of 1:1.7 was determined by experiment to work for eps/ps/etc. For the MacOS aqua terminal
-          ## a value of 2.5 is needed. However, the difference is barely noticable.
-          dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1];
-
-          ## FIXME - Multiline text produced the gnuplot "warning: ft_render: skipping glyph"
-          if (nd == 3)
-            ## This produces the desired vertical alignment in 3D.
-            fprintf (plot_stream,
-                     "set label \"%s\" at %s %.15e,%.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
-                     undo_string_escapes (label), units, lpos(1),
-                     lpos(2), lpos(3), halign, angle, dx_and_dy, fontspec,
-                     __do_enhanced_option__ (enhanced, obj), colorspec);
-          else
-            fprintf (plot_stream,
-                     "set label \"%s\" at %s %.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
-                     undo_string_escapes (label), units,
-                     lpos(1), lpos(2), halign, angle, dx_and_dy, fontspec,
-                     __do_enhanced_option__ (enhanced, obj), colorspec);
-          endif
-
-        case "hggroup"
-          ## Push group children into the kid list.
-          if (isempty (kids))
-            kids = obj.children;
-          elseif (! isempty (obj.children))
-            kids = [kids; obj.children];
-          endif
-
-        otherwise
-          error ("__go_draw_axes__: unknown object class, %s",
-                 obj.type);
-      endswitch
-
-    endwhile
-
-    ## This is need to prevent warnings for rotations in 3D plots, while
-    ## allowing colorbars with contours.
-    if (nd == 2 || (data_idx > 1 && !view_map))
-      fputs (plot_stream, "set pm3d implicit;\n");
-    else
-      fputs (plot_stream, "set pm3d explicit;\n");
-    endif
-
-    if (isnan (hidden_removal) || hidden_removal)
-      fputs (plot_stream, "set hidden3d;\n");
-    else
-      fputs (plot_stream, "unset hidden3d;\n");
-    endif
-
-    have_data = (! (isempty (data) || all (cellfun ("isempty", data))));
-
-    ## Note we don't use the [xy]2range of gnuplot as we don't use the
-    ## dual axis plotting features of gnuplot.
-    if (isempty (xlim))
-      return;
-    endif
-    if (strcmpi (axis_obj.xdir, "reverse"))
-      xdir = "reverse";
-    else
-      xdir = "noreverse";
-    endif
-    fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir);
-    if (strcmpi (axis_obj.xaxislocation, "top"))
-      fprintf (plot_stream, "set x2range [%.15e:%.15e] %s;\n", xlim, xdir);
-    endif
-
-    if (isempty (ylim))
-      return;
-    endif
-    if (strcmpi (axis_obj.ydir, "reverse"))
-      ydir = "reverse";
-    else
-      ydir = "noreverse";
-    endif
-    fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir);
-    if (strcmpi (axis_obj.yaxislocation, "right"))
-      fprintf (plot_stream, "set y2range [%.15e:%.15e] %s;\n", ylim, ydir);
-    endif
-
-    if (nd == 3)
-      if (isempty (zlim))
-        return;
-      endif
-      if (strcmpi (axis_obj.zdir, "reverse"))
-        zdir = "reverse";
-      else
-        zdir = "noreverse";
-      endif
-      fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir);
-    endif
-
-    cmap = parent_figure_obj.colormap;
-    cmap_sz = rows (cmap);
-    if (! any (isinf (clim)))
-      if (truecolor || ! cdatadirect)
-        if (rows (addedcmap) > 0)
-          for i = 1:data_idx
-            if (have_3d_patch(i))
-              data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz;
-             endif
-          endfor
-          fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) *
-                   (cmap_sz + rows (addedcmap)) / cmap_sz);
-        else
-          fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim);
-        endif
-      else
-        fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz +
-                 rows (addedcmap));
-      endif
-    endif
-
-    if (strcmpi (axis_obj.box, "on"))
-      if (nd == 3)
-        fputs (plot_stream, "set border 4095;\n");
-      else
-        fputs (plot_stream, "set border 431;\n");
-      endif
-    else
-      if (nd == 3)
-        fputs (plot_stream, "set border 895;\n");
-      elseif (! isempty (axis_obj.ytick))
-        if (strcmpi (axis_obj.yaxislocation, "right"))
-          fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n",
-                   axis_obj.tickdir);
-          if (strcmpi (axis_obj.xaxislocation, "top"))
-            fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 12;\n");
-          elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 9;\n");
-          else # xaxislocation == zero
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 8;\n");
-            fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                     axis_obj.linewidth);
-          endif
-        elseif (strcmpi (axis_obj.yaxislocation, "left"))
-          fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                   axis_obj.tickdir);
-          if (strcmpi (axis_obj.xaxislocation, "top"))
-            fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 6;\n");
-          elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 3;\n");
-          else # xaxislocation == zero
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 2;\n");
-            fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                     axis_obj.linewidth);
-          endif
-        else # yaxislocation == zero
-          fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                   axis_obj.tickdir);
-          if (strcmpi (axis_obj.xaxislocation, "top"))
-            fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 4;\n");
-          elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "set border 1;\n");
-          else # xaxislocation == zero
-            fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
-                     axis_obj.tickdir);
-            fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
-                     axis_obj.tickdir);
-            fputs (plot_stream, "unset border;\n");
-            fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
-                     axis_obj.linewidth);
-          endif
-          fprintf (plot_stream, "set yzeroaxis lt -1 lw %f;\n",
-                   axis_obj.linewidth);
-        endif
-      endif
-    endif
-
-    if (strcmpi (axis_obj.visible, "off"))
-      fputs (plot_stream, "unset border; unset tics\n");
-    else
-      fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth);
-    endif
-
-    if (! isempty (hlgnd) && ! isempty (hlgnd.children)
-        && any (strcmpi (get (hlgnd.children, "visible"), "on")))
-      if (strcmpi (hlgnd.box, "on"))
-        box = "box";
-      else
-        box = "nobox";
-      endif
-      if (strcmpi (hlgnd.orientation, "vertical"))
-        horzvert = "vertical";
-      else
-        horzvert = "horizontal";
-      endif
-      if (strcmpi (hlgnd.textposition, "right"))
-        reverse = "reverse";
-      else
-        reverse = "noreverse";
-      endif
-      inout = "inside";
-      keypos = hlgnd.location;
-      if (ischar (keypos))
-        keypos = lower (keypos);
-        keyout = strfind (keypos, "outside");
-        if (! isempty (keyout))
-          inout = "outside";
-          keypos = keypos(1:keyout-1);
-        endif
-      endif
-      switch (keypos)
-        case "north"
-          pos = "center top";
-        case "south"
-          pos = "center bottom";
-        case "east"
-          pos = "right center";
-        case "west"
-          pos = "left center";
-        case "northeast"
-          pos = "right top";
-        case "northwest"
-          pos = "left top";
-        case "southeast"
-          pos = "right bottom";
-        case "southwest"
-          pos = "left bottom";
-        case "best"
-          pos = "";
-          warning ("legend: 'Best' not yet implemented for location specifier.\n");
-          ## Least conflict with data in plot.
-          ## Least unused space outside plot.
-        otherwise
-          pos = "";
-      endswitch
-      if (__gnuplot_has_feature__ ("key_has_font_properties"))
-        [fontname, fontsize] = get_fontname_and_size (hlgnd);
-        fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
-      else
-        fontspec = "";
-      endif
-      textcolors = get (findobj (hlgnd.children, "type", "text"), "color");
-      if (iscell (textcolors))
-        textcolors = cell2mat (textcolors);
-        textcolors = unique (textcolors, "rows");
-      endif
-      if (rows (textcolors) > 1)
-        ## Gnuplot is unable to assign arbitrary colors to each text entry
-        ## for the key/legend.  But, the text color can be set to match the
-        ## color of the plot object.
-        colorspec = "textcolor variable";
-      else
-        colorspec = get_text_colorspec (textcolors, mono);
-      endif
-      fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
-               inout, pos, box, reverse, horzvert, fontspec, colorspec);
-    else
-      fputs (plot_stream, "unset key;\n");
-    endif
-    fputs (plot_stream, "set style data lines;\n");
-
-    cmap = [cmap; addedcmap];
-    cmap_sz = cmap_sz + rows (addedcmap);
-    if (length (cmap) > 0)
-      fprintf (plot_stream,
-               "set palette positive color model RGB maxcolors %i;\n",
-               cmap_sz);
-      fprintf (plot_stream,
-               "set palette file \"-\" binary record=%d using 1:2:3:4;\n",
-               cmap_sz);
-      fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32");
-      fwrite (plot_stream, "\n");
-    endif
-
-    fputs (plot_stream, "unset colorbox;\n");
-
-    if (have_data)
-      if (nd == 2)
-        plot_cmd = "plot";
-      else
-        plot_cmd = "splot";
-        rot_x = 90 - axis_obj.view(2);
-        rot_z = axis_obj.view(1);
-        while (rot_z < 0)
-          rot_z += 360;
-        endwhile
-        fputs (plot_stream, "set ticslevel 0;\n");
-        if (view_map && rot_x == 0 && rot_z == 0)
-          fputs (plot_stream, "set view map;\n");
-        else
-          fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
-        endif
-      endif
-      if (have_3d_patch (1))
-        fputs (plot_stream, "set pm3d depthorder\n");
-        fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-                 usingclause{1}, titlespec{1}, withclause{1});
-      elseif (is_image_data (1))
-        if (numel (is_image_data) > 1 && is_image_data(2))
-          ## Remove terminating semicolon
-          n = max (strfind (withclause{1}, ";"));
-          if (! isempty (n))
-            withclause{1} = withclause{1}(1:n-1);
-          endif
-        endif
-        fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-                 usingclause{1}, titlespec{1}, withclause{1});
-      else
-        fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-                 usingclause{1}, titlespec{1}, withclause{1});
-      endif
-      for i = 2:data_idx
-        if (have_3d_patch (i))
-          fprintf (plot_stream, ", \"-\" %s %s %s \\\n",
-                   usingclause{i}, titlespec{i}, withclause{i});
-        elseif (is_image_data (i))
-          if (! is_image_data (i-1))
-            fputs (plot_stream, "; ");
-            if (bg_is_set)
-              fputs (plot_stream, "unset obj 1; \\\n");
-              bg_is_set = false;
-            endif
-            if (fg_is_set)
-              fputs (plot_stream, "unset obj 2; \\\n");
-              fg_is_set = false;
-            endif
-            if (numel (is_image_data) > i && is_image_data(i+1))
-              ## Remove terminating semicolon
-              n = max (strfind (withclause{i}, ";"));
-              if (! isempty (n))
-                withclause{i} = withclause{i}(1:n-1);
-              endif
-            endif
-            fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
-                     usingclause{i}, titlespec{i}, withclause{i});
-          else
-            ## For consecutive images continue with the same plot command
-            fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",",
-                     usingclause{i}, titlespec{i}, withclause{i});
-          endif
-        elseif (is_image_data (i-1))
-          if (bg_is_set)
-            fputs (plot_stream, "unset obj 1; \\\n");
-            bg_is_set = false;
-          endif
-          if (fg_is_set)
-            fputs (plot_stream, "unset obj 2; \\\n");
-            fg_is_set = false;
-          endif
-          fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-                   usingclause{i}, titlespec{i}, withclause{i});
-        else
-          fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
-                   usingclause{i}, titlespec{i}, withclause{i});
-        endif
-      endfor
-      fputs (plot_stream, ";\n");
-      for i = 1:data_idx
-        if (have_3d_patch (i))
-          ## Can't write 3d patch data as binary as can't plot more than
-          ## a single patch at a time and have to plot all patches together
-          ## so that the gnuplot depth ordering is done correctly
-          for j = 1 : 4 : columns (data{i})
-            if (j != 1)
-              fputs (plot_stream, "\n\n");
-            endif
-            fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).');
-            fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).');
-            fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).');
-            fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).');
-          endfor
-          fputs (plot_stream, "e\n");
-        elseif (is_image_data(i))
-          fwrite (plot_stream, data{i}, "float32");
-        else
-          __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i),
-                                  have_cdata(i));
-        endif
-      endfor
-    else
-      fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n");
-    endif
-
-    ## Needed to allow mouse rotation with pcolor.
-    if (view_map)
-      fputs (plot_stream, "unset view;\n");
-    endif
-
-    if (bg_is_set)
-      fputs (plot_stream, "unset obj 1;\n");
-      bg_is_set = false;
-    endif
-
-    fflush (plot_stream);
-
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-function x = flip (x)
-  if (rows (x) == 1)
-    x = fliplr (x);
-  elseif (columns (x) == 1 || ischar (x))
-    x = flipud (x);
-  else
-    x = flipud (fliplr (x));
-  endif
-endfunction
-
-function fontspec = create_fontspec (f, s, gp_term)
-  if (strcmp (f, "*") || strcmp (gp_term, "tikz"))
-    fontspec = sprintf ("font \",%d\"", s);
-  else
-    fontspec = sprintf ("font \"%s,%d\"", f, s);
-  endif
-endfunction
-
-function style = do_linestyle_command (obj, linecolor, idx, mono,
-                                       plot_stream, errbars = "")
-  style = {};
-
-  fprintf (plot_stream, "set style line %d default;\n", idx);
-  fprintf (plot_stream, "set style line %d", idx);
-
-  found_style = false;
-  if (isnumeric (linecolor))
-    color = linecolor;
-    if (! mono)
-      fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-               round (255*color));
-    endif
-  else
-    color = [0, 0, 0];
-  endif
-
-  if (isfield (obj, "linestyle"))
-    switch (obj.linestyle)
-      case "-"
-        lt = "1";
-      case "--"
-        lt = "2";
-      case ":"
-        lt = "3";
-      case "-."
-        lt = "6";
-      case "none"
-        lt = "";
-      otherwise
-        lt = "";
-    endswitch
-
-    if (! isempty (lt))
-      fprintf (plot_stream, " linetype %s", lt);
-    endif
-
-  else
-    lt = "";
-  endif
-  if (! isempty (errbars))
-    found_style = true;
-  endif
-
-  if (isfield (obj, "linewidth"))
-    fprintf (plot_stream, " linewidth %f", obj.linewidth);
-    found_style = true;
-  endif
-
-  [pt, pt2, obj] = gnuplot_pointtype (obj);
-
-  if (! isempty (pt))
-    found_style = true;
-  endif
-
-  sidx = 1;
-  if (isempty (errbars))
-    if (isempty (lt))
-      style {sidx} = "";
-    else
-      style {sidx} = "lines";
-    endif
-
-    facesame = true;
-    if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
-        && !strncmp (obj.markerfacecolor, "none", 4))
-      if (strncmp (obj.markerfacecolor, "auto", 4)
-          || ! isnumeric (obj.markerfacecolor)
-          || (isnumeric (obj.markerfacecolor)
-              && isequal (color, obj.markerfacecolor)))
-        if (! isempty (pt2))
-          fprintf (plot_stream, " pointtype %s", pt2);
-          style {sidx} = strcat (style{sidx}, "points");
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      else
-        facesame = false;
-        if (! found_style)
-          fputs (plot_stream, " default");
-        endif
-        fputs (plot_stream, ";\n");
-        if (! isempty (style {sidx}))
-          sidx ++;
-          idx ++;
-        else
-          fputs (plot_stream, ";\n");
-        endif
-        fprintf (plot_stream, "set style line %d default;\n", idx);
-        fprintf (plot_stream, "set style line %d", idx);
-        if (isnumeric (obj.markerfacecolor) && ! mono)
-          fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                   round (255*obj.markerfacecolor));
-        endif
-        if (! isempty (pt2))
-          style {sidx} = "points";
-          fprintf (plot_stream, " pointtype %s", pt2);
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      endif
-    endif
-    if (isfield (obj, "markeredgecolor")
-        && !strncmp (obj.markeredgecolor, "none", 4))
-      if (facesame && !isempty (pt)
-          && (strncmp (obj.markeredgecolor, "auto", 4)
-              || ! isnumeric (obj.markeredgecolor)
-              || (isnumeric (obj.markeredgecolor)
-                  && isequal (color, obj.markeredgecolor))))
-        if (sidx == 1 && ((length (style {sidx}) == 5
-            && strncmp (style {sidx}, "lines", 5)) || isempty (style {sidx})))
-          if (! isempty (pt))
-            style {sidx} = strcat (style{sidx}, "points");
-            fprintf (plot_stream, " pointtype %s", pt);
-          endif
-          if (isfield (obj, "markersize"))
-            fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-          endif
-        endif
-      else
-        if (! found_style)
-          fputs (plot_stream, " default");
-        endif
-        fputs (plot_stream, ";\n");
-        if (!isempty (style {sidx}))
-          sidx ++;
-          idx ++;
-        else
-          fputs (plot_stream, ";\n");
-        endif
-        fprintf (plot_stream, "set style line %d default;\n", idx);
-        fprintf (plot_stream, "set style line %d", idx);
-        if (! mono)
-          if (strncmp (obj.markeredgecolor, "auto", 4))
-            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                     round (255*color));
-          elseif (isnumeric (obj.markeredgecolor) && ! mono)
-            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
-                     round (255*obj.markeredgecolor));
-          endif
-        endif
-        if (! isempty (pt))
-          style {sidx} = "points";
-          fprintf (plot_stream, " pointtype %s", pt);
-        endif
-        if (isfield (obj, "markersize"))
-          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
-        endif
-      endif
-    endif
-  else
-    style{1} = errbars;
-    fputs (plot_stream, " pointtype 0");
-  endif
-
-  if (! found_style && isempty (style {1}))
-    fputs (plot_stream, " default");
-  endif
-
-  fputs (plot_stream, ";\n");
-
-endfunction
-
-function [pt, pt2, obj] = gnuplot_pointtype (obj)
-  if (isfield (obj, "marker"))
-    switch (obj.marker)
-      case "+"
-        pt = pt2 = "1";
-      case "o"
-        pt = "6";
-        pt2 = "7";
-      case "*"
-        pt = pt2 = "3";
-      case "."
-        pt = "6";
-        pt2 = "7";
-        if (isfield (obj, "markerfacecolor")
-            || strncmp (obj.markerfacecolor, "none", 4))
-          obj.markerfacecolor = "auto";
-        endif
-        if (isfield (obj, "markersize"))
-          obj.markersize /= 3;
-        else
-          obj.markersize = 5;
-        endif
-      case "x"
-        pt = pt2 = "2";
-      case {"square", "s"}
-        pt = "4";
-        pt2 = "5";
-      case {"diamond", "d"}
-        pt = "12";
-        pt2 = "13";
-      case "^"
-        pt = "8";
-        pt2 = "9";
-      case "v"
-        pt = "10";
-        pt2 = "11";
-      case ">"
-        ## FIXME -- should be triangle pointing right, use triangle pointing up
-        pt = "8";
-        pt2 = "9";
-      case "<"
-        ## FIXME -- should be triangle pointing left, use triangle pointing down
-        pt = "10";
-        pt2 = "11";
-      case {"pentagram", "p"}
-        ## FIXME -- should be pentagram, using pentagon
-        pt = "14";
-        pt2 = "15";
-      case {"hexagram", "h"}
-        ## FIXME -- should be 6 pt start, using "*" instead
-        pt = pt2 = "3";
-      case "none"
-        pt = pt2 = "";
-      otherwise
-        pt = pt2 = "";
-    endswitch
-  else
-    pt = pt2 = "";
-  endif
-endfunction
-
-function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata)
-
-  ## DATA is already transposed.
-
-  ## FIXME -- this may need to be converted to C++ for speed.
-
-  ## Convert NA elements to normal NaN values because fprintf writes
-  ## "NA" and that confuses gnuplot.
-  idx = find (isna (data));
-  if (any (idx))
-    data(idx) = NaN;
-  endif
-
-  if (nd == 2)
-    fwrite (plot_stream, data, "float64");
-  elseif (nd == 3)
-    if (parametric)
-      fwrite (plot_stream, data, "float64");
-    else
-      nr = rows (data);
-      if (cdata)
-        for j = 1:4:nr
-          fwrite (plot_stream, data(j:j+3,:), "float64");
-        endfor
-      else
-        for j = 1:3:nr
-          fwrite (plot_stream, data(j:j+2,:), "float64");
-        endfor
-      endif
-    endif
-  endif
-
-endfunction
-
-function do_tics (obj, plot_stream, ymirror, mono, gnuplot_term)
-
-  obj.xticklabel = ticklabel_to_cell (obj.xticklabel);
-  obj.yticklabel = ticklabel_to_cell (obj.yticklabel);
-  obj.zticklabel = ticklabel_to_cell (obj.zticklabel);
-
-  if (strcmp (obj.xminorgrid, "on"))
-    obj.xminortick = "on";
-  endif
-  if (strcmp (obj.yminorgrid, "on"))
-    obj.yminortick = "on";
-  endif
-  if (strcmp (obj.zminorgrid, "on"))
-    obj.zminortick = "on";
-  endif
-
-  [fontname, fontsize] = get_fontname_and_size (obj);
-  fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
-
-  ## A Gnuplot tic scale of 69 is equivalent to Octave's 0.5.
-  ticklength = sprintf ("scale %4.1f", (69/0.5)*obj.ticklength(1));
-
-  if (strcmpi (obj.xaxislocation, "top"))
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x", plot_stream, true, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  elseif (strcmpi (obj.xaxislocation, "zero"))
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
-               "axis", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x2", plot_stream, true, mono, "axis",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  else
-    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
-               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
-               obj.xcolor, "x2", plot_stream, true, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
-               obj.xsgn, gnuplot_term);
-  endif
-  if (strcmpi (obj.yaxislocation, "right"))
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y", plot_stream, ymirror, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  elseif (strcmpi (obj.yaxislocation, "zero"))
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
-               "axis", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y2", plot_stream, ymirror, mono, "axis",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  else
-    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
-               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
-               "border", obj.tickdir, ticklength, fontname, fontspec,
-               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
-    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
-               obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
-               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
-               obj.ysgn, gnuplot_term);
-  endif
-  do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode,
-             obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono,
-             "border", obj.tickdir, ticklength, fontname, fontspec,
-             obj.interpreter, obj.zscale, obj.zsgn, gnuplot_term);
-endfunction
-
-function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax,
-                    plot_stream, mirror, mono, axispos, tickdir, ticklength,
-                    fontname, fontspec, interpreter, scale, sgn, gnuplot_term)
-  persistent warned_latex = false;
-  if (strcmpi (interpreter, "tex"))
-    for n = 1 : numel (labels)
-      labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false);
-    endfor
-  elseif (strcmpi (interpreter, "latex"))
-    if (! warned_latex)
-      warning ("latex markup not supported for tick marks");
-      warned_latex = true;
-    endif
-  endif
-  if (strcmp (scale, "log"))
-    num_mtics = 10;
-    if (any (strcmp (gnuplot_term, {"tikz", "pstex", "pslatex", "epslatex"})))
-      fmt = "$10^{%T}$";
-    else
-      fmt = "10^{%T}";
-    endif
-    if (sgn < 0)
-      fmt = strcat ("-", fmt);
-    endif
-  else
-    fmt = "%g";
-    num_mtics = 5;
-  endif
-  colorspec = get_text_colorspec (color, mono);
-  if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual"))
-    if (isempty (tics))
-      fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
-    elseif (strcmpi (labelmode, "manual"))
-      if (ischar (labels))
-        labels = cellstr (labels);
-      endif
-      if (isnumeric (labels))
-        labels = num2str (real (labels(:)));
-      endif
-      if (ischar (labels))
-        labels = permute (cellstr (labels), [2, 1]);
-      endif
-      if (iscellstr (labels))
-        k = 1;
-        ntics = numel (tics);
-        nlabels = numel (labels);
-        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
-        if (mirror)
-          fprintf (plot_stream, "set %stics add %s %s %s mirror (", ax,
-                   tickdir, ticklength, axispos);
-        else
-          fprintf (plot_stream, "set %stics add %s %s %s nomirror (", ax,
-                   tickdir, ticklength, axispos);
-        endif
-
-        labels = regexprep (labels, '%', "%%");
-        for i = 1:ntics
-          fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
-          if (i < ntics)
-            fputs (plot_stream, ", ");
-          endif
-          if (k > nlabels)
-            k = 1;
-          endif
-        endfor
-        fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
-        if (strcmp (mtics, "on"))
-          fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-        else
-          fprintf (plot_stream, "unset m%stics;\n", ax);
-        endif
-      else
-        error ("__go_draw_axes__: unsupported type of ticklabel");
-      endif
-    else
-      fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
-      if (mirror)
-        fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, tickdir,
-                 ticklength, axispos);
-      else
-        fprintf (plot_stream, "set %stics %s %s %s nomirror (", ax, tickdir,
-                 ticklength, axispos);
-      endif
-      fprintf (plot_stream, " %.15g,", tics(1:end-1));
-      fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
-      if (strcmp (mtics, "on"))
-        fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-      else
-        fprintf (plot_stream, "unset m%stics;\n", ax);
-      endif
-    endif
-  else
-    fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
-    if (mirror)
-      fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax,
-               axispos, tickdir, ticklength, colorspec, fontspec);
-    else
-      fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax,
-               tickdir, ticklength, axispos, colorspec, fontspec);
-    endif
-    if (strcmp (mtics, "on"))
-      fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
-    else
-      fprintf (plot_stream, "unset m%stics;\n", ax);
-    endif
-  endif
-endfunction
-
-function ticklabel = ticklabel_to_cell (ticklabel)
-  if (isnumeric (ticklabel))
-    ## Use upto 5 significant digits
-    ticklabel = num2str (ticklabel(:), 5);
-  endif
-  if (ischar (ticklabel))
-    if (rows (ticklabel) == 1 && any (ticklabel == "|"))
-      ticklabel = ostrsplit (ticklabel, "|");
-    else
-      ticklabel = cellstr (ticklabel);
-    endif
-  elseif (isempty (ticklabel))
-    ticklabel = {""};
-  else
-    ticklabel = ticklabel;
-  endif
-endfunction
-
-function colorspec = get_text_colorspec (color, mono)
-  if (mono)
-    colorspec = "";
-  else
-    colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"",
-                         round (255*color));
-  endif
-endfunction
-
-function [f, s, fnt, it, bld] = get_fontname_and_size (t)
-  if (isempty (t.fontname) || strcmp (t.fontname, "*"))
-    fnt = "{}";
-  else
-    fnt = t.fontname;
-  endif
-  f = fnt;
-  it = false;
-  bld = false;
-  if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold"))
-    if (! isempty (t.fontangle)
-        && (strcmpi (t.fontangle, "italic")
-            || strcmpi (t.fontangle, "oblique")))
-      f = cstrcat (f, "-bolditalic");
-      it = true;
-      bld = true;
-    else
-      f = cstrcat (f, "-bold");
-      bld = true;
-    endif
-  elseif (! isempty (t.fontangle)
-          && (strcmpi (t.fontangle, "italic")
-              || strcmpi (t.fontangle, "oblique")))
-    f = cstrcat (f, "-italic");
-    it = true;
-  endif
-  if (isempty (t.fontsize))
-    s = 10;
-  else
-    s = t.fontsize;
-  endif
-endfunction
-
-function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld)
-
-  persistent warned_latex = false;
-
-  if (strcmp (fld, "string"))
-    [f, s, fnt, it, bld] = get_fontname_and_size (obj);
-  else
-    f = "Helvetica";
-    s = 10;
-    fnt = f;
-    it = false;
-    bld = false;
-  endif
-
-  ## The text object maybe multiline, and may be of any class
-  str = getfield (obj, fld);
-  if (ischar (str) && rows (str) > 1)
-    str = cellstr (str);
-  elseif (isnumeric (str))
-    str = cellstr (num2str (str(:)));
-  endif
-  if (iscellstr (str))
-    for n = 1:numel (str)
-      if (isnumeric (str{n}))
-        str{n} = num2str (str{n});
-      endif
-    endfor
-    str = sprintf ("%s\n", str{:})(1:end-1);
-  endif
-
-  if (enhanced)
-    if (strcmpi (obj.interpreter, "tex"))
-      if (iscellstr (str))
-        for n = 1:numel (str)
-          str{n} = __tex2enhanced__ (str{n}, fnt, it, bld);
-        endfor
-      else
-        str = __tex2enhanced__ (str, fnt, it, bld);
-      endif
-    elseif (strcmpi (obj.interpreter, "latex"))
-      if (! warned_latex)
-        warning ("latex markup not supported for text objects");
-        warned_latex = true;
-      endif
-    elseif (enhanced)
-      str = no_super_sub_scripts (str);
-    endif
-  endif
-endfunction
-
-function str = no_super_sub_scripts (str)
-  if (iscellstr (str))
-    labels = str;
-  else
-    labels = cellstr (str);
-  endif
-  for marker = "_^" 
-    for m = 1 : numel (labels)
-      n1 = strfind (labels{m}, sprintf ("\\%s", marker));
-      n2 = strfind (labels{m}, marker);
-      if (! isempty (n1))
-        n1 = n1 + 1;
-        n2 = setdiff (n2, n1);
-      endif
-      for n = numel (n2):-1:1
-        labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)];
-      endfor
-    endfor
-  endfor
-  if (iscellstr (str))
-    str = labels;
-  else
-    str = char (labels);
-  endif
-endfunction
-
-function str = __tex2enhanced__ (str, fnt, it, bld)
-  persistent sym = __setup_sym_table__ ();
-  persistent flds = fieldnames (sym);
-
-  [s, e, m] = regexp (str, "\\\\([a-zA-Z]+|0)", "start", "end", "matches");
-
-  for i = length (s) : -1 : 1
-    ## special case for "\0"  and replace with "{/Symbol \306}'
-    if (strncmp (m{i}, '\0', 2))
-      str = cstrcat (str(1:s(i) - 1), '{/Symbol \306}', str(s(i) + 2:end));
-    else
-      f = m{i}(2:end);
-      if (isfield (sym, f))
-        g = getfield (sym, f);
-        ## FIXME The symbol font doesn't seem to support bold or italic
-        ##if (bld)
-        ##  if (it)
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
-        ##  else
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
-        ##  endif
-        ##elseif (it)
-        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
-        ##endif
-        str = cstrcat (str(1:s(i) - 1), g, str(e(i) + 1:end));
-      elseif (strncmp (f, "rm", 2))
-        bld = false;
-        it = false;
-        str = cstrcat (str(1:s(i) - 1), '/', fnt, ' ', str(s(i) + 3:end));
-      elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2))
-        it = true;
-        if (bld)
-          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ',
-                         str(s(i) + 3:end));
-        else
-          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ',
-                         str(s(i) + 3:end));
-        endif
-      elseif (strncmp (f, "bf", 2))
-        bld = true;
-        if (it)
-          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ',
-                         str(2(i) + 3:end));
-        else
-          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ',
-                         str(s(i) + 3:end));
-        endif
-      elseif (strcmpi (f, "color"))
-        ## FIXME Ignore \color but remove trailing {} block as well
-        d = strfind (str(e(i) + 1:end),'}');
-        if (isempty (d))
-          warning ('syntax error in \color argument');
-        else
-          str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end));
-        endif
-      elseif (strcmpi (f, "fontname"))
-        b1 = strfind (str(e(i) + 1:end),'{');
-        b2 = strfind (str(e(i) + 1:end),'}');
-        if (isempty (b1) || isempty (b2))
-          warning ('syntax error in \fontname argument');
-        else
-          str = cstrcat (str(1:s(i) - 1), '/',
-                         str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}',
-                         str(e(i) + b2(1) + 1:end));
-        endif
-      elseif (strcmpi (f, "fontsize"))
-        b1 = strfind (str(e(i) + 1:end),'{');
-        b2 = strfind (str(e(i) + 1:end),'}');
-        if (isempty (b1) || isempty (b2))
-          warning ('syntax error in \fontname argument');
-        else
-          str = cstrcat (str(1:s(i) - 1), '/=',
-                         str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}',
-                         str(e(i) + b2(1) + 1:end));
-        endif
-      else
-        ## Last desperate attempt to treat the symbol. Look for things
-        ## like \pix, that should be translated to the symbol Pi and x
-        for j = 1 : length (flds)
-          if (strncmp (flds{j}, f, length (flds{j})))
-            g = getfield (sym, flds{j});
-            ## FIXME The symbol font doesn't seem to support bold or italic
-            ##if (bld)
-            ##  if (it)
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
-            ##  else
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
-            ##  endif
-            ##elseif (it)
-            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
-            ##endif
-            str = cstrcat (str(1:s(i) - 1), g,
-                           str(s(i) + length (flds{j}) + 1:end));
-            break;
-          endif
-        endfor
-      endif
-    endif
-  endfor
-
-  ## Prepend @ to things  things like _0^x or _{-100}^{100} for
-  ## alignment But need to put the shorter of the two arguments first.
-  ## Carful of nested {} and unprinted characters when defining
-  ## shortest.. Don't have to worry about things like ^\theta as they
-  ## are already converted to ^{/Symbol q}.
-
-  ## FIXME -- This is a mess... Is it worth it just for a "@" character?
-
-  [s, m] = regexp (str,'[_\^]','start','matches');
-  i = 1;
-  p = 0;
-  while (i < length (s))
-    if (i < length (s))
-      if (str(s(i) + p + 1) == "{")
-        s1 = strfind (str(s(i) + p + 2:end),'{');
-        si = 1;
-        l1 = strfind (str(s(i) + p + 1:end),'}');
-        li = 1;
-        while (li <= length (l1) && si <= length (s1))
-          if (l1(li) < s1(si))
-            if (li == si)
-              break;
-            endif
-            li++;
-          else
-            si++;
-          endif
-        endwhile
-        l1 = l1 (min (length (l1), si));
-        if (s(i) + l1 + 1 == s(i+1))
-          if (str(s(i + 1) + p + 1) == "{")
-            s2 = strfind (str(s(i + 1) + p + 2:end),'{');
-            si = 1;
-            l2 = strfind (str(s(i + 1) + p + 1:end),'}');
-            li = 1;
-            while (li <= length (l2) && si <= length (s2))
-              if (l2(li) < s2(si))
-                if (li == si)
-                  break;
-                endif
-                li++;
-              else
-                si++;
-              endif
-            endwhile
-            l2 = l2 (min (length (l2), si));
-            if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
-                length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1)))
-              ## Shortest already first!
-              str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
-            else
-              ## Have to swap sub/super-script to get shortest first.
-              str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2),
-                             str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end));
-            endif
-          else
-            ## Have to swap sub/super-script to get shortest first.
-            str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1),
-                           str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end));
-          endif
-          i += 2;
-          p ++;
-        else
-          i++;
-        endif
-      else
-        if (s(i+1) == s(i) + 2)
-          ## Shortest already first!
-          str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
-          p ++;
-          i += 2;
-        else
-          i ++;
-        endif
-      endif
-    else
-      i ++;
-    endif
-  endwhile
-
-endfunction
-
-function l = length_string (s)
-  l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}'));
-  m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches');
-  if (!isempty (m))
-    l = l - sum (cellfun ("length", m));
-  endif
-endfunction
-
-function sym = __setup_sym_table__ ()
-  ## Setup the translation table for TeX to gnuplot enhanced mode.
-  sym.forall = '{/Symbol \042}';
-  sym.exists = '{/Symbol \044}';
-  sym.ni = '{/Symbol \047}';
-  sym.cong = '{/Symbol \100}';
-  sym.Delta = '{/Symbol D}';
-  sym.Phi = '{/Symbol F}';
-  sym.Gamma = '{/Symbol G}';
-  sym.vartheta = '{/Symbol J}';
-  sym.Lambda = '{/Symbol L}';
-  sym.Pi = '{/Symbol P}';
-  sym.Theta = '{/Symbol Q}';
-  sym.Sigma = '{/Symbol S}';
-  sym.varsigma = '{/Symbol V}';
-  sym.Omega = '{/Symbol W}';
-  sym.Xi = '{/Symbol X}';
-  sym.Psi = '{/Symbol Y}';
-  sym.perp = '{/Symbol \136}';
-  sym.alpha = '{/Symbol a}';
-  sym.beta = '{/Symbol b}';
-  sym.chi = '{/Symbol c}';
-  sym.delta = '{/Symbol d}';
-  sym.epsilon = '{/Symbol e}';
-  sym.phi = '{/Symbol f}';
-  sym.gamma = '{/Symbol g}';
-  sym.eta = '{/Symbol h}';
-  sym.iota = '{/Symbol i}';
-  sym.varphi = '{/Symbol j}';
-  sym.kappa = '{/Symbol k}';
-  sym.lambda = '{/Symbol l}';
-  sym.mu = '{/Symbol m}';
-  sym.nu = '{/Symbol n}';
-  sym.o =  '{/Symbol o}';
-  sym.pi = '{/Symbol p}';
-  sym.theta = '{/Symbol q}';
-  sym.rho = '{/Symbol r}';
-  sym.sigma = '{/Symbol s}';
-  sym.tau = '{/Symbol t}';
-  sym.upsilon = '{/Symbol u}';
-  sym.varpi = '{/Symbol v}';
-  sym.omega = '{/Symbol w}';
-  sym.xi = '{/Symbol x}';
-  sym.psi = '{/Symbol y}';
-  sym.zeta = '{/Symbol z}';
-  sym.sim = '{/Symbol \176}';
-  sym.Upsilon = '{/Symbol \241}';
-  sym.prime = '{/Symbol \242}';
-  sym.leq = '{/Symbol \243}';
-  sym.infty = '{/Symbol \245}';
-  sym.clubsuit = '{/Symbol \247}';
-  sym.diamondsuit = '{/Symbol \250}';
-  sym.heartsuit = '{/Symbol \251}';
-  sym.spadesuit = '{/Symbol \252}';
-  sym.leftrightarrow = '{/Symbol \253}';
-  sym.leftarrow = '{/Symbol \254}';
-  sym.uparrow = '{/Symbol \255}';
-  sym.rightarrow = '{/Symbol \256}';
-  sym.downarrow = '{/Symbol \257}';
-  sym.circ = '{/Symbol \260}';
-  sym.pm = '{/Symbol \261}';
-  sym.geq = '{/Symbol \263}';
-  sym.times = '{/Symbol \264}';
-  sym.propto = '{/Symbol \265}';
-  sym.partial = '{/Symbol \266}';
-  sym.bullet = '{/Symbol \267}';
-  sym.div = '{/Symbol \270}';
-  sym.neq = '{/Symbol \271}';
-  sym.equiv = '{/Symbol \272}';
-  sym.approx = '{/Symbol \273}';
-  sym.ldots = '{/Symbol \274}';
-  sym.mid = '{/Symbol \275}';
-  sym.aleph = '{/Symbol \300}';
-  sym.Im = '{/Symbol \301}';
-  sym.Re = '{/Symbol \302}';
-  sym.wp = '{/Symbol \303}';
-  sym.otimes = '{/Symbol \304}';
-  sym.oplus = '{/Symbol \305}';
-  sym.oslash = '{/Symbol \306}';
-  sym.cap = '{/Symbol \307}';
-  sym.cup = '{/Symbol \310}';
-  sym.supset = '{/Symbol \311}';
-  sym.supseteq = '{/Symbol \312}';
-  sym.subset = '{/Symbol \314}';
-  sym.subseteq = '{/Symbol \315}';
-  sym.in = '{/Symbol \316}';
-  sym.notin = '{/Symbol \317}';
-  sym.angle = '{/Symbol \320}';
-  sym.bigtriangledown = '{/Symbol \321}';
-  sym.langle = '{/Symbol \341}';
-  sym.rangle = '{/Symbol \361}';
-  sym.nabla = '{/Symbol \321}';
-  sym.prod = '{/Symbol \325}';
-  sym.surd = '{/Symbol \326}';
-  sym.cdot = '{/Symbol \327}';
-  sym.neg = '{/Symbol \330}';
-  sym.wedge = '{/Symbol \331}';
-  sym.vee = '{/Symbol \332}';
-  sym.Leftrightarrow = '{/Symbol \333}';
-  sym.Leftarrow = '{/Symbol \334}';
-  sym.Uparrow = '{/Symbol \335}';
-  sym.Rightarrow = '{/Symbol \336}';
-  sym.Downarrow = '{/Symbol \337}';
-  sym.diamond = '{/Symbol \340}';
-  sym.copyright = '{/Symbol \343}';
-  sym.lfloor = '{/Symbol \353}';
-  sym.lceil  = '{/Symbol \351}';
-  sym.rfloor = '{/Symbol \373}';
-  sym.rceil  = '{/Symbol \371}';
-  sym.int = '{/Symbol \362}';
-endfunction
-
-function retval = __do_enhanced_option__ (enhanced, obj)
-  retval = "";
-  if (enhanced)
-    if (strcmpi (obj.interpreter, "none"))
-      retval = "noenhanced";
-    else
-      retval = "enhanced";
-    endif
-  endif
-endfunction
--- a/scripts/plot/private/__go_draw_figure__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __go_draw_figure__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function __go_draw_figure__ (h, plot_stream, enhanced, mono)
-
-  if (nargin == 4)
-    htype = get (h, "type");
-    if (strcmp (htype, "figure"))
-      ## Get complete list of children.
-      kids = allchild (h);
-      nkids = length (kids);
-
-      if (nkids > 0)
-        fputs (plot_stream, "\nreset;\n");
-        fputs (plot_stream, "set autoscale keepfix;\n");
-        fputs (plot_stream, "set origin 0, 0\n");
-        fputs (plot_stream, "set size 1, 1\n");
-        bg = get (h, "color");
-        if (isnumeric (bg))
-          fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * bg);
-          bg_is_set = true;
-        else
-          bg_is_set = false;
-        endif
-        fg_was_set = false;
-
-        for i = nkids:-1:1
-          type = get (kids(i), "type");
-          switch (type)
-            case "axes"
-              if (strcmpi (get (kids (i), "tag"), "legend"))
-                ## This is so ugly. If there was a way of getting
-                ## gnuplot to give us the text extents of strings
-                ## then we could get rid of this mess.
-                lh = getfield (get (kids(i), "userdata"), "handle");
-                if (isscalar (lh))
-                  ## We have a legend with a single parent. It'll be handled
-                  ## below as a gnuplot key to the axis it corresponds to
-                  continue;
-                else
-                  ca = lh(1);
-                  ## Rely upon listener to convert axes position
-                  ## to "normalized" units.
-                  legend_axes_units = get (kids(i), "units");
-                  legend_axes_position = get (kids(i), "position");
-                  legend_axes_outerposition = get (kids(i), "outerposition");
-                  legend_axes_box = get (kids(i), "box");
-                  legend_axes_ylim = get (kids(i), "ylim");
-                  orig_axes_units = get (ca, "units");
-                  hlgnd = get (kids(i));
-
-                  unwind_protect
-                    set (ca, "units", "normalized");
-                    set (kids(i), "units", "normalized", "box", "off",
-                         "ylim", [-2, -1], "position", get (ca(1), "position"),
-                         "outerposition", get (ca(1), "outerposition"));
-
-                    ## Create a new set of lines with the appropriate
-                    ## displaynames, etc
-                    toberm = [];
-                    hobj = get (kids(i), "children");
-                    for j = numel (hobj) : -1 : 1
-                      if (! strcmp (get (hobj(j), "type"), "text"))
-                        continue;
-                      endif
-                      displayname = get (hobj(j), "string");
-                      ll = [];
-                      lm = [];
-                      for k = numel (hobj) : -1 : 1
-                        if (! strcmp (get (hobj(k), "type"), "line"))
-                          continue;
-                        endif
-                        if (get (hobj(j), "userdata")
-                            != get (hobj(k), "userdata"))
-                          continue;
-                        endif
-                        if (! strcmp (get (hobj(k), "linestyle"), "none"))
-                          ll = hobj(k);
-                        endif
-                        if (! strcmp (get (hobj(k), "marker"), "none"))
-                          lm = hobj(k);
-                        endif
-                      endfor
-
-                      if (! isempty (ll))
-                        if (!isempty (lm))
-                          toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", get(ll,"linestyle"), "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
-                        else
-                          toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(ll,"color"), "linestyle", get(ll,"linestyle"), "marker", "none", "displayname", displayname, "parent", kids(i))];
-                        endif
-                      elseif (! isempty (lm))
-                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", "none", "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
-                      endif
-                    endfor
-                    if (bg_is_set)
-                      fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
-                    endif
-                    __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
-                                      bg_is_set, false, hlgnd);
-                  unwind_protect_cleanup
-                    ## Return axes "units" and "position" back to
-                    ## their original values.
-                    set (ca, "units", orig_axes_units);
-                    set (kids(i), "units", legend_axes_units,
-                         "box", legend_axes_box,
-                         "ylim", legend_axes_ylim,
-                         "position", legend_axes_position,
-                         "outerposition", legend_axes_outerposition);
-                    delete (toberm);
-                    bg_is_set = false;
-                  end_unwind_protect
-                endif
-              else
-                ## Rely upon listener to convert axes position
-                ## to "normalized" units.
-                orig_axes_units = get (kids(i), "units");
-                orig_axes_position = get (kids(i), "position");
-                unwind_protect
-                  set (kids(i), "units", "normalized");
-                  fg = get (kids(i), "color");
-                  if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on"))
-                    fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg);
-                    fg_is_set = true;
-                    fg_was_set = true;
-                  elseif (fg_was_set)
-                    fprintf (plot_stream, "unset obj 2\n");
-                    fg_is_set = false;
-                    fg_was_set = false;
-                  else
-                    fg_is_set = false;
-                  endif
-                  if (bg_is_set)
-                    fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
-                  endif
-                  ## Find if this axes has an associated legend axes and pass it
-                  ## to __go_draw_axes__
-                  hlegend = [];
-                  fkids = get (h, "children");
-                  for j = 1 : numel (fkids)
-                    if (ishandle (fkids (j))
-                        && strcmp (get (fkids (j), "type"), "axes")
-                        && (strcmp (get (fkids (j), "tag"), "legend")))
-                      udata = get (fkids (j), "userdata");
-                      if (isscalar (udata.handle)
-                          && ! isempty (intersect (udata.handle, kids (i))))
-                        hlegend = get (fkids (j));
-                        break;
-                      endif
-                    endif
-                  endfor
-                  __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
-                                    bg_is_set, fg_is_set, hlegend);
-                unwind_protect_cleanup
-                  ## Return axes "units" and "position" back to
-                  ## their original values.
-                  set (kids(i), "units", orig_axes_units);
-                  set (kids(i), "position", orig_axes_position);
-                  bg_is_set = false;
-                  fg_is_set = false;
-                end_unwind_protect
-              endif
-            case "uimenu"
-              ## ignore uimenu objects
-              kids(i) = [];
-            otherwise
-              error ("__go_draw_figure__: unknown object class, %s", type);
-          endswitch
-        endfor
-        if (isempty (kids))
-          fputs (plot_stream, "\nreset; clear;\n");
-          fflush (plot_stream);
-        else
-          fputs (plot_stream, "\nunset multiplot;\n");
-        endif
-      else
-        fputs (plot_stream, "\nreset; clear;\n");
-        fflush (plot_stream);
-      endif
-    else
-      error ("__go_draw_figure__: expecting figure object, found '%s'",
-             htype);
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
--- a/scripts/plot/private/__interp_cube__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-##
-## Author: Martin Helm <martin@mhelm.de>
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
-## Undocumented internal function.
-## @end deftypefn
-
-function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" )
-  if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3 ...
-       && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val))
-    x = squeeze (x(1,:,1))(:);
-    y = squeeze (y(:,1,1))(:);
-    z = squeeze (z(1,1,:))(:);
-  elseif (isvector (x) && isvector (y) && isvector (z) )
-    x = x(:);
-    y = y(:);
-    z = z(:);
-  else
-    error ("__interp_cube__: X, Y, Z have wrong dimensions");
-  endif
-  if (size (val) != [length(x), length(y), length(z)])
-    error ("__interp_cube__: VAL has wrong dimensions");
-  endif
-  if (columns (v) != 3)
-    error ( "v has to be N*3 matrix");
-  endif
-  if (!ischar (req))
-   error ("__interp_cube__: Invalid request parameter use 'values', 'normals' or 'normals8'");
-  endif
-  if (isempty (v))
-    Vxyz = idx = frac = [];
-    return
-  endif
-
-  switch (req)
-    case "values"
-      [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
-    case "normals"
-      [idx, frac] = cube_idx (x, y, z, v);
-
-      dx = x(2:end) - x(1:end-1);
-      dy = y(2:end) - y(1:end-1);
-      dz = z(2:end) - z(1:end-1);
-      dx = 0.5 .* [dx;dx(end)](idx(:,2));
-      dy = 0.5 .* [dy;dy(end)](idx(:,1));
-      dz = 0.5 .* [dz;dz(end)](idx(:,3));
-
-      p000 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) - dz];
-      p100 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) - dz];
-      p010 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) - dz];
-      p001 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) + dz];
-      p011 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) + dz];
-      p101 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) + dz];
-      p110 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) - dz];
-      p111 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) + dz];
-
-      v000 = interp_cube_trilin (x, y, z, val, p000);
-      v100 = interp_cube_trilin (x, y, z, val, p100);
-      v010 = interp_cube_trilin (x, y, z, val, p010);
-      v001 = interp_cube_trilin (x, y, z, val, p001);
-      v011 = interp_cube_trilin (x, y, z, val, p011);
-      v101 = interp_cube_trilin (x, y, z, val, p101);
-      v110 = interp_cube_trilin (x, y, z, val, p110);
-      v111 = interp_cube_trilin (x, y, z, val, p111);
-
-      Dx = -v000 .+ v100 .- v010 .- v001 .- v011 .+ v101 .+ v110 .+ v111;
-      Dy = -v000 .- v100 .+ v010 .- v001 .+ v011 .- v101 .+ v110 .+ v111;
-      Dz = -v000 .- v100 .- v010 .+ v001 .+ v011 .+ v101 .- v110 .+ v111;
-      Vxyz = 0.5 .* [Dx./dx, Dy./dy, Dz./dz];
-    case "normals8"
-      [idx, frac] = cube_idx (x, y, z, v);
-
-      dx = x(2:end) - x(1:end-1);
-      dy = y(2:end) - y(1:end-1);
-      dz = z(2:end) - z(1:end-1);
-      dx = [dx;dx(end)](idx(:,2));
-      dy = [dy;dy(end)](idx(:,1));
-      dz = [dz;dz(end)](idx(:,3));
-      [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v);
-      Vxyz = [Dx./dx, Dy./dy, Dz./dz];
-   otherwise
-     error ("__interp_cube__: Invalid request type '%s', use 'values', 'normals' or 'normals8'", req);
-  endswitch
-endfunction
-
-function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v)
-  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
-  sval = size (val);
-  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
-  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
-  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
-  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
-  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
-  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
-  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
-  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
-  Bx = frac(:, 1);
-  By = frac(:, 2);
-  Bz = frac(:, 3);
-  Vxyz = ...
-    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i100 ) .* Bx .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i010 ) .* (1 .- Bx) .* By .* (1 .- Bz) .+ ...
-    val( i001 ) .* (1 .- Bx) .* (1 .- By) .* Bz .+ ...
-    val( i011 ) .* (1 .- Bx) .* By .* Bz .+ ...
-    val( i101 ) .* Bx .* (1 .- By) .* Bz .+ ...
-    val( i110 ) .* Bx .* By .* (1 .- Bz) .+ ...
-    val( i111 ) .* Bx .* By .* Bz;
-endfunction
-
-function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v)
-  [idx, frac] = cube_idx (x(:), y(:), z(:), v);
-  sval = size (val);
-  i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3));
-  i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3));
-  i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3));
-  i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1);
-  i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1);
-  i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1);
-  i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3));
-  i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 );
-  Bx = frac(:, 1);
-  By = frac(:, 2);
-  Bz = frac(:, 3);
-  Dx = ...
-    val( i000 ) .* -1 .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i100 ) .* (1 .- By) .* (1 .- Bz) .+ ...
-    val( i010 ) .* -1 .* By .* (1 .- Bz) .+ ...
-    val( i001 ) .* -1 .* (1 .- By) .* Bz .+ ...
-    val( i011 ) .* -1 .* By .* Bz .+ ...
-    val( i101 ) .* (1 .- By) .* Bz .+ ...
-    val( i110 ) .* By .* (1 .- Bz) .+ ...
-    val( i111 ) .* By .* Bz;
-  Dy = ...
-    val( i000 ) .* (1 .- Bx) .* -1 .* (1 .- Bz) .+ ...
-    val( i100 ) .* Bx .* -1 .* (1 .- Bz) .+ ...
-    val( i010 ) .* (1 .- Bx) .* (1 .- Bz) .+ ...
-    val( i001 ) .* (1 .- Bx) .* -1 .* Bz .+ ...
-    val( i011 ) .* (1 .- Bx) .* Bz .+ ...
-    val( i101 ) .* Bx .* -1 .* Bz .+ ...
-    val( i110 ) .* Bx .* (1 .- Bz) .+ ...
-    val( i111 ) .* Bx .* Bz;
-  Dz = ...
-    val( i000 ) .* (1 .- Bx) .* (1 .- By) .* -1 .+ ...
-    val( i100 ) .* Bx .* (1 .- By) .* -1 .+ ...
-    val( i010 ) .* (1 .- Bx) .* By .* -1 .+ ...
-    val( i001 ) .* (1 .- Bx) .* (1 .- By) .+ ...
-    val( i011 ) .* (1 .- Bx) .* By + ...
-    val( i101 ) .* Bx .* (1 .- By) .+ ...
-    val( i110 ) .* Bx .* By .* -1 .+ ...
-    val( i111 ) .* Bx .* By;
-endfunction
-
-function [idx, frac] = cube_idx (x, y, z, v)
-  idx = zeros (size (v));
-  frac = zeros (size (v));
-  idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1;
-  frac(:, 2) = (v(:, 1) - x(idx(:, 2)) )...
-      ./ (x(idx(:, 2)+1) - x(idx(:, 2)));
-  idx(:, 1) = lookup (y(2:end-1), v(:, 2)) + 1;
-  frac(:, 1) = (v(:, 2) - y(idx(:, 1))) ...
-      ./ (y(idx(:, 1)+1) - y(idx(:, 1)));
-  idx(:, 3) = lookup (z(2:end-1), v(:, 3)) + 1;
-  frac(:, 3) = (v(:, 3) - z(idx(:, 3))) ...
-      ./ (z(idx(:, 3)+1) - z(idx(:, 3)));
-endfunction
--- a/scripts/plot/private/__is_function__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function result = __is_function__ (func)
-
-  existval = exist (func);
-  result = (existval == 2 || existval == 3 || existval == 5 || existval == 6);
-
-endfunction
--- a/scripts/plot/private/__line__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-## Copyright (C) 2005-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __line__ (@var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## __line__ (p, x, y, z)
-## Create line object from x, y, and z with parent p.
-## Return handle to line object.
-
-## Author: jwe
-
-function h = __line__ (p, varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  nvargs = numel (varargin);
-
-  if (nvargs > 1 && ! ischar (varargin{1}) && ! ischar (varargin{2}))
-    if (nvargs > 2 && ! ischar (varargin{3}))
-      num_data_args = 3;
-    else
-      num_data_args = 2;
-    endif
-  else
-    num_data_args = 0;
-  endif
-
-  if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args}))
-    n = 1:num_data_args;
-    m = cellfun (@numel, varargin(1:num_data_args));
-    [~, m] = max (m);
-    b = ones (size (varargin{m(1)}));
-    try
-      varargin(n) = cellfun (@(x) bsxfun (@times, b, x), varargin(n), "uniformoutput", false);
-    catch
-      error ("line: number of X, Y, and Z points must be equal");
-    end_try_catch
-  endif
-
-  if (rem (nvargs - num_data_args, 2) != 0)
-    error ("line: invalid number of PROPERTY / VALUE pairs");
-  endif
-
-  other_args = {};
-  if (nvargs > num_data_args)
-    other_args = varargin(num_data_args+1:end);
-  endif
-
-  nlines = 0;
-  nvecpts = 0;
-  ismat = false (1, 3);
-  for i = 1:num_data_args
-    tmp = varargin{i}(:,:);
-    if (isvector (tmp))
-      nlines = max (1, nlines);
-      if (! isscalar (tmp))
-        if (nvecpts == 0)
-          nvecpts = numel (tmp);
-        elseif (nvecpts != numel (tmp))
-          error ("line: data size mismatch");
-        endif
-      endif
-    else
-      ismat(i) = true;
-      nlines = max (columns (tmp), nlines);
-    endif
-    varargin{i} = tmp;
-  endfor
-
-  if (num_data_args == 0)
-    varargin = {[0, 1], [0, 1]};
-    num_data_args = 2;
-    nlines = 1;
-  endif
-
-  handles = zeros (nlines, 1);
-
-  data = cell (1, 3);
-
-  if (num_data_args > 1)
-    data(1:num_data_args) = varargin(1:num_data_args);
-    for i = 1:num_data_args
-      if (islogical (data{i}))
-        data(i) = double (data{i});
-      elseif (iscomplex (data{i}))
-        data(i) = real (data{i});
-      endif
-    endfor
-  endif
-
-  data_args = reshape ({"xdata", "ydata", "zdata"; data{:}}, [1, 6]);
-  mask = reshape ([false(1,3); ismat], [1, 6]);
-
-  for i = 1:nlines
-    tmp = data(ismat);
-    if (! size_equal (tmp)
-        || (nvecpts != 0 && any (nvecpts != cellfun ("size", tmp, 1))))
-      error ("line: data size_mismatch");
-    endif
-
-    data_args(mask) = cellfun (@(x) x(:,i), data(ismat),
-                               "uniformoutput", false);
-
-    handles(i) = __go_line__ (p, data_args{:}, other_args{:});
-
-  endfor
-
-  if (nargout > 0)
-    h = handles;
-  endif
-
-endfunction
--- a/scripts/plot/private/__marching_cube__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,530 +0,0 @@
-## Copyright (C) 2009-2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-## Undocumented internal function.
-## @end deftypefn
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {Function File} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
-##
-## Return the triangulation information @var{t} at points @var{p} for
-## the isosurface values resp. the volume data @var{val} and the iso
-## level @var{iso}.  It is considered that the volume data @var{val} is
-## given at the points @var{x}, @var{y} and @var{z} which are of type
-## three--dimensional numeric arrays.  The orientation of the triangles
-## is choosen such that the normals point from the higher values to the
-## lower values.
-##
-## Optionally the color data @var{col} can be passed to this function
-## whereas computed vertices color data @var{c} is returned as third
-## argument.
-##
-## The marching cube algorithm is well known and described, for example, at
-## Wikipedia.  The triangulation lookup table and the edge table used
-## here are based on Cory Gene Bloyd's implementation and can be found
-## beyond other surface and geometry stuff at Paul Bourke's website
-## @uref{http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise}.
-##
-## For example:
-##
-## @example
-## @group
-## N = 20;
-## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
-##
-## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
-## [t, p] = __marching_cube__ (x, y, z, c, .5);
-##
-## figure ();
-## trimesh (t, p(:,1), p(:,2), p(:,3));
-## @end group
-## @end example
-##
-## Instead of the @command{trimesh} function the @command{patch}
-## function can be used to visualize the geometry.  For example:
-##
-## @example
-## @group
-## figure (); view (-38, 20);
-## pa = patch ("Faces", t, "Vertices", p, "FaceVertexCData", p, \
-##             "FaceColor", "interp", "EdgeColor", "none");
-##
-## ## Revert normals
-## set (pa, "VertexNormals", -get (pa, "VertexNormals"));
-##
-## ## Set lightning (available with the JHandles package)
-## # set (pa, "FaceLighting", "gouraud");
-## # light ( "Position", [1 1 5]);
-## @end group
-## @end example
-##
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors)
-
-  persistent edge_table=[];
-  persistent tri_table=[];
-
-  calc_cols = false;
-  lindex = 4;
-
-  if (isempty (tri_table) || isempty (edge_table))
-    [edge_table, tri_table] = init_mc ();
-  endif
-
-  if ((nargin != 5 && nargin != 6) || (nargout != 2 && nargout != 3))
-    print_usage ();
-  endif
-
-  if (!ismatrix (xx) || !ismatrix (yy) || !ismatrix (zz) || !ismatrix (c) || ...
-    ndims (xx) != 3 || ndims (yy) != 3 || ndims (zz) != 3 || ndims (c) != 3)
-    error ("__marching_cube__: XX, YY, ZZ, C must be matrices of dim 3");
-  endif
-
-  if (!size_equal (xx, yy, zz, c))
-    error ("__marching_cube__: XX, YY, ZZ, C must be of equal size");
-  endif
-
-  if (any (size (xx) < [2 2 2]))
-    error ("__marching_cube__: grid size must be at least 2x2x2");
-  endif
-
-  if (!isscalar (iso))
-    error ("__marching_cube__: ISO must be scalar value");
-  endif
-
-  if (nargin == 6)
-    if ( !ismatrix (colors) || ndims (colors) != 3 || size (colors) != size (c) )
-      error ( "COLORS must be a matrix of dim 3 and of same size as C" );
-    endif
-    calc_cols = true;
-    lindex = 5;
-  endif
-
-  n = size (c) - 1;
-
-  ## phase I: assign information to each voxel which edges are intersected by
-  ## the isosurface
-  cc = zeros (n(1), n(2), n(3), "uint16");
-  cedge = zeros (size (cc), "uint16");
-
-  vertex_idx = {1:n(1), 1:n(2), 1:n(3); ...
-    2:n(1)+1, 1:n(2), 1:n(3); ...
-    2:n(1)+1, 2:n(2)+1, 1:n(3); ...
-    1:n(1), 2:n(2)+1, 1:n(3); ...
-    1:n(1), 1:n(2), 2:n(3)+1; ...
-    2:n(1)+1, 1:n(2), 2:n(3)+1; ...
-    2:n(1)+1, 2:n(2)+1, 2:n(3)+1; ...
-    1:n(1), 2:n(2)+1, 2:n(3)+1 };
-
-  ## calculate which vertices have values higher than iso
-  for ii=1:8
-    idx = c(vertex_idx{ii, :}) > iso;
-    cc(idx) = bitset (cc(idx), ii);
-  endfor
-
-  cedge = edge_table(cc+1); # assign the info about intersected edges
-  id =  find (cedge); # select only voxels which are intersected
-  if (isempty (id))
-    T = p = col = [];
-    return
-  endif
-
-  ## phase II: calculate the list of intersection points
-  xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2;  2, 1, 2; 2, 2, 2; 1, 2, 2];
-  edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8];
-  offset = sub2ind (size (c), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) -1;
-  pp = zeros (length (id), lindex, 12);
-  ccedge = [vec(cedge(id)), id];
-  ix_offset=0;
-  for jj=1:12
-    id__ = bitget (ccedge(:, 1), jj);
-    id_ = ccedge(id__, 2);
-    [ix iy iz] = ind2sub (size (cc), id_);
-    id_c = sub2ind (size (c), ix, iy, iz);
-    id1 = id_c + offset(edges(jj, 1));
-    id2 = id_c + offset(edges(jj, 2));
-    if (calc_cols)
-      pp(id__, 1:5, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2), colors(id1), colors(id2)), ...
-        (1:rows (id_))' + ix_offset ];
-    else
-      pp(id__, 1:4, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2)), ...
-        (1:rows (id_))' + ix_offset ];
-    endif
-    ix_offset += rows (id_);
-  endfor
-
-  ## phase III: calculate the triangulation from the point list
-  T = [];
-  tri = tri_table(cc(id)+1, :);
-  for jj=1:3:15
-    id_ = find (tri(:, jj)>0);
-    p = [id_, lindex*ones(rows (id_), 1),tri(id_, jj:jj+2)];
-    if (!isempty (p))
-      p1 = sub2ind (size (pp), p(:,1), p(:,2), p(:,3));
-      p2 = sub2ind (size (pp), p(:,1), p(:,2), p(:,4));
-      p3 = sub2ind (size (pp), p(:,1), p(:,2), p(:,5));
-      T = [T; pp(p1), pp(p2), pp(p3)];
-    endif
-  endfor
-
-  p = [];
-  col = [];
-  for jj = 1:12
-    idp = pp(:, lindex, jj) > 0;
-    if (any (idp))
-      p(pp(idp, lindex, jj), 1:3) = pp(idp, 1:3, jj);
-      if (calc_cols)
-        col(pp(idp, lindex, jj),1) = pp(idp, 4, jj);
-      endif
-    endif
-  endfor
-endfunction
-
-function p = vertex_interp (isolevel,p1x, p1y, p1z,...
-  p2x, p2y, p2z,valp1,valp2, col1, col2)
-
-  if (nargin == 9)
-    p = zeros (length (p1x), 3);
-  elseif (nargin == 11)
-    p = zeros (length (p1x), 4);
-  else
-    error ("__marching_cube__: wrong number of arguments");
-  endif
-  mu = zeros (length (p1x), 1);
-  id = abs (valp1-valp2) < (10*eps) .* (abs (valp1) .+ abs (valp2));
-  if (any (id))
-    p(id, 1:3) = [ p1x(id), p1y(id), p1z(id) ];
-    if (nargin == 11)
-      p(id, 4) = col1(id);
-    endif
-  endif
-  nid = !id;
-  if (any (nid))
-    mu(nid) = (isolevel - valp1(nid)) ./ (valp2(nid) - valp1(nid));
-    p(nid, 1:3) = [p1x(nid) + mu(nid) .* (p2x(nid) - p1x(nid)), ...
-      p1y(nid) + mu(nid) .* (p2y(nid) - p1y(nid)), ...
-      p1z(nid) + mu(nid) .* (p2z(nid) - p1z(nid))];
-    if (nargin == 11)
-      p(nid, 4) = col1(nid) + mu(nid) .* (col2(nid) - col1(nid));
-    endif
-  endif
-endfunction
-
-function [edge_table, tri_table] = init_mc ()
-  edge_table = [
-  0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, ...
-  0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, ...
-  0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, ...
-  0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, ...
-  0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, ...
-  0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, ...
-  0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, ...
-  0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, ...
-  0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, ...
-  0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, ...
-  0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, ...
-  0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, ...
-  0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, ...
-  0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, ...
-  0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , ...
-  0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, ...
-  0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, ...
-  0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, ...
-  0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, ...
-  0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, ...
-  0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, ...
-  0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, ...
-  0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, ...
-  0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, ...
-  0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, ...
-  0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, ...
-  0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, ...
-  0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, ...
-  0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, ...
-  0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, ...
-  0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, ...
-  0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   ];
-
-  tri_table =[
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1;
-  3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1;
-  3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1;
-  3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1;
-  9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
-  2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1;
-  8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
-  4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1;
-  3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1;
-  1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1;
-  4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1;
-  4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
-  5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1;
-  2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1;
-  9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1;
-  0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1;
-  2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1;
-  10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1;
-  5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1;
-  5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1;
-  9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1;
-  1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1;
-  10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1;
-  8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1;
-  2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1;
-  7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1;
-  2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1;
-  11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1;
-  5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1;
-  11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1;
-  11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1;
-  9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1;
-  2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1;
-  6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1;
-  3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1;
-  6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1;
-  10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1;
-  6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1;
-  8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1;
-  7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1;
-  3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1;
-  5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1;
-  0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1;
-  9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1;
-  8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1;
-  5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1;
-  0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1;
-  6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1;
-  10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1;
-  10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1;
-  8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1;
-  1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1;
-  0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1;
-  10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1;
-  3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1;
-  6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1;
-  9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1;
-  8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1;
-  3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1;
-  6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1;
-  0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1;
-  10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1;
-  10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1;
-  2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1;
-  7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1;
-  7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1;
-  2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1;
-  1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1;
-  11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1;
-  8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1;
-  0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1;
-  7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
-  10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
-  2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1;
-  6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1;
-  7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1;
-  2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1;
-  1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1;
-  10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1;
-  10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1;
-  0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1;
-  7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1;
-  6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1;
-  8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1;
-  9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1;
-  6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1;
-  4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1;
-  10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1;
-  8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1;
-  0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1;
-  1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1;
-  8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1;
-  10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1;
-  4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1;
-  10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1;
-  5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
-  11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1;
-  9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1;
-  6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1;
-  7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1;
-  3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1;
-  7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1;
-  3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1;
-  6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1;
-  9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1;
-  1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1;
-  4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1;
-  7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1;
-  6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1;
-  3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1;
-  0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1;
-  6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1;
-  0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1;
-  11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1;
-  6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1;
-  5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1;
-  9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1;
-  1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1;
-  1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1;
-  10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1;
-  0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1;
-  5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1;
-  10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1;
-  11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1;
-  9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1;
-  7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1;
-  2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1;
-  8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1;
-  9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1;
-  9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1;
-  1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1;
-  9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1;
-  9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1;
-  5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1;
-  0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1;
-  10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1;
-  2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1;
-  0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1;
-  0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1;
-  9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1;
-  5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1;
-  3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1;
-  5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1;
-  8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1;
-  0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1;
-  9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1;
-  0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1;
-  1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1;
-  3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1;
-  4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1;
-  9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1;
-  11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1;
-  11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1;
-  2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1;
-  9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1;
-  3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1;
-  1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1;
-  4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1;
-  4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1;
-  0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1;
-  3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1;
-  3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1;
-  0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1;
-  9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1;
-  1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ] + 1;
-endfunction
--- a/scripts/plot/private/__next_line_color__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{rgb} =} __next_line_color__ (@var{reset})
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the next line color in the rotation.
-
-## Author: jwe
-
-function rgb = __next_line_color__ (reset)
-
-  persistent color_rotation;
-  persistent num_colors;
-  persistent color_index;
-
-  if (nargin < 2)
-    if (nargin == 1)
-      if (reset || isempty (color_rotation))
-        color_rotation = get (gca (), "colororder");
-        num_colors = rows (color_rotation);
-        color_index = 1;
-      endif
-    elseif (! isempty (color_rotation))
-      rgb = color_rotation(color_index,:);
-      if (++color_index > num_colors)
-        color_index = 1;
-        __next_line_style__ ("incr");
-      endif
-    else
-      error ("__next_line_color__: color_rotation not initialized");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
--- a/scripts/plot/private/__next_line_style__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset})
-## Undocumented internal function.
-## @end deftypefn
-
-## Return the next line style in the rotation.
-
-
-function [linestyle, marker] = __next_line_style__ (reset)
-
-  persistent style_rotation;
-  persistent num_styles;
-  persistent style_index;
-
-  if (nargin < 2)
-    if (nargin == 1)
-      if (ischar (reset) && strncmp (reset, "incr", 4))
-        if (isempty (style_rotation))
-          error ("__next_line_style__: style_rotation not initialized");
-        elseif (++style_index > num_styles)
-          style_index = 1;
-        endif
-      elseif (reset || isempty (style_rotation))
-        style_rotation = get (gca (), "linestyleorder");
-        if (ischar (style_rotation))
-          style_rotation = ostrsplit (style_rotation, "|");
-        endif
-        num_styles = length (style_rotation);
-        style_index = 1;
-      endif
-    elseif (! isempty (style_rotation))
-      options = __pltopt__ ("__next_line_style__",
-                            style_rotation (style_index));
-      linestyle = options.linestyle;
-      marker = options.marker;
-    else
-      error ("__next_line_style__: style_rotation not initialized");
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
--- a/scripts/plot/private/__patch__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton, Shai Ayal, Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-## __patch__ (p, x, y, c)
-## Create patch object from x and y with color c and parent p.
-## Return handle to patch object.
-
-## Author: Kai Habel
-
-function [h, failed] = __patch__ (p, varargin)
-
-  h = NaN;
-  failed = false;
-
-  is_numeric_arg = cellfun (@isnumeric, varargin);
-
-  if (isempty (varargin))
-    args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]};
-    args = setvertexdata (args);
-  elseif (isstruct (varargin{1}))
-    if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
-      args{1} = "faces";
-      args{2} = getfield (varargin{1}, "faces");
-      args{3} = "vertices";
-      args{4} = getfield (varargin{1}, "vertices");
-      args{5} = "facevertexcdata";
-      if (isfield (varargin{1}, "facevertexcdata"))
-        args{6} = getfield (varargin{1}, "facevertexcdata");
-      else
-        args{6} = [];
-      endif
-      args = [args; varargin(2:end)];
-      args = setdata (args);
-    else
-      failed = true;
-    endif
-  elseif (is_numeric_arg(1))
-    if (nargin < 3 || ! is_numeric_arg(2))
-      failed = true;
-    else
-
-      if (nargin > 4 && all (is_numeric_arg(1:4)))
-        x = varargin{1};
-        y = varargin{2};
-        z = varargin{3};
-        c = varargin{4};
-        iarg = 5;
-      elseif (nargin > 3 && all (is_numeric_arg(1:3)))
-        x = varargin{1};
-        y = varargin{2};
-        iarg = 4;
-        if (rem (nargin - iarg, 2) == 1)
-          c = varargin {iarg};
-          z = varargin{3};
-          iarg = 5;
-        else
-          z = [];
-          c = varargin{3};
-        endif
-      elseif (nargin > 2 && all (is_numeric_arg(1:2)))
-        x = varargin{1};
-        y = varargin{2};
-        z = [];
-        iarg = 3;
-        if (rem (nargin - iarg, 2) == 1)
-          c = varargin {iarg};
-          iarg++; 
-        else
-          c = [];
-        endif
-      endif
-
-      if (isvector (x))
-        x = x(:);
-        y = y(:);
-        z = z(:);
-        if (isnumeric (c))
-          if (isvector (c) && numel (c) == numel (x))
-            c = c(:);
-          elseif (rows (c) != numel (x) && columns (c) == numel (x))
-            c = c.';
-          endif
-        endif
-      endif
-      args{1} = "xdata";
-      args{2} = x;
-      args{3} = "ydata";
-      args{4} = y;
-      args{5} = "zdata";
-      args{6} = z;
-
-      if (isnumeric (c))
-
-        if (ndims (c) == 3 && columns (c) == 1)
-          c = permute (c, [1, 3, 2]);
-        endif
-
-        if (isvector (c) && numel (c) == columns (x))
-          if (isnan (c))
-            args{7} = "facecolor";
-            args{8} = [1, 1, 1];
-            args{9} = "cdata";
-            args{10} = c;
-          elseif (isnumeric (c))
-            args{7} = "facecolor";
-            args{8} = "flat";
-            args{9} = "cdata";
-            args{10} = c;
-          else
-            error ("patch: color value not valid");
-          endif
-        elseif (isvector (c) && numel (c) == 3)
-          args{7} = "facecolor";
-          args{8} = c;
-          args{9} = "cdata";
-          args{10} = [];
-        elseif (ndims (c) == 3 && size (c, 3) == 3)
-          ## CDATA is specified as RGB data
-          if ((rows (c) == 1 && columns (c) == 1) ...
-              || (rows (c) == 1 && columns (c) == columns (x)))
-            ## Single patch color or per-face color
-            args{7} = "facecolor";
-            args{8} = "flat";
-            args{9} = "cdata";
-            args{10} = c;
-          elseif (rows (c) == rows (x) && columns (c) == columns (x))
-            ## Per-vertex color
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            agrs{10} = c;
-          else
-            error ("patch: color value not valid");
-          endif
-        else
-          ## Color Vectors
-          if (isempty (c))
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            args{10} = [];
-          elseif (isequal (size (c), size (x)) && isequal (size (c), size (y)))
-            args{7} = "facecolor";
-            args{8} = "interp";
-            args{9} = "cdata";
-            args{10} = c;
-          else
-            error ("patch: size of x, y, and c must be equal");
-          endif
-        endif
-      elseif (ischar (c) && rem (nargin - iarg, 2) == 0)
-        ## Assume that any additional argument over an even number is
-        ## color string.
-        args{7} = "facecolor";
-        args{8} =  tolower (c);
-        args{9} = "cdata";
-        args{10} = [];
-      else
-        args{7} = "facecolor";
-        args{8} = [0, 1, 0];
-        args{9} = "cdata";
-        args{10} = [];
-      endif
-
-      args = [args, varargin(iarg:end)];
-      args = setvertexdata (args);
-    endif
-  else
-    args = varargin;
-    if (any (strcmpi (args, "faces") | strcmpi (args, "vertices")))
-      args = setdata (args);
-    else
-      args = setvertexdata (args);
-    endif
-  endif
-
-  if (!failed)
-    h = __go_patch__ (p, args {:});
-
-    ## Setup listener functions
-    addlistener (h, "xdata", @update_data);
-    addlistener (h, "ydata", @update_data);
-    addlistener (h, "zdata", @update_data);
-    addlistener (h, "cdata", @update_data);
-
-    addlistener (h, "faces", @update_fvc);
-    addlistener (h, "vertices", @update_fvc);
-    addlistener (h, "facevertexcdata", @update_fvc);
-  endif
-endfunction
-
-function args = delfields (args, flds)
-  idx = cellfun (@(x) any (strcmpi (x, flds)), args);
-  if (rows (idx) == 1)
-    idx = idx | [false, idx(1:end-1)];
-  else
-    idx = idx | [false; idx(1:end-1)];
-  endif
-  args (idx) = [];
-endfunction
-
-function args = setdata (args)
-  args = delfields (args, {"xdata", "ydata", "zdata", "cdata"});
-  ## Remove the readonly fields as well
-  args = delfields (args, {"type", "uicontextmenu"});
-  nargs = length (args);
-  idx = find (strcmpi (args, "faces"), 1, "last") + 1;
-  if (idx > nargs)
-    faces = [];
-  else
-    faces = args {idx};
-  endif
-  idx = find (strcmpi (args, "vertices"), 1, "last") + 1;
-  if (idx > nargs)
-    vert = [];
-  else
-    vert = args {idx};
-  endif
-  idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    fvc = [];
-  else
-    fvc = args {idx};
-  endif
-  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    if (!isempty (fvc))
-      fc = "flat";
-    else
-      fc = [0, 1, 0];
-    endif
-    args = {"facecolor", fc, args{:}};
-  endif
-
-  nc = rows (faces);
-  idx = faces .';
-  t1 = isnan (idx);
-  for i = find (any (t1))
-    first_idx_in_column = find (t1(:,i), 1);
-    idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i);
-  endfor
-  x = reshape (vert(:,1)(idx), size (idx));
-  y = reshape (vert(:,2)(idx), size (idx));
-  if (columns (vert) > 2)
-    z = reshape (vert(:,3)(idx), size (idx));
-  else
-    z = [];
-  endif
-
-  if (rows (fvc) == nc || rows (fvc) == 1)
-    c = reshape (fvc, [1, size(fvc)]);
-  else
-    if (columns (fvc) == 3)
-      c = cat (3, reshape (fvc(idx, 1), size (idx)),
-               reshape (fvc(idx, 2), size (idx)),
-               reshape (fvc(idx, 3), size (idx)));
-    elseif (isempty (fvc))
-      c = [];
-    else ## if (columnns (fvc) == 1)
-      c = permute (fvc(faces), [2, 1]);
-    endif
-  endif
-  args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}};
-endfunction
-
-function args = setvertexdata (args)
-  args = delfields (args, {"vertices", "faces", "facevertexcdata"});
-  ## Remove the readonly fields as well
-  args = delfields (args, {"type", "uicontextmenu"});
-  nargs = length (args);
-  idx = find (strcmpi (args, "xdata"), 1, "last") + 1;
-  if (idx > nargs)
-    x = [];
-  else
-    x = args {idx};
-  endif
-  idx = find (strcmpi (args, "ydata"), 1, "last") + 1;
-  if (idx > nargs)
-    y = [];
-  else
-    y = args {idx};
-  endif
-  idx = find (strcmpi (args, "zdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    z = [];
-  else
-    z = args {idx};
-  endif
-  idx = find (strcmpi (args, "cdata"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    c = [];
-  else
-    c = args {idx};
-  endif
-  idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
-  if (isempty (idx) || idx > nargs)
-    if (!isempty (c))
-      fc = "flat";
-    else
-      fc = [0, 1, 0];
-    endif
-    args = {"facecolor", fc, args{:}};
-  endif
-
-  [nr, nc] = size (x);
-  if (nr == 1 && nc > 1)
-    nr = nc;
-    nc = 1;
-  endif
-  if (!isempty (z))
-    vert = [x(:), y(:), z(:)];
-  else
-    vert = [x(:), y(:)];
-  endif
-  faces = reshape (1:numel (x), nr, nc);
-  faces = faces';
-
-  if (ndims (c) == 3)
-    fvc = reshape (c, rows (c) * columns (c), size (c, 3));
-  else
-    fvc = c(:);
-  endif
-
-  args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};
-endfunction
-
-function update_data (h, d)
-  update_handle (h, false);
-endfunction
-
-function update_fvc (h, d)
-  update_handle (h, true);
-endfunction
-
-function update_handle (h, isfv)
-  persistent recursive = false;
-
-  if (! recursive)
-    recursive = true;
-    f = get (h);
-    if (isfv)
-      set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:});
-    else
-      set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:});
-    endif
-    recursive = false;
-  endif
-endfunction
--- a/scripts/plot/private/__pie__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-## Copyright (C) 2010 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hlist} =} __pie__ (caller, @dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hlist = __pie__ (caller, varargin)
-
-  h = varargin{1};
-  x = abs (varargin{2});
-  iarg = 3;
-
-  if (! isvector (x))
-    error ("%s: expecting vector argument", caller);
-  endif
-
-  len = length (x);
-
-  have_explode = false;
-  have_labels = false;
-
-  while (iarg <= nargin - 1)
-    arg = varargin{iarg++};
-    if (iscell (arg))
-      labels = arg;
-      have_labels = true;
-      if (numel (x) != numel (labels))
-        error ("%s: mismatch in number of labels and data", caller);
-      endif
-    elseif (isnumeric (arg) || islogical (arg))
-      explode = arg;
-      have_explode = true;
-      if (! size_equal (x, explode))
-        error ("%s: mismatch in number of elements in explode and data",
-               caller);
-      endif
-    else
-      error ("%s: %s is invalid as an optional argument", caller, class (arg));
-    endif
-  endwhile
-
-  if (! have_explode)
-    explode = zeros (size (x));
-  endif
-
-  normalize = true;
-  if (sum (x(:)) < 1)
-    normalize = false;
-  endif
-
-  if (! have_labels)
-    if (normalize)
-      xp = round (100 * x ./ sum (x));
-    else
-      xp = round (100 * x);
-    endif
-    for i = 1:len
-      labels{i} = sprintf ("%d%%", xp(i));
-    endfor
-  endif
-
-  hlist = [];
-  refinement = 90;
-  phi = 0:refinement:360;
-  if (normalize)
-    xphi = cumsum (x / sum (x) * 360);
-  else
-    xphi = cumsum (x * 360);
-  endif
-
-  for i = 1:len
-    if (i == 1)
-      xn = 0 : 360 / refinement : xphi(i);
-    else
-      xn = xphi(i-1) : 360 / refinement : xphi(i);
-    endif
-
-    if (xn(end) != xphi(i))
-      xn = [xn, xphi(i)];
-    endif
-
-    xn2 = (xn(1) + xn(end)) / 2;
-    if (explode (i))
-      xoff = - 0.1 * sind (xn2);
-      yoff = 0.1 * cosd (xn2);
-    else
-      xoff = 0;
-      yoff = 0;
-    endif
-    xt = - 1.2 * sind (xn2);
-    yt = 1.2 * cosd (xn2);
-
-    if (len == 1)
-      set (h, "clim", [1, 2]);
-    else
-      set (h, "clim", [1, len]);
-    endif
-
-    if (strncmp (caller, "pie3", 4))
-      ln = length (xn);
-      zlvl = 0.35;
-      sx = repmat (xoff + [0, -sind(xn), 0], [2, 1]);
-      sy = repmat (yoff + [0, cosd(xn), 0], [2, 1]);
-      sz = [zeros(1, ln + 2); zlvl * ones(1, ln + 2)];
-      sc = i * ones (size (sz));
-
-      hlist = [hlist;
-        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i);
-        surface(sx, sy, sz, sc);
-        patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i);
-        text(xt, yt, zlvl, labels{i})];
-
-    elseif (strncmp (caller, "pie", 3))
-      if (xt > 0)
-        align = "left";
-      else
-        align = "right";
-      endif
-
-      hlist = [hlist; patch(xoff + [0, -sind(xn)], yoff + [0, cosd(xn)], i);
-               text(xt, yt, labels{i}, "horizontalalignment", align)];
-
-    else
-      error ("__pie__: unknown caller '%s'", caller);
-    endif
-  endfor
-
-  addlistener (gca, "view", {@update_text_pos, hlist});
-
-  if (strncmp (caller, "pie3", 4))
-    axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off");
-    view (-37.5, 30);
-  elseif (strncmp (caller, "pie", 3))
-    axis ([-1.5, 1.5, -1.5, 1.5], "square", "off");
-  endif
-endfunction
-
-function update_text_pos (all_handles)
-  ## Text objects in the foreground should be at the base level.
-  ## Text objects in the background should be at the top level.
-  ## Text objects on the right side should be aligned to the right
-  ## and on the left side to the left.
-  tobj = findobj (all_handles, "type", "text");
-
-  ## check if we are called from pie3
-  s = findobj (all_handles, "type", "surface");
-  is_pie3 = false;
-  if (length (s) > 0)
-    is_pie3 = true;
-  endif
-
-  if (length (tobj) > 0)
-    ax = get (tobj(1), "parent");
-    azel = get (ax, "view");
-    pos = get (tobj, "position");
-    if (iscell (pos))
-      pos = cell2mat (pos);
-    endif
-    phi = atand (pos(:,1) ./ pos(:,2));
-    [theta, r] = cart2pol (pos(:,1), pos(:,2));
-    theta *= 180/pi;
-    theta -= azel(1);
-    theta = mod (theta, 360);
-    ud_mask = (theta > 180);
-    lr_mask = (theta > 90) & (theta < 270);
-    for i = 1 : length (tobj)
-      if (is_pie3)
-        if (ud_mask(i))
-          set (tobj(i), "position", [pos(i,1), pos(i,2), -0.05]);
-        else
-          set (tobj(i), "position", [pos(i,1), pos(i,2), 0.40]);
-        endif
-      endif
-
-      if (lr_mask(i))
-        set (tobj(i), "horizontalalignment", "right");
-      else
-        set (tobj(i), "horizontalalignment", "left");
-      endif
-    endfor
-  endif
-endfunction
--- a/scripts/plot/private/__plt__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,496 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __plt__ (@var{caller}, @var{h}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = __plt__ (caller, h, varargin)
-
-  nargs = nargin - 2;
-
-  if (nargs > 0)
-
-    k = 1;
-
-    x_set = false;
-    y_set = false;
-    property_set = false;
-    properties = {};
-
-    hlegend = [];
-    fkids = get (gcf (), "children");
-    for i = 1 : numel (fkids)
-      if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes")
-          && (strcmp (get (fkids (i), "tag"), "legend")))
-        udata = get (fkids (i), "userdata");
-        if (! isempty (intersect (udata.handle, gca ())))
-          hlegend = fkids (i);
-          break;
-        endif
-      endif
-    endfor
-
-    setlgnd = false;
-    if (isempty (hlegend))
-      hlgnd = [];
-      tlgnd = {};
-    else
-      [hlgnd, tlgnd] = __getlegenddata__ (hlegend);
-    endif
-
-    ## Gather arguments, decode format, gather plot strings, and plot lines.
-
-    retval = [];
-
-    while (nargs > 0 || x_set)
-
-      if (nargs == 0)
-        ## Force the last plot when input variables run out.
-        next_cell = {};
-        next_arg = {""};
-      else
-        next_cell = varargin(k);
-        next_arg = varargin{k++};
-      endif
-
-      nargs--;
-
-      if (ischar (next_arg) || iscellstr (next_arg))
-        if (x_set)
-          [options, valid] = __pltopt__ (caller, next_arg, false);
-          if (! valid)
-            if (nargs == 0)
-              error ("%s: properties must appear followed by a value", caller);
-            endif
-            properties = [properties, [next_cell, varargin(k++)]];
-            nargs--;
-            continue;
-          else
-            while (nargs > 0 && ischar (varargin{k}))
-              if (nargs < 2)
-                error ("%s: properties must appear followed by a value",
-                       caller);
-              endif
-              properties = [properties, varargin(k:k+1)];
-              k += 2;
-              nargs -= 2;
-            endwhile
-          endif
-          if (y_set)
-            tmp = __plt2__ (h, x, y, options, properties);
-            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-            properties = {};
-            retval = [retval; tmp];
-          else
-            tmp = __plt1__ (h, x, options, properties);
-            [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-            properties = {};
-            retval = [retval; tmp];
-          endif
-          x_set = false;
-          y_set = false;
-        else
-          error ("plot: no data to plot");
-        endif
-      elseif (x_set)
-        if (y_set)
-          options = __pltopt__ (caller, {""});
-          tmp = __plt2__ (h, x, y, options, properties);
-          [hlgnd, tlgnd, setlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd, setlgnd);
-          retval = [retval; tmp];
-          x = next_arg;
-          y_set = false;
-          properties = {};
-        else
-          y = next_arg;
-          y_set = true;
-        endif
-      else
-        x = next_arg;
-        x_set = true;
-      endif
-
-    endwhile
-
-    if (setlgnd)
-      legend (gca (), hlgnd, tlgnd);
-    endif
-  else
-    error ("__plt__: invalid number of arguments");
-  endif
-
-endfunction
-
-function [hlgnd, tlgnd, setlgnd] = __plt_key__ (h, options, hlgnd, tlgnd, setlgnd)
-  n = numel (h);
-  if (numel (options) == 1)
-    options = repmat (options(:), n, 1);
-  endif
-
-  for i = 1 : n
-    key = options.key;
-    if (! isempty (key))
-      hlgnd = [hlgnd(:); h(i)];
-      tlgnd = {tlgnd{:}, key};
-      setlgnd = true;
-    endif
-  endfor
-endfunction
-
-function retval = __plt1__ (h, x1, options, properties = {})
-
-  if (nargin < 2 || nargin > 4)
-    print_usage ();
-  endif
-
-  if (nargin < 3 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (! isstruct (options))
-    error ("__plt1__: options must be a struct array");
-  endif
-
-  [nr, nc] = size (x1);
-  if (nr == 1)
-    x1 = x1.';
-    [nr, nc] = deal (nc, nr);   # Swap rows and columns
-  endif
-  if (iscomplex (x1))
-    x1_i = imag (x1);
-    if (any ((x1_i(:))))
-      x2 = x1_i;
-      x1 = real (x1);
-    else
-      x2 = x1;
-      x1 = (1:nr)';
-    endif
-  else
-    x2 = x1;
-    x1 = (1:nr)';
-  endif
-
-  retval = __plt2__ (h, x1, x2, options, properties);
-
-endfunction
-
-function retval = __plt2__ (h, x1, x2, options, properties = {})
-
-  if (nargin < 3 || nargin > 5)
-    print_usage ();
-  endif
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (! isstruct (options))
-    error ("__plt2__: options must be a struct array");
-  endif
-
-  if (islogical (x1))
-    x1 = int8 (x1);
-  elseif (iscomplex ((x1)))
-    x1 = real (x1);
-  endif
-
-  if (islogical (x2))
-    x2 = int8 (x2);
-  elseif (iscomplex (x2))
-    x2 = real (x2);
-  endif
-
-  h_set = false;
-  if (isempty (x1) && isempty (x2))
-    retval = zeros (0, 1);
-  elseif (isscalar (x1))
-    if (isscalar (x2))
-      retval = __plt2ss__ (h, x1, x2, options, properties);
-    elseif (isvector (x2))
-      retval = __plt2sv__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  elseif (isvector (x1))
-    if (isscalar (x2))
-      retval = __plt2vs__ (h, x1, x2, options, properties);
-    elseif (isvector (x2))
-      retval = __plt2vv__ (h, x1, x2, options, properties);
-    elseif (ismatrix (x2))
-      retval = __plt2vm__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  elseif (ismatrix (x1))
-    if (isvector (x2))
-      retval = __plt2mv__ (h, x1, x2, options, properties);
-    elseif (ismatrix (x2))
-      retval = __plt2mm__ (h, x1, x2, options, properties);
-    else
-      error ("__plt2__: invalid data for plotting");
-    endif
-  else
-    error ("__plt2__: invalid data for plotting");
-  endif
-
-endfunction
-
-function retval = __plt2mm__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  [x_nr, x_nc] = size (x);
-  [y_nr, y_nc] = size (y);
-
-  if (x_nr != y_nr && x_nc != y_nc)
-    error ("__plt2mm__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), x_nc, 1);
-  endif
-  retval = zeros (x_nc, 1);
-  for i = 1:x_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(:,i), y(:,i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2mv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  y = y(:);
-  [y_nr, y_nc] = size (y);
-  [x_nr, x_nc] = size (x);
-
-  if (x_nr == y_nr)
-    ## Correctly oriented.  Do nothing.
-  elseif (x_nc == y_nr)
-    x = x.';
-    [x_nr, x_nc] = deal (x_nc, x_nr);
-  else
-    error ("__plt2mv__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), x_nc, 1);
-  endif
-  retval = zeros (x_nc, 1);
-  for i = 1:x_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(:,i), y, "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2ss__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (numel (options) > 1)
-    options = options(1);
-  endif
-
-  linestyle = options.linestyle;
-  marker = options.marker;
-  if (isempty (marker) && isempty (linestyle))
-    ## If unspecified, marker for a single point is always "."
-    linestyle = "-";
-    marker = ".";
-  endif
-  color = options.color;
-  if (isempty (color))
-    color = __next_line_color__ ();
-  endif
-
-  retval = line (x, y, "color", color,
-                 "linestyle", linestyle,
-                 "marker", marker, properties{:});
-
-endfunction
-
-function retval = __plt2sv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  len = numel (y);
-  if (numel (options) == 1)
-    options = repmat (options(:), len, 1);
-  endif
-  retval = zeros (len, 1);
-  for i = 1:len
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      ## If unspecified, marker for a point is always "."
-      linestyle = "-";
-      marker = ".";
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x, y(i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vm__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  x = x(:);
-  [x_nr, x_nc] = size (x);
-  [y_nr, y_nc] = size (y);
-
-  if (x_nr == y_nr)
-    ## Correctly oriented.  Do nothing.
-  elseif (x_nr == y_nc)
-    y = y.';
-    [y_nr, y_nc] = deal (y_nc, y_nr);
-  else
-    error ("__plt2vm__: matrix dimensions must match");
-  endif
-
-  if (numel (options) == 1)
-    options = repmat (options(:), y_nc, 1);
-  endif
-  retval = zeros (y_nc, 1);
-  for i = 1:y_nc
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      [linestyle, marker] = __next_line_style__ ();
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x, y(:,i), "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vs__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  len = numel (x);
-  if (numel (options) == 1)
-    options = repmat (options(:), len, 1);
-  endif
-  retval = zeros (len, 1);
-  for i = 1:len
-    linestyle = options(i).linestyle;
-    marker = options(i).marker;
-    if (isempty (marker) && isempty (linestyle))
-      ## If unspecified, marker for a point is always "."
-      linestyle = "-";
-      marker = ".";
-    endif
-    color = options(i).color;
-    if (isempty (color))
-      color = __next_line_color__ ();
-    endif
-
-    retval(i) = line (x(i), y, "color", color,
-                      "linestyle", linestyle,
-                      "marker", marker, properties{:});
-  endfor
-
-endfunction
-
-function retval = __plt2vv__ (h, x, y, options, properties = {})
-
-  if (nargin < 4 || isempty (options))
-    options = __default_plot_options__ ();
-  endif
-
-  if (numel (options) > 1)
-    options = options(1);
-  endif
-
-  x = x(:);
-  y = y(:);
-
-  if (length (x) != length (y))
-    error ("__plt2vv__: vector lengths must match");
-  endif
-
-  linestyle = options.linestyle;
-  marker = options.marker;
-  if (isempty (marker) && isempty (linestyle))
-    [linestyle, marker] = __next_line_style__ ();
-  endif
-  color = options.color;
-  if (isempty (color))
-    color = __next_line_color__ ();
-  endif
-
-  retval = line (x, y, "color", color,
-            "linestyle", linestyle,
-            "marker", marker, properties{:});
-
-endfunction
-
--- a/scripts/plot/private/__pltopt__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
-## Undocumented internal function.
-## @end deftypefn
-
-## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
-##
-## Decode plot option strings.
-##
-## @var{opt} can currently be some combination of the following:
-##
-## @table @code
-## @item "-"
-## For solid linestyle (default).
-##
-## @item "--"
-## For dashed line style.
-##
-## @item "-."
-## For linespoints plot style.
-##
-## @item ":"
-## For dots plot style.
-##
-## @item "r"
-## Red line color.
-##
-## @item "g"
-## Green line color.
-##
-## @item "b"
-## Blue line color.
-##
-## @item "c"
-## Cyan line color.
-##
-## @item "m"
-## Magenta line color.
-##
-## @item "y"
-## Yellow line color.
-##
-## @item "k"
-## Black line color.
-##
-## @item "w"
-## White line color.
-##
-## @item ";title;"
-## Here @code{"title"} is the label for the key.
-##
-## @item "+"
-## @itemx "o"
-## @itemx "*"
-## @itemx "."
-## @itemx "x"
-## @itemx "s"
-## @itemx "d"
-## @itemx "^"
-## @itemx "v"
-## @itemx ">"
-## @itemx "<"
-## @itemx "p"
-## @itemx "h"
-## Used in combination with the points or linespoints styles, set the point
-## style.
-## @end table
-##
-## The legend may be fixed to include the name of the variable
-## plotted in some future version of Octave.
-
-## Author: jwe
-
-function [options, valid] = __pltopt__ (caller, opt, err_on_invalid)
-
-  valid = true;
-  options =  __default_plot_options__ ();
-
-  if ((nargin == 2 || nargin == 3) && (nargout == 1 || nargout == 2))
-    if (nargin == 2)
-      err_on_invalid = true;
-    endif
-    if (ischar (opt))
-      nel = rows (opt);
-    elseif (iscellstr (opt))
-      nel = numel (opt);
-    else
-      error ("__pltopt__: expecting argument to be character string or cell array of character strings");
-    endif
-    if (ischar (opt))
-      opt = cellstr (opt);
-    endif
-    for i = nel:-1:1
-      [options(i), valid] = __pltopt1__ (caller, opt{i}, err_on_invalid);
-      if (! err_on_invalid && ! valid)
-        return;
-      endif
-    endfor
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-## Really decode plot option strings.
-
-## Author: Rick Niles <niles@axp745.gsfc.nasa.gov>
-## Adapted-By: jwe
-## Maintainer: jwe
-
-function [options, valid] = __pltopt1__ (caller, opt, err_on_invalid)
-
-  options = __default_plot_options__ ();
-  valid = true;
-
-  more_opts = 1;
-
-  if (nargin != 2 && nargin != 3)
-    print_usage ();
-  endif
-
-  if (! ischar (opt))
-    return;
-  endif
-
-  have_linestyle = false;
-  have_marker = false;
-
-  ## If called by __errplot__, extract the linestyle before proceeding.
-  if (strcmp (caller,"__errplot__"))
-    if (strncmp (opt, "#~>", 3))
-      n = 3;
-    elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2))
-      n = 2;
-    elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1)
-            || strncmp (opt, "#", 1))
-      n = 1;
-    else
-      n = 0;
-    endif
-    options.errorstyle = opt(1:n);
-    opt(1:n) = [];
-  else
-    options.errorstyle = "~";
-  endif
-
-  while (! isempty (opt))
-    if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2))
-      options.linestyle = opt(1:2);
-      have_linestyle = true;
-      n = 2;
-    else
-      topt = opt(1);
-      n = 1;
-      if (topt == "-" || topt == ":")
-        have_linestyle = true;
-        options.linestyle = topt;
-      elseif (topt == "+" || topt == "o" || topt == "*"
-              || topt == "." || topt == "x" || topt == "s"
-              || topt == "d" || topt == "^" || topt == "v"
-              || topt == ">" || topt == "<" || topt == "p"
-              || topt == "h" || topt == "@")
-        have_marker = true;
-        ## Backward compatibility.  Leave undocumented.
-        if (topt == "@")
-          topt = "+";
-        endif
-        options.marker = topt;
-### Numeric color specs for backward compatibility.  Leave undocumented.
-      elseif (topt == "k" || topt == "0")
-        options.color = [0, 0, 0];
-      elseif (topt == "r" || topt == "1")
-        options.color = [1, 0, 0];
-      elseif (topt == "g" || topt == "2")
-        options.color = [0, 1, 0];
-      elseif (topt == "b" || topt == "3")
-        options.color = [0, 0, 1];
-      elseif (topt == "y")
-        options.color = [1, 1, 0];
-      elseif (topt == "m" || topt == "4")
-        options.color = [1, 0, 1];
-      elseif (topt == "c" || topt == "5")
-        options.color = [0, 1, 1];
-      elseif (topt == "w" || topt == "6")
-        options.color = [1, 1, 1];
-      elseif (isspace (topt))
-        ## Do nothing.
-      elseif (topt == ";")
-        t = index (opt(2:end), ";");
-        if (t)
-          options.key = opt(2:t);
-          n = t+1;
-        else
-          if (err_on_invalid)
-            error ("%s: unfinished key label", caller);
-          else
-            valid = false;
-            options = __default_plot_options__ ();
-            return;
-          endif
-        endif
-      else
-        if (err_on_invalid)
-          error ("%s: unrecognized format character: '%s'", caller, topt);
-        else
-          valid = false;
-          options = __default_plot_options__ ();
-          return;
-        endif
-      endif
-    endif
-    opt(1:n) = [];
-  endwhile
-
-  if (! have_linestyle && have_marker)
-    options.linestyle = "none";
-  endif
-
-  if (have_linestyle && ! have_marker)
-    options.marker = "none";
-  endif
-
-endfunction
--- a/scripts/plot/private/__print_parse_opts__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,638 +0,0 @@
-## Copyright (C) 2010-2012 Shai Ayal
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{args} =} __print_parse_opts__ (@var{propname}, @var{propvalue})
-## @deftypefnx {Function File} {@var{args} =} __print_parse_opts__ (@var{struct})
-## Undocumented internal function.
-## @end deftypefn
-
-function arg_st = __print_parse_opts__ (varargin)
-
-  persistent warn_on_missing_binary = true
-
-  arg_st.append_to_file = false;
-  arg_st.canvas_size = [];
-  arg_st.debug = false;
-  arg_st.debug_file = "octave-print-commands.log";
-  arg_st.devopt = "";
-  arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool"));
-  arg_st.figure = get (0, "currentfigure");
-  arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev"));
-  arg_st.fontsize = "";
-  arg_st.font = "";
-  arg_st.scalefontsize = 1;
-  arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid
-  arg_st.formatted_for_printing = false;
-  arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ());
-  arg_st.ghostscript.debug = false;
-  arg_st.ghostscript.device = "";
-  arg_st.ghostscript.epscrop = true;
-  arg_st.ghostscript.level = [];
-  arg_st.ghostscript.output = "";
-  arg_st.ghostscript.papersize = "";
-  arg_st.ghostscript.pageoffset = [];
-  arg_st.ghostscript.resolution = 150;
-  arg_st.ghostscript.antialiasing = false;
-  arg_st.ghostscript.antialiasing_textalphabits = 4;
-  arg_st.ghostscript.antialiasing_graphicsalphabits = 4;
-  arg_st.loose = false;
-  arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr"));
-  arg_st.name = "";
-  arg_st.orientation = "";
-  arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit"));
-  arg_st.preview = "";
-  arg_st.printer = "";
-  arg_st.send_to_printer = false;
-  arg_st.special_flag = "textnormal";
-  arg_st.tight_flag = false;
-  arg_st.use_color = 0; # 0=default, -1=mono, +1=color
-
-  if (isunix ())
-    arg_st.lpr_options = "-l";
-  elseif (ispc ())
-    arg_st.lpr_options = "-o l";
-  else
-    arg_st.lpr_options = "";
-  endif
-  arg_st.unlink = {};
-
-  if (nargin > 0 && isfigure (varargin{1}))
-    arg_st.figure = varargin{1};
-    varargin(1) = [];
-  endif
-
-  for i = 1:numel (varargin)
-    arg = strtrim (varargin{i});
-    if (ischar (arg))
-      if (strcmp (arg, "-color"))
-        arg_st.use_color = 1;
-      elseif (strcmp (arg, "-append"))
-        arg_st.append_to_file = true;
-      elseif (strcmp (arg, "-mono"))
-        arg_st.use_color = -1;
-      elseif (strcmp (arg, "-solid"))
-        arg_st.force_solid = 1;
-      elseif (strcmp (arg, "-dashed"))
-        arg_st.force_solid = -1;
-      elseif (strncmp (arg, "-portrait", numel (arg)))
-        arg_st.orientation = "portrait";
-      elseif (strncmp (arg, "-landscape", numel (arg)))
-        arg_st.orientation = "landscape";
-      elseif (strcmp (arg, "-loose"))
-        arg_st.loose = true;
-        arg_st.tight_flag = false;
-      elseif (strcmp (arg, "-tight"))
-        arg_st.loose = false;
-        arg_st.tight_flag = true;
-      elseif (strcmp (arg, "-textspecial"))
-        arg_st.special_flag = "textspecial";
-      elseif (any (strcmp (arg, {"-interchange", "-metafile", "-pict", "-tiff"})))
-        arg_st.preview = arg(2:end);
-      elseif (strncmp (arg, "-debug", 6))
-        arg_st.debug = true;
-        arg_st.ghostscript.debug = true;
-        if (length (arg) > 7)
-          arg_st.debug_file = arg(8:end);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-d")
-        arg_st.devopt = tolower (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-P")
-        arg_st.printer = arg;
-      elseif (strncmp (arg, "-EPSTOOL:", 9))
-        arg_st.epstool_binary = arg{10:end};
-      elseif (strncmp (arg, "-FIG2DEV:", 9))
-        arg_st.fig2dev_binary = arg{10:end};
-      elseif (strncmp (arg, "-PSTOEDIT:", 9))
-        arg_st.pstoedit_binary = arg{10:end};
-      elseif (strncmpi (arg, "-textalphabits=", 15))
-        n = find (arg == "=");
-        if (! isempty (n) && n == numel (arg) - 1 && ismember (arg(end), "124"))
-          arg_st.ghostscript.antialiasing_textalphabits = str2num (arg(end));
-        else
-          error ("print: improper syntax, or value, for TextAlphaBits");
-        endif
-      elseif (strncmpi (arg, "-graphicsalphabits=", 19))
-        n = find (arg == "=");
-        if (! isempty (n) && n == numel (arg) - 1 && ismember (arg(end), "124"))
-          arg_st.ghostscript.antialiasing_graphicsalphabits = str2num (arg(end));
-        else
-          error ("print: improper syntax, or value, for GraphicsAlphaBits");
-        endif
-      elseif ((length (arg) > 2) && arg(1:2) == "-G")
-        arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end));
-        if (isempty (arg_st.ghostscript.binary))
-          error ("print: Ghostscript binary ""%s"" could not be located",
-                 arg(3:end));
-        else
-          arg_st.ghostscript.binary = __quote_path__ (arg_st.ghostscript.binary);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-F")
-        idx = rindex (arg, ":");
-        if (idx)
-          arg_st.font = arg(3:idx-1);
-          arg_st.fontsize = str2num (arg(idx+1:end));
-        else
-          arg_st.font = arg(3:end);
-        endif
-      elseif (length (arg) > 2 && arg(1:2) == "-S")
-        arg_st.canvas_size = str2num (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-r")
-        arg_st.ghostscript.resolution = str2double (arg(3:end));
-      elseif (length (arg) > 2 && arg(1:2) == "-f")
-        arg_st.figure = str2num (arg(3:end));
-      elseif (length (arg) >= 1 && arg(1) == "-")
-        error ("print: unknown option '%s'", arg);
-      elseif (length (arg) > 0)
-        arg_st.name = tilde_expand (arg);
-      endif
-    elseif (isfigure (arg))
-      arg_st.figure = arg;
-    else
-      error ("print: expecting inputs to be character string options or a figure handle");
-    endif
-  endfor
-
-  if (arg_st.ghostscript.resolution == 0)
-    ## Do as Matlab does.
-    arg_st.ghostscript.resolution = get (0, "screenpixelsperinch");
-  endif
-
-  if (isempty (arg_st.orientation))
-    if (isfigure (arg_st.figure))
-      arg_st.orientation = get (arg_st.figure, "paperorientation");
-    else
-      ## Allows tests to be run without error.
-      arg_st.orientation = "portrait";
-    endif
-  endif
-
-  if (isempty (arg_st.ghostscript.binary))
-    arg_st.ghostscript.binary = __ghostscript_binary__ ();
-  endif
-
-  dot = rindex (arg_st.name, ".");
-  if (isempty (arg_st.devopt))
-    if (dot == 0)
-      arg_st.devopt = "psc";
-    else
-      arg_st.devopt = tolower (arg_st.name(dot+1:end));
-    endif
-  endif
-
-  if (arg_st.use_color == 0)
-    if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt)))
-      arg_st.use_color = -1;
-    else
-      arg_st.use_color = 1;
-    endif
-  endif
-
-  if (strcmp (arg_st.devopt, "tex"))
-    arg_st.devopt = "epslatex";
-  elseif (strcmp (arg_st.devopt, "ill"))
-    arg_st.devopt = "aifm";
-  elseif (strcmp (arg_st.devopt, "cdr"))
-    arg_st.devopt = "corel";
-  elseif (strcmp (arg_st.devopt, "meta"))
-    arg_st.devopt = "emf";
-  elseif (strcmp (arg_st.devopt, "jpg"))
-    arg_st.devopt = "jpeg";
-  endif
-
-  dev_list = {"aifm", "corel", "fig", "png", "jpeg", ...
-              "gif", "pbm", "pbmraw", "dxf", "mf", ...
-              "svg", "hpgl", "ps", "ps2", "psc", ...
-              "psc2", "eps", "eps2", "epsc", "epsc2", ...
-              "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ...
-              "pslatexstandalone", "pdflatexstandalone", ...
-              "pstex", "tiff", "tiffn" "tikz", "pcxmono", ...
-              "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ...
-              "ppm", "ppmraw", "pdflatex", "texdraw", ...
-              "pdfcairo", "pngcairo", "pstricks", ...
-              "epswrite", "pswrite", "ps2write", "pdfwrite"};
-
-  suffixes = {"ai", "cdr", "fig", "png", "jpg", ...
-              "gif", "pbm", "pbm", "dxf", "mf", ...
-              "svg", "hpgl", "ps", "ps", "ps", ...
-              "ps", "eps", "eps", "eps", "eps", ...
-              "emf", "pdf", "tex", "tex", "tex", ...
-              "tex", "tex", ...
-              "ps", "tiff", "tiff", "tikz", "pcx", ...
-              "pcx", "pcx", "pcx", "pgm", "pgm", ...
-              "ppm", "ppm", "tex", "tex", ...
-              "pdf", "png", "tex", ...
-              "eps", "ps", "ps", "pdf"};
-
-  if (isfigure (arg_st.figure))
-    __graphics_toolkit__ = get (arg_st.figure, "__graphics_toolkit__");
-  else
-    ## Allow tests when no figures are present.
-    __graphics_toolkit__ = get (0, "defaultfigure__graphics_toolkit__");
-  endif
-
-  if (strcmp (__graphics_toolkit__, "gnuplot")
-      && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
-    suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"};
-  endif
-
-  match = strcmpi (dev_list, arg_st.devopt);
-  if (any (match))
-    default_suffix = suffixes {match};
-  else
-    default_suffix = arg_st.devopt;
-  endif
-
-  if (dot == 0 && ! isempty (arg_st.name))
-    arg_st.name = strcat (arg_st.name, ".", default_suffix);
-  endif
-
-  if (arg_st.append_to_file)
-    if (isempty (arg_st.name))
-      arg_st.append_to_file = false;
-    elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ...
-                                          "ps", "ps2", "psc", "psc2", "pdf"})))
-      have_ghostscript = ! isempty (__ghostscript_binary__ ());
-      if (have_ghostscript)
-        file_exists = ((numel (dir (arg_st.name)) == 1)
-                       && (! isdir (arg_st.name)));
-        if (! file_exists)
-          arg_st.append_to_file = false;
-        endif
-      else
-        arg_st.append_to_file = false;
-        warning ("print.m: appended output requires ghostscript to be installed");
-      endif
-    else
-      warning ("print.m: appended output is not supported for device '%s'",
-               arg_st.devopt);
-      arg_st.append_to_file = false;
-    endif
-  endif
-
-  if (! isempty (arg_st.printer) || isempty (arg_st.name))
-    arg_st.send_to_printer = true;
-  endif
-
-  if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"})))
-    arg_st.formatted_for_printing = true;
-  endif
-
-  aliases = gs_aliases ();
-  if (any (strcmp (arg_st.devopt, fieldnames (aliases))))
-    arg_st.devopt = aliases.(arg_st.devopt);
-  endif
-
-  ## FIXME - eps2 & epsc2 needs to be handled
-  if (strcmp (arg_st.devopt, "pswrite"))
-    arg_st.ghostscript.level = 1;
-  elseif (strcmp (arg_st.devopt, "ps2write"))
-    arg_st.ghostscript.level = 2;
-  endif
-
-  if ((any (strcmp (arg_st.devopt, gs_device_list))
-       && ! arg_st.formatted_for_printing)
-      || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"})))
-    ## Use ghostscript for graphic formats
-    arg_st.ghostscript.device = arg_st.devopt;
-    arg_st.ghostscript.output = arg_st.name;
-    arg_st.ghostscript.antialiasing = true;
-    if (arg_st.formatted_for_printing)
-      arg_st.ghostscript.epscrop = ! arg_st.loose;
-    else
-      ## pstoedit throws errors if the EPS file isn't cropped
-      arg_st.ghostscript.epscrop = true;
-    endif
-  elseif (all (! strcmp (arg_st.devopt, dev_list)))
-    ## Assume we are formating output for a printer
-    arg_st.formatted_for_printing = true;
-    arg_st.ghostscript.device = arg_st.devopt;
-    arg_st.ghostscript.output = arg_st.name;
-    arg_st.ghostscript.antialiasing = false;
-    arg_st.ghostscript.epscrop = ! arg_st.loose;
-  endif
-
-  if (isempty (arg_st.canvas_size))
-    if (isfigure (arg_st.figure))
-      [arg_st.ghostscript.papersize, paperposition] = ...
-                           gs_papersize (arg_st.figure, arg_st.orientation);
-    else
-      ## allows tests to be run
-      arg_st.ghostscript.papersize = "letter";
-      paperposition = [0.25, 2.50, 8.00, 6.00] * 72;
-    endif
-    arg_st.canvas_size = paperposition(3:4);
-    if (strcmp (__graphics_toolkit__, "gnuplot") && ! arg_st.ghostscript.epscrop)
-      arg_st.ghostscript.pageoffset = paperposition(1:2) - 50;
-    else
-      arg_st.ghostscript.pageoffset = paperposition(1:2);
-    endif
-  else
-    ## Convert canvas size to points from pixels.
-    if (! isempty (arg_st.fontsize))
-      ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps).
-      arg_st.scalefontsize = arg_st.ghostscript.resolution / 72;
-    endif
-    arg_st.ghostscript.resolution = 72;
-    arg_st.ghostscript.papersize = arg_st.canvas_size;
-    arg_st.ghostscript.epscrop = true;
-    arg_st.ghostscript.pageoffset = [0, 0];
-  endif
-
-  if (arg_st.formatted_for_printing)
-    arg_st.ghostscript.resolution = [];
-  else
-    arg_st.ghostscript.papersize = "";
-    arg_st.ghostscript.pageoffset = [0, 0];
-  endif
-
-  if (warn_on_missing_binary)
-    if (isempty (arg_st.ghostscript.binary))
-      warning ("print:missing_gs", "print.m: Ghostscript binary is not available.\nOnly eps output is available.");
-    else
-      if (isempty (arg_st.epstool_binary))
-        warning ("print:missing_epstool", "print.m: epstool binary is not available.\nSome output formats are not available.");
-      endif
-      if (isempty (arg_st.fig2dev_binary))
-        warning ("print:missing_fig2dev", "print.m: fig2dev binary is not available.\nSome output formats are not available.");
-      endif
-      if (isempty (arg_st.pstoedit_binary))
-        warning ("print:missing_pstoedit", "print.m: pstoedit binary is not available.\nSome output formats are not available.");
-      endif
-    endif
-    warn_on_missing_binary = false;
-  endif
-
-endfunction
-
-## Test blocks are not allowed (and not needed) for private functions
-#%!test
-%! opts = __print_parse_opts__ ();
-%! assert (opts.devopt, "pswrite");
-%! assert (opts.use_color, 1);
-%! assert (opts.send_to_printer, true);
-%! assert (opts.canvas_size, [576, 432]);
-%! assert (opts.ghostscript.device, "pswrite");
-
-#%!test
-%! opts = __print_parse_opts__ ("test.pdf", "-S640,480");
-%! assert (opts.canvas_size, [307.2, 230.4], 0.1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose");
-%! assert (opts.devopt, "pswrite");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.use_color, 1);
-%! assert (opts.append_to_file, false);
-%! assert (opts.ghostscript.device, "pswrite");
-%! assert (opts.ghostscript.epscrop, false);
-
-#%!test
-%! opts = __print_parse_opts__ ("-deps", "-tight");
-%! assert (opts.tight_flag, true);
-%! assert (opts.send_to_printer, true);
-%! assert (opts.use_color, -1);
-%! assert (opts.ghostscript.device, "");
-
-#%!test
-%! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose");
-%! assert (opts.devopt, "jpeg");
-%! assert (opts.name, "foobar.jpg");
-%! assert (opts.ghostscript.device, "jpeg");
-%! assert (opts.ghostscript.epscrop, true);
-%! assert (opts.ghostscript.papersize, "");
-%! assert (opts.ghostscript.pageoffset, [0, 0]);
-%! assert (opts.send_to_printer, false);
-%! assert (opts.printer, "");
-%! assert (opts.use_color, -1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter");
-%! assert (opts.ghostscript.output, "foobar.deskjet");
-%! assert (opts.ghostscript.device, "deskjet");
-%! assert (opts.devopt, "deskjet");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.printer, "-Pmyprinter");
-%! assert (opts.use_color, -1);
-
-#%!test
-%! opts = __print_parse_opts__ ("-f5", "-dljet3");
-%! assert (opts.ghostscript.device, "ljet3");
-%! assert (strfind (opts.ghostscript.output, ".ljet3"));
-%! assert (opts.devopt, "ljet3");
-%! assert (opts.send_to_printer, true);
-%! assert (opts.figure, 5);
-
-function cmd = __quote_path__ (cmd)
-  if (! isempty (cmd))
-    is_quoted = all (cmd([1, end]) == "'");
-    if (! is_quoted)
-      dos_shell = ! isunix () && ispc ();
-      if (dos_shell && any (cmd == "/"))
-        cmd = strrep (cmd, "/", "\\");
-      endif
-      if (any (cmd == " "))
-        cmd = strcat ('"', strrep (cmd, '"', '""') ,'"');
-      endif
-    endif
-  endif
-endfunction
-
-function gs = __ghostscript_binary__ ()
-
-  persistent ghostscript_binary = ""
-  persistent warn_on_no_ghostscript = true
-  persistent warn_on_bad_gsc = true
-
-  if (isempty (ghostscript_binary))
-    GSC = getenv ("GSC");
-    if (exist (GSC, "file")
-        || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC)))
-      gs_binaries = {GSC};
-    elseif (! isempty (GSC) && warn_on_bad_gsc)
-      warning ("print:badgscenv",
-               "print.m: GSC environment variable not set properly");
-      warn_on_bad_gsc = false;
-      gs_binaries = {};
-    else
-      gs_binaries = {};
-    endif
-    if (isunix ())
-      ## Unix - Includes Mac OSX and Cygwin.
-      gs_binaries = horzcat (gs_binaries, {"gs", "gs.exe"});
-    else
-      ## pc - Includes Win32 and mingw.
-      gs_binaries = horzcat (gs_binaries, {"gs.exe", "gswin32c.exe", "gswin64c.exe", "mgs.exe"});
-    endif
-    n = 0;
-    while (n < numel (gs_binaries) && isempty (ghostscript_binary))
-      n = n + 1;
-      ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n});
-    endwhile
-    if (warn_on_no_ghostscript && isempty (ghostscript_binary))
-      warning ("print:noghostscript",
-               "print.m: ghostscript not found in PATH");
-      warn_on_no_ghostscript = false;
-    endif
-  endif
-
-  gs = ghostscript_binary;
-
-endfunction
-
-function bin = __find_binary__ (binary)
-
-  persistent data = struct ()
-
-  if (! isfield (data, binary))
-    ## Reinitialize when 'user_binaries' is present.
-    data.(binary).bin = "";
-    data.(binary).warn_on_absence = false;
-  endif
-
-  if (isempty (data.(binary).bin))
-    if (isunix ())
-      ## Unix - Includes Mac OSX and Cygwin.
-      binaries = strcat (binary, {"", ".exe"});
-    else
-      ## pc - Includes Win32 and mingw.
-      binaries = strcat (binary, {".exe"});
-    endif
-    n = 0;
-    while (n < numel (binaries) && isempty (data.(binary).bin))
-      n = n + 1;
-      data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n});
-    endwhile
-    if (isempty (data.(binary).bin) && data.(binary).warn_on_absence)
-      warning (sprintf ("print:no%s", binary),
-               "print.m: '%s' not found in PATH", binary);
-      data.(binary).warn_on_absence = false;
-    endif
-  endif
-
-  bin = data.(binary).bin;
-
-endfunction
-
-function [papersize, paperposition] = gs_papersize (hfig, paperorientation)
-  persistent papertypes papersizes
-
-  if (isempty (papertypes))
-    papertypes = {"usletter", "uslegal",     "a0",     "a1", ...
-                        "a2",      "a3",     "a4",     "a5", ...
-                        "b0",      "b1",     "b2",     "b3", ...
-                        "b4",      "b5", "arch-a", "arch-b", ...
-                    "arch-c",  "arch-d", "arch-e",      "a", ...
-                         "b",       "c",      "d",      "e", ...
-                   "tabloid"};
-    papersizes = [ 8.5, 11.0;  8.5, 14.0; 33.1, 46.8; 23.4, 33.1;
-                  16.5, 23.4; 11.7, 16.5;  8.3, 11.7;  5.8,  8.3;
-                  39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7;
-                   9.8, 13.9;  6.9,  9.8;  9.0, 12.0; 12.0, 18.0;
-                  18.0, 24.0; 24.0, 36.0; 36.0, 48.0;  8.5, 11.0;
-                  11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0;
-                  11.0, 17.0] * 72;
-  endif
-
-  papertype = get (hfig, "papertype");
-  paperunits = get (hfig, "paperunits");
-  paperposition = get (hfig, "paperposition");
-  if (strcmp (papertype, "<custom>"))
-    papersize = get (hfig, "papersize");
-    papersize = convert2points (papersize , paperunits);
-  else
-    papersize = papersizes (strcmp (papertypes, papertype), :);
-  endif
-
-  if (strcmp (paperunits, "normalized"))
-    paperposition = paperposition .* papersize([1,2,1,2]);
-  else
-    paperposition = convert2points (paperposition, paperunits);
-  endif
-
-  ## FIXME - This will be obsoleted by listeners for paper properties.
-  ##         Papersize is tall when portrait,and wide when landscape.
-  if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait"))
-      || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape")))
-    papersize = papersize([2,1]);
-    paperposition = paperposition([2,1,4,3]);
-  endif
-
-  if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation, "portrait")))
-    ## For portrait use the ghostscript name
-    papersize = papertype;
-    papersize(papersize=="-") = "";
-    papersize = strrep (papersize, "us", "");
-    switch (papersize)
-    case "a"
-      papersize = "letter";
-    case {"b", "tabloid"}
-      papersize = "11x17";
-    case {"c", "d", "e"}
-      papersize = strcat ("arch", papersize);
-    endswitch
-    if (strncmp (papersize, "arch", 4))
-      papersize(end) = upper (papersize(end));
-    endif
-  endif
-
-endfunction
-
-function value = convert2points (value, units)
-    switch (units)
-    case "inches"
-      value = value * 72;
-    case "centimeters"
-      value = value * 72 / 2.54;
-    case "normalized"
-      error ("print:customnormalized",
-             "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined");
-    endswitch
-endfunction
-
-function device_list = gs_device_list ();
-  ## Graphics formats/languages, not priners.
-  device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ...
-                 "epswrite"; "jpeg"; "jpegcymk"; "jpeggray"; "pbm"; ...
-                 "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ...
-                 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ...
-                 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ...
-                 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ...
-                 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "ps2write"; ...
-                 "pswrite"; "tiff12nc"; "tiff24nc"; "tiff32nc"; ...
-                 "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ...
-                 "tiffgray"; "tifflzw"; "tiffpack"; "tiffsep"};
-endfunction
-
-function aliases = gs_aliases ();
-  ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf",
-  ##                            "ps", "ps2", "psc", "psc2"
-  ##
-  ## eps, epsc, eps2, epsc2 are not included here because those are
-  ## are generated by the graphics toolkit.
-  aliases.bmp = "bmp32b";
-  aliases.pdf = "pdfwrite";
-  aliases.png = "png16m";
-  aliases.ps = "pswrite";
-  aliases.ps2 = "ps2write";
-  aliases.psc = "pswrite";
-  aliases.psc2 = "ps2write";
-  aliases.tiff = "tiff24nc";
-  aliases.tiffn = "tiff24nc";
-endfunction
-
--- a/scripts/plot/private/__quiver__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,444 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hg} =} __quiver__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hg = __quiver__ (varargin)
-
-  h = varargin{1};
-  is3d = varargin{2};
-
-  autoscale = 0.9;
-  arrowsize = 0.2;
-
-  firstnonnumeric = Inf;
-  for i = 3:nargin
-    if (! isnumeric (varargin{i}))
-      firstnonnumeric = i;
-      break;
-    endif
-  endfor
-
-  ioff = 3;
-  if (nargin < (6 + is3d) || firstnonnumeric < (6 + is3d))
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-      [x, y, z] = meshgrid (1:columns (u), 1:rows (u), 1:max (size (w)));
-    else
-      [x, y] = meshgrid (1:columns (u), 1:rows (u));
-    endif
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  else
-    x = varargin{ioff++};
-    y = varargin{ioff++};
-    if (is3d)
-      z = varargin{ioff++};
-    endif
-    u = varargin{ioff++};
-    v = varargin{ioff++};
-    if (is3d)
-      w = varargin{ioff++};
-      if (isvector (x) && isvector (y) && isvector (z)
-          && (! isvector (u) || ! isvector (v) || ! isvector (w)))
-        [x, y, z] = meshgrid (x, y, z);
-      endif
-    else
-      if (isvector (x) && isvector (y) && (! isvector (u) || ! isvector (v)))
-        [x, y] = meshgrid (x, y);
-      endif
-    endif
-    if (nargin >= ioff && isnumeric (varargin{ioff})
-        && isscalar (varargin{ioff}))
-      autoscale = varargin{ioff++};
-    endif
-  endif
-
-  have_filled = false;
-  have_line_spec = false;
-  args = {};
-  while (ioff <= nargin)
-    arg = varargin{ioff++};
-    if (ischar (arg) && strncmpi (arg, "filled", 6))
-      have_filled = true;
-    elseif ((ischar (arg) || iscell (arg))
-            && ! have_line_spec)
-      [linespec, valid] = __pltopt__ ("quiver", arg, false);
-      if (valid)
-        have_line_spec = true;
-        if (strncmp (linespec.linestyle, "none", 4))
-          linespec.linestyle = "-";
-        endif
-      else
-        args {end + 1} = arg;
-        if (ioff <= nargin)
-          args {end + 1} = varargin{ioff++};
-        endif
-      endif
-    else
-      args {end + 1} = arg;
-      if (ioff <= nargin)
-        args {end + 1} = varargin{ioff++};
-      endif
-    endif
-  endwhile
-
-  if (autoscale && numel (u) > 1)
-    ## Scale the arrows to fit in the grid
-    if (isvector (x))
-      ny = nx = length (x);
-    else
-      [nx, ny] = size (x);
-    endif
-    dx = (max (x(:)) - min (x(:))) ./ nx;
-    dy = (max (y(:)) - min (y(:))) ./ ny;
-    if (is3d)
-      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
-      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
-    else
-      dz = 0;
-      len = max (sqrt (u(:).^2 + v(:).^2));
-    endif
-    if (len > 0)
-      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
-      if (sd != 0)
-        s = sqrt (2) * autoscale * sd;
-      else # special case of identical points with multiple vectors
-        s = autoscale;
-      endif
-      uu = s * u;
-      vv = s * v;
-      if (is3d)
-        ww = s*w;
-      endif
-    endif
-  else
-    uu = u;
-    vv = v;
-    if (is3d)
-      ww = w;
-    endif
-  endif
-
-  hstate = get (h, "nextplot");
-  unwind_protect
-    hg = hggroup ();
-    if (is3d)
-      args = __add_datasource__ ("quiver3", hg,
-                                 {"x", "y", "z", "u", "v", "w"}, args{:});
-    else
-      args = __add_datasource__ ("quiver", hg,
-                                 {"x", "y", "z", "u", "v", "w"}, args{:});
-    endif
-    hold on;
-
-    addproperty ("xdata", hg, "data", x);
-    addproperty ("ydata", hg, "data", y);
-
-    addproperty ("udata", hg, "data", u);
-    addproperty ("vdata", hg, "data", v);
-    if (is3d)
-      addproperty ("zdata", hg, "data", z);
-      addproperty ("wdata", hg, "data", w);
-    else
-      addproperty ("zdata", hg, "data", []);
-      addproperty ("wdata", hg, "data", []);
-    endif
-
-    addlistener (hg, "xdata", @update_data);
-    addlistener (hg, "ydata", @update_data);
-    addlistener (hg, "zdata", @update_data);
-    addlistener (hg, "udata", @update_data);
-    addlistener (hg, "vdata", @update_data);
-    addlistener (hg, "wdata", @update_data);
-
-    x = x(:);
-    y = y(:);
-    xend = x + uu(:);
-    yend = y + vv(:);
-    if (is3d)
-      z = z(:);
-      zend = z + ww(:);
-    endif
-
-    if (have_line_spec)
-      if (is3d)
-        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
-                    [y.'; yend.'; NaN(1, length (y))](:),
-                    [z.'; zend.'; NaN(1, length (z))](:),
-                    "linestyle", linespec.linestyle,
-                    "color", linespec.color, "parent", hg);
-      else
-        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
-                   [y.'; yend.'; NaN(1, length (y))](:),
-                   "linestyle", linespec.linestyle,
-                    "color", linespec.color, "parent", hg);
-      endif
-    else
-      if (is3d)
-        h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
-                    [y.'; yend.'; NaN(1, length (y))](:),
-                    [z.'; zend.'; NaN(1, length (z))](:),
-                    "color", "black", "parent", hg);
-      else
-        h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
-                   [y.'; yend.'; NaN(1, length (y))](:),
-                   "parent", hg);
-      endif
-    endif
-
-    xtmp = x + uu(:) .* (1 - arrowsize);
-    ytmp = y + vv(:) .* (1 - arrowsize);
-
-    if (is3d)
-      xarrw1 = xtmp + sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
-      xarrw2 = xtmp - sqrt((y - yend).^2 + (z - zend).^2) * arrowsize / 3;
-      yarrw1 = ytmp - sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
-      yarrw2 = ytmp + sqrt((x - xend).^2 + (z - zend).^2) * arrowsize / 3;
-
-      zarrw1 = zarrw2 = zend - ww(:) * arrowsize;
-    else
-      xarrw1 = xtmp + (y - yend) * arrowsize / 3;
-      xarrw2 = xtmp - (y - yend) * arrowsize / 3;
-      yarrw1 = ytmp - (x - xend) * arrowsize / 3;
-      yarrw2 = ytmp + (x - xend) * arrowsize / 3;
-    endif
-
-    if (have_line_spec)
-      if (isfield (linespec, "marker")
-          && ! strncmp (linespec.marker, "none", 4))
-        if (is3d)
-          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                      "linestyle", "none", "parent", hg);
-        else
-          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                     "linestyle", "none", "parent", hg);
-        endif
-      else
-        if (is3d)
-          h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                      [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                      [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                      "linestyle", linespec.linestyle,
-                      "color", linespec.color, "parent", hg);
-        else
-          h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                     [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                     "linestyle", linespec.linestyle,
-                      "color", linespec.color, "parent", hg);
-        endif
-      endif
-    elseif (is3d)
-      h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                  [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                  [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
-                  "color", "black", "parent", hg);
-    else
-      h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
-                 [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
-                 "parent", hg);
-    endif
-
-    if (! have_line_spec
-        || (isfield (linespec, "marker")
-            && strncmp (linespec.marker, "none", 4)))
-      if (is3d)
-        h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none",
-                    "parent", hg);
-      else
-        h3 = plot (x, y, "linestyle", "none", "marker", "none", "parent", hg);
-      endif
-    else
-      if (is3d)
-        h3 = plot3 (x, y, z, "linestyle", "none", "marker", linespec.marker,
-                    "parent", hg);
-      else
-
-        h3 = plot (x, y, "linestyle", "none", "marker", linespec.marker,
-                   "parent", hg);
-      endif
-    endif
-    if (have_filled)
-      ## FIXME gnuplot doesn't respect the markerfacecolor field
-      set (h3, "markerfacecolor", get (h1, "color"));
-    endif
-
-    ## Set up the hggroup properties and listeners
-    if (autoscale)
-      addproperty ("autoscale", hg, "radio", "{on}|off", "on");
-      addproperty ("autoscalefactor", hg, "data", autoscale);
-    else
-      addproperty ("autoscale", hg, "radio", "{on}|off", "off");
-      addproperty ("autoscalefactor", hg, "data", 1.0);
-    endif
-    addlistener (hg, "autoscale", @update_data);
-    addlistener (hg, "autoscalefactor", @update_data);
-
-    addproperty ("maxheadsize", hg, "data", arrowsize);
-    addlistener (hg, "maxheadsize", @update_data);
-
-    addproperty ("showarrowhead", hg, "radio", "{on}|off", "on");
-    addlistener (hg, "showarrowhead", @update_props);
-
-    addproperty ("color", hg, "linecolor", get (h1, "color"));
-    addproperty ("linewidth", hg, "linelinewidth", get (h1, "linewidth"));
-    addproperty ("linestyle", hg, "linelinestyle", get (h1, "linestyle"));
-    addproperty ("marker", hg, "linemarker", get (h3, "marker"));
-    addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                 get (h3, "markerfacecolor"));
-    addproperty ("markersize", hg, "linemarkersize", get (h3, "markersize"));
-
-    addlistener (hg, "color", @update_props);
-    addlistener (hg, "linewidth", @update_props);
-    addlistener (hg, "linestyle", @update_props);
-    addlistener (hg, "marker", @update_props);
-    addlistener (hg, "markerfacecolor", @update_props);
-    addlistener (hg, "markersize", @update_props);
-
-    if (! isempty (args))
-      set (hg, args{:});
-    endif
-  unwind_protect_cleanup
-    set (h, "nextplot", hstate);
-  end_unwind_protect
-
-endfunction
-
-function update_data (h, d)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-  z = get (h, "zdata");
-
-  u = get (h, "udata");
-  v = get (h, "vdata");
-  w = get (h, "wdata");
-
-  s = get (h, "autoscalefactor");
-  arrowsize = get (h, "maxheadsize");
-
-  kids = get (h, "children");
-
-  if (isempty (z) || isempty (w))
-    is3d = false;
-  else
-    is3d = true;
-  endif
-
-  if (strcmpi (get (h, "autoscale"), "on") && s != 0)
-    ## Scale the arrows to fit in the grid
-    if (isvector (x))
-      ny = nx = length (x);
-    else
-      [nx, ny] = size (x);
-    endif
-    dx = (max (x(:)) - min (x(:))) ./ nx;
-    dy = (max (y(:)) - min (y(:))) ./ ny;
-    if (is3d)
-      dz = (max (z(:)) - min (z(:))) ./ max (size (z));
-      len = max (sqrt (u(:).^2 + v(:).^2 + w(:).^2));
-    else
-      dz = 0;
-      len = max (sqrt (u(:).^2 + v(:).^2));
-    endif
-    if (len > 0)
-      sd = sqrt (dx.^2 + dy.^2 + dz.^2) / len;
-      if (sd != 0)
-        s *= sqrt (2) * sd;
-      endif
-      u = s * u;
-      v = s * v;
-      if (is3d)
-        w = s*w;
-      endif
-    endif
-  endif
-
-  x = x(:);
-  y = y(:);
-  xend = x + u(:);
-  yend = y + v(:);
-  if (is3d)
-    z = z(:);
-    zend = z + w(:);
-  endif
-
-  set (kids (3), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
-  set (kids (3), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (3), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
-  endif
-
-  xtmp = x + u(:) .* (1 - arrowsize);
-  ytmp = y + v(:) .* (1 - arrowsize);
-  xarrw1 = xtmp + (y - yend) * arrowsize / 3;
-  xarrw2 = xtmp - (y - yend) * arrowsize / 3;
-  yarrw1 = ytmp - (x - xend) * arrowsize / 3;
-  yarrw2 = ytmp + (x - xend) * arrowsize / 3;
-  if (is3d)
-    zarrw1 = zarrw2 = zend - w(:) * arrowsize;
-  endif
-
-  set (kids (2), "xdata", [x.'; xend.'; NaN(1, length (x))](:));
-  set (kids (2), "ydata", [y.'; yend.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (2), "zdata", [z.'; zend.'; NaN(1, length (z))](:));
-  endif
-
-  set (kids (2), "xdata", [xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:));
-  set (kids (2), "ydata", [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:));
-  if (is3d)
-    set (kids (2), "zdata", [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:));
-  endif
-
-  set (kids (1), "xdata", x);
-  set (kids (1), "ydata", y);
-  if (is3d)
-    set (kids (1), "zdata", z);
-  endif
-
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-
-  set (kids(3), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"));
-  set (kids(2), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"));
-  if (strcmpi (get (h, "showarrowhead"), "on"))
-    set (kids (2), "visible", "on");
-  else
-    set (kids (2), "visible", "off");
-  endif
-  set (kids(1), "color", get (h, "color"),
-       "marker", get (h, "marker"),
-       "markerfacecolor", get (h, "markerfacecolor"),
-       "markersize", get (h, "markersize"));
-endfunction
--- a/scripts/plot/private/__scatter__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{hg} =} __scatter__ (@dots{})
-## Undocumented internal function.
-## @end deftypefn
-
-function hg = __scatter__ (varargin)
-
-  h = varargin{1};
-  nd = varargin{2};
-  fcn = varargin{3};
-  x = varargin{4}(:);
-  y = varargin{5}(:);
-  istart = 6;
-
-  if (nd == 3)
-    z = varargin{6}(:);
-    idx = isnan (x) | isnan (y) | isnan (z);
-    x (idx) = [];
-    y (idx) = [];
-    z (idx) = [];
-    istart = 7;
-  else
-    idx = isnan (x) | isnan (y);
-    x (idx) = [];
-    y (idx) = [];
-    z = zeros (length (x), 0);
-  endif
-
-  firstnonnumeric = Inf;
-  for i = istart:nargin
-    if (! isnumeric (varargin{i}))
-      firstnonnumeric = i;
-      break;
-    endif
-  endfor
-
-  if (istart <= nargin)
-    s = varargin{istart};
-    if (isempty (s) || ischar (s))
-      s = 6;
-    endif
-    if (! ischar (varargin{istart}))
-      istart++;
-    endif
-  else
-    s = 6;
-  endif
-
-  if (istart <= nargin && firstnonnumeric > istart)
-    c = varargin{istart};
-    if (isvector (c))
-      if (columns (c) != 3)
-        c = c(:);
-      endif
-    endif
-  elseif (firstnonnumeric == istart && ischar (varargin{istart})
-          && ! strcmpi (varargin{istart}, "filled"))
-    c = varargin{istart};
-    firstnonnumeric++;
-  else
-    c = [];
-  endif
-
-  newargs = {};
-  filled = false;
-  have_marker = false;
-  marker = "o";
-  iarg = firstnonnumeric;
-  while (iarg <= nargin)
-    arg = varargin{iarg++};
-    if (ischar (arg) && strncmpi (arg, "filled", 6))
-      filled = true;
-    elseif ((ischar (arg) || iscell (arg)) && ! have_marker)
-      [linespec, valid] = __pltopt__ (fcn, arg, false);
-      if (valid)
-        have_marker = true;
-        marker = linespec.marker;
-        if (strncmp (marker, "none", 4))
-          marker = "o";
-        elseif (isempty (marker))
-          have_marker = false;
-          [dummy, marker] = __next_line_style__ ();
-        endif
-      else
-        error ("%s: invalid linespec", fcn);
-      endif
-    else
-      newargs{end+1} = arg;
-      if (iarg <= nargin)
-        newargs{end+1} = varargin{iarg++};
-      endif
-    endif
-  endwhile
-
-  if (isempty (c))
-    c = __next_line_color__ ();
-  endif
-
-  hg = hggroup ();
-  newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"},
-                             newargs{:});
-
-  addproperty ("xdata", hg, "data", x);
-  addproperty ("ydata", hg, "data", y);
-  addproperty ("zdata", hg, "data", z);
-  if (ischar (c))
-    addproperty ("cdata", hg, "data", __color_str_rgb__ (c));
-  else
-    addproperty ("cdata", hg, "data", c);
-  endif
-  addproperty ("sizedata", hg, "data", s);
-  addlistener (hg, "xdata", @update_data);
-  addlistener (hg, "ydata", @update_data);
-  addlistener (hg, "zdata", @update_data);
-  addlistener (hg, "cdata", @update_data);
-  addlistener (hg, "sizedata", @update_data);
-
-  one_explicit_color = ischar (c) || isequal (size (c), [1, 3]);
-
-  if (numel (x) <= 100)
-
-    ## For small number of points, we'll construct an object for each point.
-
-    if (numel (s) == 1)
-      s = repmat (s, numel (x), 1);
-    endif
-
-    if (one_explicit_color)
-      for i = 1 : numel (x)
-        if (filled)
-          h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                            "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                            "facecolor", "none", "edgecolor", "none",
-                            "marker", marker,  "markersize", s(i),
-                            "markeredgecolor", c, "markerfacecolor", c,
-                            "linestyle", "none");
-        else
-          h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                            "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                            "facecolor", "none", "edgecolor", "none",
-                            "marker", marker,  "markersize", s(i),
-                            "markeredgecolor", c, "markerfacecolor", "none",
-                            "linestyle", "none");
-        endif
-      endfor
-    else
-      if (rows (c) == 1)
-        c = ones (rows (x), 1) * c;
-      endif
-      for i = 1 : numel (x)
-        if (filled)
-          h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                            "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                            "facecolor", "none", "edgecolor", "none",
-                            "marker", marker, "markersize", s(i),
-                            "markeredgecolor", "none",
-                            "markerfacecolor", "flat",
-                            "cdata", c(i,:), "facevertexcdata", c(i,:),
-                            "linestyle", "none");
-        else
-          h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
-                            "faces", 1, "vertices", [x(i), y(i), z(i,:)],
-                            "facecolor", "none", "edgecolor", "none",
-                            "marker", marker, "markersize", s(i),
-                            "markeredgecolor", "flat",
-                            "markerfacecolor", "none",
-                            "cdata", c(i,:), "facevertexcdata", c(i,:),
-                            "linestyle", "none");
-
-        endif
-      endfor
-    endif
-
-  else
-
-    ## For larger numbers of points, we split the points by common color.
-
-    vert = [x, y, z];
-    if (one_explicit_color)
-      h = render_size_color (hg, vert, s, c, marker, filled, true);
-    else
-      if (rows (c) == 1)
-        c = ones (rows (x), 1) * c;
-      endif
-      ## We want to group points by colour. So first get all the unique colours
-      [cc, ~, c_to_cc] = unique (c, "rows");
-
-      for i = 1:rows (cc)
-        ## Now for each possible unique colour, get the logical index of
-        ## points that correspond to that colour
-        idx = (i == c_to_cc);
-        if (isscalar (s))
-          h = render_size_color (hg, vert(idx, :), s, c(idx,:),
-                                 marker, filled, true);
-        else
-          h = render_size_color (hg, vert(idx, :), s(idx), c(idx,:),
-                                 marker, filled, true);
-        endif
-      endfor
-
-    endif
-  endif
-
-  if (! ischar (c) && rows (c) > 1)
-    ax = get (hg, "parent");
-    clim = get (ax, "clim");
-    if (min (c(:)) < clim(1))
-      clim(1) = min (c(:));
-      set (ax, "clim", clim);
-    endif
-    if (max (c(:)) > clim(2))
-      set (ax, "clim", [clim(1), max(c(:))]);
-    endif
-  endif
-
-  addproperty ("linewidth", hg, "patchlinewidth", 0.5);
-  addproperty ("marker", hg, "patchmarker", marker);
-  if (filled)
-    addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "none");
-    if (one_explicit_color)
-      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", c);
-    else
-      addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "flat");
-    endif
-  else
-    addproperty ("markerfacecolor", hg, "patchmarkerfacecolor", "none");
-    if (one_explicit_color)
-      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", c);
-    else
-      addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "flat");
-    endif
-  endif
-  addlistener (hg, "linewidth", @update_props);
-  addlistener (hg, "marker", @update_props);
-  addlistener (hg, "markerfacecolor", @update_props);
-  addlistener (hg, "markeredgecolor", @update_props);
-
-  if (! isempty (newargs))
-    set (hg, newargs{:});
-  endif
-
-endfunction
-
-function h = render_size_color (hg, vert, s, c, marker, filled, isflat)
-  if (isscalar (s))
-    x = vert(:,1);
-    y = vert(:,2);
-    z = vert(:,3:end);
-    toolkit = get (ancestor (hg, "figure"), "__graphics_toolkit__");
-    ## Does gnuplot only support triangles with different vertex colors ?
-    ## TODO - Verify gnuplot can only support one color. If RGB triplets
-    ##        can be assigned to each vertex, then fix __go_draw_axe__.m
-    gnuplot_hack = (numel (x) > 1 && columns (c) == 3
-                    && strcmp (toolkit, "gnuplot"));
-    if (ischar (c) || ! isflat || gnuplot_hack)
-      if (filled)
-        h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker,
-                          "markeredgecolor", "none",
-                          "markerfacecolor", c(1,:),
-                          "markersize", s, "linestyle", "none");
-      else
-        h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker,
-                          "markeredgecolor", c(1,:),
-                          "markerfacecolor", "none",
-                          "markersize", s, "linestyle", "none");
-      endif
-    else
-      if (filled)
-        h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker, "markersize", s,
-                          "markeredgecolor", "none",
-                          "markerfacecolor", "flat",
-                          "cdata", c, "facevertexcdata", c,
-                          "linestyle", "none");
-      else
-        h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
-                          "faces", 1:numel (x), "vertices", vert,
-                          "facecolor", "none", "edgecolor", "none",
-                          "marker", marker, "markersize", s,
-                          "markeredgecolor", "flat",
-                          "markerfacecolor", "none",
-                          "cdata", c, "facevertexcdata", c,
-                          "linestyle", "none");
-      endif
-    endif
-  else
-    ## FIXME: round the size to one decimal place. It's not quite right, though.
-    [ss, ~, s_to_ss] = unique (ceil (s*10) / 10);
-    for i = 1:rows (ss)
-      idx = (i == s_to_ss);
-      h = render_size_color (hg, vert(idx,:), ss(i), c,
-                             marker, filled, isflat);
-    endfor
-  endif
-endfunction
-
-function update_props (h, d)
-  lw = get (h, "linewidth");
-  m = get (h, "marker");
-  fc = get (h, "markerfacecolor");
-  ec = get (h, "markeredgecolor");
-  kids = get (h, "children");
-
-  for i = 1 : numel (kids)
-    set (kids (i), "linewidth", lw, "marker", m, "markerfacecolor", fc,
-         "edgecolor", ec);
-  endfor
-endfunction
-
-function update_data (h, d)
-  x1 = get (h, "xdata");
-  y1 = get (h, "ydata");
-  z1 = get (h, "zdata");
-  c1 = get (h, "cdata");
-  if (!ischar (c1) && rows (c1) == 1)
-    c1 = repmat (c1, numel (x1), 1);
-  endif
-  size1 = get (h, "sizedata");
-  if (numel (size1) == 1)
-    size1 = repmat (size1, numel (x1), 1);
-  endif
-  hlist = get (h, "children");
-  if (ischar (c1))
-    if (isempty (z1))
-      for i = 1 : length (hlist)
-        set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", c1,
-             "markersize", size1(i));
-      endfor
-    else
-      for i = 1 : length (hlist)
-        set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", c1,
-             "markersize", size1(i));
-      endfor
-    endif
-  else
-    if (isempty (z1))
-      for i = 1 : length (hlist)
-        set (hlist(i), "vertices", [x1(i), y1(i)], "cdata",
-             reshape (c1(i,:),[1, size(c1)(2:end)]),
-             "facevertexcdata", c1(i,:),
-             "markersize", size1(i));
-      endfor
-    else
-      for i = 1 : length (hlist)
-        set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata",
-             reshape (c1(i,:),[1, size(c1)(2:end)]),
-             "facevertexcdata", c1(i,:),
-             "markersize", size1(i));
-      endfor
-    endif
-  endif
-endfunction
--- a/scripts/plot/private/__stem__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,561 +0,0 @@
-## Copyright (C) 2006-2012 Michel D. Schmid
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} __stem__ (@var{have_z}, @var{varargin})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
-## Adapted-by: jwe
-
-function h = __stem__ (have_z, varargin)
-
-  if (have_z)
-    caller = "stem3";
-  else
-    caller = "stem";
-  endif
-
-  [ax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:});
-
-  [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
-      check_stem_arg (have_z, varargin{:});
-
-  oldax = gca ();
-  unwind_protect
-    axes (ax);
-    hold_state = get (ax, "nextplot");
-    newplot ();
-    h = [];
-
-    nx = rows (x);
-    for i = 1: columns (x)
-      if (have_z)
-        xt = x(:)';
-        xt = [xt; xt; NaN(1, nx)](:);
-        yt = y(:)';
-        yt = [yt; yt; NaN(1, nx)](:);
-        zt = z(:)';
-        zt = [zeros(1, nx); zt; NaN(1, nx)](:);
-      else
-        xt = x(:, i)';
-        xt = [xt; xt; NaN(1, nx)](:);
-        yt = y(:, i)';
-        yt = [zeros(1, nx); yt; NaN(1, nx)](:);
-      endif
-
-      hg  = hggroup ();
-      h = [h; hg];
-      args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:});
-
-      if (i == 1)
-        set (ax, "nextplot", "add");
-      endif
-
-      if (isempty (llc))
-        lc = __next_line_color__ ();
-      else
-        lc = llc;
-      endif
-
-      if (isempty (mmc))
-        mc = lc;
-      else
-        mc = mmc;
-      endif
-
-      if (dofill)
-        fc = mc;
-      else
-        fc = "none";
-      endif
-
-      if (have_z)
-        h_stems = plot3 (xt, yt, zt, "color", lc, "linestyle", ls,
-                         "parent", hg, x, y, z, "color", mc,
-                         "marker",  ms, "linestyle", "none",
-                         "markerfacecolor", fc, "parent", hg);
-
-        h_baseline = [];
-      else
-        h_stems = plot (xt, yt, "color", lc, "linestyle", ls,
-                        "parent", hg, x(:,i), y(:, i), "color", mc, "marker",
-                        ms, "linestyle", "none", "markerfacecolor",
-                        fc, "parent", hg);
-
-        x_axis_range = get (ax, "xlim");
-        h_baseline = line (x_axis_range, [0, 0], "color", [0, 0, 0]);
-        set (h_baseline, "handlevisibility", "off");
-        set (h_baseline, "xliminclude", "off");
-        addlistener (ax, "xlim", @update_xlim);
-        addlistener (h_baseline, "ydata", @update_baseline);
-        addlistener (h_baseline, "visible", @update_baseline);
-      endif
-
-      ## Setup the hggroup and listeners.
-      addproperty ("showbaseline", hg, "radio", "{on}|off");
-      addproperty ("basevalue", hg, "data", 0);
-      addproperty ("baseline", hg, "data", h_baseline);
-
-      if (!have_z)
-        addlistener (hg, "showbaseline", @show_baseline);
-        addlistener (hg, "basevalue", @move_baseline);
-      endif
-
-      addproperty ("color", hg, "linecolor", lc);
-      addproperty ("linewidth", hg, "linelinewidth", 0.5);
-      addproperty ("linestyle", hg, "linelinestyle", ls);
-      addproperty ("marker", hg, "linemarker", ms);
-      addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
-      addproperty ("markersize", hg, "linemarkersize", 6);
-
-      addlistener (hg, "color", @update_props);
-      addlistener (hg, "linewidth", @update_props);
-      addlistener (hg, "linestyle", @update_props);
-      addlistener (hg, "marker", @update_props);
-      addlistener (hg, "markerfacecolor", @update_props);
-      addlistener (hg, "markersize", @update_props);
-
-      addproperty ("xdata", hg, "data", x(:, i));
-      addproperty ("ydata", hg, "data", y(:, i));
-      if (have_z)
-        addproperty ("zdata", hg, "data", z(:, i));
-      else
-        addproperty ("zdata", hg, "data", []);
-      endif
-
-      addlistener (hg, "xdata", @update_data);
-      addlistener (hg, "ydata", @update_data);
-      addlistener (hg, "zdata", @update_data);
-
-      if (! isempty (args))
-        set (hg, args{:});
-      endif
-      if (i == 1 && ! isempty (h_baseline))
-        set (h_baseline, "parent", get (hg, "parent"));
-      endif
-    endfor
-
-  unwind_protect_cleanup
-    set (ax, "nextplot", hold_state);
-    axes (oldax);
-  end_unwind_protect
-endfunction
-
-function [x, y, z, dofill, lc, ls, mc, ms, newargs] = check_stem_arg (have_z, varargin)
-
-  ## FIXME -- there seems to be a lot of duplicated code in this
-  ## function.  It seems like it should be possible to simplify things
-  ## by combining some of the nearly identical code sections into
-  ## additional subfunctions.
-
-  if (have_z)
-    caller = "stem3";
-  else
-    caller = "stem";
-  endif
-
-  ## Remove prop/val pairs from data to consider.
-  i = 2;
-  newargs = {};
-  while (i < length (varargin))
-    if (ischar (varargin{i}) && !(strcmpi ("fill", varargin{i})
-                                  || strcmpi ("filled", varargin{i})))
-      newargs{end + 1} = varargin{i};
-      newargs{end + 1} = varargin{i + 1};
-      nargin = nargin - 2;
-      varargin(i:i+1) = [];
-    else
-      i++;
-    endif
-  endwhile
-
-  ## set specifiers to default values.
-  [lc, ls, mc, ms] = set_default_values ();
-  dofill = 0;
-  fill_2 = 0;
-  linespec_2 = 0;
-  z = [];
-
-  ## Check input arguments.
-  if (nargin == 2)
-    if (have_z)
-      z = varargin{1};
-      x = 1:rows (z);
-      y = 1:columns (z);
-    else
-      y = varargin{1};
-      if (isvector (y))
-        x = 1:length (y);
-      elseif (ismatrix (y))
-        x = 1:rows (y);
-      else
-        error ("stem: Y must be a matrix");
-      endif # in each case, x & y will be defined
-    endif
-  elseif (nargin == 3)
-    ## Several possibilities
-    ##
-    ## 1. the real y data
-    ## 2. 'filled'
-    ## 3. line spec
-    if (ischar (varargin{2}))
-      ## Only 2. or 3. possible.
-      if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
-        dofill = 1;
-      else
-        ## Parse the linespec.
-        [lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
-      endif
-      if (have_z)
-        z = varargin{1};
-        x = 1:rows (z);
-        y = 1:columns (z);
-      else
-        y = varargin{1};
-        if (isvector (y))
-          x = 1:length (y);
-        elseif (ismatrix (y))
-          x = 1:rows (y);
-        else
-          error ("stem: Y must be a matrix");
-        endif # in each case, x & y will be defined
-      endif
-    else
-      if (have_z)
-        error ("stem3: must define X, Y and Z");
-      else
-        ## Must be the real y data.
-        x = varargin{1};
-        y = varargin{2};
-        if (! (ismatrix (x) && ismatrix (y)))
-          error ("stem: X and Y must be matrices");
-        endif
-      endif
-    endif
-  elseif (nargin == 4)
-    ## Again, several possibilities:
-    ##
-    ## arg2 1. real y
-    ## arg2 2. 'filled' or linespec
-    ## arg3 1. real z
-    ## arg3 2. 'filled' or linespec
-    if (ischar (varargin{2}))
-      ## Only arg2 2. / arg3 1. & arg3 3. are possible.
-      if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
-        dofill = 1;
-        fill_2 = 1; # Be sure, no second "fill" is in the arguments.
-      else
-        ## Must be a linespec.
-        [lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
-        linespec_2 = 1;
-      endif
-      if (have_z)
-        z = varargin{1};
-        x = 1:rows (z);
-        y = 1:columns (z);
-      else
-        y = varargin{1};
-        if (isvector (y))
-          x = 1:length (y);
-        elseif (ismatrix (y))
-          x = 1:rows (y);
-        else
-          error ("stem: Y must be a matrix");
-        endif # in each case, x & y will be defined
-      endif
-    else
-      if (have_z)
-        x = varargin{1};
-        y = varargin{2};
-        z = varargin{3};
-        if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
-          error ("stem3: X, Y and Z must be matrices");
-        endif
-      else
-        ## must be the real y data.
-        x = varargin{1};
-        y = varargin{2};
-        if (! (ismatrix (x) && ismatrix (y)))
-          error ("stem: X and Y must be matrices");
-        endif
-      endif
-    endif # if ischar (varargin{2})
-    if (! have_z)
-      ## varargin{3} must be char.
-      ## Check for "fill.
-      if ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
-          && fill_2)
-        error ("stem: duplicate fill argument");
-      elseif (strcmpi ("fill", varargin{3}) && linespec_2)
-        ## Must be "fill".
-        dofill = 1;
-        fill_2 = 1;
-      elseif ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
-          && !linespec_2)
-        ## Must be "fill".
-        dofill = 1;
-        fill_2 = 1;
-      elseif (! linespec_2)
-        ## Must be linespec.
-        [lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
-        linespec_2 = 1;
-      endif
-    endif
-  elseif (nargin == 5)
-    if (have_z)
-      x = varargin{1};
-      y = varargin{2};
-      z = varargin{3};
-      if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
-        error ("stem3: X, Y and Z must be matrices");
-      endif
-    else
-      x = varargin{1};
-      y = varargin{2};
-      if (! (ismatrix (x) && ismatrix (y)))
-        error ("stem: X and Y must be matrices");
-      endif
-    endif
-
-    if (! have_z)
-      if (strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
-        dofill = 1;
-        fill_2 = 1; # Be sure, no second "fill" is in the arguments.
-      else
-        ## Must be a linespec.
-        [lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
-        linespec_2 = 1;
-      endif
-    endif
-
-    ## Check for "fill".
-    if ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
-        && fill_2)
-      error ("%s: duplicate fill argument", caller);
-    elseif ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
-        && linespec_2)
-      ## Must be "fill".
-      dofill = 1;
-      fill_2 = 1;
-    elseif (!strcmpi (varargin{4}, "fill") && !strcmpi (varargin{4}, "filled")
-        && !linespec_2)
-      ## Must be linespec.
-      [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
-      linespec_2 = 1;
-    endif
-  elseif (nargin == 6 && have_z)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    if (! (ismatrix (x) && ismatrix (y) && ismatrix (z)))
-      error ("stem3: X, Y and Z must be matrices");
-    endif
-
-    if (strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
-      dofill = 1;
-      fill_2 = 1; # be sure, no second "fill" is in the arguments
-    else
-      ## Must be a linespec.
-      [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
-      linespec_2 = 1;
-    endif
-
-    ## check for "fill" ..
-    if ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled"))
-        && fill_2)
-      error ("stem3: duplicate fill argument");
-    elseif ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled"))
-        && linespec_2)
-      ## Must be "fill".
-      dofill = 1;
-      fill_2 = 1;
-    elseif (!strcmpi (varargin{5}, "fill") && !strcmpi (varargin{5}, "filled")
-            && !linespec_2)
-      ## Must be linespec.
-      [lc, ls, mc, ms] = stem_line_spec (caller, varargin{5});
-      linespec_2 = 1;
-    endif
-  else
-    error ("%s: incorrect number of arguments", caller);
-  endif
-
-  ## Check sizes of x, y and z.
-  if (have_z)
-    if (!size_equal (x, y, z))
-      error ("stem3: inconsistent size of x, y and z");
-    else
-      x = x(:);
-      y = y(:);
-      z = z(:);
-    endif
-  else
-    if (isvector (x))
-      x = x(:);
-      if (isvector (y))
-        if (length (x) != length (y))
-          error ("stem: inconsistent size of x and y");
-        else
-          y = y(:);
-        endif
-      else
-        if (length (x) == rows (y))
-          x = repmat (x(:), 1, columns (y));
-        else
-          error ("stem: inconsistent size of x and y");
-        endif
-      endif
-    elseif (!size_equal (x, y))
-      error ("stem: inconsistent size of x and y");
-    endif
-  endif
-
-endfunction
-
-function [lc, ls, mc, ms] = stem_line_spec (caller, str)
-  if (! ischar (str))
-    error ("%s: expecting argument to be \"fill\" or a string of specifiers",
-           caller);
-  endif
-  [lc, ls, mc, ms] = set_default_values ();
-  ## Parse the line specifier string.
-  cur_props = __pltopt__ ("stem", str, false);
-  for i = 1:length (cur_props)
-    if (isfield (cur_props(i), "color") && ! isempty (cur_props(i).color)); # means line color
-      mc = lc = cur_props(i).color;
-    elseif (isfield (cur_props(i), "linestyle"))
-      ls = cur_props(i).linestyle;
-      if (isempty (ls))
-        ls = __next_line_style__ ();
-      endif
-    elseif (isfield (cur_props(i), "marker") && ! strcmpi (cur_props(i).marker, "none"))
-      ms = cur_props(i).marker;
-      if (isempty (ms))
-        [dummy, ms] = __next_line_style__ ();
-      endif
-    endif
-  endfor
-endfunction
-
-function [lc, ls, mc, ms] = set_default_values ()
-  ## set default values
-  mc = [];
-  lc = [];
-  ls = "-";
-  ms = "o";
-endfunction
-
-function update_xlim (h, d)
-  kids = get (h, "children");
-  xlim = get (h, "xlim");
-
-  for i = 1 : length (kids)
-    obj = get (kids (i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline"))
-      if (any (get (obj.baseline, "xdata") != xlim))
-        set (obj.baseline, "xdata", xlim);
-      endif
-    endif
-  endfor
-endfunction
-
-function update_baseline (h, d)
-  visible = get (h, "visible");
-  ydata = get (h, "ydata")(1);
-
-  kids = get (get (h, "parent"), "children");
-  for i = 1 : length (kids)
-    obj = get (kids (i));
-    if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline")
-        && obj.baseline == h)
-      ## Only alter if changed to avoid recursion of the listener functions
-      if (! strcmpi (get (kids(i), "showbaseline"), visible))
-        set (kids (i), "showbaseline", visible);
-      endif
-      if (! strcmpi (get (kids(i), "basevalue"), visible))
-        set (kids (i), "basevalue", ydata);
-      endif
-    endif
-  endfor
-endfunction
-
-function show_baseline (h, d)
-  set (get (h, "baseline"), "visible", get (h, "showbaseline"));
-endfunction
-
-function move_baseline (h, d)
-  b0 = get (h, "basevalue");
-  bl = get (h, "baseline");
-
-  if (get (bl, "ydata") != [b0, b0])
-    set (bl, "ydata", [b0, b0]);
-  endif
-
-  kids = get (h, "children");
-  yt = get (h, "ydata")(:)';
-  ny = length (yt);
-  yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
-  set (kids(2), "ydata", yt);
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids(2), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"));
-  set (kids(1), "color", get (h, "color"),
-       "marker", get (h, "marker"),
-       "markerfacecolor", get (h, "markerfacecolor"),
-       "markersize", get (h, "markersize"));
-endfunction
-
-function update_data (h, d)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-  z = get (h, "zdata");
-
-  if (!isempty (z) && size_equal (x, y, z))
-    sz = min ([size(x); size(y); size(z)]);
-    x = x(1:sz(1),1:sz(2));
-    y = y(1:sz(1),1:sz(2));
-    z = z(1:sz(1),1:sz(2));
-  elseif (numel (x) != numel (y));
-    sz = min ([size(x); size(y)]);
-    x = x(1:sz(1),1:sz(2));
-    y = y(1:sz(1),1:sz(2));
-  endif
-  bl = get (h, "basevalue");
-  nx = numel (x);
-  x = x(:)';
-  xt = [x; x; NaN(1, nx)](:);
-  if (! isempty (z))
-    y = y(:)';
-    yt = [y; y; NaN(1, nx)](:);
-    z = z(:)';
-    zt = [bl * ones(1, nx); z; NaN(1, nx)](:);
-  else
-    y = y(:)';
-    yt = [bl * ones(1, nx); y; NaN(1, nx)](:);
-    zt = [];
-  endif
-
-  kids = get (h, "children");
-  set (kids(2), "xdata", xt, "ydata", yt, "zdata", zt);
-  set (kids(1), "xdata", x, "ydata", y, "zdata", z);
-endfunction
--- a/scripts/plot/private/__tight_eps_bbox__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 2010-2012 Ben Abbott
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{bbox} =} __tight_eps_bbox__ (@var{@dots{}})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Ben Abbott <bpabbott@mac.com>
-## Created: 2010-07-26
-
-function bb = __tight_eps_bbox__ (opts, eps_file_name)
-
-  box_string = "%%BoundingBox:";
-
-  cmd = sprintf ("\"%s\" \"%s\" 2>&1", "head", eps_file_name);
-  [status, output] = system (cmd);
-
-  if (status == 0)
-    orig_bbox_line = get_bbox (output);
-  else
-    error ("print:noboundingbox",
-           "print.m: no bounding box found in '%s'", eps_file_name);
-  endif
-
-  ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4 -sDEVICE=bbox";
-  cmd = sprintf ("\"%s\" %s \"%s\" 2>&1", opts.ghostscript.binary,
-                 ghostscript_options, eps_file_name);
-  [status, output] = system (cmd);
-
-  if (status == 0)
-    tight_bbox_line = get_bbox (output);
-  else
-    warning ("print:nogsboundingbox",
-             "print.m: ghostscript failed to determine the bounding for '%s'",
-             eps_file_name);
-  endif
-
-  ## Attempt to fix the bbox in place.
-  fid = fopen (eps_file_name, "r+");
-  unwind_protect
-    bbox_replaced = false;
-    looking_for_bbox = true;
-    while (looking_for_bbox)
-      current_line = fgetl (fid);
-      if (strncmpi (current_line, box_string, numel (box_string)))
-        line_length = numel (current_line);
-        num_spaces = line_length - numel (tight_bbox_line);
-        if (numel (current_line) >= numel (tight_bbox_line))
-          new_line = tight_bbox_line;
-          new_line(end+1:numel (current_line)) = " ";
-          bbox_replaced = true;
-          ## Back up to the beginning of the line (include EOL characters).
-          if (ispc ())
-            fseek (fid, -line_length-2, "cof");
-          else
-            fseek (fid, -line_length-1, "cof");
-          endif
-          count = fprintf (fid, "%s", new_line);
-        endif
-        looking_for_bbox = false;
-      elseif (! ischar (current_line))
-        looking_for_bbox = false;
-      endif
-    endwhile
-  unwind_protect_cleanup
-    fclose (fid);
-  end_unwind_protect
-
-  ## If necessary load the eps-file and replace the bbox (can be slow).
-  if (! bbox_replaced)
-    fid = fopen (eps_file_name, "r");
-    unwind_protect
-      data = char (fread (fid, Inf)).';
-    unwind_protect_cleanup
-      fclose (fid);
-    end_unwind_protect
-    n = strfind (data, box_string);
-    if (numel (n) > 1)
-      ## Only replace one instance.
-      n = n(1);
-    elseif (isempty (n))
-      error ("print:noboundingbox", ...
-             "print.m: no bounding box found in '%s'.", eps_file_name);
-    endif
-    m = numel (orig_bbox_line);
-    data = horzcat (data(1:(n-1)), tight_bbox_line, data((n+m):end));
-    fid = fopen (eps_file_name, "w");
-    unwind_protect
-      fprintf (fid, "%s", data);
-    unwind_protect_cleanup
-      fclose (fid);
-    end_unwind_protect
-  endif
-
-endfunction
-
-function bbox_line = get_bbox (lines)
-  box_string = "%%BoundingBox:";
-  pattern = strcat (box_string, "[^%]*");
-  pattern = pattern(1:find (double (pattern) > 32, 1, "last"));
-  bbox_line = regexp (lines, pattern, "match");
-  if (iscell (bbox_line))
-    bbox_line = bbox_line{1};
-  endif
-  ## Remove the EOL characters.
-  bbox_line(double (bbox_line) < 32) = "";
-endfunction
-
--- a/scripts/plot/private/__uigetdir_fltk__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title})
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function dirname = __uigetdir_fltk__ (start_path, dialog_title)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uigetdir: fltk graphics toolkit required");
-  endif
-
-  dirname = __fltk_uigetfile__ ("", dialog_title, start_path, [240, 120], "dir");
-
-endfunction
--- a/scripts/plot/private/__uigetfile_fltk__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function [retval, retpath, retindex] = __uigetfile_fltk__ (filters, title, defval, position, multiselect, defdir)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uigetfile: fltk graphics toolkit required");
-  endif
-
-  filters = __fltk_file_filter__ (filters);
-  if (length (defdir) > 0)
-    defval = fullfile (defdir, defval);
-  endif
-  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, multiselect);
-
-endfunction
--- a/scripts/plot/private/__uiobject_split_args__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf})
-## @end deftypefn
-
-## Author: goffioul
-
-function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1)
-
-  parent = [];
-  args = {};
-  offset = 1;
-
-  if (! isempty (in_args))
-    if (ishandle (in_args{1}))
-      parent = in_args{1};
-      offset = 2;
-    elseif (! ischar (in_args{1}))
-      error ("%s: invalid parent handle.", who);
-    endif
-
-    args = in_args(offset:end);
-  endif
-
-  if (rem (length (args), 2))
-    error ("%s: expecting PROPERTY/VALUE pairs", who);
-  endif
-
-  if (! isempty (args))
-    i = find (strcmpi (args(1:2:end), "parent"), 1, "first");
-    if (! isempty (i) && length (args) >= 2*i)
-      parent = args{2*i};
-      if (! ishandle (parent))
-        error ("%s: invalid parent handle.", who);
-      endif
-      args([2*i-1, 2*i]) = [];
-    endif
-  endif
-
-  if (! isempty (parent))
-    if (! isempty (parent_type) && isempty (find (strcmpi (get (parent, "type"), parent_type))))
-      error ("%s: invalid parent, the parent type must be: %s", ...
-             who, sprintf ("%s, ", parent_type{:})(1:end-2));
-    endif
-  elseif (use_gcf)
-    parent = gcf ();
-  endif
-
-endfunction
--- a/scripts/plot/private/__uiputfile_fltk__.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ ()
-## Undocumented internal function.
-## @end deftypefn
-
-## Author: Michael Goffioul
-
-function [retval, retpath, retindex] = __uiputfile_fltk__ (filters, title, defval, position, tag, defdir)
-
-  if (exist ("__fltk_uigetfile__") != 3)
-    error ("uiputfile: fltk graphics toolkit required");
-  endif
-
-  filters = __fltk_file_filter__ (filters);
-  if (length (defdir) > 0)
-    defval = fullfile (defdir, defval);
-  endif
-  [retval, retpath, retindex] = __fltk_uigetfile__ (filters, title, defval, position, tag);
-
-endfunction
--- a/scripts/plot/quiver.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} quiver (@var{u}, @var{v})
-## @deftypefnx {Function File} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
-## @deftypefnx {Function File} {} quiver (@dots{}, @var{s})
-## @deftypefnx {Function File} {} quiver (@dots{}, @var{style})
-## @deftypefnx {Function File} {} quiver (@dots{}, "filled")
-## @deftypefnx {Function File} {} quiver (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} quiver (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v})} components of a vector field in
-## an @code{(@var{x}, @var{y})} meshgrid.  If the grid is uniform, you can
-## specify @var{x} and @var{y} as vectors.
-##
-## If @var{x} and @var{y} are undefined they are assumed to be
-## @code{(1:@var{m}, 1:@var{n})} where @code{[@var{m}, @var{n}] =
-## size (@var{u})}.
-##
-## The variable @var{s} is a scalar defining a scaling factor to use for
-## the arrows of the field relative to the mesh spacing.  A value of 0
-## disables all scaling.  The default value is 1.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-## If a marker is specified then markers at the grid points of the vectors are
-## printed rather than arrows.  If the argument "filled" is given then the
-## markers are drawn filled.
-##
-## The optional return value @var{h} is a graphics handle to a quiver object.
-## A quiver object regroups the components of the quiver plot (body, arrow,
-## and marker), and allows them to be changed together.
-##
-## @example
-## @group
-## [x, y] = meshgrid (1:2:20);
-## h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
-## set (h, "maxheadsize", 0.33);
-## @end group
-## @end example
-##
-## @seealso{quiver3, feather, plot}
-## @end deftypefn
-
-function retval = quiver (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __quiver__ (h, 0, varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x,y] = meshgrid (1:2:20);
-%! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
-%! set (h, 'maxheadsize', 0.33);
-
-%!demo
-%! clf;
-%! axis ('equal');
-%! x = linspace (0, 3, 80);
-%! y = sin (2*pi*x);
-%! theta = 2*pi*x + pi/2;
-%! quiver (x, y, sin (theta)/10, cos (theta)/10);
-%! hold on; plot (x,y,'r'); hold off;
-
--- a/scripts/plot/quiver3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
-## @deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} quiver3 (@dots{}, "filled")
-## @deftypefnx {Function File} {} quiver3 (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
-##
-## Plot the @code{(@var{u}, @var{v}, @var{w})} components of a vector field in
-## an @code{(@var{x}, @var{y}), @var{z}} meshgrid.  If the grid is uniform, you
-## can specify @var{x}, @var{y} @var{z} as vectors.
-##
-## If @var{x}, @var{y} and @var{z} are undefined they are assumed to be
-## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
-## size (@var{u})} and @code{@var{p} = max (size (@var{w}))}.
-##
-## The variable @var{s} is a scalar defining a scaling factor to use for
-##  the arrows of the field relative to the mesh spacing.  A value of 0
-## disables all scaling.  The default value is 1.
-##
-## The style to use for the plot can be defined with a line style @var{style}
-## in a similar manner to the line styles used with the @code{plot} command.
-## If a marker is specified then markers at the grid points of the vectors are
-## printed rather than arrows.  If the argument "filled" is given then the
-## markers as filled.
-##
-## The optional return value @var{h} is a graphics handle to a quiver object.
-## A quiver object regroups the components of the quiver plot (body, arrow,
-## and marker), and allows them to be changed together.
-##
-## @example
-## @group
-## [x, y, z] = peaks (25);
-## surf (x, y, z);
-## hold on;
-## [u, v, w] = surfnorm (x, y, z / 10);
-## h = quiver3 (x, y, z, u, v, w);
-## set (h, "maxheadsize", 0.33);
-## @end group
-## @end example
-##
-## @seealso{quiver, plot}
-## @end deftypefn
-
-function retval = quiver3 (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __quiver__ (h, 1, varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x,y] = meshgrid (-1:0.1:1);
-%! z = sin (2*pi * sqrt (x.^2 + y.^2));
-%! theta = 2*pi * sqrt (x.^2 + y.^2) + pi/2;
-%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z)));
-%! hold on;
-%! mesh (x, y, z);
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (25);
-%! surf (x, y, z);
-%! hold on;
-%! [u, v, w] = surfnorm (x, y, z / 10);
-%! h = quiver3 (x, y, z, u, v, w);
-%! set (h, 'maxheadsize', 0.33);
-%! hold off;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (25);
-%! surf (x, y, z);
-%! hold on;
-%! [u, v, w] = surfnorm (x, y, z / 10);
-%! h = quiver3 (x, y, z, u, v, w);
-%! set (h, 'maxheadsize', 0.33);
-%! hold off;
-%! shading interp;
-
--- a/scripts/plot/rectangle.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-## Copyright (C) 2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} rectangle ()
-## @deftypefnx {Function File} {} rectangle (@dots{}, "Position", @var{pos})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "Curvature", @var{curv})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "EdgeColor", @var{ec})
-## @deftypefnx {Function File} {} rectangle (@dots{}, "FaceColor", @var{fc})
-## @deftypefnx {Function File} {@var{h} =} rectangle (@dots{})
-##
-## Draw rectangular patch defined by @var{pos} and @var{curv}.  The variable
-## @code{@var{pos}(1:2)} defines the lower left-hand corner of the patch
-## and @code{@var{pos}(3:4)} defines its width and height.  By default, the
-## value of @var{pos} is @code{[0, 0, 1, 1]}.
-##
-## The variable @var{curv} defines the curvature of the sides of the rectangle
-## and may be a scalar or two-element vector with values between 0 and 1.
-## A value of 0 represents no curvature of the side, whereas a value of 1
-## means that the side is entirely curved into the arc of a circle.
-## If @var{curv} is a two-element vector, then the first element is the
-## curvature along the x-axis of the patch and the second along y-axis.
-##
-## If @var{curv} is a scalar, it represents the curvature of the shorter of the
-## two sides of the rectangle and the curvature of the other side is defined
-## by
-##
-## @example
-## min (pos (1:2)) / max (pos (1:2)) * curv
-## @end example
-##
-## Other properties are passed to the underlying patch command. 
-## 
-## The optional return value @var{h} is a graphics handle to the created
-## rectangle object.
-## @end deftypefn
-## @seealso{patch}
-
-function h = rectangle (varargin)
-
-  [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:});
-
-  tmp =  __rectangle__ (hax, varargin{:});
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-endfunction
-
-function hg = __rectangle__ (hax, varargin)
-
-  iarg = 1;
-  pos = [0, 0, 1, 1];
-  curv2 = [0, 0];
-  ec = [0, 0, 0];
-  fc = "none";
-
-  while (iarg < length (varargin))
-    arg = varargin{iarg};
-    if (ischar (arg))
-      if (strcmpi (arg, "position"))
-        pos = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-        if (!isvector (pos) || numel (pos) != 4)
-          error ("rectangle: position must be a 4 element vector");
-        endif
-      elseif (strcmpi (arg, "curvature"))
-        curv2 = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-        if (!isnumeric (curv2) || (numel (curv2) != 1 && numel (curv2) != 2))
-          error ("rectangle: curvature must be a 2 element vector or a scalar");
-        endif
-        if (any (curv2 < 0) || any (curv2 > 1))
-          error ("rectangle: curvature values must be between 0 and 1");
-        endif
-      elseif (strcmpi (arg, "edgecolor"))
-        ec = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-      elseif (strcmpi (arg, "facecolor"))
-        fc = varargin{iarg+1};
-        varargin(iarg:iarg+1) = [];
-      else
-        iarg ++;
-      endif
-    else
-      iarg ++;
-    endif
-  endwhile
-
-  if (numel (curv2) == 1)
-    [a, ai] = min (pos (3 : 4));
-    [b, bi] = max (pos (3 : 4));
-    if (ai < bi)
-      curv = [curv2, curv2 .* a ./ b];
-    else
-      curv = [curv2 .* a ./ b, curv2];
-    endif
-  else
-    curv = curv2;
-  endif
-
-  if (all (curv) < 0.01)
-    ## Special case : no curvature
-    x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
-    y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
-  else
-    p = pi / 2 * [0 : 15] / 15;
-    c = curv .* pos(3 : 4) / 2;
-    cx = c(1) * sin (p) - c(1);
-    cy = c(2) * cos (p) - c(2);
-    x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
-         pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
-    y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
-         pos(2) + pos(4) + cy, pos(2) + c(2)];
-  endif
-
-  hg = hggroup ();
-
-  h = patch ("xdata", x(:), "ydata", y(:), "facecolor", fc, "edgecolor", ec, ...
-             "parent", hg, varargin{:});
-
-  addproperty ("curvature", hg, "data", curv2);
-  addproperty ("position",  hg, "data", pos);
-  addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor"));
-  addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
-  addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
-  addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
-
-  addlistener (hg, "curvature", @update_data);
-  addlistener (hg, "position",  @update_data);
-  addlistener (hg, "edgecolor", @update_props);
-  addlistener (hg, "linewidth", @update_props);
-  addlistener (hg, "linestyle", @update_props);
-  addlistener (hg, "facecolor", @update_props);
-endfunction
-
-function update_data (h, d)
-  persistent recursion = false;
-
-  ## Don't allow recursion
-  if (!recursion)
-    unwind_protect
-      recursion = true;
-
-      kids = get (h, "children");
-      pos = get (h, "position");
-      curv2 = get (h, "curvature");
-
-      if (numel (curv2) == 1)
-        [a, ai] = min (pos (3 : 4));
-        [b, bi] = max (pos (3 : 4));
-        if (ai < bi)
-          curv = [curv2, curv2 .* a ./ b];
-        else
-          curv = [curv2 .* a ./ b, curv2];
-        endif
-      else
-        curv = curv2;
-      endif
-
-      if (all (curv) < 0.01)
-        ## Special case : no curvature
-        x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)];
-        y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)];
-      else
-        p = pi / 2 * [0 : 15] / 15;
-        c = curv .* pos(3 : 4) / 2;
-        cx = c(1) * sin (p) - c(1);
-        cy = c(2) * cos (p) - c(2);
-        x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ...
-             pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)];
-        y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ...
-             pos(2) + pos(4) + cy, pos(2) + c(2)];
-      endif
-
-      set (kids, "xdata", x, "ydata", y);
-    unwind_protect_cleanup
-      recursion = false;
-    end_unwind_protect
-  endif
-endfunction
-
-function update_props (h, d)
-  kids = get (h, "children");
-  set (kids, "edgecolor", get (h, "edgecolor"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"),
-       "facecolor", get (h, "facecolor"));
-endfunction
-
-
-%!demo
-%! clf;
-%! axis equal;
-%! rectangle ('Position', [0.05, 0.05, 0.9, 0.9], 'Curvature', [0.5, 0.5]);
-
-%!demo
-%! clf;
-%! axis equal;
-%! rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
-
-%!demo
-%! clf;
-%! axis equal;
-%! h = rectangle ('Position', [0.05, 0.05, 0.9, 0.4], 'Curvature', 1.0);
-%! set (h, 'FaceColor', [0, 1, 0]);
-
--- a/scripts/plot/refresh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} refresh ()
-## @deftypefnx {Function File} {} refresh (@var{h})
-## Refresh a figure, forcing it to be redrawn.  When called without an
-## argument the current figure is redrawn.  Otherwise, the figure pointed
-## to by @var{h} is redrawn.
-## @seealso{drawnow}
-## @end deftypefn
-
-function refresh (h)
-
-  if (nargin > 1)
-    print_usage ();
-  elseif (nargin == 1)
-    if (! isfigure (h))
-      error ("refresh: H must be a valid figure handle");
-    endif
-  else
-    h = gcf ();
-  endif
-
-  set (h, "__modified__", "on");
-  drawnow ();
-
-endfunction
--- a/scripts/plot/refreshdata.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-## Copyright (C) 2008-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} refreshdata ()
-## @deftypefnx {Function File} {} refreshdata (@var{h})
-## @deftypefnx {Function File} {} refreshdata (@var{h}, @var{workspace})
-## Evaluate any @samp{datasource} properties of the current figure and update
-## the plot if the corresponding data has changed.  If called with one or more
-## arguments @var{h} is a scalar or array of figure handles to refresh.  The
-## optional second argument @var{workspace} can take the following values.
-##
-## @table @asis
-## @item "base"
-## Evaluate the datasource properties in the base workspace.  (default).
-##
-## @item "caller"
-## Evaluate the datasource properties in the workspace of the function
-## that called @code{refreshdata}.
-## @end table
-##
-## An example of the use of @code{refreshdata} is:
-##
-## @example
-## @group
-## x = 0:0.1:10;
-## y = sin (x);
-## plot (x, y, "ydatasource", "y");
-## for i = 1 : 100
-##   pause (0.1);
-##   y = sin (x + 0.1*i);
-##   refreshdata ();
-## endfor
-## @end group
-## @end example
-## @end deftypefn
-
-function refreshdata (h, workspace)
-
-  if (nargin == 0)
-    h = gcf ();
-    workspace = "base";
-  else
-    if (iscell (h))
-      h = [h{:}];
-    endif
-    if (!all (ishandle (h)) || !all (strcmp (get (h, "type"), "figure")))
-      error ("refreshdata: expecting a list of figure handles");
-    endif
-    if (nargin < 2)
-      workspace = "base";
-    else
-      if (   !ischar (workspace)
-          || !(strcmpi (workspace, "base")
-          || strcmpi (workspace, "caller")))
-        error ("refreshdata: expecting WORKSPACE to be \"base\" or ""caller\"");
-      else
-        workspace = tolower (workspace);
-      endif
-    endif
-  endif
-
-  h = findall (h);
-  objs = [];
-  props = {};
-
-  for i = 1 : numel (h)
-    obj = get (h (i));
-    fldnames = fieldnames (obj);
-    m = regexpi (fieldnames (obj), '^.+datasource$', "match");
-    idx = ! cellfun ("isempty", m);
-    if (any (idx))
-      tmp = m(idx);
-      props = [props; {vertcat(tmp{:})}];
-      objs  = [objs ; h(i)];
-    endif
-  endfor
-
-  for i = 1 : length (objs)
-    for j = 1 : length (props {i})
-      expr = get (objs(i), props{i}{j});
-      if (!isempty (expr))
-        val = evalin (workspace, expr);
-        prop =  props{i}{j}(1:end-6);
-        if (! isequal (get (objs(i), prop), val))
-          set (objs(i), props{i}{j}(1:end-6), val);
-        endif
-      endif
-    endfor
-  endfor
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0:0.1:10;
-%! y = sin (x);
-%! plot (x, y, 'ydatasource', 'y');
-%! for i = 1 : 100
-%!   pause (0.1);
-%!   y = sin (x + 0.1 * i);
-%!   refreshdata (gcf, 'caller');
-%! end
-
--- a/scripts/plot/ribbon.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ribbon (@var{x}, @var{y}, @var{width})
-## @deftypefnx {Function File} {} ribbon (@var{y})
-## @deftypefnx {Function File} {@var{h} =} ribbon (@dots{})
-## Plot a ribbon plot for the columns of @var{y} vs. @var{x}.  The
-## optional parameter @var{width} specifies the width of a single ribbon
-## (default is 0.75).  If @var{x} is omitted, a vector containing the
-## row numbers is assumed (1:rows (Y)).
-##
-## The optional return value @var{h} is a vector of graphics handles to
-## the surface objects representing each ribbon.
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel at gmx.de>
-
-function h = ribbon (x, y, width = 0.75)
-
-  if (nargin < 1 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    y = x;
-    if (isvector (y))
-      y = y(:);
-    endif
-    [nr, nc] = size (y);
-    x = repmat ((1:nr)', 1, nc);
-  endif
-
-  if (isvector (x) && isvector (y))
-    if (length (x) != length (y))
-      error ("ribbon: vectors X and Y must have the same length");
-    else
-      [x, y] = meshgrid (x, y);
-    endif
-  else
-    if (! size_equal (x, y))
-      error ("ribbon: matrices X and Y must have the same size");
-    endif
-  endif
-
-  newplot ();
-
-  [nr, nc] = size (y);
-  htmp = zeros (nc, 1);
-
-  for c = nc:-1:1
-    zz = [y(:,c), y(:,c)];
-    yy = x(:,c);
-    xx = [c - width / 2, c + width / 2];
-    [xx, yy] = meshgrid (xx, yy);
-    cc = repmat (c, size (zz));
-    htmp(c) = surface (xx, yy, zz, cc);
-  endfor
-
-  if (! ishold ())
-    ax = get (htmp(1), "parent");
-    set (ax, "view", [-37.5, 30], "box", "off", 
-             "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = sombrero ();
-%! [x, y] = meshgrid (x, y);
-%! ribbon (y, z);
-
-%!FIXME: Could have some input validation tests here
-
--- a/scripts/plot/rose.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} rose (@var{th})
-## @deftypefnx {Function File} {} rose (@var{th}, @var{r})
-## @deftypefnx {Function File} {} rose (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} rose (@dots{})
-## @deftypefnx {Function File} {[@var{r}, @var{th}] =} rose (@dots{})
-##
-## Plot an angular histogram.  With one vector argument, @var{th}, plot the
-## histogram with 20 angular bins.  If @var{th} is a matrix then each column
-## of @var{th} produces a separate histogram.
-##
-## If @var{r} is given and is a scalar, then the histogram is produced with
-## @var{r} bins.  If @var{r} is a vector, then the center of each bin are
-## defined by the values of @var{r}.
-##
-## The optional return value @var{h} is a vector of graphics handles to the
-## line objects representing each histogram.
-##
-## If two output arguments are requested then no plot is made and 
-## the polar vectors necessary to plot the histogram are returned instead.
-##
-## @example
-## @group
-## [r, th] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
-## polar (r, th);
-## @end group
-## @end example
-##
-## @seealso{polar, compass, hist}
-## @end deftypefn
-
-function [thout, rout] = rose (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 1), "rose",
-                                                varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  ## Force theta to [0,2*pi] range
-  th = varargin {1};
-  th = atan2  (sin (th), cos (th)) + pi;
-
-  if (nargin > 1)
-    x = varargin {2};
-    if (isscalar (x))
-      x = [0.5/x : 1/x : 1] * 2 * pi;
-    else
-      ## Force theta to [0,2*pi] range
-      x = atan2  (sin (x), cos (x)) + pi;
-    endif
-  else
-    x = [1/40 : 1/20 : 1] * 2 * pi;
-  endif
-
-  [nn, xx] = hist (th, x);
-  xx = xx(:).';
-  if (isvector (nn))
-    nn = nn (:);
-  endif
-  x1 = xx(1:end-1) + diff (xx, 1) / 2;
-  x1 = [x1 ; x1; x1; x1](:);
-  th = [0; 0; x1; 2*pi ; 2*pi];
-  r = zeros (4 * rows (nn), columns (nn));
-  r(2:4:end, :) = nn;
-  r(3:4:end, :) = nn;
-
-  if (nargout < 2)
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      hlist = polar (h, th, r);
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-
-    if (nargout > 0)
-      thout = hlist;
-    endif
-  else
-    thout = th;
-    rout = r;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! rose ([2*randn(1e5, 1), pi + 2*randn(1e5, 1)]);
-
--- a/scripts/plot/saveas.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} saveas (@var{h}, @var{filename})
-## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt})
-## Save graphic object @var{h} to the file @var{filename} in graphic
-## format @var{fmt}.
-##
-## @var{fmt} should be one of the following formats:
-##
-## @table @code
-##   @item ps
-##     Postscript
-##
-##   @item eps
-##     Encapsulated Postscript
-##
-##   @item jpg
-##     JPEG Image
-##
-##   @item png
-##     PNG Image
-##
-##   @item emf
-##     Enhanced Meta File
-##
-##   @item pdf
-##     Portable Document Format
-## @end table
-##
-## All device formats specified in @code{print} may also be used.  If
-## @var{fmt} is omitted it is extracted from the extension of @var{filename}.
-## The default format is @code{"pdf"}.
-##
-## @example
-## @group
-## clf ();
-## surf (peaks);
-## saveas (1, "figure1.png");
-## @end group
-## @end example
-##
-## @seealso{print}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function  saveas (h, filename, fmt = "pdf")
-
-  if ((nargin != 2) && (nargin != 3))
-    print_usage ();
-  endif
-
-  if (ishandle (h))
-    if (isfigure (h))
-      fig = h;
-    else
-      fig = ancestor (h, "figure");
-    endif
-  else
-    error ("saveas: first argument H must be a graphics handle");
-  endif
-
-  if (!ischar (filename))
-    error ("saveas: FILENAME must be a string");
-  endif
-
-  if (nargin == 2)
-    [~, ~, ext] = fileparts (filename);
-    if (!isempty (ext))
-      fmt = ext(2:end);
-    endif
-  endif
-
-  if (nargin == 3)
-    if (!ischar (filename))
-      error ("saveas: EXT must be a string");
-    endif
-
-    [~, ~, ext] = fileparts (filename);
-
-    if (isempty (ext))
-      filename = strcat (filename, ".", fmt);
-    endif
-  endif
-
-  prt_opt = strcat ("-d", tolower (fmt));
-
-  print (fig, filename, prt_opt);
-
-endfunction
--- a/scripts/plot/scatter.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} scatter (@var{x}, @var{y})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}, @var{style})
-## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} scatter (@dots{}, "filled")
-## @deftypefnx {Function File} {} scatter (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} scatter (@dots{})
-##
-## Draw a scatter plot of the data.  A marker is plotted at each point
-## defined by the points in the vectors @var{x} and @var{y}.  The size of
-## the markers used is determined by the @var{s}, which can be a scalar or
-## a vector of the same length as @var{x} and @var{y}.  If @var{s} is not
-## given or is an empty matrix, then the default value of 8 points is used.
-##
-## The color of the markers is determined by @var{c}, which can be a string
-## defining a fixed color; a 3-element vector giving the red, green,and blue
-## components of the color; a vector of the same length as @var{x} that gives
-## a scaled index into the current colormap; or an @var{n}-by-3 matrix defining
-## the colors of each of the markers individually.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot} command.
-## If the argument @code{"filled"} is given then the markers as filled.  All
-## additional arguments are passed to the underlying patch command.
-##
-## The optional return value @var{h} is a graphics handle to the created patch
-## object.
-## 
-## Example:
-##
-## @example
-## @group
-## x = randn (100, 1);
-## y = randn (100, 1);
-## scatter (x, y, [], sqrt (x.^2 + y.^2));
-## @end group
-## @end example
-##
-## @seealso{plot, patch, scatter3}
-## @end deftypefn
-
-function retval = scatter (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __scatter__ (h, 2, "scatter", varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! scatter (x, y, 'r');
-%! title ('Scatter plot with red bubbles');
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! c = x .* y;
-%! scatter (x, y, 20, c, 'filled');
-%! title ('Scatter with colors');
-
-%!demo
-%! clf;
-%! x = randn (100, 1);
-%! y = randn (100, 1);
-%! scatter (x, y, [], sqrt (x.^2 + y.^2));
-%! title ('Scatter plot with bubble color determined by distance from origin');
-
-%!demo
-%! clf;
-%! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
-%! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
-%! x = rand_10x1_data1;
-%! y = rand_10x1_data2;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, s, s, 's', 'filled');
-%! title ({'Scatter plot with filled square markers', ...
-%!         'size and color of markers determined by algorithm'});
-
-%!demo
-%! clf;
-%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726];
-%! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
-%! x = rand_10x1_data3;
-%! y = rand_10x1_data4;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, [], 'r', 's', 'filled');
-
-%!demo
-%! clf;
-%! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
-%! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
-%! x = rand_10x1_data5;
-%! y = rand_10x1_data6;
-%! s = 10 - 10*log (x.^2 + y.^2);
-%! h = scatter (x, y, [], 'r', 's');
-
-%!demo
-%! clf;
-%! k = 1;
-%! for m = [1, 3]
-%!   for n = [101, 50, 1]
-%!     x = rand (n, 1);
-%!     y = rand (n, 1);
-%!     if (m > 1)
-%!       str = 'Three Colors';
-%!       idx = ceil (rand (n, 1) * 3);
-%!       colors = eye (3);
-%!       colors = colors(idx, :);
-%!     else
-%!       str = 'Random Colors';
-%!       colors = rand (n, m);
-%!     end
-%!     if (n == 1)
-%!       str = sprintf ('%s: 1 point', str);
-%!     elseif (n < 100)
-%!       str = sprintf ('%s: < 100 points', str);
-%!     else
-%!       str = sprintf ('%s: > 100 points', str);
-%!     end
-%!     subplot (2,3,k);
-%!     k = k + 1;
-%!     scatter (x, y, 15, colors, 'filled');
-%!     axis ([0 1 0 1]);
-%!     title (str);
-%!   end
-%! end
-
-%!demo
-%! clf;
-%! k = 1;
-%! for m = [1, 3]
-%!   for n = [101, 50, 1]
-%!     x = rand (n, 1);
-%!     y = rand (n, 1);
-%!     if (m > 1)
-%!       str = 'Three Colors';
-%!       idx = ceil (rand (n, 1) * 3);
-%!       colors = eye (3);
-%!       colors = colors(idx, :);
-%!     else
-%!       str = 'Random Colors';
-%!       colors = rand (n, m);
-%!     end
-%!     if (n == 1)
-%!       str = sprintf ('%s: 1 point', str);
-%!     elseif (n < 100)
-%!       str = sprintf ('%s: < 100 points', str);
-%!     else
-%!       str = sprintf ('%s: > 100 points', str);
-%!     end
-%!     subplot (2,3,k);
-%!     k = k + 1;
-%!     scatter (x, y, 15, colors);
-%!     axis ([0 1 0 1]);
-%!     title (str);
-%!   end
-%! end
-
--- a/scripts/plot/scatter3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
-## @deftypefnx {Function File} {} scatter3 (@dots{}, "filled")
-## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
-## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} scatter3 (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{})
-##
-## Plot a scatter plot of the data in 3D@.  A marker is plotted at each point
-## defined by the points in the vectors @var{x}, @var{y} and @var{z}.  The size
-## of the markers used is determined by @var{s}, which can be a scalar or
-## a vector of the same length of @var{x}, @var{y} and @var{z}.  If @var{s} is
-## not given or is an empty matrix, then the default value of 8 points is used.
-##
-## The color of the markers is determined by @var{c}, which can be a string
-## defining a fixed color; a 3-element vector giving the red, green, and blue
-## components of the color; a vector of the same length as @var{x} that gives
-## a scaled index into the current colormap; or a @var{n}-by-3 matrix defining
-## the colors of each of the markers individually.
-##
-## The marker to use can be changed with the @var{style} argument, that is a
-## string defining a marker in the same manner as the @code{plot} command.
-## If the argument "filled" is given then the markers as filled.  All
-## additional arguments are passed to the underlying patch command.
-##
-## The optional return value @var{h} is a graphics handle to the hggroup
-## object representing the points.
-##
-## @example
-## @group
-## [x, y, z] = peaks (20);
-## scatter3 (x(:), y(:), z(:), [], z(:));
-## @end group
-## @end example
-##
-## @seealso{plot, patch, scatter}
-## @end deftypefn
-
-function retval = scatter3 (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:});
-
-  if (nargin < 2)
-    print_usage ();
-  else
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __scatter__ (h, 3, "scatter3", varargin{:});
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  endif
-
-  if (! ishold ())
-    set (h, "view", [-37.5, 30],
-         "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [x, y, z] = peaks (20);
-%! scatter3 (x(:), y(:), z(:), [], z(:));
-%! %% Default scatter3 with constant size bubbles and color determined by Z
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 10, z(:), 's');
-%! %% scatter3 using a square marker of size 10 and color determined by Z
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 20*z(:), [], 's');
-%! %% scatter3 using a square marker whose size is determined by Z
-
-%!demo
-%! clf;
-%! x = rand (20,1);  y = rand (20,1);  z = rand (20,1);
-%! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), 's');
-%! %% scatter3 using a square marker.
-%! %% Size and color of marker are determined by Z
-
--- a/scripts/plot/semilogx.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogx (@var{y})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} semilogx (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} semilogx (@dots{})
-## Produce a two-dimensional plot using a logarithmic scale for the @var{x}
-## axis.  See the documentation of @code{plot} for a description of the
-## arguments that @code{semilogx} will accept.
-## 
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogy, loglog}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = semilogx (varargin)
-
-  [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "xscale", "log");
-    if (any( strcmp (get (gca, "nextplot"), {"new", "replace"})))
-      set (h, "xminortick", "on");
-    endif
-
-    tmp = __plt__ ("semilogx", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:0.01:10;
-%! y = (x .* (1 + rand (size (x)))) .^ 2;
-%! semilogx (y, x);
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  semilogx (x, y);
-%!  xlabel ('semilogx (x, y)');
-%!
-%! subplot (1,2,2);
-%!  semilogx (-x, y);
-%!  xlabel ('semilogx (-x, y)');
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (1,2,1);
-%!  semilogx (x, y);
-%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  xlabel ({'semilogx (x, y)', 'xdir = reversed'});
-%!
-%! subplot (1,2,2);
-%!  semilogx (-x, y);
-%!  set (gca, 'xdir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  xlabel ({'semilogx (-x, y)', 'xdir = reversed'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogx (a, b);
-%!   assert (get (gca, "xscale"), "log");
-%!   assert (get (gca, "yscale"), "linear");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a =-logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogx (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "xtick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/semilogxerr.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogxerr (@var{args})
-## @deftypefnx {Function File} {@var{h} =} semilogxerr (@var{args})
-## Produce two-dimensional plots using a logarithmic scale for the @var{x}
-## axis and errorbars at each data point.  Many different combinations of
-## arguments are possible.  The most common form is
-##
-## @example
-## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a semi-logarithmic plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  See @code{errorbar} for available formats and
-## additional information.
-## @seealso{errorbar, loglogerr, semilogyerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = semilogxerr (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "xscale", "log");
-
-    tmp = __errcomm__ ("semilogxerr", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = exp (log (0.01):0.2:log (10));
-%! y = wblpdf (x, 2, 2);
-%! ey = 0.5*rand (size (y)) .* y;
-%! semilogxerr (x, y, ey, '#~x-');
-%! xlim (x([1, end]));
-
--- a/scripts/plot/semilogy.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogy (@var{y})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
-## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
-## Produce a two-dimensional plot using a logarithmic scale for the @var{y}
-## axis.  See the documentation of @code{plot} for a description of the
-## arguments that @code{semilogy} will accept.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, semilogx, loglog}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = semilogy (varargin)
-
-  [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:});
-
-  if (nargs < 1)
-    print_usage ();
-  endif
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "yscale", "log");
-    if (any (strcmp (get (gca, "nextplot"), {"new", "replace"})))
-      set (h, "yminortick", "on");
-    endif
-
-    tmp = __plt__ ("semilogy", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:0.01:10;
-%! y = (x .* (1 + rand (size (x)))) .^ 2;
-%! semilogy (x, y);
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (2,1,1);
-%!  semilogy (x, y);
-%!  ylabel ('semilogy (x, y)');
-%!
-%! subplot (2,1,2);
-%!  semilogy (x, -y);
-%!  ylabel ('semilogy (x, -y)');
-
-%!demo
-%! clf;
-%! x = logspace (-5, 1, 10);
-%! y = logspace (-5, 1, 10);
-%!
-%! subplot (2,1,1);
-%!  semilogy (x, y);
-%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  ylabel ({'semilogy (x, y)', 'ydir = reversed'});
-%!
-%! subplot (2,1,2);
-%!  semilogy (x, -y);
-%!  set (gca, 'ydir', 'reverse', 'activepositionproperty', 'outerposition');
-%!  ylabel ({'semilogy (x, -y)', 'ydir = reversed'});
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b = logspace (-5, 1, 10);
-%!   semilogy (a, b);
-%!   assert (get (gca, "yscale"), "log");
-%!   assert (get (gca, "xscale"), "linear");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   a = logspace (-5, 1, 10);
-%!   b =-logspace (-5, 1, 10);
-%!   semilogy (a, b);
-%!   axis tight;
-%!   assert (all (get (gca, "ytick") < 0));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/semilogyerr.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-## Copyright (C) 2000-2012 Teemu Ikonen
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} semilogyerr (@var{args})
-## @deftypefnx {Function File} {@var{h} =} semilogyerr (@var{args})
-## Produce two-dimensional plots using a logarithmic scale for the @var{y}
-## axis and errorbars at each data point.  Many different combinations of
-## arguments are possible.  The most common form is
-##
-## @example
-## semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
-## @end example
-##
-## @noindent
-## which produces a semi-logarithmic plot of @var{y} versus @var{x}
-## with errors in the @var{y}-scale defined by @var{ey} and the plot
-## format defined by @var{fmt}.  See @code{errorbar} for available formats and
-## additional information.
-## @seealso{errorbar, loglogerr, semilogxerr}
-## @end deftypefn
-
-## Created: 20.2.2001
-## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
-## Keywords: errorbar, plotting
-
-function retval = semilogyerr (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    set (h, "yscale", "log");
-
-    tmp = __errcomm__ ("semilogyerr", h, varargin{:});
-
-    if (nargout > 0)
-      retval = tmp;
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 0.25:0.25:10;
-%! y = wblpdf (x, 4, 2);
-%! eyu = rand (size (y));
-%! eyl = 1.0 - 1./(1+eyu);
-%! semilogyerr (x, y, eyl.*y, eyu.*y, '~-d');
-%! xlim ([0 10]);
-
--- a/scripts/plot/shading.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-## Copyright (C) 2006-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} shading (@var{type})
-## @deftypefnx {Function File} {} shading (@var{ax}, @dots{})
-## Set the shading of surface or patch graphic objects.  Valid arguments
-## for @var{type} are
-##
-## @table @asis
-## @item "flat"
-## Single colored patches with invisible edges.
-##
-## @item "faceted"
-## Single colored patches with visible edges.
-##
-## @item "interp"
-## Color between patch vertices are interpolated and the patch edges are
-## invisible.
-## @end table
-##
-## If @var{ax} is given the shading is applied to axis @var{ax} instead
-## of the current axis.
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function shading (varargin)
-
-  [ax, varargin] = __plt_get_axis_arg__ ("shading", varargin{:});
-
-  if (nargin != 1 && nargin != 2)
-    print_usage ();
-  endif
-
-  mode = varargin{1};
-
-  h1 = findobj (ax, "type", "patch");
-  h2 = findobj (ax, "type", "surface");
-
-  obj = [h1(:); h2(:)];
-
-  for n = 1:numel (obj)
-    h = obj(n);
-    if (strcmpi (mode, "flat"))
-      set (h, "facecolor", "flat");
-      set (h, "edgecolor", "none");
-    elseif (strcmpi (mode, "interp"))
-      set (h, "facecolor", "interp");
-      set (h, "edgecolor", "none");
-    elseif (strcmpi (mode, "faceted"))
-      set (h, "facecolor", "flat");
-      set (h, "edgecolor", [0 0 0]);
-    else
-      error ("shading: unknown argument");
-    endif
-  endfor
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading faceted;
-%! title ('shading ''faceted''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading flat;
-%! title ('shading ''flat''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-%! shading interp;
-%! title ('shading ''interp''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading faceted;
-%! title ('shading ''faceted''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading flat;
-%! title ('shading ''flat''');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! pcolor (peaks ());
-%! shading interp;
-%! title ('shading ''interp''');
-
--- a/scripts/plot/shg.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-## Copyright (C) 1994-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Command} {} shg
-## Show the graph window.  Currently, this is the same as executing
-## @code{drawnow}.
-## @seealso{drawnow, figure}
-## @end deftypefn
-
-## Author: jwe
-
-function shg ()
-
-  if (nargin != 0)
-    warning ("shg: ignoring extra arguments");
-  endif
-
-  drawnow ();
-
-endfunction
--- a/scripts/plot/shrinkfaces.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-## Copyright (C) 2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} shrinkfaces (@var{p}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{p}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{fv}, @var{sf})
-## @deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{f}, @var{v}, @var{sf})
-## @deftypefnx {Function File} {[@var{nf}, @var{nv}] =} shrinkfaces (@dots{})
-##
-## Reduce the faces area for a given patch, structure or explicit faces
-## and points matrices by a scale factor @var{sf}.  The structure
-## @var{fv} must contain the fields 'faces' and 'vertices'.  If the
-## factor @var{sf} is omitted then a default of 0.3 is used.
-##
-## Given a patch handle as the first input argument and no output
-## parameters, perform the shrinking of the patch faces in place and
-## redraw the patch.
-##
-## If called with one output argument, return a structure with fields
-## 'faces', 'vertices', and 'facevertexcdata' containing the data after
-## shrinking which can then directly be used as an input argument for the
-## @command{patch} function.
-##
-## Performing the shrinking on faces which are not convex can lead to
-## undesired results.
-##
-## For example,
-##
-## @example
-## @group
-## [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
-## tri = delaunay (phi(:), r(:));
-## v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
-## clf ()
-## p = patch ("Faces", tri, "Vertices", v, "FaceColor", "none");
-## fv = shrinkfaces (p);
-## patch (fv)
-## axis equal
-## grid on
-## @end group
-## @end example
-##
-## @noindent
-## draws a triangulated 3/4 circle and the corresponding shrunken
-## version.
-## @seealso{patch}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function [nf, nv] = shrinkfaces (varargin)
-
-  if (nargin < 1 || nargin > 3 || nargout > 2)
-    print_usage ();
-  endif
-  
-  sf = 0.3;
-  p = varargin{1};
-  colors = [];
-
-  if (ishandle (p) && nargin < 3)
-    faces = get (p, "Faces");
-    vertices = get (p, "Vertices");
-    colors = get (p, "FaceVertexCData");
-    if (nargin == 2)
-      sf = varargin{2};
-    endif
-  elseif (isstruct (p) && nargin < 3)
-    faces = p.faces;
-    vertices = p.vertices;
-    if (isfield (p, "facevertexcdata"))
-      colors = p.facevertexcdata;
-    endif
-    if (nargin == 2)
-      sf = varargin{2};
-    endif
-  elseif (ismatrix (p) && nargin >= 2 && ismatrix (varargin{2}))
-    faces = p;
-    vertices = varargin{2};
-    if (nargin == 3)
-      sf = varargin{3};
-    endif
-  else
-    print_usage ();
-  endif
-  
-  if (! isscalar (sf) || sf <= 0)
-    error ("shrinkfaces: scale factor must be a positive scalar");
-  endif
-
-  n = columns (vertices);
-  if (n < 2 || n > 3)
-    error ("shrinkfaces: only 2D and 3D patches are supported");
-  endif
-
-  m = columns (faces);
-  if (m < 3)
-    error ("shrinkfaces: faces must consist of at least 3 vertices");
-  endif
-
-  v = vertices(faces'(:), :);
-  if (isempty (colors) || rows (colors) == rows (faces))
-    c = colors;
-  elseif (rows (colors) == rows (vertices))
-    c = colors(faces'(:), :);
-  else
-    ## Discard inconsistent color data.
-    c = [];
-  endif
-  sv = rows (v);
-  ## we have to deal with a probably very large number of vertices, so
-  ## use sparse we use as midpoint (1/m, ..., 1/m) in generalized
-  ## barycentric coordinates.
-  midpoints = full (kron ( speye (sv / m), ones (m, m) / m) * sparse (v));
-  v = sqrt (sf) * (v - midpoints) + midpoints;
-  f = reshape (1:sv, m, sv / m)';
-  
-  switch (nargout)
-    case 0
-      if (ishandle (p))
-        ## avoid exceptions
-        set (p, "FaceVertexCData", [], "CData", []);
-        set (p, "Vertices", v, "Faces", f, "FaceVertexCData", c);
-      else
-        nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
-      endif
-    case 1
-      nf = struct ("faces", f, "vertices", v, "facevertexcdata", c);
-    case 2
-      nf = f;
-      nv = v;
-  endswitch
-
-endfunction
-
-
-%!demo
-%! clf;
-%! faces = [1 2 3; 1 3 4];
-%! vertices = [0 0; 1 0; 1 1; 0 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-
-%!demo
-%! clf;
-%! faces = [1 2 3 4; 5 6 7 8];
-%! vertices = [0 0; 1 0; 2 1; 1 1; 2 0; 3 0; 4 1; 3.5 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-
-%!demo
-%! clf;
-%! faces = [1 2 3 4];
-%! vertices = [-1 2; 0 0; 1 2; 0 1];
-%! patch ('Faces', faces, 'Vertices', vertices, 'FaceColor', 'none');
-%! fv = shrinkfaces (faces, vertices, 0.25);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-%! title 'faces which are not convex are clearly not allowed'
-
-%!demo
-%! clf;
-%! [phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
-%! tri = delaunay (phi(:), r(:));
-%! v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
-%! p = patch ('Faces', tri, 'Vertices', v, 'FaceColor', 'none');
-%! fv = shrinkfaces (p);
-%! patch (fv);
-%! axis equal;
-%! grid on;
-
-%!demo
-%! clf;
-%! N = 10;  % N intervals per axis
-%! [x, y, z] = meshgrid (linspace (-4,4,N+1));
-%! val = x.^3 + y.^3 + z.^3;
-%! fv = isosurface (x, y, z, val, 3, z);
-%!
-%! p = patch ('Faces', fv.faces, 'Vertices', fv.vertices, 'FaceVertexCData', ...
-%!            fv.facevertexcdata, 'FaceColor', 'interp', 'EdgeColor', 'black');
-%! axis equal;
-%! view (115, 30);
-%! drawnow;
-%! shrinkfaces (p, 0.6);
-
-%!shared faces, vertices, nfv, nfv2
-%! faces = [1 2 3];
-%! vertices = [0 0 0; 1 0 0; 1 1 0];
-%! nfv = shrinkfaces (faces, vertices, 0.7);
-%! nfv2 = shrinkfaces (nfv, 1/0.7);
-%!assert (isfield (nfv, "faces"))
-%!assert (isfield (nfv, "vertices"))
-%!assert (size (nfv.faces), [1 3])
-%!assert (size (nfv.vertices), [3 3])
-%!assert (norm (nfv2.vertices - vertices), 0, 2*eps)
-
--- a/scripts/plot/slice.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel, David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
-## @deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
-## @deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
-## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
-## @deftypefnx {Function File} {@var{h} =} slice (@dots{})
-## @deftypefnx {Function File} {@var{h} =} slice (@dots{}, @var{method})
-## Plot slices of 3-D data/scalar fields.  Each element of the 3-dimensional
-## array @var{v} represents a scalar value at a location given by the
-## parameters @var{x}, @var{y}, and @var{z}.  The parameters @var{x},
-## @var{x}, and @var{z} are either 3-dimensional arrays of the same size
-## as the array @var{v} in the "meshgrid" format or vectors.  The
-## parameters @var{xi}, etc. respect a similar format to @var{x}, etc.,
-## and they represent the points at which the array @var{vi} is
-## interpolated using interp3.  The vectors @var{sx}, @var{sy}, and
-## @var{sz} contain points of orthogonal slices of the respective axes.
-##
-## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
-## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
-## @code{z = 1:size (@var{v}, 3)}.
-##
-## @var{Method} is one of:
-##
-## @table @asis
-## @item "nearest"
-## Return the nearest neighbor.
-##
-## @item "linear"
-## Linear interpolation from nearest neighbors.
-##
-## @item "cubic"
-## Cubic interpolation from four nearest neighbors (not implemented yet).
-##
-## @item "spline"
-## Cubic spline interpolation---smooth first and second derivatives
-## throughout the curve.
-## @end table
-##
-## The default method is @code{"linear"}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-##
-## Examples:
-##
-## @example
-## @group
-## [x, y, z] = meshgrid (linspace (-8, 8, 32));
-## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-## slice (x, y, z, v, [], 0, []);
-## [xi, yi] = meshgrid (linspace (-7, 7));
-## zi = xi + yi;
-## slice (x, y, z, v, xi, yi, zi);
-## @end group
-## @end example
-## @seealso{interp3, surface, pcolor}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function h = slice (varargin)
-
-  method = "linear";
-  nargs = nargin;
-
-  if (ischar (varargin{end}))
-    method = varargin{end};
-    nargs -= 1;
-  endif
-
-  if (nargs == 4)
-    v = varargin{1};
-    if (ndims (v) != 3)
-      error ("slice: expect 3-dimensional array of values");
-    endif
-    [nx, ny, nz] = size (v);
-    [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz);
-    sx = varargin{2};
-    sy = varargin{3};
-    sz = varargin{4};
-  elseif (nargs == 7)
-    v = varargin{4};
-    if (ndims (v) != 3)
-      error ("slice: expect 3-dimensional array of values");
-    endif
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    if (isvector (x) && isvector (y) && isvector (z))
-      [x, y, z] = meshgrid (x, y, z);
-    elseif (ndims (x) == 3 && size_equal (x, y, z))
-      ## Do nothing.
-    else
-      error ("slice: X, Y, Z size mismatch");
-    endif
-    sx = varargin{5};
-    sy = varargin{6};
-    sz = varargin{7};
-  else
-    print_usage ();
-  endif
-
-  if (any ([isvector(sx), isvector(sy), isvector(sz)]))
-    have_sval = true;
-  elseif (ndims (sx) == 2 && size_equal (sx, sy, sz))
-    have_sval = false;
-  else
-    error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
-  endif
-
-  newplot ();
-  ax = gca ();
-  sidx = 1;
-  maxv = max (v(:));
-  minv = min (v(:));
-  set (ax, "clim", [minv, maxv]);
-
-  if (have_sval)
-    ns = length (sx) + length (sy) + length (sz);
-    hs = zeros (ns,1);
-    [ny, nx, nz] = size (v);
-    if (length (sz) > 0)
-      for i = 1:length (sz)
-        [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
-                                 squeeze (y(:,1,1)), sz(i));
-        vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-        tmp(sidx++) = surface (xi, yi, sz(i) * ones (size (yi)), vz);
-      endfor
-    endif
-
-    if (length (sy) > 0)
-      for i = length (sy):-1:1
-        [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:)));
-        vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-        tmp(sidx++) = surface (squeeze (xi),
-                               squeeze (sy(i) * ones (size (zi))),
-                               squeeze (zi), vy);
-      endfor
-    endif
-
-    if (length (sx) > 0)
-      for i = length (sx):-1:1
-        [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:)));
-        vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
-        tmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))),
-                               squeeze (yi), squeeze(zi), vx);
-      endfor
-    endif
-  else
-    vi = interp3 (x, y, z, v, sx, sy, sz);
-    tmp = surface (sx, sy, sz, vi);
-  endif
-
-  if (! ishold ())
-    set (ax, "view", [-37.5, 30.0], "box", "off", "xgrid", "on",
-         "ygrid", "on", "zgrid", "on");
-  endif
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
-%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-%! slice (x, y, z, v, [], 0, []);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = meshgrid (linspace (-8, 8, 32));
-%! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
-%! [xi, yi] = meshgrid (linspace (-7, 7));
-%! zi = xi + yi;
-%! slice (x, y, z, v, xi, yi, zi);
-
--- a/scripts/plot/sombrero.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} sombrero ()
-## @deftypefnx {Function File} {} sombrero (@var{n})
-## Produce the familiar three-dimensional sombrero plot using @var{n}
-## grid lines.  If @var{n} is omitted, a value of 41 is assumed.
-##
-## The function plotted is
-##
-## @example
-## z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
-## @end example
-## @seealso{surf, meshgrid, mesh}
-## @end deftypefn
-
-## Author: jwe
-
-function [x, y, z] = sombrero (n = 41)
-
-  if (nargin > 2)
-    print_usage ();
-  elseif (n <= 1)
-    error ("sombrero: number of grid lines N must be greater than 1");
-  endif
-
-  tx = linspace (-8, 8, n)';
-  ty = tx;
-  [xx, yy] = meshgrid (tx, ty);
-  r = sqrt (xx .^ 2 + yy .^ 2) + eps;
-  tz = sin (r) ./ r;
-  if (nargout == 0)
-    surf (tx, ty, tz);
-    box ("off");
-  else
-    x = tx;
-    y = ty;
-    z = tz;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! sombrero ();
-
-## Test input validation
-%!error sombrero (1,2,3)
-%!error <N must be greater than 1> sombrero (1)
-
--- a/scripts/plot/specular.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv})
-## @deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se})
-## Calculate specular reflection strength of a surface defined by the normal
-## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation.
-## The light and view vectors can be specified using parameter @var{lv} and
-## @var{vv} respectively.
-## Both can be given as 2-element vectors [azimuth, elevation] in degrees or as
-## 3-element
-## vector [x, y, z].  An optional 6th argument describes the specular exponent
-## (spread) @var{se}.
-## @seealso{surfl, diffuse}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = specular (sx, sy, sz, lv, vv, se)
-
-  if (nargin < 5 || nargin > 6)
-    print_usage ();
-  endif
-
-  ## Checks for specular exponent (se).
-  if (nargin < 6)
-    se = 10;
-  else
-    if (!isnumeric (se) || numel (se) != 1 || se <= 0)
-      error ("specular: exponent must be positive scalar");
-    endif
-  endif
-
-  ## Checks for normal vector.
-  if (!size_equal (sx, sy, sz))
-    error ("specular: SX, SY, and SZ must have same size");
-  endif
-
-  ## Check for light vector (lv) argument.
-  if (length (lv) < 2 || length (lv) > 3)
-    error ("specular: light vector LV must be a 2- or 3-element vector");
-  elseif (length (lv) == 2)
-    [lv(1), lv(2), lv(3)] = sph2cart (lv(1) * pi/180, lv(2) * pi/180, 1.0);
-  endif
-
-  ## Check for view vector (vv) argument.
-  if (length (vv) < 2 || length (lv) > 3)
-    error ("specular: view vector VV must be a 2- or 3-element vector");
-  elseif (length (vv) == 2)
-    [vv(1), vv(2), vv(3)] = sph2cart (vv(1) * pi / 180, vv(2) * pi / 180, 1.0);
-  endif
-
-  ## Normalize view and light vector.
-  if (sum (abs (lv)) > 0)
-    lv  /= norm (lv);
-  endif
-  if (sum (abs (vv)) > 0)
-    vv  /= norm (vv);
-  endif
-
-  ## Calculate normal vector lengths and dot-products.
-  ns = sqrt (sx.^2 + sy.^2 + sz.^2);
-  l_dot_n = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns;
-  v_dot_n = (sx * vv(1) + sy * vv(2) + sz * vv(3)) ./ ns;
-
-  ## Calculate specular reflection using Phong's approximation.
-  retval = 2 * l_dot_n .* v_dot_n - dot (lv, vv);
-
-  ## Set zero if light is on the other side.
-  retval(l_dot_n < 0) = 0;
-
-  ## Allow postive values only.
-  retval(retval < 0) = 0;
-  retval = retval .^ se;
-
-endfunction
--- a/scripts/plot/sphere.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 2007-2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@var{n})
-## @deftypefnx {Function File} {} sphere (@var{h}, @dots{})
-## Generate three matrices in @code{meshgrid} format, such that
-## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit sphere.
-## The matrices of @code{@var{n}+1}-by-@code{@var{n}+1}.  If @var{n} is
-## omitted then a default value of 20 is assumed.
-##
-## Called with no return arguments, @code{sphere} call directly
-## @code{surf (@var{x}, @var{y}, @var{z})}.  If an axes handle is passed
-## as the first argument, the surface is plotted to this set of axes.
-## @seealso{peaks}
-## @end deftypefn
-
-function [xx, yy, zz] = sphere (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "sphere",
-                                                varargin{:});
-  if (nargin > 1)
-    print_usage ();
-  elseif (nargin == 1)
-    n = varargin{1};
-  else
-    n = 20;
-  endif
-
-  theta = linspace (0, 2*pi, n+1);
-  phi = linspace (-pi/2, pi/2, n+1);
-  [theta,phi] = meshgrid (theta, phi);
-
-  x = cos (phi) .* cos (theta);
-  y = cos (phi) .* sin (theta);
-  z = sin (phi);
-
-  if (nargout > 0)
-    xx = x;
-    yy = y;
-    zz = z;
-  else
-    surf (h, x, y, z);
-  endif
-
-endfunction
--- a/scripts/plot/stairs.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,284 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stairs (@var{y})
-## @deftypefnx {Function File} {} stairs (@var{x}, @var{y})
-## @deftypefnx {Function File} {} stairs (@dots{}, @var{style})
-## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} stairs (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} stairs (@dots{})
-## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
-## Produce a stairstep plot.  The arguments may be vectors or matrices.
-##
-## If only one argument is given, it is taken as a vector of y-values
-## and the x coordinates are taken to be the indices of the elements.
-##
-## If one output argument is requested, return a graphics handle to the
-## created plot.  If two output arguments are specified, the data are generated
-## but not plotted.  For example,
-##
-## @example
-## stairs (x, y);
-## @end example
-##
-## @noindent
-## and
-##
-## @example
-## @group
-## [xs, ys] = stairs (x, y);
-## plot (xs, ys);
-## @end group
-## @end example
-##
-## @noindent
-## are equivalent.
-## @seealso{plot}
-## @end deftypefn
-
-## Author: jwe
-
-function [xs, ys] = stairs (varargin)
-
-  [ax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:});
-
-  if (nargin < 1)
-    print_usage ();
-  else
-    if (nargout > 1)
-      [h, xs, ys] = __stairs__ (false, varargin{:});
-    else
-      oldax = gca ();
-      unwind_protect
-        axes (ax);
-        newplot ();
-        [h, xxs, yys] = __stairs__ (true, varargin{:});
-      unwind_protect_cleanup
-        axes (oldax);
-      end_unwind_protect
-    endif
-    if (nargout == 1)
-      xs = h;
-    endif
-  endif
-endfunction
-
-function [h, xs, ys] = __stairs__ (doplot, varargin)
-
-  if (nargin == 2 || ischar (varargin{2}))
-    y = varargin {1};
-    varargin(1) = [];
-    if (ismatrix (y))
-      if (isvector (y))
-        y = y(:);
-      endif
-      x = 1:rows (y);
-    endif
-  else
-    x = varargin{1};
-    y = varargin{2};
-    varargin(1:2) = [];
-  endif
-
-  if (ndims (x) > 2 || ndims (y) > 2)
-    error ("stairs: expecting 2-d arguments");
-  endif
-
-  vec_x = isvector (x);
-
-  if (vec_x)
-    x = x(:);
-  endif
-
-  if (isvector (y))
-    y = y(:);
-  endif
-
-  if (ismatrix (y))
-    [nr, nc] = size (y);
-    if (vec_x)
-      x = repmat (x, [1, nc]);
-    else
-      [x_nr, x_nc] = size (x);
-      if (x_nr != nr || x_nc != nc)
-        error ("stairs: argument size mismatch");
-      endif
-    endif
-  endif
-
-  len = 2*nr - 1;
-
-  xs = ys = zeros (len, nc);
-
-  xs(1,:) = x(1,:);
-  ys(1,:) = y(1,:);
-
-  xtmp = x(2:nr,:);
-  ridx = 2:2:len-1;
-  xs(ridx,:) = xtmp;
-  ys(ridx,:) = y(1:nr-1,:);
-
-  ridx = 3:2:len;
-  xs(ridx,:) = xtmp;
-  ys(ridx,:) = y(2:nr,:);
-
-  have_line_spec = false;
-  for i = 1 : length (varargin)
-    arg = varargin {i};
-    if ((ischar (arg) || iscell (arg)) && ! have_line_spec)
-      [linespec, valid] = __pltopt__ ("stairs", arg, false);
-      if (valid)
-        have_line_spec = true;
-        varargin(i) = [];
-        break;
-      endif
-    endif
-  endfor
-
-  if (doplot)
-    h = [];
-    unwind_protect
-      hold_state = get (gca (), "nextplot");
-      for i = 1 : columns (y)
-        hg = hggroup ();
-        h = [h; hg];
-        args = __add_datasource__ ("stairs", hg, {"x", "y"}, varargin{:});
-
-        addproperty ("xdata", hg, "data", x(:,i).');
-        addproperty ("ydata", hg, "data", y(:,i).');
-
-        addlistener (hg, "xdata", @update_data);
-        addlistener (hg, "ydata", @update_data);
-
-        if (have_line_spec)
-          tmp = line (xs(:,i).', ys(:,i).', "color", linespec.color,
-                      "parent", hg);
-        else
-          tmp = line (xs(:,i).', ys(:,i).', "color", __next_line_color__ (),
-                      "parent", hg);
-        endif
-
-        addproperty ("color", hg, "linecolor", get (tmp, "color"));
-        addproperty ("linewidth", hg, "linelinewidth", get (tmp, "linewidth"));
-        addproperty ("linestyle", hg, "linelinestyle", get (tmp, "linestyle"));
-
-        addproperty ("marker", hg, "linemarker", get (tmp, "marker"));
-        addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
-                     get (tmp, "markerfacecolor"));
-        addproperty ("markeredgecolor", hg, "linemarkeredgecolor",
-                     get (tmp, "markeredgecolor"));
-        addproperty ("markersize", hg, "linemarkersize",
-                     get (tmp, "markersize"));
-
-        addlistener (hg, "color", @update_props);
-        addlistener (hg, "linewidth", @update_props);
-        addlistener (hg, "linestyle", @update_props);
-        addlistener (hg, "marker", @update_props);
-        addlistener (hg, "markerfacecolor", @update_props);
-        addlistener (hg, "markeredgecolor", @update_props);
-        addlistener (hg, "markersize", @update_props);
-
-        if (! isempty (args))
-          set (hg, args{:});
-        endif
-      endfor
-    unwind_protect_cleanup
-      set (gca (), "nextplot", hold_state);
-    end_unwind_protect
-  else
-    h = 0;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! rand_1x10_data1 = [0.073, 0.455, 0.837, 0.124, 0.426, 0.781, 0.004, 0.024, 0.519, 0.698];
-%! y = rand_1x10_data1;
-%! stairs (x, y);
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! rand_1x10_data2 = [0.014, 0.460, 0.622, 0.394, 0.531, 0.378, 0.466, 0.788, 0.342, 0.893];
-%! y = rand_1x10_data2;
-%! [xs, ys] = stairs (x, y);
-%! plot (xs, ys);
-
-%!demo
-%! clf;
-%! stairs (1:9);
-
-%!demo
-%! clf;
-%! [xs, ys] = stairs (9:-1:1);
-%! plot (xs, ys);
-
-%!demo
-%! clf;
-%! N = 11;
-%! x = 0:(N-1);
-%! y = rand (1, N);
-%! hs = stairs (x(1), y(1));
-%! set (gca (), 'xlim', [1, N-1], 'ylim', [0, 1]);
-%! for k=2:N
-%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k));
-%!   drawnow ();
-%!   pause (0.2);
-%! end
-
-
-function update_props (h, d)
-  set (get (h, "children"), "color", get (h, "color"),
-       "linewidth", get (h, "linewidth"),
-       "linestyle", get (h, "linestyle"),
-       "marker", get (h, "marker"),
-       "markerfacecolor", get (h, "markerfacecolor"),
-       "markeredgecolor", get (h, "markeredgecolor"),
-       "markersize", get (h, "markersize"));
-endfunction
-
-function update_data (h, d)
-  x = get (h, "xdata");
-  y = get (h, "ydata");
-
-  sz = min ([size(x); size(y)]);
-  x = x(1:sz(1), 1:sz(2));
-  y = y(1:sz(1), 1:sz(2));
-
-  nr = length (x);
-  len = 2 * nr - 1;
-  xs = ys = zeros (1, len);
-
-  xs(1) = x(1);
-  ys(1) = y(1);
-
-  xtmp = x(2:nr);
-  ridx = 2:2:len-1;
-  xs(ridx) = xtmp;
-  ys(ridx) = y(1:nr-1);
-
-  ridx = 3:2:len;
-  xs(ridx) = xtmp;
-  ys(ridx) = y(2:nr);
-
-  set (get (h, "children"), "xdata", xs, "ydata", ys);
-endfunction
--- a/scripts/plot/stem.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-## Copyright (C) 2006-2012 Michel D. Schmid
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stem (@var{y})
-## @deftypefnx {Function File} {} stem (@var{x}, @var{y})
-## @deftypefnx {Function File} {} stem (@var{x}, @var{y}, @var{linespec})
-## @deftypefnx {Function File} {} stem (@dots{}, "filled")
-## @deftypefnx {Function File} {@var{h} =} stem (@dots{})
-## Plot a stem graph from two vectors of x-y data.  If only one argument
-## is given, it is taken as the y-values and the x coordinates are taken
-## from the indices of the elements.
-##
-## If @var{y} is a matrix, then each column of the matrix is plotted as
-## a separate stem graph.  In this case @var{x} can either be a vector,
-## the same length as the number of rows in @var{y}, or it can be a
-## matrix of the same size as @var{y}.
-##
-## The default color is @code{"b"} (blue).  The default line style is
-## @code{"-"} and the default marker is @code{"o"}.  The line style can
-## be altered by the @code{linespec} argument in the same manner as the
-## @code{plot} command.  For example,
-##
-## @example
-## @group
-## x = 1:10;
-## y = 2*x;
-## stem (x, y, "r");
-## @end group
-## @end example
-##
-## @noindent
-## plots 10 stems with heights from 2 to 20 in red;
-##
-## The optional return value @var{h} is a vector of "stem series" graphics
-## handles with one handle per column of the variable @var{y}.  The
-## handle regroups the elements of the stem graph together as the
-## children of the "stem series" handle, allowing them to be altered
-## together.  For example,
-##
-## @example
-## @group
-## x = [0:10]';
-## y = [sin(x), cos(x)]
-## h = stem (x, y);
-## set (h(2), "color", "g");
-## set (h(1), "basevalue", -1)
-## @end group
-## @end example
-##
-## @noindent
-## changes the color of the second "stem series" and moves the base line
-## of the first.
-## @seealso{bar, barh, plot}
-## @end deftypefn
-
-## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
-## Adapted-by: jwe
-
-function h = stem (varargin)
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  tmp = __stem__ (false, varargin{:});
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! stem (x);
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! stem (x, y);
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, 'r');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, '-.k');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, '-.k.');
-
-%!demo
-%! clf;
-%! x = 1:10;
-%! y = 2*x;
-%! h = stem (x, y, 'filled');
-
-%!demo
-%! clf;
-%! x = (0 : 10)';
-%! y = [sin(x), cos(x)];
-%! h = stem (x, y);
-%! set (h(2), 'color', 'g');
-%! set (h(1), 'basevalue', -1);
-
-%!demo
-%! clf;
-%! N = 11;
-%! x = 0:(N-1);
-%! y = rand (1, N);
-%! hs = stem (x(1), y(1));
-%! set (gca (), 'xlim', [1, N-1], 'ylim', [0, 1]);
-%! for k=2:N
-%!   set (hs, 'xdata', x(1:k), 'ydata', y(1:k))
-%!   drawnow ();
-%!   pause (0.2);
-%! end
-
--- a/scripts/plot/stem3.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stem3 (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} stem3 (@var{x}, @var{y}, @var{z}, @var{linespec})
-## @deftypefnx {Function File} {@var{h} =} stem3 (@dots{})
-## Plot a three-dimensional stem graph and return the handles of the line
-## and marker objects used to draw the stems as "stem series" object.
-## The default color is @code{"r"} (red).  The default line style is
-## @code{"-"} and the default marker is @code{"o"}.
-##
-## For example,
-##
-## @example
-## @group
-## theta = 0:0.2:6;
-## stem3 (cos (theta), sin (theta), theta)
-## @end group
-## @end example
-##
-## @noindent
-## plots 31 stems with heights from 0 to 6 lying on a circle.  Color
-## definitions with RGB-triples are not valid!
-## @seealso{stem, bar, barh, plot}
-## @end deftypefn
-
-function h = stem3 (varargin)
-
-  if (nargin < 1 || nargin > 4)
-    print_usage ();
-  endif
-
-  tmp = __stem__ (true, varargin{:});
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! theta = 0:0.2:6;
-%! stem3 (cos (theta), sin (theta), theta);
-
--- a/scripts/plot/stemleaf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-## Copyright (C) 2013 Michael D. Godfrey
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public
-## License as published by the Free Software Foundation;
-## either version 3 of the License, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied
-## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-## PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public
-## License along with Octave; see the file COPYING. If not,
-## see <http://www.gnu.org/licenses/>.
-
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} stemleaf (@var{x}, @var{caption})
-## @deftypefnx {Function File} {} stemleaf (@var{x}, @var{caption}, @var{stem_sz})
-## @deftypefnx {Function File} {@var{plotstr} =} stemleaf (@dots{})
-## Compute and display a stem and leaf plot of the vector @var{x}.
-##
-## The input @var{x} should be a vector of integers.  Any non-integer values
-## will be converted to integer by @code{@var{x} = fix (@var{x})}.  By default
-## each element of @var{x} will be plotted with the last digit of the element
-## as a leaf value and the remaining digits as the stem.  For example, 123
-## will be plotted with the stem @samp{12} and the leaf @samp{3}.  The second
-## argument, @var{caption}, should be a character array which provides a
-## description of the data.  It is included as a heading for the output.
-##
-## The optional input @var{stem_sz} sets the width of each stem.
-## The stem width is determined by @code{10^(@var{stem_sz} + 1)}.
-## The default stem width is 10.
-##
-## The output of @code{stemleaf} is composed of two parts: a
-## "Fenced Letter Display," followed by the stem-and-leaf plot itself.
-## The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
-## Briefly, the entries are as shown:
-##
-## @example
-## @group
-##
-##         Fenced Letter Display
-## #% nx|___________________     nx = numel (x)
-## M% mi|       md         |     mi median index, md median
-## H% hi|hl              hu| hs  hi lower hinge index, hl,hu hinges,
-## 1    |x(1)         x(nx)|     hs h_spreadx(1), x(nx) first 
-##            _______            and last data value.
-##      ______|step |_______     step 1.5*h_spread
-##     f|ifl            ifh|     inner fence, lower and higher
-##      |nfl            nfh|     no.\ of data points within fences
-##     F|ofl            ofh|     outer fence, lower and higher
-##      |nFl            nFh|     no.\ of data points outside outer
-##                               fences
-## @end group
-## @end example
-##
-## The stem-and-leaf plot shows on each line the stem value followed by the
-## string made up of the leaf digits.  If the @var{stem_sz} is not 1 the
-## successive leaf values are separated by ",".
-##
-## With no return argument, the plot is immediately displayed.  If an output
-## argument is provided, the plot is returned as an array of strings. 
-##
-## The leaf digits are not sorted.  If sorted leaf values are desired, use
-## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}.
-##
-## The stem and leaf plot and associated displays are described in: 
-## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977.
-## @seealso{hist, printd}
-## @end deftypefn
-
-## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
-## Description: Compute stem and leaf plot
-
-function plotstr = stemleaf (x, caption, stem_sz)
-  ## Compute and display a stem and leaf plot of the vector x.  The x
-  ## vector is converted to integer by x = fix(x).  If an output argument
-  ## is provided, the plot is returned as an array of strings.  The
-  ## first element is the heading followed by an element for each stem.
-  ##
-  ## The default stem step is 10.  If stem_sz is provided the stem
-  ## step is set to: 10^(stem_sz+1).  The x vector should be integers.
-  ## It will be treated so that the last digit is the leaf value and the
-  ## other digits are the stems.
-  ##
-  ## When we first implemented stem and leaf plots in the early 1960's
-  ## there was some discussion about sorting vs. leaving the leaf
-  ## entries in the original order in the data.  We decided in favor of
-  ## sorting the leaves for most purposes.  This is the choice
-  ## implemented in the SNAP/IEDA system that was written at that time.
-  ##
-  ## SNAP/IEDA, and particularly its stem and leaf plotting, were further
-  ## developed by Hale Trotter, David Hoagland (at Princeton and MIT),
-  ## and others.
-  ##
-  ## Tukey, in EDA, generally uses unsorted leaves.  In addition, he
-  ## described a wide range of additional display formats.  This
-  ## implementation does not sort the leaves, but if the x vector is
-  ## sorted then the leaves come out sorted.  A simple display format is
-  ## used.
-  ##
-  ## I doubt if providing other options is worthwhile.  The code can
-  ## quite easily be modified to provide specific display results.  Or,
-  ## the returned output string can be edited.  The returned output is an
-  ## array of strings with each row containing a line of the plot
-  ## preceded by the lines of header text as the first row.  This
-  ## facilitates annotation.
-  ##
-  ## Note that the code has some added complexity due to the need to
-  ## distinguish both + and - 0 stems.  The +- stem values are essential
-  ## for all plots which span 0. After dealing with +-0 stems, the added
-  ## complexity of putting +- data values in the correct stem is minor,
-  ## but the sign of 0 leaves must be checked.  And, the cases where the
-  ## stems start or end at +- 0 must also be considered.
-  ##
-  ## The fact that IEEE floating point defines +- 0 helps make this
-  ## easier.
-  ##
-  ## Michael D. Godfrey   January 2013
-
-  ## More could be implemented for better data scaling.  And, of course,
-  ## other options for the kinds of plots described by Tukey could be
-  ## provided.  This may best be left to users.
-
-  if (nargin < 2 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (! isvector (x))
-    error ("stemleaf: X must be a vector");
-  endif
-
-  if (isinteger (x))
-    ## Avoid use of integers because rounding rules do not use fix():
-    ## Example: floor (int32 (-44)/10) == -4, floor (int32 (-46)/10) = -5 !!!
-    x = single (x);
-  elseif (isfloat (x))
-    xint = fix (x);
-    if (any (x != xint))
-      warning ("stemleaf: X truncated to integer values");
-      x = xint;
-    endif
-  else
-    error ("stemleaf: X must be a numeric vector");
-  endif
-
-  if (! ischar (caption))
-    error ("stemleaf: CAPTION must be a character array");
-  endif
-
-  if (nargin == 2)
-    stem_step = 10;
-  else
-    if (isscalar (stem_sz) && stem_sz >= 0 && isreal (stem_sz))
-      stem_sz = fix (stem_sz);
-      stem_step = 10^(stem_sz+1);
-    else
-      error ("stemleaf: STEM_SZ must be a real integer >= 0");
-    endif
-  endif
-
-  ## Note that IEEE 754 states that -+ 0 should compare equal. This has
-  ## led to C sort (and therefore Octave) treating them as equal.  Thus,
-  ## sort([-1 0 -0 1]) yields [-1 0 -0 1], and sort([-1 -0 0 1])
-  ## yields: [-1 -0 0 1].  This means that stem-and-leaf plotting cannot
-  ## rely on sort to order the data as needed for display.
-  ## This also applies to min()/max() so these routines can't be relied
-  ## upon if the max or min is -+ 0.
-
-  ## Compute hinges and fences based on ref: EDA pgs. 33 and 44.
-  ## Note that these outlier estimates are meant to be "distribution free".
-
-  nx = numel (x);
-  xs = sort (x);                # Note that sort preserves -0
-  mdidx = fix ((nx + 1)/2);     # median index
-  hlidx = fix ((mdidx + 1)/2);  # lower hinge index
-  huidx = fix (nx + 1 - hlidx); # upper hinge index
-  md = xs(mdidx);               # median
-  hl = xs(hlidx);               # lower hinge
-  hu = xs(huidx);               # upper hinge
-  h_spread = hu - hl;           # h_spread: difference between hinges
-  step = 1.5*h_spread;          # step: 1.5 * h_spread
-  i_fence_l = hl - step;        # inner fences: outside hinges + step
-  o_fence_l = hl - 2*step;      # outer fences: outside hinges + 2*step
-  i_fence_h = hu + step;
-  o_fence_h = hu + 2*step;
-  n_out_l   = sum (x<i_fence_l) - sum (x<o_fence_l);
-  n_out_h   = sum (x>i_fence_h) - sum (x>o_fence_h);
-  n_far_l   = sum (x<o_fence_l);
-  n_far_h   = sum (x>o_fence_h);
-
-  # display table similar to that on pg. 33
-  plot_out = sprintf ("       Data: %s", caption);
-  plot_out = [plot_out; sprintf(" ")];
-  plot_out = [plot_out; sprintf("         Fenced Letter Display")];
-  plot_out = [plot_out; sprintf(" ")];
-  plot_out = [plot_out; sprintf("     #%3d|___________________", nx)];
-  plot_out = [plot_out; sprintf("     M%3d|       %5d      |", mdidx, md)];
-  plot_out = [plot_out; sprintf("     H%3d|%5d        %5d|   %d", hlidx, hl, hu, h_spread)];
-  plot_out = [plot_out; sprintf("     1   |%5d        %5d|", xs(1), xs(nx))];
-  plot_out = [plot_out; sprintf("               _______")];   
-  plot_out = [plot_out; sprintf("         ______|%5d|_______",step)];
-  plot_out = [plot_out; sprintf("        f|%5d        %5d|", i_fence_l, i_fence_h)];
-  plot_out = [plot_out; sprintf("         |%5d        %5d|  out", n_out_l, n_out_h)];
-  plot_out = [plot_out; sprintf("        F|%5d        %5g|", o_fence_l, o_fence_h)];
-  plot_out = [plot_out; sprintf("         |%5d        %5d|  far",n_far_l,n_far_h)];
-  plot_out = [plot_out; " "];
-
-  ## Determine stem values
-  min_x = min (x);
-  max_x = max (x);
-  if (min_x > 0)      # all stems > 0
-    stems = [fix(min(x)/stem_step) : (fix(max(x)/stem_step)+1)];
-  elseif (max_x < 0)  # all stems < 0
-    stems = [(fix(min_x/stem_step)-1) : fix(max_x/stem_step)];
-  elseif (min_x < 0 && max_x > 0)  # range crosses 0
-    stems = [(fix(min_x/stem_step)-1) : -0, 0 : fix(max_x/stem_step)+1 ];
-  else   # one endpoint is a zero which may be +0 or -0
-    if (min_x == 0)
-      if (any (x == 0 & signbit (x)))
-        min_x = -0;
-      else
-        min_x = +0;
-      endif
-    endif
-    if (max_x == 0)
-      if (any (x == 0 & ! signbit (x)))
-        max_x = +0;
-      else
-        max_x = -0;
-      endif
-    endif
-    stems = [];
-    if (signbit (min_x))
-      stems = [(fix(min_x/stem_step)-1) : -0];
-    endif
-    if (! signbit (max_x))
-      stems = [stems, 0 : fix(max_x/stem_step)+1 ];
-    endif
-  endif
-
-  ## Vectorized version provided by Rik Wehbring (rik@octave.org)
-  ## Determine leaves for each stem:
-  new_line  = 1;
-  for kx = 2: numel (stems)
-
-    stem_sign = signbit (stems(kx));
-    if (stems(kx) <= 0)
-      idx = ((x <= stems(kx)*stem_step) & (x > (stems(kx-1)*stem_step))
-              & (signbit (x) == stem_sign));
-      xlf = abs (x(idx) - stems(kx)*stem_step);
-    else
-      idx = ((x < stems(kx)*stem_step) & (x >= (stems(kx-1)*stem_step))
-              & (signbit (x) == stem_sign));
-      xlf = abs (x(idx) - stems(kx-1)*stem_step);
-    endif
-    ## Convert leaves to a string
-    if (stem_step == 10)
-      lf_str = sprintf ("%d", xlf);
-    else
-      lf_str = "";
-      if (! isempty (xlf))
-        lf_str = sprintf ("%d", xlf(1));
-        if (numel (xlf) > 1)
-          lf_str = [lf_str sprintf(",%d", xlf(2:end))];
-        endif
-      endif
-    endif
-
-    ## Set correct -0
-    if (stems(kx) == 0 && signbit (stems(kx)))
-      line = sprintf ("  -0 | %s",  lf_str);  # -0 stem.
-    elseif (stems(kx) < 0)
-      line = sprintf ("%4d | %s", stems(kx), lf_str);
-    elseif (stems(kx) > 0)
-      line = sprintf ("%4d | %s", stems(kx-1), lf_str);
-    else
-      line = "";
-    endif
-
-    if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0)
-      plot_out = [plot_out; line];
-      new_line = 1;
-    else
-      if (new_line == 1) 
-        plot_out = [plot_out; "     :"];  # just print one : if no leaves
-        new_line = 0;
-      endif
-    endif
-
-  endfor    # kx = 2: numel (stems)
-
-  if (nargout == 0)
-    disp (plot_out);
-  else
-    plotstr = plot_out;
-  endif
-
-endfunction
-
-
-%!demo
-%! %% Unsorted plot:
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
-%! stemleaf (x, 'Unsorted plot');
-
-%!demo
-%! %% Sorted leaves:
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44];
-%! y = sort (x);
-%! stemleaf (y, 'Sorted leaves');
-
-%!demo
-%! %% Sorted leaves (large dataset):
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48     ...
-%!      127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119   ...
-%!      58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 ...
-%!      121 58 114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7   ...
-%!      68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40    ...
-%!      119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114   ...
-%!      34 133 45 120 30 127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20  ...
-%!      0];
-%! y = sort (x);
-%! stemleaf (y, 'Sorted leaves (large dataset)');
-
-%!demo
-%! %% Gaussian leaves:
-%! x = fix (30 * randn (300,1));
-%! stemleaf (x);
-
-%!test
-%! ## test minus to plus
-%! x = [-22 12 -28 52  39 -2 12 10 11 11 42 38 44 18 44 37 113 124 37 48 127  \
-%!      36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 \
-%!      23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58  \
-%!      114 126 53 114 96 25 109 7 31 141 46 -13 71 43 117 116 27 7 68 40 31  \
-%!      115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57\
-%!      122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 \
-%!      127 31 116 146 21 23 30 10 20 21 30 0 100 110 1 20 0];
-%! x = sort (x);
-%! rexp = char (
-%! "       Data: test minus to plus"    ,
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     #138|___________________"      ,     
-%! "     M 69|          52      |"      ,     
-%! "     H 35|   30          116|   86" ,
-%! "     1   |  -28          146|"      ,
-%! "               _______"             ,
-%! "         ______|  129|_______"      ,
-%! "        f|  -99          245|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F| -228          374|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -2 | 82"                          ,
-%! "  -1 | 3"                           ,
-%! "  -0 | 2"                           ,
-%! "   0 | 00177"                       ,
-%! "   1 | 00112288"                    ,
-%! "   2 | 001133577777899"             ,
-%! "   3 | 000111123456777889"          ,
-%! "   4 | 00122233344456788"           ,
-%! "   5 | 223788"                      ,
-%! "   6 | 138"                         ,
-%! "   7 | 11"                          ,
-%! "     : "                            ,
-%! "   9 | 69"                          ,
-%! "  10 | 04555567999"                 ,
-%! "  11 | 0133344455566667777899"      ,
-%! "  12 | 0011223444555677788"         ,
-%! "  13 | 1239"                        ,
-%! "  14 | 16"                          );
-%! r = stemleaf (x, "test minus to plus", 0);
-%! assert (r, rexp);
-
-%!test
-%! ## positive values above 0
-%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
-%! rexp = char (
-%! "       Data: positive values above 0",
-%! " "                                   ,
-%! "         Fenced Letter Display"      ,
-%! " "                                   ,
-%! "     # 14|___________________"       ,     
-%! "     M  7|          22      |"       ,     
-%! "     H  4|   12           42|   30"  ,
-%! "     1   |    5           52|"       ,
-%! "               _______"              ,
-%! "         ______|   45|_______"       ,
-%! "        f|  -33           87|"       ,     
-%! "         |    0            0|  out"  ,
-%! "        F|  -78          132|"       ,
-%! "         |    0            0|  far"  ,
-%! " "                                   ,
-%! "   0 | 5"                            ,
-%! "   1 | 22118"                        ,
-%! "   2 | 28"                           ,
-%! "   3 | 98"                           ,
-%! "   4 | 244"                          ,
-%! "   5 | 2"                            );
-%! r = stemleaf (x, "positive values above 0");
-%! assert (r, rexp);
-
-%!test
-%! ## negative values below 0
-%! x = [5 22 12 28 52 39 12 11 11 42 38 44 18 44];
-%! x = -x;
-%! rexp = char (
-%! "       Data: negative values below 0",
-%! " "                                   ,
-%! "         Fenced Letter Display"      ,
-%! " "                                   ,
-%! "     # 14|___________________"       ,     
-%! "     M  7|         -28      |"       ,     
-%! "     H  4|  -42          -12|   30"  ,
-%! "     1   |  -52           -5|"       ,
-%! "               _______"              ,
-%! "         ______|   45|_______"       ,
-%! "        f|  -87           33|"       ,     
-%! "         |    0            0|  out"  ,
-%! "        F| -132           78|"       ,
-%! "         |    0            0|  far"  ,
-%! " "                                   ,
-%! "  -5 | 2"                            ,
-%! "  -4 | 244"                          ,
-%! "  -3 | 98"                           ,
-%! "  -2 | 28"                           ,
-%! "  -1 | 22118"                        ,
-%! "  -0 | 5"                            );
-%! r = stemleaf (x, "negative values below 0");
-%! assert (r, rexp);
-
-%!test
-%! ## positive values from 0
-%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
-%! rexp = char (
-%! "       Data: positive values from 0",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     # 15|___________________"      ,     
-%! "     M  8|          22      |"      ,     
-%! "     H  4|   11           42|   31" ,
-%! "     1   |    0           52|"      ,
-%! "               _______"             ,
-%! "         ______|   46|_______"      ,
-%! "        f|  -35           88|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F|  -82          135|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "   0 | 20"                          ,
-%! "   1 | 22118"                       ,
-%! "   2 | 28"                          ,
-%! "   3 | 98"                          ,
-%! "   4 | 244"                         ,
-%! "   5 | 2"                           );
-%! r = stemleaf (x, "positive values from 0");
-%! assert (r, rexp);
-
-%!test
-%! ## negative values from 0
-%! x = [22 12 28 52 39 2 12 0 11 11 42 38 44 18 44];
-%! x = -x;
-%! rexp = char (
-%! "       Data: negative values from 0",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     # 15|___________________"      ,     
-%! "     M  8|         -22      |"      ,     
-%! "     H  4|  -42          -11|   31" ,
-%! "     1   |  -52            0|"      ,
-%! "               _______"             ,
-%! "         ______|   46|_______"      ,
-%! "        f|  -88           35|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F| -135           82|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -5 | 2"                           ,
-%! "  -4 | 244"                         ,
-%! "  -3 | 98"                          ,
-%! "  -2 | 28"                          ,
-%! "  -1 | 22118"                       ,
-%! "  -0 | 20"                          );
-%! r = stemleaf (x, "negative values from 0");
-%! assert (r, rexp);
-
-%!test
-%! ## both +0 and -0 present
-%! x = [-9 -7 -0 0 -0];
-%! rexp = char (
-%! "       Data: both +0 and -0 present",
-%! " "                                  ,
-%! "         Fenced Letter Display"     ,
-%! " "                                  ,
-%! "     #  5|___________________"      ,     
-%! "     M  3|           0      |"      ,     
-%! "     H  2|   -7            0|   7"  ,
-%! "     1   |   -9            0|"      ,
-%! "               _______"             ,
-%! "         ______|   10|_______"      ,
-%! "        f|  -17           10|"      ,     
-%! "         |    0            0|  out" ,
-%! "        F|  -28           21|"      ,
-%! "         |    0            0|  far" ,
-%! " "                                  ,
-%! "  -0 | 9700"                        ,
-%! "   0 | 0"                           );
-%! r = stemleaf (x, "both +0 and -0 present");
-%! assert (r, rexp);
-
-%!test
-%! ## both <= 0 and -0 present
-%! x = [-9 -7 0 -0];
-%! rexp = char (
-%! "       Data: both <= 0 and -0 present",
-%! " "                                    ,
-%! "         Fenced Letter Display"       ,
-%! " "                                    ,
-%! "     #  4|___________________"        ,     
-%! "     M  2|          -7      |"        ,     
-%! "     H  1|   -9            0|   9"    ,
-%! "     1   |   -9            0|"        ,
-%! "               _______"               ,
-%! "         ______|   13|_______"        ,
-%! "        f|  -22           13|"        ,     
-%! "         |    0            0|  out"   ,
-%! "        F|  -36           27|"        ,
-%! "         |    0            0|  far"   ,
-%! " "                                    ,
-%! "  -0 | 970"                           ,
-%! "   0 | 0"                             );
-%! r = stemleaf (x, "both <= 0 and -0 present");
-%! assert (r, rexp);
-
-%!test
-%! ##   Example from EDA: Chevrolet Prices pg. 30
-%! x = [150 250 688 695 795 795 895 895 895 ...
-%!      1099 1166 1333 1499 1693 1699 1775 1995];
-%! rexp = char (
-%! "       Data: Chevrolet Prices EDA pg.30",
-%! " "                                      ,
-%! "         Fenced Letter Display"         ,
-%! " "                                      ,
-%! "     # 17|___________________"          ,          
-%! "     M  9|         895      |"          ,
-%! "     H  5|  795         1499|   704"    ,
-%! "     1   |  150         1995|"          ,
-%! "               _______"                 ,
-%! "         ______| 1056|_______"          ,
-%! "        f| -261         2555|"          ,
-%! "         |    0            0|  out"     ,
-%! "        F|-1317         3611|"          ,
-%! "         |    0            0|  far"     ,
-%! " "                                      ,
-%! "   1 | 50"                              ,
-%! "   2 | 50"                              ,
-%! "     :"                                 ,
-%! "   6 | 88,95"                           ,
-%! "   7 | 95,95"                           ,
-%! "   8 | 95,95,95"                        ,
-%! "     :"                                 ,
-%! "  10 | 99"                              ,
-%! "  11 | 66"                              ,
-%! "     :"                                 ,
-%! "  13 | 33"                              ,
-%! "  14 | 99"                              ,
-%! "     :"                                 ,
-%! "  16 | 93,99"                           ,
-%! "  17 | 75"                              ,
-%! "     :"                                 ,
-%! "  19 | 95"                              );
-%! r = stemleaf (x, "Chevrolet Prices EDA pg.30", 1);
-%! assert (r, rexp);
-
-## Test input validation
-%!error stemleaf ()
-%!error stemleaf (1, 2, 3, 4)
-%!error <X must be a vector> stemleaf (ones (2,2), "")
-%!warning <X truncated to integer values> tmp = stemleaf ([0 0.5 1],"");
-%!error <X must be a numeric vector> stemleaf ("Hello World", "data")
-%!error <CAPTION must be a character array> stemleaf (1, 2)
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", ones (2,2))
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", -1)
-%!error <STEM_SZ must be a real integer> stemleaf (1, "", 1+i)
-
--- a/scripts/plot/struct2hdl.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,638 +0,0 @@
-## Copyright (C) 2012 pdiribarne
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} struct2hdl (@var{s})
-## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
-## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
-## Construct a handle object @var{h} from the structure @var{s}.  The structure
-## must contain the fields "handle", "type", "children", "properties", and
-## "special".  If the handle of an existing figure or axes is specified,
-## @var{p}, the new object will be created as a child of that object.
-## If no object handle is provided then a new figure and the necessary
-## children will be constructed using the default object values from
-## the root figure.
-##
-## A third boolean argument @var{hilev} can be passed to specify whether
-## the function should try to preserve listeners/callbacks, e.g., for
-## legends or hggroups.  The default is false.
-## @seealso{hdl2struct, findobj, get, set}
-## @end deftypefn
-
-## Author: pdiribarne <pdiribarne@new-host.home>
-## Created: 2012-03-04
-
-function [h, pout] = struct2hdl (s, p=[], hilev = false)
-
-  fields = {"handle", "type", "children", "properties", "special"};
-  partypes = {"root", "figure", "axes", "hggroup"};
-  othertypes = {"line", "patch", "surface", "image", "text"};
-  alltypes = [partypes othertypes];
-
-  if (nargin > 3 || ! isstruct (s))
-    print_usage ();
-  elseif (! all (isfield (s, fields)))
-    print_usage ();
-  elseif (isscalar (p))
-    if (! ishandle (p))
-      error ("struct2hdl: P is not a handle to a graphic object");
-    endif
-    if (any (strcmp (get (p).type, partypes)))
-      paridx = find (strcmp (get (p).type, alltypes));
-      kididx = find (strcmp (s.type, alltypes));
-      if (kididx <= paridx)
-        error ("struct2hdl: incompatible input handles");
-      endif
-    else
-      error ("struct2hdl: %s object can't be parent object", get (p).type);
-    endif
-    hpar = p;
-    p = [NaN; hpar];
-    ## create appropriate parent if needed
-    if (any (strcmp (s.type, othertypes)))
-      for ii = (paridx+1) : (numel (partypes)-1)
-        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        p = [p [NaN; hpar]];
-      endfor
-    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
-      for ii = (paridx+1) : (kididx-1)
-        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        p = [p [NaN; hpar]];
-      endfor
-    else
-      par = NaN;
-    endif
-  elseif (isempty (p))
-    if (any (strcmp (s.type, othertypes)))
-      par = axes ();
-    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
-      par = figure ();
-    else
-      par = NaN;
-    endif
-    p = [NaN; par];
-  endif
-  ## read parent (last column) in p and remove it if duplicate
-  par = p(2,end);
-  tst = find (p(2,:) == par);
-  if (numel (tst) > 1)
-    p = p(1:2, 1:(tst(end)-1));
-  endif
-
-  ## Place the "*mode" properties as the end to avoid having the updaters
-  ## change the mode to "manual" when the value is "auto".
-  names = fieldnames (s.properties);
-  n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4);
-  n = (n | strcmp (names, "activepositionproperty"));
-  names = [names(!n); names(n)];
-  if (strcmp (s.type, "axes"))
-    n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition"));
-    if (strcmp (s.properties.activepositionproperty, "position"))
-      names{n_pos(1)} = "outerposition";
-      names{n_pos(2)} = "position";
-    else
-      names{n_pos(1)} = "position";
-      names{n_pos(2)} = "outerposition";
-    endif
-  endif
-  ## Reorder the properties with the mode properties coming last
-  s.properties = orderfields (s.properties, names);
-
-  ## create object
-  if (strcmp (s.type, "root"))
-    h = 0;
-    s.properties = rmfield (s.properties, ...
-                              {"callbackobject", "commandwindowsize", ...
-                               "screendepth", "screenpixelsperinch", ...
-                               "screensize"});
-  elseif (strcmp (s.type, "figure"))
-    h = figure ();
-  elseif (strcmp (s.type, "axes"))
-    ## legends and colorbars are "transformed" in normal axes
-    ## if hilev is not requested
-    if (! hilev)
-      if (strcmp (s.properties.tag, "legend"))
-        s.properties.tag = "";
-        s.properties.userdata = [];
-        par = gcf;
-      elseif (strcmp (s.properties.tag, "colorbar"))
-        s.properties.tag = "";
-        s.properties.userdata = [];
-        par = gcf;
-      endif
-    endif
-
-    [h, s] = createaxes (s, p, par);
-  elseif (strcmp (s.type, "line"))
-    h = createline (s, par);
-  elseif (strcmp (s.type, "patch"))
-    [h, s] = createpatch (s, par);
-  elseif (strcmp (s.type, "text"))
-    h = createtext (s, par);
-  elseif (strcmp (s.type, "image"))
-    h = createimage (s, par);
-  elseif (strcmp (s.type, "surface"))
-    h = createsurface (s, par);
-  elseif (strcmp (s.type, "hggroup"))
-    [h, s, p] = createhg (s, p, par, hilev);
-  else
-    error ("struct2hdl: %s objects are not implemented yet", s.type)
-  endif
-
-  ## children
-  p = [p [s.handle; h]];  # [original; new]
-  kids = s.children;
-  nkids = length (kids);
-  ii = 0;
-  while (nkids)
-    ii++;
-    if (! any (ii == s.special))
-      [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
-    endif
-    nkids--;
-  endwhile
-
-  ## paste properties
-  setprops (s, h, p, hilev);
-
-  pout = p;
-
-endfunction
-
-function [h, sout] = createaxes (s, p, par)
-  ## regular axes
-  if (strcmp (s.properties.tag, ""))
-    propval = {"position", s.properties.position};
-    hid = {"autopos_tag", "looseinset"};
-    for ii = 1:numel (hid)
-      prop = hid{ii};
-      if (isfield (s.properties, prop))
-        val = s.properties.(prop);
-        propval = [propval, prop, val];
-      endif
-    endfor
-    h = axes (propval{:}, "parent", par);
-
-    if (isfield (s.properties, "__plotyy_axes__"))
-      plty = s.properties.__plotyy_axes__;
-      addproperty ("__plotyy_axes__", h, "any");
-      tmp = [p [s.handle; h]];
-      tst = arrayfun (@(x) any (plty == x), tmp(1:2:end));
-      if (sum (tst) == numel (plty))
-        for ii = 1:numel (plty)
-          plty(ii) = tmp(find (tmp == plty(ii)) + 1);
-        endfor
-        for ii = 1:numel (plty)
-          set (plty(ii), "__plotyy_axes__", plty);
-        endfor
-      endif
-      s.properties = rmfield (s.properties, "__plotyy_axes__");
-    endif
-
-    ## delete non-default and already set properties
-    fields = fieldnames (s.properties);
-    tst = cellfun (@(x) isprop (h, x), fields);
-    s.properties = rmfield (s.properties, fields(find (tst == 0)));
-
-  elseif (strcmp (s.properties.tag, "legend"))
-    ## legends
-    oldax = s.properties.userdata.handle;
-    idx = find (p == oldax);
-    newax = p(idx+1);
-    strings = {};
-    kids = s.children;
-    kids(s.special) = [];
-    oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
-    for ii = 1:length (oldh)
-      idx = find (p(1:2:end) == oldh(ii)) * 2;
-      if (! isempty (idx))
-        newh(ii) = p(idx);
-        if (! strcmp (get (newh(ii), "type"), "hggroup"))
-          str = get (newh(ii), "displayname");
-          strings = [strings str];
-        else
-          str = get (get (newh(ii), "children")(1), "displayname");
-          strings = [strings str];
-        endif
-      else
-        error ("struct2hdl: didn't find a legend item");
-      endif
-    endfor
-    location = s.properties.location;
-    orientation = s.properties.orientation;
-    textpos = s.properties.textposition;
-    box = s.properties.box;
-
-    h = legend (newax, newh, strings, "location", location, ...
-                "orientation", orientation);
-    set (h, "textposition", textpos); # bug makes "textposition"
-                                      # redefine the legend
-    h = legend (newax, newh, strings, "location", location, ...
-                "orientation", orientation);
-    ## box
-    if (strcmp (box, "on"))
-      legend ("boxon");
-    endif
-
-    ## visibility
-    tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
-    if (! any (tst))
-      legend ("hide");
-    endif
-
-    ## remove all properties such as "textposition" that redefines
-    ## the entire legend. Also remove chidren
-    s.properties = rmfield (s.properties, ...
-                              {"userdata", "xlabel",...
-                               "ylabel", "zlabel", "location", ...
-                               "title", "string","orientation", ...
-                               "visible", "textposition"});
-
-    s.children = [];
-
-  elseif (strcmp (s.properties.tag, "colorbar"))
-    ## colorbar
-    oldax = s.properties.axes;
-    if (! isempty (idx = find (oldax == p)))
-      ax = p(idx+1);
-      location = s.properties.location;
-      h = colorbar ("peer", ax, location);
-      s.properties = rmfield (s.properties, ...
-                                {"userdata", "xlabel" ...
-                                 "ylabel", "zlabel", ...
-                                 "title", "axes"});
-      s.children= [];
-    else
-      error ("hdl2struct: didn't find an object");
-    endif
-  endif
-  sout = s;
-endfunction
-
-function h = createline (s, par)
-  h = line ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function [h, sout] = createpatch (s, par)
-  prp.faces = s.properties.faces;
-  prp.vertices = s.properties.vertices;
-  prp.facevertexcdata = s.properties.facevertexcdata;
-  h = patch (prp);
-  set (h, "parent", par);
-  s.properties = rmfield (s.properties,
-                            {"faces", "vertices", "facevertexcdata"});
-  addmissingprops (h, s.properties);
-  sout = s;
-endfunction
-
-function h = createtext (s, par)
-  h = text ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function h = createimage (s, par)
-  h = image ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function h = createsurface (s, par)
-  h = surface ("parent", par);
-  addmissingprops (h, s.properties);
-endfunction
-
-function [h, sout, pout] = createhg (s, p, par, hilev)
-  ## Here we infer from properties the type of hggroup we should build
-  ## an call corresponding high level functions
-  ## We manually set "hold on" to avoid next hggroup be deleted
-  ## the proper value of axes "nextplot" will finally be recovered
-
-  hold on;
-  if (hilev)
-    [h, s, p] = createhg_hilev (s, p, par);
-    if (numel (s.children) != numel (get (h).children))
-      warning (["struct2hdl: could not infer the hggroup type. ", ...
-                "Will build objects but listener/callback functions ", ...
-                "will be lost"]);
-      if (isfield (h, "bargroup"))
-        delete (get (h).bargroup);
-      else
-        delete (h);
-      endif
-      h = hggroup ("parent", par);
-      addmissingprops (h, s.properties);
-      s.special = [];
-    else
-      oldkids = s.children;
-      newkids = get (h).children;
-      nkids = numel (oldkids);
-      ii = 1;
-      while (nkids)
-        p = [p [oldkids(ii++).handle; newkids(nkids--)]];
-      endwhile
-    endif
-  else
-    h = hggroup ("parent", par);
-    addmissingprops (h, s.properties);
-    s.special = [];
-  endif
-  sout = s;
-  pout = p;
-endfunction
-
-function [h, sout, pout] = createhg_hilev (s, p, par)
-  fields = s.properties;
-  if (isfield (fields, "contourmatrix"))
-    ## contours
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    zdata = s.properties.zdata;
-    levellist = s.properties.levellist;
-    textlist = s.properties.textlist;
-
-    ## contour creation
-    if (isempty (s.children(1).properties.zdata))
-      if (strcmpi (s.properties.fill, "on"))
-        [cm2, h] = contourf (xdata, ydata, zdata, levellist);
-      else
-        [cm2, h] = contour (xdata, ydata, zdata, levellist);
-      endif
-
-      ## labels
-      if (strcmpi (s.properties.showtext, "on"))
-        clabel (cm2, h, textlist);
-      endif
-    else
-      [cm2, h] = contour3 (xdata, ydata, zdata, levellist);
-    endif
-
-    ## delete already set properties and children
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", "zdata", ...
-                               "contourmatrix", "levellist", ...
-                               "fill", "labelspacing", ...
-                               "levellistmode", "levelstep", ...
-                               "levelstepmode", "textlist"...
-                               "textlistmode" , "textstep", ...
-                               "textstepmode", "zlevel", ...
-                               "zlevelmode"});
-
-  elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
-    ## quiver
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-
-    udata = s.properties.udata;
-    vdata = s.properties.vdata;
-
-    h = quiver (xdata, ydata, udata, vdata);
-
-    ## delete already set properties and children
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", "zdata", ...
-                               "xdatasource", "ydatasource", "zdatasource", ...
-                               "udata", "vdata", "wdata", ...
-                               "udatasource", "vdatasource", "wdatasource"});
-
-  elseif (isfield (fields, "format"))
-    ##errorbar
-    form = s.properties.format;
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    xldata = s.properties.xldata;
-    ldata = s.properties.ldata;
-    xudata = s.properties.xudata;
-    udata = s.properties.udata;
-
-    switch form
-      case "xerr"
-        h = errorbar (xdata, ydata, xldata, xudata, ">");
-      case "yerr"
-        h = errorbar (xdata, ydata, ldata, udata, "~");
-      case "xyerr"
-        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>");
-      case "box"
-        h = errorbar (xdata, ydata, xldata, xudata, "#");
-      case "boxy"
-        h = errorbar (xdata, ydata, ldata, udata, "#~");
-      case "boxxy"
-        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
-      otherwise
-        error ("struct2hdl: couldn't guess the errorbar format");
-    endswitch
-    ## delete already set properties
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xldata", "ldata", ...
-                               "xudata", "udata", ...
-                               "xldatasource", "ldatasource", ...
-                               "xudatasource", "udatasource", ...
-                               "format"});
-
-  elseif (isfield (fields, "bargroup"))
-    ## bar plot
-    ## FIXME - here we don't have access to brothers so we first create all
-    ## the barseries of the bargroup (but the last), then retrieve information,
-    ## and rebuild the whole bargroup.
-    ## The duplicate are deleted after calling "setprops"
-
-    bargroup = s.properties.bargroup;
-    oldh = s.handle;
-
-    temp = arrayfun (@(x) any(x == bargroup), [p(1:2:end) oldh]);
-    tst = sum (temp) == length (bargroup);
-
-    if (isscalar (bargroup) || !tst)
-      xdata = s.properties.xdata;
-      ydata = s.properties.ydata;
-
-      h = bar (xdata, ydata);
-
-      ## delete already set properties,
-      s.properties = rmfield (s.properties, ...
-                                {"xdata", "ydata", ...
-                                 "xdatasource", "ydatasource", ...
-                                 "bargroup", ...
-                                 "barwidth", "baseline"});
-    else
-      xdata = [];
-      ydata = [];
-
-      ##build x/y matrix
-      nbar = length (bargroup);
-      tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
-      for ii = 1:(nbar - 1)
-        idx = find (p(1:2:end) == bargroup(ii)) * 2;
-        hdl = p (idx);
-        xdata = [xdata get(hdl).xdata];
-        ydata = [ydata get(hdl).ydata];
-        tmp.children(ii) = hdl2struct (hdl);
-      endfor
-
-      xdata = [xdata s.properties.xdata];
-      ydata = [ydata s.properties.ydata];
-      width = s.properties.barwidth;
-      h = bar (ydata, width);
-
-      ## replace previous handles in "match", copy props and delete redundant
-      for ii = 1:(nbar - 1)
-        props = tmp.children(ii).properties;
-        bl = props.baseline;
-        tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
-        setprops (tmp.children(ii), h(ii), p, 1);
-        delete (tmp.children(ii).handle);
-        delete (bl);
-        idxpar = find (p == tmp.children(ii).handle);
-        p(idxpar) = h(ii);
-        idxkid = idxpar - 2;
-        p(idxkid) = get (h(ii), "children");
-      endfor
-      p(2,((end-nbar+2):end)) = h(1:(end-1));
-      h = h(end);
-
-      ## delete already set properties ,
-      s.properties = rmfield (s.properties, ...
-                                {"xdata", "ydata", "bargroup"...
-                                 "barwidth", "baseline"});
-    endif
-  elseif (isfield (fields, "baseline"))
-    ## stem plot
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-
-    h = stem (xdata, ydata);
-
-    ## delete already set properties,
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xdatasource", "ydatasource", ...
-                               "baseline"});
-  elseif (isfield (fields, "basevalue"))
-    ## area plot
-    xdata = s.properties.xdata;
-    ydata = s.properties.ydata;
-    level = s.properties.basevalue;
-
-    h = area (xdata, ydata, level);
-
-    ## delete already set properties,
-    s.properties = rmfield (s.properties, ...
-                              {"xdata", "ydata", ...
-                               "xdatasource", "ydatasource"});
-  else
-    warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
-    h = hggroup ("parent", par);
-    addmissingprops (h, s.properties);
-    s.special = [];           # children will be treated as normal children
-  endif
-  sout = s;
-  pout = p;
-endfunction
-
-function setprops (s, h, p, hilev)
-  more off;
-  if (strcmpi (s.properties.tag, ""))
-    specs = s.children(s.special);
-    hdls = arrayfun (@(x) x.handle, specs);
-    nh = length (hdls);
-    msg = "";
-    if (! nh)
-      set (h, s.properties);
-    else
-      ## Specials are objects that where automatically constructed with
-      ## current object. Among them are "x(yz)labels", "title", high
-      ## level hggroup children
-      fields = fieldnames (s.properties);
-      vals = struct2cell (s.properties);
-      idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
-      s.properties = rmfield (s.properties, fields(idx));
-
-      ## set all properties but special handles
-      set (h, s.properties);
-
-      ## find  props with val == (one of special handles)
-      nf = length (idx);
-      fields = fields(idx);
-      vals = vals(idx);
-      while (nf)
-        field = fields{nf};
-        idx = find (hdls == vals{nf});
-        spec = specs(idx);
-        if (isprop (h, field))
-           h2 = get (h , field);
-           set (h2, spec.properties);
-        endif
-        nf--;
-      endwhile
-
-      ## If hggroup children  were created by high level functions,
-      ## copy only usefull properties.
-      if (hilev)
-        if (strcmp (s.type, "hggroup"))
-          nold = numel (s.children);
-          nnew = numel (get (h).children);
-
-          if (nold == nnew)
-            hnew = get (h).children;
-            ii = 1;
-            while (ii <= nnew)
-              try
-                set (hnew (ii), "displayname", ...
-                     s.children(ii).properties.displayname);
-              catch
-                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
-              end_try_catch
-              ii ++;
-            endwhile
-
-          else
-            error ("struct2hdl: non-conformant number of children in hgggroup");
-          endif
-        endif
-      endif
-    endif
-
-  elseif (strcmpi (s.properties.tag, "legend")
-          || strcmpi (s.properties.tag, "colorbar"))
-    set (h, s.properties);
-  endif
-
-endfunction
-
-function out = valcomp (x, hdls)
-  if (isfloat (x) && isscalar (x))
-    out = any (x == hdls);
-  else
-    out = 0;
-  endif
-endfunction
-
-function addmissingprops (h, props)
-  hid = {"autopos_tag", "looseinset"};
-  oldfields = fieldnames (props);
-  curfields = fieldnames (get (h));
-  missing = cellfun (@(x) !any (strcmp (x, curfields)), oldfields);
-  idx = find (missing);
-  for ii = 1:length (idx)
-    prop = oldfields{idx(ii)};
-    if (! any (strcmp (prop, hid)))
-      addproperty (prop, h, "any");
-    endif
-  endfor
-endfunction
-
-
-## FIXME: Need validation tests
--- a/scripts/plot/subplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-## Copyright (C) 1995-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
-## @deftypefnx {Function File} {} subplot (@var{rcn})
-## Set up a plot grid with @var{rows} by @var{cols} subwindows and plot
-## in location given by @var{index}.
-##
-## If only one argument is supplied, then it must be a three digit value
-## specifying the location in digits 1 (rows) and 2 (columns) and the plot
-## index in digit 3.
-##
-## The plot index runs row-wise.  First all the columns in a row are filled
-## and then the next row is filled.
-##
-## For example, a plot with 2 by 3 grid will have plot indices running as
-## follows:
-## @tex
-## \vskip 10pt
-## \hfil\vbox{\offinterlineskip\hrule
-## \halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
-## height13pt&1&2&3\cr height12pt&&&\cr\noalign{\hrule}
-## height13pt&4&5&6\cr height12pt&&&\cr\noalign{\hrule}}}
-## \hfil
-## \vskip 10pt
-## @end tex
-## @ifnottex
-##
-## @example
-## @group
-## +-----+-----+-----+
-## |  1  |  2  |  3  |
-## +-----+-----+-----+
-## |  4  |  5  |  6  |
-## +-----+-----+-----+
-## @end group
-## @end example
-##
-## @var{index} may be a vector.  In which case, the new axis will enclose
-## the grid locations specified.  The first demo illustrates an example:
-##
-## @example
-## demo ("subplot", 1)
-## @end example
-##
-## @end ifnottex
-## @seealso{axes, plot}
-## @end deftypefn
-
-## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
-## Adapted-By: jwe
-
-function h = subplot (varargin)
-
-  align_axes = false;
-  replace_axes = false;
-  have_position = false;
-  initial_args_decoded = false;
-
-  if (nargin > 2)
-    ## R, C, N?
-    arg1 = varargin{1};
-    arg2 = varargin{2};
-    arg3 = varargin{3};
-    if (isnumeric (arg1) && isscalar (arg1) && isnumeric (arg2)
-        && isscalar (arg2) && isnumeric (arg3))
-      rows = arg1;
-      cols = arg2;
-      index = arg3;
-      varargin(1:3)= [];
-      initial_args_decoded = true;
-    endif
-  endif
-
-  if (! initial_args_decoded && nargin > 1)
-    ## check for 'position', pos, ...
-    if (strcmpi (varargin{1}, "position"))
-      arg = varargin{2};
-      if (isnumeric (arg) && numel (arg) == 4)
-        pos = arg;
-        varargin(1:2) = [];
-        have_position = true;
-        initial_args_decoded = true;
-      else
-        error ("expecting position to be a 4-element numeric array");
-      endif
-    endif
-  endif
-    
-  if (! initial_args_decoded && nargin > 0)
-    arg = varargin{1};
-    if (nargin == 1 && ishandle (arg))
-      ## Axes handle?
-      axes (arg);
-      cf = get (0, "currentfigure");
-      set (cf, "nextplot", "add");
-      return;
-    elseif (isscalar (arg) && arg >= 0)
-      ## RCN?
-      index = rem (arg, 10);
-      arg = (arg - index) / 10;
-      cols = rem (arg, 10);
-      arg = (arg - cols) / 10;
-      rows = rem (arg, 10);
-      varargin(1) = [];
-      initial_args_decoded = true;
-    else
-      error ("subplot: expecting axes handle or RCN argument");
-    endif
-  endif
-
-  if (! initial_args_decoded)
-    print_usage ();
-  endif
-
-  if (! have_position)
-    cols = round (cols);
-    rows = round (rows);
-    index = round (index);
-
-    if (any (index < 1) || any (index > rows*cols))
-      error ("subplot: INDEX value must be greater than 1 and less than ROWS*COLS");
-    endif
-
-    if (cols < 1 || rows < 1 || index < 1)
-      error ("subplot: COLS, ROWS, and INDEX must be be positive");
-    endif
-  endif
-
-  nargs = numel (varargin);
-  while (nargs > 0)
-    arg = varargin{1};
-    if (strcmpi (arg, "align"))
-      align_axes = true;
-    elseif (strcmpi (arg, "replace"))
-      replace_axes = true;
-    else
-      break;
-    endif
-    varargin(1) = [];
-    nargs--;
-  endwhile
-
-  axesunits = get (0, "defaultaxesunits");
-  cf = gcf ();
-  figureunits = get (cf, "units");
-  unwind_protect
-    units = "normalized";
-    set (0, "defaultaxesunits", units);
-    set (cf, "units", "pixels");
-
-    ## FIXME: At the moment we force gnuplot to use the aligned mode
-    ##        which will set "activepositionproperty" to "position".
-    ##        Τhis can yield to text overlap between labels and titles
-    ##        see bug #31610
-    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
-      align_axes = true;
-    endif
-
-    if (! have_position)
-      if (align_axes)
-        pos = subplot_position (rows, cols, index, "position");
-      elseif (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
-        pos = subplot_position (rows, cols, index, "outerpositiontight");
-      else
-        pos = subplot_position (rows, cols, index, "outerposition");
-      endif
-    endif
-
-    set (cf, "nextplot", "add");
-
-    found = false;
-    kids = get (cf, "children");
-    for child = reshape (kids, 1, numel (kids))
-      ## Check whether this child is still valid; this might not be the
-      ## case anymore due to the deletion of previous children (due to
-      ## "deletefcn" callback or for legends/colorbars that are deleted
-      ## with their corresponding axes).
-      if (! ishandle (child))
-        continue;
-      endif
-      if (strcmp (get (child, "type"), "axes"))
-        ## Skip legend and colorbar objects.
-        if (strcmp (get (child, "tag"), "legend")
-            || strcmp (get (child, "tag"), "colorbar"))
-          continue;
-        endif
-        if (align_axes)
-          objpos = get (child, "position");
-        else
-          objpos = get (child, "outerposition");
-        endif
-        if (all (abs (objpos - pos) < eps) && ! replace_axes)
-          ## If the new axes are in exactly the same position as an
-          ## existing axes object, use the existing axes.
-          found = true;
-          tmp = child;
-        else
-          ## If the new axes overlap an old axes object, delete the old
-          ## axes.
-          x0 = pos(1);
-          x1 = x0 + pos(3);
-          y0 = pos(2);
-          y1 = y0 + pos(4);
-          objx0 = objpos(1);
-          objx1 = objx0 + objpos(3);
-          objy0 = objpos(2);
-          objy1 = objy0 + objpos(4);
-          if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0))
-            delete (child);
-          endif
-        endif
-      endif
-    endfor
-
-    if (found)
-      set (cf, "currentaxes", tmp);
-    elseif (align_axes)
-      tmp = axes ("box", "off", "position", pos, varargin{:});
-    elseif (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
-      tmp = axes ("box", "off", "outerposition", pos, varargin{:});
-    else
-      tmp = axes ("looseinset", [0 0 0 0], "box", "off", "outerposition", pos,
-                  "autopos_tag", "subplot", varargin{:});
-    endif
-
-  unwind_protect_cleanup
-    set (0, "defaultaxesunits", axesunits);
-    set (cf, "units", figureunits);
-  end_unwind_protect
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-function pos = subplot_position (rows, cols, index, position_property)
-
-  if (rows == 1 && cols == 1)
-    ## Trivial result for subplot (1,1,1)
-    if (strcmpi (position_property, "position"))
-      pos = get (0, "defaultaxesposition");
-    else
-      pos = get (0, "defaultaxesouterposition");
-    endif
-    return
-  endif
-
-  if (strcmp (position_property, "outerposition")
-      || strcmp (position_property, "outerpositiontight"))
-    margins.left   = 0.05;
-    margins.bottom = 0.05;
-    margins.right  = 0.05;
-    margins.top    = 0.05;
-    if (strcmp (position_property, "outerpositiontight"))
-      margins.column = 0.;
-      margins.row = 0.;
-    else
-      margins.column = 0.04 / cols;
-      margins.row = 0.04 / rows;
-    endif
-    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
-    width = width / cols;
-    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
-    height = height / rows;
-  else
-    defaultaxesposition = get (0, "defaultaxesposition");
-
-    ## The outer margins surrounding all subplot "positions" are independent
-    ## of the number of rows and/or columns
-    margins.left   = defaultaxesposition(1);
-    margins.bottom = defaultaxesposition(2);
-    margins.right  = 1.0 - margins.left - defaultaxesposition(3);
-    margins.top    = 1.0 - margins.bottom - defaultaxesposition(4);
-
-    ## Fit from Matlab experiments
-    pc = 1 ./ [0.1860, (margins.left + margins.right - 1)];
-    margins.column = 1 ./ polyval (pc , cols);
-    pr = 1 ./ [0.2282, (margins.top + margins.bottom - 1)];
-    margins.row    = 1 ./ polyval (pr , rows);
-
-    ## Calculate the width/height of the subplot axes "position".
-    ## This is also consistent with Matlab
-    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
-    width = width / cols;
-    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
-    height = height / rows;
-  endif
-
-  ## Index offsets from the lower left subplot
-  yi = fix ((index(:)-1)/cols);
-  xi = index(:) - yi*cols - 1;
-  yi = (rows - 1) - yi;
-
-  ## Lower left corner of the subplot, i.e. position(1:2)
-  x0 = xi .* (width + margins.column) + margins.left;
-  y0 = yi .* (height + margins.row) + margins.bottom;
-
-  if (numel (x0) > 1)
-    ## subplot (row, col, m:n)
-    x1 = max (x0(:)) + width;
-    y1 = max (y0(:)) + height;
-    x0 = min (x0(:));
-    y0 = min (y0(:));
-    pos = [x0, y0, x1-x0, y1-y0];
-  else
-    ## subplot (row, col, num)
-    pos = [x0, y0, width, height];
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! r = 3;
-%! c = 3;
-%! fmt = {'horizontalalignment', 'center', 'verticalalignment', 'middle'};
-%! for n = 1 : r*c
-%!   subplot (r, c, n);
-%!   xlabel (sprintf ('xlabel #%d', n));
-%!   ylabel (sprintf ('ylabel #%d', n));
-%!   title (sprintf ('title #%d', n));
-%!   text (0.5, 0.5, sprintf ('subplot(%d,%d,%d)', r, c, n), fmt{:});
-%!   axis ([0 1 0 1]);
-%! end
-%! subplot (r, c, 1:3);
-%! xlabel (sprintf ('xlabel #%d:%d', 1, 3));
-%! ylabel (sprintf ('ylabel #%d:%d', 1, 3));
-%! title (sprintf ('title #%d:%d', 1, 3));
-%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:});
-%! axis ([0 1 0 1]);
-
-%!demo
-%! clf;
-%! x = 0:1;
-%! for n = 1:4
-%!   subplot (2,2,n, 'align');
-%!   plot (x, x);
-%!   xlabel (sprintf ('xlabel (2,2,%d)', n));
-%!   ylabel (sprintf ('ylabel (2,2,%d)', n));
-%!   title (sprintf ('title (2,2,%d)', n));
-%! end
-%! subplot (1,2,1, 'align');
-%! plot (x, x);
-%! xlabel ('xlabel (1,2,1)');
-%! ylabel ('ylabel (1,2,1)');
-%! title ('title (1,2,1)');
-
--- a/scripts/plot/surf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-## Copyright (C) 2007-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surf (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surf (@var{z})
-## @deftypefnx {Function File} {} surf (@dots{}, @var{c})
-## @deftypefnx {Function File} {} surf (@var{hax}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surf (@dots{})
-## Plot a surface given matrices @var{x}, and @var{y} from @code{meshgrid} and
-## a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of
-## the mesh.  If @var{x} and @var{y} are vectors, then a typical vertex
-## is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z}
-## correspond to different @var{x} values and rows of @var{z} correspond
-## to different @var{y} values.
-##
-## The color of the surface is derived from the @code{colormap} and
-## the value of @var{z}.  Optionally the color of the surface can be
-## specified independent of @var{z}, by adding a fourth matrix, @var{c}.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-## @seealso{colormap, contour, meshgrid, mesh}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = surf (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-    tmp = surface (varargin{:});
-
-    if (! ishold ())
-      set (h, "view", [-37.5, 30],
-           "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = peaks ();
-%! surf (Z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! surf (Z, Fx+Fy);
-%! shading interp;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [~,Fy] = gradient (Z);
-%! surf (X, Y, Z, Fy);
-%! shading interp;
-
--- a/scripts/plot/surface.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
-## @deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
-## @deftypefnx {Function File} {} surface (@var{z})
-## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val})
-## @deftypefnx {Function File} {} surface (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
-## Plot a surface graphic object given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the surface.  If @var{x} and @var{y} are vectors,
-## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus,
-## columns of @var{z} correspond to different @var{x} values and rows of
-## @var{z} correspond to different @var{y} values.  If @var{x} and @var{y}
-## are missing, they are constructed from size of the matrix @var{z}.
-##
-## Any additional properties passed are assigned to the surface.
-## 
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-## @seealso{surf, mesh, patch, line}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = surface (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    [tmp, bad_usage] = __surface__ (h, varargin{:});
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (bad_usage)
-    print_usage ();
-  endif
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-function [h, bad_usage] = __surface__ (ax, varargin)
-
-  bad_usage = false;
-  h = 0;
-  firststring = nargin;
-  for i = 2 : nargin
-    if (ischar (varargin{i - 1}))
-      firststring = i - 1;
-      break;
-    endif
-  endfor
-
-  if (firststring > 5)
-    bad_usage = true;
-  elseif (firststring == 5)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    c = varargin{4};
-
-    [z_nr, z_nc] = size (z);
-    [c_nr, c_nc, c_np] = size (c);
-    if (! (z_nr == c_nr && z_nc == c_nc && (c_np == 1 || c_np == 3)))
-      error ("surface: Z and C must have the same size");
-    endif
-
-    if (isvector (x) && isvector (y) && ismatrix (z))
-      if (rows (z) == length (y) && columns (z) == length (x))
-        x = x(:)';
-        y = y(:);
-      else
-        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
-      endif
-    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
-      if (! size_equal (x, y, z))
-        error ("surface: X, Y, and Z must have the same dimensions");
-      endif
-    else
-      error ("surface: X and Y must be vectors and Z must be a matrix");
-    endif
-  elseif (firststring == 4)
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    c = z;
-    if (isvector (x) && isvector (y) && ismatrix (z))
-      if (rows (z) == length (y) && columns (z) == length (x))
-        x = x(:)';
-        y = y(:);
-      else
-        error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
-      endif
-    elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
-      if (! size_equal (x, y, z))
-        error ("surface: X, Y, and Z must have the same dimensions");
-      endif
-    else
-      error ("surface: X and Y must be vectors and Z must be a matrix");
-    endif
-  elseif (firststring == 3)
-    z = varargin{1};
-    c = varargin{2};
-    if (ismatrix (z) && !isvector (z) && !isscalar (z))
-      [nr, nc] = size (z);
-      x = 1:nc;
-      y = (1:nr)';
-    else
-      error ("surface: Z argument must be a matrix");
-    endif
-  elseif (firststring == 2)
-    z = varargin{1};
-    c = z;
-    if (ismatrix (z) && !isvector (z) && !isscalar (z))
-      [nr, nc] = size (z);
-      x = 1:nc;
-      y = (1:nr)';
-    else
-      error ("surface: Z argument must be a matrix");
-    endif
-  elseif (firststring == 1)
-    x = 1:3;
-    y = (x).';
-    c = z = eye (3);
-  else
-    bad_usage = true;
-  endif
-
-  if (! bad_usage)
-    ## Make a default surface object.
-    other_args = {};
-    if (firststring < nargin)
-      other_args = varargin(firststring:end);
-    endif
-    h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
-                        other_args{:});
-
-    if (! ishold ())
-      set (ax, "view", [0, 90], "box", "off");
-    endif
-  endif
-
-endfunction
-
-
-## Functional tests for surface() are in surf.m, surfc.m, surfl.m, and pcolor.m
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = surface;
-%!   assert (findobj (hf, "type", "surface"), h);
-%!   assert (get (h, "xdata"), 1:3, eps);
-%!   assert (get (h, "ydata"), (1:3)', eps);
-%!   assert (get (h, "zdata"), eye (3));
-%!   assert (get (h, "cdata"), eye (3));
-%!   assert (get (h, "type"), "surface");
-%!   assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle"));
-%!   assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps);
-%!   assert (get (h, "marker"), get (0, "defaultsurfacemarker"));
-%!   assert (get (h, "markersize"), get (0, "defaultsurfacemarkersize"));
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/surfc.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-## Copyright (C) 1996-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} surfc (@var{x}, @var{y}, @var{z})
-## Plot a surface and contour given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh.  If @var{x} and @var{y} are vectors,
-## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus,
-## columns of @var{z} correspond to different @var{x} values and rows of
-## @var{z} correspond to different @var{y} values.
-## @seealso{meshgrid, surf, contour}
-## @end deftypefn
-
-function h = surfc (varargin)
-
-  newplot ();
-
-  tmp = surface (varargin{:});
-
-  ax = get (tmp, "parent");
-
-  set (tmp, "facecolor", "flat");
-
-  if (! ishold ())
-    set (ax, "view", [-37.5, 30],
-         "xgrid", "on", "ygrid", "on", "zgrid", "on");
-  endif
-
-  drawnow ();
-  zmin = get (ax, "zlim")(1);
-
-  # don't pass axis handle and/or string arguments to __contour__()
-  stop_idx = nargin;
-  for i = 2 : nargin
-    if (ischar (varargin{i}))
-      stop_idx = i - 1;
-      break;
-    endif
-  endfor
-
-  start_idx = 1;
-  if (ishandle (varargin{1}))
-    start_idx = 2;
-  endif
-
-  if (stop_idx - start_idx == 1 || stop_idx - start_idx == 3)
-    #don't pass a color matrix c to __contour__
-    stop_idx -= 1;
-  endif
-
-  [c, tmp2] = __contour__ (ax, zmin, varargin{start_idx:stop_idx});
-
-  tmp = [tmp; tmp2];
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = peaks ();
-%! surfc (Z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = sombrero ();
-%! [Fx,Fy] = gradient (Z);
-%! surfc (Z, Fx+Fy);
-%! shading interp;
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [X,Y,Z] = sombrero ();
-%! [~,Fy] = gradient (Z);
-%! surfc (X,Y,Z,Fy);
-%! shading interp;
-
--- a/scripts/plot/surfl.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-## Copyright (C) 2009-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surfl (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surfl (@var{z})
-## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{L})
-## @deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{L}, @var{P})
-## @deftypefnx {Function File} {} surfl (@dots{}, "light")
-## Plot a lighted surface given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh.  If @var{x} and @var{y} are vectors, then
-## a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns
-## of @var{z} correspond to different @var{x} values and rows of @var{z}
-## correspond to different @var{y} values.
-##
-## The light direction can be specified using @var{L}.  It can be given as a
-## 2-element vector [azimuth, elevation] in degrees or as a 3-element vector
-## [lx, ly, lz].  The default value is rotated 45 degrees counterclockwise
-## from the current view.
-##
-## The material properties of the surface can specified using a 4-element vector
-## @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to
-## @var{p} = [0.55 0.6 0.4 10].
-##
-## @table @asis
-## @item "AM" strength of ambient light
-##
-## @item "D" strength of diffuse reflection
-##
-## @item "SP" strength of specular reflection
-##
-## @item "EXP" specular exponent
-## @end table
-##
-## The default lighting mode "cdata", changes the cdata property to give the
-## impression of a lighted surface.  Please note: the alternative "light"
-## mode, which creates a light object to illuminate the surface is not
-## implemented (yet).
-##
-## Example:
-##
-## @example
-## @group
-## colormap (bone (64));
-## surfl (peaks);
-## shading interp;
-## @end group
-## @end example
-## @seealso{surf, diffuse, specular, surface}
-## @end deftypefn
-
-## Author: Kai Habel <kai.habel@gmx.de>
-
-function retval = surfl (varargin)
-
-  [h, varargin] = __plt_get_axis_arg__ ("surfl", varargin{:});
-
-  oldh = gca ();
-  unwind_protect
-    axes (h);
-    newplot ();
-
-    ## Check for lighting type.
-    use_cdata = true;
-    if (ischar (varargin{end}))
-      lstr = tolower (varargin{end});
-      if (strncmp (lstr, "light", 5))
-        warning ("light method not supported (yet), using cdata method instead");
-        ## This can be implemented when light objects are supported.
-        use_cdata = false;
-      elseif (strncmp (lstr, "cdata", 5))
-        use_cdata = true;
-      else
-        error ("surfl: unknown lighting method");
-      endif
-      varargin(end) = [];
-    endif
-
-    ## Check for reflection properties argument.
-    ##
-    ## r = [ambient light strength,
-    ##      diffuse reflection strength,
-    ##      specular reflection strength,
-    ##      specular shine]
-    if (length (varargin{end}) == 4 && isnumeric (varargin{end}))
-      r = varargin{end};
-      varargin(end) = [];
-    else
-      ## Default values.
-      r = [0.55, 0.6, 0.4, 10];
-    endif
-
-    ## Check for light vector (lv) argument.
-    have_lv = false;
-    if (isnumeric (varargin{end}))
-      len = numel (varargin{end});
-      lastarg = varargin{end};
-      if (len == 3)
-        lv = lastarg;
-        varargin(end) = [];
-        have_lv = true;
-      elseif (len == 2)
-        [lv(1), lv(2), lv(3)] = sph2cart ((lastarg(1) - 90) * pi/180, lastarg(2) * pi/180, 1.0);
-        varargin(end) = [];
-        have_lv = true;
-      endif
-    endif
-
-    htmp = surface (varargin{:});
-    if (! ishold ())
-      set (h, "view", [-37.5, 30],
-           "xgrid", "on", "ygrid", "on", "zgrid", "on", "clim", [0 1]);
-    endif
-
-    ## Get view vector (vv).
-    a = axis;
-    [az, el] = view;
-    vv = sph2cart ((az - 90) * pi/180.0, el * pi/180.0, 1.0);
-
-    if (!have_lv)
-      ## Calculate light vector (lv) from view vector.
-      Phi = 45.0 / 180.0 * pi;
-      R = [cos(Phi), -sin(Phi), 0;
-           sin(Phi),  cos(Phi), 0;
-           0,          0,         1];
-      lv = (R * vv.').';
-    endif
-
-    vn = get (htmp, "vertexnormals");
-    dar = get (h, "plotboxaspectratio");
-    vn(:,:,1) *= dar(1);
-    vn(:,:,2) *= dar(2);
-    vn(:,:,3) *= dar(3);
-
-    ## Normalize vn.
-    vn = vn ./ repmat (sqrt (sumsq (vn, 3)), [1, 1, 3]);
-    [nr, nc] = size (get (htmp, "zdata"));
-
-    ## Ambient, diffuse, and specular term.
-    cdata = (r(1) * ones (nr, nc)
-             + r(2) * diffuse  (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv)
-             + r(3) * specular (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv, vv, r(4)));
-
-    set (htmp, "cdata", cdata ./ sum (r(1:3)));
-
-  unwind_protect_cleanup
-    axes (oldh);
-  end_unwind_protect
-
-  if (nargout > 0)
-    retval = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! [X,Y,Z] = sombrero ();
-%! colormap (copper (64));
-%! surfl (X,Y,Z);
-%! shading interp;
-
-%!demo
-%! clf;
-%! [X,Y,Z] = sombrero ();
-%! colormap (copper (64));
-%! [az, el] = view ();
-%! surfl (X,Y,Z, [az+225,el], [0.2 0.6 0.4 25]);
-%! shading interp;
-
--- a/scripts/plot/surfnorm.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} surfnorm (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} surfnorm (@var{z})
-## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{})
-## @deftypefnx {Function File} {} surfnorm (@var{h}, @dots{})
-## Find the vectors normal to a meshgridded surface.  The meshed gridded
-## surface is defined by @var{x}, @var{y}, and @var{z}.  If @var{x} and
-## @var{y} are not defined, then it is assumed that they are given by
-##
-## @example
-## @group
-## [@var{x}, @var{y}] = meshgrid (1:rows (@var{z}),
-##                    1:columns (@var{z}));
-## @end group
-## @end example
-##
-## If no return arguments are requested, a surface plot with the normal
-## vectors to the surface is plotted.  Otherwise the components of the normal
-## vectors at the mesh gridded points are returned in @var{nx}, @var{ny},
-## and @var{nz}.
-##
-## The normal vectors are calculated by taking the cross product of the
-## diagonals of each of the quadrilaterals in the meshgrid to find the
-## normal vectors of the centers of these quadrilaterals.  The four nearest
-## normal vectors to the meshgrid points are then averaged to obtain the
-## normal to the surface at the meshgridded points.
-##
-## An example of the use of @code{surfnorm} is
-##
-## @example
-## surfnorm (peaks (25));
-## @end example
-## @seealso{surf, quiver3}
-## @end deftypefn
-
-function [Nx, Ny, Nz] = surfnorm (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout != 0), "surfnorm",
-                                                varargin{:});
-
-  if (nargin != 1 && nargin != 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    z = varargin{1};
-    [x, y] = meshgrid (1:rows (z), 1:columns (z));
-    ioff = 2;
-  else
-    x = varargin{1};
-    y = varargin{2};
-    z = varargin{3};
-    ioff = 4;
-  endif
-
-  if (!ismatrix (z) || isvector (z) || isscalar (z))
-    error ("surfnorm: Z argument must be a matrix");
-  endif
-  if (! size_equal (x, y, z))
-    error ("surfnorm: X, Y, and Z must have the same dimensions");
-  endif
-
-  ## Make life easier, and avoid having to do the extrapolation later, do
-  ## a simpler linear extrapolation here. This is approximative, and works
-  ## badly for closed surfaces like spheres.
-  xx = [2 .* x(:,1) - x(:,2), x, 2 .* x(:,end) - x(:,end-1)];
-  xx = [2 .* xx(1,:) - xx(2,:); xx; 2 .* xx(end,:) - xx(end-1,:)];
-  yy = [2 .* y(:,1) - y(:,2), y, 2 .* y(:,end) - y(:,end-1)];
-  yy = [2 .* yy(1,:) - yy(2,:); yy; 2 .* yy(end,:) - yy(end-1,:)];
-  zz = [2 .* z(:,1) - z(:,2), z, 2 .* z(:,end) - z(:,end-1)];
-  zz = [2 .* zz(1,:) - zz(2,:); zz; 2 .* zz(end,:) - zz(end-1,:)];
-
-  u.x = xx(1:end-1,1:end-1) - xx(2:end,2:end);
-  u.y = yy(1:end-1,1:end-1) - yy(2:end,2:end);
-  u.z = zz(1:end-1,1:end-1) - zz(2:end,2:end);
-  v.x = xx(1:end-1,2:end) - xx(2:end,1:end-1);
-  v.y = yy(1:end-1,2:end) - yy(2:end,1:end-1);
-  v.z = zz(1:end-1,2:end) - zz(2:end,1:end-1);
-
-  c = cross ([u.x(:), u.y(:), u.z(:)], [v.x(:), v.y(:), v.z(:)]);
-  w.x = reshape (c(:,1), size (u.x));
-  w.y = reshape (c(:,2), size (u.y));
-  w.z = reshape (c(:,3), size (u.z));
-
-  ## Create normal vectors as mesh vectices from normals at mesh centers
-  nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) +
-        w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4;
-  ny = (w.y(1:end-1,1:end-1) + w.y(1:end-1,2:end) +
-        w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4;
-  nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) +
-        w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4;
-
-  ## Normalize the normal vectors
-  len = sqrt (nx.^2 + ny.^2 + nz.^2);
-  nx = nx ./ len;
-  ny = ny ./ len;
-  nz = nz ./ len;
-
-  if (nargout == 0)
-    oldh = gca ();
-    unwind_protect
-      axes (h);
-      newplot ();
-      surf (x, y, z, varargin{ioff:end});
-      old_hold_state = get (h, "nextplot");
-      unwind_protect
-        set (h, "nextplot", "add");
-        plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
-               [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
-               [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:),
-               varargin{ioff:end});
-      unwind_protect_cleanup
-        set (h, "nextplot", old_hold_state);
-      end_unwind_protect
-    unwind_protect_cleanup
-      axes (oldh);
-    end_unwind_protect
-  else
-    Nx = nx;
-    Ny = ny;
-    Nz = nz;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [x, y, z] = peaks (10);
-%! surfnorm (x, y, z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! surfnorm (peaks (10));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! surfnorm (peaks (32));
-%! shading interp;
-
--- a/scripts/plot/tetramesh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-## Copyright (C) 2012 Martin Helm
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} tetramesh (@var{T}, @var{X})
-## @deftypefnx {Function File} {} tetramesh (@var{T}, @var{X}, @var{C})
-## @deftypefnx {Function File} {} tetramesh (@dots{}, @var{property}, @var{val}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} tetramesh (@dots{})
-##
-## Display the tetrahedrons defined in the m-by-4 matrix @var{T}
-## as 3-D patches.  @var{T} is typically the output of a Delaunay triangulation
-## of a 3-D set of points.  Every row of @var{T} contains four indices into
-## the n-by-3 matrix @var{X} of the vertices of a tetrahedron.  Every row in
-## @var{X} represents one point in 3-D space. 
-##
-## The vector @var{C} specifies the color of each tetrahedron as an index
-## into the current colormap.  The default value is 1:m where m is the number
-## of tetrahedrons; the indices are scaled to map to the full range of the
-## colormap.  If there are more tetrahedrons than colors in the colormap then
-## the values in @var{C} are cyclically repeated.
-## 
-## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all
-## property/value pairs directly to the patch function as additional arguments.
-##
-## The optional return value @var{h} is a vector of patch handles where each
-## handle represents one tetrahedron in the order given by @var{T}. 
-## A typical use case for @var{h} is to turn the respective patch "visible"
-## property "on" or "off".
-##
-## Type @code{demo tetramesh} to see examples on using @code{tetramesh}.
-## @seealso{delaunay3, delaunayn, trimesh, patch}
-## @end deftypefn
-
-## Author: Martin Helm <martin@mhelm.de>
-
-function h = tetramesh (varargin)
-
-  [reg, prop] = parseparams (varargin);
-
-  if (length (reg) < 2 || length (reg) > 3)
-    print_usage ();
-  endif
-
-  T = reg{1};
-  X = reg{2};
-
-  if (! ismatrix (T) || columns (T) != 4)
-    error ("tetramesh: T must be a n-by-4 matrix");
-  endif
-  if (! ismatrix (X) || columns (X) != 3)
-    error ("tetramesh: X must be a n-by-3 matrix");
-  endif
-
-  size_T = rows (T);
-  colmap = colormap ();
-  
-  if (length (reg) < 3)
-    size_colmap = rows (colmap);
-    C = mod ((1:size_T)' - 1, size_colmap) + 1;
-    if (size_T < size_colmap && size_T > 1) 
-      ## expand to the available range of colors
-      C = floor ((C - 1) * (size_colmap - 1) / (size_T - 1)) + 1;
-    endif
-  else
-    C = reg{3};
-    if (! isvector (C) || size_T != length (C))
-      error ("tetramesh: C must be a vector of the same length as T");
-    endif
-  endif
-
-  h = zeros (1, size_T);
-  if (strcmp (graphics_toolkit (), "gnuplot"))
-    ## tiny reduction of the tetrahedron size to help gnuplot by
-    ## avoiding identical faces with different colors
-    for i = 1:size_T
-      [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7);
-      hvec(i) = patch ("Faces", th, "Vertices", p, 
-                       "FaceColor", colmap(C(i), :), prop{:});
-    endfor
-  else
-    for i = 1:size_T
-      th = [1 2 3; 2 3 4; 3 4 1; 4 1 2];
-      hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), 
-                       "FaceColor", colmap(C(i), :), prop{:});
-    endfor
-  endif
-
-  if (nargout > 0)
-    h = hvec;
-  endif
-
-endfunction
-
-## shrink the tetrahedron relative to its center of gravity
-function [tri, p] = __shrink__ (T, X, sf)
-  midpoint = repmat (sum (X(T, :), 1) / 4, 12, 1);
-  p = [X([1 2 3], :); X([2 3 4], :); X([3 4 1], :); X([4 1 2], :)];
-  p = sf * (p - midpoint) + midpoint;
-  tri = reshape (1:12, 3, 4)';
-endfunction
-
-
-%!demo
-%! clf;
-%! d = [-1 1];
-%! [x,y,z] = meshgrid (d, d, d);
-%! x = [x(:); 0];
-%! y = [y(:); 0];
-%! z = [z(:); 0];
-%! tetra = delaunay3 (x, y, z);
-%! X = [x(:) y(:) z(:)];
-%! colormap (jet (64));
-%! h = tetramesh (tetra, X);
-%! set (h(1:2:end), 'Visible', 'off');
-%! axis equal;
-%! view (30, 20);
-%! title ('Using jet (64), every other tetrahedron invisible');
-
-%!demo
-%! clf;
-%! d = [-1 1];
-%! [x,y,z] = meshgrid (d, d, d);
-%! x = [x(:); 0];
-%! y = [y(:); 0];
-%! z = [z(:); 0];
-%! tetra = delaunay3 (x, y, z);
-%! X = [x(:) y(:) z(:)];
-%! colormap (gray (256));
-%! tetramesh (tetra, X, 21:20:241, 'EdgeColor', 'w');
-%! axis equal;
-%! view (30, 20);
-%! title ('Using gray (256) and white edges');
-
--- a/scripts/plot/text.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} text (@var{x}, @var{y}, @var{label})
-## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{label})
-## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{label}, @var{p1}, @var{v1}, @dots{})
-## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{label}, @var{p1}, @var{v1}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} text (@dots{})
-## Create a text object with text @var{label} at position @var{x},
-## @var{y}, @var{z} on the current axes.  Property-value pairs following
-## @var{label} may be used to specify the appearance of the text.
-##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
-## @end deftypefn
-
-## Author: jwe
-
-## Note: The following code is rigged for Matlab compatibility and is
-##       full of hidden assumptions.  Be very wary when modifying.
-
-function h = text (varargin)
-
-  nargs = nargin;
-  offset = 0;
-
-  if (nargs > 2 && isnumeric (varargin{1}) && isnumeric (varargin{2}))
-    x = varargin{1};
-    y = varargin{2};
-
-    if (nargin > 3 && isnumeric (varargin{3}))
-      z = varargin{3};
-      offset = 4;
-    else
-      z = zeros (size (x));
-      offset = 3;
-    endif
-
-    label = varargin{offset};
-    varargin(1:offset) = [];
-
-    nx = numel (x);
-    ny = numel (y);
-    nz = numel (z);
-    if (ischar (label))
-
-      do_keyword_repl = true;
-      nt = rows (label);
-      if (nx == 1 && nt == 1)
-        ## Single text object with one line
-        label = {label};
-      elseif (nx == 1 && nt > 1)
-        ## Single text object with multiple lines
-        ## FIXME: "default" or "factory" as first row
-        ##        should be escaped to "\default" or "\factory"
-        ##        Other rows do not require escaping.
-        do_keyword_repl = false;
-        label = {label};
-      elseif (nx > 1 && nt == nx)
-        ## Mutiple text objects with different strings
-        label = cellstr (label);
-      else 
-        ## Mutiple text objects with same string
-        label = repmat ({label}, [nx, 1]);
-        nt = nx;
-      endif
-
-      ## Escape special keywords
-      if (do_keyword_repl)
-        label = regexprep (label, '^(default|factory)$', '\\$1');
-      endif
-
-    elseif (iscell (label))
-
-      nt = numel (label);
-      if (nx == 1)      
-        ## Single text object with one or more lines
-        label = {label};
-        nt = 1;
-      elseif (nx > 1 && nt == nx)
-        ## Mutiple text objects with different strings
-      else
-        ## Mutiple text objects with same string
-        label = repmat ({label}, [nx, 1]);
-        nt = nx;
-      endif
-
-    else
-
-      error ("text: LABEL must be a character string or cell array of character strings");
-
-    endif
-  else  # Only PROP/VALUE pairs
-    x = y = z = 0;
-    nx = ny = nz = 1;
-    label = {""};
-    nt = 1;
-  endif
-
-  ## Any remaining inputs must occur as PROPERTY/VALUE pairs
-  if (rem (numel (varargin), 2) != 0)
-    print_usage ();
-  endif
-
-  if (nx == ny && nx == nz && (nt == nx || nt == 1 || nx == 1))
-    pos = [x(:), y(:), z(:)];
-    ca = gca ();
-    htmp = zeros (nt, 1);
-    if (nx == 1)
-      htmp = __go_text__ (ca, "string", label{1},
-                          varargin{:},
-                          "position", pos);
-    elseif (nx == nt)
-      for n = 1:nt
-        htmp(n) = __go_text__ (ca, "string", label{n},
-                               varargin{:},
-                               "position", pos(n,:));
-      endfor
-      __request_drawnow__ ();
-    else
-      error ("text: dimension mismatch for coordinates and LABEL");
-    endif
-  elseif (nt == nx || nt == 1 || nx == 1)
-    error ("text: dimension mismatch for coordinates");
-  else
-    error ("text: dimension mismatch between coordinates and strings");
-  endif
-
-  if (nargout > 0)
-    h = htmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ha = {'left', 'center', 'right'};
-%! va = {'bottom', 'middle', 'top'};
-%! x = [0.25 0.5 0.75];
-%! y = x;
-%! for t = 0:30:359;
-%!   for nh = 1:numel (ha)
-%!     for nv = 1:numel (va)
-%!       text (x(nh), y(nv), 'Hello World', ...
-%!             'rotation', t, ...
-%!             'horizontalalignment', ha{nh}, ...
-%!             'verticalalignment', va{nv});
-%!     end
-%!   end
-%! end
-%! set (gca, 'xtick', [0.25, 0.5, 0.75], ...
-%!           'xticklabel', ha, ...
-%!           'ytick', [0.25, 0.5, 0.75], ...
-%!           'yticklabel', va);
-%! axis ([0 1 0 1]);
-%! xlabel ('horizontal alignment');
-%! ylabel ('vertical alignment');
-%! title ('text alignment and rotation (0:30:360 degrees)');
-
-%!demo
-%! clf;
-%! h = mesh (peaks, 'edgecolor', 0.7 * [1 1 1], ...
-%!                  'facecolor', 'none', ...
-%!                  'facealpha', 0);
-%! for t = 0:45:359;
-%!   text (25, 25, 0, 'Vertical Alignment = Bottom', ...
-%!                    'rotation', t, ...
-%!                    'horizontalalignment', 'left', ...
-%!                    'verticalalignment', 'bottom');
-%! end
-%! caxis ([-100 100]);
-%! title ('Vertically Aligned at Bottom');
-
-%!demo
-%! clf;
-%! axis ([0 8 0 8]);
-%! title (['1st title';'2nd title']);
-%! xlabel (['1st xlabel';'2nd xlabel']);
-%! ylabel (['1st ylabel';'2nd ylabel']);
-%! text (4, 4, {'Hello', 'World'}, ...
-%!       'horizontalalignment', 'center', ...
-%!       'verticalalignment', 'middle');
-%! grid on;
-
-%!demo
-%! clf;
-%! h = mesh (peaks (), 'edgecolor', 0.7 * [1 1 1], ...
-%!                     'facecolor', 'none', ...
-%!                     'facealpha', 0);
-%! title (['1st title';'2nd title']);
-%! xlabel (['1st xlabel';'2nd xlabel']);
-%! ylabel (['1st ylabel';'2nd ylabel']);
-%! zlabel (['1st zlabel';'2nd zlabel']);
-%! text (0, 0, 5, {'Hello', 'World'}, ...
-%!       'horizontalalignment', 'center', ...
-%!       'verticalalignment', 'middle');
-%! hold on;
-%! plot3 (0, 0, 5, '+k');
-
-%!demo
-%! clf;
-%! h = text (0.5, 0.3, 'char');
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.5, 0.4, ['char row 1'; 'char row 2']);
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.5, 0.6, {'cell2str (1,1)', 'cell2str (1,2)'; 'cell2str (2,1)', 'cell2str (2,2)'});
-%! assert ('cell', class (get (h, 'string')));
-%! h = text (0.5, 0.8, 'foobar');
-%! set (h, 'string', 1:3);
-%! h = text ([0.1, 0.1], [0.3, 0.4], 'one string & two objects');
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.5, 0.6], {'one cellstr & two objects'});
-%! assert ('cell', class (get (h(1), 'string')));
-%! assert ('cell', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.7, 0.8], {'cellstr 1 object 1', 'cellstr 2 object 2'});
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text ([0.1, 0.1], [0.1, 0.2], ['1st string & 1st object'; '2nd string & 2nd object']);
-%! assert ('char', class (get (h(1), 'string')));
-%! assert ('char', class (get (h(2), 'string')));
-%! h = text (0.7, 0.6, 'single string');
-%! assert ('char', class (get (h, 'string')));
-%! h = text (0.7, 0.5, {'single cell-string'});
-%! assert ('cell', class (get (h, 'string')));
-%! xlabel (1:2);
-%! ylabel (1:2);
-%! title (1:2);
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ## Single object with one line
-%!   h = text (0.5, 0.3, "single object with one line");
-%!   obs = get (h, "string");
-%!   assert (class (obs), "char");
-%!   assert (obs, "single object with one line");
-%!
-%!   ## Single object with multiple lines
-%!   h = text (0.5, 0.4, ["char row 1"; "char row 2"]);
-%!   obs = get (h, "string");
-%!   assert (class (obs), "char");
-%!   assert (obs, ["char row 1"; "char row 2"]);
-%!
-%!   ## Multiple objects with single line
-%!   h = text ([0.1, 0.1], [0.3, 0.4], "two objects with same string");
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "two objects with same string");
-%!   assert (get (h(2), "string"), "two objects with same string");
-%!
-%!   ## Multiple objects with multiple lines
-%!   h = text ([0.1, 0.1], [0.3, 0.4], ["string1"; "string2"]);
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "string1");
-%!   assert (get (h(2), "string"), "string2");
-%!
-%!   ### Tests repeated with cell input ###
-%!
-%!   ## Single object with one line
-%!   h = text (0.5, 0.3, {"single object with one line"});
-%!   obs = get (h, "string");
-%!   assert (class (obs), "cell");
-%!   assert (obs, {"single object with one line"});
-%!
-%!   ## Single object with multiple lines
-%!   h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)";
-%!                        "cell2str (2,1)", "cell2str (2,2)"});
-%!   obs = get (h, "string");
-%!   assert (class (obs), "cell");
-%!   assert (obs, {"cell2str (1,1)"; "cell2str (2,1)";
-%!                 "cell2str (1,2)"; "cell2str (2,2)"});
-%!
-%!   ## Multiple objects with single line
-%!   h = text ([0.1, 0.1], [0.5, 0.6], {"two objects with same cellstr"});
-%!   assert (class (get (h(1), "string")), "cell");
-%!   assert (class (get (h(2), "string")), "cell");
-%!   ## FIXME: is return value of cellstr, rather than string, Matlab-verified?
-%!   assert (get (h(1), "string"), {"two objects with same cellstr"});
-%!   assert (get (h(2), "string"), {"two objects with same cellstr"});
-%!
-%!   ## Multiple objects with multiple lines
-%!   h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr1", "cellstr2"});
-%!   ## FIXME: is return value really char in Matlab?
-%!   assert (class (get (h(1), "string")), "char");
-%!   assert (class (get (h(2), "string")), "char");
-%!   assert (get (h(1), "string"), "cellstr1");
-%!   assert (get (h(2), "string"), "cellstr2");
-%!
-%!   ## Test special keyword processing
-%!   h = text (0.5, 0.5, "default");
-%!   assert (get (h, "string"), "default")
-%!   h = text (0.5, 0.5, "factory");
-%!   assert (get (h, "string"), "factory")
-%!
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/title.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} title (@var{string})
-## @deftypefnx {Function File} {} title (@var{string}, @var{p1}, @var{v1}, @dots{})
-## @deftypefnx {Function File} {} title (@var{h}, @dots{})
-## @deftypefnx {Function File} {@var{h} =} title (@dots{})
-## Create a title object for a plot.
-##
-## The optional return value @var{h} is a graphics handle to the created object.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = title (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("title", varargin{:});
-
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  tmp = __axis_label__ (h, "title", varargin{:});
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! ax = axes ();
-%! xl = get (ax, 'title');
-%! title ('Testing title');
-%! assert (get (xl, 'string'), 'Testing title');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! xl = get (gca, 'title');
-%! title ('Testing title');
-%! assert (get (xl, 'string'), 'Testing title');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ax = axes ();
-%!   xl = get (ax, "title");
-%!   title ("Testing title");
-%!   assert (get (xl, "string"), "Testing title");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   xl = get (gca, "title");
-%!   title ("Testing title");
-%!   assert (get (xl, "string"), "Testing title");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/trimesh.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
-## Plot a triangular mesh in 3D@.  The variable @var{tri} is the triangular
-## meshing of the points @code{(@var{x}, @var{y})} which is returned
-## from @code{delaunay}.  The variable @var{z} is value at the point
-## @code{(@var{x}, @var{y})}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{triplot, trisurf, delaunay3}
-## @end deftypefn
-
-function h = trimesh (tri, x, y, z, varargin)
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  if (nargin == 3)
-    triplot (tri, x, y);
-  elseif (ischar (z))
-    triplot (tri, x, y, z, varargin{:});
-  else
-    newplot ();
-    handle = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
-                    "FaceColor", "none", "EdgeColor", __next_line_color__ (),
-                    varargin{:});
-    if (! ishold ())
-      set (gca (), "view", [-37.5, 30],
-           "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-    if (nargout > 0)
-      h = handle;
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 10);
-%! N = 10;
-%! x = 3 - 6 * rand (N, N);
-%! y = 3 - 6 * rand (N, N);
-%! z = peaks (x, y);
-%! tri = delaunay (x(:), y(:));
-%! trimesh (tri, x(:), y(:), z(:));
-
--- a/scripts/plot/triplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} triplot (@var{tri}, @var{x}, @var{y})
-## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec})
-## @deftypefnx {Function File} {@var{h} =} triplot (@dots{})
-## Plot a triangular mesh in 2D@.  The variable @var{tri} is the triangular
-## meshing of the points @code{(@var{x}, @var{y})} which is returned from
-## @code{delaunay}.  If given, @var{linespec} determines the properties
-## to use for the lines. 
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{plot, trimesh, trisurf, delaunay}
-## @end deftypefn
-
-function h = triplot (tri, x, y, varargin)
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  idx = tri(:, [1, 2, 3, 1]).';
-  nt = rows (tri);
-  handle = plot ([x(idx); NaN(1, nt)](:),
-                 [y(idx); NaN(1, nt)](:), varargin{:});
-
-  if (nargout > 0)
-    h = handle;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 2);
-%! N = 20;
-%! x = rand (N, 1);
-%! y = rand (N, 1);
-%! tri = delaunay (x, y);
-%! triplot (tri, x, y);
-
--- a/scripts/plot/trisurf.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{})
-## Plot a triangular surface in 3D@.  The variable @var{tri} is the triangular
-## meshing of the points @code{(@var{x}, @var{y})} which is returned
-## from @code{delaunay}.  The variable @var{z} is value at the point
-## @code{(@var{x}, @var{y})}.
-##
-## The optional return value @var{h} is a graphics handle to the created plot.
-## @seealso{triplot, trimesh, delaunay3}
-## @end deftypefn
-
-function h = trisurf (tri, x, y, z, varargin)
-
-  if (nargin < 3)
-    print_usage ();
-  endif
-
-  if (nargin == 3)
-    triplot (tri, x, y);
-  elseif (ischar (z))
-    triplot (tri, x, y, z, varargin{:});
-  else
-    if (nargin > 4 && isnumeric (varargin{1}))
-      c = varargin{1};
-      varargin(1) = [];
-    else
-      c = z;
-    endif
-    if (! any (strcmpi (varargin, "FaceColor")))
-      nfc = numel (varargin) + 1;
-      varargin(nfc+(0:1)) = {"FaceColor", "flat"};
-    else
-      nfc = find (any (strcmpi (varargin, "FaceColor")), 1);
-    endif
-    if (! any (strcmpi (varargin, "EdgeColor"))
-        && strcmpi (varargin{nfc+1}, "interp"))
-      varargin(end+(1:2)) = {"EdgeColor", "none"};
-    endif
-    newplot ();
-    handle = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)],
-                    "FaceVertexCData", reshape (c, numel (c), 1),
-                    varargin{:});
-    if (nargout > 0)
-      h = handle;
-    endif
-
-    if (! ishold ())
-      set (gca (), "view", [-37.5, 30],
-           "xgrid", "on", "ygrid", "on", "zgrid", "on");
-    endif
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! N = 31;
-%! [x, y] = meshgrid (1:N);
-%! tri = delaunay (x, y);
-%! z = peaks (N);
-%! h = trisurf (tri, x, y, z, 'facecolor', 'interp');
-%! axis tight;
-%! zlim auto;
-%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! N = 31;
-%! [x, y] = meshgrid (1:N);
-%! tri = delaunay (x, y);
-%! z = peaks (N);
-%! h = trisurf (tri, x, y, z, 'facecolor', 'flat');
-%! axis tight;
-%! zlim auto;
-%! title (sprintf ('facecolor = %s', get (h, 'facecolor')));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! old_state = rand ('state');
-%! restore_state = onCleanup (@() rand ('state', old_state));
-%! rand ('state', 10);
-%! N = 10;
-%! x = 3 - 6 * rand (N, N);
-%! y = 3 - 6 * rand (N, N);
-%! z = peaks (x, y);
-%! tri = delaunay (x(:), y(:));
-%! trisurf (tri, x(:), y(:), z(:));
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z);
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z, 'facecolor', 'interp');
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! x = rand (100, 1);
-%! y = rand (100, 1);
-%! z = x.^2 + y.^2;
-%! tri = delaunay (x, y);
-%! trisurf (tri, x, y, z, 'facecolor', 'interp', 'edgecolor', 'k');
-
--- a/scripts/plot/uicontextmenu.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{handle} =} uicontextmenu ("Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uicontextmenu (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uicontextmenu", varargin, {"figure"});
-  handle = __go_uicontextmenu__ (h, args{:});
-
-endfunction
--- a/scripts/plot/uicontrol.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uicontrol ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uicontrol (@var{parent}, "Name", value, @dots{})
-## @deftypefnx {Function File} {} uicontrol (@var{handle})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uicontrol (varargin)
-
-  if (nargin == 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "uicontrol"))
-    error ("uicontrol focusing not implemented yet.");
-  else
-    [h, args] = __uiobject_split_args__ ("uicontrol", varargin, {"figure", "uipanel", "uibuttongroup"});
-    handle = __go_uicontrol__ (h, args{:});
-  endif
-
-endfunction
--- a/scripts/plot/uigetdir.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{dirname} =} uigetdir ()
-## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path})
-## @deftypefnx {Function File} {@var{dirname} =} uigetdir (@var{init_path}, @var{dialog_name})
-## Open a GUI dialog for selecting a directory.  If @var{init_path} is not
-## given the current working directory is used.  @var{dialog_name} may be
-## used to customize the dialog title.
-## @seealso{uigetfile, uiputfile}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open")
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uigetdir_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uigetdir_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uigetdir: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uigetdir: no implementation for toolkit '%s', using 'fltk' instead",
-                 defaulttoolkit);
-      endif
-    endif
-  endif
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  if (!ischar (init_path) || !ischar (dialog_name))
-    error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments");
-  endif
-
-  if (!isdir (init_path))
-    init_path = fileparts (init_path);
-  endif
-
-  if (__octave_link_enabled__ ())
-    file_filter = cell (0, 2);
-    default_file_name = "";
-    dialog_position = [240, 120];
-    dialog_mode = "dir";
-
-    [filename, dirname, filterindex] ...
-      = __octave_link_file_dialog__ (file_filter, dialog_name,
-                                     default_file_name, dialog_position,
-                                     dialog_mode, init_path);
-  else
-    dirname = feval (funcname, init_path, dialog_name);
-  endif
-endfunction
-
-
-%!demo
-%! uigetdir (pwd, 'Select Directory');
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uigetfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uigetfile ()
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@var{flt}, @var{dialog_name}, @var{default_file})
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "Position", [@var{px} @var{py}])
-## @deftypefnx {Function File} {[@dots{}] =} uigetfile (@dots{}, "MultiSelect", @var{mode})
-##
-## Open a GUI dialog for selecting a file and return the filename @var{fname},
-## the path to this file @var{fpath}, and the filter index @var{fltidx}.
-## @var{flt} contains a (list of) file filter string(s) in one of the following
-## formats:
-##
-## @table @asis
-## @item "/path/to/filename.ext"
-## If a filename is given then the file extension is extracted and used as
-## filter.  In addition, the path is selected as current path and the filename
-## is selected as default file.  Example: @code{uigetfile ("myfun.m")}
-##
-## @item A single file extension "*.ext"
-## Example: @code{uigetfile ("*.ext")}
-##
-## @item A 2-column cell array
-## containing a file extension in the first column and a brief description
-## in the second column.
-## Example: @code{uigetfile (@{"*.ext", "My Description";"*.xyz",
-## "XYZ-Format"@})}
-##
-## The filter string can also contain a semicolon separated list of filter
-## extensions.
-## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture
-## Formats"@})}
-## @end table
-##
-## @var{dialog_name} can be used to customize the dialog title.
-## If @var{default_file} is given then it will be selected in the GUI dialog.
-## If, in addition, a path is given it is also used as current path.
-##
-## The screen position of the GUI dialog can be set using the "Position" key
-## and a 2-element vector containing the pixel coordinates.
-## Two or more files can be selected when setting the "MultiSelect" key to "on".
-## In that case @var{fname} is a cell array containing the files.
-## @seealso{uiputfile, uigetdir}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retfile, retpath, retindex] = uigetfile (varargin)
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uigetfile_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uigetfile_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uigetfile: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uigetfile: no implementation for toolkit '%s', using 'fltk' instead",
-               defaulttoolkit);
-      endif
-    endif
-  endif
-  
-  if (nargin > 7)
-    error ("uigetfile: number of input arguments must be less than eight");
-  endif
-
-  defaultvals = {cell(0, 2),         # File Filter
-                 "Open File",        # Dialog Title
-                 "",                 # Default file name
-                 [240, 120],         # Dialog Position (pixel x/y)
-                 "off",              # MultiSelect on/off
-                 pwd};               # Default directory
-
-  outargs = cell (6, 1);
-  for i = 1 : 6
-    outargs{i} = defaultvals{i};
-  endfor
-
-  idx1 = idx2 = [];
-  if (length (varargin) > 0)
-    for i = 1 : length (varargin)
-      val = varargin{i};
-      if (ischar (val))
-        val = tolower (val);
-        if (strncmp (val, "multiselect", 11))
-          idx1 = i;
-        elseif (strncmp (val, "position", 8))
-          idx2 = i;
-        endif
-      endif
-    endfor
-  endif
-
-  stridx = [idx1, idx2, 0];
-  if (length (stridx) > 1)
-    stridx = min (stridx(1 : end - 1));
-  endif
-
-  args = varargin;
-  if (stridx)
-    args = varargin(1 : stridx - 1);
-  endif
-
-  len = length (args);
-  if (len > 0)
-    file_filter = args{1};
-    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
-    if (length (defdir) > 0)
-      outargs{6} = defdir;
-    endif
-  else
-    outargs{1} = __file_filter__ (outargs{1});
-  endif
-
-  if (len > 1)
-    if (ischar (args{2}))
-      if (length (args{2}) > 0)
-        outargs{2} = args{2};
-      endif
-    elseif (! isempty (args{2}))
-      print_usage ();
-    endif
-  endif
-
-  if (len > 2)
-    if (ischar (args{3}))
-      [fdir, fname, fext] = fileparts (args{3});
-      if (length (fdir) > 0)
-        outargs{6} = fdir;
-      endif
-      if (length (fname) > 0 || length (fext) > 0)
-        outargs{3} = strcat (fname, fext);
-      endif
-    elseif (! isempty (args{3}))
-      print_usage ();
-    endif
-  endif
-
-  if (stridx)
-    ## we have string arguments ("position" or "multiselect")
-
-    ## check for even number of remaining arguments, prop/value pair(s)
-    if (rem (nargin - stridx + 1, 2))
-      error ("uigetfile: expecting property/value pairs");
-    endif
-
-    for i = stridx : 2 : nargin
-      prop = varargin{i};
-      val = varargin{i + 1};
-      if (strncmp (tolower (prop), "position", 8))
-        if (ismatrix (val) && length (val) == 2)
-          outargs{4} = val;
-        else
-          error ("uigetfile: expecting 2-element vector for position argument");
-        endif
-      elseif (strncmp (tolower (prop), "multiselect", 11))
-        if (ischar (val))
-          outargs{5} = tolower (val);
-        else
-          error ("uigetfile: expecting string argument (on/off) for multiselect");
-        endif
-      else
-        error ("uigetfile: unknown argument");
-      endif
-    endfor
-  endif
-
-  if (__octave_link_enabled__ ())
-    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
-  else
-    [retfile, retpath, retindex] = feval (funcname, outargs{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uimenu.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
-## @deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
-## Create a uimenu object and return a handle to it.  If @var{h} is ommited
-## then a top-level menu for the current figure is created.  If @var{h}
-## is given then a submenu relative to @var{h} is created.
-##
-## uimenu objects have the following specific properties:
-##
-## @table @asis
-## @item "accelerator"
-## A string containing the key combination together with CTRL to execute this
-## menu entry (e.g., "x" for CTRL+x).
-##
-## @item "callback"
-## Is the function called when this menu entry is executed.  It can be either a
-## function string (e.g., "myfun"), a function handle (e.g., @@myfun) or a cell
-## array containing the function handle and arguments for the callback
-## function (e.g., @{@@myfun, arg1, arg2@}).
-##
-## @item "checked"
-## Can be set "on" or "off".  Sets a mark at this menu entry.
-##
-## @item "enable"
-## Can be set "on" or "off".  If disabled the menu entry cannot be selected
-## and it is grayed out.
-##
-## @item "foregroundcolor"
-## A color value setting the text color for this menu entry.
-##
-## @item "label"
-## A string containing the label for this menu entry.  A "&"-symbol can be
-## used to mark the "accelerator" character (e.g., @nospell{"E&xit"})
-##
-## @item "position"
-## An scalar value containing the relative menu position.  The entry with the
-## lowest value is at the first position starting from left or top.
-##
-## @item "separator"
-## Can be set "on" or "off".  If enabled it draws a separator line above the
-## current position.  It is ignored for top level entries.
-##
-## @end table
-##
-## Examples:
-##
-## @example
-## @group
-## f = uimenu ("label", "&File", "accelerator", "f");
-## e = uimenu ("label", "&Edit", "accelerator", "e");
-## uimenu (f, "label", "Close", "accelerator", "q", ...
-##            "callback", "close (gcf)");
-## uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
-##            "callback", "grid (gca)");
-## @end group
-## @end example
-## @seealso{figure}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function hui = uimenu (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uimenu", varargin, {"figure", "uicontextmenu", "uimenu"});
-
-  tmp = __go_uimenu__ (h, args{:});
-
-  if (nargout > 0)
-    hui = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! surfl (peaks);
-%! colormap (copper (64));
-%! shading ('interp');
-%! f = uimenu ('label', '&File', 'accelerator', 'f');
-%! e = uimenu ('label', '&Edit', 'accelerator', 'e');
-%! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)');
-%! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)');
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   ui = uimenu ("label", "mylabel");
-%!   assert (findobj (hf, "type", "uimenu"), ui);
-%!   assert (get (ui, "label"), "mylabel");
-%!   assert (get (ui, "checked"), "off");
-%!   assert (get (ui, "separator"), "off");
-%!   assert (get (ui, "enable"), "on");
-%!   assert (get (ui, "position"), 9);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%% check for top level menus file, edit, and help
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   uif = findall (hf, "label", "&file");
-%!   assert (ishghandle (uif));
-%!   uie = findall (hf, "label", "&edit");
-%!   assert (ishghandle (uie));
-%!   uih = findall (hf, "label", "&help");
-%!   assert (ishghandle (uih));
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
-%!testif HAVE_FLTK
-%! toolkit = graphics_toolkit ();
-%! graphics_toolkit ("fltk");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   uie = findall (hf, "label", "&edit");
-%!   myui = uimenu (uie, "label", "mylabel");
-%!   assert (ancestor (myui, "uimenu", "toplevel"), uie);
-%! unwind_protect_cleanup
-%!   close (hf);
-%!   graphics_toolkit (toolkit);
-%! end_unwind_protect
-
--- a/scripts/plot/uipanel.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uipanel ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uipanel (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uipanel (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uipanel", varargin, {"figure", "uipanel", "uibuttongroup"});
-  handle = __go_uipanel__ (h, args{:});
-
-endfunction
--- a/scripts/plot/uipushtool.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uipushtool ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uipushtool (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uipushtool (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uipushtool", varargin, {"uitoolbar"}, 0);
-  if (isempty (h))
-    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
-    if (isempty (h))
-      h = uitoolbar ();
-    else
-      h = h(1);
-    endif
-  endif
-  handle = __go_uipushtool__ (h, args{:});
-
-endfunction
--- a/scripts/plot/uiputfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-## Copyright (C) 2010-2012 Kai Habel
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile ()
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt})
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name})
-## @deftypefnx {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} uiputfile (@var{flt}, @var{dialog_name}, @var{default_file})
-## Open a GUI dialog for selecting a file.  @var{flt} contains a (list of) file
-## filter string(s) in one of the following formats:
-##
-## @table @code
-## @item "/path/to/filename.ext"
-## If a filename is given the file extension is
-## extracted and used as filter.
-## In addition the path is selected as current path and the filename is selected
-## as default file.
-## Example: uiputfile ("myfun.m");
-##
-## @item "*.ext"
-## A single file extension.
-## Example: uiputfile ("*.ext");
-##
-## @item @{"*.ext","My Description"@}
-## A 2-column cell array containing the file extension in the 1st column and
-## a brief description in the 2nd column.
-## Example: uiputfile (@{"*.ext","My Description";"*.xyz","XYZ-Format"@});
-## @end table
-##
-## The filter string can also contain a semicolon separated list of filter
-## extensions.
-## Example: uiputfile (@{"*.gif;*.png;*.jpg", "Supported Picture Formats"@});
-##
-## @var{dialog_name} can be used to customize the dialog title.
-## If @var{default_file} is given it is preselected in the GUI dialog.
-## If, in addition, a path is given it is also used as current path.
-## @seealso{uigetfile, uigetdir}
-## @end deftypefn
-
-## Author: Kai Habel
-
-function [retfile, retpath, retindex] = uiputfile (varargin)
-
-  if (! __octave_link_enabled__ ())
-    defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__");
-    funcname = ["__uiputfile_", defaulttoolkit, "__"];
-    functype = exist (funcname);
-    if (! __is_function__ (funcname))
-      funcname = "__uiputfile_fltk__";
-      if (! __is_function__ (funcname))
-        error ("uiputfile: fltk graphics toolkit required");
-      elseif (! strcmp (defaulttoolkit, "gnuplot"))
-        warning ("uiputfile: no implementation for toolkit '%s', using 'fltk' instead",
-               defaulttoolkit);
-      endif
-    endif
-  endif
-
-  if (nargin > 3)
-    print_usage ();
-  endif
-
-  defaultvals = {cell(0, 2),     # File Filter
-                 "Save File",    # Dialog Title
-                 "",             # Default file name
-                 [240, 120],     # Dialog Position (pixel x/y)
-                 "create",
-                 pwd};           # Default directory
-
-  outargs = cell (6, 1);
-  for i = 1 : 6
-    outargs{i} = defaultvals{i};
-  endfor
-
-  if (nargin > 0)
-    file_filter = varargin{1};
-    [outargs{1}, outargs{3}, defdir] = __file_filter__ (file_filter);
-    if (length (defdir) > 0)
-      outargs{6} = defdir;
-    endif
-  else
-    outargs{1} = __file_filter__ (outargs{1});
-  endif
-
-  if (nargin > 1)
-    if (ischar (varargin{2}))
-      outargs{2} = varargin{2};
-    elseif (! isempty (varargin{2}))
-      print_usage ();
-    endif
-  endif
-
-  if (nargin > 2)
-    if (ischar (varargin{3}))
-      [fdir, fname, fext] = fileparts (varargin{3});
-      if (! isempty (fdir))
-        outargs{6} = fdir;
-      endif
-      if (! isempty (fname) || ! isempty (fext))
-        outargs{3} = strcat (fname, fext);
-      endif
-    elseif (! isempty (varargin{3}))
-      print_usage ();
-    endif
-  endif
-
-  if (__octave_link_enabled__ ())
-    [retfile, retpath, retindex] = __octave_link_file_dialog__ (outargs{:});
-  else
-    [retfile, retpath, retindex] = feval (funcname, outargs{:});
-  endif
-
-endfunction
-
-
-%!demo
-%! uiputfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
-
-## Remove from test statistics.  No real tests possible.
-%!assert (1)
-
--- a/scripts/plot/uiresume.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} uiresume (@var{h})
-## Resume program execution suspended with @code{uiwait}.  The handle @var{h}
-## must be the same as the on specified in @code{uiwait}.  If the handle
-## is invalid or there is no @code{uiwait} call pending for the figure
-## with handle @var{h}, this function does nothing.
-## @seealso{uiwait}
-## @end deftypefn
-
-## Author: goffioul
-
-function uiresume (h)
-
-  if (! isfigure (h))
-    error ("uiresume: invalid figure handle H");
-  endif
-
-  try
-    uiwait_state = get (h, "__uiwait_state__");
-    if (strcmp (uiwait_state, "active"))
-      set (h, "__uiwait_state__", "triggered");
-    endif
-  catch
-    # Ignore exception
-  end_try_catch
-
-endfunction
--- a/scripts/plot/uitoggletool.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uitoggletool ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uitoggletool (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uitoggletool (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0);
-  if (isempty (h))
-    h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
-    if (isempty (h))
-      h = uitoolbar ();
-    else
-      h = h(1);
-    endif
-  endif
-  handle = __go_uitoggletool__ (h, args{:});
-
-endfunction
--- a/scripts/plot/uitoolbar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{handle} =} uitoolbar ("Name", value, @dots{})
-## @deftypefnx {Function File} {@var{handle} =} uitoolbar (@var{parent}, "Name", value, @dots{})
-## @end deftypefn
-
-## Author: goffioul
-
-function handle = uitoolbar (varargin)
-
-  [h, args] = __uiobject_split_args__ ("uitoolbar", varargin, {"figure"});
-  handle = __go_uitoolbar__ (h, args{:});
-
-endfunction
--- a/scripts/plot/uiwait.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-## Copyright (C) 2012 Michael Goffioul
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} uiwait
-## @deftypefnx {Function File} {} uiwait (@var{h})
-## @deftypefnx {Function File} {} uiwait (@var{h}, @var{timeout})
-## Suspend program execution until the figure with handle @var{h} is
-## deleted or @code{uiresume} is called.  When no figure handle is specified,
-## this function uses the current figure.
-##
-## If the figure handle is invalid or there is no current figure, this
-## functions returns immediately.
-##
-## When specified, @var{timeout} defines the number of seconds to wait
-## for the figure deletion or the @code{uiresume} call.  The timeout value
-## must be at least 1.  If a smaller value is specified, a warning is issued
-## and a timeout value of 1 is used instead.  If a non-integer value is
-## specified, it is truncated towards 0.  If @var{timeout} is not specified,
-## the program execution is suspended indefinitely.
-## @seealso{uiresume, waitfor}
-## @end deftypefn
-
-## Author: goffioul
-
-function uiwait (varargin)
-
-  h = [];
-  timeout = [];
-
-  if (nargin == 0)
-    h = get (0, "currentfigure");
-  else
-    h = varargin{1};
-    if (! isfigure (h))
-      error ("uiwait: invalid figure handle H");
-    endif
-    if (nargin > 1)
-      timeout = varargin{2};
-    endif
-  endif
-
-  if (! isempty (h))
-    unwind_protect
-      try
-        addproperty ("__uiwait_state__", h, "radio", "none|{active}|triggered");
-      catch
-        if (! strcmp (get (h, "__uiwait_state__"), "none"))
-          error ("uiwait: an active uiwait call for this figure already exists");
-        endif
-        set (h, "__uiwait_state__", "active");
-      end_try_catch
-      waitfor_args = {h, "__uiwait_state__", "triggered"};
-      if (! isempty (timeout))
-        waitfor_args(end+1:end+2) = {"timeout", timeout};
-      endif
-      waitfor (waitfor_args{:});
-    unwind_protect_cleanup
-      if (ishandle (h) && isprop (h, "__uiwait_state__"))
-        set (h, "__uiwait_state__", "none");
-      endif
-    end_unwind_protect
-  endif
-
-endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__actual_axis_position__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,86 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} __actual_axis_position__ (@var{h})
+## @deftypefnx {Function File} {} __actual_axis_position__ (@var{axis_struct})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott
+
+function pos = __actual_axis_position__ (h)
+
+  if (ishandle (h))
+    axis_obj = get (h);
+  elseif (isstruct (h))
+    axis_obj = h;
+    h = axis_obj.__cbar_hax__;
+  endif
+
+  ## Get figure size in pixels
+  orig_fig_units = get (axis_obj.parent, "units");
+  orig_fig_position = get (axis_obj.parent, "position");
+  unwind_protect
+    set (axis_obj.parent, "units", "pixels");
+    fig_position = get (axis_obj.parent, "position");
+  unwind_protect_cleanup
+    set (axis_obj.parent, "units", orig_fig_units);
+    set (axis_obj.parent, "position", orig_fig_position);
+  end_unwind_protect
+  ## Get axes size in pixels
+  if (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
+      && strcmp (axis_obj.activepositionproperty, "outerposition"))
+    pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]);
+  else
+    pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]);
+  endif
+
+  nd = __calc_dimensions__ (h);
+
+  if (strcmp (axis_obj.plotboxaspectratiomode, "manual")
+      || strcmp (axis_obj.dataaspectratiomode, "manual"))
+    ## When using {rltb}margin, Gnuplot does not handle the specified
+    ## aspect ratio properly, so handle it here.
+    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+      aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2);
+    else
+      ## FIXME: This works for "axis square", but has not been
+      ##        thoroughly tested for other aspect ratios.
+      aspect_ratio_2d = [max(axis_obj.plotboxaspectratio(1:2)), ...
+                             axis_obj.plotboxaspectratio(3)/sqrt(2)];
+    endif
+    orig_aspect_ratio_2d = pos_in_pixels(3:4);
+    rel_aspect_ratio_2d =  aspect_ratio_2d ./ orig_aspect_ratio_2d;
+    rel_aspect_ratio_2d = rel_aspect_ratio_2d ./ max (rel_aspect_ratio_2d);
+    if (rel_aspect_ratio_2d(1) < rel_aspect_ratio_2d(2));
+      dx = (1.0 - rel_aspect_ratio_2d(1)) * pos_in_pixels(3);
+      pos_in_pixels = pos_in_pixels + dx*[0.5, 0.0, -1.0, 0.0];
+    elseif (rel_aspect_ratio_2d(1) > rel_aspect_ratio_2d(2))
+      dy = (1.0 - rel_aspect_ratio_2d(2)) * pos_in_pixels(4);
+      pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0];
+    endif
+    pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]);
+  elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
+          && strcmp (axis_obj.activepositionproperty, "outerposition"))
+    pos = axis_obj.outerposition;
+  else
+    pos = axis_obj.position;
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__default_plot_options__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,35 @@
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{options} =} __default_plot_options__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function options = __default_plot_options__ ()
+
+  options.key = "";
+  options.color = [];
+  options.linestyle = [];
+  options.marker = [];
+  options.errorstyle = [];
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__gnuplot_drawnow__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,410 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __gnuplot_drawnow__ (@var{h}, @var{term}, @var{file}, @var{mono}, @var{debug_file})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __gnuplot_drawnow__ (h, term, file, mono = false, debug_file)
+
+  if (nargin < 1 || nargin > 5 || nargin == 2)
+    print_usage ();
+  endif
+
+  if (nargin >= 3 && nargin <= 5)
+    ## Produce various output formats, or redirect gnuplot stream to a
+    ## debug file.
+    plot_stream = [];
+    fid = [];
+    default_plot_stream = get (h, "__plot_stream__");
+    unwind_protect
+      plot_stream = __gnuplot_open_stream__ (2, h);
+      gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream);
+      if (gnuplot_supports_term)
+        enhanced = gnuplot_set_term (plot_stream(1), true, h, term, file);
+        __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
+        if (nargin == 5)
+          fid = fopen (debug_file, "wb");
+          enhanced = gnuplot_set_term (fid, true, h, term, file);
+          __go_draw_figure__ (h, fid, enhanced, mono);
+        endif
+      else
+        error ('__gnuplot_drawnow__: the gnuplot terminal, "%s", is not available',
+               gnuplot_trim_term (term));
+      endif
+    unwind_protect_cleanup
+      set (h, "__plot_stream__", default_plot_stream);
+      if (! isempty (plot_stream))
+        pclose (plot_stream(1));
+        if (numel (plot_stream) > 1)
+          pclose (plot_stream(2));
+        endif
+        if (numel (plot_stream) > 2)
+          waitpid (plot_stream(3));
+        endif
+      endif
+      if (! isempty (fid))
+        fclose (fid);
+      endif
+    end_unwind_protect
+  else  # nargin == 1
+    ##  Graphics terminal for display.
+    plot_stream = get (h, "__plot_stream__");
+    if (isempty (plot_stream))
+      plot_stream = __gnuplot_open_stream__ (2, h);
+      new_stream = true;
+    else
+      new_stream = false;
+    endif
+    term = gnuplot_default_term (plot_stream);
+    if (strcmp (term, "dumb"))
+      ## popen2 eats stdout of gnuplot, use temporary file instead
+      dumb_tmp_file = tmpnam ();
+      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h,
+                                   term, dumb_tmp_file);
+    else
+      enhanced = gnuplot_set_term (plot_stream(1), new_stream, h, term);
+    endif
+    __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
+    fflush (plot_stream(1));
+    if (strcmp (term, "dumb"))
+      fid = -1;
+      while (fid < 0)
+        pause (0.1);
+        fid = fopen (dumb_tmp_file, 'r');
+      endwhile
+      ## reprint the plot on screen
+      [a, count] = fscanf (fid, '%c', Inf);
+      fclose (fid);
+      if (count > 0)
+        if (a(1) == 12)
+          a = a(2:end);  # avoid ^L at the beginning
+        endif
+        puts (a);
+      endif
+      unlink (dumb_tmp_file);
+    endif
+  endif
+
+endfunction
+
+function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
+  ## Generate the gnuplot "set terminal <term> ..." command.
+  ## When "term" originates from print.m, it may include other options.
+  if (nargin < 4)
+    ## This supports the gnuplot graphics toolkit.
+    term = gnuplot_default_term (plot_stream);
+    opts_str = "";
+  else
+    ## Get the one word terminal id and save the remaining as options to be
+    ## passed on to gnuplot.  The terminal may respect the graphics toolkit.
+    [term, opts_str] = gnuplot_trim_term (term);
+    term = lower (term);
+    if (strcmp (term, "lua"))
+      ## Replace "lua tikz" with just "tikz"
+      term = "tikz";
+      opts_str = strrep (opts_str, "tikz", "");
+    endif
+  endif
+
+  if (strfind (opts_str, "noenhanced"))
+    enhanced = false;
+  else
+    enhanced = gnuplot_is_enhanced_term (plot_stream, term);
+  endif
+
+  ## Set the terminal.
+  if (! isempty (term))
+
+    if (enhanced)
+      enh_str = "enhanced";
+    else
+      enh_str = "";
+    endif
+
+    if (! isempty (h) && isfigure (h))
+
+      ## Generate gnuplot title string for plot windows.
+      if (output_to_screen (term) && ! strcmp (term, "dumb"))
+        fig.numbertitle = get (h, "numbertitle");
+        fig.name = strrep (get (h, "name"), '"', '\"');
+        if (strcmp (get (h, "numbertitle"), "on"))
+          title_str = sprintf ("Figure %d", h);
+        else
+          title_str = "";
+        endif
+        if (! isempty (fig.name) && ! isempty (title_str))
+          title_str = sprintf ("%s: %s", title_str, fig.name);
+        elseif (! isempty (fig.name) && isempty (title_str))
+          title_str = fig.name;
+        endif
+        if (! isempty (title_str))
+          title_str = sprintf ('title "%s"', title_str);
+        endif
+        if (strcmp (term, "aqua"))
+          ## Adjust axes-label and tick-label spacing.
+          opts_str = sprintf ('%s font "%s,%d"', opts_str,
+                              get (0, "defaultaxesfontname"),
+                              get (0, "defaultaxesfontsize") / 1.5);
+        endif
+      else
+        title_str = "";
+      endif
+
+      if (! (any (strfind (opts_str, " size ") > 0)
+          || any (strfind (opts_str, "size ") == 1)))
+        ## Get figure size in pixels.  Rely on listener to handle coversion.
+        units = get (h, "units");
+        unwind_protect
+          set (h, "units", "pixels");
+          position_in_pixels = get (h, "position");
+        unwind_protect_cleanup
+          set (h, "units", units);
+        end_unwind_protect
+        gnuplot_pos = position_in_pixels(1:2);
+        gnuplot_size = position_in_pixels(3:4);
+        if (! (output_to_screen (term)
+               || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
+                                      "pbm", "png", "pngcairo", "svg"}))))
+          ## Convert to inches
+          gnuplot_pos = gnuplot_pos / 72;
+          gnuplot_size = gnuplot_size / 72;
+        endif
+        if (all (gnuplot_size > 0))
+          terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
+                                 "gif", "jpeg", "latex", "pbm", "pdf", ...
+                                 "pdfcairo", "postscript", "png", ...
+                                 "pngcairo", "pstex", "pslatex", "svg", "tikz"};
+          if (__gnuplot_has_feature__ ("windows_figure_position"))
+            terminals_with_size{end+1} = "windows";
+          endif
+          if (__gnuplot_has_feature__ ("x11_figure_position"))
+            terminals_with_size{end+1} = "x11";
+          endif
+          if (__gnuplot_has_feature__ ("wxt_figure_size"))
+            terminals_with_size{end+1} = "wxt";
+          endif
+          switch (term)
+            case terminals_with_size
+              size_str = sprintf ("size %.12g,%.12g", gnuplot_size);
+            case "tikz"
+              size_str = sprintf ("size %gin,%gin", gnuplot_size);
+            case "dumb"
+              new_stream = 1;
+              if (!isempty (getenv ("COLUMNS")) && !isempty (getenv ("LINES")))
+                ## Let dumb use full text screen size (minus prompt lines).
+                n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n")));
+                ## n = the number of times \n appears in PS1
+                size_str = ["size " getenv("COLUMNS") "," getenv("LINES") n];
+              else
+                ## Use the gnuplot default.
+                size_str = "";
+              endif
+            case {"aqua", "fig", "corel"}
+              size_str = sprintf ("size %g %g", gnuplot_size);
+            case "dxf"
+              size_str = "";
+            otherwise
+              size_str = "";
+          endswitch
+          if ((strcmp (term, "x11")
+               && __gnuplot_has_feature__ ("x11_figure_position"))
+              || (strcmpi (term, "windows")
+                  && __gnuplot_has_feature__ ("windows_figure_position")))
+            ## X11/Windows allows the window to be positioned as well.
+            units = get (0, "units");
+            unwind_protect
+              set (0, "units", "pixels");
+              screen_size = get (0, "screensize")(3:4);
+            unwind_protect_cleanup
+              set (0, "units", units);
+            end_unwind_protect
+            if (all (screen_size > 0))
+              ## For X11/Windows, set the figure positon as well as the size
+              ## gnuplot position is UL, Octave's is LL (same for screen/window)
+              gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
+              gnuplot_pos = max (gnuplot_pos, 1);
+              size_str = sprintf ("%s position %d,%d", size_str,
+                                  gnuplot_pos(1), gnuplot_pos(2));
+            endif
+          endif
+        else
+          size_str = "";
+          warning ("gnuplot_set_term: size is zero");
+        endif
+      else
+        ## A specified size take priority over the figure properies.
+        size_str = "";
+      endif
+    else
+      if (isempty (h))
+        disp ("gnuplot_set_term: figure handle is empty");
+      elseif (! isfigure (h))
+        disp ("gnuplot_set_term: not a figure handle");
+      endif
+      title_str = "";
+      size_str = "";
+    endif
+
+    ## Set the gnuplot terminal (type, enhanced, title, options & size).
+    term_str = ["set terminal " term];
+    if (! isempty (enh_str))
+      term_str = [term_str " " enh_str];
+    endif
+    if (! isempty (title_str))
+      term_str = [term_str " " title_str];
+    endif
+    if (isempty (strfind (term, "corel")))
+      if (! isempty (size_str) && new_stream)
+        ## size_str comes after other options to permit specification of
+        ## the canvas size for terminals cdr/corel.
+        term_str = [term_str " " size_str];
+      endif
+      if (nargin > 3 && ischar (opts_str))
+        ## Options must go last.
+        term_str = [term_str " " opts_str];
+      endif
+    else
+      if (nargin > 3 && ischar (opts_str))
+        ## Options must go last.
+        term_str = [term_str " " opts_str];
+      endif
+      if (! isempty (size_str) && new_stream)
+        ## size_str comes after other options to permit specification of
+        ## the canvas size for terminals cdr/corel.
+        term_str = [term_str " " size_str];
+      endif
+    endif
+    if (! __gnuplot_has_feature__ ("has_termoption_dashed"))
+      ## If "set termoption dashed" isn't available add "dashed" option
+      ## to the "set terminal ..." command, if it is supported.
+      if (any (strcmp (term, {"aqua", "cgm", "eepic", "emf", "epslatex", ...
+                              "fig", "pcl5", "mp", "next", "openstep", "pdf", ...
+                              "pdfcairo", "pngcairo", "postscript", ...
+                              "pslatex", "pstext", "svg", "tgif", "x11"})))
+        term_str = [term_str " dashed"];
+      endif
+    endif
+    if (any (strcmp (term, {"aqua", "wxt"})))
+      term_str = [term_str, " ", "dashlength 1"];
+    elseif (any (strcmp (term, {"epslatex", "postscript", "pslatex"})))
+      term_str = [term_str, " ", "dashlength 2"];
+    endif
+
+    ## Work around the gnuplot feature of growing the x11 window and
+    ## flickering window (x11, windows, & wxt) when the mouse and
+    ## multiplot are set in gnuplot.
+    fputs (plot_stream, "unset multiplot;\n");
+    flickering_terms = {"x11", "windows", "wxt", "dumb"};
+    if (! any (strcmp (term, flickering_terms))
+        || have_non_legend_axes (h)
+        || numel (findall (h, "type", "image")) > 0)
+      fprintf (plot_stream, "%s\n", term_str);
+      if (nargin == 5)
+        if (! isempty (file))
+          fprintf (plot_stream, "set output '%s';\n", file);
+        endif
+      endif
+      fputs (plot_stream, "set multiplot;\n");
+    elseif (any (strcmp (term, flickering_terms)))
+      fprintf (plot_stream, "%s\n", term_str);
+      if (nargin == 5)
+        if (! isempty (file))
+          fprintf (plot_stream, "set output '%s';\n", file);
+        endif
+      endif
+    endif
+    if (__gnuplot_has_feature__ ("has_termoption_dashed"))
+      fprintf (plot_stream, "set termoption dashed\n")
+    endif
+  else
+    ## gnuplot will pick up the GNUTERM environment variable itself
+    ## so no need to set the terminal type if not also setting the
+    ## figure title, enhanced mode, or position.
+  endif
+
+endfunction
+
+function term = gnuplot_default_term (plot_stream)
+  term = lower (getenv ("GNUTERM"));
+  ## If not specified, guess the terminal type.
+  if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
+    if (isguirunning () && __gnuplot_has_terminal__ ("qt", plot_stream))
+      term = "qt";
+    elseif (ismac ())
+      term = "aqua";
+    elseif (! isunix ())
+      term = "windows";
+    elseif (! isempty (getenv ("DISPLAY")))
+      term = "x11";
+    else
+      term = "dumb";
+    endif
+  endif
+endfunction
+
+function [term, opts] = gnuplot_trim_term (string)
+  ## Extract the terminal type and terminal options (from print.m)
+  string = strtrim (string);
+  [term, opts] = strtok (string, ' ');
+  if (! isempty (opts))
+    opts(1) = "";  # trim extra space from strtok
+  endif
+endfunction
+
+function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
+  ## Don't include pstex, pslatex or epslatex here as the TeX commands
+  ## should not be interpreted in that case.
+  persistent enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", ...
+                                   "jpeg", "pdf", "pdfcairo", "pm", "png", ...
+                                   "pngcairo", "postscript", "qt", "svg",  ...
+                                   "windows", "wxt", "x11"};
+
+  if (nargin < 2)
+    ## Determine the default gnuplot terminal.
+    term = gnuplot_default_term (plot_stream);
+  endif
+  have_enhanced = any (strcmp (term, enhanced_terminals));
+endfunction
+
+function ret = output_to_screen (term)
+  ret = any (strcmpi (term, 
+                     {"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}));
+endfunction
+
+function retval = have_non_legend_axes (h)
+  retval = false;
+  all_axes = findall (h, "type", "axes");
+  if (! isempty (all_axes))
+    n_all_axes = numel (all_axes);
+    all_axes_tags = get (all_axes, "tag");
+    legend_axes = strcmp (all_axes_tags, "legend");
+    if (! isempty (legend_axes))
+      n_legend_axes = sum (legend_axes);
+      retval = (n_all_axes - n_legend_axes) > 1;
+    endif
+  endif
+endfunction
+
+
+## No test needed for internal helper function.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__next_line_color__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,54 @@
+## Copyright (C) 2013 Carl Osterwisch
+## Copyright (C) 2007-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{rgb} =} __next_line_color__ (@var{reset})
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the next line color in the rotation.
+
+## Author: Carl Osterwisch
+## Author: jwe
+
+function rgb = __next_line_color__ (reset)
+
+  persistent reset_colors = true;
+
+  if (nargin == 1)
+    ## Indicates whether the next call will increment or not
+    reset_colors = reset;
+  else
+    ## Find and return the next line color
+    ca = gca ();
+    colororder = get (ca, "colororder");
+    if (reset_colors)
+      color_index = 1;
+      reset_colors = false;
+    else
+      ## Executed when "hold all" is active
+      n_kids = length (get (ca, "children"));
+      n_colors = rows (colororder);
+      color_index = mod (n_kids, n_colors) + 1;
+    endif
+    rgb = colororder(color_index,:);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__next_line_style__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,58 @@
+## Copyright (C) 2010-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset})
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the next line style in the rotation.
+
+
+function [linestyle, marker] = __next_line_style__ (reset)
+
+  persistent reset_style = true;
+
+  if (nargin == 1)
+    ## Indicates whether the next call will increment or not
+    reset_style = reset;
+  else
+    ## Find and return the next line style
+    ca = gca ();
+    style_rotation = get (ca, "linestyleorder");
+    if (ischar (style_rotation))
+      style_rotation = strsplit (style_rotation, "|");
+    endif
+    nStyles = length (style_rotation);
+    if (reset_style || (nStyles < 2))
+      style_index = 1;
+      reset_style = false;
+    else
+      ## Executed when "hold all" is active
+      nChildren = length (get (ca, "Children"));
+      nColors = rows (get (ca, "ColorOrder"));
+      style_index = mod (floor (nChildren/nColors), nStyles) + 1;
+    endif
+    options = __pltopt__ ("__next_line_style__",
+                          style_rotation(style_index));
+    linestyle = options.linestyle;
+    marker = options.marker;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__plt_get_axis_arg__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,67 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{h}, @var{varargin}, @var{narg}] =} __plt_get_axis_arg__ (@var{caller}, @var{varargin})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
+
+  h = [];
+  parent = find (strcmpi (varargin, "parent"), 1);
+  
+
+  ## Look for a scalar which is a graphics handle but not the
+  ## Root Figure (0) or an ordinary figure (integer).
+  if (numel (varargin) > 0 && numel (varargin{1}) == 1
+      && ishandle (varargin{1}) && varargin{1} != 0 && ! isfigure (varargin{1}))
+    htmp = varargin{1};
+    if (! isaxes (htmp))
+      error ("%s: expecting first argument to be axes handle", caller);
+    endif
+    if (! strcmp (get (htmp, "tag"), "legend"))
+      h = htmp;
+      varargin(1) = [];
+    endif
+  ## Look for "parent"/axis prop/value pair
+  elseif (numel (varargin) > 1 && ! isempty (parent))
+    if (parent < numel (varargin) && ishandle (varargin{parent+1}))
+      htmp = varargin{parent+1};
+      if (isaxes (htmp) && ! strcmp (get (htmp, "tag"), "legend"))
+        h = htmp;
+        varargin(parent:parent+1) = [];
+      else
+        ## 'parent' property for some other type like hggroup
+        h = ancestor (htmp, "axes");
+      endif
+    else
+      error ("%s: expecting parent value to be axes handle", caller);
+    endif
+  endif
+
+  narg = length (varargin);
+
+endfunction
+
+
+## No test needed for internal helper function.
+%!assert (1)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/__pltopt__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,235 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
+## Undocumented internal function.
+## @end deftypefn
+
+## @deftypefn {Function File} {} __pltopt__ (@var{caller}, @var{opt})
+##
+## Decode plot option strings.
+##
+## @var{opt} can currently be some combination of the following:
+##
+## @table @code
+## @item "-"
+## For solid linestyle (default).
+##
+## @item "--"
+## For dashed line style.
+##
+## @item "-."
+## For linespoints plot style.
+##
+## @item ":"
+## For dots plot style.
+##
+## @item "r"
+## Red line color.
+##
+## @item "g"
+## Green line color.
+##
+## @item "b"
+## Blue line color.
+##
+## @item "c"
+## Cyan line color.
+##
+## @item "m"
+## Magenta line color.
+##
+## @item "y"
+## Yellow line color.
+##
+## @item "k"
+## Black line color.
+##
+## @item "w"
+## White line color.
+##
+## @item ";title;"
+## Here @code{"title"} is the label for the key.
+##
+## @item "+"
+## @itemx "o"
+## @itemx "*"
+## @itemx "."
+## @itemx "x"
+## @itemx "s"
+## @itemx "d"
+## @itemx "^"
+## @itemx "v"
+## @itemx ">"
+## @itemx "<"
+## @itemx "p"
+## @itemx "h"
+## Used in combination with the points or linespoints styles, set the point
+## style.
+## @end table
+##
+## The legend may be fixed to include the name of the variable
+## plotted in some future version of Octave.
+
+## Author: jwe
+
+function [options, valid] = __pltopt__ (caller, opt, err_on_invalid = true)
+
+  options = __default_plot_options__ ();
+  valid = true;
+
+  if (ischar (opt))
+    opt = cellstr (opt);
+  elseif (! iscellstr (opt))
+    error ("__pltopt__: argument must be a character string or cell array of character strings");
+  endif
+
+  nel = numel (opt);
+
+  for i = nel:-1:1
+    [options(i), valid] = __pltopt1__ (caller, opt{i}, err_on_invalid);
+    if (! err_on_invalid && ! valid)
+      return;
+    endif
+  endfor
+
+endfunction
+
+## Really decode plot option strings.
+
+## Author: Rick Niles <niles@axp745.gsfc.nasa.gov>
+## Adapted-By: jwe
+## Maintainer: jwe
+
+function [options, valid] = __pltopt1__ (caller, opt, err_on_invalid)
+
+  options = __default_plot_options__ ();
+  valid = true;
+
+  have_linestyle = false;
+  have_marker = false;
+
+  ## If called by __errplot__, extract the linestyle before proceeding.
+  if (strcmp (caller, "__errplot__"))
+    if (strncmp (opt, "#~>", 3))
+      n = 3;
+    elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2))
+      n = 2;
+    elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1)
+            || strncmp (opt, "#", 1))
+      n = 1;
+    else
+      n = 0;
+    endif
+    options.errorstyle = opt(1:n);
+    opt(1:n) = [];
+  else
+    options.errorstyle = "~";
+  endif
+
+  while (! isempty (opt))
+    if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2))
+      options.linestyle = opt(1:2);
+      have_linestyle = true;
+      n = 2;
+    else
+      topt = opt(1);
+      n = 1;
+      if (topt == "-" || topt == ":")
+        have_linestyle = true;
+        options.linestyle = topt;
+      elseif (topt == "+" || topt == "o" || topt == "*"
+              || topt == "." || topt == "x" || topt == "s"
+              || topt == "d" || topt == "^" || topt == "v"
+              || topt == ">" || topt == "<" || topt == "p"
+              || topt == "h" || topt == "@")
+        have_marker = true;
+        ## Check for long form marker styles
+        if (any (topt == "sdhp"))
+          if (strncmp (opt, "square", 6))
+            n = 6;
+          elseif (strncmp (opt, "diamond", 7))
+            n = 7;
+          elseif (strncmp (opt, "hexagram", 8))
+            n = 8;
+          elseif (strncmp (opt, "pentagram", 9))
+            n = 9;
+          endif
+        endif
+        ## Backward compatibility.  Leave undocumented.
+        if (topt == "@")
+          topt = "+";
+        endif
+        options.marker = topt;
+      ## Numeric color specs are for backward compatibility.  Don't document.
+      elseif (topt == "k" || topt == "0")
+        options.color = [0, 0, 0];
+      elseif (topt == "r" || topt == "1")
+        options.color = [1, 0, 0];
+      elseif (topt == "g" || topt == "2")
+        options.color = [0, 1, 0];
+      elseif (topt == "b" || topt == "3")
+        options.color = [0, 0, 1];
+      elseif (topt == "y")
+        options.color = [1, 1, 0];
+      elseif (topt == "m" || topt == "4")
+        options.color = [1, 0, 1];
+      elseif (topt == "c" || topt == "5")
+        options.color = [0, 1, 1];
+      elseif (topt == "w" || topt == "6")
+        options.color = [1, 1, 1];
+      elseif (isspace (topt))
+        ## Do nothing.
+      elseif (topt == ";")
+        t = index (opt(2:end), ";");
+        if (t)
+          options.key = opt(2:t);
+          n = t+1;
+        else
+          if (err_on_invalid)
+            error ("%s: unfinished key label", caller);
+          else
+            valid = false;
+            options = __default_plot_options__ ();
+            return;
+          endif
+        endif
+      else
+        if (err_on_invalid)
+          error ("%s: unrecognized format character: '%s'", caller, topt);
+        else
+          valid = false;
+          options = __default_plot_options__ ();
+          return;
+        endif
+      endif
+    endif
+    opt(1:n) = [];
+  endwhile
+
+  if (! have_linestyle && have_marker)
+    options.linestyle = "none";
+  endif
+
+  if (have_linestyle && ! have_marker)
+    options.marker = "none";
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/allchild.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,64 @@
+## Copyright (C) 2008-2012 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} allchild (@var{handles})
+## Find all children, including hidden children, of a graphics object.
+##
+## This function is similar to @code{get (h, "children")}, but also returns
+## hidden objects (HandleVisibility = @qcode{"off"}).  If @var{handles} is a
+## scalar, @var{h} will be a vector.  Otherwise, @var{h} will be a cell
+## matrix of the same size as @var{handles} and each cell will contain a
+## vector of handles.
+## @seealso{findall, findobj, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+
+function h = allchild (handles)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  shh = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    h = get (handles, "children");
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", shh);
+  end_unwind_protect
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   kids = allchild (hf);
+%!   assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"; "uimenu"});
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!error allchild ()
+%!error allchild (1, 2)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ancestor.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,116 @@
+## Copyright (C) 2007-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{parent} =} ancestor (@var{h}, @var{type})
+## @deftypefnx {Function File} {@var{parent} =} ancestor (@var{h}, @var{type}, "toplevel")
+## Return the first ancestor of handle object @var{h} whose type matches
+## @var{type}, where @var{type} is a character string.  If @var{type} is a
+## cell array of strings, return the first parent whose type matches
+## any of the given type strings.
+##
+## If the handle object @var{h} itself is of type @var{type}, return @var{h}.
+##
+## If @qcode{"toplevel"} is given as a third argument, return the highest
+## parent in the object hierarchy that matches the condition, instead
+## of the first (nearest) one.
+## @seealso{findobj, findall, allchild}
+## @end deftypefn
+
+function p = ancestor (h, type, toplevel)
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (ischar (type))
+    type = { type };
+  elseif (! iscellstr (type))
+    error ("ancestor: TYPE must be a string or cell array of strings");
+  endif
+
+  find_first = true;
+  if (nargin == 3)
+    if (ischar (toplevel) && strcmpi (toplevel, "toplevel"))
+      find_first = false;
+    else
+      error ('ancestor: third argument must be "toplevel"');
+    endif
+  endif
+
+  if (isempty (h))
+    p = [];
+  else
+    p = cell (numel (h), 1);
+    h = num2cell (h);
+    for nh = 1:numel (h)
+      while (true)
+        if (isempty (h{nh}) || ! ishandle (h{nh}))
+          break;
+        endif
+        if (any (strcmpi (get (h{nh}, "type"), type)))
+          p{nh} = h{nh};
+          if (find_first)
+            break;
+          endif
+        endif
+        h{nh} = get (h{nh}, "parent");
+      endwhile
+    endfor
+    if (nh == 1)
+      p = p{1};
+    endif
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hl = line;
+%!   assert (ancestor (hl, "axes"), gca);
+%!   assert (ancestor (hl, "figure"), hf);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!    hg1 = hggroup ("parent", gca);
+%!    hg2 = hggroup ("parent", hg1);
+%!    hl = line ("parent", hg2);
+%!    assert (ancestor (hl, "line"), hl);
+%!    assert (ancestor (hl, "axes"), gca);
+%!    assert (ancestor (hl, "figure"), hf);
+%!    assert (ancestor (hl, "hggroup"), hg2);
+%!    assert (ancestor (hl, "hggroup", "toplevel"), hg1);
+%!    assert (ancestor (hl, {"hggroup", "axes"}), hg2);
+%!    assert (ancestor (hl, {"hggroup", "axes"}, "toplevel"), gca);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!assert (ancestor ([], "axes"), [])
+
+%!error ancestor ()
+%!error ancestor (1,2,3)
+%!error <TYPE must be a string> ancestor (1,2)
+%!error <third argument must be "toplevel"> ancestor (1, "axes", "foo")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/axes.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,82 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} axes ()
+## @deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} axes (@var{hax})
+## @deftypefnx {Function File} {@var{h} =} axes (@dots{})
+## Create an axes object and return a handle to it, or set the current
+## axes to @var{hax}.
+##
+## Called without any arguments, or with @var{property}/@var{value} pairs,
+## construct a new axes.  For accepted properties and corresponding
+## values, @pxref{XREFset,,set}.
+##
+## Called with a single axes handle argument @var{hax}, the function makes
+## @var{hax} the current axis.  It also restacks the axes in the
+## corresponding figure so that @var{hax} is the first entry in the list
+## of children.  This causes @var{hax} to be displayed on top of any other
+## axes objects (Z-order stacking).
+## 
+## @seealso {gca, set, get}
+## @end deftypefn
+
+## Author: jwe
+
+function h = axes (varargin)
+
+  if (nargin == 0 || nargin > 1)
+    ## Create an axes object.
+    idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first");
+    if (! isempty (idx) && length (varargin) >= 2*idx)
+      cf = varargin{2*idx};
+      varargin([2*idx-1, 2*idx]) = [];
+    else
+      cf = gcf ();
+    endif
+    htmp = __go_axes__ (cf, varargin{:});
+    if (__is_handle_visible__ (htmp))
+      set (ancestor (cf, "figure"), "currentaxes", htmp);
+    endif
+  else
+    ## ARG is axes handle.
+    htmp = varargin{1};
+    if (isscalar (htmp) && isaxes (htmp))
+      if (__is_handle_visible__ (htmp))
+        parent = ancestor (htmp, "figure");
+        set (0, "currentfigure", parent);
+        set (parent, "currentaxes", htmp);
+
+        ## restack
+        ch = get (parent, "children")(:);
+        idx = (ch == htmp);
+        ch = [ch(idx); ch(!idx)];
+        set (parent, "children", ch);
+      endif
+    else
+      error ("axes: H must be a scalar axes handle");
+    endif
+  endif
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/cla.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,108 @@
+## Copyright (C) 2008-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} cla
+## @deftypefnx {Command} {} cla reset
+## @deftypefnx {Function File} {} cla (@var{hax})
+## @deftypefnx {Function File} {} cla (@var{hax}, "reset")
+## Clear the current axes.
+##
+## @code{cla} operates by deleting child graphic objects with visible
+## handles (HandleVisibility = @qcode{"on"}).
+##
+## If the optional argument @qcode{"reset"} is specified, delete all child
+## objects including those with hidden handles and reset all axis properties
+## to their defaults.  However, the following properties are not reset:
+## Position, Units.
+##
+## If the first argument @var{hax} is an axes handle, then operate on
+## this axis rather than the current axes returned by @code{gca}.
+## @seealso{clf, delete, reset}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2008-10-03
+
+function cla (varargin)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    hax = gca;
+    do_reset = false;
+  elseif (nargin == 1)
+    if (isscalar (varargin{1}) && isaxes (varargin{1}))
+      hax = varargin{1};
+      do_reset = false;
+    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
+      hax = gca;
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  else
+    if (isscalar (varargin{1}) && isaxes (varargin{1})
+        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
+      hax = varargin{1};
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (! do_reset)
+    delete (get (hax, "children"));
+  else
+    __go_axes_init__ (hax, "replace");
+    __request_drawnow__ ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (1:10);
+%!   assert (! isempty (get (gca, "children")));
+%!   cla ();
+%!   assert (isempty (get (gca, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = gca;
+%!   plot (hax, 1:10);
+%!   set (hax, "interpreter", "tex");
+%!   cla (hax);
+%!   kids = get (hax, "children");
+%!   assert (numel (kids), 0);
+%!   assert (get (hax, "interpreter"), "tex");
+%!   plot (hax, 1:10);
+%!   cla (hax, "reset");
+%!   kids = get (hax, "children");
+%!   assert (numel (kids), 0);
+%!   assert (get (hax, "interpreter"), "none");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/clf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,124 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} clf
+## @deftypefnx {Command} {} clf reset
+## @deftypefnx {Function File} {} clf (@var{hfig})
+## @deftypefnx {Function File} {} clf (@var{hfig}, "reset")
+## @deftypefnx {Function File} {@var{h} =} clf (@dots{})
+## Clear the current figure window.
+## 
+## @code{clf} operates by deleting child graphics objects with visible
+## handles (HandleVisibility = @qcode{"on"}).
+##
+## If the optional argument @qcode{"reset"} is specified, delete all child
+## objects including those with hidden handles and reset all figure
+## properties to their defaults.  However, the following properties are not
+## reset: Position, Units, PaperPosition, PaperUnits.
+##
+## If the first argument @var{hfig} is a figure handle, then operate on
+## this figure rather than the current figure returned by @code{gcf}.
+## 
+## The optional return value @var{h} is the graphics handle of the figure
+## window that was cleared.
+## @seealso{cla, close, delete, reset}
+## @end deftypefn
+
+## Author: jwe
+
+function h = clf (varargin)
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    hfig = gcf;
+    do_reset = false;
+  elseif (nargin == 1)
+    if (isscalar (varargin{1}) && isfigure (varargin{1}))
+      hfig = varargin{1};
+      do_reset = false;
+    elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "reset"))
+      hfig = gcf;
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  else
+    if (isscalar (varargin{1}) && isfigure (varargin{1})
+        && ischar (varargin{2}) && strcmpi (varargin{2}, "reset"))
+      hfig = varargin{1};
+      do_reset = true;
+    else
+      print_usage ();
+    endif
+  endif
+
+  if (do_reset)
+    ## Select all the children, including the one with hidden handles.
+    delete (allchild (hfig));
+    reset (hfig);
+  else
+    ## Select only the chilren with visible handles.
+    delete (get (hfig, "children"));
+  endif
+
+  if (nargout > 0)
+    h = hfig;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   assert (! isempty (get (gcf, "children")));
+%!   clf;
+%!   assert (isempty (get (gcf, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   clf;
+%!   assert (isempty (get (gcf, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!xtest
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (1:10);
+%!   set (hf, "papertype", "tabloid");
+%!   clf (hf);
+%!   assert (isempty (get (gcf, "children")));
+%!   assert (get (hf, "papertype"), "tabloid");
+%!   plot (1:10);
+%!   clf (hf, "reset");
+%!   kids = get (hf, "children");
+%!   assert (isempty (get (gcf, "children")));
+%!   assert (get (hf, "papertype"), "usletter");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/close.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,109 @@
+## Copyright (C) 2002-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} close
+## @deftypefnx {Command} {} close (@var{h})
+## @deftypefnx {Command} {} close all
+## @deftypefnx {Command} {} close all hidden
+## Close figure window(s).
+##
+## When called with no arguments, close the current figure.  This is equivalent
+## to @code{close (gcf)}.  If the input @var{h} is a graphic handle, or vector
+## of graphics handles, then close each figure in @var{h}.
+##
+## If the argument @qcode{"all"} is given then all figures with visible handles
+## (HandleVisibility = @qcode{"on"}) are closed.
+##
+## If the argument @qcode{"all hidden"} is given then all figures, including
+## hidden ones, are closed.
+##
+## Implementation Note: @code{close} operates by calling the function specified
+## by the @qcode{"closerequestfcn"} property for each figure.  By default, the
+## function @code{closereq} is used.  It is possible that the function invoked
+## will delay or abort removing the figure.  To remove a figure without
+## executing any callback functions use @code{delete}.  When writing a callback
+## function to close a window do not use @code{close} to avoid recursion.
+##
+## @seealso{closereq, delete}
+## @end deftypefn
+
+## Author: jwe
+## 2010-05-02   PBig    allow empty argument
+
+function retval = close (arg1, arg2)
+
+  figs = [];
+
+  if (nargin > 2)
+    print_usage ();
+  elseif (nargin == 0)
+    ## Close current figure.
+    ## Can't use gcf because it opens a new plot window if one does not exist.
+    figs = get (0, "currentfigure");
+    if (figs == 0)  # don't close root figure
+      figs = [];
+    endif
+  elseif (nargin == 1)
+    if (ischar (arg1) && strcmpi (arg1, "all"))
+      figs = (get (0, "children"))';
+      figs = figs(isfigure (figs));
+    elseif (isfigure (arg1))
+      figs = arg1;
+    elseif (isempty (arg1))
+      figs = [];
+    else
+      error ('close: first argument must be "all" or a figure handle');
+    endif
+  elseif (   ischar (arg1) && strcmpi (arg1, "all")
+          && ischar (arg2) && strcmpi (arg2, "hidden"))
+    figs = (allchild (0))';
+    figs = figs(isfigure (figs));
+  else
+    error ('close: expecting argument to be "all hidden"');
+  endif
+
+  for h = figs
+    __go_execute_callback__ (h, "closerequestfcn");
+  endfor
+
+  if (nargout > 0)
+    retval = 1;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   close (hf);
+%!   objs = findobj ("type", "figure");
+%!   assert (! any (objs == hf));
+%! unwind_protect_cleanup
+%!   if (isfigure (hf))
+%!     close (hf);
+%!   endif
+%! end_unwind_protect
+
+%!error close (1,2,3)
+%!error <first argument must be "all" or a figure> close ({"all"})
+%!error <first argument must be "all" or a figure> close ("all_and_more")
+%!error <first argument must be "all" or a figure> close (-1)
+%!error <expecting argument to be "all hidden"> close "all" hid"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/closereq.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,46 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} closereq ()
+## Close the current figure and delete all graphics objects associated with it.
+##
+## By default, the @qcode{"closerequestfcn"} property of a new plot figure
+## points to this function.
+## @seealso{close, delete}
+## @end deftypefn
+
+## Author: jwe
+
+function closereq ()
+
+  if (nargin != 0)
+    print_usage ();
+  endif
+
+  cf = gcbf ();
+  if (isempty (cf))
+    warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
+    cf = get (0, "currentfigure");
+  endif
+  if (! isempty (cf) && isfigure (cf))
+    delete (cf);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/colstyle.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,90 @@
+## Copyright (C) 2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{style}, @var{color}, @var{marker}, @var{msg}] =} colstyle (@var{linespec})
+## Parse @var{linespec} and return the line style, color, and markers given.
+## In the case of an error, the string @var{msg} will return the text of the
+## error.
+## @end deftypefn
+
+function [l, c, m, msg] = colstyle (style)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  if (! ischar (style))
+    error ("colstyle: STYLE must be a string");
+  endif
+
+  try
+    opt = __pltopt__ ("colstyle", style);
+    l = opt.linestyle;
+    c = opt.color;
+    m = opt.marker;
+    msg = [];
+    switch (c)
+      case [0 0 0]
+        c = "k";
+      case [1 0 0]
+        c = "r";
+      case [0 1 0]
+        c = "g";
+      case [0 0 1]
+        c = "b";
+      case [1 1 0]
+        c = "y";
+      case [1 0 1]
+        c = "m";
+      case [0 1 1]
+        c = "c";
+      case [0 1 1]
+        c = "w";
+    endswitch
+  catch
+    l = c = m = [];
+    msg = lasterr ();
+  end_try_catch
+
+endfunction
+
+
+%!test
+%! [l, c, m, msg] = colstyle ("r:x");
+%! assert (isempty (msg));
+%! assert (l, ":");
+%! assert (c, "r");
+%! assert (m, "x");
+
+%!test
+%! [l, c, m, msg] = colstyle (".");
+%! assert (isempty (msg));
+%! assert (l, "none");
+%! assert (c, []);
+%! assert (m, ".");
+
+%!test
+%! [l, c, m, msg] = colstyle ("~");
+%! assert (msg, "colstyle: unrecognized format character: '~'");
+
+%% Test input validation
+%!error colstyle ()
+%!error colstyle (1, 2)
+%!error colstyle (1.5)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/copyobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,154 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hnew} =} copyobj (@var{horig})
+## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
+## Construct a copy of the graphic object associated with handle @var{horig}
+## and return a handle @var{hnew} to the new object.
+##
+## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
+## specified, the copied object will be created as a child of @var{hparent}.
+## @seealso{struct2hdl, hdl2struct, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-04-01
+
+function hnew = copyobj (horig, hparent = 0)
+
+  partypes = {"root", "figure", "axes", "hggroup"};
+  othertypes = {"line", "patch", "surface", "image", "text"};
+  alltypes = [partypes othertypes];
+
+  if (! ishandle (horig) || nargin > 2)
+    print_usage ();
+  elseif (! ishandle (hparent))
+    hparent = figure (fix (hparent));
+  elseif (! any (strcmpi (get (hparent).type, partypes)))
+    print_usage ();
+  endif
+
+  ## current figure and axes
+  cf = gcf ();
+  ca = gca ();
+  
+  ## compatibility of input handles
+  kididx = find (strcmp (alltypes, get (horig).type));
+  paridx = find (strcmp (alltypes, get (hparent).type));
+
+  if (kididx <= paridx)
+    error ("copyobj: %s object can't be children to %s.",
+           alltypes{kididx}, alltypes{paridx});
+  elseif (nargin == 1)
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str);
+  else
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str, hparent);
+  endif
+
+  ## reset current figure (and eventually axes) to original
+  set (0, "currentfigure", cf);
+  if (get (hnew, "parent") == cf)
+    set (cf, "currentaxes", ca)
+  endif
+  
+endfunction
+
+
+%!demo
+%! hdl = figure (1234);
+%! clf;
+%! hold on;
+%! x = 1:10;
+%! y = x.^2;
+%! dy = 2 * (.2 * x);
+%! y2 = (x - 3).^2;
+%! hg = errorbar (x, y, dy,'#~');
+%! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
+%! plot (x, y2, 'ok-');
+%! legend ('errorbar', 'line');
+%! hnew = copyobj (hdl);
+
+%!#demo
+%! ## FIXME: This demo fails for an obscure reason.
+%! ## It appears that there is something wrong with Octave code for patches.
+%! ## This demo must remain commented out until patch() has been reworked.
+%! unwind_protect
+%!   hdl = figure (1234);
+%!   clf;
+%!   subplot (2,2,1);
+%!   hold on;
+%!   contourf (rand (10, 10));
+%!   colorbar ();
+%!   subplot (2,2,2);
+%!   quiver (rand (10, 10), rand (10, 10));
+%!   subplot (2,2,3);
+%!   colormap (jet (64));
+%!   hold on;
+%!   sombrero ();
+%!   colorbar ('peer', gca, 'NorthOutside');
+%!   subplot (2,2,4);
+%!   imagesc (rand (30, 30));
+%!   text (15, 15, 'Rotated text', ...
+%!         'HorizontAlalignment', 'Center', 'Rotation', 30);
+%!   hnew = copyobj (hdl);
+%! unwind_protect_cleanup
+%!   close all;
+%! end_unwind_protect
+
+%!testif HAVE_MAGICK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("gnuplot");
+%! unwind_protect
+%!   h1 = figure ("visible", "off");
+%!   x = 0:0.1:2*pi;
+%!   y1 = sin (x);
+%!   y2 = exp (x - 1);
+%!   ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
+%!   xlabel ("X");
+%!   ylabel (ax(1), "Axis 1");
+%!   ylabel (ax(2), "Axis 2");
+%!   axes (ax(1));
+%!   text (0.5, 0.5, "Left Axis", ...
+%!         "color", [0 0 1], "horizontalalignment", "center");
+%!   axes (ax(2));
+%!   text (4.5, 80, "Right Axis", ...
+%!         "color", [0 0.5 0], "horizontalalignment", "center");
+%!   s1 = hdl2struct (h1);
+%!   h2 = struct2hdl (s1);
+%!   s2 = hdl2struct (h2);
+%!   png1 = strcat (tmpnam (), ".png");
+%!   png2 = strcat (tmpnam (), ".png");
+%!   unwind_protect
+%!     print (h1, png1);
+%!     [img1, map1, alpha1] = imread (png1);
+%!     print (h2, png2);
+%!     [img2, map2, alpha2] = imread (png2);
+%!   unwind_protect_cleanup
+%!     unlink (png1);
+%!     unlink (png2);
+%!   end_unwind_protect
+%!   assert (img1, img2);
+%!   assert (map1, map2);
+%!   assert (alpha1, alpha2);
+%! unwind_protect_cleanup
+%!   close (h1);
+%!   close (h2);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/figure.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,127 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} figure
+## @deftypefnx {Command} {} figure @var{n}
+## @deftypefnx {Function File} {} figure (@var{n})
+## @deftypefnx {Function File} {} figure (@dots{}, "@var{property}", @var{value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} figure (@var{dots})
+## Create a new figure window for plotting.
+##
+## If no arguments are specified, a new figure with the next available number
+## is created.
+##
+## If called with an integer @var{n}, and no such numbered figure exists, then
+## a new figure with the specified number is created.  If the figure already
+## exists then it is made visible and becomes the current figure for plotting.
+## 
+## Multiple property-value pairs may be specified for the figure object, but
+## they must appear in pairs.
+##
+## The optional return value @var{h} is a graphics handle to the created figure
+## object.
+## @seealso{axes, gcf, clf, close}
+## @end deftypefn
+
+## Author: jwe, Bill Denney
+
+function h = figure (varargin)
+
+  nargs = nargin;
+
+  if (mod (nargs, 2) == 0)
+    f = NaN;
+    init_new_figure = true;
+  else
+    arg = varargin{1};
+    if (ischar (arg))
+      arg = str2double (arg);
+    endif
+    if (isfigure (arg))
+      f = arg;
+      init_new_figure = false;
+      varargin(1) = [];
+      nargs--;
+    elseif (isnumeric (arg) && isscalar (arg) && arg > 0 && arg == fix (arg))
+      f = arg;
+      init_new_figure = true;
+      varargin(1) = [];
+      nargs--;
+    else
+      error ("figure: N must be figure handle or figure number");
+    endif
+  endif
+
+  if (rem (nargs, 2) == 1)
+    error ("figure: PROPERTY/VALUE arguments must be in pairs");
+  endif
+
+  ## Check to see if we already have a figure on the screen.  If we do,
+  ## then update it if it is different from the figure we are creating
+  ## or switching to.
+  cf = get (0, "currentfigure");   # Can't use gcf () because it calls figure()
+  if (! isempty (cf) && cf != 0)
+    if (init_new_figure || cf != f)
+      drawnow ();
+    endif
+  endif
+
+  if (init_new_figure)
+    if (ismac () && strcmp (graphics_toolkit (), "fltk"))
+      ## FIXME: Hack for fltk-aqua to work around bug #31931
+      f = __go_figure__ (f);
+      drawnow ();
+      if (! isempty (varargin))
+        set (f, varargin{:});
+      endif
+    else
+      f = __go_figure__ (f, varargin{:});
+    endif
+    __add_default_menu__ (f);
+  elseif (nargs > 0)
+    set (f, varargin{:});
+  endif
+
+  set (0, "currentfigure", f);
+  ## When switching to figure N, make figure visible and on top of stack.
+  if (! init_new_figure)
+    set (f, "visible", "on");
+  endif
+
+  if (nargout > 0)
+    h = f;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (hf, gcf);
+%!   assert (isfigure (hf));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!error <N must be figure handle or figure number> figure ({1})
+%!error <N must be figure handle or figure number> figure ([1 2])
+%!error <N must be figure handle or figure number> figure (-1)
+%!error <N must be figure handle or figure number> figure (1.5)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findall.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,65 @@
+## Copyright (C) 2008-2012 Bill Denney
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} findall ()
+## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
+## @deftypefnx {Function File} {@var{h} =} findall ("-property", @var{prop_name})
+## @deftypefnx {Function File} {@var{h} =} findall ("-regexp", @var{prop_name}, @var{pattern})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "flat", @dots{})
+## @deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "-depth", @var{d}, @dots{})
+## Find graphics object, including hidden ones, with specified property values.
+##
+## The return value @var{h} is a list of handles to the found graphic objects.
+##
+## @code{findall} performs the same search as @code{findobj}, but it
+## includes hidden objects (HandleVisibility = @qcode{"off"}).  For full
+## documentation, @pxref{XREFfindobj,,findobj}.
+## @seealso{findobj, allchild, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+
+function h = findall (varargin)
+
+  unwind_protect
+    shh = get (0, "showhiddenhandles");
+    set (0, "showhiddenhandles", "on");
+    h = findobj (varargin{:});
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", shh);
+  end_unwind_protect
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ("fltk");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = findall (hf);
+%!   all_handles(1) = {"figure"};
+%!   all_handles(2:14,1) = {"uimenu"};
+%!   assert (get (h, "type"), all_handles);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findfigs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,77 @@
+## Copyright (C) 2008 Bill Denney
+## Copyright (C) 2012 Carnë Draug
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} findfigs ()
+## Find all visible figures that are currently off the screen and move them
+## onto the screen.
+## @seealso{allchild, figure, get, set}
+## @end deftypefn
+
+## Author: Bill Denney <bill@denney.ws>
+## Modified by: Carnë Draug <carandraug+dev@gmail.com>
+
+function findfigs ()
+
+  hfigs = allchild (0);
+  units = get (0, "units");
+  unwind_protect
+    set (0, "units", "pixels");
+    screensize = get (0, "screensize");
+  unwind_protect_cleanup
+    set (0, "units", units);
+  end_unwind_protect
+
+  ## give the monitor a margin so that the figure must not just
+  ## marginally be on the monitor.
+  margin = 30;
+  screensize(1:2) += margin;
+  screensize(3:4) -= margin;
+
+  hfigs = hfigs(strcmp (get (hfigs, "visible"), "on"));
+  for hf = hfigs'
+    units = get (hf, "units");
+    unwind_protect
+      set (hf, "units", "pixels");
+      pos = get (hf, "position");
+      ## Test if (in order):
+      ## The left side is outside the right side of the screen
+      ## The bottom is above the top of the screen
+      ## The right side is outside the left of the screen
+      ## the top is below the bottom of the screen
+      if (pos(1) > screensize(3)
+          || pos(2) > screensize(4)
+          || pos(1)+pos(3) < screensize(1)
+          || pos(2)+pos(4) < screensize(2))
+
+        ## the new position will be at the top left of the screen
+        ## (all moved figures will overlap).  The bottom left is chosen
+        ## instead of the top left because that allows for the unknown
+        ## amount of space for the menu bar and the title bar.
+        pos(1) = screensize(1);
+        pos(2) = screensize(2);
+        set (hf, "position", pos);
+      endif
+    unwind_protect_cleanup
+      set (hf, "units", units);
+    end_unwind_protect
+  endfor
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/findobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,420 @@
+## Copyright (C) 2007-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} findobj ()
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
+## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name})
+## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "flat", @dots{})
+## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "-depth", @var{d}, @dots{})
+## Find graphics object with specified property values.
+##
+## The simplest form is
+##
+## @example
+## findobj (@var{prop_name}, @var{prop_value})
+## @end example
+##
+## @noindent
+## which returns the handles of all objects which have a property named
+## @var{prop_name} that has the value @var{prop_value}.  If multiple
+## property/value pairs are specified then only objects meeting all of the
+## conditions are returned.
+##
+## The search can be limited to a particular set of objects and their
+## descendants, by passing a handle or set of handles @var{hlist} as the first
+## argument.
+##
+## The depth of the object hierarchy to search can be limited with the
+## @qcode{"-depth"} argument.  An example of searching only three generations
+## of children is:
+##
+## @example
+## findobj (@var{hlist}, "-depth", 3, @var{prop_name}, @var{prop_value})
+## @end example
+##
+## Specifying a depth @var{d} of 0, limits the search to the set of objects
+## passed in @var{hlist}.  A depth @var{d} of 0 is equivalent to the
+## @qcode{"flat"} argument.
+##
+## A specified logical operator may be applied to the pairs of @var{prop_name}
+## and @var{prop_value}.  The supported logical operators are:
+## @qcode{"-and"}, @qcode{"-or"},
+## @qcode{"-xor"}, @qcode{"-not"}.
+##
+## Objects may also be matched by comparing a regular expression to the
+## property values, where property values that match
+## @code{regexp (@var{prop_value}, @var{pattern})} are returned.
+##
+## Finally, objects may be matched by property name only by using the
+## @qcode{"-property"} option.
+##
+## Implementation Note: The search only includes objects with visible
+## handles (HandleVisibility = @qcode{"on"}).  @xref{XREFfindall,,findall}, to
+## search for all objects including hidden ones.
+## @seealso{findall, allchild, get, set}
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+
+function h = findobj (varargin)
+
+  depth = NaN;
+  if (nargin == 0)
+    handles = 0;
+    n1 = 0;
+  else
+    if (! isempty (varargin{1}))
+      if (ishandle (varargin{1}(1)))
+        handles = varargin{1};
+        n1 = 2;
+      else
+        handles = 0;
+        n1 = 1;
+      endif
+    else
+      ## Return [](0x1) for compatibility.
+      h = zeros (0, 1);
+      return;
+    endif
+    if (n1 <= nargin)
+      if (ischar (varargin{n1}))
+        if (strcmpi (varargin{n1}, "flat"))
+          depth = 0;
+          n1 = n1 + 1;
+        elseif (strcmpi (varargin{n1}, "-depth"))
+          depth = varargin{n1+1};
+          n1 = n1 + 2;
+        endif
+      else
+        error ("findobj: properties and options must be strings");
+      endif
+    endif
+  endif
+
+  if (n1 <= nargin && nargin > 0)
+    args = varargin(n1 : nargin);
+  else
+    args = {};
+  endif
+
+  regularexpression = [];
+  property          = [];
+  logicaloperator   = {};
+  pname             = {};
+  pvalue            = {};
+  np = 1;
+  na = 1;
+  operatorprecedence = {"-not", "-and", "-or", "-xor"};
+
+  while (na <= numel (args))
+    regularexpression(np) = 0;
+    property(np) = 0;
+    logicaloperator{np} = "and";
+    if (ischar (args{na}))
+      if (strcmpi (args{na}, "-regexp"))
+        if (na + 2 <= numel (args))
+          regularexpression(np) = 1;
+          na = na + 1;
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = args{na};
+          na = na + 1;
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      elseif (strcmpi (args{na}, "-property"))
+        if (na + 1 <= numel (args))
+          na = na + 1;
+          property(np) = 1;
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = [];
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      elseif (! strcmp (args{na}(1), "-"))
+        ## Parameter/value pairs.
+        if (na + 1 <= numel (args))
+          pname{np} = args{na};
+          na = na + 1;
+          pvalue{np} = args{na};
+          na = na + 1;
+          if (na <= numel (args))
+            if (ischar (args{na}))
+              if (any (strcmpi (args{na}, operatorprecedence)))
+                logicaloperator{np} = args{na}(2:end);
+                na = na+1;
+              endif
+            else
+              error ("findobj: properties and options must be strings");
+            endif
+          else
+            logicaloperator{np} = "and";
+          endif
+          np = np + 1;
+        else
+          error ("findobj: inconsistent number of arguments");
+        endif
+      else
+        ## This is sloppy ... but works like Matlab.
+        if (strcmpi (args{na}, "-not"))
+          h = [];
+          return;
+        endif
+        na = na + 1;
+      endif
+    else
+      error ("findobj: properties and options must be strings");
+    endif
+  endwhile
+
+  numpairs = np - 1;
+  if (! isempty (logicaloperator))
+    logicaloperator = shift (logicaloperator, 1);
+  endif
+
+  ## Load all objects which qualify for being searched.
+  idepth = 0;
+  h = handles;
+  while (numel (handles) && ! (idepth >= depth))
+    children = [];
+    for n = 1 : numel (handles)
+      children = [children; get(handles(n), "children")];
+    endfor
+    handles = children;
+    h = [h; children];
+    idepth = idepth + 1;
+  endwhile
+
+  if (numpairs > 0)
+    match = true (numel (h), numpairs);
+    for nh = 1 : numel (h)
+      p = get (h(nh));
+      for np = 1 : numpairs
+        fields = fieldnames (p);
+        fieldindex = find (strcmpi (fields, pname{np}), 1);
+        if (numel (fieldindex))
+          pname{np} = fields{fieldindex};
+          if (property(np))
+            match(nh,np) = true;
+          else
+            if (regularexpression(np))
+              foo = regexp (p.(pname{np}), pvalue{np}, "once");
+              if (isempty (foo))
+                match(nh,np) = false;
+              else
+                match(nh,np) = foo;
+              endif
+            elseif (numel (p.(pname{np})) == numel (pvalue{np}))
+              if (ischar (pvalue{np}) && ischar (p.(pname{np})))
+                match(nh,np) = strcmpi (pvalue{np}, p.(pname{np}));
+              elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np}))))
+                match(nh,np) = (pvalue{np} == p.(pname{np}));
+              else
+                match(nh,np) = isequal (pvalue{np}, p.(pname{np}));
+              endif
+            else
+              match(nh,np) = false;
+            endif
+          endif
+        else
+          match(nh,np) = false;
+        endif
+      endfor
+    endfor
+
+    if (numpairs > 1)
+      for no = 1 : numel (operatorprecedence)
+        pairs = find (strcmp (logicaloperator(2:end), ...
+                              operatorprecedence{no}(2:end)));
+        for np = sort (pairs, "descend")
+          if (no == 1)
+            match(:,np+1) = ! match(:,np+1);
+            logicaloperator(np+1) = {"and"};
+          else
+            match(:,np) = feval (logicaloperator{np+1}, match(:,np), ...
+                                 match(:,np+1));
+            logicaloperator(np+1) = [];
+            match(:,np+1) = [];
+            numpairs = numpairs - 1;
+          endif
+          if (numpairs < 2)
+            break;
+          endif
+        endfor
+        if (numpairs < 2)
+          break;
+        endif
+      endfor
+    endif
+  else
+    match = true (numel (h), 1);
+  endif
+
+  h = h(match);
+  h = h(:);
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = findobj (gca (), "-property", "foo");
+%!   assert (isempty (h));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = plot (1:10);
+%!   set (h, "tag", "foobar");
+%!   g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]);
+%!   assert (g, h);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   l = line;
+%!   obj = findobj (hf, "type", "line");
+%!   assert (l, obj);
+%!   assert (gca, findobj (hf, "type", "axes"));
+%!   assert (hf, findobj (hf, "type", "figure"));
+%!   assert (isempty (findobj (hf, "type", "xyzxyz")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   subplot (2,2,1);
+%!    imagesc (rand (10));
+%!   subplot (2,2,2);
+%!    surf (peaks);
+%!   subplot (2,2,3);
+%!    contour (peaks);
+%!   subplot (2,2,4);
+%!    plot (peaks);
+%!   h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup");
+%!   h2 = findobj (gcf (), "Type", "image",
+%!                  "-or", "Type", "surface",
+%!                  "-or", "Type", "hggroup");
+%!   assert (h2, h1);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2,2,1);
+%!   h2 = subplot (2,2,2);
+%!   h3 = subplot (2,2,3, "userdata", struct ("foo", "bar"));
+%!   h4 = subplot (2,2,4);
+%!   h = findobj (hf, "userdata", struct ("foo", "bar"));
+%!   assert (h, h3);
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!test
+%! toolkit = graphics_toolkit ("gnuplot");
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2,2,1, "tag", "1");
+%!   h2 = subplot (2,2,2, "tag", "2");
+%!   h3 = subplot (2,2,3, "tag", "3");
+%!   h4 = subplot (2,2,4, "tag", "4");
+%!   h = findobj (hf, "type", "axes", "-not", "tag", "1");
+%!   assert (h, [h4; h3; h2])
+%! unwind_protect_cleanup
+%!   close (hf);
+%!   graphics_toolkit (toolkit);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h1 = subplot (2, 2, 1);
+%!   set (h1, "userdata", struct ("column", 1, "row", 1));
+%!   h2 = subplot (2, 2, 2);
+%!   set (h2, "userdata", struct ("column", 2, "row", 1));
+%!   h3 = subplot (2, 2, 3);
+%!   set (h3, "userdata", struct ("column", 1, "row", 2));
+%!   h4 = subplot (2, 2, 4);
+%!   set (h4, "userdata", struct ("column", 2, "row", 2));
+%!   h = findobj (hf, "type", "axes",
+%!                "-not", "userdata", struct ("column", 1, "row", 1));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+%! assert (h, [h4; h3; h2])
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   ha = axes ();
+%!   plot (1:10);
+%!   h = findobj (hf, "type", "figure",
+%!                "-or", "parent", hf,
+%!                "-and", "type", "axes");
+%! unwind_protect_cleanup
+%!   close (hf)
+%! end_unwind_protect
+%! assert (h, [hf; ha])
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   set (hf, "tag", "foo");
+%!   h1 = subplot (2,2,1, "tag", "foo");
+%!   h2 = subplot (2,2,2, "tag", "bar");
+%!   h3 = subplot (2,2,3, "tag", "foo");
+%!   h4 = subplot (2,2,4, "tag", "bar");
+%!   h = findobj (hf, "type", "axes", "-xor", "tag", "foo");
+%!   assert (h, [hf; h4; h2]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax1 = subplot (2,1,1);
+%!    hl1 = plot (rand (10,1));
+%!   hax2 = subplot (2,1,2);
+%!    hl2 = plot (rand (10,1));
+%!   hobj = findobj (hf);
+%!   assert (hobj, [hf; hax2; hax1; hl2; hl1]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gca.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,75 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} gca ()
+## Return a handle to the current axis object.
+##
+## The current axis is the default target for graphics output.  In the case
+## of a figure with multiple axes, @code{gca} returns the last created axes
+## or the last axes that was clicked on with the mouse.
+##
+## If no current axes object exists, create one and return its handle.  The
+## handle may then be used to examine or set properties of the axes.  For
+## example,
+##
+## @example
+## @group
+## ax = gca ();
+## set (ax, "position", [0.5, 0.5, 0.5, 0.5]);
+## @end group
+## @end example
+##
+## @noindent
+## creates an empty axes object and then changes its location and size in the
+## figure window.
+##
+## Note: To find the current axis without creating a new axes object if it
+## does not exist, query the @qcode{"CurrentAxes"} property of a figure.
+##
+## @example
+## get (gcf, "currentaxes");
+## @end example
+## @seealso{gcf, gco, gcbf, gcbo, get, set}
+## @end deftypefn
+
+## Author: jwe
+
+function h = gca ()
+
+  if (nargin == 0)
+    h = get (gcf (), "currentaxes");
+    if (isempty (h))
+      h = axes ();
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! ax = axes;
+%! unwind_protect
+%!   assert (gca, ax);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcbf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,39 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{fig} =} gcbf ()
+## Return a handle to the figure containing the object whose callback is
+## currently executing.
+##
+## If no callback is executing, this function returns the empty matrix.  The
+## handle returned by this function is the same as the second output argument
+## of @code{gcbo}.
+##
+## @seealso{gcbo, gcf, gco, gca, get, set}
+## @end deftypefn
+
+function fig = gcbf ()
+
+  [~, fig] = gcbo ();
+
+endfunction
+
+
+%!assert (isempty (gcbf))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcbo.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,48 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} gcbo ()
+## @deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo ()
+## Return a handle to the object whose callback is currently executing.
+## 
+## If no callback is executing, this function returns the empty matrix.  This
+## handle is obtained from the root object property @qcode{"CallbackObject"}.
+##
+## When called with a second output argument, return the handle of the figure
+## containing the object whose callback is currently executing.  If no callback
+## is executing the second output is also set to the empty matrix.
+##
+## @seealso{gcbf, gco, gca, gcf, get, set}
+## @end deftypefn
+
+function [h, fig] = gcbo ()
+
+  h = get (0, "callbackobject");
+  fig = [];
+
+  if (! isempty (h) && nargout > 1)
+    fig = ancestor (h, "figure");
+  endif
+
+endfunction
+
+
+%!test
+%! assert (isempty (gcbo));
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gcf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,79 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{h} =} gcf ()
+## Return a handle to the current figure.
+##
+## The current figure is the default target for graphics output.  If multiple
+## figures exist, @code{gcf} returns the last created figure or the last figure
+## that was clicked on with the mouse.
+##
+## If a current figure does not exist, create one and return its handle.  The
+## handle may then be used to examine or set properties of the figure.  For
+## example,
+##
+## @example
+## @group
+## fplot (@@sin, [-10, 10]);
+## fig = gcf ();
+## set (fig, "numbertitle", "off", "name", "sin plot")
+## @end group
+## @end example
+##
+## @noindent
+## plots a sine wave, finds the handle of the current figure, and then
+## renames the figure window to describe the contents.
+##
+## Note: To find the current figure without creating a new one if it does not
+## exist, query the @qcode{"CurrentFigure"} property of the root graphics
+## object.
+##
+## @example
+## get (0, "currentfigure");
+## @end example
+##
+## @seealso{gca, gco, gcbf, gcbo, get, set}
+## @end deftypefn
+
+## Author: jwe, Bill Denney
+
+function h = gcf ()
+
+  if (nargin == 0)
+    h = get (0, "currentfigure");
+    if (isempty (h) || h == 0)
+      ## We only have a root figure object, so create a new figure
+      ## object and make it the current figure.
+      h = figure ();
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (gcf, hf);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gco.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,47 @@
+## Copyright (C) 2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} gco ()
+## @deftypefnx {Function File} {@var{h} =} gco (@var{fig})
+## Return a handle to the current object of the current figure, or a handle
+## to the current object of the figure with handle @var{fig}.
+##
+## The current object of a figure is the object that was last clicked on.  It
+## is stored in the @qcode{"CurrentObject"} property of the target figure.
+##
+## If the last mouse click did not occur on any child object of the figure,
+## then the current object is the figure itself.
+##
+## If no mouse click occurred in the target figure, this function returns an
+## empty matrix.
+##
+## Programming Note: The value returned by this function is not necessarily the
+## same as the one returned by @code{gcbo} during callback execution.  An
+## executing callback can be interrupted by another callback and the current
+## object may be changed.
+##
+## @seealso{gcbo, gca, gcf, gcbf, get, set}
+## @end deftypefn
+
+function h = gco ()
+
+  h = get (get (0, "currentfigure"), "currentobject");
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ginput.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,60 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n})
+## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput ()
+## Return the position and type of mouse button clicks and/or key strokes
+## in the current figure window.
+##
+## If @var{n} is defined, then capture @var{n} events before returning.
+## When @var{n} is not defined @code{ginput} will loop until the return key
+## @key{RET} is pressed.
+##
+## The return values @var{x}, @var{y} are the coordinates where the mouse
+## was clicked in the units of the current axes.  The return value @var{button}
+## is 1, 2, or 3 for the left, middle, or right button.  If a key is pressed
+## the ASCII value is returned in @var{button}.
+## @seealso{gtext, waitforbuttonpress}
+## @end deftypefn
+
+function varargout = ginput (n)
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  f = gcf ();
+  a = gca ();  # Create an axis, if necessary
+  drawnow ();
+  toolkit = get (f, "__graphics_toolkit__");
+
+  varargout = cell (1, nargout);
+  if (nargin == 0)
+    [varargout{:}] = feval (["__" toolkit "_ginput__"], f);
+  else
+    [varargout{:}] = feval (["__" toolkit "_ginput__"], f, n);
+  endif
+
+endfunction
+
+
+## Remove from test statistics.  No real tests possible.
+%!test
+%! assert (1);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/gnuplot_binary.in	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,65 @@
+## Copyright (C) 2008-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
+## @deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
+## Query or set the name of the program invoked by the plot command
+## when the graphics toolkit is set to "gnuplot".  Additional arguments to
+## pass to the external plotting program may also be given.
+## The default value is @qcode{"gnuplot"} with no additional arguments.
+## @xref{Installation}.
+## @seealso{graphics_toolkit}
+## @end deftypefn
+
+## Author: jwe
+
+function [prog, args] = gnuplot_binary (new_prog, varargin)
+
+  persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
+  persistent gp_args = {};
+
+  if (nargout > 0 || nargin == 0)
+    prog = gp_binary;
+    args = gp_args;
+  endif
+
+  if (nargin == 1)
+    if (! ischar (new_prog) || isempty (new_prog))
+      error ("gnuplot_binary: NEW_PROG must be a non-empty string");
+    endif
+    gp_binary = new_prog;
+  endif
+
+  if (nargin > 1)
+    if (! iscellstr (varargin))
+      error ("gnuplot_binary: arguments must be character strings");
+    endif
+    gp_args = varargin;
+  endif
+
+endfunction
+
+
+%!test
+%! orig_val = gnuplot_binary ();
+%! old_val = gnuplot_binary ("X");
+%! assert (orig_val, old_val);
+%! assert (gnuplot_binary (), "X");
+%! gnuplot_binary (orig_val);
+%! assert (gnuplot_binary (), orig_val);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/graphics_toolkit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,106 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{name} =} graphics_toolkit ()
+## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
+## @deftypefnx {Function File} {} graphics_toolkit (@var{name})
+## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
+## Query or set the default graphics toolkit which is assigned to new figures.
+## 
+## With no inputs, return the current default graphics toolkit.  If the input
+## is a list of figure graphic handles, @var{hlist}, then return the name
+## of the graphics toolkit in use for each figure.
+## 
+## When called with a single input @var{name} set the default graphics toolkit
+## to @var{name}.  If the toolkit is not already loaded, it is initialized by
+## calling the function @code{__init_@var{name}__}.  If the first input
+## is a list of figure handles, @var{hlist}, then the graphics toolkit is set
+## to @var{name} for these figures only.
+## 
+## @seealso{available_graphics_toolkits}
+## @end deftypefn
+
+function retval = graphics_toolkit (name, hlist = [])
+
+  if (nargin > 2)
+    print_usage ();
+  endif
+
+  if (nargout > 0 || nargin == 0)
+    retval = get (0, "defaultfigure__graphics_toolkit__");
+  endif
+
+  if (nargin == 0)
+    return;
+  elseif (nargin == 1)
+    if (all (isfigure (name)))
+      hlist = name;
+      retval = get (hlist, "__graphics_toolkit__");
+      return;
+    elseif (! ischar (name))
+      error ("graphics_toolkit: invalid graphics toolkit NAME");
+    endif
+  elseif (nargin == 2)
+    ## Swap input arguments
+    [hlist, name] = deal (name, hlist);
+    if (! all (isfigure (hlist)))
+      error ("graphics_toolkit: invalid figure handle list HLIST");
+    elseif (! ischar (name))
+      error ("graphics_toolkit: invalid graphics toolkit NAME");
+    endif
+  endif
+
+  if (! any (strcmp (loaded_graphics_toolkits (), name)))
+    feval (["__init_", name, "__"]);
+    if (! any (strcmp (loaded_graphics_toolkits (), name)))
+      error ("graphics_toolkit: %s toolkit was not correctly loaded", name);
+    endif
+  endif
+
+  if (isempty (hlist))
+    set (0, "defaultfigure__graphics_toolkit__", name);
+  else
+    set (hlist, "__graphics_toolkit__", name);
+  endif
+
+endfunction
+
+
+%!testif HAVE_FLTK
+%! unwind_protect
+%!   hf = figure ("visible", "off");
+%!   toolkit = graphics_toolkit ();
+%!   assert (get (0, "defaultfigure__graphics_toolkit__"), toolkit);
+%!   graphics_toolkit (hf, "fltk");
+%!   assert (graphics_toolkit (hf), "fltk");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!testif HAVE_FLTK
+%! old_toolkit = graphics_toolkit ();
+%! switch (old_toolkit)
+%!   case {"gnuplot"}
+%!     new_toolkit = "fltk";
+%!   otherwise
+%!     new_toolkit = "gnuplot";
+%! endswitch
+%! assert (graphics_toolkit (new_toolkit), old_toolkit);
+%! assert (graphics_toolkit (old_toolkit), new_toolkit);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hdl2struct.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,172 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
+## Return a structure, @var{s}, whose fields describe the properties
+## of the object, and its children, associated with the handle, @var{h}.
+##
+## The fields of the structure @var{s} are @qcode{"type"}, @qcode{"handle"},
+## @qcode{"properties"}, @qcode{"children"}, and @qcode{"special"}.
+## @seealso{struct2hdl, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-03-04
+
+function s = hdl2struct (h)
+
+  if (nargin != 1 || !ishandle (h))
+    print_usage ();
+  endif
+
+  hiddenh = get (0, "showhiddenhandles");
+  if (strcmp (hiddenh, "on"))
+    set (0, "showhiddenhandles", "off");
+  endif
+
+  ## main object
+  main = get (h);
+  s.handle = h;
+  s.type =  main.type;
+  s.properties  = getprops (h);
+  s.children = [];
+  s.special = [];
+
+  ## sweep all children but legends, colorbars, uimenu and hggroup children
+  ## in reverse order
+  kids = main.children;
+  lg = findobj (h, "-depth", 1, "tag", "legend");
+  cb = findobj (h, "-depth", 1, "tag", "colorbar");
+  ui = findobj (h, "-depth", 1, "type", "uimenu");
+  nkids = length (kids);
+  ii = 0;
+  while (nkids)
+    if (! any (kids (nkids) == lg) && ! any (kids (nkids) == cb)
+          && ! any (kids (nkids) == ui) && ! strcmp (main.type, "hggroup"))
+      ii++;
+      s.children(ii) = hdl2struct (kids(nkids));
+    endif
+    nkids--;
+  endwhile
+
+  ## add non "children" children objects (title, xlabel, ...) and
+  ## hggroup children and tag theim in "special"
+  special = [];
+  if (strcmp (main.type, "hggroup"))
+    special = main.children;
+  endif
+  special = [special getspecial(h)];
+  nsp = length (special);
+  while (nsp)
+    ii++;
+    s.children(ii) = hdl2struct (special(nsp));
+    s.special(nsp) = ii;
+    nsp--;
+  endwhile
+
+  ## look for legends and colorbars among "main"'s brothers and add them
+  ## to the children list
+  if (strcmp (main.type, "axes"))
+    par = main.parent;
+    lg = findobj (par, "-depth", 1, "tag", "legend");
+    if (! isempty (lg))
+      idx = arrayfun (@(x) get(x).userdata.handle(end) == h, lg);
+      lg = lg(find (idx));
+    endif
+    nlg = length (lg);
+    if (nlg == 1)
+      ii++;
+      s.children(ii) = hdl2struct (lg);
+    elseif (nlg > 1)
+      error ("hdl2struct: more than one legend found");
+    endif
+
+    cb = findobj (par, "-depth", 1, "tag", "colorbar");
+    if (! isempty (cb))
+      idx = arrayfun (@(x) get(x).axes == h, cb);
+      cb = cb(find (idx));
+    endif
+
+    ncb = length (cb);
+    if (ncb == 1)
+      ii++;
+      s.children(ii) = hdl2struct (cb);
+    elseif (nlg > 1)
+      error ("hdl2struct: more than one colorbar found");
+    endif
+  endif
+
+  set (0, "showhiddenhandles", hiddenh);
+
+endfunction
+
+function hdlist = getspecial (h)
+  obj = get (h);
+  ## return handles to special children
+  fields = fieldnames (obj);
+  hdlist = [];
+
+  regkids = get ( h, "children");
+  set (0, "showhiddenhandles", "on");
+  allkids = get ( h, "children");
+  set (0, "showhiddenhandles", "off");
+  speckids = arrayfun (@(x) ! any (x == regkids), allkids);
+  hdlist = allkids (find (speckids));
+  hdlist = reshape (hdlist, 1, numel (hdlist));
+
+endfunction
+
+function prpstr = getprops (h)
+  obj = get (h);
+  ## get usefull properties rejecting readonly, children, handles ...
+  fields = fieldnames (obj);
+  hdlist = [];
+
+  forbid = {"beingdeleted", "busyaction", "buttondownfcn", ...
+            "children", "clipping", "createfcn", ...
+            "deletefcn", "handlevisibility", "hittest", ...
+            "interruptible", "parent", "selected" ,...
+            "selectionhighlight", "type", "__modified__", ...
+            "uicontextmenu", "__graphics_toolkit__", "currentaxes", ...
+            "currentcharacter", "currentobject","tightinset", ...
+            "currentpoint", "extent"};
+
+  nflds = length (fields);
+  ii = 0;
+  while (nflds)
+    prop = fields{nflds};
+    val = obj.(fields{nflds});
+    ii++;
+    if (! any (strcmp (prop, forbid)))
+      prpstr.(prop) = val;
+    endif
+    nflds--;
+  endwhile
+
+  ## hidden properties
+  hidden = {"autopos_tag", "looseinset"};
+  for ii = 1:numel (hidden)
+    if (isprop (h, hidden{ii}))
+      prpstr.(hidden{ii}) = get (h, hidden{ii});
+    endif
+  endfor
+
+endfunction
+
+
+## FIXME: need validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hggroup.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,71 @@
+## Copyright (C) 2008-2012 Michael Goffioul
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} hggroup ()
+## @deftypefnx {Function File} {} hggroup (@var{hax})
+## @deftypefnx {Function File} {} hggroup (@dots{}, @var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} hggroup (@dots{})
+## Create handle graphics group object with axes parent @var{hax}.
+##
+## If no parent is specified, the group is created in the current axes.
+##
+## Multiple property/value pairs may be specified for the hggroup, but they
+## must appear in pairs.
+##
+## The optional return value @var{h} is a graphics handle to the created
+## hggroup object.
+##
+## Programming Note: An hggroup is a way to group base graphics objects such
+## as line objects or patch objects into a single unit which can react
+## appropriately.  For example, the individual lines of a contour plot are
+## collected into a single hggroup so that they can be made visible/invisible
+## with a single command, @code{set (hg_handle, "visible", "off")}.
+## 
+## @seealso{addproperty, addlistener}
+## @end deftypefn
+
+## Author: goffioul
+
+function h = hggroup (varargin)
+
+  [hax, varargin] = __plt_get_axis_arg__ ("hggroup", varargin{:});
+  
+  if (isempty (hax))
+    hax = gca ();
+  endif
+  
+  htmp = __go_hggroup__ (hax, varargin{:});
+
+  if (nargout > 0)
+    h = htmp;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = hggroup;
+%!   assert (findobj (hf, "type", "hggroup"), h);
+%!   assert (get (h, "type"), "hggroup");
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/hold.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,200 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} hold
+## @deftypefnx {Command} {} hold on
+## @deftypefnx {Command} {} hold off
+## @deftypefnx {Command} {} hold all
+## @deftypefnx {Function File} {} hold (@var{hax}, @dots{})
+## Toggle or set the @qcode{"hold"} state of the plotting engine which
+## determines whether new graphic objects are added to the plot or replace
+## the existing objects.
+##
+## @table @code
+## @item hold on
+## Retain plot data and settings so that subsequent plot commands are displayed
+## on a single graph.
+##
+## @item hold all
+## Retain plot line color, line style, data, and settings so that subsequent
+## plot commands are displayed on a single graph with the next line color and
+## style.
+##
+## @item hold off
+## Restore default graphics settings which clear the graph and reset axis
+## properties before each new plot command.  (default).
+##
+## @item hold
+## Toggle the current hold state.
+## @end table
+##
+## When given the additional argument @var{hax}, the hold state is modified
+## for this axis rather than the current axes returned by @code{gca}.
+##
+## To query the current hold state use the @code{ishold} function.
+## @seealso{ishold, cla, clf, newplot}
+## @end deftypefn
+
+function hold (varargin)
+
+  if (nargin > 0 && isscalar (varargin{1}) && isaxes (varargin{1}))
+    hax = varargin{1};
+    varargin(1) = [];
+    nargs = numel (varargin);
+    ## FIXME: Should this be ancestor (hax, "parent")?
+    hfig = get (hax, "parent");
+  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}))
+    print_usage ();
+  else
+    hax = gca ();
+    hfig = gcf ();
+    nargs = numel (varargin);
+  endif
+
+  hold_all = false;
+  if (nargs == 0)
+    turn_hold_off = ishold (hax);
+  elseif (nargs == 1)
+    state = tolower (varargin{1});
+    switch (state)
+      case "off"
+        turn_hold_off = true;
+      case "all"
+        turn_hold_off = false;
+        hold_all = true;
+      case "on"
+        turn_hold_off = false;
+      otherwise
+        error ("hold: invalid hold STATE");
+    endswitch
+  else
+    print_usage ();
+  endif
+
+  if (turn_hold_off)
+    set (hax, "nextplot", "replace");
+  else
+    set (hax, "nextplot", "add");
+    set (hfig, "nextplot", "add");
+  endif
+  set (hax, "__hold_all__", hold_all);
+
+endfunction
+
+
+%!demo
+%! clf;
+%! t = linspace (0, 2*pi, 100);
+%! plot (t, sin (t));
+%! hold on;
+%! plot (t, cos (t));
+%! title ({'hold on', '2 plots shown on same graph'});
+%! hold off;
+
+%!demo
+%! clf;
+%! t = linspace (0, 2*pi, 100);
+%! plot (t, sin (t));
+%! hold all;
+%! plot (t, cos (t));
+%! title ({'hold all', '2 plots shown on same graph with linestyle also preserved'});
+%! hold off;
+
+%!demo
+%! clf;
+%! A = rand (100);
+%! [X, Y] = find (A > 0.95);
+%! imshow (A);
+%! hold on;
+%! plot (X, Y, 'o');
+%! hold off;
+%! title ('hold with image and plot');
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! imagesc (1 ./ hilb (4));
+%! plot (1:4, '-s');
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! imagesc (1 ./ hilb (2));
+%! imagesc (1 ./ hilb (4));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! hold on;
+%! plot (1:4, '-s');
+%! imagesc (1 ./ hilb (4));
+%! hold off;
+
+%!demo
+%! clf;
+%! colormap ('default');
+%! t = linspace (-3, 3, 50);
+%! [x, y] = meshgrid (t, t);
+%! z = peaks (x, y);
+%! contourf (x, y, z, 10);
+%! hold on;
+%! plot (x(:), y(:), '^');
+%! patch ([-1.0 1.0 1.0 -1.0 -1.0], [-1.0 -1.0 1.0 1.0 -1.0], 'red');
+%! xlim ([-2.0 2.0]);
+%! ylim ([-2.0 2.0]);
+%! colorbar ('SouthOutside');
+%! title ('Test script for some plot functions');
+
+## hold on test
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0 1]);
+%!   assert (! ishold);
+%!   hold on;
+%!   assert (ishold);
+%!   p1 = fill ([0 1 1], [0 0 1], "black");
+%!   p2 = fill ([0 1 0], [0 1 1], "red");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 3);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+## hold off test
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0 1]);
+%!   assert (! ishold);
+%!   hold on;
+%!   assert (ishold);
+%!   p1 = fill ([0 1 1], [0 0 1], "black");
+%!   hold off;
+%!   p2 = fill ([0 1 0], [0 1 1], "red");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 1);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isaxes.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,56 @@
+## Copyright (C) 2013 Rik Wehbring
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isaxes (@var{h})
+## Return true if @var{h} is an axes graphics handle and false otherwise.
+##
+## If @var{h} is a matrix then return a logical array which is true where
+## the elements of @var{h} are axes graphics handles and false where
+## they are not.
+## @seealso{isaxes, ishandle}
+## @end deftypefn
+
+## Author: jwe
+
+function retval = isaxes (h)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  hlist = ishandle (h);
+  if (any (hlist))
+    retval(hlist) = strcmp (get (h(hlist), "type"), "axes");
+  else
+    retval = hlist;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = axes ();
+%!   assert (isaxes (hax));
+%!   assert (! isaxes (-hax));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isfigure.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,55 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} isfigure (@var{h})
+## Return true if @var{h} is a figure graphics handle and false otherwise.
+##
+## If @var{h} is a matrix then return a logical array which is true where
+## the elements of @var{h} are figure graphics handles and false where
+## they are not.
+## @seealso{isaxes, ishandle}
+## @end deftypefn
+
+## Author: jwe
+
+function retval = isfigure (h)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  hlist = ishandle (h);
+  if (any (hlist))
+    retval(hlist) = strcmp (get (h(hlist), "type"), "figure");
+  else
+    retval = hlist;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (isfigure (hf));
+%!   assert (! isfigure (-hf));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ishghandle.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,64 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ishghandle (@var{h})
+## Return true if @var{h} is a graphics handle and false otherwise.
+##
+## This function is equivalent to @code{ishandle} and is provided for
+## compatibility with @sc{matlab}.
+## @seealso{ishandle}
+## @end deftypefn
+
+function retval = ishghandle (h)
+  ## This function is just included for compatibility as Octave has
+  ## no simulink equivalent.
+  retval = ishandle (h);
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (ishghandle (hf));
+%!   assert (! ishghandle (-hf));
+%!   l = line;
+%!   ax = gca;
+%!   assert (ishghandle (ax));
+%!   assert (! ishghandle (-ax));
+%!   assert (ishghandle (l));
+%!   assert (! ishghandle (-l));
+%!   p = patch;
+%!   assert (ishghandle (p));
+%!   assert (! ishghandle (-p));
+%!   s = surface;
+%!   assert (ishghandle (s));
+%!   assert (! ishghandle (-s));
+%!   t = text;
+%!   assert (ishghandle (t));
+%!   assert (! ishghandle (-t));
+%!   i = image ([1]);
+%!   assert (ishghandle (i));
+%!   assert (! ishghandle (-i));
+%!   hg = hggroup;
+%!   assert (ishghandle (hg));
+%!   assert (! ishghandle (-hg));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ishold.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,84 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} ishold
+## @deftypefnx {Function File} {} ishold (@var{hax})
+## @deftypefnx {Function File} {} ishold (@var{hfig})
+## Return true if the next plot will be added to the current plot, or
+## false if the plot device will be cleared before drawing the next plot.
+##
+## If the first argument is an axes handle @var{hax} or figure handle
+## @var{hfig} then operate on this plot rather than the current one.
+## @seealso{hold, newplot}
+## @end deftypefn
+
+function retval = ishold (h)
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    fig = gcf ();
+    ax = get (fig, "currentaxes");
+  else
+    if (ishandle (h))
+      if (strcmp (get (h, "type"), "figure"))
+        fig = h;
+        ax = get (fig, "currentaxes");
+      elseif (strcmp (get (h, "type"), "axes"))
+        ax = h;
+        fig = get (ax, "parent");
+      else
+        error ("ishold: H must be an axes or figure graphics handle");
+      endif
+    else
+      error ("ishold: H must be an axes or figure graphics handle");
+    endif
+  endif
+
+  retval = (strcmp (get (fig, "nextplot"), "add")
+            && ! isempty (ax) && strcmp (get (ax, "nextplot"), "add"));
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   assert (! ishold);
+%!   assert (isempty (get (hf, "currentaxes")));
+%!   assert (get (hf, "NextPlot"), "add");
+%!   l = plot ([0 1]);
+%!   assert (! ishold);
+%!   assert (! ishold (gca));
+%!   assert (get (gca, "NextPlot"), "replace");
+%!   assert (get (hf, "NextPlot"), "add");
+%!   hold;
+%!   assert (ishold);
+%!   assert (ishold (gca));
+%!   assert (get (gca, "NextPlot"), "add");
+%!   assert (get (hf, "NextPlot"), "add");
+%!   p = fill ([0 1 1], [0 0 1],"black");
+%!   assert (length (get (hf, "children")), 1);
+%!   assert (length (get (gca, "children")), 2);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/isprop.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,61 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{res} =} isprop (@var{h}, "@var{prop}")
+## Return true if @var{prop} is a property of the object with handle @var{h}.
+##
+## @var{h} may also be an array of handles in which case @var{res} will be a
+## logical array indicating whether each handle has the property @var{prop}.
+## @seealso{get, set}
+## @end deftypefn
+
+## Author: Ben Abbott  <bpabbott@mac.com>
+
+function res = isprop (h, prop)
+
+  if (nargin != 2)
+    print_usage ();
+  endif
+
+  if (! all (ishandle (h)))
+    error ("isprop: H must be a graphics handle or vector of handles");
+  elseif (! ischar (prop))
+    error ("isprop: PROP name must be a string");
+  endif
+
+  res = false (size (h));
+  for i = 1:numel (res)
+    try
+      v = get (h(i), prop);
+      res(i) = true;
+    end_try_catch
+  endfor
+endfunction
+
+
+%!assert (isprop (0, "foobar"), false)
+%!assert (isprop (0, "screenpixelsperinch"), true)
+%!assert (isprop (zeros (2, 3), "visible"), true (2, 3))
+
+%!error isprop ()
+%!error isprop (1)
+%!error isprop (1,2,3)
+%!error <H must be a graphics handle> isprop ({1}, "visible")
+%!error <PROP name must be a string> isprop (0, {"visible"})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/linkprop.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,102 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{hlink} =} linkprop (@var{h}, @var{prop})
+## @deftypefnx {Function File} {@var{hlink} =} linkprop (@var{h}, @{@var{prop1}, @var{prop2}, @dots{}@})
+## Link graphics object properties, such that a change in one is
+## propagated to the others.
+##
+## @var{prop} can be a string for a single property, or a cell array of strings
+## for multiple properties.  @var{h} is an array of graphics handles which
+## will have their properties linked.
+##
+## An example of the use of @code{linkprop} is
+##
+## @example
+## @group
+## x = 0:0.1:10;
+## subplot (1,2,1);
+## h1 = plot (x, sin (x));
+## subplot (1,2,2);
+## h2 = plot (x, cos (x));
+## hlink = linkprop ([h1, h2], @{"color","linestyle"@});
+## set (h1, "color", "green");
+## set (h2, "linestyle", "--");
+## @end group
+## @end example
+##
+## @end deftypefn
+
+function hlink = linkprop (h, prop)
+  if (ischar (prop))
+    prop = {prop};
+  elseif (!iscellstr (prop))
+    error ("linkprop: properties must be a string or cell string array");
+  endif
+
+  for i = 1 : numel (h)
+    for j = 1 : numel (prop)
+      addlistener (h(i), prop{j}, {@update_prop, h, prop{j}});
+    endfor
+  endfor
+
+  ## This should be an object that when destroyed removes the links
+  ## The below is not quite right. As when you call "clear hlink" the
+  ## hggroup continues to exist.
+  hlink = hggroup ();
+  set (hlink, "deletefcn", {@delete_prop, h, prop});
+endfunction
+
+function update_prop (h, d, hlist, prop)
+  persistent recursion = false;
+
+  ## Don't allow recursion
+  if (! recursion)
+    unwind_protect
+      recursion = true;
+      val = get (h, prop);
+      for hh = hlist(:)'
+        if (hh != h)
+          oldval = get (hh, prop);
+          if (! isequal (val, oldval))
+            set (hh, prop, val);
+          endif
+        endif
+      endfor
+    unwind_protect_cleanup
+      recursion = false;
+    end_unwind_protect
+  endif
+endfunction
+
+function delete_prop (h, d, hlist, prop)
+  ## FIXME. Actually need to delete the linked properties.
+  ## However, only warn if the graphics objects aren't being deleted.
+  warn = false;
+  for h = hlist(:)'
+    if (ishandle (h) && !strcmpi (get (h, "beingdeleted"), "on"))
+      warn = true;
+      break;
+    endif
+  endfor
+  if (warn)
+    warning ("linkprop: can not remove linked properties");
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/meshgrid.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,135 @@
+## Copyright (C) 1996-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
+## @deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x})
+## Given vectors of @var{x} and @var{y} coordinates, return matrices @var{xx}
+## and @var{yy} corresponding to a full 2-D grid.
+##
+## The rows of @var{xx} are copies of @var{x}, and the columns of @var{yy} are
+## copies of @var{y}.  If @var{y} is omitted, then it is assumed to be the same
+## as @var{x}.
+##
+## If the optional @var{z} input is given, or @var{zz} is requested, then the
+## output will be a full 3-D grid.
+##
+## @code{meshgrid} is most frequently used to produce input for a 2-D or 3-D
+## function that will be plotted.  The following example creates a surface
+## plot of the ``sombrero'' function.
+##
+## @example
+## @group
+## f = @@(x,y) sin (sqrt (x.^2 + y.^2)) ./ sqrt (x.^2 + y.^2);
+## range = linspace (-8, 8, 41);
+## [@var{X}, @var{Y}] = meshgrid (range, range);  
+## Z = f (X, Y);
+## surf (X, Y, Z);
+## @end group
+## @end example
+##
+## Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
+## generation.  The @code{ndgrid} function will generate 1-D through N-D
+## grids.  However, the functions are not completely equivalent.  If @var{x}
+## is a vector of length M and @var{y} is a vector of length N, then
+## @code{meshgrid} will produce an output grid which is NxM@.  @code{ndgrid}
+## will produce an output which is @nospell{MxN} (transpose) for the same
+## input.  Some core functions expect @code{meshgrid} input and others expect
+## @code{ndgrid} input.  Check the documentation for the function in question
+## to determine the proper input format.
+## @seealso{ndgrid, mesh, contour, surf}
+## @end deftypefn
+
+## Author: jwe
+
+function [xx, yy, zz] = meshgrid (x, y, z)
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin < 2)
+    y = x;
+  endif
+
+  ## Use repmat to ensure that result values have the same type as the inputs
+
+  if (nargout < 3)
+    if (! (isvector (x) && isvector (y)))
+      error ("meshgrid: X and Y must be vectors");
+    endif
+    xx = repmat (x(:).', length (y), 1);
+    yy = repmat (y(:), 1, length (x));
+  else
+    if (nargin < 3)
+      z = y;
+    endif
+    if (! (isvector (x) && isvector (y) && isvector (z)))
+      error ("meshgrid: X, Y, and Z must be vectors");
+    endif
+    lenx = length (x);
+    leny = length (y);
+    lenz = length (z);
+    xx = repmat (repmat (x(:).', leny, 1), [1, 1, lenz]);
+    yy = repmat (repmat (y(:), 1, lenx), [1, 1, lenz]);
+    zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz);
+  endif
+
+endfunction
+
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! z = 1:4;
+%! [XX, YY, ZZ] = meshgrid (x, y, z);
+%! assert (size_equal (XX, YY, ZZ));
+%! assert (ndims (XX), 3);
+%! assert (size (XX), [3, 2, 4]);
+%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
+%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! [XX, YY] = meshgrid (x, y);
+%! assert (size_equal (XX, YY));
+%! assert (ndims (XX), 2);
+%! assert (size (XX), [3, 2]);
+%! assert (XX(1) * YY(1), x(1) * y(1));
+%! assert (XX(end) * YY(end), x(end) * y(end));
+
+%!test
+%! x = 1:3;
+%! [XX1, YY1] = meshgrid (x, x);
+%! [XX2, YY2] = meshgrid (x);
+%! assert (size_equal (XX1, XX2, YY1, YY2));
+%! assert (ndims (XX1), 2);
+%! assert (size (XX1), [3, 3]);
+%! assert (XX1, XX2);
+%! assert (YY1, YY2);
+
+%% Test input validation
+%!error meshgrid ()
+%!error meshgrid (1,2,3,4)
+%!error <X and Y must be vectors> meshgrid (ones (2,2), 1:3)
+%!error <X and Y must be vectors> meshgrid (1:3, ones (2,2))
+%!error <X, Y, and Z must be vectors> [X,Y,Z] = meshgrid (1:3, 1:3, ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,80 @@
+FCN_FILE_DIRS += plot
+
+plot_util_GEN_FCN_FILES = \
+  plot/util/gnuplot_binary.m
+
+GEN_FCN_FILES += $(plot_util_GEN_FCN_FILES)
+
+plot_util_PRIVATE_FCN_FILES = \
+  plot/util/private/__add_default_menu__.m \
+  plot/util/private/__fltk_ginput__.m \
+  plot/util/private/__fltk_print__.m \
+  plot/util/private/__ghostscript__.m \
+  plot/util/private/__gnuplot_get_var__.m \
+  plot/util/private/__gnuplot_ginput__.m \
+  plot/util/private/__gnuplot_has_feature__.m \
+  plot/util/private/__gnuplot_has_terminal__.m \
+  plot/util/private/__gnuplot_open_stream__.m \
+  plot/util/private/__gnuplot_print__.m \
+  plot/util/private/__gnuplot_version__.m \
+  plot/util/private/__go_draw_axes__.m \
+  plot/util/private/__go_draw_figure__.m \
+  plot/util/private/__print_parse_opts__.m \
+  plot/util/private/__tight_eps_bbox__.m
+
+plot_util_FCN_FILES = \
+  plot/util/__actual_axis_position__.m \
+  plot/util/allchild.m \
+  plot/util/ancestor.m \
+  plot/util/axes.m \
+  plot/util/cla.m \
+  plot/util/clf.m \
+  plot/util/close.m \
+  plot/util/closereq.m \
+  plot/util/colstyle.m \
+  plot/util/copyobj.m \
+  plot/util/__default_plot_options__.m \
+  plot/util/figure.m \
+  plot/util/findall.m \
+  plot/util/findfigs.m \
+  plot/util/findobj.m \
+  plot/util/gca.m \
+  plot/util/gcbf.m \
+  plot/util/gcbo.m \
+  plot/util/gcf.m \
+  plot/util/gco.m \
+  plot/util/ginput.m \
+  plot/util/__gnuplot_drawnow__.m \
+  plot/util/graphics_toolkit.m \
+  plot/util/hdl2struct.m \
+  plot/util/hggroup.m \
+  plot/util/hold.m \
+  plot/util/isaxes.m \
+  plot/util/isfigure.m \
+  plot/util/ishghandle.m \
+  plot/util/ishold.m \
+  plot/util/isprop.m \
+  plot/util/linkprop.m \
+  plot/util/meshgrid.m \
+  plot/util/ndgrid.m \
+  plot/util/newplot.m \
+  plot/util/__next_line_color__.m \
+  plot/util/__next_line_style__.m \
+  plot/util/__plt_get_axis_arg__.m \
+  plot/util/__pltopt__.m \
+  plot/util/printd.m \
+  plot/util/print.m \
+  plot/util/refreshdata.m \
+  plot/util/refresh.m \
+  plot/util/saveas.m \
+  plot/util/shg.m \
+  plot/util/struct2hdl.m \
+  plot/util/subplot.m \
+  $(plot_util_PRIVATE_FCN_FILES)
+
+FCN_FILES += $(plot_util_FCN_FILES)
+
+PKG_ADD_FILES += plot/util/PKG_ADD
+
+DIRSTAMP_FILES += plot/util/$(octave_dirstamp)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/ndgrid.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,124 @@
+## Copyright (C) 2006-2012 Alexander Barth
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
+## @deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
+## Given n vectors @var{x1}, @dots{}, @var{x}n, @code{ndgrid} returns
+## n arrays of dimension n.  The elements of the i-th output argument
+## contains the elements of the vector @var{x}i repeated over all
+## dimensions different from the i-th dimension.  Calling ndgrid with
+## only one input argument @var{x} is equivalent to calling ndgrid with
+## all n input arguments equal to @var{x}:
+##
+## [@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
+##
+## Programming Note: @code{ndgrid} is very similar to the function
+## @code{meshgrid} except that the first two dimensions are transposed in
+## comparison to @code{meshgrid}.  Some core functions expect @code{meshgrid}
+## input and others expect @code{ndgrid} input.  Check the documentation for
+## the function in question to determine the proper input format.
+## @seealso{meshgrid}
+## @end deftypefn
+
+## Author: Alexander Barth <abarth@marine.usf.edu>
+
+function varargout = ndgrid (varargin)
+
+  if (nargin == 0)
+    print_usage ();
+  elseif (nargin == 1)
+    n = max ([nargout, 1]);
+    ## If only one input argument is given, repeat it n-times
+    varargin(1:n) = varargin(1);
+  elseif (nargin >= nargout)
+    n = max ([nargin, 1]);
+  else
+    error ("ndgrid: wrong number of input arguments");
+  endif
+
+  ## Determine the size of the output arguments
+
+  shape = zeros (1, n);
+  for i = 1:n
+    if (! isvector (varargin{i}) && ! isempty (varargin{i}))
+      error ("ndgrid: arguments must be vectors");
+    endif
+    shape(i) = length (varargin{i});
+  endfor
+
+  for i = 1:n
+    ## size for reshape
+    r = ones (1, n);
+    r(i) = shape(i);
+
+    ## size for repmat
+    s = shape;
+    s(i) = 1;
+
+    varargout{i} = repmat (reshape (varargin{i}, r), s);
+  endfor
+
+endfunction
+
+
+%!test
+%! x = 1:3;
+%! assert (isequal (ndgrid (x), x(:)));
+
+%!test
+%! x = 1:3;
+%! [XX, YY] = ndgrid (x);
+%! assert (size_equal (XX, YY));
+%! assert (isequal (XX, repmat(x(:), 1, numel(x))));
+%! assert (isequal (YY, repmat(x, numel(x), 1)));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! z = 1:4;
+%! [XX, YY, ZZ] = ndgrid (x, y, z);
+%! assert (size_equal (XX, YY, ZZ));
+%! assert (ndims (XX), 3);
+%! assert (size (XX), [2, 3, 4]);
+%! assert (XX(1) * YY(1) * ZZ(1), x(1) * y(1) * z(1));
+%! assert (XX(end) * YY(end) * ZZ(end), x(end) * y(end) * z(end));
+
+%!test
+%! x = 1:2;
+%! y = 1:3;
+%! [XX1, YY1] = meshgrid (x, y);
+%! [XX2, YY2] = ndgrid (x, y);
+%! assert (size_equal (XX1, YY1));
+%! assert (size_equal (XX2, YY2));
+%! assert (ndims (XX1), 2);
+%! assert (size (XX1), [3, 2]);
+%! assert (size (XX2), [2, 3]);
+%! assert (XX2(1) * YY2(1), x(1) * y(1));
+%! assert (XX2(end) * YY2(end), x(end) * y(end));
+%! assert (XX1, XX2.');
+%! assert (YY1, YY2.');
+
+%!assert (ndgrid ([]), zeros(0,1))
+%!assert (ndgrid ([], []), zeros(0,0))
+
+%% Test input validation
+%!error ndgrid ()
+%!error <wrong number of input arguments> [a,b,c] = ndgrid (1:3,1:3)
+%!error <arguments must be vectors> ndgrid (ones (2,2))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/newplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,194 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} newplot ()
+## @deftypefnx {Function File} {} newplot (@var{hfig})
+## @deftypefnx {Function File} {} newplot (@var{hax})
+## @deftypefnx {Function File} {@var{hax} =} newplot (@dots{})
+## Prepare graphics engine to produce a new plot.
+##
+## This function is called at the beginning of all high-level plotting
+## functions.  It is not normally required in user programs.  @code{newplot}
+## queries the @qcode{"NextPlot"} field of the current figure and axis to
+## determine what to do.
+##
+## @multitable @columnfractions .25 .75
+## @headitem Figure NextPlot @tab Action
+## @item @qcode{"new"} @tab Create a new figure and make it the current figure.
+##
+## @item @qcode{"add"} (default) @tab Add new graphic objects to the current figure.
+##
+## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
+## set to @qcode{"on"}.  Set NextPlot property to @qcode{"add"}.  This
+## typically clears a figure, but leaves in place hidden objects such as
+## menubars.  This is equivalent to @code{clf}.
+##
+## @item @qcode{"replace"} @tab Delete all child objects of the figure and
+## reset all figure properties to their defaults.  However, the following
+## four properties are not reset: Position, Units, PaperPosition, PaperUnits.
+##  This is equivalent to @code{clf reset}.
+## @end multitable
+##
+## @multitable @columnfractions .25 .75
+## @headitem Axis NextPlot @tab Action
+## @item @qcode{"add"} @tab Add new graphic objects to the current axes.  This is
+## equivalent to @code{hold on}.
+##
+## @item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
+## set to @qcode{"on"}, but leave axis properties unmodified.  This typically
+## clears a plot, but preserves special settings such as log scaling for
+## axes.  This is equivalent to @code{cla}.
+##
+## @item @qcode{"replace"} (default) @tab Delete all child objects of the
+## axis and reset all axis properties to their defaults.  However, the
+## following properties are not reset: Position, Units.  This is equivalent
+## to @code{cla reset}.
+## @end multitable
+##
+## If the optional input @var{hfig} or @var{hax} is given then prepare the
+## specified figure or axes rather than the current figure and axes.
+##
+## The optional return value @var{hax} is a graphics handle to the created
+## axes object (not figure).
+##
+## @strong{Caution:} Calling @code{newplot} may change the current figure and
+## current axis.
+## @end deftypefn
+
+## FIXME: The Matlab function takes an optional list of file handles, hsave,
+##        which are not deleted when the figure and axes are prepared.
+##        I'm sure there is a good reason for that, but coding such
+##        compatibility is really tricky and doesn't serve much purpose since
+##        newplot is nearly exclusively used by Octave's internal plotting
+##        functions.  In Octave's case the argument is almost always null,
+##        or occasionally the axis handle to plot into.
+
+function hax = newplot (hsave = [])
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  cf = [];
+  ca = [];
+
+  if (! isempty (hsave))
+    ## Find the first valid axes 
+    ca = ancestor (hsave, "axes", "toplevel"); 
+    ca = ca(find (ca, 1));
+    ## Next, find the figure associated with any axis found
+    if (! isempty (ca))
+      cf = ancestor (ca, "figure", "toplevel");
+    else
+      cf = ancestor (hsave, "figure", "toplevel"); 
+      cf = cf(find (cf, 1));
+    endif
+  endif
+
+  if (isempty (cf))
+    ## get current figure, or create a new one if necessary
+    cf = gcf ();
+  else
+    ## switch to figure provided without causing other updates
+    set (0, "currentfigure", cf);
+  endif
+
+  fnp = get (cf, "nextplot");
+  switch (fnp)
+    case "add"
+      ## Default case.  Doesn't require action.
+    case "new"
+      ## Ordinarily, create a new figure to hold plot.
+      ## But, if user has requested preparing a specific axis, then
+      ## use the existing figure to hold the requested axis.
+      if (isempty (ca))
+        cf = figure ();
+      endif
+    case "replacechildren"
+      kids = get (cf, "children");
+      if (! isempty (ca))
+        kids(kids == ca) = [];
+      endif
+      delete (kids);
+    case "replace"
+      kids = allchild (cf);
+      if (! isempty (ca))
+        kids(kids == ca) = [];
+      endif
+      delete (kids);
+      reset (cf);
+  endswitch
+  set (cf, "nextplot", "add");  # Matlab compatibility
+
+  if (isempty (ca))
+    ca = gca ();
+  else
+    set (cf, "currentaxes", ca);
+  endif
+
+  ## FIXME: Is this necessary anymore?
+  ##        It seems like a kluge that belongs somewhere else.
+  if (strcmp (get (ca, "__hold_all__"), "off"))
+    __next_line_color__ (true);
+    __next_line_style__ (true);
+  else
+    __next_line_color__ (false);
+    __next_line_style__ (false);
+  endif
+
+  anp = get (ca, "nextplot");
+  switch (anp)
+    case "add"
+      ## Default case.  Doesn't require action.
+    case "replacechildren"
+      delete (get (ca, "children"));
+    case "replace"
+      __go_axes_init__ (ca, "replace");
+      __request_drawnow__ ();
+      ## FIXME: The code above should perform the following:
+      ###########################
+      ## delete (allchild (ca));
+      ## reset (ca);
+      ###########################
+      ## Actually, __go_axes_init__ does both less and more.
+      ## It doesn't really remove all children since it re-instantiates
+      ## xlabel, ylabel, zlabel, and title text objects.
+      ## Also it preserves font properties like fontsize.
+      ## For the time being, in order to have axis labels and title work,
+      ## the above code is is required.
+  endswitch
+
+  if (nargout > 0)
+    hax = ca;
+  endif
+
+endfunction
+
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   p = plot ([0, 1]);
+%!   hax = newplot ();
+%!   assert (hax, gca);
+%!   assert (isempty (get (gca, "children")));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/print.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,710 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} print ()
+## @deftypefnx {Function File} {} print (@var{options})
+## @deftypefnx {Function File} {} print (@var{filename}, @var{options})
+## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
+## Print a plot, or save it to a file.
+##
+## Both output formatted for printing (PDF and PostScript), and many bitmapped
+## and vector image formats are supported.
+##
+## @var{filename} defines the name of the output file.  If the
+## file name has no suffix, one is inferred from the specified
+## device and appended to the file name.  If no filename is
+## specified, the output is sent to the printer.
+##
+## @var{h} specifies the handle of the figure to print.  If no handle is
+## specified the current figure is used.
+##
+## For output to a printer, PostScript file, or PDF file,
+## the paper size is specified by the figure's @code{papersize}
+## property.  The location and size of the image on the page are
+## specified by the figure's @code{paperposition} property.  The
+## orientation of the page is specified by the figure's
+## @code{paperorientation} property.
+##
+## The width and height of images are specified by the figure's
+## @code{paperpositon(3:4)} property values.
+##
+## The @code{print} command supports many @var{options}:
+##
+## @table @code
+## @item -f@var{h}
+##   Specify the handle, @var{h}, of the figure to be printed.  The
+## default is the current figure.
+##
+## @item -P@var{printer}
+##   Set the @var{printer} name to which the plot is sent if no
+## @var{filename} is specified.
+##
+## @item -G@var{ghostscript_command}
+##   Specify the command for calling Ghostscript.  For Unix and Windows
+## the defaults are @qcode{"gs"} and @qcode{"gswin32c"}, respectively.
+##
+## @item  -color
+## @itemx -mono
+##   Color or monochrome output.
+##
+## @item  -solid
+## @itemx -dashed
+##   Force all lines to be solid or dashed, respectively.
+##
+## @item  -portrait
+## @itemx -landscape
+##   Specify the orientation of the plot for printed output.  For
+## non-printed output the aspect ratio of the output corresponds to
+## the plot area defined by the @qcode{"paperposition"} property in the
+## orientation specified.  This option is equivalent to changing
+## the figure's @qcode{"paperorientation"} property.
+##
+## @item  -TextAlphaBits=@var{n}
+## @itemx -GraphicsAlphaBits=@var{n}
+##   Octave is able to produce output for various printers, bitmaps, and
+## vector formats by using Ghostscript.
+## For bitmap and printer output anti-aliasing is applied using
+## Ghostscript's TextAlphaBits and GraphicsAlphaBits options.
+## The default number of bits for each is 4.
+## Allowed values for @var{N} are 1, 2, or 4.
+##
+## @item -d@var{device}
+##   The available output format is specified by the option @var{device},
+## and is one of:
+##
+##   @table @code
+##   @item  ps
+##   @itemx ps2
+##   @itemx psc
+##   @itemx psc2
+##     PostScript (level 1 and 2, mono and color).  The FLTK graphics
+## toolkit generates PostScript level 3.0.
+##
+##   @item  eps
+##   @itemx eps2
+##   @itemx epsc
+##   @itemx epsc2
+##     Encapsulated PostScript (level 1 and 2, mono and color).  The FLTK
+## graphic toolkit generates PostScript level 3.0.
+##
+##   @item  tex
+##   @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.
+##
+##   @item tikz
+##     Generate a @LaTeX{} file using PGF/TikZ@.  For the FLTK toolkit
+## the result is PGF.
+##
+##   @item  ill
+##   @itemx aifm
+##     Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
+##
+##   @item  cdr
+##   @itemx @nospell{corel}
+##     CorelDraw
+##
+##   @item dxf
+##     AutoCAD
+##
+##   @item  emf
+##   @itemx meta
+##     Microsoft Enhanced Metafile
+##
+##   @item fig
+##     XFig.  For the Gnuplot graphics toolkit, the additional options
+## @option{-textspecial} or @option{-textnormal} can be used to control
+## whether the special flag should be set for the text in
+## the figure.  (default is @option{-textnormal})
+##
+##   @item hpgl
+##     HP plotter language
+##
+##   @item mf
+##     Metafont
+##
+##   @item png
+##     Portable network graphics
+##
+##   @item  jpg
+##   @itemx jpeg
+##     JPEG image
+##
+##   @item gif
+##     GIF image (only available for the Gnuplot graphics toolkit)
+##
+##   @item pbm
+##     PBMplus
+##
+##   @item svg
+##     Scalable vector graphics
+##
+##   @item pdf
+##     Portable document format
+##   @end table
+##
+##   If the device is omitted, it is inferred from the file extension,
+## or if there is no filename it is sent to the printer as PostScript.
+##
+## @item -d@var{ghostscript_device}
+##   Additional devices are supported by Ghostscript.
+## Some examples are;
+##
+##   @table @code
+##   @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
+## and devices are available.
+##
+##   When Ghostscript output is sent to a printer the size is determined
+## by the figure's @qcode{"papersize"} property.  When the output
+## is sent to a file the size is determined by the plot box defined by
+## the figure's @qcode{"paperposition"} property.
+##
+## @item -append
+##   Append PostScript or PDF output to a pre-existing file of the same type.
+##
+## @item -r@var{NUM}
+##   Resolution of bitmaps in pixels per inch.  For both metafiles and
+## SVG the default is the screen resolution; for other formats it is 150 dpi.
+## To specify screen resolution, use @qcode{"-r0"}.
+##
+## @item  -loose
+## @itemx -tight
+##   Force a tight or loose bounding box for eps files.  The default is loose.
+##
+## @item -@var{preview}
+##   Add a preview to eps files.  Supported formats are:
+##
+##   @table @code
+##   @item -interchange
+##     Provide an interchange preview.
+##
+##   @item -metalfile
+##     Provide a metafile preview.
+##
+##   @item -pict
+##     Provide pict preview.
+##
+##   @item -tiff
+##     Provide a tiff preview.
+##   @end table
+##
+## @item -S@var{xsize},@var{ysize}
+##   Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@.  For
+## PS, EPS, PDF, and other vector formats the plot size is in points.
+## This option is equivalent to changing the size of the plot box
+## associated with the @qcode{"paperposition"} property.  When using the
+## command form of the print function you must quote the
+## @var{xsize},@var{ysize} option.  For example, by writing @w{"-S640,480"}.
+##
+## @item  -F@var{fontname}
+## @itemx -F@var{fontname}:@var{size}
+## @itemx -F:@var{size}
+##   Use @var{fontname} and/or @var{fontsize} for all text.
+## @var{fontname} is ignored for some devices: dxf, fig, hpgl, etc.
+## @end table
+##
+## The filename and options can be given in any order.
+##
+## Example: Print to a file using the svg device.
+##
+## @example
+## @group
+## figure (1);
+## clf ();
+## surf (peaks);
+## print -dsvg figure1.svg
+## @end group
+## @end example
+##
+## Example: Print to an HP DeskJet 550C.
+##
+## @example
+## @group
+## clf ();
+## surf (peaks);
+## print -dcdj550
+## @end group
+## @end example
+##
+## @seealso{saveas, orient, figure}
+## @end deftypefn
+
+function print (varargin)
+
+  opts = __print_parse_opts__ (varargin{:});
+
+  opts.pstoedit_cmd = @pstoedit;
+  opts.fig2dev_cmd = @fig2dev;
+  opts.latex_standalone = @latex_standalone;
+  opts.lpr_cmd = @lpr;
+  opts.epstool_cmd = @epstool;
+
+  if (! isfigure (opts.figure))
+    error ("print: no figure to print");
+  endif
+
+  orig_figure = get (0, "currentfigure");
+  set (0, "currentfigure", opts.figure);
+
+  if (opts.append_to_file)
+    [~, ~, ext] = fileparts (opts.ghostscript.output);
+    opts.ghostscript.prepend = strcat (tmpnam (), ext);
+    copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
+  endif
+
+  unwind_protect
+
+    ## Modify properties as specified by options
+    props = [];
+
+    drawnow ();
+
+    ## print() requires figure units to be "pixels"
+    props(1).h = opts.figure;
+    props(1).name = "units";
+    props(1).value = {get(opts.figure, "units")};
+    set (opts.figure, "units", "pixels");
+
+    ## graphics toolkit tranlates figure position to eps bbox in points
+    fpos = get (opts.figure, "position");
+    props(2).h = opts.figure;
+    props(2).name = "position";
+    props(2).value = {fpos};
+    fpos(3:4) = opts.canvas_size;
+    set (opts.figure, "position", fpos);
+
+    ## Set figure background to none. This is done both for
+    ## consistency with Matlab and to elliminate the visible
+    ## box along the figure's perimeter.
+    props(3).h = opts.figure;
+    props(3).name = "color";
+    props(3).value{1} = get (props(3).h, props(3).name);
+    set (props(3).h, "color", "none");
+
+    if (opts.force_solid != 0)
+      h = findall (opts.figure, "-property", "linestyle");
+      m = numel (props);
+      for n = 1:numel (h)
+        props(m+n).h = h(n);
+        props(m+n).name = "linestyle";
+        props(m+n).value = {get(h(n), "linestyle")};
+      endfor
+      if (opts.force_solid > 0)
+        linestyle = "-";
+      else
+        linestyle = "--";
+      endif
+      set (h, "linestyle", linestyle);
+    endif
+
+    if (opts.use_color < 0
+        && ! strcmp (get (opts.figure, "__graphics_toolkit__"), "gnuplot"))
+      color_props = {"color", "facecolor", "edgecolor", "colormap"};
+      for c = 1:numel (color_props)
+        h = findall (opts.figure, "-property", color_props{c});
+        hnone = findall (opts.figure, color_props{c}, "none");
+        h = setdiff (h, hnone);
+        m = numel (props);
+        for n = 1:numel (h)
+          if (ishandle (h(n)))
+            ## Need to verify objects exist since callbacks may delete objects
+            ## as the colors for others are modified.
+            rgb = get (h(n), color_props{c});
+            props(end+1).h = h(n);
+            props(end).name = color_props{c};
+            props(end).value = {get(h(n), color_props{c})};
+            if (isnumeric (rgb))
+              ## convert RGB color to RGB gray scale
+              xfer = repmat ([0.30, 0.59, 0.11], rows (rgb), 1);
+              ggg = repmat (sum (xfer .* rgb, 2), 1, 3);
+              set (h(n), color_props{c}, ggg);
+            endif
+          endif
+        endfor
+      endfor
+    endif
+
+    if (! isempty (opts.font) || ! isempty (opts.fontsize))
+      h = findall (opts.figure, "-property", "fontname");
+      m = numel (props);
+      for n = 1:numel (h)
+        if (ishandle (h(n)))
+          if (! isempty (opts.font))
+            props(end+1).h = h(n);
+            props(end).name = "fontname";
+            props(end).value = {get(h(n), "fontname")};
+          endif
+        endif
+        if (ishandle (h(n)))
+          if (! isempty (opts.fontsize))
+            props(end+1).h = h(n);
+            props(end).name = "fontsize";
+            props(end).value = {get(h(n), "fontsize")};
+          endif
+        endif
+      endfor
+      if (! isempty (opts.font))
+        set (h(ishandle (h)), "fontname", opts.font);
+      endif
+      if (! isempty (opts.fontsize))
+        if (ischar (opts.fontsize))
+          fontsize = str2double (opts.fontsize);
+        else
+          fontsize = opts.fontsize;
+        endif
+        if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1)
+          ## This is done to work around the bbox being whole numbers.
+          fontsize = fontsize * opts.scalefontsize;
+        endif
+        set (h(ishandle (h)), "fontsize", fontsize);
+      endif
+    endif
+
+    ## call the graphcis toolkit print script
+    switch (get (opts.figure, "__graphics_toolkit__"))
+      case "gnuplot"
+        opts = __gnuplot_print__ (opts);
+      otherwise
+        opts = __fltk_print__ (opts);
+    endswitch
+
+  unwind_protect_cleanup
+    ## restore modified properties
+    if (isstruct (props))
+      for n = numel (props):-1:1
+        if (ishandle (props(n).h))
+          set (props(n).h, props(n).name, props(n).value{1});
+        endif
+      endfor
+    endif
+
+    ## Unlink temporary files
+    for n = 1:numel (opts.unlink)
+      [status, output] = unlink (opts.unlink{n});
+      if (status != 0)
+        warning ("print.m: %s, '%s'", output, opts.unlink{n});
+      endif
+    endfor
+  end_unwind_protect
+
+  if (isfigure (orig_figure))
+    set (0, "currentfigure", orig_figure);
+  endif
+
+endfunction
+
+function cmd = epstool (opts, filein, fileout)
+  ## As epstool does not work with pipes, a subshell is used to
+  ## permit piping. Since this solution does not work with the DOS
+  ## command shell, the -tight and -preview options are disabled if
+  ## output must be piped.
+
+  ## DOS Shell:
+  ##   gs.exe [...] -sOutputFile=<filein> - & epstool -bbox -preview-tiff <filein> <fileout> & del <filein>
+  ## Unix Shell;
+  ##   cat > <filein> ; epstool -bbox -preview-tiff <filein> <fileout> ; rm <filein>
+
+  dos_shell = (ispc () && ! isunix ());
+
+  cleanup = "";
+  if (nargin < 3)
+    fileout = opts.name;
+  elseif (isempty (fileout))
+    fileout = "-";
+  endif
+
+  if (nargin < 2 || strcmp (filein, "-") || isempty (filein))
+    pipein = true;
+    filein = strcat (tmpnam (), ".eps");
+    if (dos_shell)
+      cleanup = sprintf ("& del %s ", strrep (filein, '/', '\'));
+    else
+      cleanup = sprintf ("; rm %s ", filein);
+    endif
+  else
+    pipein = false;
+    filein = strcat ("'", strtrim (filein), "'");
+  endif
+  if (strcmp (fileout, "-"))
+    pipeout = true;
+    fileout = strcat (tmpnam (), ".eps");
+    if (dos_shell)
+      cleanup = horzcat (cleanup, sprintf ("& del %s ", strrep (fileout, '/', '\')));
+    else
+      cleanup = horzcat (cleanup, sprintf ("; rm %s ", fileout));
+    endif
+  else
+    pipeout = false;
+    fileout = strcat ("'", strtrim (fileout), "'");
+  endif
+
+  if (! isempty (opts.preview) && opts.tight_flag)
+    warning ("print:previewandtight",
+             "print.m: eps preview may not be combined with -tight");
+  endif
+  if (! isempty (opts.preview) || opts.tight_flag)
+    if (! isempty (opts.epstool_binary))
+      if (opts.tight_flag)
+        cmd = "--copy --bbox";
+      elseif (! isempty (opts.preview))
+        switch (opts.preview)
+          case "tiff"
+            cmd = sprintf ("--add-%s-preview --device tiffg3", opts.preview);
+          case {"tiff6u", "tiff6p", "metafile"}
+            cmd = sprintf ("--add-%s-preview --device bmpgray", opts.preview);
+          case {"tiff4", "interchange"}
+            cmd = sprintf ("--add-%s-preview", opts.preview);
+          case "pict"
+            cmd = sprintf ("--add-%s-preview --mac-single", opts.preview);
+          otherwise
+            error ("print:invalidpreview",
+                   "print.m: epstool cannot include preview for format '%s'",
+                   opts.preview);
+        endswitch
+        if (! isempty (opts.ghostscript.resolution))
+          cmd = sprintf ("%s --dpi %d", cmd, opts.ghostscript.resolution);
+        endif
+      else
+        cmd = "";
+      endif
+      if (! isempty (cmd))
+        cmd = sprintf ("%s --quiet %s %s %s ", opts.epstool_binary,
+                       cmd, filein, fileout);
+      endif
+      if (pipein)
+        if (dos_shell)
+          filein(filein=="'") = "\"";
+          gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                                    "device", "epswrite",
+                                    "source", "-",
+                                    "output", filein);
+          cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
+        else
+          cmd = sprintf ("cat > %s ; %s", filein, cmd);
+        endif
+      endif
+      if (pipeout)
+        if (dos_shell)
+          cmd = sprintf ("%s & type %s", cmd, fileout);
+        else
+          cmd = sprintf ("%s ; cat %s", cmd, fileout);
+        endif
+      endif
+      if (! isempty (cleanup))
+        if (pipeout && dos_shell)
+          error ("print:epstoolpipe",
+                 "print.m: cannot pipe output of 'epstool' for DOS shell");
+        elseif (pipeout)
+          cmd = sprintf ("( %s %s )", cmd, cleanup);
+        else
+          cmd = sprintf ("%s %s", cmd, cleanup);
+        endif
+      endif
+    elseif (isempty (opts.epstool_binary))
+      error ("print:noepstool", "print.m: 'epstool' not found in PATH");
+    endif
+  else
+    if (pipein && pipeout)
+      if (dos_shell)
+        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                               "device", "epswrite",
+                               "source", "-",
+                               "output", "-");
+      else
+        cmd = " cat ";
+      endif
+    elseif (pipein && ! pipeout)
+      if (dos_shell)
+        ## ghostscript expects double, not single, quotes
+        fileout(fileout=="'") = "\"";
+        cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
+                               "device", "epswrite",
+                               "source", "-",
+                               "output", fileout);
+      else
+        cmd = sprintf (" cat > %s ", fileout);
+      endif
+    elseif (! pipein && pipeout)
+      if (dos_shell)
+        cmd = sprintf (" type %s ", filein);
+      else
+        cmd = sprintf (" cat %s ", filein);
+      endif
+    else
+      if (dos_shell)
+        cmd = sprintf (" copy %s %s ", filein, fileout);
+      else
+        cmd = sprintf (" cp %s %s ", filein, fileout);
+      endif
+    endif
+  endif
+  if (opts.debug)
+    fprintf ("epstool command: '%s'\n", cmd);
+  endif
+endfunction
+
+function cmd = fig2dev (opts, devopt)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  dos_shell = (ispc () && ! isunix ());
+  if (! isempty (opts.fig2dev_binary))
+    if (dos_shell)
+      ## FIXME - is this the right thing to do for DOS?
+      cmd = sprintf ("%s -L %s 2> NUL", opts.fig2dev_binary, devopt);
+    else
+      cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt);
+    endif
+  elseif (isempty (opts.fig2dev_binary))
+    error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("fig2dev command: '%s'\n", cmd);
+  endif
+endfunction
+
+function latex_standalone (opts)
+  n = find (opts.name == ".", 1, "last");
+  if (! isempty (n))
+    opts.name = opts.name(1:n-1);
+  endif
+  latexfile = strcat (opts.name, ".tex");
+  switch (opts.devopt)
+    case {"pdflatexstandalone"}
+      packages = "\\usepackage{graphicx,color}";
+      graphicsfile = strcat (opts.name, "-inc.pdf");
+    case {"pslatexstandalone"}
+      packages = "\\usepackage{epsfig,color}";
+      graphicsfile = strcat (opts.name, "-inc.ps");
+    otherwise
+      packages = "\\usepackage{epsfig,color}";
+      graphicsfile = strcat (opts.name, "-inc.eps");
+  endswitch
+  papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}",
+                       opts.canvas_size, opts.canvas_size);
+  prepend = {"\\documentclass{minimal}";
+             packages;
+             papersize;
+             "\\begin{document}";
+             "\\centering"};
+  postpend = {"\\end{document}"};
+  fid = fopen (latexfile, "r");
+  if (fid >= 0)
+    latex = fscanf (fid, "%c", Inf);
+    status = fclose (fid);
+    if (status != 0)
+      error ("print:errorclosingfile",
+             "print.m: error closing file '%s'", latexfile);
+    endif
+    ## TODO - should this be fixed in GL2PS?
+    latex = strrep (latex, "\\includegraphics{}",
+                    sprintf ("\\includegraphics{%s}", graphicsfile));
+  else
+    error ("print:erroropeningfile",
+           "print.m: error opening file '%s'", latexfile);
+  endif
+  fid = fopen (latexfile, "w");
+  if (fid >= 0)
+    fprintf (fid, "%s\n", prepend{:});
+    fprintf (fid, "%s", latex);
+    fprintf (fid, "%s\n", postpend{:});
+    status = fclose (fid);
+    if (status != 0)
+      error ("print:errorclosingfile",
+             "print.m: error closing file '%s'", latexfile);
+    endif
+  else
+    error ("print:erroropeningfile",
+           "print.m: error opening file '%s'", latexfile);
+  endif
+endfunction
+
+function cmd = lpr (opts)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  if (! isempty (opts.lpr_binary))
+    cmd = opts.lpr_binary;
+    if (! isempty (opts.lpr_options))
+      cmd = sprintf ("%s %s", cmd, opts.lpr_options);
+    endif
+    if (! isempty (opts.printer))
+      cmd = sprintf ("%s -P %s", cmd, opts.printer);
+    endif
+  elseif (isempty (opts.lpr_binary))
+    error ("print:nolpr", "print.m: 'lpr' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("lpr command: '%s'\n", cmd);
+  endif
+endfunction
+
+function cmd = pstoedit (opts, devopt)
+  if (nargin < 2)
+    devopt =  opts.devopt;
+  endif
+  dos_shell = (ispc () && ! isunix ());
+  if (! isempty (opts.pstoedit_binary))
+    if (dos_shell)
+      cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt);
+    else
+      ## FIXME - is this the right thing to do for DOS?
+      cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt);
+    endif
+  elseif (isempty (opts.pstoedit_binary))
+    error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH");
+  endif
+  if (opts.debug)
+    fprintf ("pstoedit command: '%s'\n", cmd);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/printd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,115 @@
+## Copyright (C) 2013 Michael D. Godfrey
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public
+## License as published by the Free Software Foundation;
+## either version 3 of the License, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied
+## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+## PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public
+## License along with Octave; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} printd (@var{obj}, @var{filename})
+## @deftypefnx {Function File} {@var{out_file} =} printd (@dots{})
+##
+## Convert any object acceptable to @code{disp} into the format
+## selected by the suffix of @var{filename}.  If the return argument
+## @var{out_file} is given, the name of the created file is returned.
+##
+## This function is intended to facilitate manipulation of the output
+## of functions such as @code{stemleaf}.
+## @seealso{stemleaf}
+## @end deftypefn
+
+## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com>
+## Description: Convert objects into other file formats.
+
+function pr_out = printd (obj, filename)
+  ## Convert any object acceptable to disp() into various display formats.
+  ## obj is the input object.
+  ## filename is the output file (with required suffix).
+
+  ## Extract .suffix from filename
+  if ((sufix = rindex (filename, ".")) <= 0)
+    error ("The output filename: %s requires a suffix.\nOptions are: pdf ps eps txt jpg jpeg", filename);
+  endif
+  opt = substr (filename, sufix+1);
+  [pf, tempf, mag] = mkstemp ("oct-XXXXXX", 1);  # Safe version of tmpnam()
+  fprintf (pf, "%s", disp (obj));
+  frewind (pf);
+
+  ## It seems best to only use convert for image output.  Its ps and pdf
+  ## are badly rendered.
+  opt = lower (opt);
+  switch (opt)
+    case "pdf"
+      enscr = sprintf (
+                       "enscript --no-header -o %s.ps %s ; ps2pdf %s.ps %s.pdf; mv %s.pdf %s;exit",...
+                       tempf, tempf, tempf, tempf, tempf, filename);
+      system (enscr);
+      delete ([tempf ".ps"]);
+    case "ps"
+      enscr = sprintf ("enscript --no-header -o %s %s ; exit", filename, tempf);
+      system (enscr);
+    case "eps"
+      enscr = sprintf (
+                       "enscript --no-header -o %s.ps %s ; ps2eps --ignoreBB %s.ps; mv %s.eps %s; exit",...
+                       tempf, tempf, tempf, tempf, filename);
+      system (enscr);
+      delete ([tempf ".ps"]);
+    case "txt"
+      enscr = sprintf ("cp %s %s", tempf, filename);
+      system (enscr);
+    case {"jpg", "jpeg"}
+      enscr = sprintf ("convert -trim txt:%s  jpg:%s", tempf, filename);
+      system (enscr);
+    otherwise
+      fclose (pf);
+      delete (tempf);
+      error ("Unknown conversion type: %s.\nOptions are: pdf ps eps txt jpg jpeg", opt);
+
+  endswitch
+  fclose (pf);
+  delete (tempf);
+  pr_out =  sprintf ("%s file %s written\n", opt, filename);
+endfunction
+
+
+%!demo
+%! r2 = char (
+%! 'stem step: 10, data: unsorted.',
+%! 'Hinges:    lo: 12, hi: 42'     ,
+%! '   1 | 22118'                  ,
+%! '   2 | 28'                     ,
+%! '   3 | 98'                     ,
+%! '   4 | 244'                    ,
+%! '   5 | 2'                      );
+%! printd (r2, 'test_p.txt');
+%! system ('cat test_p.txt');
+%! delete ('test_p.txt');
+
+%!test
+%! r2 = char (
+%! "stem step: 10, data: unsorted.",
+%! "Hinges:    lo: 12, hi: 42"     ,
+%! "   1 | 22118"                  ,
+%! "   2 | 28"                     ,
+%! "   3 | 98"                     ,
+%! "   4 | 244"                    ,
+%! "   5 | 2"                      );
+%! printd (r2, "test_p.txt");
+%! r4 = fileread ("test_p.txt");
+%! delete ("test_p.txt");
+%! r2 = disp (r2);
+%! assert (r4, r2);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__add_default_menu__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,119 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __add_default_menu__ (@var{fig})
+## Add default menu to figure.  All uimenu handles have
+## their @qcode{"HandleVisibility"} property set to @qcode{"off"}.
+## @end deftypefn
+
+## Author: Kai Habel
+
+function __add_default_menu__ (fig)
+
+  ## Only FLTK toolkit currently provides menubar
+  if (! strcmp (get (fig, "__graphics_toolkit__"), "fltk"))
+    return;
+  endif
+
+  obj = findall (fig, "-depth", 1, "tag", "__default_menu__", "label", "&File");
+  if (isempty (obj))
+    ## FIXME: uimenu() will cause menubar to be displayed, even though property
+    ##        menubar remains set at "none".  So, forcibly turn menubar status
+    ##        on and then off to force figure to hide menubar.
+    menubar_state = get (fig, "menubar");
+    set (fig, "menubar", "figure");
+
+    __f = uimenu (fig, "label", "&File", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__f, "label", "Save &As", "callback", @save_cb);
+      uimenu (__f, "label", "&Save", "callback", @save_cb);
+      uimenu (__f, "label", "&Close", "callback", "close (gcf)");
+
+    __e = uimenu (fig, "label", "&Edit", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__e, "label", "&Grid", "callback", @grid_cb);
+      uimenu (__e, "label", "Auto&scale", "callback", @autoscale_cb);
+      gm = uimenu (__e, "label", "GUI &Mode");
+        uimenu (gm, "label", "Pan+Zoom", "callback", @guimode_cb);
+        uimenu (gm, "label", "Rotate+Zoom", "callback", @guimode_cb);
+        uimenu (gm, "label", "None", "callback", @guimode_cb);
+
+    __h = uimenu (fig, "label", "&Help", "handlevisibility", "off",
+                       "tag", "__default_menu__");
+      uimenu (__h, "label", "A&bout", "enable", "off");
+
+    ## FIXME: This drawnow () must occur after at least one menu item has
+    ##        been defined to avoid sizing issues in new figures.
+    ##        This may lead to flicker.  The real fix must be in the C++ code. 
+    drawnow ();
+
+    set (fig, "menubar", menubar_state);
+  endif
+
+endfunction
+
+function save_cb (h, e)
+  lbl = get (gcbo, "label");
+  if (strcmp (lbl, "&Save"))
+    fname = get (gcbo, "userdata");
+    if (isempty (fname))
+      __save_as__ (gcbo);
+    else
+      saveas (gcbo, fname);
+    endif
+  elseif (strcmp (lbl, "Save &As"))
+    __save_as__ (gcbo);
+  endif
+endfunction
+
+function __save_as__ (caller)
+  [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg",
+                                    "Supported Graphic Formats"},
+                                   "Save Figure",
+                                   pwd);
+  if (filename != 0)
+    fname = [filedir filesep() filename];
+    obj = findall (gcbf, "label", "&Save");
+    if (! isempty (obj))
+      set (obj(1), "userdata", fname);
+    endif
+    saveas (caller, fname);
+  endif
+endfunction
+
+function grid_cb (h, e)
+  grid;
+endfunction
+
+function autoscale_cb (h, e)
+  axis ("auto");
+endfunction
+
+function guimode_cb (h, e)
+  lbl = get (h, "label");
+  switch (lbl)
+    case "Pan+Zoom"
+      gui_mode ("2D");
+    case "Rotate+Zoom"
+      gui_mode ("3D");
+    case "None"
+      gui_mode ("None");
+  endswitch
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__fltk_ginput__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,95 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __fltk_ginput__ (@var{f}, @var{n})
+## Undocumented internal function.
+## @end deftypefn
+
+## This is ginput.m implementation for fltk.
+
+function [x, y, button] = __fltk_ginput__ (f, n = -1)
+
+  if (isempty (get (f, "currentaxes")))
+    error ("ginput: must have at least one axes");
+  endif
+
+  x = y = button = [];
+  ginput_accumulator (0, 0, 0, 0);  # initialize accumulator
+
+  unwind_protect
+
+    orig_windowbuttondownfcn = get (f, "windowbuttondownfcn");
+    set (f, "windowbuttondownfcn", @ginput_windowbuttondownfcn);
+
+    orig_ginput_keypressfcn = get (f, "keypressfcn");
+    set (f, "keypressfcn", @ginput_keypressfcn);
+
+    do
+      __fltk_redraw__ ();
+
+      ## Release CPU.
+      sleep (0.01);
+
+      [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0);
+    until (n0 == n || n0 < 0)
+
+  unwind_protect_cleanup
+    set (f, "windowbuttondownfcn", orig_windowbuttondownfcn);
+    set (f, "keypressfcn", orig_ginput_keypressfcn);
+  end_unwind_protect
+
+endfunction
+
+function [x, y, n, button] = ginput_accumulator (mode, xn, yn, btn)
+  persistent x y n button;
+
+  if (mode == 0)
+    ## Initialize.
+    x = y = button = [];
+    n = 0;
+  elseif (mode == 1)
+    ## Append mouse button or key press.
+    x = [x; xn];
+    y = [y; yn];
+    button = [button; btn];
+    n += 1;
+  elseif (mode == 2)
+    ## The end due to Enter.
+    n = -1;
+ endif
+
+endfunction
+
+function ginput_windowbuttondownfcn (src, data)
+  point = get (get (src,"currentaxes"), "currentpoint");
+  button = data;
+  ginput_accumulator (1, point(1,1), point(2,1), button);
+endfunction
+
+function ginput_keypressfcn (src, evt)
+  point = get (get (src, "currentaxes"), "currentpoint");
+  key = evt.Key;
+  if (key == 10)
+    ## Enter key stops ginput.
+    ginput_accumulator (2, NaN, NaN, NaN);
+  else
+    ginput_accumulator (1, point(1,1), point(2,1), key);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__fltk_print__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,174 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __fltk_print__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+function opts = __fltk_print__ (opts)
+
+  dos_shell = (ispc () && ! isunix ());
+
+  set (0, "currentfigure", opts.figure);
+  drawnow ("expose");
+  __fltk_redraw__ ();
+
+  if (! isempty (opts.fig2dev_binary))
+    ## fig2dev is prefered for conversion to emf
+    fig2dev_devices = {"pstex", "mf", "emf"};
+  else
+    fig2dev_devices = {"pstex", "mf"};
+  endif
+
+  gl2ps_device = {};
+  pipeline = {};
+  switch (lower (opts.devopt))
+    case {"eps", "eps2", "epsc", "epsc2"}
+      ## format GL2PS_EPS
+      gl2ps_device = {"eps"};
+      ## FIXME: use epstool to tighten bbox and provide preview.
+      pipeline = {opts.epstool_cmd(opts, "-", opts.name)};
+    case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ...
+          "pslatexstandalone", "pdflatexstandalone"}
+      ## format GL2PS_TEX
+      n = find (opts.devopt == "l", 1);
+      suffix = opts.devopt(1:n-1);
+      dot = find (opts.name == ".", 1, "last");
+      if ((! isempty (dot))
+          && any (strcmpi (opts.name(dot:end), ...
+                  {strcat(".", suffix), ".tex", "."})))
+        name = opts.name(1:dot-1);
+        if (dot < numel (opts.name)
+            && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"})))
+          ## If user provides eps/ps/pdf suffix, use it.
+          suffix = opts.name(dot+1:end);
+        endif
+      else
+        error ("print:invalid-suffix", 
+               "invalid suffix '%s' for device '%s'.",
+               opts.name(dot:end), lower (opts.devopt));
+      endif
+      gl2ps_device = {sprintf("%snotxt", lower (suffix))};
+      gl2ps_device{2} = "tex";
+      if (dos_shell)
+        ## FIXME: this will only work on MinGW with the MSYS shell
+        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
+        pipeline{2} = sprintf ("cat > %s.tex", name);
+      else
+        pipeline = {sprintf("cat > %s-inc.%s", name, suffix)};
+        pipeline{2} = sprintf ("cat > %s.tex", name);
+      endif
+    case "tikz"
+      ## format GL2PS_PGF
+      gl2ps_device = {"pgf"};
+      pipeline = {sprintf("cat > %s", opts.name)};
+    case "svg"
+      ## format GL2PS_SVG
+      gl2ps_device = {"svg"};
+      pipeline = {sprintf("cat > %s", opts.name)};
+    case fig2dev_devices
+      cmd_pstoedit = opts.pstoedit_cmd (opts, "fig");
+      cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt);
+      if (strcmp (opts.devopt, "pstex"))
+        [~, ~, ext] = fileparts (opts.name);
+        if (any (strcmpi (ext, {".ps", ".tex", "."})))
+          opts.name = opts.name(1:end-numel(ext));
+        endif
+        opts.name = strcat (opts.name, ".ps");
+        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+        cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t");
+        gl2ps_device{2} = "eps";
+        pipeline{2} = sprintf ("%s | %s > %s", cmd_pstoedit,
+                               cmd_fig2dev, strrep(opts.name, ".ps", ".tex"));
+      else
+        cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+      endif
+    case "aifm"
+      cmd = opts.pstoedit_cmd (opts, "ps2ai");
+      gl2ps_device = {"eps"};
+      pipeline = {sprintf("%s > %s", cmd, opts.name)};
+    case {"dxf", "emf", "fig", "hpgl"}
+      cmd = opts.pstoedit_cmd (opts);
+      gl2ps_device = {"eps"};
+      pipeline = {sprintf("%s > %s", cmd, opts.name)};
+    case {"corel", "gif"}
+      error ("print:unsupporteddevice",
+             "print.m: %s output is not available for the FLTK graphics toolkit",
+             upper (opts.devopt));
+    case opts.ghostscript.device
+      opts.ghostscript.source = "-";
+      opts.ghostscript.output = opts.name;
+      if (opts.send_to_printer)
+        opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = [];
+        opts.ghostscript.output = "-";
+      endif
+      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
+      if (opts.send_to_printer || isempty (opts.name))
+        cmd_lpr = opts.lpr_cmd (opts);
+        cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr);
+      else
+        cmd = sprintf ("%s", cmd_gs);
+      endif
+      if (! isempty (cmd_cleanup))
+        gl2ps_device = {"eps"};
+        if (dos_shell)
+          pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)};
+        else
+          pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)};
+        endif
+      else
+        gl2ps_device = {"eps"};
+        pipeline = {cmd};
+      endif
+    otherwise
+      error (sprintf ("print:no%soutput", opts.devopt),
+             "print.m: %s output is not available for GL2PS output",
+             upper (opts.devopt));
+  endswitch
+
+  opts.pipeline = pipeline;
+
+  ## Tell gl2ps to use different rendering options for 2D plots
+  haxes = findall (opts.figure, "type", "axes");
+  vw = get (haxes, "view");
+  if (iscell (vw))
+    vw = vertcat (vw{:});
+  endif
+  is2D = all (abs (vw(:,2)) == 90);
+  if (is2D)
+    gl2ps_device{end} = [gl2ps_device{end}, "is2D"];
+  endif
+
+  for n = 1:numel (pipeline)
+    if (opts.debug)
+      fprintf ("fltk-pipeline: '%s'\n", pipeline{n});
+    endif
+    drawnow (gl2ps_device{n}, strcat ('|',pipeline{n}));
+  endfor
+
+  if (! isempty (strfind (opts.devopt, "standalone")))
+    opts.latex_standalone (opts);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__ghostscript__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,171 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __ghostscript__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-07-26
+
+function [gs_cmd, cleanup_cmd] = __ghostscript__ (varargin);
+
+  opts.binary = "";
+  opts.source = "-";
+  opts.output = "-";
+  opts.device = "";
+  opts.epscrop = false;
+  opts.antialiasing  = false;
+  opts.antialiasing_textalphabits = 4;,
+  opts.antialiasing_graphicsalphabits = 4;
+  opts.resolution = 150;
+  opts.papersize = "";
+  opts.pageoffset = [0 0];
+  opts.debug = false;
+  opts.level = [];
+  opts.prepend = "";
+
+  offsetfile = "";
+  offset_ps = {};
+  cleanup_cmd = "";
+
+  args = varargin;
+  n = find (cellfun ("isclass", args, "struct"));
+  if (! isempty (n))
+    f = fieldnames (args{n});
+    for m = 1:numel (f)
+      opts.(f{m}) = args{n}.(f{m});
+    endfor
+    args(n) = [];
+  endif
+  for n = 1:2:numel (args)
+    opts.(args{n}) = args{n+1};
+  endfor
+
+  if (isempty (opts.papersize))
+    format_for_printer = false;
+  else
+    format_for_printer = true;
+  endif
+
+  gs_opts = sprintf ("-dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=%s", opts.device);
+
+  if (! isempty (opts.level) && ismember (opts.level, [1, 2, 3]))
+    gs_opts = sprintf ("%s -dLanguageLevel=%d", gs_opts, round (opts.level));
+  endif
+
+  if (opts.antialiasing && isempty (strfind (opts.device, "write")))
+    ## Apply anti-aliasing to all bitmap formats/devices
+    gs_opts = sprintf ("%s -dTextAlphaBits=%d -dGraphicsAlphaBits=%d",
+                       gs_opts, opts.antialiasing_textalphabits,
+                       opts.antialiasing_graphicsalphabits);
+    gs_opts = sprintf ("%s -r%dx%d", gs_opts, [1, 1] * opts.resolution);
+  elseif (any (strcmp (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
+    gs_opts = sprintf ("%s -dEmbedAllFonts=true", gs_opts);
+    if (strcmp (opts.device, "pdfwrite"))
+      ## Optimize for loading
+      gs_opts = sprintf ("%s -dOptimize=true", gs_opts);
+    endif
+  endif
+
+  if (opts.epscrop)
+    ## papersize is specified by the eps bbox
+    gs_opts = sprintf ("%s -dEPSCrop", gs_opts);
+  endif
+  if (format_for_printer)
+    if (ischar (opts.papersize))
+      gs_opts = sprintf ("%s -sPAPERSIZE=%s", gs_opts, opts.papersize);
+    elseif (isnumeric (opts.papersize) && numel (opts.papersize) == 2)
+      gs_opts = sprintf ("%s -dDEVICEWIDTHPOINTS=%d -dDEVICEHEIGHTPOINTS=%d",
+                         gs_opts, opts.papersize);
+      if (opts.papersize(1) > opts.papersize(2))
+        ## Lanscape mode: This option will result in automatic rotation of the
+        ##                document page if the requested page size matches one
+        ##                of the default page sizes
+        gs_opts = sprintf ("%s -dNORANGEPAGESIZE", gs_opts);
+      endif
+    else
+      error ("print:badpapersize", "__ghostscript__.m: invalid 'papersize'");
+    endif
+    gs_opts = sprintf ("%s -dFIXEDMEDIA", gs_opts);
+    ## "pageoffset" is relative to the coordinates, not the BBox LLHC.
+    str = sprintf ("%s [%d %d] %s", "<< /Margins [0 0] /.HWMargins [0 0 0 0] /PageOffset",
+                   opts.pageoffset, ">> setpagedevice");
+    offset_ps = {"%!PS-Adobe-3.0", str, "%%EOF"};
+    if (isfield (opts, "offsetfile"))
+      offsetfile = opts.offsetfile;
+      cleanup_cmd = "";
+    else
+      offsetfile = strcat (tmpnam (), ".ps");
+      cleanup_cmd = sprintf ("rm %s", offsetfile);
+    endif
+    unwind_protect
+      fid = fopen (offsetfile, "w");
+      if (fid == -1)
+        error ("print:fopenfailed", "__ghostscript__.m: fopen () failed");
+      endif
+      fprintf (fid, "%s\n", offset_ps{:});
+    unwind_protect_cleanup
+      status = fclose (fid);
+      if (status == -1)
+        error ("print:fclosefailed", "__ghostscript__.m: fclose () failed");
+      endif
+    end_unwind_protect
+    if (opts.debug)
+      fprintf ("---- begin %s ----\n", offsetfile);
+      fprintf ("%s\n", offset_ps{:});
+      fprintf ("----- end %s -----\n", offsetfile);
+    endif
+  endif
+
+  if (isempty (opts.binary))
+    error ("print:no_ghostscript", "__ghostscript__.m: ghostscript is required.");
+  elseif (isempty (opts.output))
+    cmd = sprintf ("%s %s", opts.binary, gs_opts);
+  else
+    cmd = sprintf ("%s %s -sOutputFile=\"%s\"", opts.binary, gs_opts, opts.output);
+  endif
+  if (! isempty (opts.prepend)
+      && any (strcmpi (opts.device, {"pswrite", "ps2write", "pdfwrite"})))
+    ## FIXME - Fonts get may be mangled when appending ps/ps2.
+    ##         See "How to concatenate several PS files" at the link,
+    ##         http://en.wikibooks.org/wiki/PostScript_FAQ
+    cmd = sprintf ("%s %s", cmd, opts.prepend);
+    if (isempty (cleanup_cmd))
+      cleanup_cmd = sprintf ("rm %s", opts.prepend);
+    else
+      cleanup_cmd = sprintf ("%s ; rm %s", cleanup_cmd, opts.prepend);
+    endif
+  endif
+  if (! isempty (offsetfile) && format_for_printer)
+    cmd = sprintf ("%s %s", cmd, offsetfile);
+  endif
+  if (! isempty (opts.source))
+    cmd = sprintf ("%s %s", cmd, opts.source);
+  endif
+
+  if (opts.debug)
+    fprintf ("Ghostscript command: '%s'\n", cmd);
+  endif
+
+  gs_cmd = cmd;
+
+endfunction
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_get_var__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,150 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{value} =} __gnuplot_get_var__ (@var{h}, @var{name}, @var{fmt})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-02-07
+
+function gp_var_value = __gnuplot_get_var__ (h, gp_var_name, fmt = "")
+
+  if (numel (h) == 1 && isfigure (h))
+    if (isempty (get (gcf, "__plot_stream__")))
+      ostream = __gnuplot_open_stream__ (2, h);
+    else
+      ostream = get (h, "__plot_stream__");
+    endif
+  else
+    ostream = h;
+  endif
+  if (numel (ostream) < 1)
+    error ("__gnuplot_get_var__: stream to gnuplot not open");
+  elseif (ispc ())
+    if (numel (ostream) == 1)
+      error ("__gnuplot_get_var__: Need mkfifo that is not implemented under Windows");
+    endif
+    use_mkfifo = false;
+    istream = ostream(2);
+    ostream = ostream(1);
+  else
+    use_mkfifo = true;
+    ostream = ostream(1);
+  endif
+
+  if (use_mkfifo)
+    gpin_name = tmpnam ();
+
+    ## Mode: 0600 == 6*8*8
+    [err, msg] = mkfifo (gpin_name, 6*8*8);
+
+    if (err)
+      error ("__gnuplot_get_var__: Can not make FIFO (%s)", msg);
+    endif
+  endif
+
+  gp_var_name = strtrim (gp_var_name);
+  n = min (strfind (gp_var_name, " "), strfind (gp_var_name, ",")) - 1;
+  if (isempty (n))
+    n = numel (gp_var_name);
+  endif
+
+  unwind_protect
+
+    ## Notes: Variables may be undefined if user closes gnuplot by "q"
+    ## or Alt-F4.  Further, this abrupt close also requires the leading
+    ## "\n" on the next line.
+    if (use_mkfifo)
+      fprintf (ostream, "\nset print \"%s\";\n", gpin_name);
+      fflush (ostream);
+      [gpin, err] = fopen (gpin_name, "r");
+      if (err)
+        ## Try a second time, and then give an error.
+        [gpin, err] = fopen (gpin_name, "r");
+      endif
+      if (err)
+        error ("__gnuplot_get_var__: can not open FIFO");
+      endif
+      gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n",
+                        gp_var_name(1:n), gp_var_name);
+      fputs (ostream, gp_cmd);
+
+      ## Close output file, to force it to be flushed
+      fputs (ostream, "set print;\n");
+      fflush (ostream);
+
+      ## Now read from fifo.
+      reading = true;
+      str = {};
+      while (reading)
+        str{end+1} = fgets (gpin);
+        if (isnumeric (str{end}) && (str{end} == -1))
+          reading = false;
+          str = str(1:(end-1));
+        endif
+      endwhile
+      str = strcat (str{:});
+      fclose (gpin);
+    else
+      ## Direct gnuplot to print to <STDOUT>
+      fprintf (ostream, "set print \"-\";\n");
+      fflush (ostream);
+      gp_cmd = sprintf ("\nif (exists(\"%s\")) print \"OCTAVE: \", %s; else print NaN\n",
+                        gp_var_name(1:n), gp_var_name);
+      fputs (ostream, gp_cmd);
+      fflush (ostream);
+      ## Direct gnuplot to print to <STDERR>
+      fputs (ostream, "set print;\n");
+      fflush (ostream);
+
+      str = {};
+      while (isempty (str))
+        str = fread (istream, "*char")';
+        if (isempty (str))
+          sleep (0.05);
+        else
+          str = regexp (str, 'OCTAVE:.*', "match");
+          str = str{end}(8:end);
+        endif
+        fclear (istream);
+      endwhile
+    endif
+
+    ## Strip out EOLs and the continuation character "|"
+    str(str=="\n" | str=="\r") = "";
+    n_continue = strfind (str, " \\ ");
+    if (! isempty (n_continue))
+      str(n_continue+1) = "";
+    endif
+
+    if (isempty (fmt))
+      gp_var_value = strtrim (str);
+    else
+      gp_var_value = sscanf (str, fmt);
+    endif
+
+  unwind_protect_cleanup
+    if (use_mkfifo)
+      unlink (gpin_name);
+    endif
+  end_unwind_protect
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_ginput__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,149 @@
+## Copyright (C) 2004-2012 Petr Mikulik
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} __gnuplot_ginput__ (@var{f}, @var{n})
+## Undocumented internal function.
+## @end deftypefn
+
+## This is ginput.m implementation for gnuplot and X11.
+## It requires gnuplot 4.1 and later.
+
+## This file initially bore the copyright statement
+## Petr Mikulik
+## History: June 2006; August 2005; June 2004; April 2004
+## License: public domain
+
+function [x, y, button] = __gnuplot_ginput__ (f, n)
+
+  if (compare_versions (__gnuplot_version__ (), "4.0", "<="))
+    error ("ginput: version %s of gnuplot not supported", gnuplot_version ());
+  endif
+
+  ostream = get (f, "__plot_stream__");
+  if (numel (ostream) < 1)
+    error ("ginput: stream to gnuplot not open");
+  elseif (ispc ())
+    if (numel (ostream) == 1)
+      error ("ginput: Need mkfifo that is not implemented under Windows");
+    endif
+    use_mkfifo = false;
+    istream = ostream(2);
+    ostream = ostream(1);
+  else
+    use_mkfifo = true;
+    ostream = ostream(1);
+  endif
+
+  if (nargin == 1)
+    x = zeros (100, 1);
+    y = zeros (100, 1);
+    button = zeros (100, 1);
+  else
+    x = zeros (n, 1);
+    y = zeros (n, 1);
+    button = zeros (n, 1);
+  endif
+
+  if (use_mkfifo)
+    gpin_name = tmpnam ();
+
+    ##Mode: 6*8*8 ==  0600
+    [err, msg] = mkfifo (gpin_name, 6*8*8);
+
+    if (err)
+      error ("ginput: Can not open fifo (%s)", msg);
+    endif
+  endif
+
+  unwind_protect
+
+    k = 0;
+    while (true)
+      k++;
+
+      ## Notes: MOUSE_* can be undefined if user closes gnuplot by "q"
+      ## or Alt-F4. Further, this abrupt close also requires the leading
+      ## "\n" on the next line.
+      if (use_mkfifo)
+        fprintf (ostream, "set print \"%s\";\n", gpin_name);
+        fflush (ostream);
+        [gpin, err] = fopen (gpin_name, "r");
+        if (err)
+          error ("ginput: Can not open FIFO (%s)", msg);
+        endif
+        fputs (ostream, "pause mouse any;\n\n");
+        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
+
+        ## Close output file, to force it to be flushed
+        fputs (ostream, "set print;\n");
+        fflush (ostream);
+
+        ## Now read from fifo.
+        [x(k), y(k), button(k), count] = fscanf (gpin, "%f %f %d", "C");
+        fclose (gpin);
+      else
+        fputs (ostream, "set print \"-\";\n");
+        fflush (ostream);
+        fputs (ostream, "pause mouse any;\n\n");
+        fputs (ostream, "\nif (exists(\"MOUSE_KEY\") && exists(\"MOUSE_X\")) print \"OCTAVE: \", MOUSE_X, MOUSE_Y, MOUSE_KEY; else print \"0 0 -1\"\n");
+
+        ## Close output file, to force it to be flushed
+        fputs (ostream, "set print;\n");
+        fflush (ostream);
+
+        str = {};
+        while (isempty (str))
+          str = fread (istream, "*char")';
+          if (isempty (str))
+            sleep (0.05);
+          else
+            str = regexp (str, 'OCTAVE:\s+[-+.\d]+\s+[-+.\d]+\s+\d*', 'match');
+          endif
+          fclear (istream);
+        endwhile
+        [x(k), y(k), button(k), count] = sscanf (str{end}(8:end), "%f %f %d", "C");
+      endif
+
+      if ([x(k), y(k), button(k)] == [0, 0, -1])
+        ## Mousing not active (no plot yet).
+        break;
+      endif
+
+      if (button(k) == 0x0D || button(k) == 0x0A)
+        ## Stop when hitting a RETURN or ENTER key.
+        x(k:end) = [];
+        y(k:end) = [];
+        button(k:end) = [];
+        break;
+      endif
+      if (nargin > 1 && k == n)
+        ## Input argument n was given, stop when k == n.
+        break;
+      endif
+
+    endwhile
+
+  unwind_protect_cleanup
+    if (use_mkfifo)
+      unlink (gpin_name);
+    endif
+  end_unwind_protect
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_has_feature__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,64 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-01-27
+
+function res = __gnuplot_has_feature__ (feature)
+  persistent features = {"x11_figure_position",
+                         "wxt_figure_size",
+                         "transparent_patches",
+                         "transparent_surface",
+                         "epslatex_implies_eps_filesuffix",
+                         "epslatexstandalone_terminal",
+                         "screen_coordinates_for_{lrtb}margin",
+                         "variable_GPVAL_TERMINALS",
+                         "key_has_font_properties",
+                         "windows_figure_position",
+                         "has_termoption_dashed"};
+  persistent has_features;
+
+  if (isempty (has_features))
+    try
+      gnuplot_version = __gnuplot_version__ ();
+    catch
+      ## Don't throw an error if gnuplot isn't installed
+      gnuplot_version = "0.0.0";
+    end_try_catch
+    versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
+    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
+    have_features = false (size (features));
+    for n = 1 : numel (have_features)
+      has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
+    endfor
+  endif
+
+  n = find (strcmpi (feature, features));
+  if (isempty (n))
+    res = NaN;
+  else
+    res = has_features(n);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_has_terminal__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,65 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-09-13
+
+function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
+
+  term = strtrim (term);
+  term = lower (strtok (term, " "));
+
+  if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
+    if (nargin < 2)
+      plot_stream = __gnuplot_open_stream__ (2);
+    endif
+    available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
+    available_terminals = regexp (available_terminals, '\w+', "match");
+    if (nargin < 2 && ! isempty (plot_stream))
+      pclose (plot_stream(1));
+      if (numel (plot_stream) > 1)
+        pclose (plot_stream(2));
+      endif
+      if (numel (plot_stream) > 2)
+        waitpid (plot_stream(3));
+      endif
+    endif
+  else
+    ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
+    ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
+    available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
+                           "dumb", "dxf", "eepic", "emf", "epslatex", ...
+                           "epson_180dpi", "fig", "gif", "gnugraph", ...
+                           "gpic", "hp2623A", "hp2648", "hp500c", ...
+                           "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
+                           "latex", "mf", "mif", "mp", "pbm", "pdf", ...
+                           "pm", "png", "postscript", "pslatex", ...
+                           "pstex", "pstricks", "qms", "regis", "rgip", ...
+                           "svg", "texdraw", "tgif", "tkcanvas", ...
+                           "tpic", "windows", "x11", "xlib", "xterm"};
+  endif
+
+  gnuplot_supports_term = any (strcmp (term, available_terminals));
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_open_stream__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,46 @@
+## Copyright (C) 2009-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{stream} =} __gnuplot_open_stream__ (@var{npipes}, @var{h})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2009-04-11
+
+function plot_stream = __gnuplot_open_stream__ (npipes, h)
+  [prog, args] = gnuplot_binary ();
+  if (npipes > 1)
+    [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:});
+    if (pid < 0)
+      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
+    else
+      plot_stream(3) = pid;
+    endif
+  else
+    plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
+    if (plot_stream < 0)
+      error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
+    endif
+  endif
+  if (nargin > 1)
+    set (h, "__plot_stream__", plot_stream);
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_print__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,316 @@
+## Copyright (C) 1999-2012 Daniel Heiserer
+## Copyright (C) 2001 Laurent Mazet
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __gnuplot_print__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de>
+## Adapted-By: jwe
+
+function opts = __gnuplot_print__ (opts)
+
+  dos_shell = (ispc () && ! isunix ());
+
+  if (isempty (opts.fontsize))
+    ## If no fontsize, determine the nominal axes fontsize.
+    defaultfontsize = get (0, "defaultaxesfontsize");
+    axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize");
+    if (iscell (axesfontsize))
+      axesfontsize = round (median (cell2mat (axesfontsize)));
+    endif
+    if (isempty (axesfontsize))
+      opts.fontsize = defaultfontsize;
+    else
+      opts.fontsize = axesfontsize;
+    endif
+  endif
+  ## The axes-label and tick-label spacing is determined by
+  ## the font spec given in "set terminal ..."
+  gp_opts = font_spec (opts);
+
+  pipeline = "";
+
+  switch (lower (opts.devopt))
+    case {"eps", "eps2", "epsc", "epsc2"}
+      if (any (strcmp (opts.devopt, {"eps", "epsc"})))
+        gp_opts = [gp_opts " level1"];
+      endif
+      if (opts.tight_flag || ! isempty (opts.preview))
+        tmp_file = strcat (tmpnam (), ".eps");
+        eps_drawnow (opts, tmp_file, gp_opts);
+        if (dos_shell)
+          cleanup = [" & del " strrep(tmp_file, '/', '\')];
+        else
+          cleanup = [" ; rm " tmp_file];
+        endif
+        pipeline = {sprintf("%s %s",
+                            opts.epstool_cmd (opts, tmp_file, opts.name),
+                            cleanup)};
+      else
+        eps_drawnow (opts, opts.name, gp_opts);
+      endif
+    case {"epslatex", "pslatex", "pstex", "epslatexstandalone"}
+      dot = find (opts.name == ".", 1, "last");
+      n = find (opts.devopt == "l", 1);
+      suffix = opts.devopt(1:n-1);
+      if (! isempty (dot))
+        if (any (strcmpi (opts.name(dot:end), {["." suffix], ".tex", "."})))
+          name = opts.name(1:dot-1);
+        else
+          error ("print:invalid-suffix", 
+                 "invalid suffix '%s' for device '%s'.",
+                 opts.name(dot:end), lower (opts.devopt));
+        endif
+      endif
+      if (strfind (opts.devopt, "standalone"))
+        term = sprintf ("%s ",
+                        strrep (opts.devopt, "standalone", " standalone"));
+      else
+        term = sprintf ("%s ", opts.devopt);
+      endif
+      if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
+        suffix = "tex";
+      else
+        ## Gnuplot 4.0 wants a ".eps" suffix.
+        suffix = "eps";
+      endif
+      local_drawnow ([term " " gp_opts],
+                     strcat (name, ".", suffix), opts);
+    case "tikz"
+      if (__gnuplot_has_terminal__ ("tikz"))
+        local_drawnow (["lua tikz " gp_opts], opts.name, opts);
+      else
+        error (sprintf ("print:no%soutput", opts.devopt),
+               "print.m: '%s' output is not available for gnuplot-%s",
+               upper (opts.devopt), __gnuplot_version__ ());
+      endif
+    case "svg"
+      local_drawnow (["svg dynamic " gp_opts], opts.name, opts);
+    case {"aifm", "corel", "eepic", "emf", "fig"}
+      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+    case {"pdfcairo", "pngcairo"}
+      if (__gnuplot_has_terminal__ (opts.devopt))
+        local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+      else
+        error (sprintf ("print:no%soutput", opts.devopt),
+               "print.m: '%s' output is not available for gnuplot-%s",
+               upper (opts.devopt), __gnuplot_version__ ());
+      endif
+    case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"}
+      local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+    case opts.ghostscript.device
+      gp_opts = font_spec (opts, "devopt", "eps");
+      opts.ghostscript.output = opts.name;
+      opts.ghostscript.source = strcat (tmpnam (), ".eps");
+      eps_drawnow (opts, opts.ghostscript.source, gp_opts);
+      [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript);
+      if (opts.send_to_printer || isempty (opts.name))
+        cmd_lpr = opts.lpr_cmd (opts);
+        cmd = [cmd_gs " | " cmd_lpr];
+      else
+        cmd = cmd_gs;
+      endif
+      if (dos_shell)
+        cmd = sprintf ("%s & del %s", cmd,
+                       strrep (opts.ghostscript.source, '/', '\'));
+      else
+        cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source);
+      endif
+      if (! isempty (cmd_cleanup))
+        if (dos_shell)
+          pipeline = {[cmd " & " cmd_cleanup]};
+        else
+          pipeline = {[cmd " ; " cmd_cleanup]};
+        endif
+      else
+        pipeline = {cmd};
+      endif
+    otherwise
+      error (sprintf ("print:no%soutput", opts.devopt),
+             "print.m: %s output is not available for the Gnuplot graphics toolkit",
+             upper (opts.devopt));
+  endswitch
+
+
+  opts.pipeline = pipeline;
+
+  for n = 1:numel (pipeline)
+    if (opts.debug)
+      fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n});
+    endif
+    [status, output] = system (pipeline{n});
+    if (status)
+      fprintf ("%s\n%s\n%s\n",
+               "---------- output begin ----------",
+               output,
+               "----------- output end -----------");
+      error ("gnuplot:failedpipe", "print: failed to print");
+    endif
+  endfor
+
+endfunction
+
+function eps_drawnow (opts, epsfile, gp_opts)
+  [h, fontsize] = get_figure_text_objs (opts);
+  unwind_protect
+    fontsize_2x = cellfun (@times, {2}, fontsize, "uniformoutput", false);
+    set (h, {"fontsize"}, fontsize_2x);
+    local_drawnow (["postscript eps " gp_opts], epsfile, opts);
+  unwind_protect_cleanup
+    set (h, {"fontsize"}, fontsize);
+  end_unwind_protect
+endfunction
+
+function local_drawnow (term, file, opts)
+  if (opts.use_color < 0)
+    mono = true;
+  else
+    mono = false;
+  endif
+  set (0, "currentfigure", opts.figure);
+  if (isempty (opts.debug_file) || ! opts.debug)
+    drawnow (term, file, mono);
+  else
+    drawnow (term, file, mono, opts.debug_file);
+  endif
+endfunction
+
+function f = font_spec (opts, varargin)
+  for n = 1:2:numel (varargin)
+    opts.(varargin{n}) = varargin{n+1};
+  endfor
+  f = "";
+  switch (opts.devopt)
+    case "cgm"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case {"eps", "eps2", "epsc", "epsc2"}
+      ## Gnuplot renders fonts as half their specification, which
+      ## results in a tight spacing for the axes-labels and tick-labels.
+      ## Compensate for the half scale. This will produce the proper
+      ## spacing for the requested fontsize.
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", 2 * opts.fontsize);
+      endif
+    case "svg"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        fontsize = round (opts.fontsize * 0.75);
+        f = sprintf ('fname "%s" fsize %d', opts.font, fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('fname "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        fontsize = round (opts.fontsize * 0.75);
+        f = sprintf ("%s fsize %d", f, fontsize);
+      endif
+    case "pdf"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("fsize %d", f, opts.fontsize);
+      endif
+    case {"pdfcairo", "pngcairo"}
+      if (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      endif
+    case {"epslatex", "epslatexstandalone"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "pslatex"
+      if (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case {"gif", "jpeg", "png"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('font "%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ('font "%d"', opts.fontsize);
+      endif
+    case "emf"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ('"%s" %d', opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ('"%s"', opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "canvas"
+      if (! isempty (opts.fontsize))
+        f = sprintf ("fsize %d", opts.fontsize);
+      endif
+    case {"aifm", "corel"}
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ("%s %d", opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ("%s", opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("%d", opts.fontsize);
+      endif
+    case "fig"
+      if (! isempty (opts.font) && ! isempty (opts.fontsize))
+        f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize);
+      elseif (! isempty (opts.font))
+        f = sprintf ("font %s", opts.font);
+      elseif (! isempty (opts.fontsize))
+        f = sprintf ("fontsize %d", opts.fontsize);
+      endif
+  endswitch
+endfunction
+
+function [h, fontsize] = get_figure_text_objs (opts)
+  h = findall (opts.figure, "-property", "fontsize");
+  hp = get (h, "parent");
+  if (iscell (hp))
+    hp = cell2mat (hp);
+  endif
+  ## Do not change the text objects fontsizes for the children of a
+  ## legend axes.  These will be handled by the fontsize listener.
+  is_legend_key_string = strcmp (get (hp, "tag"), "legend") ...
+                       & isprop (hp, "string") ...
+                       & isprop (hp, "location") ...
+                       & strcmp (get (hp, "type"), "axes");
+  h(is_legend_key_string) = [];
+  fontsize = get (h, "fontsize");
+  switch (numel (fontsize))
+    case 0
+      fontsize = {};
+    case 1
+      fontsize = {fontsize};
+  endswitch
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__gnuplot_version__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,51 @@
+## Copyright (C) 2006-2012 Daniel Sebald
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ ()
+## Undocumented internal function.
+## @end deftypefn
+
+## Return the version of gnuplot we are using.  Note that we do not
+## attempt to handle the case of the user switching to different
+## versions of gnuplot during the same session.
+
+function version = __gnuplot_version__ ()
+
+  persistent __version__ = "";
+
+  if (isempty (__version__))
+    [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ()));
+    if (status != 0)
+      ## This message ends in a newline so that the traceback messages
+      ## are skipped and people might actually see the message, read it,
+      ## comprehend it, take the advice it gives, and stop asking us
+      ## why plotting fails when gnuplot is not found.
+      error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
+    endif
+    output = strrep (output, "gnuplot", "");
+    output = strrep (output, "patchlevel", ".");
+    output = strrep (output, "\n", "");
+    output = strrep (output, "\r", "");
+    __version__ = strrep (output, " ", "");
+  endif
+
+  version = __version__;
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,2662 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __go_draw_axes__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __go_draw_axes__ (h, plot_stream, enhanced, mono,
+                           bg_is_set, fg_is_set, hlgnd)
+
+  showhiddenhandles = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    axis_obj = __get__ (h);
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", showhiddenhandles);
+  end_unwind_protect
+
+  parent_figure_obj = get (axis_obj.parent);
+  gnuplot_term = __gnuplot_get_var__ (axis_obj.parent, "GPVAL_TERM");
+
+  ## Set to false for plotyy axes.
+  ymirror = true;
+  if (isfield (axis_obj, "__plotyy_axes__"))
+    if (all (ishandle (axis_obj.__plotyy_axes__)))
+      ymirror = false;
+    else
+      h = axis_obj.__plotyy_axes__;
+      h = h(ishandle (h));
+      h = h(isprop (h, "__plotyy_axes__"));
+      rmappdata (h, "__plotyy_axes__");
+    endif
+  endif
+
+  nd = __calc_dimensions__ (h);
+
+  if (strcmp (axis_obj.dataaspectratiomode, "manual")
+      && strcmp (axis_obj.xlimmode, "manual")
+      && strcmp (axis_obj.ylimmode, "manual"))
+    ## All can't be "manual"
+    axis_obj.plotboxaspectratiomode = "auto";
+  endif
+
+  if (strcmp (axis_obj.dataaspectratiomode, "manual")
+      && strcmp (axis_obj.xlimmode, "manual")
+      && strcmp (axis_obj.ylimmode, "manual")
+      && (nd == 2 || all (mod (axis_obj.view, 90) == 0)))
+    ## FIXME - adjust plotboxaspectratio to respect other
+    fpos = get (axis_obj.parent, "position");
+    apos = axis_obj.position;
+  endif
+
+  pos = __actual_axis_position__ (h);
+
+  if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+    dr = axis_obj.dataaspectratio;
+    if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+      dr = dr(1) / dr(2);
+    else
+      ## FIXME - need to properly implement 3D
+      dr = mean (dr(1:2)) / dr(3);
+    endif
+  else
+    dr = 1;
+  endif
+
+  if (strcmp (axis_obj.activepositionproperty, "position"))
+    if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
+      if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
+        x = [1, 1];
+      else
+        ## 3D plots need to be sized down to fit in the window.
+        x = 1.0 ./ sqrt ([2, 2.5]);
+      endif
+      fprintf (plot_stream, "set tmargin screen %.15g;\n",
+               pos(2)+pos(4)/2+x(2)*pos(4)/2);
+      fprintf (plot_stream, "set bmargin screen %.15g;\n",
+               pos(2)+pos(4)/2-x(2)*pos(4)/2);
+      fprintf (plot_stream, "set lmargin screen %.15g;\n",
+               pos(1)+pos(3)/2-x(1)*pos(3)/2);
+      fprintf (plot_stream, "set rmargin screen %.15g;\n",
+               pos(1)+pos(3)/2+x(1)*pos(3)/2);
+      sz_str = "";
+    else
+      fprintf (plot_stream, "set tmargin 0;\n");
+      fprintf (plot_stream, "set bmargin 0;\n");
+      fprintf (plot_stream, "set lmargin 0;\n");
+      fprintf (plot_stream, "set rmargin 0;\n");
+
+      if (nd == 3 && all (axis_obj.view == [0, 90]))
+        ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot
+        pos(3:4) = pos(3:4) * 1.4;
+        pos(1:2) = pos(1:2) - pos(3:4) * 0.125;
+      endif
+
+      fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
+
+      if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+        sz_str = sprintf ("set size ratio %.15g", -dr);
+      else
+        sz_str = "set size noratio";
+      endif
+      sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4));
+    endif
+  else ## activepositionproperty == outerposition
+    fprintf (plot_stream, "unset tmargin;\n");
+    fprintf (plot_stream, "unset bmargin;\n");
+    fprintf (plot_stream, "unset lmargin;\n");
+    fprintf (plot_stream, "unset rmargin;\n");
+    fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2));
+    sz_str = "";
+    if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+      sz_str = sprintf ("ratio %g", -dr);
+    else
+      sz_str = "noratio";
+    endif
+    sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4));
+  endif
+  if (! isempty (sz_str))
+    fputs (plot_stream, sz_str);
+  endif
+
+  ## Reset all labels, axis-labels, tick-labels, and title
+  ## FIXME - We should have an function to initialize the axis.
+  ##         Presently, this is dispersed in this function.
+  fputs (plot_stream, "unset label;\n");
+  fputs (plot_stream, "unset xtics;\n");
+  fputs (plot_stream, "unset ytics;\n");
+  fputs (plot_stream, "unset ztics;\n");
+  fputs (plot_stream, "unset x2tics;\n");
+  fputs (plot_stream, "unset x2tics;\n");
+
+  if (! isempty (axis_obj.title))
+    t = get (axis_obj.title);
+    if (isempty (t.string))
+      fputs (plot_stream, "unset title;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      fprintf (plot_stream, "set title \"%s\" %s %s;\n",
+               undo_string_escapes (tt), fontspec,
+               __do_enhanced_option__ (enhanced, t));
+    endif
+  endif
+
+  if (! isempty (axis_obj.xlabel))
+    t = get (axis_obj.xlabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.xcolor, mono);
+    if (isempty (t.string))
+      fprintf (plot_stream, "unset xlabel;\n");
+      fprintf (plot_stream, "unset x2label;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      if (strcmpi (axis_obj.xaxislocation, "top"))
+        fprintf (plot_stream, "set x2label \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      else
+        fprintf (plot_stream, "set xlabel \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      endif
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+      if (strcmpi (axis_obj.xaxislocation, "top"))
+        fprintf (plot_stream, "unset xlabel;\n");
+      else
+        fprintf (plot_stream, "unset x2label;\n");
+      endif
+    endif
+  endif
+
+  if (! isempty (axis_obj.ylabel))
+    t = get (axis_obj.ylabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.ycolor, mono);
+    if (isempty (t.string))
+      fprintf (plot_stream, "unset ylabel;\n");
+      fprintf (plot_stream, "unset y2label;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "set y2label \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      else
+        fprintf (plot_stream, "set ylabel \"%s\" %s %s %s",
+                 undo_string_escapes (tt), colorspec, fontspec,
+                 __do_enhanced_option__ (enhanced, t));
+      endif
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "unset ylabel;\n");
+      else
+        fprintf (plot_stream, "unset y2label;\n");
+      endif
+    endif
+  endif
+
+  if (! isempty (axis_obj.zlabel))
+    t = get (axis_obj.zlabel);
+    angle = t.rotation;
+    colorspec = get_text_colorspec (axis_obj.zcolor, mono);
+    if (isempty (t.string))
+      fputs (plot_stream, "unset zlabel;\n");
+    else
+      [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string");
+      fontspec = create_fontspec (f, s, gnuplot_term);
+      fprintf (plot_stream, "set zlabel \"%s\" %s %s %s",
+               undo_string_escapes (tt), colorspec, fontspec,
+               __do_enhanced_option__ (enhanced, t));
+      fprintf (plot_stream, " rotate by %f;\n", angle);
+    endif
+  endif
+
+  if (strcmpi (axis_obj.xaxislocation, "top"))
+    xaxisloc = "x2";
+    xaxisloc_using = "x2";
+  else
+    xaxisloc = "x";
+    xaxisloc_using = "x1";
+    if (strcmpi (axis_obj.xaxislocation, "zero"))
+      fputs (plot_stream, "set xzeroaxis;\n");
+    endif
+  endif
+  if (strcmpi (axis_obj.yaxislocation, "right"))
+    yaxisloc = "y2";
+    yaxisloc_using = "y2";
+  else
+    yaxisloc = "y";
+    yaxisloc_using = "y1";
+    if (strcmpi (axis_obj.yaxislocation, "zero"))
+      fputs (plot_stream, "set yzeroaxis;\n");
+    endif
+  endif
+
+  have_grid = false;
+
+  if (strcmpi (axis_obj.xgrid, "on"))
+    have_grid = true;
+    fprintf (plot_stream, "set grid %stics;\n", xaxisloc);
+  else
+    fprintf (plot_stream, "set grid no%stics;\n", xaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.ygrid, "on"))
+    have_grid = true;
+    fprintf (plot_stream, "set grid %stics;\n", yaxisloc);
+  else
+    fprintf (plot_stream, "set grid no%stics;\n", yaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.zgrid, "on"))
+    have_grid = true;
+    fputs (plot_stream, "set grid ztics;\n");
+  else
+    fputs (plot_stream, "set grid noztics;\n");
+  endif
+
+  if (strcmpi (axis_obj.xminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.xscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set m%stics %d;\n", xaxisloc, m);
+    fprintf (plot_stream, "set grid m%stics;\n", xaxisloc);
+  else
+    fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.yminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.yscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set m%stics %d;\n", yaxisloc, m);
+    fprintf (plot_stream, "set grid m%stics;\n", yaxisloc);
+  else
+    fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc);
+  endif
+
+  if (strcmpi (axis_obj.zminorgrid, "on"))
+    have_grid = true;
+    if (strcmp (axis_obj.zscale, "log"))
+      m = 10;
+    else
+      m = 5;
+    endif
+    fprintf (plot_stream, "set mztics %d;\n", m);
+    fputs (plot_stream, "set grid mztics;\n");
+  else
+    fputs (plot_stream, "set grid nomztics;\n");
+  endif
+
+  ## The grid front/back/layerdefault option also controls the
+  ## appearance of tics, so it is used even if the grid is absent.
+  if (strcmpi (axis_obj.layer, "top"))
+    fputs (plot_stream, "set grid front;\n");
+    fputs (plot_stream, "set border front;\n");
+  else
+    fputs (plot_stream, "set grid layerdefault;\n");
+    ## FIXME -- the gnuplot help says that "layerdefault" should work
+    ## for set border too, but it fails for me with gnuplot 4.2.5.  So
+    ## use "back" instead.
+    fputs (plot_stream, "set border back;\n");
+  endif
+
+  fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n",
+           axis_obj.linewidth, axis_obj.linewidth);
+
+  if (! have_grid)
+    fputs (plot_stream, "unset grid;\n");
+  endif
+
+  xlogscale = strcmpi (axis_obj.xscale, "log");
+  ylogscale = strcmpi (axis_obj.yscale, "log");
+  zlogscale = strcmpi (axis_obj.zscale, "log");
+
+  ## Detect logscale and negative lims
+  if (xlogscale && all (axis_obj.xlim < 0))
+    axis_obj.xsgn = -1;
+    if (strcmp (axis_obj.xdir, "reverse"))
+      axis_obj.xdir = "normal";
+    elseif (strcmp (axis_obj.xdir, "normal"))
+      axis_obj.xdir = "reverse";
+    endif
+    axis_obj.xtick = -flip (axis_obj.xtick);
+    axis_obj.xticklabel = flip (axis_obj.xticklabel);
+    axis_obj.xlim = -flip (axis_obj.xlim);
+  else
+    axis_obj.xsgn = 1;
+  endif
+  if (ylogscale && all (axis_obj.ylim < 0))
+    axis_obj.ysgn = -1;
+    if (strcmp (axis_obj.ydir, "reverse"))
+      axis_obj.ydir = "normal";
+    elseif (strcmp (axis_obj.ydir, "normal"))
+      axis_obj.ydir = "reverse";
+    endif
+    axis_obj.ytick = -flip (axis_obj.ytick);
+    axis_obj.yticklabel = flip (axis_obj.yticklabel);
+    axis_obj.ylim = -flip (axis_obj.ylim);
+  else
+    axis_obj.ysgn = 1;
+  endif
+  if (zlogscale && all (axis_obj.zlim < 0))
+    axis_obj.zsgn = -1;
+    if (strcmp (axis_obj.zdir, "reverse"))
+      axis_obj.zdir = "normal";
+    elseif (strcmp (axis_obj.zdir, "normal"))
+      axis_obj.zdir = "reverse";
+    endif
+    axis_obj.ztick = -flip (axis_obj.ztick);
+    axis_obj.zticklabel = flip (axis_obj.zticklabel);
+    axis_obj.zlim = -flip (axis_obj.zlim);
+  else
+    axis_obj.zsgn = 1;
+  endif
+
+  xlim = axis_obj.xlim;
+  ylim = axis_obj.ylim;
+  zlim = axis_obj.zlim;
+  clim = axis_obj.clim;
+
+  do_tics (axis_obj, plot_stream, ymirror, mono, gnuplot_term);
+
+  fputs (plot_stream, "unset logscale;\n");
+  if (xlogscale)
+    fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
+  endif
+  if (ylogscale)
+    fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
+  endif
+  if (zlogscale)
+    fputs (plot_stream, "set logscale z;\n");
+  endif
+
+  xautoscale = strcmpi (axis_obj.xlimmode, "auto");
+  yautoscale = strcmpi (axis_obj.ylimmode, "auto");
+  zautoscale = strcmpi (axis_obj.zlimmode, "auto");
+  cautoscale = strcmpi (axis_obj.climmode, "auto");
+  cdatadirect = false;
+  truecolor = false;
+
+  fputs (plot_stream, "set clip two;\n");
+
+  kids = axis_obj.children;
+  ## Remove the axis labels and title from the children, and
+  ## preserved the original order.
+  [jnk, k] = setdiff (kids, [axis_obj.xlabel; axis_obj.ylabel; ...
+                             axis_obj.zlabel; axis_obj.title]);
+  kids = kids (sort (k));
+
+  if (nd == 3)
+    fputs (plot_stream, "set parametric;\n");
+    fputs (plot_stream, "set style data lines;\n");
+    fputs (plot_stream, "set surface;\n");
+    fputs (plot_stream, "unset contour;\n");
+  endif
+
+  data_idx = 0;
+  data = cell ();
+  is_image_data = [];
+  hidden_removal = NaN;
+  view_map = false;
+
+  if (! cautoscale && clim(1) == clim(2))
+    clim(2)++;
+  endif
+  addedcmap = [];
+
+  ximg_data = {};
+  ximg_data_idx = 0;
+
+  while (! isempty (kids))
+
+    obj = get (kids(end));
+
+    if (isfield (obj, "xdata"))
+      obj.xdata = double (obj.xdata);
+    endif
+    if (isfield (obj, "ydata"))
+      obj.ydata = double (obj.ydata);
+    endif
+    if (isfield (obj, "zdata"))
+      obj.zdata = double (obj.zdata);
+    endif
+
+    if (isfield (obj, "units"))
+      units = obj.units;
+      unwind_protect
+        set (kids(end), "units", "data");
+        obj = get (kids(end));
+      unwind_protect_cleanup
+        set (kids(end), "units", units);
+      end_unwind_protect
+    endif
+    kids = kids(1:(end-1));
+
+    if (strcmp (obj.visible, "off"))
+      continue;
+    endif
+
+    if (xlogscale && isfield (obj, "xdata"))
+      obj.xdata = axis_obj.xsgn * obj.xdata;
+      obj.xdata(obj.xdata<=0) = NaN;
+    endif
+    if (ylogscale && isfield (obj, "ydata"))
+      obj.ydata = axis_obj.ysgn * obj.ydata;
+      obj.ydata(obj.ydata<=0) = NaN;
+    endif
+    if (zlogscale && isfield (obj, "zdata"))
+      obj.zdata = axis_obj.zsgn * obj.zdata;
+      obj.zdata(obj.zdata<=0) = NaN;
+    endif
+
+    ## Check for facecolor interpolation for surfaces.
+    doing_interp_color = ...
+       isfield (obj, "facecolor") && strcmp (obj.facecolor, "interp");
+
+    switch (obj.type)
+      case "image"
+        img_data = obj.cdata;
+        img_xdata = obj.xdata;
+        img_ydata = obj.ydata;
+
+        if (ndims (img_data) == 3)
+          truecolor = true;
+        elseif (strcmpi (obj.cdatamapping, "direct"))
+          cdatadirect = true;
+        endif
+        data_idx++;
+        is_image_data(data_idx) = true;
+        parametric(data_idx) = false;
+        have_cdata(data_idx) = false;
+        have_3d_patch(data_idx) = false;
+
+        if (img_xdata(2) < img_xdata(1))
+          img_xdata = img_xdata(2:-1:1);
+          img_data = img_data(:,end:-1:1,:);
+        elseif (img_xdata(1) == img_xdata(2))
+          img_xdata = img_xdata(1) + [0, columns(img_data)-1];
+        endif
+        if (img_ydata(2) < img_ydata(1))
+          img_ydata = img_ydata(2:-1:1);
+          img_data = img_data(end:-1:1,:,:);
+        elseif (img_ydata(1) == img_ydata(2))
+          img_ydata = img_ydata(1) + [0, rows(img_data)-1];
+        endif
+
+        [y_dim, x_dim] = size (img_data(:,:,1));
+        if (x_dim > 1)
+          dx = abs (img_xdata(2)-img_xdata(1))/(x_dim-1);
+        else
+          x_dim = 2;
+          img_data = [img_data, img_data];
+          dx = abs (img_xdata(2)-img_xdata(1));
+        endif
+        if (y_dim > 1)
+          dy = abs (img_ydata(2)-img_ydata(1))/(y_dim-1);
+        else
+          y_dim = 2;
+          img_data = [img_data; img_data];
+          dy = abs (img_ydata(2)-img_ydata(1));
+        endif
+
+        x_origin = min (img_xdata);
+        y_origin = min (img_ydata);
+
+        if (ndims (img_data) == 3)
+          data{data_idx} = permute (img_data, [3, 1, 2])(:);
+          format = "1:2:3";
+          imagetype = "rgbimage";
+        else
+          data{data_idx} = img_data(:);
+          format = "1";
+          imagetype = "image";
+        endif
+
+        titlespec{data_idx} = "title \"\"";
+        usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s",
+            x_dim, y_dim, x_origin, y_origin, dx, dy, format);
+        withclause{data_idx} = sprintf ("with %s;", imagetype);
+
+      case "line"
+        if (strcmp (obj.linestyle, "none")
+            && (! isfield (obj, "marker")
+                || (isfield (obj, "marker")
+                    && strcmp (obj.marker, "none"))))
+          continue;
+        endif
+        data_idx++;
+        is_image_data(data_idx) = false;
+        parametric(data_idx) = true;
+        have_cdata(data_idx) = false;
+        have_3d_patch(data_idx) = false;
+        if (isempty (obj.displayname))
+          titlespec{data_idx} = "title \"\"";
+        else
+          tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+          titlespec{data_idx} = ['title "' tmp '"'];
+        endif
+        usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
+        errbars = "";
+        if (nd == 3)
+          xdat = obj.xdata(:);
+          ydat = obj.ydata(:);
+          if (! isempty (obj.zdata))
+            zdat = obj.zdata(:);
+          else
+            zdat = zeros (size (xdat));
+          endif
+          data{data_idx} = [xdat, ydat, zdat]';
+          usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat));
+          ## fputs (plot_stream, "set parametric;\n");
+        else
+          xdat = obj.xdata(:);
+          ydat = obj.ydata(:);
+          data{data_idx} = [xdat, ydat]';
+          usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s",
+                                          rows (xdat), xaxisloc_using, yaxisloc_using);
+        endif
+
+        style = do_linestyle_command (obj, obj.color, data_idx, mono,
+                                      plot_stream, errbars);
+
+        withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{1}, data_idx);
+
+        if (length (style) > 1)
+          data_idx++;
+          is_image_data(data_idx) = is_image_data(data_idx - 1);
+          parametric(data_idx) = parametric(data_idx - 1);
+          have_cdata(data_idx) = have_cdata(data_idx - 1);
+          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+          titlespec{data_idx} = "title \"\"";
+          usingclause{data_idx} = usingclause{data_idx - 1};
+          data{data_idx} = data{data_idx - 1};
+          withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{2}, data_idx);
+        endif
+        if (length (style) > 2)
+          data_idx++;
+          is_image_data(data_idx) = is_image_data(data_idx - 1);
+          parametric(data_idx) = parametric(data_idx - 1);
+          have_cdata(data_idx) = have_cdata(data_idx - 1);
+          have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+          titlespec{data_idx} = "title \"\"";
+          usingclause{data_idx} = usingclause{data_idx - 1};
+          data{data_idx} = data{data_idx - 1};
+          withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                        style{3}, data_idx);
+        endif
+
+     case "patch"
+       cmap = parent_figure_obj.colormap;
+       [nr, nc] = size (obj.xdata);
+
+       if (! isempty (obj.cdata))
+         cdat = obj.cdata;
+         if (strcmpi (obj.cdatamapping, "direct"))
+           cdatadirect = true;
+         endif
+       else
+         cdat = [];
+       endif
+
+       data_3d_idx = NaN;
+       for i = 1:nc
+         xcol = obj.xdata(:,i);
+         ycol = obj.ydata(:,i);
+         if (nd == 3)
+           if (! isempty (obj.zdata))
+             zcol = obj.zdata(:,i);
+           else
+             zcol = zeros (size (xcol));
+           endif
+         endif
+
+         if (! isnan (xcol) && ! isnan (ycol))
+           ## Is the patch closed or not
+           if (strcmp (obj.facecolor, "none"))
+             hidden_removal = false;
+           else
+
+             if (isnan (hidden_removal))
+               hidden_removal = true;
+             endif
+             if (nd == 3)
+               if (numel (xcol) > 3)
+                 error ("__go_draw_axes__: gnuplot (as of v4.2) only supports 3-D filled triangular patches");
+               else
+                 if (isnan (data_3d_idx))
+                   data_idx++;
+                   data_3d_idx = data_idx;
+                   is_image_data(data_idx) = false;
+                   parametric(data_idx) = false;
+                   have_cdata(data_idx) = true;
+                   have_3d_patch(data_idx) = true;
+                   withclause{data_3d_idx} = sprintf ("with pm3d");
+                   usingclause{data_3d_idx} =  "using 1:2:3:4";
+                   data{data_3d_idx} = [];
+                 endif
+                 local_idx = data_3d_idx;
+                 ccdat = NaN;
+               endif
+             else
+               data_idx++;
+               local_idx = data_idx;
+               is_image_data(data_idx) = false;
+               parametric(data_idx) = false;
+               have_cdata(data_idx) = false;
+               have_3d_patch(data_idx) = false;
+             endif
+
+             if (i > 1 || isempty (obj.displayname))
+               titlespec{local_idx} = "title \"\"";
+             else
+               tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+               titlespec{local_idx} = ['title "' tmp '"'];
+             endif
+             if (isfield (obj, "facecolor"))
+               if ((strcmp (obj.facecolor, "flat")
+                   || strcmp (obj.facecolor, "interp"))
+                   && isfield (obj, "cdata"))
+                 if (ndims (obj.cdata) == 2
+                     && (columns (obj.cdata) == nc
+                         && (rows (obj.cdata) == 1
+                             || rows (obj.cdata) == 3)))
+                   ccol = cdat (:, i);
+                 elseif (ndims (obj.cdata) == 2
+                     && (rows (obj.cdata) == nc
+                         && (columns (obj.cdata) == 1
+                             || columns (obj.cdata) == 3)))
+                   ccol = cdat (i, :);
+                 elseif (ndims (obj.cdata) == 3)
+                   ccol = permute (cdat (:, i, :), [1, 3, 2]);
+                 else
+                   ccol = cdat;
+                 endif
+                 if (strcmp (obj.facecolor, "flat"))
+                   if (isequal (size (ccol), [1, 3]))
+                     ## RGB Triplet
+                     color = ccol;
+                   elseif (nd == 3 && numel (xcol) == 3)
+                     ccdat = ccol;
+                   else
+                     if (cdatadirect)
+                       r = round (ccol);
+                     else
+                       r = 1 + round ((rows (cmap) - 1)
+                                      * (ccol - clim(1))/(clim(2) - clim(1)));
+                     endif
+                     r = max (1, min (r, rows (cmap)));
+                     color = cmap(r, :);
+                   endif
+                 elseif (strcmp (obj.facecolor, "interp"))
+                   if (nd == 3 && numel (xcol) == 3)
+                     ccdat = ccol;
+                     if (! isvector (ccdat))
+                       tmp = rows (cmap) + rows (addedcmap) + ...
+                            [1 : rows(ccdat)];
+                       addedcmap = [addedcmap; ccdat];
+                       ccdat = tmp(:);
+                     else
+                       ccdat = ccdat(:);
+                     endif
+                   else
+                     if (sum (diff (ccol)))
+                       warning ("\"interp\" not supported, using 1st entry of cdata");
+                     endif
+                     if (cdatadirect)
+                       r = round (ccol);
+                     else
+                       r = 1 + round ((rows (cmap) - 1)
+                                      * (ccol - clim(1))/(clim(2) - clim(1)));
+                     endif
+                     r = max (1, min (r, rows (cmap)));
+                     color = cmap(r(1),:);
+                   endif
+                 endif
+               elseif (isnumeric (obj.facecolor))
+                 color = obj.facecolor;
+               else
+                 color = [0, 1, 0];
+               endif
+             else
+               color = [0, 1, 0];
+             endif
+
+             if (nd == 3 && numel (xcol) == 3)
+               if (isnan (ccdat))
+                 ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1);
+                 addedcmap = [addedcmap; reshape(color, 1, 3)];
+               endif
+               data{data_3d_idx} = [data{data_3d_idx}, ...
+                                    [[xcol; xcol(end)], [ycol; ycol(end)], ...
+                                    [zcol; zcol(end)], [ccdat; ccdat(end)]]'];
+             else
+               if (mono)
+                 colorspec = "";
+               elseif (__gnuplot_has_feature__ ("transparent_patches")
+                       && isscalar (obj.facealpha))
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f",
+                                    round (255*color), obj.facealpha);
+               else
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                      round (255*color));
+               endif
+
+               withclause{data_idx} = sprintf ("with filledcurve %s",
+                                             colorspec);
+               data{data_idx} = [xcol, ycol]';
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)",
+                                                numel (xcol));
+             endif
+           endif
+         endif
+
+         ## patch outline
+         if (!(strcmp (obj.edgecolor, "none")
+                && (strcmp (obj.marker, "none")
+                    || (strcmp (obj.markeredgecolor, "none")
+                        && strcmp (obj.markerfacecolor, "none")))))
+
+           data_idx++;
+           is_image_data(data_idx) = false;
+           parametric(data_idx) = false;
+           have_cdata(data_idx) = false;
+           have_3d_patch(data_idx) = false;
+           titlespec{data_idx} = "title \"\"";
+           usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
+
+           if (isfield (obj, "markersize"))
+             mdat = obj.markersize / 3;
+           endif
+
+           if (isfield (obj, "edgecolor"))
+             ## FIXME
+             ## This is the wrong thing to do as edgecolor, markeredgecolor
+             ## and markerfacecolor can have different values and we should
+             ## treat them seperately. However, the below allow the scatter
+             ## functions to work as expected, where only one of these values
+             ## is set
+             if (strcmp (obj.edgecolor, "none"))
+               if (strcmp (obj.markeredgecolor, "none"))
+                 ec = obj.markerfacecolor;
+               else
+                 ec = obj.markeredgecolor;
+               endif
+             else
+               ec = obj.edgecolor;
+             endif
+
+             if ((strcmp (ec, "flat")
+                  || strcmp (ec, "interp"))
+                 && isfield (obj, "cdata"))
+               if (ndims (obj.cdata) == 2
+                   && (columns (obj.cdata) == nc
+                       && (rows (obj.cdata) == 1
+                           || rows (obj.cdata) == 3)))
+                 ccol = cdat (:, i);
+               elseif (ndims (obj.cdata) == 2
+                       && (rows (obj.cdata) == nc
+                           && (columns (obj.cdata) == 1
+                               || columns (obj.cdata) == 3)))
+                 ccol = cdat (i, :);
+               elseif (ndims (obj.cdata) == 3)
+                 ccol = permute (cdat (:, i, :), [1, 3, 2]);
+               else
+                 ccol = cdat;
+               endif
+               if (strcmp (ec, "flat"))
+                 if (numel (ccol) == 3)
+                   color = ccol;
+                 else
+                   if (isscalar (ccol))
+                     ccol = repmat (ccol, numel (xcol), 1);
+                   endif
+                   color = "flat";
+                   have_cdata(data_idx) = true;
+                 endif
+               elseif (strcmp (ec, "interp"))
+                 if (numel (ccol) == 3)
+                   warning ("\"interp\" not supported, using 1st entry of cdata");
+                   color = ccol(1,:);
+                 else
+                   if (isscalar (ccol))
+                     ccol = repmat (ccol, numel (xcol), 1);
+                   endif
+                   color = "interp";
+                   have_cdata(data_idx) = true;
+                 endif
+               endif
+             elseif (isnumeric (ec))
+               color = ec;
+             else
+               color = [0, 0, 0];
+             endif
+           else
+             color = [0, 0, 0];
+           endif
+
+           if (isfield (obj, "linestyle"))
+             switch (obj.linestyle)
+               case "-"
+                 lt = "lt 1";
+               case "--"
+                 lt = "lt 2";
+               case ":"
+                 lt = "lt 3";
+               case "-."
+                 lt = "lt 6";
+               case "none"
+                 lt = "";
+               otherwise
+                 lt = "";
+             endswitch
+           else
+             lt = "";
+           endif
+
+           if (isfield (obj, "linewidth"))
+             lw = sprintf ("linewidth %f", obj.linewidth);
+           else
+             lw  = "";
+           endif
+
+           [pt, pt2, obj] = gnuplot_pointtype (obj);
+           if (! isempty (pt))
+             pt = sprintf ("pointtype %s", pt);
+           endif
+           if (! isempty (pt2))
+             pt2 = sprintf ("pointtype %s", pt2);
+           endif
+
+           if (mono)
+             colorspec = "";
+           else
+             if (ischar (color))
+               colorspec = "palette";
+             else
+               colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                    round (255*color));
+             endif
+           endif
+
+           sidx = 1;
+           if (isempty (lt))
+             style = "";
+           else
+             style = "lines";
+           endif
+           tmpwith = {};
+
+           facesame = true;
+           if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
+               && !strcmp (obj.markerfacecolor, "none"))
+             if (strcmp (obj.markerfacecolor, "auto")
+                 || ! isnumeric (obj.markerfacecolor)
+                 || (isnumeric (obj.markerfacecolor)
+                     && isequal (color, obj.markerfacecolor)))
+               style = strcat (style, "points");
+               if (isfield (obj, "markersize"))
+                 if (length (mdat) == nc)
+                   m = mdat(i);
+                 else
+                   m = mdat;
+                 endif
+                 ps = sprintf ("pointsize %f", m / 3);
+               else
+                 ps = "";
+               endif
+
+               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                        style, lw, pt2, lt, ps,
+                                        colorspec);
+             else
+               facesame = false;
+               if (! isempty (style))
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s",
+                                          style, lw, lt,
+                                          colorspec);
+                 sidx ++;
+               endif
+               if (isnumeric (obj.markerfacecolor) && ! mono)
+                 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                      round (255*obj.markerfacecolor));
+               endif
+               style = "points";
+               if (isfield (obj, "markersize"))
+                 if (length (mdat) == nc)
+                   m = mdat(i);
+                 else
+                   m = mdat;
+                 endif
+                 ps = sprintf ("pointsize %f", m / 3);
+               else
+                 ps = "";
+               endif
+               tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                        style, lw, pt2, lt, ps,
+                                        colorspec);
+             endif
+           endif
+
+           if (isfield (obj, "markeredgecolor")
+               && !strcmp (obj.markeredgecolor, "none"))
+             if (facesame && !isempty (pt)
+                 && (strcmp (obj.markeredgecolor, "auto")
+                     || ! isnumeric (obj.markeredgecolor)
+                     || (isnumeric (obj.markeredgecolor)
+                         && isequal (color, obj.markeredgecolor))))
+               if (sidx == 1 && ((length (style) == 5
+                        && strncmp (style, "lines", 5))
+                       || isempty (style)))
+                 style = strcat (style, "points");
+                 if (isfield (obj, "markersize"))
+                   if (length (mdat) == nc)
+                     m = mdat(i);
+                   else
+                     m = mdat;
+                   endif
+                   ps = sprintf ("pointsize %f", m / 3);
+                 else
+                   ps = "";
+                 endif
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                          style, lw, pt, lt, ps,
+                                          colorspec);
+               endif
+             else
+               if (!isempty (style))
+                 if (length (tmpwith) < sidx || isempty (tmpwith{sidx}))
+                   tmpwith{sidx} = sprintf ("with %s %s %s %s",
+                                            style, lw, lt,
+                                            colorspec);
+                 endif
+                 sidx ++;
+               endif
+
+               if (!isempty (pt))
+                 if (! mono)
+                   if (strcmp (obj.markeredgecolor, "auto"))
+                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                          round (255*color));
+                   elseif (isnumeric (obj.markeredgecolor) && ! mono)
+                     colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
+                                          round (255*obj.markeredgecolor));
+                   endif
+                 endif
+                 style = "points";
+                 if (isfield (obj, "markersize"))
+                   if (length (mdat) == nc)
+                     m = mdat(i);
+                   else
+                     m = mdat;
+                   endif
+                   ps = sprintf ("pointsize %f", m / 3);
+                 else
+                   ps = "";
+                 endif
+                 tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s",
+                                          style, lw, pt, lt, ps,
+                                          colorspec);
+               endif
+             endif
+           endif
+
+           if (isempty (tmpwith))
+             withclause{data_idx} = sprintf ("with %s %s %s %s %s",
+                                             style, lw, pt, lt,
+                                             colorspec);
+           else
+             withclause{data_idx} = tmpwith{1};
+           endif
+           if (nd == 3)
+             if (ischar (color))
+               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [zcol; zcol(1)], [ccol; ccol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, zcol, ccol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", columns (data{data_idx}));
+             else
+               if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [zcol; zcol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, zcol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
+             endif
+           else
+             if (ischar (color))
+               if (! isnan (xcol) && ! isnan (ycol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ...
+                                   [ccol; ccol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol, ccol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx}));
+             else
+               if (! isnan (xcol) && ! isnan (ycol))
+                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]';
+               else
+                 data{data_idx} = [xcol, ycol]';
+               endif
+               usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx}));
+             endif
+           endif
+
+           if (length (tmpwith) > 1)
+             data_idx++;
+             is_image_data(data_idx) = is_image_data(data_idx - 1);
+             parametric(data_idx) = parametric(data_idx - 1);
+             have_cdata(data_idx) = have_cdata(data_idx - 1);
+             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+             titlespec{data_idx} = "title \"\"";
+             usingclause{data_idx} = usingclause{data_idx - 1};
+             data{data_idx} = data{data_idx - 1};
+             withclause{data_idx} = tmpwith{2};
+           endif
+           if (length (tmpwith) > 2)
+             data_idx++;
+             is_image_data(data_idx) = is_image_data(data_idx - 1);
+             parametric(data_idx) = parametric(data_idx - 1);
+             have_cdata(data_idx) = have_cdata(data_idx - 1);
+             have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+             titlespec{data_idx} = "title \"\"";
+             usingclause{data_idx} = usingclause{data_idx - 1};
+             data{data_idx} = data{data_idx - 1};
+             withclause{data_idx} = tmpwith{3};
+           endif
+         endif
+       endfor
+
+      case "surface"
+        view_map = true;
+        if (! (strcmp (obj.edgecolor, "none")
+               && strcmp (obj.facecolor, "none")))
+          data_idx++;
+          is_image_data(data_idx) = false;
+          parametric(data_idx) = false;
+          have_cdata(data_idx) = true;
+          have_3d_patch(data_idx) = false;
+          style = do_linestyle_command (obj, obj.edgecolor,
+                                        data_idx, mono,
+                                        plot_stream);
+
+          if (isempty (obj.displayname))
+            titlespec{data_idx} = "title \"\"";
+          else
+            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+            titlespec{data_idx} = ['title "' tmp '"'];
+          endif
+          withclause{data_idx} = sprintf ("with pm3d linestyle %d",
+                                          data_idx);
+          withpm3d = true;
+          pm3didx = data_idx;
+
+          xdat = obj.xdata;
+          ydat = obj.ydata;
+          zdat = obj.zdata;
+          cdat = obj.cdata;
+
+          err = false;
+          if (! size_equal (zdat, cdat))
+            err = true;
+          endif
+          if (isvector (xdat) && isvector (ydat) && ismatrix (zdat))
+            if (rows (zdat) == length (ydat)
+                && columns (zdat) == length (xdat))
+              [xdat, ydat] = meshgrid (xdat, ydat);
+            else
+              err = true;
+            endif
+          elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat))
+            if (! size_equal (xdat, ydat, zdat))
+              err = true;
+            endif
+          else
+            err = true;
+          endif
+          if (err)
+            error ("__go_draw_axes__: invalid grid data");
+          endif
+          xlen = columns (zdat);
+          ylen = rows (zdat);
+          if (xlen == columns (xdat) && xlen == columns (ydat)
+              && ylen == rows (xdat) && ylen == rows (ydat))
+            len = 4 * xlen;
+            zz = zeros (ylen, len);
+            k = 1;
+            for kk = 1:4:len
+              zz(:,kk)   = xdat(:,k);
+              zz(:,kk+1) = ydat(:,k);
+              zz(:,kk+2) = zdat(:,k);
+              zz(:,kk+3) = cdat(:,k);
+              k++;
+            endfor
+            data{data_idx} = zz.';
+          endif
+
+          if (doing_interp_color)
+            interp_str = "interpolate 0, 0";
+          else
+            ## No interpolation of facecolors.
+            interp_str = "";
+          endif
+          usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3):($4)", ylen, xlen);
+
+          flat_interp_face = (strcmp (obj.facecolor, "flat")
+                              || strcmp (obj.facecolor, "interp"));
+          flat_interp_edge = (strcmp (obj.edgecolor, "flat")
+                              || strcmp (obj.edgecolor, "interp"));
+
+          facecolor_none_or_white = (strcmp (obj.facecolor, "none")
+                                     || (isnumeric (obj.facecolor)
+                                         && all (obj.facecolor == 1)));
+          hidden_removal = false;
+          fputs (plot_stream, "set style increment default;\n");
+          if (flat_interp_edge && facecolor_none_or_white)
+            withpm3d = false;
+            withclause{data_idx} = sprintf ("with %s palette", style {1});
+            fputs (plot_stream, "unset pm3d\n");
+            if (all (obj.facecolor == 1))
+              hidden_removal = true;
+            endif
+          elseif (facecolor_none_or_white)
+            if (all (obj.facecolor == 1))
+              hidden_removal = true;
+            endif
+            fputs (plot_stream,"unset pm3d;\n");
+            fputs (plot_stream,"set style increment user;\n");
+            withpm3d = false;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{1}, data_idx);
+            fputs (plot_stream, "unset pm3d\n");
+          endif
+
+          if (doing_interp_color)
+            ## "depthorder" interferes with interpolation of colors.
+            dord = "scansautomatic";
+          else
+            dord = "depthorder";
+          endif
+
+          if (flat_interp_face && strcmp (obj.edgecolor, "flat"))
+            fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n",
+                     interp_str, dord);
+          elseif (!facecolor_none_or_white)
+            if (strcmp (obj.edgecolor, "none"))
+              if (__gnuplot_has_feature__ ("transparent_surface")
+                  && isscalar (obj.facealpha))
+                fprintf (plot_stream,
+                         "set style fill transparent solid %f;\n",
+                         obj.facealpha);
+              endif
+              fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n",
+                       interp_str, dord);
+            else
+              fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
+                       data_idx, interp_str, dord);
+
+              if (__gnuplot_has_feature__ ("transparent_surface")
+                  && isscalar (obj.facealpha))
+                fprintf (plot_stream,
+                         "set style fill transparent solid %f;\n",
+                         obj.facealpha);
+              endif
+            endif
+          endif
+
+          zz = [];
+          if (length (style) > 1)
+            len = 3 * xlen;
+            zz = zeros (ylen, len);
+            k = 1;
+            for kk = 1:3:len
+              zz(:,kk)   = xdat(:,k);
+              zz(:,kk+1) = ydat(:,k);
+              zz(:,kk+2) = zdat(:,k);
+              k++;
+            endfor
+            zz = zz.';
+
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{2}, data_idx);
+
+          endif
+          if (length (style) > 2)
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with %s linestyle %d",
+                                            style{3}, data_idx);
+          endif
+          if (withpm3d && strcmp (style{1}, "linespoints"))
+            if (isempty (zz))
+              len = 3 * xlen;
+              zz = zeros (ylen, len);
+              k = 1;
+              for kk = 1:3:len
+                zz(:,kk)   = xdat(:,k);
+                zz(:,kk+1) = ydat(:,k);
+                zz(:,kk+2) = zdat(:,k);
+                k++;
+              endfor
+              zz = zz.';
+            endif
+            data_idx++;
+            is_image_data(data_idx) = is_image_data(data_idx - 1);
+            parametric(data_idx) = parametric(data_idx - 1);
+            have_cdata(data_idx) = false;
+            have_3d_patch(data_idx) = have_3d_patch(data_idx - 1);
+            titlespec{data_idx} = "title \"\"";
+            usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3)", ylen, xlen);
+            data{data_idx} = zz;
+            withclause{data_idx} = sprintf ("with points linestyle %d",
+                                            pm3didx);
+          endif
+        endif
+
+      case "text"
+        [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string");
+        fontspec = create_fontspec (f, s, gnuplot_term);
+        lpos = obj.position;
+        halign = obj.horizontalalignment;
+        valign = obj.verticalalignment;
+        angle = obj.rotation;
+        units = obj.units;
+        color = obj.color;
+        if (strcmpi (units, "normalized"))
+          units = "graph";
+        elseif (strcmp (axis_obj.yaxislocation, "right")
+                && strcmp (units, "data"))
+          units = "second";
+        else
+          units = "";
+        endif
+
+        if (isnumeric (color))
+          colorspec = get_text_colorspec (color, mono);
+        endif
+
+        if (ischar (obj.string))
+          num_lines = rows (obj.string);
+        else
+          num_lines = numel (obj.string);
+        endif
+        switch (valign)
+          ## Text offset in characters. Relies on gnuplot for font metrics.
+          case "top"
+            dy = -0.5;
+          case "cap"
+            dy = -0.5;
+          case "middle"
+            dy = 0.5 * (num_lines - 1);
+          case "baseline"
+            dy = 0.5 + (num_lines - 1);
+          case "bottom"
+            dy = 0.5 + (num_lines - 1);
+        endswitch
+        ## Gnuplot's Character units are different for x/y and vary with
+        ## fontsize. The aspect ratio of 1:1.7 was determined by experiment
+        ## to work for eps/ps/etc. For the MacOS aqua terminal a value of 2.5
+        ## is needed. However, the difference is barely noticable.
+        dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1];
+
+        ## FIXME: Multiline text produced the gnuplot
+        ##        "warning: ft_render: skipping glyph"
+        if (nd == 3)
+          ## This produces the desired vertical alignment in 3D.
+          fprintf (plot_stream,
+                   "set label \"%s\" at %s %.15e,%.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
+                   undo_string_escapes (label), units, lpos(1),
+                   lpos(2), lpos(3), halign, angle, dx_and_dy, fontspec,
+                   __do_enhanced_option__ (enhanced, obj), colorspec);
+        else
+          fprintf (plot_stream,
+                   "set label \"%s\" at %s %.15e,%.15e %s rotate by %f offset character %f,%f %s %s front %s;\n",
+                   undo_string_escapes (label), units,
+                   lpos(1), lpos(2), halign, angle, dx_and_dy, fontspec,
+                   __do_enhanced_option__ (enhanced, obj), colorspec);
+        endif
+
+      case "hggroup"
+        ## Push group children into the kid list.
+        if (isempty (kids))
+          kids = obj.children;
+        elseif (! isempty (obj.children))
+          kids = [kids; obj.children];
+        endif
+
+      otherwise
+        error ("__go_draw_axes__: unknown object class, %s",
+               obj.type);
+    endswitch
+
+  endwhile
+
+  ## This is need to prevent warnings for rotations in 3D plots, while
+  ## allowing colorbars with contours.
+  if (nd == 2 || (data_idx > 1 && !view_map))
+    fputs (plot_stream, "set pm3d implicit;\n");
+  else
+    fputs (plot_stream, "set pm3d explicit;\n");
+  endif
+
+  if (isnan (hidden_removal) || hidden_removal)
+    fputs (plot_stream, "set hidden3d;\n");
+  else
+    fputs (plot_stream, "unset hidden3d;\n");
+  endif
+
+  have_data = (! (isempty (data) || all (cellfun ("isempty", data))));
+
+  ## Note we don't use the [xy]2range of gnuplot as we don't use the
+  ## dual axis plotting features of gnuplot.
+  if (isempty (xlim))
+    return;
+  endif
+  if (strcmpi (axis_obj.xdir, "reverse"))
+    xdir = "reverse";
+  else
+    xdir = "noreverse";
+  endif
+  fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir);
+  if (strcmpi (axis_obj.xaxislocation, "top"))
+    fprintf (plot_stream, "set x2range [%.15e:%.15e] %s;\n", xlim, xdir);
+  endif
+
+  if (isempty (ylim))
+    return;
+  endif
+  if (strcmpi (axis_obj.ydir, "reverse"))
+    ydir = "reverse";
+  else
+    ydir = "noreverse";
+  endif
+  fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir);
+  if (strcmpi (axis_obj.yaxislocation, "right"))
+    fprintf (plot_stream, "set y2range [%.15e:%.15e] %s;\n", ylim, ydir);
+  endif
+
+  if (nd == 3)
+    if (isempty (zlim))
+      return;
+    endif
+    if (strcmpi (axis_obj.zdir, "reverse"))
+      zdir = "reverse";
+    else
+      zdir = "noreverse";
+    endif
+    fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir);
+  endif
+
+  cmap = parent_figure_obj.colormap;
+  cmap_sz = rows (cmap);
+  if (! any (isinf (clim)))
+    if (truecolor || ! cdatadirect)
+      if (rows (addedcmap) > 0)
+        for i = 1:data_idx
+          if (have_3d_patch(i))
+            data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz;
+           endif
+        endfor
+        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) *
+                 (cmap_sz + rows (addedcmap)) / cmap_sz);
+      else
+        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim);
+      endif
+    else
+      fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz +
+               rows (addedcmap));
+    endif
+  endif
+
+  if (strcmpi (axis_obj.box, "on"))
+    if (nd == 3)
+      fputs (plot_stream, "set border 4095;\n");
+    else
+      fputs (plot_stream, "set border 431;\n");
+    endif
+  else
+    if (nd == 3)
+      fputs (plot_stream, "set border 895;\n");
+    elseif (! isempty (axis_obj.ytick))
+      if (strcmpi (axis_obj.yaxislocation, "right"))
+        fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 12;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 9;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 8;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+      elseif (strcmpi (axis_obj.yaxislocation, "left"))
+        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 6;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 3;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 2;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+      else # yaxislocation == zero
+        fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                 axis_obj.tickdir);
+        if (strcmpi (axis_obj.xaxislocation, "top"))
+          fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 4;\n");
+        elseif (strcmpi (axis_obj.xaxislocation, "bottom"))
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "set border 1;\n");
+        else # xaxislocation == zero
+          fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n",
+                   axis_obj.tickdir);
+          fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n",
+                   axis_obj.tickdir);
+          fputs (plot_stream, "unset border;\n");
+          fprintf (plot_stream, "set xzeroaxis lt -1 lw %f;\n",
+                   axis_obj.linewidth);
+        endif
+        fprintf (plot_stream, "set yzeroaxis lt -1 lw %f;\n",
+                 axis_obj.linewidth);
+      endif
+    endif
+  endif
+
+  if (strcmpi (axis_obj.visible, "off"))
+    fputs (plot_stream, "unset border; unset tics\n");
+  else
+    fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth);
+  endif
+
+  if (! isempty (hlgnd) && ! isempty (hlgnd.children)
+      && any (strcmpi (get (hlgnd.children, "visible"), "on")))
+    if (strcmpi (hlgnd.box, "on"))
+      box = "box";
+    else
+      box = "nobox";
+    endif
+    if (strcmpi (hlgnd.orientation, "vertical"))
+      horzvert = "vertical";
+    else
+      horzvert = "horizontal";
+    endif
+    if (strcmpi (hlgnd.textposition, "right"))
+      reverse = "reverse";
+    else
+      reverse = "noreverse";
+    endif
+    inout = "inside";
+    keypos = hlgnd.location;
+    if (ischar (keypos))
+      keypos = lower (keypos);
+      keyout = strfind (keypos, "outside");
+      if (! isempty (keyout))
+        inout = "outside";
+        keypos = keypos(1:keyout-1);
+      endif
+    endif
+    switch (keypos)
+      case "north"
+        pos = "center top";
+      case "south"
+        pos = "center bottom";
+      case "east"
+        pos = "right center";
+      case "west"
+        pos = "left center";
+      case "northeast"
+        pos = "right top";
+      case "northwest"
+        pos = "left top";
+      case "southeast"
+        pos = "right bottom";
+      case "southwest"
+        pos = "left bottom";
+      case "best"
+        pos = "";
+        warning ("legend: 'Best' not yet implemented for location specifier.\n");
+        ## Least conflict with data in plot.
+        ## Least unused space outside plot.
+      otherwise
+        pos = "";
+    endswitch
+    if (__gnuplot_has_feature__ ("key_has_font_properties"))
+      [fontname, fontsize] = get_fontname_and_size (hlgnd);
+      fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
+    else
+      fontspec = "";
+    endif
+    textcolors = get (findobj (hlgnd.children, "type", "text"), "color");
+    if (iscell (textcolors))
+      textcolors = cell2mat (textcolors);
+      textcolors = unique (textcolors, "rows");
+    endif
+    if (rows (textcolors) > 1)
+      ## Gnuplot is unable to assign arbitrary colors to each text entry
+      ## for the key/legend.  But, the text color can be set to match the
+      ## color of the plot object.
+      colorspec = "textcolor variable";
+    else
+      colorspec = get_text_colorspec (textcolors, mono);
+    endif
+    fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
+             inout, pos, box, reverse, horzvert, fontspec, colorspec);
+  else
+    fputs (plot_stream, "unset key;\n");
+  endif
+  fputs (plot_stream, "set style data lines;\n");
+
+  cmap = [cmap; addedcmap];
+  cmap_sz = cmap_sz + rows (addedcmap);
+  if (length (cmap) > 0)
+    fprintf (plot_stream,
+             "set palette positive color model RGB maxcolors %i;\n",
+             cmap_sz);
+    fprintf (plot_stream,
+             "set palette file \"-\" binary record=%d using 1:2:3:4;\n",
+             cmap_sz);
+    fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32");
+    fwrite (plot_stream, "\n");
+  endif
+
+  fputs (plot_stream, "unset colorbox;\n");
+
+  if (have_data)
+    if (nd == 2)
+      plot_cmd = "plot";
+    else
+      plot_cmd = "splot";
+      rot_x = 90 - axis_obj.view(2);
+      rot_z = axis_obj.view(1);
+      while (rot_z < 0)
+        rot_z += 360;
+      endwhile
+      fputs (plot_stream, "set ticslevel 0;\n");
+      if (view_map && rot_x == 0 && rot_z == 0)
+        fputs (plot_stream, "set view map;\n");
+      else
+        fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
+      endif
+    endif
+    if (have_3d_patch (1))
+      fputs (plot_stream, "set pm3d depthorder\n");
+      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    elseif (is_image_data (1))
+      if (numel (is_image_data) > 1 && is_image_data(2))
+        ## Remove terminating semicolon
+        n = max (strfind (withclause{1}, ";"));
+        if (! isempty (n))
+          withclause{1} = withclause{1}(1:n-1);
+        endif
+      endif
+      fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    else
+      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
+               usingclause{1}, titlespec{1}, withclause{1});
+    endif
+    for i = 2:data_idx
+      if (have_3d_patch (i))
+        fprintf (plot_stream, ", \"-\" %s %s %s \\\n",
+                 usingclause{i}, titlespec{i}, withclause{i});
+      elseif (is_image_data (i))
+        if (! is_image_data (i-1))
+          fputs (plot_stream, "; ");
+          if (bg_is_set)
+            fputs (plot_stream, "unset obj 1; \\\n");
+            bg_is_set = false;
+          endif
+          if (fg_is_set)
+            fputs (plot_stream, "unset obj 2; \\\n");
+            fg_is_set = false;
+          endif
+          if (numel (is_image_data) > i && is_image_data(i+1))
+            ## Remove terminating semicolon
+            n = max (strfind (withclause{i}, ";"));
+            if (! isempty (n))
+              withclause{i} = withclause{i}(1:n-1);
+            endif
+          endif
+          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
+                   usingclause{i}, titlespec{i}, withclause{i});
+        else
+          ## For consecutive images continue with the same plot command
+          fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",",
+                   usingclause{i}, titlespec{i}, withclause{i});
+        endif
+      elseif (is_image_data (i-1))
+        if (bg_is_set)
+          fputs (plot_stream, "unset obj 1; \\\n");
+          bg_is_set = false;
+        endif
+        if (fg_is_set)
+          fputs (plot_stream, "unset obj 2; \\\n");
+          fg_is_set = false;
+        endif
+        fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
+                 usingclause{i}, titlespec{i}, withclause{i});
+      else
+        fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
+                 usingclause{i}, titlespec{i}, withclause{i});
+      endif
+    endfor
+    fputs (plot_stream, ";\n");
+    for i = 1:data_idx
+      if (have_3d_patch (i))
+        ## Can't write 3d patch data as binary as can't plot more than
+        ## a single patch at a time and have to plot all patches together
+        ## so that the gnuplot depth ordering is done correctly
+        for j = 1 : 4 : columns (data{i})
+          if (j != 1)
+            fputs (plot_stream, "\n\n");
+          endif
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).');
+        endfor
+        fputs (plot_stream, "e\n");
+      elseif (is_image_data(i))
+        fwrite (plot_stream, data{i}, "float32");
+      else
+        __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i),
+                                have_cdata(i));
+      endif
+    endfor
+  else
+    fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n");
+  endif
+
+  ## Needed to allow mouse rotation with pcolor.
+  if (view_map)
+    fputs (plot_stream, "unset view;\n");
+  endif
+
+  if (bg_is_set)
+    fputs (plot_stream, "unset obj 1;\n");
+    bg_is_set = false;
+  endif
+
+  fflush (plot_stream);
+
+endfunction
+
+function x = flip (x)
+  if (rows (x) == 1)
+    x = fliplr (x);
+  elseif (columns (x) == 1 || ischar (x))
+    x = flipud (x);
+  else
+    x = flipud (fliplr (x));
+  endif
+endfunction
+
+function fontspec = create_fontspec (f, s, gp_term)
+  if (strcmp (f, "*") || strcmp (gp_term, "tikz"))
+    fontspec = sprintf ("font \",%d\"", s);
+  else
+    fontspec = sprintf ("font \"%s,%d\"", f, s);
+  endif
+endfunction
+
+function style = do_linestyle_command (obj, linecolor, idx, mono,
+                                       plot_stream, errbars = "")
+  style = {};
+
+  fprintf (plot_stream, "set style line %d default;\n", idx);
+  fprintf (plot_stream, "set style line %d", idx);
+
+  found_style = false;
+  if (isnumeric (linecolor))
+    color = linecolor;
+    if (! mono)
+      fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+               round (255*color));
+    endif
+  else
+    color = [0, 0, 0];
+  endif
+
+  if (isfield (obj, "linestyle"))
+    switch (obj.linestyle)
+      case "-"
+        lt = "1";
+      case "--"
+        lt = "2";
+      case ":"
+        lt = "3";
+      case "-."
+        lt = "6";
+      case "none"
+        lt = "";
+      otherwise
+        lt = "";
+    endswitch
+
+    if (! isempty (lt))
+      fprintf (plot_stream, " linetype %s", lt);
+    endif
+
+  else
+    lt = "";
+  endif
+  if (! isempty (errbars))
+    found_style = true;
+  endif
+
+  if (isfield (obj, "linewidth"))
+    fprintf (plot_stream, " linewidth %f", obj.linewidth);
+    found_style = true;
+  endif
+
+  [pt, pt2, obj] = gnuplot_pointtype (obj);
+
+  if (! isempty (pt))
+    found_style = true;
+  endif
+
+  sidx = 1;
+  if (isempty (errbars))
+    if (isempty (lt))
+      style {sidx} = "";
+    else
+      style {sidx} = "lines";
+    endif
+
+    facesame = true;
+    if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor")
+        && !strcmp (obj.markerfacecolor, "none"))
+      if (strcmp (obj.markerfacecolor, "auto")
+          || ! isnumeric (obj.markerfacecolor)
+          || (isnumeric (obj.markerfacecolor)
+              && isequal (color, obj.markerfacecolor)))
+        if (! isempty (pt2))
+          fprintf (plot_stream, " pointtype %s", pt2);
+          style {sidx} = strcat (style{sidx}, "points");
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      else
+        facesame = false;
+        if (! found_style)
+          fputs (plot_stream, " default");
+        endif
+        fputs (plot_stream, ";\n");
+        if (! isempty (style {sidx}))
+          sidx ++;
+          idx ++;
+        else
+          fputs (plot_stream, ";\n");
+        endif
+        fprintf (plot_stream, "set style line %d default;\n", idx);
+        fprintf (plot_stream, "set style line %d", idx);
+        if (isnumeric (obj.markerfacecolor) && ! mono)
+          fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                   round (255*obj.markerfacecolor));
+        endif
+        if (! isempty (pt2))
+          style {sidx} = "points";
+          fprintf (plot_stream, " pointtype %s", pt2);
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      endif
+    endif
+    if (isfield (obj, "markeredgecolor")
+        && !strcmp (obj.markeredgecolor, "none"))
+      if (facesame && !isempty (pt)
+          && (strcmp (obj.markeredgecolor, "auto")
+              || ! isnumeric (obj.markeredgecolor)
+              || (isnumeric (obj.markeredgecolor)
+                  && isequal (color, obj.markeredgecolor))))
+        if (sidx == 1 && ((length (style {sidx}) == 5
+            && strncmp (style{sidx}, "lines", 5)) || isempty (style {sidx})))
+          if (! isempty (pt))
+            style {sidx} = strcat (style{sidx}, "points");
+            fprintf (plot_stream, " pointtype %s", pt);
+          endif
+          if (isfield (obj, "markersize"))
+            fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+          endif
+        endif
+      else
+        if (! found_style)
+          fputs (plot_stream, " default");
+        endif
+        fputs (plot_stream, ";\n");
+        if (!isempty (style {sidx}))
+          sidx ++;
+          idx ++;
+        else
+          fputs (plot_stream, ";\n");
+        endif
+        fprintf (plot_stream, "set style line %d default;\n", idx);
+        fprintf (plot_stream, "set style line %d", idx);
+        if (! mono)
+          if (strcmp (obj.markeredgecolor, "auto"))
+            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                     round (255*color));
+          elseif (isnumeric (obj.markeredgecolor) && ! mono)
+            fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"",
+                     round (255*obj.markeredgecolor));
+          endif
+        endif
+        if (! isempty (pt))
+          style {sidx} = "points";
+          fprintf (plot_stream, " pointtype %s", pt);
+        endif
+        if (isfield (obj, "markersize"))
+          fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+        endif
+      endif
+    endif
+  else
+    style{1} = errbars;
+    fputs (plot_stream, " pointtype 0");
+  endif
+
+  if (! found_style && isempty (style {1}))
+    fputs (plot_stream, " default");
+  endif
+
+  fputs (plot_stream, ";\n");
+
+endfunction
+
+function [pt, pt2, obj] = gnuplot_pointtype (obj)
+  if (isfield (obj, "marker"))
+    switch (obj.marker)
+      case "+"
+        pt = pt2 = "1";
+      case "o"
+        pt = "6";
+        pt2 = "7";
+      case "*"
+        pt = pt2 = "3";
+      case "."
+        pt = "6";
+        pt2 = "7";
+        if (isfield (obj, "markerfacecolor")
+            || strcmp (obj.markerfacecolor, "none"))
+          obj.markerfacecolor = "auto";
+        endif
+        if (isfield (obj, "markersize"))
+          obj.markersize /= 3;
+        else
+          obj.markersize = 5;
+        endif
+      case "x"
+        pt = pt2 = "2";
+      case {"square", "s"}
+        pt = "4";
+        pt2 = "5";
+      case {"diamond", "d"}
+        pt = "12";
+        pt2 = "13";
+      case "^"
+        pt = "8";
+        pt2 = "9";
+      case "v"
+        pt = "10";
+        pt2 = "11";
+      case ">"
+        ## FIXME: should be triangle pointing right, use triangle pointing up
+        pt = "8";
+        pt2 = "9";
+      case "<"
+        ## FIXME: should be triangle pointing left, use triangle pointing down
+        pt = "10";
+        pt2 = "11";
+      case {"pentagram", "p"}
+        ## FIXME: should be pentagram, using pentagon
+        pt = "14";
+        pt2 = "15";
+      case {"hexagram", "h"}
+        ## FIXME: should be 6 pt start, using "*" instead
+        pt = pt2 = "3";
+      case "none"
+        pt = pt2 = "";
+      otherwise
+        pt = pt2 = "";
+    endswitch
+  else
+    pt = pt2 = "";
+  endif
+endfunction
+
+function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata)
+
+  ## DATA is already transposed.
+
+  ## FIXME -- this may need to be converted to C++ for speed.
+
+  ## Convert NA elements to normal NaN values because fprintf writes
+  ## "NA" and that confuses gnuplot.
+  idx = find (isna (data));
+  if (any (idx))
+    data(idx) = NaN;
+  endif
+
+  if (nd == 2)
+    fwrite (plot_stream, data, "float64");
+  elseif (nd == 3)
+    if (parametric)
+      fwrite (plot_stream, data, "float64");
+    else
+      nr = rows (data);
+      if (cdata)
+        for j = 1:4:nr
+          fwrite (plot_stream, data(j:j+3,:), "float64");
+        endfor
+      else
+        for j = 1:3:nr
+          fwrite (plot_stream, data(j:j+2,:), "float64");
+        endfor
+      endif
+    endif
+  endif
+
+endfunction
+
+function do_tics (obj, plot_stream, ymirror, mono, gnuplot_term)
+
+  obj.xticklabel = ticklabel_to_cell (obj.xticklabel);
+  obj.yticklabel = ticklabel_to_cell (obj.yticklabel);
+  obj.zticklabel = ticklabel_to_cell (obj.zticklabel);
+
+  if (strcmp (obj.xminorgrid, "on"))
+    obj.xminortick = "on";
+  endif
+  if (strcmp (obj.yminorgrid, "on"))
+    obj.yminortick = "on";
+  endif
+  if (strcmp (obj.zminorgrid, "on"))
+    obj.zminortick = "on";
+  endif
+
+  [fontname, fontsize] = get_fontname_and_size (obj);
+  fontspec = create_fontspec (fontname, fontsize, gnuplot_term);
+
+  ## A Gnuplot tic scale of 69 is equivalent to Octave's 0.5.
+  ticklength = sprintf ("scale %4.1f", (69/0.5)*obj.ticklength(1));
+
+  if (strcmpi (obj.xaxislocation, "top"))
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x", plot_stream, true, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  elseif (strcmpi (obj.xaxislocation, "zero"))
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+               "axis", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x2", plot_stream, true, mono, "axis",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  else
+    do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+               obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.xscale, obj.xsgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
+               obj.xcolor, "x2", plot_stream, true, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.xscale,
+               obj.xsgn, gnuplot_term);
+  endif
+  if (strcmpi (obj.yaxislocation, "right"))
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y", plot_stream, ymirror, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  elseif (strcmpi (obj.yaxislocation, "zero"))
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+               "axis", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y2", plot_stream, ymirror, mono, "axis",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  else
+    do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+               obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+               "border", obj.tickdir, ticklength, fontname, fontspec,
+               obj.interpreter, obj.yscale, obj.ysgn, gnuplot_term);
+    do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
+               obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
+               "", "", fontname, fontspec, obj.interpreter, obj.yscale,
+               obj.ysgn, gnuplot_term);
+  endif
+  do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode,
+             obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono,
+             "border", obj.tickdir, ticklength, fontname, fontspec,
+             obj.interpreter, obj.zscale, obj.zsgn, gnuplot_term);
+endfunction
+
+function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax,
+                    plot_stream, mirror, mono, axispos, tickdir, ticklength,
+                    fontname, fontspec, interpreter, scale, sgn, gnuplot_term)
+  persistent warned_latex = false;
+  if (strcmpi (interpreter, "tex"))
+    for n = 1 : numel (labels)
+      labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false);
+    endfor
+  elseif (strcmpi (interpreter, "latex"))
+    if (! warned_latex)
+      warning ("latex markup not supported for tick marks");
+      warned_latex = true;
+    endif
+  endif
+  if (strcmp (scale, "log"))
+    num_mtics = 10;
+    if (any (strcmp (gnuplot_term, {"tikz", "pstex", "pslatex", "epslatex"})))
+      fmt = "$10^{%T}$";
+    else
+      fmt = "10^{%T}";
+    endif
+    if (sgn < 0)
+      fmt = strcat ("-", fmt);
+    endif
+  else
+    fmt = "%g";
+    num_mtics = 5;
+  endif
+  colorspec = get_text_colorspec (color, mono);
+  if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual"))
+    if (isempty (tics))
+      fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
+    elseif (strcmpi (labelmode, "manual"))
+      if (ischar (labels))
+        labels = cellstr (labels);
+      endif
+      if (isnumeric (labels))
+        labels = num2str (real (labels(:)));
+      endif
+      if (ischar (labels))
+        labels = permute (cellstr (labels), [2, 1]);
+      endif
+      if (iscellstr (labels))
+        k = 1;
+        ntics = numel (tics);
+        nlabels = numel (labels);
+        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
+        if (mirror)
+          fprintf (plot_stream, "set %stics add %s %s %s mirror (", ax,
+                   tickdir, ticklength, axispos);
+        else
+          fprintf (plot_stream, "set %stics add %s %s %s nomirror (", ax,
+                   tickdir, ticklength, axispos);
+        endif
+
+        labels = regexprep (labels, '%', "%%");
+        for i = 1:ntics
+          fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
+          if (i < ntics)
+            fputs (plot_stream, ", ");
+          endif
+          if (k > nlabels)
+            k = 1;
+          endif
+        endfor
+        fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
+        if (strcmp (mtics, "on"))
+          fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+        else
+          fprintf (plot_stream, "unset m%stics;\n", ax);
+        endif
+      else
+        error ("__go_draw_axes__: unsupported type of ticklabel");
+      endif
+    else
+      fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
+      if (mirror)
+        fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, tickdir,
+                 ticklength, axispos);
+      else
+        fprintf (plot_stream, "set %stics %s %s %s nomirror (", ax, tickdir,
+                 ticklength, axispos);
+      endif
+      fprintf (plot_stream, " %.15g,", tics(1:end-1));
+      fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
+      if (strcmp (mtics, "on"))
+        fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+      else
+        fprintf (plot_stream, "unset m%stics;\n", ax);
+      endif
+    endif
+  else
+    fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt);
+    if (mirror)
+      fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax,
+               axispos, tickdir, ticklength, colorspec, fontspec);
+    else
+      fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax,
+               tickdir, ticklength, axispos, colorspec, fontspec);
+    endif
+    if (strcmp (mtics, "on"))
+      fprintf (plot_stream, "set m%stics %d;\n", ax, num_mtics);
+    else
+      fprintf (plot_stream, "unset m%stics;\n", ax);
+    endif
+  endif
+endfunction
+
+function ticklabel = ticklabel_to_cell (ticklabel)
+  if (isnumeric (ticklabel))
+    ## Use upto 5 significant digits
+    ticklabel = num2str (ticklabel(:), 5);
+  endif
+  if (ischar (ticklabel))
+    if (rows (ticklabel) == 1 && any (ticklabel == "|"))
+      ticklabel = ostrsplit (ticklabel, "|");
+    else
+      ticklabel = cellstr (ticklabel);
+    endif
+  elseif (isempty (ticklabel))
+    ticklabel = {""};
+  else
+    ticklabel = ticklabel;
+  endif
+endfunction
+
+function colorspec = get_text_colorspec (color, mono)
+  if (mono)
+    colorspec = "";
+  else
+    colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"",
+                         round (255*color));
+  endif
+endfunction
+
+function [f, s, fnt, it, bld] = get_fontname_and_size (t)
+  if (isempty (t.fontname) || strcmp (t.fontname, "*"))
+    fnt = "{}";
+  else
+    fnt = t.fontname;
+  endif
+  f = fnt;
+  it = false;
+  bld = false;
+  if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold"))
+    if (! isempty (t.fontangle)
+        && (strcmpi (t.fontangle, "italic")
+            || strcmpi (t.fontangle, "oblique")))
+      f = [f "-bolditalic"];
+      it = true;
+      bld = true;
+    else
+      f = [f "-bold"];
+      bld = true;
+    endif
+  elseif (! isempty (t.fontangle)
+          && (strcmpi (t.fontangle, "italic")
+              || strcmpi (t.fontangle, "oblique")))
+    f = [f "-italic"];
+    it = true;
+  endif
+  if (isempty (t.fontsize))
+    s = 10;
+  else
+    s = t.fontsize;
+  endif
+endfunction
+
+function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld)
+
+  persistent warned_latex = false;
+
+  if (strcmp (fld, "string"))
+    [f, s, fnt, it, bld] = get_fontname_and_size (obj);
+  else
+    f = "Helvetica";
+    s = 10;
+    fnt = f;
+    it = false;
+    bld = false;
+  endif
+
+  ## The text object maybe multiline, and may be of any class
+  str = getfield (obj, fld);
+  if (ischar (str) && rows (str) > 1)
+    str = cellstr (str);
+  elseif (isnumeric (str))
+    str = cellstr (num2str (str(:)));
+  endif
+  if (iscellstr (str))
+    for n = 1:numel (str)
+      if (isnumeric (str{n}))
+        str{n} = num2str (str{n});
+      endif
+    endfor
+    str = sprintf ("%s\n", str{:})(1:end-1);
+  endif
+
+  if (enhanced)
+    if (strcmpi (obj.interpreter, "tex"))
+      if (iscellstr (str))
+        for n = 1:numel (str)
+          str{n} = __tex2enhanced__ (str{n}, fnt, it, bld);
+        endfor
+      else
+        str = __tex2enhanced__ (str, fnt, it, bld);
+      endif
+    elseif (strcmpi (obj.interpreter, "latex"))
+      if (! warned_latex)
+        warning ("latex markup not supported for text objects");
+        warned_latex = true;
+      endif
+    elseif (enhanced)
+      str = no_super_sub_scripts (str);
+    endif
+  endif
+endfunction
+
+function str = no_super_sub_scripts (str)
+  if (iscellstr (str))
+    labels = str;
+  else
+    labels = cellstr (str);
+  endif
+  for marker = "_^" 
+    for m = 1 : numel (labels)
+      n1 = strfind (labels{m}, sprintf ("\\%s", marker));
+      n2 = strfind (labels{m}, marker);
+      if (! isempty (n1))
+        n1 = n1 + 1;
+        n2 = setdiff (n2, n1);
+      endif
+      for n = numel (n2):-1:1
+        labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)];
+      endfor
+    endfor
+  endfor
+  if (iscellstr (str))
+    str = labels;
+  else
+    str = char (labels);
+  endif
+endfunction
+
+function str = __tex2enhanced__ (str, fnt, it, bld)
+  persistent sym = __setup_sym_table__ ();
+  persistent flds = fieldnames (sym);
+
+  [s, e, m] = regexp (str, "\\\\([a-zA-Z]+|0)", "start", "end", "matches");
+
+  for i = length (s) : -1 : 1
+    ## special case for "\0"  and replace with "{/Symbol \306}'
+    if (strncmp (m{i}, '\0', 2))
+      str = [str(1:s(i) - 1) '{/Symbol \306}' str(s(i) + 2:end)];
+    else
+      f = m{i}(2:end);
+      if (isfield (sym, f))
+        g = getfield (sym, f);
+        ## FIXME The symbol font doesn't seem to support bold or italic
+        ##if (bld)
+        ##  if (it)
+        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+        ##  else
+        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+        ##  endif
+        ##elseif (it)
+        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+        ##endif
+        str = [str(1:s(i) - 1) g str(e(i) + 1:end)];
+      elseif (strncmp (f, "rm", 2))
+        bld = false;
+        it = false;
+        str = [str(1:s(i) - 1) '/' fnt ' ' str(s(i) + 3:end)];
+      elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2))
+        it = true;
+        if (bld)
+          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
+        else
+          str = [str(1:s(i) - 1) '/' fnt '-italic ' str(s(i) + 3:end)];
+        endif
+      elseif (strncmp (f, "bf", 2))
+        bld = true;
+        if (it)
+          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
+        else
+          str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)];
+        endif
+      elseif (strcmpi (f, "color"))
+        ## FIXME Ignore \color but remove trailing {} block as well
+        d = strfind (str(e(i) + 1:end),'}');
+        if (isempty (d))
+          warning ('syntax error in \color argument');
+        else
+          str = [str(1:s(i) - 1) str(e(i) + d + 1:end)];
+        endif
+      elseif (strcmpi (f, "fontname"))
+        b1 = strfind (str(e(i) + 1:end),'{');
+        b2 = strfind (str(e(i) + 1:end),'}');
+        if (isempty (b1) || isempty (b2))
+          warning ('syntax error in \fontname argument');
+        else
+          str = [str(1:s(i) - 1), '/', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                 '{}', str(e(i) + b2(1) + 1:end)];
+        endif
+      elseif (strcmpi (f, "fontsize"))
+        b1 = strfind (str(e(i) + 1:end),'{');
+        b2 = strfind (str(e(i) + 1:end),'}');
+        if (isempty (b1) || isempty (b2))
+          warning ('syntax error in \fontname argument');
+        else
+          str = [str(1:s(i) - 1), '/=', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), ...
+                 '{}', str(e(i) + b2(1) + 1:end)];
+        endif
+      else
+        ## Last desperate attempt to treat the symbol. Look for things
+        ## like \pix, that should be translated to the symbol Pi and x
+        for j = 1 : length (flds)
+          if (strncmp (flds{j}, f, length (flds{j})))
+            g = getfield (sym, flds{j});
+            ## FIXME The symbol font doesn't seem to support bold or italic
+            ##if (bld)
+            ##  if (it)
+            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+            ##  else
+            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+            ##  endif
+            ##elseif (it)
+            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+            ##endif
+            str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)];
+            break;
+          endif
+        endfor
+      endif
+    endif
+  endfor
+
+  ## Prepend @ to things  things like _0^x or _{-100}^{100} for
+  ## alignment But need to put the shorter of the two arguments first.
+  ## Carful of nested {} and unprinted characters when defining
+  ## shortest.. Don't have to worry about things like ^\theta as they
+  ## are already converted to ^{/Symbol q}.
+
+  ## FIXME -- This is a mess... Is it worth it just for a "@" character?
+
+  [s, m] = regexp (str,'[_\^]','start','matches');
+  i = 1;
+  p = 0;
+  while (i < length (s))
+    if (i < length (s))
+      if (str(s(i) + p + 1) == "{")
+        s1 = strfind (str(s(i) + p + 2:end),'{');
+        si = 1;
+        l1 = strfind (str(s(i) + p + 1:end),'}');
+        li = 1;
+        while (li <= length (l1) && si <= length (s1))
+          if (l1(li) < s1(si))
+            if (li == si)
+              break;
+            endif
+            li++;
+          else
+            si++;
+          endif
+        endwhile
+        l1 = l1 (min (length (l1), si));
+        if (s(i) + l1 + 1 == s(i+1))
+          if (str(s(i + 1) + p + 1) == "{")
+            s2 = strfind (str(s(i + 1) + p + 2:end),'{');
+            si = 1;
+            l2 = strfind (str(s(i + 1) + p + 1:end),'}');
+            li = 1;
+            while (li <= length (l2) && si <= length (s2))
+              if (l2(li) < s2(si))
+                if (li == si)
+                  break;
+                endif
+                li++;
+              else
+                si++;
+              endif
+            endwhile
+            l2 = l2 (min (length (l2), si));
+            if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
+                length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1)))
+              ## Shortest already first!
+              str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
+            else
+              ## Have to swap sub/super-script to get shortest first.
+              str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), ...
+                     str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)];
+            endif
+          else
+            ## Have to swap sub/super-script to get shortest first.
+            str = [str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), ...
+                   str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)];
+          endif
+          i += 2;
+          p ++;
+        else
+          i++;
+        endif
+      else
+        if (s(i+1) == s(i) + 2)
+          ## Shortest already first!
+          str = [str(1:s(i)+p-1) "@" str(s(i)+p:end)];
+          p ++;
+          i += 2;
+        else
+          i ++;
+        endif
+      endif
+    else
+      i ++;
+    endif
+  endwhile
+
+endfunction
+
+function l = length_string (s)
+  l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}'));
+  m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches');
+  if (!isempty (m))
+    l = l - sum (cellfun ("length", m));
+  endif
+endfunction
+
+function sym = __setup_sym_table__ ()
+  ## Setup the translation table for TeX to gnuplot enhanced mode.
+  sym.forall = '{/Symbol \042}';
+  sym.exists = '{/Symbol \044}';
+  sym.ni = '{/Symbol \047}';
+  sym.cong = '{/Symbol \100}';
+  sym.Delta = '{/Symbol D}';
+  sym.Phi = '{/Symbol F}';
+  sym.Gamma = '{/Symbol G}';
+  sym.vartheta = '{/Symbol J}';
+  sym.Lambda = '{/Symbol L}';
+  sym.Pi = '{/Symbol P}';
+  sym.Theta = '{/Symbol Q}';
+  sym.Sigma = '{/Symbol S}';
+  sym.varsigma = '{/Symbol V}';
+  sym.Omega = '{/Symbol W}';
+  sym.Xi = '{/Symbol X}';
+  sym.Psi = '{/Symbol Y}';
+  sym.perp = '{/Symbol \136}';
+  sym.alpha = '{/Symbol a}';
+  sym.beta = '{/Symbol b}';
+  sym.chi = '{/Symbol c}';
+  sym.delta = '{/Symbol d}';
+  sym.epsilon = '{/Symbol e}';
+  sym.phi = '{/Symbol f}';
+  sym.gamma = '{/Symbol g}';
+  sym.eta = '{/Symbol h}';
+  sym.iota = '{/Symbol i}';
+  sym.varphi = '{/Symbol j}';
+  sym.kappa = '{/Symbol k}';
+  sym.lambda = '{/Symbol l}';
+  sym.mu = '{/Symbol m}';
+  sym.nu = '{/Symbol n}';
+  sym.o =  '{/Symbol o}';
+  sym.pi = '{/Symbol p}';
+  sym.theta = '{/Symbol q}';
+  sym.rho = '{/Symbol r}';
+  sym.sigma = '{/Symbol s}';
+  sym.tau = '{/Symbol t}';
+  sym.upsilon = '{/Symbol u}';
+  sym.varpi = '{/Symbol v}';
+  sym.omega = '{/Symbol w}';
+  sym.xi = '{/Symbol x}';
+  sym.psi = '{/Symbol y}';
+  sym.zeta = '{/Symbol z}';
+  sym.sim = '{/Symbol \176}';
+  sym.Upsilon = '{/Symbol \241}';
+  sym.prime = '{/Symbol \242}';
+  sym.leq = '{/Symbol \243}';
+  sym.infty = '{/Symbol \245}';
+  sym.clubsuit = '{/Symbol \247}';
+  sym.diamondsuit = '{/Symbol \250}';
+  sym.heartsuit = '{/Symbol \251}';
+  sym.spadesuit = '{/Symbol \252}';
+  sym.leftrightarrow = '{/Symbol \253}';
+  sym.leftarrow = '{/Symbol \254}';
+  sym.uparrow = '{/Symbol \255}';
+  sym.rightarrow = '{/Symbol \256}';
+  sym.downarrow = '{/Symbol \257}';
+  sym.circ = '{/Symbol \260}';
+  sym.pm = '{/Symbol \261}';
+  sym.geq = '{/Symbol \263}';
+  sym.times = '{/Symbol \264}';
+  sym.propto = '{/Symbol \265}';
+  sym.partial = '{/Symbol \266}';
+  sym.bullet = '{/Symbol \267}';
+  sym.div = '{/Symbol \270}';
+  sym.neq = '{/Symbol \271}';
+  sym.equiv = '{/Symbol \272}';
+  sym.approx = '{/Symbol \273}';
+  sym.ldots = '{/Symbol \274}';
+  sym.mid = '{/Symbol \275}';
+  sym.aleph = '{/Symbol \300}';
+  sym.Im = '{/Symbol \301}';
+  sym.Re = '{/Symbol \302}';
+  sym.wp = '{/Symbol \303}';
+  sym.otimes = '{/Symbol \304}';
+  sym.oplus = '{/Symbol \305}';
+  sym.oslash = '{/Symbol \306}';
+  sym.cap = '{/Symbol \307}';
+  sym.cup = '{/Symbol \310}';
+  sym.supset = '{/Symbol \311}';
+  sym.supseteq = '{/Symbol \312}';
+  sym.subset = '{/Symbol \314}';
+  sym.subseteq = '{/Symbol \315}';
+  sym.in = '{/Symbol \316}';
+  sym.notin = '{/Symbol \317}';
+  sym.angle = '{/Symbol \320}';
+  sym.bigtriangledown = '{/Symbol \321}';
+  sym.langle = '{/Symbol \341}';
+  sym.rangle = '{/Symbol \361}';
+  sym.nabla = '{/Symbol \321}';
+  sym.prod = '{/Symbol \325}';
+  sym.surd = '{/Symbol \326}';
+  sym.cdot = '{/Symbol \327}';
+  sym.neg = '{/Symbol \330}';
+  sym.wedge = '{/Symbol \331}';
+  sym.vee = '{/Symbol \332}';
+  sym.Leftrightarrow = '{/Symbol \333}';
+  sym.Leftarrow = '{/Symbol \334}';
+  sym.Uparrow = '{/Symbol \335}';
+  sym.Rightarrow = '{/Symbol \336}';
+  sym.Downarrow = '{/Symbol \337}';
+  sym.diamond = '{/Symbol \340}';
+  sym.copyright = '{/Symbol \343}';
+  sym.lfloor = '{/Symbol \353}';
+  sym.lceil  = '{/Symbol \351}';
+  sym.rfloor = '{/Symbol \373}';
+  sym.rceil  = '{/Symbol \371}';
+  sym.int = '{/Symbol \362}';
+endfunction
+
+function retval = __do_enhanced_option__ (enhanced, obj)
+  retval = "";
+  if (enhanced)
+    if (strcmpi (obj.interpreter, "none"))
+      retval = "noenhanced";
+    else
+      retval = "enhanced";
+    endif
+  endif
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__go_draw_figure__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,206 @@
+## Copyright (C) 2005-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __go_draw_figure__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: jwe
+
+function __go_draw_figure__ (h, plot_stream, enhanced, mono)
+
+  htype = get (h, "type");
+  if (strcmp (htype, "figure"))
+    ## Get complete list of children.
+    kids = allchild (h);
+    nkids = length (kids);
+
+    if (nkids > 0)
+      fputs (plot_stream, "\nreset;\n");
+      fputs (plot_stream, "set autoscale keepfix;\n");
+      fputs (plot_stream, "set origin 0, 0\n");
+      fputs (plot_stream, "set size 1, 1\n");
+      bg = get (h, "color");
+      if (isnumeric (bg))
+        fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * bg);
+        bg_is_set = true;
+      else
+        bg_is_set = false;
+      endif
+      fg_was_set = false;
+
+      for i = nkids:-1:1
+        type = get (kids(i), "type");
+        switch (type)
+          case "axes"
+            if (strcmpi (get (kids (i), "tag"), "legend"))
+              ## This is so ugly. If there was a way of getting
+              ## gnuplot to give us the text extents of strings
+              ## then we could get rid of this mess.
+              lh = getfield (get (kids(i), "userdata"), "handle");
+              if (isscalar (lh))
+                ## We have a legend with a single parent. It'll be handled
+                ## below as a gnuplot key to the axis it corresponds to
+                continue;
+              else
+                ca = lh(1);
+                ## Rely upon listener to convert axes position
+                ## to "normalized" units.
+                legend_axes_units = get (kids(i), "units");
+                legend_axes_position = get (kids(i), "position");
+                legend_axes_outerposition = get (kids(i), "outerposition");
+                legend_axes_box = get (kids(i), "box");
+                legend_axes_ylim = get (kids(i), "ylim");
+                orig_axes_units = get (ca, "units");
+                hlgnd = get (kids(i));
+
+                unwind_protect
+                  set (ca, "units", "normalized");
+                  set (kids(i), "units", "normalized", "box", "off",
+                       "ylim", [-2, -1], "position", get (ca(1), "position"),
+                       "outerposition", get (ca(1), "outerposition"));
+
+                  ## Create a new set of lines with the appropriate
+                  ## displaynames, etc
+                  toberm = [];
+                  hobj = get (kids(i), "children");
+                  for j = numel (hobj) : -1 : 1
+                    if (! strcmp (get (hobj(j), "type"), "text"))
+                      continue;
+                    endif
+                    displayname = get (hobj(j), "string");
+                    ll = [];
+                    lm = [];
+                    for k = numel (hobj) : -1 : 1
+                      if (! strcmp (get (hobj(k), "type"), "line"))
+                        continue;
+                      endif
+                      if (get (hobj(j), "userdata")
+                          != get (hobj(k), "userdata"))
+                        continue;
+                      endif
+                      if (! strcmp (get (hobj(k), "linestyle"), "none"))
+                        ll = hobj(k);
+                      endif
+                      if (! strcmp (get (hobj(k), "marker"), "none"))
+                        lm = hobj(k);
+                      endif
+                    endfor
+
+                    if (! isempty (ll))
+                      if (!isempty (lm))
+                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", get(ll,"linestyle"), "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
+                      else
+                        toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(ll,"color"), "linestyle", get(ll,"linestyle"), "marker", "none", "displayname", displayname, "parent", kids(i))];
+                      endif
+                    elseif (! isempty (lm))
+                      toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", "none", "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))];
+                    endif
+                  endfor
+                  if (bg_is_set)
+                    fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
+                  endif
+                  __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
+                                    bg_is_set, false, hlgnd);
+                unwind_protect_cleanup
+                  ## Return axes "units" and "position" back to
+                  ## their original values.
+                  set (ca, "units", orig_axes_units);
+                  set (kids(i), "units", legend_axes_units,
+                       "box", legend_axes_box,
+                       "ylim", legend_axes_ylim,
+                       "position", legend_axes_position,
+                       "outerposition", legend_axes_outerposition);
+                  delete (toberm);
+                  bg_is_set = false;
+                end_unwind_protect
+              endif
+            else
+              ## Rely upon listener to convert axes position
+              ## to "normalized" units.
+              orig_axes_units = get (kids(i), "units");
+              orig_axes_position = get (kids(i), "position");
+              unwind_protect
+                set (kids(i), "units", "normalized");
+                fg = get (kids(i), "color");
+                if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on"))
+                  fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg);
+                  fg_is_set = true;
+                  fg_was_set = true;
+                elseif (fg_was_set)
+                  fprintf (plot_stream, "unset obj 2\n");
+                  fg_is_set = false;
+                  fg_was_set = false;
+                else
+                  fg_is_set = false;
+                endif
+                if (bg_is_set)
+                  fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg));
+                endif
+                ## Find if this axes has an associated legend axes and pass it
+                ## to __go_draw_axes__
+                hlegend = [];
+                fkids = get (h, "children");
+                for j = 1 : numel (fkids)
+                  if (ishandle (fkids (j))
+                      && strcmp (get (fkids (j), "type"), "axes")
+                      && (strcmp (get (fkids (j), "tag"), "legend")))
+                    udata = get (fkids (j), "userdata");
+                    if (isscalar (udata.handle)
+                        && ! isempty (intersect (udata.handle, kids (i))))
+                      hlegend = get (fkids (j));
+                      break;
+                    endif
+                  endif
+                endfor
+                __go_draw_axes__ (kids(i), plot_stream, enhanced, mono,
+                                  bg_is_set, fg_is_set, hlegend);
+              unwind_protect_cleanup
+                ## Return axes "units" and "position" back to
+                ## their original values.
+                set (kids(i), "units", orig_axes_units);
+                set (kids(i), "position", orig_axes_position);
+                bg_is_set = false;
+                fg_is_set = false;
+              end_unwind_protect
+            endif
+          case "uimenu"
+            ## ignore uimenu objects
+            kids(i) = [];
+          otherwise
+            error ("__go_draw_figure__: unknown object class, %s", type);
+        endswitch
+      endfor
+      if (isempty (kids))
+        fputs (plot_stream, "\nreset; clear;\n");
+        fflush (plot_stream);
+      else
+        fputs (plot_stream, "\nunset multiplot;\n");
+      endif
+    else
+      fputs (plot_stream, "\nreset; clear;\n");
+      fflush (plot_stream);
+    endif
+  else
+    error ("__go_draw_figure__: expecting figure object, found '%s'",
+           htype);
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,654 @@
+## Copyright (C) 2010-2012 Shai Ayal
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{args} =} __print_parse_opts__ (@var{propname}, @var{propvalue})
+## @deftypefnx {Function File} {@var{args} =} __print_parse_opts__ (@var{struct})
+## Undocumented internal function.
+## @end deftypefn
+
+function arg_st = __print_parse_opts__ (varargin)
+
+  persistent warn_on_missing_binary = true
+
+  arg_st.append_to_file = false;
+  arg_st.canvas_size = [];
+  arg_st.debug = false;
+  arg_st.debug_file = "octave-print-commands.log";
+  arg_st.devopt = "";
+  arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool"));
+  arg_st.figure = get (0, "currentfigure");
+  arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev"));
+  arg_st.fontsize = "";
+  arg_st.font = "";
+  arg_st.scalefontsize = 1;
+  arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid
+  arg_st.formatted_for_printing = false;
+  arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ());
+  arg_st.ghostscript.debug = false;
+  arg_st.ghostscript.device = "";
+  arg_st.ghostscript.epscrop = true;
+  arg_st.ghostscript.level = [];
+  arg_st.ghostscript.output = "";
+  arg_st.ghostscript.papersize = "";
+  arg_st.ghostscript.pageoffset = [];
+  arg_st.ghostscript.resolution = 150;
+  arg_st.ghostscript.antialiasing = false;
+  arg_st.ghostscript.antialiasing_textalphabits = 4;
+  arg_st.ghostscript.antialiasing_graphicsalphabits = 4;
+  arg_st.loose = false;
+  arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr"));
+  arg_st.name = "";
+  arg_st.orientation = "";
+  arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit"));
+  arg_st.preview = "";
+  arg_st.printer = "";
+  arg_st.send_to_printer = false;
+  arg_st.special_flag = "textnormal";
+  arg_st.tight_flag = false;
+  arg_st.use_color = 0; # 0=default, -1=mono, +1=color
+
+  if (isunix ())
+    arg_st.lpr_options = "-l";
+  elseif (ispc ())
+    arg_st.lpr_options = "-o l";
+  else
+    arg_st.lpr_options = "";
+  endif
+  arg_st.unlink = {};
+
+  if (nargin > 0 && isfigure (varargin{1}))
+    arg_st.figure = varargin{1};
+    varargin(1) = [];
+  endif
+
+  for i = 1:numel (varargin)
+    arg = strtrim (varargin{i});
+    if (ischar (arg))
+      if (strcmp (arg, "-color"))
+        arg_st.use_color = 1;
+      elseif (strcmp (arg, "-append"))
+        arg_st.append_to_file = true;
+      elseif (strcmp (arg, "-mono"))
+        arg_st.use_color = -1;
+      elseif (strcmp (arg, "-solid"))
+        arg_st.force_solid = 1;
+      elseif (strcmp (arg, "-dashed"))
+        arg_st.force_solid = -1;
+      elseif (strncmp (arg, "-portrait", length (arg)))
+        arg_st.orientation = "portrait";
+      elseif (strncmp (arg, "-landscape", length (arg)))
+        arg_st.orientation = "landscape";
+      elseif (strcmp (arg, "-loose"))
+        arg_st.loose = true;
+        arg_st.tight_flag = false;
+      elseif (strcmp (arg, "-tight"))
+        arg_st.loose = false;
+        arg_st.tight_flag = true;
+      elseif (strcmp (arg, "-textspecial"))
+        arg_st.special_flag = "textspecial";
+      elseif (any (strcmp (arg, {"-interchange", "-metafile", "-pict", "-tiff"})))
+        arg_st.preview = arg(2:end);
+      elseif (strncmp (arg, "-debug", 6))
+        arg_st.debug = true;
+        arg_st.ghostscript.debug = true;
+        if (length (arg) > 7)
+          arg_st.debug_file = arg(8:end);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-d")
+        arg_st.devopt = tolower (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-P")
+        arg_st.printer = arg;
+      elseif (strncmp (arg, "-EPSTOOL:", 9))
+        arg_st.epstool_binary = arg{10:end};
+      elseif (strncmp (arg, "-FIG2DEV:", 9))
+        arg_st.fig2dev_binary = arg{10:end};
+      elseif (strncmp (arg, "-PSTOEDIT:", 9))
+        arg_st.pstoedit_binary = arg{10:end};
+      elseif (strncmpi (arg, "-textalphabits=", 15))
+        n = find (arg == "=");
+        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
+          arg_st.ghostscript.antialiasing_textalphabits = str2num (arg(end));
+        else
+          error ("print: improper syntax, or value, for TextAlphaBits");
+        endif
+      elseif (strncmpi (arg, "-graphicsalphabits=", 19))
+        n = find (arg == "=");
+        if (! isempty (n) && n == numel (arg) - 1 && any (arg(end) == "124"))
+          arg_st.ghostscript.antialiasing_graphicsalphabits = str2num (arg(end));
+        else
+          error ("print: improper syntax, or value, for GraphicsAlphaBits");
+        endif
+      elseif ((length (arg) > 2) && arg(1:2) == "-G")
+        arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end));
+        if (isempty (arg_st.ghostscript.binary))
+          error ("print: Ghostscript binary ""%s"" could not be located",
+                 arg(3:end));
+        else
+          arg_st.ghostscript.binary = __quote_path__ (arg_st.ghostscript.binary);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-F")
+        idx = rindex (arg, ":");
+        if (idx)
+          arg_st.font = arg(3:idx-1);
+          arg_st.fontsize = str2num (arg(idx+1:end));
+        else
+          arg_st.font = arg(3:end);
+        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-S")
+        arg_st.canvas_size = str2num (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-r")
+        arg_st.ghostscript.resolution = str2double (arg(3:end));
+      elseif (length (arg) > 2 && arg(1:2) == "-f")
+        arg_st.figure = str2num (arg(3:end));
+      elseif (length (arg) >= 1 && arg(1) == "-")
+        error ("print: unknown option '%s'", arg);
+      elseif (length (arg) > 0)
+        arg_st.name = tilde_expand (arg);
+      endif
+    elseif (isfigure (arg))
+      arg_st.figure = arg;
+    else
+      error ("print: expecting inputs to be character string options or a figure handle");
+    endif
+  endfor
+
+  if (arg_st.ghostscript.resolution == 0)
+    ## Do as Matlab does.
+    arg_st.ghostscript.resolution = get (0, "screenpixelsperinch");
+  endif
+
+  if (isempty (arg_st.orientation))
+    if (isfigure (arg_st.figure))
+      arg_st.orientation = get (arg_st.figure, "paperorientation");
+    else
+      ## Allows tests to be run without error.
+      arg_st.orientation = "portrait";
+    endif
+  endif
+
+  if (isempty (arg_st.ghostscript.binary))
+    arg_st.ghostscript.binary = __ghostscript_binary__ ();
+  endif
+
+  dot = rindex (arg_st.name, ".");
+  if (isempty (arg_st.devopt))
+    if (dot == 0)
+      arg_st.devopt = "psc";
+    else
+      arg_st.devopt = tolower (arg_st.name(dot+1:end));
+    endif
+  endif
+
+  if (arg_st.use_color == 0)
+    if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt)))
+      arg_st.use_color = -1;
+    else
+      arg_st.use_color = 1;
+    endif
+  endif
+
+  if (strcmp (arg_st.devopt, "tex"))
+    arg_st.devopt = "epslatex";
+  elseif (strcmp (arg_st.devopt, "ill"))
+    arg_st.devopt = "aifm";
+  elseif (strcmp (arg_st.devopt, "cdr"))
+    arg_st.devopt = "corel";
+  elseif (strcmp (arg_st.devopt, "meta"))
+    arg_st.devopt = "emf";
+  elseif (strcmp (arg_st.devopt, "jpg"))
+    arg_st.devopt = "jpeg";
+  endif
+
+  dev_list = {"aifm", "corel", "fig", "png", "jpeg", ...
+              "gif", "pbm", "pbmraw", "dxf", "mf", ...
+              "svg", "hpgl", "ps", "ps2", "psc", ...
+              "psc2", "eps", "eps2", "epsc", "epsc2", ...
+              "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ...
+              "pslatexstandalone", "pdflatexstandalone", ...
+              "pstex", "tiff", "tiffn" "tikz", "pcxmono", ...
+              "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ...
+              "ppm", "ppmraw", "pdflatex", "texdraw", ...
+              "pdfcairo", "pngcairo", "pstricks", ...
+              "epswrite", "pswrite", "ps2write", "pdfwrite"};
+
+  suffixes = {"ai", "cdr", "fig", "png", "jpg", ...
+              "gif", "pbm", "pbm", "dxf", "mf", ...
+              "svg", "hpgl", "ps", "ps", "ps", ...
+              "ps", "eps", "eps", "eps", "eps", ...
+              "emf", "pdf", "tex", "tex", "tex", ...
+              "tex", "tex", ...
+              "ps", "tiff", "tiff", "tikz", "pcx", ...
+              "pcx", "pcx", "pcx", "pgm", "pgm", ...
+              "ppm", "ppm", "tex", "tex", ...
+              "pdf", "png", "tex", ...
+              "eps", "ps", "ps", "pdf"};
+
+  if (isfigure (arg_st.figure))
+    __graphics_toolkit__ = get (arg_st.figure, "__graphics_toolkit__");
+  else
+    ## Allow tests when no figures are present.
+    __graphics_toolkit__ = get (0, "defaultfigure__graphics_toolkit__");
+  endif
+
+  if (strcmp (__graphics_toolkit__, "gnuplot")
+      && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix"))
+    suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"};
+  endif
+
+  match = strcmpi (dev_list, arg_st.devopt);
+  if (any (match))
+    default_suffix = suffixes {match};
+  else
+    default_suffix = arg_st.devopt;
+  endif
+
+  if (dot == 0 && ! isempty (arg_st.name))
+    arg_st.name = strcat (arg_st.name, ".", default_suffix);
+  endif
+
+  if (arg_st.append_to_file)
+    if (isempty (arg_st.name))
+      arg_st.append_to_file = false;
+    elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ...
+                                          "ps", "ps2", "psc", "psc2", "pdf"})))
+      have_ghostscript = ! isempty (__ghostscript_binary__ ());
+      if (have_ghostscript)
+        file_exists = ((numel (dir (arg_st.name)) == 1)
+                       && (! isdir (arg_st.name)));
+        if (! file_exists)
+          arg_st.append_to_file = false;
+        endif
+      else
+        arg_st.append_to_file = false;
+        warning ("print.m: appended output requires ghostscript to be installed");
+      endif
+    else
+      warning ("print.m: appended output is not supported for device '%s'",
+               arg_st.devopt);
+      arg_st.append_to_file = false;
+    endif
+  endif
+
+  if (! isempty (arg_st.printer) || isempty (arg_st.name))
+    arg_st.send_to_printer = true;
+  endif
+
+  if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"})))
+    arg_st.formatted_for_printing = true;
+  endif
+
+  aliases = gs_aliases ();
+  if (any (strcmp (arg_st.devopt, fieldnames (aliases))))
+    arg_st.devopt = aliases.(arg_st.devopt);
+  endif
+
+  ## FIXME - eps2 & epsc2 needs to be handled
+  if (strcmp (arg_st.devopt, "pswrite"))
+    arg_st.ghostscript.level = 1;
+  elseif (strcmp (arg_st.devopt, "ps2write"))
+    arg_st.ghostscript.level = 2;
+  endif
+
+  if ((any (strcmp (arg_st.devopt, gs_device_list))
+       && ! arg_st.formatted_for_printing)
+      || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"})))
+    ## Use ghostscript for graphic formats
+    arg_st.ghostscript.device = arg_st.devopt;
+    arg_st.ghostscript.output = arg_st.name;
+    arg_st.ghostscript.antialiasing = true;
+    if (arg_st.formatted_for_printing)
+      arg_st.ghostscript.epscrop = ! arg_st.loose;
+    else
+      ## pstoedit throws errors if the EPS file isn't cropped
+      arg_st.ghostscript.epscrop = true;
+    endif
+  elseif (all (! strcmp (arg_st.devopt, dev_list)))
+    ## Assume we are formating output for a printer
+    arg_st.formatted_for_printing = true;
+    arg_st.ghostscript.device = arg_st.devopt;
+    arg_st.ghostscript.output = arg_st.name;
+    arg_st.ghostscript.antialiasing = false;
+    arg_st.ghostscript.epscrop = ! arg_st.loose;
+  endif
+
+  if (arg_st.send_to_printer)
+    if (isempty (arg_st.name))
+      ## Pipe the ghostscript output 
+      arg_st.name = "-";
+    else
+      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"})))
+      ## Only postscript and supported ghostscript devices
+      error ("print: invalid format for spooling to a printer")
+    endif
+  elseif (isempty (arg_st.name))
+    error ("print: an output file name must be specified")
+  endif
+
+  if (isempty (arg_st.canvas_size))
+    if (isfigure (arg_st.figure))
+      [arg_st.ghostscript.papersize, paperposition] = ...
+                           gs_papersize (arg_st.figure, arg_st.orientation);
+    else
+      ## allows tests to be run
+      arg_st.ghostscript.papersize = "letter";
+      paperposition = [0.25, 2.50, 8.00, 6.00] * 72;
+    endif
+    arg_st.canvas_size = paperposition(3:4);
+    if (strcmp (__graphics_toolkit__, "gnuplot") && ! arg_st.ghostscript.epscrop)
+      arg_st.ghostscript.pageoffset = paperposition(1:2) - 50;
+    else
+      arg_st.ghostscript.pageoffset = paperposition(1:2);
+    endif
+  else
+    ## Convert canvas size to points from pixels.
+    if (! isempty (arg_st.fontsize))
+      ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps).
+      arg_st.scalefontsize = arg_st.ghostscript.resolution / 72;
+    endif
+    arg_st.ghostscript.resolution = 72;
+    arg_st.ghostscript.papersize = arg_st.canvas_size;
+    arg_st.ghostscript.epscrop = true;
+    arg_st.ghostscript.pageoffset = [0, 0];
+  endif
+
+  if (arg_st.formatted_for_printing)
+    arg_st.ghostscript.resolution = [];
+  else
+    arg_st.ghostscript.papersize = "";
+    arg_st.ghostscript.pageoffset = [0, 0];
+  endif
+
+  if (warn_on_missing_binary)
+    if (isempty (arg_st.ghostscript.binary))
+      warning ("print:missing_gs", "print.m: Ghostscript binary is not available.\nOnly eps output is available.");
+    else
+      if (isempty (arg_st.epstool_binary))
+        warning ("print:missing_epstool", "print.m: epstool binary is not available.\nSome output formats are not available.");
+      endif
+      if (isempty (arg_st.fig2dev_binary))
+        warning ("print:missing_fig2dev", "print.m: fig2dev binary is not available.\nSome output formats are not available.");
+      endif
+      if (isempty (arg_st.pstoedit_binary))
+        warning ("print:missing_pstoedit", "print.m: pstoedit binary is not available.\nSome output formats are not available.");
+      endif
+    endif
+    warn_on_missing_binary = false;
+  endif
+
+endfunction
+
+## Test blocks are not allowed (and not needed) for private functions
+#%!test
+%! opts = __print_parse_opts__ ();
+%! assert (opts.devopt, "pswrite");
+%! assert (opts.use_color, 1);
+%! assert (opts.send_to_printer, true);
+%! assert (opts.canvas_size, [576, 432]);
+%! assert (opts.ghostscript.device, "pswrite");
+
+#%!test
+%! opts = __print_parse_opts__ ("test.pdf", "-S640,480");
+%! assert (opts.canvas_size, [307.2, 230.4], 0.1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose");
+%! assert (opts.devopt, "pswrite");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.use_color, 1);
+%! assert (opts.append_to_file, false);
+%! assert (opts.ghostscript.device, "pswrite");
+%! assert (opts.ghostscript.epscrop, false);
+
+#%!test
+%! opts = __print_parse_opts__ ("-deps", "-tight");
+%! assert (opts.tight_flag, true);
+%! assert (opts.send_to_printer, true);
+%! assert (opts.use_color, -1);
+%! assert (opts.ghostscript.device, "");
+
+#%!test
+%! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose");
+%! assert (opts.devopt, "jpeg");
+%! assert (opts.name, "foobar.jpg");
+%! assert (opts.ghostscript.device, "jpeg");
+%! assert (opts.ghostscript.epscrop, true);
+%! assert (opts.ghostscript.papersize, "");
+%! assert (opts.ghostscript.pageoffset, [0, 0]);
+%! assert (opts.send_to_printer, false);
+%! assert (opts.printer, "");
+%! assert (opts.use_color, -1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter");
+%! assert (opts.ghostscript.output, "foobar.deskjet");
+%! assert (opts.ghostscript.device, "deskjet");
+%! assert (opts.devopt, "deskjet");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.printer, "-Pmyprinter");
+%! assert (opts.use_color, -1);
+
+#%!test
+%! opts = __print_parse_opts__ ("-f5", "-dljet3");
+%! assert (opts.ghostscript.device, "ljet3");
+%! assert (strfind (opts.ghostscript.output, ".ljet3"));
+%! assert (opts.devopt, "ljet3");
+%! assert (opts.send_to_printer, true);
+%! assert (opts.figure, 5);
+
+function cmd = __quote_path__ (cmd)
+  if (! isempty (cmd))
+    is_quoted = all (cmd([1, end]) == "'");
+    if (! is_quoted)
+      dos_shell = ! isunix () && ispc ();
+      if (dos_shell && any (cmd == "/"))
+        cmd = strrep (cmd, "/", "\\");
+      endif
+      if (any (cmd == " "))
+        cmd = strcat ('"', strrep (cmd, '"', '""') ,'"');
+      endif
+    endif
+  endif
+endfunction
+
+function gs = __ghostscript_binary__ ()
+
+  persistent ghostscript_binary = ""
+  persistent warn_on_no_ghostscript = true
+  persistent warn_on_bad_gsc = true
+
+  if (isempty (ghostscript_binary))
+    GSC = getenv ("GSC");
+    if (exist (GSC, "file")
+        || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC)))
+      gs_binaries = {GSC};
+    elseif (! isempty (GSC) && warn_on_bad_gsc)
+      warning ("print:badgscenv",
+               "print.m: GSC environment variable not set properly");
+      warn_on_bad_gsc = false;
+      gs_binaries = {};
+    else
+      gs_binaries = {};
+    endif
+    if (isunix ())
+      ## Unix - Includes Mac OSX and Cygwin.
+      gs_binaries = horzcat (gs_binaries, {"gs", "gs.exe"});
+    else
+      ## pc - Includes Win32 and mingw.
+      gs_binaries = horzcat (gs_binaries, {"gs.exe", "gswin32c.exe", "gswin64c.exe", "mgs.exe"});
+    endif
+    n = 0;
+    while (n < numel (gs_binaries) && isempty (ghostscript_binary))
+      n = n + 1;
+      ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n});
+    endwhile
+    if (warn_on_no_ghostscript && isempty (ghostscript_binary))
+      warning ("print:noghostscript",
+               "print.m: ghostscript not found in PATH");
+      warn_on_no_ghostscript = false;
+    endif
+  endif
+
+  gs = ghostscript_binary;
+
+endfunction
+
+function bin = __find_binary__ (binary)
+
+  persistent data = struct ()
+
+  if (! isfield (data, binary))
+    ## Reinitialize when 'user_binaries' is present.
+    data.(binary).bin = "";
+    data.(binary).warn_on_absence = false;
+  endif
+
+  if (isempty (data.(binary).bin))
+    if (isunix ())
+      ## Unix - Includes Mac OSX and Cygwin.
+      binaries = strcat (binary, {"", ".exe"});
+    else
+      ## pc - Includes Win32 and mingw.
+      binaries = strcat (binary, {".exe"});
+    endif
+    n = 0;
+    while (n < numel (binaries) && isempty (data.(binary).bin))
+      n = n + 1;
+      data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n});
+    endwhile
+    if (isempty (data.(binary).bin) && data.(binary).warn_on_absence)
+      warning (sprintf ("print:no%s", binary),
+               "print.m: '%s' not found in PATH", binary);
+      data.(binary).warn_on_absence = false;
+    endif
+  endif
+
+  bin = data.(binary).bin;
+
+endfunction
+
+function [papersize, paperposition] = gs_papersize (hfig, paperorientation)
+  persistent papertypes papersizes
+
+  if (isempty (papertypes))
+    papertypes = {"usletter", "uslegal",     "a0",     "a1", ...
+                        "a2",      "a3",     "a4",     "a5", ...
+                        "b0",      "b1",     "b2",     "b3", ...
+                        "b4",      "b5", "arch-a", "arch-b", ...
+                    "arch-c",  "arch-d", "arch-e",      "a", ...
+                         "b",       "c",      "d",      "e", ...
+                   "tabloid"};
+    papersizes = [ 8.5, 11.0;  8.5, 14.0; 33.1, 46.8; 23.4, 33.1;
+                  16.5, 23.4; 11.7, 16.5;  8.3, 11.7;  5.8,  8.3;
+                  39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7;
+                   9.8, 13.9;  6.9,  9.8;  9.0, 12.0; 12.0, 18.0;
+                  18.0, 24.0; 24.0, 36.0; 36.0, 48.0;  8.5, 11.0;
+                  11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0;
+                  11.0, 17.0] * 72;
+  endif
+
+  papertype = get (hfig, "papertype");
+  paperunits = get (hfig, "paperunits");
+  paperposition = get (hfig, "paperposition");
+  if (strcmp (papertype, "<custom>"))
+    papersize = get (hfig, "papersize");
+    papersize = convert2points (papersize , paperunits);
+  else
+    papersize = papersizes (strcmp (papertypes, papertype), :);
+  endif
+
+  if (strcmp (paperunits, "normalized"))
+    paperposition = paperposition .* papersize([1,2,1,2]);
+  else
+    paperposition = convert2points (paperposition, paperunits);
+  endif
+
+  ## FIXME - This will be obsoleted by listeners for paper properties.
+  ##         Papersize is tall when portrait,and wide when landscape.
+  if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait"))
+      || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape")))
+    papersize = papersize([2,1]);
+    paperposition = paperposition([2,1,4,3]);
+  endif
+
+  if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation, "portrait")))
+    ## For portrait use the ghostscript name
+    papersize = papertype;
+    papersize(papersize=="-") = "";
+    papersize = strrep (papersize, "us", "");
+    switch (papersize)
+      case "a"
+        papersize = "letter";
+      case {"b", "tabloid"}
+        papersize = "11x17";
+      case {"c", "d", "e"}
+        papersize = strcat ("arch", papersize);
+    endswitch
+    if (strncmp (papersize, "arch", 4))
+      papersize(end) = upper (papersize(end));
+    endif
+  endif
+
+endfunction
+
+function value = convert2points (value, units)
+  switch (units)
+    case "inches"
+      value = value * 72;
+    case "centimeters"
+      value = value * 72 / 2.54;
+    case "normalized"
+      error ("print:customnormalized",
+             "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined");
+  endswitch
+endfunction
+
+function device_list = gs_device_list ();
+  ## Graphics formats/languages, not priners.
+  device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ...
+                 "epswrite"; "jpeg"; "jpegcymk"; "jpeggray"; "pbm"; ...
+                 "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ...
+                 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ...
+                 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ...
+                 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ...
+                 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "ps2write"; ...
+                 "pswrite"; "tiff12nc"; "tiff24nc"; "tiff32nc"; ...
+                 "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ...
+                 "tiffgray"; "tifflzw"; "tiffpack"; "tiffsep"};
+endfunction
+
+function aliases = gs_aliases ();
+  ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf",
+  ##                            "ps", "ps2", "psc", "psc2"
+  ##
+  ## eps, epsc, eps2, epsc2 are not included here because those are
+  ## are generated by the graphics toolkit.
+  aliases.bmp = "bmp32b";
+  aliases.pdf = "pdfwrite";
+  aliases.png = "png16m";
+  aliases.ps = "pswrite";
+  aliases.ps2 = "ps2write";
+  aliases.psc = "pswrite";
+  aliases.psc2 = "ps2write";
+  aliases.tiff = "tiff24nc";
+  aliases.tiffn = "tiff24nc";
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/private/__tight_eps_bbox__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,124 @@
+## Copyright (C) 2010-2012 Ben Abbott
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{bbox} =} __tight_eps_bbox__ (@var{@dots{}})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## Created: 2010-07-26
+
+function bb = __tight_eps_bbox__ (opts, eps_file_name)
+
+  box_string = "%%BoundingBox:";
+
+  cmd = sprintf ("\"%s\" \"%s\" 2>&1", "head", eps_file_name);
+  [status, output] = system (cmd);
+
+  if (status == 0)
+    orig_bbox_line = get_bbox (output);
+  else
+    error ("print:noboundingbox",
+           "print.m: no bounding box found in '%s'", eps_file_name);
+  endif
+
+  ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4 -sDEVICE=bbox";
+  cmd = sprintf ("\"%s\" %s \"%s\" 2>&1", opts.ghostscript.binary,
+                 ghostscript_options, eps_file_name);
+  [status, output] = system (cmd);
+
+  if (status == 0)
+    tight_bbox_line = get_bbox (output);
+  else
+    warning ("print:nogsboundingbox",
+             "print.m: ghostscript failed to determine the bounding for '%s'",
+             eps_file_name);
+  endif
+
+  ## Attempt to fix the bbox in place.
+  fid = fopen (eps_file_name, "r+");
+  unwind_protect
+    bbox_replaced = false;
+    looking_for_bbox = true;
+    while (looking_for_bbox)
+      current_line = fgetl (fid);
+      if (strncmpi (current_line, box_string, length (box_string)))
+        line_length = numel (current_line);
+        num_spaces = line_length - numel (tight_bbox_line);
+        if (numel (current_line) >= numel (tight_bbox_line))
+          new_line = tight_bbox_line;
+          new_line(end+1:numel (current_line)) = " ";
+          bbox_replaced = true;
+          ## Back up to the beginning of the line (include EOL characters).
+          if (ispc ())
+            fseek (fid, -line_length-2, "cof");
+          else
+            fseek (fid, -line_length-1, "cof");
+          endif
+          count = fprintf (fid, "%s", new_line);
+        endif
+        looking_for_bbox = false;
+      elseif (! ischar (current_line))
+        looking_for_bbox = false;
+      endif
+    endwhile
+  unwind_protect_cleanup
+    fclose (fid);
+  end_unwind_protect
+
+  ## If necessary load the eps-file and replace the bbox (can be slow).
+  if (! bbox_replaced)
+    fid = fopen (eps_file_name, "r");
+    unwind_protect
+      data = char (fread (fid, Inf)).';
+    unwind_protect_cleanup
+      fclose (fid);
+    end_unwind_protect
+    n = strfind (data, box_string);
+    if (numel (n) > 1)
+      ## Only replace one instance.
+      n = n(1);
+    elseif (isempty (n))
+      error ("print:noboundingbox", ...
+             "print.m: no bounding box found in '%s'.", eps_file_name);
+    endif
+    m = numel (orig_bbox_line);
+    data = horzcat (data(1:(n-1)), tight_bbox_line, data((n+m):end));
+    fid = fopen (eps_file_name, "w");
+    unwind_protect
+      fprintf (fid, "%s", data);
+    unwind_protect_cleanup
+      fclose (fid);
+    end_unwind_protect
+  endif
+
+endfunction
+
+function bbox_line = get_bbox (lines)
+  box_string = "%%BoundingBox:";
+  pattern = strcat (box_string, "[^%]*");
+  pattern = pattern(1:find (double (pattern) > 32, 1, "last"));
+  bbox_line = regexp (lines, pattern, "match");
+  if (iscell (bbox_line))
+    bbox_line = bbox_line{1};
+  endif
+  ## Remove the EOL characters.
+  bbox_line(double (bbox_line) < 32) = "";
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/refresh.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,45 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} refresh ()
+## @deftypefnx {Function File} {} refresh (@var{h})
+## Refresh a figure, forcing it to be redrawn.
+##
+## When called without an argument the current figure is redrawn.  Otherwise,
+## the figure with graphic handle @var{h} is redrawn.
+## @seealso{drawnow}
+## @end deftypefn
+
+function refresh (h)
+
+  if (nargin > 1)
+    print_usage ();
+  elseif (nargin == 1)
+    if (! isfigure (h))
+      error ("refresh: H must be a valid figure handle");
+    endif
+  else
+    h = gcf ();
+  endif
+
+  set (h, "__modified__", "on");
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/refreshdata.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,119 @@
+## Copyright (C) 2008-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} refreshdata ()
+## @deftypefnx {Function File} {} refreshdata (@var{h})
+## @deftypefnx {Function File} {} refreshdata (@var{h}, @var{workspace})
+## Evaluate any @samp{datasource} properties of the current figure and update
+## the plot if the corresponding data has changed.
+##
+## If the first argument @var{h} is a list of graphic handles, then operate
+## on these objects rather than the current figure returned by @code{gcf}.
+##
+## The optional second argument @var{workspace} can take the following values:
+##
+## @table @asis
+## @item @qcode{"base"}
+## Evaluate the datasource properties in the base workspace.  (default).
+##
+## @item @qcode{"caller"}
+## Evaluate the datasource properties in the workspace of the function
+## that called @code{refreshdata}.
+## @end table
+##
+## An example of the use of @code{refreshdata} is:
+##
+## @example
+## @group
+## x = 0:0.1:10;
+## y = sin (x);
+## plot (x, y, "ydatasource", "y");
+## for i = 1 : 100
+##   pause (0.1);
+##   y = sin (x + 0.1*i);
+##   refreshdata ();
+## endfor
+## @end group
+## @end example
+## @end deftypefn
+
+function refreshdata (h, workspace)
+
+  if (nargin == 0)
+    h = gcf ();
+    workspace = "base";
+  else
+    if (iscell (h))
+      h = [h{:}];
+    endif
+    if (! all (isfigure (h)))
+      error ("refreshdata: H must be a list of figure handles");
+    endif
+    if (nargin == 1)
+      workspace = "base";
+    elseif (nargin == 2)
+      if (! ischar (workspace)
+          || ! any (strcmpi (workspace, {"base", "caller"})))
+        error ('refreshdata: WORKSPACE must be "base" or "caller"');
+      endif
+      workspace = tolower (workspace);
+    else
+      print_usage ();
+    endif
+  endif
+
+  h = findall (h);
+  objs = [];
+  props = {};
+
+  for i = 1 : numel (h)
+    obj = get (h(i));
+    flds = fieldnames (obj);
+    ## regexp() is proper way to do searching, but is 3X slower.
+    ## Pretty unlikely that people are going to be adding datasource
+    ## properties that are not, in fact, datasources.
+    ## m = regexp (flds, '^.+datasource$');
+    m = strfind (flds, "datasource");
+    m = flds(!cellfun (@isempty, m));
+    for j = 1 : numel (m)
+      if (isempty (obj.(m{j})))
+        continue;  # datasource field doesn't point to anything
+      endif
+      expr = obj.(m{j});       # datasource field
+      val = evalin (workspace, expr);
+      pdname = m{j}(1:end-6);  # property data name without "source"
+      set (h(i), pdname, val); 
+    endfor
+  endfor
+endfunction
+
+
+%!demo
+%! clf;
+%! x = 0:0.1:10;
+%! y = sin (x);
+%! plot (x, y, 'ydatasource', 'y');
+%! title ('refreshdata() showing moving sine curve');
+%! axis manual;
+%! for i = 1 : 100
+%!   pause (0);
+%!   y = sin (x + 0.1 * i);
+%!   refreshdata (gcf, 'caller');
+%! end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/saveas.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,108 @@
+## Copyright (C) 2010-2012 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} saveas (@var{h}, @var{filename})
+## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt})
+## Save graphic object @var{h} to the file @var{filename} in graphic
+## format @var{fmt}.
+##
+## @var{fmt} should be one of the following formats:
+##
+## @table @code
+##   @item ps
+##     PostScript
+##
+##   @item eps
+##     Encapsulated PostScript
+##
+##   @item jpg
+##     JPEG Image
+##
+##   @item png
+##     PNG Image
+##
+##   @item emf
+##     Enhanced Meta File
+##
+##   @item pdf
+##     Portable Document Format
+## @end table
+##
+## All device formats specified in @code{print} may also be used.  If
+## @var{fmt} is omitted it is extracted from the extension of @var{filename}.
+## The default format is @qcode{"pdf"}.
+##
+## @example
+## @group
+## clf ();
+## surf (peaks);
+## saveas (1, "figure1.png");
+## @end group
+## @end example
+##
+## @seealso{print, orient}
+## @end deftypefn
+
+## Author: Kai Habel
+
+function  saveas (h, filename, fmt = "pdf")
+
+  if ((nargin != 2) && (nargin != 3))
+    print_usage ();
+  endif
+
+  if (ishandle (h))
+    if (isfigure (h))
+      fig = h;
+    else
+      fig = ancestor (h, "figure");
+    endif
+  else
+    error ("saveas: first argument H must be a graphics handle");
+  endif
+
+  if (!ischar (filename))
+    error ("saveas: FILENAME must be a string");
+  endif
+
+  if (nargin == 2)
+    [~, ~, ext] = fileparts (filename);
+    if (!isempty (ext))
+      fmt = ext(2:end);
+    endif
+  endif
+
+  if (nargin == 3)
+    if (!ischar (filename))
+      error ("saveas: EXT must be a string");
+    endif
+
+    [~, ~, ext] = fileparts (filename);
+
+    if (isempty (ext))
+      filename = strcat (filename, ".", fmt);
+    endif
+  endif
+
+  prt_opt = strcat ("-d", tolower (fmt));
+
+  print (fig, filename, prt_opt);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/shg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,38 @@
+## Copyright (C) 1994-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Command} {} shg
+## Show the graph window.
+##
+## Currently, this is the same as executing @code{drawnow}.
+## @seealso{drawnow, figure}
+## @end deftypefn
+
+## Author: jwe
+
+function shg ()
+
+  if (nargin != 0)
+    warning ("shg: ignoring extra arguments");
+  endif
+
+  drawnow ();
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/struct2hdl.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,645 @@
+## Copyright (C) 2012 pdiribarne
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{h} =} struct2hdl (@var{s})
+## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
+## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
+## Construct a graphics handle object @var{h} from the structure @var{s}.
+##
+## The structure must contain the fields @qcode{"handle"}, @qcode{"type"},
+## @qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}.  If the
+## handle of an existing figure or axes is specified, @var{p}, the new object
+## will be created as a child of that object.  If no parent handle is provided
+## then a new figure and the necessary children will be constructed using the
+## default values from the root figure.
+##
+## A third boolean argument @var{hilev} can be passed to specify whether
+## the function should preserve listeners/callbacks, e.g., for legends or
+## hggroups.  The default is false.
+## @seealso{hdl2struct, findobj}
+## @end deftypefn
+
+## Author: pdiribarne <pdiribarne@new-host.home>
+## Created: 2012-03-04
+
+function [h, pout] = struct2hdl (s, p=[], hilev = false)
+
+  fields = {"handle", "type", "children", "properties", "special"};
+  partypes = {"root", "figure", "axes", "hggroup"};
+  othertypes = {"line", "patch", "surface", "image", "text"};
+  alltypes = [partypes othertypes];
+
+  if (nargin > 3 || ! isstruct (s))
+    print_usage ();
+  elseif (! all (isfield (s, fields)))
+    print_usage ();
+  elseif (isscalar (p))
+    if (! ishandle (p))
+      error ("struct2hdl: P is not a handle to a graphic object");
+    endif
+    if (any (strcmp (get (p).type, partypes)))
+      paridx = find (strcmp (get (p).type, alltypes));
+      kididx = find (strcmp (s.type, alltypes));
+      if (kididx <= paridx)
+        error ("struct2hdl: incompatible input handles");
+      endif
+    else
+      error ("struct2hdl: %s object can't be parent object", get (p).type);
+    endif
+    hpar = p;
+    p = [NaN; hpar];
+    ## create appropriate parent if needed
+    if (any (strcmp (s.type, othertypes)))
+      for ii = (paridx+1) : (numel (partypes)-1)
+        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
+        p = [p [NaN; hpar]];
+      endfor
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
+      for ii = (paridx+1) : (kididx-1)
+        eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
+        p = [p [NaN; hpar]];
+      endfor
+    else
+      par = NaN;
+    endif
+  elseif (isempty (p))
+    if (any (strcmp (s.type, othertypes)))
+      par = axes ();
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
+      par = figure ();
+    else
+      par = NaN;
+    endif
+    p = [NaN; par];
+  endif
+  ## read parent (last column) in p and remove it if duplicate
+  par = p(2,end);
+  tst = find (p(2,:) == par);
+  if (numel (tst) > 1)
+    p = p(1:2, 1:(tst(end)-1));
+  endif
+
+  ## Place the "*mode" properties at the end to avoid having the updaters
+  ## change the mode to "manual" when the value is "auto".
+  names = fieldnames (s.properties);
+  n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4);
+  n = (n | strcmp (names, "activepositionproperty"));
+  names = [names(!n); names(n)];
+  if (strcmp (s.type, "axes"))
+    n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition"));
+    if (strcmp (s.properties.activepositionproperty, "position"))
+      names{n_pos(1)} = "outerposition";
+      names{n_pos(2)} = "position";
+    else
+      names{n_pos(1)} = "position";
+      names{n_pos(2)} = "outerposition";
+    endif
+  endif
+  ## Reorder the properties with the mode properties coming last
+  s.properties = orderfields (s.properties, names);
+
+  ## create object
+  if (strcmp (s.type, "root"))
+    h = 0;
+    s.properties = rmfield (s.properties, ...
+                              {"callbackobject", "commandwindowsize", ...
+                               "screendepth", "screenpixelsperinch", ...
+                               "screensize"});
+  elseif (strcmp (s.type, "figure"))
+    h = figure ();
+  elseif (strcmp (s.type, "axes"))
+    ## legends and colorbars are "transformed" in normal axes
+    ## if hilev is not requested
+    if (! hilev)
+      if (strcmp (s.properties.tag, "legend"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
+        par = gcf;
+      elseif (strcmp (s.properties.tag, "colorbar"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
+        par = gcf;
+      endif
+    endif
+
+    [h, s] = createaxes (s, p, par);
+  elseif (strcmp (s.type, "line"))
+    h = createline (s, par);
+  elseif (strcmp (s.type, "patch"))
+    [h, s] = createpatch (s, par);
+  elseif (strcmp (s.type, "text"))
+    h = createtext (s, par);
+  elseif (strcmp (s.type, "image"))
+    h = createimage (s, par);
+  elseif (strcmp (s.type, "surface"))
+    h = createsurface (s, par);
+  elseif (strcmp (s.type, "hggroup"))
+    [h, s, p] = createhg (s, p, par, hilev);
+  else
+    error ("struct2hdl: %s objects are not implemented yet", s.type)
+  endif
+
+  ## children
+  p = [p [s.handle; h]];  # [original; new]
+  kids = s.children;
+  nkids = length (kids);
+  ii = 0;
+  while (nkids)
+    ii++;
+    if (! any (ii == s.special))
+      [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
+    endif
+    nkids--;
+  endwhile
+
+  ## paste properties
+  setprops (s, h, p, hilev);
+
+  pout = p;
+
+endfunction
+
+function [h, sout] = createaxes (s, p, par)
+  ## regular axes
+  if (strcmp (s.properties.tag, ""))
+    propval = {"position", s.properties.position};
+    hid = {"autopos_tag", "looseinset"};
+    for ii = 1:numel (hid)
+      prop = hid{ii};
+      if (isfield (s.properties, prop))
+        val = s.properties.(prop);
+        propval = [propval, prop, val];
+      endif
+    endfor
+    h = axes (propval{:}, "parent", par);
+
+    if (isfield (s.properties, "__plotyy_axes__"))
+      plty = s.properties.__plotyy_axes__;
+      addproperty ("__plotyy_axes__", h, "data");
+      tmp = [p [s.handle; h]];
+      tst = ismember (tmp(1:2:end), plty);
+      if (sum (tst) == numel (plty))
+        for ii = 1:numel (plty)
+          plty(ii) = tmp(find (tmp == plty(ii)) + 1);
+        endfor
+        for ii = 1:numel (plty)
+          set (plty(ii), "__plotyy_axes__", plty);
+        endfor
+      endif
+      s.properties = rmfield (s.properties, "__plotyy_axes__");
+    endif
+
+    ## delete non-default and already set properties
+    fields = fieldnames (s.properties);
+    tst = cellfun (@(x) isprop (h, x), fields);
+    s.properties = rmfield (s.properties, fields(find (tst == 0)));
+
+  elseif (strcmp (s.properties.tag, "legend"))
+    ## legends
+    oldax = s.properties.userdata.handle;
+    idx = find (p == oldax);
+    newax = p(idx+1);
+    strings = {};
+    kids = s.children;
+    kids(s.special) = [];
+    oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
+    for ii = 1:length (oldh)
+      idx = find (p(1:2:end) == oldh(ii)) * 2;
+      if (! isempty (idx))
+        newh(ii) = p(idx);
+        if (! strcmp (get (newh(ii), "type"), "hggroup"))
+          str = get (newh(ii), "displayname");
+          strings = [strings str];
+        else
+          str = get (get (newh(ii), "children")(1), "displayname");
+          strings = [strings str];
+        endif
+      else
+        error ("struct2hdl: didn't find a legend item");
+      endif
+    endfor
+    location = s.properties.location;
+    orientation = s.properties.orientation;
+    textpos = s.properties.textposition;
+    box = s.properties.box;
+
+    h = legend (newax, newh, strings, "location", location, ...
+                "orientation", orientation);
+    set (h, "textposition", textpos); # bug makes "textposition"
+                                      # redefine the legend
+    h = legend (newax, newh, strings, "location", location, ...
+                "orientation", orientation);
+    ## box
+    if (strcmp (box, "on"))
+      legend ("boxon");
+    endif
+
+    ## visibility
+    tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
+    if (! any (tst))
+      legend ("hide");
+    endif
+
+    ## remove all properties such as "textposition" that redefines
+    ## the entire legend. Also remove chidren
+    s.properties = rmfield (s.properties, ...
+                              {"userdata", "xlabel",...
+                               "ylabel", "zlabel", "location", ...
+                               "title", "string","orientation", ...
+                               "visible", "textposition"});
+
+    s.children = [];
+
+  elseif (strcmp (s.properties.tag, "colorbar"))
+    ## colorbar
+    oldax = s.properties.axes;
+    if (! isempty (idx = find (oldax == p)))
+      ax = p(idx+1);
+      location = s.properties.location;
+      h = colorbar ("peer", ax, location);
+      s.properties = rmfield (s.properties, ...
+                                {"userdata", "xlabel" ...
+                                 "ylabel", "zlabel", ...
+                                 "title", "axes"});
+      s.children= [];
+    else
+      error ("hdl2struct: didn't find an object");
+    endif
+  endif
+  sout = s;
+endfunction
+
+function h = createline (s, par)
+  h = line ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function [h, sout] = createpatch (s, par)
+  prp.faces = s.properties.faces;
+  prp.vertices = s.properties.vertices;
+  prp.facevertexcdata = s.properties.facevertexcdata;
+  h = patch (prp);
+  set (h, "parent", par);
+  s.properties = rmfield (s.properties,
+                            {"faces", "vertices", "facevertexcdata"});
+  addmissingprops (h, s.properties);
+  sout = s;
+endfunction
+
+function h = createtext (s, par)
+  h = text ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function h = createimage (s, par)
+  h = image (1, "parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function h = createsurface (s, par)
+  h = surface ("parent", par);
+  addmissingprops (h, s.properties);
+endfunction
+
+function [h, sout, pout] = createhg (s, p, par, hilev)
+  ## Here we infer from properties the type of hggroup we should build
+  ## an call corresponding high level functions
+  ## We manually set "hold on" to avoid next hggroup be deleted
+  ## the proper value of axes "nextplot" will finally be recovered
+
+  hold on;
+  if (hilev)
+    [h, s, p] = createhg_hilev (s, p, par);
+    if (numel (s.children) != numel (get (h).children))
+      warning (["struct2hdl: could not infer the hggroup type. ", ...
+                "Will build objects but listener/callback functions ", ...
+                "will be lost"]);
+      if (isfield (h, "bargroup"))
+        delete (get (h).bargroup);
+      else
+        delete (h);
+      endif
+      h = hggroup ("parent", par);
+      addmissingprops (h, s.properties);
+      s.special = [];
+    else
+      oldkids = s.children;
+      newkids = get (h).children;
+      nkids = numel (oldkids);
+      ii = 1;
+      while (nkids)
+        p = [p [oldkids(ii++).handle; newkids(nkids--)]];
+      endwhile
+    endif
+  else
+    h = hggroup ("parent", par);
+    addmissingprops (h, s.properties);
+    s.special = [];
+  endif
+  sout = s;
+  pout = p;
+endfunction
+
+function [h, sout, pout] = createhg_hilev (s, p, par)
+  fields = s.properties;
+  if (isfield (fields, "contourmatrix"))
+    ## contours
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    zdata = s.properties.zdata;
+    levellist = s.properties.levellist;
+    textlist = s.properties.textlist;
+
+    ## contour creation
+    if (isempty (s.children(1).properties.zdata))
+      if (strcmpi (s.properties.fill, "on"))
+        [cm2, h] = contourf (xdata, ydata, zdata, levellist);
+      else
+        [cm2, h] = contour (xdata, ydata, zdata, levellist);
+      endif
+
+      ## labels
+      if (strcmpi (s.properties.showtext, "on"))
+        clabel (cm2, h, textlist);
+      endif
+    else
+      [cm2, h] = contour3 (xdata, ydata, zdata, levellist);
+    endif
+
+    ## delete already set properties and children
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", "zdata", ...
+                               "contourmatrix", "levellist", ...
+                               "fill", "labelspacing", ...
+                               "levellistmode", "levelstep", ...
+                               "levelstepmode", "textlist"...
+                               "textlistmode" , "textstep", ...
+                               "textstepmode", "zlevel", ...
+                               "zlevelmode"});
+
+  elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
+    ## quiver
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+
+    udata = s.properties.udata;
+    vdata = s.properties.vdata;
+
+    h = quiver (xdata, ydata, udata, vdata);
+
+    ## delete already set properties and children
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", "zdata", ...
+                               "xdatasource", "ydatasource", "zdatasource", ...
+                               "udata", "vdata", "wdata", ...
+                               "udatasource", "vdatasource", "wdatasource"});
+
+  elseif (isfield (fields, "format"))
+    ##errorbar
+    form = s.properties.format;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    xldata = s.properties.xldata;
+    ldata = s.properties.ldata;
+    xudata = s.properties.xudata;
+    udata = s.properties.udata;
+
+    switch (form)
+      case "xerr"
+        h = errorbar (xdata, ydata, xldata, xudata, ">");
+      case "yerr"
+        h = errorbar (xdata, ydata, ldata, udata, "~");
+      case "xyerr"
+        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>");
+      case "box"
+        h = errorbar (xdata, ydata, xldata, xudata, "#");
+      case "boxy"
+        h = errorbar (xdata, ydata, ldata, udata, "#~");
+      case "boxxy"
+        h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
+      otherwise
+        error ("struct2hdl: couldn't guess the errorbar format");
+    endswitch
+    ## delete already set properties
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xldata", "ldata", ...
+                               "xudata", "udata", ...
+                               "xldatasource", "ldatasource", ...
+                               "xudatasource", "udatasource", ...
+                               "format"});
+
+  elseif (isfield (fields, "bargroup"))
+    ## bar plot
+    ## FIXME - here we don't have access to brothers so we first create all
+    ## the barseries of the bargroup (but the last), then retrieve information,
+    ## and rebuild the whole bargroup.
+    ## The duplicate are deleted after calling "setprops"
+
+    bargroup = s.properties.bargroup;
+    oldh = s.handle;
+
+    temp = ismember ([p(1:2:end) oldh], bargroup);
+
+    tst = sum (temp) == length (bargroup);
+
+    if (isscalar (bargroup) || !tst)
+      xdata = s.properties.xdata;
+      ydata = s.properties.ydata;
+
+      h = bar (xdata, ydata);
+
+      ## delete already set properties,
+      s.properties = rmfield (s.properties, ...
+                                {"xdata", "ydata", ...
+                                 "xdatasource", "ydatasource", ...
+                                 "bargroup", ...
+                                 "barwidth", "baseline"});
+    else
+      xdata = [];
+      ydata = [];
+
+      ##build x/y matrix
+      nbar = length (bargroup);
+      tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
+      for ii = 1:(nbar - 1)
+        idx = find (p(1:2:end) == bargroup(ii)) * 2;
+        hdl = p (idx);
+        xdata = [xdata get(hdl).xdata];
+        ydata = [ydata get(hdl).ydata];
+        tmp.children(ii) = hdl2struct (hdl);
+      endfor
+
+      xdata = [xdata s.properties.xdata];
+      ydata = [ydata s.properties.ydata];
+      width = s.properties.barwidth;
+      h = bar (ydata, width);
+
+      ## replace previous handles in "match", copy props and delete redundant
+      for ii = 1:(nbar - 1)
+        props = tmp.children(ii).properties;
+        bl = props.baseline;
+        tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
+        setprops (tmp.children(ii), h(ii), p, 1);
+        delete (tmp.children(ii).handle);
+        delete (bl);
+        idxpar = find (p == tmp.children(ii).handle);
+        p(idxpar) = h(ii);
+        idxkid = idxpar - 2;
+        p(idxkid) = get (h(ii), "children");
+      endfor
+      p(2,((end-nbar+2):end)) = h(1:(end-1));
+      h = h(end);
+
+      ## delete already set properties ,
+      s.properties = rmfield (s.properties, ...
+                                {"xdata", "ydata", "bargroup"...
+                                 "barwidth", "baseline"});
+    endif
+  elseif (isfield (fields, "baseline"))
+    ## stem plot
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+
+    h = stem (xdata, ydata);
+
+    ## delete already set properties,
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xdatasource", "ydatasource", ...
+                               "baseline"});
+  elseif (isfield (fields, "basevalue"))
+    ## area plot
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    level = s.properties.basevalue;
+
+    h = area (xdata, ydata, level);
+
+    ## delete already set properties,
+    s.properties = rmfield (s.properties, ...
+                              {"xdata", "ydata", ...
+                               "xdatasource", "ydatasource"});
+  else
+    warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
+    h = hggroup ("parent", par);
+    addmissingprops (h, s.properties);
+    s.special = [];           # children will be treated as normal children
+  endif
+  sout = s;
+  pout = p;
+endfunction
+
+function setprops (s, h, p, hilev)
+  more off;
+  if (strcmpi (s.properties.tag, ""))
+    specs = s.children(s.special);
+    if (isempty (specs))
+      hdls = [];
+    else
+      hdls = [specs.handle];
+    endif
+    nh = length (hdls);
+    msg = "";
+    if (! nh)
+      set (h, s.properties);
+    else
+      ## Specials are objects that where automatically constructed with
+      ## current object. Among them are "x(yz)labels", "title", high
+      ## level hggroup children
+      fields = fieldnames (s.properties);
+      vals = struct2cell (s.properties);
+      idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
+      s.properties = rmfield (s.properties, fields(idx));
+
+      ## set all properties but special handles
+      set (h, s.properties);
+
+      ## find  props with val == (one of special handles)
+      nf = length (idx);
+      fields = fields(idx);
+      vals = vals(idx);
+      while (nf)
+        field = fields{nf};
+        idx = find (hdls == vals{nf});
+        spec = specs(idx);
+        if (isprop (h, field))
+           h2 = get (h , field);
+           set (h2, spec.properties);
+        endif
+        nf--;
+      endwhile
+
+      ## If hggroup children  were created by high level functions,
+      ## copy only usefull properties.
+      if (hilev)
+        if (strcmp (s.type, "hggroup"))
+          nold = numel (s.children);
+          nnew = numel (get (h).children);
+
+          if (nold == nnew)
+            hnew = get (h).children;
+            ii = 1;
+            while (ii <= nnew)
+              try
+                set (hnew (ii), "displayname", ...
+                     s.children(ii).properties.displayname);
+              catch
+                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
+              end_try_catch
+              ii ++;
+            endwhile
+
+          else
+            error ("struct2hdl: non-conformant number of children in hgggroup");
+          endif
+        endif
+      endif
+    endif
+
+  elseif (strcmpi (s.properties.tag, "legend")
+          || strcmpi (s.properties.tag, "colorbar"))
+    set (h, s.properties);
+  endif
+
+endfunction
+
+function out = valcomp (x, hdls)
+  if (isfloat (x) && isscalar (x))
+    out = any (x == hdls);
+  else
+    out = 0;
+  endif
+endfunction
+
+function addmissingprops (h, props)
+  hid = {"autopos_tag", "looseinset"};
+  oldfields = fieldnames (props);
+  curfields = fieldnames (get (h));
+  missing = ! ismember (oldfields, curfields);
+  idx = find (missing);
+  for ii = 1:length (idx)
+    prop = oldfields{idx(ii)};
+    if (! any (strcmp (prop, hid)))
+      addproperty (prop, h, "any");
+    endif
+  endfor
+endfunction
+
+
+## FIXME: Need validation tests
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/util/subplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,477 @@
+## Copyright (C) 1995-2012 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
+## @deftypefnx {Function File} {} subplot (@var{rcn})
+## @deftypefnx {Function File} {} subplot (@var{hax})
+## @deftypefnx {Function File} {} subplot (@dots{}, "align")
+## @deftypefnx {Function File} {} subplot (@dots{}, "replace")
+## @deftypefnx {Function File} {} subplot (@dots{}, "position", @var{pos})
+## @deftypefnx {Function File} {} subplot (@dots{}, @var{prop}, @var{val}, @dots{})
+## @deftypefnx {Function File} {@var{hax} =} subplot (@dots{})
+## Set up a plot grid with @var{rows} by @var{cols} subwindows and set the
+## current axes for plotting (@code{gca}) to the location given by @var{index}.
+##
+## If only one numeric argument is supplied, then it must be a three digit
+## value specifying the number of rows in digit 1, the number of
+## columns in digit 2, and the plot index in digit 3.
+##
+## The plot index runs row-wise; First, all columns in a row are numbered
+## and then the next row is filled.
+##
+## For example, a plot with 2x3 grid will have plot indices running as follows:
+## @tex
+## \vskip 10pt
+## \hfil\vbox{\offinterlineskip\hrule
+## \halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
+## height13pt&1&2&3\cr height12pt&&&\cr\noalign{\hrule}
+## height13pt&4&5&6\cr height12pt&&&\cr\noalign{\hrule}}}
+## \hfil
+## \vskip 10pt
+## @end tex
+## @ifnottex
+##
+## @example
+## @group
+## +-----+-----+-----+
+## |  1  |  2  |  3  |
+## +-----+-----+-----+
+## |  4  |  5  |  6  |
+## +-----+-----+-----+
+## @end group
+## @end example
+##
+## @end ifnottex
+##
+## @var{index} may also be a vector.  In this case, the new axis will enclose
+## the grid locations specified.  The first demo illustrates this:
+##
+## @example
+## demo ("subplot", 1)
+## @end example
+##
+## The index of the subplot to make active may also be specified by its axes
+## handle, @var{hax}, returned from a previous @code{subplot} command.
+##
+## If the option @qcode{"align"} is given then the plot boxes of the subwindows
+## will align, but this may leave no room for axis tick marks or labels.
+##
+## If the option @qcode{"replace"} is given then the subplot axis will be
+## reset, rather than just switching the current axis for plotting to the
+## requested subplot.
+##
+## The @qcode{"position"} property can be used to exactly position the subplot
+## axes within the current figure.  The option @var{pos} is a 4-element vector
+## [x, y, width, height] that determines the location and size of the axes.
+## The values in @var{pos} are normalized in the range [0,1].
+##
+## Any property/value pairs are passed directly to the underlying axes object.
+##
+## If the output @var{hax} is requested, subplot returns the axis handle for
+## the subplot.  This is useful for modifying the properties of a subplot
+## using @code{set}.
+## @seealso{axes, plot, gca, set}
+## @end deftypefn
+
+## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
+## Adapted-By: jwe
+
+function h = subplot (varargin)
+
+  align_axes = false;
+  replace_axes = false;
+  have_position = false;
+  initial_args_decoded = false;
+
+  if (nargin >= 3)
+    ## R, C, N?
+    arg1 = varargin{1};
+    arg2 = varargin{2};
+    arg3 = varargin{3};
+    if (   isnumeric (arg1) && isscalar (arg1)
+        && isnumeric (arg2) && isscalar (arg2)
+        && isnumeric (arg3))
+      rows = arg1;
+      cols = arg2;
+      index = arg3;
+      varargin(1:3) = [];
+      initial_args_decoded = true;
+    endif
+  endif
+
+  if (! initial_args_decoded && nargin > 1)
+    ## check for "position", pos, ...
+    if (strcmpi (varargin{1}, "position"))
+      arg = varargin{2};
+      if (isnumeric (arg) && numel (arg) == 4)
+        pos = arg;
+        varargin(1:2) = [];
+        have_position = true;
+        initial_args_decoded = true;
+      else
+        error ("subplot: POSITION must be a 4-element numeric array");
+      endif
+    endif
+  endif
+    
+  if (! initial_args_decoded && nargin > 0)
+    arg = varargin{1};
+    if (nargin == 1 && isaxes (arg))
+      ## Axes handle
+      axes (arg);
+      cf = get (0, "currentfigure");
+      set (cf, "nextplot", "add");
+      return;
+    elseif (isscalar (arg) && arg >= 0)
+      ## RCN?
+      index = rem (arg, 10);
+      arg = (arg - index) / 10;
+      cols = rem (arg, 10);
+      arg = (arg - cols) / 10;
+      rows = rem (arg, 10);
+      varargin(1) = [];
+      initial_args_decoded = true;
+    else
+      error ("subplot: expecting axes handle or RCN argument");
+    endif
+  endif
+
+  if (! initial_args_decoded)
+    print_usage ();
+  endif
+
+  if (! have_position)
+    cols = round (cols);
+    rows = round (rows);
+    index = round (index);
+
+    if (any (index < 1) || any (index > rows*cols))
+      error ("subplot: INDEX value must be >= 1 and <= ROWS*COLS");
+    endif
+
+    if (rows < 1 || cols < 1 || index < 1)
+      error ("subplot: ROWS, COLS, and INDEX must be be positive");
+    endif
+  endif
+
+  ## Process "align" and "replace" options
+  idx = strcmpi (varargin, "align");
+  if (any (idx))
+    align_axes = true;
+    varargin(idx) = [];
+  endif
+
+  idx = strcmpi (varargin, "replace");
+  if (any (idx))
+    replace_axes = true;
+    varargin(idx) = [];
+  endif
+
+  axesunits = get (0, "defaultaxesunits");
+  cf = gcf ();
+  figureunits = get (cf, "units");
+  unwind_protect
+    set (0, "defaultaxesunits", "normalized");
+    set (cf, "units", "pixels");
+
+    ## FIXME: At the moment we force gnuplot to use the aligned mode
+    ##        which will set "activepositionproperty" to "position".
+    ##        Τhis can yield to text overlap between labels and titles
+    ##        see bug #31610
+    if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot"))
+      align_axes = true;
+    endif
+
+    if (! have_position)
+      pos = subplot_position (rows, cols, index, "position");
+      outerpos = subplot_position (rows, cols, index, "outerposition");
+      box = [pos(1:2), pos(1:2)+pos(3:4)];
+      outerbox = [outerpos(1:2), outerpos(1:2)+outerpos(3:4)];
+      looseinset = [box(1:2)-outerbox(1:2), outerbox(3:4)-box(3:4)];
+      if (align_axes)
+        activepositionproperty = "position";
+      else
+        activepositionproperty = "outerposition";
+      endif
+    endif
+
+    set (cf, "nextplot", "add");
+
+    found = false;
+    kids = get (cf, "children");
+    for child = kids(:)'
+      ## Check whether this child is still valid; this might not be the
+      ## case anymore due to the deletion of previous children (due to
+      ## "deletefcn" callback or for legends/colorbars that are deleted
+      ## with their corresponding axes).
+      if (! ishandle (child))
+        continue;
+      endif
+      if (strcmp (get (child, "type"), "axes"))
+        ## Skip legend and colorbar objects.
+        if (any (strcmp (get (child, "tag"), {"legend", "colorbar"})))
+          continue;
+        endif
+        objpos = get (child, "outerposition");
+        if (all (abs (objpos - outerpos) < eps) && ! replace_axes)
+          ## If the new axes are in exactly the same position
+          ## as an existing axes object, use the existing axes.
+          found = true;
+          hsubplot = child;
+        else
+          ## If the new axes overlap an old axes object, delete the old axes.
+          if (align_axes)
+            objpos = get (child, "position");
+          endif
+          x0 = pos(1);
+          x1 = x0 + pos(3);
+          y0 = pos(2);
+          y1 = y0 + pos(4);
+          objx0 = objpos(1);
+          objx1 = objx0 + objpos(3);
+          objy0 = objpos(2);
+          objy1 = objy0 + objpos(4);
+          if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0))
+            delete (child);
+          endif
+        endif
+      endif
+    endfor
+
+    if (found)
+      ## Switch to existing subplot
+      set (cf, "currentaxes", hsubplot);
+    else
+      hsubplot = axes ("box", "off",
+                       "position", pos,
+                       "looseinset", looseinset,
+                       "activepositionproperty", activepositionproperty,
+                       varargin{:});
+      addproperty ("subplot_align", hsubplot, "boolean", true);
+      addlistener (hsubplot, "position", @subplot_align);
+      if (! align_axes)
+        set (hsubplot, "subplot_align", false)
+        subplot_align (hsubplot)
+      endif
+    endif
+
+  unwind_protect_cleanup
+    set (0, "defaultaxesunits", axesunits);
+    set (cf, "units", figureunits);
+  end_unwind_protect
+
+  if (nargout > 0)
+    h = hsubplot;
+  endif
+
+endfunction
+
+function pos = subplot_position (rows, cols, index, position_property)
+
+  if (rows == 1 && cols == 1)
+    ## Trivial result for subplot (1,1,1)
+    if (strcmpi (position_property, "position"))
+      pos = get (0, "defaultaxesposition");
+    else
+      pos = get (0, "defaultaxesouterposition");
+    endif
+    return;
+  endif
+
+  if (strcmp (position_property, "outerposition"))
+    margins.left   = 0.05;
+    margins.bottom = 0.05;
+    margins.right  = 0.05;
+    margins.top    = 0.05;
+    margins.column = 0.04 / cols;
+    margins.row    = 0.04 / rows;
+    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
+    width = width / cols;
+    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
+    height = height / rows;
+  else
+    defaultaxesposition = get (0, "defaultaxesposition");
+
+    ## The outer margins surrounding all subplot "positions" are independent
+    ## of the number of rows and/or columns
+    margins.left   = defaultaxesposition(1);
+    margins.bottom = defaultaxesposition(2);
+    margins.right  = 1.0 - margins.left - defaultaxesposition(3);
+    margins.top    = 1.0 - margins.bottom - defaultaxesposition(4);
+
+    ## Fit from Matlab experiments
+    pc = 1 ./ [0.1860, (margins.left + margins.right - 1)];
+    margins.column = 1 ./ polyval (pc , cols);
+    pr = 1 ./ [0.2282, (margins.top + margins.bottom - 1)];
+    margins.row    = 1 ./ polyval (pr , rows);
+
+    ## Calculate the width/height of the subplot axes "position".
+    ## This is also consistent with Matlab
+    width = 1 - margins.left - margins.right - (cols-1)*margins.column;
+    width = width / cols;
+    height = 1 - margins.top - margins.bottom - (rows-1)*margins.row;
+    height = height / rows;
+  endif
+
+  ## Index offsets from the lower left subplot
+  yi = fix ((index(:)-1)/cols);
+  xi = index(:) - yi*cols - 1;
+  yi = (rows - 1) - yi;
+
+  ## Lower left corner of the subplot, i.e., position(1:2)
+  x0 = xi .* (width + margins.column) + margins.left;
+  y0 = yi .* (height + margins.row) + margins.bottom;
+
+  if (numel (x0) > 1)
+    ## subplot (row, col, m:n)
+    x1 = max (x0(:)) + width;
+    y1 = max (y0(:)) + height;
+    x0 = min (x0(:));
+    y0 = min (y0(:));
+    pos = [x0, y0, x1-x0, y1-y0];
+  else
+    ## subplot (row, col, num)
+    pos = [x0, y0, width, height];
+  endif
+
+endfunction
+
+function subplot_align (h, varargin)
+  persistent updating = false;
+
+  if (! updating)
+    unwind_protect
+      updating = true;
+      hfig = ancestor (h, "figure");
+      hsubplots = findall (hfig, "type", "axes", "subplot_align", "off");
+      if (! isempty (hsubplots))
+        tightinset = get (hsubplots, "tightinset");
+        if (iscell (tightinset))
+          tightinset = max (cell2mat (tightinset));
+        endif
+        looseinset = get (hsubplots, "looseinset");
+        if (iscell (looseinset))
+          looseinset = max (cell2mat (looseinset));
+        endif
+        looseinset = max (tightinset, looseinset);
+        set (hsubplots, "looseinset", looseinset);
+      endif
+    unwind_protect_cleanup
+      updating = false;
+    end_unwind_protect
+  endif
+
+endfunction
+
+
+%!demo
+%! clf;
+%! r = 3;
+%! c = 3;
+%! fmt = {'horizontalalignment', 'center', 'verticalalignment', 'middle'};
+%! for n = 1 : r*c
+%!   subplot (r, c, n);
+%!   xlabel (sprintf ('xlabel #%d', n));
+%!   ylabel (sprintf ('ylabel #%d', n));
+%!   title (sprintf ('title #%d', n));
+%!   text (0.5, 0.5, sprintf ('subplot(%d,%d,%d)', r, c, n), fmt{:});
+%!   axis ([0 1 0 1]);
+%! end
+%! subplot (r, c, 1:3);
+%! xlabel (sprintf ('xlabel #%d:%d', 1, 3));
+%! ylabel (sprintf ('ylabel #%d:%d', 1, 3));
+%! title (sprintf ('title #%d:%d', 1, 3));
+%! text (0.5, 0.5, sprintf ('subplot(%d,%d,%d:%d)', r, c, 1, 3), fmt{:});
+%! axis ([0 1 0 1]);
+
+%!demo
+%! clf;
+%! x = 0:1;
+%! for n = 1:4
+%!   subplot (2,2,n, 'align');
+%!   plot (x, x);
+%!   xlabel (sprintf ('xlabel (2,2,%d)', n));
+%!   ylabel (sprintf ('ylabel (2,2,%d)', n));
+%!   title (sprintf ('title (2,2,%d)', n));
+%! end
+%! subplot (1,2,1, 'align');
+%! plot (x, x);
+%! xlabel ('xlabel (1,2,1)');
+%! ylabel ('ylabel (1,2,1)');
+%! title ('title (1,2,1)');
+
+%!demo
+%! clf;
+%! x = 0:10;
+%! ax(1) = subplot (221);
+%! set (ax(1), 'tag', '1');
+%! plot (x, rand (3, 11))
+%! title ('x & y labels & ticklabels');
+%! xlabel xlabel
+%! ylabel ylabel
+%! ax(2) = subplot (222);
+%! set (ax(2), 'tag', '2');
+%! plot (x, rand (3, 11))
+%! title ('no labels');
+%! axis ('nolabel','tic')
+%! ax(3) = subplot (223);
+%! set (ax(3), 'tag', '3');
+%! plot (x, rand (3, 11))
+%! title ('no labels');
+%! axis ('nolabel','tic')
+%! ax(4) = subplot (224);
+%! set (ax(4), 'tag', '4');
+%! plot (x, rand (3, 11))
+%! title ('x & y labels & ticklabels');
+%! xlabel xlabel
+%! ylabel ylabel
+
+%!demo
+%! x = 0:10;
+%! subplot (221);
+%! plot (x, rand (3, 11))
+%! ylim ([0, 1]);
+%! text (0.5, 0.5, '{x,y}labels & {x,y}ticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! xlabel xlabel
+%! ylabel ylabel
+%! title title
+%! subplot (222);
+%! plot (x, rand (3, 11))
+%! axis ('labely');
+%! ylabel ylabel
+%! text (0.5, 0.5, 'no xlabels, xticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! subplot (223);
+%! plot (x, rand (3, 11))
+%! axis ('labelx');
+%! text (0.5, 0.5, 'no ylabels, yticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+%! xlabel xlabel
+%! title title
+%! subplot (224);
+%! plot (x, rand (3, 11))
+%! axis ('nolabel','tic');
+%! text (0.5, 0.5, 'no {x,y}labels, {x,y}ticklabels', ...
+%!       'horizontalalignment', 'center', ...
+%!       'units', 'normalized');
+
--- a/scripts/plot/view.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-## Copyright (C) 2007-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {[@var{azimuth}, @var{elevation}] =} view ()
-## @deftypefnx {Function File} {} view (@var{azimuth}, @var{elevation})
-## @deftypefnx {Function File} {} view ([@var{azimuth} @var{elevation}])
-## @deftypefnx {Function File} {} view ([@var{x} @var{y} @var{z}])
-## @deftypefnx {Function File} {} view (2)
-## @deftypefnx {Function File} {} view (3)
-## @deftypefnx {Function File} {} view (@var{ax}, @dots{})
-## Query or set the viewpoint for the current axes.  The parameters
-## @var{azimuth} and @var{elevation} can be given as two arguments or as
-## 2-element vector.
-## The viewpoint can also be given with Cartesian coordinates @var{x},
-## @var{y}, and @var{z}.
-## The call @code{view (2)} sets the viewpoint to @var{azimuth} = 0
-## and @var{elevation} = 90, which is the default for 2-D graphs.
-## The call @code{view (3)} sets the viewpoint to @var{azimuth} = -37.5
-## and @var{elevation} = 30, which is the default for 3-D graphs.
-## If @var{ax} is given, the viewpoint is set for this axes, otherwise
-## it is set for the current axes.
-## @end deftypefn
-
-## Author: jwe
-
-function [azimuth, elevation] = view (varargin)
-
-  if (nargin < 4)
-    if (nargin == 0)
-      args = {get(gca (), "view")};
-    else
-      ax = varargin{1};
-      if (ishandle (ax) && strcmp (get (ax, "type"), "axes"))
-        args = varargin(2:end);
-      else
-        ax = gca;
-        args = varargin;
-      endif
-    endif
-    if (length (args) == 1)
-      x = args{1};
-      if (length (x) == 2)
-        az = x(1);
-        el = x(2);
-      elseif (length (x) == 3)
-        [az, el] = cart2sph (x(1), x(2), x(3));
-        az *= 180/pi;
-        az += 90;
-        el *= 180/pi;
-      elseif (x == 2)
-        az = 0;
-        el = 90;
-      elseif (x == 3)
-        az = -37.5;
-        el = 30;
-      else
-        print_usage ();
-      endif
-    elseif (length (args) == 2)
-      az = args{1};
-      el = args{2};
-    endif
-
-    if (nargin > 0)
-      set (ax, "view", [az, el]);
-    endif
-
-    if (nargout == 1)
-      error ("view: T = view () not implemented");
-    endif
-
-    if (nargout == 2)
-      azimuth = az;
-      elevation = el;
-    endif
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   [az, el] = view;
-%!   assert ([az, el], [-37.5, 30], eps);
-%!   view (2);
-%!   [az, el] = view;
-%!   assert ([az, el], [0, 90], eps);
-%!   view ([1 1 0]);
-%!   [az, el] = view;
-%!   assert ([az, el], [135, 0], eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   line;
-%!   [az, el] = view;
-%!   assert ([az, el], [0, 90], eps);
-%!   view (3);
-%!   [az, el] = view;
-%!   assert ([az, el], [-37.5, 30], eps);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/waitbar.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-## Copyright (C) 2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{h} =} waitbar (@var{frac})
-## @deftypefnx {Function File} {@var{h} =} waitbar (@var{frac}, @var{msg})
-## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "FigureProperty", "Value", @dots{})
-## @deftypefnx {Function File} {} waitbar (@var{frac})
-## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar})
-## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar}, @var{msg})
-## Return a handle @var{h} to a new waitbar object.  The waitbar is
-## filled to fraction @var{frac} which must be in the range [0, 1].  The
-## optional message @var{msg} is centered and displayed above the waitbar.
-## The appearance of the waitbar figure window can be configured by passing
-## property/value pairs to the function.
-## 
-## When called with a single input the current waitbar, if it exists, is
-## updated to the new value @var{frac}.  If there are multiple outstanding
-## waitbars they can be updated individually by passing the handle @var{hwbar}
-## of the specific waitbar to modify.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = waitbar (varargin)
-
-  persistent curr_waitbar;
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  frac = varargin{1};
-  varargin(1) = [];
-
-  if (! (isnumeric (frac) && isscalar (frac) && frac >= 0 && frac <= 1))
-    error ("waitbar: FRAC must be between 0 and 1");
-  endif
-
-  ## Use existing waitbar if it still points to a valid graphics handle.
-  if (nargin == 1 && ishandle (curr_waitbar))
-    h = curr_waitbar;
-  else
-    h = false;
-  endif
-
-  if (! isempty (varargin) && isnumeric (varargin{1}))
-    if (! ishandle (varargin{1}))
-      error ("waitbar: H must be a handle to a waitbar object");
-    else
-      h = varargin{1};
-      varargin(1) = [];
-      if (! isfigure (h) || ! strcmp (get (h, "tag"), "waitbar"))
-        error ("waitbar: H must be a handle to a waitbar object");
-      endif
-    endif
-  endif
-
-  msg = false;
-
-  if (! isempty (varargin))
-    msg = varargin{1};
-    varargin(1) = [];
-    if (! (ischar (msg) || iscellstr (msg)))
-      error ("waitbar: MSG must be a character string or cell array of strings");
-    endif
-  endif
-
-  if (rem (numel (varargin), 2) != 0)
-    error ("waitbar: invalid number of property-value pairs");
-  endif
-
-  if (h)
-    p = findobj (h, "type", "patch");
-    set (p, "xdata", [0; frac; frac; 0]);
-    ax = findobj (h, "type", "axes");
-    if (ischar (msg) || iscellstr (msg))
-      th = get (ax, "title");
-      curr_msg = get (th, "string");
-      ## graphics handles always store data as column vectors
-      if (iscellstr (msg))
-        msg = msg(:);  
-      endif
-      cmp = strcmp (msg, curr_msg);
-      if (! all (cmp(:)))
-        set (th, "string", msg);
-      endif
-    endif
-  else
-    h = __go_figure__ (NaN, "position", [250, 500, 400, 100],
-                       "numbertitle", "off",
-                       "toolbar", "none", "menubar", "none",
-                       "integerhandle", "off",
-                       "handlevisibility", "callback",
-                       "tag", "waitbar",
-                       varargin{:});
-
-    ax = axes ("parent", h, "xtick", [], "ytick", [],
-               "xlim", [0, 1], "ylim", [0, 1],
-               "xlimmode", "manual", "ylimmode", "manual",
-               "position", [0.1, 0.3, 0.8, 0.2]);
-
-    patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]);
-
-    if (! (ischar (msg) || iscellstr (msg)))
-      msg = "Please wait...";
-    endif
-    title (ax, msg);
-  endif
-
-  drawnow ();
-
-  if (nargout > 0)
-    retval = h;
-  endif
-
-  ## If there were no errors, update current waitbar.
-  curr_waitbar = h;
-
-endfunction
-
-
-%!demo
-%! h = waitbar (0, '0.00%');
-%! for i = 0:0.01:1
-%!   waitbar (i, h, sprintf ('%.2f%%', 100*i));
-%! end
-%! close (h);
-
-%!demo
-%! h = waitbar (0, 'please wait...');
-%! for i = 0:0.01:0.6
-%!   waitbar (i);
-%! end
-%! i = 0.3;
-%! waitbar (i, h, 'don''t you hate taking a step backward?');
-%! pause (0.5);
-%! for i = i:0.005:0.7
-%!   waitbar (i, h);
-%! end
-%! waitbar (i, h, 'or stalling?');
-%! pause (1);
-%! for i = i:0.003:0.8
-%!   waitbar (i, h, 'just a little longer now');
-%! end
-%! for i = i:0.001:1
-%!   waitbar (i, h, 'please don''t be impatient');
-%! end
-%! close (h);
-
-%!demo
-%! h1 = waitbar (0, 'Waitbar #1');
-%! h2 = waitbar (0, 'Waitbar #2');
-%! h2pos = get (h2, 'position');
-%! h2pos(1) = h2pos(1) + (h2pos(3) + 50);
-%! set (h2, 'position', h2pos);
-%! pause (0.5);
-%! for i = 1:4
-%!   waitbar (i/4, h1);
-%!   pause (0.5);
-%!   waitbar (i/4, h2);
-%!   pause (0.5);
-%! end
-%! pause (0.5);
-%! close (h1);
-%! close (h2);
-
-%% Test input validation
-%!error <FRAC must be between 0 and 1> waitbar (-0.5)
-%!error <FRAC must be between 0 and 1> waitbar (1.5)
-%!error <MSG must be a character string> waitbar (0.5, struct ())
-%!error <invalid number of property-value pairs> waitbar (0.5, "msg", "Name")
-
--- a/scripts/plot/waitforbuttonpress.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-## Copyright (C) 2004-2012 Petr Mikulik
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{b} =} waitforbuttonpress ()
-## Wait for button or mouse press.over a figure window.  The value of
-## @var{b} returns 0 if a mouse button was pressed or 1 is a key was
-## pressed.
-## @seealso{ginput}
-## @end deftypefn
-
-## The original version of this code bore the copyright
-## Author: Petr Mikulik
-## License: public domain
-
-function a = waitforbuttonpress ()
-
-  if (nargin != 0 || nargout > 1)
-    print_usage ();
-  endif
-
-  [x, y, k] = ginput (1);
-
-  if (nargout == 1)
-    if (k <= 5)
-      a = 0;
-    else
-      a = 1;
-    endif
-  endif
-
-endfunction
--- a/scripts/plot/waterfall.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-## Copyright (C) 2013 Mike Miller
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} waterfall (@var{x}, @var{y}, @var{z})
-## @deftypefnx {Function File} {} waterfall (@var{z})
-## @deftypefnx {Function File} {@var{h} =} waterfall (@dots{})
-## Plot a waterfall plot given matrices @var{x}, and @var{y} from
-## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
-## @var{y} coordinates of the mesh.  If @var{x} and @var{y} are vectors,
-## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus,
-## columns of @var{z} correspond to different @var{x} values and rows of
-## @var{z} correspond to different @var{y} values.
-##
-## The optional return value @var{h} is a graphics handle to the created
-## surface object.
-## @seealso{meshgrid, meshz, surf}
-## @end deftypefn
-
-## Author: Mike Miller <mtmiller@ieee.org>
-
-function h = waterfall (varargin)
-
-  tmp = meshz (varargin{:});
-
-  set (tmp, "meshstyle", "row");
-
-  ## The gnuplot toolkit does nothing with the meshstyle property currently.
-  toolkit = get (ancestor (tmp, "figure"), "__graphics_toolkit__");
-  if (strcmp (toolkit, "gnuplot"))
-    warning ("waterfall: may not render correctly using toolkit '%s'", toolkit);
-  endif
-
-  if (nargout > 0)
-    h = tmp;
-  endif
-
-endfunction
-
-
-%!demo
-%! clf;
-%! colormap ('default');
-%! [~,~,Z] = peaks ();
-%! waterfall (Z);
-
--- a/scripts/plot/whitebg.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-## Copyright (C) 2010-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} whitebg ()
-## @deftypefnx {Function File} {} whitebg (@var{color})
-## @deftypefnx {Function File} {} whitebg ("none")
-## @deftypefnx {Function File} {} whitebg (@var{fig})
-## @deftypefnx {Function File} {} whitebg (@var{fig}, @var{color})
-## @deftypefnx {Function File} {} whitebg (@var{fig}, "none")
-## Invert the colors in the current color scheme.  The root properties are
-## also inverted such that all subsequent plot use the new color scheme.
-##
-## If defined, @var{fig} is the handle to the figure to be inverted.  In
-## this case only the specified figure has its color properties changed.
-##
-## If the optional argument @var{color} is present then the background color
-## is set to @var{color} rather than inverted.  @var{color} may be a string
-## representing one of the eight known colors or an RGB triplet.  The special
-## string argument "none" restores the plot to the default colors.
-## @seealso{reset}
-## @end deftypefn
-
-function whitebg (varargin)
-  h = 0;
-  color = NaN;
-
-  if (nargin > 0 && nargin < 3)
-    if (ishandle (varargin{1}))
-      h = varargin{1};
-      if (nargin == 2)
-        color = varargin{2};
-      endif
-    elseif (nargin == 1)
-      color = varargin{1};
-    else
-      print_usage ();
-    endif
-  elseif (nargin != 0)
-    print_usage ();
-  endif
-
-  typ = get (h, "type");
-
-  if (strcmp (typ, "root"))
-    isroot = true;
-    fig = gcf ();
-  elseif (strcmp (typ, "figure"))
-    isroot = false;
-    fig = h;
-  else
-    error ("expecting a figure handle");
-  endif
-
-  axes = findall (fig, "type", "axes");
-  if (isnan (color))
-    ## Root figure. Set the default axes and figure properties so that
-    ## subsequent plots have the new color scheme
-    if (isroot)
-      fac = get (0, "factory");
-      fields = fieldnames (fac);
-      fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*')))));
-
-      ## Check whether the factory value has been replaced
-      for nf = 1 : numel (fieldindex);
-        defaultfield = strrep (fields {fieldindex (nf)}, "factory", "default");
-        try
-          defaultvalue = 1 - get (0, defaultfield {n});
-        catch
-          field = fields {fieldindex (nf)};
-          defaultvalue = 1 - subsref (fac, struct ("type", ".", "subs", field));
-        end_try_catch
-        set (0, defaultfield, defaultvalue);
-      endfor
-    endif
-
-    ## Load all objects which qualify for being searched.
-    handles = fig;
-    h = fig;
-    while (numel (handles))
-      children = [];
-      for n = 1 : numel (handles)
-        children = union (children, get (handles(n), "children"));
-      endfor
-      handles = children;
-      h = union (h, children);
-    endwhile
-
-    for nh = 1 : numel (h)
-      p = get (h (nh));
-      fields = fieldnames (p);
-      fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
-      if (numel (fieldindex))
-        for nf = 1 : numel (fieldindex);
-          field = fields {fieldindex (nf)};
-          c = subsref (p, struct ("type", ".", "subs", field));
-          if (! ischar (c) && columns (c) == 3)
-            set (h (nh), field, 1 - c);
-          endif
-        endfor
-      endif
-
-      ## If h(nh) is a figure or axes invert default color properties
-      typ = subsref (p, struct ("type", ".", "subs", "type"));
-      if (strcmp (typ, "axes") || strcmp (typ, "figure"))
-        def = get (h (nh), "default");
-        fields = fieldnames (def);
-        if (! isempty (fields))
-          fieldindex = find (!cellfun ("isempty", regexp (fields, 'color')));
-          for nf = 1 : numel (fieldindex)
-            defaultfield = fields {fieldindex (nf)};
-            defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield));
-            set (h (nh), defaultfield, defaultvalue);
-          endfor
-        endif
-      endif
-    endfor
-  else
-    ## FIXME
-    ## Is this the right thing to do in this case?
-    set (findall (fig, "type", "axes"), "color", color);
-    if (isroot)
-      defs = get (0, "default");
-      if (isfield (defs, "defaultaxescolor")
-          && strcmp (defs.defaultaxescolor, "none"))
-        set (0, "defaultaxescolor", color);
-      endif
-    endif
-  endif
-endfunction
-
-
-%!test
-%! dac = get (0, "defaultaxescolor");
-%! dfc = get (0, "defaultfigurecolor");
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   l = line;
-%!   assert (get (hf, "color"), dfc);
-%!   assert (get (gca, "color"), dac);
-%!   whitebg (hf);
-%!   assert (get (hf, "color"), 1 - dfc);
-%!   assert (get (gca, "color"), 1 - dac);
-%!   c = [0.2 0.2 0.2];
-%!   whitebg (hf, c);
-%!   assert (get (hf, "color"), 1 - dfc);
-%!   assert (get (gca, "color"), c);
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/xlabel.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} xlabel (@var{string})
-## @deftypefnx {Function File} {} xlabel (@var{h}, @var{string})
-## @deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
-## @deftypefnx {Function File} {} ylabel (@dots{})
-## @deftypefnx {Function File} {} zlabel (@dots{})
-## Specify x-, y-, or z-axis labels for the current axis.  If @var{h} is
-## specified then label the axis defined by @var{h}.
-##
-## The optional return value @var{h} is a graphics handle to the created object.
-## @seealso{title, text}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = xlabel (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
-
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  tmp = __axis_label__ (h, "xlabel", varargin{:},
-                        "color", get (h, "xcolor"));
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   x = xlabel ("xlabel_string");
-%!   assert (get (gca, "xlabel"), x);
-%!   assert (get (x, "type"), "text");
-%!   assert (get (x, "visible"), "on");
-%!   assert (get (x, "string"), "xlabel_string");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/xlim.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @c List other forms of function in documentation index
-## @findex ylim
-## @findex zlim
-##
-## @deftypefn  {Function File} {@var{xl} =} xlim ()
-## @deftypefnx {Function File} {} xlim (@var{xl})
-## @deftypefnx {Function File} {@var{m} =} xlim ("mode")
-## @deftypefnx {Function File} {} xlim (@var{m})
-## @deftypefnx {Function File} {} xlim (@var{h}, @dots{})
-## Get or set the limits of the x-axis of the current plot.  Called without
-## arguments @code{xlim} returns the x-axis limits of the current plot.
-## If passed a two element vector @var{xl}, the limits of the x-axis are set
-## to this value.
-##
-## The current mode for calculation of the x-axis can be returned with a
-## call @code{xlim ("mode")}, and can be either "auto" or "manual".  The
-## current plotting mode can be set by passing either "auto" or "manual"
-## as the argument.
-##
-## If passed a handle as the first argument, then operate on this handle
-## rather than the current axes handle.
-## @seealso{ylim, zlim, set, get, gca}
-## @end deftypefn
-
-function retval = xlim (varargin)
-  ret = __axes_limits__ ("xlim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! xlim ([0.2, 0.8]);
-%! title ('xlim is [0.2, 0.8]');
-%! assert (xlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! xlim ('auto');
-%! title ('xlim is auto');
-%! assert (xlim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! xlim ([0.2, 0.8]);
-%! title ('xlim is [0.2, 0.8]');
-%! assert (xlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! xlim ('auto');
-%! title ('xlim is auto');
-%! assert (xlim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   xlim ([0, 1.1]);
-%!   assert (get (gca, "xlim"), [0, 1.1], eps);
-%!   assert (xlim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   h = plot3 ([0,1.1], [0,1], [0, 1]);
-%!   assert (get (gca, "xlim"), [0, 1.4], eps);
-%!   assert (xlim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ylabel.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-## Copyright (C) 1993-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} ylabel (@var{string})
-## @deftypefnx {Function File} {} ylabel (@var{h}, @var{string})
-## @deftypefnx {Function File} {@var{h} =} ylabel (@dots{})
-## @seealso{xlabel}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = ylabel (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("ylabel", varargin{:});
-
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  tmp = __axis_label__ (h, "ylabel", varargin{:},
-                        "color", get (h, "ycolor"));
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   y = ylabel ("ylabel_string");
-%!   assert (get (gca, "ylabel"), y);
-%!   assert (get (y, "type"), "text");
-%!   assert (get (y, "visible"), "on");
-%!   assert (get (y, "string"), "ylabel_string");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/ylim.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{yl} =} ylim ()
-## @deftypefnx {Function File} {} ylim (@var{yl})
-## @deftypefnx {Function File} {@var{m} =} ylim ("mode")
-## @deftypefnx {Function File} {} ylim (@var{m})
-## @deftypefnx {Function File} {} ylim (@var{h}, @dots{})
-## Get or set the limits of the y-axis of the current plot.  Called without
-## arguments @code{ylim} returns the y-axis limits of the current plot.
-## If passed a two element vector @var{yl}, the limits of the y-axis are set
-## to this value.
-##
-## The current mode for calculation of the y-axis can be returned with a
-## call @code{ylim ("mode")}, and can be either "auto" or "manual".  The
-## current plotting mode can be set by passing either "auto" or "manual"
-## as the argument.
-##
-## If passed a handle as the first argument, then operate on this handle
-## rather than the current axes handle.
-## @seealso{xlim, zlim, set, get, gca}
-## @end deftypefn
-
-function retval = ylim (varargin)
-  ret = __axes_limits__ ("ylim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! ylim ([0.2, 0.8]);
-%! title ('ylim is [0.2, 0.8]');
-%! assert (ylim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! ylim ('auto');
-%! title ('ylim is auto');
-%! assert (ylim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! ylim ([0.2, 0.8]);
-%! title ('ylim is [0.2, 0.8]');
-%! assert (ylim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! ylim ('auto');
-%! title ('ylim is auto');
-%! assert (ylim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   limy = [0, 1.1];
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   ylim (limy);
-%!   assert (get (gca, "ylim"), limy, eps);
-%!   assert (ylim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1.1], [0, 1]);
-%!   assert (get (gca, "ylim"), [0, 1.4], eps);
-%!   assert (ylim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/zlabel.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-## Copyright (C) 1995-2012 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} zlabel (@var{string})
-## @deftypefnx {Function File} {} zlabel (@var{h}, @var{string})
-## @deftypefnx {Function File} {@var{h} =} zlabel (@dots{})
-## @seealso{xlabel}
-## @end deftypefn
-
-## Author: jwe
-
-function retval = zlabel (varargin)
-
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("zlabel", varargin{:});
-
-  if (rem (nargin, 2) != 1)
-    print_usage ();
-  endif
-
-  tmp = __axis_label__ (h, "zlabel", varargin{:},
-                        "color", get (h, "zcolor"));
-
-  if (nargout > 0)
-    retval = tmp;
-  endif
-
-endfunction
-
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   z = zlabel ("zlabel_string");
-%!   assert (get (gca, "zlabel"), z);
-%!   assert (get (z, "type"), "text");
-%!   assert (get (z, "visible"), "off");
-%!   assert (get (z, "string"), "zlabel_string");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! plot3 (0, 0, 0);
-%! unwind_protect
-%!   z = zlabel ("zlabel_string");
-%!   assert (get (gca, "zlabel"), z);
-%!   assert (get (z, "type"), "text");
-%!   assert (get (z, "visible"), "off");
-%!   assert (get (z, "string"), "zlabel_string");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/plot/zlim.m	Thu Sep 12 21:08:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-## Copyright (C) 2007-2012 David Bateman
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{zl} =} zlim ()
-## @deftypefnx {Function File} {} zlim (@var{zl})
-## @deftypefnx {Function File} {@var{m} =} zlim ("mode")
-## @deftypefnx {Function File} {} zlim (@var{m})
-## @deftypefnx {Function File} {} zlim (@var{h}, @dots{})
-## Get or set the limits of the z-axis of the current plot.  Called without
-## arguments @code{zlim} returns the z-axis limits of the current plot.
-## If passed a two element vector @var{zl}, the limits of the z-axis are set
-## to this value.
-##
-## The current mode for calculation of the z-axis can be returned with a
-## call @code{zlim ("mode")}, and can be either "auto" or "manual".  The
-## current plotting mode can be set by passing either "auto" or "manual"
-## as the argument.
-##
-## If passed a handle as the first argument, then operate on this handle
-## rather than the current axes handle.
-## @seealso{xlim, ylim, set, get, gca}
-## @end deftypefn
-
-function retval = zlim (varargin)
-  ret = __axes_limits__ ("zlim", varargin{:});
-
-  if (! isempty (ret))
-    retval = ret;
-  endif
-endfunction
-
-
-%!demo
-%! clf;
-%! line ();
-%! zlim ([0.2, 0.8]);
-%! title ('zlim is [0.2, 0.8]');
-%! assert (zlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! line ();
-%! zlim ('auto');
-%! title ('zlim is auto');
-%! assert (zlim ('mode'), 'auto');
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! zlim ([0.2, 0.8]);
-%! title ('zlim is [0.2, 0.8]');
-%! assert (zlim (), [0.2, 0.8]);
-
-%!demo
-%! clf;
-%! plot3 ([0,1], [0,1], [0,1]);
-%! zlim ('auto');
-%! title ('zlim is auto');
-%! assert (zlim ('mode'), 'auto');
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   limz = [0, 1.1];
-%!   plot3 ([0,1], [0,1], [0,1]);
-%!   zlim (limz);
-%!   assert (get (gca, "zlim"), limz, eps);
-%!   assert (zlim ("mode"), "manual");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
-%!test
-%! hf = figure ("visible", "off");
-%! unwind_protect
-%!   plot3 ([0,1], [0,1], [0, 1.1]);
-%!   assert (get (gca, "zlim"), [0, 1.4], eps);
-%!   assert (zlim ("mode"), "auto");
-%! unwind_protect_cleanup
-%!   close (hf);
-%! end_unwind_protect
-
--- a/scripts/polynomial/conv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/conv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,10 +29,10 @@
 ## The optional @var{shape} argument may be
 ##
 ## @table @asis
-## @item @var{shape} = "full"
+## @item @var{shape} = @qcode{"full"}
 ## Return the full convolution.  (default)
 ##
-## @item @var{shape} = "same"
+## @item @var{shape} = @qcode{"same"}
 ## Return the central part of the convolution with the same size as @var{a}.
 ## @end table
 ##
--- a/scripts/polynomial/mkpp.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/mkpp.m	Sat Oct 05 11:22:09 2013 -0400
@@ -45,12 +45,12 @@
 
 function pp = mkpp (x, P, d)
 
-  # check number of arguments
+  ## check number of arguments
   if (nargin < 2 || nargin > 3)
     print_usage ();
   endif
 
-  # check x
+  ## check x
   if (length (x) < 2)
     error ("mkpp: at least one interval is needed");
   endif
--- a/scripts/polynomial/pchip.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/pchip.m	Sat Oct 05 11:22:09 2013 -0400
@@ -125,6 +125,7 @@
 
 endfunction
 
+
 %!demo
 %! x = 0:8;
 %! y = [1, 1, 1, 1, 0.5, 0, 0, 0, 0];
@@ -170,3 +171,4 @@
 
 %!error (pchip (1,2));
 %!error (pchip (1,2,3));
+
--- a/scripts/polynomial/polyeig.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/polyeig.m	Sat Oct 05 11:22:09 2013 -0400
@@ -46,13 +46,13 @@
   n = zeros (1, nin);
 
   for cnt = 1 : nin
-    if ! ( issquare (varargin{cnt}) )
+    if (! issquare (varargin{cnt}))
        error ("polyeig: coefficients must be square matrices");
     endif
     n(cnt) = size (varargin{cnt}, 1);
   endfor
 
-  if numel (unique (n)) > 1
+  if (numel (unique (n)) > 1)
        error ("polyeig: coefficients must have the same dimensions");
   endif
   n = unique (n);
@@ -83,9 +83,11 @@
 
 endfunction
 
+
 %!test
 %! C0 = [8, 0; 0, 4]; C1 = [1, 0; 0, 1];
 %! [v,z] = polyeig (C0, C1);
 %! assert (isequal (z(1), -8), true);
 %! d = C0*v + C1*v*z;
 %! assert (isequal (norm(d), 0.0), true);
+
--- a/scripts/polynomial/polyfit.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/polyfit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -115,7 +115,7 @@
   p = r \ (q' * y);
   p(k) = p;
   
-  if (n ~= m)
+  if (n != m)
     q = p; p = zeros (n+1, 1); 
     p(polymask) = q;
   endif
@@ -137,12 +137,12 @@
     try
       C = cholinv (r.'*r)(k, k);
     catch
-      C = NaN * ones (m+1, m+1);
+      C = NaN (m+1, m+1);
     end_try_catch
 
-    if (n ~= m)
+    if (n != m)
       ## fill matrices if required
-      s.X(:, ~polymask) = 0;
+      s.X(:, !polymask) = 0;
       s.R = zeros (n+1, n+1); s.R(polymask, polymask) = r;
       s.C = zeros (n+1, n+1); s.C(polymask, polymask) = C;
     else
@@ -171,10 +171,10 @@
 ## variable is not normalized properly.
 ## Also check the usage of 2nd & 3rd output arguments.
 %!test
-%! x = [ -1196.4, -1195.2, -1194, -1192.8, -1191.6, -1190.4, -1189.2, -1188, \
+%! x = [ -1196.4, -1195.2, -1194, -1192.8, -1191.6, -1190.4, -1189.2, -1188, ...
 %!       -1186.8, -1185.6, -1184.4, -1183.2, -1182];
-%! y = [ 315571.7086, 315575.9618, 315579.4195, 315582.6206, 315585.4966,    \
-%!       315588.3172, 315590.9326, 315593.5934, 315596.0455, 315598.4201,    \
+%! y = [ 315571.7086, 315575.9618, 315579.4195, 315582.6206, 315585.4966, ...
+%!       315588.3172, 315590.9326, 315593.5934, 315596.0455, 315598.4201, ...
 %!       315600.7143, 315602.9508, 315605.1765 ];
 %! [p1, s1] = polyfit (x, y, 10);
 %! [p2, s2, mu] = polyfit (x, y, 10);
--- a/scripts/polynomial/polyout.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/polyout.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,7 +32,7 @@
 ##
 ## @end ifnottex
 ## and return it as a string or write it to the screen (if @var{nargout} is
-## zero).  @var{x} defaults to the string @code{"s"}.
+## zero).  @var{x} defaults to the string @qcode{"s"}.
 ## @seealso{polyreduce}
 ## @end deftypefn
 
--- a/scripts/polynomial/ppval.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/ppval.m	Sat Oct 05 11:22:09 2013 -0400
@@ -95,7 +95,7 @@
     yi = shiftdim (yi, nd);
   endif
 
-  ##
+  ## FIXME: Why is this commented out, rather than just removed?
   #if (d == 1)
   #  yi = reshape (yi, sxi);
   #endif
@@ -127,3 +127,4 @@
 %! ret(:,:,1) = ppval (pp, breaks');
 %! ret(:,:,2) = ppval (pp, breaks');
 %! assert (ppval (pp, [breaks',breaks']), ret)
+
--- a/scripts/polynomial/private/__splinefit__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/private/__splinefit__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -387,7 +387,7 @@
 if isempty(cc)
     cc = ones(size(xc));
 elseif numel(size(cc)) ~= 2
-    error('arguments:ccsize1','Constraint coefficients cc must be 2D.')
+    error('arguments:ccsize1','Constraint coefficients cc must be 2-D.')
 elseif size(cc,2) ~= nx
     mess = 'Last dimension of cc must equal length of xc.';
     error('arguments:ccsize2',mess)
--- a/scripts/polynomial/residue.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/residue.m	Sat Oct 05 11:22:09 2013 -0400
@@ -160,7 +160,7 @@
     ## The inputs are the residue, pole, and direct part. Solve for the
     ## corresponding numerator and denominator polynomials
     [r, p] = rresidue (b, a, varargin{1}, toler, e);
-    return
+    return;
   endif
 
   ## Make sure both polynomials are in reduced form.
--- a/scripts/polynomial/roots.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/roots.m	Sat Oct 05 11:22:09 2013 -0400
@@ -81,7 +81,7 @@
 
   if (nargin != 1 || (! isvector (v) && ! isempty (v)))
     print_usage ();
-  elseif (any (isnan (v) | isinf (v)))
+  elseif (any (! isfinite (v)))
     error ("roots: inputs must not contain Inf or NaN");
   endif
 
--- a/scripts/polynomial/splinefit.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/polynomial/splinefit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -59,18 +59,18 @@
 ## the degrees of freedom are reduced to P.
 ##
 ## The optional property, @var{constaints}, is a structure specifying
-## linear constraints on the fit.  The structure has three fields, "xc",
-## "yc", and "cc".
+## linear constraints on the fit.  The structure has three fields, @qcode{"xc"},
+## @qcode{"yc"}, and @qcode{"cc"}.
 ##
 ## @table @asis
-## @item "xc"
+## @item @qcode{"xc"}
 ## Vector of the x-locations of the constraints.
 ##
-## @item "yc"
+## @item @qcode{"yc"}
 ## Constraining values at the locations @var{xc}.
 ## The default is an array of zeros.
 ##
-## @item "cc"
+## @item @qcode{"cc"}
 ## Coefficients (matrix).  The default is an array of ones.  The number of
 ## rows is limited to the order of the piecewise polynomials, @var{order}.
 ## @end table
@@ -94,7 +94,7 @@
 
 function pp = splinefit (x, y, breaks, varargin)
   if (nargin > 3)
-    n = cellfun (@ischar, varargin, "uniformoutput", true);
+    n = cellfun ("isclass", varargin, "char");
     varargin(n) = lower (varargin(n));
     try
       props = struct (varargin{:});
--- a/scripts/prefs/addpref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/addpref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -69,6 +69,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/getpref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/getpref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -90,6 +90,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/ispref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/ispref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -55,6 +55,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -9,6 +9,8 @@
   prefs/addpref.m \
   prefs/getpref.m \
   prefs/ispref.m \
+  prefs/prefdir.m \
+  prefs/preferences.m \
   prefs/rmpref.m \
   prefs/setpref.m \
   $(prefs_PRIVATE_FCN_FILES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/prefs/prefdir.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,48 @@
+## Copyright (C) 2013 John Donoghue
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Command} {} prefdir 
+## @deftypefnx {Command} {@var{dir} =} prefdir 
+## Return the directory that contains the preferences for Octave.
+##
+## Examples:
+##
+## Display the preferences directory
+##
+## @example
+## prefdir
+## @end example
+##
+## Change to the preferences folder
+##
+## @example
+## cd (prefdir)
+## @end example
+## @seealso{getpref, setpref, addpref, rmpref, ispref}
+## @end deftypefn
+
+## Author: John Donoghue
+## Version: 0.01
+
+function folder = prefdir ()
+
+  folder = getenv ("HOME");
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/prefs/preferences.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,34 @@
+## Copyright (C) 2013 John Donoghue
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Command} {} preferences 
+## Display the GUI preferences dialog window for Octave.
+## @end deftypefn
+
+## Author: John Donoghue
+## Version: 0.01
+
+function preferences ()
+  if (isguirunning ())
+    __octave_link_show_preferences__ ();
+  else
+    warning ("preferences: GUI must be running to use preferences dialog");
+  endif
+endfunction
+
--- a/scripts/prefs/private/loadprefs.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/private/loadprefs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -38,6 +38,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/private/prefsfile.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/private/prefsfile.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,10 +25,12 @@
 
 function retval = prefsfile ()
 
-  retval = "~/.octave_prefs";
+  retval = [prefdir() filesep() ".octave_prefs"];
+  
+endfunction
 
-endfunction
 
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/private/saveprefs.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/private/saveprefs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -31,6 +31,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/prefs/setpref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/prefs/setpref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -62,6 +62,8 @@
 
 endfunction
 
+
 %% Testing these functions will require some care to avoid wiping out
 %% existing (or creating unwanted) preferences for the user running the
 %% tests.
+
--- a/scripts/set/intersect.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/intersect.m	Sat Oct 05 11:22:09 2013 -0400
@@ -60,7 +60,7 @@
       len_a = rows (a);
     else
       c = [a(:); b(:)];
-      [c, ic] = sort (c);               ## [a(:);b(:)](ic) == c
+      [c, ic] = sort (c);               # [a(:);b(:)](ic) == c
       if (iscellstr (c))
         ii = find (strcmp (c(1:end-1), c(2:end)));
       else
@@ -71,8 +71,8 @@
     endif
 
     if (nargout > 1)
-      ia = ja(ic(ii));                  ## a(ia) == c
-      ib = jb(ic(ii+1) - len_a);        ## b(ib) == c
+      ia = ja(ic(ii));                  # a(ia) == c
+      ib = jb(ic(ii+1) - len_a);        # b(ib) == c
     endif
 
     if (nargin == 2 && (rows (b) == 1 || rows (a) == 1))
--- a/scripts/set/ismember.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/ismember.m	Sat Oct 05 11:22:09 2013 -0400
@@ -48,7 +48,7 @@
 ## @end group
 ## @end example
 ##
-## With the optional third argument @code{"rows"}, and matrices
+## With the optional third argument @qcode{"rows"}, and matrices
 ## @var{A} and @var{s} with the same number of columns, compare rows in
 ## @var{A} with the rows in @var{s}.
 ##
--- a/scripts/set/powerset.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/powerset.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## The set @var{a} must be a numerical matrix or a cell array of strings.  The
 ## output will always be a cell array of either vectors or strings.
 ##
-## With the optional second argument @code{"rows"}, each row of the set @var{a}
+## With the optional second argument @qcode{"rows"}, each row of the set @var{a}
 ## is considered one element of the set.  As a result, @var{a} must then be a
 ## numerical 2-D matrix.
 ##
--- a/scripts/set/private/validargs.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/private/validargs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -55,3 +55,4 @@
   endif
 
 endfunction
+
--- a/scripts/set/setdiff.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/setdiff.m	Sat Oct 05 11:22:09 2013 -0400
@@ -26,7 +26,7 @@
 ## return a column vector, otherwise return a row vector.
 ## @var{a}, @var{b} may be cell arrays of string(s).
 ##
-## Given the optional third argument @samp{"rows"}, return the rows in
+## Given the optional third argument @qcode{"rows"}, return the rows in
 ## @var{a} that are not in @var{b}, sorted in ascending order by rows.
 ##
 ## If requested, return @var{i} such that @code{c = a(i)}.
--- a/scripts/set/union.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/union.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,9 +33,9 @@
 ## @end group
 ## @end example
 ##
-## If the optional third input argument is the string "rows" then each row of
-## the matrices @var{a} and @var{b} will be considered as a single set element.
-## For example:
+## If the optional third input argument is the string @qcode{"rows"} then
+## each row of the matrices @var{a} and @var{b} will be considered as a
+## single set element.  For example:
 ##
 ## @example
 ## @group
--- a/scripts/set/unique.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/set/unique.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,16 +29,16 @@
 ## output is always a column vector.  @var{x} may also be a cell array of
 ## strings.
 ##
-## If the optional argument @code{"rows"} is supplied, return the unique
+## If the optional argument @qcode{"rows"} is supplied, return the unique
 ## rows of @var{x}, sorted in ascending order.
 ##
 ## If requested, return index vectors @var{i} and @var{j} such that
 ## @code{x(i)==y} and @code{y(j)==x}.
 ##
-## Additionally, if @var{i} is a requested output then one of @code{"first"} or
-## @code{"last"} may be given as an input.  If @code{"last"} is specified,
-## return the highest possible indices in @var{i}, otherwise, if @code{"first"}
-## is specified, return the lowest.  The default is @code{"last"}.
+## Additionally, if @var{i} is a requested output then one of @qcode{"first"} or
+## @qcode{"last"} may be given as an input.  If @qcode{"last"} is specified,
+## return the highest possible indices in @var{i}, otherwise, if @qcode{"first"}
+## is specified, return the lowest.  The default is @qcode{"last"}.
 ## @seealso{union, intersect, setdiff, setxor, ismember}
 ## @end deftypefn
 
@@ -221,3 +221,4 @@
 %!error unique({"a", "b", "c"}, "UnknownOption1", "UnknownOption2")
 %!error unique({"a", "b", "c"}, "rows", "UnknownOption2")
 %!error unique({"a", "b", "c"}, "UnknownOption1", "last")
+
--- a/scripts/signal/arch_fit.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/arch_fit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -116,3 +116,4 @@
   endfor
 
 endfunction
+
--- a/scripts/signal/arch_rnd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/arch_rnd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -100,3 +100,4 @@
   y = y(1:t);
 
 endfunction
+
--- a/scripts/signal/arch_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/arch_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -94,3 +94,4 @@
   pval = 1 - chi2cdf (lm, p);
 
 endfunction
+
--- a/scripts/signal/arma_rnd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/arma_rnd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -79,3 +79,4 @@
   x = x(n + 1 : t + n);
 
 endfunction
+
--- a/scripts/signal/detrend.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/detrend.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,8 +28,9 @@
 ## is assumed.  This corresponds to removing a linear trend.
 ##
 ## The order of the polynomial can also be given as a string, in which case
-## @var{p} must be either @t{"constant"} (corresponds to @code{@var{p}=0}) or
-## @t{"linear"} (corresponds to @code{@var{p}=1}).
+## @var{p} must be either @qcode{"constant"} (corresponds to
+## @code{@var{p}=0}) or
+## @qcode{"linear"} (corresponds to @code{@var{p}=1}).
 ## @seealso{polyfit}
 ## @end deftypefn
 
--- a/scripts/signal/durbinlevinson.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/durbinlevinson.m	Sat Oct 05 11:22:09 2013 -0400
@@ -91,3 +91,4 @@
   endif
 
 endfunction
+
--- a/scripts/signal/fftconv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/fftconv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -67,36 +67,36 @@
 
 %% FIXME: Borrow tests from conv.m.  May need a tolerance on the assert comparison
 %!test
-%!  x = ones (3,1);
-%!  y = ones (1,3);
-%!  b = 2;
-%!  c = 3;
-%!  assert (fftconv (x, x), [1; 2; 3; 2; 1], 5*eps);
-%!  assert (fftconv (y, y), [1, 2, 3, 2, 1], 5*eps);
-%!  assert (fftconv (x, y), [1, 2, 3, 2, 1], 5*eps);
-%!  assert (fftconv (y, x), [1; 2; 3; 2; 1], 5*eps);
-%!  assert (fftconv (c, x), [3; 3; 3], 5*eps);
-%!  assert (fftconv (c, y), [3, 3, 3], 5*eps);
-%!  assert (fftconv (x, c), [3; 3; 3], 5*eps);
-%!  assert (fftconv (y, c), [3, 3, 3], 5*eps);
-%!  assert (fftconv (b, c), 6, 5*eps);
+%! x = ones (3,1);
+%! y = ones (1,3);
+%! b = 2;
+%! c = 3;
+%! assert (fftconv (x, x), [1; 2; 3; 2; 1], 5*eps);
+%! assert (fftconv (y, y), [1, 2, 3, 2, 1], 5*eps);
+%! assert (fftconv (x, y), [1, 2, 3, 2, 1], 5*eps);
+%! assert (fftconv (y, x), [1; 2; 3; 2; 1], 5*eps);
+%! assert (fftconv (c, x), [3; 3; 3], 5*eps);
+%! assert (fftconv (c, y), [3, 3, 3], 5*eps);
+%! assert (fftconv (x, c), [3; 3; 3], 5*eps);
+%! assert (fftconv (y, c), [3, 3, 3], 5*eps);
+%! assert (fftconv (b, c), 6, 5*eps);
 
 %!test
-%!  a = 1:10;
-%!  b = 1:3;
-%!  assert (size (conv (a,b)), [1, numel(a)+numel(b)-1])
-%!  assert (size (conv (b,a)), [1, numel(a)+numel(b)-1])
+%! a = 1:10;
+%! b = 1:3;
+%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]);
+%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]);
 
-%!  a = (1:10).';
-%!  b = 1:3;
-%!  assert (size (conv (a,b)), [numel(a)+numel(b)-1, 1])
-%!  assert (size (conv (b,a)), [numel(a)+numel(b)-1, 1])
+%! a = (1:10).';
+%! b = 1:3;
+%! assert (size (conv (a,b)), [numel(a)+numel(b)-1, 1]);
+%! assert (size (conv (b,a)), [numel(a)+numel(b)-1, 1]);
 
 %!test
-%!  a = 1:10;
-%!  b = (1:3).';
-%!  assert (size (conv (a,b)), [1, numel(a)+numel(b)-1])
-%!  assert (size (conv (b,a)), [1, numel(a)+numel(b)-1])
+%! a = 1:10;
+%! b = (1:3).';
+%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]);
+%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]);
 
 %% Test input validation
 %!error fftconv (1)
--- a/scripts/signal/fftfilt.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/fftfilt.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,11 @@
 ## @var{b} using the FFT.
 ##
 ## Given the optional third argument, @var{n}, @code{fftfilt} uses the
-## overlap-add method to filter @var{x} with @var{b} using an N-point FFT.
+## overlap-add method to filter @var{x} with @var{b} using an @var{n}-point
+## FFT@.  The FFT size must be an even power of 2 and must be greater than
+## or equal to the length of @var{b}.  If the specified @var{n} does not
+## meet these criteria, it is automatically adjusted to the nearest value
+## that does.
 ##
 ## If @var{x} is a matrix, filter each column of the matrix.
 ## @seealso{filter, filter2}
@@ -137,7 +141,7 @@
 %! assert (fftfilt (b.',x  ), [1 1 0 0 0 0 0 0 0 0]  );
 %! assert (fftfilt (b.',x.'), [1 1 0 0 0 0 0 0 0 0].');
 %! assert (fftfilt (b,  [x.' x.']), [1 1 0 0 0 0 0 0 0 0].'*[1 1]);
-%! assert (fftfilt (b,  [x.'+eps x.']) == [1 1 0 0 0 0 0 0 0 0].'*[1 1], [false(10, 1) true(10, 1)]);
+%! assert (fftfilt (b,  [x.'+2*eps x.']) == [1 1 0 0 0 0 0 0 0 0].'*[1 1], [false(10, 1) true(10, 1)]);
 
 %!test
 %! r = sqrt (1/2) * (1+i);
--- a/scripts/signal/fftshift.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/fftshift.m	Sat Oct 05 11:22:09 2013 -0400
@@ -85,47 +85,47 @@
 
 
 %!test
-%!  x = [0:7];
-%!  y = fftshift (x);
-%!  assert (y, [4 5 6 7 0 1 2 3]);
-%!  assert (fftshift (y), x);
+%! x = [0:7];
+%! y = fftshift (x);
+%! assert (y, [4 5 6 7 0 1 2 3]);
+%! assert (fftshift (y), x);
 
 %!test
-%!  x = [0:6];
-%!  y = fftshift (x);
-%!  assert (y, [4 5 6 0 1 2 3]);
-%!  assert (fftshift (y), [1 2 3 4 5 6 0]);
+%! x = [0:6];
+%! y = fftshift (x);
+%! assert (y, [4 5 6 0 1 2 3]);
+%! assert (fftshift (y), [1 2 3 4 5 6 0]);
 
 %!test
-%!  x = [0:7]';
-%!  y = fftshift (x);
-%!  assert (y, [4;5;6;7;0;1;2;3]);
-%!  assert (fftshift (y), x);
+%! x = [0:7]';
+%! y = fftshift (x);
+%! assert (y, [4;5;6;7;0;1;2;3]);
+%! assert (fftshift (y), x);
 
 %!test
-%!  x = [0:6]';
-%!  y = fftshift (x);
-%!  assert (y, [4;5;6;0;1;2;3]);
-%!  assert (fftshift (y), [1;2;3;4;5;6;0]);
+%! x = [0:6]';
+%! y = fftshift (x);
+%! assert (y, [4;5;6;0;1;2;3]);
+%! assert (fftshift (y), [1;2;3;4;5;6;0]);
 
 %!test
-%!  x = [0:3];
-%!  x = [x;2*x;3*x+1;4*x+1];
-%!  y = fftshift (x);
-%!  assert (y, [[7 10 1 4];[9 13 1 5];[2 3 0 1];[4 6 0 2]]);
-%!  assert (fftshift (y), x);
+%! x = [0:3];
+%! x = [x;2*x;3*x+1;4*x+1];
+%! y = fftshift (x);
+%! assert (y, [[7 10 1 4];[9 13 1 5];[2 3 0 1];[4 6 0 2]]);
+%! assert (fftshift (y), x);
 
 %!test
-%!  x = [0:3];
-%!  x = [x;2*x;3*x+1;4*x+1];
-%!  y = fftshift (x,1);
-%!  assert (y, [[1 4 7 10];[1 5 9 13];[0 1 2 3];[0 2 4 6]]);
-%!  assert (fftshift (y,1), x);
+%! x = [0:3];
+%! x = [x;2*x;3*x+1;4*x+1];
+%! y = fftshift (x,1);
+%! assert (y, [[1 4 7 10];[1 5 9 13];[0 1 2 3];[0 2 4 6]]);
+%! assert (fftshift (y,1), x);
 
 %!test
-%!  x = [0:3];
-%!  x = [x;2*x;3*x+1;4*x+1];
-%!  y = fftshift (x,2);
-%!  assert (y, [[2 3 0 1];[4 6 0 2];[7 10 1 4];[9 13 1 5]]);
-%!  assert (fftshift (y,2), x);
+%! x = [0:3];
+%! x = [x;2*x;3*x+1;4*x+1];
+%! y = fftshift (x,2);
+%! assert (y, [[2 3 0 1];[4 6 0 2];[7 10 1 4];[9 13 1 5]]);
+%! assert (fftshift (y,2), x);
 
--- a/scripts/signal/filter2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/filter2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,13 +24,13 @@
 ## Possible values are:
 ##
 ## @table @asis
-## @item "full"
+## @item @qcode{"full"}
 ## pad @var{x} with zeros on all sides before filtering.
 ##
-## @item "same"
+## @item @qcode{"same"}
 ## unpadded @var{x} (default)
 ##
-## @item "valid"
+## @item @qcode{"valid"}
 ## trim @var{x} after filtering so edge effects are no included.
 ## @end table
 ##
--- a/scripts/signal/fractdiff.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/fractdiff.m	Sat Oct 05 11:22:09 2013 -0400
@@ -67,3 +67,4 @@
   endif
 
 endfunction
+
--- a/scripts/signal/freqz.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/freqz.m	Sat Oct 05 11:22:09 2013 -0400
@@ -44,8 +44,8 @@
 ## For fastest computation, @var{n} should factor into a small number of
 ## small primes.
 ##
-## If the fourth argument, "whole", is omitted the response is evaluated at
-## frequencies between 0 and
+## If the fourth argument, @qcode{"whole"}, is omitted the response is
+## evaluated at frequencies between 0 and
 ## @ifnottex
 ##  pi.
 ## @end ifnottex
@@ -178,7 +178,7 @@
 
 
 %!test # correct values and fft-polyval consistency
-%! # butterworth filter, order 2, cutoff pi/2 radians
+%! ## butterworth filter, order 2, cutoff pi/2 radians
 %! b = [0.292893218813452  0.585786437626905  0.292893218813452];
 %! a = [1  0  0.171572875253810];
 %! [h,w] = freqz (b,a,32);
@@ -203,3 +203,4 @@
 %! assert (h,h2.',20*eps);
 %! [h3,f3] = freqz (b,a,32,"whole",320);
 %! assert (f3,[0:31]'*10,10*eps);
+
--- a/scripts/signal/freqz_plot.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/freqz_plot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -64,3 +64,4 @@
   axis ([w(1), w(n)], "autoy", "label");
 
 endfunction
+
--- a/scripts/signal/hurst.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/hurst.m	Sat Oct 05 11:22:09 2013 -0400
@@ -46,3 +46,4 @@
   H = log (RS) / log (xr);
 
 endfunction
+
--- a/scripts/signal/periodogram.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/periodogram.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,7 +34,7 @@
 ##
 ## @itemize
 ## @item x: data; if real-valued a one-sided spectrum is estimated,
-## if complex-valued or range indicates "@nospell{twosided}", the full
+## if complex-valued or range indicates @qcode{"@nospell{twosided}"}, the full
 ## spectrum is estimated.
 ##
 ## @item win: weight data with window, x.*win is used for further computation,
@@ -44,9 +44,10 @@
 ##
 ## @item Fs: sampling rate, default 1.
 ##
-## @item range: "@nospell{onesided}" computes spectrum from [0..nfft/2+1].
-## "@nospell{twosided}" computes spectrum from [0..nfft-1].  These strings
-## can appear at any position in the list input arguments after window.
+## @item range: @qcode{"@nospell{onesided}"} computes spectrum from [0..nfft/2+1].
+## @qcode{"@nospell{twosided}"} computes spectrum from [0..nfft-1].  These
+## strings can appear at any position in the list input arguments after
+## window.
 ##
 ## @item @nospell{Pxx}: one-, or two-sided power spectrum.
 ##
@@ -74,14 +75,14 @@
       range = varargin{k};
     else
       switch (j)
-      case 1
-        window = varargin{k};
-      case 2
-        nfft   = varargin{k};
-      case 3
-        fs     = varargin{k};
-      case 4
-        range  = varargin{k};
+        case 1
+          window = varargin{k};
+        case 2
+          nfft   = varargin{k};
+        case 3
+          fs     = varargin{k};
+        case 4
+          range  = varargin{k};
       endswitch
       j++;
     endif
@@ -188,3 +189,4 @@
   endif
 
 endfunction
+
--- a/scripts/signal/private/rectangle_lw.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/private/rectangle_lw.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,13 +27,10 @@
 
 function retval = rectangle_lw (n, b)
 
-  if (nargin != 2)
-    print_usage ();
-  endif
-
   retval = zeros (n, 1);
   t = floor (1 / b);
 
   retval(1:t, 1) = ones (t, 1);
 
 endfunction
+
--- a/scripts/signal/private/rectangle_sw.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/private/rectangle_sw.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,10 +27,6 @@
 
 function retval = rectangle_sw (n, b)
 
-  if (nargin != 2)
-    print_usage ();
-  endif
-
   retval = zeros (n, 1);
   retval(1) = 2 / b + 1;
 
@@ -41,32 +37,3 @@
 
 endfunction
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/scripts/signal/private/triangle_lw.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/private/triangle_lw.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,10 +27,6 @@
 
 function retval = triangle_lw (n, b)
 
-  if (nargin != 2)
-    print_usage ();
-  endif
-
   retval = 1 - (0 : n-1)' * b;
   retval = max ([retval'; (zeros (1, n))])';
 
--- a/scripts/signal/private/triangle_sw.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/private/triangle_sw.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,10 +27,6 @@
 
 function retval = triangle_sw (n, b)
 
-  if (nargin != 2)
-    print_usage ();
-  endif
-
   retval = zeros (n,1);
   retval(1) = 1 / b;
 
@@ -41,32 +37,3 @@
 
 endfunction
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/scripts/signal/spectral_adf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/spectral_adf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,16 +17,19 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} spectral_adf (@var{c}, @var{win}, @var{b})
+## @deftypefn  {Function File} {} spectral_adf (@var{c})
+## @deftypefnx {Function File} {} spectral_adf (@var{c}, @var{win})
+## @deftypefnx {Function File} {} spectral_adf (@var{c}, @var{win}, @var{b})
 ## Return the spectral density estimator given a vector of
 ## autocovariances @var{c}, window name @var{win}, and bandwidth,
 ## @var{b}.
 ##
-## The window name, e.g., @code{"triangle"} or @code{"rectangle"} is
-## used to search for a function called @code{@var{win}_sw}.
+## The window name, e.g., @qcode{"triangle"} or @qcode{"rectangle"} is
+## used to search for a function called @code{@var{win}_lw}.
 ##
 ## If @var{win} is omitted, the triangle window is used.  If @var{b} is
 ## omitted, @code{1 / sqrt (length (@var{x}))} is used.
+## @seealso{spectral_xdf}
 ## @end deftypefn
 
 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at>
@@ -34,6 +37,10 @@
 
 function retval = spectral_adf (c, win, b)
 
+  if (nargin < 1 || nargin > 3)
+    print_usage ();
+  endif
+
   cr = length (c);
 
   if (columns (c) > 1)
@@ -46,8 +53,10 @@
 
   if (nargin == 1)
     w = triangle_lw (cr, b);
+  elseif (! ischar (win))
+    error ("spectral_adf: WIN must be a string");
   else
-    win = str2func (cstrcat (win, "_lw"));
+    win = str2func ([win "_lw"]);
     w = feval (win, cr, b);
   endif
 
@@ -60,6 +69,9 @@
 endfunction
 
 
-
+%% Test input validation
+%!error spectral_adf ();
+%!error spectral_adf (1, 2, 3, 4);
+%!error spectral_adf (1, 2);
+%!error spectral_adf (1, "invalid");
 
-
--- a/scripts/signal/spectral_xdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/spectral_xdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -17,15 +17,18 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} spectral_xdf (@var{x}, @var{win}, @var{b})
+## @deftypefn  {Function File} {} spectral_xdf (@var{x})
+## @deftypefnx {Function File} {} spectral_xdf (@var{x}, @var{win})
+## @deftypefnx {Function File} {} spectral_xdf (@var{x}, @var{win}, @var{b})
 ## Return the spectral density estimator given a data vector @var{x},
 ## window name @var{win}, and bandwidth, @var{b}.
 ##
-## The window name, e.g., @code{"triangle"} or @code{"rectangle"} is
+## The window name, e.g., @qcode{"triangle"} or @qcode{"rectangle"} is
 ## used to search for a function called @code{@var{win}_sw}.
 ##
 ## If @var{win} is omitted, the triangle window is used.  If @var{b} is
 ## omitted, @code{1 / sqrt (length (@var{x}))} is used.
+## @seealso{spectral_adf}
 ## @end deftypefn
 
 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at>
@@ -33,6 +36,10 @@
 
 function retval = spectral_xdf (x, win, b)
 
+  if (nargin < 1 || nargin > 3)
+    print_usage ();
+  endif
+
   xr = length (x);
 
   if (columns (x) > 1)
@@ -45,8 +52,10 @@
 
   if (nargin == 1)
     w = triangle_sw (xr, b);
+  elseif (! ischar (win))
+    error ("spectral_xdf: WIN must be a string");
   else
-    win = str2func (cstrcat (win, "_sw"));
+    win = str2func ([win "_sw"]);
     w = feval (win, xr, b);
   endif
 
@@ -60,3 +69,10 @@
 
 endfunction
 
+
+%% Test input validation
+%!error spectral_xdf ();
+%!error spectral_xdf (1, 2, 3, 4);
+%!error spectral_xdf (1, 2);
+%!error spectral_xdf (1, "invalid");
+
--- a/scripts/signal/stft.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/stft.m	Sat Oct 05 11:22:09 2013 -0400
@@ -132,3 +132,4 @@
   endif
 
 endfunction
+
--- a/scripts/signal/synthesis.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/synthesis.m	Sat Oct 05 11:22:09 2013 -0400
@@ -70,3 +70,4 @@
   x = reshape (z, inc * nc, 1);
 
 endfunction
+
--- a/scripts/signal/yulewalker.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/signal/yulewalker.m	Sat Oct 05 11:22:09 2013 -0400
@@ -55,6 +55,3 @@
 endfunction
 
 
-
-
-
--- a/scripts/sparse/bicg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/bicg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -233,11 +233,11 @@
 %! assert (x, ones (size (b)), 1e-7);
 
 %!function y = afun (x, t, a)
-%!  switch t
-%!   case "notransp"
-%!     y = a * x;
-%!   case "transp"
-%!     y = a' * x;
+%!  switch (t)
+%!    case "notransp"
+%!      y = a * x;
+%!    case "transp"
+%!      y = a' * x;
 %!  endswitch
 %!endfunction
 %!
--- a/scripts/sparse/bicgstab.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/bicgstab.m	Sat Oct 05 11:22:09 2013 -0400
@@ -145,7 +145,7 @@
     flag = 1;
 
     for iter = 1:maxit
-      rho_1 = res' * rr;
+      rho_1 = rr' * res;
 
       if (iter == 1)
         p = res;
@@ -163,7 +163,7 @@
       shat = precon (s);
 
       t = Ax (shat);
-      omega = (t' * s) / (t' * t);
+      omega = (s' * t) / (t' * t);
       x = x + alpha * phat + omega * shat;
       res = s - omega * t;
       rho_2 = rho_1;
@@ -248,3 +248,8 @@
 %! [x, flag, relres, iter, resvec] = bicgstab (A, b, tol, [], diag (diag (A)));
 %! assert (x, ones (size (b)), 1e-7);
 
+%!test
+%! A = [1 + 1i, 1 + 1i; 2 - 1i, 2 + 1i];
+%! b = A * [1; 1];
+%! [x, flag, relres, iter, resvec] = bicgstab (A, b);
+%! assert (x, [1; 1], 1e-6);
--- a/scripts/sparse/colperm.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/colperm.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,3 +35,4 @@
   idx = find (diff ([j; Inf]) != 0);
   [dummy, p] = sort (idx - [0; idx(1:(end-1))]);
 endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/sparse/eigs.m	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,1110 @@
+## Copyright (C) 2005-2012 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {@var{d} =} eigs (@var{A})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{k})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{k}, @var{sigma})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{k}, @var{sigma}, @var{opts})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{B})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{B}, @var{k})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{B}, @var{k}, @var{sigma})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{B})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{k})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{k}, @var{sigma})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts})
+## @deftypefnx {Function File} {@var{d} =} eigs (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts})
+## @deftypefnx {Function File} {[@var{V}, @var{d}] =} eigs (@var{A}, @dots{})
+## @deftypefnx {Function File} {[@var{V}, @var{d}] =} eigs (@var{af}, @var{n}, @dots{})
+## @deftypefnx {Function File} {[@var{V}, @var{d}, @var{flag}] =} eigs (@var{A}, @dots{})
+## @deftypefnx {Function File} {[@var{V}, @var{d}, @var{flag}] =} eigs (@var{af}, @var{n}, @dots{})
+## Calculate a limited number of eigenvalues and eigenvectors of @var{A},
+## based on a selection criteria.  The number of eigenvalues and eigenvectors to
+## calculate is given by @var{k} and defaults to 6.
+## 
+## By default, @code{eigs} solve the equation
+## @tex
+## $A \nu = \lambda \nu$,
+## @end tex
+## @ifinfo
+## @code{A * v = lambda * v},
+## @end ifinfo
+## where
+## @tex
+## $\lambda$ is a scalar representing one of the eigenvalues, and $\nu$
+## @end tex
+## @ifinfo
+## @code{lambda} is a scalar representing one of the eigenvalues, and @code{v}
+## @end ifinfo
+## is the corresponding eigenvector.  If given the positive definite matrix
+## @var{B} then @code{eigs} solves the general eigenvalue equation
+## @tex
+## $A \nu = \lambda B \nu$.
+## @end tex
+## @ifinfo
+## @code{A * v = lambda * B * v}.
+## @end ifinfo
+## 
+## The argument @var{sigma} determines which eigenvalues are returned.
+## @var{sigma} can be either a scalar or a string.  When @var{sigma} is a
+## scalar, the @var{k} eigenvalues closest to @var{sigma} are returned.  If
+## @var{sigma} is a string, it must have one of the following values.
+## 
+## @table @asis
+## @item @qcode{"lm"}
+## Largest Magnitude (default).
+## 
+## @item @qcode{"sm"}
+## Smallest Magnitude.
+## 
+## @item @qcode{"la"}
+## Largest Algebraic (valid only for real symmetric problems).
+## 
+## @item @qcode{"sa"}
+## Smallest Algebraic (valid only for real symmetric problems).
+## 
+## @item @qcode{"be"}
+## Both Ends, with one more from the high-end if @var{k} is odd (valid only for
+## real symmetric problems).
+## 
+## @item @qcode{"lr"}
+## Largest Real part (valid only for complex or unsymmetric problems).
+## 
+## @item @qcode{"sr"}
+## Smallest Real part (valid only for complex or unsymmetric problems).
+## 
+## @item @qcode{"li"}
+## Largest Imaginary part (valid only for complex or unsymmetric problems).
+## 
+## @item @qcode{"si"}
+## Smallest Imaginary part (valid only for complex or unsymmetric problems).
+## @end table
+## 
+## If @var{opts} is given, it is a structure defining possible options that
+## @code{eigs} should use.  The fields of the @var{opts} structure are:
+## 
+## @table @code
+## @item issym
+## If @var{af} is given, then flags whether the function @var{af} defines a
+## symmetric problem.  It is ignored if @var{A} is given.  The default is false.
+## 
+## @item isreal
+## If @var{af} is given, then flags whether the function @var{af} defines a
+## real problem.  It is ignored if @var{A} is given.  The default is true.
+## 
+## @item tol
+## Defines the required convergence tolerance, calculated as
+## @code{tol * norm (A)}.  The default is @code{eps}.
+## 
+## @item maxit
+## The maximum number of iterations.  The default is 300.
+## 
+## @item p
+## The number of Lanzcos basis vectors to use.  More vectors will result in
+## faster convergence, but a greater use of memory.  The optimal value of
+## @code{p} is problem dependent and should be in the range @var{k} to @var{n}.
+## The default value is @code{2 * @var{k}}.
+## 
+## @item v0
+## The starting vector for the algorithm.  An initial vector close to the
+## final vector will speed up convergence.  The default is for @sc{arpack}
+## to randomly generate a starting vector.  If specified, @code{v0} must be
+## an @var{n}-by-1 vector where @code{@var{n} = rows (@var{A})}
+## 
+## @item disp
+## The level of diagnostic printout (0|1|2).  If @code{disp} is 0 then
+## diagnostics are disabled.  The default value is 0.
+## 
+## @item cholB
+## Flag if @code{chol (@var{B})} is passed rather than @var{B}.  The default is
+## false.
+## 
+## @item permB
+## The permutation vector of the Cholesky@tie{}factorization of @var{B} if
+## @code{cholB} is true.  That is @code{chol (@var{B}(permB, permB))}.  The
+## default is @code{1:@var{n}}.
+## 
+## @end table
+## 
+## It is also possible to represent @var{A} by a function denoted @var{af}.
+## @var{af} must be followed by a scalar argument @var{n} defining the length
+## of the vector argument accepted by @var{af}.  @var{af} can be
+## a function handle, an inline function, or a string.  When @var{af} is a
+## string it holds the name of the function to use.
+## 
+## @var{af} is a function of the form @code{y = af (x)}
+## where the required return value of @var{af} is determined by
+## the value of @var{sigma}.  The four possible forms are
+## 
+## @table @code
+## @item A * x
+## if @var{sigma} is not given or is a string other than "sm".
+## 
+## @item A \ x
+## if @var{sigma} is 0 or "sm".
+## 
+## @item (A - sigma * I) \ x
+## for the standard eigenvalue problem, where @code{I} is the identity matrix of
+## the same size as @var{A}.
+## 
+## @item (A - sigma * B) \ x
+## for the general eigenvalue problem.
+## @end table
+## 
+## The return arguments of @code{eigs} depend on the number of return arguments
+## requested.  With a single return argument, a vector @var{d} of length @var{k}
+## is returned containing the @var{k} eigenvalues that have been found.  With
+## two return arguments, @var{V} is a @var{n}-by-@var{k} matrix whose columns
+## are the @var{k} eigenvectors corresponding to the returned eigenvalues.  The
+## eigenvalues themselves are returned in @var{d} in the form of a
+## @var{n}-by-@var{k} matrix, where the elements on the diagonal are the
+## eigenvalues.
+## 
+## Given a third return argument @var{flag}, @code{eigs} returns the status
+## of the convergence.  If @var{flag} is 0 then all eigenvalues have converged.
+## Any other value indicates a failure to converge.
+## 
+## This function is based on the @sc{arpack} package, written by R. Lehoucq,
+## K. Maschhoff, D. Sorensen, and C. Yang.  For more information see
+## @url{http://www.caam.rice.edu/software/ARPACK/}.
+## 
+## @seealso{eig, svds}
+## @end deftypefn
+
+function varargout = eigs (varargin)
+
+  ## For compatibility with Matlab, handle small matrix cases here
+  ## that ARPACK does not.
+
+  if (nargin == 0)
+    print_usage ();
+  endif
+
+  call_eig = false;
+  offset = 0;
+  k = 6;
+  sigma = "lm";
+
+  if (isnumeric (varargin{1}) && issquare (varargin{1}))
+    a = varargin{1};
+    if (nargin > 1 && isnumeric (varargin{2})
+        && issquare (varargin{2}) && size_equal (a, varargin{2}))
+      b = varargin{2};
+      offset = 1;
+    endif
+
+    if (rows (a) < 9)
+      call_eig = true;
+    endif
+    
+    if (nargin > 1 + offset)
+      tmp = varargin{2+offset};
+      if (isnumeric (tmp) && isscalar (tmp) && isreal (tmp)
+          && round (tmp) == tmp)
+        k = tmp;
+
+        if (rows (a) - k < 3)
+          call_eig = true;
+        endif
+      else
+        call_eig = false;
+      endif
+
+      if (nargin > 2 + offset)
+        tmp = varargin{3+offset};
+        if (ischar (tmp) || (isnumeric (tmp) && isscalar (tmp)))
+          sigma = tmp;
+        else
+          call_eig = false;
+        endif
+      endif
+    endif
+  endif
+
+  if (call_eig)
+    varargout = cell (1, min (2, max (1, nargout)));
+    if (offset)
+      real_valued = isreal (a) && isreal (b);
+      symmetric = issymmetric (a) && issymmetric (b);
+      [varargout{:}] = eig (a, b);
+    else
+      real_valued = isreal (a);
+      symmetric = issymmetric (a);
+      [varargout{:}] = eig (a);
+    endif
+    varargout = select (varargout, k, sigma, real_valued, symmetric);
+    if (nargout == 3)
+      varargout{3} = 0;
+    endif
+  else
+    varargout = cell (1, max (1, nargout));
+    [varargout{:}] = __eigs__ (varargin{:});
+  endif
+
+endfunction
+
+function out = select (args, k, sigma, real_valued, symmetric)
+
+  if (numel (args) == 1)
+    d = args{1};
+  else
+    d = diag (args{2});
+  endif
+
+  if (ischar (sigma))
+    switch (sigma)
+      case "lm"
+        [~, idx] = sort (abs (d), "descend");
+
+      case "sm"
+        [~, idx] = sort (abs (d), "ascend");
+
+      case "la"
+        if (real_valued && symmetric)
+          [~, idx] = sort (real (d), "descend");
+        else
+          error ("sigma = \"la\" requires real symmetric problem");
+        endif
+
+      case "sa"
+        if (real_valued && symmetric)
+          [~, idx] = sort (real (d), "ascend");
+        else
+          error ("sigma = \"sa\" requires real symmetric problem");
+        endif
+
+      case "be"
+        if (real_valued && symmetric)
+          [~, idx] = sort (real (d), "ascend");
+        else
+          error ("sigma = \"be\" requires real symmetric problem");
+        endif
+
+      case "lr"
+        if (! (real_valued || symmetric))
+          [~, idx] = sort (real (d), "descend");
+        else
+          error ("sigma = \"lr\" requires complex or unsymmetric problem");
+        endif
+
+      case "sr"
+        if (! (real_valued || symmetric))
+          [~, idx] = sort (real (d), "ascend");
+        else
+          error ("sigma = \"sr\" requires complex or unsymmetric problem");
+        endif
+
+      case "li"
+        if (! (real_valued || symmetric))
+          [~, idx] = sort (imag (d), "descend");
+        else
+          error ("sigma = \"li\" requires complex or unsymmetric problem");
+        endif
+
+      case "si"
+        if (! (real_valued || symmetric))
+          [~, idx] = sort (imag (d), "ascend");
+        else
+          error ("sigma = \"si\" requires complex or unsymmetric problem");
+        endif
+
+      otherwise
+        error ("unrecognized value for sigma: %s", sigma);
+    endswitch
+  endif
+
+  d = d(idx);
+
+  n = numel (d);
+
+  k = min (k, n);
+
+  if (strcmp (sigma, 'be'))
+    tmp = k / 2;
+    n1 = floor (tmp);
+    n2 = n - ceil (tmp) + 1;
+    selection = [1:floor(k/2), n2:n];
+  else
+    selection = 1:k;
+  endif
+
+  d = d(selection);
+
+  if (numel (args) == 1)
+    out{1} = d;
+  else
+    out{2} = diag (d);
+
+    v = args{1};
+    v = v(:,idx);
+    out{1} = v(selection,:);
+  endif
+
+endfunction
+
+
+#### SPARSE MATRIX VERSIONS ####
+
+## Real positive definite tests, n must be even
+%!shared n, k, A, d0, d2
+%! n = 20;
+%! k = 4;
+%! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),4*ones(1,n),ones(1,n-2)]);
+%! d0 = eig (A);
+%! d2 = sort (d0);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); # initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (d1, d0(end:-1:(end-k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (d1, d0(k:-1:1), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "la");
+%! assert (d1, d2(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sa");
+%! assert (d1, d2(1:k), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "be");
+%! assert (d1, d2([1:floor(k/2), (end - ceil(k/2) + 1):end]), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1, "be");
+%! assert (d1, d2([1:floor((k+1)/2), (end - ceil((k+1)/2) + 1):end]), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (d1(idx1), d0(idx0(1:k)), 1e-11);
+%!testif HAVE_ARPACK, HAVE_CHOLMOD
+%! d1 = eigs (A, speye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (eigs (A, k, 4.1), eigs (A, speye (n), k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (eigs (A, k, 4.1), eigs (A, speye (n), k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (d1, d0(k:-1:1), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (d1, eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! AA = speye (10);
+%! fn = @(x) AA * x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! assert (eigs (fn, 10, AA, 3, "lm", opts), [1; 1; 1], 10*eps);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "la");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sa");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "be");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+## Real unsymmetric tests
+%!shared n, k, A, d0
+%! n = 20;
+%! k = 4;
+%! A =  sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]);
+%! d0 = eig (A);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (abs (d1), abs (d0(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lr");
+%! [~, idx] = sort (real (d0));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "li");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "si");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
+%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_CHOLMOD
+%! d1 = eigs (A, speye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, speye (n), k, 4.1)), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, speye (n), k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (abs (d1), d0(1:k), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "li");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "si");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+
+## Complex hermitian tests
+%!shared n, k, A, d0
+%! n = 20;
+%! k = 4;
+%! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[1i*ones(1,n-2),4*ones(1,n),-1i*ones(1,n-2)]);
+%! d0 = eig (A);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (abs (d1), abs (d0(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "li");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "si");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
+%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_CHOLMOD
+%! d1 = eigs (A, speye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, speye (n), k, 4.1, opts);
+%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
+%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, speye (n)(q,q), k, 4.1, opts);
+%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
+%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, speye (n), k, 4.1)), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, speye (n), k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (abs (d1), d0(1:k), 1e-11);
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK, HAVE_UMFPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "li");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "si");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*speye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+#### FULL MATRIX VERSIONS ####
+
+## Real positive definite tests, n must be even
+%!shared n, k, A, d0, d2
+%! n = 20;
+%! k = 4;
+%! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),4*ones(1,n),ones(1,n-2)]));
+%! d0 = eig (A);
+%! d2 = sort (d0);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (d1, d0(end:-1:(end-k)),1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (d1, d0(k:-1:1), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "la");
+%! assert (d1, d2(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sa");
+%! assert (d1, d2(1:k), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "be");
+%! assert (d1, d2([1:floor(k/2), (end - ceil(k/2) + 1):end]), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1, "be");
+%! assert (d1, d2([1:floor((k+1)/2), (end - ceil((k+1)/2) + 1):end]), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (d1(idx1), d0(idx0(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, eye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (eigs (A, k, 4.1), eigs (A, eye (n), k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (eigs (A, k, 4.1), eigs (A, eye (n), k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (d1, d0(end:-1:(end-k+1)), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (d1, d0(k:-1:1), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 1;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (d1, eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "la");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sa");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "be");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+## Real unsymmetric tests
+%!shared n, k, A, d0
+%! n = 20;
+%! k = 4;
+%! A =  full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]));
+%! d0 = eig (A);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (abs (d1), abs (d0(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lr");
+%! [~, idx] = sort (real (d0));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "li");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "si");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
+%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, eye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, eye (n), k, 4.1)), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, eye (n), k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (abs (d1), d0(1:k), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 0;  opts.isreal = 1;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "li");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "si");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+## Complex hermitian tests
+%!shared n, k, A, d0
+%! n = 20;
+%! k = 4;
+%! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[1i*ones(1,n-2),4*ones(1,n),-1i*ones(1,n-2)]));
+%! d0 = eig (A);
+%! [~, idx] = sort (abs (d0));
+%! d0 = d0(idx);
+%! rand ("state", 42); % initialize generator to make eigs behavior reproducible
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k+1);
+%! assert (abs (d1), abs (d0(end:-1:(end-k))),1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sm");
+%! assert (abs (d1), abs (d0(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "lr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "sr");
+%! [~, idx] = sort (real (abs (d0)));
+%! d2 = d0(idx);
+%! assert (real (d1), real (d2(1:k)), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "li");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(end:-1:(end-k+1)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, "si");
+%! [~, idx] = sort (imag (abs (d0)));
+%! d2 = d0(idx);
+%! assert (sort (imag (d1)), sort (imag (d2(1:k))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, k, 4.1);
+%! [~, idx0] = sort (abs (d0 - 4.1));
+%! [~, idx1] = sort (abs (d1 - 4.1));
+%! assert (abs (d1(idx1)), abs (d0(idx0(1:k))), 1e-11);
+%! assert (sort (imag (d1(idx1))), sort (imag (d0(idx0(1:k)))), 1e-11);
+%!testif HAVE_ARPACK
+%! d1 = eigs (A, eye (n), k, "lm");
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! d1 = eigs (A, eye (n), k, 4.1, opts);
+%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
+%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! opts.cholB = true;
+%! q = [2:n,1];
+%! opts.permB = q;
+%! d1 = eigs (A, eye (n)(q,q), k, 4.1, opts);
+%! assert (abs (abs (d1)), abs (eigs (A, k, 4.1)), 1e-11);
+%! assert (sort (imag (abs (d1))), sort (imag (eigs (A, k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (abs (eigs (A, k, 4.1)), abs (eigs (A, eye (n), k, 4.1)), 1e-11);
+%!testif HAVE_ARPACK
+%! assert (sort (imag (eigs (A, k, 4.1))), sort (imag (eigs (A, eye (n), k, 4.1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A * x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, "lm", opts);
+%! assert (abs (d1), abs (d0(end:-1:(end-k+1))), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) A \ x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, "sm", opts);
+%! assert (abs (d1), d0(1:k), 1e-11);
+%!testif HAVE_ARPACK
+%! fn = @(x) (A - 4.1 * eye (n)) \ x;
+%! opts.issym = 0;  opts.isreal = 0;
+%! d1 = eigs (fn, n, k, 4.1, opts);
+%! assert (abs (d1), eigs (A, k, 4.1), 1e-11);
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sm");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "lr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "sr");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "li");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+%!testif HAVE_ARPACK
+%! [v1,d1] = eigs (A, k, "si");
+%! d1 = diag (d1);
+%! for i=1:k
+%!   assert (max (abs ((A - d1(i)*eye (n))*v1(:,i))), 0, 1e-11);
+%! endfor
+
+%!assert (eigs (diag (1:5), 5, "sa"), [1;2;3;4;5]);
+%!assert (eigs (diag (1:5), 5, "la"), [5;4;3;2;1]);
+%!assert (eigs (diag (1:5), 3, "be"), [1;4;5]);
+
--- a/scripts/sparse/etreeplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/etreeplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,7 +20,7 @@
 ## @deftypefn  {Function File} {} etreeplot (@var{A})
 ## @deftypefnx {Function File} {} etreeplot (@var{A}, @var{node_style}, @var{edge_style})
 ## Plot the elimination tree of the matrix @var{A} or
-## @xcode{@var{A}+@var{A}'} if @var{A} in not symmetric.  The optional
+## @tcode{@var{A}+@var{A}'} if @var{A} in not symmetric.  The optional
 ## parameters @var{node_style} and @var{edge_style} define the output
 ## style.
 ## @seealso{treeplot, gplot}
@@ -34,3 +34,4 @@
 
   treeplot (etree (A+A'), varargin{:});
 endfunction
+
--- a/scripts/sparse/gmres.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/gmres.m	Sat Oct 05 11:22:09 2013 -0400
@@ -234,3 +234,4 @@
 %!error <A must be a function or matrix> gmres ({1},2)
 %!error <M1 must be a function or matrix> gmres (1,2,3,4,5,{6})
 %!error <M2 must be a function or matrix> gmres (1,2,3,4,5,6,{7})
+
--- a/scripts/sparse/module.mk	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/module.mk	Sat Oct 05 11:22:09 2013 -0400
@@ -8,6 +8,7 @@
   sparse/bicgstab.m \
   sparse/cgs.m \
   sparse/colperm.m \
+  sparse/eigs.m \
   sparse/etreeplot.m \
   sparse/gmres.m \
   sparse/gplot.m \
--- a/scripts/sparse/pcg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/pcg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -391,101 +391,101 @@
 
 
 %!demo
-%!  # Simplest usage of pcg (see also 'help pcg')
-%! 
-%!  N = 10;
-%!  A = diag ([1:N]); b = rand (N, 1);
-%!  y = A \ b;  # y is the true solution
-%!  x = pcg (A, b);
-%!  printf ("The solution relative error is %g\n", norm (x - y) / norm (y));
-%! 
-%!  # You shouldn't be afraid if pcg issues some warning messages in this
-%!  # example: watch out in the second example, why it takes N iterations
-%!  # of pcg to converge to (a very accurate, by the way) solution
+%! ## Simplest usage of pcg (see also 'help pcg')
+%!
+%! N = 10;
+%! A = diag ([1:N]); b = rand (N, 1);
+%! y = A \ b;  # y is the true solution
+%! x = pcg (A, b);
+%! printf ("The solution relative error is %g\n", norm (x - y) / norm (y));
+%!
+%! ## You shouldn't be afraid if pcg issues some warning messages in this
+%! ## example: watch out in the second example, why it takes N iterations
+%! ## of pcg to converge to (a very accurate, by the way) solution
 
 %!demo
-%!  # Full output from pcg, except for the eigenvalue estimates
-%!  # We use this output to plot the convergence history
-%! 
-%!  N = 10;
-%!  A = diag ([1:N]); b = rand (N, 1);
-%!  X = A \ b;  # X is the true solution
-%!  [x, flag, relres, iter, resvec] = pcg (A, b);
-%!  printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
-%!  title ("Convergence history");
-%!  semilogy ([0:iter], resvec / resvec(1), "o-g");
-%!  xlabel ("Iteration"); ylabel ("log(||b-Ax||/||b||)");
-%!  legend ("relative residual");
+%! ## Full output from pcg, except for the eigenvalue estimates
+%! ## We use this output to plot the convergence history
+%!
+%! N = 10;
+%! A = diag ([1:N]); b = rand (N, 1);
+%! X = A \ b;  # X is the true solution
+%! [x, flag, relres, iter, resvec] = pcg (A, b);
+%! printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
+%! title ("Convergence history");
+%! semilogy ([0:iter], resvec / resvec(1), "o-g");
+%! xlabel ("Iteration"); ylabel ("log(||b-Ax||/||b||)");
+%! legend ("relative residual");
 
 %!demo
-%!  # Full output from pcg, including the eigenvalue estimates
-%!  # Hilbert matrix is extremely ill-conditioned, so pcg WILL have problems
-%! 
-%!  N = 10;
-%!  A = hilb (N); b = rand (N, 1);
-%!  X = A \ b;  # X is the true solution
-%!  [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], 200);
-%!  printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
-%!  printf ("Condition number estimate is %g\n", eigest(2) / eigest(1));
-%!  printf ("Actual condition number is   %g\n", cond (A));
-%!  title ("Convergence history");
-%!  semilogy ([0:iter], resvec, ["o-g";"+-r"]);
-%!  xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
-%!  legend ("absolute residual", "absolute preconditioned residual");
+%! ## Full output from pcg, including the eigenvalue estimates
+%! ## Hilbert matrix is extremely ill-conditioned, so pcg WILL have problems
+%!
+%! N = 10;
+%! A = hilb (N); b = rand (N, 1);
+%! X = A \ b;  # X is the true solution
+%! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], 200);
+%! printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
+%! printf ("Condition number estimate is %g\n", eigest(2) / eigest(1));
+%! printf ("Actual condition number is   %g\n", cond (A));
+%! title ("Convergence history");
+%! semilogy ([0:iter], resvec, ["o-g";"+-r"]);
+%! xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
+%! legend ("absolute residual", "absolute preconditioned residual");
 
 %!demo
-%!  # Full output from pcg, including the eigenvalue estimates
-%!  # We use the 1-D Laplacian matrix for A, and cond(A) = O(N^2)
-%!  # and that's the reason we need some preconditioner; here we take
-%!  # a very simple and not powerful Jacobi preconditioner,
-%!  # which is the diagonal of A
+%! ## Full output from pcg, including the eigenvalue estimates
+%! ## We use the 1-D Laplacian matrix for A, and cond(A) = O(N^2)
+%! ## and that's the reason we need some preconditioner; here we take
+%! ## a very simple and not powerful Jacobi preconditioner,
+%! ## which is the diagonal of A.
 %!
-%!  N = 100;
-%!  A = zeros (N, N);
-%!  for i = 1 : N - 1 # form 1-D Laplacian matrix
-%!    A(i:i+1, i:i+1) = [2 -1; -1 2];
-%!  endfor
-%!  b = rand (N, 1);
-%!  X = A \ b;  # X is the true solution
-%!  maxit = 80;
-%!  printf ("System condition number is %g\n", cond (A));
-%!  # No preconditioner: the convergence is very slow!
+%! N = 100;
+%! A = zeros (N, N);
+%! for i = 1 : N - 1 # form 1-D Laplacian matrix
+%!   A(i:i+1, i:i+1) = [2 -1; -1 2];
+%! endfor
+%! b = rand (N, 1);
+%! X = A \ b;  # X is the true solution
+%! maxit = 80;
+%! printf ("System condition number is %g\n", cond (A));
+%! ## No preconditioner: the convergence is very slow!
 %!
-%!  [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit);
-%!  printf ("System condition number estimate is %g\n", eigest(2) / eigest(1));
-%!  title ("Convergence history");
-%!  semilogy ([0:iter], resvec(:,1), "o-g");
-%!  xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
-%!  legend ("NO preconditioning: absolute residual");
+%! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit);
+%! printf ("System condition number estimate is %g\n", eigest(2) / eigest(1));
+%! title ("Convergence history");
+%! semilogy ([0:iter], resvec(:,1), "o-g");
+%! xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
+%! legend ("NO preconditioning: absolute residual");
 %!
-%!  pause (1);
-%!  # Test Jacobi preconditioner: it will not help much!!!
+%! pause (1);
+%! ## Test Jacobi preconditioner: it will not help much!!!
 %!
-%!  M = diag (diag (A)); # Jacobi preconditioner
-%!  [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
-%!  printf ("JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
-%!  hold on;
-%!  semilogy ([0:iter], resvec(:,1), "o-r");
-%!  legend ("NO preconditioning: absolute residual", ...
-%!          "JACOBI preconditioner: absolute residual");
+%! M = diag (diag (A)); # Jacobi preconditioner
+%! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
+%! printf ("JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
+%! hold on;
+%! semilogy ([0:iter], resvec(:,1), "o-r");
+%! legend ("NO preconditioning: absolute residual", ...
+%!         "JACOBI preconditioner: absolute residual");
 %!
-%!  pause (1);
-%!  # Test nonoverlapping block Jacobi preconditioner: it will help much!
+%! pause (1);
+%! ## Test nonoverlapping block Jacobi preconditioner: it will help much!
 %!
-%!  M = zeros (N, N); k = 4;
-%!  for i = 1 : k : N # form 1-D Laplacian matrix
-%!    M(i:i+k-1, i:i+k-1) = A(i:i+k-1, i:i+k-1);
-%!  endfor
-%!  [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
-%!  printf ("BLOCK JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
-%!  semilogy ([0:iter], resvec(:,1), "o-b");
-%!  legend ("NO preconditioning: absolute residual", ...
-%!          "JACOBI preconditioner: absolute residual", ...
-%!          "BLOCK JACOBI preconditioner: absolute residual");
-%!  hold off;
+%! M = zeros (N, N); k = 4;
+%! for i = 1 : k : N # form 1-D Laplacian matrix
+%!   M(i:i+k-1, i:i+k-1) = A(i:i+k-1, i:i+k-1);
+%! endfor
+%! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
+%! printf ("BLOCK JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
+%! semilogy ([0:iter], resvec(:,1), "o-b");
+%! legend ("NO preconditioning: absolute residual", ...
+%!         "JACOBI preconditioner: absolute residual", ...
+%!         "BLOCK JACOBI preconditioner: absolute residual");
+%! hold off;
 
 %!test
-%! # solve small diagonal system
+%! ## solve small diagonal system
 %!
 %! N = 10;
 %! A = diag ([1:N]); b = rand (N, 1);
@@ -495,9 +495,9 @@
 %! assert (flag, 0);
 
 %!test
-%! # solve small indefinite diagonal system
-%! # despite A is indefinite, the iteration continues and converges
-%! # indefiniteness of A is detected
+%! ## solve small indefinite diagonal system
+%! ## despite A is indefinite, the iteration continues and converges
+%! ## indefiniteness of A is detected
 %!
 %! N = 10;
 %! A = diag([1:N] .* (-ones(1, N) .^ 2)); b = rand (N, 1);
@@ -507,7 +507,7 @@
 %! assert (flag, 3);
 
 %!test
-%! # solve tridiagonal system, do not converge in default 20 iterations
+%! ## solve tridiagonal system, do not converge in default 20 iterations
 %!
 %! N = 100;
 %! A = zeros (N, N);
@@ -522,9 +522,9 @@
 %! assert (iter, 20); # should perform max allowable default number of iterations
 
 %!test
-%! # solve tridiagonal system with 'perfect' preconditioner
-%! # which converges in one iteration, so the eigest does not
-%! # work and issues a warning
+%! ## solve tridiagonal system with 'perfect' preconditioner
+%! ## which converges in one iteration, so the eigest does not
+%! ## work and issues a warning
 %!
 %! N = 100;
 %! A = zeros (N, N);
--- a/scripts/sparse/pcr.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/pcr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -303,7 +303,7 @@
 
 
 %!demo
-%! # Simplest usage of PCR (see also 'help pcr')
+%! ## Simplest usage of PCR (see also 'help pcr')
 %!
 %! N = 20;
 %! A = diag (linspace (-3.1,3,N)); b = rand (N,1);
@@ -311,13 +311,13 @@
 %! x = pcr (A,b);
 %! printf ("The solution relative error is %g\n", norm (x-y) / norm (y));
 %!
-%! # You shouldn't be afraid if PCR issues some warning messages in this
-%! # example: watch out in the second example, why it takes N iterations
-%! # of PCR to converge to (a very accurate, by the way) solution
+%! ## You shouldn't be afraid if PCR issues some warning messages in this
+%! ## example: watch out in the second example, why it takes N iterations
+%! ## of PCR to converge to (a very accurate, by the way) solution.
 
 %!demo
-%! # Full output from PCR
-%! # We use this output to plot the convergence history
+%! ## Full output from PCR
+%! ## We use this output to plot the convergence history
 %!
 %! N = 20;
 %! A = diag (linspace (-3.1,30,N)); b = rand (N,1);
@@ -330,11 +330,11 @@
 %! semilogy ([0:iter], resvec/resvec(1), "o-g;relative residual;");
 
 %!demo
-%! # Full output from PCR
-%! # We use indefinite matrix based on the Hilbert matrix, with one
-%! # strongly negative eigenvalue
-%! # Hilbert matrix is extremely ill conditioned, so is ours,
-%! # and that's why PCR WILL have problems
+%! ## Full output from PCR
+%! ## We use indefinite matrix based on the Hilbert matrix, with one
+%! ## strongly negative eigenvalue
+%! ## Hilbert matrix is extremely ill conditioned, so is ours,
+%! ## and that's why PCR WILL have problems
 %!
 %! N = 10;
 %! A = hilb (N); A(1,1) = -A(1,1); b = rand (N,1);
@@ -350,14 +350,14 @@
 %! semilogy ([0:iter], resvec, "o-g;absolute residual;");
 
 %!demo
-%! # Full output from PCR
-%! # We use an indefinite matrix based on the 1-D Laplacian matrix for A,
-%! # and here we have cond(A) = O(N^2)
-%! # That's the reason we need some preconditioner; here we take
-%! # a very simple and not powerful Jacobi preconditioner,
-%! # which is the diagonal of A
+%! ## Full output from PCR
+%! ## We use an indefinite matrix based on the 1-D Laplacian matrix for A,
+%! ## and here we have cond(A) = O(N^2)
+%! ## That's the reason we need some preconditioner; here we take
+%! ## a very simple and not powerful Jacobi preconditioner,
+%! ## which is the diagonal of A.
 %!
-%! # Note that we use here indefinite preconditioners!
+%! ## Note that we use here indefinite preconditioners!
 %!
 %! N = 100;
 %! A = zeros (N,N);
@@ -369,7 +369,7 @@
 %! X = A \ b;  # X is the true solution
 %! maxit = 80;
 %! printf ("System condition number is %g\n", cond (A));
-%! # No preconditioner: the convergence is very slow!
+%! ## No preconditioner: the convergence is very slow!
 %!
 %! [x, flag, relres, iter, resvec] = pcr (A,b,[],maxit);
 %! clf;
@@ -378,7 +378,7 @@
 %! semilogy ([0:iter], resvec, "o-g;NO preconditioning: absolute residual;");
 %!
 %! pause (1);
-%! # Test Jacobi preconditioner: it will not help much!!!
+%! ## Test Jacobi preconditioner: it will not help much!!!
 %!
 %! M = diag (diag (A)); # Jacobi preconditioner
 %! [x, flag, relres, iter, resvec] = pcr (A,b,[],maxit,M);
@@ -386,8 +386,8 @@
 %! semilogy ([0:iter],resvec,"o-r;JACOBI preconditioner: absolute residual;");
 %!
 %! pause (1);
-%! # Test nonoverlapping block Jacobi preconditioner: this one should give
-%! # some convergence speedup!
+%! ## Test nonoverlapping block Jacobi preconditioner: this one should give
+%! ## some convergence speedup!
 %!
 %! M = zeros (N,N); k = 4;
 %! for i=1:k:N # get k x k diagonal blocks of A
@@ -399,7 +399,7 @@
 %! hold off;
 
 %!test
-%! # solve small indefinite diagonal system
+%! ## solve small indefinite diagonal system
 %!
 %! N = 10;
 %! A = diag (linspace (-10.1,10,N)); b = ones (N,1);
@@ -409,8 +409,8 @@
 %! assert (flag, 0);
 
 %!test
-%! # solve tridiagonal system, do not converge in default 20 iterations
-%! # should perform max allowable default number of iterations
+%! ## solve tridiagonal system, do not converge in default 20 iterations
+%! ## should perform max allowable default number of iterations
 %!
 %! N = 100;
 %! A = zeros (N,N);
@@ -425,8 +425,8 @@
 %! assert (iter, 20);
 
 %!test
-%! # solve tridiagonal system with "perfect" preconditioner
-%! # converges in one iteration
+%! ## solve tridiagonal system with "perfect" preconditioner
+%! ## converges in one iteration
 %!
 %! N = 100;
 %! A = zeros (N,N);
--- a/scripts/sparse/private/__sprand_impl__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/private/__sprand_impl__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -75,7 +75,7 @@
     [i, j] = ind2sub ([m, n], idx);
   endif
 
-
   S = sparse (i, j, randfun (k, 1), m, n);
 
 endfunction
+
--- a/scripts/sparse/spdiags.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/spdiags.m	Sat Oct 05 11:22:09 2013 -0400
@@ -91,3 +91,4 @@
 %!assert (spdiags (zeros (1,0),1,1,1), sparse (0))
 %!assert (spdiags (zeros (0,1),1,1,1), sparse (0))
 %!assert (spdiags ([0.5 -1 0.5], 0:2, 1, 1), sparse(0.5))
+
--- a/scripts/sparse/sprandn.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/sprandn.m	Sat Oct 05 11:22:09 2013 -0400
@@ -75,3 +75,4 @@
 %% Test very large, very low density matrix doesn't fail 
 %!test
 %! s = sprandn(1e6,1e6,1e-7);
+
--- a/scripts/sparse/sprandsym.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/sprandsym.m	Sat Oct 05 11:22:09 2013 -0400
@@ -121,7 +121,7 @@
   ## Degenerate case
   if (k == 1)
     r = 1;
-    return
+    return;
   endif
 
   ## Compute the stuff described above
--- a/scripts/sparse/svds.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/svds.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,13 +40,13 @@
 ## and defaults to 6.
 ##
 ## The argument @var{sigma} specifies which singular values to find.  When
-## @var{sigma} is the string 'L', the default, the largest singular values of
-## @var{A} are found.  Otherwise, @var{sigma} must be a real scalar and the
-## singular values closest to @var{sigma} are found.  As a corollary,
+## @var{sigma} is the string @qcode{'L'}, the default, the largest singular
+## values of @var{A} are found.  Otherwise, @var{sigma} must be a real scalar
+## and the singular values closest to @var{sigma} are found.  As a corollary,
 ## @code{@var{sigma} = 0} finds the smallest singular values.  Note that for
-## relatively small values of @var{sigma}, there is a chance that the requested
-## number of singular values will not be found.  In that case @var{sigma}
-## should be increased.
+## relatively small values of @var{sigma}, there is a chance that the
+## requested number of singular values will not be found.  In that case
+## @var{sigma} should be increased.
 ##
 ## @var{opts} is a structure defining options that @code{svds} will pass
 ## to @code{eigs}.  The possible fields of this structure are documented in
@@ -99,11 +99,11 @@
   endif
 
   if (ndims (A) > 2)
-    error ("svds: A must be a 2D matrix");
+    error ("svds: A must be a 2-D matrix");
   endif
 
   if (nargin < 4)
-    opts.tol = 0;   ## use ARPACK default
+    opts.tol = 0;    # use ARPACK default
     opts.disp = 0;
     opts.maxit = 300;
   else
@@ -111,7 +111,7 @@
       error ("svds: OPTS must be a structure");
     endif
     if (!isfield (opts, "tol"))
-      opts.tol = 0;   ## use ARPACK default
+      opts.tol = 0;  # use ARPACK default
     else
       opts.tol = opts.tol / root2;
     endif
@@ -141,6 +141,9 @@
   if (isempty (max_a))
     max_a = 0;
   endif
+  ## Must initialize variable value, otherwise it may appear to interpreter
+  ## that code is trying to call flag() colormap function.
+  flag = 0;  
 
   if (max_a == 0)
     s = zeros (k, 1);  # special case of zero matrix
@@ -294,7 +297,7 @@
 %!
 %!testif HAVE_ARPACK
 %! s = svds (speye (10));
-%! assert (s, ones (6, 1), 4*eps);
+%! assert (s, ones (6, 1), 8*eps);
 
 %!test
 %! ## Restore random number generator seeds at end of tests
--- a/scripts/sparse/treelayout.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/sparse/treelayout.m	Sat Oct 05 11:22:09 2013 -0400
@@ -144,7 +144,7 @@
       if (columns (idx) == 1 && top_level == 1)
         s++;
       else
-        # We aren't in top level separator now.
+        ## We aren't in top level separator now.
         top_level = 0;
       endif
       ## If there is not any descendant of "parent node":
--- a/scripts/specfun/bessel.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/bessel.m	Sat Oct 05 11:22:09 2013 -0400
@@ -93,3 +93,4 @@
 
 
 %!error bessel ()
+
--- a/scripts/specfun/betaln.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/betaln.m	Sat Oct 05 11:22:09 2013 -0400
@@ -55,3 +55,4 @@
 %% Test input validation
 %!error (betaln (1))
 %!error (betaln (1,2,3))
+
--- a/scripts/specfun/ellipke.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/ellipke.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,19 +19,22 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {} ellipke (@var{m})
-## @deftypefnx {Function File} {} ellipke (@var{m}, @var{tol})
+## @deftypefn  {Function File} {@var{k} =} ellipke (@var{m})
+## @deftypefnx {Function File} {@var{k} =} ellipke (@var{m}, @var{tol})
 ## @deftypefnx {Function File} {[@var{k}, @var{e}] =} ellipke (@dots{})
-## Compute complete elliptic integral of the first K(@var{m}) and second
+## Compute complete elliptic integrals of the first K(@var{m}) and second
 ## E(@var{m}) kind.
 ##
-## @var{m} is either real array or scalar with 0 @leq{} m @leq{} 1.
+## @var{m} must be a scalar or real array with -Inf @leq{} @var{m} @leq{} 1.
+##
+## The optional input @var{tol} is currently ignored (@sc{matlab} uses this
+## to allow a faster, less accurate approximation).
 ##
-## @var{tol} is currently ignored (@sc{matlab} uses this to allow faster,
-## less accurate approximation).
+## Called with only one output, elliptic integrals of the first kind are
+## returned.
 ##
-## Ref: Abramowitz, Milton and Stegun, Irene A. Handbook of Mathematical
-## Functions, Dover, 1965, Chapter 17.
+## Reference: Milton Abramowitz and Irene A. Stegun,
+## @cite{Handbook of Mathematical Functions}, Chapter 17, Dover, 1965.
 ## @seealso{ellipj}
 ## @end deftypefn
 
@@ -45,73 +48,72 @@
     print_usage ();
   endif
 
-  k = e = zeros (size (m));
   m = m(:);
-  if any (!isreal (m))
-    error ("ellipke must have real m");
-  endif
-  if any (m > 1)
-    error ("ellipke must have m <= 1");
+  if (! isreal (m))
+    error ("ellipke: M must be real");
+  elseif (any (m > 1))
+    error ("ellipke: M must be <= 1");
   endif
 
-  Nmax = 16;
-  idx = find (m == 1);
-  if (!isempty (idx))
-    k(idx) = Inf;
-    e(idx) = 1;
-  endif
+  k = e = zeros (size (m));
 
-  idx = find (m == -Inf);
-  if (!isempty (idx))
-    k(idx) = 0;
-    e(idx) = Inf;
-  endif
+  ## Handle extreme values
+  idx_1 = (m == 1);
+  k(idx_1) = Inf;
+  e(idx_1) = 1;
+
+  idx_neginf = (m == -Inf);
+  k(idx_neginf) = 0;
+  e(idx_neginf) = Inf;
 
   ## Arithmetic-Geometric Mean (AGM) algorithm
   ## ( Abramowitz and Stegun, Section 17.6 )
-  idx = find (m != 1 & m != -Inf);
-  if (!isempty (idx))
-    idx_neg = find (m < 0 & m != -Inf);
+  Nmax = 16;
+  idx = !idx_1 & !idx_neginf;
+  if (any (idx))
+    idx_neg = find (m < 0 & !idx_neginf);
     mult_k = 1./sqrt (1 - m(idx_neg));
     mult_e = sqrt (1 - m(idx_neg));
-    m(idx_neg) = -m(idx_neg)./(1 - m(idx_neg));
-    a = ones (length (idx), 1);
+    m(idx_neg) = -m(idx_neg) ./ (1 - m(idx_neg));
+    a = ones (sum (idx), 1);
     b = sqrt (1 - m(idx));
     c = sqrt (m(idx));
     f = 0.5;
-    sum = f*c.*c;
-    for n = 2:Nmax
+    sum = f*c.^2;
+    n = 2;
+    do
       t = (a + b)/2;
       c = (a - b)/2;
       b = sqrt (a.*b);
       a = t;
-      f = f * 2;
-      sum = sum + f*c.*c;
-      if (all (c./a < eps)) break; endif
-    endfor
-    if (n >= Nmax) error ("ellipke: not enough workspace"); endif
-    k(idx) = 0.5*pi./a;
-    e(idx) = 0.5*pi.*(1 - sum)./a;
-    k(idx_neg) = mult_k.*k(idx_neg);
-    e(idx_neg) = mult_e.*e(idx_neg);
+      f *= 2;
+      sum += f*c.^2;
+    until (all (c./a < eps) || (++n > Nmax))
+    if (n >= Nmax)
+      error ("ellipke: algorithm did not converge in %d iterations", Nmax);
+    endif
+    k(idx) = 0.5*pi ./ a;
+    e(idx) = 0.5*pi*(1 - sum) ./ a;
+    k(idx_neg) = mult_k .* k(idx_neg);
+    e(idx_neg) = mult_e .* e(idx_neg);
   endif
 
 endfunction
 
-%% Test complete elliptic functions of first and second kind
-%% against "exact" solution from Mathematica 3.0
+
+## Test complete elliptic functions of first and second kind
+## against "exact" solution from Mathematica 3.0
 %!test
-%! m = [0.0; 0.01; 0.1; 0.5; 0.9; 0.99; 1.0 ];
+%! m = [0.0; 0.01; 0.1; 0.5; 0.9; 0.99; 1.0];
 %! [k,e] = ellipke (m);
 %!
-%! # K(1.0) is really infinity - see below
 %! k_exp = [1.5707963267948966192;
 %!          1.5747455615173559527;
 %!          1.6124413487202193982;
 %!          1.8540746773013719184;
 %!          2.5780921133481731882;
 %!          3.6956373629898746778;
-%!          0.0 ];
+%!          Inf ];
 %! e_exp = [1.5707963267948966192;
 %!          1.5668619420216682912;
 %!          1.5307576368977632025;
@@ -119,11 +121,10 @@
 %!          1.1047747327040733261;
 %!          1.0159935450252239356;
 %!          1.0 ];
-%! if k(7)==Inf, k(7)=0; endif;
 %! assert (k, k_exp, 8*eps);
 %! assert (e, e_exp, 8*eps);
 
-%% Test against A&S Table 17.1
+## Test against A&S Table 17.1
 %!test
 %! m = [0:5:50]'/100;
 %! k_exp = [1.570796326794897;
@@ -152,6 +153,26 @@
 %! assert (k, k_exp, 1e-15);
 %! assert (e, e_exp, 1e-8);
 
-%% Test input validation
+## Test negative values against "exact" solution from Mathematica.
+%! m = [-0.01; -1; -5; -100; -1000; -Inf];
+%! [k,e] = ellipke (m);
+%!
+%! k_exp = [1.5668912730681963584;
+%!          1.3110287771460599052;
+%!          0.9555039270640439337;
+%!          0.3682192486091410329;
+%!          0.1530293349884987857;
+%!          0];
+%! e_exp = [1.5747159850169884130;
+%!          1.9100988945138560089;
+%!          2.8301982463458773125;
+%!          10.209260919814572009;
+%!          31.707204053711259719;
+%!          Inf ];
+%! assert (k, k_exp, 8*eps);
+%! assert (e, e_exp, 8*eps (e_exp));
+
+## Test input validation
 %!error ellipke ()
 %!error ellipke (1,2,3)
+
--- a/scripts/specfun/expint.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/expint.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,25 +20,55 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} expint (@var{x})
-## Compute the exponential integral,
+## Compute the exponential integral:
 ## @tex
 ## $$
-##  E_1 (x) = \int_x^\infty {e^{-t} \over t} dt.
+## {\rm E_1} (x) = \int_x^\infty {e^{-t} \over t} dt
 ## $$
 ## @end tex
 ## @ifnottex
 ##
 ## @example
 ## @group
-##               infinity
-##              /
-## expint (x) = | exp (-t)/t dt
-##              /
-##             x
+##            infinity
+##           /
+## E_1 (x) = | exp (-t)/t dt
+##           /
+##          x
 ## @end group
 ## @end example
 ##
 ## @end ifnottex
+## Note: For compatibility, this functions uses the @sc{matlab} definition
+## of the exponential integral.  Most other sources refer to this particular
+## value as @math{E_1 (x)}, and the exponential integral is
+## @tex
+## $$
+## {\rm Ei} (x) = - \int_{-x}^\infty {e^{-t} \over t} dt.
+## $$
+## @end tex
+## @ifnottex
+##
+## @example
+## @group
+##             infinity
+##            /
+## Ei (x) = - | exp (-t)/t dt
+##            /
+##          -x
+## @end group
+## @end example
+##
+## @end ifnottex
+## The two definitions are related, for positive real values of @var{x}, by
+## @tex
+## $
+## E_1 (-x) = -{\rm Ei} (x) - i\pi.
+## $
+## @end tex
+## @ifnottex
+## @w{@code{E_1 (-x) = -Ei (x) - i*pi}}.
+## @end ifnottex
 ## @end deftypefn
 
 function y = expint (x)
@@ -47,98 +77,85 @@
     print_usage ();
   endif
 
-  y = expint_E1 (x);
-
-endfunction
+  y = x;  # Copy over all values, including NaNs
 
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{y} =} expint_E1 (@var{x})
-## Compute the exponential integral,
-## @verbatim
-##                    infinity
-##                   /
-##       expint(x) = | exp(-t)/t dt
-##                   /
-##                  x
-## @end verbatim
-## @end deftypefn
-
-function y = expint_E1 (x)
+  if (isreal (x))
+    idx = (x >= 0);
+    y(idx) = -expint_Ei (-x(idx));
 
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  y = x;
-
-  idx = (imag (x) > 0 & imag (x) != 0);
-  y(idx) = -expint_Ei (-y(idx)) - i.*pi;
+    idx = (x < 0);
+    y(idx) = -expint_Ei (-x(idx)) - i*pi;
+  else
+    idx = (imag (x) > 0);
+    y(idx) = -expint_Ei (-x(idx)) - i*pi;
 
-  idx = (imag (x) < 0 & imag (x) != 0);
-  y(idx) = -expint_Ei (-y(idx)) + i.*pi;
+    idx = (imag (x) < 0);
+    y(idx) = -expint_Ei (-x(idx)) + i*pi;
 
-  idx = (real (x) >= 0 & imag (x) == 0);
-  y(idx) = -expint_Ei (-y(idx));
+    isreal_idx = (imag (x) == 0);
+    idx = (isreal_idx & real (x) >= 0);
+    y(idx) = -expint_Ei (-x(idx));
 
-  idx = (real (x) < 0 & imag (x) == 0);
-  y(idx) = -expint_Ei (-y(idx)) - i.*pi;
+    idx = (isreal_idx & real (x) < 0);
+    y(idx) = -expint_Ei (-x(idx)) - i*pi;
+  endif
 
 endfunction
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {@var{y} =} expint_Ei (@var{x})
-## Compute the exponential integral,
+## Compute the exponential integral:
 ## @verbatim
-##                      infinity
-##                     /
-##    expint_Ei(x) = - | exp(t)/t dt
-##                     /
-##                     -x
+##                       infinity
+##                      /
+##    expint_Ei (x) = - | exp(-t)/t dt
+##                      /
+##                    -x
 ## @end verbatim
 ## @end deftypefn
 
 function y = expint_Ei (x)
 
-  if (nargin != 1)
-    print_usage ();
-  endif
-
   y = zeros (size (x));
   F = @(x) exp (-x)./x;
-  s = prod (size (x));
 
-  for t = 1:s;
-    if (x(t) < 0 && imag (x(t)) == 0)
-      y(t) = -quad (F, -x(t), Inf);
+  for t = 1:numel (x)
+    xt = x(t);
+    if (xt < 0 && imag (xt) == 0)
+      ## Direct integration for most real inputs
+      y(t) = -quad (F, -xt, Inf, [0, 1e-10]);
+    elseif (xt > 2 && imag (xt) == 0)
+      persistent Ei_2 = 4.954234356001890;
+      y(t) = Ei_2 - quad (F, -xt, -2);
+    elseif (abs (xt) < 10)
+      ## Series Expansion for real (range [0,2]) or complex inputs (r < 10)
+      k = 1;
+      do
+        term = xt^k / (k*factorial (k));
+        y(t) += term;
+      until (abs (term) < eps (abs (y(t))) / 2 || k++ >= 100)
+      y(t) = 0.57721566490153286 + log (xt) + y(t);
     else
-      if (abs (x(t)) > 2 && imag (x(t)) == 0)
-        y(t) = expint_Ei (2) - quad (F, -x(t), -2);
+      ## FIXME: This expansion is accurate to only 1e-13 at the beginning
+      ##        near 10+i, although it becomes more accurate as the magnitude
+      ##        of xt grows.
+      if (imag (xt) <= 0)
+        persistent a1 = 4.03640;
+        persistent a2 = 1.15198;
+        persistent b1 = 5.03637;
+        persistent b2 = 4.19160;
+        y(t) = -(xt^2 - a1*xt + a2) ...
+               / ((xt^2 - b1*xt + b2) * (-xt) * exp (-xt)) ...
+               - i*pi;
       else
-        if (abs (x(t)) >= 10)
-          if (imag (x(t)) <= 0)
-            a1 = 4.03640;
-            a2 = 1.15198;
-            b1 = 5.03637;
-            b2 = 4.19160;
-            y(t) = -(x(t).^2 - a1.*x(t) + a2) ...
-                   ./ ((x(t).^2 - b1.*x(t) + b2) .* (-x(t)) .* exp (-x(t))) ...
-                   - i.*pi;
-          else
-            y(t) = conj (expint_Ei (conj (x(t))));
-          endif;
-        ## Serie Expansion
-        else
-          for k = 1:100;
-            y(t) = y(t) + x(t).^k ./ (k.*factorial (k));
-          endfor
-          y(t) = 0.577215664901532860606512090082402431 + log (x(t)) + y(t);
-        endif
-      endif
+        y(t) = conj (expint_Ei (conj (xt)));
+      endif;
     endif
   endfor
 endfunction
 
-%% Test against A&S Table 5.1
+
+## Test against A&S Table 5.1
 %!test
 %! x = [5:5:50]'/100;
 %! gamma = 0.5772156649;
@@ -198,6 +215,52 @@
 %! y = expint (x);
 %! assert (y, y_exp, 1e-9);
 
-%% Test input validation
+## Series expansion (-2 < x < 0)
+## Expected values from Mathematica
+%!test  
+%! x = [-0.1; -0.5; -1; -1.5; -2];
+%! y_exp = [ 1.6228128139692767  - i*pi;
+%!          -0.45421990486317358 - i*pi;
+%!          -1.8951178163559368  - i*pi;
+%!          -3.3012854491297978  - i*pi;
+%!          -4.9542343560018902  - i*pi];
+%! y = expint (x);
+%! assert (y, y_exp, eps (real (y_exp)));
+
+## (x < -2, x real)
+%!test  
+%! x = [-2.5; -3; -10;-15; -25];
+%! y_exp = [-7.0737658945786007   - i*pi;
+%!          -9.9338325706254165   - i*pi;
+%!          -2492.2289762418777   - i*pi;
+%!          -234955.85249076830   - i*pi;
+%!          -3.0059509065255486e9 - i*pi];
+%! y = expint (x);
+%! assert (y, y_exp, 8*eps (real (y_exp)));
+
+## Complex values
+%!test
+%! x = [i; -1-i; 10-i; 10+i];
+%! y_exp = [-0.33740392290096813   - i*0.62471325642771360;
+%!          -1.7646259855638540    + i*0.75382280207927082;
+%!          1.90746381979783120e-6 + i*3.67354374003294739e-6;
+%!          1.90746381979783120e-6 - i*3.67354374003294739e-6];
+%! y = expint (x);
+%! assert (y, y_exp, 1e-12);
+
+## Exceptional values (-Inf, Inf, NaN, 0, 0.37250741078)
+%!test  
+%! x = [-Inf; Inf; NaN; 0; -0.3725074107813668];
+%! y_exp = [-Inf - i*pi;
+%!          -Inf;  # should be 0;
+%!          NaN;
+%!          Inf;
+%!          0 - i*pi];
+%! y = expint (x);
+%! assert (y, y_exp, 5*eps);
+
+## Test input validation
 %!error expint ()
 %!error expint (1,2)
+
+
--- a/scripts/specfun/legendre.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/legendre.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,12 +22,12 @@
 ## @deftypefnx {Function File} {@var{l} =} legendre (@var{n}, @var{x}, @var{normalization})
 ## Compute the Legendre function of degree @var{n} and order
 ## @var{m} = 0 @dots{} N@.  The optional argument, @var{normalization},
-## may be one of @code{"unnorm"}, @code{"sch"}, or @code{"norm"}.
-## The default is @code{"unnorm"}.  The value of @var{n} must be a
+## may be one of @qcode{"unnorm"}, @qcode{"sch"}, or @qcode{"norm"}.
+## The default is @qcode{"unnorm"}.  The value of @var{n} must be a
 ## non-negative scalar integer.
 ##
 ## If the optional argument @var{normalization} is missing or is
-## @code{"unnorm"}, compute the Legendre function of degree @var{n} and
+## @qcode{"unnorm"}, compute the Legendre function of degree @var{n} and
 ## order @var{m} and return all values for @var{m} = 0 @dots{} @var{n}.
 ## The return value has one dimension more than @var{x}.
 ##
@@ -84,7 +84,7 @@
 ## @end group
 ## @end example
 ##
-## If the optional argument @code{normalization} is @code{"sch"},
+## If the optional argument @code{normalization} is @qcode{"sch"},
 ## compute the Schmidt semi-normalized associated Legendre function.
 ## The Schmidt semi-normalized associated Legendre function is related
 ## to the unnormalized Legendre functions by the following:
@@ -127,7 +127,7 @@
 ##
 ## @end ifnottex
 ##
-## If the optional argument @var{normalization} is @code{"norm"},
+## If the optional argument @var{normalization} is @qcode{"norm"},
 ## compute the fully normalized associated Legendre function.
 ## The fully normalized associated Legendre function is related
 ## to the unnormalized Legendre functions by the following:
--- a/scripts/specfun/perms.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/specfun/perms.m	Sat Oct 05 11:22:09 2013 -0400
@@ -42,7 +42,7 @@
   if (nargin != 1)
     print_usage ();
   endif
-  vidx = [1:length(v)]';
+  vidx = uint8 ([1:length(v)]');
   n = length (vidx);
 
   if (n == 0)
@@ -51,7 +51,7 @@
     p = vidx(1);
     for j = 2:n
       B = p;
-      p = zeros (prod (2:j), n);
+      p = zeros (prod (2:j), n, "uint8");
       k = rows (B);
       idx = 1:k;
       for i = j:-1:1
--- a/scripts/special-matrix/gallery.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/special-matrix/gallery.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,7 +22,6 @@
 ## @deftypefnx {Function File} {} gallery (@var{name}, @var{args})
 ## Create interesting matrices for testing.
 ##
-##
 ## @end deftypefn
 ##
 ## @deftypefn  {Function File} {@var{c} =} gallery ("cauchy", @var{x})
@@ -146,6 +145,29 @@
 ##
 ## @end deftypefn
 ##
+## @deftypefn  {Function File} {@var{a} =} gallery ("integerdata", @var{imax}, [@var{M} @var{N} @dots{}], @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("integerdata", @var{imax}, @var{M}, @var{N}, @dots{}, @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("integerdata", [@var{imin}, @var{imax}], [@var{M} @var{N} @dots{}], @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("integerdata", [@var{imin}, @var{imax}], @var{M}, @var{N}, @dots{}, @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("integerdata", @dots{}, "@var{class}")
+## Create a matrix with random integers in the range [1, @var{imax}].
+## If @var{imin} is given then the integers are in the range
+## [@var{imin}, @var{imax}].
+##
+## The second input is a matrix of dimensions describing the size of the output.
+## The dimensions can also be input as comma-separated arguments.
+##
+## The input @var{j} is an integer index in the range [0, 2^32-1].  The
+## values of the output matrix are always exactly the same
+## (reproducibility) for a given size input and @var{j} index.
+##
+## The final optional argument determines the class of the resulting matrix.
+## Possible values for @var{class}: @qcode{"uint8"}, @qcode{"uint16"},
+## @qcode{"uint32"}, @qcode{"int8"}, @qcode{"int16"}, int32", @qcode{"single"},
+## @qcode{"double"}.  The default is @qcode{"double"}.
+##
+## @end deftypefn
+##
 ## @deftypefn  {Function File} {@var{a} =} gallery ("invhess", @var{x})
 ## @deftypefnx {Function File} {@var{a} =} gallery ("invhess", @var{x}, @var{y})
 ## Create the inverse of an upper Hessenberg matrix.
@@ -226,6 +248,25 @@
 ##
 ## @end deftypefn
 ##
+## @deftypefn  {Function File} {@var{a} =} gallery ("normaldata", [@var{M} @var{N} @dots{}], @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("normaldata", @var{M}, @var{N}, @dots{}, @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("normaldata", @dots{}, "@var{class}")
+## Create a matrix with random samples from the standard normal distribution
+## (mean = 0, std = 1).
+##
+## The first input is a matrix of dimensions describing the size of the output.
+## The dimensions can also be input as comma-separated arguments.
+##
+## The input @var{j} is an integer index in the range [0, 2^32-1].  The
+## values of the output matrix are always exactly the same
+## (reproducibility) for a given size input and @var{j} index.
+##
+## The final optional argument determines the class of the resulting matrix.
+## Possible values for @var{class}: @qcode{"single"}, @qcode{"double"}.
+## The default is @qcode{"double"}.
+##
+## @end deftypefn
+##
 ## @deftypefn  {Function File} {@var{q} =} gallery ("orthog", @var{n})
 ## @deftypefnx {Function File} {@var{q} =} gallery ("orthog", @var{n}, @var{k})
 ## Create orthogonal and nearly orthogonal matrices.
@@ -328,6 +369,25 @@
 ##
 ## @end deftypefn
 ##
+## @deftypefn  {Function File} {@var{a} =} gallery ("uniformdata", [@var{M} @var{N} @dots{}], @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("uniformdata", @var{M}, @var{N}, @dots{}, @var{j})
+## @deftypefnx {Function File} {@var{a} =} gallery ("uniformdata", @dots{}, "@var{class}")
+## Create a matrix with random samples from the standard uniform distribution
+## (range [0,1]).
+##
+## The first input is a matrix of dimensions describing the size of the output.
+## The dimensions can also be input as comma-separated arguments.
+##
+## The input @var{j} is an integer index in the range [0, 2^32-1].  The
+## values of the output matrix are always exactly the same
+## (reproducibility) for a given size input and @var{j} index.
+##
+## The final optional argument determines the class of the resulting matrix.
+## Possible values for @var{class}: @qcode{"single"}, @qcode{"double"}.
+## The default is @qcode{"double"}.
+##
+## @end deftypefn
+##
 ## @deftypefn  {Function File} {@var{a} =} gallery ("wathen", @var{nx}, @var{ny})
 ## @deftypefnx {Function File} {@var{a} =} gallery ("wathen", @var{nx}, @var{ny}, @var{k})
 ## Create the Wathen matrix.
@@ -390,8 +450,7 @@
     case "grcar"      , [varargout{1:n_out}] = grcar       (varargin{:});
     case "hanowa"     , [varargout{1:n_out}] = hanowa      (varargin{:});
     case "house"      , [varargout{1:n_out}] = house       (varargin{:});
-    case "integerdata"
-      error ("gallery: matrix %s not implemented.", name);
+    case "integerdata", [varargout{1:n_out}] = integerdata (varargin{:});
     case "invhess"    , [varargout{1:n_out}] = invhess     (varargin{:});
     case "invol"      , [varargout{1:n_out}] = invol       (varargin{:});
     case "ipjfact"    , [varargout{1:n_out}] = ipjfact     (varargin{:});
@@ -408,8 +467,7 @@
     case "minij"      , [varargout{1:n_out}] = minij       (varargin{:});
     case "moler"      , [varargout{1:n_out}] = moler       (varargin{:});
     case "neumann"    , [varargout{1:n_out}] = neumann     (varargin{:});
-    case "normaldata"
-      error ("gallery: matrix %s not implemented.", name);
+    case "normaldata" , [varargout{1:n_out}] = normaldata  (varargin{:});
     case "orthog"     , [varargout{1:n_out}] = orthog      (varargin{:});
     case "parter"     , [varargout{1:n_out}] = parter      (varargin{:});
     case "pei"        , [varargout{1:n_out}] = pei         (varargin{:});
@@ -434,8 +492,7 @@
     case "toeppen"     , [varargout{1:n_out}] = toeppen     (varargin{:});
     case "tridiag"     , [varargout{1:n_out}] = tridiag     (varargin{:});
     case "triw"        , [varargout{1:n_out}] = triw        (varargin{:});
-    case "uniformdata"
-      error ("gallery: matrix %s not implemented.", name);
+    case "uniformdata" , [varargout{1:n_out}] = uniformdata (varargin{:});
     case "wathen"      , [varargout{1:n_out}] = wathen      (varargin{:});
     case "wilk"        , [varargout{1:n_out}] = wilk        (varargin{:});
     otherwise
@@ -745,7 +802,7 @@
   if (nargin < 1 || nargin > 2)
     error ("gallery: 1 or 2 arguments are required for compar matrix.");
   elseif (! isnumeric (A) || ndims (A) != 2)
-    error ("gallery: A must be a 2D matrix for compar matrix.");
+    error ("gallery: A must be a 2-D matrix for compar matrix.");
   elseif (! isnumeric (k) || ! isscalar (k))
     error ("gallery: K must be a numeric scalar for compar matrix.");
   endif
@@ -1268,6 +1325,48 @@
   endif
 endfunction
 
+function A = integerdata (varargin)
+
+  if (nargin < 3)
+    error ("gallery: At least 3 arguments required for integerdata matrix.");
+  endif
+
+  if (isnumeric (varargin{end}))
+    jidx = varargin{end};
+    svec = [varargin{:}];
+    varargin(end) = [];
+  elseif (ischar (varargin{end}))
+    if (nargin < 4)
+      error (["gallery: CLASS argument requires 4 inputs " ...
+              "for integerdata matrix."]);
+    endif
+    jidx = varargin{end-1};
+    svec = [varargin{1:end-1}];
+    varargin(end-1) = [];
+  else 
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for integerdata matrix"]);
+  endif
+
+  if (! (isnumeric (jidx) && isscalar (jidx)
+         && jidx == fix (jidx)
+         && jidx >= 0 && jidx <= 0xFFFFFFFF))
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for integerdata matrix"]);
+  endif
+
+  ## Save and restore random state.  Initialization done so that reproducible
+  ## data is available from gallery depending on the jidx and size vector.
+  randstate = rand ("state"); 
+  unwind_protect
+    rand ("state", svec);
+    A = randi (varargin{:});
+  unwind_protect_cleanup
+    rand ("state", randstate);
+  end_unwind_protect
+
+endfunction
+
 function A = invhess (x, y)
   ## INVHESS  Inverse of an upper Hessenberg matrix.
   ##          INVHESS(X, Y), where X is an N-vector and Y an N-1 vector,
@@ -1315,7 +1414,7 @@
   x = x(:);
   y = y(:);
 
-  ##  On next line, z = x'; A = z(ones(n,1),:) would be more efficient.
+  ##  FIXME: On next line, z = x'; A = z(ones(n,1),:) would be more efficient.
   A = ones (n, 1) * x';
   for j = 2:n
     A(1:j-1,j) = y(1:j-1);
@@ -1503,16 +1602,16 @@
   if (nargin < 1 || nargin > 2)
     error ("gallery: 1 to 2 arguments are required for lauchli matrix.");
   elseif (! isnumeric (n) || ! isscalar (n) || fix (n) != n)
-    error("gallery: N must be an integer for lauchli matrix.")
+    error ("gallery: N must be an integer for lauchli matrix.")
   elseif (! isscalar (mu))
-    error("gallery: MU must be a scalar for lauchli matrix.")
+    error ("gallery: MU must be a scalar for lauchli matrix.")
   endif
 
-  A = (1:n)'*ones(1,n);
-  A = abs(A - A');
+  A = (1:n)'*ones (1,n);
+  A = abs (A - A');
   A = rho .^ A;
-  if imag(rho)
-    A = conj(tril(A,-1)) + triu(A);
+  if (imag (rho))
+    A = conj (tril (A,-1)) + triu (A);
   endif
 endfunction
 
@@ -1531,7 +1630,7 @@
   if (nargin < 1 || nargin > 3)
     error ("gallery: 1 to 3 arguments are required for krylov matrix.");
   elseif (! isnumeric (A) || ! issquare (A) || ndims (A) != 2)
-    error ("gallery: A must be a square 2D matrix for krylov matrix.");
+    error ("gallery: A must be a square 2-D matrix for krylov matrix.");
   endif
 
   n = length (A);
@@ -1746,6 +1845,47 @@
   A = kron (T, eye (n(2))) + kron (eye (n(2)), T);
 endfunction
 
+function A = normaldata (varargin)
+
+  if (nargin < 2)
+    error ("gallery: At least 2 arguments required for normaldata matrix.");
+  endif
+  if (isnumeric (varargin{end}))
+    jidx = varargin{end};
+    svec = [varargin{:}];
+    varargin(end) = [];
+  elseif (ischar (varargin{end}))
+    if (nargin < 3)
+      error (["gallery: CLASS argument requires 3 inputs " ...
+              "for normaldata matrix."]);
+    endif
+    jidx = varargin{end-1};
+    svec = [varargin{1:end-1}];
+    varargin(end-1) = [];
+  else 
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for normaldata matrix"]);
+  endif
+
+  if (! (isnumeric (jidx) && isscalar (jidx)
+         && jidx == fix (jidx)
+         && jidx >= 0 && jidx <= 0xFFFFFFFF))
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for normaldata matrix"]);
+  endif
+
+  ## Save and restore random state.  Initialization done so that reproducible
+  ## data is available from gallery depending on the jidx and size vector.
+  randstate = randn ("state"); 
+  unwind_protect
+    randn ("state", svec);
+    A = randn (varargin{:});
+  unwind_protect_cleanup
+    randn ("state", randstate);
+  end_unwind_protect
+
+endfunction
+
 function Q = orthog (n, k = 1)
   ## ORTHOG Orthogonal and nearly orthogonal matrices.
   ##        Q = ORTHOG(N, K) selects the K'th type of matrix of order N.
@@ -1809,7 +1949,7 @@
       Q(1,2:n) = ones (1, n-1);
       for i = 2:n
         Q(i,i) = -(i-1);
-      end
+      endfor
       Q = diag (sqrt ([n 1:n-1] .* [1:n])) \ Q;
 
     case (5)
@@ -1928,7 +2068,7 @@
   a(1)   = 2*w;
   a(2:n) = sin (2*pi*w*(1:n-1)) ./ (pi*(1:n-1));
 
-  A = toeplitz(a);
+  A = toeplitz (a);
 endfunction
 
 function H = randhess (x)
@@ -2077,8 +2217,8 @@
   if (p == 1)
     A = randn (m, n);
     A = A / norm (A);
-    return
-  end
+    return;
+  endif
 
   ##  Set up vector sigma of singular values.
   switch (abs (mode))
@@ -2104,7 +2244,7 @@
   ##  Convert to diagonal matrix of singular values.
   if (mode < 0)
     sigma = sigma (p:-1:1);
-  end
+  endif
   sigma = diag (sigma);
 
   if (posdef)
@@ -2112,13 +2252,13 @@
     Q = qmult (p);
     A = Q' * sigma * Q;
     A = (A + A') / 2;  # Ensure matrix is symmetric.
-    return
+    return;
   endif
 
   if (m != n)
     ## Expand to m-by-n diagonal matrix
     sigma(m, n) = 0;
-  end
+  endif
 
   if (kl == 0 && ku == 0)
     ## Diagonal matrix requested - nothing more to do.
@@ -2252,8 +2392,8 @@
     error ("gallery: K must be a numeric scalar for smoke matrix.");
   endif
 
-  w = exp(2*pi*i/n);
-  A = diag( [w.^(1:n-1) 1] ) + diag(ones(n-1,1),1);
+  w = exp (2*pi*i/n);
+  A = diag ( [w.^(1:n-1) 1] ) + diag (ones (n-1,1), 1);
 
   switch (k)
     case (0), A(n,1) = 1;
@@ -2324,7 +2464,7 @@
     error ("gallery: 1 to 6 arguments are required for toeppen matrix.");
   elseif (! isnumeric (n) || ! isscalar (n) || fix (n) != n)
     error ("gallery: N must be a numeric integer for toeppen matrix.");
-  elseif (any (cellfun (@(x) ! isnumeric (x) || ! isscalar (x), {a b c d e})))
+  elseif (any (! cellfun ("isnumeric", {a b c d e})) || any (cellfun ("numel", {a b c d e}) != 1))
     error ("gallery: A, B, C, D and E must be numeric scalars for toeppen matrix.");
   endif
 
@@ -2426,6 +2566,47 @@
   t = tril (eye (m, n) + alpha * triu (ones (m, n), 1), k);
 endfunction
 
+function A = uniformdata (varargin)
+
+  if (nargin < 2)
+    error ("gallery: At least 2 arguments required for uniformdata matrix.");
+  endif
+  if (isnumeric (varargin{end}))
+    jidx = varargin{end};
+    svec = [varargin{:}];
+    varargin(end) = [];
+  elseif (ischar (varargin{end}))
+    if (nargin < 3)
+      error (["gallery: CLASS argument requires 3 inputs " ...
+              "for uniformdata matrix."]);
+    endif
+    jidx = varargin{end-1};
+    svec = [varargin{1:end-1}];
+    varargin(end-1) = [];
+  else 
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for uniformdata matrix"]);
+  endif
+
+  if (! (isnumeric (jidx) && isscalar (jidx)
+         && jidx == fix (jidx)
+         && jidx >= 0 && jidx <= 0xFFFFFFFF))
+    error (["gallery: J must be an integer in the range [0, 2^32-1] " ...
+            "for uniformdata matrix"]);
+  endif
+
+  ## Save and restore random state.  Initialization done so that reproducible
+  ## data is available from gallery depending on the jidx and size vector.
+  randstate = rand ("state"); 
+  unwind_protect
+    rand ("state", svec);
+    A = rand (varargin{:});
+  unwind_protect_cleanup
+    rand ("state", randstate);
+  end_unwind_protect
+
+endfunction
+
 function A = wathen (nx, ny, k = 0)
   ## # WATHEN returns the Wathen matrix.
   ##
@@ -2671,3 +2852,4 @@
     A = A';
   endif
 endfunction
+
--- a/scripts/special-matrix/toeplitz.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/special-matrix/toeplitz.m	Sat Oct 05 11:22:09 2013 -0400
@@ -96,8 +96,8 @@
   endif
 
   if (issparse (c) && issparse (r))
-    c = c(:).';  ## enforce row vector
-    r = r(:).';  ## enforce row vector
+    c = c(:).';  # enforce row vector
+    r = r(:).';  # enforce row vector
     cidx = find (c);
     ridx = find (r);
 
--- a/scripts/startup/__finish__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/startup/__finish__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -40,3 +40,4 @@
 
 ## No test needed for internal helper function.
 %!assert (1)
+
--- a/scripts/statistics/base/mean.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/base/mean.m	Sat Oct 05 11:22:09 2013 -0400
@@ -39,13 +39,13 @@
 ## The following options are recognized:
 ##
 ## @table @asis
-## @item "a"
+## @item @qcode{"a"}
 ## Compute the (ordinary) arithmetic mean.  [default]
 ##
-## @item "g"
+## @item @qcode{"g"}
 ## Compute the geometric mean.
 ##
-## @item "h"
+## @item @qcode{"h"}
 ## Compute the harmonic mean.
 ## @end table
 ##
--- a/scripts/statistics/base/moment.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/base/moment.m	Sat Oct 05 11:22:09 2013 -0400
@@ -45,7 +45,7 @@
 ## Valid options are:
 ##
 ## @table @asis
-## @item "c"
+## @item @qcode{"c"}
 ##   Central Moment.  The moment about the mean defined as
 ## @tex
 ## $$
@@ -62,7 +62,7 @@
 ##
 ## @end ifnottex
 ##
-## @item "a"
+## @item @qcode{"a"}
 ##   Absolute Moment.  The moment about zero ignoring sign defined as
 ## @tex
 ## $$
@@ -79,7 +79,7 @@
 ##
 ## @end ifnottex
 ##
-## @item "ac"
+## @item @qcode{"ac"}
 ##   Absolute Central Moment.  Defined as
 ## @tex
 ## $$
--- a/scripts/statistics/base/qqplot.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/base/qqplot.m	Sat Oct 05 11:22:09 2013 -0400
@@ -97,3 +97,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/distributions/binocdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/binocdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -60,9 +60,9 @@
   k = (x >= 0) & (x < n) & (n == fix (n)) & (p >= 0) & (p <= 1);
   tmp = floor (x(k));
   if (isscalar (n) && isscalar (p))
-    cdf(k) = 1 - betainc (p, tmp + 1, n - tmp);
+    cdf(k) = betainc (1 - p, n - tmp, tmp + 1);
   else
-    cdf(k) = 1 - betainc (p(k), tmp + 1, n(k) - tmp);
+    cdf(k) = betainc (1 .- p(k), n(k) - tmp, tmp + 1);
   endif
 
 endfunction
--- a/scripts/statistics/distributions/geocdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/geocdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,6 +21,9 @@
 ## @deftypefn {Function File} {} geocdf (@var{x}, @var{p})
 ## For each element of @var{x}, compute the cumulative distribution function
 ## (CDF) at @var{x} of the geometric distribution with parameter @var{p}.
+##
+## The geometric distribution models the number of failures (@var{x}-1) of a
+## Bernoulli trial with probability @var{p} before the first success (@var{x}).
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/geoinv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/geoinv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,6 +21,9 @@
 ## @deftypefn {Function File} {} geoinv (@var{x}, @var{p})
 ## For each element of @var{x}, compute the quantile (the inverse of
 ## the CDF) at @var{x} of the geometric distribution with parameter @var{p}.
+##
+## The geometric distribution models the number of failures (@var{x}-1) of a
+## Bernoulli trial with probability @var{p} before the first success (@var{x}).
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/geopdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/geopdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,6 +21,9 @@
 ## @deftypefn {Function File} {} geopdf (@var{x}, @var{p})
 ## For each element of @var{x}, compute the probability density function
 ## (PDF) at @var{x} of the geometric distribution with parameter @var{p}.
+##
+## The geometric distribution models the number of failures (@var{x}-1) of a
+## Bernoulli trial with probability @var{p} before the first success (@var{x}).
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/geornd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/geornd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,6 +33,9 @@
 ## 
 ## If no size arguments are given then the result matrix is the size of
 ## @var{p}.
+##
+## The geometric distribution models the number of failures (@var{x}-1) of a
+## Bernoulli trial with probability @var{p} before the first success (@var{x}).
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/normcdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/normcdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -54,13 +54,13 @@
   endif
 
   if (isscalar (mu) && isscalar (sigma))
-    if (!isinf (mu) && !isnan (mu) && (sigma > 0) && (sigma < Inf))
+    if (isfinite (mu) && (sigma > 0) && (sigma < Inf))
       cdf = stdnormal_cdf ((x - mu) / sigma);
     else
       cdf = NaN (size (x), class (cdf));
     endif
   else
-    k = isinf (mu) | isnan (mu) | !(sigma > 0) | !(sigma < Inf);
+    k = ! isfinite (mu) | !(sigma > 0) | !(sigma < Inf);
     cdf(k) = NaN;
 
     k = ! k;
--- a/scripts/statistics/distributions/norminv.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/norminv.m	Sat Oct 05 11:22:09 2013 -0400
@@ -54,11 +54,11 @@
   endif
 
   if (isscalar (mu) && isscalar (sigma))
-    if (!isinf (mu) && !isnan (mu) && (sigma > 0) && (sigma < Inf))
+    if (isfinite (mu) && (sigma > 0) && (sigma < Inf))
       inv =  mu + sigma * stdnormal_inv (x);
     endif
   else
-    k = !isinf (mu) & !isnan (mu) & (sigma > 0) & (sigma < Inf);
+    k = isfinite (mu) & (sigma > 0) & (sigma < Inf);
     inv(k) = mu(k) + sigma(k) .* stdnormal_inv (x(k));
   endif
 
--- a/scripts/statistics/distributions/normpdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/normpdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -54,7 +54,7 @@
   endif
 
   if (isscalar (mu) && isscalar (sigma))
-    if (!isinf (mu) && !isnan (mu) && (sigma > 0) && (sigma < Inf))
+    if (isfinite (mu) && (sigma > 0) && (sigma < Inf))
       pdf = stdnormal_pdf ((x - mu) / sigma) / sigma;
     else
       pdf = NaN (size (x), class (pdf));
--- a/scripts/statistics/distributions/normrnd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/normrnd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -83,14 +83,14 @@
   endif
 
   if (isscalar (mu) && isscalar (sigma))
-    if (!isnan (mu) && !isinf (mu) && (sigma > 0) && (sigma < Inf))
+    if (isfinite (mu) && (sigma > 0) && (sigma < Inf))
       rnd =  mu + sigma * randn (sz, cls);
     else
       rnd = NaN (sz, cls);
     endif
   else
     rnd = mu + sigma .* randn (sz, cls);
-    k = isnan (mu) | isinf (mu) | !(sigma > 0) | !(sigma < Inf);
+    k = ! isfinite (mu) | !(sigma > 0) | !(sigma < Inf);
     rnd(k) = NaN;
   endif
 
--- a/scripts/statistics/distributions/tcdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/tcdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,3 +1,4 @@
+## Copyright (C) 2013 Julien Bect
 ## Copyright (C) 2012 Rik Wehbring
 ## Copyright (C) 1995-2012 Kurt Hornik
 ##
@@ -51,11 +52,26 @@
   endif
 
   k = !isinf (x) & (n > 0);
+
+  xx = x .^ 2;
+  x_big_abs = (xx > n);
+
+  ## deal with the case "abs(x) big"
+  kk = k & x_big_abs;
   if (isscalar (n))
-    cdf(k) = betainc (1 ./ (1 + x(k) .^ 2 / n), n/2, 1/2) / 2;
+    cdf(kk) = betainc (n ./ (n + xx(kk)), n/2, 1/2) / 2;
   else
-    cdf(k) = betainc (1 ./ (1 + x(k) .^ 2 ./ n(k)), n(k)/2, 1/2) / 2;
+    cdf(kk) = betainc (n(kk) ./ (n(kk) + xx(kk)), n(kk)/2, 1/2) / 2;
   endif
+
+  ## deal with the case "abs(x) small"
+  kk = k & !x_big_abs;
+  if (isscalar (n))
+    cdf(kk) = 0.5 * (1 - betainc (xx(kk) ./ (n + xx(kk)), 1/2, n/2));
+  else
+    cdf(kk) = 0.5 * (1 - betainc (xx(kk) ./ (n(kk) + xx(kk)), 1/2, n(kk)/2));
+  endif
+
   k &= (x > 0);
   if (any (k(:)))
     cdf(k) = 1 - cdf(k);
@@ -92,3 +108,53 @@
 %!error tcdf (i, 2)
 %!error tcdf (2, i)
 
+## Check some reference values
+
+%!shared tol_rel
+%! tol_rel = 10 * eps;
+
+## check accuracy for small positive values
+%!assert (tcdf (10^(-10), 2.5), 0.50000000003618087, -tol_rel)
+%!assert (tcdf (10^(-11), 2.5), 0.50000000000361809, -tol_rel)
+%!assert (tcdf (10^(-12), 2.5), 0.50000000000036181, -tol_rel)
+%!assert (tcdf (10^(-13), 2.5), 0.50000000000003618, -tol_rel)
+%!assert (tcdf (10^(-14), 2.5), 0.50000000000000362, -tol_rel)
+%!assert (tcdf (10^(-15), 2.5), 0.50000000000000036, -tol_rel)
+%!assert (tcdf (10^(-16), 2.5), 0.50000000000000004, -tol_rel)
+
+## check accuracy for large negative values
+%!assert (tcdf (-10^1, 2.5), 2.2207478836537124e-03, -tol_rel)
+%!assert (tcdf (-10^2, 2.5), 7.1916492116661878e-06, -tol_rel)
+%!assert (tcdf (-10^3, 2.5), 2.2747463948307452e-08, -tol_rel)
+%!assert (tcdf (-10^4, 2.5), 7.1933970159922115e-11, -tol_rel)
+%!assert (tcdf (-10^5, 2.5), 2.2747519231756221e-13, -tol_rel)
+
+## # Reference values obtained using Python 2.7.4 and mpmath 0.17
+##
+## from mpmath import *
+##
+## mp.dps = 100
+##
+## def F(x_in, nu_in):
+##     x = mpf(x_in);
+##     nu = mpf(nu_in);
+##     t = nu / (nu + x*x)
+##     a = nu / 2
+##     b = mpf(0.5)
+##     F = betainc(a, b, 0, t, regularized=True) / 2
+##     if (x > 0):
+##         F = 1 - F
+##     return F
+##
+## nu = 2.5
+##
+## for i in range(1, 6):
+##     x = - power(mpf(10), mpf(i))
+##     print "%%!assert (tcdf (-10^%d, 2.5), %s, -eps)" \
+##         % (i, nstr(F(x, nu), 17))
+##
+## for i in range(10, 17):
+##     x = power(mpf(10), -mpf(i))
+##     print "%%!assert (tcdf (10^(-%d), 2.5), %s, -eps)" \
+##         % (i, nstr(F(x, nu), 17))
+
--- a/scripts/statistics/distributions/tpdf.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/tpdf.m	Sat Oct 05 11:22:09 2013 -0400
@@ -53,7 +53,7 @@
   k = isnan (x) | !(n > 0) | !(n < Inf);
   pdf(k) = NaN;
 
-  k = !isinf (x) & !isnan (x) & (n > 0) & (n < Inf);
+  k = isfinite (x) & (n > 0) & (n < Inf);
   if (isscalar (n))
     pdf(k) = (exp (- (n + 1) * log (1 + x(k) .^ 2 / n)/2)
               / (sqrt (n) * beta (n/2, 1/2)));
--- a/scripts/statistics/distributions/wienrnd.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/distributions/wienrnd.m	Sat Oct 05 11:22:09 2013 -0400
@@ -52,3 +52,4 @@
   retval = [((1: n*t)' / n), retval];
 
 endfunction
+
--- a/scripts/statistics/models/logistic_regression.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/models/logistic_regression.m	Sat Oct 05 11:22:09 2013 -0400
@@ -190,3 +190,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/models/private/logistic_regression_derivatives.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/models/private/logistic_regression_derivatives.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,10 +30,6 @@
 
 function [dl, d2l] = logistic_regression_derivatives (x, z, z1, g, g1, p)
 
-  if (nargin != 6)
-    print_usage ();
-  endif
-
   ## first derivative
   v = g .* (1 - g) ./ p; v1 = g1 .* (1 - g1) ./ p;
   dlogp = [(diag (v) * z - diag (v1) * z1), (diag (v - v1) * x)];
@@ -45,3 +41,4 @@
       - dlogp' * dlogp;
 
 endfunction
+
--- a/scripts/statistics/models/private/logistic_regression_likelihood.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/models/private/logistic_regression_likelihood.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,10 +29,6 @@
 
 function [g, g1, p, dev] = logistic_regression_likelihood (y, x, beta, z, z1)
 
-  if (nargin != 5)
-    print_usage ();
-  endif
-
   e = exp ([z, x] * beta); e1 = exp ([z1, x] * beta);
   g = e ./ (1 + e); g1 = e1 ./ (1 + e1);
   g = max (y == max (y), g); g1 = min (y > min (y), g1);
@@ -41,3 +37,4 @@
   dev = -2 * sum (log (p));
 
 endfunction
+
--- a/scripts/statistics/tests/anova.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/anova.m	Sat Oct 05 11:22:09 2013 -0400
@@ -108,3 +108,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/bartlett_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/bartlett_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -65,3 +65,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/chisquare_test_homogeneity.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/chisquare_test_homogeneity.m	Sat Oct 05 11:22:09 2013 -0400
@@ -66,3 +66,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/chisquare_test_independence.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/chisquare_test_independence.m	Sat Oct 05 11:22:09 2013 -0400
@@ -51,3 +51,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/cor_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/cor_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -22,18 +22,18 @@
 ## populations.
 ##
 ## The optional argument string @var{alt} describes the alternative
-## hypothesis, and can be @code{"!="} or @code{"<>"} (non-zero),
-## @code{">"} (greater than 0), or @code{"<"} (less than 0).  The
+## hypothesis, and can be @qcode{"!="} or @qcode{"<>"} (non-zero),
+## @qcode{">"} (greater than 0), or @qcode{"<"} (less than 0).  The
 ## default is the two-sided case.
 ##
 ## The optional argument string @var{method} specifies which
 ## correlation coefficient to use for testing.  If @var{method} is
-## @code{"pearson"} (default), the (usual) Pearson's product moment
+## @qcode{"pearson"} (default), the (usual) Pearson's product moment
 ## correlation coefficient is used.  In this case, the data should come
 ## from a bivariate normal distribution.  Otherwise, the other two
 ## methods offer nonparametric alternatives.  If @var{method} is
-## @code{"kendall"}, then Kendall's rank correlation tau is used.  If
-## @var{method} is @code{"spearman"}, then Spearman's rank correlation
+## @qcode{"kendall"}, then Kendall's rank correlation tau is used.  If
+## @var{method} is @qcode{"spearman"}, then Spearman's rank correlation
 ## rho is used.  Only the first character is necessary.
 ##
 ## The output is a structure with the following elements:
@@ -133,3 +133,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/f_test_regression.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/f_test_regression.m	Sat Oct 05 11:22:09 2013 -0400
@@ -75,3 +75,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/hotelling_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/hotelling_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -70,3 +70,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/hotelling_test_2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/hotelling_test_2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -84,3 +84,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/kolmogorov_smirnov_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/kolmogorov_smirnov_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -36,11 +36,11 @@
 ## that calculates the CDF of distribution @var{dist} exists.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative F
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative F
 ## != G@.  In this case, the test statistic @var{ks} follows a two-sided
-## Kolmogorov-Smirnov distribution.  If @var{alt} is @code{">"}, the
-## one-sided alternative F > G is considered.  Similarly for @code{"<"},
+## Kolmogorov-Smirnov distribution.  If @var{alt} is @qcode{">"}, the
+## one-sided alternative F > G is considered.  Similarly for @qcode{"<"},
 ## the one-sided alternative F > G is considered.  In this case, the
 ## test statistic @var{ks} has a one-sided Kolmogorov-Smirnov
 ## distribution.  The default is the two-sided case.
@@ -121,7 +121,7 @@
 %!error kolmogorov_smirnov_test (1)
 %!error <X must be a vector> kolmogorov_smirnov_test ({}, "unif", 2, 4)
 %!error <no not_a_distcdf or not_a_dist_cdf function found>
-%!  kolmogorov_smirnov_test (1, "not_a_dist");
+%! kolmogorov_smirnov_test (1, "not_a_dist");
 %!error <alternative foo not recognized>
-%!  kolmogorov_smirnov_test (1, "unif", 2, 4, "foo");
+%! kolmogorov_smirnov_test (1, "unif", 2, 4, "foo");
 
--- a/scripts/statistics/tests/kolmogorov_smirnov_test_2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/kolmogorov_smirnov_test_2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,11 +25,11 @@
 ## G.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative F
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative F
 ## != G@.  In this case, the test statistic @var{ks} follows a two-sided
-## Kolmogorov-Smirnov distribution.  If @var{alt} is @code{">"}, the
-## one-sided alternative F > G is considered.  Similarly for @code{"<"},
+## Kolmogorov-Smirnov distribution.  If @var{alt} is @qcode{">"}, the
+## one-sided alternative F > G is considered.  Similarly for @qcode{"<"},
 ## the one-sided alternative F < G is considered.  In this case, the
 ## test statistic @var{ks} has a one-sided Kolmogorov-Smirnov
 ## distribution.  The default is the two-sided case.
@@ -102,3 +102,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/kruskal_wallis_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/kruskal_wallis_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -18,7 +18,7 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {[@var{pval}, @var{k}, @var{df}] =} kruskal_wallis_test (@var{x1}, @dots{})
-## Perform a Kruskal-Wallis one-factor "analysis of variance".
+## Perform a Kruskal-Wallis one-factor analysis of variance.
 ##
 ## Suppose a variable is observed for @var{k} > 1 different groups, and
 ## let @var{x1}, @dots{}, @var{xk} be the corresponding data vectors.
@@ -36,9 +36,10 @@
 ## where @var{sum_ties} is the sum of @var{t}^2 - @var{t} over each group
 ## of ties where @var{t} is the number of ties in the group and @var{n}
 ## is the total number of values in the input data.  For more info on
-## this adjustment see "Use of Ranks in One-Criterion Variance Analysis"
-## in Journal of the American Statistical Association, Vol. 47,
-## No. 260 (Dec 1952) by William H. Kruskal and W. Allen Wallis.
+## this adjustment see William H. Kruskal and W. Allen Wallis,
+## @cite{Use of Ranks in One-Criterion Variance Analysis}, 
+## Journal of the American Statistical Association, Vol. 47,
+## No. 260 (Dec 1952).
 ##
 ## The p-value (1 minus the CDF of this distribution at @var{k}) is
 ## returned in @var{pval}.
@@ -97,3 +98,4 @@
 
 ## Test with ties
 %!assert (abs (kruskal_wallis_test ([86 86], [74]) - 0.157299207050285) < 0.0000000000001)
+
--- a/scripts/statistics/tests/manova.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/manova.m	Sat Oct 05 11:22:09 2013 -0400
@@ -159,3 +159,4 @@
   printf ("\n");
 
 endfunction
+
--- a/scripts/statistics/tests/mcnemar_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/mcnemar_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -63,5 +63,3 @@
 
 endfunction
 
-
-
--- a/scripts/statistics/tests/prop_test_2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/prop_test_2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,10 +25,10 @@
 ## approximately follows a standard normal distribution.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @var{p1} != @var{p2}.  If @var{alt} is @code{">"}, the one-sided
-## alternative @var{p1} > @var{p2} is used.  Similarly for @code{"<"},
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @var{p1} != @var{p2}.  If @var{alt} is @qcode{">"}, the one-sided
+## alternative @var{p1} > @var{p2} is used.  Similarly for @qcode{"<"},
 ## the one-sided alternative @var{p1} < @var{p2} is used.
 ## The default is the two-sided case.
 ##
@@ -78,3 +78,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/run_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/run_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -56,3 +56,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/sign_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/sign_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,12 +25,12 @@
 ## (@var{x} != @var{y})} and @var{p} = 1/2.
 ##
 ## With the optional argument @code{alt}, the alternative of interest
-## can be selected.  If @var{alt} is @code{"!="} or @code{"<>"}, the
+## can be selected.  If @var{alt} is @qcode{"!="} or @qcode{"<>"}, the
 ## null hypothesis is tested against the two-sided alternative PROB
-## (@var{x} < @var{y}) != 1/2.  If @var{alt} is @code{">"}, the
+## (@var{x} < @var{y}) != 1/2.  If @var{alt} is @qcode{">"}, the
 ## one-sided alternative PROB (@var{x} > @var{y}) > 1/2 ("x is
 ## stochastically greater than y") is considered.  Similarly for
-## @code{"<"}, the one-sided alternative PROB (@var{x} > @var{y}) < 1/2
+## @qcode{"<"}, the one-sided alternative PROB (@var{x} > @var{y}) < 1/2
 ## ("x is stochastically less than y") is considered.  The default is
 ## the two-sided case.
 ##
@@ -81,3 +81,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/t_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/t_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,9 +25,9 @@
 ## - 1} degrees of freedom.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @code{">"}, the
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @qcode{">"}, the
 ## one-sided alternative @code{mean (@var{x}) > @var{m}} is considered.
 ## Similarly for @var{"<"}, the one-sided alternative @code{mean
 ## (@var{x}) < @var{m}} is considered.  The default is the two-sided
@@ -81,3 +81,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/t_test_2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/t_test_2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,11 +25,11 @@
 ## freedom.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{mean (@var{x}) != mean (@var{y})}.  If @var{alt} is @code{">"},
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{mean (@var{x}) != mean (@var{y})}.  If @var{alt} is @qcode{">"},
 ## the one-sided alternative @code{mean (@var{x}) > mean (@var{y})} is
-## used.  Similarly for @code{"<"}, the one-sided alternative @code{mean
+## used.  Similarly for @qcode{"<"}, the one-sided alternative @code{mean
 ## (@var{x}) < mean (@var{y})} is used.  The default is the two-sided
 ## case.
 ##
@@ -82,3 +82,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/t_test_regression.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/t_test_regression.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,9 +27,9 @@
 ## If @var{r} is omitted, a value of 0 is assumed.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @nospell{@code{@var{rr} * @var{b} != @var{r}}}.  If @var{alt} is @code{">"},
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @nospell{@code{@var{rr} * @var{b} != @var{r}}}.  If @var{alt} is @qcode{">"},
 ## the one-sided alternative
 ## @nospell{@code{@var{rr} * @var{b} > @var{r}}} is used.  Similarly for
 ## @var{"<"}, the one-sided alternative
@@ -97,3 +97,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/u_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/u_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,11 +25,11 @@
 ## equivalent to the Wilcoxon rank-sum test.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## PROB (@var{x} > @var{y}) != 1/2.  If @var{alt} is @code{">"}, the
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## PROB (@var{x} > @var{y}) != 1/2.  If @var{alt} is @qcode{">"}, the
 ## one-sided alternative PROB (@var{x} > @var{y}) > 1/2 is considered.
-## Similarly for @code{"<"}, the one-sided alternative PROB (@var{x} >
+## Similarly for @qcode{"<"}, the one-sided alternative PROB (@var{x} >
 ## @var{y}) < 1/2 is considered.  The default is the two-sided case.
 ##
 ## The p-value of the test is returned in @var{pval}.
@@ -83,3 +83,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/var_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/var_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,9 +25,9 @@
 ## degrees of freedom.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{var (@var{x}) != var (@var{y})}.  If @var{alt} is @code{">"},
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{var (@var{x}) != var (@var{y})}.  If @var{alt} is @qcode{">"},
 ## the one-sided alternative @code{var (@var{x}) > var (@var{y})} is
 ## used.  Similarly for "<", the one-sided alternative @code{var
 ## (@var{x}) > var (@var{y})} is used.  The default is the two-sided
@@ -78,3 +78,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/welch_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/welch_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,11 +25,11 @@
 ## Student distribution with @var{df} degrees of freedom.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @code{">"}, the
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @qcode{">"}, the
 ## one-sided alternative mean(x) > @var{m} is considered.  Similarly for
-## @code{"<"}, the one-sided alternative mean(x) < @var{m} is
+## @qcode{"<"}, the one-sided alternative mean(x) < @var{m} is
 ## considered.  The default is the two-sided case.
 ##
 ## The p-value of the test is returned in @var{pval}.
@@ -83,3 +83,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/wilcoxon_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/wilcoxon_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,11 +27,11 @@
 ## and thus is invalid for @var{n} @leq{} 25.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## PROB (@var{x} > @var{y}) != 1/2.  If alt is @code{">"}, the one-sided
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## PROB (@var{x} > @var{y}) != 1/2.  If alt is @qcode{">"}, the one-sided
 ## alternative PROB (@var{x} > @var{y}) > 1/2 is considered.  Similarly
-## for @code{"<"}, the one-sided alternative PROB (@var{x} > @var{y}) <
+## for @qcode{"<"}, the one-sided alternative PROB (@var{x} > @var{y}) <
 ## 1/2 is considered.  The default is the two-sided case.
 ##
 ## The p-value of the test is returned in @var{pval}.
@@ -89,3 +89,4 @@
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/z_test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/z_test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,11 +24,11 @@
 ## @var{z} follows a standard normal distribution.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @code{">"}, the
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{mean (@var{x}) != @var{m}}.  If @var{alt} is @qcode{">"}, the
 ## one-sided alternative @code{mean (@var{x}) > @var{m}} is considered.
-## Similarly for @code{"<"}, the one-sided alternative @code{mean
+## Similarly for @qcode{"<"}, the one-sided alternative @code{mean
 ## (@var{x}) < @var{m}} is considered.  The default is the two-sided
 ## case.
 ##
@@ -78,10 +78,11 @@
   endif
 
   if (nargout == 0)
-    s = cstrcat ("Z-test of mean(x) == %g against mean(x) %s %g,\n",
-                 "with known var(x) == %g:\n",
-                 "  pval = %g\n");
+    s = ["Z-test of mean(x) == %g against mean(x) %s %g,\n", ...
+         "with known var(x) == %g:\n",                       ...
+         "  pval = %g\n"];
     printf (s, m, alt, m, v, pval);
   endif
 
 endfunction
+
--- a/scripts/statistics/tests/z_test_2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/statistics/tests/z_test_2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,11 +24,11 @@
 ## statistic @var{z} follows a standard normal distribution.
 ##
 ## With the optional argument string @var{alt}, the alternative of
-## interest can be selected.  If @var{alt} is @code{"!="} or
-## @code{"<>"}, the null is tested against the two-sided alternative
-## @code{mean (@var{x}) != mean (@var{y})}.  If alt is @code{">"}, the
+## interest can be selected.  If @var{alt} is @qcode{"!="} or
+## @qcode{"<>"}, the null is tested against the two-sided alternative
+## @code{mean (@var{x}) != mean (@var{y})}.  If alt is @qcode{">"}, the
 ## one-sided alternative @code{mean (@var{x}) > mean (@var{y})} is used.
-## Similarly for @code{"<"}, the one-sided alternative @code{mean
+## Similarly for @qcode{"<"}, the one-sided alternative @code{mean
 ## (@var{x}) < mean (@var{y})} is used.  The default is the two-sided
 ## case.
 ##
@@ -78,11 +78,12 @@
   endif
 
   if (nargout == 0)
-    s = cstrcat ("Two-sample Z-test of mean(x) == mean(y) against ",
-                 "mean(x) %s mean(y),\n",
-                 "with known var(x) == %g and var(y) == %g:\n",
-                 "  pval = %g\n");
+    s = ["Two-sample Z-test of mean(x) == mean(y) against ", ...
+         "mean(x) %s mean(y),\n",                            ...
+         "with known var(x) == %g and var(y) == %g:\n",      ...
+         "  pval = %g\n"];
     printf (s, alt, v_x, v_y, pval);
   endif
 
 endfunction
+
--- a/scripts/strings/base2dec.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/base2dec.m	Sat Oct 05 11:22:09 2013 -0400
@@ -30,7 +30,7 @@
 ##
 ## If @var{s} is a string matrix, return a column vector with one value per
 ## row of @var{s}.  If a row contains invalid symbols then the
-## corresponding value will be NaN@.  
+## corresponding value will be NaN@.
 ##
 ## If @var{s} is a cell array of strings, return a column vector with one
 ## value per cell element in @var{s}.
--- a/scripts/strings/dec2base.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/dec2base.m	Sat Oct 05 11:22:09 2013 -0400
@@ -62,7 +62,7 @@
     d = cell2mat (d);
   endif
 
-  # Create column vector for algorithm
+  ## Create column vector for algorithm
   if (! iscolumn (d))
     d = d(:);
   endif
--- a/scripts/strings/index.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/index.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,8 +32,8 @@
 ## @end group
 ## @end example
 ##
-## If @var{direction} is @samp{"first"}, return the first element found.
-## If @var{direction} is @samp{"last"}, return the last element found.
+## If @var{direction} is @qcode{"first"}, return the first element found.
+## If @var{direction} is @qcode{"last"}, return the last element found.
 ##
 ## @seealso{find, rindex}
 ## @end deftypefn
--- a/scripts/strings/isstrprop.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/isstrprop.m	Sat Oct 05 11:22:09 2013 -0400
@@ -35,45 +35,45 @@
 ## The second argument @var{prop} must be one of
 ##
 ## @table @asis
-## @item "alpha"
+## @item @qcode{"alpha"}
 ## True for characters that are alphabetic (letters).
 ##
-## @item "alnum"
-## @itemx "alphanum"
+## @item  @qcode{"alnum"}
+## @itemx @qcode{"alphanum"}
 ## True for characters that are alphabetic or digits.
 ##
-## @item "lower"
+## @item @qcode{"lower"}
 ## True for lowercase letters.
 ##
-## @item "upper"
+## @item @qcode{"upper"}
 ## True for uppercase letters.
 ##
-## @item "digit"
+## @item @qcode{"digit"}
 ## True for decimal digits (0-9).
 ##
-## @item "xdigit"
+## @item @qcode{"xdigit"}
 ## True for hexadecimal digits (@nospell{a-fA-F0-9}).
 ##
-## @item "space"
-## @itemx "wspace"
+## @item  @qcode{"space"}
+## @itemx @qcode{"wspace"}
 ## True for whitespace characters (space, formfeed, newline, carriage
 ## return, tab, vertical tab).
 ##
-## @item "punct"
+## @item @qcode{"punct"}
 ## True for punctuation characters (printing characters except space
 ## or letter or digit).
 ##
-## @item "cntrl"
+## @item @qcode{"cntrl"}
 ## True for control characters.
 ##
-## @item "graph"
-## @itemx "graphic"
+## @item  @qcode{"graph"}
+## @itemx @qcode{"graphic"}
 ## True for printing characters except space.
 ##
-## @item "print"
+## @item @qcode{"print"}
 ## True for printing characters including space.
 ##
-## @item "ascii"
+## @item @qcode{"ascii"}
 ## True for characters that are in the range of ASCII encoding.
 ##
 ## @end table
--- a/scripts/strings/mat2str.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/mat2str.m	Sat Oct 05 11:22:09 2013 -0400
@@ -29,7 +29,7 @@
 ## precision of the real part and @code{@var{n}(2)} defines the
 ## precision of the imaginary part.  The default for @var{n} is 15.
 ##
-## If the argument "class" is given then the class of @var{x} is
+## If the argument @qcode{"class"} is given then the class of @var{x} is
 ## included in the string in such a way that @code{eval} will result in the
 ## construction of a matrix of the same class.
 ##
@@ -103,7 +103,7 @@
     endif
   else
     ## Non-scalar X, print brackets
-    fmt = cstrcat (fmt, " ");
+    fmt = [fmt " "];
     if (x_iscomplex)
       t = x.';
       s = sprintf (fmt, [real(t(:))'; imag(t(:))']);
@@ -114,7 +114,7 @@
       s = sprintf (fmt, x.');
     endif
 
-    s = cstrcat ("[", s);
+    s = ["[" s];
     s(end) = "]";
     idx = strfind (s, " ");
     nc = columns (x);
@@ -122,7 +122,7 @@
   endif
 
   if (strcmp ("class", cls))
-    s = cstrcat (class (x), "(", s, ")");
+    s = [class(x) "(" s ")"];
   endif
 
 endfunction
--- a/scripts/strings/regexptranslate.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/regexptranslate.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## values
 ##
 ## @table @asis
-## @item "wildcard"
+## @item @qcode{"wildcard"}
 ## The wildcard characters @code{.}, @code{*}, and @code{?} are replaced
 ## with wildcards that are appropriate for a regular expression.
 ## For example:
@@ -36,7 +36,7 @@
 ## @end group
 ## @end example
 ##
-## @item "escape"
+## @item @qcode{"escape"}
 ## The characters @code{$.?[]}, that have special meaning for regular
 ## expressions are escaped so that they are treated literally.  For example:
 ##
--- a/scripts/strings/rindex.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/rindex.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,7 +32,7 @@
 ## @end example
 ##
 ## The @code{rindex} function is equivalent to @code{index} with
-## @var{direction} set to @samp{"last"}.
+## @var{direction} set to @qcode{"last"}.
 ##
 ## @seealso{find, index}
 ## @end deftypefn
--- a/scripts/strings/str2num.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/str2num.m	Sat Oct 05 11:22:09 2013 -0400
@@ -42,7 +42,7 @@
 ## in the string @var{s}.  Use @code{str2double} for a safer and faster
 ## conversion.
 ##
-## For cell array of strings use @code{str2double}.  
+## For cell array of strings use @code{str2double}.
 ## @seealso{str2double, eval}
 ## @end deftypefn
 
--- a/scripts/strings/strcat.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strcat.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,19 +20,20 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} strcat (@var{s1}, @var{s2}, @dots{})
 ## Return a string containing all the arguments concatenated
-## horizontally.  If the arguments are cells strings,  @code{strcat}
+## horizontally.  If the arguments are cell strings, @code{strcat}
 ## returns a cell string with the individual cells concatenated.
 ## For numerical input, each element is converted to the
-## corresponding ASCII character.  Trailing white space for each of
-## the inputs (@var{s1}, @var{S2}, @dots{}) is eliminated before they
-## are concatenated.
+## corresponding ASCII character.  Trailing white space for any
+## character string input is eliminated before the strings are
+## concatenated.  Note that cell string values do @strong{not} have
+## whitespace trimmed.
 ##
 ## For example:
 ##
 ## @example
 ## @group
 ## strcat ("|", " leading space is preserved", "|")
-##     @result{} | leading space is perserved|
+##     @result{} | leading space is preserved|
 ## @end group
 ## @end example
 ##
@@ -62,12 +63,12 @@
 ##
 ## @example
 ## @group
-## s = @{ "ab"; "cde" @};
+## s = @{ "ab"; "cd " @};
 ## strcat (s, s, s)
 ##     @result{}
 ##         @{
 ##           [1,1] = ababab
-##           [2,1] = cdecdecde
+##           [2,1] = cd cd cd 
 ##         @}
 ## @end group
 ## @end example
@@ -79,45 +80,46 @@
 
 function st = strcat (varargin)
 
-  if (nargin > 0)
-    if (nargin == 1)
-      st = varargin{1};
-    elseif (nargin > 1)
-      ## Convert to cells of strings
-      uo = "uniformoutput";
-      reals = cellfun ("isreal", varargin);
-      if (any (reals))
-        varargin(reals) = cellfun ("char", varargin(reals), uo, false);
-      endif
-      chars = cellfun ("isclass", varargin, "char");
-      allchar = all (chars);
-      varargin(chars) = cellfun ("cellstr", varargin(chars), uo, false);
-      if (! all (cellfun ("isclass", varargin, "cell")))
-        error ("strcat: inputs must be strings or cells of strings");
-      endif
-
-      ## We don't actually need to bring all cells to common size, because
-      ## cellfun can now expand scalar cells.
-      err = common_size (varargin{:});
-
-      if (err)
-        error ("strcat: arguments must be the same size, or be scalars");
-      endif
-
-      ## Cellfun handles everything for us.
-      st = cellfun ("horzcat", varargin{:}, uo, false);
-
-      if (allchar)
-        ## If all inputs were strings, return strings.
-        st = char (st);
-      endif
-    endif
-  else
+  if (nargin == 0)
     print_usage ();
   endif
 
+  if (nargin == 1)
+    st = varargin{1};
+  else
+    ## Convert to cells of strings
+    uo = "uniformoutput";
+    reals = cellfun ("isreal", varargin);
+    if (any (reals))
+      varargin(reals) = cellfun ("char", varargin(reals), uo, false);
+    endif
+    chars = cellfun ("isclass", varargin, "char");
+    allchar = all (chars);
+    varargin(chars) = cellfun ("cellstr", varargin(chars), uo, false);
+    if (! all (cellfun ("isclass", varargin, "cell")))
+      error ("strcat: inputs must be strings or cells of strings");
+    endif
+
+    ## We don't actually need to bring all cells to common size, because
+    ## cellfun can now expand scalar cells.
+    err = common_size (varargin{:});
+
+    if (err)
+      error ("strcat: arguments must be the same size, or be scalars");
+    endif
+
+    ## Cellfun handles everything for us.
+    st = cellfun ("horzcat", varargin{:}, uo, false);
+
+    if (allchar)
+      ## If all inputs were strings, return strings.
+      st = char (st);
+    endif
+  endif
+
 endfunction
 
+
 ## test the dimensionality
 ## 1d
 %!assert (strcat ("ab ", "ab "), "abab")
--- a/scripts/strings/strjoin.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strjoin.m	Sat Oct 05 11:22:09 2013 -0400
@@ -58,13 +58,13 @@
 
   if (numel (cstr) == 1)
     rval = cstr{1};
-    return
+    return;
   endif
 
   if (ischar (delimiter))
     delimiter = do_string_escapes (delimiter);
     delimiter = {delimiter};
-  end
+  endif
  
   num = numel (cstr); 
   if (numel (delimiter) == 1 && num > 1)
@@ -85,6 +85,7 @@
 
 endfunction
 
+
 %!assert (strjoin ({"hello"}, "-"), "hello")
 %!assert (strjoin ({"hello", "world"}), "hello world")
 %!assert (strjoin ({"Octave", "Scilab", "Lush", "Yorick"}, "*"),
@@ -94,3 +95,4 @@
 %!assert (strjoin ({'Octave','Scilab'},'\n'), "Octave\nScilab")
 %!assert (strjoin ({'Octave','Scilab'},{'\n'}), "Octave\\nScilab")
 %!assert (strjoin ({},'foo'), "")
+
--- a/scripts/strings/strjust.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strjust.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,8 +21,8 @@
 ## @deftypefn  {Function File} {} strjust (@var{s})
 ## @deftypefnx {Function File} {} strjust (@var{s}, @var{pos})
 ## Return the text, @var{s}, justified according to @var{pos}, which may
-## be @samp{"left"}, @samp{"center"}, or @samp{"right"}.  If @var{pos}
-## is omitted it defaults to @samp{"right"}.
+## be @qcode{"left"}, @qcode{"center"}, or @qcode{"right"}.  If @var{pos}
+## is omitted it defaults to @qcode{"right"}.
 ##
 ## Null characters are replaced by spaces.  All other character
 ## data are treated as non-white space.
--- a/scripts/strings/strmatch.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strmatch.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,7 +23,7 @@
 ## @deftypefnx {Function File} {} strmatch (@var{s}, @var{A}, "exact")
 ## Return indices of entries of @var{A} which begin with the string @var{s}.
 ## The second argument @var{A} must be a string, character matrix, or a cell
-## array of strings.  If the third argument @code{"exact"} is not given, then
+## array of strings.  If the third argument @qcode{"exact"} is not given, then
 ## @var{s} only needs to match @var{A} up to the length of @var{s}.
 ## Trailing spaces and nulls in @var{s} and @var{A} are ignored when matching.
 ##
@@ -43,7 +43,7 @@
 ## @end example
 ##
 ## @strong{Caution:} @code{strmatch} is scheduled for deprecation.  Use
-## @code{strncmp} (normal case), or @code{strcmp} ("exact" case), or
+## @code{strncmp} (normal case), or @code{strcmp} (@qcode{"exact"} case), or
 ## @code{regexp} in all new code.
 ## @seealso{strfind, findstr, strcmp, strncmp, strcmpi, strncmpi, find}
 ## @end deftypefn
--- a/scripts/strings/strsplit.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strsplit.m	Sat Oct 05 11:22:09 2013 -0400
@@ -159,8 +159,8 @@
     args.delimitertype = "simple";
   endif
 
-  # Save the length of the "delimitertype" parameter
-  length_deltype = numel (args.delimitertype);
+  ## Save the length of the "delimitertype" parameter
+  length_deltype = length (args.delimitertype);
 
   if (nargin == 1 || (nargin > 1 && (islogical (del) || isnumeric (del))))
     if (nargin > 1)
@@ -168,7 +168,7 @@
       args.collapsedelimiters = del;
     endif
     ## Set proper default for the delimiter type
-    if (strncmpi (args.delimitertype, "simple", numel (args.delimitertype)))
+    if (strncmpi (args.delimitertype, "simple", length (args.delimitertype)))
       del = {" ","\f","\n","\r","\t","\v"};
     else
       del = "\\s";
@@ -187,7 +187,7 @@
     else
       del = do_string_escapes (del);
     endif
-    % This is clumsy, but needed for multi-row strings
+    ## This is clumsy, but needed for multi-row strings
     del = regexprep (del, '([^\w])', '\\$1');
   endif
 
@@ -209,6 +209,7 @@
   endif
 endfunction
 
+
 %!shared str
 %! str = "The rain in Spain stays mainly in the plain.";
 % Split on all whitespace.
--- a/scripts/strings/strtok.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/strtok.m	Sat Oct 05 11:22:09 2013 -0400
@@ -211,9 +211,9 @@
 %% Test with TAB, LF, VT, FF, and CR
 %!test
 %! for ch = "\t\n\v\f\r"
-%!   [t, r] = strtok (cstrcat ("beg", ch, "end"));
+%!   [t, r] = strtok (["beg", ch, "end"]);
 %!   assert (t, "beg");
-%!   assert (r, cstrcat (ch, "end"));
+%!   assert (r, [ch, "end"]);
 %! endfor
 
 %% Test input validation
--- a/scripts/strings/untabify.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/untabify.m	Sat Oct 05 11:22:09 2013 -0400
@@ -61,7 +61,7 @@
   if (ischar (t))
     s = replace_tabs (t, tw);
   else
-    s = cellfun (@(str) replace_tabs (str, tw), t, "uniformoutput", false);
+    s = cellfun (@replace_tabs, t, {tw}, "uniformoutput", false);
   endif
 
   if (dblank)
--- a/scripts/strings/validatestring.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/strings/validatestring.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,11 +28,12 @@
 ## cellstr of valid values, then @var{validstr} will be the validated form
 ## of @var{str} where validation is defined as @var{str} being a member
 ## or substring of @var{validstr}.  This is useful for both verifying
-## and expanding short options, such as "r", to their longer forms, such as
-## "red".  If @var{str} is a substring of @var{validstr}, and there are
-## multiple matches, the shortest match will be returned if all matches are
-## substrings of each other.  Otherwise, an error will be raised because the
-## expansion of @var{str} is ambiguous.  All comparisons are case insensitive.
+## and expanding short options, such as @qcode{"r"}, to their longer forms,
+## such as @qcode{"red"}.  If @var{str} is a substring of @var{validstr}, and
+## there are multiple matches, the shortest match will be returned if all
+## matches are substrings of each other.  Otherwise, an error will be raised
+## because the expansion of @var{str} is ambiguous.  All comparisons are case
+## insensitive.
 ##
 ## The additional inputs @var{funcname}, @var{varname}, and @var{position}
 ## are optional and will make any generated validation error message more
@@ -51,7 +52,7 @@
 ##    blue, black
 ## @end group
 ## @end smallexample
-## 
+##
 ## @seealso{strcmp, strcmpi}
 ## @end deftypefn
 
@@ -69,7 +70,7 @@
     position = varargin{end};
     varargin(end) = [];
   endif
-  
+
   funcname = varname = "";
   char_idx = cellfun ("isclass", varargin, "char");
   n_chararg = sum (char_idx);
@@ -111,7 +112,7 @@
     errstr(end:end+1) = ":\n";
   endif
 
-  matches = strncmpi (str, strarray(:), numel (str));
+  matches = strncmpi (str, strarray(:), length (str));
   nmatches = sum (matches);
   if (nmatches == 0)
     error ("validatestring: %s'%s' does not match any of\n%s", errstr, str,
@@ -123,9 +124,9 @@
     ## If true, choose the shortest.  If not, raise an error.
     match_idx = find (matches);
     match_len = cellfun ("length", strarray(match_idx));
-    [min_len, min_idx] = min (match_len); 
+    [min_len, min_idx] = min (match_len);
     short_str = strarray{match_idx(min_idx)};
-    submatch = strncmpi (short_str, strarray(match_idx), min_len);    
+    submatch = strncmpi (short_str, strarray(match_idx), min_len);
     if (all (submatch))
       str = short_str;
     else
--- a/scripts/testfun/__have_feature__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/__have_feature__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,3 +32,4 @@
     retval = false;
   endif
 endfunction
+
--- a/scripts/testfun/__printf_assert__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/__printf_assert__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -25,3 +25,4 @@
   global _assert_printf;
   _assert_printf = cat (2, _assert_printf, sprintf (varargin{:}));
 endfunction
+
--- a/scripts/testfun/__prog_output_assert__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/__prog_output_assert__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,3 +32,4 @@
   endif
   _assert_printf = "";
 endfunction
+
--- a/scripts/testfun/__run_test_suite__.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/__run_test_suite__.m	Sat Oct 05 11:22:09 2013 -0400
@@ -33,15 +33,15 @@
   endif
   global files_with_no_tests = {};
   global files_with_tests = {};
-  ## FIXME -- these names don't really make sense if we are running
-  ## tests for an installed copy of Octave.
+  ## FIXME: These names don't really make sense if we are running
+  ##        tests for an installed copy of Octave.
   global topsrcdir = fcnfiledir;
   global topbuilddir = testsdir;
   pso = page_screen_output ();
   warn_state = warning ("query", "quiet");
   warning ("on", "quiet");
   try
-    page_screen_output (0);
+    page_screen_output (false);
     warning ("off", "Octave:deprecated-function");
     fid = fopen ("fntests.log", "wt");
     if (fid < 0)
@@ -92,9 +92,9 @@
     endif
 
     ## Weed out deprecated and private functions
-    weed_idx = cellfun (@isempty, regexp (files_with_tests, '\bdeprecated\b|\bprivate\b', 'once'));
+    weed_idx = cellfun (@isempty, regexp (files_with_tests, '\<deprecated\>|\<private\>', 'once'));
     files_with_tests = files_with_tests(weed_idx);
-    weed_idx = cellfun (@isempty, regexp (files_with_no_tests, '\bdeprecated\b|\bprivate\b', 'once'));
+    weed_idx = cellfun (@isempty, regexp (files_with_no_tests, '\<deprecated\>|\<private\>', 'once'));
     files_with_no_tests = files_with_no_tests(weed_idx);
 
     report_files_with_no_tests (files_with_tests, files_with_no_tests, ".m");
@@ -103,7 +103,7 @@
     puts ("these files (see the list in the file fntests.log).\n\n");
 
     fprintf (fid, "\nFiles with no tests:\n\n%s",
-            list_in_columns (files_with_no_tests, 80));
+                  list_in_columns (files_with_no_tests, 80));
     fclose (fid);
 
     page_screen_output (pso);
@@ -133,16 +133,17 @@
 
 function retval = has_functions (f)
   n = length (f);
-  if (n > 3 && strcmp (f((end-2):end), ".cc"))
+  if (n > 3 && strcmpi (f((end-2):end), ".cc"))
     fid = fopen (f);
     if (fid >= 0)
       str = fread (fid, "*char")';
       fclose (fid);
-      retval = ! isempty (regexp (str,'^(DEFUN|DEFUN_DLD)\b', 'lineanchors'));
+      retval = ! isempty (regexp (str,'^(DEFUN|DEFUN_DLD)\>',
+                                      'lineanchors', 'once'));
     else
       error ("fopen failed: %s", f);
     endif
-  elseif (n > 2 && strcmp (f((end-1):end), ".m"))
+  elseif (n > 2 && strcmpi (f((end-1):end), ".m"))
     retval = true;
   else
     retval = false;
@@ -154,18 +155,8 @@
   if (fid >= 0)
     str = fread (fid, "*char")';
     fclose (fid);
-    retval = ! isempty (regexp (str, '^%!(assert|error|fail|test|warning)', "lineanchors"));
-  else
-    error ("fopen failed: %s", f);
-  endif
-endfunction
-
-function retval = has_demos (f)
-  fid = fopen (f);
-  if (fid >= 0)
-    str = fread (fid, "*char")';
-    fclose (fid);
-    retval = ! isempty (regexp (str, '^%!demo', "lineanchors"));
+    retval = ! isempty (regexp (str, '^%!(assert|error|fail|test|warning)',
+                                     'lineanchors', 'once'));
   else
     error ("fopen failed: %s", f);
   endif
@@ -179,9 +170,7 @@
   for i = 1:length (lst)
     nm = lst(i).name;
     if (lst(i).isdir
-        && ! strcmp (nm, ".") && ! strcmp (nm, "..")
-        && ! strcmp (nm, "private") && nm(1) != "@"
-        && ! strcmp (nm, "CVS"))
+        && nm(1) != "." && ! strcmp (nm, "private") && nm(1) != "@")
       [p, n, xf, sk] = run_test_dir (fid, [d, filesep, nm]);
       dp += p;
       dn += n;
@@ -194,7 +183,7 @@
     chdir (d);
     for i = 1:length (lst)
       nm = lst(i).name;
-      if (length (nm) > 4 && strcmp (nm((end-3):end), ".tst"))
+      if (length (nm) > 4 && strcmpi (nm((end-3):end), ".tst"))
         p = n = xf = sk = 0;
         ffnm = fullfile (d, nm);
         if (has_tests (ffnm))
@@ -202,8 +191,6 @@
           [p, n, xf, sk] = test (nm, "quiet", fid);
           print_pass_fail (n, p);
           files_with_tests(end+1) = ffnm;
-        ##elseif (has_demos (ffnm))
-        ##  files_with_tests(end+1) = ffnm;
         else
           files_with_no_tests(end+1) = ffnm;
         endif
@@ -227,8 +214,7 @@
   dp = dn = dxf = dsk = 0;
   for i = 1:length (lst)
     nm = lst(i).name;
-    if (lst(i).isdir && ! strcmp (nm, ".") && ! strcmp (nm, "..")
-        && ! strcmp (nm, "CVS"))
+    if (lst(i).isdir && nm(1) != ".")
       [p, n, xf, sk] = run_test_script (fid, [d, filesep, nm]);
       dp += p;
       dn += n;
@@ -243,12 +229,12 @@
       continue
     endif
     f = fullfile (d, nm);
-    if ((length (nm) > 2 && strcmp (nm((end-1):end), ".m"))
+    if ((length (nm) > 2 && strcmpi (nm((end-1):end), ".m"))
         || (length (nm) > 4
-            && (strcmp (nm((end-3):end), "-tst")
-                || strcmp (nm((end-3):end), ".tst"))))
+            && (   strcmpi (nm((end-3):end), "-tst")
+                || strcmpi (nm((end-3):end), ".tst"))))
       p = n = xf = 0;
-      ## Only run if it contains %!test, %!assert %!error or %!warning
+      ## Only run if it contains %!test, %!assert, %!error, %!fail, or %!warning
       if (has_tests (f))
         tmp = strrep (f, [topsrcdir, filesep], "");
         tmp = strrep (tmp, [topbuilddir, filesep], "");
@@ -260,8 +246,6 @@
         dxf += xf;
         dsk += sk;
         files_with_tests(end+1) = f;
-      ##elseif (has_demos (f))
-      ##  files_with_tests(end+1) = f;
       else
         ## To reduce the list length, only mark .cc files that contain
         ## DEFUN definitions.
@@ -273,13 +257,14 @@
 endfunction
 
 function n = num_elts_matching_pattern (lst, pat)
-  n = sum (cellfun (@(x) !isempty (x), regexp (lst, pat, 'once')));
+  n = sum (! cellfun ("isempty", regexp (lst, pat, 'once')));
 endfunction
 
 function report_files_with_no_tests (with, without, typ)
-  pat = cstrcat ('\', typ, "$");
+  pat = ['\' typ "$"];
   n_with = num_elts_matching_pattern (with, pat);
   n_without = num_elts_matching_pattern (without, pat);
   n_tot = n_with + n_without;
   printf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ);
 endfunction
+
--- a/scripts/testfun/assert.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/assert.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,7 +27,7 @@
 ## be called in three different ways.
 ##
 ## @table @code
-## @item assert (@var{cond})
+## @item  assert (@var{cond})
 ## @itemx assert (@var{cond}, @var{errmsg}, @dots{})
 ## @itemx assert (@var{cond}, @var{msg_id}, @var{errmsg}, @dots{})
 ## Called with a single argument @var{cond}, @code{assert} produces an
@@ -47,38 +47,40 @@
 ## If @var{tol} is negative then it is a relative tolerance which will produce
 ## an error if @code{abs (@var{observed} - @var{expected}) >
 ## abs (@var{tol} * @var{expected})}.  If @var{expected} is zero @var{tol} will
-## always be interpreted as an absolute tolerance.
+## always be interpreted as an absolute tolerance.  If @var{tol} is not scalar
+## its dimensions must agree with those of @var{observed} and @var{expected}
+## and tests are performed on an element-wise basis.
 ## @end table
 ## @seealso{test, fail, error}
 ## @end deftypefn
 
-## FIXME: Output throttling: don't print out the entire 100x100 matrix,
-## but instead give a summary; don't print out the whole list, just
-## say what the first different element is, etc.  To do this, make
-## the message generation type specific.
-
 function assert (cond, varargin)
 
-  in = deblank (argn(1,:));
-  for i = 2:rows (argn)
-    in = cstrcat (in, ",", deblank (argn(i,:)));
-  endfor
-  in = cstrcat ("(", in, ")");
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  persistent call_depth = -1;
+  persistent errmsg;
+
+  call_depth++;
+
+  if (call_depth == 0)
+    errmsg = "";
+  endif
 
   if (nargin == 1 || (nargin > 1 && islogical (cond) && ischar (varargin{1})))
     if ((! isnumeric (cond) && ! islogical (cond)) || ! all (cond(:)))
+      call_depth--;
       if (nargin == 1)
-        ## Say which elements failed?
-        error ("assert %s failed", in);
+        ## Perhaps, say which elements failed?
+        argin = ["(" strjoin(cellstr (argn), ",") ")"];
+        error ("assert %s failed", argin);
       else
         error (varargin{:});
       endif
     endif
   else
-    if (nargin < 2 || nargin > 3)
-      print_usage ();
-    endif
-
     expected = varargin{1};
     if (nargin < 3)
       tol = 0;
@@ -86,42 +88,80 @@
       tol = varargin{2};
     endif
 
-    if (exist ("argn") == 0)
-      argn = " ";
-    endif
-
-    coda = "";
-    iserror = 0;
-
+    ## Add to list as the errors accumulate.  If empty at end then no errors.
+    err.index = {};
+    err.observed = {};
+    err.expected = {};
+    err.reason = {};
 
     if (ischar (expected))
-      iserror = (! ischar (cond) || ! strcmp (cond, expected));
+      if (! ischar (cond))
+        err.index{end+1} = ".";
+        err.expected{end+1} = expected;
+        if (isnumeric (cond))
+          err.observed{end+1} = num2str (cond);
+          err.reason{end+1} = "Expected string, but observed number";
+        else
+          err.observed{end+1} = "O";
+          err.reason{end+1} = ["Expected string, but observed " class(cond)];
+        endif
+      elseif (! strcmp (cond, expected))
+        err.index{end+1} = "[]";
+        err.observed{end+1} = cond;
+        err.expected{end+1} = expected;
+        err.reason{end+1} = "Strings don't match";
+      endif
 
     elseif (iscell (expected))
-      if (! iscell (cond) || any (size (cond) != size (expected)))
-        iserror = 1;
+      if (! iscell (cond))
+        err.index{end+1} = ".";
+        err.observed{end+1} = "O";
+        err.expected{end+1} = "E";
+        err.reason{end+1} = ["Expected cell, but observed " class(cond)];
+      elseif (ndims (cond) != ndims (expected)
+              || any (size (cond) != size (expected)))
+        err.index{end+1} = ".";
+        err.observed{end+1} = ["O(" sprintf("%dx", size(cond))(1:end-1) ")"];
+        err.expected{end+1} = ["E(" sprintf("%dx", size(expected))(1:end-1) ")"];
+        err.reason{end+1} = "Dimensions don't match";
       else
         try
+          ## Recursively compare cell arrays
           for i = 1:length (expected(:))
             assert (cond{i}, expected{i}, tol);
           endfor
         catch
-          iserror = 1;
+          err.index{end+1} = "{}";
+          err.observed{end+1} = "O";
+          err.expected{end+1} = "E";
+          err.reason{end+1} = "Cell configuration error";
         end_try_catch
       endif
 
     elseif (isstruct (expected))
-      if (! isstruct (cond) || any (size (cond) != size (expected))
-          || rows (fieldnames (cond)) != rows (fieldnames (expected)))
-        iserror = 1;
+      if (! isstruct (cond))
+        err.index{end+1} = ".";
+        err.observed{end+1} = "O";
+        err.expected{end+1} = "E";
+        err.reason{end+1} = ["Expected struct, but observed " class(cond)];
+      elseif (ndims (cond) != ndims (expected)
+              || any (size (cond) != size (expected))
+              || rows (fieldnames (cond)) != rows (fieldnames (expected)))
+
+        err.index{end+1} = ".";
+        err.observed{end+1} = ["O(" sprintf("%dx", size(cond))(1:end-1) ")"];
+        err.expected{end+1} = ["E(" sprintf("%dx", size(expected))(1:end-1) ")"];
+        err.reason{end+1} = "Structure sizes don't match";
       else
         try
-          #empty = numel (cond) == 0;
           empty = isempty (cond);
           normal = (numel (cond) == 1);
           for [v, k] = cond
             if (! isfield (expected, k))
-              error ();
+              err.index{end+1} = ".";
+              err.observed{end+1} = "O";
+              err.expected{end+1} = "E";
+              err.reason{end+1} = ["'" k "'" " is not an expected field"];
             endif
             if (empty)
               v = {};
@@ -130,109 +170,210 @@
             else
               v = v(:)';
             endif
+            ## Recursively call assert for struct array values
             assert (v, {expected.(k)}, tol);
           endfor
         catch
-          iserror = 1;
+          err.index{end+1} = ".";
+          err.observed{end+1} = "O";
+          err.expected{end+1} = "E";
+          err.reason{end+1} = "Structure configuration error";
         end_try_catch
       endif
 
     elseif (ndims (cond) != ndims (expected)
             || any (size (cond) != size (expected)))
-      iserror = 1;
-      coda = "Dimensions don't match";
+      err.index{end+1} = ".";
+      err.observed{end+1} = ["O(" sprintf("%dx", size(cond))(1:end-1) ")"];
+      err.expected{end+1} = ["E(" sprintf("%dx", size(expected))(1:end-1) ")"];
+      err.reason{end+1} = "Dimensions don't match";
 
-    else
+    else  # Numeric comparison
       if (nargin < 3)
         ## Without explicit tolerance, be more strict.
         if (! strcmp (class (cond), class (expected)))
-          iserror = 1;
-          coda = cstrcat ("Class ", class (cond), " != ", class (expected));
+          err.index{end+1} = "()";
+          err.observed{end+1} = "O";
+          err.expected{end+1} = "E";
+          err.reason{end+1} = ["Class " class(cond) " != " class(expected)];
         elseif (isnumeric (cond))
           if (issparse (cond) != issparse (expected))
+            err.index{end+1} = "()";
+            err.observed{end+1} = "O";
+            err.expected{end+1} = "E";
             if (issparse (cond))
-              iserror = 1;
-              coda = "sparse != non-sparse";
+              err.reason{end+1} = "sparse != non-sparse";
             else
-              iserror = 1;
-              coda = "non-sparse != sparse";
+              err.reason{end+1} = "non-sparse != sparse";
             endif
           elseif (iscomplex (cond) != iscomplex (expected))
-            if (iscomplex (cond))
-              iserror = 1;
-              coda = "complex != real";
+            err.index{end+1} = "()";
+            err.observed{end+1} = "O";
+            err.expected{end+1} = "E";
+           if (iscomplex (cond))
+              err.reason{end+1} = "complex != real";
             else
-              iserror = 1;
-              coda = "real != complex";
+              err.reason{end+1} = "real != complex";
             endif
           endif
         endif
       endif
 
-      if (! iserror)
-        ## Numeric.
-        A = cond(:);
-        B = expected(:);
+      if (isempty (err.index))
+
+        A = cond;
+        B = expected;
+
         ## Check exceptional values.
-        if (any (isna (A) != isna (B)))
-          iserror = 1;
-          coda = "NAs don't match";
-        elseif (any (isnan (A) != isnan (B)))
-          iserror = 1;
-          coda = "NaNs don't match";
-          ## Try to avoid problems comparing strange values like Inf+NaNi.
-        elseif (any (isinf (A) != isinf (B))
-                || any (A(isinf (A) & ! isnan (A)) != B(isinf (B) & ! isnan (B))))
-          iserror = 1;
-          coda = "Infs don't match";
+        errvec = (  isna (real (A)) != isna (real (B))
+                  | isna (imag (A)) != isna (imag (B)));
+        erridx = find (errvec);
+        if (! isempty (erridx))
+          err.index(end+1:end+length (erridx)) = ...
+            ind2tuple (size (A), erridx);
+          err.observed(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (A(erridx) (:))));
+          err.expected(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (B(erridx) (:))));
+          err.reason(end+1:end+length (erridx)) = ...
+            repmat ({"'NA' mismatch"}, length (erridx), 1);
+        endif
+        errseen = errvec;
+
+        errvec = (  isnan (real (A)) != isnan (real (B))
+                  | isnan (imag (A)) != isnan (imag (B)));
+        erridx = find (errvec & !errseen);
+        if (! isempty (erridx))
+          err.index(end+1:end+length (erridx)) = ...
+            ind2tuple (size (A), erridx);
+          err.observed(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (A(erridx) (:))));
+          err.expected(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (B(erridx) (:))));
+          err.reason(end+1:end+length (erridx)) = ...
+            repmat ({"'NaN' mismatch"}, length (erridx), 1);
+        endif
+        errseen |= errvec;
+
+        errvec =   ((isinf (real (A)) | isinf (real (B))) ...
+                    & (real (A) != real (B)))             ...
+                 | ((isinf (imag (A)) | isinf (imag (B))) ...
+                    & (imag (A) != imag (B)));
+        erridx = find (errvec & !errseen);
+        if (! isempty (erridx))
+          err.index(end+1:end+length (erridx)) = ...
+            ind2tuple (size (A), erridx);
+          err.observed(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (A(erridx) (:))));
+          err.expected(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (B(erridx) (:))));
+          err.reason(end+1:end+length (erridx)) = ...
+            repmat ({"'Inf' mismatch"}, length (erridx), 1);
+        endif
+        errseen |= errvec;
+
+        ## Check normal values.
+        ## Replace exceptional values already checked above by zero.
+        A_null_real = real (A);
+        B_null_real = real (B);
+        exclude = errseen | ! isfinite (A_null_real) & ! isfinite (B_null_real);
+        A_null_real(exclude) = 0;
+        B_null_real(exclude) = 0;
+        A_null_imag = imag (A);
+        B_null_imag = imag (B);
+        exclude = errseen | ! isfinite (A_null_imag) & ! isfinite (B_null_imag);
+        A_null_imag(exclude) = 0;
+        B_null_imag(exclude) = 0;
+        A_null = complex (A_null_real, A_null_imag);
+        B_null = complex (B_null_real, B_null_imag);
+        if (isscalar (tol))
+          mtol = tol * ones (size (A));
         else
-          ## Check normal values.
-          A = A(isfinite (A));
-          B = B(isfinite (B));
-          if (tol == 0)
-            err = any (A != B);
-            errtype = "values do not match";
-          elseif (tol >= 0)
-            err = max (abs (A - B));
-            errtype = "maximum absolute error %g exceeds tolerance %g";
-          else
-            abserr = max (abs (A(B == 0)));
-            A = A(B != 0);
-            B = B(B != 0);
-            relerr = max (abs (A - B) ./ abs (B));
-            err = max ([abserr; relerr]);
-            errtype = "maximum relative error %g exceeds tolerance %g";
+          mtol = tol;
+        endif
+
+        k = (mtol == 0);
+        erridx = find ((A_null != B_null) & k);
+        if (! isempty (erridx))
+          err.index(end+1:end+length (erridx)) = ...
+            ind2tuple (size (A), erridx);
+          err.observed(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (A(erridx) (:))));
+          err.expected(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (B(erridx) (:))));
+          err.reason(end+1:end+length (erridx)) = ...
+            ostrsplit (deblank (sprintf ("Abs err %.5g exceeds tol %.5g\n",...
+            [abs(A_null(erridx) - B_null(erridx))(:) mtol(erridx)(:)]')), "\n");
+        endif
+
+        k = (mtol > 0);
+        erridx = find ((abs (A_null - B_null) > mtol) & k);
+        if (! isempty (erridx))
+          err.index(end+1:end+length (erridx)) = ...
+            ind2tuple (size (A), erridx);
+          err.observed(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (A(erridx) (:))));
+          err.expected(end+1:end+length (erridx)) = ...
+            strtrim (cellstr (num2str (B(erridx) (:))));
+          err.reason(end+1:end+length (erridx)) = ...
+            ostrsplit (deblank (sprintf ("Abs err %.5g exceeds tol %.5g\n",...
+            [abs(A_null(erridx) - B_null(erridx))(:) mtol(erridx)(:)]')), "\n");
+        endif
+
+        k = (mtol < 0);
+        if (any (k(:)))
+          ## Test for absolute error where relative error can't be calculated.
+          erridx = find ((B_null == 0) & abs (A_null) > abs (mtol) & k);
+          if (! isempty (erridx))
+            err.index(end+1:end+length (erridx)) = ...
+              ind2tuple (size (A), erridx);
+            err.observed(end+1:end+length (erridx)) = ...
+              strtrim (cellstr (num2str (A(erridx) (:))));
+            err.expected(end+1:end+length (erridx)) = ...
+              strtrim (cellstr (num2str (B(erridx) (:))));
+            err.reason(end+1:end+length (erridx)) = ...
+              ostrsplit (deblank (sprintf ("Abs err %.5g exceeds tol %.5g\n",
+              [abs(A_null(erridx) - B_null(erridx)) -mtol(erridx)]')), "\n");
           endif
-          if (err > abs (tol))
-            iserror = 1;
-            coda = sprintf (errtype, err, abs (tol));
+          ## Test for relative error
+          Bdiv = Inf (size (B_null));
+          Bdiv(k & (B_null != 0)) = B_null(k & (B_null != 0));
+          relerr = abs ((A_null - B_null) ./ abs (Bdiv));
+          erridx = find ((relerr > abs (mtol)) & k);
+          if (! isempty (erridx))
+            err.index(end+1:end+length (erridx)) = ...
+              ind2tuple (size (A), erridx);
+            err.observed(end+1:end+length (erridx)) = ...
+              strtrim (cellstr (num2str (A(erridx) (:))));
+            err.expected(end+1:end+length (erridx)) = ...
+              strtrim (cellstr (num2str (B(erridx) (:))));
+            err.reason(end+1:end+length (erridx)) = ...
+              ostrsplit (deblank (sprintf ("Rel err %.5g exceeds tol %.5g\n",
+              [relerr(erridx)(:) -mtol(erridx)(:)]')), "\n");
           endif
         endif
       endif
 
     endif
 
-    if (! iserror)
-      return;
+    ## Print any errors
+    if (! isempty (err.index))
+      argin = ["(" strjoin(cellstr (argn), ",") ")"];
+      if (! isempty (errmsg))
+        errmsg = [errmsg "\n"];
+      endif
+      errmsg = [errmsg, pprint(argin, err)];
     endif
 
-    ## Pretty print the "expected but got" info, trimming leading and
-    ## trailing "\n".
-    str = disp (expected);
-    idx = find (str != "\n");
-    if (! isempty (idx))
-      str = str(idx(1):idx(end));
+  endif
+
+  call_depth--;
+
+  if (call_depth == -1)
+    ## Last time through.  If there were any errors on any pass, raise a flag.
+    if (! isempty (errmsg))
+      error (errmsg);
     endif
-    str2 = disp (cond);
-    idx = find (str2 != "\n");
-    if (! isempty (idx))
-      str2 = str2 (idx(1):idx(end));
-    endif
-    msg = cstrcat ("assert ", in, " expected\n", str, "\nbut got\n", str2);
-    if (! isempty (coda))
-      msg = cstrcat (msg, "\n", coda);
-    endif
-    error ("%s", msg);
   endif
 
 endfunction
@@ -241,8 +382,8 @@
 ## empty input
 %!assert ([])
 %!assert (zeros (3,0), zeros (3,0))
-%!error assert (zeros (3,0), zeros (0,2))
-%!error assert (zeros (3,0), [])
+%!error <O\(3x0\)\s+E\(0x2\)> assert (zeros (3,0), zeros (0,2))
+%!error <Dimensions don't match> assert (zeros (3,0), [])
 %!error <Dimensions don't match> assert (zeros (2,0,2), zeros (2,0))
 
 ## conditions
@@ -257,67 +398,135 @@
 %!error assert ([1,0;1,1])
 
 ## scalars
-%!error assert (3, [3,3; 3,3])
-%!error assert ([3,3; 3,3], 3)
+%!error <Dimensions don't match> assert (3, [3,3])
+%!error <Dimensions don't match> assert (3, [3,3; 3,3])
+%!error <Dimensions don't match> assert ([3,3; 3,3], 3)
 %!assert (3, 3)
+%!error <Abs err 1 exceeds tol> assert (3, 4)
 %!assert (3+eps, 3, eps)
 %!assert (3, 3+eps, eps)
-%!error assert (3+2*eps, 3, eps)
-%!error assert (3, 3+2*eps, eps)
+%!error <Abs err 4.4409e-16 exceeds tol> assert (3+2*eps, 3, eps)
+%!error <Abs err 4.4409e-16 exceeds tol> assert (3, 3+2*eps, eps)
 
 ## vectors
 %!assert ([1,2,3],[1,2,3]);
 %!assert ([1;2;3],[1;2;3]);
-%!error assert ([2;2;3],[1;2;3]);
-%!error assert ([1,2,3],[1;2;3]);
-%!error assert ([1,2],[1,2,3]);
-%!error assert ([1;2;3],[1;2]);
+%!error <Abs err 1 exceeds tol 0> assert ([2,2,3,3],[1,2,3,4]);
+%!error <Abs err 1 exceeds tol 0.5> assert ([2,2,3,3],[1,2,3,4],0.5);
+%!error <Rel err 1 exceeds tol 0.1> assert ([2,2,3,5],[1,2,3,4],-0.1);
+%!error <Abs err 1 exceeds tol 0> assert ([6;6;7;7],[5;6;7;8]);
+%!error <Abs err 1 exceeds tol 0.5> assert ([6;6;7;7],[5;6;7;8],0.5);
+%!error <Rel err .* exceeds tol 0.1> assert ([6;6;7;7],[5;6;7;8],-0.1);
+%!error <Dimensions don't match> assert ([1,2,3],[1;2;3]);
+%!error <Dimensions don't match> assert ([1,2],[1,2,3]);
+%!error <Dimensions don't match> assert ([1;2;3],[1;2]);
+
+## matrices
 %!assert ([1,2;3,4],[1,2;3,4]);
-%!error assert ([1,4;3,4],[1,2;3,4])
-%!error assert ([1,3;2,4;3,5],[1,2;3,4])
+%!error <\(1,2\)\s+4\s+2> assert ([1,4;3,4],[1,2;3,4])
+%!error <Dimensions don't match> assert ([1,3;2,4;3,5],[1,2;3,4])
+%!test  # 2-D matrix
+%! A = [1 2 3]'*[1,2];
+%! assert (A, A);
+%! fail ("assert (A.*(A!=2),A)");
+%!test  # N-D matrix
+%! X = zeros (2,2,3);
+%! Y = X;
+%! Y(1,2,3) = 1.5;
+%! fail ("assert (X,Y)", "\(1,2,3\).*Abs err 1.5 exceeds tol 0");
 
 ## must give a small tolerance for floating point errors on relative
 %!assert (100+100*eps, 100, -2*eps)
 %!assert (100, 100+100*eps, -2*eps)
-%!error assert (100+300*eps, 100, -2*eps)
-%!error assert (100, 100+300*eps, -2*eps)
-%!error assert (3, [3,3])
-%!error assert (3, 4)
+%!error <Rel err .* exceeds tol> assert (100+300*eps, 100, -2*eps)
+%!error <Rel err .* exceeds tol> assert (100, 100+300*eps, -2*eps)
 
 ## test relative vs. absolute tolerances
-%!test  assert (0.1+eps, 0.1,  2*eps);  # accept absolute
-%!error assert (0.1+eps, 0.1, -2*eps);  # fail relative
-%!test  assert (100+100*eps, 100, -2*eps);  # accept relative
-%!error assert (100+100*eps, 100,  2*eps);  # fail absolute
+%!test  assert (0.1+eps, 0.1,  2*eps);
+%!error <Rel err 2.2204e-15 exceeds tol> assert (0.1+eps, 0.1, -2*eps);
+%!test  assert (100+100*eps, 100, -2*eps);
+%!error <Abs err 2.8422e-14 exceeds tol> assert (100+100*eps, 100,  2*eps);
+
+## Corner case of relative tolerance with 0 divider
+%!error <Abs err 2 exceeds tol 0.1> assert (2, 0, -0.1)
+
+## Extra checking of inputs when tolerance unspecified.
+%!error <Class single != double> assert (single (1), 1)
+%!error <Class uint8 != uint16> assert (uint8 (1), uint16 (1))
+%!error <sparse != non-sparse> assert (sparse([1]), [1])
+%!error <non-sparse != sparse> assert ([1], sparse([1]))
+%!error <complex != real> assert (1+i, 1)
+%!error <real != complex> assert (1, 1+i)
 
 ## exceptional values
 %!assert ([NaN, NA, Inf, -Inf, 1+eps, eps], [NaN, NA, Inf, -Inf, 1, 0], eps)
-%!error assert (NaN, 1)
-%!error assert (NA, 1)
-%!error assert (-Inf, Inf)
+
+%!error <'NaN' mismatch> assert (NaN, 1)
+%!error <'NaN' mismatch> assert ([NaN 1], [1 NaN])
+%!test
+%! try
+%!   assert ([NaN 1], [1 NaN]);
+%! catch
+%!   errmsg = lasterr ();
+%!   if (sum (errmsg () == "\n") != 4)
+%!     error ("Too many errors reported for NaN assert");
+%!   elseif (strfind (errmsg, "NA"))
+%!     error ("NA reported for NaN assert");
+%!   elseif (strfind (errmsg, "Abs err NaN exceeds tol 0"))
+%!     error ("Abs err reported for NaN assert");
+%!   endif
+%! end_try_catch
+
+%!error <'NA' mismatch> assert (NA, 1)
+%!error assert ([NA 1]', [1 NA]')
+%!test
+%! try
+%!   assert ([NA 1]', [1 NA]');
+%! catch
+%!   errmsg = lasterr ();
+%!   if (sum (errmsg () == "\n") != 4)
+%!     error ("Too many errors reported for NA assert");
+%!   elseif (strfind (errmsg, "NaN"))
+%!     error ("NaN reported for NA assert");
+%!   elseif (strfind (errmsg, "Abs err NA exceeds tol 0"))
+%!     error ("Abs err reported for NA assert");
+%!   endif
+%! end_try_catch
+%!error assert ([(complex (NA, 1)) (complex (2, NA))], [(complex (NA, 2)) 2])
+
+%!error <'Inf' mismatch> assert (-Inf, Inf)
+%!error <'Inf' mismatch> assert ([-Inf Inf], [Inf -Inf])
+%!test
+%! try
+%!   assert (complex (Inf, 0.2), complex (-Inf, 0.2 + 2*eps), eps);
+%! catch
+%!   errmsg = lasterr ();
+%!   if (sum (errmsg () == "\n") != 3)
+%!     error ("Too many errors reported for Inf assert");
+%!   elseif (strfind (errmsg, "Abs err"))
+%!     error ("Abs err reported for Inf assert");
+%!   endif
+%! end_try_catch
+%!error <Abs err> assert (complex (Inf, 0.2), complex (Inf, 0.2 + 2*eps), eps)
 
 ## strings
 %!assert ("dog", "dog")
-%!error assert ("dog", "cat")
-%!error assert ("dog", 3)
-%!error assert (3, "dog")
-
-## structures
-%!shared x,y
-%! x.a = 1; x.b=[2, 2];
-%! y.a = 1; y.b=[2, 2];
-%!assert (x, y)
-%!test y.b=3;
-%!error assert (x, y)
-%!error assert (3, x)
-%!error assert (x, 3)
-%!test
-%! # Empty structures
-%! x = resize (x, 0, 1);
-%! y = resize (y, 0, 1);
-%! assert (x, y);
+%!error <Strings don't match> assert ("dog", "cat")
+%!error <Expected string, but observed number> assert (3, "dog")
+%!error <Class char != double> assert ("dog", [3 3 3])
+%!error <Expected string, but observed cell> assert ({"dog"}, "dog")
+%!error <Expected string, but observed struct> assert (struct ("dog", 3), "dog")
 
 ## cell arrays
+%!error <Expected cell, but observed double> assert (1, {1})
+%!error <Dimensions don't match> assert (cell (1,2,3), cell (3,2,1))
+%!test
+%! x = {{{1}}, 2};  # cell with multiple levels
+%! y = x;
+%! assert (x,y);
+%! y{1}{1}{1} = 3;
+%! fail ("assert (x,y)", "Abs err 2 exceeds tol 0");
+
 %!test
 %! x = {[3], [1,2,3]; 100+100*eps, "dog"};
 %! y = x;
@@ -330,8 +539,106 @@
 %! fail ("assert (x, y)");
 %! y = x; y(2,2) = "cat";
 %! fail ("assert (x, y)");
+%! y = x; y(1,1) = [2];  y(1,2) = [0, 2, 3]; y(2,1) = 101; y(2,2) = "cat";
+%! fail ("assert (x, y)");
 
-%% Test input validation
-%!error assert
+## structures
+%!error <Expected struct, but observed double> assert (1, struct ("a", 1))
+%!error <Structure sizes don't match>
+%! x(1,2,3).a = 1;
+%! y(1,2).a = 1;
+%! assert (x,y);
+%!error <Structure sizes don't match>
+%! x(1,2,3).a = 1;
+%! y(3,2,2).a = 1;
+%! assert (x,y);
+%!error <Structure sizes don't match>
+%! x.a = 1;
+%! x.b = 1;
+%! y.a = 1;
+%! assert (x,y);
+%!error <'b' is not an expected field>
+%! x.b = 1;
+%! y.a = 1;
+%! assert (x,y);
+
+%!test
+%! x.a = 1; x.b=[2, 2];
+%! y.a = 1; y.b=[2, 2];
+%! assert (x, y);
+%! y.b=3;
+%! fail ("assert (x, y)");
+%! fail ("assert (3, x)");
+%! fail ("assert (x, 3)");
+%! ## Empty structures
+%! x = resize (x, 0, 1);
+%! y = resize (y, 0, 1);
+%! assert (x, y);
+
+## vector of tolerances
+%!test
+%! x = [-40:0];
+%! y1 = (10.^x).*(10.^x);
+%! y2 = 10.^(2*x);
+%! assert (y1, y2, eps (y1));
+%! fail ("assert (y1, y2 + eps*1e-70, eps (y1))");
+
+## Multiple tolerances
+%!test
+%! x = [1 2; 3 4];
+%! y = [0 -1; 1 2];
+%! tol = [-0.1 0; -0.2 0.3];
+%! try
+%!   assert (x, y, tol);
+%! catch
+%!   errmsg = lasterr ();
+%!   if (sum (errmsg () == "\n") != 6)
+%!     error ("Incorrect number of errors reported");
+%!   endif
+%!   assert (!isempty (regexp (errmsg, '\(1,2\).*Abs err 3 exceeds tol 0\>')));
+%!   assert (!isempty (regexp (errmsg, '\(2,2\).*Abs err 2 exceeds tol 0.3')));
+%!   assert (!isempty (regexp (errmsg, '\(1,1\).*Abs err 1 exceeds tol 0.1')));
+%!   assert (!isempty (regexp (errmsg, '\(2,1\).*Rel err 2 exceeds tol 0.2')));
+%! end_try_catch
+
+## test input validation
+%!error assert ()
 %!error assert (1,2,3,4)
 
+
+## Convert all error indices into tuple format
+function cout = ind2tuple (matsize, erridx)
+
+  cout = cell (numel (erridx), 1);
+  tmp = cell (1, numel (matsize));
+  [tmp{:}] = ind2sub (matsize, erridx (:));
+  subs = [tmp{:}];
+  if (numel (matsize) == 2)
+    subs = subs(:, matsize != 1);
+  endif
+  for i = 1:numel (erridx)
+    loc = sprintf ("%d,", subs(i,:));
+    cout{i} = ["(" loc(1:end-1) ")"];
+  endfor
+
+endfunction
+
+
+## Pretty print the various errors in a condensed tabular format.
+function str = pprint (argin, err)
+
+  str = ["ASSERT errors for:  assert " argin "\n"];
+  str = [str, "\n  Location  |  Observed  |  Expected  |  Reason\n"];
+  for i = 1:length (err.index)
+    leni = length (err.index{i});
+    leno = length (err.observed{i});
+    lene = length (err.expected{i});
+    str = [str, sprintf("%*s%*s %*s%*s %*s%*s   %s\n",
+                        6+fix(leni/2), err.index{i}   , 6-fix(leni/2), "",
+                        6+fix(leno/2), err.observed{i}, 6-fix(leno/2), "",
+                        6+fix(lene/2), err.expected{i}, 6-fix(lene/2), "",
+                        err.reason{i})];
+  endfor
+
+endfunction
+
--- a/scripts/testfun/demo.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/demo.m	Sat Oct 05 11:22:09 2013 -0400
@@ -28,9 +28,9 @@
 ## Examples are stored in the script file, or in a file with the same
 ## name but no extension located on Octave's load path.  To keep examples
 ## separate from regular script code, all lines are prefixed by @code{%!}.  Each
-## example must also be introduced by the keyword 'demo' flush left to the
-## prefix with no intervening spaces.  The remainder of the example can
-## contain arbitrary Octave code.  For example:
+## example must also be introduced by the keyword @qcode{"demo"} flush left
+## to the prefix with no intervening spaces.  The remainder of the example
+## can contain arbitrary Octave code.  For example:
 ##
 ## @example
 ## @group
@@ -67,8 +67,8 @@
 ## rather than just anonymous functions or inline functions, you will have to
 ## use @code{eval (example ("function",n))} to see them.  Because eval only
 ## evaluates one line, or one statement if the statement crosses
-## multiple lines, you must wrap your demo in "if 1 <demo stuff> endif"
-## with the 'if' on the same line as 'demo'.  For example:
+## multiple lines, you must wrap your demo in @qcode{"if 1 <demo stuff> endif"}
+## with the @qcode{"if"} on the same line as @qcode{"demo"}.  For example:
 ##
 ## @example
 ## @group
@@ -128,7 +128,7 @@
     try
       block = code(idx(doidx(i)):idx(doidx(i)+1)-1);
       ## Use an environment without variables
-      eval (cstrcat ("function __demo__ ()\n", block, "\nendfunction"));
+      eval (["function __demo__()\n" block "\nendfunction"]);
       ## Display the code that will be executed before executing it
       printf ("%s example %d:%s\n\n", name, doidx(i), block);
       __demo__;
--- a/scripts/testfun/example.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/example.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## @deftypefnx {Function File} {[@var{s}, @var{idx}] =} example (@dots{})
 ##
 ## Display the code for example @var{n} associated with the function
-## "@var{name}", but do not run it.  If @var{n} is not specified, all examples
+## @var{name}, but do not run it.  If @var{n} is not specified, all examples
 ## are displayed.
 ##
 ## When called with output arguments, the examples are returned in the form of
--- a/scripts/testfun/rundemos.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/rundemos.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,6 +20,9 @@
 ## @deftypefn  {Function File} {} rundemos ()
 ## @deftypefnx {Function File} {} rundemos (@var{directory})
 ## Execute built-in demos for all function files in the specified directory.
+## Also executes demos in any C++ source files found in the directory, for
+## use with dynamically linked functions.
+##
 ## If no directory is specified, operate on all directories in Octave's
 ## search path for functions.
 ## @seealso{runtests, path}
@@ -31,11 +34,16 @@
 
   if (nargin == 0)
     dirs = ostrsplit (path (), pathsep ());
+    do_class_dirs = true;
   elseif (nargin == 1)
     if (is_absolute_filename (directory))
       dirs = {directory};
+    elseif (is_rooted_relative_filename (directory))
+      dirs = {canonicalize_file_name(directory)};
     else
-      directory = regexprep (directory, ['\',filesep(),'$'], "");
+      if (directory(end) == filesep ())
+        directory = directory(1:end-1);
+      endif
       fullname = find_dir_in_path (directory);
       if (! isempty (fullname))
         dirs = {fullname};
@@ -43,23 +51,25 @@
         error ("rundemos: DIRECTORY argument must be a valid pathname");
       endif
     endif
+    do_class_dirs = false;
   else
     print_usage ();
   endif
 
   for i = 1:numel (dirs)
     d = dirs{i};
-    run_all_demos (d);
+    run_all_demos (d, do_class_dirs);
   endfor
 
 endfunction
 
-function run_all_demos (directory)
-  dirinfo = dir (directory);
-  flist = {dirinfo.name};
+function run_all_demos (directory, do_class_dirs)
+  flist = readdir (directory);
+  dirs = {};
   for i = 1:numel (flist)
     f = flist{i};
-    if (length (f) > 2 && strcmp (f((end-1):end), ".m"))
+    if ((length (f) > 2 && strcmpi (f((end-1):end), ".m")) ||
+        (length (f) > 3 && strcmpi (f((end-2):end), ".cc")))
       f = fullfile (directory, f);
       if (has_demos (f))
         try
@@ -71,8 +81,21 @@
           input ("Press <enter> to continue: ", "s");
         endif
       endif
+    elseif (f(1) == "@")
+      f = fullfile (directory, f);
+      if (isdir (f))
+        dirs(end+1) = f;
+      endif
     endif
   endfor
+
+  ## Recurse into class directories since they are implied in the path
+  if (do_class_dirs)
+    for i = 1:numel (dirs)
+      d = dirs{i};
+      run_all_demos (d, false);
+    endfor
+  endif
 endfunction
 
 function retval = has_demos (f)
@@ -80,9 +103,9 @@
   if (f < 0)
     error ("rundemos: fopen failed: %s", f);
   else
-    str = fscanf (fid, "%s");
+    str = fread (fid, "*char").';
     fclose (fid);
-    retval = strfind (str, "%!demo");
+    retval = ! isempty (regexp (str, '^%!demo', 'lineanchors', 'once'));
   endif
 endfunction
 
--- a/scripts/testfun/runtests.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/runtests.m	Sat Oct 05 11:22:09 2013 -0400
@@ -20,6 +20,9 @@
 ## @deftypefn  {Function File} {} runtests ()
 ## @deftypefnx {Function File} {} runtests (@var{directory})
 ## Execute built-in tests for all function files in the specified directory.
+## Also executes tests in any C++ source files found in the directory, for
+## use with dynamically linked functions.
+##
 ## If no directory is specified, operate on all directories in Octave's
 ## search path for functions.
 ## @seealso{rundemos, path}
@@ -31,11 +34,16 @@
 
   if (nargin == 0)
     dirs = ostrsplit (path (), pathsep ());
+    do_class_dirs = true;
   elseif (nargin == 1)
     if (is_absolute_filename (directory))
       dirs = {directory};
+    elseif (is_rooted_relative_filename (directory))
+      dirs = {canonicalize_file_name(directory)};
     else
-      directory = regexprep (directory, ['\',filesep(),'$'], "");
+      if (directory(end) == filesep ())
+        directory = directory(1:end-1);
+      endif
       fullname = find_dir_in_path (directory);
       if (! isempty (fullname))
         dirs = {fullname};
@@ -43,34 +51,41 @@
         error ("runtests: DIRECTORY argument must be a valid pathname");
       endif
     endif
+    do_class_dirs = false;
   else
     print_usage ();
   endif
 
   for i = 1:numel (dirs)
     d = dirs{i};
-    run_all_tests (d);
+    run_all_tests (d, do_class_dirs);
   endfor
 
 endfunction
 
-function run_all_tests (directory)
-  dirinfo = dir (directory);
-  flist = {dirinfo.name};
+function run_all_tests (directory, do_class_dirs)
+  flist = readdir (directory);
+  dirs = {};
   no_tests = {};
   printf ("Processing files in %s:\n\n", directory);
   fflush (stdout);
   for i = 1:numel (flist)
     f = flist{i};
-    if (length (f) > 2 && strcmp (f((end-1):end), ".m"))
+    if ((length (f) > 2 && strcmpi (f((end-1):end), ".m")) ||
+        (length (f) > 3 && strcmpi (f((end-2):end), ".cc")))
       ff = fullfile (directory, f);
       if (has_tests (ff))
         print_test_file_name (f);
         [p, n, xf, sk] = test (ff, "quiet");
         print_pass_fail (n, p);
         fflush (stdout);
-      else
-        no_tests{end+1} = f;
+      elseif (has_functions (ff))
+        no_tests(end+1) = f;
+      endif
+    elseif (f(1) == "@")
+      f = fullfile (directory, f);
+      if (isdir (f))
+        dirs(end+1) = f;
       endif
     endif
   endfor
@@ -78,14 +93,42 @@
     printf ("\nThe following files in %s have no tests:\n\n", directory);
     printf ("%s", list_in_columns (no_tests));
   endif
+
+  ## Recurse into class directories since they are implied in the path
+  if (do_class_dirs)
+    for i = 1:numel (dirs)
+      d = dirs{i};
+      run_all_tests (d, false);
+    endfor
+  endif
+endfunction
+
+function retval = has_functions (f)
+  n = length (f);
+  if (n > 3 && strcmpi (f((end-2):end), ".cc"))
+    fid = fopen (f);
+    if (fid >= 0)
+      str = fread (fid, "*char")';
+      fclose (fid);
+      retval = ! isempty (regexp (str,'^(?:DEFUN|DEFUN_DLD|DEFUNX)\>',
+                                      'lineanchors', 'once'));
+    else
+      error ("fopen failed: %s", f);
+    endif
+  elseif (n > 2 && strcmpi (f((end-1):end), ".m"))
+    retval = true;
+  else
+    retval = false;
+  endif
 endfunction
 
 function retval = has_tests (f)
   fid = fopen (f);
   if (fid >= 0)
-    str = fread (fid, "*char")';
+    str = fread (fid, "*char").';
     fclose (fid);
-    retval = ! isempty (regexp (str, '^%!(test|assert|error|warning)', "lineanchors"));
+    retval = ! isempty (regexp (str, '^%!(?:test|assert|error|warning)',
+                                     'lineanchors', 'once'));
   else
     error ("runtests: fopen failed: %s", f);
   endif
@@ -106,3 +149,8 @@
   filler = repmat (".", 1, 55-length (nm));
   printf ("  %s %s", nm, filler);
 endfunction
+
+
+%!error runtests ("foo", 1)
+%!error <DIRECTORY argument> runtests ("#_TOTALLY_/_INVALID_/_PATHNAME_#")
+
--- a/scripts/testfun/speed.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/speed.m	Sat Oct 05 11:22:09 2013 -0400
@@ -187,14 +187,14 @@
   do_display = (nargout == 0);
 
   if (do_display)
-    disp (cstrcat ("testing ", __f1, "\ninit: ", __init));
+    disp (["testing " __f1 "\ninit: " __init]);
   endif
 
   ## Add semicolon closure to all code fragments in case user has not done so.
-  __init = cstrcat (__init, ";");
-  __f1 = cstrcat (__f1, ";");
+  __init(end+1) = ";";
+  __f1(end+1) = ";";
   if (! isempty (__f2))
-    __f2 = cstrcat (__f2, ";");
+    __f2(end+1) = ";";
   endif
 
   ## Make sure the functions are freshly loaded by evaluating them at
@@ -217,19 +217,19 @@
       fflush (stdout);
     endif
 
-    eval (cstrcat ("__t = time();", __f1, "__v1=ans; __t = time()-__t;"));
+    eval (["__t = time();" __f1 "__v1=ans; __t = time()-__t;"]);
     if (__t < 0.25)
-      eval (cstrcat ("__t2 = time();", __f1, "__t2 = time()-__t2;"));
-      eval (cstrcat ("__t3 = time();", __f1, "__t3 = time()-__t3;"));
+      eval (["__t2 = time();" __f1 "__t2 = time()-__t2;"]);
+      eval (["__t3 = time();" __f1 "__t3 = time()-__t3;"]);
       __t = min ([__t, __t2, __t3]);
     endif
     __tnew(k) = __t;
 
     if (! isempty (__f2))
-      eval (cstrcat ("__t = time();", __f2, "__v2=ans; __t = time()-__t;"));
+      eval (["__t = time();" __f2 "__v2=ans; __t = time()-__t;"]);
       if (__t < 0.25)
-        eval (cstrcat ("__t2 = time();", __f2, "__t2 = time()-__t2;"));
-        eval (cstrcat ("__t3 = time();", __f2, "__t3 = time()-__t3;"));
+        eval (["__t2 = time();" __f2 "__t2 = time()-__t2;"]);
+        eval (["__t3 = time();" __f2 "__t3 = time()-__t3;"]);
         __t = min ([__t, __t2, __t3]);
       endif
       __torig(k) = __t;
@@ -280,27 +280,25 @@
     loglog (__test_n, __tnew*1000, "*-g;execution time;");
     xlabel ("test length");
     ylabel ("best execution time (ms)");
-    title ({__f1, cstrcat("init: ", __init)});
+    title ({__f1, ["init: " __init]});
 
   elseif (do_display)
 
     subplot (1, 2, 1);
     semilogx (__test_n, __torig./__tnew,
-              cstrcat ("-*r;", strrep (__f1, ";", "."), " / ",
-                       strrep (__f2, ";", "."), ";"),
-               __test_n, __tnew./__torig,
-              cstrcat ("-*g;", strrep (__f2, ";", "."), " / ",
-                       strrep (__f1, ";", "."), ";"));
+             ["-*r;" strrep(__f1, ";", ".") " / " strrep(__f2, ";", ".") ";"],
+              __test_n, __tnew./__torig,
+             ["-*g;", strrep(__f2, ";", ".") " / " strrep(__f1, ";", ".") ";"]);
     title ("Speedup Ratio");
     xlabel ("test length");
     ylabel ("speedup ratio");
 
     subplot (1, 2, 2);
     loglog (__test_n, __tnew*1000,
-            cstrcat ("*-g;", strrep (__f1, ";", "."), ";"),
+            ["*-g;" strrep(__f1,";",".") ";"],
             __test_n, __torig*1000,
-            cstrcat ("*-r;", strrep (__f2,";","."), ";"));
-    title ({"Execution Times", cstrcat("init: ", __init)});
+            ["*-r;" strrep(__f2,";",".") ";"]);
+    title ({"Execution Times", ["init: " __init]});
     xlabel ("test length");
     ylabel ("best execution time (ms)");
 
--- a/scripts/testfun/test.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/testfun/test.m	Sat Oct 05 11:22:09 2013 -0400
@@ -34,14 +34,14 @@
 ## output is selected.
 ##
 ## @table @asis
-## @item "quiet"
+## @item @qcode{"quiet"}
 ##  Don't report all the tests as they happen, just the errors.
 ##
-## @item "normal"
+## @item @qcode{"normal"}
 ## Report all tests as they happen, but don't do tests which require
 ## user interaction.
 ##
-## @item "verbose"
+## @item @qcode{"verbose"}
 ## Do tests which require user interaction.
 ## @end table
 ##
@@ -58,13 +58,14 @@
 ## @var{n} and @var{max}, the number of successful tests and the total number
 ## of tests in the file @var{name} are returned.
 ##
-## If the second argument is the string "grabdemo", the contents of the demo
-## blocks are extracted but not executed.  Code for all code blocks is
-## concatenated and returned as @var{code} with @var{idx} being a vector of
-## positions of the ends of the demo blocks.
+## If the second argument is the string @qcode{"grabdemo"}, the contents of
+## the demo blocks are extracted but not executed.  Code for all code blocks
+## is concatenated and returned as @var{code} with @var{idx} being a vector
+## of positions of the ends of the demo blocks.
 ##
-## If the second argument is "explain", then @var{name} is ignored and an
-## explanation of the line markers used is written to the file @var{fid}.
+## If the second argument is @qcode{"explain"}, then @var{name} is ignored
+## and an explanation of the line markers used is written to the file
+## @var{fid}.
 ## @seealso{assert, fail, error, demo, example}
 ## @end deftypefn
 
@@ -155,10 +156,10 @@
   ## Locate the file to test.
   __file = file_in_loadpath (__name, "all");
   if (isempty (__file))
-    __file = file_in_loadpath (cstrcat (__name, ".m"), "all");
+    __file = file_in_loadpath ([__name ".m"], "all");
   endif
   if (isempty (__file))
-    __file = file_in_loadpath (cstrcat (__name, ".cc"), "all");
+    __file = file_in_loadpath ([__name ".cc"], "all");
   endif
   if (iscell (__file))
       ## If repeats, return first in path.
@@ -229,7 +230,7 @@
 
   ## Ready to start tests ... if in batch mode, tell us what is happening.
   if (__verbose)
-    disp (cstrcat (__signal_file, __file));
+    disp ([__signal_file, __file]);
   endif
 
   ## Assume all tests will pass.
@@ -281,7 +282,7 @@
           __demo_code = __code;
           __demo_idx = [1, length(__demo_code)+1];
         else
-          __demo_code = cstrcat (__demo_code, __code);
+          __demo_code = [__demo_code, __code];
           __demo_idx = [__demo_idx, length(__demo_code)+1];
         endif
 
@@ -326,9 +327,9 @@
       try
         __vars = deblank (__vars);
         if (! isempty (__vars))
-          eval (cstrcat (strrep (__vars, ",", "=[];"), "=[];"));
+          eval ([strrep(__vars, ",", "=[];"), "=[];"]);
           __shared = __vars;
-          __shared_r = cstrcat ("[ ", __vars, "] = ");
+          __shared_r = ["[ ", __vars, "] = "];
         else
           __shared = " ";
           __shared_r = " ";
@@ -357,7 +358,7 @@
         __name = __block(__name_position(1):__name_position(2));
         __code = __block;
         try
-          eval (__code); ## Define the function
+          eval (__code);  # Define the function
           __clear = sprintf ("%sclear %s;\n", __clear, __name);
         catch
           __success = 0;
@@ -392,7 +393,11 @@
       if (__id)
         __patstr = ["id=",__id];
       else
-        __patstr = ["<",__pattern,">"];
+        if (! strcmp (__pattern, '.'))
+          __patstr = ["<",__pattern,">"];
+        else
+          __patstr = ifelse (__warning, "a warning", "an error");
+        endif
       endif
       try
         eval (sprintf ("function __test__(%s)\n%s\nendfunction",
@@ -407,25 +412,34 @@
         __success = 0;
         __warnstate = warning ("query", "quiet");
         warning ("on", "quiet");
+        ## Clear error and warning strings before starting
+        lasterr ("");
+        lastwarn ("");
         try
+          ## FIXME: lastwarn () must be called once from *WITHIN* the try block
+          ##        or subsequent warning/lastwarn statements may fail.
+          ##        Likely this is something to do with the specialness of
+          ##        the try block which is disabling normal errors.
+          lastwarn ();
           eval (sprintf ("__test__(%s);", __shared));
           if (! __warning)
-            __msg = sprintf ("%sexpected %s but got no error\n",
+            __msg = sprintf ("%serror failed.\nExpected %s but got no error\n",
                              __signal_fail, __patstr);
           else
             if (! isempty (__id))
-              [~, __err] = lastwarn;
+              [~, __err] = lastwarn ();
               __mismatch = ! strcmp (__err, __id);
             else
-              __err = trimerr (lastwarn, "warning");
+              __err = trimerr (lastwarn (), "warning");
               __mismatch = isempty (regexp (__err, __pattern, "once"));
             endif
             warning (__warnstate.state, "quiet");
             if (isempty (__err))
-              __msg = sprintf ("%sexpected %s but got no warning\n",
-                             __signal_fail, __patstr);
+              __msg = sprintf (["%swarning failed.\n" ...
+                                "Expected %s but got no warning\n"],
+                               __signal_fail, __patstr);
             elseif (__mismatch)
-              __msg = sprintf ("%sexpected %s but got %s\n",
+              __msg = sprintf ("%swarning failed.\nExpected %s but got <%s>\n",
                                __signal_fail, __patstr, __err);
             else
               __success = 1;
@@ -434,18 +448,19 @@
 
         catch
           if (! isempty (__id))
-            [~, __err] = lasterr;
+            [~, __err] = lasterr ();
             __mismatch = ! strcmp (__err, __id);
           else
-            __err = trimerr (lasterr, "error");
+            __err = trimerr (lasterr (), "error");
             __mismatch = isempty (regexp (__err, __pattern, "once"));
           endif
           warning (__warnstate.state, "quiet");
           if (__warning)
-            __msg = sprintf ("%sexpected warning %s but got error %s\n",
+            __msg = sprintf (["%swarning failed.\n" ...
+                              "Expected warning %s but got error <%s>\n"],
                              __signal_fail, __patstr, __err);
           elseif (__mismatch)
-            __msg = sprintf ("%sexpected %s but got %s\n",
+            __msg = sprintf ("%serror failed.\nExpected %s but got <%s>\n",
                              __signal_fail, __patstr, __err);
           else
             __success = 1;
@@ -565,13 +580,16 @@
   if (nargout == 0)
     if (__tests || __xfail || __xskip)
       if (__xfail)
-        printf ("PASSES %d out of %d tests (%d expected failures)\n",
-                __successes, __tests, __xfail);
+        printf ("PASSES %d out of %d test%s (%d expected failure%s)\n",
+                __successes, __tests, ifelse (__tests > 1, "s", ""),
+                __xfail, ifelse (__xfail > 1, "s", ""));
       else
-        printf ("PASSES %d out of %d tests\n", __successes, __tests);
+        printf ("PASSES %d out of %d test%s\n", __successes, __tests,
+               ifelse (__tests > 1, "s", ""));
       endif
       if (__xskip)
-        printf ("Skipped %d tests due to missing features\n", __xskip);
+        printf ("Skipped %d test%s due to missing features\n", __xskip,
+                ifelse (__xskip > 1, "s", ""));
       endif
     else
       printf ("%s%s has no tests available\n", __signal_empty, __file);
@@ -639,20 +657,17 @@
 
 ## Strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks.
 function msg = trimerr (msg, prefix)
-  idx = index (msg, cstrcat (prefix, ":"));
+  idx = index (msg, [prefix ":"]);
   if (idx > 0)
     msg(1:idx+length(prefix)) = [];
   endif
-  msg = trimleft (deblank (msg));
+  msg = strtrim (msg);
 endfunction
 
 ## Strip leading blanks from string.
 function str = trimleft (str)
-  idx = find (isspace (str));
-  leading = find (idx == 1:length (idx));
-  if (! isempty (leading))
-    str = str(leading(end)+1:end);
-  endif
+  idx = find (! isspace (str), 1);
+  str = str(idx:end);
 endfunction
 
 ## Make a structure out of the named variables
@@ -672,7 +687,7 @@
       if (length (ln) >= 2 && strcmp (ln(1:2), "%!"))
         body = [body, "\n"];
         if (length (ln) > 2)
-          body = cstrcat (body, ln(3:end));
+          body = [body, ln(3:end)];
         endif
       endif
     endwhile
@@ -680,6 +695,7 @@
   endif
 endfunction
 
+
 ### example from toeplitz
 %!shared msg1,msg2
 %! msg1="C must be a vector";
@@ -734,9 +750,9 @@
 %! % you should now see a spectrogram in the image window
 
 
-### now test test itself
+## now test 'test' itself
 
-%!## usage and error testing
+## usage and error testing
 % !fail ('test','usage.*test')           # no args, generates usage()
 % !fail ('test (1,2,3,4)','usage.*test') # too many args, generates usage()
 %!fail ('test ("test", "bogus")','unknown flag')  # incorrect args
@@ -754,7 +770,7 @@
 
 %!warning <warning message> warning ('warning message');
 
-%!## test of shared variables
+## test of shared variables
 %!shared a                # create a shared variable
 %!test   a=3;             # assign to a shared variable
 %!test   assert (a,3)     # variable should equal 3
@@ -792,17 +808,17 @@
 %! assert (x,6);
 %! assert (z,9);
 
-%!## test of assert block
+## test of assert block
 %!assert (isempty ([]))      # support for test assert shorthand
 
-%!## demo blocks
+## demo blocks
 %!demo                   # multiline demo block
 %! t = [0:0.01:2*pi]; x = sin (t);
 %! plot (t,x);
 %! % you should now see a sine wave in your figure window
 %!demo a=3               # single line demo blocks work too
 
-%!## this is a comment block. it can contain anything.
+## this is a comment block. it can contain anything.
 %!##
 %! it is the "#" as the block type that makes it a comment
 %! and it stays as a comment even through continuation lines
--- a/scripts/time/addtodate.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/addtodate.m	Sat Oct 05 11:22:09 2013 -0400
@@ -21,8 +21,9 @@
 ## Add @var{q} amount of time (with units @var{f}) to the serial datenum,
 ## @var{d}.
 ##
-## @var{f} must be one of "year", "month", "day", "hour", "minute", "second",
-## or "millisecond".
+## @var{f} must be one of @qcode{"year"}, @qcode{"month"}, @qcode{"day"},
+## @qcode{"hour"}, @qcode{"minute"}, @qcode{"second"}, or
+## @qcode{"millisecond"}.
 ## @seealso{datenum, datevec, etime}
 ## @end deftypefn
 
--- a/scripts/time/asctime.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/asctime.m	Sat Oct 05 11:22:09 2013 -0400
@@ -19,7 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} asctime (@var{tm_struct})
 ## Convert a time structure to a string using the following 
-## format: "ddd mmm mm HH:MM:SS yyyy".  For example:
+## format: @qcode{"ddd mmm mm HH:MM:SS yyyy"}.  For example:
 ##
 ## @example
 ## @group
--- a/scripts/time/clock.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/clock.m	Sat Oct 05 11:22:09 2013 -0400
@@ -54,6 +54,7 @@
 
 endfunction
 
+
 %!test
 %! t1 = clock;
 %! t2 = str2num (strftime ("[%Y, %m, %d, %H, %M, %S]", localtime (time ())));
--- a/scripts/time/datenum.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/datenum.m	Sat Oct 05 11:22:09 2013 -0400
@@ -203,3 +203,4 @@
 %!error <expected date vector containing> datenum ([1, 2])
 %!error <expected date vector containing> datenum ([1,2,3,4,5,6,7])
 %!error <all inputs must be of class double> datenum (int32 (2000), int32 (1), int32 (1))
+
--- a/scripts/time/datestr.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/datestr.m	Sat Oct 05 11:22:09 2013 -0400
@@ -37,16 +37,16 @@
 ##
 ## @multitable @columnfractions 0.1 0.45 0.35
 ## @headitem Code @tab Format @tab Example
-## @item  0 @tab dd-mmm-yyyy HH:MM:SS   @tab 07-Sep-2000 15:38:09
-## @item  1 @tab dd-mmm-yyyy            @tab 07-Sep-2000
-## @item  2 @tab mm/dd/yy               @tab 09/07/00
-## @item  3 @tab mmm                    @tab Sep
-## @item  4 @tab m                      @tab S
-## @item  5 @tab mm                     @tab 09
-## @item  6 @tab mm/dd                  @tab 09/07
-## @item  7 @tab dd                     @tab 07
-## @item  8 @tab ddd                    @tab Thu
-## @item  9 @tab d                      @tab T
+## @item 0 @tab dd-mmm-yyyy HH:MM:SS   @tab 07-Sep-2000 15:38:09
+## @item 1 @tab dd-mmm-yyyy            @tab 07-Sep-2000
+## @item 2 @tab mm/dd/yy               @tab 09/07/00
+## @item 3 @tab mmm                    @tab Sep
+## @item 4 @tab m                      @tab S
+## @item 5 @tab mm                     @tab 09
+## @item 6 @tab mm/dd                  @tab 09/07
+## @item 7 @tab dd                     @tab 07
+## @item 8 @tab ddd                    @tab Thu
+## @item 9 @tab d                      @tab T
 ## @item 10 @tab yyyy                   @tab 2000
 ## @item 11 @tab yy                     @tab 00
 ## @item 12 @tab mmmyy                  @tab Sep00
--- a/scripts/time/datetick.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/datetick.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,23 +24,35 @@
 ## @deftypefnx {Function File} {} datetick (@dots{}, "keepticks")
 ## @deftypefnx {Function File} {} datetick (@var{hax}, @dots{})
 ## Add date formatted tick labels to an axis.  The axis to apply the
-## ticks to is determined by @var{axis} which can take the values "x",
-## "y", or "z".  The default value is "x".  The formatting of the labels is
-## determined by the variable @var{form}, which can either be a string or
-## positive integer that @code{datestr} accepts.
+## ticks to is determined by @var{axis} which can take the values @qcode{"x"},
+## @qcode{"y"}, or @qcode{"z"}.  The default value is @qcode{"x"}.  The
+## formatting of the labels is determined by the variable @var{form}, which
+## can either be a string or positive integer that @code{datestr} accepts.
 ## @seealso{datenum, datestr}
 ## @end deftypefn
 
 function datetick (varargin)
 
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("datetick", varargin{:});
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("datetick", varargin{:});
 
-  oldh = gca ();
+  oldfig = [];
+  if (! isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
+  if (isempty (hax))
+    hax = gca ();
+  endif 
+
   unwind_protect
-    axes (h);
+    ## FIXME: This will bring the axes to the top of the stack.
+    ##        This may not always be desirable if there are multiple axes
+    ##        objects.
+    axes (hax);
     __datetick__ (varargin{:});
   unwind_protect_cleanup
-    axes (oldh);
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
   end_unwind_protect
 
 endfunction
@@ -61,7 +73,7 @@
 %! yr = 1988:2:2002;
 %! yr = datenum (yr,1,1);
 %! pr = [12.1 13.3 12.6 13.1 13.3 14.1 14.4 15.2];
-%! plot (yr, pr);
+%! plot (yr, pr, "-o");
 %! xlabel ("year");
 %! ylabel ("average price");
 %! ax = gca;
@@ -75,31 +87,26 @@
 function __datetick__ (varargin)
 
   keeplimits = false;
+  idx = strcmpi (varargin, "keeplimits");
+  if (any (idx))
+    keeplimits = true;
+    varargin = varargin(! idx);
+  endif
   keepticks = false;
-  idx = [];
-  for i = 1 : nargin
-    arg = varargin {i};
-    if (ischar (arg))
-      if (strcmpi (arg, "keeplimits"))
-        keeplimits = true;
-        idx = [idx, i];
-      elseif (strcmpi (arg, "keepticks"))
-        keepticks = true;
-        idx = [idx, i];
-      endif
-    endif
-  endfor
+  idx = strcmpi (varargin, "keepticks");
+  if (any (idx))
+    keepticks = true;
+    varargin = varargin(! idx);
+  endif
 
-  varargin(idx) = [];
-  nargin = length (varargin);
+  nargin = numel (varargin); 
   form = [];
   ax = "x";
 
   if (nargin != 0)
     arg = varargin{1};
-    if (ischar (arg) && (strcmp (arg, "x") || strcmp (arg, "y")
-                         || strcmp (arg, "z")))
-      ax = arg;
+    if (ischar (arg) && any (strcmpi (arg, {"x", "y", "z"})))
+      ax = tolower (arg);
       if (nargin > 1)
         form = varargin{2};
         varargin(1:2) = [];
@@ -121,7 +128,7 @@
 
   if (! isempty (form))
     if (isnumeric (form))
-      if (! isscalar (form) || floor (form) != form || form < 0)
+      if (! isscalar (form) || form < 0 || form != fix (form))
         error ("datetick: expecting FORM argument to be a positive integer");
       endif
     elseif (! ischar (form))
@@ -130,7 +137,7 @@
   endif
 
   if (keepticks)
-    ticks = get (gca (), strcat (ax, "tick"));
+    ticks = get (gca (), [ax "tick"]);
   else
     ## Need to do our own axis tick position calculation as
     ## year, etc, don't fallback on nice datenum values.
@@ -139,8 +146,8 @@
     xmin = NaN;
     for i = 1 : length (objs)
       fld = get (objs (i));
-      if (isfield (fld, strcat (ax, "data")))
-        xdata = getfield (fld, strcat (ax, "data"))(:);
+      if (isfield (fld, [ax "data"]))
+        xdata = getfield (fld, [ax "data"])(:);
         xmin = min (xmin, min (xdata));
         xmax = max (xmax, max (xdata));
       endif
@@ -209,7 +216,7 @@
       ## days
       form = 8;
     elseif (r < 365)
-      ## FIXME -- FORM should be 19 for European users who use dd/mm
+      ## FIXME: FORM should be 19 for European users who use dd/mm
       ## instead of mm/dd.  How can that be determined automatically?
       ## months
       form = 6;
@@ -243,17 +250,17 @@
 
   if (keepticks)
     if (keeplimits)
-      set (gca (), strcat (ax, "ticklabel"), sticks);
+      set (gca (), [ax "ticklabel"], sticks);
     else
-      set (gca (), strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"),
-      [min(ticks), max(ticks)]);
+      set (gca (), [ax "ticklabel"], sticks,
+                   [ax "lim"], [min(ticks), max(ticks)]);
     endif
   else
     if (keeplimits)
-      set (gca (), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks);
+      set (gca (), [ax "tick"], ticks, [ax "ticklabel"], sticks);
     else
-      set (gca (), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks,
-      strcat (ax, "lim"), [min(ticks), max(ticks)]);
+      set (gca (), [ax "tick"], ticks, [ax "ticklabel"], sticks,
+                   [ax "lim"], [min(ticks), max(ticks)]);
     endif
   endif
 endfunction
--- a/scripts/time/weekday.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/time/weekday.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,14 +24,14 @@
 ##
 ## @var{d} is a serial date number or a date string.
 ##
-## If the string @var{format} is not present or is equal to "short" then
+## If the string @var{format} is not present or is equal to @qcode{"short"} then
 ## @var{s} will contain the abbreviated name of the weekday.  If @var{format}
-## is "long" then @var{s} will contain the full name.
+## is @qcode{"long"} then @var{s} will contain the full name.
 ##
 ## Table of return values based on @var{format}:
 ##
 ## @multitable @columnfractions .06 .13 .16
-## @headitem @var{n} @tab "short" @tab "long"
+## @headitem @var{n} @tab @qcode{"short"} @tab @qcode{"long"}
 ## @item 1 @tab Sun @tab Sunday
 ## @item 2 @tab Mon @tab Monday
 ## @item 3 @tab Tue @tab Tuesday
--- a/scripts/ui/errordlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/errordlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## The message may have multiple lines separated by newline characters
 ## ("\n"), or it may be a cellstr array with one element for each
 ## line.  The optional input @var{title} (character string) can be used to
-## set the dialog caption.  The default title is "Error Dialog".
+## set the dialog caption.  The default title is @qcode{"Error Dialog"}.
 ##
 ## The return value is always 1.
 ## @seealso{helpdlg, inputdlg, listdlg, msgbox, questdlg, warndlg}
@@ -40,10 +40,12 @@
 
 endfunction
 
-%!demo
-%!  disp('- test errordlg with prompt only.');
-%!  errordlg('Oops, an expected error occured');
 
 %!demo
-%!  disp('- test errordlg with prompt and caption.');
-%!  errordlg('Oops another error','This is a very long and informative caption');
+%! disp ('- test errordlg with prompt only.');
+%! errordlg ('Oops, an expected error occured');
+
+%!demo
+%! disp ('- test errordlg with prompt and caption.');
+%! errordlg ('Oops another error','This is a very long and informative caption');
+
--- a/scripts/ui/helpdlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/helpdlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## The message may have multiple lines separated by newline characters
 ## ("\n"), or it may be a cellstr array with one element for each
 ## line.  The optional input @var{title} (character string) can be used to
-## set the dialog caption.  The default title is "Help Dialog".
+## set the dialog caption.  The default title is @qcode{"Help Dialog"}.
 ##
 ## The return value is always 1.
 ## @seealso{errordlg, inputdlg, listdlg, msgbox, questdlg, warndlg}
@@ -40,10 +40,12 @@
 
 endfunction
 
-%!demo
-%!  disp('- test helpdlg with a help message only.');
-%!  helpdlg("Below, you should see 3 lines:\nline #1\nline #2, and\nline #3.");
 
 %!demo
-%!  disp('- test helpdlg with help message and caption.');
-%!  helpdlg('You should see a single line.','A help dialog');
+%! disp ('- test helpdlg with a help message only.');
+%! helpdlg ("Below, you should see 3 lines:\nline #1\nline #2, and\nline #3.");
+
+%!demo
+%! disp ('- test helpdlg with help message and caption.');
+%! helpdlg ('You should see a single line.','A help dialog');
+
--- a/scripts/ui/inputdlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/inputdlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -32,7 +32,8 @@
 ## A cell array with strings labeling each text field.  This input is required. 
 ##
 ## @item title
-## String to use for the caption of the dialog.  The default is "Input Dialog".
+## String to use for the caption of the dialog.  The default is @qcode{"Input
+## Dialog"}.
 ##
 ## @item rowscols
 ## Specifies the size of the text fields and can take three forms:
@@ -65,7 +66,7 @@
 
   if (iscell (prompt))
     ## Silently extract only char elements
-    prompt = prompt(cellfun ("ischar", prompt));
+    prompt = prompt(cellfun ("isclass", prompt, "char"));
   elseif (ischar (prompt))
     prompt = {prompt};
   else
@@ -142,64 +143,66 @@
 
 endfunction
 
-%!demo
-%!  disp('- test inputdlg with prompt and caption only.');
-%!  prompt = {'Width','Height','Depth'};
-%!  dims = inputdlg ( prompt, 'Enter Box Dimensions' );
-%!  if isempty(dims)
-%!     helpdlg('Canceled by user', 'Information');
-%!  else
-%!     volume  = str2num(dims{1}) * str2num(dims{2}) * str2num(dims{3});
-%!     surface = 2 * (str2num(dims{1}) * str2num(dims{2}) + ...
-%!                    str2num(dims{2}) * str2num(dims{3}) + ...
-%!                    str2num(dims{1}) * str2num(dims{3}));
-%!     helpdlg(sprintf('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
-%!  end
 
 %!demo
-%!  disp('- test inputdlg with prescribed scalar (2 lines per text field) and defaults.');
-%!  prompt = {'Width','Height','Depth'};
-%!  default = {'1.1','2.2','3.3'};
-%!  rc = 2;
-%!  dims = inputdlg ( prompt, 'Enter Box Dimensions',rc,default );
-%!  if isempty(dims)
-%!     helpdlg('Canceled by user', 'Information');
-%!  else
-%!     volume  = str2num(dims{1}) * str2num(dims{2}) * str2num(dims{3});
-%!     surface = 2 * (str2num(dims{1}) * str2num(dims{2}) + ...
-%!                    str2num(dims{2}) * str2num(dims{3}) + ...
-%!                    str2num(dims{1}) * str2num(dims{3}));
-%!     helpdlg(sprintf('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
-%!  end
+%! disp ('- test inputdlg with prompt and caption only.');
+%! prompt = {'Width','Height','Depth'};
+%! dims = inputdlg (prompt, 'Enter Box Dimensions');
+%! if (isempty (dims))
+%!   helpdlg ('Canceled by user', 'Information');
+%! else
+%!   volume  = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3});
+%!   surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ...
+%!                  str2num (dims{2}) * str2num (dims{3}) + ...
+%!                  str2num (dims{1}) * str2num (dims{3}));
+%!   helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
+%! end
+
+%!demo
+%! disp ('- test inputdlg with prescribed scalar (2 lines per text field) and defaults.');
+%! prompt = {'Width','Height','Depth'};
+%! default = {'1.1','2.2','3.3'};
+%! rc = 2;
+%! dims = inputdlg (prompt, 'Enter Box Dimensions',rc,default);
+%! if (isempty (dims))
+%!   helpdlg ('Canceled by user', 'Information');
+%! else
+%!   volume  = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3});
+%!   surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ...
+%!                  str2num (dims{2}) * str2num (dims{3}) + ...
+%!                  str2num (dims{1}) * str2num (dims{3}));
+%!    helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
+%! end
 
 %!demo
-%!  disp('- test inputdlg with prescribed vector [1,2,3] for # of lines per text field and defaults.');
-%!  prompt = {'Width','Height','Depth'};
-%!  default = {'1.10', '2.10', '3.10'};
-%!  rc = [1,2,3];  % NOTE: must be an array
-%!  dims = inputdlg ( prompt, 'Enter Box Dimensions',rc,default );
-%!  if isempty(dims)
-%!     helpdlg('Canceled by user', 'Information');
-%!  else
-%!     volume  = str2num(dims{1}) * str2num(dims{2}) * str2num(dims{3});
-%!     surface = 2 * (str2num(dims{1}) * str2num(dims{2}) + ...
-%!                    str2num(dims{2}) * str2num(dims{3}) + ...
-%!                    str2num(dims{1}) * str2num(dims{3}));
-%!     helpdlg(sprintf('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
-%!  end
+%! disp ('- test inputdlg with prescribed vector [1,2,3] for # of lines per text field and defaults.');
+%! prompt = {'Width','Height','Depth'};
+%! default = {'1.10', '2.10', '3.10'};
+%! rc = [1,2,3];  % NOTE: must be an array
+%! dims = inputdlg (prompt, 'Enter Box Dimensions',rc,default);
+%! if (isempty (dims))
+%!   helpdlg ('Canceled by user', 'Information');
+%! else
+%!   volume  = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3});
+%!   surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ...
+%!                  str2num (dims{2}) * str2num (dims{3}) + ...
+%!                  str2num (dims{1}) * str2num (dims{3}));
+%!   helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
+%! end
 
 %!demo
-%!  disp('- test inputdlg with prescribed row by column sizes and defaults.');
-%!  prompt = {'Width','Height','Depth'};
-%!  default = {'1.10', '2.20', '3.30'};
-%!  rc = [1,10; 2,20; 3,30];  % NOTE: must be an array
-%!  dims = inputdlg ( prompt, 'Enter Box Dimensions',rc,default );
-%!  if isempty(dims)
-%!     helpdlg('Canceled by user', 'Information');
-%!  else
-%!     volume  = str2num(dims{1}) * str2num(dims{2}) * str2num(dims{3});
-%!     surface = 2 * (str2num(dims{1}) * str2num(dims{2}) + ...
-%!                    str2num(dims{2}) * str2num(dims{3}) + ...
-%!                    str2num(dims{1}) * str2num(dims{3}));
-%!     helpdlg(sprintf('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
-%!  end
+%! disp ('- test inputdlg with prescribed row by column sizes and defaults.');
+%! prompt = {'Width','Height','Depth'};
+%! default = {'1.10', '2.20', '3.30'};
+%! rc = [1,10; 2,20; 3,30];  % NOTE: must be an array
+%! dims = inputdlg (prompt, 'Enter Box Dimensions',rc,default);
+%! if (isempty (dims))
+%!   helpdlg ('Canceled by user', 'Information');
+%! else
+%!   volume  = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3});
+%!   surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ...
+%!                  str2num (dims{2}) * str2num (dims{3}) + ...
+%!                  str2num (dims{1}) * str2num (dims{3}));
+%!   helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', volume, surface), 'Box Dimensions');
+%! end
+
--- a/scripts/ui/listdlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/listdlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -27,37 +27,37 @@
 ## The indices in @var{sel} are 1-based.
 ##
 ## The arguments are specified in form of @var{key}, @var{value} pairs. 
-## The "ListString" argument pair must be specified.
+## The @qcode{"ListString"} argument pair must be specified.
 ##
 ## Valid @var{key} and @var{value} pairs are:
 ##
 ## @table @asis
-## @item "ListString"
+## @item @qcode{"ListString"}
 ## a cell array of strings comprising the content of the list.
 ##
-## @item "SelectionMode"
-## can be either "Single" or "Multiple" (default).
+## @item @qcode{"SelectionMode"}
+## can be either @qcode{"Single"} or @qcode{"Multiple"} (default).
 ##
-## @item "ListSize"
+## @item @qcode{"ListSize"}
 ## a vector with two elements @var{width} and @var{height} defining
 ## the size of the list field in pixels.  Default is [160 300].
 ##
-## @item "InitialValue"
+## @item @qcode{"InitialValue"}
 ## a vector containing 1-based indices of preselected elements.  Default
 ## is 1 (first item).
 ##
-## @item "Name"
+## @item @qcode{"Name"}
 ## a string to be used as the dialog caption.  Default is "".
 ##
-## @item "PromptString"
+## @item @qcode{"PromptString"}
 ## a cell array of strings to be displayed above the list field.  Default
 ## is @{@}.
 ##
-## @item "OKString"
-## a string used to label the OK button.  Default is "OK".
+## @item @qcode{"OKString"}
+## a string used to label the OK button.  Default is @qcode{"OK"}.
 ##
-## @item "CancelString"
-## a string used to label the Cancel button.  Default is "Cancel".
+## @item @qcode{"CancelString"}
+## a string used to label the Cancel button.  Default is @qcode{"Cancel"}.
 ## @end table
 ##
 ## Example:
@@ -94,21 +94,21 @@
 
   ## handle key, value pairs
   for i = 1:2:nargin-1
-    if strcmp (varargin{i}, "ListString")
+    if (strcmp (varargin{i}, "ListString"))
       listcell = varargin{i+1};
-    elseif strcmp (varargin{i}, "SelectionMode")
+    elseif (strcmp (varargin{i}, "SelectionMode"))
       selmode = varargin{i+1};
-    elseif strcmp (varargin{i}, "ListSize")
+    elseif (strcmp (varargin{i}, "ListSize"))
       listsize = varargin{i+1};
-    elseif strcmp (varargin{i}, "InitialValue")
+    elseif (strcmp (varargin{i}, "InitialValue"))
       initialvalue = varargin{i+1};
-    elseif strcmp (varargin{i}, "Name")
+    elseif (strcmp (varargin{i}, "Name"))
       name = varargin{i+1};
-    elseif strcmp (varargin{i}, "PromptString")
+    elseif (strcmp (varargin{i}, "PromptString"))
       prompt = varargin{i+1};
-    elseif strcmp (varargin{i}, "OKString")
+    elseif (strcmp (varargin{i}, "OKString"))
       okstring = varargin{i+1};
-    elseif strcmp (varargin{i}, "CancelString")
+    elseif (strcmp (varargin{i}, "CancelString"))
       cancelstring = varargin{i+1};
     endif
   endfor
@@ -137,7 +137,7 @@
     ## swap width and height to correct calling format for JDialogBox
     listsize = {num2str(listsize(2)), num2str(listsize(1))};
     initialvalue = arrayfun (@num2str, initialvalue, "UniformOutput", false);
-    if isempty(prompt)
+    if (isempty (prompt))
       prompt = {""};
     endif
 
@@ -158,35 +158,37 @@
 
 endfunction
 
+
 %!demo
-%!  disp('- test listdlg with selectionmode single. No caption, no prompt.');
-%!  itemlist = {'An item \\alpha', 'another', 'yet another'};
-%!  s = listdlg ( 'ListString',itemlist, 'SelectionMode','Single' );
-%!  imax = numel (s);
-%!  for i=1:1:imax
-%!     disp(['Selected: ',num2str(i),': ', itemlist{s(i)}]);
-%!  end
+%! disp ('- test listdlg with selectionmode single. No caption, no prompt.');
+%! itemlist = {'An item \\alpha', 'another', 'yet another'};
+%! s = listdlg ('ListString',itemlist, 'SelectionMode','Single');
+%! imax = numel (s);
+%! for i=1:1:imax
+%!   disp (['Selected: ',num2str (i),': ', itemlist{s (i)}]);
+%! end
 
 %!demo
-%!  disp('- test listdlg with selectionmode and preselection. Has caption and two lines prompt.');
-%!  itemlist = {'An item \\alpha', 'another', 'yet another'};
-%!  s = listdlg ( 'ListString',itemlist, ...
-%!                'SelectionMode','Multiple', ...
-%!                'Name','Selection Dialog', ...
-%!                'InitialValue',[1,2,3,4],
-%!                'PromptString',{'Select <b>an</b> item...', '...or <b>multiple</b> items'} );
-%!  imax = numel (s);
-%!  for i=1:1:imax
-%!     disp(['Selected: ',num2str(i),': ', itemlist{s(i)}]);
-%!  end
+%! disp ('- test listdlg with selectionmode and preselection. Has caption and two lines prompt.');
+%! itemlist = {'An item \\alpha', 'another', 'yet another'};
+%! s = listdlg ('ListString',itemlist, ...
+%!              'SelectionMode','Multiple', ...
+%!              'Name','Selection Dialog', ...
+%!              'InitialValue',[1,2,3,4],
+%!              'PromptString',{'Select <b>an</b> item...', '...or <b>multiple</b> items'} );
+%! imax = numel (s);
+%! for i=1:1:imax
+%!   disp (['Selected: ',num2str (i),': ', itemlist{s (i)}]);
+%! end
 
 %!demo
-%!  disp('- test listdlg with listsize.');
-%!  itemlist = {"Neutron","Electron","Quark","Proton","Neutrino"};
-%!  s = listdlg ( "ListString",itemlist,
-%!                "Name","Bits and Pieces",
-%!                "ListSize",[200 75] );
-%!  imax = numel (s);
-%!  for i=1:1:imax
-%!     disp(['Selected: ',num2str(i),': ', itemlist{s(i)}]);
-%!  end
+%! disp ('- test listdlg with listsize.');
+%! itemlist = {"Neutron","Electron","Quark","Proton","Neutrino"};
+%! s = listdlg ("ListString",itemlist,
+%!              "Name","Bits and Pieces",
+%!              "ListSize",[200 75] );
+%! imax = numel (s);
+%! for i=1:1:imax
+%!   disp (['Selected: ',num2str (i),': ', itemlist{s (i)}]);
+%! end
+
--- a/scripts/ui/msgbox.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/msgbox.m	Sat Oct 05 11:22:09 2013 -0400
@@ -23,13 +23,13 @@
 ## Display @var{msg} using a message dialog box. 
 ##
 ## The message may have multiple lines separated by newline characters
-## (@code{"\n"}), or it may be a cellstr array with one element for each
+## (@qcode{"\n"}), or it may be a cellstr array with one element for each
 ## line.  The optional input @var{title} (character string) can be used to
 ## decorate the dialog caption.
 ##
 ## The optional argument @var{icon} selects a dialog icon. 
-## It can be one of @code{"none"} (default), @code{"error"}, @code{"help"}, or
-## @code{"warn"}.
+## It can be one of @qcode{"none"} (default), @qcode{"error"},
+## @qcode{"help"}, or @qcode{"warn"}.
 ##
 ## The return value is always 1.
 ## @seealso{errordlg, helpdlg, inputdlg, listdlg, questdlg, warndlg}
@@ -45,10 +45,12 @@
 
 endfunction
 
-%!demo
-%!  disp('- test msgbox message only.');
-%!  msgbox("Below, you should see 3 lines:\nline #1\nline #2, and\nline #3.");
 
 %!demo
-%!  disp('- test msgbox message and caption.');
-%!  msgbox('You should see a single line.','A msgbox');
+%! disp('- test msgbox message only.');
+%! msgbox("Below, you should see 3 lines:\nline #1\nline #2, and\nline #3.");
+
+%!demo
+%! disp('- test msgbox message and caption.');
+%! msgbox('You should see a single line.','A msgbox');
+
--- a/scripts/ui/private/message_dialog.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/private/message_dialog.m	Sat Oct 05 11:22:09 2013 -0400
@@ -63,3 +63,4 @@
   endif
 
 endfunction
+
--- a/scripts/ui/questdlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/questdlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -38,7 +38,8 @@
 ## @var{btn3}.
 ##
 ## If only @var{msg} and @var{title} are specified, three buttons with
-## the default captions "Yes", "No", and "Cancel" are used.
+## the default captions @qcode{"Yes"}, @qcode{"No"}, and @qcode{"Cancel"} are
+## used.
 ##
 ## If only two button captions, @var{btn1} and @var{btn2}, are specified 
 ## the dialog will have only these two buttons.
@@ -81,7 +82,7 @@
       options{4} = varargin{1};  # default
       if (! any (strcmp (options{4}, options(1:3))))
         error (defbtn_error_msg);
-      end
+      endif
 
     case 3
       ## two buttons and default button string
@@ -91,7 +92,7 @@
       options{4} = varargin{3};  # default
       if (! any (strcmp (options{4}, options([1 3]))))
         error (defbtn_error_msg);
-      end
+      endif
 
     case 4
       ## three buttons and default button string
@@ -101,7 +102,7 @@
       options{4} = varargin{4};  # default
       if (! any (strcmp (options{4}, options(1:3))))
         error (defbtn_error_msg);
-      end
+      endif
 
     otherwise
       print_usage ();
@@ -120,55 +121,56 @@
 
 endfunction
 
+
 %!demo
-%!  disp('- test questdlg with two buttons');
-%!  a = questdlg('Would you like some free money?',...
+%! disp ('- test questdlg with two buttons');
+%! a = questdlg ('Would you like some free money?',...
 %!               '$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $',...
 %!               'No', 'Cancel', 'Cancel');
-%!  if strcmp (a, 'No')
-%!    msgbox('Suit yourself.', 'Message Box');
-%!  endif
+%! if (strcmp (a, 'No'))
+%!   msgbox ('Suit yourself.', 'Message Box');
+%! endif
 
 %!demo
-%!  disp('- test questdlg with message and title only.');
-%!  a = 'No';
-%!  c = 0;
-%!  while (strcmp(a, 'No') || !c)
-%!    a = questdlg('Close this Question Dialog?', 'Reductio Ad Absurdum');
-%!    if strcmp(a, 'Yes')
-%!      q = 'Are you sure?';
-%!      while (strcmp(a, 'Yes') && !c)
-%!        a = questdlg(q, 'Reductio Ad Absurdum');
-%!        word = ' really';
-%!        i = strfind(q, word);
-%!        if isempty( i )
-%!          i = strfind(q, ' sure');
-%!          q = [q '!'];
-%!        else
-%!          word = [word ','];
-%!        endif
-%!        q = [q(1:i-1) word q(i:end)];
-%!      endwhile
-%!    endif
-%!    if strcmp(a, 'Cancel')
-%!      warndlg('Answer "Yes" or "No".', 'Warning Dialog');
-%!      a = 'No';
-%!      c = 1;
-%!    endif
-%!  endwhile
-%!  msgbox('Whew!');
+%! disp ('- test questdlg with message and title only.');
+%! a = 'No';
+%! c = 0;
+%! while (strcmp (a, 'No') || !c)
+%!   a = questdlg ('Close this Question Dialog?', 'Reductio Ad Absurdum');
+%!   if (strcmp (a, 'Yes'))
+%!     q = 'Are you sure?';
+%!     while (strcmp (a, 'Yes') && !c)
+%!       a = questdlg (q, 'Reductio Ad Absurdum');
+%!       word = ' really';
+%!       i = strfind (q, word);
+%!       if (isempty (i))
+%!         i = strfind (q, ' sure');
+%!         q = [q '!'];
+%!       else
+%!         word = [word ','];
+%!       endif
+%!       q = [q(1:i-1) word q(i:end)];
+%!     endwhile
+%!   endif
+%!   if (strcmp (a, 'Cancel'))
+%!     warndlg ('Answer "Yes" or "No".', 'Warning Dialog');
+%!     a = 'No';
+%!     c = 1;
+%!   endif
+%! endwhile
+%! msgbox ('Whew!');
 
 %!demo
-%!  disp('- test questdlg with five inputs');
-%!  ans = questdlg('Are you ready Steve?', 'Brian', 'No', 'Uh huh', 'Uh huh');
-%!  if !strcmp (ans, 'No')
-%!    ans = questdlg ('Andy?', 'Brian', 'No', 'Yeah', 'Yeah');
-%!    if !strcmp (ans, 'No')
-%!      ans = questdlg ('Mick?', 'Brian', 'No', 'Okay', 'Okay');
-%!      if !strcmp (ans, 'No')
-%!        ans = msgbox ("Well all right, fellas.    \n\n     Let''s GO!!!!!",...
-%!                      'Ballroom Blitz', 'none');
-%!      endif
-%!    endif
-%!  endif
+%! disp ('- test questdlg with five inputs');
+%! ans = questdlg ('Are you ready Steve?', 'Brian', 'No', 'Uh huh', 'Uh huh');
+%! if (! strcmp (ans, 'No'))
+%!   ans = questdlg ('Andy?', 'Brian', 'No', 'Yeah', 'Yeah');
+%!   if (! strcmp (ans, 'No'))
+%!     ans = questdlg ('Mick?', 'Brian', 'No', 'Okay', 'Okay');
+%!     if (! strcmp (ans, 'No'))
+%!       ans = msgbox ("Well all right, fellas.    \n\n     Let''s GO!!!!!",...
+%!                     'Ballroom Blitz', 'none');
+%!     endif
+%!   endif
+%! endif
 
--- a/scripts/ui/warndlg.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/scripts/ui/warndlg.m	Sat Oct 05 11:22:09 2013 -0400
@@ -24,7 +24,7 @@
 ## The message may have multiple lines separated by newline characters
 ## ("\n"), or it may be a cellstr array with one element for each
 ## line.  The optional input @var{title} (character string) can be used to
-## set the dialog caption.  The default title is "Warning Dialog".
+## set the dialog caption.  The default title is @qcode{"Warning Dialog"}.
 ##
 ## @seealso{helpdlg, inputdlg, listdlg, questdlg}
 ## @end deftypefn
@@ -39,10 +39,12 @@
 
 endfunction
 
-%!demo
-%!  disp('- test warndlg with prompt only.');
-%!  warndlg('Oh, a warning occured');
 
 %!demo
-%!  disp('- test warndlg with prompt and caption.');
-%!  warndlg('Oh, No...','This is the last Warning');
+%! disp ('- test warndlg with prompt only.');
+%! warndlg ('Oh, a warning occured');
+
+%!demo
+%! disp ('- test warndlg with prompt and caption.');
+%! warndlg ('Oh, No...','This is the last Warning');
+
--- a/src/main.cc	Thu Sep 12 21:08:07 2013 -0400
+++ b/src/main.cc	Sat Oct 05 11:22:09 2013 -0400
@@ -41,7 +41,7 @@
   install_defaults ();
 
   if (octave_starting_gui ())
-    retval = octave_start_gui (argc, argv);
+    retval = octave_start_gui (argc, argv, octave_fork_gui ());
   else
     {
       octave_initialize_interpreter (argc, argv, 0);
@@ -51,3 +51,22 @@
 
   return retval;
 }
+
+
+/*!
+@mainpage Source code documentation for GNU Octave
+
+GNU Octave is a high-level language, primarily intended for numerical
+computations.  It provides a convenient interactive command line
+interface for solving linear and nonlinear problems numerically, and
+for performing other numerical experiments.  It may also be used as a
+batch-oriented language for data processing.
+
+GNU Octave is free software. You may redistribute it and/or modify it
+under the terms of the <a href="http://www.gnu.org/licenses/">GNU
+General Public License</a> as published by the Free Software Foundation.
+
+This is the developer documentation for Octave's own source code. It is
+intended to help for hacking Octave. It may also be useful for
+understanding the Octave API when writing your own .oct files.
+*/
--- a/test/Makefile.am	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/Makefile.am	Sat Oct 05 11:22:09 2013 -0400
@@ -34,6 +34,7 @@
   if.tst \
   index.tst \
   io.tst \
+  jit.tst \
   line-continue.tst \
   logical-index.tst \
   null-assign.tst \
@@ -98,6 +99,7 @@
   $(GENERATED_BC_OVERLOADS_FILES)
 
 DISTCLEANFILES = \
+  .gdbinit \
   fntests.log
 
 fixedtestsdir := $(octtestsdir)/fixed
--- a/test/args.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/args.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -123,98 +123,98 @@
 %!  assert (x, 0);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## numeric vector (spaces)
 %!function f (x = [0 1 2])
 %!  assert (x, [0 1 2]);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## numeric vector (range)
 %!function f (x = 1:3)
 %!  assert (x, 1:3);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## numeric vector (commas)
 %!function f (x = [0,1,2])
 %!  assert (x, [0 1 2]);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## numeric vector (commas and spaces)
 %!function f (x = [0, 1, 2])
 %!  assert (x, [0 1 2]);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## numeric matrix
 %!function f (x = [0, 1, 2;3, 4, 5])
 %!  assert (x, [0 1 2;3 4 5]);
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## empty cell
 %!function f (x = {})
 %!  assert (x, {});
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## full cell
 %!function f (x = {1})
 %!  assert (x, {1});
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## many cells
 %!function f (x = {1 'a' "b" 2.0 struct("a", 3)})
 %!  assert (x, {1 'a' "b" 2.0 struct("a", 3)});
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## struct
 %!function f (x = struct("a", 3))
 %!  assert (x, struct ("a", 3));
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## char (double quotes)
 %!function f (x = "a")
 %!  assert (x, "a");
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## char (single quotes)
 %!function f (x = 'a')
 %!  assert (x, "a");
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## char (string, double quotes)
 %!function f (x = "abc123")
 %!  assert (x, "abc123");
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## char (string, double quotes, punctuation)
 %!function f (x = "abc123`1234567890-=~!@#$%^&*()_+[]{}|;':\",./<>?\\")
 %!  assert (x, "abc123`1234567890-=~!@#$%^&*()_+[]{}|;':\",./<>?\\");
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## Function handle (builtin)
 %!function f (x = @sin)
@@ -223,7 +223,7 @@
 %!  assert (isa (x, "function_handle") && strcmp (fname, "sin"));
 %!endfunction
 %!test
-%!  f()
+%! f()
 
 ## Function handle (anonymous)
 %!function f (x = @(x) x.^2)
@@ -232,5 +232,5 @@
 %!  assert (isa (x, "function_handle") && strcmp (ftype, "anonymous"));
 %!endfunction
 %!test
-%!  f()
+%! f()
 
--- a/test/build-sparse-tests.sh	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/build-sparse-tests.sh	Sat Oct 05 11:22:09 2013 -0400
@@ -325,7 +325,7 @@
 %!test
 %! sv = as.^bf;
 %! fv = af.^bf;
-%! idx = find (af~=0);
+%! idx = find (af!=0);
 %! assert (sv(:)(idx), sparse (fv(:)(idx)), 100*eps)
 
 EOF
@@ -342,7 +342,7 @@
 %!test
 %! sv = as.^bs;
 %! fv = af.^bf;
-%! idx = find (af~=0);
+%! idx = find (af!=0);
 %! assert(sv(:)(idx), sparse (fv(:)(idx)), 100*eps)
 
 EOF
@@ -577,11 +577,11 @@
 %!assert (issparse (as.'))
 %!assert (issparse (as'))
 %!assert (issparse (-as))
-%!assert (~as, sparse (~af))
+%!assert (!as, sparse (!af))
 %!assert (as.', sparse (af.'));
 %!assert (as',  sparse (af'));
 %!assert (-as, sparse (-af));
-%!assert (~as, sparse (~af));
+%!assert (!as, sparse (!af));
 %!error [i,j] = size (af);as(i-1,j+1);
 %!error [i,j] = size (af);as(i+1,j-1);
 %!test
@@ -653,7 +653,7 @@
 %!testif HAVE_UMFPACK   # simple LU + row permutations
 %! [L,U,P] = lu (bs);
 %! assert (P'*L*U, bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -662,7 +662,7 @@
 %!testif HAVE_UMFPACK   # simple LU + row/col permutations
 %! [L,U,P,Q] = lu (bs);
 %! assert (P'*L*U*Q', bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -671,7 +671,7 @@
 %!testif HAVE_UMFPACK   # LU with vector permutations
 %! [L,U,P,Q] = lu (bs,'vector');
 %! assert (L(P,:)*U(:,Q), bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -680,7 +680,7 @@
 %!testif HAVE_UMFPACK   # LU with scaling
 %! [L,U,P,Q,R] = lu (bs);
 %! assert (R*P'*L*U*Q', bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -757,7 +757,7 @@
 %!testif HAVE_UMFPACK   # simple LU + row permutations
 %! [L,U,P] = lu (bs);
 %! assert (P'*L*U, bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -766,7 +766,7 @@
 %!testif HAVE_UMFPACK   # simple LU + row/col permutations
 %! [L,U,P,Q] = lu (bs);
 %! assert (P'*L*U*Q', bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -775,7 +775,7 @@
 %!testif HAVE_UMFPACK   # LU with vector permutations
 %! [L,U,P,Q] = lu (bs,'vector');
 %! assert (L (P,:)*U (:,Q), bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -784,7 +784,7 @@
 %!testif HAVE_UMFPACK   # LU with scaling
 %! [L,U,P,Q,R] = lu (bs);
 %! assert (R*P'*L*U*Q', bs, 1e-10);
-%! # triangularity
+%! ## triangularity
 %! [i,j,v] = find (L);
 %! assert (i-j>=0);
 %! [i,j,v] = find (U);
@@ -1204,7 +1204,7 @@
 gen_section
 gen_save_tests
 gen_section
-echo '%!test bf = bf+1i*(bf~=0);' >> $TESTS
+echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS
 gen_rectangular_tests
 gen_section
 
@@ -1242,7 +1242,7 @@
 echo '%! as = sparse (af);' >> $TESTS
 gen_square_tests
 gen_section
-echo '%!test bf = bf+1i*(bf~=0);' >> $TESTS
+echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS
 echo '%! bs = sparse (bf);' >> $TESTS
 gen_square_tests
 gen_section
--- a/test/classes/@Snork/end.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/end.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,6 @@
 function r = end (snk, index_pos, num_indices)
 
-  if (num_indices ~= 1)
+  if (num_indices != 1)
     error ('Snork object may only have one index')
   end
 
--- a/test/classes/@Snork/mpower.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/mpower.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,6 @@
 function s = mpower (s1, x)
 
-  if (~isa (s1, 'Snork') || isa (x, 'Snork'))
+  if (!isa (s1, 'Snork') || isa (x, 'Snork'))
     error ('mpower Snork!!!');
   end
 
--- a/test/classes/@Snork/ne.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/ne.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,5 +1,5 @@
 function b = ne (s1, s2)
 
-  b = ~(s1 == s2);
+  b = !(s1 == s2);
 
 end
--- a/test/classes/@Snork/power.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/power.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,6 +1,6 @@
 function s = power (s1, x)
 
-  if (~isa (s1, 'Snork') || isa (x, 'Snork'))
+  if (!isa (s1, 'Snork') || isa (x, 'Snork'))
     error ('power Snork!!!');
   end
 
--- a/test/classes/@Snork/subsasgn.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/subsasgn.m	Sat Oct 05 11:22:09 2013 -0400
@@ -6,7 +6,7 @@
   switch (s(1).type)
     case '()'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         if (length (s) == 1)
@@ -17,7 +17,7 @@
       end
     case '{}'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         if (length (s) == 1)
--- a/test/classes/@Snork/subsref.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Snork/subsref.m	Sat Oct 05 11:22:09 2013 -0400
@@ -6,14 +6,14 @@
   switch (s(1).type)
     case '()'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         b = snk.cack(ind{1});
       end
     case '{}'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         b = snk.cack(ind{1});
--- a/test/classes/@Spork/loadobj.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/@Spork/loadobj.m	Sat Oct 05 11:22:09 2013 -0400
@@ -1,7 +1,7 @@
 function out = loadobj (in)
 
   out = in;
-  if (~isa (in, 'Spork'))
+  if (!isa (in, 'Spork'))
     out.cack = [];
   end
 
--- a/test/classes/classes.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/classes/classes.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -59,9 +59,9 @@
 %! assert (isobject (snk));
 %! assert (isequal (class (snk), 'Snork'));
 %! assert (isa (snk, 'Snork'));
-%! assert (~isa (snk, 'Sneetch'));
+%! assert (!isa (snk, 'Sneetch'));
 %! assert (ismethod (snk, 'gick'));
-%! assert (~ismethod (snk, 'bletch'));
+%! assert (!ismethod (snk, 'bletch'));
 %! assert (exist ('snk') == 1);
 %! assert (exist ('blink') == 0);
 %!test snk1 = Snork (snk);
@@ -272,17 +272,17 @@
 %!assert (s1 == s1)
 %!assert (s1 == x1)
 %!assert (x1 == s1)
-%!assert (~(s1 == (s1 + 1)))
-%!assert (~(s1 == (x1 + 1)))
-%!assert (~(x1 == (s1 + 1)))
+%!assert (!(s1 == (s1 + 1)))
+%!assert (!(s1 == (x1 + 1)))
+%!assert (!(x1 == (s1 + 1)))
 
-%% Test overloaded ne (~=) for the Snork class
-%!assert (~(s1 ~= s1))
-%!assert (~(s1 ~= x1))
-%!assert (~(x1 ~= s1))
-%!assert (s1 ~= (s1 + 1))
-%!assert (x1 ~= (s1 + 1))
-%!assert (s1 ~= (x1 + 1))
+%% Test overloaded ne (!=) for the Snork class
+%!assert (!(s1 != s1))
+%!assert (!(s1 != x1))
+%!assert (!(x1 != s1))
+%!assert (s1 != (s1 + 1))
+%!assert (x1 != (s1 + 1))
+%!assert (s1 != (x1 + 1))
 
 %% Test overloaded lt (<) for the Snork class
 %!assert (s1 < (s1 + 1))
--- a/test/error.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/error.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -18,7 +18,6 @@
 
 ## Test %!error usage
 
-%% test/octave.test/error/error-1.m
 %!function g ()
 %!  error ("foo");
 %!endfunction
@@ -27,7 +26,6 @@
 %!endfunction
 %!error <foo> f ()
 
-%% test/octave.test/error/error-2.m
 %!function g ()
 %!  error ("foo\n");
 %!endfunction
@@ -36,15 +34,12 @@
 %!endfunction
 %!error <foo> f ()
 
-%% test/octave.test/error/error-3.m
 %!error error ()
 
-%% test/octave.test/error/error-4.m
 %!error <foo> error ("foo\n")
 
 ## Test %!warning usage
 
-%% test/octave.test/error/warning-1.m
 %!function g ()
 %!  warning ("foo");
 %!endfunction
@@ -53,7 +48,6 @@
 %!endfunction
 %!warning <foo> f ()
 
-%% test/octave.test/error/warning-2.m
 %!test
 %! st.identifier = "backtrace";
 %! ws = warning ("query", "backtrace");
@@ -67,7 +61,6 @@
 
 ## Test usage() function
 
-%% test/octave.test/error/usage-1.m
 %!function g ()
 %!  usage ("foo");
 %!endfunction
@@ -76,7 +69,6 @@
 %!endfunction
 %!error <foo> f ()
 
-%% test/octave.test/error/usage-2.m
 %!function g ()
 %!  usage ("foo");
 %!endfunction
@@ -85,9 +77,7 @@
 %!endfunction
 %!error <foo> f ()
 
-%% test/octave.test/error/usage-3.m
 %!error usage ()
 
-%% test/octave.test/error/usage-4.m
 %!error <foo> usage ("foo\n")
 
--- a/test/eval-catch.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/eval-catch.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,56 +16,47 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/eval-catch/eval-catch-1.m
 %!test
 %! eval ("clear a; a;", "");
 
-%% test/octave.test/eval-catch/eval-catch-2.m
 %!test
 %! eval ("", "error ('Should not get here');");
 
-%% test/octave.test/eval-catch/eval-catch-3.m
 %!test
 %! eval ("clear a; a; x = 0;", "x = 1;");
 %! assert (x, 1);
 
-%% test/octave.test/eval-catch/eval-catch-5.m
 %!test
 %! eval ("clear a; a; str = '';", "str=lasterr;");
 %! assert (lasterr()(1:13), "'a' undefined");
 %! assert (str(1:13), "'a' undefined");
 
-%% test/octave.test/eval-catch/eval-catch-6.m
 %!test
 %! eval ("error ('user-defined error'); str = '';", "str = lasterr;");
 %! assert (lasterr()(1:18), "user-defined error");
 %! assert (str(1:18), "user-defined error");
 
-%% test/octave.test/eval-catch/eval-catch-7.m
 %!function ms = mangle (s)
 %!  ## Wrap angle brackets around S.
-%!  ms = cstrcat ("<", s, ">");
+%!  ms = ["<" s ">"];
 %!endfunction
 %!test
 %! eval ("clear a; a; str='';", "str = mangle (lasterr);");
 %! assert (mangle (lasterr)(1:14), "<'a' undefined");
 %! assert (str(1:14), "<'a' undefined");
 
-%% test/octave.test/eval-catch/eval-catch-8.m
 %!test
 %! eval ("eval (\"clear a; a;str1='';\", \"str1=lasterr;\"); clear b; b; str2='';",
 %! "str2 = lasterr;");
 %! assert (str1(1:13), "'a' undefined");
 %! assert (str2(1:13), "'b' undefined");
 
-%% test/octave.test/eval-catch/eval-catch-9.m
 %!test
 %! eval ("clear a; a; str1='';",
 %! "eval (\"clear b; b; str2='';\", \"str2=lasterr;\"); str1=lasterr;");
 %! assert (str1(1:13), "'b' undefined");
 %! assert (str2(1:13), "'b' undefined");
 
-%% test/octave.test/eval-catch/eval-catch-10.m
 %!test
 %! eval ("eval (\"clear a; a; str='';\",\"error (cstrcat (\\\"rethrow: \\\", lasterr));str='';\");",
 %! "str=lasterr;");
--- a/test/for.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/for.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,15 +16,13 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/for/for-1.m
 %!test
 %! for i = 1
 %!   __printf_assert__ ("%d", i);
-%! end
+%! end  # "end" is part of test, check not using "endfor"
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1"));
 
-%% test/octave.test/for/for-2.m
 %!test
 %! for i = 1:4
 %!   __printf_assert__ ("%d", i);
@@ -32,7 +30,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1234"));
 
-%% test/octave.test/for/for-3.m
 %!test
 %! for i = [1,2,3,4]
 %!   __printf_assert__ ("%d", i);
@@ -40,7 +37,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1234"));
 
-%% test/octave.test/for/for-4.m
 %!test
 %! for i = [1,2;3,4]
 %!   __printf_assert__ ("%d", i(1,1));
@@ -49,7 +45,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1324"));
 
-%% test/octave.test/for/for-5.m
 %!test
 %! for i = I
 %!   __printf_assert__ ("%d", imag (i));
@@ -57,7 +52,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1"));
 
-%% test/octave.test/for/for-6.m
 %!test
 %! for i = [1,2,3,4]*I
 %!   __printf_assert__ ("%d", imag (i));
@@ -65,7 +59,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1234"));
 
-%% test/octave.test/for/for-7.m
 %!test
 %! for i = [1,2;3,4]*I
 %!   __printf_assert__ ("%d", imag (i(1,1)));
@@ -74,7 +67,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("1324"));
 
-%% test/octave.test/for/for-8.m
 %!test
 %! for i = [1,2,3,4]
 %!   if (i > 2)
@@ -85,7 +77,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("12"));
 
-%% test/octave.test/for/for-9.m
 %!test
 %! for i = [1,2,3,4]
 %!   if (i < 3)
@@ -110,10 +101,25 @@
 %!   assert (i, {1 + 2*j; 2 + 2*j++})
 %! endfor
 
-%% test parsing of single-quoted character string appearing at the
-%% beginning of a for loop
+## test parsing of single-quoted character string appearing at the
+## beginning of a for loop
 %!test
 %! for i = 1:5
 %!   'foo';
 %! endfor
 %! assert (i, 5);
+
+%!test
+%! parfor i = 1
+%!   __printf_assert__ ("%d", i);
+%! end  # "end" is part of test, check not using "endparfor"
+%! __printf_assert__ ("\n");
+%! assert (__prog_output_assert__ ("1"));
+
+%!test
+%! parfor i = 1:4
+%!   __printf_assert__ ("%d", i);
+%! endparfor
+%! __printf_assert__ ("\n");
+%! assert (__prog_output_assert__ ("1234"));
+
--- a/test/global.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/global.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,12 +16,10 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/global/global-1.m
 %!test
 %! global G = 1;
 %! assert (G,1);
 
-%% test/octave.test/global/global-2.m
 %!function f ()
 %!  global G;
 %!  assert (G,1);
@@ -30,7 +28,6 @@
 %! global G = 1;
 %! f;
 
-%% test/octave.test/global/global-3.m
 %!function f ()
 %!  fail ("G");
 %!endfunction
@@ -38,15 +35,13 @@
 %! global G = 1;
 %! f ();
 
-%% test/octave.test/global/global-4.m
 %!function f ()
 %!  global H = 1;
 %!endfunction
 %!test
-%!  f;
-%!  fail ("H");
+%! f;
+%! fail ("H");
 
-%% test/octave.test/global/global-5.m
 %!function f ()
 %!  global H = 1;
 %!endfunction
@@ -56,7 +51,6 @@
 %!test
 %! g ();
 
-%% test/octave.test/global/global-6.m
 %!function f ()
 %!  global H = 1;
 %!endfunction
@@ -68,7 +62,6 @@
 %! f ();
 %! g ();
 
-%% test/octave.test/global/global-7.m
 %!test
 %!function f ()
 %!  global H = 1;
@@ -76,7 +69,6 @@
 %!test
 %! fail ("H");
 
-%% test/octave.test/global/global-8.m
 %!function f ()
 %!  global H = 1;
 %!endfunction
--- a/test/if.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/if.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,25 +16,22 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/if/if-1.m
 %!test
 %! i = 0;
 %! if (i == 0)
 %!   i++;
 %!   __printf_assert__ ("%d\n", i);
-%! endif
+%! end  # "end" is part of test, check not using "endif"
 %! assert (__prog_output_assert__ ("1"));
 
-%% test/octave.test/if/if-2.m
 %!test
 %! if (eye (2))
 %!   __printf_assert__ ("fail\n");
 %! else
 %!   __printf_assert__ ("pass\n");
-%! end
+%! endif
 %! assert (__prog_output_assert__ ("pass"));
 
-%% test/octave.test/if/if-3.m
 %!test
 %! x = 2;
 %! if (eye (2))
@@ -44,7 +41,6 @@
 %! endif
 %! assert (__prog_output_assert__ ("pass"));
 
-%% test/octave.test/if/if-4.m
 %!test
 %! x = 0;
 %! y = -2;
@@ -54,10 +50,9 @@
 %!   __printf_assert__ ("fail\n");
 %! elseif (y)
 %!   __printf_assert__ ("pass\n");
-%! end
+%! endif
 %! assert (__prog_output_assert__ ("pass"));
 
-%% test/octave.test/if/if-5.m
 %!test
 %! x = 0;
 %! y = -2;
@@ -72,7 +67,6 @@
 %! endif
 %! assert (__prog_output_assert__ ("pass"));
 
-%% test/octave.test/if/if-6.m
 %!test
 %! x = 0;
 %! y = -2;
@@ -82,11 +76,11 @@
 %!   __printf_assert__ ("fail\n");
 %! elseif (x)
 %!   __printf_assert__ ("fail\n");
-%! end
+%! endif
 %! assert (__prog_output_assert__ ("pass"));
 
-%% test parsing of single-quoted character string appearing at the
-%% beginning of an if condition
+## test parsing of single-quoted character string appearing at the
+## beginning of an if condition
 %!test
 %! if (1)
 %!   'foo';
@@ -94,8 +88,8 @@
 %! endif
 %! assert (x, 13);
 
-%% test parsing of single-quoted character string appearing at the
-%% beginning of an if condition
+## test parsing of single-quoted character string appearing at the
+## beginning of an if condition
 %!test
 %! if (0)
 %!   x = 42;
@@ -104,3 +98,4 @@
 %!   x = 13;
 %! endif
 %! assert (x, 13);
+
--- a/test/index.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/index.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -134,7 +134,7 @@
 %!assert (b([],3), zeros (0,1))
 
 %!shared x
-%! # Dummy shared block to clear any previous definitions
+%! ## Dummy shared block to clear any previous definitions
 %! x = 1;
 
 %!test
--- a/test/io.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/io.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -20,7 +20,6 @@
 ## saving sparse matrices to MAT files when using 64-bit indexing since
 ## that is not implemented yet.
 
-%% test/octave.test/io/load-save.m
 %!function [ret, files] = testls (input)
 %!  ## flag a1 global so as to test the storage of global flags
 %!  global a1;
@@ -179,7 +178,7 @@
 %!  ret = 1;
 %!endfunction
 
-%!test
+%!testif HAVE_ZLIB
 %!
 %! [save_status, save_files] = testls (0);
 %! [load_status, load_files] = testls (1);
@@ -223,7 +222,7 @@
 %! matrix1 = rand (100, 2);
 %! save -ascii matrix.ascii matrix1
 %! matrix2 = load ("matrix.ascii");
-%! assert (matrix1, matrix2, 1e-9)
+%! assert (matrix1, matrix2, 1e-9);
 %!
 %! delete matrix.ascii;
 
@@ -232,17 +231,12 @@
 %% FIXME: This test is disabled as it writes to stdout and there is no easy
 %% way to recover output.  Need to spawn new octave process and pipe stdout
 %% somewhere to treat this case.
-%% test/octave.test/io/puts-1.m
 %!#test
 %! puts ("foo\n");
 
-%% test/octave.test/io/puts-2.m
 %!assert (puts (1),-1)
 
-%% test/octave.test/io/puts-3.m
 %!error <Invalid call to puts> puts ()
-
-%% test/octave.test/io/puts-4.m
 %!error <Invalid call to puts> puts (1, 2)
 
 %!assert (sscanf ('123456', '%10c'), '123456')
@@ -250,11 +244,11 @@
 
 %!assert (sscanf (['ab'; 'cd'], '%s'), 'acbd')
 
-%!assert (sscanf ('02:08:30', '%i:%i:%i'), [2; 0]);
-%!assert (sscanf ('02:08:30', '%d:%d:%d'), [2; 8; 30]);
+%!assert (sscanf ('02:08:30', '%i:%i:%i'), [2; 0])
+%!assert (sscanf ('02:08:30', '%d:%d:%d'), [2; 8; 30])
 
-%!assert (sscanf ('0177 08', '%i'), [127; 0; 8]);
-%!assert (sscanf ('0177 08', '%d'), [177; 8]);
+%!assert (sscanf ('0177 08', '%i'), [127; 0; 8])
+%!assert (sscanf ('0177 08', '%d'), [177; 8])
 
 %!test
 %! [val, count, msg, pos] = sscanf ("3I2", "%f");
@@ -277,7 +271,6 @@
 %! assert (msg, "");
 %! assert (pos, 6);
 
-%% test/octave.test/io/sscanf-1.m
 %!test
 %! [a, b, c] = sscanf ("1.2 3 foo", "%f%d%s", "C");
 %! [v1, c1, m1] = sscanf ("1 2 3 4 5 6", "%d");
@@ -287,22 +280,15 @@
 %! && v1 == [1; 2; 3; 4; 5; 6] && c1 == 6 && ischar (m1)
 %! && v2 == [1; 2] && c2 == 2 && ischar (m2)));
 
-%% test/octave.test/io/sscanf-2.m
 %!error <Invalid call to sscanf> sscanf ()
-
-%% test/octave.test/io/sscanf-3.m
 %!error sscanf (1, 2)
-
-%% test/octave.test/io/sscanf-4.m
 %!error <Invalid call to sscanf> sscanf ("foo", "bar", "C", 1)
 
-%% test/octave.test/io/sscanf-5.m
 %!test
 %! [x, n] = sscanf ("   0.024000 0.200 0.200 2.000         1987           5           0  0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 2 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 4 5 1 2    2 5 5 8 2 8 12 6 15 18 28 26 47 88 118 162 192 130 88 56 27 23 14 9 6 3 4 1 0    2 3 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0   0.026000 0.250 0.250 2.100         3115           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0    0 0 0 0 1 0 1 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 1    1 1 0 1 0 1 3 2 0 5 15 25 44 66 145 179 193 172 104 57 17 11 12 2 1 0 1 1 0 1    0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.028000 0.300 0.300 2.200         4929           3           0  1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0    1 0 1 0 1 2 2 3 2 3 14 21 49 80 148 184 218 159 124 63 37 13 12 3 1 1 0 0 0 0    0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.030000 0.350 0.350 2.300         7051           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1    0 0 1 0 0 0 2 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1    0 0 0 2 0 0 0 1 5 6 14 28 51 88 154 177 208 169 124 65 39 15 5 3 3 2 1 0 1 0 1   0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.032000 0.400 0.400 2.400         9113           4           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0    1 0 0 0 0 2 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 2 0    1 0 0 1 1 0 2 3 5 3 17 30 60 117 156 189 209 129 102 64 56 16 11 4 2 2 0 0 0 0   1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0   0.034000 0.450 0.450 2.500        11811           6           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0    0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0    0 0 2 1 0 0 1 0 5 5 15 21 57 99 149 190 195 159 130 69 41 16 10 2 5 3 0 1 0 0    0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.036000 0.500 0.500 2.600        14985           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 0 0    0 0 0 0 1 0 0 2 2 6 10 34 60 95 126 177 194 155 99 71 44 17 6 7 2 0 0 0 3 0 0    1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.038000 0.550 0.550 2.700        18391           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0    0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 2 0 0 1 1 0 1    2 1 0 0 0 1 0 1 3 6 19 27 52 95 161 154 169 134 94 64 37 19 9 6 0 2 1 0 0 0 0    1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 2 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0    0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.040000 0.600 0.600 2.800        22933           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1    0 0 0 0 0 2 0 3 4 7 18 27 47 82 134 163 133 138 101 58 34 26 10 5 2 1 2 1 1 0    2 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0   0.042000 0.650 0.650 2.900        27719           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 1 0 0 0 1 1 2 8 16 37 51 87 128 153 146 123 105 62 35 24 8 3 5 0 1 2 1 0 0   0 1 1 1 0 0 0 1 0 1 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0    0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.044000 0.700 0.700 3.000        32922           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 2 0    0 0 0 0 0 0 0 2 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 1    1 1 0 0 0 1 4 3 5 5 15 35 54 88 132 168 149 105 92 62 30 16 17 4 5 1 0 0 1 0 1   1 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.046000 0.750 0.750 3.100        38973           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0    0 0 0 1 0 0 0 4 3 5 20 37 56 94 110 135 149 124 84 58 36 17 14 7 1 0 2 0 1 0 0   1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1    1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0    1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.048000 0.800 0.800 3.200        45376           5           0  1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 2 1 1 2 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0    0 0 0 1 0 0 0 0 1 3 18 34 55 82 104 135 116 99 79 60 51 29 10 4 3 1 1 1 0 0 1    0 0 0 1 0 0 3 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1    0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.050000 0.850 0.850 3.300        52060           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1    0 0 0 0 0 2 2 1 3 12 24 40 39 107 121 127 138 100 86 68 44 23 15 7 3 1 1 0 1 1   0 0 2 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 2 0 0 0 1 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.052000 0.900 0.900 3.400        59454           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 1    0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0    0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 2 0 2 1 0 0 0 1 0    0 1 0 0 0 0 0 3 3 6 21 32 68 90 132 111 122 107 73 57 47 24 11 7 4 2 2 1 0 0 0   0 0 0 0 0 1 0 0 1 0 0 2 0 1 1 0 0 1 0 0 0 0 0 3 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0   0.054000 0.950 0.950 3.500        67013           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 0 0 0    1 0 1 0 1 2 4 3 7 9 28 31 71 94 115 96 108 78 82 60 38 17 12 11 4 3 1 1 0 2 1    0 0 0 2 1 3 0 0 0 0 3 0 0 1 0 0 0 0 0 0 0 2 0 0 0 1 0 2 0 1 0 2 0 1 0 0 1 0 0    0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0   0.056000 1.000 1.000 3.600        75475           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 3 0 0 1    1 2 0 1 4 0 1 8 6 7 17 41 56 71 109 113 84 103 72 54 35 22 6 9 1 7 5 4 0 0 1 0   0 0 0 0 0 1 0 0 2 1 0 0 0 0 2 0 0 1 0 0 1 0 0 0 0 0 0 1 0 2 0 1 0 0 0 0 1 0 1    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 3 0 0 0 1 0 0 0 0 0 0 1 1 0 0 2 0 0 0 0    0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0   0.058000 1.050 1.050 3.700        83558           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 2 0 0    2 0 0 1 0 3 2 3 6 15 27 41 77 73 94 94 92 76 61 56 42 23 13 11 6 2 1 2 0 1 2 0   0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 2 0 0 0 0 0 1 2 0    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0   0.060000 1.100 1.100 3.800        93087           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1    0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 2 2 0 0 0 1 0 1 1 0 0 0 1 1 0 4    0 0 1 2 0 3 1 3 5 13 33 31 65 75 77 96 97 80 59 45 36 32 18 2 5 0 1 0 0 1 0 0    3 0 0 0 0 1 0 0 0 0 0 1 0 0 1 2 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 2 0 0 2 0 1 0    0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0    0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.062000 1.150 1.150 3.900       102829           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0    0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 0 2 0 2    1 2 0 0 2 4 3 5 11 9 23 43 53 68 65 87 83 77 59 49 34 18 15 9 4 2 3 2 0 0 0 4    0 1 1 0 0 2 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 2 0 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0    0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0   0.064000 1.200 1.200 4.000       113442           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0    0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1    2 0 0 0 2 0 4 5 11 13 29 39 61 68 61 75 76 74 73 44 37 29 19 6 3 3 2 0 1 2 1 0   0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 1 2 0 2 1 1 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0    0 0 0 0 1 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0    0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0   0.066000 1.250 1.250 4.100       126668           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0    0 0 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1    0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 2 3 0 2 1 2 0 1 0 3 0 0 0 1 0 1 1 3    0 0 1 3 0 2 4 3 12 12 30 48 56 66 77 78 71 82 52 31 32 19 20 16 8 2 1 3 0 0 2    1 0 1 0 1 0 0 0 1 3 1 0 1 0 1 1 1 0 0 0 0 0 2 0 2 0 0 0 0 0 1 0 0 0 0 1 1 0 0    0 0 0 1 0 0 0 0 0 2 0 3 1 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.068000 1.300 1.300 4.200       138042           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 2 0 0 1 0 1 0 0 0 0 0    0 0 0 1 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0    0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 3 0 0 1 0 0 1 2 0 0 0 3 0 1 0 0 3 0    1 0 1 1 3 1 4 7 11 14 27 36 44 68 72 70 71 45 44 46 29 13 16 11 5 2 0 3 0 0 0    0 1 1 2 0 0 1 1 2 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 2 0 0 1 1 0 1 1 1 0    0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0    0 0 0 1 0 0 1 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0.070000 1.350 1.350 4.300       152335           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0    1 0 0 0 2 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 2 0    0 0 0 0 2 0 1 7 14 19 34 35 54 72 68 72 68 58 48 36 37 27 25 17 1 4 1 0 0 0 1    2 2 0 0 1 1 1 2 1 0 3 1 0 1 0 2 1 0 0 0 1 1 1 2 0 0 0 0 1 1 0 1 1 0 2 1 1 1 1    0 0 0 1 1 0 0 2 0 0 1 0 0 0 1 1 0 2 1 1 0 0 0 0 2 0 0 0 0 0 0 0 1 1 0 0 0 0 1    0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0   0.072000 1.400 1.400 4.400       166280           4           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0    0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0    2 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 0 0 3 4 2 2 0 0 0 0 0 1 1 3 1 0 3 2 2    1 2 2 0 2 2 1 8 14 26 24 29 47 47 68 65 63 55 42 41 26 29 17 8 4 4 1 0 1 2 0 0   0 1 1 2 0 1 2 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 2 1 2 1 0 0 0 0 0 1 1 2 0 2 2 0    0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0    0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0   0.074000 1.450 1.450 4.500       179484           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0    1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 1 0 1 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 1 0    0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1 1 2 0 0 1 1 2 1 0    1 1 2 2 0 1 5 6 10 20 43 50 57 62 53 62 66 45 42 33 27 26 23 14 3 0 2 0 1 0 0    1 1 0 0 2 1 1 0 0 3 0 1 1 1 0 1 1 0 1 0 1 2 1 0 0 1 2 0 2 0 0 0 0 1 1 3 1 0 0    2 1 1 1 0 0 0 0 0 0 1 2 0 1 0 0 0 0 0 1 1 0 2 0 0 0 0 0 1 0 2 1 0 0 0 0 0 0 1    0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0   0.076000 1.500 1.500 4.600       197657           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 0 0 0 1 1 0 0 0 0 0 0 1 0 1 0    0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 2 0 0 0 1 0 0 0 0    0 0 1 0 1 0 0 0 0 0 0 0 0 1 2 0 0 0 2 1 1 0 1 1 0 1 1 3 2 1 1 2 1 0 1 0 0 0 0    0 1 1 1 0 5 3 7 12 24 38 32 41 48 54 66 71 49 46 31 38 25 15 8 6 6 5 0 1 3 0 1   1 1 1 1 0 1 2 0 1 0 0 0 1 0 2 1 2 0 0 0 0 1 3 1 0 0 0 0 1 1 0 1 0 1 1 1 1 1 0    4 1 1 1 0 3 0 0 0 2 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0    0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0   0.078000 1.550 1.550 4.700       212054           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0    0 1 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1    0 0 2 0 0 0 1 0 0 1 0 1 1 0 1 3 1 0 0 1 2 0 0 0 1 0 0 0 0 0 2 1 2 1 1 1 0 0 1    5 1 1 2 3 5 7 9 11 22 31 37 48 50 52 54 57 37 38 38 33 24 11 19 11 3 1 2 0 3 3   2 1 0 1 3 0 1 1 1 1 1 2 0 0 0 1 1 2 0 1 1 3 0 1 1 0 0 1 0 2 0 1 0 0 1 3 0 2 0    1 0 1 2 0 1 1 1 1 1 0 3 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0   0.080000 1.600 1.600 4.800       231971           3           0  0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 2 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1    0 0 0 0 2 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 2 1 0 1 1 1 0 1 0 0 1 0 1 3 0 0 0 1 0    0 0 1 1 1 0 0 4 1 1 0 2 0 1 1 1 2 0 0 0 1 0 1 2 1 2 3 2 0 1 0 4 3 1 1 1 1 3 1    0 0 0 2 1 0 2 7 17 13 29 47 58 59 52 38 51 51 38 34 35 21 14 13 4 1 0 1 1 1 0    2 2 4 1 0 1 1 4 0 0 0 2 0 2 2 2 0 0 1 3 2 1 1 2 2 2 2 1 0 3 0 2 1 2 1 2 2 0 0    1 1 0 2 0 2 2 0 1 0 2 2 3 1 2 3 1 1 0 1 0 2 0 1 2 1 2 0 2 1 0 0 3 0 0 1 1 1 1    0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0   0.082000 1.650 1.650 4.900       252503           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 2 0 0    0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0    0 0 0 0 2 0 0 1 0 1 2 2 2 1 0 2 0 1 0 1 1 2 2 0 3 0 0 4 1 0 0 3 0 0 1 2 0 1 1    1 3 0 1 0 2 9 11 25 27 34 53 41 49 43 47 36 31 38 22 30 22 18 9 5 9 2 2 1 2 2    3 1 4 1 1 0 0 1 2 0 2 1 0 0 1 3 2 2 1 0 0 0 1 2 1 0 0 0 2 1 1 0 2 0 0 1 0 0 2    1 3 1 1 1 0 2 1 1 0 2 1 0 1 3 0 0 0 0 2 0 0 1 0 0 0 0 0 1 2 1 1 1 0 2 1 0 0 0    2 0 1 0 0 0 0 1 0 0 0 0 1 0 0 2 0 1 0 1 0 0 0 0 0 0 0 0 0 0   0.084000 1.700 1.700 5.000       267889           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 1    0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0    0 1 0 1 1 0 3 0 1 1 1 0 1 2 1 0 2 0 2 4 0 1 0 0 0 1 1 0 1 3 2 0 2 0 4 0 0 2 0    1 4 2 4 3 3 6 10 14 28 37 54 36 40 52 40 50 46 40 32 26 29 12 18 5 2 0 2 4 1 2   1 0 2 1 2 2 1 0 1 0 2 1 2 4 1 1 5 1 0 2 0 1 2 3 2 2 1 2 1 0 2 1 2 1 1 4 1 2 1    4 0 2 2 0 0 3 1 0 2 0 0 1 1 1 0 0 2 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 0    0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0   0.086000 1.750 1.750 5.100       290294           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0    0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 3 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 2    1 0 1 0 1 0 0 2 2 0 1 2 2 0 2 0 2 0 1 0 0 1 1 1 3 1 1 1 1 3 4 1 1 2 2 2 1 0 3    0 0 0 2 4 5 6 16 18 20 31 40 54 55 46 41 52 35 27 21 28 27 20 15 8 6 7 1 0 0 3   0 0 2 2 0 3 1 3 1 1 2 0 0 1 2 1 3 2 0 1 2 1 3 1 1 1 1 1 2 0 2 1 0 1 1 1 3 1 1    2 0 1 0 1 0 2 1 1 0 0 1 2 0 3 1 1 0 0 0 1 3 1 1 1 0 0 1 2 1 0 0 1 1 1 0 0 1 0    0 0 0 0 0 2 0 1 0 0 0 2 1 0 2 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0   0.088000 1.800 1.800 5.200       312476           6           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0    0 0 2 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 2 0 0 0 1 0 1 0 0 0 0 0 0 2    1 0 0 1 0 0 1 1 1 1 4 2 0 1 0 0 3 0 0 0 0 0 1 1 4 0 0 0 0 1 1 2 1 0 3 0 0 2 2    4 0 3 1 6 9 10 13 21 24 32 43 33 41 43 49 50 32 26 31 27 12 16 17 3 3 3 5 0 3    0 2 1 3 3 2 1 2 3 1 2 1 1 1 2 0 1 1 0 2 0 3 0 0 2 0 0 0 0 1 0 1 1 3 3 0 1 1 1    1 1 1 2 2 2 0 3 1 0 2 2 2 0 0 0 0 3 1 2 5 1 1 2 0 0 3 3 0 2 2 0 0 0 0 1 2 0 0    1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0   0.090000 1.850 1.850 5.300       337348           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 2 0 1 0 1 0 0 0 1 0 0 0    0 0 0 1 0 0 0 0 2 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0    2 0 0 0 1 3 2 0 0 2 2 3 3 2 2 2 0 0 1 1 3 1 3 0 0 0 0 0 0 1 2 1 2 1 2 2 2 0 1    1 0 4 2 2 7 6 15 22 21 39 37 50 31 51 30 33 34 34 26 21 14 13 10 9 4 3 3 4 2 2   0 1 2 3 3 0 1 3 2 5 3 2 2 4 0 2 3 0 4 2 1 2 2 2 4 2 1 3 1 3 2 1 3 1 2 4 1 1 1    1 2 4 1 3 3 3 1 0 4 1 0 1 1 1 1 2 3 0 3 0 0 4 1 1 1 0 2 2 2 1 2 2 0 1 1 0 0 0    2 0 1 0 1 0 0 1 0 0 0 1 3 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0   0.092000 1.900 1.900 5.400       357303           3           0  0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0    0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 3 1 0 1 0 0 0 0 1 0 0 1 0 0 1 1 2 2 0 0 2    2 1 1 1 1 1 1 0 1 0 0 1 1 1 3 1 1 1 1 1 0 1 4 0 1 1 1 3 0 1 1 2 2 2 0 2 3 2 2    2 2 1 2 1 3 8 22 14 32 36 46 39 42 39 29 36 38 26 24 26 18 16 19 10 9 3 6 5 0    3 2 1 1 1 2 0 2 1 1 0 1 1 3 1 0 2 4 2 2 1 4 1 2 2 1 1 0 1 2 0 2 2 2 4 2 1 1 0    2 1 3 1 2 3 4 2 3 2 3 0 1 2 1 0 0 0 4 1 1 1 2 1 3 1 0 5 1 0 0 0 0 0 0 1 0 2 0    1 2 1 0 1 0 0 0 0 0 1 1 0 1 0 1 4 0 0 0 1 0 1 0 0 0 0 0 0 0 0   0.094000 1.950 1.950 5.500       383138           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 1 0    0 0 1 0 0 2 1 0 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 2 1 1 1 1    2 1 0 2 0 1 0 3 2 1 3 0 1 3 1 1 0 5 0 1 0 1 2 0 0 1 1 2 0 0 6 1 0 3 2 2 3 4 5    0 4 2 1 5 4 11 15 22 27 28 57 38 38 40 38 39 38 27 26 30 18 14 10 10 4 4 4 3 3   2 2 2 2 1 1 1 1 2 2 3 4 1 2 3 1 2 1 2 2 2 1 3 2 1 5 0 1 1 1 3 2 2 2 1 3 1 1 0    3 2 2 0 0 2 2 2 0 0 0 2 0 1 3 1 2 3 2 1 1 0 1 1 1 0 3 2 2 1 0 0 1 3 1 1 0 1 0    0 0 0 0 1 0 0 0 0 1 0 0 3 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0   0.096000 2.000 2.000 5.600       409868           3           0  0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 2 0 0    1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 2 0 1 0 0 2 0 2 0 0 0 0 1 0 0 2 1    2 2 2 1 2 1 1 1 1 1 2 0 0 1 1 0 1 0 2 1 2 0 2 0 3 1 2 1 3 1 5 0 2 2 1 2 4 1 2    0 3 1 4 7 5 9 13 22 19 31 27 28 41 34 39 37 22 23 21 22 17 23 15 8 9 3 8 0 3 1   2 2 2 3 1 0 4 2 4 2 2 2 2 4 2 1 1 0 2 0 3 0 3 2 2 1 2 2 1 4 1 2 2 1 1 5 2 1 2    1 2 2 1 0 2 4 3 2 1 2 2 3 2 3 1 2 1 1 1 1 2 1 1 2 2 1 2 3 2 1 1 0 2 2 4 0 1 1    1 1 1 0 0 1 1 3 0 0 0 0 0 1 0 0 2 0 1 2 0 1 1 1 0 1 0 1 0 0   0.098000 2.050 2.050 5.700       439102           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 0 1 1 0    0 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1 2 0 0 1 1 1 1 2 0 1 1 0 0 0 0 1 1 1 0 4 0 0    0 2 1 1 0 3 4 0 1 2 2 1 0 3 0 3 2 0 0 2 0 1 0 0 1 0 1 3 1 3 5 0 2 2 3 5 2 2 2    0 3 2 3 6 5 16 21 19 23 28 29 35 42 42 44 39 33 23 30 18 25 24 15 13 5 4 2 2 0   3 3 0 0 1 3 0 1 1 3 2 4 3 4 2 1 1 1 3 1 0 0 2 2 4 2 2 1 4 2 4 2 2 2 1 2 2 1 2    0 4 2 2 3 1 2 1 1 2 2 1 2 4 2 1 4 1 2 2 2 2 0 2 0 3 0 1 0 2 1 0 4 2 1 3 2 1 0    2 1 1 1 1 0 1 1 2 1 1 1 2 0 1 0 2 1 1 0 0 1 0 0 1 0 0 0 0 0 0   0.100000 2.100 2.100 5.800       467340           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 1 0 0 1 2 0 0 0 0 0 1 0 2 0 0 2 0 0 1 1 0 0    0 1 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 1 2 0 2    2 4 1 0 1 1 2 3 4 1 4 1 5 1 2 1 0 2 2 2 1 5 4 1 5 4 0 1 2 4 2 2 0 2 1 2 5 4 1    1 1 2 5 7 9 16 23 31 15 22 36 36 44 42 29 31 28 28 18 35 12 10 13 8 4 3 2 2 5    1 2 3 3 1 3 3 5 2 0 3 4 1 2 2 3 0 0 5 2 3 6 2 1 2 5 3 4 3 1 1 1 1 2 2 4 0 2 3    1 2 1 2 4 5 4 3 5 2 1 2 0 5 0 2 2 4 1 0 4 1 0 2 1 2 0 0 1 3 2 4 3 0 2 3 3 3 4    2 2 0 0 0 0 1 1 0 3 2 0 1 2 0 4 2 1 1 1 2 0 0 0 0 0 0 0 0 0 0   0.102000 2.150 2.150 5.900       497495           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 2 1 0 0 0 0 1 0 1 0 0 0 0 1 2    0 0 0 0 0 2 0 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1 1 1 2 0 0 1 0 0 0 1 0 2 2 1 0 0 0    2 0 2 1 1 1 6 3 2 0 3 2 2 2 1 1 3 4 1 0 1 2 4 2 3 3 1 1 1 1 3 3 1 4 1 3 4 3 2    3 1 2 2 5 11 11 14 26 27 28 28 28 36 39 42 29 33 24 20 29 18 13 17 13 6 10 4 3   3 6 1 0 1 0 2 1 3 2 3 1 2 3 1 2 1 2 0 2 2 3 1 3 1 1 2 4 4 1 4 3 2 2 3 5 5 3 0    2 5 3 5 1 4 1 1 3 4 2 2 2 2 1 3 0 1 1 2 2 4 2 1 3 2 0 1 2 1 0 2 3 1 2 0 0 0 2    0 0 1 3 0 0 1 2 0 3 1 0 3 1 2 2 1 1 2 0 0 0 0 2 0 0 1 0 0 0 0 0   0.104000 2.200 2.200 6.000       529288           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0    0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 1 3 0 2 0 2 0 0    3 2 2 0 4 0 3 2 2 1 3 1 7 3 1 1 0 4 3 2 1 0 0 3 2 3 5 2 1 4 1 5 1 0 3 2 3 0 1    2 4 7 3 7 8 12 15 20 24 34 39 34 35 27 36 34 23 22 26 15 24 12 12 14 5 3 0 7 1   1 3 5 1 2 2 2 4 3 1 2 5 2 2 3 1 1 4 2 1 3 0 4 5 4 6 4 5 3 3 3 3 1 1 5 0 6 1 2    4 2 3 2 1 3 2 0 0 0 1 3 3 0 1 4 0 3 2 3 0 3 3 0 2 3 4 3 1 1 1 2 5 3 1 2 1 1 2    4 1 0 2 4 1 3 0 0 3 0 1 3 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0   0.106000 2.250 2.250 6.100       560628           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 1    1 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 0 1 1 2 0 0 0 0 2 0 3 1 1 0 0 2 2 2 0 5 2 1    1 1 1 3 1 2 3 0 1 0 0 0 0 1 0 2 2 1 2 1 0 4 3 2 1 2 1 0 4 2 2 0 2 1 1 2 3 1 2    1 2 4 4 11 12 17 19 19 29 30 24 30 35 51 32 36 34 31 19 22 17 11 19 11 7 6 6 3   4 0 3 3 2 0 2 2 2 3 1 5 3 2 3 5 1 0 2 2 5 4 2 3 2 0 1 6 1 2 2 2 2 1 1 2 2 1 4    3 2 2 1 2 5 2 0 2 0 2 5 4 5 2 1 3 6 1 3 4 4 0 0 6 0 2 6 1 2 2 2 0 1 3 1 3 4 2    1 4 2 1 2 3 3 0 3 1 0 2 0 2 1 0 2 1 2 0 0 1 1 0 2 0 0 0 0 0 0 0   0.108000 2.300 2.300 6.200       593293           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 2 0 2 2 1 0 0 2 0 1 0 1 0 0 1 2 2 1 0    0 1 0 2 0 0 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 1 2 2 1 0 1 1 0 1 5 0 2 4 1 0 1 4    2 1 3 2 2 3 2 3 2 0 0 3 4 3 1 3 2 2 0 3 0 2 4 0 3 2 5 1 2 1 4 6 1 2 4 0 3 6 1    7 6 4 5 4 10 16 24 22 20 40 37 44 34 29 21 28 36 36 27 23 24 14 10 4 5 2 5 3 6   2 3 3 1 4 2 1 5 1 3 5 3 2 1 2 2 6 2 3 1 1 0 5 3 3 3 4 5 2 2 3 3 5 5 1 6 2 3 2    6 0 5 2 4 3 5 1 2 2 5 1 2 3 1 2 2 2 4 2 5 5 2 2 2 5 0 1 2 5 2 3 2 3 1 1 2 4 0    2 1 4 2 1 1 1 0 1 2 0 0 1 3 1 0 2 1 1 3 3 2 0 0 0 1 2 0 0 0 0   0.110000 2.350 2.350 6.300       636559           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 1 0 0 0 1 1 2 0 0 1 0 0 0 0 0 0 0    1 2 0 0 1 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 2 0 1 0 1 0 1 0 0 1 1 3 0 1 2 2 0 2 1    1 1 1 0 1 0 1 3 0 3 2 3 4 3 3 4 3 3 2 6 3 1 1 1 2 4 2 3 1 5 1 3 1 4 5 3 3 2 1    3 7 4 3 10 19 17 19 23 27 28 33 39 36 23 23 32 32 16 19 35 23 12 11 12 8 4 5 7   1 2 2 1 2 3 5 4 2 3 2 6 4 4 2 4 1 2 2 1 2 3 0 4 2 1 2 6 2 2 1 3 3 1 6 4 8 5 2    3 5 2 3 0 3 2 3 1 2 2 3 4 3 8 6 2 1 4 6 3 1 2 0 2 0 2 5 0 3 3 3 3 1 3 3 2 5 4    2 1 4 2 2 4 4 1 3 2 5 2 3 1 2 0 4 0 1 0 6 3 1 2 0 2 0 1 0 0 0 0   0.112000 2.400 2.400 6.400       670484           3           0  0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 2    0 1 1 1 3 0 0 0 2 1 3 0 1 1 1 0 1 1 1 0 0 1 2 0 1 3 1 5 2 3 0 4 0 2 0 0 1 2 1    0 1 0 0 1 0 2 2 3 2 3 2 2 2 3 4 4 2 3 5 3 3 2 3 3 4 2 4 0 3 2 4 4 1 3 1 3 4 2    2 5 2 8 6 12 17 14 22 27 26 29 39 30 24 36 22 22 20 9 19 15 5 12 16 4 7 5 7 5    5 1 4 5 5 4 4 1 4 4 3 3 3 4 2 2 4 2 4 4 4 4 0 2 3 2 1 4 3 6 1 3 3 3 4 5 4 2 2    2 5 3 0 2 5 4 2 5 3 5 1 1 3 1 1 3 6 6 2 3 2 0 3 2 4 3 4 1 2 2 6 2 0 3 2 2 5 3    3 5 2 1 0 3 1 1 2 2 0 1 1 3 2 3 2 1 1 1 1 3 2 1 0 0 0 0 0 0 0   0.114000 2.450 2.450 6.500       711783           4           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 1 0 2 1 2 0 1 0 0 1 0 0 1 1 1 1 0 0 0 1    1 2 0 1 1 0 0 0 2 1 1 1 1 1 2 1 2 3 3 1 1 1 2 3 1 3 2 2 1 0 1 1 4 4 4 1 0 4 0    0 1 1 2 1 3 2 0 3 4 1 1 1 1 3 2 0 1 3 2 1 2 1 0 3 3 2 5 4 2 5 3 4 2 2 5 3 3 3    3 5 5 8 7 14 12 28 22 24 23 36 33 26 32 27 26 18 30 24 15 13 19 15 17 6 5 7 5    4 3 5 3 1 4 4 9 5 3 1 4 0 0 6 2 5 3 3 3 1 2 3 2 4 1 5 5 3 8 2 1 1 4 1 7 5 6 6    4 4 3 2 6 3 3 3 3 1 3 4 5 4 3 4 3 1 2 3 1 2 1 2 2 6 5 2 2 2 4 2 2 0 2 3 3 2 7    4 4 1 4 2 0 3 1 1 2 1 2 3 1 3 2 2 4 3 1 4 0 0 4 2 2 2 1 0 0 0 0   0.116000 2.500 2.500 6.600       745364           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 2 1 1 2 1 1 1 0 1 0 2 0 1 1    0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 2 3 0 1 4 4 0 4 0 1 0 1 3 3 0 2 1 2 3    2 1 1 1 2 0 4 0 0 4 5 2 5 4 1 3 5 5 4 0 4 4 2 3 2 3 5 2 2 4 2 3 4 2 3 3 3 3 3    2 4 12 10 13 14 19 22 23 24 36 19 32 25 25 36 24 18 20 21 14 18 13 8 6 9 2 9 5   2 5 3 4 4 3 3 0 4 3 2 5 3 4 2 2 6 3 4 0 2 4 1 3 4 7 4 5 3 2 4 5 5 3 4 4 4 2 3    2 4 4 2 1 5 7 1 5 2 4 1 5 5 3 4 4 3 2 4 2 4 0 6 2 3 4 1 2 2 2 4 1 4 2 2 2 5 6    5 1 4 4 2 3 3 3 1 4 3 4 2 6 2 5 3 2 2 1 3 2 2 5 1 1 0 0 1 0 0 0   0.118000 2.550 2.550 6.700       791846           4           0  0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 2 1 1 0 0 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0    1 4 1 2 3 0 3 1 0 1 1 1 0 3 1 2 1 1 1 0 0 1 1 1 3 1 3 2 3 1 2 2 1 3 2 4 1 4 0    2 4 1 4 3 2 1 1 2 1 3 2 3 3 2 1 1 5 3 3 3 3 2 3 4 3 5 3 1 1 2 2 3 5 1 2 1 1 4    4 6 9 6 6 13 17 21 20 24 22 25 20 29 23 28 30 26 27 18 20 17 16 17 12 10 8 5 6   6 6 4 3 1 2 4 6 9 2 2 3 5 7 6 2 3 8 5 4 5 6 4 6 5 3 5 3 2 5 3 2 8 3 5 4 5 3 5    4 3 4 8 4 3 8 3 3 3 1 1 2 2 5 4 7 3 2 3 3 2 2 3 6 3 2 2 1 1 5 2 5 6 3 5 3 4 1    3 1 2 1 0 4 1 4 2 2 2 3 1 1 1 1 3 2 0 1 6 1 1 0 2 1 0 1 0 0 0 0   0.120000 2.600 2.600 6.800       833394           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 2 1 1 1 2 1 0 0 0 1 0 1 0 0 0 1 0 0 1 1 2 1 0 0    0 0 0 2 2 0 3 1 0 0 2 1 1 1 1 0 1 2 1 5 0 1 0 2 2 1 2 0 4 2 1 4 3 4 2 2 1 2 1    5 2 3 1 3 0 2 2 2 2 3 4 0 4 2 3 3 4 5 2 2 6 3 4 5 5 5 3 4 6 5 1 3 0 5 4 5 1 3    2 2 6 18 13 17 27 27 21 28 28 24 26 27 29 23 21 16 17 19 22 14 11 9 5 14 7 7 6   4 4 12 3 6 4 5 4 6 4 2 0 1 8 1 6 8 5 2 3 4 5 6 4 2 5 8 3 1 1 6 3 7 8 4 1 6 5 2   8 11 5 6 5 6 2 4 5 1 2 7 2 2 5 5 6 3 3 2 3 8 5 1 9 3 3 2 3 6 3 5 3 2 4 6 3 1 3   5 4 4 4 6 3 3 5 0 2 2 5 1 3 2 2 1 4 2 0 2 2 2 2 4 1 2 1 2 1 1 0   0.122000 2.650 2.650 6.900       876007           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2 1 1 1 1 2 2 1 0 0 1 0 0 0 1 1 0 0 0 2 0 0    4 1 0 2 1 2 0 1 2 0 1 3 2 1 0 1 1 0 1 2 1 0 2 3 3 5 3 3 3 0 1 4 0 1 5 3 4 3 1    2 2 2 4 1 3 3 3 2 3 2 3 2 1 4 4 2 2 5 5 3 4 1 2 1 2 4 2 4 7 2 4 4 2 7 3 5 7 5    3 6 8 10 10 18 21 22 24 14 25 27 29 31 22 25 24 21 27 20 19 22 19 14 13 14 10    5 7 3 4 5 5 3 1 4 3 8 4 5 4 0 3 4 3 4 1 7 6 1 1 3 4 4 3 4 3 6 4 3 4 2 4 4 3 5    6 5 1 1 6 2 6 6 3 5 5 3 2 6 5 4 3 4 6 4 3 5 5 6 5 6 2 4 2 1 2 2 4 2 7 6 2 1 3    1 5 2 1 2 4 3 3 3 2 5 2 4 1 4 3 2 2 5 5 1 1 3 3 2 2 2 2 1 0 0 0 0 0   0.124000 2.700 2.700 7.000       925764           3           0  0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 2 1 3 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0    1 2 0 0 3 2 0 1 2 1 1 2 0 2 1 2 2 0 0 2 3 2 3 2 2 3 2 2 4 0 2 0 5 1 3 2 3 1 2    3 2 0 6 4 3 6 2 5 0 5 2 1 4 4 5 7 4 2 3 5 2 0 2 5 2 4 7 4 4 4 8 5 3 1 7 2 2 1    5 5 5 14 19 16 22 18 30 29 25 36 23 23 22 25 25 27 26 23 14 20 16 16 10 6 6 6    4 2 6 6 6 6 6 4 6 1 0 3 4 4 5 2 4 3 2 4 4 5 5 5 6 10 6 3 6 8 5 5 8 7 4 6 4 3 4   8 5 5 7 4 6 3 5 8 4 3 4 4 3 4 3 1 3 3 7 2 4 8 3 6 4 3 3 2 5 4 4 3 7 4 5 4 4 3    4 7 2 3 3 4 3 0 2 2 4 3 4 2 4 2 2 6 4 4 6 6 1 5 1 1 2 1 0 0 0 0 0   0.126000 2.750 2.750 7.100       969560           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 1 0 1 2 0 2 0 2 2 0 1 1 1 0 0 1 0 1 1 1 1 2 0    1 2 2 1 2 0 0 1 0 1 0 2 1 0 1 0 1 1 2 0 3 0 3 4 3 1 3 2 0 4 0 1 2 0 3 1 1 2 3    2 2 2 5 1 7 1 5 1 5 4 2 0 0 1 2 1 3 2 3 3 5 4 10 10 2 5 11 4 1 2 1 7 3 5 4 4 1   5 10 8 7 9 9 20 20 21 33 21 28 20 27 32 21 29 22 20 24 15 13 27 14 13 15 10 9    3 11 6 7 5 3 6 8 5 4 4 1 3 3 5 2 7 3 6 6 1 6 4 6 5 3 4 2 4 3 3 9 4 5 4 4 5 2 3   10 4 3 2 6 10 6 3 6 5 5 5 4 8 8 5 4 3 6 4 4 2 4 4 4 5 7 4 4 4 4 5 2 2 3 4 5 2    1 3 2 6 2 7 7 1 6 4 4 6 5 5 4 0 2 2 3 2 7 5 0 4 1 1 4 6 1 0 3 2 0 0 1   0.128000 2.800 2.800 7.200      1022713           5           0  0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 2 1 0 0 4 0 0 1 2 3    1 1 0 1 0 1 0 3 1 1 1 2 2 1 1 1 3 1 0 2 4 2 1 2 1 2 0 3 1 3 2 1 5 2 1 3 1 2 1    5 3 2 1 2 5 3 8 2 3 2 5 5 4 3 6 4 4 4 3 2 3 8 4 3 4 5 4 5 4 7 6 5 3 3 3 5 2 9    10 7 9 12 11 13 17 15 22 19 33 24 28 30 26 21 24 22 27 20 26 16 10 10 9 20 10    7 4 5 7 7 2 7 5 3 5 1 6 1 5 7 5 6 3 1 5 1 1 3 4 8 6 3 9 5 5 3 6 7 4 6 7 6 4 2    4 6 2 3 6 5 6 7 6 4 4 9 6 8 6 9 7 1 2 6 2 7 5 4 4 4 4 5 5 4 4 3 6 3 5 3 6 4 3    6 6 2 5 2 8 4 5 3 6 5 4 5 8 4 3 5 6 5 5 2 8 1 2 2 5 4 1 3 0 0 0 0 0   0.130000 2.850 2.850 7.300      1081669           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 5 0 0 2 2 0 0 1 0 0 0 1 1 0 2 0 2 2 2 1 0    1 0 2 2 3 1 1 0 2 0 1 0 2 1 1 2 2 0 1 4 3 0 2 1 1 0 2 5 2 1 0 1 3 2 5 2 1 2 5    2 3 4 3 6 6 6 4 6 6 3 1 3 2 3 4 7 5 2 9 7 4 1 4 4 3 2 2 2 7 4 8 4 7 4 6 8 5 1    8 6 10 18 21 18 15 21 24 21 26 22 30 28 27 23 22 21 17 25 20 17 13 17 9 12 7 8   5 4 4 5 5 2 4 1 1 2 5 7 6 4 9 7 7 5 5 5 5 5 2 4 5 3 6 8 2 4 9 4 10 5 1 4 5 5 5   10 3 2 8 6 5 7 3 13 3 3 6 5 1 4 5 9 5 2 7 4 5 6 3 5 6 5 4 5 9 6 4 3 4 4 4 5 8    5 5 0 3 6 3 4 3 7 5 6 4 3 3 6 8 4 1 3 1 2 7 3 4 6 6 1 3 4 1 0 1 0 0   0.132000 2.900 2.900 7.400      1131887           3           0  0 0 0 0 0 0 0 0 1 0 0 1 2 1 1 0 0 0 1 2 2 1 1 0 2 1 1 0 1 1 1 0 2 2 3 1 0 1 0    1 0 2 0 2 0 1 4 0 1 2 2 0 0 0 2 3 0 1 2 3 0 1 2 3 5 6 2 2 3 1 4 4 8 4 3 3 3 7    2 2 5 7 4 1 2 4 8 1 5 2 7 3 4 2 9 6 5 5 6 2 2 3 6 2 5 6 7 7 2 8 3 3 3 3 6 6 5    3 10 15 15 17 19 13 29 20 23 22 34 28 28 33 20 20 22 17 22 18 15 19 14 11 9 13   6 6 13 4 2 9 8 8 7 6 5 6 4 4 9 6 2 8 9 7 2 6 3 7 3 6 3 7 4 4 5 4 5 6 4 7 5 4     10 2 6 6 8 3 6 6 9 5 8 8 7 6 4 8 5 7 5 5 7 3 5 5 5 10 7 3 8 7 5 7 2 4 4 6 4 10   7 6 4 4 4 4 3 2 4 2 6 5 9 7 3 2 6 2 5 1 5 6 2 2 1 9 2 5 2 5 1 0 0 0 1 1   0.134000 2.950 2.950 7.500      1185706           3           0  0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 2 1 0 1 1 0 0 0 0 0 1 0 1 1 2 0 1 0 1 2 0 0 0    1 1 0 1 1 1 0 2 2 0 1 3 3 2 3 0 0 2 2 3 2 1 1 3 0 0 1 1 3 4 3 1 1 9 1 4 0 1 3    4 1 3 2 6 4 7 7 3 2 8 5 2 5 2 4 6 7 3 7 7 8 4 7 2 4 7 7 9 9 2 5 5 8 3 5 7 3 6    10 6 10 15 10 13 14 29 21 23 37 26 20 28 20 16 24 25 16 19 21 20 20 17 11 10     12 8 7 7 5 5 5 4 5 6 7 3 6 5 7 5 11 9 6 8 11 6 4 6 8 8 7 7 7 4 5 4 8 5 4 3 4 8   10 7 9 4 7 6 8 9 7 3 5 7 7 6 2 6 4 7 3 9 8 12 7 6 6 6 4 5 7 2 4 7 3 2 4 4 7 1    4 5 0 4 6 3 10 8 5 4 3 4 5 7 5 7 5 7 3 5 2 5 6 4 5 2 4 1 6 6 2 4 2 0 0 1 0   0.136000 3.000 3.000 7.600      1238426           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 2 4 0 2 0 2 2 0 1 1 1 0 2 1 1 2 1 0 1 1 0 3 1 0    0 1 0 1 0 0 2 1 1 0 4 0 2 6 3 3 4 0 3 1 2 4 0 4 4 0 1 5 2 2 5 1 3 4 3 3 5 2 4    4 6 2 5 3 4 5 4 5 6 7 5 6 2 8 3 4 7 2 4 4 3 7 6 5 1 4 8 3 7 10 3 3 6 1 5 3 8     11 5 7 15 11 15 17 21 23 21 24 28 16 21 29 15 22 27 28 20 13 19 13 7 15 10 11    9 6 8 8 4 7 5 4 6 5 10 6 7 8 9 3 5 5 9 5 9 4 4 4 3 5 7 4 10 6 8 4 9 8 4 6 7 9    11 6 8 3 5 8 12 3 6 9 7 11 9 6 7 4 7 7 7 2 5 4 5 0 2 9 5 5 5 10 7 5 6 3 9 4 4    13 2 7 5 7 4 7 2 0 4 5 4 4 6 8 1 2 5 6 4 7 3 11 4 3 3 5 5 4 4 3 1 4 2 2 1 1 0   0.138000 3.050 3.050 7.700      1299809           6           0  0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 2 1 1 0 0 1 0 0 2 0 1 2 0 0 3 0 0 1 3 1    2 0 2 0 1 1 2 1 2 3 2 1 2 5 2 2 2 4 3 2 5 3 0 3 2 4 5 4 3 0 5 4 1 4 3 8 6 4 4    7 4 5 4 3 6 5 6 10 3 6 6 2 6 3 4 4 3 6 7 6 8 3 4 7 5 4 9 2 4 8 5 9 8 3 7 5 7 7   13 7 11 15 17 16 18 18 18 20 17 26 25 19 20 26 31 22 18 20 18 14 11 16 4 7 11    10 8 9 9 6 3 8 8 7 5 6 10 3 5 6 6 3 12 7 8 8 2 10 4 13 9 9 12 4 5 9 7 9 5 7 4    8 9 6 7 8 10 8 7 5 7 11 6 4 4 4 6 4 9 4 5 9 10 7 4 12 7 4 9 5 10 10 6 8 4 7 2    4 7 2 6 8 4 11 3 3 9 7 6 7 3 8 7 4 8 5 3 7 4 5 5 7 4 6 7 5 5 3 5 2 5 4 1 2 0 0   1   0.140000 3.100 3.100 7.800      1361810           3           0  0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 2 1 0 0 0 1 1 1 2 0 0 0 0 1 0 2 2 2 1 0 0 3 3 0    2 0 6 2 3 1 0 3 3 1 2 2 5 3 5 3 3 2 2 7 3 2 2 3 4 2 3 4 4 1 3 7 4 5 4 2 3 5 4    2 1 3 6 3 4 3 8 7 6 5 3 5 11 5 5 3 3 7 3 6 4 4 2 4 4 4 1 5 5 9 6 6 9 3 10 8 6    8 3 10 8 16 16 13 18 23 29 25 19 19 20 27 19 22 27 24 21 15 18 11 20 21 17 12    5 18 6 12 7 9 11 7 12 11 4 8 8 4 8 7 7 2 6 4 4 9 6 9 3 4 7 7 7 4 10 4 11 5 8 8   8 5 4 4 8 6 4 9 8 12 12 8 5 8 3 10 8 7 5 3 5 6 8 5 6 10 7 2 11 2 5 5 6 8 10 2    7 5 5 14 2 7 3 9 3 5 2 8 2 3 4 4 7 9 5 4 7 6 7 5 6 3 5 4 7 6 7 7 9 3 0 2 1 1 1   0 0   0.142000 3.150 3.150 7.900      1429499           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 1 2 1 1 0 0 0 3 0 2 2 1 0 3 0 2 1 3 0 0 1    1 3 1 2 4 1 5 3 5 1 0 7 1 3 2 3 2 2 2 3 0 0 1 3 6 3 2 2 4 4 4 6 4 3 6 4 10 3 7   2 5 4 7 4 5 8 4 7 4 1 7 11 5 2 10 2 11 3 7 8 10 9 6 3 5 3 6 3 10 11 5 5 9 7 10   8 9 5 15 11 9 18 18 15 24 17 23 17 19 25 17 24 18 37 16 17 21 17 14 20 17 15     15 9 4 11 7 3 8 10 8 8 6 8 3 4 5 8 4 6 3 9 9 6 2 10 4 4 3 8 4 9 1 7 5 9 7 10 9   10 4 6 5 8 6 6 10 10 6 5 7 6 6 10 5 7 8 8 8 7 7 11 12 8 3 10 6 9 13 11 4 6 7 6   3 10 5 8 4 7 7 7 5 8 4 9 5 5 7 6 6 7 11 11 7 8 5 3 5 7 7 10 3 3 6 5 7 9 2 3 7    1 0 0 0 0 1   0.144000 3.200 3.200 8.000      1493946           3           0  0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 2 3 0 0 1 2 1 1 1 4 1 0 1 0 1 2 1 3 1 1 1 1 2    1 1 3 2 6 0 4 0 1 4 2 4 5 2 1 3 0 2 2 4 2 3 2 4 3 5 4 4 4 1 5 1 3 4 5 6 4 7 2    8 8 8 5 3 6 0 7 3 2 2 5 7 5 7 5 8 9 6 4 3 6 8 6 10 2 5 6 3 3 6 6 6 6 17 5 10 6   6 11 11 13 12 21 26 18 24 21 24 23 30 18 22 20 24 19 13 17 25 22 17 15 8 13 7    10 8 9 6 7 9 8 7 8 9 7 7 6 12 5 9 9 12 9 12 6 9 7 10 7 7 4 9 7 4 2 7 4 5 8 8 9   7 6 7 5 9 4 8 13 6 5 4 7 9 6 7 7 9 4 4 5 8 10 9 10 6 6 7 9 12 11 8 8 9 11 5 8    7 5 5 8 5 9 10 5 5 11 11 6 8 8 4 8 5 5 5 4 7 4 5 6 5 6 6 7 7 4 2 6 3 2 1 0 0 0   0 0   0.146000 3.250 3.250 8.100      1562352           5           0  0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 2 0 1 2 1 1 0 0 1 0 1 2 0 0 0 3 1 2 0 4 4 2 0    0 2 3 2 0 1 3 3 4 0 1 4 3 3 4 5 5 4 2 1 4 2 5 3 2 7 6 3 5 6 5 5 5 1 5 2 7 4 8    7 4 6 5 7 5 3 5 8 1 6 4 6 8 7 6 7 6 3 4 6 3 5 8 4 10 3 3 11 6 5 3 9 6 4 3 17 9   11 11 24 13 15 14 25 26 26 21 17 32 32 22 18 25 29 29 27 24 21 12 23 14 12 11    9 17 7 9 11 3 7 6 5 5 12 3 6 8 7 4 7 11 10 8 9 5 8 2 10 9 8 10 10 7 7 4 7 5 7    7 9 10 8 7 7 16 6 8 10 5 6 6 12 12 7 11 11 8 9 7 8 12 10 7 8 7 11 8 9 7 7 4 9    4 7 14 9 8 8 13 9 8 7 13 5 9 5 7 4 9 5 7 8 7 8 7 3 10 9 3 4 4 4 5 2 6 6 3 5 10   4 4 2 3 0 1 0 0   0.148000 3.300 3.300 8.200      1630559           3           0  0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 4 2 1 1 1 2 1 2 0 2 1 5 0 1 1 4 0 2 1 4 5 3 0    1 1 1 2 1 3 3 3 1 1 1 1 1 3 4 6 6 8 8 4 3 2 7 2 2 1 7 4 4 5 1 10 6 4 4 4 3 3 3   6 11 6 4 5 4 8 5 5 9 4 5 5 7 6 4 13 12 3 6 7 5 2 7 9 7 8 8 4 7 6 4 10 6 8 9 9    9 13 15 17 23 25 13 16 24 22 26 21 27 24 24 21 21 21 15 17 22 25 21 22 17 14     11 8 12 5 9 7 8 5 11 10 6 6 5 9 13 10 9 8 8 8 6 4 9 10 9 9 7 8 7 5 7 8 14 13 5   14 5 12 11 8 9 6 5 4 9 13 7 10 13 11 11 8 5 9 10 8 7 6 7 13 3 13 8 7 13 17 5 8   5 10 7 12 7 6 6 9 7 8 8 11 8 11 9 11 11 8 5 6 10 4 9 3 10 8 7 10 8 7 8 10 10 7   4 11 5 7 8 2 4 3 0 0 1 0 1   0.150000 3.350 3.350 8.300      1707576           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 1 2 1 0 2 0 2 3 1 3 2 2 2 2 0 2 1 4 3 2 2 3    1 2 1 0 2 2 4 2 5 3 3 5 2 8 4 5 4 2 3 6 7 6 1 0 7 4 7 7 6 5 4 3 4 6 6 7 6 2 7    4 4 2 5 5 6 9 3 3 3 6 6 5 3 5 7 8 8 6 8 8 6 8 3 9 6 6 8 8 6 4 8 6 6 10 4 11 6    11 15 23 16 8 17 20 21 19 24 15 14 19 21 30 25 21 15 19 16 18 21 21 15 14 12     16 8 10 12 7 10 9 8 10 10 7 9 8 10 12 6 6 9 11 6 5 9 12 6 7 12 7 5 6 8 5 9 4     11 9 8 8 10 7 6 10 7 11 13 7 4 13 11 8 11 9 16 6 12 11 10 10 19 2 9 11 8 7 8 8   6 13 6 10 12 12 9 12 9 9 8 7 7 9 6 12 8 4 9 9 8 5 7 8 9 5 12 5 7 5 9 10 9 10 3   6 6 8 7 11 3 5 5 4 2 0 0 0 0   0.152000 3.400 3.400 8.400      1777231           3           0  0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 3 1 0 3 4 2 3 3 3 3 3 2 1 1 1 1 3 3 0    1 8 0 0 5 3 7 4 4 4 4 4 3 5 2 2 5 3 6 1 7 6 1 2 2 5 2 1 6 6 8 7 7 5 10 4 1 6 9   3 4 5 3 5 8 4 9 8 11 8 3 2 7 7 9 10 9 10 8 6 8 6 8 7 10 8 7 3 8 4 10 7 6 8 9 6   5 16 9 19 24 23 17 23 24 22 30 21 15 23 27 20 20 20 18 20 23 18 17 15 19 17 18   13 9 4 4 7 12 7 10 4 8 6 10 5 6 13 2 3 8 7 8 7 3 11 8 7 9 7 19 7 8 9 6 14 8 8    11 10 11 13 14 10 16 8 9 13 8 9 9 12 7 12 11 6 9 15 5 9 9 9 11 11 13 6 10 6 4    12 9 9 12 11 8 6 9 16 10 10 10 8 10 10 6 7 4 1 15 6 8 4 9 13 11 8 10 11 9 8 3    3 6 6 7 9 4 6 8 7 4 2 1 2 2 1 0   0.154000 3.450 3.450 8.500      1849489           6           0  0 0 0 0 0 0 0 0 0 0 1 1 3 0 1 2 2 0 1 4 1 1 0 1 0 2 1 0 0 1 1 1 1 6 3 6 1 3 1    3 3 0 6 0 4 2 7 4 6 4 4 3 7 4 5 7 5 5 2 3 9 9 2 5 5 3 9 4 2 7 6 2 8 2 5 7 12 6   5 4 5 10 4 12 10 6 4 14 7 9 10 11 7 7 7 7 3 9 7 4 3 8 7 5 7 9 6 8 9 6 8 8 12 6   5 11 12 13 11 13 21 26 19 23 25 18 23 22 23 23 18 27 20 15 20 25 24 19 18 12     14 13 15 8 15 10 11 7 9 13 11 12 13 11 11 7 11 13 6 5 10 6 6 10 8 14 5 14 11 8   5 9 7 10 10 8 7 15 13 3 13 12 18 15 7 10 9 10 8 15 9 6 8 9 10 10 9 5 7 7 5 10    11 13 12 12 12 10 6 17 10 11 9 4 8 7 6 6 9 12 8 16 18 7 5 10 8 12 10 15 6 13     11 6 10 16 10 11 16 8 9 5 11 10 14 11 5 2 5 7 3 1 1 0 1 0   0.156000 3.500 3.500 8.600      1920727           4           0  0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 2 1 2 0 3 0 1 1 0 1 0 3 0 4 4 1 3 1 2 3 3 4 3    1 2 3 9 5 2 3 7 3 3 6 5 2 6 1 4 3 2 3 6 5 1 8 3 8 5 3 7 6 13 11 9 5 8 7 7 5 8    7 4 8 6 4 10 4 6 5 6 9 9 12 6 7 10 9 9 8 8 3 8 9 8 8 2 12 11 13 8 13 7 8 6 6 9   6 8 16 13 14 16 16 22 20 21 21 17 20 18 19 22 20 11 20 22 21 14 19 15 23 17 15   12 14 19 16 10 11 14 11 9 11 9 12 8 16 14 9 6 18 10 11 7 10 11 17 10 13 8 10     12 9 12 7 7 10 10 11 11 9 8 8 14 10 10 9 14 9 14 13 9 19 16 17 4 11 8 12 11 10   21 6 10 8 9 12 9 7 7 12 7 16 14 10 13 6 13 8 9 10 6 10 8 7 10 4 6 11 19 12 6 7   5 8 11 10 12 13 9 6 10 5 11 11 4 14 10 7 2 6 5 1 2 5 1 1 0 0   0.158000 3.550 3.550 8.700      1999833           3           0  0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 2 3 2 2 2 1 2 3 0 1 0 1 3 2 0 0 3 2 3 2 5 7 0    3 4 1 10 7 7 4 5 2 3 4 3 8 3 6 4 4 4 8 2 3 4 5 5 7 1 6 7 8 1 6 8 1 4 4 11 9 4    7 11 9 10 5 6 8 4 3 9 7 9 11 5 5 8 8 4 8 7 8 11 9 12 6 4 13 4 12 10 6 9 11 10    11 10 11 11 11 14 15 14 23 18 17 29 16 26 23 15 19 14 18 19 22 31 13 21 20 12    16 15 14 18 17 15 8 12 14 13 10 10 10 10 10 13 11 6 8 11 8 14 8 10 11 11 8 10    13 5 14 7 12 9 10 10 12 15 18 8 6 9 9 12 8 9 20 14 16 10 11 14 5 5 13 6 11 9     11 15 6 9 13 11 7 8 7 10 8 16 12 11 8 10 14 11 17 11 8 16 13 9 10 5 10 17 13     14 16 8 10 9 11 5 10 9 10 12 8 11 12 11 8 6 7 12 15 13 12 7 13 5 0 3 2 0 0 0 0   0.160000 3.600 3.600 8.800      2073149           3           0  0 0 0 0 0 0 0 0 0 1 0 0 0 0 2 1 2 1 2 2 1 0 2 2 1 0 3 6 4 5 5 2 2 2 5 5 3 6 4    6 4 5 2 4 4 3 2 4 6 3 3 6 5 7 4 5 7 5 3 5 6 13 5 3 10 5 9 7 4 5 6 5 10 6 5 5 6   6 4 14 7 6 11 6 9 10 9 8 5 3 8 10 10 6 6 8 9 5 6 14 7 11 10 9 9 11 13 8 4 5 10   12 6 16 8 8 7 19 20 23 10 16 27 25 23 19 26 21 16 20 21 24 18 25 8 11 13 16 18   13 22 18 9 16 4 16 10 12 13 9 7 9 8 17 11 10 13 10 14 4 9 12 16 8 9 16 17 13     11 14 8 8 13 9 11 15 10 11 14 8 6 4 9 11 18 9 9 8 9 15 11 11 11 9 6 13 13 10 7   8 10 15 14 9 7 4 10 12 17 10 14 13 10 10 12 20 9 7 6 11 15 11 10 8 9 6 10 13     17 6 8 9 6 13 13 16 10 15 5 11 14 11 12 6 5 12 9 4 9 2 4 1 1 0 0 0   0.162000 3.650 3.650 8.900      2156456           5           0  0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 2 0 1 1 3 2 3 4 3 3 2 1 3 6 5 2 3 4 4 3 6 2 3    4 4 5 5 3 4 1 4 5 9 3 3 4 3 3 8 5 6 12 2 10 3 4 6 8 9 8 8 2 2 7 5 8 2 8 9 7 2    6 8 6 5 8 2 7 5 6 13 5 6 8 11 6 10 5 6 3 8 10 11 10 10 14 10 11 8 11 8 12 6 12   5 15 12 13 10 13 13 18 23 12 21 18 21 23 20 30 20 23 26 24 24 21 21 29 19 21     16 23 20 13 19 13 16 11 15 13 13 11 8 11 14 14 13 4 16 15 18 13 9 19 8 11 6 9    14 8 13 12 13 10 13 10 14 11 13 11 8 10 13 11 11 14 11 8 14 11 10 9 14 12 14     18 8 12 7 13 12 10 14 14 8 12 17 11 13 9 12 12 15 7 9 13 17 11 11 11 12 17 12    11 16 15 8 9 12 7 13 15 11 16 7 10 7 14 5 18 10 10 8 8 6 6 13 14 6 9 11 9 9 3    5 1 1 3 0 0   0.164000 3.700 3.700 9.000      2234753           3           0  0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 4 1 4 2 1 3 1 1 3 2 3 3 1 3 6 2 4 4 3 3 3 6 5 2    6 4 1 3 3 7 1 4 4 6 12 4 5 2 6 4 9 3 1 8 11 5 2 7 6 3 8 4 7 3 8 3 9 6 7 8 9 2    7 6 9 6 15 6 9 5 9 4 9 17 15 10 2 10 6 8 12 12 11 12 10 9 7 11 8 7 5 11 10 14    16 7 7 7 13 15 10 16 17 21 19 14 18 24 19 27 27 24 20 22 24 21 20 14 24 17 17    18 32 15 12 13 15 12 8 14 11 11 19 11 14 15 18 10 5 12 11 11 9 15 9 7 9 16 12    9 12 10 15 9 18 7 11 12 14 7 20 8 10 13 14 11 6 6 9 11 8 10 16 8 17 13 17 9 16   11 10 9 13 20 17 14 12 10 13 11 9 9 17 20 10 16 8 14 13 14 18 15 15 8 10 12 11   22 12 13 9 12 9 11 14 19 12 12 8 8 12 11 19 11 11 12 15 11 15 13 9 9 10 9 4 9    4 2 1 0 0   0.166000 3.750 3.750 9.100      2327990           3           0  0 0 0 0 0 0 0 0 0 0 0 0 3 2 2 0 1 2 2 1 1 0 0 3 1 4 2 6 4 2 4 3 2 5 5 2 3 1 3    1 2 10 2 7 4 3 4 3 3 4 3 10 6 9 6 3 8 5 5 3 4 4 6 8 4 4 7 5 5 11 14 5 3 6 8 8    7 10 11 7 17 7 11 10 8 7 8 12 13 11 12 6 13 9 7 7 6 5 8 13 10 10 14 11 11 8 12   15 14 9 13 10 9 18 13 18 12 23 14 17 24 15 23 25 31 19 17 29 19 19 19 26 25 19   17 22 19 19 19 11 11 12 22 21 8 10 18 10 14 19 17 13 14 10 6 9 10 15 11 5 13     13 11 11 17 16 9 7 14 7 19 6 10 13 7 12 18 14 7 12 15 13 13 9 13 13 13 12 12     14 12 19 10 16 18 18 12 8 10 10 9 7 14 9 11 13 12 8 15 12 11 10 12 11 17 15 19   14 14 12 7 7 12 11 15 16 12 11 12 10 19 19 12 14 12 15 11 20 13 7 18 9 15 19     16 11 5 9 8 6 2 4 0 2 0 1   0.168000 3.800 3.800 9.200      2406866           3           0  0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 3 2 3 1 2 1 2 2 5 2 1 2 3 2 2 2 5 3 5 3 3 1 3    6 8 6 1 3 9 6 3 6 10 5 5 7 4 5 7 12 9 5 7 5 6 6 8 3 5 4 7 8 5 6 5 8 13 4 10 2    10 9 7 7 16 9 10 9 13 8 12 9 13 15 9 15 9 10 11 6 6 6 7 7 6 8 15 9 8 9 6 12 12   11 14 12 11 13 8 17 18 18 11 14 19 14 25 21 15 10 15 19 27 23 22 24 17 19 18     12 16 22 21 25 9 25 15 19 15 21 15 8 11 13 12 10 12 7 13 11 17 11 13 10 16 19    14 23 11 8 12 13 10 9 17 4 14 10 7 10 17 14 11 11 20 18 13 8 12 6 8 13 12 23     15 14 15 16 9 14 9 13 14 17 11 17 11 10 15 17 11 6 12 12 14 15 17 12 16 16 8     17 15 15 10 15 11 10 15 12 13 9 12 9 12 15 12 6 18 7 15 14 12 21 18 11 10 18     11 19 11 7 11 3 2 5 4 0 1 1   0.170000 3.850 3.850 9.300      2508471           7           0  0 0 0 0 0 0 0 0 0 0 0 0 1 3 1 2 1 4 3 3 1 2 7 0 3 2 2 2 2 5 2 3 2 3 3 4 3 7 3    5 3 4 4 6 2 3 10 4 11 3 13 7 7 5 6 3 8 10 6 6 4 10 11 4 12 7 8 9 7 7 8 4 6 7 9   9 5 9 11 5 14 9 10 7 9 8 8 5 6 11 13 14 10 10 10 10 8 9 9 9 9 14 14 13 11 8 18   9 10 9 16 12 13 15 13 10 17 16 20 14 22 20 26 29 29 27 24 20 37 21 24 13 18 13   28 24 22 25 21 13 14 15 9 11 18 8 16 17 16 13 12 16 11 11 17 15 11 15 10 11 12   13 12 12 20 15 14 15 16 12 17 15 15 12 10 14 14 17 15 19 15 13 13 11 12 16 14    17 16 8 16 12 8 14 13 13 10 10 9 12 11 19 20 13 11 4 15 11 14 11 20 18 18 13     20 12 20 21 15 15 12 13 18 18 11 16 9 14 9 18 11 10 11 20 11 13 17 13 13 12 14   16 10 12 12 23 12 11 12 8 8 1 0 1 2 0   0.172000 3.900 3.900 9.400      2591210           3           0  0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 4 4 3 2 1 3 3 2 3 0 3 6 1 3 1 5 5 4 3 9 9 0 4 7    5 3 5 5 8 7 3 3 5 5 8 5 11 10 8 10 3 6 6 6 7 7 8 8 12 9 6 10 8 7 10 8 8 10 4 6   12 20 4 6 11 7 9 10 7 5 10 6 12 11 7 13 13 16 12 6 8 14 13 9 7 5 14 17 17 10     12 11 6 13 11 17 3 23 13 21 12 21 28 11 23 30 28 23 24 26 26 17 21 15 27 23 33   16 22 25 11 20 22 23 21 20 7 21 13 16 12 16 16 13 18 18 9 13 16 15 9 20 13 19    15 8 9 11 14 13 10 9 10 16 15 14 17 15 19 16 12 14 12 14 14 16 19 19 4 24 8 12   15 16 11 15 14 20 14 13 13 14 16 19 14 13 19 14 18 23 15 15 4 14 17 14 8 10 15   20 11 15 19 12 9 13 12 11 16 12 16 13 14 16 13 16 16 19 19 12 11 10 19 15 15     14 12 5 11 18 17 10 13 12 9 6 2 0 0 1 0   0.174000 3.950 3.950 9.500      2675515           3           0  0 0 0 0 0 0 0 0 0 0 2 0 1 1 0 2 1 2 3 3 1 3 1 3 7 5 3 6 4 3 9 4 5 2 5 3 3 3 6    9 5 5 2 6 8 5 8 4 8 5 6 5 6 4 6 3 7 11 6 9 9 3 6 6 7 6 8 7 9 12 18 6 9 8 11 11   8 14 15 15 11 15 13 9 19 10 15 14 9 4 18 5 8 10 8 10 13 9 12 11 8 8 12 6 15 8    9 9 18 7 17 21 9 13 18 14 21 24 18 22 17 26 15 21 23 25 19 26 23 20 27 17 27     20 26 15 22 15 19 15 16 24 12 15 24 13 13 17 11 7 10 21 15 15 16 13 20 22 12     16 12 16 15 14 18 11 12 14 14 24 10 13 16 19 8 11 18 19 15 15 23 16 16 11 12     18 11 13 14 16 10 14 13 18 12 15 15 14 8 11 17 12 22 13 12 14 15 10 11 15 19     15 12 17 8 21 23 13 19 11 8 12 15 11 14 15 19 15 10 17 9 16 14 18 14 16 14 14    23 14 14 13 16 12 14 15 14 9 14 7 5 2 3 1 1 1   0.176000 4.000 4.000 9.600      2779386           5           0  0 0 0 0 0 0 0 0 0 0 0 2 2 3 0 1 3 0 6 2 6 3 1 5 0 4 1 6 5 1 6 3 6 5 6 2 5 4 5    3 9 8 5 7 5 8 4 12 8 12 6 8 5 7 5 7 10 5 5 6 7 9 7 10 7 10 10 8 12 10 6 13 10    11 12 11 10 10 16 9 6 12 9 11 17 10 11 10 14 11 16 7 11 13 12 10 17 14 11 13     12 10 13 16 16 17 17 15 14 11 8 15 13 27 22 14 19 17 22 22 27 18 28 19 27 32     24 33 21 17 23 12 27 25 20 20 17 22 14 15 22 21 14 9 16 12 19 16 17 16 16 20     14 18 15 14 18 10 12 9 16 12 12 10 13 19 12 12 15 14 15 22 12 11 15 18 19 18     10 6 11 14 10 23 17 14 16 19 10 10 16 19 17 23 16 18 19 18 16 12 14 14 14 13     11 10 24 21 22 26 18 18 18 14 17 5 13 17 11 13 16 14 18 16 9 15 15 18 16 14 21   13 22 17 9 8 16 17 16 16 19 7 20 19 18 16 10 6 10 6 3 5 1 0 0 2   0.178000 4.050 4.050 9.700      2869617           3           0  0 0 0 0 0 0 0 0 0 0 2 2 2 0 1 4 1 3 2 2 1 2 3 2 2 4 4 7 5 6 5 3 6 6 5 7 8 1 5    2 3 5 5 8 10 7 6 10 9 6 8 9 7 8 10 15 4 10 5 8 8 6 11 8 8 11 7 5 8 14 5 11 7     13 10 9 7 8 9 14 12 10 9 11 6 14 15 14 13 11 9 18 18 10 14 14 10 12 16 12 9 8    14 15 6 11 11 12 10 14 12 11 18 13 13 27 16 23 23 20 21 32 20 18 25 22 24 32     25 34 19 23 21 25 22 25 19 23 19 21 16 19 16 18 9 18 6 13 12 13 18 12 8 19 14    14 11 16 13 15 14 21 11 14 14 13 11 20 14 14 26 10 22 16 18 15 20 24 18 19 19    16 14 14 14 21 13 19 18 20 13 17 11 17 14 22 17 15 15 20 8 21 15 16 16 23 17     13 19 21 20 12 15 18 15 19 15 18 17 20 15 13 14 24 18 15 15 14 18 20 19 17 19    20 21 21 15 19 19 17 11 16 16 11 23 10 20 13 10 5 10 2 3 1 1 0   0.180000 4.100 4.100 9.800      2975040           3           0  0 0 0 0 0 0 0 0 1 0 0 1 2 2 4 4 2 4 4 1 2 5 0 3 3 5 2 5 5 4 9 2 7 8 4 8 3 11 6   10 4 7 8 6 6 5 8 8 7 11 4 4 11 12 7 11 7 10 11 7 11 11 10 9 7 13 12 18 8 14 12   14 12 8 8 16 10 10 14 16 10 6 8 15 15 15 22 13 19 18 12 6 11 10 7 12 12 24 15    17 9 17 21 10 17 18 14 14 14 9 22 11 23 17 15 23 32 20 11 12 20 15 23 30 20 25   19 26 29 19 27 23 15 19 11 30 16 21 24 18 18 14 8 6 25 13 21 13 13 19 13 21 25   23 18 14 14 13 20 12 14 8 10 25 14 15 20 15 10 15 16 21 8 15 20 21 20 13 16 15   20 11 18 17 17 9 12 24 19 13 18 17 20 14 15 20 10 23 19 25 8 7 13 14 11 15 18    13 10 12 10 17 11 24 16 17 11 12 13 16 20 14 26 12 17 13 14 16 16 6 20 16 23     22 11 17 16 14 25 19 17 21 22 19 13 19 16 18 10 11 7 4 6 0 0 2   0.182000 4.150 4.150 9.900      3083416           6           0  0 0 0 0 0 0 0 0 0 0 2 1 1 4 1 3 4 3 5 6 2 1 4 2 3 5 6 6 7 2 4 1 11 7 5 2 6 6 8   9 8 12 7 11 9 6 12 7 8 9 6 6 8 11 6 6 8 11 8 11 12 11 13 9 10 7 9 6 11 9 13 12   12 8 14 15 8 9 8 8 11 22 16 6 11 16 15 9 13 12 12 13 11 15 9 9 16 14 14 12 21    12 12 12 16 19 10 15 18 8 16 14 16 16 21 30 22 9 25 19 19 26 23 33 25 22 21 19   21 20 20 21 20 26 20 29 27 25 25 21 20 25 21 21 18 14 19 15 6 20 18 16 20 16     13 13 15 15 15 15 22 16 15 15 11 21 19 11 19 13 14 15 17 21 12 18 12 22 18 21    18 13 23 15 18 9 21 11 14 23 18 21 25 18 22 15 21 23 15 15 16 19 21 18 19 21     17 13 24 23 22 19 14 20 22 15 14 14 20 20 23 13 18 15 18 20 20 24 9 12 17 21     21 12 16 17 16 16 21 26 19 15 21 22 24 15 11 13 13 6 8 1 4 0 1 0   0.184000 4.200 4.200 10.00      3174897           3           0  0 0 0 0 0 0 0 0 0 0 1 1 2 3 0 5 4 3 3 0 7 3 2 4 2 8 6 4 5 9 3 8 6 4 2 7 6 8 7    9 3 5 8 5 9 7 7 6 11 14 7 12 9 9 5 15 12 14 15 12 9 11 5 8 13 11 12 10 9 17 12   11 8 17 11 19 11 15 9 11 7 15 14 16 16 16 7 12 10 14 13 13 16 16 11 15 13 14     12 16 11 12 13 17 10 13 19 11 17 11 13 14 13 10 19 19 23 24 22 24 24 31 19 23    22 28 21 25 29 17 23 17 21 30 22 19 25 27 27 22 23 23 17 25 17 20 17 12 23 21    9 17 20 16 19 16 17 20 9 16 11 22 16 15 12 15 17 23 24 16 16 18 26 11 16 20 18   10 14 17 26 19 17 15 17 19 12 21 20 24 17 27 13 16 18 19 23 14 19 14 10 11 18    19 6 15 21 23 25 17 17 18 21 27 20 17 18 20 25 22 20 18 22 18 17 15 24 16 15     22 18 22 14 20 20 22 18 22 25 19 26 12 19 19 13 12 16 19 14 9 7 5 4 2 0 2   0.186000 4.250 4.250 10.10      3283256           3           0  0 0 0 0 0 0 0 1 0 0 1 1 4 1 5 2 5 5 3 4 6 3 2 4 7 8 2 6 6 4 10 7 8 7 5 4 4 9 8   18 10 7 6 6 13 12 10 13 10 7 15 4 7 10 13 12 8 8 13 5 14 6 9 14 9 10 16 12 13    11 8 12 11 10 13 9 11 15 17 23 18 13 10 12 11 12 14 14 14 10 12 12 16 13 15 13   13 14 18 10 13 17 14 14 14 12 12 8 18 14 23 20 16 19 16 16 16 27 18 21 19 20     19 37 22 21 22 28 24 26 18 21 28 21 22 21 21 22 16 15 13 22 22 27 22 11 13 20    10 17 16 19 20 30 18 25 8 7 22 18 17 14 23 16 17 11 16 24 19 18 22 15 15 23 16   13 15 22 14 8 12 18 13 15 22 17 15 15 17 27 21 19 21 24 17 10 12 14 19 17 22     18 19 17 28 19 15 14 16 28 17 20 15 11 22 18 19 16 21 17 24 19 22 22 20 10 20    18 18 18 21 18 23 18 32 26 21 21 22 20 22 16 17 20 22 21 17 13 13 11 9 5 0 1 1   1   0.188000 4.300 4.300 10.20      3396610           5           0  0 0 0 0 0 0 0 0 0 0 1 2 3 0 2 5 5 4 3 3 5 1 2 3 6 9 3 3 3 8 7 2 9 5 7 5 11 8 9   7 6 9 6 4 5 8 6 10 9 14 10 15 6 7 13 15 10 13 7 15 10 10 11 14 14 6 7 17 13 19   3 13 9 6 13 13 14 10 11 12 16 17 13 10 15 15 19 19 11 11 15 11 13 9 13 20 8 18   14 18 23 23 23 15 19 20 14 11 7 18 16 15 22 28 20 24 22 25 17 20 39 24 26 25     25 33 25 25 25 33 15 29 18 29 18 12 18 23 17 24 28 22 16 20 33 23 18 23 26 23    15 24 16 16 16 16 17 15 15 16 14 11 9 23 17 13 13 18 12 19 20 30 20 20 15 21     19 16 18 20 23 19 15 10 11 15 19 13 22 22 18 19 16 19 23 16 10 25 23 20 21 20    31 19 19 18 15 22 18 14 13 21 18 19 22 19 16 17 21 14 20 26 18 26 22 19 26 19    20 22 15 13 24 23 15 21 21 21 27 18 22 19 24 17 22 16 18 23 10 12 3 5 3 3 0 0   0.190000 4.350 4.350 10.30      3502025           3           0  0 0 0 0 0 0 0 0 0 0 0 3 0 3 2 3 4 4 3 4 5 10 7 6 6 4 5 12 10 6 6 13 10 6 7 14    9 6 13 10 12 16 3 9 9 7 5 6 13 11 10 8 11 19 12 14 13 16 13 14 9 12 14 13 14     16 10 14 7 16 18 16 9 15 11 20 15 10 14 14 11 14 17 10 6 16 10 15 12 17 17 20    15 7 12 23 15 8 13 12 8 16 15 20 16 16 20 14 11 20 24 23 20 16 18 27 25 31 27    27 25 21 31 27 20 23 24 32 17 21 34 27 17 19 19 25 30 27 21 24 28 30 19 26 21    14 16 21 23 27 8 17 21 17 11 23 15 22 15 18 10 17 20 23 18 18 17 19 22 15 22     21 19 23 18 18 26 17 18 26 18 24 15 22 23 23 19 23 25 23 24 26 10 21 16 32 23    18 19 24 21 28 26 22 19 19 14 30 21 24 23 22 21 13 27 20 27 24 15 20 22 22 13    25 14 19 32 21 18 18 23 22 22 14 18 20 24 14 19 20 18 17 24 29 27 20 12 18 17    11 9 2 3 2 1 0   0.192000 4.400 4.400 10.40      3593938           3           0  0 0 0 0 0 0 0 0 0 0 1 0 1 1 2 3 4 7 8 1 5 6 8 3 7 5 4 9 8 8 7 7 9 7 9 9 15 5 7   8 15 14 9 9 13 8 8 15 10 7 10 9 10 14 7 8 18 16 17 11 14 15 13 8 15 8 15 18 16   16 22 12 8 16 13 10 13 13 10 21 11 10 16 16 13 13 17 16 20 23 13 22 16 14 15     22 19 22 15 22 24 16 16 16 19 12 15 16 17 20 18 19 26 17 23 18 32 20 28 36 22    25 30 29 31 36 24 24 21 29 24 32 29 30 23 34 19 33 34 25 20 31 27 24 16 14 21    20 13 24 17 28 13 24 16 26 15 26 21 11 15 20 13 20 18 25 23 18 24 26 22 16 22    14 13 16 20 24 25 19 29 20 15 20 16 25 26 21 22 17 24 22 21 17 23 23 15 19 30    23 17 21 19 18 21 26 14 29 24 20 33 19 15 20 23 28 19 23 25 15 19 17 31 23 18    29 26 25 14 24 25 18 19 19 24 35 31 23 23 14 15 19 11 20 19 24 17 16 9 10 12 3   2 2 0 1   0.194000 4.450 4.450 10.50      3712573           7           0  0 0 0 0 0 0 0 0 0 0 0 1 1 1 5 3 5 4 3 11 3 10 4 6 7 8 5 5 5 8 9 12 7 7 11 8 6    7 9 10 13 10 6 13 9 9 9 11 14 14 12 13 10 6 13 13 15 12 13 19 8 14 13 16 11 13   14 15 9 15 16 13 16 17 17 17 23 18 16 19 10 13 18 16 10 9 21 11 22 14 20 14 18   13 15 12 13 14 16 14 15 20 29 17 14 18 8 15 21 15 19 15 22 20 17 15 23 26 16     26 24 23 23 23 23 30 24 29 28 26 35 33 31 22 23 22 20 37 22 27 33 26 27 26 17    16 18 27 22 21 24 18 18 18 17 15 18 14 19 24 22 15 20 21 15 19 25 15 16 26 19    22 29 20 16 13 15 16 32 24 23 13 33 17 22 18 18 23 24 22 21 20 26 21 16 22 18    18 16 15 26 26 17 22 21 13 25 24 13 23 18 18 25 32 20 24 21 17 19 24 24 23 33    19 19 21 32 18 22 23 19 23 32 18 31 22 25 23 23 31 29 21 16 20 20 15 22 14 12    5 10 9 2 1 0 1   0.196000 4.500 4.500 10.60      3829518           3           0  0 0 0 0 0 0 0 0 0 1 2 2 1 6 2 6 5 9 3 5 6 8 6 3 8 10 7 11 9 4 8 9 5 11 10 13 9   16 13 10 9 5 12 9 15 10 13 9 12 18 14 19 9 13 14 12 13 21 17 17 18 16 13 12 16   14 18 10 15 15 16 11 15 22 17 19 17 11 12 26 12 17 19 18 21 20 27 17 18 19 21    14 19 16 12 16 21 20 18 8 17 17 13 13 18 15 19 15 19 20 28 21 29 27 27 34 24     26 31 25 24 16 17 23 23 30 28 18 28 32 28 37 18 26 18 16 33 21 31 21 20 22 19    20 25 18 18 20 11 17 20 22 23 14 14 17 18 20 25 20 19 20 22 19 16 33 25 21 21    24 18 16 22 29 22 16 27 26 28 21 20 22 17 25 23 20 23 18 16 19 26 22 21 22 23    15 20 19 17 23 19 20 15 22 18 22 26 23 23 31 17 29 18 13 15 19 18 24 22 28 22    17 23 24 26 21 23 25 24 29 26 18 41 24 29 22 27 23 28 16 30 24 18 23 19 17 18    21 17 14 8 2 5 2 0 0   0.198000 4.550 4.550 10.70      3950740           3           0  0 0 0 0 0 0 0 0 1 1 1 2 1 3 7 5 6 7 7 7 4 5 6 4 1 8 9 10 9 8 10 8 12 6 10 8 10   8 11 9 10 15 7 11 8 13 11 13 15 15 17 12 10 8 17 12 9 14 12 14 11 14 21 14 15    20 18 16 8 15 22 24 14 10 18 14 15 16 12 10 16 21 16 25 17 20 17 17 20 15 24     15 17 22 25 17 13 22 18 20 19 11 21 22 21 16 21 24 16 22 17 21 17 24 22 24 35    27 24 28 24 32 37 34 25 24 29 37 37 25 28 21 23 24 22 21 20 25 22 32 19 21 22    24 20 21 20 22 18 27 17 14 20 22 22 22 14 19 20 20 21 23 22 14 20 21 23 20 18    23 20 25 31 24 18 22 14 23 22 21 23 27 27 20 21 18 22 23 24 23 21 18 22 17 22    21 35 15 24 24 12 27 30 27 28 22 31 24 24 19 27 24 28 23 25 26 35 27 22 29 21    24 18 19 26 33 29 31 23 25 19 24 26 21 10 23 24 26 28 20 27 26 17 29 22 18 14    22 8 10 11 4 4 1 2 0   0.200000 4.600 4.600 10.80      4068161           5           0  0 0 0 0 0 0 0 0 0 1 1 0 1 5 5 2 9 3 11 6 9 8 7 7 8 3 3 13 10 8 7 5 8 13 8 7 14   12 10 7 15 13 13 11 12 12 14 12 13 12 10 15 11 14 7 16 15 8 15 13 15 13 18 13    17 21 15 12 13 13 17 18 18 18 16 19 20 17 14 17 24 13 12 18 19 19 13 21 18 26    21 23 16 14 18 19 13 33 13 19 20 14 20 23 14 26 19 22 21 21 16 27 30 25 28 22    32 21 30 27 31 21 30 22 27 27 31 27 21 17 38 41 17 21 20 19 30 24 27 20 20 21    30 20 19 19 31 25 24 13 21 23 19 24 33 24 17 20 17 12 25 23 18 24 11 24 25 22    33 20 11 22 31 21 20 26 27 21 26 24 14 23 23 20 20 26 28 10 20 27 24 22 17 27    28 20 23 23 33 20 24 26 32 33 29 21 25 24 17 18 19 27 26 20 24 26 24 24 26 21    19 24 21 36 32 18 33 33 20 23 25 33 19 27 25 27 24 27 21 21 23 28 18 27 25 19    24 15 17 12 15 7 2 1 0 0 ", "%f ", Inf);
 %! assert (rows (x) == n);
 
 %% Note use fprintf so output not sent to stdout
-%% test/octave.test/io/printf-1.m
 %!test
 %! nm = tmpnam ();
 %! fid1 = fopen (nm,"w");
@@ -315,31 +301,29 @@
 %! assert (x, 8);
 %! assert (str, "test:1");
 
-%% test/octave.test/io/printf-2.m
 %!error printf (1)
-
-%% test/octave.test/io/printf-3.m
 %!error <Invalid call to printf> printf ()
 
-%% test/octave.test/io/sprintf-1.m
 %!test
 %! [s, msg, status] = sprintf ("%s: %d\n", "test", 1);
-%!
 %! assert (s == "test: 1\n" && ischar (msg) && status == 8);
 
-%% test/octave.test/io/sprintf-2.m
-%!error sprintf (1)
+%!assert (sprintf ("%-+6.2f", Inf), "+Inf  ")
+%!assert (sprintf ("%-6.2f", Inf), "Inf   ")
+%!assert (sprintf ("%-+6.2f", nan), "+NaN  ")  # lowercase nan is part of test
+%!assert (sprintf ("%-6.2f", nan), "NaN   ")
+%!assert (sprintf ("%-+6.2f", NA), "+NA   ")
+%!assert (sprintf ("%-6.2f", NA), "NA    ")
 
-%% test/octave.test/io/sprintf-3.m
 %!error <Invalid call to sprintf> sprintf ()
+%!error <format TEMPLATE must be a string> sprintf (1)
 
-%% test/octave.test/io/fopen-1.m
 %!test
-%! arch_list = {"native"; "ieee-le"; "ieee-be"; "vaxd"; "vaxg"; "cray"};
-%! warning ("off", "Octave:fopen-mode")
+%! arch_list = {"native"; "ieee-le"; "ieee-be"};
+%! warning ("off", "Octave:fopen-mode");
 %! status = 1;
 %!
-%! for i = 1:6
+%! for i = 1:3
 %!   arch = arch_list{i};
 %!   for j = 1:4
 %!     if (j == 1)
@@ -362,7 +346,7 @@
 %!       else
 %!         fclose (id);
 %!       endif
-%!       tmp_mode = cstrcat (mode, "b");
+%!       tmp_mode = [mode, "b"];
 %!       [id, err] = fopen (nm, tmp_mode, arch);
 %!       if (id < 0)
 %!         __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
@@ -371,7 +355,7 @@
 %!       else
 %!         fclose (id);
 %!       endif
-%!       tmp_mode = cstrcat (mode, "t");
+%!       tmp_mode = [mode, "t"];
 %!       [id, err] = fopen (nm, tmp_mode, arch);
 %!       if (id < 0)
 %!         __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
@@ -393,43 +377,28 @@
 %!
 %! assert (status == 1);
 
-%% test/octave.test/io/fopen-2.m
 %!test
 %! s.a = 1;
 %! fail ("fopen (s)");
 
-%% test/octave.test/io/fopen-3.m
 %!error fopen ("foo", "x")
 
-%% test/octave.test/io/fopen-4.m
 %! fopen ("foo", "wb", "noodle");
 %! assert (__prog_output_assert__ ("error:"));
 
-%% test/octave.test/io/fopen-5.m
 %!error <Invalid call to fopen> fopen ()
-
-%% test/octave.test/io/fopen-6.m
 %!error <Invalid call to fopen> fopen ("foo", "wb", "native", 1)
 
-%% test/octave.test/io/fclose-1.m
 %!error fclose (0)
-
-%% test/octave.test/io/fclose-2.m
 %!error <Invalid call to fclose> fclose (1, 2)
 
-%% test/octave.test/io/tmpnam-1.m
 %!assert (ischar (tmpnam ()))
 
-%% test/octave.test/io/tmpnam-2.m
 %!warning tmpnam (1);
-
-%% test/octave.test/io/tmpnam-3.m
 %!warning tmpnam ("foo", 1);
 
-%% test/octave.test/io/tmpnam-4.m
 %!error <Invalid call to tmpnam> tmpnam (1, 2, 3)
 
-%% test/octave.test/io/binary-io-1.m
 %!test
 %! type_list = ["char"; "char*1"; "integer*1"; "int8";
 %! "schar"; "signed char"; "uchar"; "unsigned char";
@@ -464,7 +433,6 @@
 %! unlink (nm);
 %! assert (__prog_output_assert__ ("ok"));
 
-%% test/octave.test/io/file-pos-1.m
 %!test
 %! nm = tmpnam ();
 %! id = fopen (nm, "wb");
@@ -502,119 +470,60 @@
 %! endif
 %! unlink (nm);
 
-%% test/octave.test/io/fputs-1.m
+%!assert (fputs (1, 1),-1)
+
 %!error <Invalid call to fputs> fputs ()
-
-%% test/octave.test/io/fputs-2.m
 %!error <Invalid call to fputs> fputs (1, "foo", 1)
 
-%% test/octave.test/io/fputs-3.m
-%!assert (fputs (1, 1),-1)
+%!error fgetl ("foo", 1)
 
-%% test/octave.test/io/fgetl-1.m
 %!error <Invalid call to fgetl> fgetl ()
-
-%% test/octave.test/io/fgetl-2.m
 %!error <Invalid call to fgetl> fgetl (1, 2, 3)
 
-%% test/octave.test/io/fgetl-3.m
-%!error fgetl ("foo", 1)
+%!error fgets ("foo", 1)
 
-%% test/octave.test/io/fgets-1.m
 %!error <Invalid call to fgets> fgets ()
-
-%% test/octave.test/io/fgets-2.m
 %!error <Invalid call to fgets> fgets (1, 2, 3)
 
-%% test/octave.test/io/fgets-3.m
-%!error fgets ("foo", 1)
-
-%% test/octave.test/io/fprintf-1.m
-%!error <Invalid call to fprintf> fprintf ()
-
-%% test/octave.test/io/fprintf-2.m
-%!error <Invalid call to fprintf> fprintf (1)
-
-%% test/octave.test/io/fprintf-3.m
 %!test
 %! s.a = 1;
 %! fail ("fprintf (s)", "Invalid call to fprintf");
 
-%% test/octave.test/io/fprintf-4.m
+%!error <Invalid call to fprintf> fprintf ()
+%!error <Invalid call to fprintf> fprintf (1)
 %!error fprintf (1, 1)
-
-%% test/octave.test/io/fprintf-5.m
 %!error fprintf (-1, "foo")
 
-%% test/octave.test/io/fscanf-1.m
-%!error <Invalid call to fscanf> fscanf ()
-
-%% test/octave.test/io/fscanf-2.m
-%!error <Invalid call to fscanf> fscanf (1)
-
-%% test/octave.test/io/fscanf-3.m
 %!error fscanf ("foo", "bar")
 
-%% test/octave.test/io/fread-1.m
-%!error <Invalid call to fread> fread ()
+%!error <Invalid call to fscanf> fscanf ()
+%!error <Invalid call to fscanf> fscanf (1)
 
-%% test/octave.test/io/fread-2.m
+%!error <Invalid call to fread> fread ()
 %!error <Invalid call to fread> fread (1, 2, "char", 1, "native", 2)
-
-%% test/octave.test/io/fread-3.m
 %!error fread ("foo")
 
-%% test/octave.test/io/fwrite-1.m
 %!error <Invalid call to fwrite> fwrite ()
-
-%% test/octave.test/io/fwrite-2.m
 %!error <Invalid call to fwrite> fwrite (1, rand (10), "char", 1, "native", 2)
-
-%% test/octave.test/io/fwrite-3.m
 %!error fwrite ("foo", 1)
 
-%% test/octave.test/io/feof-1.m
 %!error <Invalid call to feof> feof ()
-
-%% test/octave.test/io/feof-2.m
 %!error <Invalid call to feof> feof (1, 2)
-
-%% test/octave.test/io/feof-3.m
 %!error feof ("foo")
 
-%% test/octave.test/io/ferror-1.m
 %!error <Invalid call to ferror> ferror ()
-
-%% test/octave.test/io/ferror-2.m
 %!error <Invalid call to ferror> ferror (1, 'clear', 2)
-
-%% test/octave.test/io/ferror-3.m
 %!error ferror ("foo")
 
-%% test/octave.test/io/ftell-1.m
 %!error <Invalid call to ftell> ftell ()
-
-%% test/octave.test/io/ftell-2.m
 %!error <Invalid call to ftell> ftell (1, 2)
-
-%% test/octave.test/io/ftell-3.m
 %!error ftell ("foo")
 
-%% test/octave.test/io/fseek-1.m
 %!error <Invalid call to fseek> fseek ()
-
-%% test/octave.test/io/fseek-2.m
 %!error <Invalid call to fseek> fseek (1, 0, SEEK_SET, 1)
-
-%% test/octave.test/io/fseek-3.m
 %!error fseek ("foo", 0, SEEK_SET)
 
-%% test/octave.test/io/frewind-1.m
 %!error <Invalid call to frewind> frewind ()
-
-%% test/octave.test/io/frewind-2.m
 %!error <Invalid call to frewind> frewind (1, 2)
-
-%% test/octave.test/io/frewind-3.m
 %!error frewind ("foo")
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jit.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -0,0 +1,431 @@
+## Copyright (C) 2012 Max Brister
+## 
+## This file is part of Octave.
+## 
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 3 of the License, or (at your
+## option) any later version.
+## 
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## Author: Max Brister <max@2bass.com>
+
+## Turn on JIT and set defaults before running tests
+%!testif HAVE_LLVM
+%! global __old_jit_enable__;
+%! global __old_jit_startcnt__;
+%! __old_jit_enable__ = jit_enable (true);
+%! __old_jit_startcnt__ = jit_startcnt (1000);
+
+## Test some simple cases that compile.
+
+%!testif HAVE_LLVM
+%! for i=1:1e6
+%!   if (i < 5)
+%!     break;
+%!   else
+%!     break;
+%!   endif
+%! endfor
+%! assert (i, 1);
+
+%!testif HAVE_LLVM
+%! while (1)
+%!   if (1)
+%!     break;
+%!   else
+%!     break;
+%!   endif
+%! endwhile
+
+%!testif HAVE_LLVM
+%! for i=1:1e6
+%!   if (i == 100)
+%!     break;
+%!   endif
+%! endfor
+%! assert (i, 100);
+
+## Also test parfor keyword
+%!testif HAVE_LLVM
+%! parfor i=1:1e6
+%!   if (i == 100)
+%!     break;
+%!   endif
+%! endparfor
+%! assert (i, 100);
+
+%!testif HAVE_LLVM
+%! inc = 1e-5;
+%! result = 0;
+%! for ii = 0:inc:1
+%!   result = result + inc * (1/3 * ii * ii);
+%! endfor
+%! assert (abs (result - 1/9) < 1e-5);
+
+%!testif HAVE_LLVM
+%! inc = 1e-5;
+%! result = 0;
+%! for ii = 0:inc:1
+%!   ## the ^ operator's result is complex
+%!   result = result + inc * (1/3 * ii ^ 2);
+%! endfor
+%! assert (abs (result - 1/9) < 1e-5);
+
+%!testif HAVE_LLVM
+%! temp = 1+1i;
+%! nan = NaN;
+%! while (1)
+%!   temp = temp - 1i;
+%!   temp = temp * nan;
+%!   break;
+%! endwhile
+%! assert (imag (temp), 0);
+
+%!testif HAVE_LLVM
+%! temp = 1+1i;
+%! nan = NaN+1i;
+%! while (1)
+%!   nan = nan - 1i;
+%!   temp = temp - 1i;
+%!   temp = temp * nan;
+%!   break;
+%! endwhile
+%! assert (imag (temp), 0);
+
+%!testif HAVE_LLVM
+%! temp = 1+1i;
+%! while (1)
+%!   temp = temp * 5;
+%!   break;
+%! endwhile
+%! assert (temp, 5+5i);
+
+%!testif HAVE_LLVM
+%! nr = 1001;
+%! mat = zeros (1, nr);
+%! for i = 1:nr
+%!   mat(i) = i;
+%! endfor
+%! assert (mat == 1:nr);
+
+%!testif HAVE_LLVM
+%! nr = 1001;
+%! mat = 1:nr;
+%! mat(end) = 0; # force mat to a matrix
+%! total = 0;
+%! for i = 1:nr
+%!   total = mat(i) + total;
+%! endfor
+%! assert (sum (mat) == total);
+
+%!testif HAVE_LLVM
+%! nr = 1001;
+%! mat = [3 1 5];
+%! try
+%!   for i = 1:nr
+%!     if (i > 500)
+%!       result = mat(100);
+%!     else
+%!       result = i;
+%!     endif
+%!   endfor
+%! catch
+%! end_try_catch
+%! assert (result == 500);
+
+%!function result = gen_test (n)
+%!  result = double (rand (1, n) > .01);
+%!endfunction
+
+%!function z = vectorized (A, K)
+%!  temp = ones (1, K);
+%!  z = conv (A, temp);
+%!  z = z > K-1;
+%!  z = conv (z, temp);
+%!  z = z(K:end-K+1);
+%!  z = z >= 1;
+%!endfunction
+
+%!function z = loopy (A, K)
+%!  z = A;
+%!  n = numel (A);
+%!  counter = 0;
+%!  for ii=1:n
+%!    if (z(ii))
+%!      counter = counter + 1;
+%!    else
+%!      if (counter > 0 && counter < K)
+%!        z(ii-counter:ii-1) = 0;
+%!      endif
+%!      counter = 0;
+%!    endif
+%!  endfor
+%!
+%!  if (counter > 0 && counter < K)
+%!    z(end-counter+1:end) = 0;
+%!  endif
+%!endfunction
+
+%!testif HAVE_LLVM
+%! test_set = gen_test (10000);
+%! assert (all (vectorized (test_set, 3) == loopy (test_set, 3)));
+
+%!testif HAVE_LLVM
+%! niter = 1001;
+%! i = 0;
+%! while (i < niter)
+%!   i = i + 1;
+%! endwhile
+%! assert (i == niter);
+
+%!testif HAVE_LLVM
+%! niter = 1001;
+%! result = 0;
+%! m = [5 10];
+%! for i=1:niter
+%!   result = result + m(end);
+%! endfor
+%! assert (result == m(end) * niter);
+
+%!testif HAVE_LLVM
+%! ndim = 100;
+%! result = 0;
+%! m = zeros (ndim);
+%! m(:) = 1:ndim^2;
+%! i = 1;
+%! while (i <= ndim)
+%!   for j = 1:ndim
+%!     result = result + m(i, j);
+%!    endfor
+%!   i = i + 1;
+%! endwhile
+%! assert (result == sum (sum (m)));
+
+%!testif HAVE_LLVM
+%! ndim = 100;
+%! m = zeros (ndim);
+%! i = 1;
+%! while (i <= ndim)
+%!   for j = 1:ndim
+%!     m(i, j) = (j - 1) * ndim + i;
+%!   endfor
+%!   i = i + 1;
+%! endwhile
+%! m2 = zeros (ndim);
+%! m2(:) = 1:(ndim^2);
+%! assert (all (m == m2));
+
+%!testif HAVE_LLVM
+%! ndim = 2;
+%! m = zeros (ndim, ndim, ndim, ndim);
+%! result = 0;
+%! i0 = 1;
+%! while (i0 <= ndim)
+%!   for i1 = 1:ndim
+%!     for i2 = 1:ndim
+%!       for i3 = 1:ndim
+%!         m(i0, i1, i2, i3) = 1;
+%!         m(i0, i1, i2, i3, 1, 1, 1, 1, 1, 1) = 1;
+%!         result = result + m(i0, i1, i2, i3);
+%!       endfor
+%!     endfor
+%!   endfor
+%!   i0 = i0 + 1;
+%! endwhile
+%! expected = ones (ndim, ndim, ndim, ndim);
+%! assert (all (m == expected));
+%! assert (result == sum (expected (:)));
+
+%!function test_divide ()
+%! state = warning ("query", "Octave:divide-by-zero").state;
+%! unwind_protect
+%!   warning ("error", "Octave:divide-by-zero");
+%!   for i=1:1e5
+%!     a = 1;
+%!     a / 0;
+%!   endfor
+%! unwind_protect_cleanup
+%!   warning (state, "Octave:divide-by-zero");
+%! end_unwind_protect
+%!endfunction
+
+%!testif HAVE_LLVM
+%! lasterr ("");
+%! try
+%!   test_divide ();
+%! end_try_catch
+%! assert (strcmp (lasterr (), "division by zero"));
+
+%!testif HAVE_LLVM
+%! while (1)
+%!   a = 0;
+%!   result = a / 1;
+%!   break;
+%! endwhile
+%! assert (result, 0);
+
+%!testif HAVE_LLVM
+%! m = zeros (2, 1001);
+%! for i=1:1001
+%!   m(end, i) = i;
+%!   m(end - 1, end - i + 1) = i;
+%! endfor
+%! m2 = zeros (2, 1001);
+%! m2(1, :) = fliplr (1:1001);
+%! m2(2, :) = 1:1001;
+%! assert (m, m2);
+
+%!testif HAVE_LLVM
+%! m = [1 2 3];
+%! for i=1:1001
+%!   m = sin (m);
+%!   break;
+%! endfor
+%! assert (m == sin ([1  2 3]));
+
+%!testif HAVE_LLVM
+%! i = 0;
+%! while i < 10
+%!   i += 1;
+%! endwhile
+%! assert (i == 10);
+
+%!testif HAVE_LLVM
+%! i = 0;
+%! while i < 10
+%!   a = ++i;
+%! endwhile
+%! assert (i == 10);
+%! assert (a == 10);
+%!testif HAVE_LLVM
+%! i = 0;
+%! while i < 10
+%!   a = i++;
+%! endwhile
+%! assert (i == 10);
+%! assert (a == 9);
+
+%!testif HAVE_LLVM
+%! num = 2;
+%! a = zeros (1, num);
+%! i = 1;
+%! while i <= num
+%!   a(i) = norm (eye (i));
+%!   ++i;
+%! endwhile
+%! assert (a, ones (1, num));
+
+%!function test_compute_idom ()
+%! while (li <= length (l1) && si <= length (s1))
+%!   if (l1 (li) < s1 (si))
+%!     if (li == si)
+%!       break;
+%!     endif;
+%!     li++;
+%!   else
+%!     si++;
+%!   endif;
+%! endwhile
+
+%!testif HAVE_LLVM
+%! lasterr ("");
+%! try
+%!   test_compute_idom ();
+%! end_try_catch
+%! assert (! isempty (lasterr ()));
+
+%!function x = test_overload (a)
+%!  while (1)
+%!    x = a;
+%!    break;
+%!  endwhile
+%!endfunction
+
+%!testif HAVE_LLVM
+%! assert (test_overload (1), 1);
+%! assert (test_overload ([1 2]), [1 2]);
+
+%!function a = bubble (a = [3 2 1])
+%!  swapped = 1;
+%!  n = length (a);
+%!  while (swapped)
+%!    swapped = 0;
+%!    for i = 1:n-1
+%!      if (a(i) > a(i + 1))
+%!        swapped = 1;
+%!        temp = a(i);
+%!        a(i) = a(i + 1);
+%!        a(i + 1) = temp;
+%!      endif
+%!    endfor
+%!  endwhile
+%!endfunction
+
+%!testif HAVE_LLVM
+%! assert (bubble (), [1 2 3]);
+
+%!testif HAVE_LLVM
+%! a = 0;
+%! b = 1;
+%! for i=1:1e3
+%!   for j=1:2
+%!     a = a + b;
+%!   endfor
+%! endfor
+%! assert (a, 2000);
+%! assert (b, 1);
+
+%!testif HAVE_LLVM
+%! a = [1+1i 1+2i];
+%! b = 0;
+%! while (1)
+%!   b = a(1);
+%!   break;
+%! endwhile
+%! assert (b, a(1));
+
+%!function test_undef ()
+%!  for i=1:1e7
+%!    XXX;
+%!  endfor
+%!endfunction
+
+%!testif HAVE_LLVM
+%! lasterr ("");
+%! try
+%!   test_undef ();
+%! end_try_catch
+%! assert (strncmp (lasterr (), "'XXX' undefined near", 20));
+
+%!shared id
+%! id = @(x) x;
+
+%!testif HAVE_LLVM
+%! assert (id (1), 1);
+%! assert (id (1+1i), 1+1i);
+%! assert (id (1, 2), 1);
+
+%!testif HAVE_LLVM
+%! lasterr ("");
+%! try
+%!   id ();
+%! end_try_catch
+%! assert (strncmp (lasterr (), "'x' undefined near", 18));
+
+## Restore JIT settings
+%!testif HAVE_LLVM
+%! global __old_jit_enable__;
+%! global __old_jit_startcnt__;
+%! jit_enable (__old_jit_enable__);
+%! jit_startcnt (__old_jit_startcnt__);
+%! clear -g __old_jit_enable__ __old_jit_startcnt__;
+
--- a/test/line-continue.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/line-continue.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -71,10 +71,14 @@
 %! y = [1,2];
 %! assert (y, x);
 
-%% test/oc tave.test/contin/contin-16.m
 %!test
 %! x = [ 1 , ...
 %! 2];
 %! y = [1,2];
 %! assert  (y, x);
 
+%!test
+%! x = [ 1 , ...anything after the ... is ignored
+%! 2];
+%! y = [1,2];
+%! assert  (y, x);
--- a/test/nest/varg_nest2.m	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/nest/varg_nest2.m	Sat Oct 05 11:22:09 2013 -0400
@@ -6,7 +6,7 @@
     x = a;
   endif
 
-  function a, b = f
+  function [a, b] = f
     if nargout == 2
       a = b = 5;
     endif
--- a/test/parser.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/parser.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -35,217 +35,229 @@
 ## Level 13 (parentheses and indexing)
 ## Overrides all other levels
 %!test
-%!  a.b = 1;
-%!  assert (a. b++, 1)
-%!  assert (a.b, 2)
-%!  clear a;
-%!  a.b = [0 1];
-%!  b = 2;
-%!  assert (a.b', [0;1])
-%!  assert (!a .b, logical ([1 0]))
-%!  assert (3*a .b, [0 3])
-%!  assert (a. b-1, [-1 0])
-%!  assert (a. b:3, 0:3)
-%!  assert (a. b>0.5, logical ([0 1]))
-%!  assert (a. b&0, logical ([0 0]))
-%!  assert (a. b|0, logical ([0 1]))
-%!  a.b = [1 2];
-%!  assert (a. b&&0, false)
-%!  assert (a. b||0, true)
-%!  a.b += a. b*2;
-%!  assert (a.b, [3 6])
+%! a.b = 1;
+%! assert (a. b++, 1);
+%! assert (a.b, 2);
+%! clear a;
+%! a.b = [0 1];
+%! b = 2;
+%! assert (a.b', [0;1]);
+%! assert (!a .b, logical ([1 0]));
+%! assert (3*a .b, [0 3]);
+%! assert (a. b-1, [-1 0]);
+%! assert (a. b:3, 0:3);
+%! assert (a. b>0.5, logical ([0 1]));
+%! assert (a. b&0, logical ([0 0]));
+%! assert (a. b|0, logical ([0 1]));
+%! a.b = [1 2];
+%! assert (a. b&&0, false);
+%! assert (a. b||0, true);
+%! a.b += a. b*2;
+%! assert (a.b, [3 6]);
 ## Level 12 (postfix increment and decrement)
 %!test
-%!  a = [3 5];
-%!  assert (2.^a ++, [8 32])
-%!  assert (a, [4 6])
-%!  assert (a--', [4; 6])
-%!  assert (a, [3 5])
-%!  a = 0;
-%!  assert (!a --, true)
-%!  assert (-a ++, 1)
-%!  assert (3*a ++, 0)
-%!  assert (a++-2, -1)
-%!  assert (1:a ++, 1:2)
-%!  assert (4>a++, true)
-%!  a = [0 -1];
-%!  assert ([1 1] & a++, logical ([0 1]))
-%!  assert ([0 0] | a++, logical ([1 0]))
-%!  a = 0;
-%!  assert (1 && a ++, false)
-%!  assert (0 || a --, true)
-%!  a = 5; b = 2;
-%!  b +=a ++;
-%!  assert (b, 7)
+%! a = [3 5];
+%! assert (2.^a ++, [8 32]);
+%! assert (a, [4 6]);
+%! assert (a--', [4; 6]);
+%! assert (a, [3 5]);
+%! a = 0;
+%! assert (!a --, true);
+%! assert (-a ++, 1);
+%! assert (3*a ++, 0);
+%! assert (a++-2, -1);
+%! assert (1:a ++, 1:2);
+%! assert (4>a++, true);
+%! a = [0 -1];
+%! assert ([1 1] & a++, logical ([0 1]));
+%! assert ([0 0] | a++, logical ([1 0]));
+%! a = 0;
+%! assert (1 && a ++, false);
+%! assert (0 || a --, true);
+%! a = 5; b = 2;
+%! b +=a ++;
+%! assert (b, 7);
 
 ## Level 11 (transpose and exponentiation)
 %!test
-%!  assert (-2 ^2, -4)
-%!  assert (!0 ^0, false)
-%!  assert (2*3 ^2, 18)
-%!  assert (2+3 ^2, 11)
-%!  assert ([1:10](1:2 ^2), [1 2 3 4])
-%!  assert (3>2 ^2, false)
-%!  assert (1&0 ^0, true)
-%!  assert (0|0 ^0, true)
-%!  assert (1&&0 ^0, true)
-%!  assert (0||0 ^0, true)
-%!  a = 3;
-%!  a *= 0 ^0;
-%!  assert (a, 3)
+%! assert (-2 ^2, -4);
+%! assert (!0 ^0, false);
+%! assert (2*3 ^2, 18);
+%! assert (2+3 ^2, 11);
+%! assert ([1:10](1:2 ^2), [1 2 3 4]);
+%! assert (3>2 ^2, false);
+%! assert (1&0 ^0, true);
+%! assert (0|0 ^0, true);
+%! assert (1&&0 ^0, true);
+%! assert (0||0 ^0, true);
+%! a = 3;
+%! a *= 0 ^0;
+%! assert (a, 3);
 ## Level 10 (unary plus/minus, prefix increment/decrement, not)
 %!test
-%!  a = 2;
-%!  assert (++ a*3, 9)
-%!  assert (-- a-2, 0)
-%!  assert (a, 2)
-%!  assert (! a-2, -2)
-%!  assert ([1:10](++ a:5), 3:5)
-%!  a = [1 0];
-%!  assert (! a>=[1 0], [false true])
-%!  a = 0;
-%!  assert (++ a&1, true)
-%!  assert (-- a|0, false)
-%!  assert (-- a&&1, true)
-%!  assert (++ a||0, false)
-%!  a = 3;
-%!  a *= ++a;
-%!  assert (a, 16)
+%! a = 2;
+%! assert (++ a*3, 9);
+%! assert (-- a-2, 0);
+%! assert (a, 2);
+%! assert (! a-2, -2);
+%! assert ([1:10](++ a:5), 3:5);
+%! a = [1 0];
+%! assert (! a>=[1 0], [false true]);
+%! a = 0;
+%! assert (++ a&1, true);
+%! assert (-- a|0, false);
+%! assert (-- a&&1, true);
+%! assert (++ a||0, false);
+%! a = 3;
+%! a *= ++a;
+%! assert (a, 16);
 ## Level 9 (multiply, divide)
 %!test
-%!  assert (3+4 * 5, 23)
-%!  assert (5 * 1:6, [5 6])
-%!  assert (3>1 * 5, false)
-%!  assert (1&1 * 0, false)
-%!  assert (1|1 * 0, true)
-%!  assert (1&&1 * 0, false)
-%!  assert (1||1 * 0, true)
-%!  a = 3;
-%!  a /= a * 2;
-%!  assert (a, 0.5)
+%! assert (3+4 * 5, 23);
+%! assert (5 * 1:6, [5 6]);
+%! assert (3>1 * 5, false);
+%! assert (1&1 * 0, false);
+%! assert (1|1 * 0, true);
+%! assert (1&&1 * 0, false);
+%! assert (1||1 * 0, true);
+%! a = 3;
+%! a /= a * 2;
+%! assert (a, 0.5);
 ## Level 8 (add, subtract)
 %!test
-%!  assert ([2 + 1:6], 3:6)
-%!  assert (3>1 + 5, false)
-%!  assert (1&1 - 1, false)
-%!  assert (0|1 - 2, true)
-%!  assert (1&&1 - 1, false)
-%!  assert (0||1 - 2, true)
-%!  a = 3;
-%!  a *= 1 + 1;
-%!  assert (a, 6)
+%! assert ([2 + 1:6], 3:6);
+%! assert (3>1 + 5, false);
+%! assert (1&1 - 1, false);
+%! assert (0|1 - 2, true);
+%! assert (1&&1 - 1, false);
+%! assert (0||1 - 2, true);
+%! a = 3;
+%! a *= 1 + 1;
+%! assert (a, 6);
 ## Level 7 (colon)
 %!test
-%!  assert (5:-1: 3>4, [true false false])
-%!  assert (1: 3&1, [true true true])
-%!  assert (1: 3|0, [true true true])
-%!  assert (-1: 3&&1, false)
-%!  assert (-1: 3||0, false)
-%!  a = [1:3];
-%!  a += 3 : 5;
-%!  assert (a, [4 6 8])
+%! assert (5:-1: 3>4, [true false false]);
+%! assert (1: 3&1, [true true true]);
+%! assert (1: 3|0, [true true true]);
+%! assert (-1: 3&&1, false);
+%! assert (-1: 3||0, false);
+%! a = [1:3];
+%! a += 3 : 5;
+%! assert (a, [4 6 8]);
 ## Level 6 (relational)
 %!test
-%!  assert (0 == -1&0, false)
-%!  assert (1 == -1|0, false)
-%!  assert (0 == -1&&0, false)
-%!  assert (1 == -1||0, false)
-%!  a = 2;
-%!  a *= 3 > 1;
-%!  assert (a, 2)
+%! assert (0 == -1&0, false);
+%! assert (1 == -1|0, false);
+%! assert (0 == -1&&0, false);
+%! assert (1 == -1||0, false);
+%! a = 2;
+%! a *= 3 > 1;
+%! assert (a, 2);
 ## Level 5 (element-wise and)
 %!test
-%!  assert (0 & 1|1, true)
-%!  assert ([0 1] & 1&&1, false)
-%!  assert (0 & 1||1, true)
-%!  a = 2;
-%!  a *= 3 & 1;
-%!  assert (a, 2)
+%! assert (0 & 1|1, true);
+%! assert ([0 1] & 1&&1, false);
+%! assert (0 & 1||1, true);
+%! a = 2;
+%! a *= 3 & 1;
+%! assert (a, 2);
 ## Level 4 (element-wise or)
 %!test
-%!  assert ([0 1] | 1&&0, false)
-%!  assert ([0 1] | 1||0, true)
-%!  a = 2;
-%!  a *= 0 | 1;
-%!  assert (a, 2)
+%! assert ([0 1] | 1&&0, false);
+%! assert ([0 1] | 1||0, true);
+%! a = 2;
+%! a *= 0 | 1;
+%! assert (a, 2);
 ## Level 3 (logical and)
 %!test
-%!  assert (0 && 1||1, true)
-%!  a = 2;
-%!  a *= 3 && 1;
-%!  assert (a, 2)
+%! assert (0 && 1||1, true);
+%! a = 2;
+%! a *= 3 && 1;
+%! assert (a, 2);
 ## Level 2 (logical or)
 %!test
-%!  a = 2;
-%!  a *= 0 || 1;
-%!  assert (a, 2)
+%! a = 2;
+%! a *= 0 || 1;
+%! assert (a, 2);
 
 ## Tests for operator precedence within each level where ordering should
 ## be left to right except for postfix and assignment operators.
 
 ## Level 13 (parentheses and indexing)
 %!test
-%!  a.b1 = 2;
-%!  assert (a.(strcat('b','1'))++, 2)
-%!  assert (a.b1, 3)
-%!  b = {1 2 3 4 5};
-%!  assert (b{(a. b1 + 1)}, 4)
-%!  b = 1:5;
-%!  assert (b(a. b1 + 1), 4)
-%!  assert ([2 3].^2', [4; 9])
+%! a.b1 = 2;
+%! assert (a.(strcat('b','1'))++, 2);
+%! assert (a.b1, 3);
+%! b = {1 2 3 4 5};
+%! assert (b{(a. b1 + 1)}, 4);
+%! b = 1:5;
+%! assert (b(a. b1 + 1), 4);
+%! assert ([2 3].^2', [4; 9]);
 ## Level 12 (postfix increment and decrement)
 ## No tests possible since a++-- is not valid
 ## Level 11 (transpose and exponentiation)
-## Note: Exponentiation works left to right for compatibility with Matlab.
-%!  assert (2^3**2, 64)
-%!  assert ([2 3].^2.', [4;9])
-%!  assert ([2 3].'.^2, [4;9])
-%!  assert (3*4i'.', 0 - 12i)
-%!  assert (3*4i.'.', 0 + 12i)
+## Note: Exponentiation should be left-to-right, but Octave does right-to-left.
+##       See bug #33304.
+%!test
+%! assert (2^3**2, 64);
+%! assert ([2 3].^2.', [4;9]);
+%! assert ([2 3].'.^2, [4;9]);
+%! assert (3*4i'.', 0 - 12i);
+%! assert (3*4i.'.', 0 + 12i);
+%! assert (2^-4^3, (1/16)^3);
+%! assert (2^+4^3, 16^3);
+%! assert (2^~0^2, 4);
+
+## Note: Exponentiation should be left-to-right, but Octave does right-to-left.
+##       See bug #33304.
+
 ## Level 10 (unary plus/minus, prefix increment/decrement, not)
 %!test
-%!  assert (+-+1, -1)
-%!  a = -1;
-%!  assert (!++a, true)
-%!  assert (a, 0)
-%!  assert (-~a, -1)
-%!  assert (!~--a, true)
-%!  assert (a, -1)
+%! assert (+-+1, -1);
+%! a = -1;
+%! assert (!++a, true);
+%! assert (a, 0);
+%! assert (-~a, -1);
+%! assert (!~--a, true);
+%! assert (a, -1);
 ## Level 9 (multiply, divide)
 %!test
-%!  assert (3 * 4 / 5, 2.4)
-%!  assert (3 ./ 4 .* 5, 3.75)
-%!  assert (2 * 4 \ 6, 0.75)
-%!  assert (2 .\ 4 .* 6, 12)
+%! assert (3 * 4 / 5, 2.4);
+%! assert (3 ./ 4 .* 5, 3.75);
+%! assert (2 * 4 \ 6, 0.75);
+%! assert (2 .\ 4 .* 6, 12);
 ## Level 8 (add, subtract)
 %!test
-%!  assert (-3 - 4 + 1 + 3 * 2, 0)
+%! assert (-3 - 4 + 1 + 3 * 2, 0);
 ## Level 7 (colon)
-## No tests possible because colon operator can't be combined with second colon operator
+## No tests possible because colon operator can't be combined
+## with second colon operator.
 ## Level 6 (relational)
 %!test
-%!  assert (0 < 1 <= 0.5 == 0 >= 0.5 > 0, true)
-%!  assert (1 < 1 == 0 != 0, true)
-%!  assert (1 < 1 == 0 ~= 0, true)
+%! assert (0 < 1 <= 0.5 == 0 >= 0.5 > 0, true);
+%! assert (1 < 1 == 0 != 0, true);
+%! assert (1 < 1 == 0 ~= 0, true);
 ## Level 5 (element-wise and)
-## No tests possible.  Only one operator (&) at this precedence level and operation is associative.
+## No tests possible.  Only one operator (&) at this precedence level
+## and operation is associative.
 ## Level 4 (element-wise or)
-## No tests possible.  Only one operator (|) at this precedence level and operation is associative.
+## No tests possible.  Only one operator (|) at this precedence level
+## and operation is associative.
 ## Level 3 (logical and)
 %!test
-%!  a = 1;
-%!  assert (1 && 0 && ++a, false)
-%!  assert (a, 1)
+%! a = 1;
+%! assert (1 && 0 && ++a, false);
+%! assert (a, 1);
 ## Level 2 (logical or)
 %!test
-%!  a = 1;
-%!  assert (0 || 1 || ++a, true)
-%!  assert (a, 1)
+%! a = 1;
+%! assert (0 || 1 || ++a, true);
+%! assert (a, 1);
 ## Level 1 (assignment)
 %!test
 %! a = 2; b = 5; c = 7;
-%! assert (a += b *= c += 1, 42)
-%! assert (b == 40 && c == 8)
+%! assert (a += b *= c += 1, 42);
+%! assert (b == 40 && c == 8);
 
 ## Test creation of anonymous functions
 
--- a/test/prefer.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/prefer.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,82 +16,67 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/prefer/prefer-1.m
 %!test
 %! m = [3 2];
 %! assert (all (m == (3:-1:2)));
 
-%% test/octave.test/prefer/prefer-2.m
 %!test
 %! m = [3,
 %! 2];
 %! assert (all (m == (3:-1:2)'));
 
-%% test/octave.test/prefer/prefer-3.m
 %!test
 %! a = 2;
 %! assert ([a - 1], 1);
 
-%% test/octave.test/prefer/prefer-4.m
 %!test
 %! m = [3,2];
 %! fail ("[m ']");
 
-%% test/octave.test/prefer/prefer-5.m
 %!assert (all ([3 2] == (3:-1:2)));
 
-%% test/octave.test/prefer/prefer-6.m
 %!assert (all ([3, 2] == (3:-1:2)));
 
-%% test/octave.test/prefer/prefer-7.m
 %!test
 %! m = [3,2];
 %! assert (all ([m (1)] == (3:-1:1)));
 
-%% test/octave.test/prefer/prefer-8.m
 %!test
 %! m = [3,2];
 %! assert ([m(1)],3);
 
-%% test/octave.test/prefer/prefer-10.m
 %!test
 %! a = 2;
 %! assert ([a- 1], 1);
 
-%% test/octave.test/prefer/prefer-11.m
 %!test
 %! a = 1;
 %! assert (all ([a -1] == (1:-2:-1)));
 
-%% test/octave.test/prefer/prefer-12.m
 %!test
 %! wsn = warning ("query", "Octave:str-to-num");
 %! warning ("off", "Octave:str-to-num");
 %! assert ("d" + 0, 100);
 %! warning (wsn.state, "Octave:str-to-num");
 
-%% test/octave.test/prefer/prefer-13.m
 %!test
 %! wsn = warning ("query", "Octave:str-to-num");
 %! warning ("on", "Octave:str-to-num");
 %! fail ("'d' + 0", "warning");
 %! warning (wsn.state, "Octave:str-to-num");
 
-%% test/octave.test/prefer/prefer-14.m
 %!test
 %! wir = warning ("query", "Ocave:imag-to-real");
 %! warning ("off", "Ocave:imag-to-real");
 %! assert (eye (1+i), 1);
 %! warning (wir.state, "Ocave:imag-to-real");
 
-%% test/octave.test/prefer/prefer-15.m
 %!test
 %! wir = warning ("query", "Ocave:imag-to-real");
 %! warning ("on", "Ocave:imag-to-real");
 %! fail ("eye (1+i)", "warning");
 %! warning (wir.state, "Ocave:imag-to-real");
 
-%% test/octave.test/prefer/prefer-17.m
 %!test
 %! wrre = warning ("query", "Octave:resize-on-range-error");
 %! warning ("off", "Octave:resize-on-range-error");
@@ -100,13 +85,11 @@
 %! assert (all (a == [0,1,2]));
 %! warning (wrre.state, "Octave:resize-on-range-error");
 
-%% test/octave.test/prefer/prefer-18.m
 %!test
 %! clear a;
 %! a(1) = 1; a(2) = 2;
 %! assert (all (a == [1,2]));
 
-%% test/octave.test/prefer/prefer-21.m
 %!test
 %! ped = print_empty_dimensions ();
 %! print_empty_dimensions (0);
@@ -116,7 +99,6 @@
 %! assert (isempty (findstr (b{1} ,"[](0x0)")));
 %! print_empty_dimensions (ped);
 
-%% test/octave.test/prefer/prefer-22.m
 %!test
 %! ped = print_empty_dimensions ();
 %! print_empty_dimensions (1);
@@ -125,13 +107,10 @@
 %! assert (!isempty (findstr (b{1}, "[](0x0)")));
 %! print_empty_dimensions (ped);
 
-%% test/octave.test/prefer/prefer-23.m
 %!assert (all (size (inv ([])) == [0, 0]));
 
-%% test/octave.test/prefer/prefer-24.m
 %!assert (all (svd ([]) == zeros (0, 1)));
 
-%% test/octave.test/prefer/prefer-27.m
 %!test
 %! sp = save_precision ();
 %! save_precision (1);
@@ -144,7 +123,6 @@
 %! assert (x,3);
 %! save_precision (sp);
 
-%% test/octave.test/prefer/prefer-28.m
 %!test
 %! sp = save_precision ();
 %! save_precision (5);
@@ -158,7 +136,6 @@
 %! save_precision (sp);
 
 %% FIXME: How to capture standard output for comparison?
-%% test/octave.test/prefer/prefer-29.m
 %!function f ()
 %! 1
 %!endfunction
@@ -170,7 +147,6 @@
 %! silent_functions (sf);
 
 %% FIXME: Same problem as above!!!
-%% test/octave.test/prefer/prefer-30.m
 %!function f ()
 %! 1
 %!endfunction
@@ -181,42 +157,36 @@
 %! assert (??);
 %! silent_functions (sf);
 
-%% test/octave.test/prefer/prefer-32.m
 %!test
 %! wndz = warning ("query", "Octave:neg-dim-as-zero");
 %! warning ("on", "Octave:neg-dim-as-zero");
 %! fail ("eye (-1) == []", "warning");
 %! warning (wndz.state, "Octave:neg-dim-as-zero");
 
-%% test/octave.test/prefer/prefer-33.m
 %!test
 %! wndz = warning ("query", "Octave:neg-dim-as-zero");
 %! warning ("off", "Octave:neg-dim-as-zero");
 %! assert (all (size (eye (-1)) == [0, 0]));
 %! warning (wndz.state, "Octave:neg-dim-as-zero");
 
-%% test/octave.test/prefer/prefer-34.m
 %!test
 %! watv = warning ("query", "Octave:assign-as-truth-value");
 %! warning ("off", "Octave:assign-as-truth-value");
 %! if (x = 1) 1; endif
 %! warning (watv.state, "Octave:assign-as-truth-value");
 
-%% test/octave.test/prefer/prefer-35.m
 %!test
 %! watv = warning ("query", "Octave:assign-as-truth-value");
 %! warning ("on", "Octave:assign-as-truth-value");
 %! fail ("if (x = 1) 1; endif", "warning");
 %! warning (watv.state, "Octave:assign-as-truth-value");
 
-%% test/octave.test/prefer/prefer-38.m
 %!test
 %! wdbz = warning ("query", "Octave:divide-by-zero");
 %! warning ("off", "Octave:divide-by-zero");
 %! assert (isinf (1/0));
 %! warning (wdbz.state, "Octave:divide-by-zero");
 
-%% test/octave.test/prefer/prefer-39.m
 %!test
 %! wdbz = warning ("query", "Octave:divide-by-zero");
 %! warning ("on", "Octave:divide-by-zero");
--- a/test/recursion.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/recursion.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,7 +16,6 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/recursion/recursion-1.m
 %!function y = f (x)
 %!  if (x == 1)
 %!    y = x;
@@ -28,7 +27,6 @@
 %!
 %!assert (f (5), 120)
 
-%% test/octave.test/recursion/recursion-2.m
 %!function y = f (x)
 %!  if (x == 1)
 %!    y = x;
--- a/test/return.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/return.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,7 +16,6 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/return/return-1.m
 %!function y = f ()
 %!  y = 1;
 %!  return;
@@ -25,7 +24,6 @@
 %!
 %!assert (f (), 1)
 
-%% test/octave.test/return/return-2.m
 %!test
 %! return;
 
--- a/test/slice.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/slice.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -18,7 +18,7 @@
 
 %!function x = set_slice (size, dim, slice)
 %!  x = ones (size);
-%!  switch dim
+%!  switch (dim)
 %!    case 11
 %!      x(slice) = 2;
 %!    case 21
--- a/test/struct.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/struct.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,95 +16,73 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/struct/fieldnames-1.m
 %!test
 %! s.a = 1;
 %! c = fieldnames (s);
 %! assert (iscell (c) && strcmp (c{1}, "a"));
 
-%% test/octave.test/struct/fieldnames-2.m
 %!test
 %! s.a.b = 1;
 %! c = fieldnames (s.a);
 %! assert (iscell (c) && strcmp (c{1}, "b"));
 
-%% test/octave.test/struct/fieldnames-3.m
 %!error <Invalid call to fieldnames> fieldnames ();
 
-%% test/octave.test/struct/fieldnames-4.m
 %!test
 %! s.a = 1;
 %! fail ("fieldnames (s, 1)", "Invalid call to fieldnames");
 
-%% test/octave.test/struct/fieldnames-5.m
 %!error fieldnames (1);
 
-%% test/octave.test/struct/isfield-1.m
 %!test
 %! s.aaa = 1;
 %! s.a = 2;
 %! assert (isfield (s, "a"));
 
-%% test/octave.test/struct/isfield-2.m
 %!test
 %! s.aaa = 1;
 %! s.a = 2;
 %! assert (!(isfield (s, "b")));
 
-%% test/octave.test/struct/isfield-3.m
 %!error <Invalid call to isfield> isfield ();
 
-%% test/octave.test/struct/isfield-4.m
 %!test
 %! s.aaa = 1;
 %! s.a = 2;
 %! fail ("isfield (s, 'a', 3);", "Invalid call to isfield");
 
-%% test/octave.test/struct/isfield-5.m
 %!assert (isfield (1, "m") == 0);
 
-%% test/octave.test/struct/isfield-6.m
 %!test
 %! s.a = 2;
 %! assert (isfield (s, 2) == 0);
 
-%% test/octave.test/struct/isstruct-1.m
 %!assert (!(isstruct (1)))
 
-%% test/octave.test/struct/isstruct-2.m
 %!assert (!(isstruct ([1, 2])))
 
-%% test/octave.test/struct/isstruct-3.m
 %!assert (!(isstruct ([])))
 
-%% test/octave.test/struct/isstruct-4.m
 %!assert (!(isstruct ([1, 2; 3, 4])))
 
-%% test/octave.test/struct/isstruct-5.m
 %!assert (!(isstruct ("t")))
 
-%% test/octave.test/struct/isstruct-6.m
 %!assert (!(isstruct ("test")))
 
-%% test/octave.test/struct/isstruct-7.m
 %!assert (!(isstruct (["test"; "ing"])))
 
 %!assert (!(isstruct ({1})))
 
-%% test/octave.test/struct/isstruct-8.m
 %!test
 %! s.a = 1;
 %! assert (isstruct (s));
 
-%% test/octave.test/struct/isstruct-9.m
 %!test
 %! s.a.b = 1;
 %! assert (isstruct (s.a));
 
-%% test/octave.test/struct/isstruct-10.m
 %!error <Invalid call to isstruct> isstruct ();
 
-%% test/octave.test/struct/isstruct-11.m
 %!test
 %! s.a = 1;
 %! fail ("isstruct (s, 1)", "Invalid call to isstruct");
--- a/test/switch.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/switch.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,20 +16,19 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/switch/switch-1.m
 %!test
 %! a = 1;
 %! b = 2;
 %! c = 3;
 %!
-%! switch 0 case 1 x = a; case 2 x = b; otherwise x = c; endswitch
-%! switch 1 case 1 y = a; case 2 y = b; otherwise y = c; endswitch
-%! switch 2 case 1 z = a; case 2 z = b; otherwise z = c; endswitch
-%! switch 3 case 1 p = a; case 2 p = b; otherwise p = c; endswitch
+%! ## "end" is part of test, check not using "endswitch"
+%! switch (0) case 1 x = a; case 2 x = b; otherwise x = c; end
+%! switch (1) case 1 y = a; case 2 y = b; otherwise y = c; endswitch
+%! switch (2) case 1 z = a; case 2 z = b; otherwise z = c; endswitch
+%! switch (3) case 1 p = a; case 2 p = b; otherwise p = c; endswitch
 %!
 %! assert (x == c && y == a && z == b && p == c);
 
-%% test/octave.test/switch/switch-2.m
 %!test
 %! a = 1;
 %! b = 2;
@@ -42,18 +41,17 @@
 %! for i = 0:3
 %! switch (i)
 %!   case a
-%!    x(k) = a;
+%!     x(k) = a;
 %!   case b
-%!    x(k) = b;
+%!     x(k) = b;
 %!   otherwise
-%!    x(k) = c;
+%!     x(k) = c;
 %!   endswitch
 %!   k++;
 %! endfor
 %!
 %! assert (all (x == [3, 1, 2, 3]));
 
-%% test/octave.test/switch/switch-3.m
 %!test
 %! a = 1;
 %! b = 2;
@@ -65,8 +63,8 @@
 %!
 %! for i = 0:3
 %!   switch (i)
-%!   case a
-%!    x(k) = a;
+%!     case a
+%!       x(k) = a;
 %!   endswitch
 %!   k++;
 %! endfor
@@ -76,21 +74,18 @@
 %!test
 %! a = 1;
 %!
-%! switch 1
-%! otherwise
-%!   a = 2;
+%! switch (1)
+%!   otherwise
+%!     a = 2;
 %! endswitch
 %!
 %! assert (a == 2);
 
 
-%% test/octave.test/switch/switch-4.m
 %!error <syntax error> eval ("switch endswitch")
 
-%% test/octave.test/switch/switch-5.m
 %!error <syntax error> eval ("switch case endswitch")
 
-%% test/octave.test/switch/switch-6.m
 %!error <syntax error> eval ("switch 1 default 1; endswitch")
 
 %% test parsing of single-quoted character string appearing immediately
--- a/test/system.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/system.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,7 +16,6 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/system/cputime-1.m
 %!test
 %! [t1, u1, s1] = cputime ();
 %! for i = 1:200
@@ -30,46 +29,36 @@
 %! assert (s2 >= s2);
 %!#assert (t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2);
 
-%% test/octave.test/system/tic-toc-1.m
 %!test
 %! tic ();
 %! sleep (2);
 %! assert (toc () > 0);
 
-%% test/octave.test/system/pause-1.m
 %!test
 %! pause (0);
 %! __printf_assert__ ("ok\n");
 %! assert (__prog_output_assert__ ("ok"));
 
-%% test/octave.test/system/pause-2.m
 %!error <Invalid call to pause> pause (1, 2)
 
-%% test/octave.test/system/sleep-1.m
 %!test
 %! sleep (0);
 %! __printf_assert__ ("ok\n");
 %! assert (__prog_output_assert__ ("ok"));
 
-%% test/octave.test/system/sleep-2.m
 %!error <Invalid call to sleep> sleep ()
 
-%% test/octave.test/system/sleep-3.m
 %!error <Invalid call to sleep> sleep (1, 2)
 
-%% test/octave.test/system/usleep-1.m
 %!test
 %! usleep (0);
 %! __printf_assert__ ("ok\n");
 %! assert (__prog_output_assert__ ("ok"));
 
-%% test/octave.test/system/usleep-2.m
 %!error <Invalid call to usleep> usleep ()
 
-%% test/octave.test/system/usleep-3.m
 %!error <Invalid call to usleep> usleep (1, 2)
 
-%% test/octave.test/system/rename-1.m
 %!test
 %! from = tmpnam ();
 %! to = tmpnam ();
@@ -88,13 +77,10 @@
 %!   endif
 %! endif
 
-%% test/octave.test/system/rename-2.m
 %!error <Invalid call to rename> rename ()
 
-%% test/octave.test/system/rename-3.m
 %!error <Invalid call to rename> rename ("foo", "bar", 1)
 
-%% test/octave.test/system/unlink-1.m
 %!test
 %! nm = tmpnam ();
 %! if ((id = fopen (nm, "wb")) > 0)
@@ -105,24 +91,18 @@
 %!   endif
 %! endif
 
-%% test/octave.test/system/unlink-2.m
 %!error <Invalid call to unlink> unlink ()
 
-%% test/octave.test/system/unlink-3.m
 %!error <Invalid call to unlink> unlink ("foo", 1)
 
-%% test/octave.test/system/readdir-1.m
 %!test
 %! [files, status, msg] = readdir (filesep);
 %! assert (iscell (files) && status == 0 && strcmp (msg, ""));
 
-%% test/octave.test/system/readdir-2.m
 %!error <Invalid call to readdir> readdir ()
 
-%% test/octave.test/system/readdir-3.m
 %!error <Invalid call to readdir> readdir ("foo", 1)
 
-%% test/octave.test/system/mk-rm-dir-1.m
 %!test
 %! nm = tmpnam ();
 %! e1 = mkdir (nm);
@@ -131,23 +111,18 @@
 %! [s4, e4] = stat (nm);
 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0));
 
-%% test/octave.test/system/mkdir-1.m
 %!error <Invalid call to mkdir> mkdir ()
 
-%% test/octave.test/system/mkdir-2.m
 %!error <Invalid call to mkdir> mkdir ("foo", 1, 2)
 
-%% test/octave.test/system/rmdir-1.m
 %!error <Invalid call to rmdir> rmdir ()
 
-%% test/octave.test/system/rmdir-2.m
 %!test
 %! crr = confirm_recursive_rmdir ();
 %! confirm_recursive_rmdir (0);
 %! assert (!rmdir ("foo", "s"));
 %! confirm_recursive_rmdir (crr);
 
-%% test/octave.test/system/umask-1.m
 %!test
 %! orig_umask = umask (0);
 %! nm = tmpnam ();
@@ -165,16 +140,13 @@
 %!
 %! assert (deblank (s1.modestr), "-rw-rw-rw-");
 %! assert (deblank (s2.modestr), "----------");
-%! # Restore original umask value
+%! ## Restore original umask value
 %! umask (orig_umask);
 
-%% test/octave.test/system/umask-2.m
 %!error <Invalid call to umask> umask ()
 
-%% test/octave.test/system/umask-3.m
 %!error <Invalid call to umask> umask (1, 2)
 
-%% test/octave.test/system/stat-1.m
 %!test
 %! [s, err, msg] = stat (filesep);
 %! assert ((err == 0
@@ -191,13 +163,10 @@
 %! && isfield (s, "ctime")
 %! && ischar (msg)));
 
-%% test/octave.test/system/stat-2.m
 %!error <Invalid call to stat> stat ()
 
-%% test/octave.test/system/stat-3.m
 %!error <Invalid call to stat> stat ("foo", 1)
 
-%% test/octave.test/system/lstat-1.m
 %!test
 %! [s, err, msg] = lstat (filesep);
 %! assert ((err == 0
@@ -214,22 +183,16 @@
 %! && isfield (s, "ctime")
 %! && ischar (msg)));
 
-%% test/octave.test/system/lstat-2.m
 %!error <Invalid call to lstat> lstat ()
 
-%% test/octave.test/system/lstat-3.m
 %!error <Invalid call to lstat> lstat ("foo", 1)
 
-%% test/octave.test/system/glob-1.m
 %!assert (iscell (glob ([filesep "*"])))
 
-%% test/octave.test/system/glob-2.m
 %!error <Invalid call to glob> glob ()
 
-%% test/octave.test/system/glob-3.m
 %!error <Invalid call to glob> glob ("foo", 1)
 
-%% test/octave.test/system/fnmatch-1.m
 %!test
 %! string_fill_char = char (0);
 %! assert ((fnmatch ("a*a", {"aba"; "xxxba"; "aa"}) == [1; 0; 1]
@@ -238,123 +201,91 @@
 %! && fnmatch ("x[0-5]*", {"x1"; "x6"; "x001"}) == [1; 0; 1]
 %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0]));
 
-%% test/octave.test/system/fnmatch-2.m
 %!error <Invalid call to fnmatch> fnmatch ()
 
-%% test/octave.test/system/fnmatch-3.m
 %!error <Invalid call to fnmatch> fnmatch ("foo", "bar", 3)
 
-%% test/octave.test/system/file_in_path-1.m
 %!assert (ischar (file_in_path (path (), "date.m")))
 
-%% test/octave.test/system/file_in_path-2.m
 %!error <invalid option> file_in_path ("foo", "bar", 1)
 
-%% test/octave.test/system/file_in_path-3.m
 %!error <Invalid call to file_in_path> file_in_path ()
 
-%% test/octave.test/system/file_in_path-4.m
 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka")
 
-%% test/octave.test/system/tilde_expand-1.m
 %!testif HAVE_GETPWUID
 %! x = getpwuid (getuid ());
 %! assert ((strcmp (x.dir, tilde_expand ("~"))
 %! && strcmp (x.dir, tilde_expand (sprintf ("~%s", x.name)))
 %! && strcmp ("foobar", tilde_expand ("foobar"))));
 
-%% test/octave.test/system/tilde_expand-2.m
 %!error <Invalid call to tilde_expand> tilde_expand ()
 
-%% test/octave.test/system/tilde_expand-3.m
 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2)
 
-%% test/octave.test/system/getpgrp-1.m
 %!testif HAVE_GETPGRP
 %! assert (getpgrp () > 0);
 
-%% test/octave.test/system/getpgrp-2.m
 %!error <... getpgrp> getpgrp (1)
 
-%% test/octave.test/system/getpid-1.m
 %!assert (getpid () > 0)
 
-%% test/octave.test/system/getpid-2.m
 %!error <... getpid> getpid (1)
 
-%% test/octave.test/system/getppid-1.m
 %!testif HAVE_GETPPID
 %! assert (getppid () > 0);
 
-%% test/octave.test/system/getppid-2.m
 %!error <... getppid> getppid (1)
 
-%% test/octave.test/system/geteuid-1.m
 %!assert (geteuid () >= 0)
 
-%% test/octave.test/system/geteuid-2.m
 %!error <... geteuid> geteuid (1)
 
-%% test/octave.test/system/getuid-1.m
 %!assert (getuid () >= 0)
 
-%% test/octave.test/system/getuid-2.m
 %!error <... getuid> getuid (1)
 
-%% test/octave.test/system/getegid-1.m
 %!assert (getegid () >= 0)
 
-%% test/octave.test/system/getegid-2.m
 %!error <... getegid> getegid (1)
 
-%% test/octave.test/system/getgid-1.m
 %!assert (getgid () >= 0)
 
-%% test/octave.test/system/getgid-2.m
 %!error <... getgid> getgid (1)
 
-%% test/octave.test/system/getenv-1.m
 %!assert (getenv ("HOME"), tilde_expand ("~"))
 
-%% test/octave.test/system/getenv-2.m
 %!error <Invalid call to getenv> getenv ()
 
-%% test/octave.test/system/getenv-3.m
 %!error <Invalid call to getenv> getenv ("foo", 1)
 
-%% test/octave.test/system/getenv-4.m
 %!test
 %! wns = warning ("query", "Octave:num-to-str");
 %! warning ("on", "Octave:num-to-str");
 %! fail ("getenv (1)", "warning");
 %! warning (wns.state, "Octave:num-to-str");
 
-%% test/octave.test/system/putenv-1.m
 %!test
 %! putenv ("foobar", "baz");
 %! assert (getenv ("foobar"), "baz");
 
-%% test/octave.test/system/putenv-2.m
 %!error <Invalid call to putenv> putenv ()
 
-%% test/octave.test/system/putenv-3.m
 %!error <Invalid call to putenv> putenv ("foo", "bar", 1)
 
-%% test/octave.test/system/putenv-4.m
 %!test
 %! wns = warning ("query", "Octave:num-to-str");
 %! warning ("on", "Octave:num-to-str");
 %! fail ("putenv (1, 2)","warning");
 %! warning (wns.state, "Octave:num-to-str");
 
-%% test/octave.test/system/cd-1.m
 %!test
 %! xdir = pwd ();
 %! cd /
 %! d1 = pwd ();
 %! cd (xdir);
 %! if (ispc () && ! isunix ())
-%!   # should be a drive letter
+%!   ## should be a drive letter
 %!   assert (length (d1), 3);
 %!   assert (d1(2), ":");
 %!   assert (d1(3), "\\");
@@ -363,13 +294,10 @@
 %! endif
 %! assert (pwd (), xdir);
 
-%% test/octave.test/system/cd-2.m
 %!error cd (1)
 
-%% test/octave.test/system/pwd-1.m
 %!assert (ischar (pwd ()))
 
-%% test/octave.test/system/getpwent-1.m
 %!testif HAVE_GETPWENT
 %! s = getpwent ();
 %! endpwent ();
@@ -382,36 +310,28 @@
 %! && isfield (s, "dir")
 %! && isfield (s, "shell")));
 
-%% test/octave.test/system/getpwent-2.m
 %!error <Invalid call to getpwent> getpwent (1)
 
-%% test/octave.test/system/getpwuid-1.m
 %!testif HAVE_GETPWUID
 %! x = getpwent ();
 %! y = getpwuid (x.uid);
 %! endpwent ();
 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
 
-%% test/octave.test/system/getpwuid-2.m
 %!error <Invalid call to getpwuid> getpwuid ()
 
-%% test/octave.test/system/getpwuid-3.m
 %!error <Invalid call to getpwuid> getpwuid (1, 2)
 
-%% test/octave.test/system/getpwnam-1.m
 %!testif HAVE_GETPWNAM
 %! x = getpwent ();
 %! y = getpwnam (x.name);
 %! endpwent ();
 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
 
-%% test/octave.test/system/getpwnam-2.m
 %!error <Invalid call to getpwnam> getpwnam ()
 
-%% test/octave.test/system/getpwnam-3.m
 %!error <Invalid call to getpwnam> getpwnam ("foo", 1)
 
-%% test/octave.test/system/setpwent-1.m
 %!testif HAVE_SETPWENT
 %! x = getpwent ();
 %! setpwent ();
@@ -419,13 +339,10 @@
 %! endpwent ();
 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
 
-%% test/octave.test/system/setpwent-2.m
 %!error <Invalid call to setpwent> setpwent (1)
 
-%% test/octave.test/system/endpwent-1.m
 %!error <Invalid call to endpwent> endpwent (1)
 
-%% test/octave.test/system/getgrent-1.m
 %!testif HAVE_GETGRENT
 %! x = getgrent ();
 %! endgrent ();
@@ -435,36 +352,28 @@
 %! && isfield (x, "gid")
 %! && isfield (x, "mem")));
 
-%% test/octave.test/system/getgrent-2.m
 %!error <Invalid call to getgrent> getgrent (1)
 
-%% test/octave.test/system/getgrgid-1.m
 %!testif HAVE_GETGRGID
 %! x = getgrent ();
 %! y = getgrgid (x.gid);
 %! endgrent ();
 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
 
-%% test/octave.test/system/getgrgid-2.m
 %!error <Invalid call to getgrgid> getgrgid ()
 
-%% test/octave.test/system/getgrgid-3.m
 %!error <Invalid call to getgrgid> getgrgid (1, 2)
 
-%% test/octave.test/system/getgrnam-1.m
 %!testif HAVE_GETGRNAM
 %! x = getgrent ();
 %! y = getgrnam (x.name);
 %! endgrent ();
 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
 
-%% test/octave.test/system/getgrnam-2.m
 %!error <Invalid call to getgrnam> getgrnam ()
 
-%% test/octave.test/system/getgrnam-3.m
 %!error <Invalid call to getgrnam> getgrnam ("foo", 1)
 
-%% test/octave.test/system/setgrent-1.m
 %!testif HAVE_SETGRENT
 %! x = getgrent ();
 %! setgrent ();
@@ -472,18 +381,13 @@
 %! endgrent ();
 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
 
-%% test/octave.test/system/setgrent-2.m
 %!error <Invalid call to setgrent> setgrent (1)
 
-%% test/octave.test/system/endgrent-1.m
 %!error <Invalid call to endgrent> endgrent (1)
 
-%% test/octave.test/system/isieee-1.m
 %!assert (isieee () == 1 || isieee () == 0)
 
-%% test/octave.test/system/octave_config_info-1.m
 %!assert (isstruct (octave_config_info ()))
 
-%% test/octave.test/system/getrusage-1.m
 %!assert (isstruct (getrusage ()))
 
--- a/test/try.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/try.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,14 +16,12 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/try/try-1.m
 %!test
 %! try
 %! catch
 %!   error ("Shoudn't get here");
-%! end_try_catch
+%! end  # "end" is part of test, check not using "end_try_catch"
 
-%% test/octave.test/try/try-2.m
 %!test
 %! try
 %!   clear a;
@@ -33,7 +31,6 @@
 %! a = 1;
 %! assert (a,1);
 
-%% test/octave.test/try/try-3.m
 %!test
 %! clear x;
 %! try
@@ -46,7 +43,6 @@
 %! assert (!exist ('x'));
 %! assert (a,2);
 
-%% test/octave.test/try/try-4.m
 %!test
 %! try
 %!   clear a;
@@ -56,7 +52,6 @@
 %! end_try_catch
 %! assert (exist ('x'));
 
-%% test/octave.test/try/try-5.m
 %!test
 %! try
 %!   clear a;
@@ -67,7 +62,6 @@
 %! end_try_catch
 %! assert (lasterr()(1:13), "'a' undefined");
 
-%% test/octave.test/try/try-6.m
 %!test
 %! try
 %!   error ("user-defined error");
@@ -75,10 +69,9 @@
 %!   assert (lasterr, "user-defined error");
 %! end_try_catch
 
-%% test/octave.test/try/try-7.m
 %!function ms = mangle (s)
 %!  ## Wrap angle brackets around S.
-%!  ms = cstrcat ("<", s, ">");
+%!  ms = ["<" s ">"];
 %!endfunction
 %!test
 %! try
@@ -89,7 +82,6 @@
 %!   assert (mangle (lasterr)(1:14), "<'a' undefined");
 %! end_try_catch
 
-%% test/octave.test/try/try-8.m
 %!test
 %! try
 %!   try
@@ -106,7 +98,6 @@
 %!   assert (lasterr()(1:13), "'b' undefined");
 %! end_try_catch
 
-%% test/octave.test/try/try-9.m
 %!test
 %! try
 %!   clear a;
@@ -123,7 +114,6 @@
 %!   end_try_catch
 %! end_try_catch
 
-%% test/octave.test/try/try-10.m
 %!test
 %! try
 %!   try
@@ -131,9 +121,62 @@
 %!     a;
 %!     error ("Shoudn't get here");
 %!   catch
-%!     error (cstrcat ("rethrow: ", lasterr));
+%!     error (["rethrow: " lasterr]);
 %!   end_try_catch
 %! catch
 %!   assert (lasterr()(1:22), "rethrow: 'a' undefined");
 %! end_try_catch
 
+%!test
+%! clear myerr;
+%! try
+%!   error ("user-defined error");
+%! catch myerr
+%!   assert (myerr.message, "user-defined error");
+%! end_try_catch
+
+%!test
+%! try
+%!   clear a;
+%!   error ("user-defined error");
+%! catch a=1;
+%!   assert (lasterr, "user-defined error");
+%!   assert (a, 1);
+%! end_try_catch
+
+%!test
+%! clear myerr1
+%! clear myerr2
+%! try
+%!   try
+%!     clear a;
+%!     a;
+%!   catch myerr1
+%!     error (myerr1);
+%!   end_try_catch
+%! catch myerr2
+%!   assert (myerr1.message, myerr2.message);
+%!   assert (myerr1.identifier, myerr2.identifier);
+%! end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch x; assert (x.message, "foo"); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch x end_try_catch
+%! assert (x.message, "foo");
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch, x; assert (x, 1); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch; x; assert (x, 1); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch
+%!   x; assert (x, 1); end_try_catch
--- a/test/unwind.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/unwind.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,7 +16,6 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/unwind/unwind-1.m
 %!function y = f (x)
 %!  global g;
 %!  save_g = g;
@@ -29,7 +28,7 @@
 %!  unwind_protect_cleanup
 %!    g = save_g;
 %!    y = [y, g];
-%!  end_unwind_protect
+%!  end  # "end" is part of test, check not using "end_unwind_protect"
 %!endfunction
 %!
 %!test
@@ -37,7 +36,6 @@
 %! y = f ([3,4]);
 %! assert (y, [0,1,-1]);
 
-%% test/octave.test/unwind/unwind-2.m
 %!function y = f (x)
 %!  global g;
 %!  save_g = g;
--- a/test/while.tst	Thu Sep 12 21:08:07 2013 -0400
+++ b/test/while.tst	Sat Oct 05 11:22:09 2013 -0400
@@ -16,16 +16,14 @@
 ## along with Octave; see the file COPYING.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-%% test/octave.test/while/while-1.m
 %!test
 %! i = 0;
 %! while (eye (2))
 %!   i++;
 %!   __printf_assert__ ("%d\n", i);
-%! endwhile
+%! end  # "end" is part of test, check not using "endwhile"
 %! assert (__prog_output_assert__ (""));
 
-%% test/octave.test/while/while-2.m
 %!test
 %! i = 5;
 %! while (--i)
@@ -34,7 +32,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("4321"));
 
-%% test/octave.test/while/while-3.m
 %!test
 %! i = 5;
 %! while (i)
@@ -44,7 +41,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("43210"));
 
-%% test/octave.test/while/while-4.m
 %!test
 %! i = 0;
 %! while (i++ < 20)
@@ -56,7 +52,6 @@
 %! __printf_assert__ ("\n");
 %! assert (__prog_output_assert__ ("12"));
 
-%% test/octave.test/while/while-5.m
 %!test
 %! i = 0;
 %! while (++i < 5)