changeset 26360:ddf1cfd62a86

maint: merge stable to default.
author Rik <rik@octave.org>
date Tue, 01 Jan 2019 22:24:53 -0800
parents 661fe14264c6 (current diff) cd44edea6a31 (diff)
children 0249ba4c9589
files NEWS etc/NEWS.5
diffstat 20 files changed, 56 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Jan 01 08:13:41 2019 -0800
+++ b/NEWS	Tue Jan 01 22:24:53 2019 -0800
@@ -2,6 +2,9 @@
 ----------------------------------------------------------------------
 
  ** New functions added in 6.0:
+ ** Specifying legend position with a numeric argument is deprecated and
+    will be removed in Octave 7.0.  Use a string argument instead.
+
 
 
 
--- a/etc/NEWS.5	Tue Jan 01 08:13:41 2019 -0800
+++ b/etc/NEWS.5	Tue Jan 01 22:24:53 2019 -0800
@@ -164,6 +164,9 @@
     Matlab compatible.  If necessary use the "-loose" option to
     reproduce figures as they appeared in previous versions of Octave.
 
+ ** Specifying legend position with a numeric argument is deprecated and
+    will be removed in Octave 7.0.  Use a string argument instead.
+
  ** It is now possible to use files and folders containing Unicode
     characters in Windows.
 
--- a/libgui/src/m-editor/file-editor-tab.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libgui/src/m-editor/file-editor-tab.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -2330,9 +2330,9 @@
     // implementations.
     if (can_encode)
       {
-        std::u32string u32_str = editor_text.toStdU32String ();
+        QVector<uint> u32_str = editor_text.toUcs4 ();
         const uint32_t *src = reinterpret_cast<const uint32_t *>
-                              (u32_str.c_str ());
+                              (u32_str.data ());
 
         size_t length;
         char *res_str =
--- a/libgui/src/octave-dock-widget.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libgui/src/octave-dock-widget.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -58,8 +58,8 @@
           }
         else
           {
-            m_default_float_button = buttonlist.at (0);
-            m_default_close_button = buttonlist.at (1);
+            m_default_float_button = buttonlist.at (1);
+            m_default_close_button = buttonlist.at (0);
           }
       }
 
--- a/libinterp/corefcn/data.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/data.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -101,7 +101,7 @@
     print_usage ();
 
   int dim = (nargin == 1 ? -1
-                         : args(1).int_value ("all: DIM must be an integer")-1);
+                         : args(1).xint_value ("all: DIM must be an integer")-1);
 
   if (dim < -1)
     error ("all: invalid dimension argument = %d", dim + 1);
@@ -166,7 +166,7 @@
     print_usage ();
 
   int dim = (nargin == 1 ? -1
-                         : args(1).int_value ("any: DIM must be an integer")-1);
+                         : args(1).xint_value ("any: DIM must be an integer")-1);
 
   if (dim < -1)
     error ("any: invalid dimension argument = %d", dim + 1);
@@ -1135,7 +1135,7 @@
         {
           SparseMatrix cs = arg.sparse_matrix_value ().cumsum (dim);
           if (isnative)
-            retval = cs != 0.0;
+            retval = (cs != 0.0);
           else
             retval = cs;
         }
@@ -1143,7 +1143,7 @@
         {
           NDArray cs = arg.array_value ().cumsum (dim);
           if (isnative)
-            retval = cs != 0.0;
+            retval = (cs != 0.0);
           else
             retval = cs;
         }
