changeset 32718:eca3683c88dc bytecode-interpreter

maint: Merge default to bytecode-interpreter.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Wed, 10 Jan 2024 15:07:40 -0500
parents 1401b75c22a9 (current diff) 53bd205b9426 (diff)
children 90d3b8ad2a98
files etc/NEWS.9.md
diffstat 5 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.9.md	Mon Jan 08 19:44:27 2024 -0500
+++ b/etc/NEWS.9.md	Wed Jan 10 15:07:40 2024 -0500
@@ -249,7 +249,7 @@
 ----------------------------------------------------
 
 - Bugfixes to `whos -file`, `urlread`, `mat2cell`, `set`, `savepath`,
-  `loadpath` and the general interpreter stack-handling.
+  `loadpath`, `griddata`, and the general interpreter stack-handling.
 
 - Better input validation for `sparse`, `speye`.
 
--- a/libinterp/corefcn/oct-stream.h	Mon Jan 08 19:44:27 2024 -0500
+++ b/libinterp/corefcn/oct-stream.h	Wed Jan 10 15:07:40 2024 -0500
@@ -121,20 +121,19 @@
       return output_stream ();
 
     if (m_conv_ostream)
-      return m_conv_ostream;
+      return m_conv_ostream.get ();
 
     // wrap the output stream with encoding conversion facet
     std::ostream *os = output_stream ();
     if (os && *os)
       {
-        convfacet_u8 *facet = new convfacet_u8 (m_encoding);
-        std::wbuffer_convert<convfacet_u8, char> *converter
-          = new std::wbuffer_convert<convfacet_u8, char> (os->rdbuf (),
-              facet);
-        m_conv_ostream = new std::ostream (converter);
+        m_converter
+          = std::make_unique<std::wbuffer_convert<convfacet_u8, char>>
+            (os->rdbuf (), new convfacet_u8 (m_encoding));
+        m_conv_ostream = std::make_unique<std::ostream> (m_converter.get ());
       }
 
-    return (m_conv_ostream ? m_conv_ostream : output_stream ());
+    return (m_conv_ostream ? m_conv_ostream.get () : output_stream ());
   }
 
   // Return TRUE if this stream is open.
@@ -208,15 +207,12 @@
   // encoding conversion facet
   typedef string::deletable_facet<string::codecvt_u8> convfacet_u8;
 
-  // FIXME: Identified by compiler as unused private field.
-  // Commented out 10/29/2022.
-  // If there are no repercussions, delete entirely.
-  // std::wbuffer_convert<convfacet_u8, char> *m_converter;
+  std::unique_ptr<std::wbuffer_convert<convfacet_u8, char>> m_converter;
 
   // wrappers for encoding conversion
-  // std::istream *m_conv_istream;
+  // std::unique_ptr<std::istream> m_conv_istream;
 
-  std::ostream *m_conv_ostream;
+  std::unique_ptr<std::ostream> m_conv_ostream;
 
   // TRUE if an error has occurred.
   bool m_fail;
--- a/libinterp/dldfcn/gzip.cc	Mon Jan 08 19:44:27 2024 -0500
+++ b/libinterp/dldfcn/gzip.cc	Wed Jan 10 15:07:40 2024 -0500
@@ -445,6 +445,7 @@
     {
       if (deflateEnd (m_strm) != Z_OK)
         throw std::runtime_error ("failed to close zlib stream");
+      delete m_strm;
       m_strm = nullptr;
 
       // We have no error handling for failing to close source, let
--- a/libinterp/octave.cc	Mon Jan 08 19:44:27 2024 -0500
+++ b/libinterp/octave.cc	Wed Jan 10 15:07:40 2024 -0500
@@ -246,7 +246,7 @@
   octave_scalar_map m;
 
   m.assign ("sys_argc", sys_argc ());
-  m.assign ("sys_argv", Cell (string_vector (sys_argv ())));
+  m.assign ("sys_argv", Cell (all_args ()));
   m.assign ("echo_commands", echo_commands ());
   m.assign ("forced_interactive", forced_interactive ());
   m.assign ("forced_line_editing", forced_line_editing ());
--- a/scripts/geometry/griddata.m	Mon Jan 08 19:44:27 2024 -0500
+++ b/scripts/geometry/griddata.m	Wed Jan 10 15:07:40 2024 -0500
@@ -181,7 +181,8 @@
       z3 = z(tri(:,3));
 
       ## Calculate norm vector.
-      N = cross ([x2-x1, y2-y1, z2-z1], [x3-x1, y3-y1, z3-z1]);
+      N = cross ([x2-x1, y2-y1, z2-z1], [x3-x1, y3-y1, z3-z1], 2);
+
       ## Normalize.
       N = diag (norm (N, "rows")) \ N;
 
@@ -330,6 +331,15 @@
 %! zz2(isnan (zz)) = NaN;
 %! assert (zz, zz2, 100*eps);
 
+%!testif HAVE_QHULL <*65146> # Ensure correct output for 3-point queries.
+%! xi = [1 2 3];
+%! a = griddata (xi, xi, xi .* xi', xi, xi, "linear");
+%! assert (a, [1, 4, 9]', 10*eps);
+%! a = griddata (xi, xi, xi .* xi', xi', xi', "linear");
+%! assert (a, [1, 4, 9]', 10*eps);
+%! a = griddata (xi, xi, xi .* xi', [xi; xi], [xi; xi], "linear");
+%! assert (a, [1, 4, 9; 1, 4, 9], 10*eps);
+
 ## Test input validation
 %!error <Invalid call> griddata ()
 %!error <Invalid call> griddata (1)