changeset 33592:8a833798c741 bytecode-interpreter

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Fri, 17 May 2024 09:32:40 -0400
parents a079e8d8bef7 (current diff) d26bc20bac10 (diff)
children 96a203bc7e17
files libinterp/octave-value/ov-base-mat.cc libinterp/octave-value/ov-base.h
diffstat 10 files changed, 91 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Fri May 17 09:32:40 2024 -0400
@@ -1615,7 +1615,7 @@
 // This slot is a reimplementation of the virtual slot in octave_dock_widget.
 // We need this for updating the parent of the find dialog
 void
-file_editor::toplevel_change (bool)
+file_editor::toplevel_change (bool toplevel)
 {
   if (m_find_dialog)
     {
@@ -1626,6 +1626,8 @@
       find_create ();
       m_find_dialog->activateWindow ();
     }
+
+  octave_dock_widget::toplevel_change (toplevel);
 }
 
 void
--- a/libinterp/octave-value/ov-base-diag.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-base-diag.cc	Fri May 17 09:32:40 2024 -0400
@@ -598,8 +598,6 @@
       octave_idx_type max_elts = 10;
       octave_idx_type elts = 0;
 
-      octave_idx_type nel = m_matrix.numel ();
-
       octave_idx_type nr = m_matrix.rows ();
       octave_idx_type nc = m_matrix.columns ();
 
@@ -617,25 +615,37 @@
                 os << tmp.substr (pos);
               else if (! tmp.empty ())
                 os << tmp[0];
-
-              if (++elts >= max_elts)
-                goto done;
+              elts++;
 
               if (j < nc - 1)
-                os << ", ";
+                {
+                  os << ", ";
+
+                  if (elts >= max_elts)
+                    {
+                      os << "...";
+                      goto done;
+                    }
+                }
             }
 
-          if (i < nr - 1 && elts < max_elts)
-            os << "; ";
+          if (i < nr - 1)
+            {
+              os << "; ";
+
+              if (elts >= max_elts)
+                {
+                  os << "...";
+                  goto done;
+                }
+            }
         }
 
     done:
-
-      if (nel <= max_elts)
-        os << ']';
+      os << ']';
     }
   else
-    os << "...";
+    octave_base_value::short_disp (os);
 }
 
 template <typename DMT, typename MT>
--- a/libinterp/octave-value/ov-base-mat.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-base-mat.cc	Fri May 17 09:32:40 2024 -0400
@@ -511,8 +511,6 @@
       octave_idx_type max_elts = 10;
       octave_idx_type elts = 0;
 
-      octave_idx_type nel = m_matrix.numel ();
-
       octave_idx_type nr = m_matrix.rows ();
       octave_idx_type nc = m_matrix.columns ();
 
@@ -530,25 +528,37 @@
                 os << tmp.substr (pos);
               else if (! tmp.empty ())
                 os << tmp[0];
-
-              if (++elts >= max_elts)
-                goto done;
+              elts++;
 
               if (j < nc - 1)
-                os << ", ";
+                {
+                  os << ", ";
+
+                  if (elts >= max_elts)
+                    {
+                      os << "...";
+                      goto done;
+                    }
+                }
             }
 
-          if (i < nr - 1 && elts < max_elts)
-            os << "; ";
+          if (i < nr - 1)
+            {
+              os << "; ";
+
+              if (elts >= max_elts)
+                {
+                  os << "...";
+                  goto done;
+                }
+            }
         }
 
     done:
-
-      if (nel <= max_elts)
-        os << ']';
+      os << ']';
     }
   else
-    os << "...";
+    octave_base_value::short_disp (os);
 }
 
 template <typename MT>
--- a/libinterp/octave-value/ov-base.h	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-base.h	Fri May 17 09:32:40 2024 -0400
@@ -768,7 +768,11 @@
   print_with_name (std::ostream& output_buf, const std::string& name,
                    bool print_padding = true);
 
-  virtual void short_disp (std::ostream& os) const { os << "..."; }
+  virtual void short_disp (std::ostream& os) const
+  {
+    dim_vector dv = dims ();
+    os << "[" << dv.str () << " " << class_name () << "]";
+  }
 
   virtual OCTINTERP_API float_display_format get_edit_display_format () const;
 