--- a/libinterp/corefcn/dlmread.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/dlmread.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -478,7 +478,7 @@
                     {
                       double y = octave_read_double (tmp_stream);
 
-                      if (! iscmplx && y != 0.)
+                      if (! iscmplx && y != 0.0)
                         {
                           iscmplx = true;
                           cdata = ComplexMatrix (rdata);
--- a/libinterp/corefcn/error.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/error.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -972,7 +972,7 @@
 {
   std::string retval;
 
-  std::string tstr;
+  std::string tmpstr;
 
   if (args.length () > 0)
     {
@@ -988,20 +988,18 @@
 
       if (arg.is_defined ())
         {
-          if (arg.is_string ())
+          if (arg.isempty ())
+            return retval;
+          else if (arg.is_string ())
             {
-              tstr = arg.string_value ();
-              msg = tstr.c_str ();
-
-              if (! msg)
-                return retval;
+              tmpstr = arg.string_value ();  // 2-stage assignment required
+              msg = tmpstr.c_str ();         // in order to generate pointer  
+                                             // to valid memory.
             }
-          else if (arg.isempty ())
-            return retval;
         }
     }
 
-// Ugh.
+  // Ugh.
 
   size_t len = strlen (msg);
 
--- a/libinterp/corefcn/find.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/find.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -105,7 +105,6 @@
       start_nc = 0;
       end_nc = nc;
       n_to_find = nz;
-      count = nz;
     }
   else if (direction > 0)
     {
--- a/libinterp/corefcn/help.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/help.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -630,7 +630,7 @@
             // skip newline characters
             while (file
                    && (c = file.get ()) != std::istream::traits_type::eof ()
-                   && c == '\n' && c == '\r')
+                   && (c == '\n' || c == '\r'))
               ; // skip text
 
             file.unget ();
--- a/libinterp/corefcn/input.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/input.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -122,7 +122,7 @@
     {
       if (line[pos] == ')')
         paren_count++;
-      else if (line[pos] == '}')
+      else
         curly_count++;
 
       while (curly_count + paren_count > 0 && --pos >= 0)
@@ -636,9 +636,6 @@
     if (input_buf[len - 1] != '\n')
       octave_diary << "\n";
 
-    if (len < 1)
-      return read_as_string ? octave_value ("") : octave_value (Matrix ());
-
     if (read_as_string)
       {
         // FIXME: fix gnu_readline and octave_gets instead!
@@ -1116,7 +1113,7 @@
       size_t srclen = src_str.length ();
 
       size_t length;
-      uint8_t *utf8_str = nullptr;
+      uint8_t *utf8_str;
 
       utf8_str = octave_u8_conv_from_encoding (encoding.c_str (), src, srclen,
                                                &length);
@@ -1483,7 +1480,7 @@
   if (nargin < 1 || nargin > 2)
     print_usage ();
 
-  std::string hook_fcn_id = args(0).string_value ("remove_input_event_hook: argument not valid as a hook function name or id");
+  std::string hook_fcn_id = args(0).xstring_value ("remove_input_event_hook: argument not valid as a hook function name or id");
 
   bool warn = (nargin < 2);
 
--- a/libinterp/corefcn/matrix_type.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/matrix_type.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -266,7 +266,7 @@
           if (nargin == 3
               && (str_typ == "upper" || str_typ == "lower"))
             {
-              const ColumnVector perm = args(2).vector_value ("matrix_type: Invalid permutation vector PERM");
+              const ColumnVector perm = args(2).xvector_value ("matrix_type: Invalid permutation vector PERM");
 
               octave_idx_type len = perm.numel ();
               dim_vector dv = args(0).dims ();
@@ -403,7 +403,7 @@
 
           if (nargin == 3 && (str_typ == "upper" || str_typ == "lower"))
             {
-              const ColumnVector perm = args(2).vector_value ("matrix_type: Invalid permutation vector PERM");
+              const ColumnVector perm = args(2).xvector_value ("matrix_type: Invalid permutation vector PERM");
 
               octave_idx_type len = perm.numel ();
               dim_vector dv = args(0).dims ();
--- a/libinterp/corefcn/ordschur.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/ordschur.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -77,7 +77,7 @@
   if (args.length () != 3)
     print_usage ();
 
-  const Array<octave_idx_type> sel_arg = args(2).octave_idx_type_vector_value ("ordschur: SELECT must be an array of integers");
+  const Array<octave_idx_type> sel_arg = args(2).xoctave_idx_type_vector_value ("ordschur: SELECT must be an array of integers");
 
   const octave_idx_type sel_n = sel_arg.numel ();
 
--- a/libinterp/corefcn/psi.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/psi.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -73,7 +73,7 @@
     print_usage ();
 
   const octave_value oct_z = (nargin == 1) ? args(0) : args(1);
-  const octave_idx_type k = (nargin == 1) ? 0 : args(0).idx_type_value ("psi: K must be an integer");
+  const octave_idx_type k = (nargin == 1) ? 0 : args(0).xidx_type_value ("psi: K must be an integer");
   if (k < 0)
     error ("psi: K must be non-negative");
 
@@ -222,7 +222,7 @@
 %!error psi ()
 %!error psi (1, 2, 3)
 %!error <Z must be> psi ("non numeric")
-%!error <conversion of 5.3 to int.* value failed> psi (5.3, 1)
+%!error <K must be an integer> psi ({5.3}, 1)
 %!error <K must be non-negative> psi (-5, 1)
 %!error <Z must be non-negative for polygamma> psi (5, -1)
 %!error <Z must be a floating point> psi (5, uint8 (-1))
--- a/libinterp/corefcn/quad.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/quad.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -344,7 +344,7 @@
 
           have_sing = true;
 
-          sing = args(4).vector_value ("quad: fifth argument SING must be a vector of singularities");
+          sing = args(4).xvector_value ("quad: fifth argument SING must be a vector of singularities");
           OCTAVE_FALLTHROUGH;
 
         case 4:
--- a/libinterp/corefcn/rand.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/corefcn/rand.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -177,8 +177,7 @@
 
             dims.resize (2);
 
-            dims(0) = octave::math::nint_big (tmp.double_value ());
-            dims(1) = octave::math::nint_big (tmp.double_value ());
+            dims(0) = dims(1) = octave::math::nint_big (dval);
 
             goto gen_matrix;
           }
--- a/libinterp/dldfcn/__delaunayn__.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/dldfcn/__delaunayn__.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -204,26 +204,23 @@
             error ("__delaunayn__: Qhull returned non-simplicial facets -- try delaunayn with different options");
         }
 
-      if (! exitcode)
-        {
-          Matrix simpl (nf, dim+1);
+      Matrix simpl (nf, dim+1);
 
-          FORALLfacets
+      FORALLfacets
+        {
+          if (! facet->upperdelaunay)
             {
-              if (! facet->upperdelaunay)
-                {
-                  octave_idx_type j = 0;
+              octave_idx_type j = 0;
 
-                  FOREACHvertex_ (facet->vertices)
-                    {
-                      simpl(i, j++) = 1 + qh_pointid(vertex->point);
-                    }
-                  i++;
+              FOREACHvertex_ (facet->vertices)
+                {
+                  simpl(i, j++) = 1 + qh_pointid(vertex->point);
                 }
+              i++;
             }
+        }
 
-          retval(0) = simpl;
-        }
+      retval(0) = simpl;
     }
   else if (n == dim + 1)
     {
--- a/libinterp/dldfcn/__eigs__.cc	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/dldfcn/__eigs__.cc	Tue Jan 01 22:24:53 2019 -0800
@@ -114,7 +114,7 @@
 
       if (tmp.length () && tmp(0).is_defined ())
         {
-          retval = tmp(0).complex_vector_value ("eigs: evaluation of user-supplied function failed");
+          retval = tmp(0).xcomplex_vector_value ("eigs: evaluation of user-supplied function failed");
         }
       else
         {
@@ -165,7 +165,7 @@
   std::string fcn_name;
   octave_idx_type n = 0;
   octave_idx_type k = 6;
-  Complex sigma = 0.;
+  Complex sigma = 0.0;
   double sigmar, sigmai;
   bool have_sigma = false;
   std::string typ = "LM";
@@ -304,7 +304,7 @@
           // Use STL function to convert to upper case
           transform (typ.begin (), typ.end (), typ.begin (), toupper);
 
-          sigma = 0.;
+          sigma = 0.0;
         }
       else
         {
@@ -330,14 +330,14 @@
       tmp = map.getfield ("issym");
       if (tmp.is_defined () && ! sym_tested)
         {
-          symmetric = tmp.double_value () != 0.;
+          symmetric = tmp.double_value () != 0.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.);
+        a_is_complex = ! (tmp.double_value () != 0.0);
 
       tmp = map.getfield ("tol");
       if (tmp.is_defined ())
@@ -366,7 +366,7 @@
 
       tmp = map.getfield ("cholB");
       if (tmp.is_defined ())
-        cholB = tmp.double_value () != 0.;
+        cholB = tmp.double_value () != 0.0;
 
       tmp = map.getfield ("permB");
       if (tmp.is_defined ())
@@ -459,7 +459,7 @@
       else
         retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info));
     }
-  else if (sigmai != 0.)
+  else if (sigmai != 0.0)
     {
       // Promote real problem to a complex one.
       ComplexMatrix eig_vec;
--- a/libinterp/parse-tree/lex.h	Tue Jan 01 08:13:41 2019 -0800
+++ b/libinterp/parse-tree/lex.h	Tue Jan 01 22:24:53 2019 -0800
@@ -113,11 +113,8 @@
 
       ~bbp_nesting_level (void) = default;
 
-      void reset (void)
-      {
-        while (! m_context.empty ())
-          m_context.pop ();
-      }
+      // Alias for clear function.
+      void reset (void) { clear (); }
 
       void bracket (void) { m_context.push (BRACKET); }
 
--- a/scripts/plot/appearance/legend.m	Tue Jan 01 08:13:41 2019 -0800
+++ b/scripts/plot/appearance/legend.m	Tue Jan 01 22:24:53 2019 -0800
@@ -208,6 +208,7 @@
   if (nargs > 0)
     pos = varargin{nargs};
     if (isnumeric (pos) && isscalar (pos) && pos == fix (pos))
+      warning ("legend: specifying location with a numeric argument is obsolete and will be removed from a future version of Octave, use a string specification instead");
       if (pos >= -1 && pos <= 4)
         location = [{"northeastoutside", "best", "northeast",
                      "northwest", "southwest", "southeast"}] {pos + 2};
--- a/scripts/testfun/private/html_compare_plot_demos.m	Tue Jan 01 08:13:41 2019 -0800
+++ b/scripts/testfun/private/html_compare_plot_demos.m	Tue Jan 01 22:24:53 2019 -0800
@@ -46,7 +46,7 @@
 ## with a parameter named equal to the toolkit.  For example:
 ##
 ## @smallexample
-## @code{html_compare_plot_demos ({"gnuplot", "fltk"}, "gnuplot", " 4.6 patchlevel 5")}
+## @code{html_compare_plot_demos (@{"gnuplot", "fltk"@}, "gnuplot", " 4.6 patchlevel 5")}
 ## @end smallexample
 ##
 ## @seealso{compare_plot_demos, dump_demos, demo}