changeset 33562:67d22dc78b80 bytecode-interpreter

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Fri, 10 May 2024 11:27:56 -0400
parents bfa4ab12b323 (current diff) 3485012a415a (diff)
children 36a19bb5cf61
files
diffstat 3 files changed, 102 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.10.md	Thu May 09 18:18:53 2024 -0400
+++ b/etc/NEWS.10.md	Fri May 10 11:27:56 2024 -0400
@@ -18,24 +18,27 @@
 - `nchoosek` algorithm is now ~2x faster and provides greater precision.
 
 - `nextpow2` algorithm is now more accurate for inputs very close to a power
-of 2.  The output class now matches the input class for Matlab compatibility.
-The function no longer accepts complex inputs and will emit an error for these
-inputs.
+  of 2.  The output class now matches the input class for Matlab compatibility.
+  The function no longer accepts complex inputs and will emit an error for
+  these inputs.
 
 - `jsonencode` now outputs integers and floating point integers without ".0"
-suffix.
+  suffix.
 
 - `hist` now accepts N-dimensional array inputs for input `Y` which is
-processed in columns as if the array was flattened to a 2-dimensional array.
+  processed in columns as if the array was flattened to a 2-dimensional array.
+
+- The third output for `unique` is now correct when `stable` sort option is
+  used.
 
 ### Graphical User Interface
 
 ### Graphics backend
 