--- a/libinterp/octave-value/ov-cell.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-cell.cc	Fri May 17 09:32:40 2024 -0400
@@ -699,7 +699,10 @@
 void
 octave_cell::short_disp (std::ostream& os) const
 {
-  os << (m_matrix.isempty () ? "{}" : "...");
+  // octave_base_matrix<octave_value>::short_disp is not appropriate for
+  // cell arrays.
+
+  octave_base_value::short_disp (os);
 }
 
 #define CELL_ELT_TAG "<cell-element>"
--- a/libinterp/octave-value/ov-classdef.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-classdef.cc	Fri May 17 09:32:40 2024 -0400
@@ -399,13 +399,7 @@
 
               octave_value val = prop.get_value (m_object, false);
 
-              if (val.ndims () == 2 && val.rows () == 1 && (val.isnumeric () || val.islogical () || val.is_string ()))
-                val.short_disp (os);
-              else
-                {
-                  dim_vector dims = val.dims ();
-                  os << "[" << dims.str () << " " << val.class_name () << "]";
-                }
+              val.short_disp (os);
             }
 
           newline (os);
--- a/libinterp/octave-value/ov-perm.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-perm.cc	Fri May 17 09:32:40 2024 -0400
@@ -510,8 +510,6 @@
       octave_idx_type max_elts = 10;
       octave_idx_type elts = 0;
 
-      octave_idx_type nel = m_matrix.numel ();
-
       octave_idx_type nr = m_matrix.rows ();
       octave_idx_type nc = m_matrix.columns ();
 
@@ -530,25 +528,37 @@
                 os << tmp.substr (pos);
               else if (! tmp.empty ())
                 os << tmp[0];
-
-              if (++elts >= max_elts)
-                goto done;
+              elts++;
 
               if (j < nc - 1)
-                os << ", ";
+                {
+                  os << ", ";
+
+                  if (elts >= max_elts)
+                    {
+                      os << "...";
+                      goto done;
+                    }
+                }
             }
 
-          if (i < nr - 1 && elts < max_elts)
-            os << "; ";
+          if (i < nr - 1)
+            {
+              os << "; ";
+
+              if (elts >= max_elts)
+                {
+                  os << "...";
+                  goto done;
+                }
+            }
         }
 
     done:
-
-      if (nel <= max_elts)
-        os << ']';
+      os << ']';
     }
   else
-    os << "...";
+    octave_base_value::short_disp (os);
 }
 
 octave_base_value *
--- a/libinterp/octave-value/ov-str-mat.cc	Tue May 14 15:35:10 2024 -0400
+++ b/libinterp/octave-value/ov-str-mat.cc	Fri May 17 09:32:40 2024 -0400
@@ -285,9 +285,15 @@
       std::string tmp = chm.row_as_string (0);
 
       // FIXME: should this be configurable?
-      std::size_t max_len = 100;
+      std::size_t max_len = 50;
+
+      char quote_char = is_sq_string () ? '\'' : '"';
 
-      os << (tmp.length () > max_len ? tmp.substr (0, 100) : tmp);
+      os << quote_char;
+      if (tmp.length () > max_len)
+        os << tmp.substr (0, 50) << quote_char << " (truncated)";
+      else
+        os << tmp << quote_char;
     }
 }
 
--- a/liboctave/util/glob-match.cc	Tue May 14 15:35:10 2024 -0400
+++ b/liboctave/util/glob-match.cc	Fri May 17 09:32:40 2024 -0400
@@ -97,7 +97,7 @@
   octave_idx_type pat_wildc_idx = -1;
   octave_idx_type sym_len = sym.length ();
   octave_idx_type sym_idx = 0;
-  octave_idx_type sym_wildc_idx;
+  octave_idx_type sym_wildc_idx = 0;
 
   while (sym_idx < sym_len)
     {
--- a/scripts/miscellaneous/inputParser.m	Tue May 14 15:35:10 2024 -0400
+++ b/scripts/miscellaneous/inputParser.m	Fri May 17 09:32:40 2024 -0400
@@ -364,9 +364,10 @@
 
       if (iscell (def))
         ## Accept cell default values (bug #64305).
-        this.Parameter(end+1) = struct ("name", name, "def", {def}, "val", val);
+        ## Use builtin() to avoid struct overload in classdef (bug #65667)
+        this.Parameter(end+1) = builtin ("struct", "name", name, "def", {def}, "val", val);
       else
-        this.Parameter(end+1) = struct ("name", name, "def", def, "val", val);
+        this.Parameter(end+1) = builtin ("struct", "name", name, "def", def, "val", val);
       endif
 
     endfunction