-- `polar` plots now include the center tick mark value, typically 0, in
-the `'rtick'` parameter when the plot is created.  Subsequent modifications
-to `'rtick'` by the function `rticks` will only include the center tick mark
-value if it is specified.
+- `polar` plots now include the center tick mark value, typically 0, in the
+  `'rtick'` parameter when the plot is created.  Subsequent modifications to
+  `'rtick'` by the function `rticks` will only include the center tick mark
+  value if it is specified.
 
 - `view` correctly interprets cartesian viewpoints on main axes (bug #65641).
 
@@ -43,32 +46,35 @@
 
 - `height` and `width` are now aliases for the `rows` and `columns` functions.
 
-- All colormaps now default to a size of 256 colors. (The previous default
-size was 64.)
+- All colormaps now default to a size of 256 colors. (The previous default size
+  was 64.)
+
+- The first argument to `colormap` may now be a figure or axes object.  Calling
+  `colormap` on a figure object will clear any "colormap" properties set at the
+  axes level.
 
 - `griddata` output size more consistently matches the input interpolation
-points when they are input as vectors.  When they are same-orientation vectors,
-the outputs will be the same size as those vectors.  When either is a row
-vector and the other is a column vector, the interpolating points are processed
-through meshgrid and the output is a matrix the same size as the meshgrid.
-
-- Enable the third output for `unique` with the `stable` sort option.
+  points when they are input as vectors.  When they are same-orientation
+  vectors, the outputs will be the same size as those vectors.  When either is
+  a row vector and the other is a column vector, the interpolating points are
+  processed through meshgrid and the output is a matrix the same size as the
+  meshgrid.
 
 - `iqr` now provides compatible output for empty inputs.
 
-- `cross` now produces row vector outputs when the inputs are a mix of row
-and column vectors (bug #61295).
+- `cross` now produces row vector outputs when the inputs are a mix of row and
+  column vectors (bug #61295).
 
 - `rat` now accepts complex inputs.
 
 - The optional second input argument of `system`, denoting whether to return
-the output as a variable, is now required to be a boolean value if used.
+  the output as a variable, is now required to be a boolean value if used.
 
 - Octave functions whose Matlab equivalents give errors when passed non-integer
-values as sizes or dimensions now also give similar errors. For example,
-`cell (e, pi)` now gives an error in Octave about requiring integer sizes
-for the cell array, matching Matlab behavior.  Previously, Octave's conversion
-from non-integers to integers was more lenient.
+  values as sizes or dimensions now also give similar errors.  For example,
+  `cell (e, pi)` now gives an error in Octave about requiring integer sizes for
+  the cell array, matching Matlab behavior.  Previously, Octave's conversion
+  from non-integers to integers was more lenient.
 
 ### Alphabetical list of new functions added in Octave 10
 
@@ -98,14 +104,15 @@
         interpreter::verbose                  | interpreter::init_trace
         cmdline_options::verbose              | cmdline_options::init_trace
 
-  - A new method `rwdata ()` provides direct read/write access (a pointer) to the
-data in a liboctave `Array` object (or its derived classes such as `Matrix`).
-Historically, the method `fortran_vec ()` provided this access, but the name
-is unclear, and it is recommended to use `rwdata ()` in any new code.  There
-are no plans to deprecate `fortran_vec`.
+  - A new method `rwdata ()` provides direct read/write access (a pointer) to
+    the data in a liboctave `Array` object (or its derived classes such as
+    `Matrix`).  Historically, the method `fortran_vec ()` provided this access,
+    but the name is unclear, and it is recommended to use `rwdata ()` in any
+    new code.  There are no plans to deprecate `fortran_vec`.
 
   - The `--verbose`,`-V` command-line option has been deprecated.  Use
-`--init-trace` to print the configuration files executed during initialization.
+    `--init-trace` to print the configuration files executed during
+    initialization.
 
 The following features were deprecated in Octave 8 and have been removed
 from Octave 10.
@@ -117,22 +124,22 @@
         shift                  | circshift
         sparse_auto_mutate     | none (see below)
 
-- `fminsearch` parameter passing:  A legacy, undocumented, and only partially
-supported syntax for passing parameters to the minimized function `fcn` called
-by `fminsearch` by appending them to the input argument list was partly
-implemented since Octave 4.4.0.  Due to conflicts with other input methods,
-the documentation of this syntax was removed in Octave 5.1.0.  The remaining
-functionality has been completely removed in Octave 10.  Attempts to call
-`fminsearch` with that syntax will result in an error.  The preferred method of
-passing parameters to any of the minimization functions (including
-`fminsearch`, `fminbnd`, and `fminunc`) is through the use of anonymous
-functions.  Specific examples of this can be found in the "Minimizers" section
-of the Octave manual.
+- `fminsearch` parameter passing: A legacy, undocumented, and only partially
+  supported syntax for passing parameters to the minimized function `fcn`
+  called by `fminsearch` by appending them to the input argument list was
+  partly implemented since Octave 4.4.0.  Due to conflicts with other input
+  methods, the documentation of this syntax was removed in Octave 5.1.0.  The
+  remaining functionality has been completely removed in Octave 10.  Attempts
+  to call `fminsearch` with that syntax will result in an error.  The preferred
+  method of passing parameters to any of the minimization functions (including
+  `fminsearch`, `fminbnd`, and `fminunc`) is through the use of anonymous
+  functions.  Specific examples of this can be found in the "Minimizers"
+  section of the Octave manual.
 
 ### Build system
 
 - Octave now requires a C++ compiler that is compliant with C++17 (preferably
-with GNU extensions).
+  with GNU extensions).
 
 
 Summary of bugs fixed for version 10.1.0 (yyyy-mm-dd):
--- a/liboctave/wrappers/unistd-wrappers.c	Thu May 09 18:18:53 2024 -0400
+++ b/liboctave/wrappers/unistd-wrappers.c	Fri May 10 11:27:56 2024 -0400
@@ -180,7 +180,11 @@
 int
 octave_execvp_wrapper (const char *file, char *const *argv)
 {
+#if defined (OCTAVE_USE_WINDOWS_API)
+  return execvp (file, (const char *const *) argv);
+#else
   return execvp (file, argv);
+#endif
 }
 
 pid_t
--- a/scripts/image/colormap.m	Thu May 09 18:18:53 2024 -0400
+++ b/scripts/image/colormap.m	Fri May 10 11:27:56 2024 -0400
@@ -29,6 +29,7 @@
 ## @deftypefnx {} {@var{cmap} =} colormap (@qcode{"default"})
 ## @deftypefnx {} {@var{cmap} =} colormap (@var{map_name})
 ## @deftypefnx {} {@var{cmap} =} colormap (@var{hax}, @dots{})
+## @deftypefnx {} {@var{cmap} =} colormap (@var{hfig}, @dots{})
 ## @deftypefnx {} {} colormap @var{map_name}
 ## Query or set the current colormap.
 ##
@@ -48,7 +49,8 @@
 ## is the name of a function that returns a colormap.
 ##
 ## If the first argument @var{hax} is an axes handle, then the colormap for
-## those axes is queried or set.
+## the specified axes is queried or set.  If the first argument @var{hfig} is a
+## figure handle, then the colormap for the specified figure is queried or set.
 ##
 ## For convenience, it is also possible to use this function with the
 ## command form, @code{colormap @var{map_name}}.
@@ -93,15 +95,32 @@
 
 function cmap = colormap (varargin)
 
-  [hax, varargin, nargin] = __plt_get_axis_arg__ ("colormap", varargin{:});
+  hax = [];
+  if (nargin > 0)
+    if (isscalar (varargin{1}) && ishghandle (varargin{1}))
+      htmp = varargin{1};
+      if (isaxes (htmp))
+        hax = htmp;
+      elseif (isfigure (htmp))
+        hax = [];
+      else
+        error ("colormap: target argument must be a figure or axes handle");
+      endif
+      ## Delete first item in list that was just processed.
+      varargin(1) = [];
+      nargin = nargin - 1;
+    endif
+  endif
 
   if (nargin > 1)
     print_usage ();
   endif
 
   if (! isempty (hax))
+    have_fig = false;
     cf = hax;
   else
+    have_fig = true;
     cf = get (0, "currentfigure");
   endif
 
@@ -133,6 +152,11 @@
       endif
       ## Set the new color map
       set (cf, "colormap", map);
+      if (have_fig)
+        ## Matlab Compatibility: Also clear any axes colormaps as of R2018A.
+        hax = findobj (cf, '-depth', 1, 'type', 'axes');
+        set (hax, 'colormap', []);
+      endif
     endif
   endif
 
@@ -178,12 +202,33 @@
 %!   close (hf);
 %! end_unwind_protect
 
+%!test <*65674>
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax1 = subplot (2, 1, 1);
+%!   hax2 = subplot (2, 1, 2);
+%!   cmaptst = [0 1 0; 1 0 1; 1 1 1];
+%!   colormap (cmaptst);
+%!   colormap (hax1, jet (16));
+%!   colormap (hax2, pink (16));
+%!   assert (map = colormap (hf), cmaptst);
+%!   assert (map = colormap (hax1), jet (16));
+%!   assert (map = colormap (hax2), pink (16));
+%!   colormap (gray (4));
+%!   assert (map = colormap (hf), gray (4));
+%!   assert (map = colormap (hax1), gray (4));
+%!   assert (map = colormap (hax2), gray (4));
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
 ## Test input validation
-%!error colormap (1,2,3)
+%!error <target argument must be a figure or axes handle> colormap (0)
+%!error <Invalid call> colormap (1,2,3)
+%!error <failed to set MAP .invalid_map_name.> colormap ("invalid_map_name")
 %!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 <failed to set MAP .invalid_map_name.> colormap ("invalid_map_name")