# HG changeset patch # User John W. Eaton # Date 1648999826 14400 # Node ID 960909469245cdff8ad6bd524bd9b8815c86e944 # Parent b77b321f1ac5d34366894407369a3c700bb38b6c# Parent 0a1aec50a0c82fd9fed4bd64961680f6291d4a75 maint: Merge stable to default. diff -r 0a1aec50a0c8 -r 960909469245 .github/workflows/make.yaml --- a/.github/workflows/make.yaml Sun Apr 03 11:29:17 2022 -0400 +++ b/.github/workflows/make.yaml Sun Apr 03 11:30:26 2022 -0400 @@ -76,7 +76,7 @@ key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }} restore-keys: | ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }} - ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/stable + ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/default - name: configure ccache env: @@ -215,7 +215,7 @@ key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }} restore-keys: | ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }} - ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/stable + ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/default - name: configure ccache # The cache doesn't seem to compress well on macOS. Is it already compressed? @@ -294,7 +294,7 @@ - name: analyze test suite results # Make sure the test summary lists 0 "FAIL"s and no "REGRESSION" - run: | + run: | [ -n "$(grep -e "FAIL\s*0" ./test-suite.log)" ] || echo "::warning::At least one test failed" [ -z "$(grep -e "REGRESSION" ./test-suite.log)" ] || echo "::warning::At least one regression in test suite" echo Finished analyzing test suite results. @@ -439,7 +439,7 @@ key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.target }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }} restore-keys: | ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.target }}:${{ github.ref }} - ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.target }}:refs/heads/stable + ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.target }}:refs/heads/default - name: configure ccache # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota. @@ -519,7 +519,7 @@ - name: analyze test suite results # Make sure the test summary lists 0 "FAIL"s and no "REGRESSION" - run: | + run: | [ -n "$(grep -e "FAIL\s*0" ./test-suite.log)" ] || echo "::warning::At least one test failed" [ -z "$(grep -e "REGRESSION" ./test-suite.log)" ] || echo "::warning::At least one regression in test suite" echo Finished analyzing test suite results. diff -r 0a1aec50a0c8 -r 960909469245 Makefile.am --- a/Makefile.am Sun Apr 03 11:29:17 2022 -0400 +++ b/Makefile.am Sun Apr 03 11:30:26 2022 -0400 @@ -233,7 +233,7 @@ # See bug #45578. BUILT_SOURCES += libgnu/libgnu.la -libgnu/libgnu.la: oct-conf-post.h +libgnu/libgnu.la: oct-conf-post-private.h oct-conf-post-public.h cd libgnu && $(MAKE) $(AM_MAKEFLAGS) all include liboctave/module.mk @@ -298,7 +298,8 @@ endif BUILT_SOURCES += \ - oct-conf-post.h \ + oct-conf-post-private.h \ + oct-conf-post-public.h \ octave-config.h \ run-octave \ $(DIRSTAMP_FILES) @@ -330,6 +331,7 @@ CONFIG_FILES = @ac_config_headers@ @ac_config_files@ nodist_octinclude_HEADERS += \ + oct-conf-post-public.h \ octave-config.h OCTAVE_INTERPRETER_TARGETS += \ @@ -458,17 +460,18 @@ if [ -n "`cat $(OCT_FILE_PKG_ADD_FILES)`" ]; then \ $(INSTALL_DATA) oct-file-pkg-add $(DESTDIR)$(octfiledir)/PKG_ADD; \ fi + top_build_dir=`pwd` && \ cd $(DESTDIR)$(octlibdir) && \ for ltlib in $(OCT_FILE_LIBS); do \ f=`echo $$ltlib | $(SED) 's,.*/,,'`; \ - dl=`$(SED) -n -e "s/dlname='\([^']*\)'/\1/p" < $$f`; \ + dl=`$(SED) -n -e "s/dlname='\([^']*\)'/\1/p" < $$top_build_dir/$$ltlib`; \ if [ -n "$$dl" ]; then \ $(INSTALL_PROGRAM) $$dl $(DESTDIR)$(octfiledir)/`echo $$f | $(SED) 's,^lib,,; s,\.la$$,.oct,'`; \ else \ echo "error: dlname is empty in $$ltlib!"; \ exit 1; \ fi; \ - lnames=`$(SED) -n -e "s/library_names='\([^']*\)'/\1/p" < $$f`; \ + lnames=`$(SED) -n -e "s/library_names='\([^']*\)'/\1/p" < $$top_build_dir/$$ltlib`; \ if [ -n "$$lnames" ]; then \ rm -f $$f $$lnames $$dl; \ fi \ diff -r 0a1aec50a0c8 -r 960909469245 bootstrap.conf --- a/bootstrap.conf Sun Apr 03 11:29:17 2022 -0400 +++ b/bootstrap.conf Sun Apr 03 11:30:26 2022 -0400 @@ -90,6 +90,7 @@ stat stddef stdio + strcase strdup-posix strerror strptime @@ -100,7 +101,6 @@ sys_times sys_wait tempname - tmpfile uname unicase/u8-tolower unicase/u8-toupper diff -r 0a1aec50a0c8 -r 960909469245 build-aux/mk-octave-config-h.sh --- a/build-aux/mk-octave-config-h.sh Sun Apr 03 11:29:17 2022 -0400 +++ b/build-aux/mk-octave-config-h.sh Sun Apr 03 11:30:26 2022 -0400 @@ -100,210 +100,22 @@ #define octave_octave_config_h 1 #if ! defined (OCTAVE_AUTOCONFIG_H_INCLUDED) - -# if defined (__cplusplus) -# include -# else -# include -# endif - -# define OCTAVE_NAMESPACE_BEGIN namespace octave { -# define OCTAVE_NAMESPACE_END } - -# if defined (__GNUC__) -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__ ("[" #ver "]: " msg))) -# else -# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__)) -# endif -# define OCTAVE_NORETURN __attribute__ ((__noreturn__)) -# define OCTAVE_UNUSED __attribute__ ((__unused__)) - -# define HAVE_OCTAVE_DEPRECATED_ATTR 1 -# define HAVE_OCTAVE_NORETURN_ATTR 1 -# define HAVE_OCTAVE_UNUSED_ATTR 1 -# else -# define OCTAVE_DEPRECATED(ver, msg) -# define OCTAVE_NORETURN -# define OCTAVE_UNUSED - -/* # undef HAVE_OCTAVE_DEPRECATED_ATTR */ -/* # undef HAVE_OCTAVE_NORETURN_ATTR */ -/* # undef HAVE_OCTAVE_UNUSED_ATTR */ -# endif - -# if defined (__MINGW32__) - /* MinGW requires special handling due to different format specifiers - * on different platforms. The macro __MINGW_PRINTF_FORMAT maps to - * either gnu_printf or ms_printf depending on where we are compiling - * to avoid warnings on format specifiers that are legal. - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=1331349 */ -# if defined (__cplusplus) -# include -# else -# include -# endif - -# define OCTAVE_FORMAT_PRINTF(stringIndex, firstToCheck) \ - __attribute__ ((format (__MINGW_PRINTF_FORMAT, stringIndex, firstToCheck))) - -# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 -# elif defined (__GNUC__) - /* The following attributes are used with gcc and clang compilers. */ -# define OCTAVE_FORMAT_PRINTF(index, first) \ - __attribute__ ((__format__(printf, index, first))) - -# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 -# else -# define OCTAVE_FORMAT_PRINTF(index, first) - -/* # undef HAVE_OCTAVE_FORMAT_PRINTF_ATTR */ -# endif - -# if ! defined (OCTAVE_FALLTHROUGH) -# if defined (__cplusplus) && __cplusplus > 201402L -# define OCTAVE_FALLTHROUGH [[fallthrough]] -# elif defined (__GNUC__) && __GNUC__ < 7 -# define OCTAVE_FALLTHROUGH ((void) 0) -# else -# define OCTAVE_FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -# endif - -# define OCTAVE_PROVIDE_DEPRECATED_SYMBOLS 1 - -# if defined (__cplusplus) -template -static inline void -octave_unused_parameter (const T&) -{ } -# else -# define octave_unused_parameter(param) (void) param; -# endif - -/* Defined to 1 if Octave libraries were built with visibility flags */ EOF -$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS.*$\)/# \1/p' $config_h_file - -cat << EOF - -# if defined (OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS) -# if defined (_WIN32) || defined (__CYGWIN__) -# if defined (__GNUC__) - /* GCC */ -# define OCTAVE_EXPORT __attribute__ ((dllexport)) -# define OCTAVE_IMPORT __attribute__ ((dllimport)) -# else - /* MSVC */ -# define OCTAVE_EXPORT __declspec(dllexport) -# define OCTAVE_IMPORT __declspec(dllimport) -# endif -# else - /* All other platforms. */ -# define OCTAVE_EXPORT __attribute__ ((visibility ("default"))) -# define OCTAVE_IMPORT -# endif -# else -# define OCTAVE_EXPORT -# define OCTAVE_IMPORT -# endif - -/* API macro for liboctave */ -#if defined (OCTAVE_DLL) -# define OCTAVE_API OCTAVE_EXPORT -#else -# define OCTAVE_API OCTAVE_IMPORT -#endif - -/* API macro for libinterp */ -#if defined (OCTINTERP_DLL) -# define OCTINTERP_API OCTAVE_EXPORT -#else -# define OCTINTERP_API OCTAVE_IMPORT -#endif - -/* API macro for the Array class in liboctave and liboctinterp */ -#if (defined (OCTAVE_DLL) || defined (OCTINTERP_DLL)) -# define OCTARRAY_API OCTAVE_EXPORT -#else -# define OCTARRAY_API OCTAVE_IMPORT -#endif - -/* API macro for libinterp/graphics */ -#if defined (OCTGRAPHICS_DLL) -# define OCTGRAPHICS_API OCTAVE_EXPORT -#else -# define OCTGRAPHICS_API OCTAVE_IMPORT -#endif - -/* API macro for libgui */ -#if defined (OCTGUI_DLL) -# define OCTGUI_API OCTAVE_EXPORT -#else -# define OCTGUI_API OCTAVE_IMPORT -#endif -EOF - -octave_idx_type="`$SED -n 's/#define OCTAVE_IDX_TYPE \([_a-zA-Z][_a-zA-Z0-9]*\)/\1/p' $config_h_file`" - -if test -z "$octave_idx_type"; then - echo "mk-octave-config-h.sh: failed to find OCTAVE_IDX_TYPE in $config_h_file" 1>&2 - exit 1 -fi - -octave_f77_int_type="`$SED -n 's/#define OCTAVE_F77_INT_TYPE \([_a-zA-Z][_a-zA-Z0-9]*\)/\1/p' $config_h_file`" - -if test -z "$octave_f77_int_type"; then - echo "mk-octave-config-h.sh: failed to find OCTAVE_F77_INT_TYPE in $config_h_file" 1>&2 - exit 1 -fi - -cat << EOF - -typedef $octave_idx_type octave_idx_type; -typedef $octave_f77_int_type octave_f77_int_type; - -# define OCTAVE_HAVE_F77_INT_TYPE 1 - -/* time type in API is always 64 bits wide */ -# define OCTAVE_TIME_T int64_t - -# if defined (__cplusplus) && ! defined (OCTAVE_THREAD_LOCAL) -# define OCTAVE_THREAD_LOCAL -# endif - -EOF - -if grep "#define OCTAVE_ENABLE_FLOAT_TRUNCATE 1" $config_h_file > /dev/null; then - echo "# define OCTAVE_FLOAT_TRUNCATE volatile" -else - echo "# define OCTAVE_FLOAT_TRUNCATE" -fi - -echo "" - $SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_64.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_BOUNDS_CHECK.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_FLOAT_TRUNCATE.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_OPENMP.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_F77_INT_TYPE.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_LONG_LONG_INT.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT.*$\)/# \1/p' $config_h_file -$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR.*$\)/# \1/p' $config_h_file -$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES.*$\)/# \1/p' $config_h_file +$SED -n 's/#\(\(undef\|define\) OCTAVE_IDX_TYPE.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_SIZEOF_F77_INT_TYPE.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_SIZEOF_IDX_TYPE.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) OCTAVE_SIZEOF_INT.*$\)/# \1/p' $config_h_file - -cat << EOF - -# if defined (OCTAVE_ENABLE_64) -# define OCTAVE_IDX_TYPE_FORMAT PRId64 -# else -# define OCTAVE_IDX_TYPE_FORMAT PRId32 -# endif - -EOF - $SED -n 's/#\(\(undef\|define\) gid_t.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) uid_t.*$\)/# \1/p' $config_h_file $SED -n 's/#\(\(undef\|define\) nlink_t.*$\)/# \1/p' $config_h_file @@ -372,6 +184,14 @@ cat << EOF +/* Enable inline functions or typedefs that provide access to + symbols that have been moved to the octave namespace so that + users of Octave may continue to access symbols using the + deprecated names. */ +# define OCTAVE_PROVIDE_DEPRECATED_SYMBOLS 1 + +# include "oct-conf-post-public.h" + #endif #endif diff -r 0a1aec50a0c8 -r 960909469245 build-aux/module.mk --- a/build-aux/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/build-aux/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -27,7 +27,8 @@ $(AM_V_GEN)$(SHELL) config.status $@-tmp $@ GEN_CONFIG_INC = \ - oct-conf-post.h + oct-conf-post-private.h \ + oct-conf-post-public.h $(GEN_CONFIG_INC) : %.h : %.in.h config.status $(AM_V_GEN)$(SHELL) config.status $@-tmp $@ diff -r 0a1aec50a0c8 -r 960909469245 configure.ac --- a/configure.ac Sun Apr 03 11:29:17 2022 -0400 +++ b/configure.ac Sun Apr 03 11:30:26 2022 -0400 @@ -27,7 +27,7 @@ ### Initialize Autoconf AC_PREREQ([2.65]) -AC_INIT([GNU Octave], [7.0.93], [https://octave.org/bugs.html], [octave], +AC_INIT([GNU Octave], [8.0.0], [https://octave.org/bugs.html], [octave], [https://www.gnu.org/software/octave/]) ### Declare version numbers @@ -39,9 +39,9 @@ ## explains how to update these numbers for release and development ## versions. -OCTAVE_MAJOR_VERSION=7 +OCTAVE_MAJOR_VERSION=8 OCTAVE_MINOR_VERSION=0 -OCTAVE_PATCH_VERSION=93 +OCTAVE_PATCH_VERSION=0 dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument. OCTAVE_VERSION="$PACKAGE_VERSION" @@ -63,7 +63,7 @@ dnl FIXME: Since we also set libtool versions for liboctave and libinterp, dnl perhaps we should be computing the "api version" from those versions numbers dnl in some way instead of setting it independently here. -OCTAVE_API_VERSION="api-v57" +OCTAVE_API_VERSION="api-v57+" AC_SUBST(OCTAVE_MAJOR_VERSION) AC_SUBST(OCTAVE_MINOR_VERSION) @@ -2281,7 +2281,7 @@ LIBS="$save_LIBS" fi -dnl Define this way instead of with an #if in oct-conf-post.h so that +dnl Define this way instead of with an #if in oct-conf-post-private.h so that dnl the build features script will get the correct value. dnl dnl The test on the sunlinsol_klu.h header is a bit of a kluge. @@ -2670,10 +2670,10 @@ ### Determine whether libraries should be linked with visibility attributes -ENABLE_LIB_VISIBILITY_FLAGS=no +ENABLE_LIB_VISIBILITY_FLAGS=yes AC_ARG_ENABLE(lib-visibility-flags, - [AS_HELP_STRING([--enable-lib-visibility-flags], - [Build libraries with visibility flags (don't export all symbols). This feature is experimental and should only be used for testing.])], + [AS_HELP_STRING([--disable-lib-visibility-flags], + [don't build libraries with visibility flags (export all symbols)])], [case $enableval in yes) ENABLE_LIB_VISIBILITY_FLAGS=yes ;; no) ENABLE_LIB_VISIBILITY_FLAGS=no ;; @@ -3006,7 +3006,8 @@ ### Add footer to config.h -AH_BOTTOM([#include "oct-conf-post.h"]) +AH_BOTTOM([#include "oct-conf-post-private.h"]) +AH_BOTTOM([#include "oct-conf-post-public.h"]) ### Make all AC_DEFINES available to testif feature of test.m function. dnl This must reside at the bottom of configure.ac after all AC_DEFINES @@ -3104,12 +3105,19 @@ liboctave/octave.pc:liboctave/octave.in.pc libinterp/octinterp.pc:libinterp/octinterp.in.pc]) -dnl We use a .in.h file for oct-conf-post.h simply to copy it to the build tree +dnl We use a .in.h file for oct-conf-post-private.h and +dnl oct-conf-post-public.h simply to copy it to the build tree dnl so that we don't have to add the -I${top_srcdir} to any CPPFLAGS variables. -AC_CONFIG_FILES([oct-conf-post.h-tmp:oct-conf-post.in.h]) -AC_CONFIG_COMMANDS([oct-conf-post.h], - [$SHELL $srcdir/build-aux/move-if-change oct-conf-post.h-tmp oct-conf-post.h]) +AC_CONFIG_FILES([ + oct-conf-post-private.h-tmp:oct-conf-post-private.in.h + oct-conf-post-public.h-tmp:oct-conf-post-public.in.h]) + +AC_CONFIG_COMMANDS([oct-conf-post-private.h], + [$SHELL $srcdir/build-aux/move-if-change oct-conf-post-private.h-tmp oct-conf-post-private.h]) + +AC_CONFIG_COMMANDS([oct-conf-post-public.h], + [$SHELL $srcdir/build-aux/move-if-change oct-conf-post-public.h-tmp oct-conf-post-public.h]) OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES([ liboctave/external/mk-f77-def.sh diff -r 0a1aec50a0c8 -r 960909469245 doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Sun Apr 03 11:29:17 2022 -0400 +++ b/doc/interpreter/contributors.in Sun Apr 03 11:30:26 2022 -0400 @@ -34,6 +34,7 @@ David Billinghurst Don Bindner Jakub Bogusz +Gaël Bonithon Moritz Borgmann Paul Boven Richard Bovey @@ -404,7 +405,8 @@ Ariel Tankus Falk Tannhäuser Duncan Temple Lang -Matthew Tenny +Matthew Tennyhg +Remi Thebault Kris Thielemans Georg Thimm Paul Thomas diff -r 0a1aec50a0c8 -r 960909469245 doc/interpreter/genpropdoc.m --- a/doc/interpreter/genpropdoc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/doc/interpreter/genpropdoc.m Sun Apr 03 11:30:26 2022 -0400 @@ -930,6 +930,15 @@ for the x-axis. __modemsg__. @xref{XREFxlim, , @w{xlim function}}."; s.valid = valid_2elvec; + case "xlimitmethod" + s.doc = "Method used to determine the x axis limits when the \ +@code{xlimmode} property is @qcode{\"auto\"}. The default value, \ +@qcode{\"tickaligned\"} makes limits align with the closest ticks. With \ +value @qcode{\"tight\"} the limits are adjusted to enclose all the graphics \ +objects in the axes, while with value @qcode{\"padded\"}, an additionnal \ +margin of about 7%% of the data extent is added around the objects. \ +@xref{XREFaxis, , @w{axis function}}."; + case "xlimmode" case "xminorgrid" s.doc = "Control whether minor x grid lines are displayed."; @@ -975,6 +984,15 @@ for the y-axis. __modemsg__. @xref{XREFylim, , @w{ylim function}}."; s.valid = valid_2elvec; + case "ylimitmethod" + s.doc = "Method used to determine the y axis limits when the \ +@code{xlimmode} property is @qcode{\"auto\"}. The default value, \ +@qcode{\"tickaligned\"} makes limits align with the closest ticks. With \ +value @qcode{\"tight\"} the limits are adjusted to enclose all the graphics \ +objects in the axes, while with value @qcode{\"padded\"}, an additionnal \ +margin of about 7%% of the data extent is added around the objects. \ +@xref{XREFaxis, , @w{axis function}}."; + case "ylimmode" case "yminorgrid" s.doc = "Control whether minor y grid lines are displayed."; @@ -1013,6 +1031,15 @@ for the z-axis. __modemsg__. @xref{XREFzlim, , @w{zlim function}}."; s.valid = valid_2elvec; + case "zlimitmethod" + s.doc = "Method used to determine the z axis limits when the \ +@code{xlimmode} property is @qcode{\"auto\"}. The default value, \ +@qcode{\"tickaligned\"} makes limits align with the closest ticks. With \ +value @qcode{\"tight\"} the limits are adjusted to enclose all the graphics \ +objects in the axes, while with value @qcode{\"padded\"}, an additionnal \ +margin of about 7%% of the data extent is added around the objects. \ +@xref{XREFaxis, , @w{axis function}}."; + case "zlimmode" case "zminorgrid" s.doc = "Control whether minor z grid lines are displayed."; @@ -1064,6 +1091,29 @@ before rendering.\n\ @xref{XREFinterpreterusage, , @w{Use of the interpreter property}}."; + case "itemhitfcn" + s.doc = "Callback function which is executed when a legend item \ +is clicked. @xref{Callbacks, , @w{Callbacks section}}.\n\ +\n\ +The callback function must have the following prototype \ +@code{fcn (hlegend, evnt)}, where @code{hlegend} is the legend object handle \ +and @code{evnt} is a structure with the following fields:\n\ +@table @code\n\ +@item Peer\n\ +Handle of the plot object to which the clicked item is associated.\n\ +@item Region\n\ +May be @qcode{\"icon\"} or @qcode{\"label\"} depending on which part of \ +the item is clicked.\n\ +@item SelectionType\n\ +One of @qcode{\"normal\"}, @qcode{\"extend\"}, @qcode{\"open\"}, or \ +@qcode{\"alt\"}. \ +@xref{XREFfigureselectiontype, , @w{Figure @qcode{\"selectiontype\"}}}.\n\ +@item Source\n\ +Handle of the legend object.\n\ +@item EventName\n\ +Name is @qcode{\"ItemHit\"}.\n\ +@end table"; + case "location" s.doc = "Control the location of the legend."; @@ -2077,8 +2127,8 @@ if (isempty (props)) props = {"autoupdate", "box", "color", "edgecolor", "fontangle", ... "fontname", "fontsize", "fontunits", "fontweight", ... - "location", "numcolumns", "orientation", "position", ... - "string", "textcolor", "title", "units"}; + "itemhitfcn", "location", "numcolumns", "orientation", ... + "position", "string", "textcolor", "title", "units"}; endif elseif (strcmp (objname, "scatter")) ## Make sure to get a scatter object independent of graphics toolkit diff -r 0a1aec50a0c8 -r 960909469245 doc/interpreter/matrix.txi --- a/doc/interpreter/matrix.txi Sun Apr 03 11:29:17 2022 -0400 +++ b/doc/interpreter/matrix.txi Sun Apr 03 11:30:26 2022 -0400 @@ -112,8 +112,6 @@ @DOCSTRING(circshift) -@DOCSTRING(shift) - @DOCSTRING(shiftdim) @DOCSTRING(sort) diff -r 0a1aec50a0c8 -r 960909469245 doc/interpreter/mk-doc-cache.pl --- a/doc/interpreter/mk-doc-cache.pl Sun Apr 03 11:29:17 2022 -0400 +++ b/doc/interpreter/mk-doc-cache.pl Sun Apr 03 11:30:26 2022 -0400 @@ -34,25 +34,22 @@ use File::Temp; my $doc_delim = "\x{1d}"; -my $tex_delim_pat = qr/\Q-*- texinfo -*-\E/; +my $tex_delim_ptn = qr/\Q-*- texinfo -*-\E/; -## Returns a File::Temp object with texinfo code. +## Returns a File::Temp object with Texinfo code. sub make_texinfo_file { my $srcdir = shift; my $macro_fpath = shift; my @docstrings = @_; - my $t_file = File::Temp->new (UNLINK => 1); + my $tmpfile = File::Temp->new (UNLINK => 1); ## Only the first file is the macro file. Copy its contents verbatim. - open (my $macro_fh, "<", $macro_fpath) + open (my $FH_macro, "<", $macro_fpath) or die "Unable to open $macro_fpath for reading: $!\n"; - while (<$macro_fh>) - { - print {$t_file} $_; - } - close ($macro_fh); + while (<$FH_macro>) { print {$tmpfile} $_; } + close ($FH_macro); foreach my $filepath (@docstrings) { @@ -64,35 +61,44 @@ ## tree, from released sources. $filepath = File::Spec->catfile ($srcdir, $filepath); } - open (my $fh, "<", $filepath) + open (my $FH, "<", $filepath) or die "Unable to open $filepath for reading: $!\n"; my $in_header = 1; - while (my $line = <$fh>) + while (my $line = <$FH>) { ## DOCSTRINGS header ends once we find the first function. if ($in_header && $line =~ m/^$doc_delim/) { $in_header = 0; } - next if $in_header; - next if $line =~ /$tex_delim_pat/; + next if ($in_header); + next if ($line =~ /$tex_delim_ptn/); - $line =~ s/\@seealso/\@xseealso/g; + ## Change @seealso to private @xseealso macro + if ($line =~ m'@seealso') + { + ## Combine @seealso macro spread over multiple lines + while ($line !~ m/}$/) { $line .= <$FH>; } - ## escape {}@ characters for texinfo - $line =~ s/([{}\@])/\@$1/g - if $line =~ m/^$doc_delim/; + ## escape @ characters in old-style class names like @ftp + $line =~ s/\@(\w)/\@\@$1/g; + $line =~ s'@@seealso'@xseealso'; + } - print {$t_file} $line; + ## escape {}@ characters in Texinfo anchor name (e.g., @ftp/dir.m) + $line =~ s/([{}@])/\@$1/g if ($line =~ m/^$doc_delim/); + + print {$tmpfile} $line; } - close ($fh); + close ($FH); } - print {$t_file} $doc_delim; + print {$tmpfile} $doc_delim; - $t_file->flush (); - return $t_file; + $tmpfile->flush (); + + return $tmpfile; } sub get_info_text @@ -106,7 +112,7 @@ if (! defined $info_text); die "makeinfo produced no output!" - if ! $info_text; + if (! $info_text); return $info_text; } @@ -117,7 +123,7 @@ ## Constant patterns. We only check for two underscores at the end, ## and not at the start, to also skip @class/__method__ - my $private_name_pat = qr/__$/; + my $private_name_ptn = qr/__$/; my @formatted = (); @@ -135,7 +141,7 @@ my ($symbol, $doc) = split (/[\r\n]/, $block, 2); - next if (length ($symbol) > 2 && $symbol =~ m/$private_name_pat/); + next if (length ($symbol) > 2 && $symbol =~ m/$private_name_ptn/); if (! defined ($doc)) { @@ -156,6 +162,7 @@ push (@formatted, [($symbol, $doc, $first_sentence)]); } + return @formatted; } @@ -164,22 +171,26 @@ my ($str) = @_; my $len = length ($str); - print "# name: \n"; - print "# type: sq_string\n"; - print "# elements: 1\n"; - print "# length: $len\n"; - print "$str\n\n\n"; + print <<__END_OF_ELEMENT__; +# name: +# type: sq_string +# elements: 1 +# length: $len +$str\n\n +__END_OF_ELEMENT__ } sub print_cache { my $num = @_; - print "# created by mk-doc-cache.pl\n"; - print "# name: cache\n"; - print "# type: cell\n"; - print "# rows: 3\n"; - print "# columns: $num\n"; + print <<__END_OF_CACHE_HDR__; +# created by mk-doc-cache.pl +# name: cache +# type: cell +# rows: 3 +# columns: $num +__END_OF_CACHE_HDR__ foreach my $elt (@_) { @@ -194,6 +205,8 @@ } } +## FIXME: This is a very C/C++ way of coding things. +## Perl convention would just be to have the executable code at end of file. sub main { my $srcdir = shift; diff -r 0a1aec50a0c8 -r 960909469245 doc/interpreter/sparse.txi --- a/doc/interpreter/sparse.txi Sun Apr 03 11:29:17 2022 -0400 +++ b/doc/interpreter/sparse.txi Sun Apr 03 11:30:26 2022 -0400 @@ -530,13 +530,6 @@ @noindent returns a full matrix as can be seen. - -Additionally, if @code{sparse_auto_mutate} is true, all sparse functions -test the amount of memory occupied by the sparse matrix to see if the -amount of storage used is larger than the amount used by the full -equivalent. Therefore @code{speye (2) * 1} will return a full matrix as -the memory used is smaller for the full version than the sparse version. - As all of the mixed operators and functions between full and sparse matrices exist, in general this does not cause any problems. However, one area where it does cause a problem is where a sparse matrix is @@ -561,11 +554,6 @@ always returns a sparse matrix, even if the memory used will be larger than its full representation. -@DOCSTRING(sparse_auto_mutate) - -Note that the @code{sparse_auto_mutate} option is incompatible with -@sc{matlab}, and so it is off by default. - @node Mathematical Considerations @subsubsection Mathematical Considerations diff -r 0a1aec50a0c8 -r 960909469245 etc/HACKING.md --- a/etc/HACKING.md Sun Apr 03 11:29:17 2022 -0400 +++ b/etc/HACKING.md Sun Apr 03 11:30:26 2022 -0400 @@ -399,6 +399,80 @@ These guidelines also appear in the GNU libtool manual, see https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html. +Merging the default branch to stable before a release +----------------------------------------------------- + +To merge default to stable for a release with version == MAJOR: + +NOTE, I use two separate repos, one in `/path/to/octave-stable` that is +updated to the stable branch and one in `/path/to/octave-default` that +is updated to the default branch. + +1. Update the repo in `/path/to/octave-stable` to the most recent change + on the stable branch. Ensure that there are no pending changes (be + careful to avoid wiping out any changes you are currently working + on!): + + cd /path/to/octave-stable + hg update -C stable + +2. Merge default to stable (there should never be any conflicts here; + you are just making the stable branch be whatever is on the current + default branch): + + hg merge default + +3. Commit the change (replace VERSION with the correct version; it + should be of the form MAJOR.1.0): + + hg commit -m "maint: Merge default to stable to begin VERSION release process." + +4. Bump version numbers and release date in `configure.ac` for pre-release: + + * Set version in AC_INIT to MAJOR.0.1 + * OCTAVE_MAJOR_VERSION should already be correct. + * Set OCTAVE_MINOR_VERSION to 0. + * Set OCTAVE_PATCH_VERSION to 1. + * Set OCTAVE_RELEASE_DATE to the current date. + * Set the year in OCTAVE_COPYRIGHT to the current year. The + copyright dates in the source files should have already been + updated during the development cycle. If not, that should be done + in a separate change before the merge. + * OCTAVE_API_VERSION and shared library version numbers may be + updated in a separate changeset just prior to creating the first + test release. + + hg commit ## Use commit message similar to the one in 8f8fab4c93ae + +5. Update the repo in `/path/to/octave-default` to the most recent change + on the default branch. Ensure that there are no pending changes (be + careful to avoid wiping out any changes you are currently working + on!): + + cd /path/to/octave-default + hg update -C default + +6. Merge stable back to default (there should not be conflicts in this + merge): + + hg merge stable + hg commit -m "maint: Merge stable to default." + +7. Bump versions in `configure.ac` to begin active development of MAJOR+1: + + * Set version in AC_INIT to MAJOR+1.0.0 + * Set OCTAVE_MAJOR_VERSION to MAJOR+1 + * Set OCTAVE_MINOR_VERSION to 0 + * Set OCTAVE_PATCH_VERSION to 0 + + hg commit ## Use commit message similar to the one in 1455418a5c4c + +8. Remove functions and properties deprecated in MAJOR-1 (see ecf207896f76, + for example) + +9. Update NEWS file for next development cycle (see 0ec5eaabaf2c, for + example). + ################################################################################ diff -r 0a1aec50a0c8 -r 960909469245 etc/NEWS.7.md diff -r 0a1aec50a0c8 -r 960909469245 etc/NEWS.8.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/NEWS.8.md Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,69 @@ +Summary of important user-visible changes for version 8 (yyyy-mm-dd): +--------------------------------------------------------------------- + +### General improvements + +- Octave's libraries are now built using symbol visibility by default. +That means that less symbols are exported from these libraries. +Configure with `--disable-lib-visibility-flags` to export all symbols +(as in previous versions). + + +### Graphical User Interface + + +### Graphics backend + + +### Matlab compatibility + +- `cylinder` now accepts a scalar for the radius argument. + +- `clock` now has an optional second output `ISDST` which indicates if + Daylight Savings Time is in effect for the system's time zone. + +### Alphabetical list of new functions added in Octave 8 + + +### Deprecated functions, properties, and operators + +The following functions and properties have been deprecated in Octave 8 +and will be removed from Octave 10 (or whatever version is the second +major release after 8): + +- Functions + + Function | Replacement + -----------------------|------------------ + `shift` | `circshift` + `sparse_auto_mutate` | none (see below) + +- The `sparse_auto_mutate` function no longer has any effect on Octave's + behavior. Previously, after calling `sparse_auto_mutate (true)`, + Octave would automatically convert sparse matrices to full when a + sparse matrix required more memory than simply using full matrix + storage. This setting was `false` by default for compatibility with + Matlab. Now you must manually convert to full storage when desired. + +The following functions were deprecated in Octave 6 and have been removed +from Octave 8. + +- Functions + + Function | Replacement + -----------------------|------------------ + `runtests` | `oruntests` + +- The environment variable used by `mkoctfile` for linker flags is now + `LDFLAGS` rather than `LFLAGS`. `LFLAGS` was deprecated in Octave 6, + and will be removed in a future version of Octave. + +### Old release news + +- [Octave 7.x](etc/NEWS.7) +- [Octave 6.x](etc/NEWS.6) +- [Octave 5.x](etc/NEWS.5) +- [Octave 4.x](etc/NEWS.4) +- [Octave 3.x](etc/NEWS.3) +- [Octave 2.x](etc/NEWS.2) +- [Octave 1.x](etc/NEWS.1) diff -r 0a1aec50a0c8 -r 960909469245 etc/module.mk --- a/etc/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/etc/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -12,6 +12,7 @@ %reldir%/NEWS.5.md \ %reldir%/NEWS.6.md \ %reldir%/NEWS.7.md \ + %reldir%/NEWS.8.md \ %reldir%/gdbinit %canon_reldir%_EXTRA_DIST += \ diff -r 0a1aec50a0c8 -r 960909469245 libgui/graphics/FigureWindow.cc --- a/libgui/graphics/FigureWindow.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/graphics/FigureWindow.cc Sun Apr 03 11:30:26 2022 -0400 @@ -30,6 +30,7 @@ #include #include "FigureWindow.h" +#include "gui-preferences-global.h" namespace octave { @@ -38,7 +39,7 @@ : FigureWindowBase (xparent) { // set icon from application resources - setWindowIcon (QIcon (":/actions/icons/graphic_logo_Figure.png")); + setWindowIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE))); } FigureWindow::~FigureWindow (void) diff -r 0a1aec50a0c8 -r 960909469245 libgui/graphics/ToolBarButton.cc --- a/libgui/graphics/ToolBarButton.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/graphics/ToolBarButton.cc Sun Apr 03 11:30:26 2022 -0400 @@ -29,11 +29,13 @@ #include #include +#include #include #include "ToolBarButton.h" #include "QtHandlesUtils.h" #include "octave-qobject.h" +#include "gui-preferences-global.h" namespace octave { @@ -155,9 +157,7 @@ template QIcon ToolBarButton::get_icon (const std::string& name) { - octave::resource_manager& rmgr = m_octave_qobj.get_resource_manager (); - - return rmgr.icon (QString::fromStdString (name)); + return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + QString::fromStdString (name) + ".png"); } } diff -r 0a1aec50a0c8 -r 960909469245 libgui/qterminal/libqterminal/unix/kpty.cpp --- a/libgui/qterminal/libqterminal/unix/kpty.cpp Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/qterminal/libqterminal/unix/kpty.cpp Sun Apr 03 11:30:26 2022 -0400 @@ -294,8 +294,8 @@ { for (const char* s4 = "0123456789abcdef"; *s4; s4++) { - ptyName = QString().sprintf("/dev/pty%c%c", *s3, *s4).toAscii(); - d->ttyName = QString().sprintf("/dev/tty%c%c", *s3, *s4).toAscii(); + ptyName = QString().sprintf("/dev/pty%c%c", *s3, *s4).toLatin1(); + d->ttyName = QString().sprintf("/dev/tty%c%c", *s3, *s4).toLatin1(); d->masterFd = ::open(ptyName.data(), O_RDWR); if (d->masterFd >= 0) diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/community-news.cc --- a/libgui/src/community-news.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/community-news.cc Sun Apr 03 11:30:26 2022 -0400 @@ -27,12 +27,12 @@ # include "config.h" #endif -#include #include #include #include #include "community-news.h" +#include "gui-utils.h" #include "gui-preferences-nr.h" #include "news-reader.h" #include "octave-qobject.h" @@ -130,14 +130,4 @@ activateWindow (); } - // FIXME: This function is duplicated in main_window.cc. Maybe it - // should be a utility function? - - void community_news::get_screen_geometry (int& width, int& height) - { - QRect screen_geometry = QApplication::desktop ()->availableGeometry (this); - - width = screen_geometry.width (); - height = screen_geometry.height (); - } } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/community-news.h --- a/libgui/src/community-news.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/community-news.h Sun Apr 03 11:30:26 2022 -0400 @@ -61,8 +61,6 @@ void construct (base_qobject& oct_qobj, const QString& base_url, const QString& page, int serial); - void get_screen_geometry (int& width, int& height); - QTextBrowser *m_browser; }; } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/documentation.cc --- a/libgui/src/documentation.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/documentation.cc Sun Apr 03 11:30:26 2022 -0400 @@ -417,13 +417,13 @@ // Zoom m_tool_bar->addSeparator (); m_action_zoom_in - = add_action (rmgr.icon ("zoom-in"), tr ("Zoom in"), + = add_action (rmgr.icon ("view-zoom-in"), tr ("Zoom in"), SLOT (zoom_in (void)), m_doc_browser, m_tool_bar); m_action_zoom_out - = add_action (rmgr.icon ("zoom-out"), tr ("Zoom out"), + = add_action (rmgr.icon ("view-zoom-out"), tr ("Zoom out"), SLOT (zoom_out (void)), m_doc_browser, m_tool_bar); m_action_zoom_original - = add_action (rmgr.icon ("zoom-original"), tr ("Zoom original"), + = add_action (rmgr.icon ("view-zoom-original"), tr ("Zoom original"), SLOT (zoom_original (void)), m_doc_browser, m_tool_bar); // Bookmarks (connect slots later) diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/files-dock-widget.cc Sun Apr 03 11:30:26 2022 -0400 @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include @@ -70,6 +72,113 @@ } }; + // to have file renamed in the file tree, it has to be renamed in + // QFileSystemModel::setData. + // For the editor to behave correctly, some signals must be sent before + // and after the rename + class file_system_model : public QFileSystemModel + { + public: + file_system_model (files_dock_widget *p) : QFileSystemModel (p) {} + + ~file_system_model () = default; + + bool setData (const QModelIndex &idx, const QVariant &value, + int role) override + { + if (!idx.isValid () || idx.column () != 0 || role != Qt::EditRole + || (flags (idx) & Qt::ItemIsEditable) == 0) + { + return false; + } + + QString new_name = value.toString (); + QString old_name = idx.data ().toString (); + if (new_name == old_name) + return true; + if (new_name.isEmpty () + || QDir::toNativeSeparators (new_name).contains (QDir::separator ())) + { + display_rename_failed_message (old_name, new_name); + return false; + } + + auto parent_dir = QDir(filePath (parent (idx))); + + files_dock_widget *fdw = static_cast(parent()); + + + fdw->file_remove_signal(parent_dir.filePath(old_name), parent_dir.filePath(new_name)); + + if (!parent_dir.rename (old_name, new_name)) + { + display_rename_failed_message (old_name, new_name); + fdw->file_renamed_signal(false); + return false; + } + + fdw->file_renamed_signal(true); + + emit fileRenamed(parent_dir.absolutePath(), old_name, new_name); + revert(); + + return true; + } + + private: + void display_rename_failed_message (const QString &old_name, + const QString &new_name) + { + const QString message = + + files_dock_widget::tr ("Could not rename file \"%1\" to \"%2\".") + .arg (old_name) + .arg (new_name); + QMessageBox::information (static_cast (parent ()), + QFileSystemModel::tr ("Invalid filename"), + message, QMessageBox::Ok); + } + }; + + // Delegate to improve ergonomy of file renaming by pre-selecting the text + // before the extension. + class RenameItemDelegate : public QStyledItemDelegate + { + public: + RenameItemDelegate (QObject *parent = nullptr) + : QStyledItemDelegate{ parent } + { + } + + void setEditorData (QWidget *editor, + const QModelIndex &index) const override + { + QLineEdit *line_edit = qobject_cast (editor); + + if (!line_edit) + { + QStyledItemDelegate::setEditorData (editor, index); + return; + } + + QString filename = index.data (Qt::EditRole).toString (); + + int select_len = filename.indexOf (QChar ('.')); + if (select_len == -1) + select_len = filename.size (); + + line_edit->setText (filename); + + // Qt calls QLineEdit::selectAll after this function is called, so to + // actually restrict the selection, we have to post the modification at + // the end of the event loop. + // QTimer allows this easily with 0 as timeout. + QTimer::singleShot (0, [=] () { + line_edit->setSelection (0, select_len); + }); + } + }; + files_dock_widget::files_dock_widget (QWidget *p, base_qobject& oct_qobj) : octave_dock_widget ("FilesDockWidget", p, oct_qobj) { @@ -121,7 +230,7 @@ resource_manager& rmgr = m_octave_qobj.get_resource_manager (); QAction *directory_up_action - = new QAction (rmgr.icon ("go-up"), "", m_navigation_tool_bar); + = new QAction (rmgr.icon ("folder-up", false, "go-up"), "", m_navigation_tool_bar); directory_up_action->setToolTip (tr ("One directory up")); m_sync_browser_directory_action @@ -146,8 +255,9 @@ popdown_menu->addAction (m_sync_octave_directory_action); popdown_button->setMenu (popdown_menu); popdown_button->setPopupMode (QToolButton::InstantPopup); - popdown_button->setDefaultAction (new QAction (rmgr.icon ("applications-system"), - "", m_navigation_tool_bar)); + popdown_button->setDefaultAction ( + new QAction (rmgr.icon ("folder-settings", false, "applications-system"), + "", m_navigation_tool_bar)); popdown_menu->addSeparator (); popdown_menu->addAction (rmgr.icon ("folder"), @@ -202,7 +312,7 @@ startup_dir = QDir (); } - m_file_system_model = new QFileSystemModel (this); + m_file_system_model = new file_system_model (this); m_file_system_model->setResolveSymlinks (false); m_file_system_model->setFilter ( QDir::System | QDir::NoDotAndDotDot | QDir::AllEntries); @@ -219,6 +329,24 @@ m_file_tree_view->setAnimated (true); m_file_tree_view->setToolTip (tr ("Double-click to open file/folder, right click for alternatives")); + // allow renaming directly in the tree view with + // m_file_tree_view->edit(index) + m_file_system_model->setReadOnly (false); + // delegate to improve rename ergonomy by pre-selecting text up to the + // extension + auto *rename_delegate = new RenameItemDelegate (this); + m_file_tree_view->setItemDelegateForColumn (0, rename_delegate); + // prevent the tree view to override Octave's double-click behavior + m_file_tree_view->setEditTriggers (QAbstractItemView::NoEditTriggers); + // create the rename action (that will be added to context menu) + // and associate to F2 key shortcut + m_rename_action = new QAction (tr ("Rename..."), this); + m_rename_action->setShortcut (Qt::Key_F2); + m_rename_action->setShortcutContext(Qt::WidgetWithChildrenShortcut); + connect (m_rename_action, &QAction::triggered, this, + &files_dock_widget::contextmenu_rename); + addAction(m_rename_action); + // get sort column and order as well as column state (order and width) m_file_tree_view->sortByColumn @@ -582,8 +710,7 @@ } menu.addSeparator (); - menu.addAction (tr ("Rename..."), - this, &files_dock_widget::contextmenu_rename); + menu.addAction (m_rename_action); menu.addAction (rmgr.icon ("edit-delete"), tr ("Delete..."), this, &files_dock_widget::contextmenu_delete); @@ -694,37 +821,8 @@ if (rows.size () > 0) { QModelIndex index = rows[0]; - - QFileInfo info = m_file_system_model->fileInfo (index); - QDir path = info.absoluteDir (); - QString old_name = info.fileName (); - bool ok; - - QString new_name - = QInputDialog::getText (this, tr ("Rename file/directory"), - tr ("Rename file/directory:\n") - + old_name + tr ("\n to: "), - QLineEdit::Normal, old_name, &ok); - if (ok && new_name.length () > 0) - { - new_name = path.absolutePath () + '/' + new_name; - old_name = path.absolutePath () + '/' + old_name; - // editor: close old - emit file_remove_signal (old_name, new_name); - // Do the renaming - QFile f (old_name); // Must use QFile, not QDir (bug #56298) - bool st = f.rename (new_name); - if (! st) - QMessageBox::warning (this, tr ("Rename error"), - tr ("Could not rename file \"%1\" to \"%2\"."). - arg (old_name).arg (new_name)); - // editor: load new/old file depending on success - emit file_renamed_signal (st); - // Clear cache of file browser - m_file_system_model->revert (); - } + m_file_tree_view->edit(index); } - } void files_dock_widget::contextmenu_delete (bool) @@ -791,8 +889,8 @@ tr ("Could not delete file \"%1\"."). arg (info.filePath ())); // Reload the old file - emit file_renamed_signal (false); } + emit file_renamed_signal (st); } m_file_system_model->revert (); diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/files-dock-widget.h --- a/libgui/src/files-dock-widget.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/files-dock-widget.h Sun Apr 03 11:30:26 2022 -0400 @@ -207,6 +207,7 @@ QToolBar *m_navigation_tool_bar; QAction *m_sync_octave_directory_action; QAction *m_sync_browser_directory_action; + QAction *m_rename_action; //! The file system model. diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/gui-preferences-global.h --- a/libgui/src/gui-preferences-global.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/gui-preferences-global.h Sun Apr 03 11:30:26 2022 -0400 @@ -84,7 +84,35 @@ const gui_pref global_icon_theme ("use_system_icon_theme", QVariant (true)); -// Other +enum +{ + ICON_THEME_SYSTEM = 0, + ICON_THEME_OCTAVE, + ICON_THEME_TANGO, + ICON_THEME_CURSORS +} ; + +const QStringList +global_icon_paths (QStringList () + << "" + << ":/icons/octave/128x128/" + << ":/icons/tango/128x128/" + << ":/icons/cursors/" + ); + +const gui_pref +global_icon_theme_index ("icon_theme", QVariant (ICON_THEME_SYSTEM)); +const QStringList +global_all_icon_themes (QStringList () + << "" + << "octave" + << "tango" + << "cursors"); +const QStringList +global_all_icon_theme_names (QStringList () + << "System" + << "Octave" + << "Tango"); const gui_pref global_status_bar ("show_status_bar", QVariant (true)); diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/gui-utils.cc --- a/libgui/src/gui-utils.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/gui-utils.cc Sun Apr 03 11:30:26 2022 -0400 @@ -27,6 +27,10 @@ # include "config.h" #endif +#include +#include +#include + #include "gui-utils.h" namespace octave @@ -42,4 +46,80 @@ return QColor::fromHsvF (h1, s1*fs, v1 + fv*(v2 - v1)); } + + OCTGUI_API void + get_screen_geometry (int& width, int& height) + { + QRect geom = QGuiApplication::primaryScreen ()->availableGeometry (); + + width = geom.width (); + height = geom.height (); + } + + + OCTGUI_API void + adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry) + { + + // Get the screen that holds the largest part of the given actual geometry + + const QScreen *actual_screen = nullptr; // no screen found yet + QRect actual_screen_geom = QRect (); // geometry of found screen + int intersected_area_max = 0; // max. intersected area + + const int area_actual_geometry + = actual_geometry.width () * actual_geometry.height (); + QRect intersection; + + foreach (const QScreen *screen, QGuiApplication::screens()) + { + QRect screen_geom = screen->availableGeometry (); + intersection = screen_geom.intersected (actual_geometry); + if (! intersection.isEmpty ()) + { + int area = intersection.width () * intersection.height (); + if (area > intersected_area_max) + { + actual_screen = screen; + actual_screen_geom = screen->availableGeometry (); + if (area == area_actual_geometry) + return; // Actual geom is completely on a screen: return + intersected_area_max = area; + } + } + } + + // If the actual geometry is on no screen, use deault geometry + + if (actual_screen == nullptr) + { + actual_geometry = default_geometry; + return; + } + + // There is a screen that holds a part of the actual geometry. + // Now adjust actual geometry to this screen + + // Get some properties of the actual and intersected geometry + int agx1, agy1, agx2, agy2; + actual_geometry.getCoords (&agx1, &agy1, &agx2, &agy2); + int isx1, isy1, isx2, isy2; + intersection.getCoords (&isx1, &isy1, &isx2, &isy2); + + // Make the intersection the same size as the actual geometry + if ((agx1 == isx1) && (agx2 != isx2)) + isx1 = isx1 - agx2 + isx2; + if ((agx1 != isx1) && (agx2 == isx2)) + isx2 = isx2 + agx2 - isx2; + if ((agy1 == isy1) && (agy2 != isy2)) + isy1 = isy1 - agy2 + isy2; + if ((agy1 != isy1) && (agy2 == isy2)) + isy2 = isy2 + agy2 - isy2; + + // And compute again the intersection with the screen if this resizing + // led to corners outside the screen + actual_geometry = actual_screen_geom.intersected ( + QRect (QPoint (isx1,isy1), QPoint (isx2,isy2))); + } + } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/gui-utils.h --- a/libgui/src/gui-utils.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/gui-utils.h Sun Apr 03 11:30:26 2022 -0400 @@ -29,6 +29,7 @@ #include "octave-config.h" #include +#include namespace octave { @@ -55,6 +56,28 @@ interpolate_color (const QColor& col1, const QColor& col2, double fs, double fv); + + /*! + Get the screen geometry of the actual screen. + + @param width integer variable for storing the screen width + @param height integer variable for storing the screen height + */ + + extern OCTGUI_API void + get_screen_geometry (int& width, int& height); + + + /*! + Adjust geometry to be completely on a screen + + @param actual_geometry QRect with actual widget geometry; this is + changed to the updated geometry which is on the screen. + @param default_geometry the default geometry that is used in case + the actual geometry os on no available screen. + */ + extern OCTGUI_API void + adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry); } #endif diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/applications-system.png Binary file libgui/src/icons/applications-system.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/applications-system.svg --- a/libgui/src/icons/applications-system.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - System Applications - - - Jakub Steiner - - - http://jimmac.musichall.cz/ - - - system - applications - group - category - admin - root - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bookmark-new.png Binary file libgui/src/icons/bookmark-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bookmark-new.svg --- a/libgui/src/icons/bookmark-new.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,672 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - New Bookmark - - - bookmark - remember - favorite - - - - - - Andreas Nilsson - - - - - - Jakub Steiner - - - create bookmark action - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bottom_left_corner.png Binary file libgui/src/icons/bottom_left_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bottom_right_corner.png Binary file libgui/src/icons/bottom_right_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bottom_side.png Binary file libgui/src/icons/bottom_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-next.png Binary file libgui/src/icons/bp-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-next.svg --- a/libgui/src/icons/bp-next.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1072 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - player - record - music - sound - video - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-prev.png Binary file libgui/src/icons/bp-prev.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-prev.svg --- a/libgui/src/icons/bp-prev.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - player - record - music - sound - video - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-rm-all.png Binary file libgui/src/icons/bp-rm-all.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-rm-all.svg --- a/libgui/src/icons/bp-rm-all.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - player - record - music - sound - video - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-toggle.png Binary file libgui/src/icons/bp-toggle.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/bp-toggle.svg --- a/libgui/src/icons/bp-toggle.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,948 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - player - record - music - sound - video - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/circle.png Binary file libgui/src/icons/circle.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/circle.svg --- a/libgui/src/icons/circle.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cross.png Binary file libgui/src/icons/cross.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/bottom_left_corner.png Binary file libgui/src/icons/cursors/bottom_left_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/bottom_right_corner.png Binary file libgui/src/icons/cursors/bottom_right_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/bottom_side.png Binary file libgui/src/icons/cursors/bottom_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/circle.png Binary file libgui/src/icons/cursors/circle.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/circle.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/cursors/circle.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/cross.png Binary file libgui/src/icons/cursors/cross.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/fleur.png Binary file libgui/src/icons/cursors/fleur.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/hand2.png Binary file libgui/src/icons/cursors/hand2.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/left_side.png Binary file libgui/src/icons/cursors/left_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/right_side.png Binary file libgui/src/icons/cursors/right_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/top_left_corner.png Binary file libgui/src/icons/cursors/top_left_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/top_right_corner.png Binary file libgui/src/icons/cursors/top_right_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/cursors/top_side.png Binary file libgui/src/icons/cursors/top_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-cont.png Binary file libgui/src/icons/db-cont.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-cont.svg --- a/libgui/src/icons/db-cont.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Jakub Steiner - - - http://jimmac.musichall.cz/ - - - system - applications - group - category - admin - root - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step-in.png Binary file libgui/src/icons/db-step-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step-in.svg --- a/libgui/src/icons/db-step-in.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - stop - playback - video - music - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step-out.png Binary file libgui/src/icons/db-step-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step-out.svg --- a/libgui/src/icons/db-step-out.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - stop - playback - video - music - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step.png Binary file libgui/src/icons/db-step.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-step.svg --- a/libgui/src/icons/db-step.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - stop - playback - video - music - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-stop.png Binary file libgui/src/icons/db-stop.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/db-stop.svg --- a/libgui/src/icons/db-stop.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,677 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - stop - playback - video - music - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-error.png Binary file libgui/src/icons/dialog-error.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-error.svg --- a/libgui/src/icons/dialog-error.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Rodney Dawes - - - - - Jakub Steiner, Garrett LeSage - - - - Dialog Error - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-information.png Binary file libgui/src/icons/dialog-information.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-information.svg --- a/libgui/src/icons/dialog-information.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Info - - - Jakub Steiner - - - - - dialog - info - - - http://jimmac.musichall.cz - - - - Garrett LeSage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-warning.png Binary file libgui/src/icons/dialog-warning.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/dialog-warning.svg --- a/libgui/src/icons/dialog-warning.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,373 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Dialog Warning - 2005-10-14 - - - Andreas Nilsson - - - - - Jakub Steiner, Garrett LeSage - - - - - dialog - warning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-new.png Binary file libgui/src/icons/document-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-new.svg --- a/libgui/src/icons/document-new.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,448 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - New Document - - - Jakub Steiner - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-open.png Binary file libgui/src/icons/document-open.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-open.svg --- a/libgui/src/icons/document-open.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,535 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Folder Icon Accept - 2005-01-31 - - - Jakub Steiner - - - - http://jimmac.musichall.cz - Active state - when files are being dragged to. - - - Novell, Inc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-print.png Binary file libgui/src/icons/document-print.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-print.svg --- a/libgui/src/icons/document-print.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,532 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Print Document - - - Jakub Steiner - - - - http://jimmac.musichall.cz - - - document - lpr - print - local - laser - bubblejet - inkjet - print - output - cups - lpd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-save-as.png Binary file libgui/src/icons/document-save-as.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-save-as.svg --- a/libgui/src/icons/document-save-as.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,663 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Save As - - - Jakub Steiner - - - - - hdd - hard drive - save as - io - store - - - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-save.png Binary file libgui/src/icons/document-save.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/document-save.svg --- a/libgui/src/icons/document-save.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,619 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Save - - - Jakub Steiner - - - - - hdd - hard drive - save - io - store - - - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-copy.png Binary file libgui/src/icons/edit-copy.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-copy.svg --- a/libgui/src/icons/edit-copy.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Edit Copy - 2005-10-15 - - - Andreas Nilsson - - - - - edit - copy - - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-cut.png Binary file libgui/src/icons/edit-cut.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-cut.svg --- a/libgui/src/icons/edit-cut.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,508 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Edit Cut - - - Garrett Le Sage - - - - - edit - cut - clipboard - - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-delete.png Binary file libgui/src/icons/edit-delete.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-delete.svg --- a/libgui/src/icons/edit-delete.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Delete - 2005-12-28 - - - Andreas Nilsson - - - http://tango-project.org - - - delete - remove - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-find-replace.png Binary file libgui/src/icons/edit-find-replace.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-find-replace.svg --- a/libgui/src/icons/edit-find-replace.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,974 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Edit Find Replace - - - edit - find - locate - search - - - - - - Garrett LeSage - - - - - - Jakub Steiner, Steven Garrity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-find.png Binary file libgui/src/icons/edit-find.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-find.svg --- a/libgui/src/icons/edit-find.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,750 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Edit Find - - - edit - find - locate - search - - - - - - Steven Garrity - - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-paste.png Binary file libgui/src/icons/edit-paste.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-paste.svg --- a/libgui/src/icons/edit-paste.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,531 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Edit Paste - 2005-10-10 - - - Andreas Nilsson - - - - - edit - paste - - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-redo.png Binary file libgui/src/icons/edit-redo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-redo.svg --- a/libgui/src/icons/edit-redo.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Edit Redo - - - edit - redo - again - reapply - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-undo.png Binary file libgui/src/icons/edit-undo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/edit-undo.svg --- a/libgui/src/icons/edit-undo.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Edit Undo - - - edit - undo - revert - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-axes.png Binary file libgui/src/icons/figure-axes.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-axes.svg --- a/libgui/src/icons/figure-axes.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-grid.png Binary file libgui/src/icons/figure-grid.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-grid.svg --- a/libgui/src/icons/figure-grid.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,357 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-pan.png Binary file libgui/src/icons/figure-pan.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-pan.svg --- a/libgui/src/icons/figure-pan.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,971 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - - - - view - refresh - reload - reboot - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-rotate.png Binary file libgui/src/icons/figure-rotate.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-rotate.svg --- a/libgui/src/icons/figure-rotate.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,441 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - View Refresh - - - reload - refresh - view - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-text.png Binary file libgui/src/icons/figure-text.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-text.svg --- a/libgui/src/icons/figure-text.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,639 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Generic font - - - Andreas Nilsson - - - - - the oxygen guys - - - - http://tango-project.org - - - font - type - letter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-in.png Binary file libgui/src/icons/figure-zoom-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-in.svg --- a/libgui/src/icons/figure-zoom-in.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Martin Ruskov - - - http://commons.wikimedia.org/wiki/Tango_icon - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-original.png Binary file libgui/src/icons/figure-zoom-original.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-original.svg --- a/libgui/src/icons/figure-zoom-original.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,306 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - 1 - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-out.png Binary file libgui/src/icons/figure-zoom-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/figure-zoom-out.svg --- a/libgui/src/icons/figure-zoom-out.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Martin Ruskov - - - http://commons.wikimedia.org/wiki/Tango_icon - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/fleur.png Binary file libgui/src/icons/fleur.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/folder-new.png Binary file libgui/src/icons/folder-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/folder-new.svg --- a/libgui/src/icons/folder-new.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,452 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - New Folder - - - - Jakub Steiner - - - - http://jimmac.musichall.cz - - - folder - directory - create - new - - - - - Tuomas Kuosmanen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/folder.png Binary file libgui/src/icons/folder.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/folder.svg --- a/libgui/src/icons/folder.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,424 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Folder Icon - - - - Jakub Steiner - - - - http://jimmac.musichall.cz - - - folder - directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-down.png Binary file libgui/src/icons/go-down.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-down.svg --- a/libgui/src/icons/go-down.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Down - - - go - lower - down - arrow - pointer - > - - - - - Andreas Nilsson - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-first.png Binary file libgui/src/icons/go-first.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-first.svg --- a/libgui/src/icons/go-first.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Previous - - - go - previous - left - arrow - pointer - < - - - - - Andreas Nilsson - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-home.png Binary file libgui/src/icons/go-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-home.svg --- a/libgui/src/icons/go-home.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,445 +0,0 @@ - -image/svg+xmlGo HomeJakub Steinerhttp://jimmac.musichall.czhomereturngodefaultuserdirectoryTuomas Kuosmanen - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-last.png Binary file libgui/src/icons/go-last.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-last.svg --- a/libgui/src/icons/go-last.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Next - - - go - next - right - arrow - pointer - > - - - - - Andreas Nilsson - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-next.png Binary file libgui/src/icons/go-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-next.svg --- a/libgui/src/icons/go-next.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Next - - - go - next - right - arrow - pointer - > - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-previous.png Binary file libgui/src/icons/go-previous.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-previous.svg --- a/libgui/src/icons/go-previous.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,854 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Previous - - - go - previous - left - arrow - pointer - < - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-up.png Binary file libgui/src/icons/go-up.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/go-up.svg --- a/libgui/src/icons/go-up.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Go Up - - - go - higher - up - arrow - pointer - > - - - - - Andreas Nilsson - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_DocumentationDockWidget.png Binary file libgui/src/icons/graphic_logo_DocumentationDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_DocumentationDockWidget.svg --- a/libgui/src/icons/graphic_logo_DocumentationDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,731 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_Figure.png Binary file libgui/src/icons/graphic_logo_Figure.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_Figure.svg --- a/libgui/src/icons/graphic_logo_Figure.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1226 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_FileEditor.png Binary file libgui/src/icons/graphic_logo_FileEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_FileEditor.svg --- a/libgui/src/icons/graphic_logo_FileEditor.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1060 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_FilesDockWidget.png Binary file libgui/src/icons/graphic_logo_FilesDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_FilesDockWidget.svg --- a/libgui/src/icons/graphic_logo_FilesDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1308 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_HistoryDockWidget.png Binary file libgui/src/icons/graphic_logo_HistoryDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_HistoryDockWidget.svg --- a/libgui/src/icons/graphic_logo_HistoryDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1328 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_NewsDockWidget.png Binary file libgui/src/icons/graphic_logo_NewsDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_NewsDockWidget.svg --- a/libgui/src/icons/graphic_logo_NewsDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1156 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_ReleaseWidget.png Binary file libgui/src/icons/graphic_logo_ReleaseWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_ReleaseWidget.svg --- a/libgui/src/icons/graphic_logo_ReleaseWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1156 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_TerminalDockWidget.png Binary file libgui/src/icons/graphic_logo_TerminalDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_TerminalDockWidget.svg --- a/libgui/src/icons/graphic_logo_TerminalDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1744 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_VariableEditor.png Binary file libgui/src/icons/graphic_logo_VariableEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_VariableEditor.svg --- a/libgui/src/icons/graphic_logo_VariableEditor.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1240 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_WorkspaceView.png Binary file libgui/src/icons/graphic_logo_WorkspaceView.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/graphic_logo_WorkspaceView.svg --- a/libgui/src/icons/graphic_logo_WorkspaceView.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1175 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/hand2.png Binary file libgui/src/icons/hand2.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/icons_license --- a/libgui/src/icons/icons_license Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -=========================================== -Icons based on the Tango-Desktop-Project -=========================================== - -Tango-Desktop-Project: -http://tango.freedesktop.org/Tango_Desktop_Project - -Archive with base icon set available at: -http://tango.freedesktop.org/releases/tango-icon-theme-0.8.90.tar.gz - -License -=========================================== - -The Tango base icon theme is released to the Public Domain. - -Icons used for Octave -=========================================== - -applications-system.svg -bookmark-new.svg -dialog-error.svg -dialog-information.svg -dialog-warning.svg -document-new.svg -document-open.svg -document-print.svg -document-save.svg -document-save-as.svg -edit-copy.svg -edit-cut.svg -edit-delete.svg -edit-find.svg -edit-find-replace.svg -edit-paste.svg -edit-redo.svg -edit-undo.svg -figure-rotate.svg (original file view-refresh.svg) -figure-text.svg (original file font-x-generic.svg) -figure-zoom-in.svg (original file view-zoom-in.svg) -figure-zoom-original.svg (original file view-zoom-original.svg) -figure-zoom-out.svg (original file view-zoom-out.svg) -folder.svg -folder-new.svg -go-down.svg -go-first.svg -go-home.svg -go-last.svg -go-next.svg -go-previous.svg -go-up.svg -preferences-system.svg -user-home.svg -view-refresh.svg -view-refresh.svg - -=========================================== -Icons created by the Octave developers -=========================================== - -figure-axes.svg -figure-grid.svg -logo.png -widget-close.svg -widget-dock.svg -widget-undock.svg - -Icons with elements from the Tango theme -=========================================== - -figure-pan.svg -graphic_logo_DocumentationDockWidget.svg -graphic_logo_Figure.svg -graphic_logo_FileEditor.svg -graphic_logo_FilesDockWidget.svg -graphic_logo_HistoryDockWidget.svg -graphic_logo_NewsDockWidget.svg -graphic_logo_ReleaseWidget.svg -graphic_logo_TerminalDockWidget.svg -graphic_logo_WorkspaceView.svg -letter_logo_DocumentationDockWidget.svg -letter_logo_FileEditor.svg -letter_logo_FilesDockWidget.svg -letter_logo_HistoryDockWidget.svg -letter_logo_NewsDockWidget.svg -letter_logo_ReleaseWidget.svg -letter_logo_TerminalDockWidget.svg -letter_logo_WorkspaceView.svg - -bp-next.svg -bp-prev.svg -bp-rm_all.svg -bp-toggle.svg -db-cont.svg -db-step-in.svg -db-step-out.svg -db-step.svg -db-stop.svg -plot-xy-curve.svg -system-run.svg - -Cursors from the standard DMZ theme -=================================== - -https://github.com/GalliumOS/dmz-cursor-theme/tree/master/DMZ-White - -bottom_left_corner.png -bottom_right_corner.png -bottom_side.png -cross.png -fleur.png -hand2.png -left_side.png -right_side.png -top_left_corner.png -top_right_corner.png -top_side.png - -Cursor created by the Octave developers -with elements from the DMZ theme: - -circle.png -circle.svg diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/left_side.png Binary file libgui/src/icons/left_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_DocumentationDockWidget.png Binary file libgui/src/icons/letter_logo_DocumentationDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_DocumentationDockWidget.svg --- a/libgui/src/icons/letter_logo_DocumentationDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - D - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_FileEditor.png Binary file libgui/src/icons/letter_logo_FileEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_FileEditor.svg --- a/libgui/src/icons/letter_logo_FileEditor.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - E - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_FilesDockWidget.png Binary file libgui/src/icons/letter_logo_FilesDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_FilesDockWidget.svg --- a/libgui/src/icons/letter_logo_FilesDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - F - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_HistoryDockWidget.png Binary file libgui/src/icons/letter_logo_HistoryDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_HistoryDockWidget.svg --- a/libgui/src/icons/letter_logo_HistoryDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - H - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_NewsDockWidget.png Binary file libgui/src/icons/letter_logo_NewsDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_NewsDockWidget.svg --- a/libgui/src/icons/letter_logo_NewsDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - N - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_ReleaseWidget.png Binary file libgui/src/icons/letter_logo_ReleaseWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_ReleaseWidget.svg --- a/libgui/src/icons/letter_logo_ReleaseWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - R - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_TerminalDockWidget.png Binary file libgui/src/icons/letter_logo_TerminalDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_TerminalDockWidget.svg --- a/libgui/src/icons/letter_logo_TerminalDockWidget.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - C - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_VariableEditor.png Binary file libgui/src/icons/letter_logo_VariableEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_VariableEditor.svg --- a/libgui/src/icons/letter_logo_VariableEditor.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - V - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_WorkspaceView.png Binary file libgui/src/icons/letter_logo_WorkspaceView.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/letter_logo_WorkspaceView.svg --- a/libgui/src/icons/letter_logo_WorkspaceView.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - W - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/license.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/license.md Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,137 @@ +# Icons for Octave + +## Icons based on the Tango-Desktop-Project + +The icons in the directory **tango** are taken from the Tango-Desktop-Projekt + +- [Tango-Desktop-Project](http://tango.freedesktop.org/Tango_Desktop_Project) +- [Archive with base icon set](http://tango.freedesktop.org/releases/tango-icon-theme-0.8.90.tar.gz) + +The Tango base icon theme is released to the Public Domain. + +The following icons excusively used by octave are created by the +Octave developers using elements of the tango icon theme: + +- bp-next +- bp-prev +- bp-rm_all +- bp-toggle +- db-cont +- db-step-in +- db-step-out +- db-step +- db-stop +- system-run + + +## Icons by Octave developers + +The icons in the directory **octave** are created by the Octave developers. + +### Icons by Luís Eduardo Ribeiro Guerra + +The icons are maintained in this +[repository on github](https://github.com/luisrguerra/cc0-fluent-icons) +under the CC0 1.0 Universal license. + +- applications-system +- bookmark-new +- bp-next +- bp-prev +- bp-rm-all +- bp-toggle +- db-cont +- db-step-in +- db-step-out +- db-step +- db-stop +- dialog-error +- dialog-information +- document-new +- document-open +- document-print +- document-save-as +- document-save +- edit-copy +- edit-cut +- edit-find-replace +- edit-find +- edit-paste +- edit-redo +- edit-undo +- folder-new +- figure-zoom-in +- figure-zoom-original +- figure-zoom-out +- folder-settings +- folder-up +- folder +- go-down +- go-first +- go-home +- go-last +- go-next +- go-previous +- go-up +- system-run +- user-home +- view-zoom-in +- view-zoom-out +- view-zoom-original + +### Icons containing elements from the Tango theme + +- figure-pan +- figure-rotate +- figure-text +- graphic_logo_DocumentationDockWidget +- graphic_logo_Figure +- graphic_logo_FileEditor +- graphic_logo_FilesDockWidget +- graphic_logo_HistoryDockWidget +- graphic_logo_NewsDockWidget +- graphic_logo_ReleaseWidget +- graphic_logo_TerminalDockWidget +- graphic_logo_WorkspaceView +- letter_logo_DocumentationDockWidget +- letter_logo_FileEditor +- letter_logo_FilesDockWidget +- letter_logo_HistoryDockWidget +- letter_logo_NewsDockWidget +- letter_logo_ReleaseWidget +- letter_logo_TerminalDockWidget +- letter_logo_WorkspaceView +- plot-xy-curve + +### Icons created independently from other themes + +- figure-axes +- figure-grid +- logo +- widget-close +- widget-dock +- widget-undock + + +## Cursor icons + +The directory **cursors** contains cursor icons required by Octave. +The following cursors are taken from the [standrad DMZ theme](https://github.com/GalliumOS/dmz-cursor-theme/tree/master/DMZ-White): + +- bottom_left_corner +- bottom_right_corner +- bottom_side +- cross +- fleur +- hand2 +- left_side +- right_side +- top_left_corner +- top_right_corner +- top_side + +## Cursor created by the Octave developers + +The following cursors are created by the Octave developers with elements from the DMZ theme: + +- circle diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/logo.png Binary file libgui/src/icons/logo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/applications-system.png Binary file libgui/src/icons/octave/128x128/applications-system.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/bookmark-new.png Binary file libgui/src/icons/octave/128x128/bookmark-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/bp-next.png Binary file libgui/src/icons/octave/128x128/bp-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/bp-prev.png Binary file libgui/src/icons/octave/128x128/bp-prev.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/bp-rm-all.png Binary file libgui/src/icons/octave/128x128/bp-rm-all.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/bp-toggle.png Binary file libgui/src/icons/octave/128x128/bp-toggle.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/db-cont.png Binary file libgui/src/icons/octave/128x128/db-cont.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/db-step-in.png Binary file libgui/src/icons/octave/128x128/db-step-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/db-step-out.png Binary file libgui/src/icons/octave/128x128/db-step-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/db-step.png Binary file libgui/src/icons/octave/128x128/db-step.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/db-stop.png Binary file libgui/src/icons/octave/128x128/db-stop.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/dialog-error.png Binary file libgui/src/icons/octave/128x128/dialog-error.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/dialog-information.png Binary file libgui/src/icons/octave/128x128/dialog-information.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/document-new.png Binary file libgui/src/icons/octave/128x128/document-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/document-open.png Binary file libgui/src/icons/octave/128x128/document-open.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/document-print.png Binary file libgui/src/icons/octave/128x128/document-print.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/document-save-as.png Binary file libgui/src/icons/octave/128x128/document-save-as.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/document-save.png Binary file libgui/src/icons/octave/128x128/document-save.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-copy.png Binary file libgui/src/icons/octave/128x128/edit-copy.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-cut.png Binary file libgui/src/icons/octave/128x128/edit-cut.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-find-replace.png Binary file libgui/src/icons/octave/128x128/edit-find-replace.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-find.png Binary file libgui/src/icons/octave/128x128/edit-find.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-paste.png Binary file libgui/src/icons/octave/128x128/edit-paste.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-redo.png Binary file libgui/src/icons/octave/128x128/edit-redo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/edit-undo.png Binary file libgui/src/icons/octave/128x128/edit-undo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-axes.png Binary file libgui/src/icons/octave/128x128/figure-axes.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-grid.png Binary file libgui/src/icons/octave/128x128/figure-grid.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-pan.png Binary file libgui/src/icons/octave/128x128/figure-pan.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-rotate.png Binary file libgui/src/icons/octave/128x128/figure-rotate.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-text.png Binary file libgui/src/icons/octave/128x128/figure-text.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-zoom-in.png Binary file libgui/src/icons/octave/128x128/figure-zoom-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-zoom-original.png Binary file libgui/src/icons/octave/128x128/figure-zoom-original.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/figure-zoom-out.png Binary file libgui/src/icons/octave/128x128/figure-zoom-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/folder-new.png Binary file libgui/src/icons/octave/128x128/folder-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/folder-settings.png Binary file libgui/src/icons/octave/128x128/folder-settings.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/folder-up.png Binary file libgui/src/icons/octave/128x128/folder-up.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/folder.png Binary file libgui/src/icons/octave/128x128/folder.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-down.png Binary file libgui/src/icons/octave/128x128/go-down.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-first.png Binary file libgui/src/icons/octave/128x128/go-first.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-home.png Binary file libgui/src/icons/octave/128x128/go-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-last.png Binary file libgui/src/icons/octave/128x128/go-last.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-next.png Binary file libgui/src/icons/octave/128x128/go-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-previous.png Binary file libgui/src/icons/octave/128x128/go-previous.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/go-up.png Binary file libgui/src/icons/octave/128x128/go-up.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_DocumentationDockWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_DocumentationDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_Figure.png Binary file libgui/src/icons/octave/128x128/graphic_logo_Figure.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_FileEditor.png Binary file libgui/src/icons/octave/128x128/graphic_logo_FileEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_FilesDockWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_FilesDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_HistoryDockWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_HistoryDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_NewsDockWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_NewsDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_ReleaseWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_ReleaseWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_TerminalDockWidget.png Binary file libgui/src/icons/octave/128x128/graphic_logo_TerminalDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_VariableEditor.png Binary file libgui/src/icons/octave/128x128/graphic_logo_VariableEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/graphic_logo_WorkspaceView.png Binary file libgui/src/icons/octave/128x128/graphic_logo_WorkspaceView.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_DocumentationDockWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_DocumentationDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_FileEditor.png Binary file libgui/src/icons/octave/128x128/letter_logo_FileEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_FilesDockWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_FilesDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_HistoryDockWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_HistoryDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_NewsDockWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_NewsDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_ReleaseWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_ReleaseWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_TerminalDockWidget.png Binary file libgui/src/icons/octave/128x128/letter_logo_TerminalDockWidget.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_VariableEditor.png Binary file libgui/src/icons/octave/128x128/letter_logo_VariableEditor.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/letter_logo_WorkspaceView.png Binary file libgui/src/icons/octave/128x128/letter_logo_WorkspaceView.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/logo.png Binary file libgui/src/icons/octave/128x128/logo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/plot-xy-curve.png Binary file libgui/src/icons/octave/128x128/plot-xy-curve.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/system-run.png Binary file libgui/src/icons/octave/128x128/system-run.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/user-home.png Binary file libgui/src/icons/octave/128x128/user-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/view-zoom-in.png Binary file libgui/src/icons/octave/128x128/view-zoom-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/view-zoom-original.png Binary file libgui/src/icons/octave/128x128/view-zoom-original.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/view-zoom-out.png Binary file libgui/src/icons/octave/128x128/view-zoom-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-close-light.png Binary file libgui/src/icons/octave/128x128/widget-close-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-close.png Binary file libgui/src/icons/octave/128x128/widget-close.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-dock-light.png Binary file libgui/src/icons/octave/128x128/widget-dock-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-dock.png Binary file libgui/src/icons/octave/128x128/widget-dock.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-undock-light.png Binary file libgui/src/icons/octave/128x128/widget-undock-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/128x128/widget-undock.png Binary file libgui/src/icons/octave/128x128/widget-undock.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/index.theme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/index.theme Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,18 @@ +[Icon Theme] +Name=Octave-icons +Comment=icon theme for octave + +# Directory list +Directories=scalable,128 + +[scalable] +Size=48 +MinSize=16 +MaxSize=512 +Type=Scalable + +[128x128] +Size=128 +MinSize=16 +MaxSize=512 +Type=Scalable diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/applications-system.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/applications-system.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/bookmark-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/bookmark-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/bp-next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/bp-next.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/bp-prev.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/bp-prev.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/bp-rm-all.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/bp-rm-all.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/bp-toggle.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/bp-toggle.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/db-cont.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/db-cont.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/db-step-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/db-step-in.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/db-step-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/db-step-out.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/db-step.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/db-step.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/db-stop.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/db-stop.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/dialog-error.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/dialog-error.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/dialog-information.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/dialog-information.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/document-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/document-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/document-open.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/document-open.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/document-print.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/document-print.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/document-save-as.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/document-save-as.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/document-save.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/document-save.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-copy.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-copy.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-cut.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-cut.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-find-replace.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-find-replace.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-find.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-find.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-paste.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-paste.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-redo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-redo.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/edit-undo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/edit-undo.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-axes.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-axes.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-grid.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-grid.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,357 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-pan.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-pan.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,971 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + + + + view + refresh + reload + reboot + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-rotate.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-rotate.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,441 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + View Refresh + + + reload + refresh + view + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-text.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-text.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,639 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Generic font + + + Andreas Nilsson + + + + + the oxygen guys + + + + http://tango-project.org + + + font + type + letter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-zoom-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-zoom-in.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-zoom-original.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-zoom-original.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/figure-zoom-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/figure-zoom-out.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/folder-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/folder-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/folder-settings.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/folder-settings.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/folder-up.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/folder-up.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/folder.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/folder.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-down.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-down.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-first.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-first.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-home.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-home.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-last.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-last.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-next.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-previous.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-previous.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/go-up.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/go-up.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_DocumentationDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_DocumentationDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,731 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_Figure.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_Figure.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1226 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_FileEditor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_FileEditor.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1060 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_FilesDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_FilesDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1308 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_HistoryDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_HistoryDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1328 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_NewsDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_NewsDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1156 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_ReleaseWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_ReleaseWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1156 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_TerminalDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_TerminalDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1744 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_VariableEditor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_VariableEditor.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1240 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/graphic_logo_WorkspaceView.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/graphic_logo_WorkspaceView.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1175 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_DocumentationDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_DocumentationDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,363 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_FileEditor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_FileEditor.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,375 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + E + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_FilesDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_FilesDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,375 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + F + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_HistoryDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_HistoryDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,363 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + H + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_NewsDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_NewsDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,363 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_ReleaseWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_ReleaseWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,363 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + R + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_TerminalDockWidget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_TerminalDockWidget.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,363 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_VariableEditor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_VariableEditor.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,332 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + V + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/letter_logo_WorkspaceView.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/letter_logo_WorkspaceView.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,375 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + W + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/plot-xy-curve.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/plot-xy-curve.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/system-run.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/system-run.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/user-home.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/user-home.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/view-zoom-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/view-zoom-in.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/view-zoom-original.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/view-zoom-original.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/view-zoom-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/view-zoom-out.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-close-light.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-close-light.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,78 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-close.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-close.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,78 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-dock-light.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-dock-light.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-dock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-dock.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-undock-light.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-undock-light.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/octave/scalable/widget-undock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/octave/scalable/widget-undock.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/plot-xy-curve.png Binary file libgui/src/icons/plot-xy-curve.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/plot-xy-curve.svg --- a/libgui/src/icons/plot-xy-curve.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Lapo Calamandrei - - - - - - media - stop - playback - video - music - - - - - Jakub Steiner - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/preferences-system.png Binary file libgui/src/icons/preferences-system.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/preferences-system.svg --- a/libgui/src/icons/preferences-system.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,398 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Preferences System - - - preferences - settings - control panel - tweaks - system - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/right_side.png Binary file libgui/src/icons/right_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/system-run.png Binary file libgui/src/icons/system-run.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/system-run.svg --- a/libgui/src/icons/system-run.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1334 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Jakub Steiner - - - http://jimmac.musichall.cz/ - - - system - applications - group - category - admin - root - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/applications-system.png Binary file libgui/src/icons/tango/128x128/applications-system.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/bookmark-new.png Binary file libgui/src/icons/tango/128x128/bookmark-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/bp-next.png Binary file libgui/src/icons/tango/128x128/bp-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/bp-prev.png Binary file libgui/src/icons/tango/128x128/bp-prev.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/bp-rm-all.png Binary file libgui/src/icons/tango/128x128/bp-rm-all.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/bp-toggle.png Binary file libgui/src/icons/tango/128x128/bp-toggle.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/db-cont.png Binary file libgui/src/icons/tango/128x128/db-cont.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/db-step-in.png Binary file libgui/src/icons/tango/128x128/db-step-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/db-step-out.png Binary file libgui/src/icons/tango/128x128/db-step-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/db-step.png Binary file libgui/src/icons/tango/128x128/db-step.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/db-stop.png Binary file libgui/src/icons/tango/128x128/db-stop.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/dialog-error.png Binary file libgui/src/icons/tango/128x128/dialog-error.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/dialog-information.png Binary file libgui/src/icons/tango/128x128/dialog-information.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/dialog-warning.png Binary file libgui/src/icons/tango/128x128/dialog-warning.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/document-new.png Binary file libgui/src/icons/tango/128x128/document-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/document-open.png Binary file libgui/src/icons/tango/128x128/document-open.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/document-print.png Binary file libgui/src/icons/tango/128x128/document-print.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/document-save-as.png Binary file libgui/src/icons/tango/128x128/document-save-as.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/document-save.png Binary file libgui/src/icons/tango/128x128/document-save.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-copy.png Binary file libgui/src/icons/tango/128x128/edit-copy.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-cut.png Binary file libgui/src/icons/tango/128x128/edit-cut.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-delete.png Binary file libgui/src/icons/tango/128x128/edit-delete.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-find-replace.png Binary file libgui/src/icons/tango/128x128/edit-find-replace.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-find.png Binary file libgui/src/icons/tango/128x128/edit-find.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-paste.png Binary file libgui/src/icons/tango/128x128/edit-paste.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-redo.png Binary file libgui/src/icons/tango/128x128/edit-redo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/edit-undo.png Binary file libgui/src/icons/tango/128x128/edit-undo.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/folder-new.png Binary file libgui/src/icons/tango/128x128/folder-new.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/folder.png Binary file libgui/src/icons/tango/128x128/folder.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-down.png Binary file libgui/src/icons/tango/128x128/go-down.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-first.png Binary file libgui/src/icons/tango/128x128/go-first.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-home.png Binary file libgui/src/icons/tango/128x128/go-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-last.png Binary file libgui/src/icons/tango/128x128/go-last.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-next.png Binary file libgui/src/icons/tango/128x128/go-next.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-previous.png Binary file libgui/src/icons/tango/128x128/go-previous.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/go-up.png Binary file libgui/src/icons/tango/128x128/go-up.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/preferences-system.png Binary file libgui/src/icons/tango/128x128/preferences-system.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/user-home.png Binary file libgui/src/icons/tango/128x128/user-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/view-refresh.png Binary file libgui/src/icons/tango/128x128/view-refresh.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/view-zoom-in.png Binary file libgui/src/icons/tango/128x128/view-zoom-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/view-zoom-original.png Binary file libgui/src/icons/tango/128x128/view-zoom-original.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/128x128/view-zoom-out.png Binary file libgui/src/icons/tango/128x128/view-zoom-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/index.theme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/index.theme Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,18 @@ +[Icon Theme] +Name=Tango-icons +Comment=icon theme tango + +# Directory list +Directories=scalable,128 + +[scalable] +Size=48 +MinSize=16 +MaxSize=512 +Type=Scalable + +[128x128] +Size=128 +MinSize=16 +MaxSize=512 +Type=Scalable diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/applications-system.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/applications-system.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + System Applications + + + Jakub Steiner + + + http://jimmac.musichall.cz/ + + + system + applications + group + category + admin + root + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/bookmark-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/bookmark-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,672 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + New Bookmark + + + bookmark + remember + favorite + + + + + + Andreas Nilsson + + + + + + Jakub Steiner + + + create bookmark action + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/bp-next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/bp-next.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1072 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + player + record + music + sound + video + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/bp-prev.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/bp-prev.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + player + record + music + sound + video + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/bp-rm-all.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/bp-rm-all.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + player + record + music + sound + video + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/bp-toggle.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/bp-toggle.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,948 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + player + record + music + sound + video + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/db-cont.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/db-cont.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Jakub Steiner + + + http://jimmac.musichall.cz/ + + + system + applications + group + category + admin + root + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/db-step-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/db-step-in.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + stop + playback + video + music + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/db-step-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/db-step-out.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + stop + playback + video + music + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/db-step.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/db-step.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + stop + playback + video + music + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/db-stop.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/db-stop.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,677 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Lapo Calamandrei + + + + + + media + stop + playback + video + music + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/dialog-error.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/dialog-error.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Rodney Dawes + + + + + Jakub Steiner, Garrett LeSage + + + + Dialog Error + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/dialog-information.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/dialog-information.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,1159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Info + + + Jakub Steiner + + + + + dialog + info + + + http://jimmac.musichall.cz + + + + Garrett LeSage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/dialog-warning.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/dialog-warning.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Dialog Warning + 2005-10-14 + + + Andreas Nilsson + + + + + Jakub Steiner, Garrett LeSage + + + + + dialog + warning + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/document-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/document-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,448 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + New Document + + + Jakub Steiner + + + http://jimmac.musichall.cz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/document-open.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/document-open.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,535 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Folder Icon Accept + 2005-01-31 + + + Jakub Steiner + + + + http://jimmac.musichall.cz + Active state - when files are being dragged to. + + + Novell, Inc. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/document-print.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/document-print.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,532 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Print Document + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + document + lpr + print + local + laser + bubblejet + inkjet + print + output + cups + lpd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/document-save-as.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/document-save-as.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,663 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Save As + + + Jakub Steiner + + + + + hdd + hard drive + save as + io + store + + + + + http://jimmac.musichall.cz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/document-save.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/document-save.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,619 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Save + + + Jakub Steiner + + + + + hdd + hard drive + save + io + store + + + + + http://jimmac.musichall.cz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-copy.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-copy.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Edit Copy + 2005-10-15 + + + Andreas Nilsson + + + + + edit + copy + + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-cut.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-cut.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Edit Cut + + + Garrett Le Sage + + + + + edit + cut + clipboard + + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-delete.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-delete.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Delete + 2005-12-28 + + + Andreas Nilsson + + + http://tango-project.org + + + delete + remove + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-find-replace.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-find-replace.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,974 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Edit Find Replace + + + edit + find + locate + search + + + + + + Garrett LeSage + + + + + + Jakub Steiner, Steven Garrity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-find.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-find.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,750 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Edit Find + + + edit + find + locate + search + + + + + + Steven Garrity + + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-paste.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-paste.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,531 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Edit Paste + 2005-10-10 + + + Andreas Nilsson + + + + + edit + paste + + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-redo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-redo.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Edit Redo + + + edit + redo + again + reapply + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/edit-undo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/edit-undo.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Edit Undo + + + edit + undo + revert + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/folder-new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/folder-new.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + New Folder + + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + folder + directory + create + new + + + + + Tuomas Kuosmanen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/folder.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/folder.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Folder Icon + + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + folder + directory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-down.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-down.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Down + + + go + lower + down + arrow + pointer + > + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-first.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-first.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Previous + + + go + previous + left + arrow + pointer + < + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-home.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-home.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,445 @@ + +image/svg+xmlGo HomeJakub Steinerhttp://jimmac.musichall.czhomereturngodefaultuserdirectoryTuomas Kuosmanen + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-last.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-last.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Next + + + go + next + right + arrow + pointer + > + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-next.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Next + + + go + next + right + arrow + pointer + > + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-previous.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-previous.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,854 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Previous + + + go + previous + left + arrow + pointer + < + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/go-up.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/go-up.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Up + + + go + higher + up + arrow + pointer + > + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/preferences-system.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/preferences-system.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Preferences System + + + preferences + settings + control panel + tweaks + system + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/user-home.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/user-home.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,529 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Home Folder Icon + + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + folder + directory + home + user + + + + + Garrett LeSage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/view-refresh.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/view-refresh.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + View Refresh + + + reload + refresh + view + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/view-zoom-in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/view-zoom-in.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Add + 2006-01-04 + + + Andreas Nilsson + + + http://tango-project.org + + + add + plus + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/view-zoom-original.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/view-zoom-original.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + 2006-01-04 + + + Andreas Nilsson + + + http://tango-project.org + + + add + plus + + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/tango/scalable/view-zoom-out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/icons/tango/scalable/view-zoom-out.svg Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Remove + 2006-01-04 + + + Andreas Nilsson + + + http://tango-project.org + + + remove + delete + + + + + + + + + + + + + + + + + diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/top_left_corner.png Binary file libgui/src/icons/top_left_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/top_right_corner.png Binary file libgui/src/icons/top_right_corner.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/top_side.png Binary file libgui/src/icons/top_side.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/user-home.png Binary file libgui/src/icons/user-home.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/user-home.svg --- a/libgui/src/icons/user-home.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,529 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Home Folder Icon - - - - Jakub Steiner - - - - http://jimmac.musichall.cz - - - folder - directory - home - user - - - - - Garrett LeSage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/view-refresh.png Binary file libgui/src/icons/view-refresh.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/view-refresh.svg --- a/libgui/src/icons/view-refresh.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - View Refresh - - - reload - refresh - view - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-close-light.png Binary file libgui/src/icons/widget-close-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-close-light.svg --- a/libgui/src/icons/widget-close-light.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-close.png Binary file libgui/src/icons/widget-close.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-close.svg --- a/libgui/src/icons/widget-close.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-dock-light.png Binary file libgui/src/icons/widget-dock-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-dock-light.svg --- a/libgui/src/icons/widget-dock-light.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-dock.png Binary file libgui/src/icons/widget-dock.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-dock.svg --- a/libgui/src/icons/widget-dock.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-undock-light.png Binary file libgui/src/icons/widget-undock-light.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-undock-light.svg --- a/libgui/src/icons/widget-undock-light.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-undock.png Binary file libgui/src/icons/widget-undock.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/widget-undock.svg --- a/libgui/src/icons/widget-undock.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-in.png Binary file libgui/src/icons/zoom-in.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-in.svg --- a/libgui/src/icons/zoom-in.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,436 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Add - 2006-01-04 - - - Andreas Nilsson - - - http://tango-project.org - - - add - plus - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-original.png Binary file libgui/src/icons/zoom-original.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-original.svg --- a/libgui/src/icons/zoom-original.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - 2006-01-04 - - - Andreas Nilsson - - - http://tango-project.org - - - add - plus - - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-out.png Binary file libgui/src/icons/zoom-out.png has changed diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/icons/zoom-out.svg --- a/libgui/src/icons/zoom-out.svg Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,424 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Remove - 2006-01-04 - - - Andreas Nilsson - - - http://tango-project.org - - - remove - delete - - - - - - - - - - - - - - - - - diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Sun Apr 03 11:30:26 2022 -0400 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -508,6 +509,9 @@ update_lexer (); } + // set the window title to actual filename (not modified) + update_window_title (m_edit_area->isModified ()); + // update the file editor with current editing directory emit editor_state_changed (m_copy_available, m_is_octave_file, m_edit_area->isModified ()); @@ -531,6 +535,14 @@ return true; } + void file_editor_tab::enable_file_watcher (bool do_enable) + { + if (do_enable) + m_file_system_watcher.addPath (m_file_name); + else + m_file_system_watcher.removePath (m_file_name); + } + // We cannot create a breakpoint when the file is modified // because the line number the editor is providing might // not match what Octave core is interpreting in the @@ -1844,9 +1856,8 @@ QApplication::restoreOverrideCursor (); m_copy_available = false; // no selection yet available + m_edit_area->setModified (false); // loaded file is not modified yet set_file_name (file_to_load); - update_window_title (false); // window title (no modification) - m_edit_area->setModified (false); // loaded file is not modified yet update_eol_indicator (); @@ -2183,7 +2194,7 @@ bool remove_on_success, bool restore_breakpoints) { - QFile file (file_to_save); + QSaveFile file (file_to_save); // stop watching file QStringList trackedFiles = m_file_system_watcher.files (); @@ -2239,36 +2250,47 @@ out.flush (); QApplication::restoreOverrideCursor (); - file.flush (); - file.close (); - - // file exists now - QFileInfo file_info = QFileInfo (file); - QString full_file_to_save = file_info.canonicalFilePath (); - - // save filename after closing file as set_file_name starts watching again - set_file_name (full_file_to_save); // make absolute - - // set the window title to actual filename (not modified) - update_window_title (false); - - // file is save -> not modified, update encoding in statusbar - m_edit_area->setModified (false); - m_enc_indicator->setText (m_encoding); - - emit tab_ready_to_close (); - - if (remove_on_success) + + // Finish writing by committing the changes to disk, + // where nothing is done when an error occurred while writing above + bool writing_ok = file.commit (); + + if (writing_ok) { - emit tab_remove_request (); - return; // Don't touch member variables after removal + // Writing was successful: file exists now + QFileInfo file_info = QFileInfo (file.fileName ()); + QString full_file_to_save = file_info.canonicalFilePath (); + + // file is save -> not modified, update encoding in statusbar + m_edit_area->setModified (false); + m_enc_indicator->setText (m_encoding); + + // save filename after closing file as set_file_name starts watching again + set_file_name (full_file_to_save); // make absolute + + emit tab_ready_to_close (); + + if (remove_on_success) + { + emit tab_remove_request (); + return; // Don't touch member variables after removal + } + + // Attempt to restore the breakpoints if that is desired. + // This is only allowed if the tab is not closing since changing + // breakpoints would reopen the tab in this case. + if (restore_breakpoints) + check_restore_breakpoints (); } - - // Attempt to restore the breakpoints if that is desired. - // This is only allowed if the tab is not closing since changing - // breakpoints would reopen the tab in this case. - if (restore_breakpoints) - check_restore_breakpoints (); + else + { + QMessageBox::critical (nullptr, + tr ("Octave Editor"), + tr ("The changes could not be saved to the file\n" + "%1") + .arg (file.fileName ()) + ); + } } void file_editor_tab::save_file_as (bool remove_on_success) diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/file-editor-tab.h Sun Apr 03 11:30:26 2022 -0400 @@ -64,6 +64,8 @@ bool conditional_close (void); void update_breakpoints (); + void set_file_name (const QString& fileName); + void enable_file_watcher (bool do_enable); QString file_name (void) const { return m_file_name; } QString encoding (void) const { return m_encoding; } @@ -255,7 +257,6 @@ protected: void closeEvent (QCloseEvent *event); - void set_file_name (const QString& fileName); private: diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/file-editor.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1167,7 +1167,7 @@ { // Clear old list of file data and declare a structure for file data m_tmp_closed_files.clear (); - session_data f_data; + removed_file_data f_data; // Preprocessing old name(s) QString old_name_clean = old_name.trimmed (); @@ -1201,22 +1201,12 @@ if (editor_tab) { - // Get index and line. - - f_data.encoding = editor_tab->encoding (); - f_data.index = m_tab_widget->indexOf (editor_tab); - int l, c; - editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c); - f_data.line = l + 1; - - // Close it silently - m_no_focus = true; // Remember for not focussing editor - editor_tab->file_has_changed (QString (), true); // Close the tab - m_no_focus = false; // Back to normal - - // For reloading old file if error while removing - f_data.file_name = old_names.at (i); - // For reloading new file (if new_file is not empty) + + editor_tab->enable_file_watcher (false); + + // For re-enabling tracking if error while removing/renaming + f_data.editor_tab = editor_tab; + // For renaming into new file (if new_file is not empty) if (new_is_dir) { std::string ndir = new_name.toStdString (); @@ -1239,27 +1229,24 @@ { m_no_focus = true; // Remember for not focussing editor - // Loop over all files that have to be reloaded. Start at the end of the + // Loop over all files that have to be handled. Start at the end of the // list, otherwise the stored indexes are not correct. for (int i = m_tmp_closed_files.count () - 1; i >= 0; i--) { - // Load old or new file if (load_new) { - if (! m_tmp_closed_files.at (i).new_file_name.isEmpty ()) - request_open_file (m_tmp_closed_files.at (i).new_file_name, - m_tmp_closed_files.at (i).encoding, - m_tmp_closed_files.at (i).line, - false, false, true, "", - m_tmp_closed_files.at (i).index); + // Close file (remove) or rename into new file (rename) + if (m_tmp_closed_files.at (i).new_file_name.isEmpty ()) + m_tmp_closed_files.at (i).editor_tab->file_has_changed (QString (), true); + else + m_tmp_closed_files.at (i).editor_tab->set_file_name ( + m_tmp_closed_files.at (i).new_file_name); } else { - request_open_file (m_tmp_closed_files.at (i).file_name, - m_tmp_closed_files.at (i).encoding, - m_tmp_closed_files.at (i).line, - false, false, true, "", - m_tmp_closed_files.at (i).index); + // Something went wrong while renaming or removing: + // Leave everything as it is but reactivate tracking + m_tmp_closed_files.at (i).editor_tab->enable_file_watcher (true); } } @@ -2215,15 +2202,16 @@ view_menu->addSeparator (); m_zoom_in_action - = add_action (view_menu, rmgr.icon ("zoom-in"), tr ("Zoom &In"), + = add_action (view_menu, rmgr.icon ("view-zoom-in"), tr ("Zoom &In"), SLOT (zoom_in (bool))); m_zoom_out_action - = add_action (view_menu, rmgr.icon ("zoom-out"), tr ("Zoom &Out"), + = add_action (view_menu, rmgr.icon ("view-zoom-out"), tr ("Zoom &Out"), SLOT (zoom_out (bool))); m_zoom_normal_action - = add_action (view_menu, tr ("&Normal Size"), SLOT (zoom_normal (bool))); + = add_action (view_menu, rmgr.icon ("view-zoom-original"), tr ("&Normal Size"), + SLOT (zoom_normal (bool))); view_menu->addSeparator (); @@ -2704,7 +2692,7 @@ const QString& new_name) { QDir old_dir (old_name); - session_data f_data; + removed_file_data f_data; std::list editor_tab_lst = m_tab_widget->tab_list (); @@ -2731,52 +2719,39 @@ && (rel_path_to_file.left (3) != QString ("../"))) { // The currently considered file is included in the - // removed/renamed diectory: Delete it. - m_no_focus = true; // Remember for not focussing editor - + // removed/renamed diectory: remeber it if (editor_tab) { - // Get index and line - int l, c; - editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c); - f_data.line = l + 1; - f_data.index = m_tab_widget->indexOf (editor_tab); - // Close - editor_tab->file_has_changed (QString (), true); - } - m_no_focus = false; // Back to normal - - // Store file for possible later reload - f_data.file_name = file_name; - - // Add the new file path and the encoding for later reloading - // if new_name is given - if (! new_name.isEmpty ()) - { - QDir new_dir (new_name); - QString append_to_new_dir; - if (new_dir.exists ()) + editor_tab->enable_file_watcher (false); + f_data.editor_tab = editor_tab; + + // Add the new file path and the encoding for later reloading + // if new_name is given + if (! new_name.isEmpty ()) { - // The new directory already exists (movefile was used). - // This means, we have to add the name (not the path) - // of the old dir and the relative path to the file - // to new dir. - append_to_new_dir - = old_dir.dirName () + "/" + rel_path_to_file; + QDir new_dir (new_name); + QString append_to_new_dir; + if (new_dir.exists ()) + { + // The new directory already exists (movefile was used). + // This means, we have to add the name (not the path) + // of the old dir and the relative path to the file + // to new dir. + append_to_new_dir + = old_dir.dirName () + "/" + rel_path_to_file; + } + else + append_to_new_dir = rel_path_to_file; + + f_data.new_file_name + = new_dir.absoluteFilePath (append_to_new_dir); } else - append_to_new_dir = rel_path_to_file; - - f_data.new_file_name - = new_dir.absoluteFilePath (append_to_new_dir); + f_data.new_file_name = ""; // no new name, just removing this file + + // Store data in list for later reloading + m_tmp_closed_files << f_data; } - else - f_data.new_file_name = ""; // no new name, just removing this file - - f_data.encoding = editor_tab->encoding (); // store the encoding - - // Store data in list for later reloading - m_tmp_closed_files << f_data; } } } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/file-editor.h Sun Apr 03 11:30:26 2022 -0400 @@ -89,6 +89,12 @@ } }; + struct removed_file_data + { + file_editor_tab *editor_tab; + QString new_file_name; + }; + file_editor (QWidget *p, base_qobject& oct_qobj); ~file_editor (void) = default; @@ -487,7 +493,7 @@ QPointer m_find_dialog; // List of data on temporarily closed files for later reloading. - QList m_tmp_closed_files; + QList m_tmp_closed_files; }; } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/find-dialog.cc --- a/libgui/src/m-editor/find-dialog.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/find-dialog.cc Sun Apr 03 11:30:26 2022 -0400 @@ -71,7 +71,6 @@ #include #include #include -#include #include #include #include @@ -83,6 +82,7 @@ #include "find-dialog.h" #include "gui-preferences-ed.h" +#include "gui-utils.h" #include "resource-manager.h" #include "octave-qobject.h" @@ -293,27 +293,21 @@ m_backward_check_box->setChecked (FIND_DLG_BACK & opts); m_search_selection_check_box->setChecked (FIND_DLG_SEL & opts); - // Position: lower right of editor's position + // Default position: lower right of editor's position int xp = ed_bottom_right.x () - sizeHint ().width (); int yp = ed_bottom_right.y () - sizeHint ().height (); - - m_last_position = s->value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint (); - move (m_last_position); + QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ()); - if (QApplication::desktop ()->screenNumber (this) == -1) - { - // Last used position is not on screen anymore, use default pos. - m_last_position = QPoint (xp, yp); - move (m_last_position); + // Last position from settings + m_last_position = s->value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint (); + QRect last_geometry (m_last_position, + QSize (sizeHint ().width (), sizeHint ().height ())); - if (QApplication::desktop ()->screenNumber (this) == -1) - { - // Default position is not on screen, last resort - m_last_position = QPoint (50, 100); // upper left - move (m_last_position); - } - } + // Make sure we are on the screen + adjust_to_screen (last_geometry, default_geometry); + m_last_position = last_geometry.topLeft (); + move (m_last_position); } // set text of "search from start" depending on backward search diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/m-editor/octave-qscintilla.cc Sun Apr 03 11:30:26 2022 -0400 @@ -948,8 +948,11 @@ // Remove line and column from first line of error message only // if it is related to the tmp itself, i.e. only if the - // the error stack size is 0 or 1 - if (stack.size () < 2) + // the error stack size is 0, 1, or, if in debug mode, 2 + size_t max_stack_size = 1; + if (dbg) + max_stack_size = 2; + if (stack.size () <= max_stack_size) { QRegExp rx ("source: error sourcing file [^\n]*$"); if (new_msg.contains (rx)) @@ -984,9 +987,12 @@ } } - // Drop first stack level, i.e. temporary function file + // Drop first stack level, which is the temporary function file, + // or, if in debug mode, drop first two stack levels if (stack.size () > 0) stack.pop_back (); + if (dbg && (stack.size () > 0)) + stack.pop_back (); // Clean up before throwing the modified error. emit ctx_menu_run_finished_signal (show_dbg_file, err_line, diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/main-window.cc Sun Apr 03 11:30:26 2022 -0400 @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -69,6 +68,7 @@ #include "gui-preferences-nr.h" #include "gui-preferences-sc.h" #include "gui-settings.h" +#include "gui-utils.h" #include "interpreter-qobject.h" #include "main-window.h" #include "news-reader.h" @@ -135,6 +135,8 @@ setObjectName (gui_obj_name_main_window); + rmgr.config_icon_theme (); + rmgr.update_network_settings (); // We provide specific terminal capabilities, so ensure that @@ -828,7 +830,6 @@ // Wait for worker to suspend qt_link->lock (); - // Close the file if opened #if defined (HAVE_QSCINTILLA) m_editor_window->handle_file_remove (o, n); @@ -2592,7 +2593,7 @@ m_main_tool_bar->addWidget (m_current_directory_combo_box); resource_manager& rmgr = m_octave_qobj.get_resource_manager (); QAction *current_dir_up - = m_main_tool_bar->addAction (rmgr.icon ("go-up"), + = m_main_tool_bar->addAction (rmgr.icon ("folder-up", false, "go-up"), tr ("One directory up")); QAction *current_dir_search = m_main_tool_bar->addAction (rmgr.icon ("folder"), @@ -2729,15 +2730,6 @@ }); } - // Get size of screen where the main window is located - void main_window::get_screen_geometry (int& width, int& height) - { - QRect screen_geometry = QApplication::desktop ()->availableGeometry (this); - - width = screen_geometry.width (); - height = screen_geometry.height (); - } - void main_window::resize_dock (QDockWidget *dw, int width, int height) { #if defined (HAVE_QMAINWINDOW_RESIZEDOCKS) diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/main-window.h --- a/libgui/src/main-window.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/main-window.h Sun Apr 03 11:30:26 2022 -0400 @@ -299,7 +299,6 @@ void update_default_encoding (const QString& default_encoding); - void get_screen_geometry (int& width, int& height); void set_default_geometry (void); void resize_dock (QDockWidget *dw, int width, int height); diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/module.mk --- a/libgui/src/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -1,113 +1,254 @@ octave_gui_ICONS = \ - %reldir%/icons/applications-system.png \ - %reldir%/icons/bookmark-new.png \ - %reldir%/icons/bottom_left_corner.png \ - %reldir%/icons/bottom_right_corner.png \ - %reldir%/icons/bottom_side.png \ - %reldir%/icons/bp-next.png \ - %reldir%/icons/bp-prev.png \ - %reldir%/icons/bp-rm-all.png \ - %reldir%/icons/bp-toggle.png \ - %reldir%/icons/circle.png \ - %reldir%/icons/cross.png \ - %reldir%/icons/db-cont.png \ - %reldir%/icons/db-step-in.png \ - %reldir%/icons/db-step-out.png \ - %reldir%/icons/db-step.png \ - %reldir%/icons/db-stop.png \ - %reldir%/icons/dialog-error.png \ - %reldir%/icons/dialog-information.png \ - %reldir%/icons/dialog-warning.png \ - %reldir%/icons/document-new.png \ - %reldir%/icons/document-open.png \ - %reldir%/icons/document-print.png \ - %reldir%/icons/document-save.png \ - %reldir%/icons/document-save-as.png \ - %reldir%/icons/edit-copy.png \ - %reldir%/icons/edit-cut.png \ - %reldir%/icons/edit-delete.png \ - %reldir%/icons/edit-find.png \ - %reldir%/icons/edit-find-replace.png \ - %reldir%/icons/edit-paste.png \ - %reldir%/icons/edit-redo.png \ - %reldir%/icons/edit-undo.png \ - %reldir%/icons/figure-axes.png \ - %reldir%/icons/figure-grid.png \ - %reldir%/icons/figure-pan.png \ - %reldir%/icons/figure-rotate.png \ - %reldir%/icons/figure-text.png \ - %reldir%/icons/figure-zoom-in.png \ - %reldir%/icons/figure-zoom-original.png \ - %reldir%/icons/figure-zoom-out.png \ - %reldir%/icons/fleur.png \ - %reldir%/icons/folder.png \ - %reldir%/icons/folder-new.png \ - %reldir%/icons/go-down.png \ - %reldir%/icons/go-first.png \ - %reldir%/icons/go-home.png \ - %reldir%/icons/go-last.png \ - %reldir%/icons/go-next.png \ - %reldir%/icons/go-previous.png \ - %reldir%/icons/go-up.png \ - %reldir%/icons/graphic_logo_DocumentationDockWidget.png \ - %reldir%/icons/graphic_logo_Figure.png \ - %reldir%/icons/graphic_logo_FileEditor.png \ - %reldir%/icons/graphic_logo_FilesDockWidget.png \ - %reldir%/icons/graphic_logo_HistoryDockWidget.png \ - %reldir%/icons/graphic_logo_NewsDockWidget.png \ - %reldir%/icons/graphic_logo_TerminalDockWidget.png \ - %reldir%/icons/graphic_logo_WorkspaceView.png \ - %reldir%/icons/graphic_logo_ReleaseWidget.png \ - %reldir%/icons/graphic_logo_VariableEditor.png \ - %reldir%/icons/graphic_logo_DocumentationDockWidget.svg \ - %reldir%/icons/graphic_logo_FileEditor.svg \ - %reldir%/icons/graphic_logo_FilesDockWidget.svg \ - %reldir%/icons/graphic_logo_HistoryDockWidget.svg \ - %reldir%/icons/graphic_logo_NewsDockWidget.svg \ - %reldir%/icons/graphic_logo_TerminalDockWidget.svg \ - %reldir%/icons/graphic_logo_WorkspaceView.svg \ - %reldir%/icons/graphic_logo_ReleaseWidget.svg \ - %reldir%/icons/graphic_logo_VariableEditor.svg \ - %reldir%/icons/hand2.png \ - %reldir%/icons/icons_license \ - %reldir%/icons/left_side.png \ - %reldir%/icons/letter_logo_DocumentationDockWidget.png \ - %reldir%/icons/letter_logo_FileEditor.png \ - %reldir%/icons/letter_logo_FilesDockWidget.png \ - %reldir%/icons/letter_logo_HistoryDockWidget.png \ - %reldir%/icons/letter_logo_NewsDockWidget.png \ - %reldir%/icons/letter_logo_TerminalDockWidget.png \ - %reldir%/icons/letter_logo_WorkspaceView.png \ - %reldir%/icons/letter_logo_ReleaseWidget.png \ - %reldir%/icons/letter_logo_VariableEditor.png \ - %reldir%/icons/letter_logo_DocumentationDockWidget.svg \ - %reldir%/icons/letter_logo_FileEditor.svg \ - %reldir%/icons/letter_logo_FilesDockWidget.svg \ - %reldir%/icons/letter_logo_HistoryDockWidget.svg \ - %reldir%/icons/letter_logo_NewsDockWidget.svg \ - %reldir%/icons/letter_logo_TerminalDockWidget.svg \ - %reldir%/icons/letter_logo_WorkspaceView.svg \ - %reldir%/icons/letter_logo_ReleaseWidget.svg \ - %reldir%/icons/letter_logo_VariableEditor.svg \ - %reldir%/icons/logo.png \ - %reldir%/icons/plot-xy-curve.png \ - %reldir%/icons/preferences-system.png \ - %reldir%/icons/right_side.png \ - %reldir%/icons/system-run.png \ - %reldir%/icons/top_left_corner.png \ - %reldir%/icons/top_right_corner.png \ - %reldir%/icons/top_side.png \ - %reldir%/icons/user-home.png \ - %reldir%/icons/view-refresh.png \ - %reldir%/icons/widget-close.png \ - %reldir%/icons/widget-dock.png \ - %reldir%/icons/widget-undock.png \ - %reldir%/icons/widget-close-light.png \ - %reldir%/icons/widget-dock-light.png \ - %reldir%/icons/widget-undock-light.png \ - %reldir%/icons/zoom-in.png \ - %reldir%/icons/zoom-original.png \ - %reldir%/icons/zoom-out.png + %reldir%/icons/license.md \ + %reldir%/icons/cursors/bottom_left_corner.png \ + %reldir%/icons/cursors/bottom_right_corner.png \ + %reldir%/icons/cursors/bottom_side.png \ + %reldir%/icons/cursors/circle.png \ + %reldir%/icons/cursors/cross.png \ + %reldir%/icons/cursors/fleur.png \ + %reldir%/icons/cursors/hand2.png \ + %reldir%/icons/cursors/left_side.png \ + %reldir%/icons/cursors/right_side.png \ + %reldir%/icons/cursors/top_left_corner.png \ + %reldir%/icons/cursors/top_right_corner.png \ + %reldir%/icons/cursors/top_side.png \ + %reldir%/icons/octave/index.theme \ + %reldir%/icons/octave/128x128/applications-system.png \ + %reldir%/icons/octave/128x128/bp-next.png \ + %reldir%/icons/octave/128x128/bp-prev.png \ + %reldir%/icons/octave/128x128/bp-rm-all.png \ + %reldir%/icons/octave/128x128/bp-toggle.png \ + %reldir%/icons/octave/128x128/bookmark-new.png \ + %reldir%/icons/octave/128x128/db-cont.png \ + %reldir%/icons/octave/128x128/db-step-in.png \ + %reldir%/icons/octave/128x128/db-step-out.png \ + %reldir%/icons/octave/128x128/db-step.png \ + %reldir%/icons/octave/128x128/db-stop.png \ + %reldir%/icons/octave/128x128/dialog-information.png \ + %reldir%/icons/octave/128x128/dialog-error.png \ + %reldir%/icons/octave/128x128/document-new.png \ + %reldir%/icons/octave/128x128/document-open.png \ + %reldir%/icons/octave/128x128/document-print.png \ + %reldir%/icons/octave/128x128/document-save-as.png \ + %reldir%/icons/octave/128x128/document-save.png \ + %reldir%/icons/octave/128x128/edit-copy.png \ + %reldir%/icons/octave/128x128/edit-cut.png \ + %reldir%/icons/octave/128x128/edit-find-replace.png \ + %reldir%/icons/octave/128x128/edit-find.png \ + %reldir%/icons/octave/128x128/edit-paste.png \ + %reldir%/icons/octave/128x128/edit-redo.png \ + %reldir%/icons/octave/128x128/edit-undo.png \ + %reldir%/icons/octave/128x128/figure-axes.png \ + %reldir%/icons/octave/128x128/figure-grid.png \ + %reldir%/icons/octave/128x128/figure-pan.png \ + %reldir%/icons/octave/128x128/figure-rotate.png \ + %reldir%/icons/octave/128x128/figure-text.png \ + %reldir%/icons/octave/128x128/figure-zoom-in.png \ + %reldir%/icons/octave/128x128/figure-zoom-original.png \ + %reldir%/icons/octave/128x128/figure-zoom-out.png \ + %reldir%/icons/octave/128x128/folder-new.png \ + %reldir%/icons/octave/128x128/folder-settings.png \ + %reldir%/icons/octave/128x128/folder-up.png \ + %reldir%/icons/octave/128x128/folder.png \ + %reldir%/icons/octave/128x128/go-down.png \ + %reldir%/icons/octave/128x128/go-first.png \ + %reldir%/icons/octave/128x128/go-home.png \ + %reldir%/icons/octave/128x128/go-last.png \ + %reldir%/icons/octave/128x128/go-next.png \ + %reldir%/icons/octave/128x128/go-previous.png \ + %reldir%/icons/octave/128x128/go-up.png \ + %reldir%/icons/octave/128x128/graphic_logo_DocumentationDockWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_Figure.png \ + %reldir%/icons/octave/128x128/graphic_logo_FileEditor.png \ + %reldir%/icons/octave/128x128/graphic_logo_FilesDockWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_HistoryDockWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_NewsDockWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_ReleaseWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_TerminalDockWidget.png \ + %reldir%/icons/octave/128x128/graphic_logo_VariableEditor.png \ + %reldir%/icons/octave/128x128/graphic_logo_WorkspaceView.png \ + %reldir%/icons/octave/128x128/letter_logo_DocumentationDockWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_FileEditor.png \ + %reldir%/icons/octave/128x128/letter_logo_FilesDockWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_HistoryDockWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_NewsDockWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_ReleaseWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_TerminalDockWidget.png \ + %reldir%/icons/octave/128x128/letter_logo_VariableEditor.png \ + %reldir%/icons/octave/128x128/letter_logo_WorkspaceView.png \ + %reldir%/icons/octave/128x128/logo.png \ + %reldir%/icons/octave/128x128/plot-xy-curve.png \ + %reldir%/icons/octave/128x128/system-run.png \ + %reldir%/icons/octave/128x128/user-home.png \ + %reldir%/icons/octave/128x128/view-zoom-in.png \ + %reldir%/icons/octave/128x128/view-zoom-original.png \ + %reldir%/icons/octave/128x128/view-zoom-out.png \ + %reldir%/icons/octave/128x128/widget-close-light.png \ + %reldir%/icons/octave/128x128/widget-close.png \ + %reldir%/icons/octave/128x128/widget-dock-light.png \ + %reldir%/icons/octave/128x128/widget-dock.png \ + %reldir%/icons/octave/128x128/widget-undock-light.png \ + %reldir%/icons/octave/128x128/widget-undock.png \ + %reldir%/icons/octave/scalable/applications-system.svg \ + %reldir%/icons/octave/scalable/bookmark-new.svg \ + %reldir%/icons/octave/scalable/bp-next.svg \ + %reldir%/icons/octave/scalable/bp-prev.svg \ + %reldir%/icons/octave/scalable/bp-rm-all.svg \ + %reldir%/icons/octave/scalable/bp-toggle.svg \ + %reldir%/icons/octave/scalable/db-cont.svg \ + %reldir%/icons/octave/scalable/db-step-in.svg \ + %reldir%/icons/octave/scalable/db-step-out.svg \ + %reldir%/icons/octave/scalable/db-step.svg \ + %reldir%/icons/octave/scalable/db-stop.svg \ + %reldir%/icons/octave/scalable/dialog-information.svg \ + %reldir%/icons/octave/scalable/dialog-error.svg \ + %reldir%/icons/octave/scalable/document-new.svg \ + %reldir%/icons/octave/scalable/document-open.svg \ + %reldir%/icons/octave/scalable/document-print.svg \ + %reldir%/icons/octave/scalable/document-save-as.svg \ + %reldir%/icons/octave/scalable/document-save.svg \ + %reldir%/icons/octave/scalable/edit-copy.svg \ + %reldir%/icons/octave/scalable/edit-cut.svg \ + %reldir%/icons/octave/scalable/edit-find-replace.svg \ + %reldir%/icons/octave/scalable/edit-find.svg \ + %reldir%/icons/octave/scalable/edit-paste.svg \ + %reldir%/icons/octave/scalable/edit-redo.svg \ + %reldir%/icons/octave/scalable/edit-undo.svg \ + %reldir%/icons/octave/scalable/figure-axes.svg \ + %reldir%/icons/octave/scalable/figure-grid.svg \ + %reldir%/icons/octave/scalable/figure-pan.svg \ + %reldir%/icons/octave/scalable/figure-rotate.svg \ + %reldir%/icons/octave/scalable/figure-text.svg \ + %reldir%/icons/octave/scalable/figure-zoom-in.svg \ + %reldir%/icons/octave/scalable/figure-zoom-original.svg \ + %reldir%/icons/octave/scalable/figure-zoom-out.svg \ + %reldir%/icons/octave/scalable/folder-new.svg \ + %reldir%/icons/octave/scalable/folder-settings.svg \ + %reldir%/icons/octave/scalable/folder-up.svg \ + %reldir%/icons/octave/scalable/folder.svg \ + %reldir%/icons/octave/scalable/go-down.svg \ + %reldir%/icons/octave/scalable/go-first.svg \ + %reldir%/icons/octave/scalable/go-home.svg \ + %reldir%/icons/octave/scalable/go-last.svg \ + %reldir%/icons/octave/scalable/go-next.svg \ + %reldir%/icons/octave/scalable/go-previous.svg \ + %reldir%/icons/octave/scalable/go-up.svg \ + %reldir%/icons/octave/scalable/graphic_logo_DocumentationDockWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_Figure.svg \ + %reldir%/icons/octave/scalable/graphic_logo_FileEditor.svg \ + %reldir%/icons/octave/scalable/graphic_logo_FilesDockWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_HistoryDockWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_NewsDockWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_ReleaseWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_TerminalDockWidget.svg \ + %reldir%/icons/octave/scalable/graphic_logo_VariableEditor.svg \ + %reldir%/icons/octave/scalable/graphic_logo_WorkspaceView.svg \ + %reldir%/icons/octave/scalable/letter_logo_DocumentationDockWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_FileEditor.svg \ + %reldir%/icons/octave/scalable/letter_logo_FilesDockWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_HistoryDockWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_NewsDockWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_ReleaseWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_TerminalDockWidget.svg \ + %reldir%/icons/octave/scalable/letter_logo_VariableEditor.svg \ + %reldir%/icons/octave/scalable/letter_logo_WorkspaceView.svg \ + %reldir%/icons/octave/scalable/plot-xy-curve.svg \ + %reldir%/icons/octave/scalable/system-run.svg \ + %reldir%/icons/octave/scalable/user-home.svg \ + %reldir%/icons/octave/scalable/view-zoom-in.svg \ + %reldir%/icons/octave/scalable/view-zoom-original.svg \ + %reldir%/icons/octave/scalable/view-zoom-out.svg \ + %reldir%/icons/octave/scalable/widget-close-light.svg \ + %reldir%/icons/octave/scalable/widget-close.svg \ + %reldir%/icons/octave/scalable/widget-dock-light.svg \ + %reldir%/icons/octave/scalable/widget-dock.svg \ + %reldir%/icons/octave/scalable/widget-undock-light.svg \ + %reldir%/icons/octave/scalable/widget-undock.svg \ + %reldir%/icons/tango/index.theme \ + %reldir%/icons/tango/128x128/applications-system.png \ + %reldir%/icons/tango/128x128/bookmark-new.png \ + %reldir%/icons/tango/128x128/bp-next.png \ + %reldir%/icons/tango/128x128/bp-prev.png \ + %reldir%/icons/tango/128x128/bp-rm-all.png \ + %reldir%/icons/tango/128x128/bp-toggle.png \ + %reldir%/icons/tango/128x128/db-cont.png \ + %reldir%/icons/tango/128x128/db-step-in.png \ + %reldir%/icons/tango/128x128/db-step-out.png \ + %reldir%/icons/tango/128x128/db-step.png \ + %reldir%/icons/tango/128x128/db-stop.png \ + %reldir%/icons/tango/128x128/dialog-error.png \ + %reldir%/icons/tango/128x128/dialog-information.png \ + %reldir%/icons/tango/128x128/dialog-warning.png \ + %reldir%/icons/tango/128x128/document-new.png \ + %reldir%/icons/tango/128x128/document-open.png \ + %reldir%/icons/tango/128x128/document-print.png \ + %reldir%/icons/tango/128x128/document-save.png \ + %reldir%/icons/tango/128x128/document-save-as.png \ + %reldir%/icons/tango/128x128/edit-copy.png \ + %reldir%/icons/tango/128x128/edit-cut.png \ + %reldir%/icons/tango/128x128/edit-delete.png \ + %reldir%/icons/tango/128x128/edit-find-replace.png \ + %reldir%/icons/tango/128x128/edit-find.png \ + %reldir%/icons/tango/128x128/edit-paste.png \ + %reldir%/icons/tango/128x128/edit-redo.png \ + %reldir%/icons/tango/128x128/edit-undo.png \ + %reldir%/icons/tango/128x128/folder-new.png \ + %reldir%/icons/tango/128x128/folder.png \ + %reldir%/icons/tango/128x128/go-down.png \ + %reldir%/icons/tango/128x128/go-first.png \ + %reldir%/icons/tango/128x128/go-home.png \ + %reldir%/icons/tango/128x128/go-last.png \ + %reldir%/icons/tango/128x128/go-next.png \ + %reldir%/icons/tango/128x128/go-previous.png \ + %reldir%/icons/tango/128x128/go-up.png \ + %reldir%/icons/tango/128x128/preferences-system.png \ + %reldir%/icons/tango/128x128/user-home.png \ + %reldir%/icons/tango/128x128/view-refresh.png \ + %reldir%/icons/tango/128x128/view-zoom-in.png \ + %reldir%/icons/tango/128x128/view-zoom-original.png \ + %reldir%/icons/tango/128x128/view-zoom-out.png \ + %reldir%/icons/tango/scalable/applications-system.svg \ + %reldir%/icons/tango/scalable/bookmark-new.svg \ + %reldir%/icons/tango/scalable/bp-next.svg \ + %reldir%/icons/tango/scalable/bp-prev.svg \ + %reldir%/icons/tango/scalable/bp-rm-all.svg \ + %reldir%/icons/tango/scalable/bp-toggle.svg \ + %reldir%/icons/tango/scalable/db-cont.svg \ + %reldir%/icons/tango/scalable/db-step-in.svg \ + %reldir%/icons/tango/scalable/db-step-out.svg \ + %reldir%/icons/tango/scalable/db-step.svg \ + %reldir%/icons/tango/scalable/db-stop.svg \ + %reldir%/icons/tango/scalable/dialog-error.svg \ + %reldir%/icons/tango/scalable/dialog-information.svg \ + %reldir%/icons/tango/scalable/dialog-warning.svg \ + %reldir%/icons/tango/scalable/document-new.svg \ + %reldir%/icons/tango/scalable/document-open.svg \ + %reldir%/icons/tango/scalable/document-print.svg \ + %reldir%/icons/tango/scalable/document-save.svg \ + %reldir%/icons/tango/scalable/document-save-as.svg \ + %reldir%/icons/tango/scalable/edit-copy.svg \ + %reldir%/icons/tango/scalable/edit-cut.svg \ + %reldir%/icons/tango/scalable/edit-delete.svg \ + %reldir%/icons/tango/scalable/edit-find-replace.svg \ + %reldir%/icons/tango/scalable/edit-find.svg \ + %reldir%/icons/tango/scalable/edit-paste.svg \ + %reldir%/icons/tango/scalable/edit-redo.svg \ + %reldir%/icons/tango/scalable/edit-undo.svg \ + %reldir%/icons/tango/scalable/folder-new.svg \ + %reldir%/icons/tango/scalable/folder.svg \ + %reldir%/icons/tango/scalable/go-down.svg \ + %reldir%/icons/tango/scalable/go-first.svg \ + %reldir%/icons/tango/scalable/go-home.svg \ + %reldir%/icons/tango/scalable/go-last.svg \ + %reldir%/icons/tango/scalable/go-next.svg \ + %reldir%/icons/tango/scalable/go-previous.svg \ + %reldir%/icons/tango/scalable/go-up.svg \ + %reldir%/icons/tango/scalable/preferences-system.svg \ + %reldir%/icons/tango/scalable/user-home.svg \ + %reldir%/icons/tango/scalable/view-refresh.svg \ + %reldir%/icons/tango/scalable/view-zoom-in.svg \ + %reldir%/icons/tango/scalable/view-zoom-original.svg \ + %reldir%/icons/tango/scalable/view-zoom-out.svg octave_gui_MOC = diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/octave-dock-widget.cc --- a/libgui/src/octave-dock-widget.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/octave-dock-widget.cc Sun Apr 03 11:30:26 2022 -0400 @@ -29,18 +29,20 @@ #include #include -#include #include #include +#include #include #include #include +#include #include "gui-preferences-dw.h" #include "gui-preferences-global.h" #include "gui-preferences-mw.h" #include "gui-preferences-sc.h" #include "gui-settings.h" +#include "gui-utils.h" #include "main-window.h" #include "octave-dock-widget.h" #include "octave-qobject.h" @@ -71,11 +73,13 @@ } } + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + // the custom (extra) title bar of the widget m_title_widget = new QWidget (); m_dock_action = new QAction - (QIcon (":/actions/icons/widget-undock.png"), "", this); + (rmgr.icon ("widget-undock", true), "", this); m_dock_action->setToolTip (tr ("Undock widget")); m_dock_button = new QToolButton (m_title_widget); m_dock_button->setDefaultAction (m_dock_action); @@ -83,7 +87,7 @@ m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size)); m_close_action = new QAction - (QIcon (":/actions/icons/widget-close.png"), "", this); + (rmgr.icon ("widget-close", true), "", this); m_close_action->setToolTip (tr ("Close widget")); m_close_button = new QToolButton (m_title_widget); m_close_button->setDefaultAction (m_close_action); @@ -231,13 +235,15 @@ m_close_action->setToolTip (tr ("Hide widget")); - setStyleSheet (qdockwidget_css (QString (":/actions/icons/widget-close.png"), - QString ("Close widget"), - QString (":/actions/icons/widget-undock.png"), - QString ("Undock widget"), - m_icon_size, - QString (""), - QString (""))); + setStyleSheet (qdockwidget_css ( + global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png", + QString ("Close widget"), + global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-undock.png", + QString ("Undock widget"), + m_icon_size, + QString (""), + QString (""))); + if (widget ()) widget ()->setToolTip (QString ("")); @@ -309,8 +315,8 @@ // adjust the (un)dock icon if (titleBarWidget ()) { - m_dock_action->setIcon (QIcon (":/actions/icons/widget-dock" - + m_icon_color + ".png")); + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); + m_dock_action->setIcon (rmgr.icon ("widget-dock" + m_icon_color, true)); m_dock_action->setToolTip (tr ("Dock widget")); } else @@ -368,8 +374,7 @@ this, &octave_dock_widget::make_window); if (titleBarWidget ()) { - m_dock_action->setIcon (QIcon (":/actions/icons/widget-undock" - + m_icon_color + ".png")); + m_dock_action->setIcon (rmgr.icon ("widget-undock" + m_icon_color, true)); m_dock_action->setToolTip (tr ("Undock widget")); } else @@ -513,12 +518,8 @@ m_icon_color_active = ""; - QWidget *ref_widget = m_main_window; - if (! ref_widget) - ref_widget = this; - int x, y, w, h; - QApplication::desktop ()->availableGeometry (ref_widget).getRect (&x, &y, &w, &h); + QGuiApplication::primaryScreen ()->availableGeometry ().getRect (&x, &y, &w, &h); QRect default_floating_size = QRect (x+16, y+32, w/3, h/2); QRect default_dock_size; @@ -538,11 +539,7 @@ = settings->value (dw_float_geometry.key.arg (objectName ()), default_floating_size).toRect (); - QWidget dummy; - dummy.setGeometry (m_recent_float_geom); - - if (QApplication::desktop ()->screenNumber (&dummy) == -1) - m_recent_float_geom = default_floating_size; + adjust_to_screen (m_recent_float_geom, default_floating_size); // The following is required for ensure smooth transition from old // saveGeomety to new QRect setting (see comment for restoring size @@ -804,22 +801,23 @@ css_background = QString (""); } - QString full_dock_icon = ":/actions/icons/" + dock_icon + icon_col + ".png"; - QString full_close_icon = ":/actions/icons/widget-close" + icon_col + ".png"; + QString full_dock_icon = dock_icon + icon_col; + QString full_close_icon = "widget-close" + icon_col; if (titleBarWidget ()) { + resource_manager& rmgr = m_octave_qobj.get_resource_manager (); titleBarWidget ()->setStyleSheet (css_foreground + css_background); css_button = QString ("QToolButton {background: transparent; border: 0px;}"); m_dock_button->setStyleSheet (css_button); m_close_button->setStyleSheet (css_button); - m_dock_action->setIcon (QIcon (full_dock_icon)); - m_close_action->setIcon (QIcon (full_close_icon)); + m_dock_action->setIcon (rmgr.icon (full_dock_icon, true)); + m_close_action->setIcon (rmgr.icon (full_close_icon, true)); } else { - setStyleSheet (qdockwidget_css (full_close_icon, + setStyleSheet (qdockwidget_css (global_icon_paths.at (ICON_THEME_OCTAVE) + full_close_icon + ".png", close_tooltip, - full_dock_icon, + global_icon_paths.at (ICON_THEME_OCTAVE) + full_dock_icon + ".png", dock_tooltip, m_icon_size, css_foreground, diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/octave-qobject.cc --- a/libgui/src/octave-qobject.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/octave-qobject.cc Sun Apr 03 11:30:26 2022 -0400 @@ -313,6 +313,7 @@ // After settings. config_translators (); + m_resource_manager.config_icon_theme (); // Initilize the shortcut-manager m_shortcut_manager.init_data (); diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/release-notes.cc --- a/libgui/src/release-notes.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/release-notes.cc Sun Apr 03 11:30:26 2022 -0400 @@ -27,15 +27,17 @@ # include "config.h" #endif -#include +#include #include #include #include +#include #include #include #include #include "release-notes.h" +#include "gui-utils.h" #include "gui-preferences-nr.h" #include "news-reader.h" #include "octave-qobject.h" @@ -116,14 +118,4 @@ activateWindow (); } - // FIXME: This function is duplicated in main_window.cc. Maybe it - // should be a utility function? - - void release_notes::get_screen_geometry (int& width, int& height) - { - QRect screen_geometry = QApplication::desktop ()->availableGeometry (this); - - width = screen_geometry.width (); - height = screen_geometry.height (); - } } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/release-notes.h --- a/libgui/src/release-notes.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/release-notes.h Sun Apr 03 11:30:26 2022 -0400 @@ -51,8 +51,6 @@ private: - void get_screen_geometry (int& width, int& height); - QTextBrowser *m_browser; QString m_release_notes_icon; }; diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/resource-manager.cc --- a/libgui/src/resource-manager.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/resource-manager.cc Sun Apr 03 11:30:26 2022 -0400 @@ -27,6 +27,8 @@ # include "config.h" #endif +#include + #include #include #include @@ -38,11 +40,7 @@ #include #include #include -#if defined (HAVE_QSTANDARDPATHS) -# include -#else -# include -#endif +#include #include @@ -67,7 +65,7 @@ { resource_manager::resource_manager (void) : m_settings_directory (), m_settings_file (), m_settings (nullptr), - m_default_settings (nullptr), m_temporary_files () + m_default_settings (nullptr), m_temporary_files (), m_icon_fallbacks () { // Let gui_settings decide where to put the ini file with gui preferences m_default_settings @@ -185,6 +183,52 @@ } + void resource_manager::config_icon_theme (void) + { + m_icon_fallbacks.clear (); + + int theme = global_icon_theme_index.def.toInt (); + + if (m_settings) + { + // check for new and old setting and use old if required + if (! m_settings->contains (global_icon_theme_index.key)) + { + // new pref does not exist + if (m_settings->value (global_icon_theme).toBool ()) + theme = ICON_THEME_SYSTEM; + else + theme = ICON_THEME_OCTAVE; + m_settings->setValue (global_icon_theme_index.key, theme); // add new + m_settings->remove (global_icon_theme.key); // remove deprecated key + } + else + { + // get new settings + theme = m_settings->value (global_icon_theme_index).toInt (); + } + } + + QIcon::setThemeName (global_all_icon_themes.at (theme)); + + // set the required fallback search paths + switch (theme) + { + case ICON_THEME_SYSTEM: + m_icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE); + m_icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO); + break; + case ICON_THEME_TANGO: + m_icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE); + break; + case ICON_THEME_OCTAVE: + m_icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO); + break; + } + + m_icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS); + } + gui_settings * resource_manager::get_settings (void) const { return m_settings; @@ -581,19 +625,26 @@ sys::env::putenv ("HTTPS_PROXY", proxy_url_str); } - QIcon resource_manager::icon (const QString& icon_name, bool fallback) + QIcon resource_manager::icon (const QString& icon_name, bool octave_only, + const QString& icon_alt_name) { - // If system icon theme is not desired, take own icon files - if (! m_settings->value (global_icon_theme).toBool ()) - return QIcon (":/actions/icons/" + icon_name + ".png"); + if (octave_only) + return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png"); - // Use system icon theme with own files as fallback except when the - // fallback is explicitly disabled (fallback=false) - if (fallback) - return QIcon::fromTheme (icon_name, - QIcon (":/actions/icons/" + icon_name + ".png")); - else - return QIcon::fromTheme (icon_name); + if (QIcon::hasThemeIcon (icon_name)) + return QIcon (QIcon::fromTheme (icon_name)); + else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name)) + return QIcon (QIcon::fromTheme (icon_alt_name)); + + for (int i = 0; i < m_icon_fallbacks.length (); i++ ) + { + QString icon_file (m_icon_fallbacks.at (i) + icon_name + ".png"); + if (QFile (icon_file).exists ()) + return QIcon (icon_file); + } + + //QIcon::setThemeName (current_theme); + return QIcon (); } // get a list of all available encodings @@ -676,6 +727,7 @@ combo->setMaxVisibleItems (12); } + QPointer resource_manager::create_tmp_file (const QString& extension, const QString& contents) @@ -685,8 +737,7 @@ ext = QString (".") + ext; // Create octave dir within temp. dir - QString tmp_dir = QDir::tempPath () + QDir::separator() + "octave"; - QDir::temp ().mkdir ("octave"); + QString tmp_dir = QString::fromStdString (sys::env::get_temp_directory ()); // Create temp. file QPointer tmp_file diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/resource-manager.h --- a/libgui/src/resource-manager.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/resource-manager.h Sun Apr 03 11:30:26 2022 -0400 @@ -61,6 +61,7 @@ void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr, QTranslator *gui_tr); + void config_icon_theme (void); gui_settings * get_settings (void) const; @@ -96,7 +97,8 @@ void update_network_settings (void); - QIcon icon (const QString& icon_name, bool fallback = true); + QIcon icon (const QString& icon_name, bool octave_only = false, + const QString& icon_alt_name = QString ()); void get_codecs (QStringList *codecs); @@ -122,6 +124,8 @@ gui_settings *m_default_settings; QList m_temporary_files; + + QStringList m_icon_fallbacks; }; } diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/resource.qrc --- a/libgui/src/resource.qrc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/resource.qrc Sun Apr 03 11:30:26 2022 -0400 @@ -1,94 +1,136 @@ - - icons/applications-system.png - icons/bookmark-new.png - icons/bp-toggle.png - icons/bp-rm-all.png - icons/bp-prev.png - icons/bp-next.png - icons/bottom_left_corner.png - icons/bottom_right_corner.png - icons/bottom_side.png - icons/circle.png - icons/cross.png - icons/db-cont.png - icons/db-step.png - icons/db-step-in.png - icons/db-step-out.png - icons/db-stop.png - icons/dialog-error.png - icons/dialog-information.png - icons/dialog-warning.png - icons/document-new.png - icons/document-open.png - icons/document-print.png - icons/document-save.png - icons/document-save-as.png - icons/edit-copy.png - icons/edit-cut.png - icons/edit-delete.png - icons/edit-find.png - icons/edit-find-replace.png - icons/edit-paste.png - icons/edit-redo.png - icons/edit-undo.png - icons/figure-axes.png - icons/figure-grid.png - icons/figure-pan.png - icons/figure-rotate.png - icons/figure-text.png - icons/figure-zoom-in.png - icons/figure-zoom-original.png - icons/figure-zoom-out.png - icons/folder.png - icons/folder-new.png - icons/go-down.png - icons/go-first.png - icons/go-home.png - icons/go-last.png - icons/go-next.png - icons/go-previous.png - icons/go-up.png - icons/graphic_logo_FilesDockWidget.png - icons/graphic_logo_Figure.png - icons/graphic_logo_FileEditor.png - icons/graphic_logo_NewsDockWidget.png - icons/graphic_logo_TerminalDockWidget.png - icons/graphic_logo_HistoryDockWidget.png - icons/graphic_logo_WorkspaceView.png - icons/graphic_logo_DocumentationDockWidget.png - icons/graphic_logo_ReleaseWidget.png - icons/graphic_logo_VariableEditor.png - icons/fleur.png - icons/hand2.png - icons/left_side.png - icons/letter_logo_FilesDockWidget.png - icons/letter_logo_FileEditor.png - icons/letter_logo_NewsDockWidget.png - icons/letter_logo_TerminalDockWidget.png - icons/letter_logo_HistoryDockWidget.png - icons/letter_logo_WorkspaceView.png - icons/letter_logo_DocumentationDockWidget.png - icons/letter_logo_ReleaseWidget.png - icons/letter_logo_VariableEditor.png - icons/logo.png - icons/plot-xy-curve.png - icons/preferences-system.png - icons/right_side.png - icons/system-run.png - icons/top_left_corner.png - icons/top_right_corner.png - icons/top_side.png - icons/user-home.png - icons/view-refresh.png - icons/widget-close.png - icons/widget-dock.png - icons/widget-undock.png - icons/widget-close-light.png - icons/widget-dock-light.png - icons/widget-undock-light.png - icons/zoom-in.png - icons/zoom-original.png - icons/zoom-out.png + + icons/cursors/bottom_left_corner.png + icons/cursors/bottom_right_corner.png + icons/cursors/bottom_side.png + icons/cursors/circle.png + icons/cursors/cross.png + icons/cursors/fleur.png + icons/cursors/hand2.png + icons/cursors/left_side.png + icons/cursors/right_side.png + icons/cursors/top_left_corner.png + icons/cursors/top_right_corner.png + icons/cursors/top_side.png + icons/octave/128x128/applications-system.png + icons/octave/128x128/bookmark-new.png + icons/octave/128x128/bp-toggle.png + icons/octave/128x128/bp-rm-all.png + icons/octave/128x128/bp-prev.png + icons/octave/128x128/bp-next.png + icons/octave/128x128/db-cont.png + icons/octave/128x128/db-step.png + icons/octave/128x128/db-step-in.png + icons/octave/128x128/db-step-out.png + icons/octave/128x128/db-stop.png + icons/octave/128x128/dialog-information.png + icons/octave/128x128/dialog-error.png + icons/octave/128x128/document-new.png + icons/octave/128x128/document-open.png + icons/octave/128x128/document-print.png + icons/octave/128x128/document-save-as.png + icons/octave/128x128/document-save.png + icons/octave/128x128/edit-copy.png + icons/octave/128x128/edit-cut.png + icons/octave/128x128/edit-find-replace.png + icons/octave/128x128/edit-find.png + icons/octave/128x128/edit-paste.png + icons/octave/128x128/edit-redo.png + icons/octave/128x128/edit-undo.png + icons/octave/128x128/figure-axes.png + icons/octave/128x128/figure-grid.png + icons/octave/128x128/figure-pan.png + icons/octave/128x128/figure-rotate.png + icons/octave/128x128/figure-text.png + icons/octave/128x128/figure-zoom-in.png + icons/octave/128x128/figure-zoom-original.png + icons/octave/128x128/figure-zoom-out.png + icons/octave/128x128/folder.png + icons/octave/128x128/folder-new.png + icons/octave/128x128/folder-settings.png + icons/octave/128x128/folder-up.png + icons/octave/128x128/go-down.png + icons/octave/128x128/go-first.png + icons/octave/128x128/go-home.png + icons/octave/128x128/go-last.png + icons/octave/128x128/go-next.png + icons/octave/128x128/go-previous.png + icons/octave/128x128/go-up.png + icons/octave/128x128/graphic_logo_FilesDockWidget.png + icons/octave/128x128/graphic_logo_Figure.png + icons/octave/128x128/graphic_logo_FileEditor.png + icons/octave/128x128/graphic_logo_NewsDockWidget.png + icons/octave/128x128/graphic_logo_TerminalDockWidget.png + icons/octave/128x128/graphic_logo_HistoryDockWidget.png + icons/octave/128x128/graphic_logo_WorkspaceView.png + icons/octave/128x128/graphic_logo_DocumentationDockWidget.png + icons/octave/128x128/graphic_logo_ReleaseWidget.png + icons/octave/128x128/graphic_logo_VariableEditor.png + icons/octave/128x128/letter_logo_FilesDockWidget.png + icons/octave/128x128/letter_logo_FileEditor.png + icons/octave/128x128/letter_logo_NewsDockWidget.png + icons/octave/128x128/letter_logo_TerminalDockWidget.png + icons/octave/128x128/letter_logo_HistoryDockWidget.png + icons/octave/128x128/letter_logo_WorkspaceView.png + icons/octave/128x128/letter_logo_DocumentationDockWidget.png + icons/octave/128x128/letter_logo_ReleaseWidget.png + icons/octave/128x128/letter_logo_VariableEditor.png + icons/octave/128x128/logo.png + icons/octave/128x128/plot-xy-curve.png + icons/octave/128x128/system-run.png + icons/octave/128x128/user-home.png + icons/octave/128x128/view-zoom-in.png + icons/octave/128x128/view-zoom-original.png + icons/octave/128x128/view-zoom-out.png + icons/octave/128x128/widget-close.png + icons/octave/128x128/widget-dock.png + icons/octave/128x128/widget-undock.png + icons/octave/128x128/widget-close-light.png + icons/octave/128x128/widget-dock-light.png + icons/octave/128x128/widget-undock-light.png + icons/octave/index.theme + icons/tango/128x128/applications-system.png + icons/tango/128x128/bookmark-new.png + icons/tango/128x128/bp-toggle.png + icons/tango/128x128/bp-rm-all.png + icons/tango/128x128/bp-prev.png + icons/tango/128x128/bp-next.png + icons/tango/128x128/db-cont.png + icons/tango/128x128/db-step.png + icons/tango/128x128/db-step-in.png + icons/tango/128x128/db-step-out.png + icons/tango/128x128/db-stop.png + icons/tango/128x128/dialog-error.png + icons/tango/128x128/dialog-information.png + icons/tango/128x128/dialog-warning.png + icons/tango/128x128/document-new.png + icons/tango/128x128/document-open.png + icons/tango/128x128/document-print.png + icons/tango/128x128/document-save.png + icons/tango/128x128/document-save-as.png + icons/tango/128x128/edit-copy.png + icons/tango/128x128/edit-cut.png + icons/tango/128x128/edit-delete.png + icons/tango/128x128/edit-find.png + icons/tango/128x128/edit-find-replace.png + icons/tango/128x128/edit-paste.png + icons/tango/128x128/edit-redo.png + icons/tango/128x128/edit-undo.png + icons/tango/128x128/folder.png + icons/tango/128x128/folder-new.png + icons/tango/128x128/go-down.png + icons/tango/128x128/go-first.png + icons/tango/128x128/go-home.png + icons/tango/128x128/go-last.png + icons/tango/128x128/go-next.png + icons/tango/128x128/go-previous.png + icons/tango/128x128/go-up.png + icons/tango/128x128/preferences-system.png + icons/tango/128x128/user-home.png + icons/tango/128x128/view-refresh.png + icons/tango/128x128/view-zoom-in.png + icons/tango/128x128/view-zoom-original.png + icons/tango/128x128/view-zoom-out.png + icons/tango/index.theme diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/settings-dialog.cc Sun Apr 03 11:30:26 2022 -0400 @@ -137,7 +137,9 @@ icon_size_normal->setChecked (true); // the default icon_size_small->setChecked (icon_size < 0); icon_size_large->setChecked (icon_size > 0); - cb_system_icon_theme->setChecked (settings->value (global_icon_theme).toBool ()); + combo_box_icon_theme->addItems (global_all_icon_theme_names); + int theme = settings->value (global_icon_theme_index.key).toInt (); + combo_box_icon_theme->setCurrentIndex (theme); // which icon has to be selected QButtonGroup *icon_group = new QButtonGroup (this); @@ -1020,7 +1022,7 @@ // icon size and theme int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked (); settings->setValue (global_icon_size.key, icon_size); - settings->setValue (global_icon_theme.key, cb_system_icon_theme->isChecked ()); + settings->setValue (global_icon_theme_index.key, combo_box_icon_theme->currentIndex ()); // native file dialogs settings->setValue (global_use_native_dialogs.key, cb_use_native_file_dialogs->isChecked ()); diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/settings-dialog.ui Sun Apr 03 11:30:26 2022 -0400 @@ -35,7 +35,7 @@ - 6 + 0 @@ -55,8 +55,8 @@ 0 0 - 657 - 629 + 1021 + 618 @@ -68,30 +68,44 @@ - - + + + + Dock widget title bar + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Dock widgets window icons + + + + + + + Style + + + + + - + 135 0 - - QComboBox::InsertAtBottom - - - - (requires restart) - - - - - + Qt::Horizontal @@ -105,19 +119,26 @@ - - + + - Dock widget title bar - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Language - - + + + + + Icon theme (requires restart) + + + + + + + @@ -143,58 +164,10 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Use system icon theme if available (requires restart) - - - - - - - - - - - Octave logo only - - - true - - - - - - - Letter icons - - - - - - - Graphic icons - - - - - + + Qt::Horizontal @@ -208,23 +181,6 @@ - - - - Toolbar Icons - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Icon set for dock widgets - - - @@ -387,27 +343,40 @@ - - + + - Language + Toolbar Icons + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + + - + 135 0 + + QComboBox::InsertAtBottom + - + + + (requires restart) + + + + + Qt::Horizontal @@ -421,12 +390,46 @@ - - - - Style - - + + + + + + Octave logo only + + + true + + + + + + + Letter icons + + + + + + + Graphic icons + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -584,8 +587,8 @@ 0 0 - 668 - 267 + 1035 + 569 @@ -865,8 +868,8 @@ 0 0 - 765 - 1515 + 1021 + 1497 @@ -2173,8 +2176,8 @@ 0 0 - 595 - 410 + 1035 + 569 @@ -2323,8 +2326,8 @@ 0 0 - 259 - 67 + 1035 + 569 @@ -2385,8 +2388,8 @@ 0 0 - 605 - 233 + 1035 + 569 @@ -2770,8 +2773,8 @@ 0 0 - 703 - 310 + 1035 + 569 diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/terminal-dock-widget.cc --- a/libgui/src/terminal-dock-widget.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/terminal-dock-widget.cc Sun Apr 03 11:30:26 2022 -0400 @@ -27,7 +27,7 @@ # include "config.h" #endif -#include +#include // This header is only needed for the new terminal widget. #include "command-widget.h" @@ -107,8 +107,8 @@ int win_x = metrics.maxWidth()*80; int win_y = metrics.height()*25; - int max_x = QApplication::desktop ()->screenGeometry (this).width (); - int max_y = QApplication::desktop ()->screenGeometry (this).height (); + int max_x = QGuiApplication::primaryScreen ()->availableGeometry ().width (); + int max_y = QGuiApplication::primaryScreen ()->availableGeometry ().height (); if (win_x > max_x) win_x = max_x; diff -r 0a1aec50a0c8 -r 960909469245 libgui/src/welcome-wizard.cc --- a/libgui/src/welcome-wizard.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libgui/src/welcome-wizard.cc Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,6 @@ #endif #include -#include #include #include #include diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/__isprimelarge__.cc --- a/libinterp/corefcn/__isprimelarge__.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/__isprimelarge__.cc Sun Apr 03 11:30:26 2022 -0400 @@ -98,7 +98,8 @@ bool isprimescalar (uint64_t n) { - // Fast return for even numbers. n==2 is excluded by the time this function is called. + // Fast return for even numbers. + // n==2 is excluded by the time this function is called. if (! (n & 1)) return false; @@ -197,7 +198,10 @@ %!assert (__isprimelarge__ (uint64 (2305843009213693951)), true) %!assert (__isprimelarge__ (uint64 (18446744073709551557)), true) -%!assert (__isprimelarge__ ([uint64(12345), uint64(2147483647), uint64(2305843009213693951), uint64(18446744073709551557)]), logical ([0 1 1 1])) +%!assert (__isprimelarge__ ([uint64(12345), uint64(2147483647), ... +%! uint64(2305843009213693951), ... +%! uint64(18446744073709551557)]), +%! logical ([0 1 1 1])) %!error (__isprimelarge__ ({'foo'; 'bar'})) */ diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/__lin_interpn__.cc --- a/libinterp/corefcn/__lin_interpn__.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/__lin_interpn__.cc Sun Apr 03 11:30:26 2022 -0400 @@ -35,6 +35,8 @@ #include "error.h" #include "ovl.h" +#include + OCTAVE_NAMESPACE_BEGIN // equivalent to isvector.m @@ -127,11 +129,11 @@ // n-dimensional linear interpolation -template +template void lin_interpn (int n, const octave_idx_type *size, const octave_idx_type *scale, - octave_idx_type Ni, T extrapval, const T **x, - const T *v, const T **y, T *vi) + octave_idx_type Ni, DT extrapval, const T **x, + const DT *v, const T **y, DT *vi) { bool out = false; int bit; @@ -185,13 +187,17 @@ } } -template +template octave_value -lin_interpn (int n, M *X, const M V, M *Y) +lin_interpn (int n, MT *X, const DMT V, MT *Y, DT extrapval) { + static_assert(std::is_same::value, + "Type DMT must be an ArrayType with elements of type DT."); + using T = typename MT::element_type; + octave_value retval; - M Vi = M (Y[0].dims ()); + DMT Vi = DMT (Y[0].dims ()); OCTAVE_LOCAL_BUFFER (const T *, y, n); OCTAVE_LOCAL_BUFFER (octave_idx_type, size, n); @@ -205,12 +211,10 @@ OCTAVE_LOCAL_BUFFER (const T *, x, n); OCTAVE_LOCAL_BUFFER (octave_idx_type, scale, n); - const T *v = V.data (); - T *vi = Vi.fortran_vec (); + const DT *v = V.data (); + DT *vi = Vi.fortran_vec (); octave_idx_type Ni = Vi.numel (); - T extrapval = octave_NA; - // offset in memory of each dimension scale[0] = 1; @@ -228,7 +232,7 @@ if (X[i].dims () != V.dims ()) error ("interpn: incompatible size of argument number %d", i+1); - M tmp = M (dim_vector (size[i], 1)); + MT tmp = MT (dim_vector (size[i], 1)); for (octave_idx_type j = 0; j < size[i]; j++) tmp(j) = X[i](scale[i]*j); @@ -284,8 +288,6 @@ OCTAVE_LOCAL_BUFFER (FloatNDArray, X, n); OCTAVE_LOCAL_BUFFER (FloatNDArray, Y, n); - const FloatNDArray V = args(n).float_array_value (); - for (int i = 0; i < n; i++) { X[i] = args(i).float_array_value (); @@ -295,15 +297,24 @@ error ("interpn: incompatible size of argument number %d", n+i+2); } - retval = lin_interpn (n, X, V, Y); + if (args(n).iscomplex ()) + { + const FloatComplexNDArray V = args(n).float_complex_array_value (); + FloatComplex extrapval (octave_NA, octave_NA); + retval = lin_interpn (n, X, V, Y, extrapval); + } + else + { + const FloatNDArray V = args(n).float_array_value (); + float extrapval = octave_NA; + retval = lin_interpn (n, X, V, Y, extrapval); + } } else { OCTAVE_LOCAL_BUFFER (NDArray, X, n); OCTAVE_LOCAL_BUFFER (NDArray, Y, n); - const NDArray V = args(n).array_value (); - for (int i = 0; i < n; i++) { X[i] = args(i).array_value (); @@ -313,15 +324,36 @@ error ("interpn: incompatible size of argument number %d", n+i+2); } - retval = lin_interpn (n, X, V, Y); + if (args(n).iscomplex ()) + { + const ComplexNDArray V = args(n).complex_array_value (); + Complex extrapval (octave_NA, octave_NA); + retval = lin_interpn (n, X, V, Y, extrapval); + } + else + { + const NDArray V = args(n).array_value (); + double extrapval = octave_NA; + retval = lin_interpn (n, X, V, Y, extrapval); + } } return retval; } /* -## No test needed for internal helper function. -%!assert (1) +## Test that real and imaginary parts are interpolated the same way +## and outer points are set to NA + 1i*NA +%!test <*61907> +%! x1 = 1:3; +%! x2 = 1:4; +%! v = repmat(1:4, 3, 1) + 1i * repmat((1:3)', 1, 4); +%! [XI2, XI1] = meshgrid(1.5:3.5, 1.5:3.5); +%! vi_complex = __lin_interpn__ (x1, x2, v, XI1, XI2); +%! vi_real = __lin_interpn__ (x1, x2, real (v), XI1, XI2); +%! vi_imag = __lin_interpn__ (x1, x2, imag (v), XI1, XI2); +%! assert (real (vi_complex), vi_real); +%! assert (imag (vi_complex), vi_imag); */ OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/__pchip_deriv__.cc --- a/libinterp/corefcn/__pchip_deriv__.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/__pchip_deriv__.cc Sun Apr 03 11:30:26 2022 -0400 @@ -57,79 +57,167 @@ if (args(0).is_single_type () || args(1).is_single_type ()) { FloatColumnVector xvec (args(0).float_vector_value ()); - FloatMatrix ymat (args(1).float_matrix_value ()); - F77_INT nx = to_f77_int (xvec.numel ()); - if (nx < 2) error ("__pchip_deriv__: X must be at least of length 2"); - octave_idx_type nyr = ymat.rows (); - octave_idx_type nyc = ymat.columns (); + if (args(1).iscomplex ()) + { + FloatComplexMatrix ymat (args(1).float_complex_matrix_value ()); + + octave_idx_type nyr = ymat.rows (); + octave_idx_type nyc = ymat.columns (); - if (nx != (rows ? nyc : nyr)) - error ("__pchip_deriv__: X and Y dimension mismatch"); + if (nx != (rows ? nyc : nyr)) + error ("__pchip_deriv__: X and Y dimension mismatch"); + + FloatComplexMatrix dmat (nyr, nyc); + + F77_INT ierr; + const F77_INT incfd = (rows ? to_f77_int (2*nyr) : 2); + volatile const octave_idx_type inc = (rows ? 2 : 2*nyr); + volatile octave_idx_type k = 0; - FloatMatrix dmat (nyr, nyc); + for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + { + F77_XFCN (pchim, PCHIM, (nx, xvec.data (), + reinterpret_cast(ymat.data ()) + k * inc, + reinterpret_cast(dmat.fortran_vec ()) + k * inc, + incfd, ierr)); - F77_INT ierr; - const F77_INT incfd = (rows ? to_f77_int (nyr) : 1); - volatile const octave_idx_type inc = (rows ? 1 : nyr); - volatile octave_idx_type k = 0; + if (ierr < 0) + error ("__pchip_deriv__: PCHIM failed for real part with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); + + F77_XFCN (pchim, PCHIM, (nx, xvec.data (), + reinterpret_cast(ymat.data ()) + 1 + k * inc, + reinterpret_cast(dmat.fortran_vec ()) + 1 + k * inc, + incfd, ierr)); + + if (ierr < 0) + error ("__pchip_deriv__: PCHIM failed for imaginary part with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); - for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + k++; + } + + retval = dmat; + } + else { - F77_XFCN (pchim, PCHIM, (nx, xvec.data (), - ymat.data () + k * inc, - dmat.fortran_vec () + k * inc, - incfd, ierr)); + FloatMatrix ymat (args(1).float_matrix_value ()); + + octave_idx_type nyr = ymat.rows (); + octave_idx_type nyc = ymat.columns (); + + if (nx != (rows ? nyc : nyr)) + error ("__pchip_deriv__: X and Y dimension mismatch"); + + FloatMatrix dmat (nyr, nyc); - k++; + F77_INT ierr; + const F77_INT incfd = (rows ? to_f77_int (nyr) : 1); + volatile const octave_idx_type inc = (rows ? 1 : nyr); + volatile octave_idx_type k = 0; - if (ierr < 0) - error ("__pchip_deriv__: PCHIM failed with ierr = %" - OCTAVE_F77_INT_TYPE_FORMAT, ierr); + for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + { + F77_XFCN (pchim, PCHIM, (nx, xvec.data (), + ymat.data () + k * inc, + dmat.fortran_vec () + k * inc, + incfd, ierr)); + + k++; + + if (ierr < 0) + error ("__pchip_deriv__: PCHIM failed with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); + } + + retval = dmat; } - - retval = dmat; } else { ColumnVector xvec (args(0).vector_value ()); - Matrix ymat (args(1).matrix_value ()); - F77_INT nx = to_f77_int (xvec.numel ()); - if (nx < 2) error ("__pchip_deriv__: X must be at least of length 2"); - octave_idx_type nyr = ymat.rows (); - octave_idx_type nyc = ymat.columns (); + if (args(1).iscomplex ()) + { + ComplexMatrix ymat (args(1).complex_matrix_value ()); + + octave_idx_type nyr = ymat.rows (); + octave_idx_type nyc = ymat.columns (); - if (nx != (rows ? nyc : nyr)) - error ("__pchip_deriv__: X and Y dimension mismatch"); + if (nx != (rows ? nyc : nyr)) + error ("__pchip_deriv__: X and Y dimension mismatch"); + + ComplexMatrix dmat (nyr, nyc); + + F77_INT ierr; + const F77_INT incfd = (rows ? to_f77_int (2*nyr) : 2); + volatile const octave_idx_type inc = (rows ? 2 : 2*nyr); + volatile octave_idx_type k = 0; - Matrix dmat (nyr, nyc); + for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + { + F77_XFCN (dpchim, DPCHIM, (nx, xvec.data (), + reinterpret_cast(ymat.data ()) + k * inc, + reinterpret_cast(dmat.fortran_vec ()) + k * inc, + incfd, ierr)); - F77_INT ierr; - const F77_INT incfd = (rows ? to_f77_int (nyr) : 1); - volatile const octave_idx_type inc = (rows ? 1 : nyr); - volatile octave_idx_type k = 0; + if (ierr < 0) + error ("__pchip_deriv__: DPCHIM failed for real part with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); + + F77_XFCN (dpchim, DPCHIM, (nx, xvec.data (), + reinterpret_cast(ymat.data ()) + 1 + k * inc, + reinterpret_cast(dmat.fortran_vec ()) + 1 + k * inc, + incfd, ierr)); + + if (ierr < 0) + error ("__pchip_deriv__: DPCHIM failed for imaginary part with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); - for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + k++; + } + + retval = dmat; + } + else { - F77_XFCN (dpchim, DPCHIM, (nx, xvec.data (), - ymat.data () + k * inc, - dmat.fortran_vec () + k * inc, - incfd, ierr)); - k++; + Matrix ymat (args(1).matrix_value ()); + + octave_idx_type nyr = ymat.rows (); + octave_idx_type nyc = ymat.columns (); + + if (nx != (rows ? nyc : nyr)) + error ("__pchip_deriv__: X and Y dimension mismatch"); + + Matrix dmat (nyr, nyc); + + F77_INT ierr; + const F77_INT incfd = (rows ? to_f77_int (nyr) : 1); + volatile const octave_idx_type inc = (rows ? 1 : nyr); + volatile octave_idx_type k = 0; - if (ierr < 0) - error ("__pchip_deriv__: DPCHIM failed with ierr = %" - OCTAVE_F77_INT_TYPE_FORMAT, ierr); + for (volatile octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) + { + F77_XFCN (dpchim, DPCHIM, (nx, xvec.data (), + ymat.data () + k * inc, + dmat.fortran_vec () + k * inc, + incfd, ierr)); + k++; + + if (ierr < 0) + error ("__pchip_deriv__: DPCHIM failed with ierr = %" + OCTAVE_F77_INT_TYPE_FORMAT, ierr); + } + + retval = dmat; } - - retval = dmat; } } @@ -137,8 +225,37 @@ } /* -## No test needed for internal helper function. -%!assert (1) +%!shared x, y +%! x = 0:3; +%! y = x.^2 + 1i * x.^3; + +%!test +%! d_complex = __pchip_deriv__ (x, y, 2); +%! d_real = __pchip_deriv__ (x, real (y), 2); +%! d_imag = __pchip_deriv__ (x, imag (y), 2); +%! assert (real (d_complex), d_real); +%! assert (imag (d_complex), d_imag); + +%!test +%! d_complex = __pchip_deriv__ (x.', y.'); +%! d_real = __pchip_deriv__ (x.', real (y.')); +%! d_imag = __pchip_deriv__ (x.', imag (y.')); +%! assert (real (d_complex), d_real); +%! assert (imag (d_complex), d_imag); + +%!test +%! d_complex = __pchip_deriv__ (single (x), single (y), 2); +%! d_real = __pchip_deriv__ (single (x), real (single (y)), 2); +%! d_imag = __pchip_deriv__ (single (x), imag (single (y)), 2); +%! assert (real (d_complex), d_real); +%! assert (imag (d_complex), d_imag); + +%!test +%! d_complex = __pchip_deriv__ (single (x'), single (y')); +%! d_real = __pchip_deriv__ (single (x'), real (single (y'))); +%! d_imag = __pchip_deriv__ (single (x'), imag (single (y'))); +%! assert (real (d_complex), d_real); +%! assert (imag (d_complex), d_imag); */ OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/bsxfun.cc --- a/libinterp/corefcn/bsxfun.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/bsxfun.cc Sun Apr 03 11:30:26 2022 -0400 @@ -719,10 +719,12 @@ %!assert (bsxfun (f, a, b), a - repmat (b, [4, 1, 1])) %!assert (bsxfun (f, a, c), a - repmat (c, [1, 4, 1])) %!assert (bsxfun (f, a, d), a - repmat (d, [1, 1, 4])) -%!assert (bsxfun ("minus", ones ([4, 0, 4]), ones ([4, 1, 4])), zeros ([4, 0, 4])) +%!assert (bsxfun ("minus", ones ([4, 0, 4]), ones ([4, 1, 4])), +%! zeros ([4, 0, 4])) ## The test below is a very hard case to treat -%!assert (bsxfun (f, ones ([4, 1, 4, 1]), ones ([1, 4, 1, 4])), zeros ([4, 4, 4, 4])) +%!assert (bsxfun (f, ones ([4, 1, 4, 1]), ones ([1, 4, 1, 4])), +%! zeros ([4, 4, 4, 4])) %!shared a, b, aa, bb %! ## FIXME: Set a known "good" random seed. See bug #51779. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/call-stack.cc --- a/libinterp/corefcn/call-stack.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/call-stack.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1138,7 +1138,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} max_stack_depth () @deftypefnx {} {@var{old_val} =} max_stack_depth (@var{new_val}) -@deftypefnx {} {} max_stack_depth (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} max_stack_depth (@var{new_val}, "local") Query or set the internal limit on the number of times a function may be called recursively. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/cellfun.cc --- a/libinterp/corefcn/cellfun.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/cellfun.cc Sun Apr 03 11:30:26 2022 -0400 @@ -859,19 +859,27 @@ %! 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]); -%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! 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}, ... %! "UniformOutput", true, "ErrorHandler", @__cellfunerror); %! B = isfield (A(1), "message") && isfield (A(1), "index"); -%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]); -%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], +%! [false, false]); %! assert ([A(1).index, A(2).index], [1, 2]); ## Input arguments can be of type cell arrays of character or strings @@ -886,18 +894,26 @@ %!test %! 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]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! 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"}, ... %! "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]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], +%! [false, false]); %! assert ([A(1).index, A(2).index], [1, 2]); ## Structures cannot be handled by cellfun @@ -920,18 +936,26 @@ %!test %! 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]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! 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}}, ... %! "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]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], +%! [false, false]); %! assert ([A(1).index, A(2).index], [1, 2]); ## Input arguments can be of type cell array of structure arrays @@ -984,7 +1008,8 @@ %!assert (cellfun ("size", {zeros([1,2,3]),1}, 2), [2,1]) %!assert (cellfun ("size", {zeros([1,2,3]),1}, 3), [3,1]) %!assert (cellfun (@atan2, {1,1}, {1,2}), [atan2(1,1), atan2(1,2)]) -%!assert (cellfun (@atan2, {1,1}, {1,2},"UniformOutput", false), {atan2(1,1), atan2(1,2)}) +%!assert (cellfun (@atan2, {1,1}, {1,2},"UniformOutput", false), +%! {atan2(1,1), atan2(1,2)}) %!assert (cellfun (@sin, {1,2;3,4}), sin ([1,2;3,4])) %!assert (cellfun (@atan2, {1,1;1,1}, {1,2;1,2}), atan2 ([1,1;1,1],[1,2;1,2])) %!error cellfun (@factorial, {-1,3}) @@ -997,9 +1022,12 @@ %! assert (c, {".d", ".h"}); %!assert <*40467> (cellfun (@isreal, {1 inf nan []}), [true, true, true, true]) -%!assert <*40467> (cellfun (@isreal, {1 inf nan []}, "UniformOutput", false), {true, true, true, true}) -%!assert <*40467> (cellfun (@iscomplex, {1 inf nan []}), [false, false, false, false]) -%!assert <*40467> (cellfun (@iscomplex, {1 inf nan []}, "UniformOutput", false), {false, false, false, false}) +%!assert <*40467> (cellfun (@isreal, {1 inf nan []}, "UniformOutput", false), +%! {true, true, true, true}) +%!assert <*40467> (cellfun (@iscomplex, {1 inf nan []}), +%! [false, false, false, false]) +%!assert <*40467> (cellfun (@iscomplex, {1 inf nan []}, "UniformOutput", false), +%! {false, false, false, false}) %!error cellfun (1) %!error cellfun ("isclass", 1) @@ -1015,7 +1043,8 @@ %!endfunction %!test <*58411> %! global __errmsg; -%! assert (cellfun (@factorial, {1, 2, -3}, "ErrorHandler", @__errfcn), [1, 2, NaN]); +%! assert (cellfun (@factorial, {1, 2, -3}, "ErrorHandler", @__errfcn), +%! [1, 2, NaN]); %! assert (! isempty (__errmsg)); %! clear -global __errmsg; */ @@ -1537,19 +1566,27 @@ %! 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]); -%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! 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}, ... %! "UniformOutput", true, "ErrorHandler", @__arrayfunerror); %! B = isfield (A(1), "message") && isfield (A(1), "index"); -%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]); -%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], +%! [false, false]); %! assert ([A(1).index, A(2).index], [1, 2]); ## Input arguments can be of type character or strings @@ -1565,7 +1602,8 @@ %!test %! 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"); +%! B = isfield (A(1), "identifier") && isfield (A(1), "message") ... +%! && isfield (A(1), "index"); %! assert (B, true); ## Input arguments can be of type structure @@ -1609,18 +1647,26 @@ %! assert (A, {true, false}); %!test %! A = arrayfun (@(x,y) num2str(x,y), {1.1, 4.2}, {3.1, 2}, "ErrorHandler", @__arrayfunerror); -%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], [true, true]); -%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], [true, true]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! 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}, ... %! "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]); -%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], [true, true]); -%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], [false, false]); +%! assert ([(isfield (A(1), "identifier")), (isfield (A(2), "identifier"))], +%! [true, true]); +%! assert ([(isfield (A(1), "message")), (isfield (A(2), "message"))], +%! [true, true]); +%! assert ([(isfield (A(1), "index")), (isfield (A(2), "index"))], +%! [true, true]); +%! assert ([(isempty (A(1).message)), (isempty (A(2).message))], +%! [false, false]); %! assert ([A(1).index, A(2).index], [1, 2]); */ @@ -1944,8 +1990,8 @@ do_mat2cell_2d (const Array2D& a, const Array *d, int nd) { Cell retval; - assert (nd == 1 || nd == 2); - assert (a.ndims () == 2); + error_unless (nd == 1 || nd == 2); + error_unless (a.ndims () == 2); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; @@ -2001,7 +2047,7 @@ do_mat2cell_nd (const ArrayND& a, const Array *d, int nd) { Cell retval; - assert (nd >= 1); + error_unless (nd >= 1); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; @@ -2065,7 +2111,7 @@ do_mat2cell (octave_value& a, const Array *d, int nd) { Cell retval; - assert (nd >= 1); + error_unless (nd >= 1); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/chol.cc --- a/libinterp/corefcn/chol.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/chol.cc Sun Apr 03 11:30:26 2022 -0400 @@ -314,7 +314,8 @@ /* %!assert (chol ([2, 1; 1, 1]), [sqrt(2), 1/sqrt(2); 0, 1/sqrt(2)], sqrt (eps)) -%!assert (chol (single ([2, 1; 1, 1])), single ([sqrt(2), 1/sqrt(2); 0, 1/sqrt(2)]), sqrt (eps ("single"))) +%!assert (chol (single ([2, 1; 1, 1])), +%! single ([sqrt(2), 1/sqrt(2); 0, 1/sqrt(2)]), sqrt (eps ("single"))) %!assert (chol ([2, 1; 1, 1], "upper"), [sqrt(2), 1/sqrt(2); 0, 1/sqrt(2)], %! sqrt (eps)) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/daspk.cc --- a/libinterp/corefcn/daspk.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/daspk.cc Sun Apr 03 11:30:26 2022 -0400 @@ -68,7 +68,7 @@ { ColumnVector retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -117,7 +117,7 @@ { Matrix retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/dasrt.cc --- a/libinterp/corefcn/dasrt.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/dasrt.cc Sun Apr 03 11:30:26 2022 -0400 @@ -69,7 +69,7 @@ { ColumnVector retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -155,7 +155,7 @@ { Matrix retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/dassl.cc --- a/libinterp/corefcn/dassl.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/dassl.cc Sun Apr 03 11:30:26 2022 -0400 @@ -67,7 +67,7 @@ { ColumnVector retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -116,7 +116,7 @@ { Matrix retval; - assert (x.numel () == xdot.numel ()); + error_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/data.cc Sun Apr 03 11:30:26 2022 -0400 @@ -703,8 +703,10 @@ %!assert (rem ([1, 2, 3; -1, -2, -3], 2), [1, 0, 1; -1, 0, -1]) %!assert (rem ([1, 2, 3; -1, -2, -3], 2 * ones (2, 3)),[1, 0, 1; -1, 0, -1]) %!assert (rem ([0, 1, 2], [0, 0, 1]), [NaN, NaN, 0]) -%!assert (rem (uint8 ([1, 2, 3; -1, -2, -3]), uint8 (2)), uint8 ([1, 0, 1; -1, 0, -1])) -%!assert (uint8 (rem ([1, 2, 3; -1, -2, -3], 2 * ones (2, 3))),uint8 ([1, 0, 1; -1, 0, -1])) +%!assert (rem (uint8 ([1, 2, 3; -1, -2, -3]), uint8 (2)), +%! uint8 ([1, 0, 1; -1, 0, -1])) +%!assert (uint8 (rem ([1, 2, 3; -1, -2, -3], 2 * ones (2, 3))), +%! uint8 ([1, 0, 1; -1, 0, -1])) %!assert (rem (uint8 ([0, 1, 2]), [0, 0, 1]), uint8 ([0, 0, 0])) ## Test sparse implementations @@ -1020,12 +1022,15 @@ %!assert (cumprod ([1, 2, 3]), [1, 2, 6]) %!assert (cumprod ([-1; -2; -3]), [-1; 2; -6]) %!assert (cumprod ([i, 2+i, -3+2i, 4]), [i, -1+2i, -1-8i, -4-32i]) -%!assert (cumprod ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), [1, 2, 3; i, 4i, 9i; -1+i, -8+8i, -27+27i]) +%!assert (cumprod ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), +%! [1, 2, 3; i, 4i, 9i; -1+i, -8+8i, -27+27i]) %!assert (cumprod (single ([1, 2, 3])), single ([1, 2, 6])) %!assert (cumprod (single ([-1; -2; -3])), single ([-1; 2; -6])) -%!assert (cumprod (single ([i, 2+i, -3+2i, 4])), single ([i, -1+2i, -1-8i, -4-32i])) -%!assert (cumprod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single ([1, 2, 3; i, 4i, 9i; -1+i, -8+8i, -27+27i])) +%!assert (cumprod (single ([i, 2+i, -3+2i, 4])), +%! single ([i, -1+2i, -1-8i, -4-32i])) +%!assert (cumprod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), +%! single ([1, 2, 3; i, 4i, 9i; -1+i, -8+8i, -27+27i])) %!assert (cumprod ([2, 3; 4, 5], 1), [2, 3; 8, 15]) %!assert (cumprod ([2, 3; 4, 5], 2), [2, 6; 4, 20]) @@ -1170,12 +1175,15 @@ %!assert (cumsum ([1, 2, 3]), [1, 3, 6]) %!assert (cumsum ([-1; -2; -3]), [-1; -3; -6]) %!assert (cumsum ([i, 2+i, -3+2i, 4]), [i, 2+2i, -1+4i, 3+4i]) -%!assert (cumsum ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), [1, 2, 3; 1+i, 2+2i, 3+3i; 2+2i, 4+4i, 6+6i]) +%!assert (cumsum ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), +%! [1, 2, 3; 1+i, 2+2i, 3+3i; 2+2i, 4+4i, 6+6i]) %!assert (cumsum (single ([1, 2, 3])), single ([1, 3, 6])) %!assert (cumsum (single ([-1; -2; -3])), single ([-1; -3; -6])) -%!assert (cumsum (single ([i, 2+i, -3+2i, 4])), single ([i, 2+2i, -1+4i, 3+4i])) -%!assert (cumsum (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single ([1, 2, 3; 1+i, 2+2i, 3+3i; 2+2i, 4+4i, 6+6i])) +%!assert (cumsum (single ([i, 2+i, -3+2i, 4])), +%! single ([i, 2+2i, -1+4i, 3+4i])) +%!assert (cumsum (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), +%! single ([1, 2, 3; 1+i, 2+2i, 3+3i; 2+2i, 4+4i, 6+6i])) %!assert (cumsum ([1, 2; 3, 4], 1), [1, 2; 4, 6]) %!assert (cumsum ([1, 2; 3, 4], 2), [1, 3; 3, 7]) @@ -1254,35 +1262,53 @@ %!assert (full (diag ([1; 2; 3])), [1, 0, 0; 0, 2, 0; 0, 0, 3]) %!assert (diag ([1; 2; 3], 1), [0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]) -%!assert (diag ([1; 2; 3], 2), [0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0]) -%!assert (diag ([1; 2; 3],-1), [0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]) -%!assert (diag ([1; 2; 3],-2), [0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0]) +%!assert (diag ([1; 2; 3], 2), +%! [0 0 1 0 0; 0 0 0 2 0; 0 0 0 0 3; 0 0 0 0 0; 0 0 0 0 0]) +%!assert (diag ([1; 2; 3],-1), +%! [0 0 0 0; 1 0 0 0; 0 2 0 0; 0 0 3 0]) +%!assert (diag ([1; 2; 3],-2), +%! [0 0 0 0 0; 0 0 0 0 0; 1 0 0 0 0; 0 2 0 0 0; 0 0 3 0 0]) %!assert (diag ([1, 0, 0; 0, 2, 0; 0, 0, 3]), [1; 2; 3]) -%!assert (diag ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0], 1), [1; 2; 3]) -%!assert (diag ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0], -1), [1; 2; 3]) +%!assert (diag ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0], 1), +%! [1; 2; 3]) +%!assert (diag ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0], -1), +%! [1; 2; 3]) %!assert (diag (ones (1, 0), 2), zeros (2)) %!assert (diag (1:3, 4, 2), [1, 0; 0, 2; 0, 0; 0, 0]) -%!assert (full (diag (single ([1; 2; 3]))), single ([1, 0, 0; 0, 2, 0; 0, 0, 3])) -%!assert (diag (single ([1; 2; 3]), 1), single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) -%!assert (diag (single ([1; 2; 3]), 2), single ([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) -%!assert (diag (single ([1; 2; 3]),-1), single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) -%!assert (diag (single ([1; 2; 3]),-2), single ([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) +%!assert (full (diag (single ([1; 2; 3]))), +%! single ([1, 0, 0; 0, 2, 0; 0, 0, 3])) +%!assert (diag (single ([1; 2; 3]), 1), +%! single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) +%!assert (diag (single ([1; 2; 3]), 2), +%! single ([0 0 1 0 0; 0 0 0 2 0; 0 0 0 0 3; 0 0 0 0 0; 0 0 0 0 0])) +%!assert (diag (single ([1; 2; 3]),-1), +%! single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) +%!assert (diag (single ([1; 2; 3]),-2), +%! single ([0 0 0 0 0; 0 0 0 0 0; 1 0 0 0 0; 0 2 0 0 0; 0 0 3 0 0])) %!assert (diag (single ([1, 0, 0; 0, 2, 0; 0, 0, 3])), single ([1; 2; 3])) -%!assert (diag (single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), single ([1; 2; 3])) -%!assert (diag (single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), single ([1; 2; 3])) +%!assert (diag (single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), +%! single ([1; 2; 3])) +%!assert (diag (single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), +%! single ([1; 2; 3])) %!assert (diag (int8 ([1; 2; 3])), int8 ([1, 0, 0; 0, 2, 0; 0, 0, 3])) -%!assert (diag (int8 ([1; 2; 3]), 1), int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) -%!assert (diag (int8 ([1; 2; 3]), 2), int8 ([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) -%!assert (diag (int8 ([1; 2; 3]),-1), int8 ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) -%!assert (diag (int8 ([1; 2; 3]),-2), int8 ([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) +%!assert (diag (int8 ([1; 2; 3]), 1), +%! int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) +%!assert (diag (int8 ([1; 2; 3]), 2), +%! int8 ([0 0 1 0 0; 0 0 0 2 0; 0 0 0 0 3; 0 0 0 0 0; 0 0 0 0 0])) +%!assert (diag (int8 ([1; 2; 3]),-1), +%! int8 ([0 0 0 0; 1 0 0 0; 0 2 0 0; 0 0 3 0])) +%!assert (diag (int8 ([1; 2; 3]),-2), +%! int8 ([0 0 0 0 0; 0 0 0 0 0; 1 0 0 0 0; 0 2 0 0 0; 0 0 3 0 0])) %!assert (diag (int8 ([1, 0, 0; 0, 2, 0; 0, 0, 3])), int8 ([1; 2; 3])) -%!assert (diag (int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), int8 ([1; 2; 3])) -%!assert (diag (int8 ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), int8 ([1; 2; 3])) +%!assert (diag (int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), +%! int8 ([1; 2; 3])) +%!assert (diag (int8 ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), +%! int8 ([1; 2; 3])) %!assert (diag (1, 3, 3), diag ([1, 0, 0])) %!assert (diag (i, 3, 3), diag ([i, 0, 0])) @@ -1295,7 +1321,8 @@ %!assert <*37411> (diag (diag ([5, 2, 3])(:,1)), diag([5 0 0 ])) %!assert <*37411> (diag (diag ([5, 2, 3])(:,1), 2), [0 0 5 0 0; zeros(4, 5)]) -%!assert <*37411> (diag (diag ([5, 2, 3])(:,1), -2), [[0 0 5 0 0]', zeros(5, 4)]) +%!assert <*37411> (diag (diag ([5, 2, 3])(:,1), -2), +%! [[0 0 5 0 0]', zeros(5, 4)]) ## Test non-square size %!assert (diag ([1,2,3], 6, 3), [1 0 0; 0 2 0; 0 0 3; 0 0 0; 0 0 0; 0 0 0]) @@ -1464,14 +1491,16 @@ %!assert (prod (single ([1, 2, 3])), single (6)) %!assert (prod (single ([-1; -2; -3])), single (-6)) %!assert (prod (single ([i, 2+i, -3+2i, 4])), single (-4 - 32i)) -%!assert (prod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single ([-1+i, -8+8i, -27+27i])) +%!assert (prod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), +%! single ([-1+i, -8+8i, -27+27i])) ## Test sparse %!assert (prod (sparse ([1, 2, 3])), sparse (6)) %!assert (prod (sparse ([-1; -2; -3])), sparse (-6)) ## Commented out until bug #42290 is fixed #%!assert (prod (sparse ([i, 2+i, -3+2i, 4])), sparse (-4 - 32i)) -#%!assert (prod (sparse ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), sparse ([-1+i, -8+8i, -27+27i])) +#%!assert (prod (sparse ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), +#%! sparse ([-1+i, -8+8i, -27+27i])) %!assert (prod ([1, 2; 3, 4], 1), [3, 8]) %!assert (prod ([1, 2; 3, 4], 2), [2; 12]) @@ -1507,7 +1536,8 @@ %!assert (prod (single ([1, 2, 3]), "double"), 6) %!assert (prod (single ([-1; -2; -3]), "double"), -6) %!assert (prod (single ([i, 2+i, -3+2i, 4]), "double"), -4 - 32i) -%!assert (prod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), "double"), [-1+i, -8+8i, -27+27i]) +%!assert (prod (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i]), "double"), +%! [-1+i, -8+8i, -27+27i]) ## Test "native" type argument %!assert (prod (uint8 ([1, 2, 3]), "native"), uint8 (6)) @@ -2254,7 +2284,8 @@ /* %!test %! c = {"foo"; "bar"; "bazoloa"}; -%! assert (vertcat (c, "a", "bc", "def"), {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"}); +%! assert (vertcat (c, "a", "bc", "def"), +%! {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"}); */ DEFUN (cat, args, , @@ -2321,11 +2352,13 @@ %! assert (cat (1, cast (1, t1), cast (2, t2)), cast ([1; 2], tr)); %! assert (cat (1, cast (1, t1), cast ([2; 3], t2)), cast ([1; 2; 3], tr)); %! assert (cat (1, cast ([1; 2], t1), cast (3, t2)), cast ([1; 2; 3], tr)); -%! assert (cat (1, cast ([1; 2], t1), cast ([3; 4], t2)), cast ([1; 2; 3; 4], tr)); +%! assert (cat (1, cast ([1; 2], t1), cast ([3; 4], t2)), +%! cast ([1; 2; 3; 4], tr)); %! assert (cat (2, cast (1, t1), cast (2, t2)), cast ([1, 2], tr)); %! assert (cat (2, cast (1, t1), cast ([2, 3], t2)), cast ([1, 2, 3], tr)); %! assert (cat (2, cast ([1, 2], t1), cast (3, t2)), cast ([1, 2, 3], tr)); -%! assert (cat (2, cast ([1, 2], t1), cast ([3, 4], t2)), cast ([1, 2, 3, 4], tr)); +%! assert (cat (2, cast ([1, 2], t1), cast ([3, 4], t2)), +%! cast ([1, 2, 3, 4], tr)); %! %! assert ([cast(1, t1); cast(2, t2)], cast ([1; 2], tr)); %! assert ([cast(1, t1); cast([2; 3], t2)], cast ([1; 2; 3], tr)); @@ -2340,12 +2373,13 @@ %! assert (cat (1, cast (1i, t1), cast (2, t2)), cast ([1i; 2], tr)); %! assert (cat (1, cast (1i, t1), cast ([2; 3], t2)), cast ([1i; 2; 3], tr)); %! assert (cat (1, cast ([1i; 2], t1), cast (3, t2)), cast ([1i; 2; 3], tr)); -%! assert (cat (1, cast ([1i; 2], t1), cast ([3; 4], t2)), cast ([1i; 2; 3; 4], tr)); +%! assert (cat (1, cast ([1i; 2], t1), cast ([3; 4], t2)), +%! cast ([1i; 2; 3; 4], tr)); %! assert (cat (2, cast (1i, t1), cast (2, t2)), cast ([1i, 2], tr)); %! assert (cat (2, cast (1i, t1), cast ([2, 3], t2)), cast ([1i, 2, 3], tr)); %! assert (cat (2, cast ([1i, 2], t1), cast (3, t2)), cast ([1i, 2, 3], tr)); -%! assert (cat (2, cast ([1i, 2], t1), cast ([3, 4], t2)), cast ([1i, 2, 3, 4], tr)); -%! +%! assert (cat (2, cast ([1i, 2], t1), cast ([3, 4], t2)), +%! cast ([1i, 2, 3, 4], tr)); %! assert ([cast(1i, t1); cast(2, t2)], cast ([1i; 2], tr)); %! assert ([cast(1i, t1); cast([2; 3], t2)], cast ([1i; 2; 3], tr)); %! assert ([cast([1i; 2], t1); cast(3, t2)], cast ([1i; 2; 3], tr)); @@ -2358,12 +2392,13 @@ %! assert (cat (1, cast (1, t1), cast (2i, t2)), cast ([1; 2i], tr)); %! assert (cat (1, cast (1, t1), cast ([2i; 3], t2)), cast ([1; 2i; 3], tr)); %! assert (cat (1, cast ([1; 2], t1), cast (3i, t2)), cast ([1; 2; 3i], tr)); -%! assert (cat (1, cast ([1; 2], t1), cast ([3i; 4], t2)), cast ([1; 2; 3i; 4], tr)); +%! assert (cat (1, cast ([1; 2], t1), cast ([3i; 4], t2)), +%! cast ([1; 2; 3i; 4], tr)); %! assert (cat (2, cast (1, t1), cast (2i, t2)), cast ([1, 2i], tr)); %! assert (cat (2, cast (1, t1), cast ([2i, 3], t2)), cast ([1, 2i, 3], tr)); %! assert (cat (2, cast ([1, 2], t1), cast (3i, t2)), cast ([1, 2, 3i], tr)); -%! assert (cat (2, cast ([1, 2], t1), cast ([3i, 4], t2)), cast ([1, 2, 3i, 4], tr)); -%! +%! assert (cat (2, cast ([1, 2], t1), cast ([3i, 4], t2)), +%! cast ([1, 2, 3i, 4], tr)); %! assert ([cast(1, t1); cast(2i, t2)], cast ([1; 2i], tr)); %! assert ([cast(1, t1); cast([2i; 3], t2)], cast ([1; 2i; 3], tr)); %! assert ([cast([1; 2], t1); cast(3i, t2)], cast ([1; 2; 3i], tr)); @@ -2374,22 +2409,30 @@ %! assert ([cast([1, 2], t1), cast([3i, 4], t2)], cast ([1, 2, 3i, 4], tr)); %! %! assert (cat (1, cast (1i, t1), cast (2i, t2)), cast ([1i; 2i], tr)); -%! assert (cat (1, cast (1i, t1), cast ([2i; 3], t2)), cast ([1i; 2i; 3], tr)); -%! assert (cat (1, cast ([1i; 2], t1), cast (3i, t2)), cast ([1i; 2; 3i], tr)); -%! assert (cat (1, cast ([1i; 2], t1), cast ([3i; 4], t2)), cast ([1i; 2; 3i; 4], tr)); +%! assert (cat (1, cast (1i, t1), cast ([2i; 3], t2)), +%! cast ([1i; 2i; 3], tr)); +%! assert (cat (1, cast ([1i; 2], t1), cast (3i, t2)), +%! cast ([1i; 2; 3i], tr)); +%! assert (cat (1, cast ([1i; 2], t1), cast ([3i; 4], t2)), +%! cast ([1i; 2; 3i; 4], tr)); %! assert (cat (2, cast (1i, t1), cast (2i, t2)), cast ([1i, 2i], tr)); -%! assert (cat (2, cast (1i, t1), cast ([2i, 3], t2)), cast ([1i, 2i, 3], tr)); -%! assert (cat (2, cast ([1i, 2], t1), cast (3i, t2)), cast ([1i, 2, 3i], tr)); -%! assert (cat (2, cast ([1i, 2], t1), cast ([3i, 4], t2)), cast ([1i, 2, 3i, 4], tr)); +%! assert (cat (2, cast (1i, t1), cast ([2i, 3], t2)), +%! cast ([1i, 2i, 3], tr)); +%! assert (cat (2, cast ([1i, 2], t1), cast (3i, t2)), +%! cast ([1i, 2, 3i], tr)); +%! assert (cat (2, cast ([1i, 2], t1), cast ([3i, 4], t2)), +%! cast ([1i, 2, 3i, 4], tr)); %! %! assert ([cast(1i, t1); cast(2i, t2)], cast ([1i; 2i], tr)); %! assert ([cast(1i, t1); cast([2i; 3], t2)], cast ([1i; 2i; 3], tr)); %! assert ([cast([1i; 2], t1); cast(3i, t2)], cast ([1i; 2; 3i], tr)); -%! assert ([cast([1i; 2], t1); cast([3i; 4], t2)], cast ([1i; 2; 3i; 4], tr)); +%! assert ([cast([1i; 2], t1); cast([3i; 4], t2)], +%! cast ([1i; 2; 3i; 4], tr)); %! assert ([cast(1i, t1), cast(2i, t2)], cast ([1i, 2i], tr)); %! assert ([cast(1i, t1), cast([2i, 3], t2)], cast ([1i, 2i, 3], tr)); %! assert ([cast([1i, 2], t1), cast(3i, t2)], cast ([1i, 2, 3i], tr)); -%! assert ([cast([1i, 2], t1), cast([3i, 4], t2)], cast ([1i, 2, 3i, 4], tr)); +%! assert ([cast([1i, 2], t1), cast([3i, 4], t2)], +%! cast ([1i, 2, 3i, 4], tr)); %! endif %! ret = true; %!endfunction @@ -3173,7 +3216,8 @@ %!assert (sum (single ([1, 2, 3])), single (6)) %!assert (sum (single ([-1; -2; -3])), single (-6)) %!assert (sum (single ([i, 2+i, -3+2i, 4])), single (3+4i)) -%!assert (sum (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single ([2+2i, 4+4i, 6+6i])) +%!assert (sum (single ([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), +%! single ([2+2i, 4+4i, 6+6i])) %!assert (sum ([1, 2; 3, 4], 1), [4, 6]) %!assert (sum ([1, 2; 3, 4], 2), [3; 7]) @@ -3271,8 +3315,8 @@ DEFUN (islogical, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} islogical (@var{x}) -@deftypefnx {} {} isbool (@var{x}) +@deftypefn {} {@var{tf} =} islogical (@var{x}) +@deftypefnx {} {@var{tf} =} isbool (@var{x}) Return true if @var{x} is a logical object. @seealso{ischar, isfloat, isinteger, isstring, isnumeric, isa} @end deftypefn */) @@ -3301,7 +3345,7 @@ DEFUN (isinteger, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isinteger (@var{x}) +@deftypefn {} {@var{tf} =} isinteger (@var{x}) Return true if @var{x} is an integer object (int8, uint8, int16, etc.). Note that @w{@code{isinteger (14)}} is false because numeric constants in @@ -3359,7 +3403,7 @@ DEFUN (iscomplex, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} iscomplex (@var{x}) +@deftypefn {} {@var{tf} =} iscomplex (@var{x}) Return true if @var{x} is a complex-valued numeric object. @seealso{isreal, isnumeric, ischar, isfloat, islogical, isstring, isa} @end deftypefn */) @@ -3389,7 +3433,7 @@ DEFUN (isfloat, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isfloat (@var{x}) +@deftypefn {} {@var{tf} =} isfloat (@var{x}) Return true if @var{x} is a floating-point numeric object. Objects of class double or single are floating-point objects. @@ -3428,6 +3472,12 @@ @end example @seealso{real, imag, iscomplex, abs, arg} @end deftypefn */) +// Programming Note: Throughout this function the coding pattern +// octave_value (new XXX)) is used. This is done specifically because the +// default octave_value constructor would otherwise perform automatic narrowing +// (i.e., complex values with 0 for the imaginary part would be converted +// to real values). The complex() function *must* return a complex value +// even when the imaginary part is 0. { int nargin = args.length (); @@ -3565,11 +3615,10 @@ { const FloatNDArray im_val = im.float_array_value (); - FloatComplexNDArray result (im_val.dims (), - FloatComplex ()); + FloatComplexNDArray result (im_val.dims ()); for (octave_idx_type i = 0; i < im_val.numel (); i++) - result.xelem (i) = FloatComplex (re_val, im_val(i)); + result.xelem (i) = FloatComplex (re_val, im_val.xelem (i)); retval = octave_value (new octave_float_complex_matrix (result)); @@ -3583,11 +3632,10 @@ { float im_val = im.float_value (); - FloatComplexNDArray result (re_val.dims (), - FloatComplex ()); + FloatComplexNDArray result (re_val.dims ()); for (octave_idx_type i = 0; i < re_val.numel (); i++) - result.xelem (i) = FloatComplex (re_val(i), im_val); + result.xelem (i) = FloatComplex (re_val.xelem (i), im_val); retval = octave_value (new octave_float_complex_matrix (result)); @@ -3599,12 +3647,11 @@ if (re_val.dims () != im_val.dims ()) error ("complex: dimension mismatch"); - FloatComplexNDArray result (re_val.dims (), - FloatComplex ()); + FloatComplexNDArray result (re_val.dims ()); for (octave_idx_type i = 0; i < re_val.numel (); i++) - result.xelem (i) = FloatComplex (re_val(i), - im_val(i)); + result.xelem (i) = FloatComplex (re_val.xelem (i), + im_val.xelem (i)); retval = octave_value (new octave_float_complex_matrix (result)); @@ -3626,10 +3673,10 @@ { const NDArray im_val = im.array_value (); - ComplexNDArray result (im_val.dims (), Complex ()); + ComplexNDArray result (im_val.dims ()); for (octave_idx_type i = 0; i < im_val.numel (); i++) - result.xelem (i) = Complex (re_val, im_val(i)); + result.xelem (i) = Complex (re_val, im_val.xelem (i)); retval = octave_value (new octave_complex_matrix (result)); } @@ -3642,10 +3689,10 @@ { double im_val = im.double_value (); - ComplexNDArray result (re_val.dims (), Complex ()); + ComplexNDArray result (re_val.dims ()); for (octave_idx_type i = 0; i < re_val.numel (); i++) - result.xelem (i) = Complex (re_val(i), im_val); + result.xelem (i) = Complex (re_val.xelem (i), im_val); retval = octave_value (new octave_complex_matrix (result)); } @@ -3659,7 +3706,8 @@ ComplexNDArray result (re_val.dims (), Complex ()); for (octave_idx_type i = 0; i < re_val.numel (); i++) - result.xelem (i) = Complex (re_val(i), im_val(i)); + result.xelem (i) = Complex (re_val.xelem (i), + im_val.xelem (i)); retval = octave_value (new octave_complex_matrix (result)); } @@ -3714,7 +3762,7 @@ DEFUN (isreal, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isreal (@var{x}) +@deftypefn {} {@var{tf} =} isreal (@var{x}) Return true if @var{x} is a non-complex matrix or scalar. For compatibility with @sc{matlab}, this includes logical and character @@ -3730,7 +3778,7 @@ DEFUN (isempty, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isempty (@var{a}) +@deftypefn {} {@var{tf} =} isempty (@var{a}) Return true if @var{a} is an empty matrix (any one of its dimensions is zero). @seealso{isnull, isa} @@ -3749,7 +3797,7 @@ DEFUN (isnumeric, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isnumeric (@var{x}) +@deftypefn {} {@var{tf} =} isnumeric (@var{x}) Return true if @var{x} is a numeric object, i.e., an integer, real, or complex array. @@ -3782,7 +3830,7 @@ DEFUN (isscalar, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isscalar (@var{x}) +@deftypefn {} {@var{tf} =} isscalar (@var{x}) Return true if @var{x} is a scalar. A scalar is an object with two dimensions for which @code{size (@var{x})} @@ -3821,7 +3869,7 @@ DEFUN (isvector, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isvector (@var{x}) +@deftypefn {} {@var{tf} =} isvector (@var{x}) Return true if @var{x} is a vector. A vector is a 2-D array where one of the dimensions is equal to 1 (either @@ -3862,7 +3910,7 @@ DEFUN (isrow, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isrow (@var{x}) +@deftypefn {} {@var{tf} =} isrow (@var{x}) Return true if @var{x} is a row vector. A row vector is a 2-D array for which @code{size (@var{x})} returns @@ -3911,7 +3959,7 @@ DEFUN (iscolumn, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} iscolumn (@var{x}) +@deftypefn {} {@var{tf} =} iscolumn (@var{x}) Return true if @var{x} is a column vector. A column vector is a 2-D array for which @code{size (@var{x})} returns @@ -3960,7 +4008,7 @@ DEFUN (ismatrix, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} ismatrix (@var{x}) +@deftypefn {} {@var{tf} =} ismatrix (@var{x}) Return true if @var{x} is a 2-D array. A matrix is an object with two dimensions (@code{ndims (@var{x}) == 2}) for @@ -4009,7 +4057,7 @@ DEFUN (issquare, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} issquare (@var{x}) +@deftypefn {} {@var{tf} =} issquare (@var{x}) Return true if @var{x} is a 2-D square array. A square array is a 2-D object for which @code{size (@var{x})} returns @@ -4696,7 +4744,8 @@ %!assert (Inf (3, 2), [Inf, Inf; Inf, Inf; Inf, Inf]) %!assert (size (Inf (3, 4, 5)), [3, 4, 5]) -%!assert (Inf (3, "single"), single ([Inf, Inf, Inf; Inf, Inf, Inf; Inf, Inf, Inf])) +%!assert (Inf (3, "single"), +%! single ([Inf, Inf, Inf; Inf, Inf, Inf; Inf, Inf, Inf])) %!assert (Inf (2, 3, "single"), single ([Inf, Inf, Inf; Inf, Inf, Inf])) %!assert (Inf (3, 2, "single"), single ([Inf, Inf; Inf, Inf; Inf, Inf])) %!assert (size (inf (3, 4, 5, "single")), [3, 4, 5]) @@ -4704,7 +4753,8 @@ %!assert (Inf (2, 2, "like", speye (2)), sparse ([Inf, Inf; Inf, Inf])) %!assert (Inf (2, 2, "like", complex (ones (2, 2))), [Inf, Inf; Inf, Inf]) %!assert (Inf (2, 2, "like", double (1)), double ([Inf, Inf; Inf, Inf])) -%!assert (Inf (3, 3, "like", single (1)), single ([Inf, Inf, Inf; Inf, Inf, Inf; Inf, Inf, Inf])) +%!assert (Inf (3, 3, "like", single (1)), +%! single ([Inf, Inf, Inf; Inf, Inf, Inf; Inf, Inf, Inf])) %!assert (Inf (2, "like", single (1i)), single ([Inf, Inf; Inf, Inf])) %!error Inf (3, "like", int8 (1)) @@ -4775,14 +4825,16 @@ %!assert (NaN (3, 2), [NaN, NaN; NaN, NaN; NaN, NaN]) %!assert (size (NaN (3, 4, 5)), [3, 4, 5]) -%!assert (NaN (3, "single"), single ([NaN, NaN, NaN; NaN, NaN, NaN; NaN, NaN, NaN])) +%!assert (NaN (3, "single"), +%! single ([NaN, NaN, NaN; NaN, NaN, NaN; NaN, NaN, NaN])) %!assert (NaN (2, 3, "single"), single ([NaN, NaN, NaN; NaN, NaN, NaN])) %!assert (NaN (3, 2, "single"), single ([NaN, NaN; NaN, NaN; NaN, NaN])) %!assert (size (NaN (3, 4, 5, "single")), [3, 4, 5]) %!assert (NaN (2, 2, "like", double (1)), double ([NaN, NaN; NaN, NaN])) %!assert (NaN (2, 2, "like", complex (ones(2, 2))), [NaN, NaN; NaN, NaN]) -%!assert (NaN (3, 3, "like", single (1)), single ([NaN, NaN, NaN; NaN, NaN, NaN; NaN, NaN, NaN])) +%!assert (NaN (3, 3, "like", single (1)), +%! single ([NaN, NaN, NaN; NaN, NaN, NaN; NaN, NaN, NaN])) %!assert (NaN (2, "like", single (1i)), single ([NaN, NaN; NaN, NaN])) %!assert (NaN (2, 2, "like", speye (2)), sparse ([NaN, NaN; NaN, NaN])) @@ -4933,7 +4985,7 @@ %!assert (eps (Inf), NaN) %!assert (eps (NaN), NaN) %!assert (eps ([1/2 1 2 realmax 0 realmin/2 realmin/16 Inf NaN]), -%! [2^(-53) 2^(-52) 2^(-51) 2^971 2^(-1074) 2^(-1074) 2^(-1074) NaN NaN]) +%! [2^-53 2^-52 2^-51 2^971 2^-1074 2^-1074 2^-1074 NaN NaN]) %!assert (eps (single (1/2)), single (2^(-24))) %!assert (eps (single (1)), single (2^(-23))) %!assert (eps (single (2)), single (2^(-22))) @@ -4944,7 +4996,7 @@ %!assert (eps (single (Inf)), single (NaN)) %!assert (eps (single (NaN)), single (NaN)) %!assert (eps (single ([1/2 1 2 realmax("single") 0 realmin("single")/2 realmin("single")/16 Inf NaN])), -%! single ([2^(-24) 2^(-23) 2^(-22) 2^104 2^(-149) 2^(-149) 2^(-149) NaN NaN])) +%! single ([2^-24 2^-23 2^-22 2^104 2^-149 2^-149 2^-149 NaN NaN])) %!error eps (uint8 ([0 1 2])) */ @@ -7007,16 +7059,26 @@ ## Single %!assert (sort (single ([NaN, 1, -1, 2, Inf])), single ([-1, 1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 1), single ([NaN, 1, -1, 2, Inf])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2), single ([-1, 1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 3), single ([NaN, 1, -1, 2, Inf])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), "ascend"), single ([-1, 1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2, "ascend"), single ([-1, 1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), "descend"), single ([NaN, Inf, 2, 1, -1])) -%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2, "descend"), single ([NaN, Inf, 2, 1, -1])) -%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4])), single ([3, 1, 6, 4; 8, 2, 7, 5])) -%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4]), 1), single ([3, 1, 6, 4; 8, 2, 7, 5])) -%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4]), 2), single ([1, 3, 5, 7; 2, 4, 6, 8])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 1), +%! single ([NaN, 1, -1, 2, Inf])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2), +%! single ([-1, 1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 3), +%! single ([NaN, 1, -1, 2, Inf])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), "ascend"), +%! single ([-1, 1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2, "ascend"), +%! single ([-1, 1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), "descend"), +%! single ([NaN, Inf, 2, 1, -1])) +%!assert (sort (single ([NaN, 1, -1, 2, Inf]), 2, "descend"), +%! single ([NaN, Inf, 2, 1, -1])) +%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4])), +%! single ([3, 1, 6, 4; 8, 2, 7, 5])) +%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4]), 1), +%! single ([3, 1, 6, 4; 8, 2, 7, 5])) +%!assert (sort (single ([3, 1, 7, 5; 8, 2, 6, 4]), 2), +%! single ([1, 3, 5, 7; 2, 4, 6, 8])) %!assert (sort (single (1)), single (1)) %!test @@ -7026,16 +7088,26 @@ ## Single Complex %!assert (sort (single ([NaN, 1i, -1, 2, Inf])), single ([1i, -1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 1), single ([NaN, 1i, -1, 2, Inf])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2), single ([1i, -1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 3), single ([NaN, 1i, -1, 2, Inf])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), "ascend"), single ([1i, -1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2, "ascend"), single ([1i, -1, 2, Inf, NaN])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), "descend"), single ([NaN, Inf, 2, -1, 1i])) -%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2, "descend"), single ([NaN, Inf, 2, -1, 1i])) -%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4])), single ([3, 1i, 6, 4; 8, 2, 7, 5])) -%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4]), 1), single ([3, 1i, 6, 4; 8, 2, 7, 5])) -%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4]), 2), single ([1i, 3, 5, 7; 2, 4, 6, 8])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 1), +%! single ([NaN, 1i, -1, 2, Inf])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2), +%! single ([1i, -1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 3), +%! single ([NaN, 1i, -1, 2, Inf])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), "ascend"), +%! single ([1i, -1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2, "ascend"), +%! single ([1i, -1, 2, Inf, NaN])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), "descend"), +%! single ([NaN, Inf, 2, -1, 1i])) +%!assert (sort (single ([NaN, 1i, -1, 2, Inf]), 2, "descend"), +%! single ([NaN, Inf, 2, -1, 1i])) +%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4])), +%! single ([3, 1i, 6, 4; 8, 2, 7, 5])) +%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4]), 1), +%! single ([3, 1i, 6, 4; 8, 2, 7, 5])) +%!assert (sort (single ([3, 1i, 7, 5; 8, 2, 6, 4]), 2), +%! single ([1i, 3, 5, 7; 2, 4, 6, 8])) %!assert (sort (single (1i)), single (1i)) %!test @@ -7048,10 +7120,14 @@ %!assert (sort ([true, false, true, false], 1), [true, false, true, false]) %!assert (sort ([true, false, true, false], 2), [false, false, true, true]) %!assert (sort ([true, false, true, false], 3), [true, false, true, false]) -%!assert (sort ([true, false, true, false], "ascend"), [false, false, true, true]) -%!assert (sort ([true, false, true, false], 2, "ascend"), [false, false, true, true]) -%!assert (sort ([true, false, true, false], "descend"), [true, true, false, false]) -%!assert (sort ([true, false, true, false], 2, "descend"), [true, true, false, false]) +%!assert (sort ([true, false, true, false], "ascend"), +%! [false, false, true, true]) +%!assert (sort ([true, false, true, false], 2, "ascend"), +%! [false, false, true, true]) +%!assert (sort ([true, false, true, false], "descend"), +%! [true, true, false, false]) +%!assert (sort ([true, false, true, false], 2, "descend"), +%! [true, true, false, false]) %!assert (sort (true), true) %!test @@ -7060,14 +7136,22 @@ %! assert (i, [2, 4, 1, 3]); ## Sparse Double -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf])), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 1), sparse ([0, NaN, 1, 0, -1, 2, Inf])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 3), sparse ([0, NaN, 1, 0, -1, 2, Inf])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "ascend"), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2, "ascend"), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "descend"), sparse ([NaN, Inf, 2, 1, 0, 0, -1])) -%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2, "descend"), sparse ([NaN, Inf, 2, 1, 0, 0, -1])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf])), +%! sparse ([-1, 0, 0, 1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 1), +%! sparse ([0, NaN, 1, 0, -1, 2, Inf])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2), +%! sparse ([-1, 0, 0, 1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 3), +%! sparse ([0, NaN, 1, 0, -1, 2, Inf])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "ascend"), +%! sparse ([-1, 0, 0, 1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2, "ascend"), +%! sparse ([-1, 0, 0, 1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "descend"), +%! sparse ([NaN, Inf, 2, 1, 0, 0, -1])) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2, "descend"), +%! sparse ([NaN, Inf, 2, 1, 0, 0, -1])) %!shared a %! a = randn (10, 10); @@ -7082,14 +7166,22 @@ %! assert (is, i); ## Sparse Complex -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf])), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 1), sparse ([0, NaN, 1i, 0, -1, 2, Inf])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 3), sparse ([0, NaN, 1i, 0, -1, 2, Inf])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "ascend"), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "ascend"), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "descend"), sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) -%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "descend"), sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf])), +%! sparse ([0, 0, 1i, -1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 1), +%! sparse ([0, NaN, 1i, 0, -1, 2, Inf])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2), +%! sparse ([0, 0, 1i, -1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 3), +%! sparse ([0, NaN, 1i, 0, -1, 2, Inf])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "ascend"), +%! sparse ([0, 0, 1i, -1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "ascend"), +%! sparse ([0, 0, 1i, -1, 2, Inf, NaN])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "descend"), +%! sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "descend"), +%! sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) %!shared a %! a = randn (10, 10); @@ -7105,14 +7197,22 @@ %! assert (is, i); ## Sparse Bool -%!assert (sort (sparse ([true, false, true, false])), sparse ([false, false, true, true])) -%!assert (sort (sparse ([true, false, true, false]), 1), sparse ([true, false, true, false])) -%!assert (sort (sparse ([true, false, true, false]), 2), sparse ([false, false, true, true])) -%!assert (sort (sparse ([true, false, true, false]), 3), sparse ([true, false, true, false])) -%!assert (sort (sparse ([true, false, true, false]), "ascend"), sparse ([false, false, true, true])) -%!assert (sort (sparse ([true, false, true, false]), 2, "ascend"), sparse ([false, false, true, true])) -%!assert (sort (sparse ([true, false, true, false]), "descend"), sparse ([true, true, false, false])) -%!assert (sort (sparse ([true, false, true, false]), 2, "descend"), sparse ([true, true, false, false])) +%!assert (sort (sparse ([true, false, true, false])), +%! sparse ([false, false, true, true])) +%!assert (sort (sparse ([true, false, true, false]), 1), +%! sparse ([true, false, true, false])) +%!assert (sort (sparse ([true, false, true, false]), 2), +%! sparse ([false, false, true, true])) +%!assert (sort (sparse ([true, false, true, false]), 3), +%! sparse ([true, false, true, false])) +%!assert (sort (sparse ([true, false, true, false]), "ascend"), +%! sparse ([false, false, true, true])) +%!assert (sort (sparse ([true, false, true, false]), 2, "ascend"), +%! sparse ([false, false, true, true])) +%!assert (sort (sparse ([true, false, true, false]), "descend"), +%! sparse ([true, true, false, false])) +%!assert (sort (sparse ([true, false, true, false]), 2, "descend"), +%! sparse ([true, true, false, false])) %!test %! [v, i] = sort (sparse ([true, false, true, false])); @@ -7212,17 +7312,17 @@ DEFUN (issorted, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} issorted (@var{a}) -@deftypefnx {} {} issorted (@var{a}, @var{mode}) -@deftypefnx {} {} issorted (@var{a}, "rows", @var{mode}) -Return true if the array is sorted according to @var{mode}, which may be either -@qcode{"ascend"}, @qcode{"descend"}, or @qcode{"either"}. +@deftypefn {} {@var{tf} =} issorted (@var{a}) +@deftypefnx {} {@var{tf} =} issorted (@var{a}, @var{mode}) +@deftypefnx {} {@var{tf} =} issorted (@var{a}, "rows", @var{mode}) +Return true if the vector @var{a} is sorted according to @var{mode}, which +may be either @qcode{"ascend"}, @qcode{"descend"}, or @qcode{"either"}. By default, @var{mode} is @qcode{"ascend"}. NaNs are treated in the same manner as @code{sort}. -If the optional argument @qcode{"rows"} is supplied, check whether the array is -sorted by rows as output by the function @code{sortrows} (with no options). +If the optional argument @qcode{"rows"} is supplied, check whether the matrix +is sorted by rows as output by the function @code{sortrows} (with no options). This function does not support sparse matrices. @seealso{sort, sortrows} @@ -7935,7 +8035,7 @@ idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1); retval = SparseT (retval.index (col1, sl1)) - SparseT (retval.index (col2, sl2)); - assert (retval.columns () == k-1); + error_unless (retval.columns () == k-1); order--; k--; } @@ -7948,7 +8048,7 @@ idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1); retval = SparseT (retval.index (sl1, col1)) - SparseT (retval.index (sl2, col2)); - assert (retval.rows () == k-1); + error_unless (retval.rows () == k-1); order--; k--; } @@ -8128,7 +8228,8 @@ { Array retval; - assert (rep.ndims () == 2 && rep.rows () == 2); + if (rep.ndims () != 2 || rep.rows () != 2) + error ("repelems: R must be a 2-row, N-column matrix of integers"); octave_idx_type n = rep.columns (); octave_idx_type l = 0; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/debug.cc Sun Apr 03 11:30:26 2022 -0400 @@ -529,12 +529,12 @@ %!test %! if (isguirunning ()) %! orig_show_dbg = __event_manager_gui_preference__ ("editor/show_dbg_file", -%! "0"); +%! "0"); %! endif %! unwind_protect %! dbclear all; # Clear out breakpoints before test %! dbstop @ftp/dir; -%! dbstop @audioplayer/set 70; +%! dbstop @audioplayer/set 75; %! dbstop quantile>__quantile__; %! dbstop ls; %! s = dbstatus; @@ -1171,7 +1171,7 @@ DEFMETHOD (isdebugmode, interp, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isdebugmode () +@deftypefn {} {@var{tf} =} isdebugmode () Return true if in debugging mode, otherwise false. @seealso{dbwhere, dbstack, dbstatus} @end deftypefn */) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/dirfns.cc --- a/libinterp/corefcn/dirfns.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/dirfns.cc Sun Apr 03 11:30:26 2022 -0400 @@ -713,7 +713,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} confirm_recursive_rmdir () @deftypefnx {} {@var{old_val} =} confirm_recursive_rmdir (@var{new_val}) -@deftypefnx {} {} confirm_recursive_rmdir (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} confirm_recursive_rmdir (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will ask for confirmation before recursively removing a directory tree. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/dot.cc --- a/libinterp/corefcn/dot.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/dot.cc Sun Apr 03 11:30:26 2022 -0400 @@ -37,12 +37,14 @@ OCTAVE_NAMESPACE_BEGIN +// FIXME: input 'y' is no longer necessary (2/5/2022). +// At some point it would be better to change all occurrences of +// get_red_dims to eliminate this input parameter. static void -get_red_dims (const dim_vector& x, const dim_vector& y, int dim, +get_red_dims (const dim_vector& x, const dim_vector& /* y */, int dim, dim_vector& z, F77_INT& m, F77_INT& n, F77_INT& k) { int nd = x.ndims (); - assert (nd == y.ndims ()); z = dim_vector::alloc (nd); octave_idx_type tmp_m = 1; octave_idx_type tmp_n = 1; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/environment.cc --- a/libinterp/corefcn/environment.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/environment.cc Sun Apr 03 11:30:26 2022 -0400 @@ -157,7 +157,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} EDITOR () @deftypefnx {} {@var{old_val} =} EDITOR (@var{new_val}) -@deftypefnx {} {} EDITOR (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} EDITOR (@var{new_val}, "local") Query or set the internal variable that specifies the default text editor. The default value is taken from the environment variable @w{@env{EDITOR}} @@ -192,7 +192,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} EXEC_PATH () @deftypefnx {} {@var{old_val} =} EXEC_PATH (@var{new_val}) -@deftypefnx {} {} EXEC_PATH (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} EXEC_PATH (@var{new_val}, "local") Query or set the internal variable that specifies a colon separated list of directories to append to the shell PATH when executing external programs. @@ -229,7 +229,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} IMAGE_PATH () @deftypefnx {} {@var{old_val} =} IMAGE_PATH (@var{new_val}) -@deftypefnx {} {} IMAGE_PATH (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} IMAGE_PATH (@var{new_val}, "local") Query or set the internal variable that specifies a colon separated list of directories in which to search for image files. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/error.cc Sun Apr 03 11:30:26 2022 -0400 @@ -657,7 +657,7 @@ octave_idx_type nel = ident.numel (); - assert (nel != 0); + panic_if (nel == 0); bool found = false; @@ -689,8 +689,7 @@ // The warning state "all" is always supposed to remain in the list, // so we should always find a state, either explicitly or by using the // state for "all". - - assert (found); + panic_unless (found); retval.assign ("identifier", id); retval.assign ("state", val); @@ -2116,7 +2115,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} beep_on_error () @deftypefnx {} {@var{old_val} =} beep_on_error (@var{new_val}) -@deftypefnx {} {} beep_on_error (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} beep_on_error (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will try to ring the terminal bell before printing an error message. @@ -2134,7 +2133,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} debug_on_error () @deftypefnx {} {@var{old_val} =} debug_on_error (@var{new_val}) -@deftypefnx {} {} debug_on_error (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} debug_on_error (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will try to enter the debugger when an error is encountered. @@ -2156,7 +2155,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} debug_on_warning () @deftypefnx {} {@var{old_val} =} debug_on_warning (@var{new_val}) -@deftypefnx {} {} debug_on_warning (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} debug_on_warning (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will try to enter the debugger when a warning is encountered. @@ -2180,8 +2179,3 @@ } OCTAVE_NAMESPACE_END - -// Deprecated variables and functions. - -// This variable is obsolete and always has the value 0. -int error_state = 0; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/error.h --- a/libinterp/corefcn/error.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/error.h Sun Apr 03 11:30:26 2022 -0400 @@ -174,7 +174,8 @@ octave_map warning_options (void) const { return m_warning_options; } - void set_warning_options (const octave_map& val) { m_warning_options = val; } + void set_warning_options (const octave_map& val) + { m_warning_options = val; } octave_map warning_options (const octave_map& new_val) { @@ -187,9 +188,7 @@ last_error_message (const octave_value_list& args, int nargout); void set_last_error_message (const std::string& val) - { - m_last_error_message = val; - } + { m_last_error_message = val; } std::string last_error_message (void) const { return m_last_error_message; } @@ -203,9 +202,11 @@ OCTINTERP_API octave_value last_warning_message (const octave_value_list& args, int nargout); - void set_last_warning_message (const std::string& val) { m_last_warning_message = val; } + void set_last_warning_message (const std::string& val) + { m_last_warning_message = val; } - std::string last_warning_message (void) const { return m_last_warning_message; } + std::string last_warning_message (void) const + { return m_last_warning_message; } std::string last_warning_message (const std::string& s) { @@ -217,7 +218,8 @@ OCTINTERP_API octave_value last_warning_id (const octave_value_list& args, int nargout); - void set_last_warning_id (const std::string& val) { m_last_warning_id = val; } + void set_last_warning_id (const std::string& val) + { m_last_warning_id = val; } std::string last_warning_id (void) const { return m_last_warning_id; } @@ -408,9 +410,6 @@ // not deprecated and eventually removed, does it make sense to also // define them inside the octave namespace? -#define panic_impossible() \ - panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__) - extern OCTINTERP_API void vmessage (const char *name, const char *fmt, va_list args); @@ -506,6 +505,52 @@ OCTAVE_NORETURN extern OCTINTERP_API void panic (const char *fmt, ...); +#define panic_impossible() \ + panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__) + +inline void +panic_if (bool cond) +{ +#ifndef NDEBUG + if (cond) + panic_impossible (); + else + return; + +#else + octave_unused_parameter (cond); +#endif +} + +inline void +panic_unless (bool cond) +{ + panic_if (! cond); +} + +#define error_impossible() \ + error ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__) + +inline void +error_if (bool cond) +{ +#ifndef NDEBUG + if (cond) + error_impossible (); + else + return; + +#else + octave_unused_parameter (cond); +#endif +} + +inline void +error_unless (bool cond) +{ + error_if (! cond); +} + OCTAVE_NAMESPACE_BEGIN //! Helper function for print_usage defined in defun.cc. @@ -566,14 +611,6 @@ octave::interpreter_try (uwp); } -OCTAVE_DEPRECATED (6, "this function is obsolete and should not be needed") -inline void reset_error_handler (void) { } #endif -// This symbol must have be declared with the correct visibility -// attributes when Octave is built, so it must appear unconditionally in -// this header file. -OCTAVE_DEPRECATED (6, "this variable is obsolete and always has the value 0") -extern OCTINTERP_API int error_state; - #endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/errwarn.h --- a/libinterp/corefcn/errwarn.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/errwarn.h Sun Apr 03 11:30:26 2022 -0400 @@ -188,11 +188,4 @@ extern OCTINTERP_API void warn_wrong_type_arg (const char *name, const octave_value& tc); -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "this function will be removed in a future version of Octave") -inline void -warn_divide_by_zero (void) -{ } #endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/event-manager.h --- a/libinterp/corefcn/event-manager.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/event-manager.h Sun Apr 03 11:30:26 2022 -0400 @@ -623,7 +623,8 @@ return false; } - bool gui_status_update (const std::string& feature, const std::string& status) + bool gui_status_update (const std::string& feature, + const std::string& status) { if (enabled ()) { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/file-io.cc Sun Apr 03 11:30:26 2022 -0400 @@ -60,14 +60,12 @@ #include "mkostemp-wrapper.h" #include "oct-env.h" #include "oct-locbuf.h" -#include "tmpfile-wrapper.h" #include "unistd-wrappers.h" #include "builtin-defun-decls.h" #include "defun.h" #include "error.h" #include "errwarn.h" -#include "file-io.h" #include "interpreter-private.h" #include "interpreter.h" #include "load-path.h" @@ -905,6 +903,34 @@ return puts_internal (interp, who, args); } +/* +## Check if text is correctly converted to output encoding +%!test <*61839> +%! str = "aäöu"; # string with non-ASCII characters +%! fname = tempname (); +%! fid = fopen (fname, "wt", "n", "ISO-8859-1"); +%! unwind_protect +%! fprintf (fid, '%s\n', str); +%! fdisp (fid, str); +%! fputs (fid, str); +%! fclose (fid); +%! ## re-open file for reading in binary mode +%! fid = fopen (fname, "rb"); +%! fb = fread (fid); +%! fclose (fid); +%! ## check file content +%! encoded = [97 228 246 117]; # original string in ISO-8859-1 encoding +%! if (ispc ()) +%! eol = double ("\r\n"); +%! else +%! eol = double ("\n"); +%! endif +%! assert (fb.', [encoded eol encoded eol encoded]) +%! unwind_protect_cleanup +%! unlink (fname); +%! end_unwind_protect +*/ + DEFMETHOD (puts, interp, args, , doc: /* -*- texinfo -*- @deftypefn {} {} puts (@var{string}) @@ -2278,6 +2304,7 @@ %! fid = fopen (f, "w+", "n", "iso-8859-1"); %! unwind_protect %! fprintf (fid, "abc,äöü\n"); +%! fflush (fid); %! fseek (fid, 0, "bof"); %! obs = textscan (fid, "%s", "delimiter", ","); %! fclose (fid); @@ -2329,6 +2356,8 @@ %! C = textscan ('5973459727478852968', '%u64'); %! assert (C{1}, uint64 (5973459727478852968)); +%!assert <*60711> (textscan('1,.,2', '%f', 'Delimiter', ','), {1}); + */ // These tests have end-comment sequences, so can't just be in a comment @@ -2853,6 +2882,51 @@ return ovl (streams.remove (args(0), "pclose")); } +DEFUN (tempdir, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {@var{dir} =} tempdir () +Return the name of the host system's directory for temporary files. + +The directory name is taken first from the environment variable @env{TMPDIR}. +If that does not exist, the environment variable @env{TMP} (and on Windows +platforms also with higher priority the environment variable @env{TEMP}) is +checked. If none of those are set, the system default returned by +@code{P_tmpdir} is used. +@seealso{P_tmpdir, tempname, mkstemp, tmpfile} +@end deftypefn */) +{ + int nargin = args.length (); + + if (nargin > 0) + print_usage (); + + std::string tmpdir = sys::env::get_temp_directory (); + + if (! sys::file_ops::is_dir_sep (tmpdir.back ())) + tmpdir += sys::file_ops::dir_sep_str (); + + return ovl (tmpdir); +} + +/* +%!assert (ischar (tempdir ())) + +%!test +%! old_wstate = warning ("off"); +%! old_tmpdir = getenv ("TMPDIR"); +%! unwind_protect +%! setenv ("TMPDIR", "__MY_TMP_DIR__"); +%! assert (tempdir (), ["__MY_TMP_DIR__" filesep()]); +%! unwind_protect_cleanup +%! if (! isempty (old_tmpdir)) +%! setenv ("TMPDIR", old_tmpdir); +%! else +%! unsetenv ("TMPDIR"); +%! endif +%! warning (old_wstate); +%! end_unwind_protect +*/ + DEFUN (tempname, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{fname} =} tempname () @@ -2882,8 +2956,6 @@ if (nargin > 0) dir = args(0).xstring_value ("tempname: DIR must be a string"); - else - dir = sys::env::getenv ("TMPDIR"); std::string pfx ("oct-"); @@ -2966,15 +3038,15 @@ octave_value_list retval; - FILE *fid = octave_tmpfile_wrapper (); + std::string tmpfile (sys::tempnam (sys::env::get_temp_directory (), "oct-")); + + FILE *fid = sys::fopen_tmp (tmpfile, "w+b"); if (fid) { - std::string nm; - std::ios::openmode md = fopen_mode_to_ios_mode ("w+b"); - stream s = stdiostream::create (nm, fid, md); + stream s = stdiostream::create (tmpfile, fid, md); if (! s) { @@ -3253,24 +3325,4 @@ return const_value ("stderr", args, streams.stderr_file ()); } -// Deprecated variables and functions. - -// Remove when corresponding global deprecated function is removed. -void mark_for_deletion_deprecated (const std::string& file) -{ - octave::interpreter& interp - = octave::__get_interpreter__ ("mark_for_deletion"); - - interp.mark_for_deletion (file); -} - -// Remove when corresponding global deprecated function is removed. -void cleanup_tmp_files_deprecated (void) -{ - octave::interpreter& interp - = octave::__get_interpreter__ ("cleanup_tmp_files"); - - interp.cleanup_tmp_files (); -} - OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/file-io.h --- a/libinterp/corefcn/file-io.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/file-io.h Sun Apr 03 11:30:26 2022 -0400 @@ -23,43 +23,9 @@ // //////////////////////////////////////////////////////////////////////// -// Written by John C. Campbell - #if ! defined (octave_file_io_h) #define octave_file_io_h 1 -#include "octave-config.h" - -#include - -OCTAVE_NAMESPACE_BEGIN - -// Use this function internally until the function that uses it is -// removed. Remove when corresponding global deprecated function is -// removed. -extern void mark_for_deletion_deprecated (const std::string&); - -// Use this function internally until the function that uses it is -// removed. Remove when corresponding global deprecated function is -// removed. -extern void cleanup_tmp_files_deprecated (void); - -OCTAVE_NAMESPACE_END - -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) - -OCTAVE_DEPRECATED (6, "use 'interpreter::mark_for_deletion' instead") -inline void mark_for_deletion (const std::string& fname) -{ - octave::mark_for_deletion_deprecated (fname); -} - -OCTAVE_DEPRECATED (6, "use 'interpreter::cleanup_tmp_files' instead") -inline void cleanup_tmp_files (void) -{ - octave::cleanup_tmp_files_deprecated (); -} +#warning "file-io.h was deprecated in Octave 8 and will be removed in a future version." #endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/filter.cc --- a/libinterp/corefcn/filter.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/filter.cc Sun Apr 03 11:30:26 2022 -0400 @@ -106,6 +106,8 @@ if (a_len <= 1 && si_len <= 0) return b(0) * x; + // Here onwards, either a_len > 1 or si_len >= 1 or both. + y.resize (x_dims, 0.0); octave_idx_type x_stride = 1; @@ -113,29 +115,69 @@ x_stride *= x_dims(i); octave_idx_type x_num = x_dims.numel () / x_len; + // For deconv and fftfilt, x_num seems to always be 1. + // For directly calling filter, it can be more than 1. + for (octave_idx_type num = 0; num < x_num; num++) { - octave_idx_type x_offset; - if (x_stride == 1) - x_offset = num * x_len; - else - { - x_offset = num; - octave_idx_type n_strides = num / x_stride; - x_offset += n_strides * x_stride * (x_len - 1); - } + octave_idx_type x_offset = (x_stride == 1) ? num * x_len + : num + (num / x_stride) * x_stride * (x_len - 1); + octave_idx_type si_offset = num * si_len; + // Try to achieve a balance between speed and interruptibility. + // + // One extreme is to not check for interruptions at all, which gives + // good speed but the user cannot use Ctrl-C for the whole duration. + // The other end is to check frequently from inside an inner loop, + // which slows down performance by 5X or 6X. + // + // Putting any sort of check in an inner loop seems to prevent the + // compiler from optimizing the loop, so we cannot say "check for + // interruptions every M iterations" using an if-statement. + // + // This is a compromise approach to split the total numer of loop + // executions into num_outer and num_inner, to provide periodic checks + // for interruptions without writing a conditional inside a tight loop. + // + // To make it more interruptible and run more slowly, reduce num_inner. + // To speed it up but make it less interruptible, increase it. + // May need to increase it slowly over time as computers get faster. + // The aim is to not lose Ctrl-C ability for longer than about 2 seconds. + // + // In December 2021, num_inner = 100000 is acceptable. + + octave_idx_type num_execs = si_len-1; // 0 to num_execs-1 + octave_idx_type num_inner = 100000; + octave_idx_type num_outer = num_execs / num_inner; + + // The following if-else block depends on a_len and si_len, + // both of which are loop invariants in this 0 <= num < x_num loop. + // But x_num is so small in practice that using the if-else inside + // the loop has more benefits than duplicating the outer for-loop, + // even though the checks are on loop invariants. + + // We cannot have a_len <= 1 AND si_len <= 0 because that case already + // returned above. This means exactly one of the following blocks + // inside the if-conditional will be obeyed: it is not possible for the + // if-block and the else-block to *both* skip. Therefore any code that + // is common to both branches can be pulled out here without affecting + // correctness or speed. + + T *py = y.fortran_vec (); + T *psi = si.fortran_vec (); + const T *pb = b.data (); + const T *px = x.data (); + psi += si_offset; + if (a_len > 1) { - T *py = y.fortran_vec (); - T *psi = si.fortran_vec (); + const T *pa = a.data (); - const T *pa = a.data (); - const T *pb = b.data (); - const T *px = x.data (); - - psi += si_offset; + // Usually the last element to be written will be si_len-1 + // but if si_len is 0, then we need the 0th element to be written. + // Pulling this check out of the for-loop makes it run faster. + octave_idx_type iidx = (si_len > 0) ? si_len-1 : 0; for (octave_idx_type i = 0, idx = x_offset; i < x_len; @@ -143,34 +185,27 @@ { py[idx] = psi[0] + pb[0] * px[idx]; - if (si_len > 0) + // Outer and inner loops for interruption management + for (octave_idx_type u = 0; u <= num_outer; u++) { - for (octave_idx_type j = 0; j < si_len - 1; j++) - { - octave_quit (); - - psi[j] = psi[j+1] - pa[j+1] * py[idx] + pb[j+1] * px[idx]; - } + octave_idx_type lo = u * num_inner; + octave_idx_type hi = (lo + num_inner < num_execs-1) + ? lo + num_inner : num_execs-1; - psi[si_len-1] = pb[si_len] * px[idx] - pa[si_len] * py[idx]; + // Inner loop, no interruption + for (octave_idx_type j = lo; j <= hi; j++) + psi[j] = psi[j+1] - pa[j+1] * py[idx] + pb[j+1] * px[idx]; + + octave_quit(); // Check for interruptions } - else - { - octave_quit (); - psi[0] = pb[si_len] * px[idx] - pa[si_len] * py[idx]; - } + psi[iidx] = pb[si_len] * px[idx] - pa[si_len] * py[idx]; } } - else if (si_len > 0) + else // a_len <= 1 ==> si_len MUST be > 0 { - T *py = y.fortran_vec (); - T *psi = si.fortran_vec (); - - const T *pb = b.data (); - const T *px = x.data (); - - psi += si_offset; + // This else-block is almost the same as the above if-block, + // except for the absence of variable pa. for (octave_idx_type i = 0, idx = x_offset; i < x_len; @@ -178,23 +213,21 @@ { py[idx] = psi[0] + pb[0] * px[idx]; - if (si_len > 1) + // Outer and inner loops for interruption management + for (octave_idx_type u = 0; u <= num_outer; u++) { - for (octave_idx_type j = 0; j < si_len - 1; j++) - { - octave_quit (); - - psi[j] = psi[j+1] + pb[j+1] * px[idx]; - } + octave_idx_type lo = u * num_inner; + octave_idx_type hi = (lo + num_inner < num_execs-1) + ? lo + num_inner : num_execs-1; - psi[si_len-1] = pb[si_len] * px[idx]; + // Inner loop, no interruption + for (octave_idx_type j = lo; j <= hi; j++) + psi[j] = psi[j+1] + pb[j+1] * px[idx]; + + octave_quit(); // Check for interruptions } - else - { - octave_quit (); - psi[0] = pb[1] * px[idx]; - } + psi[si_len-1] = pb[si_len] * px[idx]; } } } @@ -596,14 +629,16 @@ %!assert (filter (1, ones (10,1) / 10, []), []) %!assert (filter (1, ones (10,1) / 10, zeros (0,10)), zeros (0,10)) -%!assert (filter (1, ones (10,1) / 10, single (1:5)), repmat (single (10), 1, 5)) +%!assert (filter (1, ones (10,1) / 10, single (1:5)), +%! repmat (single (10), 1, 5)) ## Test using initial conditions %!assert (filter ([1, 1, 1], [1, 1], [1 2], [1, 1]), [2 2]) %!assert (filter ([1, 1, 1], [1, 1], [1 2], [1, 1]'), [2 2]) %!assert (filter ([1, 3], [1], [1 2; 3 4; 5 6], [4, 5]), [5 7; 6 10; 14 18]) %!error filter ([1, 3], [1], [1 2; 3 4; 5 6], [4, 5]') -%!assert (filter ([1, 3, 2], [1], [1 2; 3 4; 5 6], [1 0 0; 1 0 0], 2), [2 6; 3 13; 5 21]) +%!assert (filter ([1, 3, 2], [1], [1 2; 3 4; 5 6], [1 0 0; 1 0 0], 2), +%! [2 6; 3 13; 5 21]) ## Test of DIM parameter %!test diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/find.cc --- a/libinterp/corefcn/find.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/find.cc Sun Apr 03 11:30:26 2022 -0400 @@ -54,7 +54,8 @@ idx = nda.find (); // The maximum element is always at the end. - octave_idx_type iext = (idx.isempty () ? 0 : idx.xelem (idx.numel () - 1) + 1); + octave_idx_type iext = (idx.isempty () ? 0 + : idx.xelem (idx.numel () - 1) + 1); switch (nargout) { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/gcd.cc --- a/libinterp/corefcn/gcd.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/gcd.cc Sun Apr 03 11:30:26 2022 -0400 @@ -514,7 +514,8 @@ /* %!assert (gcd (200, 300, 50, 35), 5) %!assert (gcd (int16 (200), int16 (300), int16 (50), int16 (35)), int16 (5)) -%!assert (gcd (uint64 (200), uint64 (300), uint64 (50), uint64 (35)), uint64 (5)) +%!assert (gcd (uint64 (200), uint64 (300), uint64 (50), uint64 (35)), +%! uint64 (5)) %!assert (gcd (18-i, -29+3i), -3-4i) %!test diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/gl-render.h --- a/libinterp/corefcn/gl-render.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/gl-render.h Sun Apr 03 11:30:26 2022 -0400 @@ -146,7 +146,8 @@ double p1, double p1N, double p2, double p2N, int xyz, bool is_3D); - virtual void render_tickmarks (const Matrix& ticks, double lim1, double lim2, + virtual void render_tickmarks (const Matrix& ticks, + double lim1, double lim2, double p1, double p1N, double p2, double p2N, double dx, double dy, double dz, int xyz, bool doubleside); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/gl2ps-print.cc --- a/libinterp/corefcn/gl2ps-print.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/gl2ps-print.cc Sun Apr 03 11:30:26 2022 -0400 @@ -42,7 +42,7 @@ #include "file-ops.h" #include "lo-mappers.h" #include "oct-locbuf.h" -#include "tmpfile-wrapper.h" +#include "oct-env.h" #include "unistd-wrappers.h" #include "unistr-wrappers.h" #include "unwind-prot.h" @@ -396,7 +396,9 @@ gl2ps_sort = GL2PS_NO_SORT; // Use a temporary file in case an overflow happens - FILE *tmpf = octave_tmpfile_wrapper (); + std::string tmpfile (sys::tempnam (sys::env::get_temp_directory (), + "oct-")); + FILE *tmpf = sys::fopen_tmp (tmpfile, "w+b"); if (! tmpf) error ("gl2ps_renderer::draw: couldn't open temporary file for printing"); @@ -1329,16 +1331,20 @@ std::swap (vp_lim_min(1), vp_lim_max(1)); float clip_xmin - = do_clip ? (vp_lim_min(0) > m_xmin ? vp_lim_min(0) : m_xmin) : vp_lim_min(0); + = do_clip ? (vp_lim_min(0) > m_xmin ? vp_lim_min(0) : m_xmin) + : vp_lim_min(0); float clip_ymin - = do_clip ? (vp_lim_min(1) > m_ymin ? vp_lim_min(1) : m_ymin) : vp_lim_min(1); + = do_clip ? (vp_lim_min(1) > m_ymin ? vp_lim_min(1) : m_ymin) + : vp_lim_min(1); float clip_xmax - = do_clip ? (vp_lim_max(0) < m_xmax ? vp_lim_max(0) : m_xmax) : vp_lim_max(0); + = do_clip ? (vp_lim_max(0) < m_xmax ? vp_lim_max(0) : m_xmax) + : vp_lim_max(0); float clip_ymax - = do_clip ? (vp_lim_max(1) < m_ymax ? vp_lim_max(1) : m_ymax) : vp_lim_max(1); + = do_clip ? (vp_lim_max(1) < m_ymax ? vp_lim_max(1) : m_ymax) + : vp_lim_max(1); if (im_xmin < clip_xmin) j0 += (clip_xmin - im_xmin)/nor_dx + 1; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/graphics-toolkit.h --- a/libinterp/corefcn/graphics-toolkit.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/graphics-toolkit.h Sun Apr 03 11:30:26 2022 -0400 @@ -284,12 +284,4 @@ }; } -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "use 'octave::graphics_toolkit' instead") -typedef octave::graphics_toolkit graphics_toolkit; - -OCTAVE_DEPRECATED (6, "use 'octave::base_graphics_toolkit' instead") -typedef octave::base_graphics_toolkit base_graphics_toolkit; #endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/graphics.cc Sun Apr 03 11:30:26 2022 -0400 @@ -4138,7 +4138,8 @@ %! set (0, "units", "pixels"); %! assert (get (0, "screensize"), sz + [1, 1, 0, 0]); %! set (0, "units", "characters"); -%! assert (get (0, "screensize"), sz / dpi * (74.951 / 12.0), 0.5 / dpi * (74.951 / 12.0)); +%! assert (get (0, "screensize"), +%! sz / dpi * (74.951 / 12.0), 0.5 / dpi * (74.951 / 12.0)); %! unwind_protect_cleanup %! set (0, "units", old_units); %! end_unwind_protect @@ -5190,7 +5191,8 @@ yaxislocation_is ("origin"), m_xscale.is ("log") ? 2 : (xaxislocation_is ("origin") ? 0 : (xaxislocation_is ("bottom") ? -1 : 1)), m_ylim); - calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), false, 2, m_zlim); + calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), + false, 2, m_zlim); xset (m_xlabel.handle_value (), "handlevisibility", "off"); xset (m_ylabel.handle_value (), "handlevisibility", "off"); @@ -5502,11 +5504,11 @@ // FIXME: Should this have all properties in it? // Including ones we do don't implement? - // FIXME: This function is probably never called without mode == "reset" - // Check that this is the case with an assert statement (1/6/2017). + // FIXME: This function is probably never called without mode == "reset". + // Verify this is the case with error_unless() (1/6/2017). // If there are reports of problems then figure out what code is // calling it with the mode set to something else. - assert (mode == "reset"); + error_unless (mode == "reset"); Matrix tlim (1, 2, 0.0); tlim(1) = 1; @@ -6486,7 +6488,8 @@ if (xlabel_props.horizontalalignmentmode_is ("auto")) { xlabel_props.set_horizontalalignment - (m_xstate > AXE_DEPTH_DIR ? "center" : (m_xyzSym ? "left" : "right")); + (m_xstate > AXE_DEPTH_DIR ? "center" + : (m_xyzSym ? "left" : "right")); xlabel_props.set_horizontalalignmentmode ("auto"); } @@ -6590,7 +6593,8 @@ if (ylabel_props.horizontalalignmentmode_is ("auto")) { ylabel_props.set_horizontalalignment - (m_ystate > AXE_DEPTH_DIR ? "center" : (! m_xyzSym ? "left" : "right")); + (m_ystate > AXE_DEPTH_DIR ? "center" + : (! m_xyzSym ? "left" : "right")); ylabel_props.set_horizontalalignmentmode ("auto"); } @@ -7782,7 +7786,8 @@ Matrix axes::properties::get_axis_limits (double xmin, double xmax, double min_pos, double max_neg, - const bool logscale) + const bool logscale, + const std::string& method) { Matrix retval; @@ -7834,17 +7839,38 @@ max_val *= 0.9; } } - if (min_val > 0) - { - // Log plots with all positive data - min_val = std::pow (10, std::floor (log10 (min_val))); - max_val = std::pow (10, std::ceil (log10 (max_val))); - } - else - { - // Log plots with all negative data - min_val = -std::pow (10, std::ceil (log10 (-min_val))); - max_val = -std::pow (10, std::floor (log10 (-max_val))); + + if (method == "tickaligned") + { + if (min_val > 0) + { + // Log plots with all positive data + min_val = std::pow (10, std::floor (log10 (min_val))); + max_val = std::pow (10, std::ceil (log10 (max_val))); + } + else + { + // Log plots with all negative data + min_val = -std::pow (10, std::ceil (log10 (-min_val))); + max_val = -std::pow (10, std::floor (log10 (-max_val))); + } + } + else if (method == "padded") + { + if (min_val > 0) + { + // Log plots with all positive data + double pad = (log10 (max_val) - log10 (min_val)) * 0.07; + min_val = std::pow (10, log10 (min_val) - pad); + max_val = std::pow (10, log10 (max_val) + pad); + } + else + { + // Log plots with all negative data + double pad = (log10 (-min_val) - log10 (-max_val)) * 0.07; + min_val = -std::pow (10, log10 (-min_val) + pad); + max_val = -std::pow (10, log10 (-max_val) - pad); + } } } else @@ -7862,12 +7888,21 @@ max_val += 0.1 * std::abs (max_val); } - double tick_sep = calc_tick_sep (min_val, max_val); - double min_tick = std::floor (min_val / tick_sep); - double max_tick = std::ceil (max_val / tick_sep); - // Prevent round-off from cropping ticks - min_val = std::min (min_val, tick_sep * min_tick); - max_val = std::max (max_val, tick_sep * max_tick); + if (method == "tickaligned") + { + double tick_sep = calc_tick_sep (min_val, max_val); + double min_tick = std::floor (min_val / tick_sep); + double max_tick = std::ceil (max_val / tick_sep); + // Prevent round-off from cropping ticks + min_val = std::min (min_val, tick_sep * min_tick); + max_val = std::max (max_val, tick_sep * max_tick); + } + else if (method == "padded") + { + double pad = 0.07 * (max_val - min_val); + min_val -= pad; + max_val += pad; + } } } @@ -8082,13 +8117,16 @@ array_property& mticks, bool limmode_is_auto, bool tickmode_is_auto, - bool is_logscale) + bool is_logscale, + bool method_is_padded, + bool method_is_tight) { if (lims.get ().isempty ()) return; double lo = (lims.get ().matrix_value ())(0); double hi = (lims.get ().matrix_value ())(1); + double lo_lim = lo; double hi_lim = hi; bool is_negative = lo < 0 && hi < 0; @@ -8132,17 +8170,28 @@ if (limmode_is_auto) { - // Adjust limits to include min and max ticks Matrix tmp_lims (1, 2); - tmp_lims(0) = std::min (tick_sep * i1, lo); - tmp_lims(1) = std::max (tick_sep * i2, hi); + + if (! method_is_padded && ! method_is_tight) + { + // Adjust limits to include min and max ticks + tmp_lims(0) = std::min (tick_sep * i1, lo); + tmp_lims(1) = std::max (tick_sep * i2, hi); + } + else + { + tmp_lims(0) = lo; + tmp_lims(1) = hi; + } if (is_logscale) { tmp_lims(0) = std::pow (10., tmp_lims(0)); tmp_lims(1) = std::pow (10., tmp_lims(1)); + if (tmp_lims(0) <= 0) tmp_lims(0) = std::pow (10., lo); + if (is_negative) { double tmp = tmp_lims(0); @@ -8150,6 +8199,7 @@ tmp_lims(1) = -tmp; } } + lims = tmp_lims; } else @@ -8518,9 +8568,11 @@ { get_children_limits (min_val, max_val, min_pos, max_neg, kids, 'x'); + std::string method = m_properties.get_xlimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.xscale_is ("log")); + m_properties.xscale_is ("log"), + method); } else m_properties.check_axis_limits (limits, kids, @@ -8539,9 +8591,11 @@ { get_children_limits (min_val, max_val, min_pos, max_neg, kids, 'y'); + std::string method = m_properties.get_ylimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.yscale_is ("log")); + m_properties.yscale_is ("log"), + method); } else m_properties.check_axis_limits (limits, kids, @@ -8563,9 +8617,11 @@ m_properties.set_has3Dkids ((max_val - min_val) > std::numeric_limits::epsilon ()); + std::string method = m_properties.get_zlimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.zscale_is ("log")); + m_properties.zscale_is ("log"), + method); } else { @@ -8718,9 +8774,11 @@ { get_children_limits (min_val, max_val, min_pos, max_neg, kids, 'x'); + std::string method = m_properties.get_xlimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.xscale_is ("log")); + m_properties.xscale_is ("log"), + method); } else { @@ -8741,9 +8799,11 @@ { get_children_limits (min_val, max_val, min_pos, max_neg, kids, 'y'); + std::string method = m_properties.get_ylimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.yscale_is ("log")); + m_properties.yscale_is ("log"), + method); } else { @@ -8773,9 +8833,11 @@ && ! m_properties.zscale_is ("log")) min_val = max_val = 0.; + std::string method = m_properties.get_zlimitmethod (); limits = m_properties.get_axis_limits (min_val, max_val, min_pos, max_neg, - m_properties.zscale_is ("log")); + m_properties.zscale_is ("log"), + method); } else { @@ -10324,8 +10386,8 @@ if (! cd.isempty () && (c_rows != 1 || c_cols != 3) && (c_rows != x_rows || (c_cols != 1 && c_cols != 3))) { - m_bad_data_msg = "cdata must be an rgb triplet or have the same number of " - "rows as X and one or three columns"; + m_bad_data_msg = "cdata must be an rgb triplet or have the same number " + "of rows as X and one or three columns"; return; } @@ -12646,7 +12708,7 @@ DEFMETHOD (ishghandle, interp, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} ishghandle (@var{h}) +@deftypefn {} {@var{tf} =} ishghandle (@var{h}) Return true if @var{h} is a graphics handle and false otherwise. @var{h} may also be a matrix of handles in which case a logical array is diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/graphics.in.h Sun Apr 03 11:30:26 2022 -0400 @@ -950,7 +950,8 @@ const std::string& current_value (void) const { return m_current_val; } - std::string values_as_string (void) const { return m_vals.values_as_string (); } + std::string values_as_string (void) const + { return m_vals.values_as_string (); } Cell values_as_cell (void) const { return m_vals.values_as_cell (); } @@ -1378,7 +1379,8 @@ array_property (void) : base_property ("", graphics_handle ()), m_data (Matrix ()), m_min_val (), m_max_val (), m_min_pos (), m_max_neg (), - m_type_constraints (), m_size_constraints (), m_finite_constraint (NO_CHECK), + m_type_constraints (), m_size_constraints (), + m_finite_constraint (NO_CHECK), m_minval (std::pair (octave_NaN, true)), m_maxval (std::pair (octave_NaN, true)) { @@ -1389,7 +1391,8 @@ const octave_value& m) : base_property (nm, h), m_data (m.issparse () ? m.full_value () : m), m_min_val (), m_max_val (), m_min_pos (), m_max_neg (), - m_type_constraints (), m_size_constraints (), m_finite_constraint (NO_CHECK), + m_type_constraints (), m_size_constraints (), + m_finite_constraint (NO_CHECK), m_minval (std::pair (octave_NaN, true)), m_maxval (std::pair (octave_NaN, true)) { @@ -1401,8 +1404,10 @@ // copy constraints. array_property (const array_property& p) : base_property (p), m_data (p.m_data), - m_min_val (p.m_min_val), m_max_val (p.m_max_val), m_min_pos (p.m_min_pos), m_max_neg (p.m_max_neg), - m_type_constraints (), m_size_constraints (), m_finite_constraint (NO_CHECK), + m_min_val (p.m_min_val), m_max_val (p.m_max_val), + m_min_pos (p.m_min_pos), m_max_neg (p.m_max_neg), + m_type_constraints (), m_size_constraints (), + m_finite_constraint (NO_CHECK), m_minval (std::pair (octave_NaN, true)), m_maxval (std::pair (octave_NaN, true)) { } @@ -3383,7 +3388,9 @@ graphics_xform (const Matrix& xm, const Matrix& xim, const scaler& x, const scaler& y, const scaler& z, const Matrix& zl) - : m_xform (xm), m_xform_inv (xim), m_sx (x), m_sy (y), m_sz (z), m_zlim (zl) { } + : m_xform (xm), m_xform_inv (xim), m_sx (x), m_sy (y), + m_sz (z), m_zlim (zl) + { } graphics_xform (const graphics_xform& g) : m_xform (g.m_xform), m_xform_inv (g.m_xform_inv), m_sx (g.m_sx), @@ -3553,7 +3560,10 @@ OCTINTERP_API void update_title_position (void); graphics_xform get_transform (void) const - { return graphics_xform (m_x_render, m_x_render_inv, m_sx, m_sy, m_sz, m_x_zlim); } + { + return graphics_xform (m_x_render, m_x_render_inv, + m_sx, m_sy, m_sz, m_x_zlim); + } Matrix get_transform_matrix (void) const { return m_x_render; } Matrix get_inverse_transform_matrix (void) const { return m_x_render_inv; } @@ -3603,7 +3613,10 @@ bool get_nearhoriz (void) const { return m_nearhoriz; } ColumnVector pixel2coord (double px, double py) const - { return get_transform ().untransform (px, py, (m_x_zlim(0)+m_x_zlim(1))/2); } + { + return get_transform ().untransform (px, py, + (m_x_zlim(0)+m_x_zlim(1))/2); + } ColumnVector coord2pixel (double x, double y, double z) const { return get_transform ().transform (x, y, z); } @@ -3766,7 +3779,8 @@ radio_property gridcolormode , "{auto}|manual" radio_property gridlinestyle , "{-}|--|:|-.|none" array_property innerposition sg , default_axes_position () - // FIXME: Should be an array of "interaction objects". Make it read-only for now. + // FIXME: Should be an array of "interaction objects". + // Make it read-only for now. any_property interactions r , Matrix () double_property labelfontsizemultiplier u , 1.1 radio_property layer u , "{bottom}|top" @@ -3814,6 +3828,7 @@ bool_property xgrid , "off" handle_property xlabel SOf , make_graphics_handle ("text", m___myhandle__, false, false, false) row_vector_property xlim mu , default_lim () + radio_property xlimitmethod u , "{tickaligned}|tight|padded" radio_property xlimmode al , "{auto}|manual" bool_property xminorgrid , "off" bool_property xminortick , "off" @@ -3833,6 +3848,7 @@ bool_property ygrid , "off" handle_property ylabel SOf , make_graphics_handle ("text", m___myhandle__, false, false, false) row_vector_property ylim mu , default_lim () + radio_property ylimitmethod u , "{tickaligned}|tight|padded" radio_property ylimmode al , "{auto}|manual" bool_property yminorgrid , "off" bool_property yminortick , "off" @@ -3850,6 +3866,7 @@ bool_property zgrid , "off" handle_property zlabel SOf , make_graphics_handle ("text", m___myhandle__, false, false, false) row_vector_property zlim mu , default_lim () + radio_property zlimitmethod u , "{tickaligned}|tight|padded" radio_property zlimmode al , "{auto}|manual" bool_property zminorgrid , "off" bool_property zminortick , "off" @@ -4029,7 +4046,8 @@ { calc_ticks_and_lims (m_xlim, m_xtick, m_xminortickvalues, m_xlimmode.is ("auto"), m_xtickmode.is ("auto"), - m_xscale.is ("log")); + m_xscale.is ("log"), m_xlimitmethod.is ("padded"), + m_xlimitmethod.is ("tight")); if (m_xticklabelmode.is ("auto")) calc_ticklabels (m_xtick, m_xticklabel, m_xscale.is ("log"), xaxislocation_is ("origin"), @@ -4045,7 +4063,8 @@ { calc_ticks_and_lims (m_ylim, m_ytick, m_yminortickvalues, m_ylimmode.is ("auto"), m_ytickmode.is ("auto"), - m_yscale.is ("log")); + m_yscale.is ("log"), m_ylimitmethod.is ("padded"), + m_ylimitmethod.is ("tight")); if (m_yticklabelmode.is ("auto")) calc_ticklabels (m_ytick, m_yticklabel, m_yscale.is ("log"), yaxislocation_is ("origin"), @@ -4061,7 +4080,8 @@ { calc_ticks_and_lims (m_zlim, m_ztick, m_zminortickvalues, m_zlimmode.is ("auto"), m_ztickmode.is ("auto"), - m_zscale.is ("log")); + m_zscale.is ("log"), m_zlimitmethod.is ("padded"), + m_zlimitmethod.is ("tight")); if (m_zticklabelmode.is ("auto")) calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), false, 2, m_zlim); @@ -4109,7 +4129,8 @@ void update_zticklabelmode (void) { if (m_zticklabelmode.is ("auto")) - calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), false, 2, m_zlim); + calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), + false, 2, m_zlim); } void update_fontname (void) @@ -4165,7 +4186,8 @@ OCTINTERP_API void calc_ticks_and_lims (array_property& lims, array_property& ticks, array_property& mticks, bool limmode_is_auto, - bool tickmode_is_auto, bool is_logscale); + bool tickmode_is_auto, bool is_logscale, + bool method_is_padded, bool method_is_tight); OCTINTERP_API void calc_ticklabels (const array_property& ticks, any_property& labels, bool is_logscale, const bool is_origin, @@ -4214,7 +4236,7 @@ OCTINTERP_API Matrix get_axis_limits (double xmin, double xmax, double min_pos, double max_neg, - const bool logscale); + const bool logscale, const std::string& method); OCTINTERP_API void check_axis_limits (Matrix& limits, const Matrix kids, @@ -4226,7 +4248,8 @@ calc_ticks_and_lims (m_xlim, m_xtick, m_xminortickvalues, m_xlimmode.is ("auto"), m_xtickmode.is ("auto"), - m_xscale.is ("log")); + m_xscale.is ("log"), m_xlimitmethod.is ("padded"), + m_xlimitmethod.is ("tight")); if (m_xticklabelmode.is ("auto")) calc_ticklabels (m_xtick, m_xticklabel, m_xscale.is ("log"), m_xaxislocation.is ("origin"), @@ -4242,13 +4265,19 @@ update_axes_layout (); } + void update_xlimitmethod () + { + update_xlim (); + } + void update_ylim (void) { update_axis_limits ("ylim"); calc_ticks_and_lims (m_ylim, m_ytick, m_yminortickvalues, m_ylimmode.is ("auto"), m_ytickmode.is ("auto"), - m_yscale.is ("log")); + m_yscale.is ("log"), m_ylimitmethod.is ("padded"), + m_ylimitmethod.is ("tight")); if (m_yticklabelmode.is ("auto")) calc_ticklabels (m_ytick, m_yticklabel, m_yscale.is ("log"), yaxislocation_is ("origin"), @@ -4264,13 +4293,19 @@ update_axes_layout (); } + void update_ylimitmethod () + { + update_ylim (); + } + void update_zlim (void) { update_axis_limits ("zlim"); calc_ticks_and_lims (m_zlim, m_ztick, m_zminortickvalues, m_zlimmode.is ("auto"), m_ztickmode.is ("auto"), - m_zscale.is ("log")); + m_zscale.is ("log"), m_zlimitmethod.is ("padded"), + m_zlimitmethod.is ("tight")); if (m_zticklabelmode.is ("auto")) calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), false, 2, m_zlim); @@ -4282,6 +4317,11 @@ update_axes_layout (); } + void update_zlimitmethod () + { + update_zlim (); + } + void trigger_normals_calc (void); }; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/hash.cc --- a/libinterp/corefcn/hash.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/hash.cc Sun Apr 03 11:30:26 2022 -0400 @@ -206,18 +206,19 @@ %!assert <*31689> (hash ("md2", "abc\0"), "5a636d615002a7874ac1c9e9a43361f7") %!assert <*31689> (hash ("md4", "abc\0"), "0ee5201897ecb206c4eaba1d2da5224d") %!assert <*31689> (hash ("md5", "abc\0"), "147a664a2ca9410911e61986d3f0d52a") -%!assert <*31689> (hash ("sha1", "abc\0"), "686483805ac47ca14e03514f7481a7973b401762") +%!assert <*31689> (hash ("sha1", "abc\0"), +%! "686483805ac47ca14e03514f7481a7973b401762") %!assert <*31689> (hash ("sha224", "abc\0"), -%! "fbc8e47920e108bb1d0b631d18b36ae9b1549d28362aa15ebe960cfb"); +%! "fbc8e47920e108bb1d0b631d18b36ae9b1549d28362aa15ebe960cfb"); %!assert <*31689> (hash ("sha256", "abc\0"), -%! "dc1114cd074914bd872cc1f9a23ec910ea2203bc79779ab2e17da25782a624fc"); +%! "dc1114cd074914bd872cc1f9a23ec910ea2203bc79779ab2e17da25782a624fc"); %!assert <*31689> (hash ("sha384", "abc\0"), -%! ["eba81f2dfba4ec60d3f786c89d91b08e6c0b63d55986874378e385", ... -%! "e6fac587cce7a520ca9437290fe626cbf75c855e17"]); +%! ["eba81f2dfba4ec60d3f786c89d91b08e6c0b63d55986874378e385", ... +%! "e6fac587cce7a520ca9437290fe626cbf75c855e17"]); %!assert <*31689> (hash ("sha512", "abc\0"), -%! ["7ce05eda233e545a2d5c626862a5ddaafb09b9d8ec3bec08aa458b", ... -%! "7c9e7d939d84a57d5a20d8a9002983aabae2457b19c50ba326bf5b", ... -%! "081f75b41342f42c3383"]); +%! ["7ce05eda233e545a2d5c626862a5ddaafb09b9d8ec3bec08aa458b", ... +%! "7c9e7d939d84a57d5a20d8a9002983aabae2457b19c50ba326bf5b", ... +%! "081f75b41342f42c3383"]); ## Test equivalence to deprecated md5sum offering file hashing %!test diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/help.cc --- a/libinterp/corefcn/help.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/help.cc Sun Apr 03 11:30:26 2022 -0400 @@ -637,7 +637,8 @@ std::string name; int i = 0; int c; - while (file && (c = file.get ()) != std::istream::traits_type::eof ()) + while (file + && (c = file.get ()) != std::istream::traits_type::eof ()) { if (c == '\n' || c == '\r') { @@ -954,7 +955,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} built_in_docstrings_file () @deftypefnx {} {@var{old_val} =} built_in_docstrings_file (@var{new_val}) -@deftypefnx {} {} built_in_docstrings_file (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} built_in_docstrings_file (@var{new_val}, "local") Query or set the internal variable that specifies the name of the file containing docstrings for built-in Octave functions. @@ -979,7 +980,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} doc_cache_file () @deftypefnx {} {@var{old_val} =} doc_cache_file (@var{new_val}) -@deftypefnx {} {} doc_cache_file (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} doc_cache_file (@var{new_val}, "local") Query or set the internal variable that specifies the name of the Octave documentation cache file. @@ -1008,7 +1009,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} info_file () @deftypefnx {} {@var{old_val} =} info_file (@var{new_val}) -@deftypefnx {} {} info_file (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} info_file (@var{new_val}, "local") Query or set the internal variable that specifies the name of the Octave info file. @@ -1034,7 +1035,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} info_program () @deftypefnx {} {@var{old_val} =} info_program (@var{new_val}) -@deftypefnx {} {} info_program (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} info_program (@var{new_val}, "local") Query or set the internal variable that specifies the name of the info program to run. @@ -1057,7 +1058,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} makeinfo_program () @deftypefnx {} {@var{old_val} =} makeinfo_program (@var{new_val}) -@deftypefnx {} {} makeinfo_program (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} makeinfo_program (@var{new_val}, "local") Query or set the internal variable that specifies the name of the program that Octave runs to format help text containing Texinfo markup commands. @@ -1079,7 +1080,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} suppress_verbose_help_message () @deftypefnx {} {@var{old_val} =} suppress_verbose_help_message (@var{new_val}) -@deftypefnx {} {} suppress_verbose_help_message (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} suppress_verbose_help_message (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will add additional help information to the end of the output from the @code{help} command and usage messages for built-in commands. @@ -1098,7 +1099,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} texi_macros_file () @deftypefnx {} {@var{old_val} =} texi_macros_file (@var{new_val}) -@deftypefnx {} {} texi_macros_file (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} texi_macros_file (@var{new_val}, "local") Query or set the internal variable that specifies the name of the file containing Texinfo macros that are prepended to documentation strings before they are passed to makeinfo. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/hex2num.cc --- a/libinterp/corefcn/hex2num.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/hex2num.cc Sun Apr 03 11:30:26 2022 -0400 @@ -361,8 +361,10 @@ } /* -%!assert (num2hex (-2:2), ["c000000000000000";"bff0000000000000";"0000000000000000";"3ff0000000000000";"4000000000000000"]) -%!assert (num2hex (single (-2:2)), ["c0000000";"bf800000";"00000000";"3f800000";"40000000"]) +%!assert (num2hex (-2:2), +%! ["c000000000000000";"bff0000000000000";"0000000000000000";"3ff0000000000000";"4000000000000000"]) +%!assert (num2hex (single (-2:2)), +%! ["c0000000";"bf800000";"00000000";"3f800000";"40000000"]) %!assert (num2hex (intmax ("uint8")), "ff") %!assert (num2hex (intmax ("uint16")), "ffff") %!assert (num2hex (intmax ("uint32")), "ffffffff") diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/input.cc --- a/libinterp/corefcn/input.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/input.cc Sun Apr 03 11:30:26 2022 -0400 @@ -89,11 +89,6 @@ // the next user prompt. bool Vdrawnow_requested = false; -// TRUE if we are recording line numbers in a source file. -// Always true except when debugging and taking input directly from -// the terminal. -bool Vtrack_line_num = true; - OCTAVE_NAMESPACE_BEGIN static std::string @@ -966,7 +961,8 @@ : m_rep (new file_reader (interp, file)) { } - input_reader::input_reader (interpreter& interp, FILE *file, const std::string& enc) + input_reader::input_reader (interpreter& interp, FILE *file, + const std::string& enc) : m_rep (new file_reader (interp, file, enc)) { } @@ -1453,7 +1449,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PS1 () @deftypefnx {} {@var{old_val} =} PS1 (@var{new_val}) -@deftypefnx {} {} PS1 (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} PS1 (@var{new_val}, "local") Query or set the primary prompt string. When executing interactively, Octave displays the primary prompt when it is @@ -1497,7 +1493,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PS2 () @deftypefnx {} {@var{old_val} =} PS2 (@var{new_val}) -@deftypefnx {} {} PS2 (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} PS2 (@var{new_val}, "local") Query or set the secondary prompt string. The secondary prompt is printed when Octave is expecting additional input to @@ -1521,7 +1517,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} completion_append_char () @deftypefnx {} {@var{old_val} =} completion_append_char (@var{new_val}) -@deftypefnx {} {} completion_append_char (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} completion_append_char (@var{new_val}, "local") Query or set the internal character variable that is appended to successful command-line completion attempts. @@ -1650,7 +1646,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} auto_repeat_debug_command () @deftypefnx {} {@var{old_val} =} auto_repeat_debug_command (@var{new_val}) -@deftypefnx {} {} auto_repeat_debug_command (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} auto_repeat_debug_command (@var{new_val}, "local") Query or set the internal variable that controls whether debugging commands are automatically repeated when the input line is empty (typing just @key{RET}). diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/input.h --- a/libinterp/corefcn/input.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/input.h Sun Apr 03 11:30:26 2022 -0400 @@ -48,11 +48,6 @@ // the next user prompt. extern OCTINTERP_API bool Vdrawnow_requested; -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "'Vtrack_line_num' is an obsolete internal variable; any uses should be removed") -extern OCTINTERP_API bool Vtrack_line_num; -#endif - extern OCTINTERP_API octave::sys::time Vlast_prompt_time; class octave_value; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/interpreter.cc Sun Apr 03 11:30:26 2022 -0400 @@ -56,7 +56,6 @@ #include "display.h" #include "error.h" #include "event-manager.h" -#include "file-io.h" #include "graphics.h" #include "help.h" #include "input.h" @@ -2023,24 +2022,6 @@ return found; } - // Remove when corresponding public deprecated function is removed. - void interpreter::add_atexit_function_deprecated (const std::string& fname) - { - interpreter& interp - = __get_interpreter__ ("interpreter::add_atexit_function"); - - interp.add_atexit_fcn (fname); - } - - // Remove when corresponding public deprecated function is removed. - bool interpreter::remove_atexit_function_deprecated (const std::string& fname) - { - interpreter& interp - = __get_interpreter__ ("interpreter::remove_atexit_function"); - - return interp.remove_atexit_fcn (fname); - } - // What internal options get configured by --traditional. void interpreter::maximum_braindamage (void) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/interpreter.h --- a/libinterp/corefcn/interpreter.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/interpreter.h Sun Apr 03 11:30:26 2022 -0400 @@ -536,30 +536,6 @@ bool remove_atexit_fcn (const std::string& fname); - private: - - // Remove when corresponding public deprecated function is removed. - static void add_atexit_function_deprecated (const std::string& fname); - - // Remove when corresponding public deprecated function is removed. - static bool remove_atexit_function_deprecated (const std::string& fname); - - public: - -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) - OCTAVE_DEPRECATED (6, "use interpreter::add_atexit_fcn member function instead") - static void add_atexit_function (const std::string& fname) - { - add_atexit_function_deprecated (fname); - } - - OCTAVE_DEPRECATED (6, "use interpreter::remove_atexit_fcn member function instead") - static bool remove_atexit_function (const std::string& fname) - { - return remove_atexit_function_deprecated (fname); - } - #endif - static interpreter * the_interpreter (void) { return m_instance; } private: diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/inv.cc --- a/libinterp/corefcn/inv.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/inv.cc Sun Apr 03 11:30:26 2022 -0400 @@ -70,11 +70,14 @@ octave_value arg = args(0); + if (! arg.isnumeric ()) + err_wrong_type_arg ("inv", arg); + if (arg.isempty ()) return ovl (Matrix ()); if (arg.rows () != arg.columns ()) - err_square_matrix_required ("inverse", "A"); + err_square_matrix_required ("inv", "A"); octave_value result; octave_idx_type info; @@ -191,6 +194,8 @@ } } else + // Shouldn't get here since we checked for suitable arg earlier. + // Maybe for some user-defined classes? err_wrong_type_arg ("inv", arg); } @@ -233,6 +238,12 @@ %! assert (xinv, single ([-2, 1; 1.5, -0.5]), 5*eps ("single")); %! assert (isa (rcond, "single")); +## Basic test for integer inputs +%!assert (inv (int32 (2)), 0.5) +%!assert (inv (uint32 (2)), 0.5) +%!assert (inv (int64 (2)), 0.5) +%!assert (inv (uint64 (2)), 0.5) + ## Normal scalar cases %!assert (inv (2), 0.5) %!test @@ -367,11 +378,15 @@ %! assert (A, sparse ([Inf, Inf; 0, 0])); %!testif HAVE_UMFPACK <*56232> -%! fail ("A = inv (sparse ([1, 0, 0; 0, 0, 0; 0, 0, 1]))", "warning", "matrix singular"); +%! fail ("A = inv (sparse ([1, 0, 0; 0, 0, 0; 0, 0, 1]))", +%! "warning", "matrix singular"); %! assert (A, sparse ([Inf, 0, 0; 0, 0, 0; 0, 0, Inf])); -%!error inv () -%!error inv ([1, 2; 3, 4], 2) +%!error inv () +%!error inv ([1, 2; 3, 4], 2) +%!error inv ("Hello World") +%!error inv ({1}) +%!error inv (true) %!error inv ([1, 2; 3, 4; 5, 6]) %!error inv (sparse (2, 2, 0)) %!error inv (diag ([0, 0])) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/kron.cc --- a/libinterp/corefcn/kron.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/kron.cc Sun Apr 03 11:30:26 2022 -0400 @@ -55,8 +55,8 @@ static MArray kron (const MArray& a, const MArray& b) { - assert (a.ndims () == 2); - assert (b.ndims () == 2); + error_unless (a.ndims () == 2); + error_unless (b.ndims () == 2); octave_idx_type nra = a.rows (); octave_idx_type nrb = b.rows (); @@ -86,7 +86,7 @@ static MArray kron (const MDiagArray2& a, const MArray& b) { - assert (b.ndims () == 2); + error_unless (b.ndims () == 2); octave_idx_type nra = a.rows (); octave_idx_type nrb = b.rows (); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/load-path.cc --- a/libinterp/corefcn/load-path.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/load-path.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1035,7 +1035,8 @@ source_file (file, "base"); } - // FIXME: maybe we should also maintain a map to speed up this method of access. + // FIXME: maybe we should also maintain a map to speed up this method of + // access. load_path::const_dir_info_list_iterator load_path::find_dir_info (const std::string& dir_arg) const @@ -1799,7 +1800,8 @@ if (p != fcn_file_map.end ()) { std::string fname - = sys::file_ops::concat (sys::file_ops::concat (dir, "private"), fcn); + = sys::file_ops::concat (sys::file_ops::concat (dir, "private"), + fcn); if (check_file_type (fname, type, p->second, fcn, "load_path::find_private_fcn")) @@ -1970,7 +1972,8 @@ if (symtab.is_built_in_function_name (base)) { - std::string fcn_path = sys::file_ops::concat (dir_name, fname); + std::string fcn_path = sys::file_ops::concat (dir_name, + fname); warning_with_id ("Octave:shadowed-function", "function %s shadows a built-in function", @@ -1992,7 +1995,8 @@ && s_sys_path.find (old.dir_name) != std::string::npos && in_path_list (s_sys_path, old.dir_name)) { - std::string fcn_path = sys::file_ops::concat (dir_name, fname); + std::string fcn_path = sys::file_ops::concat (dir_name, + fname); warning_with_id ("Octave:shadowed-function", "function %s shadows a core library function", @@ -2092,7 +2096,8 @@ void load_path::package_info::move_fcn_map (const std::string& dir_name, - const string_vector& fcn_files, bool at_end) + const string_vector& fcn_files, + bool at_end) { octave_idx_type len = fcn_files.numel (); @@ -2446,7 +2451,8 @@ sys::file_stat fs (nm); if (fs && fs.is_dir ()) - retval += directory_path::path_sep_str () + genpath (nm, skip); + retval += (directory_path::path_sep_str () + + genpath (nm, skip)); } } } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/load-save.cc --- a/libinterp/corefcn/load-save.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/load-save.cc Sun Apr 03 11:30:26 2022 -0400 @@ -855,7 +855,8 @@ OCTAVE_VERSION ", %Y-%m-%d %T UTC"; std::string comment_string = now.strftime (matlab_format); - std::size_t len = std::min (comment_string.length (), static_cast (124)); + std::size_t len = std::min (comment_string.length (), + static_cast (124)); memset (headertext, ' ', 124); memcpy (headertext, comment_string.data (), len); @@ -1915,7 +1916,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} crash_dumps_octave_core () @deftypefnx {} {@var{old_val} =} crash_dumps_octave_core (@var{new_val}) -@deftypefnx {} {} crash_dumps_octave_core (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} crash_dumps_octave_core (@var{new_val}, "local") Query or set the internal variable that controls whether Octave tries to save all current variables to the file @file{octave-workspace} if it crashes or receives a hangup, terminate or similar signal. @@ -1936,7 +1937,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} save_default_options () @deftypefnx {} {@var{old_val} =} save_default_options (@var{new_val}) -@deftypefnx {} {} save_default_options (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} save_default_options (@var{new_val}, "local") Query or set the internal variable that specifies the default options for the @code{save} command, and defines the default format. @@ -1958,7 +1959,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} octave_core_file_limit () @deftypefnx {} {@var{old_val} =} octave_core_file_limit (@var{new_val}) -@deftypefnx {} {} octave_core_file_limit (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} octave_core_file_limit (@var{new_val}, "local") Query or set the internal variable that specifies the maximum amount of memory that Octave will save when writing a crash dump file. @@ -1987,7 +1988,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} octave_core_file_name () @deftypefnx {} {@var{old_val} =} octave_core_file_name (@var{new_val}) -@deftypefnx {} {} octave_core_file_name (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} octave_core_file_name (@var{new_val}, "local") Query or set the internal variable that specifies the name of the file used for saving data from the top-level workspace if Octave aborts. @@ -2009,7 +2010,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} octave_core_file_options () @deftypefnx {} {@var{old_val} =} octave_core_file_options (@var{new_val}) -@deftypefnx {} {} octave_core_file_options (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} octave_core_file_options (@var{new_val}, "local") Query or set the internal variable that specifies the options used for saving the workspace data if Octave aborts. @@ -2032,7 +2033,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} save_header_format_string () @deftypefnx {} {@var{old_val} =} save_header_format_string (@var{new_val}) -@deftypefnx {} {} save_header_format_string (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} save_header_format_string (@var{new_val}, "local") Query or set the internal variable that specifies the format string used for the comment line written at the beginning of text-format data files saved by Octave. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/ls-hdf5.cc --- a/libinterp/corefcn/ls-hdf5.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/ls-hdf5.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1272,7 +1272,8 @@ if (space_hid < 0) return space_hid; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/ls-hdf5.h --- a/libinterp/corefcn/ls-hdf5.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/ls-hdf5.h Sun Apr 03 11:30:26 2022 -0400 @@ -53,7 +53,8 @@ ~hdf5_fstreambase () { close (); } - OCTINTERP_API hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0); + OCTINTERP_API hdf5_fstreambase (const char *name, int mode, + int /* prot */ = 0); OCTINTERP_API void close (void); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/ls-mat5.cc --- a/libinterp/corefcn/ls-mat5.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/ls-mat5.cc Sun Apr 03 11:30:26 2022 -0400 @@ -913,7 +913,8 @@ if (ov_fcn.is_defined ()) // XXX FCN_HANDLE: SIMPLE/SCOPED - tc = octave_value (new octave_fcn_handle (ov_fcn, fname)); + tc = octave_value (new octave_fcn_handle (ov_fcn, + fname)); } else { @@ -940,7 +941,8 @@ if (ov_fcn.is_defined ()) // XXX FCN_HANDLE: SIMPLE/SCOPED - tc = octave_value (new octave_fcn_handle (ov_fcn, fname)); + tc = octave_value (new octave_fcn_handle (ov_fcn, + fname)); else { warning_with_id ("Octave:load:file-not-found", @@ -1041,7 +1043,8 @@ error ("load: failed to load anonymous function handle"); // XXX FCN_HANDLE: ANONYMOUS - tc = octave_value (new octave_fcn_handle (fh->fcn_val (), local_vars)); + tc = octave_value (new octave_fcn_handle (fh->fcn_val (), + local_vars)); } else error ("load: invalid function handle type"); @@ -2703,7 +2706,8 @@ { if (tc.is_inline_function () || tc.isobject ()) { - std::string classname = (tc.isobject () ? tc.class_name () : "inline"); + std::string classname = (tc.isobject () ? tc.class_name () + : "inline"); std::size_t namelen = classname.length (); if (namelen > max_namelen) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/ls-oct-text.cc --- a/libinterp/corefcn/ls-oct-text.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/ls-oct-text.cc Sun Apr 03 11:30:26 2022 -0400 @@ -463,7 +463,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} save_precision () @deftypefnx {} {@var{old_val} =} save_precision (@var{new_val}) -@deftypefnx {} {} save_precision (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} save_precision (@var{new_val}, "local") Query or set the internal variable that specifies the number of digits to keep when saving data in text format. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/lu.cc --- a/libinterp/corefcn/lu.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/lu.cc Sun Apr 03 11:30:26 2022 -0400 @@ -781,14 +781,16 @@ %! [L,U] = luupdate (L,U,P*single (u), single (v)); %! assert (norm (vec (tril (L)-L), Inf) == 0); %! assert (norm (vec (triu (U)-U), Inf) == 0); -%! assert (norm (vec (P'*L*U - single (A) - single (u)*single (v).'), Inf) < norm (single (A))*1e1*eps ("single")); +%! assert (norm (vec (P'*L*U - single (A) - single (u)*single (v).'), Inf) +%! < norm (single (A))*1e1*eps ("single")); %! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu (single (Ac)); %! [L,U] = luupdate (L,U,P*single (uc),single (vc)); %! assert (norm (vec (tril (L)-L), Inf) == 0); %! assert (norm (vec (triu (U)-U), Inf) == 0); -%! assert (norm (vec (P'*L*U - single (Ac) - single (uc)*single (vc).'), Inf) < norm (single (Ac))*1e1*eps ("single")); +%! assert (norm (vec (P'*L*U - single (Ac) - single (uc)*single (vc).'), Inf) +%! < norm (single (Ac))*1e1*eps ("single")); %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu (A); @@ -823,14 +825,16 @@ %! [L,U,P] = luupdate (L,U,P,single (u),single (v)); %! assert (norm (vec (tril (L)-L), Inf) == 0); %! assert (norm (vec (triu (U)-U), Inf) == 0); -%! assert (norm (vec (P'*L*U - single (A) - single (u)*single (v).'), Inf) < norm (single (A))*1e1*eps ("single")); +%! assert (norm (vec (P'*L*U - single (A) - single (u)*single (v).'), Inf) +%! < norm (single (A))*1e1*eps ("single")); %! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu (single (Ac)); %! [L,U,P] = luupdate (L,U,P,single (uc),single (vc)); %! assert (norm (vec (tril (L)-L), Inf) == 0); %! assert (norm (vec (triu (U)-U), Inf) == 0); -%! assert (norm (vec (P'*L*U - single (Ac) - single (uc)*single (vc).'), Inf) < norm (single (Ac))*1e1*eps ("single")); +%! assert (norm (vec (P'*L*U - single (Ac) - single (uc)*single (vc).'), Inf) +%! < norm (single (Ac))*1e1*eps ("single")); */ OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/mappers.cc --- a/libinterp/corefcn/mappers.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/mappers.cc Sun Apr 03 11:30:26 2022 -0400 @@ -280,7 +280,8 @@ %! assert (arg (single (-1)), single (pi)); %! endif %!assert (arg (single (-i)), single (-pi/2)) -%!assert (arg (single ([1, i; -1, -i])), single ([0, pi/2; pi, -pi/2]), 2e1*eps ("single")) +%!assert (arg (single ([1, i; -1, -i])), +%! single ([0, pi/2; pi, -pi/2]), 2e1*eps ("single")) %!error arg () %!error arg (1, 2) @@ -535,7 +536,8 @@ %!assert (ceil (single ([2, 1.1, -1.1, -1])), single ([2, 2, -1, -1])) ## complex single precision -%!assert (ceil (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), single ([2+2i, 2+2i, -1-i, -1-i])) +%!assert (ceil (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), +%! single ([2+2i, 2+2i, -1-i, -1-i])) %!error ceil () %!error ceil (1, 2) @@ -732,13 +734,18 @@ /* ## middle region %!assert (erf (erfinv ([-0.9 -0.3 0 0.4 0.8])), [-0.9 -0.3 0 0.4 0.8], eps) -%!assert (erf (erfinv (single ([-0.9 -0.3 0 0.4 0.8]))), single ([-0.9 -0.3 0 0.4 0.8]), eps ("single")) +%!assert (erf (erfinv (single ([-0.9 -0.3 0 0.4 0.8]))), +%! single ([-0.9 -0.3 0 0.4 0.8]), eps ("single")) ## tail region -%!assert (erf (erfinv ([-0.999 -0.99 0.9999 0.99999])), [-0.999 -0.99 0.9999 0.99999], eps) -%!assert (erf (erfinv (single ([-0.999 -0.99 0.9999 0.99999]))), single ([-0.999 -0.99 0.9999 0.99999]), eps ("single")) +%!assert (erf (erfinv ([-0.999 -0.99 0.9999 0.99999])), +%! [-0.999 -0.99 0.9999 0.99999], eps) +%!assert (erf (erfinv (single ([-0.999 -0.99 0.9999 0.99999]))), +%! single ([-0.999 -0.99 0.9999 0.99999]), eps ("single")) ## backward - loss of accuracy -%!assert (erfinv (erf ([-3 -1 -0.4 0.7 1.3 2.8])), [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) -%!assert (erfinv (erf (single ([-3 -1 -0.4 0.7 1.3 2.8]))), single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) +%!assert (erfinv (erf ([-3 -1 -0.4 0.7 1.3 2.8])), +%! [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) +%!assert (erfinv (erf (single ([-3 -1 -0.4 0.7 1.3 2.8]))), +%! single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) ## exceptional %!assert (erfinv ([-1, 1, 1.1, -2.1]), [-Inf, Inf, NaN, NaN]) %!error erfinv (1+2i) @@ -769,13 +776,18 @@ /* ## middle region %!assert (erfc (erfcinv ([1.9 1.3 1 0.6 0.2])), [1.9 1.3 1 0.6 0.2], eps) -%!assert (erfc (erfcinv (single ([1.9 1.3 1 0.6 0.2]))), single ([1.9 1.3 1 0.6 0.2]), eps ("single")) +%!assert (erfc (erfcinv (single ([1.9 1.3 1 0.6 0.2]))), +%! single ([1.9 1.3 1 0.6 0.2]), eps ("single")) ## tail region -%!assert (erfc (erfcinv ([0.001 0.01 1.9999 1.99999])), [0.001 0.01 1.9999 1.99999], eps) -%!assert (erfc (erfcinv (single ([0.001 0.01 1.9999 1.99999]))), single ([0.001 0.01 1.9999 1.99999]), eps ("single")) +%!assert (erfc (erfcinv ([0.001 0.01 1.9999 1.99999])), +%! [0.001 0.01 1.9999 1.99999], eps) +%!assert (erfc (erfcinv (single ([0.001 0.01 1.9999 1.99999]))), +%! single ([0.001 0.01 1.9999 1.99999]), eps ("single")) ## backward - loss of accuracy -%!assert (erfcinv (erfc ([-3 -1 -0.4 0.7 1.3 2.8])), [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) -%!assert (erfcinv (erfc (single ([-3 -1 -0.4 0.7 1.3 2.8]))), single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) +%!assert (erfcinv (erfc ([-3 -1 -0.4 0.7 1.3 2.8])), +%! [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) +%!assert (erfcinv (erfc (single ([-3 -1 -0.4 0.7 1.3 2.8]))), +%! single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) ## exceptional %!assert (erfcinv ([2, 0, -0.1, 2.1]), [-Inf, Inf, NaN, NaN]) %!error erfcinv (1+2i) @@ -957,8 +969,10 @@ /* %!assert (exp ([0, 1, -1, -1000]), [1, e, 1/e, 0], sqrt (eps)) %!assert (exp (1+i), e * (cos (1) + sin (1) * i), sqrt (eps)) -%!assert (exp (single ([0, 1, -1, -1000])), single ([1, e, 1/e, 0]), sqrt (eps ("single"))) -%!assert (exp (single (1+i)), single (e * (cos (1) + sin (1) * i)), sqrt (eps ("single"))) +%!assert (exp (single ([0, 1, -1, -1000])), +%! single ([1, e, 1/e, 0]), sqrt (eps ("single"))) +%!assert (exp (single (1+i)), +%! single (e * (cos (1) + sin (1) * i)), sqrt (eps ("single"))) %!assert (exp ([Inf, -Inf, NaN]), [Inf 0 NaN]) %!assert (exp (single ([Inf, -Inf, NaN])), single ([Inf 0 NaN])) @@ -999,7 +1013,7 @@ DEFUN (isfinite, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isfinite (@var{x}) +@deftypefn {} {@var{tf} =} isfinite (@var{x}) Return a logical array which is true where the elements of @var{x} are finite values and false where they are not. @@ -1061,7 +1075,8 @@ %!assert (fix ([1.1, 1, -1.1, -1]), [1, 1, -1, -1]) %!assert (fix ([1.1+1.1i, 1+i, -1.1-1.1i, -1-i]), [1+i, 1+i, -1-i, -1-i]) %!assert (fix (single ([1.1, 1, -1.1, -1])), single ([1, 1, -1, -1])) -%!assert (fix (single ([1.1+1.1i, 1+i, -1.1-1.1i, -1-i])), single ([1+i, 1+i, -1-i, -1-i])) +%!assert (fix (single ([1.1+1.1i, 1+i, -1.1-1.1i, -1-i])), +%! single ([1+i, 1+i, -1-i, -1-i])) %!error fix () %!error fix (1, 2) @@ -1094,7 +1109,8 @@ %!assert (floor ([2, 1.1, -1.1, -1]), [2, 1, -2, -1]) %!assert (floor ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i]), [2+2i, 1+i, -2-2i, -1-i]) %!assert (floor (single ([2, 1.1, -1.1, -1])), single ([2, 1, -2, -1])) -%!assert (floor (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), single ([2+2i, 1+i, -2-2i, -1-i])) +%!assert (floor (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), +%! single ([2+2i, 1+i, -2-2i, -1-i])) %!error floor () %!error floor (1, 2) @@ -1199,7 +1215,7 @@ DEFUNX ("isalnum", Fisalnum, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isalnum (@var{s}) +@deftypefn {} {@var{tf} =} isalnum (@var{s}) Return a logical array which is true where the elements of @var{s} are letters or digits and false where they are not. @@ -1229,7 +1245,7 @@ DEFUNX ("isalpha", Fisalpha, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isalpha (@var{s}) +@deftypefn {} {@var{tf} =} isalpha (@var{s}) Return a logical array which is true where the elements of @var{s} are letters and false where they are not. @@ -1258,7 +1274,7 @@ DEFUNX ("isascii", Fisascii, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isascii (@var{s}) +@deftypefn {} {@var{tf} =} isascii (@var{s}) Return a logical array which is true where the elements of @var{s} are ASCII characters (in the range 0 to 127 decimal) and false where they are not. @@ -1282,7 +1298,7 @@ DEFUNX ("iscntrl", Fiscntrl, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} iscntrl (@var{s}) +@deftypefn {} {@var{tf} =} iscntrl (@var{s}) Return a logical array which is true where the elements of @var{s} are control characters and false where they are not. @seealso{ispunct, isspace, isalpha, isdigit} @@ -1308,7 +1324,7 @@ DEFUNX ("isdigit", Fisdigit, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isdigit (@var{s}) +@deftypefn {} {@var{tf} =} isdigit (@var{s}) Return a logical array which is true where the elements of @var{s} are decimal digits (0-9) and false where they are not. @seealso{isxdigit, isalpha, isletter, ispunct, isspace, iscntrl} @@ -1334,7 +1350,7 @@ DEFUN (isinf, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isinf (@var{x}) +@deftypefn {} {@var{tf} =} isinf (@var{x}) Return a logical array which is true where the elements of @var{x} are infinite and false where they are not. @@ -1360,13 +1376,15 @@ %!assert (! isinf (NaN)) %!assert (! isinf (NA)) %!assert (isinf (rand (1,10)), false (1,10)) -%!assert (isinf ([NaN -Inf -1 0 1 Inf NA]), [false, true, false, false, false, true, false]) +%!assert (isinf ([NaN -Inf -1 0 1 Inf NA]), +%! [false, true, false, false, false, true, false]) %!assert (isinf (single (Inf))) %!assert (! isinf (single (NaN))) %!assert (! isinf (single (NA))) %!assert (isinf (single (rand (1,10))), false (1,10)) -%!assert (isinf (single ([NaN -Inf -1 0 1 Inf NA])), [false, true, false, false, false, true, false]) +%!assert (isinf (single ([NaN -Inf -1 0 1 Inf NA])), +%! [false, true, false, false, false, true, false]) %!assert (! isinf ('a')) %!error isinf () @@ -1375,7 +1393,7 @@ DEFUNX ("isgraph", Fisgraph, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isgraph (@var{s}) +@deftypefn {} {@var{tf} =} isgraph (@var{s}) Return a logical array which is true where the elements of @var{s} are printable characters (but not the space character) and false where they are not. @@ -1402,7 +1420,7 @@ DEFUNX ("islower", Fislower, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} islower (@var{s}) +@deftypefn {} {@var{tf} =} islower (@var{s}) Return a logical array which is true where the elements of @var{s} are lowercase letters and false where they are not. @seealso{isupper, isalpha, isletter, isalnum} @@ -1428,7 +1446,7 @@ DEFUN (isna, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isna (@var{x}) +@deftypefn {} {@var{tf} =} isna (@var{x}) Return a logical array which is true where the elements of @var{x} are NA (missing) values and false where they are not. @@ -1454,13 +1472,15 @@ %!assert (! isna (NaN)) %!assert (isna (NA)) %!assert (isna (rand (1,10)), false (1,10)) -%!assert (isna ([NaN -Inf -1 0 1 Inf NA]), [false, false, false, false, false, false, true]) +%!assert (isna ([NaN -Inf -1 0 1 Inf NA]), +%! [false, false, false, false, false, false, true]) %!assert (! isna (single (Inf))) %!assert (! isna (single (NaN))) %!assert (isna (single (NA))) %!assert (isna (single (rand (1,10))), false (1,10)) -%!assert (isna (single ([NaN -Inf -1 0 1 Inf NA])), [false, false, false, false, false, false, true]) +%!assert (isna (single ([NaN -Inf -1 0 1 Inf NA])), +%! [false, false, false, false, false, false, true]) %!error isna () %!error isna (1, 2) @@ -1468,7 +1488,7 @@ DEFUN (isnan, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isnan (@var{x}) +@deftypefn {} {@var{tf} =} isnan (@var{x}) Return a logical array which is true where the elements of @var{x} are NaN values and false where they are not. @@ -1494,13 +1514,15 @@ %!assert (isnan (NaN)) %!assert (isnan (NA)) %!assert (isnan (rand (1,10)), false (1,10)) -%!assert (isnan ([NaN -Inf -1 0 1 Inf NA]), [true, false, false, false, false, false, true]) +%!assert (isnan ([NaN -Inf -1 0 1 Inf NA]), +%! [true, false, false, false, false, false, true]) %!assert (! isnan (single (Inf))) %!assert (isnan (single (NaN))) %!assert (isnan (single (NA))) %!assert (isnan (single (rand (1,10))), false (1,10)) -%!assert (isnan (single ([NaN -Inf -1 0 1 Inf NA])), [true, false, false, false, false, false, true]) +%!assert (isnan (single ([NaN -Inf -1 0 1 Inf NA])), +%! [true, false, false, false, false, false, true]) %!assert (! isnan ('a')) %!error isnan () @@ -1509,7 +1531,7 @@ DEFUNX ("isprint", Fisprint, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isprint (@var{s}) +@deftypefn {} {@var{tf} =} isprint (@var{s}) Return a logical array which is true where the elements of @var{s} are printable characters (including the space character) and false where they are not. @@ -1536,7 +1558,7 @@ DEFUNX ("ispunct", Fispunct, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} ispunct (@var{s}) +@deftypefn {} {@var{tf} =} ispunct (@var{s}) Return a logical array which is true where the elements of @var{s} are punctuation characters and false where they are not. @seealso{isalpha, isdigit, isspace, iscntrl} @@ -1565,7 +1587,7 @@ DEFUNX ("isspace", Fisspace, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isspace (@var{s}) +@deftypefn {} {@var{tf} =} isspace (@var{s}) Return a logical array which is true where the elements of @var{s} are whitespace characters (space, formfeed, newline, carriage return, tab, and vertical tab) and false where they are not. @@ -1592,7 +1614,7 @@ DEFUNX ("isupper", Fisupper, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isupper (@var{s}) +@deftypefn {} {@var{tf} =} isupper (@var{s}) Return a logical array which is true where the elements of @var{s} are uppercase letters and false where they are not. @seealso{islower, isalpha, isletter, isalnum} @@ -1618,7 +1640,7 @@ DEFUNX ("isxdigit", Fisxdigit, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isxdigit (@var{s}) +@deftypefn {} {@var{tf} =} isxdigit (@var{s}) Return a logical array which is true where the elements of @var{s} are hexadecimal digits (0-9 and @nospell{a-fA-F}). @seealso{isdigit} @@ -1714,7 +1736,8 @@ %!assert (log ([-0.5, -1.5, -2.5]), log ([0.5, 1.5, 2.5]) + pi*1i, sqrt (eps)) %!assert (log (single ([1, e, e^2])), single ([0, 1, 2]), sqrt (eps ("single"))) -%!assert (log (single ([-0.5, -1.5, -2.5])), single (log ([0.5, 1.5, 2.5]) + pi*1i), 4*eps ("single")) +%!assert (log (single ([-0.5, -1.5, -2.5])), +%! single (log ([0.5, 1.5, 2.5]) + pi*1i), 4*eps ("single")) %!error log () %!error log (1, 2) @@ -1735,7 +1758,8 @@ /* %!assert (log10 ([0.01, 0.1, 1, 10, 100]), [-2, -1, 0, 1, 2], sqrt (eps)) -%!assert (log10 (single ([0.01, 0.1, 1, 10, 100])), single ([-2, -1, 0, 1, 2]), sqrt (eps ("single"))) +%!assert (log10 (single ([0.01, 0.1, 1, 10, 100])), +%! single ([-2, -1, 0, 1, 2]), sqrt (eps ("single"))) %!error log10 () %!error log10 (1, 2) @@ -2061,12 +2085,16 @@ %!assert (sqrt (4), 2) %!assert (sqrt (-1), i) %!assert (sqrt (1+i), exp (0.5 * log (1+i)), sqrt (eps)) -%!assert (sqrt ([4, -4; i, 1-i]), [2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))], sqrt (eps)) +%!assert (sqrt ([4, -4; i, 1-i]), +%! [2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))], sqrt (eps)) %!assert (sqrt (single (4)), single (2)) %!assert (sqrt (single (-1)), single (i)) -%!assert (sqrt (single (1+i)), single (exp (0.5 * log (1+i))), sqrt (eps ("single"))) -%!assert (sqrt (single ([4, -4; i, 1-i])), single ([2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))]), sqrt (eps ("single"))) +%!assert (sqrt (single (1+i)), +%! single (exp (0.5 * log (1+i))), sqrt (eps ("single"))) +%!assert (sqrt (single ([4, -4; i, 1-i])), +%! single ([2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))]), +%! sqrt (eps ("single"))) %!error sqrt () %!error sqrt (1, 2) @@ -2162,10 +2190,12 @@ /* %!assert (tolower ("OCTAVE"), "octave") %!assert (tolower ("123OCTave! _&"), "123octave! _&") -%!assert (tolower ({"ABC", "DEF", {"GHI", {"JKL"}}}), {"abc", "def", {"ghi", {"jkl"}}}) +%!assert (tolower ({"ABC", "DEF", {"GHI", {"JKL"}}}), +%! {"abc", "def", {"ghi", {"jkl"}}}) %!assert (tolower (["ABC"; "DEF"]), ["abc"; "def"]) %!assert (tolower ({["ABC"; "DEF"]}), {["abc";"def"]}) -%!assert (tolower (["ABCÄÖÜSS"; "abcäöüß"]), ["abcäöüss"; "abcäöüß"]) +%!assert (tolower (["ABCÄÖÜSS"; "abcäöüß"]), +%! ["abcäöüss"; "abcäöüß"]) %!assert (tolower (repmat ("ÄÖÜ", 2, 1, 3)), repmat ("äöü", 2, 1, 3)) %!assert (tolower (68), 68) %!assert (tolower ({[68, 68; 68, 68]}), {[68, 68; 68, 68]}) @@ -2228,10 +2258,12 @@ /* %!assert (toupper ("octave"), "OCTAVE") %!assert (toupper ("123OCTave! _&"), "123OCTAVE! _&") -%!assert (toupper ({"abc", "def", {"ghi", {"jkl"}}}), {"ABC", "DEF", {"GHI", {"JKL"}}}) +%!assert (toupper ({"abc", "def", {"ghi", {"jkl"}}}), +%! {"ABC", "DEF", {"GHI", {"JKL"}}}) %!assert (toupper (["abc"; "def"]), ["ABC"; "DEF"]) %!assert (toupper ({["abc"; "def"]}), {["ABC";"DEF"]}) -%!assert (toupper (["ABCÄÖÜSS"; "abcäöüß"]), ["ABCÄÖÜSS"; "ABCÄÖÜSS"]) +%!assert (toupper (["ABCÄÖÜSS"; "abcäöüß"]), +%! ["ABCÄÖÜSS"; "ABCÄÖÜSS"]) %!assert (toupper (repmat ("äöü", 2, 1, 3)), repmat ("ÄÖÜ", 2, 1, 3)) %!assert (toupper (100), 100) %!assert (toupper ({[100, 100; 100, 100]}), {[100, 100; 100, 100]}) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/matrix_type.cc --- a/libinterp/corefcn/matrix_type.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/matrix_type.cc Sun Apr 03 11:30:26 2022 -0400 @@ -458,10 +458,13 @@ %!assert (matrix_type (speye (10,10)), "Diagonal") %!assert (matrix_type (speye (10,10)([2:10,1],:)), "Permuted Diagonal") -%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]]), "Upper") -%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]](:,[2,1,3:11])), "Permuted Upper") +%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]]), +%! "Upper") +%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]](:,[2,1,3:11])), +%! "Permuted Upper") %!assert (matrix_type ([speye(10,10),sparse(10,1);1,sparse(1,9),1]), "Lower") -%!assert (matrix_type ([speye(10,10),sparse(10,1);1,sparse(1,9),1]([2,1,3:11],:)), "Permuted Lower") +%!assert (matrix_type ([speye(10,10),sparse(10,1);1,sparse(1,9),1]([2,1,3:11],:)), +%! "Permuted Lower") %!test %! bnd = spparms ("bandden"); @@ -486,30 +489,40 @@ %!assert (matrix_type (speye (10,11)([2:10,1],:)), "Permuted Diagonal") %!assert (matrix_type (speye (11,10)), "Diagonal") %!assert (matrix_type (speye (11,10)([2:11,1],:)), "Permuted Diagonal") -%#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]]), "Upper") -%#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]](:,[2,1,3:12])), "Permuted Upper") +%!#assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]]), "Upper") +%!#assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]](:,[2,1,3:12])), "Permuted Upper") %!assert (matrix_type ([speye(11,9),[1;sparse(8,1);1;0]]), "Upper") -%!assert (matrix_type ([speye(11,9),[1;sparse(8,1);1;0]](:,[2,1,3:10])), "Permuted Upper") -%#!assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]), "Lower") -%#!assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]([2,1,3:12],:)), "Permuted Lower") +%!assert (matrix_type ([speye(11,9),[1;sparse(8,1);1;0]](:,[2,1,3:10])), +%! "Permuted Upper") + +%!#assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]), +%! "Lower") +%!#assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]([2,1,3:12],:)), +%! "Permuted Lower") %!assert (matrix_type ([speye(9,11);[1,sparse(1,8),1,0]]), "Lower") -%!assert (matrix_type ([speye(9,11);[1,sparse(1,8),1,0]]([2,1,3:10],:)), "Permuted Lower") +%!assert (matrix_type ([speye(9,11);[1,sparse(1,8),1,0]]([2,1,3:10],:)), +%! "Permuted Lower") %!assert (matrix_type (spdiags (randn (10,4),[-2:1],10,9)), "Rectangular") %!assert (matrix_type (1i*speye (10,10)), "Diagonal") %!assert (matrix_type (1i*speye (10,10)([2:10,1],:)), "Permuted Diagonal") -%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]]), "Upper") -%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]](:,[2,1,3:11])), "Permuted Upper") +%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]]), +%! "Upper") +%!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]](:,[2,1,3:11])), +%! "Permuted Upper") %!assert (matrix_type ([speye(10,10),sparse(10,1);1i,sparse(1,9),1]), "Lower") -%!assert (matrix_type ([speye(10,10),sparse(10,1);1i,sparse(1,9),1]([2,1,3:11],:)), "Permuted Lower") +%!assert (matrix_type ([speye(10,10),sparse(10,1);1i,sparse(1,9),1]([2,1,3:11],:)), +%! "Permuted Lower") %!test %! bnd = spparms ("bandden"); %! spparms ("bandden", 0.5); -%! assert (matrix_type (spdiags (1i*randn (10,3),[-1,0,1],10,10)), "Tridiagonal"); +%! assert (matrix_type (spdiags (1i*randn (10,3),[-1,0,1],10,10)), +%! "Tridiagonal"); %! a = 1i*(rand (9,1)-0.5); %! a = [[a;0],ones(10,1),[0;-a]]; -%! assert (matrix_type (spdiags (a,[-1,0,1],10,10)), "Tridiagonal Positive Definite"); +%! assert (matrix_type (spdiags (a,[-1,0,1],10,10)), +%! "Tridiagonal Positive Definite"); %! spparms ("bandden", bnd); %!test %! bnd = spparms ("bandden"); @@ -528,14 +541,16 @@ %!assert (matrix_type (1i*speye (10,11)([2:10,1],:)), "Permuted Diagonal") %!assert (matrix_type (1i*speye (11,10)), "Diagonal") %!assert (matrix_type (1i*speye (11,10)([2:11,1],:)), "Permuted Diagonal") -%#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]]), "Upper") -%#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]](:,[2,1,3:12])), "Permuted Upper") +%!#assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]]), "Upper") +%!#assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]](:,[2,1,3:12])), "Permuted Upper") %!assert (matrix_type ([speye(11,9),[1i;sparse(8,1);1i;0]]), "Upper") -%!assert (matrix_type ([speye(11,9),[1i;sparse(8,1);1i;0]](:,[2,1,3:10])), "Permuted Upper") -%#!assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]), "Lower") -%#!assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]([2,1,3:12],:)), "Permuted Lower") +%!assert (matrix_type ([speye(11,9),[1i;sparse(8,1);1i;0]](:,[2,1,3:10])), +%! "Permuted Upper") +%!#assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]), "Lower") +%!#assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]([2,1,3:12],:)), "Permuted Lower") %!assert (matrix_type ([speye(9,11);[1i,sparse(1,8),1i,0]]), "Lower") -%!assert (matrix_type ([speye(9,11);[1i,sparse(1,8),1i,0]]([2,1,3:10],:)), "Permuted Lower") +%!assert (matrix_type ([speye(9,11);[1i,sparse(1,8),1i,0]]([2,1,3:10],:)), +%! "Permuted Lower") %!assert (matrix_type (1i*spdiags(randn(10,4),[-2:1],10,9)), "Rectangular") %!test diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/max.cc --- a/libinterp/corefcn/max.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/max.cc Sun Apr 03 11:30:26 2022 -0400 @@ -290,7 +290,8 @@ retval(0) = range.max (); if (nargout > 1) retval(1) = static_cast - (range.increment () >= 0 ? range.numel () : 1); + (range.increment () >= 0 ? range.numel () + : 1); } } else if (arg.issparse ()) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/mex.cc Sun Apr 03 11:30:26 2022 -0400 @@ -489,7 +489,7 @@ mxArray *retval = m_val.as_mxArray (m_interleaved); // RETVAL is assumed to be an mxArray_matlab object. Should we - // assert that condition here? + // error_unless that condition here? if (retval) { @@ -799,9 +799,11 @@ GET_DATA_METHOD (mxUint64, get_uint64s, mxUINT64_CLASS, mxREAL); - GET_DATA_METHOD (mxComplexDouble, get_complex_doubles, mxDOUBLE_CLASS, mxCOMPLEX); - - GET_DATA_METHOD (mxComplexSingle, get_complex_singles, mxDOUBLE_CLASS, mxCOMPLEX); + GET_DATA_METHOD (mxComplexDouble, get_complex_doubles, + mxDOUBLE_CLASS, mxCOMPLEX); + + GET_DATA_METHOD (mxComplexSingle, get_complex_singles, + mxDOUBLE_CLASS, mxCOMPLEX); #if 0 /* We don't have these yet. */ @@ -1558,8 +1560,8 @@ protected: mxArray_matlab (bool interleaved, mxClassID id = mxUNKNOWN_CLASS) - : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), m_ndims (0), - m_dims (nullptr) + : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), + m_ndims (0), m_dims (nullptr) { } mxArray_matlab (bool interleaved, mxClassID id, mwSize ndims, @@ -1609,7 +1611,8 @@ } mxArray_matlab (bool interleaved, mxClassID id, mwSize m, mwSize n) - : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), m_ndims (2), + : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), + m_ndims (2), m_dims (static_cast (mxArray::malloc (m_ndims * sizeof (mwSize)))) { m_dims[0] = m; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/module.mk --- a/libinterp/corefcn/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -231,6 +231,7 @@ %reldir%/ordschur.cc \ %reldir%/pager.cc \ %reldir%/pinv.cc \ + %reldir%/pow2.cc \ %reldir%/pr-flt-fmt.cc \ %reldir%/pr-output.cc \ %reldir%/procstream.cc \ diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/mxarray.h --- a/libinterp/corefcn/mxarray.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/mxarray.h Sun Apr 03 11:30:26 2022 -0400 @@ -652,7 +652,8 @@ void set_field_by_number (mwIndex index, int key_num, mxArray *val) { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); } - int get_number_of_fields (void) const { return m_rep->get_number_of_fields (); } + int get_number_of_fields (void) const + { return m_rep->get_number_of_fields (); } const char * get_field_name_by_number (int key_num) const { DO_MUTABLE_METHOD (const char*, get_field_name_by_number (key_num)); } @@ -668,7 +669,8 @@ mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const { return m_rep->calc_single_subscript (nsubs, subs); } - std::size_t get_element_size (void) const { return m_rep->get_element_size (); } + std::size_t get_element_size (void) const + { return m_rep->get_element_size (); } bool mutation_needed (void) const { return m_rep->mutation_needed (); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/oct-errno.in.cc --- a/libinterp/corefcn/oct-errno.in.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/oct-errno.in.cc Sun Apr 03 11:30:26 2022 -0400 @@ -321,7 +321,8 @@ int octave_errno::do_lookup (const std::string& name) { - return (m_errno_tbl.find (name) != m_errno_tbl.end ()) ? m_errno_tbl[name] : -1; + return (m_errno_tbl.find (name) != m_errno_tbl.end ()) ? m_errno_tbl[name] + : -1; } octave_scalar_map diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/oct-hist.cc --- a/libinterp/corefcn/oct-hist.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/oct-hist.cc Sun Apr 03 11:30:26 2022 -0400 @@ -867,7 +867,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} history_timestamp_format_string () @deftypefnx {} {@var{old_val} =} history_timestamp_format_string (@var{new_val}) -@deftypefnx {} {} history_timestamp_format_string (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} history_timestamp_format_string (@var{new_val}, "local") Query or set the internal variable that specifies the format string for the comment line that is written to the history file when Octave exits. @@ -902,7 +902,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} history_save () @deftypefnx {} {@var{old_val} =} history_save (@var{new_val}) -@deftypefnx {} {} history_save (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} history_save (@var{new_val}, "local") Query or set the internal variable that controls whether commands entered on the command line are saved in the history file. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/oct-map.cc --- a/libinterp/corefcn/oct-map.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/oct-map.cc Sun Apr 03 11:30:26 2022 -0400 @@ -498,8 +498,6 @@ octave_map octave_map::transpose (void) const { - assert (ndims () == 2); - octave_map retval (m_keys); retval.m_dimensions = dim_vector (m_dimensions (1), m_dimensions (0)); @@ -614,7 +612,7 @@ for (octave_idx_type j = 0; j < nf; j++) { retval.m_vals.push_back (Cell (rd)); - assert (retval.m_vals[j].numel () == n); + error_unless (retval.m_vals[j].numel () == n); for (octave_idx_type i = 0; i < n; i++) retval.m_vals[j].xelem (i) = map_list[i].m_vals[j]; } @@ -984,7 +982,8 @@ octave_map octave_map::page (octave_idx_type k) const { - static Array ia (dim_vector (3, 1), octave::idx_vector::colon); + static Array ia (dim_vector (3, 1), + octave::idx_vector::colon); ia(2) = k; return index (ia); @@ -1032,7 +1031,7 @@ error (ee, "incompatible fields in struct assignment"); } - assert (rhs1.m_keys.is_same (m_keys)); + error_unless (rhs1.m_keys.is_same (m_keys)); assign (i, rhs1); } } @@ -1080,7 +1079,7 @@ error (ee, "incompatible fields in struct assignment"); } - assert (rhs1.m_keys.is_same (m_keys)); + error_unless (rhs1.m_keys.is_same (m_keys)); assign (i, j, rhs1); } } @@ -1128,7 +1127,7 @@ error (ee, "incompatible fields in struct assignment"); } - assert (rhs1.m_keys.is_same (m_keys)); + error_unless (rhs1.m_keys.is_same (m_keys)); assign (ia, rhs1); } } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/oct-stream.cc Sun Apr 03 11:30:26 2022 -0400 @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -42,7 +43,6 @@ #include "Array.h" #include "Cell.h" #include "byte-swap.h" -#include "lo-cutils.h" #include "lo-ieee.h" #include "lo-mappers.h" #include "lo-utils.h" @@ -50,6 +50,7 @@ #include "octave-preserve-stream-state.h" #include "quit.h" #include "str-vec.h" +#include "strcase-wrappers.h" #include "error.h" #include "errwarn.h" @@ -351,9 +352,9 @@ void add_elt_to_list (int width, bool discard, char type, char modifier, const std::string& char_class = ""); - void process_conversion (const std::string& s, std::size_t& i, std::size_t n, - int& width, bool& discard, char& type, - char& modifier); + void process_conversion (const std::string& s, std::size_t& i, + std::size_t n, int& width, bool& discard, + char& type, char& modifier); int finish_conversion (const std::string& s, std::size_t& i, std::size_t n, int width, bool discard, char& type, @@ -1248,7 +1249,7 @@ // Load new data into buffer, and set eob, last, idx. // Return EOF at end of file, 0 otherwise. - int refresh_buf (void); + int refresh_buf (bool initialize = false); // Get a character, relying on caller to call field_done if // a delimiter has been reached. @@ -1293,7 +1294,7 @@ bool eof (void) { - return (m_eob == m_buf && m_i_stream.eof ()) + return (m_eob == m_buf + m_overlap && m_i_stream.eof ()) || (m_flags & std::ios_base::eofbit); } @@ -1319,6 +1320,17 @@ bool no_progress (void) { return m_progress_marker == m_idx; } + // Number of characters remaining until end of stream if it is already + // buffered. int_max otherwise. + + std::ptrdiff_t remaining (void) + { + if (m_eob < m_buf + m_bufsize) + return m_eob - m_idx; + else + return std::numeric_limits::max (); + } + private: // Number of characters to read from the file at once. @@ -1340,6 +1352,9 @@ // Position after last character in buffer. char *m_eob; + // Overlap with old content when refreshing buffer. + std::ptrdiff_t m_overlap; + // True if there is delimiter in the buffer after idx. bool m_delimited; @@ -1374,7 +1389,7 @@ m_eob = m_buf + m_bufsize; m_idx = m_eob; // refresh_buf shouldn't try to copy old data m_progress_marker = m_idx; - refresh_buf (); // load the first batch of data + refresh_buf (true); // load the first batch of data } // Used to create a stream from a strstream from data read from a dstr. @@ -1390,7 +1405,7 @@ { m_i_stream.clear (); m_i_stream.seekg (m_buf_in_file); - m_i_stream.read (m_buf, m_idx - m_buf); + m_i_stream.read (m_buf, m_idx - m_buf - m_overlap); } delete [] m_buf; @@ -1448,7 +1463,7 @@ // processed. int - delimited_stream::refresh_buf (void) + delimited_stream::refresh_buf (bool initialize) { if (eof ()) return std::istream::traits_type::eof (); @@ -1459,36 +1474,54 @@ m_idx = m_eob; std::size_t old_remaining = m_eob - m_idx; + std::size_t old_overlap = 0; + + if (initialize || (m_idx - m_buf <= 0)) + m_overlap = 0; + else + { + old_overlap = m_overlap; + // Retain the last 25 bytes in the buffer. That should be more than enough + // to putback an entire double precision floating point number in decimal + // including 3 digit exponent and signs. Do we ever need to putback more + // than that? + m_overlap = 25; + // Assure we don't "underflow" with the overlap + m_overlap = std::min (m_overlap, m_idx - m_buf - 1); + } octave_quit (); // allow ctrl-C - if (old_remaining > 0) - { - m_buf_in_file += (m_idx - m_buf); - memmove (m_buf, m_idx, old_remaining); + if (old_remaining + m_overlap > 0) + { + m_buf_in_file += (m_idx - old_overlap - m_buf); + std::memmove (m_buf, m_idx - m_overlap, m_overlap + old_remaining); } else m_buf_in_file = m_i_stream.tellg (); // record for destructor - m_progress_marker -= m_idx - m_buf; // where original idx would have been - m_idx = m_buf; + // where original idx would have been + m_progress_marker -= m_idx - m_overlap - m_buf; + m_idx = m_buf + m_overlap; int gcount; // chars read if (! m_i_stream.eof ()) { - m_i_stream.read (m_buf + old_remaining, m_bufsize - old_remaining); + m_i_stream.read (m_buf + m_overlap + old_remaining, + m_bufsize - m_overlap - old_remaining); gcount = m_i_stream.gcount (); } else gcount = 0; - m_eob = m_buf + old_remaining + gcount; + m_eob = m_buf + m_overlap + old_remaining + gcount; m_last = m_eob; if (gcount == 0) { m_delimited = false; - if (m_eob != m_buf) // no more data in file, but still some to go + if (m_eob != m_buf + m_overlap) + // no more data in file, but still some to go retval = 0; else // file and buffer are both done. @@ -1498,13 +1531,14 @@ { m_delimited = true; - for (m_last = m_eob - m_longest; m_last - m_buf >= 0; m_last--) + for (m_last = m_eob - m_longest; m_last - m_buf - m_overlap >= 0; + m_last--) { if (m_delims.find (*m_last) != std::string::npos) break; } - if (m_last < m_buf) + if (m_last < m_buf + m_overlap) m_delimited = false; retval = 0; @@ -1528,7 +1562,7 @@ { char *retval; - if (m_eob - m_idx > size) + if (m_eob - m_idx >= size) { retval = m_idx; m_idx += size; @@ -1755,7 +1789,8 @@ int read_first_row (delimited_stream& is, textscan& ts); - std::list out_buf (void) const { return (m_output_container); } + std::list out_buf (void) const + { return (m_output_container); } private: @@ -2616,8 +2651,8 @@ } // Finally, create the stream. delimited_stream is (isp, - (m_delim_table.empty () ? m_whitespace + "\r\n" - : m_delims), + (m_delims.empty () ? m_whitespace + "\r\n" + : m_delims), max_lookahead, buf_size); // Grow retval dynamically. "size" is half the initial size @@ -2792,12 +2827,12 @@ double retval = 0; bool valid = false; // syntactically correct double? - int ch = is.peek (); + int ch = is.peek_undelim (); if (ch == '+') { is.get (); - ch = is.peek (); + ch = is.peek_undelim (); if (width_left) width_left--; } @@ -2805,7 +2840,7 @@ { sign = -1; is.get (); - ch = is.peek (); + ch = is.peek_undelim (); if (width_left) width_left--; } @@ -2853,6 +2888,11 @@ if (i > 0) valid = true; // valid if at least one digit after '.' + else if (! valid) // if there was nothing before and after '.' + { + is.putback (ch); + ch = '.'; + } // skip remainder after '.', to field width, to look for exponent if (i == precision) @@ -2866,7 +2906,7 @@ bool used_exp = false; if (valid && width_left > 1 && m_exp_chars.find (ch) != std::string::npos) { - int ch1 = is.peek (); + int ch1 = is.peek_undelim (); if (ch1 == '-' || ch1 == '+' || (ch1 >= '0' && ch1 <= '9')) { // if 1.0e+$ or some such, this will set failbit, as we want @@ -2885,7 +2925,7 @@ is.get (); } valid = false; - while (width_left-- && is && (ch = is.get ()) >= '0' && ch <= '9') + while (width_left-- && is && (ch = is.get_undelim ()) >= '0' && ch <= '9') { exp = exp*10 + ch - '0'; valid = true; @@ -2908,9 +2948,9 @@ is.putback (ch); // Check for +/- inf and NaN - if (! valid && width_left >= 3) - { - int i = lookahead (is, m_inf_nan, 3, false); // false -> case insensitive + if (! valid && width_left >= 3 && is.remaining () >= 3) + { + int i = lookahead (is, m_inf_nan, 3, false); // false->case insensitive if (i == 0) { retval = numeric_limits::Inf (); @@ -2944,23 +2984,23 @@ bool as_empty = false; // did we fail but match a "treat_as_empty" string? bool inf = false; - int ch = is.peek (); + int ch = is.peek_undelim (); if (ch == '+' || ch == '-') // check for [+-][ij] with no coefficients { ch = is.get (); - int ch2 = is.peek (); + int ch2 = is.peek_undelim (); if (ch2 == 'i' || ch2 == 'j') { double value = 1; is.get (); // Check not -inf - if (is.peek () == 'n') + if (is.peek_undelim () == 'n') { char *pos = is.tellg (); std::ios::iostate state = is.rdstate (); is.get (); - ch2 = is.get (); + ch2 = is.get_undelim (); if (ch2 == 'f') { inf = true; @@ -2971,6 +3011,8 @@ else { is.clear (state); + // FIXME: Buffer might have refreshed. + // pos might no longer be valid. is.seekg (pos); // reset to position before look-ahead } } @@ -2986,6 +3028,7 @@ char *pos = is.tellg (); std::ios::iostate state = is.rdstate (); //re = read_value (is); + // FIXME: read_double might refresh the buffer. So seekg might be off. re = read_double (is, fmt); // check for "treat as empty" string @@ -3037,7 +3080,8 @@ { state = is.rdstate (); // before tellg, since that fails at EOF - ch = is.peek (); // ch == EOF if read failed; no need to chk fail + ch = is.peek_undelim (); + // ch == EOF if read failed; no need to chk fail if (ch == 'i' || ch == 'j') // pure imaginary { is.get (); @@ -3051,11 +3095,13 @@ state = is.rdstate (); //im = read_value (is); + // FIXME: read_double might refresh the buffer. + // So seekg might be off after this. im = read_double (is, fmt); if (is.fail ()) im = 1; - if (is.peek () == 'i' || is.peek () == 'j') + if (is.peek_undelim () == 'i' || is.peek_undelim () == 'j') is.get (); else { @@ -3166,7 +3212,7 @@ val.append (std::max (val.length (), static_cast (16)), '\0'); - int ch = is.get (); + int ch = is.get_undelim (); if (is_delim (ch) || ch == std::istream::traits_type::eof ()) { is.putback (ch); @@ -3224,7 +3270,7 @@ { skip_whitespace (is); - if (is.peek () != '"') + if (is.peek_undelim () != '"') scan_string (is, fmt, val); else { @@ -3505,7 +3551,7 @@ { if (m_delim_list.isempty ()) { - if (! is_delim (is.peek ())) + if (! is_delim (is.peek_undelim ())) this_conversion_failed = true; } else // Cell array of multi-character delimiters @@ -3929,7 +3975,7 @@ { is.get (); if (c1 == m_eol1 && is.peek_undelim () == m_eol2) - is.get_undelim (); // if \r\n, skip the \n too. + is.get (); // if \r\n, skip the \n too. if (multiple_delims_as_one) { @@ -4042,7 +4088,7 @@ base_stream::clearerr (void) { std::istream *is = input_stream (); - std::ostream *os = output_stream (); + std::ostream *os = preferred_output_stream (); if (is) is->clear (); @@ -5422,7 +5468,7 @@ { int retval = -1; - std::ostream *os = output_stream (); + std::ostream *os = preferred_output_stream (); if (! os) invalid_operation ("fflush", "writing"); @@ -5632,24 +5678,23 @@ template static int - do_printf_conv (std::ostream& os, const std::string& encoding, - const char *fmt, int nsa, int sa_1, int sa_2, T arg, - const std::string& who) + do_printf_conv (std::ostream& os, const char *fmt, int nsa, int sa_1, + int sa_2, T arg, const std::string& who) { int retval = 0; switch (nsa) { case 2: - retval = format (os, encoding, fmt, sa_1, sa_2, arg); + retval = format (os, fmt, sa_1, sa_2, arg); break; case 1: - retval = format (os, encoding, fmt, sa_1, arg); + retval = format (os, fmt, sa_1, arg); break; case 0: - retval = format (os, encoding, fmt, arg); + retval = format (os, fmt, arg); break; default: @@ -5663,7 +5708,7 @@ static std::size_t do_printf_string (std::ostream& os, const printf_format_elt *elt, int nsa, int sa_1, int sa_2, const std::string& arg, - const std::string& encoding, const std::string& who) + const std::string& who) { if (nsa > 2) ::error ("%s: internal error handling format", who.c_str ()); @@ -5677,12 +5722,6 @@ std::size_t prec = (nsa > 1 ? sa_2 : (elt->prec == -1 ? len : elt->prec)); std::string print_str = prec < arg.length () ? arg.substr (0, prec) : arg; - if (encoding.compare ("utf-8")) - { - std::size_t src_len = print_str.length (); - print_str = string::u8_to_encoding (who, print_str, encoding); - len -= src_len - print_str.length (); - } std::size_t fw = (nsa > 0 ? sa_1 : (elt->fw == -1 ? len : elt->fw)); @@ -5809,8 +5848,8 @@ tval = (lo_ieee_is_NA (dval) ? "NA" : "NaN"); } - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, sa_1, - sa_2, tval, who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, tval, + who); } else { @@ -5829,8 +5868,8 @@ // Insert "long" modifier. tfmt.replace (tfmt.rfind (type), 1, llmod + type); - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, - sa_1, sa_2, tval.value (), who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, + tval.value (), who); } else { @@ -5838,8 +5877,8 @@ double dval = val.double_value (true); - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, - sa_1, sa_2, dval, who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, + dval, who); } break; @@ -5851,8 +5890,8 @@ // Insert "long" modifier. tfmt.replace (tfmt.rfind (type), 1, llmod + type); - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, - sa_1, sa_2, tval.value (), who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, + tval.value (), who); } else { @@ -5860,8 +5899,8 @@ double dval = val.double_value (true); - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, - sa_1, sa_2, dval, who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, + dval, who); } break; @@ -5870,8 +5909,8 @@ { double dval = val.double_value (true); - retval += do_printf_conv (os, encoding (), tfmt.c_str (), nsa, - sa_1, sa_2, dval, who); + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, + dval, who); } break; @@ -5903,7 +5942,7 @@ octave_idx_type m_nconv = fmt_list.num_conversions (); - std::ostream *osp = output_stream (); + std::ostream *osp = preferred_output_stream (); if (! osp) invalid_operation (who, "writing"); @@ -5956,18 +5995,12 @@ if (elt->type == '%') { - if (encoding ().compare ("utf-8")) - os << string::u8_to_encoding (who, "%", encoding ()); - else - os << '%'; + os << '%'; retval++; } else if (elt->args == 0 && ! elt->text.empty ()) { - if (encoding ().compare ("utf-8")) - os << string::u8_to_encoding (who, elt->text, encoding ()); - else - os << elt->text; + os << elt->text; retval += (elt->text.length ()); } else if (elt->type == 's' || elt->type == 'c') @@ -5981,8 +6014,7 @@ std::string sval = val.string_value (); retval += do_printf_string (os, elt, nsa, sa_1, - sa_2, sval, encoding (), - who); + sa_2, sval, who); } else retval += do_numeric_printf_conv (os, elt, nsa, sa_1, @@ -6039,7 +6071,7 @@ { int retval = -1; - std::ostream *osp = output_stream (); + std::ostream *osp = preferred_output_stream (); if (! osp) invalid_operation (who, "writing"); @@ -6365,7 +6397,10 @@ stream::close (void) { if (stream_ok ()) + { + m_rep->flush (); m_rep->close (); + } } template @@ -6595,9 +6630,6 @@ // consistent with the order of the elements in the data_type enum in the // oct_data_conv class. - // Expose this in a future version? - std::size_t char_count = 0; - std::ptrdiff_t tmp_count = 0; try @@ -6660,7 +6692,7 @@ std::ptrdiff_t input_buf_size = static_cast (input_buf_elts) * input_elt_size; - assert (input_buf_size >= 0); + error_if (input_buf_size < 0); // Must also work and return correct type object for 0 elements to read. std::istream *isp = input_stream (); @@ -6701,7 +6733,6 @@ std::size_t gcount = is.gcount (); - char_count += gcount; cur_pos += gcount; octave_idx_type nel = gcount / input_elt_size; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/oct-stream.h --- a/libinterp/corefcn/oct-stream.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/oct-stream.h Sun Apr 03 11:30:26 2022 -0400 @@ -35,6 +35,8 @@ #include #include +#include "oct-string.h" + // These only appear as reference arguments or return values. class Cell; @@ -73,7 +75,8 @@ mach_info::float_format ff = mach_info::native_float_format (), const std::string& encoding = "utf-8") : m_mode (arg_md), m_flt_fmt (ff), m_encoding (encoding), - m_fail (false), m_open_state (true), m_errmsg () + m_conv_ostream (nullptr), m_fail (false), m_open_state (true), + m_errmsg () { } // No copying! @@ -115,6 +118,31 @@ virtual std::ostream * output_stream (void) { return nullptr; } + // Return either the original output stream or one wrapped with the + // encoding facet. + + std::ostream * preferred_output_stream (void) + { + if (! m_encoding.compare ("utf-8")) + return output_stream (); + + if (m_conv_ostream) + return m_conv_ostream; + + // 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 *converter + = new std::wbuffer_convert (os->rdbuf (), + facet); + m_conv_ostream = new std::ostream (converter); + } + + return (m_conv_ostream ? m_conv_ostream : output_stream ()); + } + // Return TRUE if this stream is open. bool is_open (void) const { return m_open_state; } @@ -183,6 +211,16 @@ // Code page std::string m_encoding; + // encoding conversion facet + typedef string::deletable_facet convfacet_u8; + + std::wbuffer_convert *m_converter; + + // wrappers for encoding conversion + // std::istream *m_conv_istream; + + std::ostream *m_conv_ostream; + // TRUE if an error has occurred. bool m_fail; @@ -415,7 +453,7 @@ std::ostream * output_stream (void) { - return m_rep ? m_rep->output_stream () : nullptr; + return (m_rep ? m_rep->preferred_output_stream () : nullptr); } void clearerr (void) { if (m_rep) m_rep->clearerr (); } @@ -476,7 +514,8 @@ lookup (const octave_value& fid, const std::string& who = "") const; OCTINTERP_API int remove (int fid, const std::string& who = ""); - OCTINTERP_API int remove (const octave_value& fid, const std::string& who = ""); + OCTINTERP_API int remove (const octave_value& fid, + const std::string& who = ""); OCTINTERP_API void clear (bool flush = true); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/pager.cc --- a/libinterp/corefcn/pager.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/pager.cc Sun Apr 03 11:30:26 2022 -0400 @@ -666,7 +666,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} page_output_immediately () @deftypefnx {} {@var{old_val} =} page_output_immediately (@var{new_val}) -@deftypefnx {} {} page_output_immediately (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} page_output_immediately (@var{new_val}, "local") Query or set the internal variable that controls whether Octave sends output to the pager as soon as it is available. @@ -690,7 +690,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} page_screen_output () @deftypefnx {} {@var{old_val} =} page_screen_output (@var{new_val}) -@deftypefnx {} {} page_screen_output (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} page_screen_output (@var{new_val}, "local") Query or set the internal variable that controls whether output intended for the terminal window that is longer than one page is sent through a pager. @@ -714,7 +714,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PAGER () @deftypefnx {} {@var{old_val} =} PAGER (@var{new_val}) -@deftypefnx {} {} PAGER (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} PAGER (@var{new_val}, "local") Query or set the internal variable that specifies the program to use to display terminal output on your system. @@ -737,7 +737,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PAGER_FLAGS () @deftypefnx {} {@var{old_val} =} PAGER_FLAGS (@var{new_val}) -@deftypefnx {} {} PAGER_FLAGS (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} PAGER_FLAGS (@var{new_val}, "local") Query or set the internal variable that specifies the options to pass to the pager. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/pinv.cc --- a/libinterp/corefcn/pinv.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/pinv.cc Sun Apr 03 11:30:26 2022 -0400 @@ -64,6 +64,9 @@ octave_value arg = args(0); + if (! arg.isnumeric ()) + err_wrong_type_arg ("pinv", arg); + if (arg.isempty ()) return ovl (Matrix ()); @@ -197,6 +200,12 @@ %! y = pinv (x, 2); %! assert (diag (y), [1/3 1/2 0 0 0]'); +## Basic test for integer inputs +%!assert (pinv (int32 (2)), 0.5) +%!assert (pinv (uint32 (2)), 0.5) +%!assert (pinv (int64 (2)), 0.5) +%!assert (pinv (uint64 (2)), 0.5) + ## Test special case of 0 scalars and vectors %!assert (pinv (0), 0) %!assert (pinv ([0, 0, 0]), [0; 0; 0]) @@ -206,6 +215,12 @@ %!assert (pinv (complex ([0,0,0], [0,0,0])), [0; 0; 0]) %!assert (pinv (complex (single (0),0)), single (0)) %!assert (pinv (complex (single ([0,0,0]), [0,0,0])), single ([0; 0; 0])) + +## Test input validation +%!error pinv ("Hello World") +%!error pinv ({1}) +%!error pinv (true) + */ OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/pow2.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libinterp/corefcn/pow2.cc Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,325 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include + +#include "lo-array-errwarn.h" + +#include "defun.h" +#include "error.h" +#include "errwarn.h" + +// FIXME: According to cppreference.com the implementation of `ldexp (f, e)` +// might be less efficient that the corresponding `f * exp2 (e)`. Consider +// replacing our implementation with the latter. + +template +void +map_2_xldexp (Array& y, const Array& f, const Array& e) +{ + if (f.numel () == e.numel () || e.numel () == 1) + y = Array (f.dims ()); + else if (f.numel () == 1) + y = Array (e.dims ()); + else + octave::err_nonconformant ("pow2", f.dims (), e.dims ()); + + octave_idx_type f_inc = (f.numel () == 1) ? 0 : 1; + octave_idx_type e_inc = (e.numel () == 1) ? 0 : 1; + + for (octave_idx_type i = 0; i < y.numel (); i++) + y.xelem (i) = std::ldexp (f.xelem (i * f_inc), + static_cast (e.xelem (i * e_inc))); +} + +void +map_2_xldexp_sparse (SparseMatrix& y, const SparseMatrix& f, + const SparseMatrix& e) +{ + if (e.numel () == 1) + { + int ee = static_cast (e.data (0)); + for (octave_idx_type i = 0; i < y.nnz (); i++) + y.data (i) = std::ldexp (f.data (i), ee); + } + else if (f.numel () == e.numel ()) + { + octave_idx_type col = 1; + for (octave_idx_type i = 0; i < y.nnz (); i++) + { + // Determine current column. + while (i >= f.cidx (col)) + col++; + int ee = static_cast (e.xelem (f.ridx (i), col - 1)); + y.data (i) = std::ldexp (f.data (i), ee); + } + } + else + octave::err_nonconformant ("pow2", f.dims (), e.dims ()); +} + +OCTAVE_NAMESPACE_BEGIN + +DEFUN (pow2, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {@var{y} =} pow2 (@var{x}) +@deftypefnx {} {@var{y} =} pow2 (@var{f}, @var{e}) +With one input argument, compute +@tex +$y = 2^x$ +@end tex +@ifnottex +y = 2 .^ x +@end ifnottex +for each element of @var{x}. + +With two input arguments, return +@tex +$y = f \cdot 2^e$, +@end tex +@ifnottex +y = f .* (2 .^ e). +@end ifnottex +where for complex inputs only the real part of both inputs is regarded +and from @var{e} only the real integer part. This calling form corresponds +to C/C++ standard function @code{ldexp()}. +@seealso{log2, nextpow2, power} +@end deftypefn */) +{ + if (args.length () < 1 || args.length () > 2) + print_usage (); + + if (! args(0).isfloat ()) + err_wrong_type_arg ("pow2", args(0)); + + // Call exp2(f) where possible for numerical more accurate results. + if (args.length () == 1) + { + if (args(0).iscomplex ()) + { + // The C++ standard does not define exp2 for complex arguments. + // Therefore call `2.^x`. + octave_value retval = octave::binary_op (octave_value::op_el_pow, + 2, args(0)); + + // Preserve sparse datatype, but even for sparse input fill-up + // is unavoidable `2^0 == 1` thus cast only. + if (args(0).issparse ()) + retval = octave_value (retval.sparse_complex_matrix_value ()); + + return ovl (retval); + } + else if (args(0).is_single_type ()) + { + FloatNDArray x = args(0).float_array_value (); + FloatNDArray y (x.dims ()); + for (octave_idx_type i = 0; i < y.numel (); i++) + y.xelem (i) = std::exp2 (x.xelem (i)); + return ovl (y); + } + else + { + NDArray x = args(0).array_value (); + NDArray y (x.dims ()); + for (octave_idx_type i = 0; i < y.numel (); i++) + y.xelem (i) = std::exp2 (x.xelem (i)); + + // Preserve sparse datatype, but even for sparse input fill-up + // is unavoidable `2^0 == 1` thus cast only. + if (args(0).issparse ()) + return ovl (SparseMatrix (y)); + else + return ovl (y); + } + } + + // For Matlab compatibility, the two argument call `y = pow2 (f, e)` + // corresponds to std::ldexp() (see bug #61968). The resulting y is + // computed quickly by adding the integer part of e to the floating-point + // exponent of f. + + if (! args(1).isfloat ()) + err_wrong_type_arg ("pow2", args(1)); + + if (args(0).iscomplex () || args(1).iscomplex ()) + warning_with_id ("Octave:pow2:imaginary-ignored", + "pow2: imaginary part is ignored"); + + // Note: Matlab R2021a errors on `pow2 (sparse (f), single (e))`, + // but sparsity in f determines output and can significantly + // reduce computation, e.g. `N=1e5; pow2(speye(N),sparse(N,N))`. + if (args(0).issparse ()) + { + SparseMatrix f = args(0).sparse_matrix_value (); + + // Special case: return a sparse zero matrix in size of e. + if ((f.numel () == 1) && (f.nnz () == 0)) + return ovl (SparseMatrix (args(1).rows (), args(1).columns ())); + + // Only do sparse computation, if it pays off. For scalar f fill-up + // is unavoidable even for sparse e because `f * 2^0 == f`. Use dense + // code below in this case. + if (f.numel () > 1) + { + SparseMatrix e = args(1).sparse_matrix_value (); + SparseMatrix y = SparseMatrix (f); + map_2_xldexp_sparse (y, f, e); + return ovl (y); + } + } + + if (args(0).is_single_type () || args(1).is_single_type ()) + { + FloatNDArray f = args(0).float_array_value (); + FloatNDArray e = args(1).float_array_value (); + FloatNDArray y; + map_2_xldexp (y, f, e); + return ovl (y); + } + else + { + NDArray f = args(0).array_value (); + NDArray e = args(1).array_value (); + NDArray y; + map_2_xldexp (y, f, e); + + // Preserve sparse datatype. + // Cases for efficient use of sparsity were treated above already. + if (args(0).issparse ()) + return ovl (SparseMatrix (y)); + else + return ovl (y); + } +} + +/* +## Call `y = pow2 (x)` + +%!test +%! fcns = {@double, @single, @complex}; +%! x = [3, 0, -3]; +%! v = [8, 1, .125]; +%! for i = 1:numel (fcns) +%! fcn = fcns{i}; +%! assert (pow2 (fcn (x)), fcn (v), sqrt (eps)); +%! endfor + +%!test +%! fcns = {@double, @single, @complex, @sparse}; +%! x = [3, 1, -3]; +%! v = [8, 2, .125]; +%! for i = 1:numel (fcns) +%! fcn = fcns{i}; +%! assert (pow2 (fcn (x)), fcn (v), sqrt (eps)); +%! endfor + +%!test +%! fcns = {@double, @single, @complex, @sparse}; +%! x = [1, 1+1i, 1i]; +%! for i = 1:numel (fcns) +%! fcn = fcns{i}; +%! assert (pow2 (fcn (x)), fcn (2) .^ fcn (x), sqrt (eps)); +%! endfor + +## Call `y = pow2 (f, e)` + +%!test +%! fcns = {@double, @single, @complex, @sparse}; +%! f = [2 2]; +%! e = [2 2]; +%! z = [8 8]; +%! warning ("off", "Octave:pow2:imaginary-ignored", "local"); +%! for i = 1:numel (fcns) +%! fcn = fcns{i}; +%! assert (pow2 (fcn (f), fcn (e)), real (fcn (z))); +%! endfor + +## Only integer part is taken into account. +%!test +%! f = 2; +%! e = [2, 2.1, 2.2, 2.4, 2.5, 2.8]; +%! z = 8 .* ones (1, length (e)); +%! assert (pow2 (f, e), z); + +## Only real part is taken into account. +%!test +%! f = [1+1i, 1]; +%! e = 2; +%! z = [4, 4]; +%! warning ("off", "Octave:pow2:imaginary-ignored", "local"); +%! assert (pow2 (f, e), z); + +%!test +%! f = 1; +%! e = [1+1i, 1]; +%! z = [2, 2]; +%! warning ("off", "Octave:pow2:imaginary-ignored", "local"); +%! assert (pow2 (f, e), z); + +%!test +%! f = [1/2, pi/4, -3/4, 1/2, 1-eps()/2, 1/2]; +%! e = [1, 2, 2, -51, 1024, -1021]; +%! z = [1, pi, -3, eps(), realmax(), realmin()]; +%! assert (pow2 (f, e), z); + +## Tests for sparsity. +%!assert (pow2 (sparse (0), ones (3)), sparse (3, 3)); +%!assert (pow2 (sparse (1), ones (3)), 2 .* sparse (ones (3))); +%!assert (pow2 (sparse (1), speye (3)), sparse (ones (3) + eye (3))); +%!assert (pow2 (sparse (3, 3), ones (3)), sparse (3, 3)); +%!assert (pow2 (speye (3), ones (3)), 2 .* speye (3)); +%!assert (pow2 (speye (3), 1), 2 .* speye (3)); + +%!test +%! f = speye (3); +%! e = sparse (3, 3); +%! e(1,1) = 1; +%! e(1,3) = 1; +%! z = f; +%! z(1,1) = 2; +%! assert (pow2 (f, e), z); + +## Large sparse matrix (only few real elements). +%!test +%! ## FIXME: `N = 1e5` would be a better test, but `assert` fills-up somehow. +%! N = 1e3; +%! assert (pow2 (speye (N), sparse (N,N)), speye (N)); +%! assert (pow2 (sparse (0), speye (N)), sparse(N,N)); + +%!error pow2 () +%!error pow2 (1,2,3) +%!error pow2 (int8 (1)) +%!error pow2 (2, int8 (1)) +%!warning pow2 (i, 2); +%!warning pow2 (2, i); +%!error pow2 ([1,2], [3,4,5]) +%!error pow2 (sparse ([1,2]), sparse ([3,4,5])) +*/ + +OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/pr-flt-fmt.cc --- a/libinterp/corefcn/pr-flt-fmt.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/pr-flt-fmt.cc Sun Apr 03 11:30:26 2022 -0400 @@ -54,7 +54,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} output_precision () @deftypefnx {} {@var{old_val} =} output_precision (@var{new_val}) -@deftypefnx {} {} output_precision (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} output_precision (@var{new_val}, "local") Query or set the internal variable that specifies the minimum number of significant figures to display for numeric output. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/pr-output.cc Sun Apr 03 11:30:26 2022 -0400 @@ -300,7 +300,7 @@ pr_max_internal (const MArray& m) { // We expect a 2-d array. - assert (m.ndims () == 2); + error_unless (m.ndims () == 2); octave_idx_type nr = m.rows (); octave_idx_type nc = m.columns (); @@ -680,7 +680,7 @@ static inline float_display_format make_matrix_format (const MT& m) { - assert (m.ndims () == 2); + error_unless (m.ndims () == 2); if (free_format) return float_display_format (); @@ -1570,7 +1570,7 @@ print_empty_matrix (std::ostream& os, octave_idx_type nr, octave_idx_type nc, bool pr_as_read_syntax) { - assert (nr == 0 || nc == 0); + error_unless (nr == 0 || nc == 0); if (pr_as_read_syntax) { @@ -1592,7 +1592,7 @@ print_empty_nd_array (std::ostream& os, const dim_vector& dims, bool pr_as_read_syntax) { - assert (dims.any_zero ()); + error_unless (dims.any_zero ()); if (pr_as_read_syntax) os << "zeros (" << dims.str (',') << ')'; @@ -2558,7 +2558,8 @@ octave_idx_type col = 0; while (col < num_elem) { - octave_idx_type lim = (col + inc < num_elem ? col + inc : num_elem); + octave_idx_type lim = (col + inc < num_elem ? col + inc + : num_elem); pr_col_num_header (os, total_width, max_width, lim, col, extra_indent); @@ -2917,7 +2918,7 @@ } #define PRINT_INT_SCALAR_INTERNAL(TYPE) \ - OCTINTERP_API void \ + void \ octave_print_internal (std::ostream& os, \ const float_display_format& fmt, \ const octave_int& val, bool dummy) \ @@ -4059,7 +4060,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} fixed_point_format () @deftypefnx {} {@var{old_val} =} fixed_point_format (@var{new_val}) -@deftypefnx {} {} fixed_point_format (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} fixed_point_format (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will use a scaled format to print matrix values. @@ -4102,7 +4103,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} print_empty_dimensions () @deftypefnx {} {@var{old_val} =} print_empty_dimensions (@var{new_val}) -@deftypefnx {} {} print_empty_dimensions (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} print_empty_dimensions (@var{new_val}, "local") Query or set the internal variable that controls whether the dimensions of empty matrices are printed along with the empty matrix symbol, @samp{[]}. @@ -4133,7 +4134,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} split_long_rows () @deftypefnx {} {@var{old_val} =} split_long_rows (@var{new_val}) -@deftypefnx {} {} split_long_rows (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} split_long_rows (@var{new_val}, "local") Query or set the internal variable that controls whether rows of a matrix may be split when displayed to a terminal window. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/psi.cc --- a/libinterp/corefcn/psi.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/psi.cc Sun Apr 03 11:30:26 2022 -0400 @@ -179,7 +179,8 @@ ## Interesting identities of the digamma function, in section of 5.1.3 %!assert (psi (1/3), - em - (3/2) * log (3) - ((sqrt (3) / 6) * pi), eps*10) %!assert (psi (1/4), - em -3 * log (2) - pi/2, eps*10) -%!assert (psi (1/6), - em -2 * log (2) - (3/2) * log (3) - ((sqrt (3) / 2) * pi), eps*10) +%!assert (psi (1/6), +%! - em -2 * log (2) - (3/2) * log (3) - ((sqrt (3) / 2) * pi), eps*10) ## First 6 zeros of the digamma function, in section of 5.1.5 (and also on ## Abramowitz and Stegun, page 258, eq 6.3.19) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/qr.cc --- a/libinterp/corefcn/qr.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/qr.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1417,14 +1417,16 @@ %! [Q,R] = qrupdate (Q, R, single (u), single (v)); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R)-R), Inf) == 0); -%! assert (norm (vec (Q*R - single (A) - single (u)*single (v)'), Inf) < norm (single (A))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single (A) - single (u)*single (v)'), Inf) +%! < norm (single (A))*1e1*eps ("single")); %! %!test %! [Q,R] = qr (single (Ac)); %! [Q,R] = qrupdate (Q, R, single (uc), single (vc)); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R)-R), Inf) == 0); -%! assert (norm (vec (Q*R - single (Ac) - single (uc)*single (vc)'), Inf) < norm (single (Ac))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single (Ac) - single (uc)*single (vc)'), Inf) +%! < norm (single (Ac))*1e1*eps ("single")); */ DEFUN (qrinsert, args, , @@ -1599,13 +1601,15 @@ %! [Q,R] = qrinsert (Q, R, 3, single (u)); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - single ([A(:,1:2) u A(:,3)])), Inf) < norm (single (A))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single ([A(:,1:2) u A(:,3)])), Inf) +%! < norm (single (A))*1e1*eps ("single")); %!test %! [Q,R] = qr (single (Ac)); %! [Q,R] = qrinsert (Q, R, 3, single (uc)); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - single ([Ac(:,1:2) uc Ac(:,3)])), Inf) < norm (single (Ac))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single ([Ac(:,1:2) uc Ac(:,3)])), Inf) +%! < norm (single (Ac))*1e1*eps ("single")); %!test %! x = single ([0.85082 0.76426 0.42883 ]); %! @@ -1613,7 +1617,8 @@ %! [Q,R] = qrinsert (Q, R, 3, x, "row"); %! assert (norm (vec (Q'*Q - eye (6,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - single ([A(1:2,:);x;A(3:5,:)])), Inf) < norm (single (A))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single ([A(1:2,:);x;A(3:5,:)])), Inf) +%! < norm (single (A))*1e1*eps ("single")); %!test %! x = single ([0.20351 + 0.05401i 0.13141 + 0.43708i 0.29808 + 0.08789i ]); %! @@ -1621,7 +1626,8 @@ %! [Q,R] = qrinsert (Q, R, 3, x, "row"); %! assert (norm (vec (Q'*Q - eye (6,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - single ([Ac(1:2,:);x;Ac(3:5,:)])), Inf) < norm (single (Ac))*1e1*eps ("single")); +%! assert (norm (vec (Q*R - single ([Ac(1:2,:);x;Ac(3:5,:)])), Inf) +%! < norm (single (Ac))*1e1*eps ("single")); */ DEFUN (qrdelete, args, , @@ -1815,7 +1821,8 @@ %! [Q,R] = qrdelete (Q, R, 3); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - [AA(:,1:2) AA(:,4)]), Inf) < norm (AA)*1e1*eps ("single")); +%! assert (norm (vec (Q*R - [AA(:,1:2) AA(:,4)]), Inf) +%! < norm (AA)*1e1*eps ("single")); %! %!test %! AA = single ([0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; @@ -1828,8 +1835,9 @@ %! [Q,R] = qrdelete (Q, R, 3); %! assert (norm (vec (Q'*Q - eye (5,"single")), Inf) < 1e1*eps ("single")); %! assert (norm (vec (triu (R) - R), Inf) == 0); -%! assert (norm (vec (Q*R - [AA(:,1:2) AA(:,4)]), Inf) < norm (AA)*1e1*eps ("single")); -%! +%! assert (norm (vec (Q*R - [AA(:,1:2) AA(:,4)]), Inf) +%! < norm (AA)*1e1*eps ("single")); + %!test %! AA = single ([0.091364 0.613038 0.027504 0.999083; %! 0.594638 0.425302 0.562834 0.603537; @@ -1841,7 +1849,8 @@ %! [Q,R] = qrdelete (Q, R, 3, "row"); %! assert (norm (vec (Q'*Q - eye (4,"single")), Inf) < 1.5e1*eps ("single")); %! 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")); +%! 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 %! AA = single ([0.091364 0.613038 0.027504 0.999083; @@ -1854,7 +1863,8 @@ %! [Q,R] = qrdelete (Q, R, 3, "row"); %! assert (norm (vec (Q'*Q - eye (4,"single")), Inf) < 1e1*eps ("single")); %! 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")); +%! assert (norm (vec (Q*R - [AA(1:2,:);AA(4:5,:)]), Inf) +%! < norm (AA)*1e1*eps ("single")); %! %!test %! AA = single ([0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; @@ -1867,7 +1877,8 @@ %! [Q,R] = qrdelete (Q, R, 3, "row"); %! assert (norm (vec (Q'*Q - eye (4,"single")), Inf) < 1e1*eps ("single")); %! 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")); +%! assert (norm (vec (Q*R - [AA(1:2,:);AA(4:5,:)]), Inf) +%! < norm (AA)*1e1*eps ("single")); */ DEFUN (qrshift, args, , diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/rand.cc Sun Apr 03 11:30:26 2022 -0400 @@ -796,7 +796,7 @@ /* %!test %! randg ("state", 12); -%! assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]); # *** Please report +%! assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]); %!test %! ## Test a known fixed state @@ -901,7 +901,7 @@ %! endif %!test %! randg ("seed", 12); -%!assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]) # *** Please report +%! assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]); %!test %! if (__random_statistical_tests__) %! ## statistical tests may fail occasionally. @@ -1021,7 +1021,7 @@ /* %!test %! randp ("state", 12); -%! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); # *** Please report +%! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); %!test %! ## Test a known fixed state %! randp ("state", 1); @@ -1033,7 +1033,9 @@ %!test %! ## Test a known fixed state %! randp ("state", 1); -%! assert (randp (1e9, 1, 6), [999915677 999976657 1000047684 1000019035 999985749 999977692], -1e-6); +%! assert (randp (1e9, 1, 6), +%! [999915677 999976657 1000047684 1000019035 999985749 999977692], +%! -1e-6); %!test %! ## Test a known fixed seed %! randp ("seed", 1); @@ -1046,7 +1048,9 @@ %!test %! ## Test a known fixed seed %! randp ("seed", 1); -%! assert (randp (1e9, 1, 6), [1000006208 1000012224 999981120 999963520 999963072 999981440], -1e-6); +%! assert (randp (1e9, 1, 6), +%! [1000006208 1000012224 999981120 999963520 999963072 999981440], +%! -1e-6); %!test %! if (__random_statistical_tests__) %! ## statistical tests may fail occasionally. @@ -1075,7 +1079,7 @@ %! endif %!test %! randp ("seed", 12); -%! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); # *** Please report +%! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); %!test %! if (__random_statistical_tests__) %! ## statistical tests may fail occasionally. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/regexp.cc --- a/libinterp/corefcn/regexp.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/regexp.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1127,8 +1127,10 @@ %! assert (isempty (fieldnames (nm))); %! assert (sp, { "", "", "A", "", "E", "" }); -%!assert (regexp ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, '-'), {6;[1,5,9];zeros(1,0)}) -%!assert (regexp ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, {'-';'f';'q'}), {6;[3,7];[1,9]}) +%!assert (regexp ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, '-'), +%! {6;[1,5,9];zeros(1,0)}) +%!assert (regexp ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, {'-';'f';'q'}), +%! {6;[3,7];[1,9]}) %!assert (regexp ('Strings', {'t','s'}), {2, 7}) ## Test case for lookaround operators @@ -1351,9 +1353,12 @@ %!error regexpi ('string', 'tri', 'BadArg') %!error regexpi ('string') -%!assert (regexpi ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, '-'), {6;[1,5,9];zeros(1, 0)}) -%!assert (regexpi ({'asdfg-dfd', '-dfd-dfd-', 'qasfdfdaq'}, '-'), {6, [1,5,9], zeros(1,0)}) -%!assert (regexpi ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, {'-';'f';'q'}), {6;[3,7];[1,9]}) +%!assert (regexpi ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, '-'), +%! {6;[1,5,9];zeros(1, 0)}) +%!assert (regexpi ({'asdfg-dfd', '-dfd-dfd-', 'qasfdfdaq'}, '-'), +%! {6, [1,5,9], zeros(1,0)}) +%!assert (regexpi ({'asdfg-dfd';'-dfd-dfd-';'qasfdfdaq'}, {'-';'f';'q'}), +%! {6;[3,7];[1,9]}) %!assert (regexpi ('Strings', {'t', 's'}), {2, [1, 7]}) %!assert (regexpi ("\n", '\n'), 1) @@ -1588,7 +1593,8 @@ ## Empty matches were broken on ARM architecture %!test <*52810> -%! assert (strcmp (regexprep ("\nabc", "^(\t*)(abc)$", "$1$2", "lineanchors"), "\nabc")) +%! assert (strcmp (regexprep ("\nabc", "^(\t*)(abc)$", "$1$2", "lineanchors"), +%! "\nabc")); */ OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/schur.cc --- a/libinterp/corefcn/schur.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/schur.cc Sun Apr 03 11:30:26 2022 -0400 @@ -46,7 +46,7 @@ octave_value retval = a; octave_idx_type n = a.rows (); - assert (a.columns () == n); + error_unless (a.columns () == n); const typename Matrix::element_type zero = typename Matrix::element_type (); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sighandlers.cc --- a/libinterp/corefcn/sighandlers.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sighandlers.cc Sun Apr 03 11:30:26 2022 -0400 @@ -517,7 +517,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} debug_on_interrupt () @deftypefnx {} {@var{old_val} =} debug_on_interrupt (@var{new_val}) -@deftypefnx {} {} debug_on_interrupt (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} debug_on_interrupt (@var{new_val}, "local") Query or set the internal variable that controls whether Octave will try to enter debugging mode when it receives an interrupt signal (typically generated with @kbd{C-c}). @@ -551,7 +551,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} sighup_dumps_octave_core () @deftypefnx {} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val}) -@deftypefnx {} {} sighup_dumps_octave_core (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val}, "local") Query or set the internal variable that controls whether Octave tries to save all current variables to the file @file{octave-workspace} if it receives a hangup signal. @@ -582,7 +582,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} sigquit_dumps_octave_core () @deftypefnx {} {@var{old_val} =} sigquit_dumps_octave_core (@var{new_val}) -@deftypefnx {} {} sigquit_dumps_octave_core (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} sigquit_dumps_octave_core (@var{new_val}, "local") Query or set the internal variable that controls whether Octave tries to save all current variables to the file @file{octave-workspace} if it receives a quit signal. @@ -613,7 +613,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} sigterm_dumps_octave_core () @deftypefnx {} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val}) -@deftypefnx {} {} sigterm_dumps_octave_core (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val}, "local") Query or set the internal variable that controls whether Octave tries to save all current variables to the file @file{octave-workspace} if it receives a terminate signal. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sparse-xdiv.h --- a/libinterp/corefcn/sparse-xdiv.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sparse-xdiv.h Sun Apr 03 11:30:26 2022 -0400 @@ -157,7 +157,8 @@ OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead") inline SparseComplexMatrix -xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ) +xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, + MatrixType& typ) { return octave::xdiv (a, b, typ); } @@ -269,7 +270,8 @@ OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline SparseComplexMatrix -xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ) +xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, + MatrixType& typ) { return octave::xleftdiv (a, b, typ); } @@ -297,7 +299,8 @@ OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline SparseComplexMatrix -xleftdiv (const ComplexDiagMatrix& a, const SparseComplexMatrix& b, MatrixType& typ) +xleftdiv (const ComplexDiagMatrix& a, const SparseComplexMatrix& b, + MatrixType& typ) { return octave::xleftdiv (a, b, typ); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sparse.cc --- a/libinterp/corefcn/sparse.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sparse.cc Sun Apr 03 11:30:26 2022 -0400 @@ -46,7 +46,7 @@ DEFUN (issparse, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} issparse (@var{x}) +@deftypefn {} {@var{tf} =} issparse (@var{x}) Return true if @var{x} is a sparse matrix. @seealso{ismatrix} @end deftypefn */) @@ -155,9 +155,6 @@ octave_value retval; - // Temporarily disable sparse_auto_mutate if set (it's obsolete anyway). - unwind_protect_var restore_var (Vsparse_auto_mutate, false); - if (nargin == 1) { octave_value arg = args(0); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/stack-frame.cc --- a/libinterp/corefcn/stack-frame.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/stack-frame.cc Sun Apr 03 11:30:26 2022 -0400 @@ -31,6 +31,7 @@ #include "str-vec.h" #include "defun.h" +#include "error.h" #include "interpreter.h" #include "interpreter-private.h" #include "oct-map.h" @@ -1041,7 +1042,8 @@ const std::shared_ptr& parent_link, const std::shared_ptr& static_link) { - return new compiled_fcn_stack_frame (tw, fcn, index, parent_link, static_link); + return new compiled_fcn_stack_frame (tw, fcn, index, + parent_link, static_link); } stack_frame * stack_frame::create (tree_evaluator& tw, @@ -1059,7 +1061,8 @@ const std::shared_ptr& static_link, const std::shared_ptr& access_link) { - return new user_fcn_stack_frame (tw, fcn, index, parent_link, static_link, access_link); + return new user_fcn_stack_frame (tw, fcn, index, + parent_link, static_link, access_link); } stack_frame * stack_frame::create (tree_evaluator& tw, @@ -1069,7 +1072,9 @@ const local_vars_map& local_vars, const std::shared_ptr& access_link) { - return new user_fcn_stack_frame (tw, fcn, index, parent_link, static_link, local_vars, access_link); + return new user_fcn_stack_frame (tw, fcn, index, + parent_link, static_link, local_vars, + access_link); } stack_frame * stack_frame::create (tree_evaluator& tw, @@ -1599,7 +1604,7 @@ // scope. If the symbol wasn't present before, it should be outside // the range so we need to resize then update offsets. - assert (data_offset >= size ()); + panic_unless (data_offset >= size ()); resize (data_offset+1); @@ -1650,7 +1655,7 @@ if (sym) { - assert (sym.frame_offset () == 0); + panic_unless (sym.frame_offset () == 0); return sym; } @@ -1679,7 +1684,7 @@ // All symbol records in a script scope should have zero offset, // which means we redirect our lookup using // lexical_frame_offsets and values_offets. - assert (sym.frame_offset () == 0); + panic_unless (sym.frame_offset () == 0); return sym; } @@ -1689,7 +1694,7 @@ sym = scope.find_symbol (name); - assert (sym); + panic_unless (sym.is_valid ()); resize_and_update_script_offsets (sym); @@ -2100,7 +2105,7 @@ { // FIXME: do we need to ensure that the called // function is a child of the caller? Does it hurt - // to assert this condition, at least for now? + // to panic_unless this condition, at least for now? alink = static_link; } @@ -2108,7 +2113,7 @@ { // FIXME: do we need to check that the parent of the // called function is also a parent of the caller? - // Does it hurt to assert this condition, at least + // Does it hurt to panic_unless this condition, at least // for now? int links_to_follow = caller_nesting_depth - nesting_depth + 1; @@ -2221,7 +2226,7 @@ sym = scope.find_symbol (name); - assert (sym); + panic_unless (sym.is_valid ()); return sym; } @@ -2388,7 +2393,7 @@ sym = m_scope.find_symbol (name); - assert (sym); + panic_unless (sym.is_valid ()); return sym; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/strfind.cc --- a/libinterp/corefcn/strfind.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/strfind.cc Sun Apr 03 11:30:26 2022 -0400 @@ -299,8 +299,10 @@ %!assert (strfind ("abababa", "aba", "forcecelloutput", false), [1, 3, 5]) %!assert (strfind ("abababa", "aba", "forcecelloutput", true), {[1, 3, 5]}) %!assert (strfind ({"abababa", "bla", "bla"}, "a"), {[1, 3, 5, 7], 3, 3}) -%!assert (strfind ({"abababa", "bla", "bla"}, "a", "forcecelloutput", false), {[1, 3, 5, 7], 3, 3}) -%!assert (strfind ({"abababa", "bla", "bla"}, "a", "forcecelloutput", true), {[1, 3, 5, 7], 3, 3}) +%!assert (strfind ({"abababa", "bla", "bla"}, "a", "forcecelloutput", false), +%! {[1, 3, 5, 7], 3, 3}) +%!assert (strfind ({"abababa", "bla", "bla"}, "a", "forcecelloutput", true), +%! {[1, 3, 5, 7], 3, 3}) %!assert (strfind ("Linux _is_ user-friendly. It just isn't ignorant-friendly or idiot-friendly.", "friendly"), [17, 50, 68]) %!assert (strfind ("abc", ""), []) %!assert (strfind ("abc", {"", "b", ""}), {[], 2, []}) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/strfns.cc --- a/libinterp/corefcn/strfns.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/strfns.cc Sun Apr 03 11:30:26 2022 -0400 @@ -290,7 +290,7 @@ DEFUN (ischar, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} ischar (@var{x}) +@deftypefn {} {@var{tf} =} ischar (@var{x}) Return true if @var{x} is a character array. @seealso{isfloat, isinteger, islogical, isnumeric, isstring, iscellstr, isa} @end deftypefn */) @@ -665,7 +665,8 @@ %!assert (strncmp ("abce", {"abcd", "bca", "abc"}, 3), logical ([1, 0, 1])) %!assert (strncmp ("abc", {"abcd", "bca", "abc"}, 4), logical ([0, 0, 1])) %!assert (strncmp ({"abcd", "bca", "abc"},"abce", 3), logical ([1, 0, 1])) -%!assert (strncmp ({"abcd", "bca", "abc"},{"abcd", "bca", "abe"}, 3), logical ([1, 1, 0])) +%!assert (strncmp ({"abcd", "bca", "abc"},{"abcd", "bca", "abe"}, 3), +%! logical ([1, 1, 0])) %!assert (strncmp ("abc", {"abcd", 10}, 2), logical ([1, 0])) %!assert <*54373> (strncmp ("abc", "abc", 100)) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sub2ind.cc --- a/libinterp/corefcn/sub2ind.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sub2ind.cc Sun Apr 03 11:30:26 2022 -0400 @@ -195,7 +195,7 @@ The input @var{dims} is a dimension vector where each element is the size of the array in the respective dimension (@pxref{XREFsize,,@code{size}}). The -second input @var{ind} contains linear indies to be converted. +second input @var{ind} contains linear indices to be converted. The outputs @var{s1}, @dots{}, @var{sN} contain the converted subscripts. @@ -220,12 +220,8 @@ The left matrix contains the linear indices for each matrix element. The right matrix shows the subscript tuples for the same matrix. -The following example shows how to convert the two-dimensional indices -@code{(2,1)} and @code{(2,3)} of a 3-by-3 matrix to linear indices with a -single call to @code{sub2ind}. - The following example shows how to convert the linear indices @code{2} and -@code{8} in a 3-by-3 matrix into subscripts. +@code{8} to appropriate subscripts of a 3-by-3 matrix. @example @group diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/svd.cc --- a/libinterp/corefcn/svd.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/svd.cc Sun Apr 03 11:30:26 2022 -0400 @@ -400,7 +400,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} svd_driver () @deftypefnx {} {@var{old_val} =} svd_driver (@var{new_val}) -@deftypefnx {} {} svd_driver (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} svd_driver (@var{new_val}, "local") Query or set the underlying @sc{lapack} driver used by @code{svd}. Currently recognized values are @qcode{"gesdd"}, @qcode{"gesvd"}, and diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sylvester.cc --- a/libinterp/corefcn/sylvester.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sylvester.cc Sun Apr 03 11:30:26 2022 -0400 @@ -158,8 +158,10 @@ } /* -%!assert (sylvester ([1, 2; 3, 4], [5, 6; 7, 8], [9, 10; 11, 12]), [1/2, 2/3; 2/3, 1/2], sqrt (eps)) -%!assert (sylvester (single ([1, 2; 3, 4]), single ([5, 6; 7, 8]), single ([9, 10; 11, 12])), single ([1/2, 2/3; 2/3, 1/2]), sqrt (eps ("single"))) +%!assert (sylvester ([1, 2; 3, 4], [5, 6; 7, 8], [9, 10; 11, 12]), +%! [1/2, 2/3; 2/3, 1/2], sqrt (eps)) +%!assert (sylvester (single ([1, 2; 3, 4]), single ([5, 6; 7, 8]), single ([9, 10; 11, 12])), +%! single ([1/2, 2/3; 2/3, 1/2]), sqrt (eps ("single"))) ## Test input validation %!error sylvester () diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/symbfact.cc --- a/libinterp/corefcn/symbfact.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/symbfact.cc Sun Apr 03 11:30:26 2022 -0400 @@ -427,7 +427,8 @@ %! fail ("symbfact (sparse (1), {1})", "TYP must be a string"); %! fail ("symbfact (sparse (1), 'foobar')", 'unrecognized TYP "foobar"'); %! fail ("symbfact (sparse (1), 'sym', {'L'})", "MODE must be a string"); -%! fail ('symbfact (sparse (1), "sym", "foobar")', 'unrecognized MODE "foobar"'); +%! fail ('symbfact (sparse (1), "sym", "foobar")', +%! 'unrecognized MODE "foobar"'); %! fail ("symbfact (sparse ([1, 2; 3, 4; 5, 6]))", "S must be a square matrix"); */ diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/symrec.h --- a/libinterp/corefcn/symrec.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/symrec.h Sun Apr 03 11:30:26 2022 -0400 @@ -194,11 +194,13 @@ explicit operator bool () const { return is_valid (); } - void set_frame_offset (std::size_t offset) { m_rep->set_frame_offset (offset); } + void set_frame_offset (std::size_t offset) + { m_rep->set_frame_offset (offset); } std::size_t frame_offset (void) const { return m_rep->frame_offset (); } - void set_data_offset (std::size_t offset) { m_rep->set_data_offset (offset); } + void set_data_offset (std::size_t offset) + { m_rep->set_data_offset (offset); } std::size_t data_offset (void) const { return m_rep->data_offset (); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/symscope.cc --- a/libinterp/corefcn/symscope.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/symscope.cc Sun Apr 03 11:30:26 2022 -0400 @@ -335,7 +335,8 @@ } bool symbol_scope_rep::look_nonlocal (const std::string& name, - std::size_t offset, symbol_record& result) + std::size_t offset, + symbol_record& result) { offset++; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/symtab.cc --- a/libinterp/corefcn/symtab.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/symtab.cc Sun Apr 03 11:30:26 2022 -0400 @@ -722,98 +722,6 @@ return octave_value (info_map); } - // Remove when corresponding public deprecated function is removed. - bool symbol_table::at_top_level_deprecated (void) - { - return m_interpreter.at_top_level (); - } - - // Remove when corresponding public deprecated function is removed. - octave_value symbol_table::varval_deprecated (const std::string& name) const - { - return m_interpreter.varval (name); - } - - // Remove when corresponding public deprecated function is removed. - octave_value symbol_table::global_varval_deprecated (const std::string& name) const - { - return m_interpreter.global_varval (name); - } - - // Remove when corresponding public deprecated function is removed. - octave_value symbol_table::top_level_varval_deprecated (const std::string& name) const - { - return m_interpreter.top_level_varval (name); - } - - // Remove when corresponding public deprecated function is removed. - std::list symbol_table::global_variable_names_deprecated (void) - { - return m_interpreter.global_variable_names (); - } - - // Remove when corresponding public deprecated function is removed. - std::list symbol_table::top_level_variable_names_deprecated (void) - { - return m_interpreter.top_level_variable_names (); - } - - // Remove when corresponding public deprecated function is removed. - std::list symbol_table::variable_names_deprecated (void) - { - return m_interpreter.variable_names (); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::assign_deprecated (const std::string& name, const octave_value& value) - { - return m_interpreter.assign (name, value); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::clear_all_deprecated (bool force) - { - return m_interpreter.clear_all (force); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::clear_global_deprecated (const std::string& name) - { - return m_interpreter.clear_global_variable (name); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::clear_global_pattern_deprecated (const std::string& pattern) - { - return m_interpreter.clear_global_variable_pattern (pattern); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::clear_symbol_deprecated (const std::string& name) - { - return m_interpreter.clear_symbol (name); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::clear_symbol_pattern_deprecated (const std::string& pattern) - { - return m_interpreter.clear_symbol_pattern (pattern); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::global_assign_deprecated (const std::string& name, - const octave_value& value) - { - return m_interpreter.global_assign (name, value); - } - - // Remove when corresponding public deprecated function is removed. - void symbol_table::top_level_assign_deprecated (const std::string& name, - const octave_value& value) - { - return m_interpreter.top_level_assign (name, value); - } - DEFMETHOD (__dump_symtab_info__, interp, args, , doc: /* -*- texinfo -*- @deftypefn {} {} __dump_symtab_info__ () diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/symtab.h --- a/libinterp/corefcn/symtab.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/symtab.h Sun Apr 03 11:30:26 2022 -0400 @@ -185,170 +185,6 @@ fcn_info * get_fcn_info (const std::string& name); - // The remaining functions are all provided for backward - // compatibility. New code should use the functions provided by the - // interpreter class. - - private: - - // Remove when corresponding public deprecated function is removed. - bool at_top_level_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - octave_value varval_deprecated (const std::string& name) const; - - // Remove when corresponding public deprecated function is removed. - octave_value global_varval_deprecated (const std::string& name) const; - - // Remove when corresponding public deprecated function is removed. - octave_value top_level_varval_deprecated (const std::string& name) const; - - // Remove when corresponding public deprecated function is removed. - std::list global_variable_names_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - std::list top_level_variable_names_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - std::list variable_names_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - void assign_deprecated (const std::string& name, - const octave_value& value = octave_value ()); - - // Remove when corresponding public deprecated function is removed. - // Note, FORCE_ADD no longer has any meaning. - void assign_deprecated (const std::string& name, const octave_value& value, - bool /*force_add*/); - - // Remove when corresponding public deprecated function is removed. - void clear_all_deprecated (bool force = false); - - // Remove when corresponding public deprecated function is removed. - void clear_global_deprecated (const std::string& name); - - // Remove when corresponding public deprecated function is removed. - void clear_global_pattern_deprecated (const std::string& pattern); - - // Remove when corresponding public deprecated function is removed. - void clear_symbol_deprecated (const std::string& name); - - // Remove when corresponding public deprecated function is removed. - void clear_symbol_pattern_deprecated (const std::string& pattern); - - // Remove when corresponding public deprecated function is removed. - void global_assign_deprecated (const std::string& name, - const octave_value& value = octave_value ()); - - // Remove when corresponding public deprecated function is removed. - void top_level_assign_deprecated (const std::string& name, - const octave_value& value = octave_value ()); - - public: - -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) - OCTAVE_DEPRECATED (6, "use 'interpreter::at_top_level' instead") - bool at_top_level (void) - { - return at_top_level_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::varval' instead") - octave_value varval (const std::string& name) const - { - return varval_deprecated (name); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::global_varval' instead") - octave_value global_varval (const std::string& name) const - { - return global_varval_deprecated (name); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_varval' instead") - octave_value top_level_varval (const std::string& name) const - { - return top_level_varval_deprecated (name); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::global_variable_names' instead") - std::list global_variable_names (void) - { - return global_variable_names_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_variable_names' instead") - std::list top_level_variable_names (void) - { - return top_level_variable_names_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::variable_names' instead") - std::list variable_names (void) - { - return variable_names_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::assign' instead") - void assign (const std::string& name, - const octave_value& value = octave_value ()) - { - assign_deprecated (name, value); - } - - // Note, FORCE_ADD no longer has any meaning. - OCTAVE_DEPRECATED (6, "use 'interpreter::assign' instead") - void assign (const std::string& name, const octave_value& value, - bool /*force_add*/) - { - assign_deprecated (name, value); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::clear_all' instead") - void clear_all (bool force = false) - { - clear_all_deprecated (force); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::clear_global' instead") - void clear_global (const std::string& name) - { - clear_global_deprecated (name); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::clear_global_pattern' instead") - void clear_global_pattern (const std::string& pattern) - { - clear_global_pattern_deprecated (pattern); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::clear_symbol' instead") - void clear_symbol (const std::string& name) - { - clear_symbol_deprecated (name); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::clear_symbol_pattern' instead") - void clear_symbol_pattern (const std::string& pattern) - { - clear_symbol_pattern_deprecated (pattern); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::global_assign' instead") - void global_assign (const std::string& name, - const octave_value& value = octave_value ()) - { - global_assign_deprecated (name, value); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_assign' instead") - void top_level_assign (const std::string& name, - const octave_value& value = octave_value ()) - { - top_level_assign_deprecated (name, value); - } -#endif - private: interpreter& m_interpreter; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/sysdep.cc --- a/libinterp/corefcn/sysdep.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/sysdep.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1362,7 +1362,7 @@ DEFUN (isieee, , , doc: /* -*- texinfo -*- -@deftypefn {} {} isieee () +@deftypefn {} {@var{tf} =} isieee () Return true if your computer @emph{claims} to conform to the IEEE standard for floating point calculations. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/toplev.cc --- a/libinterp/corefcn/toplev.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/toplev.cc Sun Apr 03 11:30:26 2022 -0400 @@ -54,7 +54,6 @@ #include "defaults.h" #include "defun.h" #include "error.h" -#include "file-io.h" #include "help.h" #include "interpreter-private.h" #include "octave.h" diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/typecast.cc --- a/libinterp/corefcn/typecast.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/typecast.cc Sun Apr 03 11:30:26 2022 -0400 @@ -206,8 +206,6 @@ else if (array.is_uint64_type ()) get_data_and_bytesize (array.uint64_array_value (), data, byte_size, old_dims, frame); - else - assert (0); } else if (array.iscomplex ()) { @@ -239,8 +237,8 @@ ; else if (numclass == "char") retval = octave_value (reinterpret_copy - (data, byte_size, old_dims), array.is_dq_string () ? '"' - : '\''); + (data, byte_size, old_dims), + array.is_dq_string () ? '"' : '\''); else if (numclass[0] == 'i') { if (numclass == "int8") @@ -548,8 +546,6 @@ retval = do_bitunpack (array.uint32_array_value ()); else if (array.is_uint64_type ()) retval = do_bitunpack (array.uint64_array_value ()); - else - assert (0); } else if (array.iscomplex ()) { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/utils.cc --- a/libinterp/corefcn/utils.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/utils.cc Sun Apr 03 11:30:26 2022 -0400 @@ -48,6 +48,7 @@ #include "pathsearch.h" #include "quit.h" #include "str-vec.h" +#include "strcase-wrappers.h" #include "vasprintf-wrapper.h" #include "Cell.h" @@ -93,7 +94,7 @@ DEFUN (isvarname, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isvarname (@var{name}) +@deftypefn {} {@var{tf} =} isvarname (@var{name}) Return true if @var{name} is a valid variable name. A valid variable name is composed of letters, digits, and underscores ("_"), @@ -1099,7 +1100,7 @@ DEFUN (is_absolute_filename, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} is_absolute_filename (@var{file}) +@deftypefn {} {@var{tf} =} is_absolute_filename (@var{file}) Return true if @var{file} is an absolute filename. @seealso{is_rooted_relative_filename, make_absolute_filename, isfolder} @end deftypefn */) @@ -1120,7 +1121,7 @@ DEFUN (is_rooted_relative_filename, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} is_rooted_relative_filename (@var{file}) +@deftypefn {} {@var{tf} =} is_rooted_relative_filename (@var{file}) Return true if @var{file} is a rooted-relative filename. @seealso{is_absolute_filename, make_absolute_filename, isfolder} @end deftypefn */) @@ -1491,33 +1492,6 @@ return s.length (); } - std::size_t format (std::ostream& os, const std::string& enc, const char *fmt, ...) - { - std::size_t retval; - - va_list args; - va_start (args, fmt); - - retval = vformat (os, enc, fmt, args); - - va_end (args); - - return retval; - } - - std::size_t vformat (std::ostream& os, const std::string& enc, const char *fmt, - va_list args) - { - std::string s = vasprintf (fmt, args); - - if (enc.compare ("utf-8")) - os << string::u8_to_encoding ("printf", s, enc); - else - os << s; - - return s.length (); - } - std::string vasprintf (const char *fmt, va_list args) { std::string retval; @@ -1628,8 +1602,8 @@ DEFMETHOD (isindex, interp, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isindex (@var{ind}) -@deftypefnx {} {} isindex (@var{ind}, @var{n}) +@deftypefn {} {@var{tf} =} isindex (@var{ind}) +@deftypefnx {} {@var{tf} =} isindex (@var{ind}, @var{n}) Return true if @var{ind} is a valid index. Valid indices are either positive integers (although possibly of real data @@ -1768,7 +1742,7 @@ DEFUN (isstudent, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isstudent () +@deftypefn {} {@var{tf} =} isstudent () Return true if running in the student edition of @sc{matlab}. @code{isstudent} always returns false in Octave. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/utils.h --- a/libinterp/corefcn/utils.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/utils.h Sun Apr 03 11:30:26 2022 -0400 @@ -169,15 +169,8 @@ format (std::ostream& os, const char *fmt, ...); extern OCTINTERP_API std::size_t - format (std::ostream& os, const std::string& enc, const char *fmt, ...); - - extern OCTINTERP_API std::size_t vformat (std::ostream& os, const char *fmt, va_list args); - extern OCTINTERP_API std::size_t - vformat (std::ostream& os, const std::string& enc, - const char *fmt, va_list args); - extern OCTINTERP_API std::string vasprintf (const char *fmt, va_list args); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/variables.cc --- a/libinterp/corefcn/variables.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/variables.cc Sun Apr 03 11:30:26 2022 -0400 @@ -124,7 +124,7 @@ DEFMETHOD (isglobal, interp, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isglobal (@var{name}) +@deftypefn {} {@var{tf} =} isglobal (@var{name}) Return true if @var{name} is a globally visible variable. For example: @@ -772,7 +772,7 @@ int nargin = args.length (); - assert (var < nchoices); + error_unless (var < nchoices); if (nargout > 0 || nargin == 0) retval = choices[var]; @@ -1395,7 +1395,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} missing_function_hook () @deftypefnx {} {@var{old_val} =} missing_function_hook (@var{new_val}) -@deftypefnx {} {} missing_function_hook (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} missing_function_hook (@var{new_val}, "local") Query or set the internal variable that specifies the function to call to provide extra information when an unknown identifier is referenced. @@ -1496,7 +1496,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} missing_component_hook () @deftypefnx {} {@var{old_val} =} missing_component_hook (@var{new_val}) -@deftypefnx {} {} missing_component_hook (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} missing_component_hook (@var{new_val}, "local") Query or set the internal variable that specifies the function to call when a component of Octave is missing. @@ -1525,45 +1525,3 @@ } OCTAVE_NAMESPACE_END - -// DEPRECATED in Octave 6 - -octave_function * -extract_function (const octave_value& arg, const std::string& warn_for, - const std::string& fname, const std::string& header, - const std::string& trailer) -{ - octave_function *retval = is_valid_function (arg, warn_for, 0); - - if (! retval) - { - std::string s = arg.xstring_value ("%s: argument must be a string", - warn_for.c_str ()); - - std::string cmd = header; - cmd.append (s); - cmd.append (trailer); - - int parse_status; - - octave::interpreter& interp - = octave::__get_interpreter__ ("extract_function"); - - interp.eval_string (cmd, true, parse_status, 0); - - if (parse_status != 0) - error ("%s: '%s' is not valid as a function", - warn_for.c_str (), fname.c_str ()); - - retval = is_valid_function (fname, warn_for, 0); - - if (! retval) - error ("%s: '%s' is not valid as a function", - warn_for.c_str (), fname.c_str ()); - - warning ("%s: passing function body as a string is obsolete; please use anonymous functions", - warn_for.c_str ()); - } - - return retval; -} diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/variables.h --- a/libinterp/corefcn/variables.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/variables.h Sun Apr 03 11:30:26 2022 -0400 @@ -124,29 +124,34 @@ OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (bool& var, const octave_value_list& args, int nargout, const char *nm) +set_internal_variable (bool& var, const octave_value_list& args, int nargout, + const char *nm) { return octave::set_internal_variable (var, args, nargout, nm); } OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (char& var, const octave_value_list& args, int nargout, const char *nm) +set_internal_variable (char& var, const octave_value_list& args, int nargout, + const char *nm) { return octave::set_internal_variable (var, args, nargout, nm); } OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (int& var, const octave_value_list& args, int nargout, const char *nm, - int minval = std::numeric_limits::min (), int maxval = std::numeric_limits::max ()) +set_internal_variable (int& var, const octave_value_list& args, int nargout, + const char *nm, + int minval = std::numeric_limits::min (), + int maxval = std::numeric_limits::max ()) { return octave::set_internal_variable (var, args, nargout, nm, minval, maxval); } OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (double& var, const octave_value_list& args, int nargout, const char *nm, +set_internal_variable (double& var, const octave_value_list& args, int nargout, + const char *nm, double minval = -octave::numeric_limits::Inf (), double maxval = octave::numeric_limits::Inf ()) { @@ -155,24 +160,24 @@ OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (std::string& var, const octave_value_list& args, int nargout, const char *nm, - bool empty_ok = true) +set_internal_variable (std::string& var, const octave_value_list& args, + int nargout, const char *nm, bool empty_ok = true) { return octave::set_internal_variable (var, args, nargout, nm, empty_ok); } OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (std::string& var, const octave_value_list& args, int nargout, const char *nm, - const char **choices) +set_internal_variable (std::string& var, const octave_value_list& args, + int nargout, const char *nm, const char **choices) { return octave::set_internal_variable (var, args, nargout, nm, choices); } OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead") inline octave_value -set_internal_variable (int& var, const octave_value_list& args, int nargout, const char *nm, - const char **choices) +set_internal_variable (int& var, const octave_value_list& args, int nargout, + const char *nm, const char **choices) { return octave::set_internal_variable (var, args, nargout, nm, choices); } @@ -184,12 +189,6 @@ return octave::maybe_missing_function_hook (name); } -OCTAVE_DEPRECATED (6, "use 'octave::get_function_handle' instead") -extern OCTINTERP_API octave_function * -extract_function (const octave_value& arg, const std::string& warn_for, - const std::string& fname, const std::string& header, - const std::string& trailer); - #endif // The following macros should also be considered obsolete. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/xdiv.h --- a/libinterp/corefcn/xdiv.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/xdiv.h Sun Apr 03 11:30:26 2022 -0400 @@ -77,7 +77,8 @@ extern FloatMatrix elem_xdiv (float a, const FloatMatrix& b); extern FloatComplexMatrix elem_xdiv (float a, const FloatComplexMatrix& b); -extern FloatComplexMatrix elem_xdiv (const FloatComplex a, const FloatMatrix& b); +extern FloatComplexMatrix elem_xdiv (const FloatComplex a, + const FloatMatrix& b); extern FloatComplexMatrix elem_xdiv (const FloatComplex a, const FloatComplexMatrix& b); @@ -243,31 +244,32 @@ OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline Matrix -xleftdiv (const Matrix& a, const Matrix& b, MatrixType& typ, blas_trans_type transt = blas_no_trans) +xleftdiv (const Matrix& a, const Matrix& b, + MatrixType& typ, blas_trans_type transt = blas_no_trans) { return octave::xleftdiv (a, b, typ, transt); } OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline ComplexMatrix -xleftdiv (const Matrix& a, const ComplexMatrix& b, MatrixType& typ, - blas_trans_type transt = blas_no_trans) +xleftdiv (const Matrix& a, const ComplexMatrix& b, + MatrixType& typ, blas_trans_type transt = blas_no_trans) { return octave::xleftdiv (a, b, typ, transt); } OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline ComplexMatrix -xleftdiv (const ComplexMatrix& a, const Matrix& b, MatrixType& typ, - blas_trans_type transt = blas_no_trans) +xleftdiv (const ComplexMatrix& a, const Matrix& b, + MatrixType& typ, blas_trans_type transt = blas_no_trans) { return octave::xleftdiv (a, b, typ, transt); } OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead") inline ComplexMatrix -xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ, - blas_trans_type transt = blas_no_trans) +xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b, + MatrixType& typ, blas_trans_type transt = blas_no_trans) { return octave::xleftdiv (a, b, typ, transt); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/corefcn/xpow.h --- a/libinterp/corefcn/xpow.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/xpow.h Sun Apr 03 11:30:26 2022 -0400 @@ -77,7 +77,8 @@ extern OCTINTERP_API octave_value elem_xpow (double a, const Matrix& b); extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexMatrix& b); -extern OCTINTERP_API octave_value elem_xpow (double a, const octave::range& r); +extern OCTINTERP_API octave_value elem_xpow (double a, + const octave::range& r); extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, double b); extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Matrix& b); @@ -88,7 +89,8 @@ extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Matrix& b); extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const ComplexMatrix& b); -extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const octave::range& r); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, + const octave::range& r); extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, double b); extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, diff -r 0a1aec50a0c8 -r 960909469245 libinterp/dldfcn/__init_fltk__.cc --- a/libinterp/dldfcn/__init_fltk__.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/dldfcn/__init_fltk__.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1340,7 +1340,8 @@ return 0; } - octave_scalar_map format_key_event (int e_key, const char *e_text, int e_state) + octave_scalar_map format_key_event (int e_key, const char *e_text, + int e_state) { octave_scalar_map evt; @@ -1798,7 +1799,8 @@ case FL_RELEASE: if (! m_fp.get_windowbuttonupfcn ().isempty ()) { - set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ()); + set_currentpoint (Fl::event_x (), + Fl::event_y () - menu_dy ()); m_fp.execute_windowbuttonupfcn (); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/dldfcn/__ode15__.cc --- a/libinterp/dldfcn/__ode15__.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/dldfcn/__ode15__.cc Sun Apr 03 11:30:26 2022 -0400 @@ -863,7 +863,8 @@ } else if (index.numel () > 0) - // Not first step: register all events and test if stop integration or not + // Not first step: register all events and test + // if stop integration or not { te.resize (temp + index.numel ()); ye.resize (temp + index.numel (), m_num); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/dldfcn/audiodevinfo.cc --- a/libinterp/dldfcn/audiodevinfo.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/dldfcn/audiodevinfo.cc Sun Apr 03 11:30:26 2022 -0400 @@ -499,7 +499,8 @@ %! devinfo = audiodevinfo; %! nout = audiodevinfo (0); %! nin = audiodevinfo (1); -%! ## There might be multiple devices with the same name (e.g. on Windows WDM-KS) +%! ## There might be multiple devices with the same name +%! ## (e.g., on Windows WDM-KS) %! ## Check only the first of each unique device name. %! [unq_out_name, idx_unique] = unique ({devinfo.output(:).Name}); %! unq_out_id = [devinfo.output(idx_unique).ID]; @@ -563,8 +564,8 @@ octave_value get_userdata (void); PaStream * get_stream (void); + void play (void); void playblocking (void); - void play (void); void pause (void); void resume (void); void stop (void); @@ -884,7 +885,7 @@ if (isplaying ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting playing audioplayer"); + "interrupting audioplayer during playback"); stop (); } } @@ -1556,7 +1557,7 @@ if (isrecording ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting recording audiorecorder"); + "interrupting audiorecorder during recording"); stop (); } } @@ -1655,7 +1656,9 @@ void audiorecorder::set_channels (int channels_arg) { - assert (channels_arg == 1 || channels_arg == 2); + if (channels_arg != 1 && channels_arg != 2) + error ("audiorecorder: number of channels must be 1 or 2"); + channels = channels_arg; } @@ -1931,7 +1934,7 @@ || args(0).is_inline_function ()); if (is_function) - error ("audiorecorder: callbacks not yet implemented"); + error ("audiorecorder: callback functions are not yet implemented"); } if (nargin >= 3) @@ -2343,7 +2346,7 @@ || args(0).is_inline_function ()); if (is_function) - error ("audioplayer: callbacks not yet implemented"); + error ("audioplayer: callback functions are not yet implemented"); recorder->set_y (args(0)); recorder->set_fs (args(1).int_value ()); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/dldfcn/audioread.cc --- a/libinterp/dldfcn/audioread.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/dldfcn/audioread.cc Sun Apr 03 11:30:26 2022 -0400 @@ -545,17 +545,26 @@ ## Test input validation %!testif HAVE_SNDFILE %! fail ("audiowrite (1, 1, 8e3)", "FILENAME must be a string"); -%! fail ("audiowrite ('foo', int64 (1), 8e3)", "wrong type argument 'int64 scalar'"); -%! fail ("audiowrite ('foo', [0 1], [8e3, 8e3])", "FS must be a positive scalar"); +%! fail ("audiowrite ('foo', int64 (1), 8e3)", +%! "wrong type argument 'int64 scalar'"); +%! fail ("audiowrite ('foo', [0 1], [8e3, 8e3])", +%! "FS must be a positive scalar"); %! fail ("audiowrite ('foo', 1, {8e3})", "FS must be a .* integer"); %! fail ("audiowrite ('foo', 1, -8e3)", "FS must be a positive"); -%! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample')", "invalid number of arguments"); -%! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample', 48)", "wrong number of bits specified"); -%! fail ("audiowrite ('foo', 1, 8e3, 'quality', [2 3 4])", "Quality value must be a scalar"); -%! fail ("audiowrite ('foo', 1, 8e3, 'quality', NaN)", "Quality value must be .* between 0 and 100"); -%! fail ("audiowrite ('foo', 1, 8e3, 'quality', -1)", "Quality value must be .* between 0 and 100"); -%! fail ("audiowrite ('foo', 1, 8e3, 'quality', 101)", "Quality value must be .* between 0 and 100"); -%! fail ("audiowrite ('foo', 1, 8e3, 'foo', 'bar')", "unrecognized option: 'foo'"); +%! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample')", +%! "invalid number of arguments"); +%! fail ("audiowrite ('foo', 1, 8e3, 'bitspersample', 48)", +%! "wrong number of bits specified"); +%! fail ("audiowrite ('foo', 1, 8e3, 'quality', [2 3 4])", +%! "Quality value must be a scalar"); +%! fail ("audiowrite ('foo', 1, 8e3, 'quality', NaN)", +%! "Quality value must be .* between 0 and 100"); +%! fail ("audiowrite ('foo', 1, 8e3, 'quality', -1)", +%! "Quality value must be .* between 0 and 100"); +%! fail ("audiowrite ('foo', 1, 8e3, 'quality', 101)", +%! "Quality value must be .* between 0 and 100"); +%! fail ("audiowrite ('foo', 1, 8e3, 'foo', 'bar')", +%! "unrecognized option: 'foo'"); */ DEFUN_DLD (audioinfo, args, , diff -r 0a1aec50a0c8 -r 960909469245 libinterp/dldfcn/convhulln.cc --- a/libinterp/dldfcn/convhulln.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/dldfcn/convhulln.cc Sun Apr 03 11:30:26 2022 -0400 @@ -304,7 +304,8 @@ %! [h, v] = convhulln (cube, "Qt"); %! assert (size (h), [12 3]); %! h = sortrows (sort (h, 2), [1:3]); -%! assert (h, [1 2 4; 1 2 6; 1 4 8; 1 5 6; 1 5 8; 2 3 4; 2 3 7; 2 6 7; 3 4 7; 4 7 8; 5 6 7; 5 7 8]); +%! assert (h, +%! [1 2 4; 1 2 6; 1 4 8; 1 5 6; 1 5 8; 2 3 4; 2 3 7; 2 6 7; 3 4 7; 4 7 8; 5 6 7; 5 7 8]); %! assert (v, 1, 10*eps); %! [h2, v2] = convhulln (cube); # Test default option = "Qt" %! assert (size (h2), size (h)); @@ -316,7 +317,8 @@ %! cube = [0 0 0;1 0 0;1 1 0;0 1 0;0 0 1;1 0 1;1 1 1;0 1 1]; %! [h, v] = convhulln (cube, "QJ"); %! assert (size (h), [12 3]); -%! assert (sortrows (sort (h, 2), [1:3]), [1 2 4; 1 2 5; 1 4 5; 2 3 4; 2 3 6; 2 5 6; 3 4 8; 3 6 7; 3 7 8; 4 5 8; 5 6 8; 6 7 8]); +%! assert (sortrows (sort (h, 2), [1:3]), +%! [1 2 4; 1 2 5; 1 4 5; 2 3 4; 2 3 6; 2 5 6; 3 4 8; 3 6 7; 3 7 8; 4 5 8; 5 6 8; 6 7 8]); %! assert (v, 1.0, 1e6*eps); %!testif HAVE_QHULL diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-class.cc --- a/libinterp/octave-value/cdef-class.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-class.cc Sun Apr 03 11:30:26 2022 -0400 @@ -312,7 +312,8 @@ } void - cdef_class::cdef_class_rep::find_methods (std::map& meths, + cdef_class::cdef_class_rep::find_methods (std::map& meths, bool only_inherited, bool include_ctor) { @@ -1020,9 +1021,9 @@ // Look for all external methods visible on octave path at the // time of loading of the class. // - // FIXME: This is an "extension" to Matlab behavior, which only looks - // in the @-folder containing the original classdef file. However, - // this is easier to implement it that way at the moment. + // FIXME: This is an "extension" to Matlab behavior, which only + // looks in the @-folder containing the original classdef file. + // However, this is easier to implement it that way at the moment. std::list external_methods = lp.methods (full_class_name); @@ -1052,9 +1053,9 @@ // Property blocks // FIXME: default property expression should be able to call static - // methods of the class being constructed. A restricted CLASSNAME - // symbol should be added to the scope before evaluating default - // value expressions. + // methods of the class being constructed. A restricted + // CLASSNAME symbol should be added to the scope before + // evaluating default value expressions. std::list pb_list = b->properties_list (); @@ -1127,17 +1128,17 @@ // list of all valid properties that can be used to // validate the attribute list (see bug #60593). - // Install property attributes. This is done before assigning - // the property accessors so we can do validation by using - // cdef_property methods. + // Install property attributes. This is done before + // assigning the property accessors so we can do validation + // by using cdef_property methods. for (auto& attrnm_val : amap) prop.put (attrnm_val.first, attrnm_val.second); // Install property access methods, if any. Remove the - // accessor methods from the temporary storage map, so we can - // detect which ones are invalid and do not correspond to a - // defined property. + // accessor methods from the temporary storage map, so we + // can detect which ones are invalid and do not correspond + // to a defined property. auto git = get_methods.find (prop_name); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-class.h --- a/libinterp/octave-value/cdef-class.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-class.h Sun Apr 03 11:30:26 2022 -0400 @@ -214,7 +214,7 @@ bool m_handle_class; // The list of super-class constructors that are called implicitly by the - // the classdef engine when creating an object. These constructors are not + // classdef engine when creating an object. These constructors are not // called explicitly by the class constructor. std::list m_implicit_ctor_list; @@ -239,7 +239,8 @@ cdef_class (void) : cdef_meta_object () { } - cdef_class (const std::string& nm, const std::list& superclasses) + cdef_class (const std::string& nm, + const std::list& superclasses) : cdef_meta_object (new cdef_class_rep (superclasses)) { get_rep ()->set_name (nm); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-manager.cc --- a/libinterp/octave-value/cdef-manager.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-manager.cc Sun Apr 03 11:30:26 2022 -0400 @@ -281,7 +281,8 @@ static octave_value_list package_getAllPackages (interpreter& interp, - const octave_value_list& /* args */, int /* nargout */) + const octave_value_list& /* args */, + int /* nargout */) { std::map toplevel_packages; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-method.cc --- a/libinterp/octave-value/cdef-method.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-method.cc Sun Apr 03 11:30:26 2022 -0400 @@ -218,7 +218,8 @@ switch (type[0]) { case '(': - retval = (execute (idx.front (), type.length () > 1 ? 1 : nargout, true)); + retval = (execute (idx.front (), + type.length () > 1 ? 1 : nargout, true)); break; default: diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-object.cc diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-object.h --- a/libinterp/octave-value/cdef-object.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-object.h Sun Apr 03 11:30:26 2022 -0400 @@ -207,7 +207,8 @@ // FIXME: use a null object? cdef_object (void) : m_rep (new cdef_object_rep ()) { } - cdef_object (const cdef_object& obj) : m_rep (obj.m_rep) { m_rep->m_count++; } + cdef_object (const cdef_object& obj) : m_rep (obj.m_rep) + { m_rep->m_count++; } cdef_object (cdef_object_rep *r) : m_rep (r) { } @@ -256,7 +257,8 @@ bool is_meta_object (void) const { return m_rep->is_meta_object (); } - Array array_value (void) const { return m_rep->array_value (); } + Array array_value (void) const + { return m_rep->array_value (); } void put (const std::string& pname, const octave_value& val) { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-package.h --- a/libinterp/octave-value/cdef-package.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-package.h Sun Apr 03 11:30:26 2022 -0400 @@ -61,7 +61,8 @@ ~cdef_package_rep (void) = default; - cdef_object_rep * copy (void) const { return new cdef_package_rep (*this); } + cdef_object_rep * copy (void) const + { return new cdef_package_rep (*this); } bool is_package (void) const { return true; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/cdef-utils.cc --- a/libinterp/octave-value/cdef-utils.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/cdef-utils.cc Sun Apr 03 11:30:26 2022 -0400 @@ -318,16 +318,17 @@ return true; else if (is_strict_superclass (ctx, cls)) { - // Calling a protected method or property in a derived class. - // This is only allowed if the context class knows about it - // and has access to it. + // Calling a protected method or property in a derived + // class. This is only allowed if the context class knows + // about it and has access to it. if (! meth_name.empty ()) { cdef_method m = ctx.find_method (meth_name); if (m.ok ()) - return check_access (ctx, m.get ("Access"), meth_name); + return check_access (ctx, + m.get ("Access"), meth_name); return false; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-base-diag.cc --- a/libinterp/octave-value/ov-base-diag.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-base-diag.cc Sun Apr 03 11:30:26 2022 -0400 @@ -299,7 +299,8 @@ // FIXME: We really need some traits so that ad hoc hooks like this // are not necessary. template inline T helper_iscomplex (T) { return false; } -template inline T helper_iscomplex (std::complex) { return true; } +template inline T helper_iscomplex (std::complex) +{ return true; } template double diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-base-int.cc --- a/libinterp/octave-value/ov-base-int.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-base-int.cc Sun Apr 03 11:30:26 2022 -0400 @@ -453,7 +453,8 @@ if (space_hid < 0) return false; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, octave_H5P_DEFAULT); @@ -742,7 +743,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-base.cc --- a/libinterp/octave-value/ov-base.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-base.cc Sun Apr 03 11:30:26 2022 -0400 @@ -98,8 +98,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, "", "unknown"); -// TRUE means to perform automatic sparse to real mutation if there -// is memory to be saved +// DEPRECATED in Octave 8. bool Vsparse_auto_mutate = false; octave_base_value * @@ -1363,7 +1362,7 @@ void octave_base_value::indent (std::ostream& os) const { - assert (s_curr_print_indent_level >= 0); + panic_unless (s_curr_print_indent_level >= 0); if (s_beginning_of_line) { @@ -1555,49 +1554,4 @@ INSTALL_WIDENOP_TI (ti, octave_base_value, octave_cell, cell_conv); } -DEFUN (sparse_auto_mutate, args, nargout, - doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} sparse_auto_mutate () -@deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}) -@deftypefnx {} {} sparse_auto_mutate (@var{new_val}, "local") -Query or set the internal variable that controls whether Octave will -automatically mutate sparse matrices to full matrices to save memory. - -For example: - -@example -@group -s = speye (3); -sparse_auto_mutate (false); -s(:, 1) = 1; -typeinfo (s) -@result{} sparse matrix -sparse_auto_mutate (true); -s(1, :) = 1; -typeinfo (s) -@result{} matrix -@end group -@end example - -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. -@end deftypefn */) -{ - return set_internal_variable (Vsparse_auto_mutate, args, nargout, - "sparse_auto_mutate"); -} - -/* -%!test -%! s = speye (3); -%! sparse_auto_mutate (false); -%! s(:, 1) = 1; -%! assert (typeinfo (s), "sparse matrix"); -%! sparse_auto_mutate (true); -%! s(1, :) = 1; -%! assert (typeinfo (s), "matrix"); -%! sparse_auto_mutate (false); -*/ - OCTAVE_NAMESPACE_END diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-base.h --- a/libinterp/octave-value/ov-base.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-base.h Sun Apr 03 11:30:26 2022 -0400 @@ -302,7 +302,8 @@ virtual octave_value as_uint32 (void) const; virtual octave_value as_uint64 (void) const; - virtual octave_base_value * try_narrowing_conversion (void) { return nullptr; } + virtual octave_base_value * try_narrowing_conversion (void) + { return nullptr; } virtual void maybe_economize (void) { } @@ -942,8 +943,7 @@ octave::auto_shlib m_containing_dynamic_library; }; -// TRUE means to perform automatic sparse to real mutation if there -// is memory to be saved +OCTAVE_DEPRECATED (8, "Vsparse_auto_mutate is obsolete and is now always false") extern OCTINTERP_API bool Vsparse_auto_mutate; // Utility function to convert C++ arguments used in subsref/subsasgn into an diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-bool-mat.cc --- a/libinterp/octave-value/ov-bool-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-bool-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -456,7 +456,8 @@ if (space_hid < 0) return false; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-bool-sparse.cc --- a/libinterp/octave-value/ov-bool-sparse.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-bool-sparse.cc Sun Apr 03 11:30:26 2022 -0400 @@ -73,32 +73,6 @@ octave_sparse_matrix::static_type_id ()); } -octave_base_value * -octave_sparse_bool_matrix::try_narrowing_conversion (void) -{ - octave_base_value *retval = nullptr; - - if (Vsparse_auto_mutate) - { - // Don't use numel, since it can overflow for very large matrices - // Note that for the second test, this means it becomes approximative - // since it involves a cast to double to avoid issues of overflow - if (matrix.rows () == 1 && matrix.cols () == 1) - { - // Const copy of the matrix, so the right version of () operator used - const SparseBoolMatrix tmp (matrix); - - retval = new octave_bool (tmp (0)); - } - else if (matrix.cols () > 0 && matrix.rows () > 0 - && (double (matrix.byte_size ()) > double (matrix.rows ()) - * double (matrix.cols ()) * sizeof (bool))) - retval = new octave_bool_matrix (matrix.matrix_value ()); - } - - return retval; -} - double octave_sparse_bool_matrix::double_value (bool) const { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-bool-sparse.h --- a/libinterp/octave-value/ov-bool-sparse.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-bool-sparse.h Sun Apr 03 11:30:26 2022 -0400 @@ -84,8 +84,6 @@ type_conv_info numeric_conversion_function (void) const; - octave_base_value * try_narrowing_conversion (void); - // FIXME: Adapt idx_vector to allow sparse logical indexing without overflow! octave::idx_vector index_vector (bool /* require_integers */ = false) const { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-bool.cc --- a/libinterp/octave-value/ov-bool.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-bool.cc Sun Apr 03 11:30:26 2022 -0400 @@ -241,7 +241,8 @@ if (space_hid < 0) return false; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, octave_H5P_DEFAULT); @@ -253,8 +254,8 @@ } double tmp = double_value (); - retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, octave_H5S_ALL, - octave_H5P_DEFAULT, &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, + octave_H5S_ALL, octave_H5P_DEFAULT, &tmp) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-cell.cc --- a/libinterp/octave-value/ov-cell.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-cell.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1045,7 +1045,8 @@ #if defined (HAVE_HDF5_18) size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -1223,7 +1224,7 @@ DEFUN (iscell, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} iscell (@var{x}) +@deftypefn {} {@var{tf} =} iscell (@var{x}) Return true if @var{x} is a cell array object. @seealso{ismatrix, isstruct, iscellstr, isa} @end deftypefn */) @@ -1289,7 +1290,7 @@ DEFUN (iscellstr, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} iscellstr (@var{cell}) +@deftypefn {} {@var{tf} =} iscellstr (@var{cell}) Return true if every element of the cell array @var{cell} is a character string. @seealso{ischar, isstring} diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-ch-mat.cc --- a/libinterp/octave-value/ov-ch-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-ch-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -320,12 +320,12 @@ p(1) = 0; \ in_m = matrix.permute (p); \ } \ - std::size_t output_length = in_m.numel (); \ + std::size_t output_length = in_m.numel (); \ charNDArray ch_array = charNDArray (in_m.dims ()); \ const uint8_t *in = reinterpret_cast (in_m.data ()); \ uint8_t *buf = reinterpret_cast (ch_array.fortran_vec ()); \ U8_FCN (in, matrix.numel (), nullptr, buf, &output_length); \ - if (output_length != static_cast (matrix.numel ())) \ + if (output_length != static_cast (matrix.numel ())) \ { \ warning_with_id ("Octave:multi_byte_char_length", \ "UMAP: Possible multi-byte error."); \ diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-class.cc --- a/libinterp/octave-value/ov-class.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-class.cc Sun Apr 03 11:30:26 2022 -0400 @@ -281,7 +281,7 @@ Cell octave_class::dotref (const octave_value_list& idx) { - assert (idx.length () == 1); + panic_if (idx.length () != 1); std::string method_class = get_current_method_class (); @@ -654,7 +654,7 @@ octave_value_list key_idx = *++p; - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).xstring_value ("invalid index for class assignment"); @@ -692,7 +692,7 @@ { octave_value_list key_idx = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -747,7 +747,7 @@ auto p = idx.begin (); octave_value_list key_idx = *++p; - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).xstring_value ("assignment to class element failed"); @@ -785,7 +785,7 @@ { octave_value_list key_idx = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -1068,7 +1068,7 @@ // Something has gone terribly wrong if // symbol_table::find_method (c_name, c_name) does not return // a class constructor for the class c_name... - assert (have_ctor); + panic_unless (have_ctor); } if (have_ctor) @@ -1802,7 +1802,7 @@ DEFUN (isa, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isa (@var{obj}, @var{classname}) +@deftypefn {} {@var{tf} =} isa (@var{obj}, @var{classname}) Return true if @var{obj} is an object from the class @var{classname}. @var{classname} may also be one of the following class categories: @@ -1928,7 +1928,7 @@ DEFUN (isobject, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isobject (@var{x}) +@deftypefn {} {@var{tf} =} isobject (@var{x}) Return true if @var{x} is a class object. @seealso{class, typeinfo, isa, ismethod, isprop} @end deftypefn */) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-class.h --- a/libinterp/octave-value/ov-class.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-class.h Sun Apr 03 11:30:26 2022 -0400 @@ -188,7 +188,8 @@ OCTINTERP_API void print (std::ostream& os, bool pr_as_read_syntax = false); - OCTINTERP_API void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + OCTINTERP_API void print_raw (std::ostream& os, + bool pr_as_read_syntax = false) const; OCTINTERP_API bool reconstruct_exemplar (void); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-classdef.cc Sun Apr 03 11:30:26 2022 -0400 @@ -140,7 +140,8 @@ } } - retval = m_object.subsref (type, idx, 1, skip, octave::cdef_class (), auto_add); + retval = m_object.subsref (type, idx, 1, skip, + octave::cdef_class (), auto_add); if (type.length () > skip && idx.size () > skip) retval = retval(0).next_subsref (1, type, idx, skip); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-colon.h --- a/libinterp/octave-value/ov-colon.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-colon.h Sun Apr 03 11:30:26 2022 -0400 @@ -73,7 +73,8 @@ OCTINTERP_API void print (std::ostream& os, bool pr_as_read_syntax = false); - OCTINTERP_API void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + OCTINTERP_API void print_raw (std::ostream& os, + bool pr_as_read_syntax = false) const; private: diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-complex.cc --- a/libinterp/octave-value/ov-complex.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-complex.cc Sun Apr 03 11:30:26 2022 -0400 @@ -385,7 +385,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT); #endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-cx-mat.cc --- a/libinterp/octave-value/ov-cx-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-cx-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -596,7 +596,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT); #endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-cx-sparse.cc --- a/libinterp/octave-value/ov-cx-sparse.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-cx-sparse.cc Sun Apr 03 11:30:26 2022 -0400 @@ -60,49 +60,8 @@ octave_base_value * octave_sparse_complex_matrix::try_narrowing_conversion (void) { - octave_base_value *retval = nullptr; - - if (Vsparse_auto_mutate) - { - int nr = matrix.rows (); - int nc = matrix.cols (); - - // Don't use numel, since it can overflow for very large matrices - // Note that for the tests on matrix size, they become approximative - // since they involves a cast to double to avoid issues of overflow - if (matrix.rows () == 1 && matrix.cols () == 1) - { - // Const copy of the matrix, so the right version of () operator used - const SparseComplexMatrix tmp (matrix); - - Complex c = tmp (0, 0); - - if (c.imag () == 0.0) - retval = new octave_scalar (c.real ()); - else - retval = new octave_complex (c); - } - else if (nr == 0 || nc == 0) - retval = new octave_matrix (Matrix (nr, nc)); - else if (matrix.all_elements_are_real ()) - if (matrix.cols () > 0 && matrix.rows () > 0 - && (double (matrix.byte_size ()) > double (matrix.rows ()) - * double (matrix.cols ()) * sizeof (double))) - retval = new octave_matrix (::real (matrix.matrix_value ())); - else - retval = new octave_sparse_matrix (::real (matrix)); - else if (matrix.cols () > 0 && matrix.rows () > 0 - && (double (matrix.byte_size ()) > double (matrix.rows ()) - * double (matrix.cols ()) * sizeof (Complex))) - retval = new octave_complex_matrix (matrix.matrix_value ()); - } - else - { - if (matrix.all_elements_are_real ()) - retval = new octave_sparse_matrix (::real (matrix)); - } - - return retval; + return (matrix.all_elements_are_real () + ? new octave_sparse_matrix (::real (matrix)) : nullptr); } double @@ -400,7 +359,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -425,7 +385,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -450,7 +411,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -488,7 +450,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -526,7 +489,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -582,7 +546,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, octave_H5P_DEFAULT); @@ -601,8 +566,8 @@ { Complex *ctmp = m.xdata (); - retval = H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL, - octave_H5P_DEFAULT, ctmp) >= 0; + retval = H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, + octave_H5S_ALL, octave_H5P_DEFAULT, ctmp) >= 0; } H5Dclose (data_hid); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-dld-fcn.h --- a/libinterp/octave-value/ov-dld-fcn.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-dld-fcn.h Sun Apr 03 11:30:26 2022 -0400 @@ -69,7 +69,8 @@ ~octave_dld_function (void); - void mark_fcn_file_up_to_date (const octave::sys::time& t) { m_time_checked = t; } + void mark_fcn_file_up_to_date (const octave::sys::time& t) + { m_time_checked = t; } std::string fcn_file_name (void) const; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sun Apr 03 11:30:26 2022 -0400 @@ -217,7 +217,8 @@ bool load_binary (std::istream& is, bool swap, mach_info::float_format fmt); - bool save_hdf5 (octave_hdf5_id loc_hid, const char *name, bool save_as_floats); + bool save_hdf5 (octave_hdf5_id loc_hid, const char *name, + bool save_as_floats); bool load_hdf5 (octave_hdf5_id& group_hid, octave_hdf5_id& space_hid, octave_hdf5_id& type_hid); @@ -289,7 +290,8 @@ bool load_binary (std::istream& is, bool swap, mach_info::float_format fmt); - bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); + bool save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool save_as_floats); bool load_hdf5 (octave_hdf5_id& group_hid, octave_hdf5_id& space_hid, octave_hdf5_id& type_hid); @@ -362,7 +364,8 @@ bool load_binary (std::istream& is, bool swap, mach_info::float_format fmt); - bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); + bool save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool save_as_floats); bool load_hdf5 (octave_hdf5_id& group_hid, octave_hdf5_id& space_hid, octave_hdf5_id& type_hid); @@ -552,7 +555,8 @@ bool load_binary (std::istream& is, bool swap, mach_info::float_format fmt); - bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); + bool save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool save_as_floats); bool load_hdf5 (octave_hdf5_id& group_hid, octave_hdf5_id& space_hid, octave_hdf5_id& type_hid); @@ -656,7 +660,8 @@ bool load_binary (std::istream& is, bool swap, mach_info::float_format fmt); - bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); + bool save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool save_as_floats); bool load_hdf5 (octave_hdf5_id& group_hid, octave_hdf5_id& space_hid, octave_hdf5_id& type_hid); @@ -1359,7 +1364,8 @@ a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, octave_H5P_DEFAULT, octave_H5P_DEFAULT); #else - a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, octave_H5P_DEFAULT); + a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, + octave_H5P_DEFAULT); #endif if (a_id >= 0) @@ -2389,7 +2395,8 @@ retval = false; #if defined (HAVE_HDF5_18) data_hid = H5Gcreate (group_hid, "symbol table", - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Gcreate (group_hid, "symbol table", 0); #endif @@ -2621,14 +2628,14 @@ tree_statement_list *b = f->body (); - assert (b->length () == 1); + panic_if (b->length () != 1); tree_statement *s = b->front (); if (! s) error ("invalid anonymous function handle"); - assert (s->is_expression ()); + panic_unless (s->is_expression ()); tree_expression *e = s->expression (); @@ -2954,14 +2961,16 @@ std::string name; is >> name; - new_rep.reset (new octave::simple_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::simple_fcn_handle (name, fpath, + octaveroot)); } else if (subtype == "scopedfunction") { std::string name; is >> name; - new_rep.reset (new octave::scoped_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::scoped_fcn_handle (name, fpath, + octaveroot)); } else if (subtype == "anonymous") new_rep.reset (new octave::anonymous_fcn_handle ()); @@ -2970,14 +2979,16 @@ std::string name; is >> name; - new_rep.reset (new octave::nested_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::nested_fcn_handle (name, fpath, + octaveroot)); } else if (subtype == "classsimple") { std::string name; is >> name; - new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, + octaveroot)); } } @@ -3077,7 +3088,8 @@ else if (subtype == "nested") new_rep.reset (new octave::nested_fcn_handle (name, fpath, octaveroot)); else if (subtype == "classsimple") - new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, + octaveroot)); } if (! new_rep) @@ -3230,7 +3242,8 @@ else if (subtype == "nested") new_rep.reset (new octave::nested_fcn_handle (name, fpath, octaveroot)); else if (subtype == "classsimple") - new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, octaveroot)); + new_rep.reset (new octave::class_simple_fcn_handle (name, fpath, + octaveroot)); } bool status = false; @@ -3397,16 +3410,6 @@ OCTAVE_NAMESPACE_BEGIN - // DEPRECATED in Octave 6. - - octave_value - make_fcn_handle (interpreter& interp, const std::string& nm) - { - tree_evaluator& tw = interp.get_evaluator (); - - return tw.make_fcn_handle (nm); - } - DEFUN (functions, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{s} =} functions (@var{fcn_handle}) @@ -3590,7 +3593,7 @@ DEFUN (is_function_handle, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} is_function_handle (@var{x}) +@deftypefn {} {@var{tf} =} is_function_handle (@var{x}) Return true if @var{x} is a function handle. @seealso{isa, typeinfo, class, functions} @end deftypefn */) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-fcn-handle.h --- a/libinterp/octave-value/ov-fcn-handle.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-fcn-handle.h Sun Apr 03 11:30:26 2022 -0400 @@ -373,14 +373,4 @@ extern bool is_equal_to (const octave_fcn_handle& fh1, const octave_fcn_handle& fh2); -OCTAVE_NAMESPACE_BEGIN - -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) - OCTAVE_DEPRECATED (6, "use 'tree_evaluator::make_fcn_handle' instead") - extern octave_value - make_fcn_handle (interpreter& interp, const std::string& name); #endif - -OCTAVE_NAMESPACE_END - -#endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-float.cc --- a/libinterp/octave-value/ov-float.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-float.cc Sun Apr 03 11:30:26 2022 -0400 @@ -262,7 +262,8 @@ if (space_hid < 0) return false; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-flt-complex.cc --- a/libinterp/octave-value/ov-flt-complex.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-flt-complex.cc Sun Apr 03 11:30:26 2022 -0400 @@ -326,7 +326,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT); #endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-flt-cx-diag.cc --- a/libinterp/octave-value/ov-flt-cx-diag.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-flt-cx-diag.cc Sun Apr 03 11:30:26 2022 -0400 @@ -148,8 +148,7 @@ return ::imag (m_matrix); case umap_sqrt: { - FloatComplexColumnVector tmp = m_matrix.extract_diag ().map - (std::sqrt); + FloatComplexColumnVector tmp = m_matrix.extract_diag ().map (std::sqrt); FloatComplexDiagMatrix retval (tmp); retval.resize (m_matrix.rows (), m_matrix.columns ()); return retval; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-flt-cx-mat.cc --- a/libinterp/octave-value/ov-flt-cx-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-flt-cx-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -552,7 +552,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT); #endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-flt-re-diag.cc --- a/libinterp/octave-value/ov-flt-re-diag.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-flt-re-diag.cc Sun Apr 03 11:30:26 2022 -0400 @@ -166,8 +166,7 @@ return DiagMatrix (m_matrix.rows (), m_matrix.cols (), 0.0); case umap_sqrt: { - FloatComplexColumnVector tmp = m_matrix.extract_diag ().map - (octave::math::rc_sqrt); + FloatComplexColumnVector tmp = m_matrix.extract_diag ().map (octave::math::rc_sqrt); FloatComplexDiagMatrix retval (tmp); retval.resize (m_matrix.rows (), m_matrix.columns ()); return retval; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-flt-re-mat.cc --- a/libinterp/octave-value/ov-flt-re-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-flt-re-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -619,7 +619,8 @@ #endif #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-java.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1265,7 +1265,8 @@ } static octave_value -convert_to_string (JNIEnv *jni_env, jobject m_java_object, bool force, char type) +convert_to_string (JNIEnv *jni_env, jobject m_java_object, bool force, + char type) { octave_value retval; @@ -1274,7 +1275,8 @@ jclass_ref cls (jni_env, jni_env->FindClass ("java/lang/String")); if (jni_env->IsInstanceOf (m_java_object, cls)) - retval = octave_value (jstring_to_string (jni_env, m_java_object), type); + retval = octave_value (jstring_to_string (jni_env, m_java_object), + type); else if (force) { cls = jni_env->FindClass ("[Ljava/lang/String;"); @@ -2366,7 +2368,8 @@ JNIEnv *current_env = thread_jni_env (); if (current_env) - return convert_to_string (current_env, TO_JOBJECT (to_java ()), force, type); + return convert_to_string (current_env, TO_JOBJECT (to_java ()), force, + type); else return octave_value (""); @@ -3372,7 +3375,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} java_matrix_autoconversion () @deftypefnx {} {@var{old_val} =} java_matrix_autoconversion (@var{new_val}) -@deftypefnx {} {} java_matrix_autoconversion (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} java_matrix_autoconversion (@var{new_val}, "local") Query or set the internal variable that controls whether Java arrays are automatically converted to Octave matrices. @@ -3403,7 +3406,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} java_unsigned_autoconversion () @deftypefnx {} {@var{old_val} =} java_unsigned_autoconversion (@var{new_val}) -@deftypefnx {} {} java_unsigned_autoconversion (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} java_unsigned_autoconversion (@var{new_val}, "local") Query or set the internal variable that controls how integer classes are converted when @code{java_matrix_autoconversion} is enabled. @@ -3435,7 +3438,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} debug_java () @deftypefnx {} {@var{old_val} =} debug_java (@var{new_val}) -@deftypefnx {} {} debug_java (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} debug_java (@var{new_val}, "local") Query or set the internal variable that determines whether extra debugging information regarding the initialization of the JVM and any Java exceptions is printed. @@ -3466,7 +3469,7 @@ DEFUN (isjava, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isjava (@var{x}) +@deftypefn {} {@var{tf} =} isjava (@var{x}) Return true if @var{x} is a Java object. @seealso{class, typeinfo, isa, javaObject} @end deftypefn */) @@ -3494,14 +3497,22 @@ ## Check we can create objects that wrap java literals %!testif HAVE_JAVA; usejava ("jvm") <*38821> -%! assert (class (javaObject ("java.lang.Byte", uint8 (1))), "java.lang.Byte"); -%! assert (class (javaObject ("java.lang.Byte", int8 (1))), "java.lang.Byte"); -%! assert (class (javaObject ("java.lang.Short", uint16 (1))), "java.lang.Short"); -%! assert (class (javaObject ("java.lang.Short", int16 (1))), "java.lang.Short"); -%! assert (class (javaObject ("java.lang.Integer", uint32 (1))), "java.lang.Integer"); -%! assert (class (javaObject ("java.lang.Integer", int32 (1))), "java.lang.Integer"); -%! assert (class (javaObject ("java.lang.Long", uint64 (1))), "java.lang.Long"); -%! assert (class (javaObject ("java.lang.Long", int64 (1))), "java.lang.Long"); +%! assert (class (javaObject ("java.lang.Byte", uint8 (1))), +%! "java.lang.Byte"); +%! assert (class (javaObject ("java.lang.Byte", int8 (1))), +%! "java.lang.Byte"); +%! assert (class (javaObject ("java.lang.Short", uint16 (1))), +%! "java.lang.Short"); +%! assert (class (javaObject ("java.lang.Short", int16 (1))), +%! "java.lang.Short"); +%! assert (class (javaObject ("java.lang.Integer", uint32 (1))), +%! "java.lang.Integer"); +%! assert (class (javaObject ("java.lang.Integer", int32 (1))), +%! "java.lang.Integer"); +%! assert (class (javaObject ("java.lang.Long", uint64 (1))), +%! "java.lang.Long"); +%! assert (class (javaObject ("java.lang.Long", int64 (1))), +%! "java.lang.Long"); ## More checks of java numeric and boolean class instances %!testif HAVE_JAVA; usejava ("jvm") @@ -3559,8 +3570,10 @@ %! assert (javaMethod ("valueOf", "java.lang.Long", int64 (1)), 1) %! assert (javaMethod ("valueOf", "java.lang.Float", single (1)), 1) %! assert (javaMethod ("valueOf", "java.lang.Double", double (1)), 1) -%! assert (class (javaMethod ("valueOf", "java.math.BigDecimal", double (1))), "java.math.BigDecimal") -%! assert (class (javaMethod ("valueOf", "java.math.BigInteger", int64 (1))), "java.math.BigInteger") +%! assert (class (javaMethod ("valueOf", "java.math.BigDecimal", double (1))), +%! "java.math.BigDecimal") +%! assert (class (javaMethod ("valueOf", "java.math.BigInteger", int64 (1))), +%! "java.math.BigInteger") ## Automatic conversion from string cell array into String[] %!testif HAVE_JAVA; usejava ("jvm") <*45290> diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-lazy-idx.cc --- a/libinterp/octave-value/ov-lazy-idx.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-lazy-idx.cc Sun Apr 03 11:30:26 2022 -0400 @@ -99,7 +99,8 @@ octave_value octave_lazy_index::squeeze (void) const { - return octave::idx_vector (m_index.as_array ().squeeze (), m_index.extent (0)); + return octave::idx_vector (m_index.as_array ().squeeze (), + m_index.extent (0)); } octave_value diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-lazy-idx.h --- a/libinterp/octave-value/ov-lazy-idx.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-lazy-idx.h Sun Apr 03 11:30:26 2022 -0400 @@ -60,7 +60,8 @@ octave_value fast_elem_extract (octave_idx_type n) const; - std::size_t byte_size (void) const { return numel () * sizeof (octave_idx_type); } + std::size_t byte_size (void) const + { return numel () * sizeof (octave_idx_type); } octave_value squeeze (void) const; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-null-mat.cc --- a/libinterp/octave-value/ov-null-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-null-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -100,7 +100,7 @@ DEFUN (isnull, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isnull (@var{x}) +@deftypefn {} {@var{tf} =} isnull (@var{x}) Return true if @var{x} is a special null matrix, string, or single quoted string. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-range.cc --- a/libinterp/octave-value/ov-range.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-range.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1079,7 +1079,8 @@ } # if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); # else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT); # endif diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-re-mat.cc --- a/libinterp/octave-value/ov-re-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-re-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -745,7 +745,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, octave_H5P_DEFAULT); @@ -757,8 +758,8 @@ } double *mtmp = m.fortran_vec (); - retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, octave_H5S_ALL, - octave_H5P_DEFAULT, mtmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, + octave_H5S_ALL, octave_H5P_DEFAULT, mtmp) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-re-mat.h --- a/libinterp/octave-value/ov-re-mat.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-re-mat.h Sun Apr 03 11:30:26 2022 -0400 @@ -106,7 +106,10 @@ octave_base_value * try_narrowing_conversion (void); octave::idx_vector index_vector (bool /* require_integers */ = false) const - { return idx_cache ? *idx_cache : set_idx_cache (octave::idx_vector (matrix)); } + { + return idx_cache ? *idx_cache + : set_idx_cache (octave::idx_vector (matrix)); + } builtin_type_t builtin_type (void) const { return btyp_double; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-re-sparse.cc --- a/libinterp/octave-value/ov-re-sparse.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-re-sparse.cc Sun Apr 03 11:30:26 2022 -0400 @@ -69,32 +69,6 @@ } } -octave_base_value * -octave_sparse_matrix::try_narrowing_conversion (void) -{ - octave_base_value *retval = nullptr; - - if (Vsparse_auto_mutate) - { - // Don't use numel, since it can overflow for very large matrices - // Note that for the second test, this means it becomes approximative - // since it involves a cast to double to avoid issues of overflow - if (matrix.rows () == 1 && matrix.cols () == 1) - { - // Const copy of the matrix, so the right version of () operator used - const SparseMatrix tmp (matrix); - - retval = new octave_scalar (tmp (0)); - } - else if (matrix.cols () > 0 && matrix.rows () > 0 - && (double (matrix.byte_size ()) > double (matrix.rows ()) - * double (matrix.cols ()) * sizeof (double))) - retval = new octave_matrix (matrix.matrix_value ()); - } - - return retval; -} - double octave_sparse_matrix::double_value (bool) const { @@ -421,7 +395,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -445,7 +420,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -470,7 +446,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -508,7 +485,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -545,7 +523,8 @@ } #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, octave_H5P_DEFAULT); @@ -594,7 +573,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, octave_H5P_DEFAULT); @@ -607,8 +587,8 @@ } double *dtmp = m.xdata (); - retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, octave_H5S_ALL, - octave_H5P_DEFAULT, dtmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, + octave_H5S_ALL, octave_H5P_DEFAULT, dtmp) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); H5Gclose (group_hid); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-re-sparse.h --- a/libinterp/octave-value/ov-re-sparse.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-re-sparse.h Sun Apr 03 11:30:26 2022 -0400 @@ -91,8 +91,6 @@ octave_base_value * empty_clone (void) const { return new octave_sparse_matrix (); } - octave_base_value * try_narrowing_conversion (void); - octave::idx_vector index_vector (bool require_integers = false) const; builtin_type_t builtin_type (void) const { return btyp_double; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-scalar.cc --- a/libinterp/octave-value/ov-scalar.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-scalar.cc Sun Apr 03 11:30:26 2022 -0400 @@ -283,7 +283,8 @@ #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, octave_H5P_DEFAULT); @@ -295,8 +296,8 @@ } double tmp = double_value (); - retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, octave_H5S_ALL, - octave_H5P_DEFAULT, &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, octave_H5S_ALL, + octave_H5S_ALL, octave_H5P_DEFAULT, &tmp) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-str-mat.cc --- a/libinterp/octave-value/ov-str-mat.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-str-mat.cc Sun Apr 03 11:30:26 2022 -0400 @@ -593,7 +593,8 @@ return false; #if defined (HAVE_HDF5_18) data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, - octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT); + octave_H5P_DEFAULT, octave_H5P_DEFAULT, + octave_H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, octave_H5P_DEFAULT); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-struct.cc Sun Apr 03 11:30:26 2022 -0400 @@ -91,7 +91,7 @@ { Cell retval; - assert (idx.length () == 1); + panic_if (idx.length () != 1); std::string nm = idx(0).string_value (); @@ -321,7 +321,7 @@ octave_value_list key_idx = *++p; - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -377,7 +377,7 @@ { octave_value_list key_idx = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -443,7 +443,7 @@ octave_value_list key_idx = *++p; octave_value_list idxf = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -514,7 +514,7 @@ { octave_value_list key_idx = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -1107,7 +1107,7 @@ { octave_value retval; - assert (idx.length () == 1); + panic_if (idx.length () != 1); std::string nm = idx(0).string_value (); @@ -1228,7 +1228,7 @@ octave_value_list key_idx = idx.front (); - assert (key_idx.length () == 1); + panic_if (key_idx.length () != 1); std::string key = key_idx(0).string_value (); @@ -1885,14 +1885,16 @@ %!assert (size (x), [0,0]) %!assert (isstruct (x)) %!assert (isempty (fieldnames (x))) -%!fail ('struct ("a",{1,2},"b",{1,2,3})', 'dimensions of parameter 2 do not match those of parameter 4') +%!fail ('struct ("a",{1,2},"b",{1,2,3})', +%! 'dimensions of parameter 2 do not match those of parameter 4') %!error struct (1,2,3,4) -%!fail ('struct ("1",2,"3")', 'struct: additional arguments must occur as "field", VALUE pairs') +%!fail ('struct ("1",2,"3")', +%! 'struct: additional arguments must occur as "field", VALUE pairs') */ DEFUN (isstruct, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isstruct (@var{x}) +@deftypefn {} {@var{tf} =} isstruct (@var{x}) Return true if @var{x} is a structure or a structure array. @seealso{ismatrix, iscell, isa} @end deftypefn */) @@ -1932,8 +1934,8 @@ DEFUN (isfield, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isfield (@var{x}, "@var{name}") -@deftypefnx {} {} isfield (@var{x}, @var{name}) +@deftypefn {} {@var{tf} =} isfield (@var{x}, "@var{name}") +@deftypefnx {} {@var{tf} =} isfield (@var{x}, @var{name}) Return true if the @var{x} is a structure and it includes an element named @var{name}. @@ -2112,7 +2114,7 @@ // result dimensions. dim_vector rdv = vals.dims ().redim (nd); - assert (ext == rdv(dim)); + panic_unless (ext == rdv(dim)); if (nd == 2) { rdv(0) = rdv(1-dim); @@ -2213,7 +2215,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} struct_levels_to_print () @deftypefnx {} {@var{old_val} =} struct_levels_to_print (@var{new_val}) -@deftypefnx {} {} struct_levels_to_print (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} struct_levels_to_print (@var{new_val}, "local") Query or set the internal variable that specifies the number of structure levels to display. @@ -2232,7 +2234,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} print_struct_array_contents () @deftypefnx {} {@var{old_val} =} print_struct_array_contents (@var{new_val}) -@deftypefnx {} {} print_struct_array_contents (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} print_struct_array_contents (@var{new_val}, "local") Query or set the internal variable that specifies whether to print struct array contents. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-typeinfo.cc --- a/libinterp/octave-value/ov-typeinfo.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-typeinfo.cc Sun Apr 03 11:30:26 2022 -0400 @@ -645,7 +645,8 @@ { octave_scalar_map retval; - int len = std::min (static_cast (m_binary_ops.columns ()), m_num_types); + int len = std::min (static_cast (m_binary_ops.columns ()), + m_num_types); dim_vector tab_dims (len, len); @@ -697,7 +698,8 @@ { octave_scalar_map retval; - int len = std::min (static_cast (m_assign_ops.columns ()), m_num_types); + int len = std::min (static_cast (m_assign_ops.columns ()), + m_num_types); dim_vector tab_dims (len, len); @@ -722,7 +724,8 @@ { octave_scalar_map retval; - int len = std::min (static_cast (m_assignany_ops.columns ()), m_num_types); + int len = std::min (static_cast (m_assignany_ops.columns ()), + m_num_types); dim_vector tab_dims (1, len); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov-usr-fcn.cc --- a/libinterp/octave-value/ov-usr-fcn.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov-usr-fcn.cc Sun Apr 03 11:30:26 2022 -0400 @@ -504,8 +504,8 @@ octave::tree_expression * octave_user_function::special_expr (void) { - assert (is_special_expr ()); - assert (m_cmd_list->length () == 1); + panic_unless (is_special_expr ()); + panic_if (m_cmd_list->length () != 1); octave::tree_statement *stmt = m_cmd_list->front (); return stmt->expression (); @@ -869,7 +869,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} optimize_subsasgn_calls () @deftypefnx {} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val}) -@deftypefnx {} {} optimize_subsasgn_calls (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val}, "local") Query or set the internal flag for @code{subsasgn} method call optimizations. @@ -905,7 +905,7 @@ DEFMETHOD (isargout, interp, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isargout (@var{k}) +@deftypefn {} {@var{tf} =} isargout (@var{k}) Within a function, return a logical value indicating whether the argument @var{k} will be assigned to a variable on output. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov.cc --- a/libinterp/octave-value/ov.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov.cc Sun Apr 03 11:30:26 2022 -0400 @@ -3986,7 +3986,7 @@ DEFUN (is_sq_string, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} is_sq_string (@var{x}) +@deftypefn {} {@var{tf} =} is_sq_string (@var{x}) Return true if @var{x} is a single-quoted character string. @seealso{is_dq_string, ischar} @end deftypefn */) @@ -4009,7 +4009,7 @@ DEFUN (is_dq_string, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} is_dq_string (@var{x}) +@deftypefn {} {@var{tf} =} is_dq_string (@var{x}) Return true if @var{x} is a double-quoted character string. @seealso{is_sq_string, ischar} @end deftypefn */) @@ -4034,7 +4034,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} optimize_permutation_matrix () @deftypefnx {} {@var{old_val} =} optimize_permutation_matrix (@var{new_val}) -@deftypefnx {} {} optimize_permutation_matrix (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} optimize_permutation_matrix (@var{new_val}, "local") Query or set whether a special space-efficient format is used for storing permutation matrices. @@ -4065,7 +4065,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} optimize_diagonal_matrix () @deftypefnx {} {@var{old_val} =} optimize_diagonal_matrix (@var{new_val}) -@deftypefnx {} {} optimize_diagonal_matrix (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} optimize_diagonal_matrix (@var{new_val}, "local") Query or set whether a special space-efficient format is used for storing diagonal matrices. @@ -4110,7 +4110,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} optimize_range () @deftypefnx {} {@var{old_val} =} optimize_range (@var{new_val}) -@deftypefnx {} {} optimize_range (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} optimize_range (@var{new_val}, "local") Query or set whether a special space-efficient format is used for storing ranges. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ov.h --- a/libinterp/octave-value/ov.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ov.h Sun Apr 03 11:30:26 2022 -0400 @@ -1901,6 +1901,8 @@ extern OCTINTERP_API void install_types (octave::type_info&); // Templated value extractors. +// FIXME: would be more consistent to use panic_impossible(), rather than +// assert(), but including "error.h" leads to compilation errors. template inline Value octave_value_extract (const octave_value&) { assert (false); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave-value/ovl.cc --- a/libinterp/octave-value/ovl.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave-value/ovl.cc Sun Apr 03 11:30:26 2022 -0400 @@ -71,7 +71,7 @@ m_data[k++] = ovl(i); } - assert (k == nel); + panic_unless (k == nel); } } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave.cc --- a/libinterp/octave.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave.cc Sun Apr 03 11:30:26 2022 -0400 @@ -242,7 +242,7 @@ octave_scalar_map m; m.assign ("sys_argc", sys_argc ()); - m.assign ("sys_argv", string_vector (sys_argv ())); + m.assign ("sys_argv", Cell (string_vector (sys_argv ()))); m.assign ("echo_commands", echo_commands ()); m.assign ("forced_interactive", forced_interactive ()); m.assign ("forced_line_editing", forced_line_editing ()); @@ -267,8 +267,8 @@ m.assign ("info_file", info_file ()); m.assign ("info_program", info_program ()); m.assign ("texi_macros_file", texi_macros_file ()); - m.assign ("all_args", all_args ()); - m.assign ("remaining_args", remaining_args ()); + m.assign ("all_args", Cell (all_args ())); + m.assign ("remaining_args", Cell (remaining_args ())); return m; } @@ -429,7 +429,7 @@ DEFUN (isguirunning, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} isguirunning () +@deftypefn {} {@var{tf} =} isguirunning () Return true if Octave is running in GUI mode and false otherwise. @seealso{have_window_system} @end deftypefn */) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/octave.h --- a/libinterp/octave.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/octave.h Sun Apr 03 11:30:26 2022 -0400 @@ -57,11 +57,13 @@ bool echo_commands (void) const { return m_echo_commands; } - bool experimental_terminal_widget (void) const { return m_experimental_terminal_widget; } + bool experimental_terminal_widget (void) const + { return m_experimental_terminal_widget; } bool forced_interactive (void) const { return m_forced_interactive; } bool forced_line_editing (void) const { return m_forced_line_editing; } bool gui (void) const { return m_gui; } - bool inhibit_startup_message (void) const { return m_inhibit_startup_message; } + bool inhibit_startup_message (void) const + { return m_inhibit_startup_message; } bool line_editing (void) const { return m_line_editing; } bool no_window_system (void) const { return m_no_window_system; } @@ -74,7 +76,8 @@ bool traditional (void) const { return m_traditional; } bool verbose_flag (void) const { return m_verbose_flag; } std::string code_to_eval (void) const { return m_code_to_eval; } - std::list command_line_path (void) const { return m_command_line_path; } + std::list command_line_path (void) const + { return m_command_line_path; } std::string docstrings_file (void) const { return m_docstrings_file; } std::string doc_cache_file (void) const { return m_doc_cache_file; } std::string exec_path (void) const { return m_exec_path; } @@ -87,7 +90,8 @@ void echo_commands (bool arg) { m_echo_commands = arg; } - void experimental_terminal_widget (bool arg) { m_experimental_terminal_widget = arg; } + void experimental_terminal_widget (bool arg) + { m_experimental_terminal_widget = arg; } void forced_line_editing (bool arg) { m_forced_line_editing = arg; } void forced_interactive (bool arg) { m_forced_interactive = arg; } void gui (bool arg) { m_gui = arg; } @@ -104,7 +108,8 @@ void traditional (bool arg) { m_traditional = arg; } void verbose_flag (bool arg) { m_verbose_flag = arg; } void code_to_eval (const std::string& arg) { m_code_to_eval = arg; } - void command_line_path (const std::list& arg) { m_command_line_path = arg; } + void command_line_path (const std::list& arg) + { m_command_line_path = arg; } void docstrings_file (const std::string& arg) { m_docstrings_file = arg; } void doc_cache_file (const std::string& arg) { m_doc_cache_file = arg; } void exec_path (const std::string& arg) { m_exec_path = arg; } @@ -282,7 +287,8 @@ virtual bool gui_running (void) const { return false; } virtual void gui_running (bool) { } - void program_invocation_name (const std::string& nm) { m_program_invocation_name = nm; } + void program_invocation_name (const std::string& nm) + { m_program_invocation_name = nm; } void program_name (const std::string& nm) { m_program_name = nm; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/operators/ops.h --- a/libinterp/operators/ops.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/operators/ops.h Sun Apr 03 11:30:26 2022 -0400 @@ -29,6 +29,7 @@ #include "octave-config.h" #include "Array-util.h" +#include "error.h" namespace octave { @@ -130,7 +131,7 @@ CONCAT2 (octave_, t1)& v1 = dynamic_cast (a1); \ const CONCAT2 (octave_, t2)& v2 = dynamic_cast (a2); \ \ - assert (idx.empty ()); \ + error_unless (idx.empty ()); \ v1.matrix_ref () op v2.CONCAT2 (f, _value) (); \ \ return octave_value (); \ @@ -145,7 +146,7 @@ CONCAT2 (octave_, t1)& v1 = dynamic_cast (a1); \ const CONCAT2 (octave_, t2)& v2 = dynamic_cast (a2); \ \ - assert (idx.empty ()); \ + error_unless (idx.empty ()); \ fnop (v1.matrix_ref (), v2.CONCAT2 (f, _value) ()); \ \ return octave_value (); \ diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/bp-table.cc --- a/libinterp/parse-tree/bp-table.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/bp-table.cc Sun Apr 03 11:30:26 2022 -0400 @@ -176,7 +176,7 @@ { Array W = U.index (0); if (W.isempty () || W(0).isempty ()) - es.debug_on_caught (true); // like "dbstop if caught error" with no ID + es.debug_on_caught (true); // like "dbstop if caught error" with no ID else if (! W(0).iscell ()) fail = true; else @@ -538,14 +538,14 @@ %! dbclear all; # Clear out breakpoints before test %! dbstop help; %! dbstop in ls; -%! dbstop help at 104; -%! dbstop in ls 102; ## 102 is a comment; code line is at 105 +%! dbstop help at 105; # 105 is a comment; code line is at 106 +%! dbstop in ls 102; %! dbstop help 204 if a==5; %! dbstop if error Octave:undefined-function; %! s = dbstatus; %! dbclear all; %! assert ({s.bkpt(:).name}, {"help", "help", "help>do_contents", "ls", "ls"}); -%! assert ([s.bkpt(:).line], [55, 105, 207, 63, 102]); +%! assert ([s.bkpt(:).line], [56, 106, 208, 63, 102]); %! assert (s.errs, {"Octave:undefined-function"}); */ @@ -670,7 +670,8 @@ // a breakpoint there. Put the system into debug_mode. int bp_table::add_breakpoint_in_function (const std::string& fname, const std::string& class_name, - int line, const std::string& condition) + int line, + const std::string& condition) { bp_lines line_info; line_info.insert (line); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/bp-table.h --- a/libinterp/parse-tree/bp-table.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/bp-table.h Sun Apr 03 11:30:26 2022 -0400 @@ -208,9 +208,12 @@ bool condition_valid (const std::string& cond); - void parse_dbfunction_params (const char *who, const octave_value_list& args, - std::string& func_name, std::string& class_name, - bp_table::bp_lines& lines, std::string& cond); + void parse_dbfunction_params (const char *who, + const octave_value_list& args, + std::string& func_name, + std::string& class_name, + bp_table::bp_lines& lines, + std::string& cond); private: diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/lex.h --- a/libinterp/parse-tree/lex.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/lex.h Sun Apr 03 11:30:26 2022 -0400 @@ -777,7 +777,8 @@ { } lexer (FILE *file, interpreter& interp, const std::string& encoding) - : base_lexer (interp), m_reader (interp, file, encoding), m_initial_input (true) + : base_lexer (interp), m_reader (interp, file, encoding), + m_initial_input (true) { } lexer (const std::string& eval_string, interpreter& interp) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/oct-lvalue.h --- a/libinterp/parse-tree/oct-lvalue.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/oct-lvalue.h Sun Apr 03 11:30:26 2022 -0400 @@ -68,7 +68,8 @@ octave_idx_type numel (void) const; - void set_index (const std::string& t, const std::list& i); + void set_index (const std::string& t, + const std::list& i); void clear_index (void) { m_type = ""; m_idx.clear (); } @@ -105,8 +106,6 @@ std::string m_type; std::list m_idx; - - octave_idx_type m_nel; }; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/profiler.cc --- a/libinterp/parse-tree/profiler.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/profiler.cc Sun Apr 03 11:30:26 2022 -0400 @@ -52,8 +52,6 @@ for (const auto& nm : list) retval(i++) = nm; - assert (i == n); - return retval; } @@ -88,10 +86,10 @@ profiler::tree_node* profiler::tree_node::exit (octave_idx_type /* fcn */) { - // FIXME: These assert statements don't make sense if profile() is called - // from within a function hierarchy to begin with. See bug #39587. - // assert (m_parent); - // assert (m_fcn_id == fcn); + // FIXME: These panic_unless statements don't make sense if profile() is + // called from within a function hierarchy to begin with. See bug #39587. + // panic_unless (m_parent); + // panic_unless (m_fcn_id == fcn); return m_parent; } @@ -99,7 +97,8 @@ void profiler::tree_node::build_flat (flat_profile& data) const { - // If this is not the top-level node, update profile entry for this function. + // If this is not the top-level node, + // update profile entry for this function. if (m_fcn_id != 0) { stats& entry = data[m_fcn_id - 1]; @@ -107,7 +106,7 @@ entry.m_time += m_time; entry.m_calls += m_calls; - assert (m_parent); + panic_unless (m_parent); if (m_parent->m_fcn_id != 0) { entry.m_parents.insert (m_parent->m_fcn_id); @@ -161,7 +160,6 @@ ++i; } - assert (i == n); octave_map retval; @@ -195,8 +193,8 @@ profiler::enter_function (const std::string& fcn) { // The enter class will check and only call us if the profiler is active. - assert (enabled ()); - assert (m_call_tree); + panic_unless (enabled ()); + panic_unless (m_call_tree); // If there is already an active function, add to its time before // pushing the new one. @@ -229,21 +227,23 @@ { if (m_active_fcn) { - assert (m_call_tree); - // FIXME: This assert statements doesn't make sense if profile() is called - // from within a function hierarchy to begin with. See bug #39587. - //assert (m_active_fcn != m_call_tree); + panic_unless (m_call_tree); + // FIXME: This panic_unless statements doesn't make sense if profile() + // is called from within a function hierarchy to begin with. + // See bug #39587. + // panic_unless (m_active_fcn != m_call_tree); - // Usually, if we are disabled this function is not even called. But the - // call disabling the profiler is an exception. So also check here + // Usually, if we are disabled this function is not even called. But + // the call disabling the profiler is an exception. So also check here // and only record the time if enabled. if (enabled ()) add_current_time (); fcn_index_map::iterator pos = m_fcn_index.find (fcn); - // FIXME: This assert statements doesn't make sense if profile() is called - // from within a function hierarchy to begin with. See bug #39587. - //assert (pos != m_fcn_index.end ()); + // FIXME: This panic_unless statements doesn't make sense if profile() + // is called from within a function hierarchy to begin with. + // See bug #39587. + // panic_unless (pos != m_fcn_index.end ()); m_active_fcn = m_active_fcn->exit (pos->second); // If this was an "inner call", we resume executing the parent function diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/profiler.h --- a/libinterp/parse-tree/profiler.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/profiler.h Sun Apr 03 11:30:26 2022 -0400 @@ -185,7 +185,8 @@ // Each function we see in the profiler is given a unique index (which // simply counts starting from 1). We thus have to map profiler-names to - // those indices. For all other stuff, we identify functions by their index. + // those indices. For all other stuff, we identify functions by their + // index. typedef std::vector function_set; typedef std::map fcn_index_map; @@ -198,7 +199,8 @@ tree_node *m_call_tree; tree_node *m_active_fcn; - // Store last timestamp we had, when the currently active function was called. + // Store last timestamp we had, when the currently active function was + // called. double m_last_time; // These are private as only the unwind-protecting inner class enter diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-binop.h --- a/libinterp/parse-tree/pt-binop.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-binop.h Sun Apr 03 11:30:26 2022 -0400 @@ -76,7 +76,8 @@ void mark_braindead_shortcircuit (void) { - if (m_etype == octave_value::op_el_and || m_etype == octave_value::op_el_or) + if (m_etype == octave_value::op_el_and + || m_etype == octave_value::op_el_or) { m_eligible_for_braindead_shortcircuit = true; diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-classdef.cc --- a/libinterp/parse-tree/pt-classdef.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-classdef.cc Sun Apr 03 11:30:26 2022 -0400 @@ -61,10 +61,9 @@ // part of an index expression. It is also not an identifier in // the syntax tree but we need to handle it as if it were. So // call the function here. - octave_function *f = tmp.function_value (true); - assert (f); + panic_unless (f); return f->call (tw, nargout); } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-colon.cc --- a/libinterp/parse-tree/pt-colon.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-colon.cc Sun Apr 03 11:30:26 2022 -0400 @@ -42,7 +42,8 @@ tree_colon_expression *new_ce = new tree_colon_expression (m_base ? m_base->dup (scope) : nullptr, m_limit ? m_limit->dup (scope) : nullptr, - m_increment ? m_increment->dup (scope) : nullptr, + m_increment ? m_increment->dup (scope) + : nullptr, line (), column ()); new_ce->copy_base (*this); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Sun Apr 03 11:30:26 2022 -0400 @@ -107,7 +107,7 @@ }; debugger (interpreter& interp, std::size_t level) - : m_interpreter (interp), m_level (level), m_debug_frame (0), + : m_interpreter (interp), m_level (level), m_execution_mode (EX_NORMAL), m_in_debug_repl (false) { } @@ -134,7 +134,6 @@ interpreter& m_interpreter; std::size_t m_level; - std::size_t m_debug_frame; execution_mode m_execution_mode; bool m_in_debug_repl; }; @@ -3495,7 +3494,7 @@ if (user_function.is_special_expr ()) { - assert (cmd_list->length () == 1); + panic_if (cmd_list->length () != 1); tree_statement *stmt = cmd_list->front (); @@ -4309,11 +4308,11 @@ { if (m_dbstep_flag == 1 || is_end_of_fcn_or_script) { - // We get here if we are doing a "dbstep" or a "dbstep N" and the - // count has reached 1 so that we must stop and return to debug - // prompt. Alternatively, "dbstep N" has been used but the end - // of the frame has been reached so we stop at the last line and - // return to prompt. + // We get here if we are doing a "dbstep" or a "dbstep N" and + // the count has reached 1 so that we must stop and return to + // debug prompt. Alternatively, "dbstep N" has been used but + // the end of the frame has been reached so we stop at the last + // line and return to prompt. break_on_this_statement = true; } @@ -5120,7 +5119,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} max_recursion_depth () @deftypefnx {} {@var{old_val} =} max_recursion_depth (@var{new_val}) -@deftypefnx {} {} max_recursion_depth (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} max_recursion_depth (@var{new_val}, "local") Query or set the internal limit on the number of times a function may be called recursively. @@ -5155,7 +5154,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} whos_line_format () @deftypefnx {} {@var{old_val} =} whos_line_format (@var{new_val}) -@deftypefnx {} {} whos_line_format (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} whos_line_format (@var{new_val}, "local") Query or set the format string used by the command @code{whos}. A full format string is: @@ -5236,7 +5235,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} silent_functions () @deftypefnx {} {@var{old_val} =} silent_functions (@var{new_val}) -@deftypefnx {} {} silent_functions (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} silent_functions (@var{new_val}, "local") Query or set the internal variable that controls whether internal output from a function is suppressed. @@ -5270,7 +5269,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} string_fill_char () @deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val}) -@deftypefnx {} {} string_fill_char (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val}, "local") Query or set the internal variable used to pad all rows of a character matrix to the same length. @@ -5319,7 +5318,7 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PS4 () @deftypefnx {} {@var{old_val} =} PS4 (@var{new_val}) -@deftypefnx {} {} PS4 (@var{new_val}, "local") +@deftypefnx {} {@var{old_val} =} PS4 (@var{new_val}, "local") Query or set the character string used to prefix output produced when echoing commands is enabled. diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-exp.h --- a/libinterp/parse-tree/pt-exp.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-exp.h Sun Apr 03 11:30:26 2022 -0400 @@ -91,7 +91,8 @@ int paren_count (void) const { return m_num_parens; } - bool is_postfix_indexed (void) const { return (m_postfix_index_type != '\0'); } + bool is_postfix_indexed (void) const + { return (m_postfix_index_type != '\0'); } char postfix_index (void) const { return m_postfix_index_type; } diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-idx.cc --- a/libinterp/parse-tree/pt-idx.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-idx.cc Sun Apr 03 11:30:26 2022 -0400 @@ -346,7 +346,7 @@ { octave_value_list retval; - assert (! m_args.empty ()); + panic_if (m_args.empty ()); auto p_args = m_args.begin (); auto p_arg_nm = m_arg_nm.begin (); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-pr-code.cc --- a/libinterp/parse-tree/pt-pr-code.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-pr-code.cc Sun Apr 03 11:30:26 2022 -0400 @@ -1203,7 +1203,7 @@ void tree_print_code::indent (void) { - assert (m_curr_print_indent_level >= 0); + panic_unless (m_curr_print_indent_level >= 0); if (m_beginning_of_line) { diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-select.h --- a/libinterp/parse-tree/pt-select.h Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-select.h Sun Apr 03 11:30:26 2022 -0400 @@ -45,7 +45,8 @@ public: tree_if_clause (int l = -1, int c = -1) - : tree (l, c), m_expr (nullptr), m_list (nullptr), m_lead_comm (nullptr) { } + : tree (l, c), m_expr (nullptr), m_list (nullptr), m_lead_comm (nullptr) + { } tree_if_clause (tree_statement_list *sl, comment_list *lc = nullptr, int l = -1, int c = -1) @@ -130,7 +131,8 @@ tree_if_command (tree_if_command_list *lst, comment_list *lc, comment_list *tc, int l = -1, int c = -1) - : tree_command (l, c), m_list (lst), m_lead_comm (lc), m_trail_comm (tc) { } + : tree_command (l, c), m_list (lst), m_lead_comm (lc), m_trail_comm (tc) + { } // No copying! @@ -170,7 +172,8 @@ public: tree_switch_case (int l = -1, int c = -1) - : tree (l, c), m_label (nullptr), m_list (nullptr), m_lead_comm (nullptr) { } + : tree (l, c), m_label (nullptr), m_list (nullptr), m_lead_comm (nullptr) + { } tree_switch_case (tree_statement_list *sl, comment_list *lc = nullptr, int l = -1, int c = -1) diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/pt-tm-const.cc --- a/libinterp/parse-tree/pt-tm-const.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/pt-tm-const.cc Sun Apr 03 11:30:26 2022 -0400 @@ -608,7 +608,8 @@ { // Optimize all scalars case. TYPE result (m_dv); - assert (static_cast (result.numel ()) == row.length ()); + panic_unless (static_cast (result.numel ()) + == row.length ()); octave_idx_type i = 0; for (const auto& elt : row) result(i++) = octave_value_extract (elt); diff -r 0a1aec50a0c8 -r 960909469245 libinterp/parse-tree/token.cc --- a/libinterp/parse-tree/token.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/parse-tree/token.cc Sun Apr 03 11:30:26 2022 -0400 @@ -29,6 +29,7 @@ #include +#include "error.h" #include "token.h" namespace octave @@ -95,14 +96,14 @@ std::string token::text (void) const { - assert (m_type_tag == string_token); + panic_if (m_type_tag != string_token); return *m_tok_info.m_str; } octave_value token::number (void) const { - assert (m_type_tag == numeric_token); + panic_if (m_type_tag != numeric_token); return *m_tok_info.m_num; } @@ -115,21 +116,21 @@ token::end_tok_type token::ettype (void) const { - assert (m_type_tag == ettype_token); + panic_if (m_type_tag != ettype_token); return m_tok_info.m_et; } std::string token::superclass_method_name (void) const { - assert (m_type_tag == scls_name_token); + panic_if (m_type_tag != scls_name_token); return m_tok_info.m_superclass_info->m_method_name; } std::string token::superclass_class_name (void) const { - assert (m_type_tag == scls_name_token); + panic_if (m_type_tag != scls_name_token); return m_tok_info.m_superclass_info->m_class_name; } diff -r 0a1aec50a0c8 -r 960909469245 liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/system/lo-sysdep.cc Sun Apr 03 11:30:26 2022 -0400 @@ -382,6 +382,30 @@ #endif } + std::FILE * + fopen_tmp (const std::string& name, const std::string& mode) + { +#if defined (OCTAVE_USE_WINDOWS_API) + + // Append "D" to the mode string to indicate that this is a temporary + // file that should be deleted when the last open handle is closed. + std::string tmp_mode = mode + "D"; + + return std::fopen (name.c_str (), tmp_mode.c_str ()); + +#else + + std::FILE *fptr = std::fopen (name.c_str (), mode.c_str ()); + + // From gnulib: This relies on the Unix semantics that a file is not + // really removed until it is closed. + octave_unlink_wrapper (name.c_str ()); + + return fptr; + +#endif + } + std::fstream fstream (const std::string& filename, const std::ios::openmode mode) { @@ -699,17 +723,19 @@ = (oct_ascii_dir + file_ops::dir_sep_str () + crypto::hash ("SHA1", orig_file_name)); + // FIXME: This is just to check if the file exists. Use a more efficient + // method. std::string abs_filename_hash = canonicalize_file_name (filename_hash); if (! abs_filename_hash.empty ()) sys::unlink (filename_hash); - wchar_t w_filename_hash[filename_hash.length ()+1] = {0}; + // At this point, we know that we have only ASCII characters. + // So instead of converting, just copy the characters to std::wstring. + std::wstring w_filename_hash (filename_hash.begin (), + filename_hash.end ()); - for (std::size_t i=0; i < filename_hash.length (); i++) - w_filename_hash[i] = filename_hash.at (i); - - if (CreateHardLinkW (w_filename_hash, w_orig_file_name, nullptr)) + if (CreateHardLinkW (w_filename_hash.c_str (), w_orig_file_name, nullptr)) return filename_hash; #else diff -r 0a1aec50a0c8 -r 960909469245 liboctave/system/lo-sysdep.h --- a/liboctave/system/lo-sysdep.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/system/lo-sysdep.h Sun Apr 03 11:30:26 2022 -0400 @@ -54,6 +54,9 @@ extern OCTAVE_API std::FILE * fopen (const std::string& name, const std::string& mode); + extern OCTAVE_API std::FILE * + fopen_tmp (const std::string& name, const std::string& mode); + extern OCTAVE_API std::fstream fstream (const std::string& name, const std::ios::openmode mode = std::ios::in | std::ios::out); diff -r 0a1aec50a0c8 -r 960909469245 liboctave/system/oct-env.cc --- a/liboctave/system/oct-env.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/system/oct-env.cc Sun Apr 03 11:30:26 2022 -0400 @@ -207,11 +207,12 @@ std::string env::do_get_temp_directory (void) const { - std::string tempd; + std::string tempd = do_getenv ("TMPDIR"); #if defined (__MINGW32__) || defined (_MSC_VER) - tempd = do_getenv ("TEMP"); + if (tempd.empty ()) + tempd = do_getenv ("TEMP"); if (tempd.empty ()) tempd = do_getenv ("TMP"); @@ -228,7 +229,8 @@ #else - tempd = do_getenv ("TMP"); + if (tempd.empty ()) + tempd = do_getenv ("TMP"); #if defined (P_tmpdir) if (tempd.empty ()) diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/f2c-main.c --- a/liboctave/util/f2c-main.c Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1996-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#include - -/* Dummy Fortran main declaration, needed in order to link to some - Fortran libraries. See the AC_F77_DUMMY_MAIN macro documentation. - This function should never be called. */ - -#if defined (F77_DUMMY_MAIN) -# if defined (__cplusplus) -extern "C" -# endif -int F77_DUMMY_MAIN () { assert (0); return 1; } -#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/f77-dummy-main.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/util/f77-dummy-main.cc Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 1996-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include + +// Dummy Fortran main declaration, needed in order to link to some +// Fortran libraries. See the AC_F77_DUMMY_MAIN macro documentation. +// This function should never be called. + +#if defined (F77_DUMMY_MAIN) + +extern "C" +int +F77_DUMMY_MAIN (void) +{ + assert (0); + + return 1; +} + +#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/lo-array-errwarn.cc --- a/liboctave/util/lo-array-errwarn.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/lo-array-errwarn.cc Sun Apr 03 11:30:26 2022 -0400 @@ -301,21 +301,6 @@ "matrix singular to machine precision, rcond = %g", rcond); } } - - // DEPRECATED in Octave 6. - - // Complain of an index that is out of range, but we don't know matrix size - void - err_index_out_of_range (int nd, int dim, octave_idx_type idx, - octave_idx_type ext) - { - // The dim_vector setting here doesn't really make sense. However, - // this function has been deprecated and will be removed in version - // 8, so there's no need to attempt to fix it. - - throw out_of_range (std::to_string (idx), nd, dim, ext, - dim_vector (1, 1, 1, 1, 1, 1, 1)); - } } /* Tests in test/index.tst */ diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/lo-array-errwarn.h --- a/liboctave/util/lo-array-errwarn.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/lo-array-errwarn.h Sun Apr 03 11:30:26 2022 -0400 @@ -131,13 +131,6 @@ err_index_out_of_range (int ndims, int dim, octave_idx_type idx, octave_idx_type ext, const dim_vector& dv); -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) - OCTAVE_DEPRECATED (6, "use err_index_out_of_range (int, int, octave_idx_type, octave_idx_type, const dim_vector&) instead") - OCTAVE_NORETURN extern OCTAVE_API void - err_index_out_of_range (int ndims, int dim, octave_idx_type idx, - octave_idx_type ext); -#endif - OCTAVE_NORETURN extern OCTAVE_API void err_del_index_out_of_range (bool is1d, octave_idx_type iext, octave_idx_type ext); diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/lo-cutils.c --- a/liboctave/util/lo-cutils.c Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2000-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#include -#include - -#include "lo-cutils.h" - -OCTAVE_API void -octave_qsort (void *base, size_t n, size_t size, - int (*cmp) (const void *, const void *)) -{ - qsort (base, n, size, cmp); -} - -OCTAVE_API int -octave_strcasecmp (const char *s1, const char *s2) -{ - return strcasecmp (s1, s2); -} - -OCTAVE_API int -octave_strncasecmp (const char *s1, const char *s2, size_t n) -{ - return strncasecmp (s1, s2, n); -} diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/lo-cutils.h --- a/liboctave/util/lo-cutils.h Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2012-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -#if ! defined (octave_lo_cutils_h) -#define octave_lo_cutils_h 1 - -#include "octave-config.h" - -#if defined (__cplusplus) -#include -using std::size_t; -extern "C" { -#else -#include -#endif - -OCTAVE_API void -octave_qsort (void *base, size_t n, size_t size, - int (*cmp) (const void *, const void *)); - -OCTAVE_API int -octave_strcasecmp (const char *s1, const char *s2); - -OCTAVE_API int -octave_strncasecmp (const char *s1, const char *s2, size_t n); - -#if defined (__cplusplus) -} -#endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/lo-utils.h --- a/liboctave/util/lo-utils.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/lo-utils.h Sun Apr 03 11:30:26 2022 -0400 @@ -33,7 +33,6 @@ #include #include -#include "lo-cutils.h" #include "oct-cmplx.h" #include "quit.h" diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/module.mk --- a/liboctave/util/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -9,7 +9,6 @@ %reldir%/file-info.h \ %reldir%/glob-match.h \ %reldir%/lo-array-errwarn.h \ - %reldir%/lo-cutils.h \ %reldir%/lo-hash.h \ %reldir%/lo-ieee.h \ %reldir%/lo-regexp.h \ @@ -51,8 +50,6 @@ %reldir%/r1mach.f UTIL_C_SRC = \ - %reldir%/f2c-main.c \ - %reldir%/lo-cutils.c \ %reldir%/blaswrap.c \ %reldir%/f77-fcn.c \ %reldir%/lo-error.c \ @@ -64,6 +61,7 @@ %reldir%/cmd-edit.cc \ %reldir%/cmd-hist.cc \ %reldir%/data-conv.cc \ + %reldir%/f77-dummy-main.cc \ %reldir%/file-info.cc \ %reldir%/glob-match.cc \ %reldir%/kpse.cc \ @@ -75,6 +73,7 @@ %reldir%/quit.cc \ %reldir%/oct-atomic.c \ %reldir%/oct-base64.cc \ + %reldir%/oct-cmplx.cc \ %reldir%/oct-glob.cc \ %reldir%/oct-inttypes.cc \ %reldir%/oct-mutex.cc \ diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/oct-cmplx.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/util/oct-cmplx.cc Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,201 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 1995-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include + +// For complex-complex and complex-real comparisons, Octave uses the following +// ordering: compare absolute values first; if they match, compare phase +// angles. This is partially inconsistent with M*b, which compares complex +// numbers only by their real parts; OTOH, it uses the same definition for +// max/min and sort. The abs/arg comparison is definitely more useful (the +// other one is emulated rather trivially), so let's be consistent and use that +// all over. + +// The standard C library function arg() returns [-pi,pi], which creates a +// non-unique representation for numbers along the negative real axis branch +// cut. Change this to principal value (-pi,pi] by mapping -pi to pi. + +// General templated code for all (double, float) complex operators +#define DEF_COMPLEXR_COMP(OP, OPS) \ + template \ + bool operator OP (const std::complex& a, const std::complex& b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ + OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ + if (ay == static_cast (-M_PI)) \ + { \ + if (by != static_cast (-M_PI)) \ + return static_cast (M_PI) OP by; \ + } \ + else if (by == static_cast (-M_PI)) \ + { \ + return ay OP static_cast (M_PI); \ + } \ + return ay OP by; \ + } \ + else \ + return ax OPS bx; \ + } \ + template \ + bool operator OP (const std::complex& a, T b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ + if (ay == static_cast (-M_PI)) \ + return static_cast (M_PI) OP 0; \ + return ay OP 0; \ + } \ + else \ + return ax OPS bx; \ + } \ + template \ + bool operator OP (T a, const std::complex& b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ + if (by == static_cast (-M_PI)) \ + return 0 OP static_cast (M_PI); \ + return 0 OP by; \ + } \ + else \ + return ax OPS bx; \ + } + +#if defined (__APPLE__) + // Apple specializations + + // FIXME: Apple's math library chooses to return a different value for + // std::arg with floats than the constant static_cast (M_PI). + // Work around this obtuse behavior by providing the constant A_PI which + // is Apple's definition of the constant PI for float variables. + // The template code for doubles is the same as that for UNIX platforms. + // Use C++ template specialization to add specific functions for float + // values that make use of A_PI. + + // Apple version of PI in single precision +# define A_PI 3.1415925025939941f + +# define INST_SPECIAL_COMPLEXR_COMP(OP, OPS) \ + template <> OCTAVE_API \ + bool operator OP (const std::complex& a, \ + const std::complex& b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ + OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ + if (ay == -A_PI) \ + { \ + if (by != -A_PI) \ + return static_cast (M_PI) OP by; \ + } \ + else if (by == -A_PI) \ + { \ + return ay OP static_cast (M_PI); \ + } \ + return ay OP by; \ + } \ + else \ + return ax OPS bx; \ + } \ + template <> OCTAVE_API \ + bool operator OP (const std::complex& a, float b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ + if (ay == -A_PI) \ + return static_cast (M_PI) OP 0; \ + return ay OP 0; \ + } \ + else \ + return ax OPS bx; \ + } \ + template <> OCTAVE_API \ + bool operator OP (float a, const std::complex& b) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ + OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ + if (ax == bx) \ + { \ + OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ + if (by == -A_PI) \ + return 0 OP static_cast (M_PI); \ + return 0 OP by; \ + } \ + else \ + return ax OPS bx; \ + } + +#endif + +DEF_COMPLEXR_COMP (>, >) +DEF_COMPLEXR_COMP (<, <) +DEF_COMPLEXR_COMP (>=, >) +DEF_COMPLEXR_COMP (<=, <) + + +// Instantiate templates + +# define INST_COMPLEXR_COMP(OP, T) \ + template OCTAVE_API bool operator OP (const std::complex& a, \ + const std::complex& b); \ + template OCTAVE_API bool operator OP (const std::complex& a, T b); \ + template OCTAVE_API bool operator OP (T a, const std::complex& b); + +INST_COMPLEXR_COMP (>, double) +INST_COMPLEXR_COMP (<, double) +INST_COMPLEXR_COMP (>=, double) +INST_COMPLEXR_COMP (<=, double) + +#if defined (__APPLE__) +INST_SPECIAL_COMPLEXR_COMP (>, >) +INST_SPECIAL_COMPLEXR_COMP (<, <) +INST_SPECIAL_COMPLEXR_COMP (>=, >) +INST_SPECIAL_COMPLEXR_COMP (<=, <) +#else +INST_COMPLEXR_COMP (>, float) +INST_COMPLEXR_COMP (<, float) +INST_COMPLEXR_COMP (>=, float) +INST_COMPLEXR_COMP (<=, float) +#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/oct-cmplx.h --- a/liboctave/util/oct-cmplx.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/oct-cmplx.h Sun Apr 03 11:30:26 2022 -0400 @@ -33,206 +33,34 @@ typedef std::complex Complex; typedef std::complex FloatComplex; -// For complex-complex and complex-real comparisons, Octave uses the following -// ordering: compare absolute values first; if they match, compare phase -// angles. This is partially inconsistent with M*b, which compares complex -// numbers only by their real parts; OTOH, it uses the same definition for -// max/min and sort. The abs/arg comparison is definitely more useful (the -// other one is emulated rather trivially), so let's be consistent and use that -// all over. - -// The standard C library function arg() returns [-pi,pi], which creates a -// non-unique representation for numbers along the negative real axis branch -// cut. Change this to principal value (-pi,pi] by mapping -pi to pi. - -#if ! defined (__APPLE__) +// template declaration +# define DECL_COMPLEXR_COMP(OP) \ + template bool operator OP (const std::complex& a, \ + const std::complex& b); \ + template bool operator OP (const std::complex& a, T b); \ + template bool operator OP (T a, const std::complex& b); - // General templated code for all (double, float) complex operators -# define DEF_COMPLEXR_COMP(OP, OPS) \ - template \ - inline bool operator OP (const std::complex& a, \ - const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ - OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ - if (ay == static_cast (-M_PI)) \ - { \ - if (by != static_cast (-M_PI)) \ - return static_cast (M_PI) OP by; \ - } \ - else if (by == static_cast (-M_PI)) \ - { \ - return ay OP static_cast (M_PI); \ - } \ - return ay OP by; \ - } \ - else \ - return ax OPS bx; \ - } \ - template \ - inline bool operator OP (const std::complex& a, T b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ - if (ay == static_cast (-M_PI)) \ - return static_cast (M_PI) OP 0; \ - return ay OP 0; \ - } \ - else \ - return ax OPS bx; \ - } \ - template \ - inline bool operator OP (T a, const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ - if (by == static_cast (-M_PI)) \ - return 0 OP static_cast (M_PI); \ - return 0 OP by; \ - } \ - else \ - return ax OPS bx; \ - } - -#else - // Apple specialization. - - // FIXME: Apple's math library chooses to return a different value for - // std::arg with floats than the constant static_cast (M_PI). - // Work around this obtuse behavior by providing the constant A_PI which - // is Apple's definition of the constant PI for float variables. - // The template code for doubles is the same as that for UNIX platforms. - // Use C++ template specialization to add specific functions for float - // values that make use of A_PI. - - // Apple version of PI -# define A_PI 3.1415925025939941f +DECL_COMPLEXR_COMP(>) +DECL_COMPLEXR_COMP(<) +DECL_COMPLEXR_COMP(>=) +DECL_COMPLEXR_COMP(<=) -# define DEF_COMPLEXR_COMP(OP, OPS) \ - template \ - inline bool operator OP (const std::complex& a, \ - const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ - OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ - if (ay == static_cast (-M_PI)) \ - { \ - if (by != static_cast (-M_PI)) \ - return static_cast (M_PI) OP by; \ - } \ - else if (by == static_cast (-M_PI)) \ - { \ - return ay OP static_cast (M_PI); \ - } \ - return ay OP by; \ - } \ - else \ - return ax OPS bx; \ - } \ - template \ - inline bool operator OP (const std::complex& a, T b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ - if (ay == static_cast (-M_PI)) \ - return static_cast (M_PI) OP 0; \ - return ay OP 0; \ - } \ - else \ - return ax OPS bx; \ - } \ - template \ - inline bool operator OP (T a, const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ - if (by == static_cast (-M_PI)) \ - return 0 OP static_cast (M_PI); \ - return 0 OP by; \ - } \ - else \ - return ax OPS bx; \ - } \ - template <> \ - inline bool operator OP (const std::complex& a, \ - const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ - OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ - if (ay == -A_PI) \ - { \ - if (by != -A_PI) \ - return static_cast (M_PI) OP by; \ - } \ - else if (by == -A_PI) \ - { \ - return ay OP static_cast (M_PI); \ - } \ - return ay OP by; \ - } \ - else \ - return ax OPS bx; \ - } \ - template <> \ - inline bool operator OP (const std::complex& a, float b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ - if (ay == -A_PI) \ - return static_cast (M_PI) OP 0; \ - return ay OP 0; \ - } \ - else \ - return ax OPS bx; \ - } \ - template <> \ - inline bool operator OP (float a, const std::complex& b) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ - OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ - if (ax == bx) \ - { \ - OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ - if (by == -A_PI) \ - return 0 OP static_cast (M_PI); \ - return 0 OP by; \ - } \ - else \ - return ax OPS bx; \ - } +// extern template instantiations +# define EXT_INST_COMPLEXR_COMP(OP, T) \ + extern template OCTAVE_API \ + bool operator OP (const std::complex& a, const std::complex& b); \ + extern template OCTAVE_API \ + bool operator OP (const std::complex& a, T b); \ + extern template OCTAVE_API \ + bool operator OP (T a, const std::complex& b); + +EXT_INST_COMPLEXR_COMP(>, double) +EXT_INST_COMPLEXR_COMP(>, float) +EXT_INST_COMPLEXR_COMP(<, double) +EXT_INST_COMPLEXR_COMP(<, float) +EXT_INST_COMPLEXR_COMP(>=, double) +EXT_INST_COMPLEXR_COMP(>=, float) +EXT_INST_COMPLEXR_COMP(<=, double) +EXT_INST_COMPLEXR_COMP(<=, float) #endif - -DEF_COMPLEXR_COMP (>, >) -DEF_COMPLEXR_COMP (<, <) -DEF_COMPLEXR_COMP (<=, <) -DEF_COMPLEXR_COMP (>=, >) - -#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/oct-string.cc --- a/liboctave/util/oct-string.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/oct-string.cc Sun Apr 03 11:30:26 2022 -0400 @@ -607,6 +607,90 @@ return num_replacements; } +typedef octave::string::codecvt_u8::InternT InternT; +typedef octave::string::codecvt_u8::ExternT ExternT; +typedef octave::string::codecvt_u8::StateT StateT; + +typename std::codecvt::result +octave::string::codecvt_u8::do_out + (StateT& /* state */, + const InternT* from, const InternT* from_end, const InternT*& from_next, + ExternT* to, ExternT* to_end, ExternT*& to_next) const +{ + if (from_end < from) + return std::codecvt::noconv; + + // Convert from UTF-8 to output encoding + std::size_t srclen = (from_end-from) * sizeof (InternT); + std::size_t lengthp = (to_end-to) * sizeof (ExternT); + const uint8_t *u8_str = reinterpret_cast (from); + char *enc_str = octave_u8_conv_to_encoding (m_enc.c_str (), u8_str, srclen, + &lengthp); + + size_t max = to_end - to; + if (lengthp < max) + max = lengthp; + + // copy conversion result to output + // FIXME: Handle incomplete UTF-8 characters at end of buffer. + std::copy_n (enc_str, max, to); + ::free (enc_str); + + from_next = from + srclen; + to_next = to + max; + + return std::codecvt::ok; +} + +typename std::codecvt::result +octave::string::codecvt_u8::do_in + (StateT& /* state */, + const ExternT* from, const ExternT* from_end, const ExternT*& from_next, + InternT* to, InternT* to_end, InternT*& to_next) const +{ + // Convert from input encoding to UTF-8 + std::size_t srclen = (from_end-from) * sizeof (ExternT); + std::size_t lengthp = (to_end-to) * sizeof (InternT); + const char *enc_str = reinterpret_cast (from); + uint8_t *u8_str = octave_u8_conv_from_encoding (m_enc.c_str (), + enc_str, srclen, &lengthp); + + std::size_t max = to_end - to; + if (lengthp < max) + max = lengthp; + + // copy conversion result to output + std::copy_n (u8_str, max, to); + ::free (u8_str); + + from_next = from + srclen; + to_next = to + max; + + return std::codecvt::ok; +} + +int octave::string::codecvt_u8::do_length + (StateT& /* state */, const ExternT *src, const ExternT *end, + std::size_t max) const +{ + // return number of external characters that produce MAX internal ones + std::size_t srclen = end-src; + std::size_t offsets[srclen]; + std::size_t lengthp = max; + octave_u8_conv_from_encoding_offsets (m_enc.c_str (), src, srclen, offsets, + &lengthp); + std::size_t ext_char; + for (ext_char = 0; ext_char < srclen; ext_char++) + { + if (offsets[ext_char] != static_cast (-1) + && offsets[ext_char] >= max) + break; + } + + return ext_char; +} + + template std::string rational_approx (T val, int len) diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/oct-string.h --- a/liboctave/util/oct-string.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/oct-string.h Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,8 @@ #include "octave-config.h" +#include + #include "oct-cmplx.h" namespace octave @@ -155,6 +157,94 @@ extern OCTAVE_API unsigned int u8_validate (const std::string& who, std::string& in_string, const u8_fallback_type type = U8_REPLACEMENT_CHAR); + + + template + struct + deletable_facet : Facet + { + template + deletable_facet (Args&& ...args) + : Facet (std::forward (args)...) + { } + + // destructor needs to be public + ~deletable_facet () {} + }; + + class + OCTAVE_API + codecvt_u8 : public std::codecvt + { + public: + + // No copying! + + codecvt_u8 (codecvt_u8 &) = delete; + + codecvt_u8& operator = (codecvt_u8 &) = delete; + + codecvt_u8 (const std::string &enc) + : m_enc (enc) + { } + + virtual ~codecvt_u8 () { } + + typedef char InternT; + typedef char ExternT; + typedef std::mbstate_t StateT; + + private: + + OCTAVE_API + typename std::codecvt::result + do_out (StateT& state, + const InternT* from, const InternT* from_end, const InternT*& from_next, + ExternT* to, ExternT* to_end, ExternT*& to_next) const; + + OCTAVE_API + typename std::codecvt::result + do_in (StateT& state, + const ExternT* from, const ExternT* from_end, const ExternT*& from_next, + InternT* to, InternT* to_end, InternT*& to_next) const; + + typename std::codecvt::result + do_unshift (StateT& /* state */, ExternT* to, ExternT* /* to_end */, + ExternT*& to_next) const + { + // FIXME: What is the correct thing to unshift? + // Just reset? + to_next = to; + + return std::codecvt::ok; + } + + int do_encoding () const throw () + { + // return 0 because UTF-8 encoding is variable length + return 0; + } + + bool do_always_noconv () const throw () + { + // return false to indicate non-identity conversion + return false; + } + + OCTAVE_API int + do_length (StateT& state, const ExternT *src, const ExternT *end, + std::size_t max) const; + + int do_max_length() const throw () + { + // For UTF-8, a maximum of 4 bytes are needed for one character. + return 4; + } + + std::string m_enc; + + }; + } } diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/quit.cc --- a/liboctave/util/quit.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/quit.cc Sun Apr 03 11:30:26 2022 -0400 @@ -37,32 +37,11 @@ sig_atomic_t octave_interrupt_state = 0; -// DEPRECATED in Octave 6. -// This variable should never have been public. -sig_atomic_t octave_exception_state = 0; -// Use this variable internally until the functions that use it can be -// removed. -static sig_atomic_t internal_exception_state; - volatile sig_atomic_t octave_signal_caught = 0; void (*octave_signal_hook) (void) = nullptr; void (*octave_interrupt_hook) (void) = nullptr; -// DEPRECATED in Octave 6. -void (*octave_bad_alloc_hook) (void) = nullptr; - -// The octave_exception enum values were DEPRECATED in Octave 6. -// Use these values internally until the functions that use them can be -// removed. -enum octave_internal_exception -{ - octave_internal_no_exception = 0, - octave_internal_exec_exception = 1, - octave_internal_alloc_exception = 3, - octave_internal_quit_exception = 4 -}; - namespace octave { std::string execution_exception::stack_trace (void) const @@ -130,61 +109,3 @@ throw octave::interrupt_exception (); } } - -// DEPRECATED in Octave 6 -void -octave_throw_interrupt_exception (void) -{ - if (octave_interrupt_hook) - octave_interrupt_hook (); - - throw octave::interrupt_exception (); -} - -// DEPRECATED in Octave 6 -void -octave_throw_execution_exception (void) -{ - // FIXME: would a hook function be useful here? - - internal_exception_state = octave_internal_exec_exception; - - throw octave::execution_exception (); -} - -// DEPRECATED in Octave 6 -void -octave_throw_bad_alloc (void) -{ - internal_exception_state = octave_internal_alloc_exception; - - throw std::bad_alloc (); -} - -// DEPRECATED in Octave 6 -void -octave_rethrow_exception (void) -{ - if (octave_interrupt_state) - { - octave_interrupt_state = -1; - - throw octave::interrupt_exception (); - } - else - { - switch (internal_exception_state) - { - case octave_internal_exec_exception: - throw octave::execution_exception (); - break; - - case octave_internal_alloc_exception: - throw std::bad_alloc (); - break; - - default: - break; - } - } -} diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/quit.h --- a/liboctave/util/quit.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/quit.h Sun Apr 03 11:30:26 2022 -0400 @@ -224,29 +224,10 @@ */ extern OCTAVE_API sig_atomic_t octave_interrupt_state; -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "'octave_exception_state' is an obsolete internal variable; any uses should be removed") -extern OCTAVE_API sig_atomic_t octave_exception_state; -#endif - extern OCTAVE_API volatile sig_atomic_t octave_signal_caught; extern OCTAVE_API void octave_handle_signal (void); -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "use 'throw octave::interrupt_exception' instead") -OCTAVE_NORETURN extern OCTAVE_API void octave_throw_interrupt_exception (void); - -OCTAVE_DEPRECATED (6, "use 'throw octave::execution_exception' instead") -OCTAVE_NORETURN extern OCTAVE_API void octave_throw_execution_exception (void); - -OCTAVE_DEPRECATED (6, "use 'throw std::bad_alloc' instead") -OCTAVE_NORETURN extern OCTAVE_API void octave_throw_bad_alloc (void); - -OCTAVE_DEPRECATED (6, "use 'throw' instead") -extern OCTAVE_API void octave_rethrow_exception (void); -#endif - #if defined (__cplusplus) inline void octave_quit (void) @@ -312,11 +293,6 @@ extern OCTAVE_API void (*octave_signal_hook) (void); extern OCTAVE_API void (*octave_interrupt_hook) (void); -#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) -OCTAVE_DEPRECATED (6, "'octave_bad_alloc_hook' is obsolete and no longer used") -extern OCTAVE_API void (*octave_bad_alloc_hook) (void); #endif #endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/util/str-vec.cc --- a/liboctave/util/str-vec.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/util/str-vec.cc Sun Apr 03 11:30:26 2022 -0400 @@ -244,7 +244,6 @@ for (octave_idx_type row = 0; row < nr; row++) { count = row; - octave_idx_type pos = 0; // Print the next row. @@ -264,7 +263,6 @@ octave_idx_type spaces_to_pad = max_name_length - name_length; for (octave_idx_type i = 0; i < spaces_to_pad; i++) os << ' '; - pos += max_name_length; } os << "\n"; } diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/module.mk --- a/liboctave/wrappers/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/wrappers/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -24,12 +24,12 @@ %reldir%/set-program-name-wrapper.h \ %reldir%/signal-wrappers.h \ %reldir%/stat-wrappers.h \ + %reldir%/strcase-wrappers.h \ %reldir%/strdup-wrapper.h \ %reldir%/strftime-wrapper.h \ %reldir%/strmode-wrapper.h \ %reldir%/strptime-wrapper.h \ %reldir%/time-wrappers.h \ - %reldir%/tmpfile-wrapper.h \ %reldir%/uname-wrapper.h \ %reldir%/unicase-wrappers.h \ %reldir%/uniconv-wrappers.h \ @@ -67,12 +67,12 @@ %reldir%/set-program-name-wrapper.c \ %reldir%/signal-wrappers.c \ %reldir%/stat-wrappers.c \ + %reldir%/strcase-wrappers.c \ %reldir%/strdup-wrapper.c \ %reldir%/strftime-wrapper.c \ %reldir%/strmode-wrapper.c \ %reldir%/strptime-wrapper.c \ %reldir%/time-wrappers.c \ - %reldir%/tmpfile-wrapper.c \ %reldir%/uname-wrapper.c \ %reldir%/unicase-wrappers.c \ %reldir%/uniconv-wrappers.c \ diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/strcase-wrappers.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strcase-wrappers.c Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include + +#include "strcase-wrappers.h" + +OCTAVE_API int +octave_strcasecmp (const char *s1, const char *s2) +{ + return strcasecmp (s1, s2); +} + +OCTAVE_API int +octave_strncasecmp (const char *s1, const char *s2, size_t n) +{ + return strncasecmp (s1, s2, n); +} diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/strcase-wrappers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/strcase-wrappers.h Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if ! defined (octave_strcase_wrappers_h) +#define octave_strcase_wrappers_h 1 + +#include "octave-config.h" + +#if defined (__cplusplus) +#include +using std::size_t; +extern "C" { +#else +#include +#endif + +OCTAVE_API int +octave_strcasecmp (const char *s1, const char *s2); + +OCTAVE_API int +octave_strncasecmp (const char *s1, const char *s2, size_t n); + +#if defined (__cplusplus) +} +#endif + +#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/tmpfile-wrapper.c --- a/liboctave/wrappers/tmpfile-wrapper.c Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -// tmpfile may be provided by gnulib. We don't include gnulib headers -// directly in Octave's C++ source files to avoid problems that may be -// caused by the way that gnulib overrides standard library functions. - -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#include - -#include "tmpfile-wrapper.h" - -FILE * -octave_tmpfile_wrapper (void) -{ - return tmpfile (); -} diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/tmpfile-wrapper.h --- a/liboctave/wrappers/tmpfile-wrapper.h Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -#if ! defined (octave_tmpfile_wrapper_h) -#define octave_tmpfile_wrapper_h 1 - -#if defined __cplusplus -# include -#else -# include -#endif - -#if defined __cplusplus -extern "C" { -#endif - -// c++11 provides std::tmpfile but it appears to fail on 64-bit -// Windows systems. - -extern OCTAVE_API FILE * octave_tmpfile_wrapper (void); - -#if defined __cplusplus -} -#endif - -#endif diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/uniconv-wrappers.c --- a/liboctave/wrappers/uniconv-wrappers.c Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/wrappers/uniconv-wrappers.c Sun Apr 03 11:30:26 2022 -0400 @@ -72,6 +72,24 @@ src, srclen, NULL, NULL, lengthp); } +uint8_t * +octave_u8_conv_from_encoding_offsets + (const char *fromcode, const char *src, size_t srclen, + size_t *offsets, size_t *lengthp) +{ + return u8_conv_from_encoding (fromcode, iconveh_question_mark, + src, srclen, offsets, NULL, lengthp); +} + +char * +octave_u8_conv_to_encoding_offsets + (const char *tocode, const uint8_t *src, size_t srclen, + size_t *offsets, size_t *lengthp) +{ + return u8_conv_to_encoding (tocode, iconveh_question_mark, + src, srclen, offsets, NULL, lengthp); +} + char * u8_from_wchar (const wchar_t *wc) { diff -r 0a1aec50a0c8 -r 960909469245 liboctave/wrappers/uniconv-wrappers.h --- a/liboctave/wrappers/uniconv-wrappers.h Sun Apr 03 11:29:17 2022 -0400 +++ b/liboctave/wrappers/uniconv-wrappers.h Sun Apr 03 11:30:26 2022 -0400 @@ -57,6 +57,16 @@ octave_u32_conv_to_encoding_strict (const char *tocode, const uint32_t *src, size_t srclen, size_t *lengthp); +extern OCTAVE_API uint8_t * +octave_u8_conv_from_encoding_offsets + (const char *fromcode, const char *src, size_t srclen, + size_t *offsets, size_t *lengthp); + +extern OCTAVE_API char * +octave_u8_conv_to_encoding_offsets + (const char *tocode, const uint8_t *src, size_t srclen, + size_t *offsets, size_t *lengthp); + extern OCTAVE_API char * u8_from_wchar (const wchar_t *wc); extern OCTAVE_API wchar_t * u8_to_wchar (const char *u8_char); diff -r 0a1aec50a0c8 -r 960909469245 m4/acinclude.m4 --- a/m4/acinclude.m4 Sun Apr 03 11:29:17 2022 -0400 +++ b/m4/acinclude.m4 Sun Apr 03 11:30:26 2022 -0400 @@ -3240,7 +3240,7 @@ AC_DEFUN([OCTAVE_PROG_GHOSTSCRIPT], [ case "$canonical_host_type" in *-*-mingw* | *-*-msdosmsvc) - ac_octave_gs_names="gswin32c gs mgs" + ac_octave_gs_names="gs gswin32c gswin64c mgs" ;; *) ac_octave_gs_names="gs" diff -r 0a1aec50a0c8 -r 960909469245 m4/ax_cxx_compile_stdcxx.m4 --- a/m4/ax_cxx_compile_stdcxx.m4 Sun Apr 03 11:29:17 2022 -0400 +++ b/m4/ax_cxx_compile_stdcxx.m4 Sun Apr 03 11:30:26 2022 -0400 @@ -10,8 +10,8 @@ # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). +# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for +# the respective C++ standard version. # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. @@ -36,13 +36,14 @@ # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # Copyright (c) 2020 Jason Merrill +# Copyright (c) 2021 Jörn Heusipp # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 12 +#serial 14 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -51,6 +52,7 @@ m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], + [$1], [20], [ax_cxx_compile_alternatives="20"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], @@ -151,7 +153,6 @@ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) - dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], @@ -159,12 +160,24 @@ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) +dnl Test body for checking C++17 support + m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) +dnl Test body for checking C++20 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 +) + + dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ @@ -960,3 +973,33 @@ #endif // __cplusplus < 201703L ]]) + + +dnl Tests for new features in C++20 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 202002L + +#error "This is not a C++20 compiler" + +#else + +#include + +namespace cxx20 +{ + +// As C++20 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx20 + +#endif // __cplusplus < 202002L + +]]) diff -r 0a1aec50a0c8 -r 960909469245 oct-conf-post-private.in.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oct-conf-post-private.in.h Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,112 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 1993-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if ! defined (HAVE_DEV_T) +typedef short dev_t; +#endif + +#if ! defined (HAVE_INO_T) +typedef unsigned long ino_t; +#endif + +#if defined (_MSC_VER) +# define __WIN32__ 1 +# define WIN32 1 + /* missing parameters in macros */ +# pragma warning (disable: 4003) + /* missing implementations in template instantiation */ +# pragma warning (disable: 4996) + /* deprecated function names (FIXME: ???) */ +# pragma warning (disable: 4661) +#endif + +#if defined (__APPLE__) && defined (__MACH__) +# define OCTAVE_USE_OS_X_API 1 +#endif + +/* Silence deprecated API warning from Apple OS > 10.14 */ +#if defined (__APPLE__) && defined (__MACH__) && defined (HAVE_OPENGL) +# define GL_SILENCE_DEPRECATION 1 +#endif + +/* Define to 1 if we expect to have , Sleep, etc. */ +#if defined (__WIN32__) && ! defined (__CYGWIN__) +# define OCTAVE_USE_WINDOWS_API 1 +#endif + +#if defined (OCTAVE_USE_WINDOWS_API) +# define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 +#elif defined (__CYGWIN__) +# define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 +# define OCTAVE_HAVE_POSIX_FILESYSTEM 1 +#else +# define OCTAVE_HAVE_POSIX_FILESYSTEM 1 +#endif + +#if defined (__MINGW32__) + /* We need to include this header or __MSVCRT_VERSION__ might not be defined + to the correct value */ +# include <_mingw.h> +#endif +/* assume that Windows will support UTF-8 locales when using UCRT */ +#if defined (__MSVCRT_VERSION__) && __MSVCRT_VERSION__ == 0x0E00 +# define OCTAVE_HAVE_WINDOWS_UTF8_LOCALE 1 +#endif + +/* sigsetjmp is a macro, not a function. */ +#if defined (sigsetjmp) && defined (HAVE_SIGLONGJMP) +# define OCTAVE_HAVE_SIG_JUMP 1 +#endif + +/* To be able to use long doubles for 64-bit mixed arithmetics, we need + them at least 80 bits wide and we need roundl declared in math.h. + FIXME: Maybe substitute this by a more precise check in the future? */ +#if (SIZEOF_LONG_DOUBLE >= 10) && defined (HAVE_ROUNDL) +# define OCTAVE_INT_USE_LONG_DOUBLE +# if (SIZEOF_LONG_DOUBLE < 16 \ + && (defined __i386__ || defined __x86_64__) && defined __GNUC__) +# define OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED 1 +# endif +#endif + +/* Make all .oct file interpreter functions and methods static. */ +#define OCTAVE_USE_STATIC_DEFUN + +/* This macro is intended to be used only to enable inline functions or + typedefs that provide access to symbols that have been moved to the + octave namespace. It may be temporarily useful to define this macro + when moving a symbol to the octave namespace but it should not be + defined when building released versions of Octave, as building those + should not require deprecated symbols. It is defined in + octave-config.h, so users of Octave may continue to access symbols + using the deprecated names. */ +/* #undef OCTAVE_PROVIDE_DEPRECATED_SYMBOLS */ + +/* Tag indicating Octave's autoconf-generated config.h has been + included. This symbol is provided because autoconf-generated + config.h files do not define a multiple-inclusion guard. See also + the notes at the top of the generated octave-config.h file. */ + +#define OCTAVE_AUTOCONFIG_H_INCLUDED 1 diff -r 0a1aec50a0c8 -r 960909469245 oct-conf-post-public.in.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oct-conf-post-public.in.h Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,210 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 1993-2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (__cplusplus) +# include +#else +# include +#endif + +# define OCTAVE_NAMESPACE_BEGIN namespace octave { +# define OCTAVE_NAMESPACE_END } + +/* The C++ standard is evolving to allow attribute hints in a + compiler-independent manner. In C++ 2011 support for noreturn was + added. In C++ 2014 support for deprecated was added. The Octave + code base has been future-proofed by using macros of the form + OCTAVE_ATTRIBUTE_NAME in place of vendor specific attribute + mechanisms. As compilers evolve, the underlying implementation can + be changed with the macro definitions below. FIXME: Update macros + to use C++ standard attribute syntax when Octave moves to C++ 2011 + standard. */ + +#if defined (__GNUC__) + /* The following attributes are used with gcc and clang compilers. */ +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__ ("[" #ver "]: " msg))) +# else +# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__)) +# endif +# define HAVE_OCTAVE_DEPRECATED_ATTR 1 + +# define OCTAVE_NORETURN __attribute__ ((__noreturn__)) +# define HAVE_OCTAVE_NORETURN_ATTR 1 + +# define OCTAVE_UNUSED __attribute__ ((__unused__)) +# define HAVE_OCTAVE_UNUSED_ATTR 1 +#else +# define OCTAVE_DEPRECATED(ver, msg) +# define OCTAVE_NORETURN +# define OCTAVE_UNUSED + +/* # undef HAVE_OCTAVE_DEPRECATED_ATTR */ +/* # undef HAVE_OCTAVE_NORETURN_ATTR */ +/* # undef HAVE_OCTAVE_UNUSED_ATTR */ +#endif + +#if defined (__MINGW32__) + /* MinGW requires special handling due to different format specifiers + * on different platforms. The macro __MINGW_PRINTF_FORMAT maps to + * either gnu_printf or ms_printf depending on where we are compiling + * to avoid warnings on format specifiers that are legal. + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=1331349 */ +# if defined (__cplusplus) +# include +# else +# include +# endif + +# define OCTAVE_FORMAT_PRINTF(stringIndex, firstToCheck) \ + __attribute__ ((format (__MINGW_PRINTF_FORMAT, stringIndex, firstToCheck))) + +# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 +#elif defined (__GNUC__) + /* The following attributes are used with gcc and clang compilers. */ +# define OCTAVE_FORMAT_PRINTF(index, first) \ + __attribute__ ((__format__(printf, index, first))) + +# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 +#else +# define OCTAVE_FORMAT_PRINTF(index, first) + +/* # undef HAVE_OCTAVE_FORMAT_PRINTF_ATTR */ +#endif + +#if ! defined (OCTAVE_FALLTHROUGH) +# if defined (__cplusplus) && __cplusplus > 201402L +# define OCTAVE_FALLTHROUGH [[fallthrough]] +# elif defined (__GNUC__) && __GNUC__ < 7 +# define OCTAVE_FALLTHROUGH ((void) 0) +# else +# define OCTAVE_FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + +#if defined (__cplusplus) +template +static inline void +octave_unused_parameter (const T&) +{ } +#else +# define octave_unused_parameter(param) (void) param; +#endif + +#if defined (OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS) +# if defined (_WIN32) || defined (__CYGWIN__) +# if defined (__GNUC__) + /* GCC */ +# define OCTAVE_EXPORT __attribute__ ((dllexport)) +# define OCTAVE_IMPORT __attribute__ ((dllimport)) +# else + /* MSVC */ +# define OCTAVE_EXPORT __declspec(dllexport) +# define OCTAVE_IMPORT __declspec(dllimport) +# endif +# else + /* All other platforms. */ +# define OCTAVE_EXPORT __attribute__ ((visibility ("default"))) +# define OCTAVE_IMPORT +# endif +#else +# define OCTAVE_EXPORT +# define OCTAVE_IMPORT +#endif + +/* API macro for liboctave */ +#if defined (OCTAVE_DLL) +# define OCTAVE_API OCTAVE_EXPORT +#else +# define OCTAVE_API OCTAVE_IMPORT +#endif + +/* API macro for liboctinterp */ +#if defined (OCTINTERP_DLL) +# define OCTINTERP_API OCTAVE_EXPORT +#else +# define OCTINTERP_API OCTAVE_IMPORT +#endif + +/* API macro for the Array class in liboctave and liboctinterp */ +#if (defined (OCTAVE_DLL) || defined (OCTINTERP_DLL)) +# define OCTARRAY_API OCTAVE_EXPORT +#else +# define OCTARRAY_API OCTAVE_IMPORT +#endif + +/* API macro for libinterp/graphics */ +#if defined (OCTGRAPHICS_DLL) +# define OCTGRAPHICS_API OCTAVE_EXPORT +#else +# define OCTGRAPHICS_API OCTAVE_IMPORT +#endif + +/* API macro for libgui */ +#if defined (OCTGUI_DLL) +# define OCTGUI_API OCTAVE_EXPORT +#else +# define OCTGUI_API OCTAVE_IMPORT +#endif + +#if defined (OCTAVE_ENABLE_64) +# define OCTAVE_IDX_TYPE_FORMAT PRId64 +#else +# define OCTAVE_IDX_TYPE_FORMAT PRId32 +#endif + +#if OCTAVE_SIZEOF_F77_INT_TYPE == 8 +# define OCTAVE_F77_INT_TYPE_FORMAT PRId64 +#else +# define OCTAVE_F77_INT_TYPE_FORMAT PRId32 +#endif + +#define OCTAVE_HAVE_F77_INT_TYPE 1 + +/* time type in API is always 64 bits wide */ +#define OCTAVE_TIME_T int64_t + +#if defined (__cplusplus) && ! defined (OCTAVE_THREAD_LOCAL) +# define OCTAVE_THREAD_LOCAL +#endif + +typedef OCTAVE_IDX_TYPE octave_idx_type; +typedef OCTAVE_F77_INT_TYPE octave_f77_int_type; + +/* Backward compatibility */ + +#if defined (OCTAVE_ENABLE_64) +# define USE_64_BIT_IDX_T 1 +#endif + +#if defined (OCTAVE_ENABLE_OPENMP) +# define HAVE_OPENMP 1 +#endif + +#if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE) +# define OCTAVE_FLOAT_TRUNCATE volatile +#else +# define OCTAVE_FLOAT_TRUNCATE +#endif diff -r 0a1aec50a0c8 -r 960909469245 oct-conf-post.in.h --- a/oct-conf-post.in.h Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1993-2022 The Octave Project Developers -// -// See the file COPYRIGHT.md in the top-level directory of this -// distribution or . -// -// This file is part of Octave. -// -// Octave is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Octave is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see -// . -// -//////////////////////////////////////////////////////////////////////// - -# define OCTAVE_NAMESPACE_BEGIN namespace octave { -# define OCTAVE_NAMESPACE_END } - -/* The C++ standard is evolving to allow attribute hints in a - compiler-independent manner. In C++ 2011 support for noreturn was - added. In C++ 2014 support for deprecated was added. The Octave - code base has been future-proofed by using macros of the form - OCTAVE_ATTRIBUTE_NAME in place of vendor specific attribute - mechanisms. As compilers evolve, the underlying implementation can - be changed with the macro definitions below. FIXME: Update macros - to use C++ standard attribute syntax when Octave moves to C++ 2011 - standard. */ - -#if defined (__GNUC__) - /* The following attributes are used with gcc and clang compilers. */ -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__ ("[" #ver "]: " msg))) -# else -# define OCTAVE_DEPRECATED(ver, msg) __attribute__ ((__deprecated__)) -# endif -# define HAVE_OCTAVE_DEPRECATED_ATTR 1 - -# define OCTAVE_NORETURN __attribute__ ((__noreturn__)) -# define HAVE_OCTAVE_NORETURN_ATTR 1 - -# define OCTAVE_UNUSED __attribute__ ((__unused__)) -# define HAVE_OCTAVE_UNUSED_ATTR 1 -#else -# define OCTAVE_DEPRECATED(ver, msg) -# define OCTAVE_NORETURN -# define OCTAVE_UNUSED -#endif - -#if defined (__MINGW32__) - /* MinGW requires special handling due to different format specifiers - * on different platforms. The macro __MINGW_PRINTF_FORMAT maps to - * either gnu_printf or ms_printf depending on where we are compiling - * to avoid warnings on format specifiers that are legal. - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=1331349 */ -# if defined (__cplusplus) -# include -# else -# include -# endif - -# define OCTAVE_FORMAT_PRINTF(stringIndex, firstToCheck) \ - __attribute__ ((format (__MINGW_PRINTF_FORMAT, stringIndex, firstToCheck))) - -# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 -#elif defined (__GNUC__) - /* The following attributes are used with gcc and clang compilers. */ -# define OCTAVE_FORMAT_PRINTF(index, first) \ - __attribute__ ((__format__(printf, index, first))) - -# define HAVE_OCTAVE_FORMAT_PRINTF_ATTR 1 -#else -# define OCTAVE_FORMAT_PRINTF(index, first) - -/* # undef HAVE_OCTAVE_FORMAT_PRINTF_ATTR */ -#endif - -#if ! defined (OCTAVE_FALLTHROUGH) -# if defined (__cplusplus) && __cplusplus > 201402L -# define OCTAVE_FALLTHROUGH [[fallthrough]] -# elif defined (__GNUC__) && __GNUC__ < 7 -# define OCTAVE_FALLTHROUGH ((void) 0) -# else -# define OCTAVE_FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - -/* This macro is intended to be used only to enable inline functions or - typedefs that provide access to symbols that have been moved to the - octave namespace. It may be temporarily useful to define this macro - when moving a symbol to the octave namespace but it should not be - defined when building released versions of Octave, as building those - should not require deprecated symbols. It is defined in - octave-config.h, so users of Octave may continue to access symbols - using the deprecated names. */ -/* #undef OCTAVE_PROVIDE_DEPRECATED_SYMBOLS */ - -#if defined (__cplusplus) -template -static inline void -octave_unused_parameter (const T&) -{ } -#else -# define octave_unused_parameter(param) (void) param; -#endif - -#if ! defined (HAVE_DEV_T) -typedef short dev_t; -#endif - -#if ! defined (HAVE_INO_T) -typedef unsigned long ino_t; -#endif - -#if defined (_MSC_VER) -# define __WIN32__ 1 -# define WIN32 1 - /* missing parameters in macros */ -# pragma warning (disable: 4003) - /* missing implementations in template instantiation */ -# pragma warning (disable: 4996) - /* deprecated function names (FIXME: ???) */ -# pragma warning (disable: 4661) -#endif - -#if defined (__APPLE__) && defined (__MACH__) -# define OCTAVE_USE_OS_X_API 1 -#endif - -/* Silence deprecated API warning from Apple OS > 10.14 */ -#if defined (__APPLE__) && defined (__MACH__) && defined (HAVE_OPENGL) -# define GL_SILENCE_DEPRECATION 1 -#endif - -/* Define to 1 if we expect to have , Sleep, etc. */ -#if defined (__WIN32__) && ! defined (__CYGWIN__) -# define OCTAVE_USE_WINDOWS_API 1 -#endif - -#if defined (OCTAVE_USE_WINDOWS_API) -# define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 -#elif defined (__CYGWIN__) -# define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 -# define OCTAVE_HAVE_POSIX_FILESYSTEM 1 -#else -# define OCTAVE_HAVE_POSIX_FILESYSTEM 1 -#endif - -#if defined (__MINGW32__) - /* We need to include this header or __MSVCRT_VERSION__ might not be defined - to the correct value */ -# include <_mingw.h> -#endif -/* assume that Windows will support UTF-8 locales when using UCRT */ -#if defined (__MSVCRT_VERSION__) && __MSVCRT_VERSION__ == 0x0E00 -# define OCTAVE_HAVE_WINDOWS_UTF8_LOCALE 1 -#endif - -/* sigsetjmp is a macro, not a function. */ -#if defined (sigsetjmp) && defined (HAVE_SIGLONGJMP) -# define OCTAVE_HAVE_SIG_JUMP 1 -#endif - -/* To be able to use long doubles for 64-bit mixed arithmetics, we need - them at least 80 bits wide and we need roundl declared in math.h. - FIXME: Maybe substitute this by a more precise check in the future? */ -#if (SIZEOF_LONG_DOUBLE >= 10) && defined (HAVE_ROUNDL) -# define OCTAVE_INT_USE_LONG_DOUBLE -# if (SIZEOF_LONG_DOUBLE < 16 \ - && (defined __i386__ || defined __x86_64__) && defined __GNUC__) -# define OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED 1 -# endif -#endif - -/* oct-dlldefs.h */ - -#if defined (OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS) -# if defined (_WIN32) || defined (__CYGWIN__) -# if defined (__GNUC__) - /* GCC */ -# define OCTAVE_EXPORT __attribute__ ((dllexport)) -# define OCTAVE_IMPORT __attribute__ ((dllimport)) -# else - /* MSVC */ -# define OCTAVE_EXPORT __declspec(dllexport) -# define OCTAVE_IMPORT __declspec(dllimport) -# endif -# else - /* All other platforms. */ -# define OCTAVE_EXPORT __attribute__ ((visibility ("default"))) -# define OCTAVE_IMPORT -# endif -#else -# define OCTAVE_EXPORT -# define OCTAVE_IMPORT -#endif - -/* API macro for liboctave */ -#if defined (OCTAVE_DLL) -# define OCTAVE_API OCTAVE_EXPORT -#else -# define OCTAVE_API OCTAVE_IMPORT -#endif - -/* API macro for liboctinterp */ -#if defined (OCTINTERP_DLL) -# define OCTINTERP_API OCTAVE_EXPORT -#else -# define OCTINTERP_API OCTAVE_IMPORT -#endif - -/* API macro for the Array class in liboctave and liboctinterp */ -#if (defined (OCTAVE_DLL) || defined (OCTINTERP_DLL)) -# define OCTARRAY_API OCTAVE_EXPORT -#else -# define OCTARRAY_API OCTAVE_IMPORT -#endif - -/* API macro for libinterp/graphics */ -#if defined (OCTGRAPHICS_DLL) -# define OCTGRAPHICS_API OCTAVE_EXPORT -#else -# define OCTGRAPHICS_API OCTAVE_IMPORT -#endif - -/* API macro for libgui */ -#if defined (OCTGUI_DLL) -# define OCTGUI_API OCTAVE_EXPORT -#else -# define OCTGUI_API OCTAVE_IMPORT -#endif - -/* Backward compatibility */ - -#if defined (OCTAVE_ENABLE_64) -# define USE_64_BIT_IDX_T 1 -#endif - -#if defined (OCTAVE_ENABLE_OPENMP) -# define HAVE_OPENMP 1 -#endif - -#if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE) -# define OCTAVE_FLOAT_TRUNCATE volatile -#else -# define OCTAVE_FLOAT_TRUNCATE -#endif - -#if defined (__cplusplus) -# include -#else -# include -#endif - -typedef OCTAVE_IDX_TYPE octave_idx_type; - -#if defined (OCTAVE_ENABLE_64) -# define OCTAVE_IDX_TYPE_FORMAT PRId64 -#else -# define OCTAVE_IDX_TYPE_FORMAT PRId32 -#endif - -typedef OCTAVE_F77_INT_TYPE octave_f77_int_type; - -#if OCTAVE_SIZEOF_F77_INT_TYPE == 8 -# define OCTAVE_F77_INT_TYPE_FORMAT PRId64 -#else -# define OCTAVE_F77_INT_TYPE_FORMAT PRId32 -#endif - -#define OCTAVE_HAVE_F77_INT_TYPE 1 - -/* time type in API is always 64 bits wide */ -#define OCTAVE_TIME_T int64_t - -#if defined (__cplusplus) && ! defined (OCTAVE_THREAD_LOCAL) -# define OCTAVE_THREAD_LOCAL -#endif - -/* Make all .oct file interpreter functions and methods static. */ -#define OCTAVE_USE_STATIC_DEFUN - -/* Tag indicating Octave's autoconf-generated config.h has been - included. This symbol is provided because autoconf-generated - config.h files do not define a multiple-inclusion guard. See also - the notes at the top of the generated octave-config.h file. */ - -#define OCTAVE_AUTOCONFIG_H_INCLUDED 1 diff -r 0a1aec50a0c8 -r 960909469245 scripts/+containers/Map.m --- a/scripts/+containers/Map.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/+containers/Map.m Sun Apr 03 11:30:26 2022 -0400 @@ -305,6 +305,7 @@ ## -*- texinfo -*- ## @deftypefn {} {} Map.remove (@var{keySet}) + ## @deftypefn {} {@var{newMap) =} Map.remove (@var{keySet}) ## Remove the list of key/value pairs specified by a cell array of keys ## @var{keySet} from the map. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/ascii.m --- a/scripts/@ftp/ascii.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/ascii.m Sun Apr 03 11:30:26 2022 -0400 @@ -32,6 +32,7 @@ ## representation. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/binary, @ftp/ftp} ## @end deftypefn function ascii (f) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/binary.m --- a/scripts/@ftp/binary.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/binary.m Sun Apr 03 11:30:26 2022 -0400 @@ -31,6 +31,7 @@ ## representation to the local representation. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/ascii, @ftp/ftp} ## @end deftypefn function binary (f) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/cd.m --- a/scripts/@ftp/cd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/cd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cd (@var{f}) +## @deftypefn {} {@var{cwd} =} cd (@var{f}) ## @deftypefnx {} {} cd (@var{f}, @var{path}) +## @deftypefnx {} {@var{new_cwd} =} cd (@var{f}, @var{path}) ## Get or set the remote directory on the FTP connection @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. @@ -36,6 +37,7 @@ ## ## If the directory does not exist, an error message is printed and the ## working directory is not changed. +## @seealso{@ftp/dir, @ftp/ftp} ## @end deftypefn function path = cd (f, path) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/close.m --- a/scripts/@ftp/close.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/close.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Close the FTP connection represented by the FTP object @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/ftp} ## @end deftypefn function close (f) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/delete.m --- a/scripts/@ftp/delete.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/delete.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Delete the remote file @var{file} over the FTP connection @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/rmdir, @ftp/rename, @ftp/ftp} ## @end deftypefn function delete (f, file) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/dir.m --- a/scripts/@ftp/dir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/dir.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,16 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{lst} =} dir (@var{f}) +## @deftypefn {} {} dir (@var{f}) +## @deftypefnx {} {@var{lst} =} dir (@var{f}) ## List the current directory in verbose form for the FTP connection @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## +## If the optional output @var{lst} is requested return a struct array +## with one entry per file with the fields @code{name}, @code{date}, +## @code{bytes}, @code{isdir}, @code{datenum}. +## @seealso{@ftp/cd, @ftp/mkdir, @ftp/rmdir, @ftp/ftp} ## @end deftypefn function lst = dir (f) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/ftp.m --- a/scripts/@ftp/ftp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/ftp.m Sun Apr 03 11:30:26 2022 -0400 @@ -50,6 +50,8 @@ ## @item rmdir @tab Remove remote directory ## @end multitable ## +## @seealso{@ftp/ascii, @ftp/binary, @ftp/cd, @ftp/close, @ftp/delete, +## @ftp/dir, @ftp/mget, @ftp/mkdir, @ftp/mput, @ftp/rename, @ftp/rmdir} ## @end deftypefn function obj = ftp (host = "", username = "anonymous", password = "") diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/mget.m --- a/scripts/@ftp/mget.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/mget.m Sun Apr 03 11:30:26 2022 -0400 @@ -38,6 +38,7 @@ ## If a third string argument @var{target} is given, then it must indicate ## the path to the local destination directory. @var{target} may be a ## relative or absolute path. +## @seealso{@ftp/mput, @ftp/ftp} ## @end deftypefn function mget (f, file, target = "") diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/mkdir.m --- a/scripts/@ftp/mkdir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/mkdir.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Create the remote directory @var{path}, over the FTP connection @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/rmdir, @ftp/ftp} ## @end deftypefn function mkdir (f, path) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/mput.m --- a/scripts/@ftp/mput.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/mput.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} mput (@var{f}, @var{file}) +## @deftypefn {} {} mput (@var{f}, @var{file}) +## @deftypefnx {} {@var{file_list} =} mput (@var{f}, @var{file}) ## Upload the local file @var{file} into the current remote directory on the ## FTP connection @var{f}. ## -## @var{f} is an FTP object returned by the ftp function. +## @var{f} is an FTP object returned by the @code{ftp} function. ## ## The argument @var{file} is passed through the @code{glob} function and any ## files that match the wildcards in @var{file} will be uploaded. +## +## The optional output argument @var{file_list} contains a cell array of +## strings with the names of the uploaded files. +## @seealso{@ftp/mget, @ftp/mkdir, @ftp/ftp} ## @end deftypefn function retval = mput (f, file) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/rename.m --- a/scripts/@ftp/rename.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/rename.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,8 @@ ## Rename or move the remote file or directory @var{oldname} to @var{newname}, ## over the FTP connection @var{f}. ## -## @var{f} is an FTP object returned by the ftp function. +## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/delete, @ftp/rmdir, @ftp/ftp} ## @end deftypefn function rename (f, oldname, newname) diff -r 0a1aec50a0c8 -r 960909469245 scripts/@ftp/rmdir.m --- a/scripts/@ftp/rmdir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/@ftp/rmdir.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Remove the remote directory @var{path}, over the FTP connection @var{f}. ## ## @var{f} is an FTP object returned by the @code{ftp} function. +## @seealso{@ftp/delete, @ftp/mkdir, @ftp/rename, @ftp/ftp} ## @end deftypefn function rmdir (f, path) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/__get_properties__.m --- a/scripts/audio/@audioplayer/__get_properties__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/__get_properties__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,51 +24,44 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{properties} =} __get_properties__ (@var{player}) +## @deftypefn {} {@var{props} =} __get_properties__ (@var{player}) ## Return a struct containing all named properties of the audioplayer object ## @var{player}. +## @seealso{@audioplayer/get, @audioplayer/set, @audioplayer/audioplayer} ## @end deftypefn function props = __get_properties__ (player) - if (nargin < 1) - print_usage (); - endif - - if (__player_isplaying__ (struct (player).player)) - running = "on"; - else - running = "off"; - endif + hplayer = struct (player).player; props = struct ("BitsPerSample", - __player_get_nbits__ (struct (player).player), + __player_get_nbits__ (hplayer), "CurrentSample", - __player_get_sample_number__ (struct (player).player), + __player_get_sample_number__ (hplayer), "DeviceID", - __player_get_id__ (struct (player).player), + __player_get_id__ (hplayer), "NumberOfChannels", - __player_get_channels__ (struct (player).player), + __player_get_channels__ (hplayer), "Running", - running, + ifelse (__player_isplaying__ (hplayer), "on", "off"), "SampleRate", - __player_get_fs__ (struct (player).player), + __player_get_fs__ (hplayer), "TotalSamples", - __player_get_total_samples__ (struct (player).player), + __player_get_total_samples__ (hplayer), "Tag", - __player_get_tag__ (struct (player).player), + __player_get_tag__ (hplayer), "Type", "audioplayer", "UserData", - __player_get_userdata__ (struct (player).player)); + __player_get_userdata__ (hplayer)); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/audioplayer.m --- a/scripts/audio/@audioplayer/audioplayer.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/audioplayer.m Sun Apr 03 11:30:26 2022 -0400 @@ -32,16 +32,35 @@ ## Create an audioplayer object that will play back data @var{y} at sample ## rate @var{fs}. ## -## The optional arguments @var{nbits}, and @var{id} specify the bit depth and -## player device id, respectively. Device IDs may be found using the -## audiodevinfo function. Given an audioplayer object, use the data from the -## object to initialize the player. +## The signal @var{y} can be a vector (mono audio) or a two-dimensional array +## (multi-channel audio). +## +## The optional arguments @var{nbits} and @var{id} specify the number of bits +## per sample and player device ID, respectively. Device IDs may be found +## using the @code{audiodevinfo} function. +## +## Given an audiorecorder object @var{recorder}, use the data from the object +## to initialize the player. +## +## The list of actions for an audioplayer object are shown below. All +## methods require an audioplayer object as the first argument. ## -## The signal @var{y} can be a vector or a two-dimensional array. +## @multitable @columnfractions 0.2 0.75 +## @headitem Method @tab Description +## @item get @tab Read audioplayer property values +## @item isplaying @tab Return true if audioplayer is playing +## @item pause @tab Pause audioplayer playback +## @item play @tab Play audio stored in audioplayer object w/o blocking +## @item playblocking @tab Play audio stored in audioplayer object +## @item resume @tab Resume playback after pause +## @item set @tab Write audioplayer property values +## @item stop @tab Stop playback +## @end multitable ## -## The following example will create an audioplayer object that will play -## back one second of white noise at 44100 sample rate using 8 bits per -## sample. +## Example +## +## Create an audioplayer object that will play back one second of white noise +## at 44100 sample rate using 8 bits per sample. ## ## @example ## @group @@ -50,8 +69,13 @@ ## play (player); ## @end group ## @end example +## @seealso{@audioplayer/get, @audioplayer/isplaying, @audioplayer/pause, +## @audioplayer/play, @audioplayer/playblocking, @audioplayer/resume, +## @audioplayer/set, @audioplayer/stop, audiodevinfo, +## @audiorecorder/audiorecorder, sound, soundsc} ## @end deftypefn +################################################################################ ## FIXME: callbacks don't work properly, apparently because portaudio ## will execute the callbacks in a separate thread, and calling Octave ## functions in a separate thread which is likely to cause trouble with @@ -85,6 +109,7 @@ ## # play for as long as you want ## stop (player); ## @end group +################################################################################ function player = audioplayer (varargin) @@ -100,15 +125,22 @@ elseif (nargin == 2) recorder = varargin{1}; data = getaudiodata (recorder); - player = audioplayer (data, get (recorder, "SampleRate"), - get (recorder, "BitsPerSample"), varargin{2}); + player = audioplayer (data, + get (recorder, "SampleRate"), + get (recorder, "BitsPerSample"), + varargin{2}); else print_usage (); endif else - if (ischar (varargin{1})) - varargin{1} = str2func (varargin{1}); + ## FIXME: Prevent use of callbacks until situation is fixed. + if (is_function_handle (varargin{1}) || ischar (varargin{1})) + error ("audioplayer: first argument cannot be a callback function"); endif + ## FIXME: Uncomment when callback functions are supported. + ## if (ischar (varargin{1})) + ## varargin{1} = str2func (varargin{1}); + ## endif player.player = __player_audioplayer__ (varargin{:}); player = class (player, "audioplayer"); endif @@ -117,6 +149,7 @@ %!demo +%! ## Generate 2 seconds of white noise and play it back with a pause %! fs = 44100; %! audio = 0.25 * randn (2, 2*fs); %! player = audioplayer (audio, fs); @@ -144,37 +177,34 @@ %! assert (player2.TotalSamples, 44100); %!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 -%! audio = 0.25 * randn (2, 44100); -%! fs = 44100; -%! player = audioplayer (audio, fs); -%! set (player, {"SampleRate", "Tag", "UserData"}, {8000, "tag", [1, 2; 3, 4]}); -%! assert (player.SampleRate, 8000); -%! assert (player.Tag, "tag"); -%! assert (player.UserData, [1, 2; 3, 4]); - -%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 -%! audio = 0.25 * randn (2, 44100); +%! audio = randn (8000, 1); %! fs = 44100; -%! player = audioplayer (audio, fs); -%! settable = set (player); -%! settable.SampleRate = 8000; -%! settable.Tag = "tag"; -%! settable.UserData = [1, 2; 3, 4]; -%! set (player, settable); -%! assert (player.SampleRate, 8000); -%! assert (player.Tag, "tag"); -%! assert (player.UserData, [1, 2; 3, 4]); +%! player = audioplayer (audio, fs, 16); +%! assert (player.NumberOfChannels, 1); +%! assert (player.SampleRate, 44100); +%! assert (player.BitsPerSample, 16); + +## FIXME: Callbacks do not work currently (5/31/2020) so BIST tests commented. +%!#function [sound, status] = callback (samples) +%!# sound = rand (samples, 2) - 0.5; +%!# status = 0; +%!#endfunction -%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 -%! audio = 0.25 * randn (2, 44100); -%! fs = 44100; -%! player = audioplayer (audio, fs); -%! player.SampleRate = 8000; -%! player.Tag = "tag"; -%! player.UserData = [1, 2; 3, 4]; -%! properties = get (player, {"SampleRate", "Tag", "UserData"}); -%! assert (properties, {8000, "tag", [1, 2; 3, 4]}); +%!#testif HAVE_PORTAUDIO +%!# player = audioplayer (@callback, 44100); +%!# play (player); +%!# pause (2); +%!# stop (player); +%!# assert (1); +%!#testif HAVE_PORTAUDIO +%!# player = audioplayer ("callback", 44100, 16); +%!# play (player); +%!# pause (2); +%!# stop (player); +%!# assert (1); + +## Verify input validation %!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 %! ## Verify nbits option only accepts 8, 16, 24 %! fail ("audioplayer (1, 8e3, 9)", "NBITS must be 8, 16, or 24"); @@ -183,22 +213,5 @@ %! player = audioplayer (1, 8e3, 16); %! player = audioplayer (1, 8e3, 24); -## FIXME: Callbacks do not work currently (5/31/2020) so BIST tests commented. -#%!function [sound, status] = callback (samples) -#%! sound = rand (samples, 2) - 0.5; -#%! status = 0; -#%!endfunction - -#%!testif HAVE_PORTAUDIO -#%! player = audioplayer (@callback, 44100); -#%! play (player); -#%! pause (2); -#%! stop (player); -#%! assert (1); - -#%!testif HAVE_PORTAUDIO -#%! player = audioplayer ("callback", 44100, 16); -#%! play (player); -#%! pause (2); -#%! stop (player); -#%! assert (1); +%!error audioplayer (@ls, 8000) +%!error audioplayer ("ls", 8000) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/disp.m --- a/scripts/audio/@audioplayer/disp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/disp.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,17 +26,18 @@ ## -*- texinfo -*- ## @deftypefn {} {} disp (@var{player}) ## Display the properties of the audioplayer object @var{player}. +## @seealso{@audioplayer/audioplayer} ## @end deftypefn function disp (player) - if (nargin < 1) - print_usage (); - endif - printf ("audioplayer object with properties:\n\n"); for [val, prop] = __get_properties__ (player) printf (" %s = ", prop), disp (val); endfor endfunction + + +## No tests possible/needed for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/get.m --- a/scripts/audio/@audioplayer/get.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/get.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,38 +25,74 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{value} =} get (@var{player}, @var{name}) +## @deftypefnx {} {@var{values} =} get (@var{player}, @lbracechar{}@var{name1}, @var{name2}, @dots{}@rbracechar{}) ## @deftypefnx {} {@var{values} =} get (@var{player}) ## Return the @var{value} of the property identified by @var{name}. ## ## If @var{name} is a cell array return the values of the properties ## identified by the elements of the cell array. Given only the player -## object, return a scalar structure with values of all properties of -## @var{player}. The field names of the structure correspond to property +## object, return a scalar structure with values for all properties of +## @var{player}. The field names of the structure correspond to the property ## names. +## @seealso{@audioplayer/set, @audioplayer/audioplayer} ## @end deftypefn -function retval = get (varargin) +function value = get (player, name) - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - properties = __get_properties__ (varargin{1}); + properties = __get_properties__ (player); if (nargin == 1) - retval = properties; + value = properties; elseif (nargin == 2) - pnames = varargin{2}; + pnames = name; if (ischar (pnames)) - retval = getfield (properties, pnames); + value = getproperty (properties, pnames); elseif (iscellstr (pnames)) - retval = cell (size (pnames)); + value = cell (size (pnames)); for i = 1:numel (pnames) - retval{i} = getfield (properties, pnames{i}); + value{i} = getproperty (properties, pnames{i}); endfor else - error ("@audioplayer/get: invalid NAME argument"); + error ("@audioplayer/get: NAME must be a string or cell array of strings"); endif endif endfunction + +function value = getproperty (properties, pname) + + persistent valid_props; + if (isempty (valid_props)) + valid_props = { "BitsPerSample", "CurrentSample", "DeviceID", ... + "NumberOfChannels", "Running", "SampleRate", ... + "TotalSamples", "Tag", "Type", "UserData" }; + endif + + idx = find (strcmpi (pname, valid_props), 1); + if (isempty (idx)) + error ('@audioplayer/get: "%s" is not a valid property name', pname); + endif + + value = properties.(valid_props{idx}); + +endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! props = get (player); +%! assert (fieldnames (props), {"BitsPerSample"; "CurrentSample"; "DeviceID"; +%! "NumberOfChannels"; "Running"; "SampleRate"; "TotalSamples"; "Tag"; +%! "Type"; "UserData"}); +%! value = get (player, "Running"); +%! assert (value, "off"); +%! value = get (player, "ruNNIng"); # test case insensitivity +%! assert (value, "off"); +%! values = get (player, {"SampleRate", "BitsPerSample", "TotalSamples"}); +%! assert (values, {44100, 8, 2}); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! fail ("get (player, 1)", "NAME must be a string"); +%! fail ('get (player, "foobar")', '"foobar" is not a valid property'); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/isplaying.m --- a/scripts/audio/@audioplayer/isplaying.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/isplaying.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,17 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isplaying (@var{player}) +## @deftypefn {} {@var{tf} =} isplaying (@var{player}) ## Return true if the audioplayer object @var{player} is currently playing back ## audio and false otherwise. +## @seealso{@audioplayer/pause, @audioplayer/audioplayer} ## @end deftypefn -function result = isplaying (player) +function tf = isplaying (player) - if (nargin < 1) - print_usage (); - endif - - result = __player_isplaying__ (struct (player).player); + tf = __player_isplaying__ (struct (player).player); endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! assert (isplaying (player), false); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/pause.m --- a/scripts/audio/@audioplayer/pause.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/pause.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,15 +25,16 @@ ## -*- texinfo -*- ## @deftypefn {} {} pause (@var{player}) -## Pause the audioplayer @var{player}. +## Pause playback of audioplayer @var{player}. +## @seealso{@audioplayer/resume, @audioplayer/stop, @audioplayer/audioplayer} ## @end deftypefn function pause (player) - if (nargin < 1) - print_usage (); - endif - __player_pause__ (struct (player).player); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/play.m --- a/scripts/audio/@audioplayer/play.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/play.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,20 +26,30 @@ ## -*- texinfo -*- ## @deftypefn {} {} play (@var{player}) ## @deftypefnx {} {} play (@var{player}, @var{start}) -## @deftypefnx {} {} play (@var{player}, @var{limits}) +## @deftypefnx {} {} play (@var{player}, [@var{start}, @var{end}]) ## Play audio stored in the audioplayer object @var{player} without blocking. ## -## Given optional argument start, begin playing at @var{start} samples in the -## recording. Given a two-element vector @var{limits}, begin and end playing -## at the number of samples specified by the elements of the vector. +## If the optional argument @var{start} is provided, begin playing +## @var{start} samples in to the recording. +## +## If the optional argument @var{end} is provided, stop playing at +## @var{end} samples into the recording. +## @seealso{@audioplayer/playblocking, @audioplayer/pause, @audioplayer/stop, +## @audioplayer/audioplayer} ## @end deftypefn -function play (varargin) +function play (player, length) + + hplayer = struct (player).player; - if (nargin < 1 || nargin > 2) - print_usage (); + if (nargin == 1) + __player_play__ (hplayer); + else + __player_play__ (hplayer, length); endif - __player_play__ (struct (varargin{1}).player, varargin{2:end}); +endfunction + -endfunction +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/playblocking.m --- a/scripts/audio/@audioplayer/playblocking.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/playblocking.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,20 +26,29 @@ ## -*- texinfo -*- ## @deftypefn {} {} playblocking (@var{player}) ## @deftypefnx {} {} playblocking (@var{player}, @var{start}) -## @deftypefnx {} {} playblocking (@var{player}, @var{limits}) -## Play audio stored in the audioplayer object @var{player} with blocking. +## @deftypefnx {} {} playblocking (@var{player}, [@var{start}, @var{end}]) +## Play audio stored in the audioplayer object @var{player} with blocking +## (synchronous I/O). ## -## Given optional argument start, begin playing at @var{start} samples in the -## recording. Given a two-element vector @var{limits}, begin and end playing -## at the number of samples specified by the elements of the vector. +## If the optional argument @var{start} is provided, begin playing +## @var{start} samples into the recording. +## +## If the optional argument @var{end} is provided, stop playing at +## @var{end} samples into the recording. +## @seealso{@audioplayer/play, @audioplayer/pause, @audioplayer/stop, +## @audioplayer/audioplayer} ## @end deftypefn -function playblocking (varargin) +function playblocking (player, length) - if (nargin < 1 || nargin > 2) + if (nargin != 2) print_usage (); endif - __player_playblocking__ (struct (varargin{1}).player, varargin{2:end}); + __player_playblocking__ (struct (player).player, length); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/resume.m --- a/scripts/audio/@audioplayer/resume.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/resume.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,14 +26,15 @@ ## -*- texinfo -*- ## @deftypefn {} {} resume (@var{player}) ## Resume playback for the paused audioplayer object @var{player}. +## @seealso{@audioplayer/pause, @audioplayer/stop, @audioplayer/audioplayer} ## @end deftypefn function resume (player) - if (nargin < 1) - print_usage (); - endif - __player_resume__ (struct (player).player); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/set.m --- a/scripts/audio/@audioplayer/set.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/set.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,60 +25,94 @@ ## -*- texinfo -*- ## @deftypefn {} {} set (@var{player}, @var{name}, @var{value}) -## @deftypefnx {} {} set (@var{player}, @var{properties}) +## @deftypefnx {} {} set (@var{player}, @var{name_cell}, @var{value_cell}) +## @deftypefnx {} {} set (@var{player}, @var{properties_struct}) ## @deftypefnx {} {@var{properties} =} set (@var{player}) ## Set the value of property specified by @var{name} to a given @var{value}. ## ## If @var{name} and @var{value} are cell arrays, set each property to the -## corresponding value. Given a structure of @var{properties} with fields +## corresponding value. Given a structure of properties with fields ## corresponding to property names, set the value of those properties to the -## field values. Given only the audioplayer object, return a structure of -## settable properties. +## corresponding field values. Given only an audioplayer object, return a +## structure of configurable properties (i.e., writeable properties). +## @seealso{@audioplayer/get, @audioplayer/audioplayer} ## @end deftypefn -function settable = set (varargin) +function properties = set (player, varargin) - if (nargin < 1 || nargin > 3) + if (nargin > 3) print_usage (); endif - player = struct (varargin{1}).player; + hplayer = struct (player).player; if (nargin == 1) - settable.SampleRate = {}; - settable.Tag = {}; - settable.UserData = {}; + properties = struct ("SampleRate", {{}}, "Tag", {{}}, "UserData", {{}}); elseif (nargin == 2) - for [value, property] = varargin{2} - setproperty (player, property, value); + for [value, property] = varargin{1} + setproperty (hplayer, property, value); endfor elseif (nargin == 3) - if (iscell (varargin{2})) + if (iscell (varargin{1})) index = 1; - for property = varargin{2} - setproperty (player, char (property), varargin{3}{index}); + for property = varargin{1} + setproperty (hplayer, char (property), varargin{2}{index}); index += 1; endfor else - setproperty (player, varargin{2}, varargin{3}); + setproperty (hplayer, varargin{1}, varargin{2}); endif - else - error ("@audioplayer/set: wrong number of arguments to the set method"); endif endfunction function setproperty (player, property, value) - switch (property) - case "SampleRate" + switch (lower (property)) + case "samplerate" __player_set_fs__ (player, value); - case "Tag" + case "tag" __player_set_tag__ (player, value); - case "UserData" + case "userdata" __player_set_userdata__ (player, value); otherwise - error ("audioplayer: no such property or the property specified is read-only"); + error ('@audioplayer/set: "%s" is not a valid property name or is read-only', property); endswitch endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! set (player, "SampleRate", 8800); +%! set (player, "Tag", "mytag"); +%! ## Also test case insensitivity +%! set (player, "USERdata", [1, 2; 3, 4]); +%! assert (player.SampleRate, 8800); +%! assert (player.Tag, "mytag"); +%! assert (player.UserData, [1, 2; 3, 4]); + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! set (player, {"SampleRate", "Tag", "UserData"}, +%! {8800, "mytag", [1, 2; 3, 4]}); +%! assert (player.SampleRate, 8800); +%! assert (player.Tag, "mytag"); +%! assert (player.UserData, [1, 2; 3, 4]); + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! props = set (player); +%! props.SampleRate = 8800; +%! props.Tag = "mytag"; +%! props.UserData = [1, 2; 3, 4]; +%! set (player, props); +%! assert (player.SampleRate, 8800); +%! assert (player.Tag, "mytag"); +%! assert (player.UserData, [1, 2; 3, 4]); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! fail ('set (player, "foobar", 1)', "not a valid property name"); +%! fail ('set (player, "Running", 1)', "is read-only"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/stop.m --- a/scripts/audio/@audioplayer/stop.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/stop.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,16 +25,17 @@ ## -*- texinfo -*- ## @deftypefn {} {} stop (@var{player}) -## Stop the playback for the audioplayer @var{player} and reset the -## relevant variables to their starting values. +## Stop playback of the audioplayer @var{player} and reset relevant variables +## to their initial values. +## @seealso{@audioplayer/pause, @audioplayer/resume, @audioplayer/audioplayer} ## @end deftypefn function stop (player) - if (nargin < 1) - print_usage (); - endif - __player_stop__ (struct (player).player); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/subsasgn.m --- a/scripts/audio/@audioplayer/subsasgn.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/subsasgn.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,10 +28,15 @@ ## Perform subscripted assignment on the audio player object @var{player}. ## ## Assign the value of @var{rhs} to the player property named by @var{idx}. +## @seealso{@audioplayer/audioplayer} ## @end deftypefn function value = subsasgn (player, idx, rhs) + if (nargin != 3) + print_usage (); + endif + if (isempty (idx)) error ("audioplayer: missing index"); endif @@ -45,3 +50,15 @@ endif endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! player.Tag = "mytag"; +%! assert (get (player, "Tag"), "mytag"); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! fail ("player(1).Tag = 5", "invalid subscript type"); +%! fail ("player{1}.Tag = 5", "invalid subscript type"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audioplayer/subsref.m --- a/scripts/audio/@audioplayer/subsref.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audioplayer/subsref.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Perform subscripted selection on the audio player object @var{player}. ## ## Return the player property value named by @var{idx}. +## @seealso{@audioplayer/audioplayer} ## @end deftypefn function value = subsref (player, idx) @@ -48,3 +49,15 @@ endif endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! set (player, "Tag", "mytag"); +%! assert (player.Tag, "mytag"); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (0) > 0 +%! player = audioplayer ([-1, 1], 44100, 8); +%! fail ("player(1).Tag", "invalid subscript type"); +%! fail ("player{1}.Tag", "invalid subscript type"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/__get_properties__.m --- a/scripts/audio/@audiorecorder/__get_properties__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/__get_properties__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,51 +24,45 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{properties} =} __get_properties__ (@var{recorder}) +## @deftypefn {} {@var{props} =} __get_properties__ (@var{recorder}) ## Return a struct containing all named properties of the recorder object ## @var{recorder}. +## @seealso{@audiorecorder/get, @audiorecorder/set, +## @audiorecorder/audiorecorder} ## @end deftypefn function props = __get_properties__ (recorder) - if (nargin < 1) - print_usage (); - endif - - if (__recorder_isrecording__ (struct (recorder).recorder)) - running = "on"; - else - running = "off"; - endif + hrecorder = struct (recorder).recorder; props = struct ("BitsPerSample", - __recorder_get_nbits__ (struct (recorder).recorder), + __recorder_get_nbits__ (hrecorder), "CurrentSample", - __recorder_get_sample_number__ (struct (recorder).recorder), + __recorder_get_sample_number__ (hrecorder), "DeviceID", - __recorder_get_id__ (struct (recorder).recorder), + __recorder_get_id__ (hrecorder), "NumberOfChannels", - __recorder_get_channels__ (struct (recorder).recorder), + __recorder_get_channels__ (hrecorder), "Running", - running, + ifelse (__recorder_isrecording__ (hrecorder), "on", "off"), "SampleRate", - __recorder_get_fs__ (struct (recorder).recorder), + __recorder_get_fs__ (hrecorder), "TotalSamples", - __recorder_get_total_samples__ (struct (recorder).recorder), + __recorder_get_total_samples__ (hrecorder), "Tag", - __recorder_get_tag__ (struct (recorder).recorder), + __recorder_get_tag__ (hrecorder), "Type", "audiorecorder", "UserData", - __recorder_get_userdata__ (struct (recorder).recorder)); + __recorder_get_userdata__ (hrecorder)); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/audiorecorder.m --- a/scripts/audio/@audiorecorder/audiorecorder.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/audiorecorder.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,25 +25,50 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{recorder} =} audiorecorder () -## @deftypefnx {} {@var{recorder} =} audiorecorder (@var{fs}, @var{nbits}, @var{channels}) -## @deftypefnx {} {@var{recorder} =} audiorecorder (@var{fs}, @var{nbits}, @var{channels}, @var{id}) -## Create an audiorecorder object recording 8 bit mono audio at 8000 Hz +## @deftypefnx {} {@var{recorder} =} audiorecorder (@var{fs}, @var{nbits}, @var{nchannels}) +## @deftypefnx {} {@var{recorder} =} audiorecorder (@var{fs}, @var{nbits}, @var{nchannels}, @var{id}) +## Create an audiorecorder object recording 8-bit mono audio at 8000 Hz ## sample rate. ## -## The optional arguments @var{fs}, @var{nbits}, @var{channels}, and @var{id} -## specify the sample rate, bit depth, number of channels and recording -## device id, respectively. Device IDs may be found using the audiodevinfo -## function. +## The optional arguments @var{fs}, @var{nbits}, @var{nchannels}, and @var{id} +## specify the sample rate, number of bits per sample, number of channels, and +## recording device ID, respectively. Device IDs may be found using the +## @code{audiodevinfo} function. +## +## The list of actions for an audiorecorder object are shown below. All +## methods require an audiorecorder object as the first argument. +## +## @multitable @columnfractions 0.22 0.73 +## @headitem Method @tab Description +## @item get @tab Read audiorecorder property values +## @item getaudiodata @tab Return audio data as a numeric matrix +## @item getplayer @tab Return audioplayer loaded with data from audiorecorder +## @item isrecording @tab Return true if audiorecorder is recording +## @item pause @tab Pause recording +## @item play @tab Play audio stored in audiorecorder object +## @item record @tab Record audio in audiorecorder object w/o blocking +## @item recordblocking @tab Record audio in audiorecorder object +## @item resume @tab Resume recording after pause +## @item set @tab Write audiorecorder property values +## @item stop @tab Stop recording +## @end multitable ## @end deftypefn +## @seealso{@audiorecorder/get, @audiorecorder/getaudiodata, +## @audiorecorder/getplayer, @audiorecorder/isrecording, +## @audiorecorder/pause, @audiorecorder/play, @audiorecorder/record, +## @audiorecorder/recordblocking, @audioplayer/resume, @audiorecorder/set, +## @audiorecorder/stop, audiodevinfo, @audioplayer/audioplayer, record} +################################################################################ ## FIXME: callbacks don't work properly, apparently because portaudio ## will execute the callbacks in a separate thread, and calling Octave -## functions in a separate thread which is likely to cause trouble with +## functions in a separate thread is likely to cause trouble with ## all of Octave's global data... ## ## @deftypefnx {} {@var{recorder} =} audiorecorder (@var{function}, @dots{}) ## ## Given a function handle, use that function to process the audio. +################################################################################ function recorder = audiorecorder (varargin) @@ -51,9 +76,15 @@ print_usage (); endif - if (nargin > 0 && ischar (varargin{1})) - varargin{1} = str2func (varargin{1}); + ## FIXME: Prevent use of callbacks until situation is fixed. + if (nargin > 0 && (is_function_handle (varargin{1}) || ischar (varargin{1}))) + error ("audiorecorder: first argument cannot be a callback function"); endif + + ## FIXME: Uncomment when callback functions are supported. + ## if (nargin > 0 && ischar (varargin{1})) + ## varargin{1} = str2func (varargin{1}); + ## endif recorder.recorder = __recorder_audiorecorder__ (varargin{:}); recorder = class (recorder, "audiorecorder"); @@ -62,6 +93,7 @@ %!demo +%! ## Record 1 second of audio and play it back in two ways %! recorder = audiorecorder (44100, 16, 2); %! record (recorder, 1); %! pause (2); @@ -76,67 +108,34 @@ ## Tests of audiorecorder must not actually record anything. -%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 -%! recorder = audiorecorder (44100, 16, 2); -%! data = getaudiodata (recorder, "int16"); -%! assert (strcmp (class (data), "int16")); -%! data = getaudiodata (recorder, "int8"); -%! assert (strcmp (class (data), "int8")); -%! data = getaudiodata (recorder, "uint8"); -%! assert (strcmp (class (data), "uint8")); -%! assert (size (data)(1), recorder.TotalSamples); -%! assert (size (data)(2), 2); - -%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 -%! recorder = audiorecorder (); -%! set (recorder, {"SampleRate", "Tag", "UserData"}, -%! {8000, "tag", [1, 2; 3, 4]}); -%! assert (recorder.SampleRate, 8000); -%! assert (recorder.Tag, "tag"); -%! assert (recorder.UserData, [1, 2; 3, 4]); - -%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 -%! recorder = audiorecorder (); -%! settable = set (recorder); -%! settable.SampleRate = 8000; -%! settable.Tag = "tag"; -%! settable.UserData = [1, 2; 3, 4]; -%! set (recorder, settable); -%! assert (recorder.SampleRate, 8000); -%! assert (recorder.Tag, "tag"); -%! assert (recorder.UserData, [1, 2; 3, 4]); +## FIXME: Uncomment when callbacks are supported +%!#function status = callback_record (sound) +%!# fid = fopen ("record.txt", "at"); +%!# for index = 1:rows(sound) +%!# fprintf (fid, "%.4f, %.4f\n", sound(index, 1), sound(index, 2)); +%!# endfor +%!# fclose (fid); +%!# status = 0; +%!#endfunction -%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 -%! recorder = audiorecorder (); -%! recorder.SampleRate = 8000; -%! recorder.Tag = "tag"; -%! recorder.UserData = [1, 2; 3, 4]; -%! properties = get (recorder, {"SampleRate", "Tag", "UserData"}); -%! assert (properties, {8000, "tag", [1, 2; 3, 4]}); - -#%!function status = callback_record (sound) -#%! fid = fopen ("record.txt", "at"); -#%! for index = 1:rows(sound) -#%! fprintf (fid, "%.4f, %.4f\n", sound(index, 1), sound(index, 2)); -#%! endfor -#%! fclose (fid); -#%! status = 0; -#%!endfunction +%!#testif HAVE_PORTAUDIO +%!# recorder = audiorecorder (@callback_record, 44100); +%!# unlink ("record.txt") +%!# record (recorder); +%!# pause (2); +%!# stop (recorder); +%!# s = stat ("record.txt"); +%!# assert (s.size > 0); -#%!testif HAVE_PORTAUDIO -#%! recorder = audiorecorder (@callback_record, 44100); -#%! unlink ("record.txt") -#%! record (recorder); -#%! pause (2); -#%! stop (recorder); -#%! s = stat ("record.txt"); -#%! assert (s.size > 0); +%!#testif HAVE_PORTAUDIO +%!# recorder = audiorecorder (@callback_record, 44100); +%!# unlink ("record.txt") +%!# record (recorder); +%!# pause (2); +%!# stop (recorder); +%!# s = stat ("record.txt"); +%!# assert (s.size > 0); -#%!testif HAVE_PORTAUDIO -#%! recorder = audiorecorder (@callback_record, 44100); -#%! unlink ("record.txt") -#%! record (recorder); -#%! pause (2); -#%! stop (recorder); -#%! s = stat ("record.txt"); -#%! assert (s.size > 0); +## Test input validation +%!error audiorecorder (@ls) +%!error audiorecorder ("ls") diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/disp.m --- a/scripts/audio/@audiorecorder/disp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/disp.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,17 +26,18 @@ ## -*- texinfo -*- ## @deftypefn {} {} disp (@var{recorder}) ## Display the properties of the audiorecorder object @var{recorder}. +## @seealso{@audiorecorder/audiorecorder} ## @end deftypefn function disp (recorder) - if (nargin < 1) - print_usage (); - endif - printf ("audiorecorder object with properties:\n\n"); for [val, prop] = __get_properties__ (recorder) printf (" %s = ", prop), disp (val); endfor endfunction + + +## No tests possible/needed for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/get.m --- a/scripts/audio/@audiorecorder/get.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/get.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,38 +25,72 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{value} =} get (@var{recorder}, @var{name}) +## @deftypefnx {} {@var{values} =} get (@var{recorder}, @lbracechar{}@var{name1}, @var{name2}, @dots{}@rbracechar{}) ## @deftypefnx {} {@var{values} =} get (@var{recorder}) ## Return the @var{value} of the property identified by @var{name}. ## -## If @var{name} is a cell array, return the values of the properties -## corresponding to the elements of the cell array. Given only the recorder -## object, return a scalar structure with values of all properties of -## @var{recorder}. The field names of the structure correspond to property +## If @var{name} is a cell array return the values of the properties +## identified by the elements of the cell array. Given only the recorder +## object, return a scalar structure with values for all properties of +## @var{recorder}. The field names of the structure correspond to the property ## names. +## @seealso{@audiorecorder/set, @audiorecorder/audiorecorder} ## @end deftypefn -function retval = get (varargin) +function value = get (recorder, name) - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - properties = __get_properties__ (varargin{1}); + properties = __get_properties__ (recorder); if (nargin == 1) - retval = properties; + value = properties; elseif (nargin == 2) - pnames = varargin{2}; + pnames = name; if (ischar (pnames)) - retval = getfield (properties, pnames); + value = getproperty (properties, pnames); elseif (iscellstr (pnames)) - retval = cell (size (pnames)); + value = cell (size (pnames)); for i = 1:numel (pnames) - retval{i} = getfield (properties, pnames{i}); + value{i} = getproperty (properties, pnames{i}); endfor else - error ("@audiorecorder/get: invalid NAME argument"); + error ("@audiorecorder/get: NAME must be a string or cell array of strings"); endif endif endfunction + +function value = getproperty (properties, pname) + + persistent valid_props; + if (isempty (valid_props)) + valid_props = { "BitsPerSample", "CurrentSample", "DeviceID", ... + "NumberOfChannels", "Running", "SampleRate", ... + "TotalSamples", "Tag", "Type", "UserData" }; + endif + + idx = find (strcmpi (pname, valid_props), 1); + if (isempty (idx)) + error ('@audiorecorder/get: "%s" is not a valid property name', pname); + endif + + value = properties.(valid_props{idx}); + +endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! props = get (recorder); +%! assert (fieldnames (props), {"BitsPerSample"; "CurrentSample"; "DeviceID"; +%! "NumberOfChannels"; "Running"; "SampleRate"; "TotalSamples"; "Tag"; +%! "Type"; "UserData"}); +%! value = get (recorder, "Running"); +%! assert (value, "off"); +%! values = get (recorder, {"SampleRate", "BitsPerSample", "NumberOfChannels"}); +%! assert (values, {44100, 16, 2}); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! fail ("get (recorder, 1)", "NAME must be a string"); +%! fail ('get (recorder, "foobar")', '"foobar" is not a valid property'); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/getaudiodata.m --- a/scripts/audio/@audiorecorder/getaudiodata.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/getaudiodata.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,41 +26,74 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{data} =} getaudiodata (@var{recorder}) ## @deftypefnx {} {@var{data} =} getaudiodata (@var{recorder}, @var{datatype}) -## Return recorder audio data as a matrix with values between -1.0 and 1.0 -## and with as many columns as there are channels in the recorder. +## Return audio data from audiorecorder object @var{recorder} as a double +## matrix with values between -1.0 and 1.0 and with as many columns as there +## are channels in @var{recorder}. ## ## Given the optional argument @var{datatype}, convert the recorded data ## to the specified type, which may be one of @qcode{"double"}, ## @qcode{"single"}, @qcode{"int16"}, @qcode{"int8"} or @qcode{"uint8"}. +## @seealso{@audiorecorder/audiorecorder} ## @end deftypefn -function data = getaudiodata (varargin) +function data = getaudiodata (recorder, datatype) - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - recorder = varargin{1}; + hrecorder = struct (recorder).recorder; if (nargin == 1) - data = __recorder_getaudiodata__ (struct (recorder).recorder); + data = __recorder_getaudiodata__ (hrecorder); else - data = __recorder_getaudiodata__ (struct (recorder).recorder); - type = varargin{2}; - switch (type) + data = __recorder_getaudiodata__ (hrecorder); + switch (datatype) + case "double" + ## Do nothing, data is already of type double + case "single" + data = single (data); case "int16" data = int16 (data * (2.0 ^ 15)); case "int8" data = int8 (data * (2.0 ^ 7)); case "uint8" data = uint8 ((data + 1.0) * 0.5 * (2.0 ^ 8 - 1)); + otherwise + error ('@audiorecorder/getaudiodata: invalid DATATYPE "%s"', datatype) endswitch endif if (get (recorder, "NumberOfChannels") == 2) - data = data'; + data = data.'; else - data = data(1,:)'; + data = data(1,:).'; endif endfunction + + +## Tests of audiorecorder must not actually record anything. +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! data = getaudiodata (recorder); +%! assert (isa (data, "double")); +%! data = getaudiodata (recorder, "double"); +%! assert (isa (data, "double")); +%! data = getaudiodata (recorder, "single"); +%! assert (isa (data, "single")); +%! data = getaudiodata (recorder, "int16"); +%! assert (isa (data, "int16")); +%! data = getaudiodata (recorder, "int8"); +%! assert (isa (data, "int8")); +%! data = getaudiodata (recorder, "uint8"); +%! assert (isa (data, "uint8")); +%! assert (size (data)(1), recorder.TotalSamples); +%! assert (size (data)(2), 2); + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 8, 1); +%! data = getaudiodata (recorder); +%! assert (size (data)(1), recorder.TotalSamples); +%! assert (size (data)(2), 1); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! fail ("getaudiodata (recorder, 'foobar')", "invalid DATATYPE"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/getplayer.m --- a/scripts/audio/@audiorecorder/getplayer.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/getplayer.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,17 +27,23 @@ ## @deftypefn {} {@var{player} =} getplayer (@var{recorder}) ## Return an audioplayer object with data recorded by the audiorecorder object ## @var{recorder}. +## @seealso{@audioplayer/audioplayer, @audiorecorder/audiorecorder} ## @end deftypefn -function player = getplayer (varargin) +function player = getplayer (recorder) - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - recorder = varargin{1}; data = getaudiodata (recorder); - player = audioplayer (data, get (recorder, "SampleRate"), + player = audioplayer (data, + get (recorder, "SampleRate"), get (recorder, "BitsPerSample")); endfunction + + +## FIXME: Uncomment when audioplayer constructor supports null data +%!#testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%!# recorder = audiorecorder (44100, 16, 2); +%!# player = getplayer (recorder); +%!# assert (isa (player, "audioplayer")); +%!# assert (player.SampleRate, 44100); +%!# assert (player.BitsPerSample, 16); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/isrecording.m --- a/scripts/audio/@audiorecorder/isrecording.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/isrecording.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,17 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isrecording (@var{recorder}) +## @deftypefn {} {@var{tf} =} isrecording (@var{recorder}) ## Return true if the audiorecorder object @var{recorder} is currently ## recording audio and false otherwise. +## @seealso{@audiorecorder/pause, @audiorecorder/audiorecorder} ## @end deftypefn -function result = isrecording (recorder) +function tf = isrecording (recorder) - if (nargin < 1) - print_usage (); - endif - - result = __recorder_isrecording__ (struct (recorder).recorder); + tf = __recorder_isrecording__ (struct (recorder).recorder); endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! assert (isrecording (recorder), false); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/pause.m --- a/scripts/audio/@audiorecorder/pause.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/pause.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,15 +25,17 @@ ## -*- texinfo -*- ## @deftypefn {} {} pause (@var{recorder}) -## Pause recording with audiorecorder object @var{recorder}. +## Pause recording for audiorecorder @var{recorder}. +## @seealso{@audiorecorder/resume, @audiorecorder/stop, +## @audiorecorder/audiorecorder} ## @end deftypefn function pause (recorder) - if (nargin < 1) - print_usage (); - endif - __recorder_pause__ (struct (recorder).recorder); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/play.m --- a/scripts/audio/@audiorecorder/play.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/play.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,30 +27,33 @@ ## @deftypefn {} {@var{player} =} play (@var{recorder}) ## @deftypefnx {} {@var{player} =} play (@var{recorder}, @var{start}) ## @deftypefnx {} {@var{player} =} play (@var{recorder}, [@var{start}, @var{end}]) -## Play the audio recorded in @var{recorder} and return a corresponding -## audioplayer object. +## Play the audio recorded in @var{recorder} without blocking and return a +## corresponding audioplayer object. ## ## If the optional argument @var{start} is provided, begin playing -## @var{start} seconds in to the recording. +## @var{start} seconds into the recording. ## ## If the optional argument @var{end} is provided, stop playing at -## @var{end} seconds in the recording. +## @var{end} seconds into the recording. +## @seealso{@audiorecorder/getplayer, @audioplayer/audioplayer, +## @audiorecorder/audiorecorder} ## @end deftypefn -function player = play (varargin) +function player = play (recorder, start) - if (nargin < 1 || nargin > 2) - print_usage (); - endif + data = getaudiodata (recorder); + player = audioplayer (data, + get (recorder, "SampleRate"), + get (recorder, "BitsPerSample")); - recorder = varargin{1}; - data = getaudiodata (recorder); - player = audioplayer (data, get (recorder, "SampleRate"), - get (recorder, "BitsPerSample")); if (nargin == 1) play (player); else - play (player, varargin{2}); + play (player, start); endif endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/record.m --- a/scripts/audio/@audiorecorder/record.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/record.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,18 +27,25 @@ ## @deftypefn {} {} record (@var{recorder}) ## @deftypefnx {} {} record (@var{recorder}, @var{length}) ## Record audio without blocking using the audiorecorder object -## @var{recorder} until stopped or paused by the @var{stop} or @var{pause} -## method. +## @var{recorder} until paused or stopped by the @var{pause} or @var{stop} +## methods. ## ## Given the optional argument @var{length}, record for @var{length} seconds. +## @seealso{@audiorecorder/recordblocking, @audiorecorder/audiorecorder} ## @end deftypefn -function record (varargin) +function record (recorder, length) + + hrecorder = struct (recorder).recorder; - if (nargin < 1 || nargin > 2) - print_usage (); + if (nargin == 1) + __recorder_record__ (hrecorder); + else + __recorder_record__ (hrecorder, length); endif - __recorder_record__ (struct (varargin{1}).recorder, varargin{2:end}); +endfunction + -endfunction +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/recordblocking.m --- a/scripts/audio/@audiorecorder/recordblocking.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/recordblocking.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,14 +28,19 @@ ## Record audio with blocking (synchronous I/O). ## ## The length of the recording in seconds (@var{length}) must be specified. +## @seealso{@audiorecorder/record, @audiorecorder/audiorecorder} ## @end deftypefn -function recordblocking (varargin) +function recordblocking (recorder, length) if (nargin != 2) print_usage (); endif - __recorder_recordblocking__ (struct (varargin{1}).recorder, varargin{2}); + __recorder_recordblocking__ (struct (recorder).recorder, length); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/resume.m --- a/scripts/audio/@audiorecorder/resume.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/resume.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,14 +26,16 @@ ## -*- texinfo -*- ## @deftypefn {} {} resume (@var{recorder}) ## Resume recording with the paused audiorecorder object @var{recorder}. +## @seealso{@audiorecorder/pause, @audiorecorder/stop, +## @audiorecorder/audiorecorder} ## @end deftypefn function resume (recorder) - if (nargin < 1) - print_usage (); - endif - __recorder_resume__ (struct (recorder).recorder); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/set.m --- a/scripts/audio/@audiorecorder/set.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/set.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,42 +25,44 @@ ## -*- texinfo -*- ## @deftypefn {} {} set (@var{recorder}, @var{name}, @var{value}) -## @deftypefnx {} {} set (@var{recorder}, @var{properties}) +## @deftypefnx {} {} set (@var{recorder}, @var{name_cell}, @var{value_cell}) +## @deftypefnx {} {} set (@var{recorder}, @var{properties_struct}) ## @deftypefnx {} {@var{properties} =} set (@var{recorder}) ## Set the value of property specified by @var{name} to a given @var{value}. ## -## If @var{name} and @var{value} are cell arrays of the same size, set each -## property to a corresponding value. Given a structure with fields +## If @var{name} and @var{value} are cell arrays, set each property to a +## corresponding value. Given a structure of properties with fields ## corresponding to property names, set the value of those properties to the -## corresponding field values. Given only the recorder object, return a -## structure of settable properties. +## corresponding field values. Given only a recorder object, return a +## structure of configurable properties (i.e., writeable properties). +## @seealso{@audiorecorder/get, @audiorecorder/audiorecorder} ## @end deftypefn -function settable = set (varargin) +function properties = set (recorder, varargin) - if (nargin < 1 || nargin > 3) + if (nargin > 3) print_usage (); endif - recorder = struct (varargin{1}).recorder; + hrecorder = struct (recorder).recorder; if (nargin == 1) - settable.SampleRate = {}; - settable.Tag = {}; - settable.UserData = {}; + properties = struct ("SampleRate", {{}}, "Tag", {{}}, "UserData", {{}}); + elseif (nargin == 2) - for [value, property] = varargin{2} - setproperty (recorder, property, value); + for [value, property] = varargin{1} + setproperty (hrecorder, property, value); endfor + elseif (nargin == 3) - if (iscell (varargin{2})) + if (iscell (varargin{1})) index = 1; - for property = varargin{2} - setproperty (recorder, char (property), varargin{3}{index}); + for property = varargin{1} + setproperty (hrecorder, char (property), varargin{2}{index}); index += 1; endfor else - setproperty (recorder, varargin{2}, varargin{3}); + setproperty (hrecorder, varargin{1}, varargin{2}); endif endif @@ -68,15 +70,52 @@ function setproperty (recorder, property, value) - switch (property) - case "SampleRate" + switch (lower (property)) + case "samplerate" __recorder_set_fs__ (recorder, value); - case "Tag" + case "tag" __recorder_set_tag__ (recorder, value); - case "UserData" + case "userdata" __recorder_set_userdata__ (recorder, value); otherwise - error ("@audiorecorder/set: no such property or the property specified is read-only"); + error ('@audiorecorder/set: "%s" is not a valid property name or is read-only', property); endswitch endfunction + + +## Tests of audiorecorder must not actually record anything. +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (); +%! set (recorder, "SampleRate", 8800); +%! set (recorder, "Tag", "mytag"); +%! ## Also test case insensitivity +%! set (recorder, "USERdata", [1, 2; 3, 4]); +%! assert (recorder.SampleRate, 8800); +%! assert (recorder.Tag, "mytag"); +%! assert (recorder.UserData, [1, 2; 3, 4]); + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (); +%! set (recorder, {"SampleRate", "Tag", "UserData"}, +%! {8800, "mytag", [1, 2; 3, 4]}); +%! assert (recorder.SampleRate, 8800); +%! assert (recorder.Tag, "mytag"); +%! assert (recorder.UserData, [1, 2; 3, 4]); + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (); +%! props = set (recorder); +%! props.SampleRate = 8800; +%! props.Tag = "mytag"; +%! props.UserData = [1, 2; 3, 4]; +%! set (recorder, props); +%! assert (recorder.SampleRate, 8800); +%! assert (recorder.Tag, "mytag"); +%! assert (recorder.UserData, [1, 2; 3, 4]); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (); +%! fail ('set (recorder, "foobar", 1)', "not a valid property name"); +%! fail ('set (recorder, "Running", 1)', "is read-only"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/stop.m --- a/scripts/audio/@audiorecorder/stop.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/stop.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,15 +25,18 @@ ## -*- texinfo -*- ## @deftypefn {} {} stop (@var{recorder}) -## Stop the audiorecorder object @var{recorder} and clean up any audio streams. +## Stop recording with audiorecorder object @var{recorder} and clean up any +## audio streams. +## @seealso{@audiorecorder/pause, @audiorecorder/resume, +## @audiorecorder/audiorecorder} ## @end deftypefn function stop (recorder) - if (nargin < 1) - print_usage (); - endif - __recorder_stop__ (struct (recorder).recorder); endfunction + + +## No tests possible for this function +%!assert (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/subsasgn.m --- a/scripts/audio/@audiorecorder/subsasgn.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/subsasgn.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,9 +28,10 @@ ## Perform subscripted assignment on the audio recorder object @var{recorder}. ## ## Assign the value of @var{rhs} to the recorder property named by @var{idx}. +## @seealso{@audiorecorder/audiorecorder} ## @end deftypefn -function value = subsasgn (recorder, idx, rhs) +function recorder = subsasgn (recorder, idx, rhs) if (nargin != 3) print_usage (); @@ -43,9 +44,20 @@ if (strcmp (idx(1).type, ".")) field = idx.subs; set (recorder, field, rhs); - value = recorder; else error ("@audiorecorder/subsasgn: invalid subscript type"); endif endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! recorder.Tag = "mytag"; +%! assert (get (recorder, "Tag"), "mytag"); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! fail ("recorder(1).Tag = 5", "invalid subscript type"); +%! fail ("recorder{1}.Tag = 5", "invalid subscript type"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/@audiorecorder/subsref.m --- a/scripts/audio/@audiorecorder/subsref.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/@audiorecorder/subsref.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## Perform subscripted selection on the audio recorder object @var{recorder}. ## ## Return the recorder property value named by @var{idx}. +## @seealso{@audiorecorder/audiorecorder} ## @end deftypefn function value = subsref (recorder, idx) @@ -48,3 +49,15 @@ endif endfunction + + +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! set (recorder, "Tag", "mytag"); +%! assert (recorder.Tag, "mytag"); + +## Test input validation +%!testif HAVE_PORTAUDIO; audiodevinfo (1) > 0 +%! recorder = audiorecorder (44100, 16, 2); +%! fail ("recorder(1).Tag", "invalid subscript type"); +%! fail ("recorder{1}.Tag", "invalid subscript type"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/record.m --- a/scripts/audio/record.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/record.m Sun Apr 03 11:30:26 2022 -0400 @@ -33,10 +33,10 @@ ## for recording. ## ## For more control over audio recording, use the @code{audiorecorder} class. -## @seealso{sound, soundsc} +## @seealso{@audiorecorder/audiorecorder, sound, soundsc} ## @end deftypefn -function x = record (sec, fs = 8000) +function data = record (sec, fs = 8000) if (nargin < 1) print_usage (); @@ -50,16 +50,14 @@ error ("record: sample rate FS must be a positive number"); endif - x = []; + data = []; if (sec > 0) - rec = audiorecorder (fs, 16, 1); recordblocking (rec, sec); - x = getaudiodata (rec); - + data = getaudiodata (rec); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/sound.m --- a/scripts/audio/sound.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/sound.m Sun Apr 03 11:30:26 2022 -0400 @@ -30,7 +30,7 @@ ## Play audio data @var{y} at sample rate @var{fs} to the default audio ## device. ## -## The audio signal @var{y} can be a vector or a two-column array, representing +## The audio signal @var{y} can be a vector or a two-column array representing ## mono or stereo audio, respectively. ## ## If @var{fs} is not given, a default sample rate of 8000 samples per second @@ -40,7 +40,7 @@ ## audio device and defaults to 8 bits. ## ## For more control over audio playback, use the @code{audioplayer} class. -## @seealso{soundsc, record} +## @seealso{soundsc, @audioplayer/audioplayer, record} ## @end deftypefn function sound (y, fs, nbits) diff -r 0a1aec50a0c8 -r 960909469245 scripts/audio/soundsc.m --- a/scripts/audio/soundsc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/audio/soundsc.m Sun Apr 03 11:30:26 2022 -0400 @@ -31,7 +31,7 @@ ## Scale the audio data @var{y} and play it at sample rate @var{fs} to the ## default audio device. ## -## The audio signal @var{y} can be a vector or a two-column array, representing +## The audio signal @var{y} can be a vector or a two-column array representing ## mono or stereo audio, respectively. ## ## If @var{fs} is not given, a default sample rate of 8000 samples per second @@ -46,19 +46,15 @@ ## are scaled to the range [-1, 1] instead. ## ## For more control over audio playback, use the @code{audioplayer} class. -## @seealso{sound, record} +## @seealso{sound, @audioplayer/audioplayer, record} ## @end deftypefn -function soundsc (y, fs, nbits, yrange) +function soundsc (y, fs, nbits, yrange = []) if (nargin < 1) print_usage (); endif - if (nargin < 4) - yrange = []; - endif - if (nargin < 2 || isempty (fs)) fs = 8000; elseif (nargin == 2 && numel (fs) > 1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/disable_diagonal_matrix.m --- a/scripts/deprecated/disable_diagonal_matrix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/deprecated/disable_diagonal_matrix.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,7 +26,7 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{val} =} disable_diagonal_matrix () ## @deftypefnx {} {@var{old_val} =} disable_diagonal_matrix (@var{new_val}) -## @deftypefnx {} {} disable_diagonal_matrix (@var{new_val}, "local") +## @deftypefnx {} {@var{old_val} =} disable_diagonal_matrix (@var{new_val}, "local") ## ## @code{disable_diagonal_matrix} is deprecated and will be removed in Octave ## version 9. Use @code{optimize_diagonal_matrix} instead. diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/disable_permutation_matrix.m --- a/scripts/deprecated/disable_permutation_matrix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/deprecated/disable_permutation_matrix.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,7 +26,7 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{val} =} disable_permutation_matrix () ## @deftypefnx {} {@var{old_val} =} disable_permutation_matrix (@var{new_val}) -## @deftypefnx {} {} disable_permutation_matrix (@var{new_val}, "local") +## @deftypefnx {} {@var{old_val} =} disable_permutation_matrix (@var{new_val}, "local") ## ## @code{disable_permutation_matrix} is deprecated and will be removed in ## Octave version 9. Use @code{optimize_permutation_matrix} instead. diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/disable_range.m --- a/scripts/deprecated/disable_range.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/deprecated/disable_range.m Sun Apr 03 11:30:26 2022 -0400 @@ -26,7 +26,7 @@ ## -*- texinfo -*- ## @deftypefn {} {@var{val} =} disable_range () ## @deftypefnx {} {@var{old_val} =} disable_range (@var{new_val}) -## @deftypefnx {} {} disable_range (@var{new_val}, "local") +## @deftypefnx {} {@var{old_val} =} disable_range (@var{new_val}, "local") ## ## @code{disable_range} is deprecated and will be removed in Octave version 9. ## Use @code{optimize_range} instead. diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/module.mk --- a/scripts/deprecated/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/deprecated/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -5,7 +5,8 @@ %reldir%/disable_diagonal_matrix.m \ %reldir%/disable_permutation_matrix.m \ %reldir%/disable_range.m \ - %reldir%/runtests.m + %reldir%/shift.m \ + %reldir%/sparse_auto_mutate.m %canon_reldir%dir = $(fcnfiledir)/deprecated diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/runtests.m --- a/scripts/deprecated/runtests.m Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -######################################################################## -## -## Copyright (C) 2010-2022 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or . -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {} runtests () -## @deftypefnx {} {} runtests (@var{directory}) -## -## -## @code{runtests} is deprecated and will be removed in Octave version 8. -## Use @code{oruntests} instead. -## -## Execute built-in tests for all m-files in the specified @var{directory}. -## -## Test blocks in any C++ source files (@file{*.cc}) will also be executed -## for use with dynamically linked oct-file functions. -## -## If no directory is specified, operate on all directories in Octave's search -## path for functions. -## @seealso{oruntests, rundemos, test, path} -## @end deftypefn - -## FIXME: DEPRECATED: Remove in version 8. - -function runtests (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "runtests is obsolete and will be removed from a future version of Octave, please use oruntests instead\n"); - endif - - oruntests (varargin{:}); - -endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/shift.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/shift.m Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,115 @@ +######################################################################## +## +## Copyright (C) 1995-2022 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or . +## +## This file is part of Octave. +## +## Octave is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{y} =} shift (@var{x}, @var{b}) +## @deftypefnx {} {@var{y} =} shift (@var{x}, @var{b}, @var{dim}) +## +## @code{shift} is deprecated and will be removed in Octave version 10. Use +## @code{circshift} instead. +## +## If @var{x} is a vector, perform a circular shift of length @var{b} of +## the elements of @var{x}. +## +## If @var{x} is a matrix, do the same for each column of @var{x}. +## +## If the optional @var{dim} argument is given, operate along this dimension. +## @seealso{circshift} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 10. + +function y = shift (x, b, dim) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "shift is deprecated and will be removed from a future version of Octave, please use circshift instead\n"); + endif + + if (nargin < 2) + print_usage (); + endif + + if (numel (x) < 1) + error ("shift: X must not be empty"); + elseif (! (isscalar (b) && b == fix (b))) + error ("shift: B must be an integer"); + endif + + nd = ndims (x); + sz = size (x); + + if (nargin == 3) + if (!(isscalar (dim) && dim == fix (dim)) + || !(1 <= dim && dim <= nd)) + error ("shift: DIM must be an integer and a valid dimension"); + endif + else + ## Find the first non-singleton dimension. + (dim = find (sz > 1, 1)) || (dim = 1); + endif + + d = sz(dim); + + idx = repmat ({':'}, nd, 1); + if (b > 0) + b = rem (b, d); + idx{dim} = [d-b+1:d, 1:d-b]; + elseif (b < 0) + b = rem (abs (b), d); + idx{dim} = [b+1:d, 1:b]; + endif + + y = x(idx{:}); + +endfunction + + +%!test +%! a = [1, 2, 3]; +%! b = [4, 5, 6]; +%! c = [7, 8, 9]; +%! +%! r = [a, b, c]; +%! m = [a; b; c]; +%! +%! assert (shift (r, 0), r); +%! assert (shift (r, 3), [c, a, b]); +%! assert (shift (r, -6), [c, a, b]); +%! assert (shift (r, -3), [b, c, a]); +%! assert (shift (m, 1), [c; a; b]); +%! assert (shift (m, -2), [c; a; b]); + +## Test input validation +%!error shift () +%!error shift (1) +%!error shift ([], 1) +%!error shift (ones (2), ones (2)) +%!error shift (ones (2), 1.5) +%!error shift (1, 1, 1.5) +%!error shift (1, 1, 0) +%!error shift (1, 1, 3) diff -r 0a1aec50a0c8 -r 960909469245 scripts/deprecated/sparse_auto_mutate.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/sparse_auto_mutate.m Sun Apr 03 11:30:26 2022 -0400 @@ -0,0 +1,81 @@ +######################################################################## +## +## Copyright (C) 2022 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or . +## +## This file is part of Octave. +## +## Octave is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{val} =} sparse_auto_mutate () +## @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}) +## @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}, "local") +## +## @code{sparse_auto_mutate} is deprecated and will be removed in Octave +## version 9. Use @code{optimize_diagonal_matrix} instead. +## +## Query or set whether storing diagonal matrices in a special space-efficient +## format is disabled. +## +## The default value is false. If this option is set to true, Octave will +## store ranges as full matrices. +## +## When called from inside a function with the @qcode{"local"} option, the +## setting is changed locally for the function and any subroutines it calls. +## The original setting is restored when exiting the function. +## @seealso{sparse_auto_mutate, disable_permutation_matrix} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 10. + +function retval = sparse_auto_mutate (val, opt) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "sparse_auto_mutate is obsolete, has no effect, and will be removed from a future version of Octave\n"); + endif + + if (nargin == 0 || nargout > 0) + ## Always false now. + retval = false; + return; + endif + + if (nargin == 2) + if (! (ischar (opt) && strcmp (opt, "local"))) + error ('sparse_auto_mutate: second argument must be "local"'); + endif + nargin = 1; + endif + + ## Don't bother warning that "local" is invalid outside of a + ## function. + + if (nargin > 1) + print_usage (); + endif + + if (! islogical (val)) + error ("sparse_auto_mutate: argument must be a logical value"); + endif + +endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acosd.m --- a/scripts/elfun/acosd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acosd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acosd (@var{x}) +## @deftypefn {} {@var{y} =} acosd (@var{x}) ## Compute the inverse cosine in degrees for each element of @var{x}. ## @seealso{cosd, acos} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acot.m --- a/scripts/elfun/acot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acot.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acot (@var{x}) +## @deftypefn {} {@var{y} =} acot (@var{x}) ## Compute the inverse cotangent in radians for each element of @var{x}. ## @seealso{cot, acotd} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acotd.m --- a/scripts/elfun/acotd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acotd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acotd (@var{x}) +## @deftypefn {} {@var{y} =} acotd (@var{x}) ## Compute the inverse cotangent in degrees for each element of @var{x}. ## @seealso{cotd, acot} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acoth.m --- a/scripts/elfun/acoth.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acoth.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acoth (@var{x}) +## @deftypefn {} {@var{y} =} acoth (@var{x}) ## Compute the inverse hyperbolic cotangent of each element of @var{x}. ## @seealso{coth} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acsc.m --- a/scripts/elfun/acsc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acsc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acsc (@var{x}) +## @deftypefn {} {@var{y} =} acsc (@var{x}) ## Compute the inverse cosecant in radians for each element of @var{x}. ## @seealso{csc, acscd} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acscd.m --- a/scripts/elfun/acscd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acscd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acscd (@var{x}) +## @deftypefn {} {@var{y} =} acscd (@var{x}) ## Compute the inverse cosecant in degrees for each element of @var{x}. ## @seealso{cscd, acsc} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/acsch.m --- a/scripts/elfun/acsch.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/acsch.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} acsch (@var{x}) +## @deftypefn {} {@var{y} =} acsch (@var{x}) ## Compute the inverse hyperbolic cosecant of each element of @var{x}. ## @seealso{csch} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/asec.m --- a/scripts/elfun/asec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/asec.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} asec (@var{x}) +## @deftypefn {} {@var{y} =} asec (@var{x}) ## Compute the inverse secant in radians for each element of @var{x}. ## @seealso{sec, asecd} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/asecd.m --- a/scripts/elfun/asecd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/asecd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} asecd (@var{x}) +## @deftypefn {} {@var{y} =} asecd (@var{x}) ## Compute the inverse secant in degrees for each element of @var{x}. ## @seealso{secd, asec} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/asech.m --- a/scripts/elfun/asech.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/asech.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} asech (@var{x}) +## @deftypefn {} {@var{y} =} asech (@var{x}) ## Compute the inverse hyperbolic secant of each element of @var{x}. ## @seealso{sech} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/asind.m --- a/scripts/elfun/asind.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/asind.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} asind (@var{x}) +## @deftypefn {} {@var{y} =} asind (@var{x}) ## Compute the inverse sine in degrees for each element of @var{x}. ## @seealso{sind, asin} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/atan2d.m --- a/scripts/elfun/atan2d.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/atan2d.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,19 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} atan2d (@var{y}, @var{x}) +## @deftypefn {} {@var{d} =} atan2d (@var{y}, @var{x}) ## Compute atan (@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) +function d = atan2d (y, x) if (nargin != 2) print_usage (); endif - retval = 180 ./ pi .* atan2 (y, x); + d = 180 ./ pi .* atan2 (y, x); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/atand.m --- a/scripts/elfun/atand.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/atand.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} atand (@var{x}) +## @deftypefn {} {@var{y} =} atand (@var{x}) ## Compute the inverse tangent in degrees for each element of @var{x}. ## @seealso{tand, atan} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/cosd.m --- a/scripts/elfun/cosd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/cosd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cosd (@var{x}) +## @deftypefn {} {@var{y} =} cosd (@var{x}) ## Compute the cosine for each element of @var{x} in degrees. ## ## The function is more accurate than @code{cos} for large values of @var{x} diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/cot.m --- a/scripts/elfun/cot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/cot.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cot (@var{x}) +## @deftypefn {} {@var{y} =} cot (@var{x}) ## Compute the cotangent for each element of @var{x} in radians. ## @seealso{acot, cotd, coth} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/cotd.m --- a/scripts/elfun/cotd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/cotd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cotd (@var{x}) +## @deftypefn {} {@var{y} =} cotd (@var{x}) ## Compute the cotangent for each element of @var{x} in degrees. ## @seealso{acotd, cot} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/coth.m --- a/scripts/elfun/coth.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/coth.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} coth (@var{x}) +## @deftypefn {} {@var{y} =} coth (@var{x}) ## Compute the hyperbolic cotangent of each element of @var{x}. ## @seealso{acoth} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/csc.m --- a/scripts/elfun/csc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/csc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} csc (@var{x}) +## @deftypefn {} {@var{y} =} csc (@var{x}) ## Compute the cosecant for each element of @var{x} in radians. ## @seealso{acsc, cscd, csch} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/cscd.m --- a/scripts/elfun/cscd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/cscd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cscd (@var{x}) +## @deftypefn {} {@var{y} =} cscd (@var{x}) ## Compute the cosecant for each element of @var{x} in degrees. ## @seealso{acscd, csc} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/csch.m --- a/scripts/elfun/csch.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/csch.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} csch (@var{x}) +## @deftypefn {} {@var{y} =} csch (@var{x}) ## Compute the hyperbolic cosecant of each element of @var{x}. ## @seealso{acsch} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/sec.m --- a/scripts/elfun/sec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/sec.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sec (@var{x}) +## @deftypefn {} {@var{y} =} sec (@var{x}) ## Compute the secant for each element of @var{x} in radians. ## @seealso{asec, secd, sech} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/secd.m --- a/scripts/elfun/secd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/secd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} secd (@var{x}) +## @deftypefn {} {@var{y} =} secd (@var{x}) ## Compute the secant for each element of @var{x} in degrees. ## @seealso{asecd, sec} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/sech.m --- a/scripts/elfun/sech.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/sech.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sech (@var{x}) +## @deftypefn {} {@var{y} =} sech (@var{x}) ## Compute the hyperbolic secant of each element of @var{x}. ## @seealso{asech} ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/sind.m --- a/scripts/elfun/sind.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/sind.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sind (@var{x}) +## @deftypefn {} {@var{y} =} sind (@var{x}) ## Compute the sine for each element of @var{x} in degrees. ## ## The function is more accurate than @code{sin} for large values of @var{x} diff -r 0a1aec50a0c8 -r 960909469245 scripts/elfun/tand.m --- a/scripts/elfun/tand.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/elfun/tand.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} tand (@var{x}) +## @deftypefn {} {@var{y} =} tand (@var{x}) ## Compute the tangent for each element of @var{x} in degrees. ## ## Returns zero for elements where @code{@var{x}/180} is an integer and diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/accumarray.m --- a/scripts/general/accumarray.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/accumarray.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{func}, @var{fillval}, @var{issparse}) -## @deftypefnx {} {} accumarray (@var{subs}, @var{vals}, @dots{}) +## @deftypefn {} {@var{A} =} accumarray (@var{subs}, @var{vals}) +## @deftypefnx {} {@var{A} =} accumarray (@var{subs}, @var{vals}, @var{sz}) +## @deftypefnx {} {@var{A} =} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{func}) +## @deftypefnx {} {@var{A} =} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{func}, @var{fillval}) +## @deftypefnx {} {@var{A} =} accumarray (@var{subs}, @var{vals}, @var{sz}, @var{func}, @var{fillval}, @var{issparse}) ## ## Create an array by accumulating the elements of a vector into the ## positions defined by their subscripts. diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/accumdim.m --- a/scripts/general/accumdim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/accumdim.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} accumdim (@var{subs}, @var{vals}, @var{dim}, @var{n}, @var{func}, @var{fillval}) +## @deftypefn {} {@var{A} =} accumdim (@var{subs}, @var{vals}) +## @deftypefnx {} {@var{A} =} accumdim (@var{subs}, @var{vals}, @var{dim}) +## @deftypefnx {} {@var{A} =} accumdim (@var{subs}, @var{vals}, @var{dim}, @var{n}) +## @deftypefnx {} {@var{A} =} accumdim (@var{subs}, @var{vals}, @var{dim}, @var{n}, @var{func}) +## @deftypefnx {} {@var{A} =} accumdim (@var{subs}, @var{vals}, @var{dim}, @var{n}, @var{func}, @var{fillval}) ## Create an array by accumulating the slices of an array into the ## positions defined by their subscripts along a specified dimension. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/bincoeff.m --- a/scripts/general/bincoeff.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/bincoeff.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} bincoeff (@var{n}, @var{k}) +## @deftypefn {} {@var{b} =} bincoeff (@var{n}, @var{k}) ## Return the binomial coefficient of @var{n} and @var{k}. ## ## The binomial coefficient is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/bitcmp.m --- a/scripts/general/bitcmp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/bitcmp.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} bitcmp (@var{A}, @var{k}) +## @deftypefn {} {@var{C} =} bitcmp (@var{A}, @var{k}) ## Return the @var{k}-bit complement of integers in @var{A}. ## ## If @var{k} is omitted @code{k = log2 (flintmax) + 1} is assumed. diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/bitget.m --- a/scripts/general/bitget.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/bitget.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{c} =} bitget (@var{A}, @var{n}) -## Return the status of bit(s) @var{n} of the unsigned integers in @var{A}. +## @deftypefn {} {@var{b} =} bitget (@var{A}, @var{n}) +## Return the bit value at position(s) @var{n} of the unsigned integers in +## @var{A}. ## ## The least significant bit is @var{n} = 1. ## @@ -40,7 +41,7 @@ ## Liberally based of the version by Kai Habel from Octave Forge -function C = bitget (A, n) +function b = bitget (A, n) if (nargin != 2) print_usage (); @@ -87,7 +88,7 @@ error ("bitget: N must be in the range [1,%d]", Amax); endif - C = bitand (A, bitshift (_conv (1), uint8 (n) - uint8 (1))) != _conv (0); + b = bitand (A, bitshift (_conv (1), uint8 (n) - uint8 (1))) != _conv (0); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/bitset.m --- a/scripts/general/bitset.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/bitset.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{C} =} bitset (@var{A}, @var{n}) -## @deftypefnx {} {@var{C} =} bitset (@var{A}, @var{n}, @var{val}) -## Set or reset bit(s) @var{n} of the unsigned integers in @var{A}. +## @deftypefn {} {@var{B} =} bitset (@var{A}, @var{n}) +## @deftypefnx {} {@var{B} =} bitset (@var{A}, @var{n}, @var{val}) +## Set or reset bit(s) at position @var{n} of the unsigned integers in @var{A}. ## ## The least significant bit is @var{n} = 1. @w{@var{val} = 0} resets bits and ## @w{@var{val} = 1} sets bits. If no @var{val} is specified it defaults to @@ -62,7 +62,7 @@ ## @seealso{bitand, bitor, bitxor, bitget, bitcmp, bitshift, intmax, flintmax} ## @end deftypefn -function C = bitset (A, n, val = true) +function B = bitset (A, n, val = true) if (nargin < 2) print_usage (); @@ -79,28 +79,28 @@ ## Special case of empty input if (isempty (A)) - C = []; + B = []; return; endif sz = size (A); - cl = class (A); + cls = class (A); if (isfloat (A) && isreal (A)) - Bmax = flintmax (cl); + Bmax = flintmax (cls); Amax = ceil (log2 (Bmax)); elseif (isinteger (A)) - Bmax = intmax (cl); + Bmax = intmax (cls); Amax = ceil (log2 (Bmax)); else - error ("bitset: invalid class %s", cl); + error ("bitset: invalid class %s", cls); endif - if (any ((n < 1)(:)) || any ((n > Amax)(:))) + if (any (n(:) < 1) || any (n(:) > Amax)) error ("bitset: N must be in the range [1,%d]", Amax); endif - mask = bitshift (cast (1, cl), uint8 (n) - uint8 (1)); + mask = bitshift (cast (1, cls), uint8 (n) - uint8 (1)); on = logical (val); off = ! on; @@ -113,9 +113,9 @@ offmask = mask(off); endif - C = zeros (sz, cl); - C(on) = bitor (A(on), onmask); - C(off) = bitand (A(off), bitcmp (offmask)); + B = zeros (sz, cls); + B(on) = bitor (A(on), onmask); + B(off) = bitand (A(off), bitcmp (offmask)); endfunction @@ -131,6 +131,7 @@ %! endfor %! endfor +## Special case of empty input %!assert (bitset ([], 1), []) %!assert <*36458> (bitset (uint8 ([1, 2;3 4]), 1, [0 1; 0 1]), @@ -145,16 +146,16 @@ %!error bitset () %!error bitset (1) %!error bitset (-1, 2) +%!error bitset ([1 2], [1 2 3]) %!error bitset (1, [1 2], [1 2 3]) -%!error bitset ([1 2], [1 2 3]) %!error bitset ("1", 2) %!error bitset (0, 0) %!error bitset (0, 55) %!error bitset (single (0), 0) %!error bitset (single (0), 26) -%!error bitset (uint8 (0), 0) +%!error bitset (int8 (0), 0) +%!error bitset (int8 (0), 9) %!error bitset (uint8 (0), 9) -%!error bitset (int8 (0), 9) %!error bitset (int16 (0), 17) %!error bitset (uint16 (0), 17) %!error bitset (int32 (0), 33) diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/blkdiag.m --- a/scripts/general/blkdiag.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/blkdiag.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} blkdiag (@var{A}, @var{B}, @var{C}, @dots{}) +## @deftypefn {} {@var{M} =} blkdiag (@var{A}, @var{B}, @var{C}, @dots{}) ## Build a block diagonal matrix from @var{A}, @var{B}, @var{C}, @dots{} ## ## All arguments must be numeric and either two-dimensional matrices or @@ -32,7 +32,7 @@ ## @seealso{diag, horzcat, vertcat, sparse} ## @end deftypefn -function retval = blkdiag (varargin) +function M = blkdiag (varargin) if (nargin < 1) print_usage (); @@ -53,15 +53,15 @@ csz = cumsum ([0 0; tmp], 1); if (any (cellfun ("issparse", varargin))) - retval = sparse (csz(end,1), csz(end,2)); + M = sparse (csz(end,1), csz(end,2)); else - retval = zeros (csz(end,:)); + M = zeros (csz(end,:)); endif for p = 1:nargin vp = varargin{p}; if (! isempty (vp)) - retval((csz(p,1)+1):csz(p+1,1),(csz(p,2)+1):csz(p+1,2)) = vp; + M((csz(p,1)+1):csz(p+1,1),(csz(p,2)+1):csz(p+1,2)) = vp; endif endfor diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/celldisp.m --- a/scripts/general/celldisp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/celldisp.m Sun Apr 03 11:30:26 2022 -0400 @@ -51,7 +51,7 @@ ## @seealso{disp} ## @end deftypefn -## This is ugly, but seems to be what matlab does.. +## This is ugly, but seems to be what Matlab does.. function celldisp (c, name) diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/cplxpair.m --- a/scripts/general/cplxpair.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/cplxpair.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cplxpair (@var{z}) -## @deftypefnx {} {} cplxpair (@var{z}, @var{tol}) -## @deftypefnx {} {} cplxpair (@var{z}, @var{tol}, @var{dim}) +## @deftypefn {} {@var{zsort} =} cplxpair (@var{z}) +## @deftypefnx {} {@var{zsort} =} cplxpair (@var{z}, @var{tol}) +## @deftypefnx {} {@var{zsort} =} cplxpair (@var{z}, @var{tol}, @var{dim}) ## Sort the numbers @var{z} into complex conjugate pairs ordered by increasing ## real part. ## @@ -57,14 +57,14 @@ ## 2006-05-12 David Bateman - Modified for NDArrays -function y = cplxpair (z, tol, dim) +function zsort = cplxpair (z, tol, dim) if (nargin < 1) print_usage (); endif if (isempty (z)) - y = zeros (size (z)); + zsort = zeros (size (z)); return; endif @@ -108,7 +108,7 @@ [~, idx] = sort (q, 1); midx = idx + rows (idx) * ones (rows (idx), 1) * [0:columns(idx)-1]; z = z(midx); - y = z; + zsort = z; ## For each remaining z, place the value and its conjugate at the start of ## the returned list, and remove them from further consideration. @@ -125,16 +125,16 @@ ## For pairs, select the one with positive imaginary part and use it and ## it's conjugate, but list the negative imaginary pair first. if (imag (z(i,j)) > 0) - y([i, i+1],j) = [conj(z(i,j)), z(i,j)]; + zsort([i, i+1],j) = [conj(z(i,j)), z(i,j)]; else - y([i, i+1],j) = [conj(z(idx+i,j)), z(idx+i,j)]; + zsort([i, i+1],j) = [conj(z(idx+i,j)), z(idx+i,j)]; endif z(idx+i,j) = z(i+1,j); endfor endfor ## Reshape the output matrix. - y = ipermute (reshape (y, sz), perm); + zsort = ipermute (reshape (zsort, sz), perm); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/dblquad.m --- a/scripts/general/dblquad.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/dblquad.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}) -## @deftypefnx {} {} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}) -## @deftypefnx {} {} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}, @var{quadf}) -## @deftypefnx {} {} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}, @var{quadf}, @dots{}) +## @deftypefn {} {@var{q} =} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}) +## @deftypefnx {} {@var{q} =} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}) +## @deftypefnx {} {@var{q} =} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}, @var{quadf}) +## @deftypefnx {} {@var{q} =} dblquad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{tol}, @var{quadf}, @dots{}) ## Numerically evaluate the double integral of @var{f}. ## ## @var{f} is a function handle, inline function, or string containing the name diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/flip.m --- a/scripts/general/flip.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/flip.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} flip (@var{x}) -## @deftypefnx {} {} flip (@var{x}, @var{dim}) -## Return a copy of array @var{x} flipped across dimension @var{dim}. +## @deftypefn {} {@var{B} =} flip (@var{A}) +## @deftypefnx {} {@var{B} =} flip (@var{A}, @var{dim}) +## Return a copy of array @var{A} flipped across dimension @var{dim}. ## ## If @var{dim} is unspecified it defaults to the first non-singleton ## dimension. @@ -59,14 +59,14 @@ ## @seealso{fliplr, flipud, rot90, rotdim, permute, transpose} ## @end deftypefn -function y = flip (x, dim) +function B = flip (A, dim) if (nargin < 1) print_usage (); endif - nd = ndims (x); - sz = size (x); + nd = ndims (A); + sz = size (A); if (nargin == 1) ## Find the first non-singleton dimension. (dim = find (sz > 1, 1)) || (dim = 1); @@ -75,8 +75,8 @@ endif idx(1:max(nd, dim)) = {':'}; - idx{dim} = size (x, dim):-1:1; - y = x(idx{:}); + idx{dim} = size (A, dim):-1:1; + B = A(idx{:}); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/fliplr.m --- a/scripts/general/fliplr.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/fliplr.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fliplr (@var{x}) +## @deftypefn {} {@var{B} =} fliplr (@var{A}) ## Flip array left to right. ## -## Return a copy of @var{x} with the order of the columns reversed. In other -## words, @var{x} is flipped left-to-right about a vertical axis. For example: +## Return a copy of @var{A} with the order of the columns reversed. In other +## words, @var{A} is flipped left-to-right about a vertical axis. For example: ## ## @example ## @group @@ -41,13 +41,13 @@ ## @seealso{flipud, flip, rot90, rotdim} ## @end deftypefn -function y = fliplr (x) +function B = fliplr (A) if (nargin < 1) print_usage (); endif - y = flip (x, 2); + B = flip (A, 2); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/flipud.m --- a/scripts/general/flipud.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/flipud.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} flipud (@var{x}) +## @deftypefn {} {@var{B} =} flipud (@var{A}) ## Flip array upside down. ## -## Return a copy of @var{x} with the order of the rows reversed. In other -## words, @var{x} is flipped upside-down about a horizontal axis. For example: +## Return a copy of @var{A} with the order of the rows reversed. In other +## words, @var{A} is flipped upside-down about a horizontal axis. For example: ## ## @example ## @group @@ -41,12 +41,12 @@ ## @seealso{fliplr, flip, rot90, rotdim} ## @end deftypefn -function y = flipud (x) +function B = flipud (A) if (nargin < 1) print_usage (); endif - y = flip (x, 1); + B = flip (A, 1); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/idivide.m --- a/scripts/general/idivide.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/idivide.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} idivide (@var{x}, @var{y}, @var{op}) +## @deftypefn {} {@var{C} =} idivide (@var{A}, @var{B}, @var{op}) ## Integer division with different rounding rules. ## -## The standard behavior of integer division such as @code{@var{a} ./ @var{b}} +## The standard behavior of integer division such as @code{@var{A} ./ @var{B}} ## is to round the result to the nearest integer. This is not always the ## desired behavior and @code{idivide} permits integer element-by-element ## division to be performed with different treatment for the fractional @@ -36,19 +36,19 @@ ## ## @table @asis ## @item @qcode{"fix"} -## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded +## Calculate @code{@var{A} ./ @var{B}} with the fractional part rounded ## towards zero. ## ## @item @qcode{"round"} -## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded +## Calculate @code{@var{A} ./ @var{B}} with the fractional part rounded ## towards the nearest integer. ## ## @item @qcode{"floor"} -## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded +## Calculate @code{@var{A} ./ @var{B}} with the fractional part rounded ## towards negative infinity. ## ## @item @qcode{"ceil"} -## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded +## Calculate @code{@var{A} ./ @var{B}} with the fractional part rounded ## towards positive infinity. ## @end table ## @@ -69,10 +69,10 @@ ## @end group ## @end example ## -## @seealso{ldivide, rdivide} +## @seealso{ceil, floor, fix, round, ldivide, rdivide} ## @end deftypefn -function z = idivide (x, y, op) +function C = idivide (A, B, op) if (nargin < 2) print_usage (); @@ -84,74 +84,74 @@ op = tolower (op); endif - if (! isinteger (x) && ! isinteger (y)) - error ("idivide: at least one input (X or Y) must be an integer type"); - elseif (isinteger (x) && isinteger (y) && ! strcmp (class (x), class (y))) - error ("idivide: integer type of X (%s) must match integer type of Y (%s)", - class (x), class (y)); + if (! isinteger (A) && ! isinteger (B)) + error ("idivide: at least one input (A or B) must be an integer type"); + elseif (isinteger (A) && isinteger (B) && ! strcmp (class (A), class (B))) + error ("idivide: integer type of A (%s) must match integer type of B (%s)", + class (A), class (B)); endif - z = x ./ y; + C = A ./ B; if (strcmp (op, "fix")) - ## The following is an optimized version of `z -= (z .* y > x) .* sign (y)`. - if (isscalar (y)) - if (y > 0) - z -= (z * y > x); + ## The following is an optimized version of `C -= (C .* B > A) .* sign (B)`. + if (isscalar (B)) + if (B > 0) + C -= (C * B > A); else - z += (z * y > x); + C += (C * B > A); endif else - y_sel = (y > 0); - if (isscalar (x)) - z(y_sel) -= (z(y_sel) .* y(y_sel) > x); + y_sel = (B > 0); + if (isscalar (A)) + C(y_sel) -= (C(y_sel) .* B(y_sel) > A); y_sel = ! y_sel; - z(y_sel) += (z(y_sel) .* y(y_sel) > x); + C(y_sel) += (C(y_sel) .* B(y_sel) > A); else - z(y_sel) -= (z(y_sel) .* y(y_sel) > x(y_sel)); + C(y_sel) -= (C(y_sel) .* B(y_sel) > A(y_sel)); y_sel = ! y_sel; - z(y_sel) += (z(y_sel) .* y(y_sel) > x(y_sel)); + C(y_sel) += (C(y_sel) .* B(y_sel) > A(y_sel)); endif endif elseif (strcmp (op, "round")) return; elseif (strcmp (op, "floor")) - ## The following is an optimized version of `z -= (z .* abs (y) > sign (y) .* x)`. - if (isscalar (y)) - if (y > 0) - z -= (z * y > x); + ## The following is an optimized version of `C -= (C .* abs (B) > sign (B) .* A)`. + if (isscalar (B)) + if (B > 0) + C -= (C * B > A); else - z -= (z * y < x); + C -= (C * B < A); endif else - y_sel = (y > 0); - if (isscalar (x)) - z(y_sel) -= (z(y_sel) .* y(y_sel) > x); + y_sel = (B > 0); + if (isscalar (A)) + C(y_sel) -= (C(y_sel) .* B(y_sel) > A); y_sel = ! y_sel; - z(y_sel) -= (z(y_sel) .* y(y_sel) < x); + C(y_sel) -= (C(y_sel) .* B(y_sel) < A); else - z(y_sel) -= (z(y_sel) .* y(y_sel) > x(y_sel)); + C(y_sel) -= (C(y_sel) .* B(y_sel) > A(y_sel)); y_sel = ! y_sel; - z(y_sel) -= (z(y_sel) .* y(y_sel) < x(y_sel)); + C(y_sel) -= (C(y_sel) .* B(y_sel) < A(y_sel)); endif endif elseif (strcmp (op, "ceil")) - ## The following is an optimized version of `z += (z .* abs (y) < sign (y) .* x)`. - if (isscalar (y)) - if (y > 0) - z += (z * y < x); + ## The following is an optimized version of `C += (C .* abs (B) < sign (B) .* A)`. + if (isscalar (B)) + if (B > 0) + C += (C * B < A); else - z += (z * y > x); + C += (C * B > A); endif else - y_sel = (y > 0); - if (isscalar (x)) - z(y_sel) += (z(y_sel) .* y(y_sel) < x); + y_sel = (B > 0); + if (isscalar (A)) + C(y_sel) += (C(y_sel) .* B(y_sel) < A); y_sel = ! y_sel; - z(y_sel) += (z(y_sel) .* y(y_sel) > x); + C(y_sel) += (C(y_sel) .* B(y_sel) > A); else - z(y_sel) += (z(y_sel) .* y(y_sel) < x(y_sel)); + C(y_sel) += (C(y_sel) .* B(y_sel) < A(y_sel)); y_sel = ! y_sel; - z(y_sel) += (z(y_sel) .* y(y_sel) > x(y_sel)); + C(y_sel) += (C(y_sel) .* B(y_sel) > A(y_sel)); endif endif else @@ -201,5 +201,5 @@ %!error idivide (uint8 (1), 2, 3) %!error idivide (1, 2) %!error idivide ({1}, 2) -%!error idivide (int8 (1), uint8 (2)) +%!error idivide (int8 (1), uint8 (2)) %!error idivide (int8 (1), 2, "foo") diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/int2str.m --- a/scripts/general/int2str.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/int2str.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} int2str (@var{n}) +## @deftypefn {} {@var{str} =} int2str (@var{n}) ## Convert an integer (or array of integers) to a string (or a character ## array). ## @@ -58,7 +58,7 @@ ## @seealso{sprintf, num2str, mat2str} ## @end deftypefn -function retval = int2str (n) +function str = int2str (n) if (nargin < 1) print_usage (); @@ -67,10 +67,10 @@ endif if (ischar (n)) - retval = n; + str = n; return; elseif (isempty (n)) - retval = ""; + str = ""; return; endif @@ -96,7 +96,7 @@ n = permute (n, [2, 3:nd, 1]); fmt = [repmat(fmt, 1, nc), "\n"]; strtmp = sprintf (fmt, n); - retval = strtrim (char (ostrsplit (strtmp, "\n", true))); + str = strtrim (char (ostrsplit (strtmp, "\n", true))); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/interp2.m --- a/scripts/general/interp2.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/interp2.m Sun Apr 03 11:30:26 2022 -0400 @@ -69,7 +69,8 @@ ## interpolation with smooth first derivative. ## ## @item @qcode{"cubic"} -## Cubic interpolation (same as @qcode{"pchip"}). +## Cubic interpolation using a convolution kernel function---third order +## method with smooth first derivative. ## ## @item @qcode{"spline"} ## Cubic spline interpolation---smooth first and second derivatives @@ -149,7 +150,7 @@ ## Calculate the interleaved input vectors. p = 2^n; XI = (p:p*zc)/p; - YI = (p:p*zr)'/p; + YI = (p:p*zr).'/p; endif if (! isnumeric (XI) || ! isnumeric (YI)) error ("interp2: XI, YI must be numeric"); @@ -180,7 +181,13 @@ error ("interp2: Y must be strictly monotonic"); endif - if (any (strcmp (method, {"nearest", "linear", "pchip", "cubic"}))) + if (strcmp (method, "cubic") && (rows (Z) < 3 || columns (Z) < 3)) + warning (["interp2: cubic requires at least 3 points in each " ... + "dimension. Falling back to linear interpolation."]); + method = "linear"; + endif + + if (any (strcmp (method, {"nearest", "linear", "pchip"}))) ## If Xi and Yi are vectors of different orientation build a grid if ((isrow (XI) && iscolumn (YI)) || (iscolumn (XI) && isrow (YI))) @@ -244,30 +251,17 @@ idx = sub2ind (size (Z), yidx+jj, xidx+ii); ZI = Z(idx); - elseif (strcmp (method, "pchip") || strcmp (method, "cubic")) + elseif (strcmp (method, "pchip")) if (length (X) < 2 || length (Y) < 2) - error ("interp2: %s requires at least 2 points in each dimension", - method); + error ("interp2: pchip requires at least 2 points in each dimension"); endif ## first order derivatives DX = __pchip_deriv__ (X, Z, 2); DY = __pchip_deriv__ (Y, Z, 1); ## Compute mixed derivatives row-wise and column-wise. Use the average. - DXY = (__pchip_deriv__ (X, DY, 2) + __pchip_deriv__ (Y, DX, 1))/2; - - if (iscomplex (Z)) - ## __pchip_deriv__ works only on real part. Do it again for imag part. - ## FIXME: Adapt __pchip_deriv__ to correctly handle complex input. - - ## first order derivatives - DX += 1i * __pchip_deriv__ (X, imag (Z), 2); - DY += 1i * __pchip_deriv__ (Y, imag (Z), 1); - ## Compute mixed derivatives row-wise and column-wise. Use the average. - DXY += 1i * (__pchip_deriv__ (X, imag (DY), 2) - + __pchip_deriv__ (Y, imag (DX), 1))/2; - endif + DXY = (__pchip_deriv__ (X, DY, 2) + __pchip_deriv__ (Y, DX, 1)) / 2; ## do the bicubic interpolation hx = diff (X); hx = hx(xidx); @@ -304,19 +298,19 @@ yb{1,1} = t2 + 1; ZI = zeros (size (XI)); - for i = 1:2 - for j = 1:2 - zidx = sub2ind (size (Z), yidx+(j-1), xidx+(i-1)); - ZI += xb{1,i} .* yb{1,j} .* Z(zidx); - ZI += xb{2,i} .* yb{1,j} .* DX(zidx); - ZI += xb{1,i} .* yb{2,j} .* DY(zidx); - ZI += xb{2,i} .* yb{2,j} .* DXY(zidx); + for ix = 1:2 + for iy = 1:2 + zidx = sub2ind (size (Z), yidx+(iy-1), xidx+(ix-1)); + ZI += xb{1,ix} .* yb{1,iy} .* Z(zidx); + ZI += xb{2,ix} .* yb{1,iy} .* DX(zidx); + ZI += xb{1,ix} .* yb{2,iy} .* DY(zidx); + ZI += xb{2,ix} .* yb{2,iy} .* DXY(zidx); endfor endfor endif - else + else # cubic or spline methods ## Check dimensions of XI and YI if (isvector (XI) && isvector (YI) && ! size_equal (XI, YI)) @@ -326,15 +320,50 @@ endif if (strcmp (method, "spline")) - if (isgriddata (XI) && isgriddata (YI')) + if (isgriddata (XI) && isgriddata (YI.')) ZI = __splinen__ ({Y, X}, Z, {YI(:,1), XI(1,:)}, extrap, "spline"); else error ("interp2: XI, YI must have uniform spacing ('meshgrid' format)"); endif - endif + return; # spline doesn't use extrapolation value (MATLAB compatibility) + elseif (strcmp (method, "cubic")) + ## reduce to vectors if interpolation points are a meshgrid + if (size_equal (XI, YI) && all (all (XI(1, :) == XI & YI(:, 1) == YI))) + XI = XI(1, :); + YI = YI(:, 1); + endif + + ## make X a row vector + X = X.'; - return; # spline doesn't need NA extrapolation value (MATLAB compatibility) + ## quadratic padding + additional zeros for the special case of copying + ## the last line (like x=1:5, xi=5, requires to have indices 6 and 7) + row_1 = 3*Z(1, :, :) - 3*Z(2, :, :) + Z(3, :, :); + row_end = 3*Z(end, :, :) - 3*Z(end-1, :, :) + Z(end-2, :, :); + ZI = [3*row_1(:, 1, :) - 3*row_1(:, 2, :) + row_1(:, 3, :), ... + row_1, ... + 3*row_1(:, end, :) - 3*row_1(:, end-1, :) + row_1(:, end-2, :), ... + 0; + # + 3*Z(:, 1, :) - 3*Z(:, 2, :) + Z(:, 3, :), ... + Z, ... + 3*Z(:, end, :) - 3*Z(:, end-1, :) + Z(:, end-2, :), ... + zeros(rows (Z), 1, size (Z, 3)); + # + 3*row_end(:, 1, :) - 3*row_end(:, 2, :) + row_end(:, 3, :), ... + row_end, ... + 3*row_end(:, end, :) - 3*row_end(:, end-1, :) + row_end(:, end-2, :), ... + 0; + zeros(1, columns (Z) + 3, size (Z, 3))]; + ## interpolate + if (isrow (XI) && iscolumn (YI)) + ZI = conv_interp_vec (ZI, Y, YI, @cubic, [-2, 2], 1); + ZI = conv_interp_vec (ZI, X, XI, @cubic, [-2, 2], 2); + else + ZI = conv_interp_pairs (ZI, X, Y, XI, YI, @cubic, [-2, 2]); + endif + endif endif ## extrapolation 'extrap' @@ -367,6 +396,70 @@ b = ! any (d1(:) != 0); endfunction +## cubic convolution kernel with a = -0.5 for MATLAB compatibility. +function w = cubic (h) + + absh = abs (h); + absh01 = absh <= 1; + absh12 = absh <= 2 & ! absh01; + absh_sqr = absh .* absh; + absh_cube = absh_sqr .* absh; + w = ... # for |h| <= 1 + (1.5 * absh_cube - 2.5 * absh_sqr + 1) .* absh01 ... + ... # for 1 < |h| <= 2 + + (-0.5 * absh_cube + 2.5 * absh_sqr - 4 * absh + 2) .* absh12; + +endfunction + +## bicubic interpolation of full matrix in one direction with vector +function out = conv_interp_vec (Z, XY, XIYI, kernel, kernel_bounds, axis) + + ## allocate output + out_shape = size (Z); + out_shape(axis) = length (XIYI); + out = zeros (out_shape); + + ## get indexes and distances h + spread = abs (XY(1) - XY(2)); + idx = lookup (XY, XIYI, "l"); + h = (XIYI - XY(idx)) / spread; + idx += -kernel_bounds(1) - 1; # apply padding for indexes + + ## interpolate + for shift = kernel_bounds(1)+1 : kernel_bounds(2) + if (axis == 1) + out += Z(idx + shift, :) .* kernel (shift - h); + else + out += Z(:, idx + shift) .* kernel (shift - h); + endif + endfor + +endfunction + +## bicubic interpolation of arbitrary XI-YI-pairs +function out = conv_interp_pairs (Z, X, Y, XI, YI, kernel, kernel_bounds) + + spread_x = abs (X(1, 1) - X(1, 2)); + spread_y = abs (Y(1, 1) - Y(2, 1)); + idx_x = lookup (X, XI, "l"); + idx_y = lookup (Y, YI, "l"); + h_x = (XI - reshape (X(idx_x), size (idx_x))) / spread_x; + h_y = (YI - reshape (Y(idx_y), size (idx_y))) / spread_y; + + # adjust indexes for padding + idx_x += -kernel_bounds(1) - 1; + idx_y += -kernel_bounds(1) - 1; + + shifts = kernel_bounds(1)+1 : kernel_bounds(2); + [SX(1,1,:,:), SY(1,1,:,:)] = meshgrid (shifts, shifts); + pixels = Z(sub2ind (size (Z), idx_y + SY, idx_x + SX)); + kernel_y = kernel (reshape (shifts, 1, 1, [], 1) - h_y); + kernel_x = kernel (reshape (shifts, 1, 1, 1, []) - h_x); + out_x = sum (pixels .* kernel_x, 4); + out = sum (out_x .* kernel_y, 3); + +endfunction + %!demo %! clf; @@ -374,7 +467,7 @@ %! A = [13,-1,12;5,4,3;1,6,2]; %! x = [0,1,4]; y = [10,11,12]; %! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; +%! yi = linspace (min (y), max (y), 26).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "linear")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -383,9 +476,9 @@ %! clf; %! colormap ("default"); %! [x,y,A] = peaks (10); -%! x = x(1,:)'; y = y(:,1); +%! x = x(1,:).'; y = y(:,1); %! xi = linspace (min (x), max (x), 41); -%! yi = linspace (min (y), max (y), 41)'; +%! yi = linspace (min (y), max (y), 41).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "linear")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -396,7 +489,7 @@ %! A = [13,-1,12;5,4,3;1,6,2]; %! x = [0,1,4]; y = [10,11,12]; %! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; +%! yi = linspace (min (y), max (y), 26).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "nearest")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -405,33 +498,31 @@ %! clf; %! colormap ("default"); %! [x,y,A] = peaks (10); -%! x = x(1,:)'; y = y(:,1); +%! x = x(1,:).'; y = y(:,1); %! xi = linspace (min (x), max (x), 41); -%! yi = linspace (min (y), max (y), 41)'; +%! yi = linspace (min (y), max (y), 41).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "nearest")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; -## 'pchip' commented out since it is the same as 'cubic' -%!#demo +%!demo %! clf; %! colormap ("default"); %! A = [13,-1,12;5,4,3;1,6,2]; %! x = [0,1,2]; y = [10,11,12]; %! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; +%! yi = linspace (min (y), max (y), 26).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "pchip")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; -## 'pchip' commented out since it is the same as 'cubic' -%!#demo +%!demo %! clf; %! colormap ("default"); %! [x,y,A] = peaks (10); -%! x = x(1,:)'; y = y(:,1); +%! x = x(1,:).'; y = y(:,1); %! xi = linspace (min (x), max (x), 41); -%! yi = linspace (min (y), max (y), 41)'; +%! yi = linspace (min (y), max (y), 41).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "pchip")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -442,7 +533,7 @@ %! A = [13,-1,12;5,4,3;1,6,2]; %! x = [0,1,2]; y = [10,11,12]; %! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; +%! yi = linspace (min (y), max (y), 26).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "cubic")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -451,9 +542,9 @@ %! clf; %! colormap ("default"); %! [x,y,A] = peaks (10); -%! x = x(1,:)'; y = y(:,1); +%! x = x(1,:).'; y = y(:,1); %! xi = linspace (min (x), max (x), 41); -%! yi = linspace (min (y), max (y), 41)'; +%! yi = linspace (min (y), max (y), 41).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "cubic")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -464,7 +555,7 @@ %! A = [13,-1,12;5,4,3;1,6,2]; %! x = [0,1,2]; y = [10,11,12]; %! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; +%! yi = linspace (min (y), max (y), 26).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "spline")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; @@ -473,36 +564,115 @@ %! clf; %! colormap ("default"); %! [x,y,A] = peaks (10); -%! x = x(1,:)'; y = y(:,1); +%! x = x(1,:).'; y = y(:,1); %! xi = linspace (min (x), max (x), 41); -%! yi = linspace (min (y), max (y), 41)'; +%! yi = linspace (min (y), max (y), 41).'; %! mesh (xi,yi,interp2 (x,y,A,xi,yi, "spline")); %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x,y,A,"b*"); hold off; +%!shared x, y, orig, xi, yi, expected %!test # simple test %! x = [1,2,3]; %! y = [4,5,6,7]; %! [X, Y] = meshgrid (x, y); %! orig = X.^2 + Y.^3; -%! xi = [1.2,2, 1.5]; -%! yi = [6.2, 4.0, 5.0]'; +%! xi = [0.8, 1.2, 2.0, 1.5]; +%! yi = [6.2, 4.0, 5.0, 7.1].'; +%! +%! # check nearest neighbor +%! expected = ... +%! [NA, 217, 220, 220; +%! NA, 65, 68, 68; +%! NA, 126, 129, 129; +%! NA, NA, NA, NA]; +%! result = interp2 (x, y, orig, xi, yi, "nearest"); +%! assert (result, expected); %! +%! # check invariance of translation +%! result = interp2 (x+3, y-7, orig, xi+3, yi-7, "nearest"); +%! assert (result, expected); +%! +%! # check invariance of scaling +%! result = interp2 (x*3, y*(-7), orig, xi*3, yi*(-7), "nearest"); +%! assert (result, expected); +%! +%! # check interpolation with index pairs +%! result = interp2 (x, y, orig, xi(2:4), yi(1:3).', "nearest"); +%! assert (result, expected(sub2ind(size(expected), 1:3, 2:4))); +%! +%! # check bilinear interpolation %! expected = ... -%! [243, 245.4, 243.9; -%! 65.6, 68, 66.5; -%! 126.6, 129, 127.5]; -%! result = interp2 (x,y,orig, xi, yi); +%! [NA, 243, 245.4, 243.9; +%! NA, 65.6, 68, 66.5; +%! NA, 126.6, 129, 127.5; +%! NA, NA, NA, NA]; +%! result = interp2 (x, y, orig, xi, yi); +%! assert (result, expected, 1000*eps); +%! +%! # check invariance of translation +%! result = interp2 (x+3, y-7, orig, xi+3, yi-7); +%! assert (result, expected, 1000*eps); +%! +%! # check invariance of scaling +%! result = interp2 (x*3, y*(-7), orig, xi*3, yi*(-7)); +%! assert (result, expected, 1000*eps); +%! +%! # check interpolation with index pairs +%! result = interp2 (x, y, orig, xi(2:4), yi(1:3).'); +%! assert (result, expected(sub2ind(size(expected), 1:3, 2:4)), 1000*eps); +%! +%! # check spline interpolation +%! expected = ... +%! [238.968, 239.768, 242.328, 240.578; +%! 64.64, 65.44, 68, 66.25; +%! 125.64, 126.44, 129, 127.25; +%! 358.551, 359.351, 361.911, 360.161]; +%! result = interp2 (x, y, orig, xi, yi, "spline"); +%! assert (result, expected, 1000*eps); %! +%! # check invariance of translation +%! result = interp2 (x+3, y-7, orig, xi+3, yi-7, "spline"); %! assert (result, expected, 1000*eps); +%! +%! # check invariance of scaling +%! result = interp2 (x*3, y*(-7), orig, xi*3, yi*(-7), "spline"); +%! assert (result, expected, 1000*eps); +%! +%!test <62133> +%! # FIXME: spline interpolation does not support index pairs, Matlab does. +%! result = interp2 (x, y, orig, xi(2:4), yi(1:3).', "spline"); +%! assert (result, expected(sub2ind(size(expected), 1:3, 2:4)), 1000*eps); +%! +%!test <*61754> +%! # check bicubic interpolation +%! expected = ... +%! [NA, 239.96, 242.52, 240.77; +%! NA, 65.44, 68, 66.25; +%! NA, 126.44, 129, 127.25; +%! NA, NA, NA, NA]; +%! result = interp2 (x, y, orig, xi, yi, "cubic"); +%! assert (result, expected, 10000*eps); +%! +%! # check invariance of translation +%! result = interp2 (x+3, y-7, orig, xi+3, yi-7, "cubic"); +%! assert (result, expected, 10000*eps); +%! +%! # check invariance of scaling +%! result = interp2 (x*3, y*(-7), orig, xi*3, yi*(-7), "cubic"); +%! assert (result, expected, 10000*eps); +%! +%! # check interpolation with index pairs +%! result = interp2 (x, y, orig, xi(2:4), yi(1:3).', "cubic"); +%! assert (result, expected(sub2ind(size(expected), 1:3, 2:4)), 10000*eps); ## Test that interpolating a complex matrix is equivalent to interpolating its ## real and imaginary parts separately. -%!test <61863> +%!test <*61863> %! xi = [2.5, 3.5]; -%! yi = [0.5, 1.5]'; -%! orig = rand (2, 3) + 1i * rand (2, 3); -%! for method = {"nearest", "linear", "pchip", "spline"} +%! yi = [0.5, 1.5].'; +%! orig = rand (4, 3) + 1i * rand (4, 3); +%! for method = {"nearest", "linear", "pchip", "cubic", "spline"} %! interp_complex = interp2 (orig, xi, yi, method{1}); %! interp_real = interp2 (real (orig), xi, yi, method{1}); %! interp_imag = interp2 (imag (orig), xi, yi, method{1}); @@ -515,7 +685,7 @@ %! y = [4,5,6,7]; %! [X, Y] = meshgrid (x, y); %! orig = X.^2 + Y.^3; -%! xi = [1:0.25:3]; yi = [4:0.25:7]'; +%! xi = [1:0.25:3]; yi = [4:0.25:7].'; %! expected = interp2 (x,y,orig, xi, yi); %! result = interp2 (orig, 2); %! @@ -535,18 +705,20 @@ %! [X, Y] = meshgrid (x,y); %! orig = X.^2 + Y.^3; %! xi = [0,4]; -%! yi = [3,8]'; +%! yi = [3,8].'; %! assert (interp2 (x,y,orig, xi, yi), [NA,NA;NA,NA]); %! assert (interp2 (x,y,orig, xi, yi,"linear", 0), [0,0;0,0]); %! assert (interp2 (x,y,orig, xi, yi,"linear", 2), [2,2;2,2]); %! assert (interp2 (x,y,orig, xi, yi,"spline", 2), [2,2;2,2]); %! assert (interp2 (x,y,orig, xi, yi,"linear", 0+1i), [0+1i,0+1i;0+1i,0+1i]); %! assert (interp2 (x,y,orig, xi, yi,"spline"), [27,43;512,528]); +%! assert (interp2 (x,y,orig, xi, yi,"cubic"), [NA,NA;NA,NA]); +%! assert (interp2 (x,y,orig, xi, yi,"cubic", 2), [2,2;2,2]); %!test # for values at boundaries %! A = [1,2;3,4]; %! x = [0,1]; -%! y = [2,3]'; +%! y = [2,3].'; %! assert (interp2 (x,y,A,x,y,"linear"), A); %! assert (interp2 (x,y,A,x,y,"nearest"), A); @@ -569,20 +741,26 @@ %!assert (interp2 (z), zout, tol) %!assert (interp2 (z, "linear"), zout, tol) %!assert (interp2 (z, "pchip"), zout, tol) -%!assert (interp2 (z, "cubic"), zout, 10 * tol) +%!assert (interp2 (z, "cubic"), zout, tol) %!assert (interp2 (z, "spline"), zout, tol) -%!assert (interp2 (z, [2 3 1], [2 2 2]', "linear"), +%!assert (interp2 (z, [2 3 1], [2 2 2].', "linear"), %! repmat ([5, 7, 3], [3, 1]), tol) -%!assert (interp2 (z, [2 3 1], [2 2 2]', "pchip"), +%!assert (interp2 (z, [2 3 1], [2 2 2].', "pchip"), %! repmat ([5, 7, 3], [3, 1]), tol) -%!assert (interp2 (z, [2 3 1], [2 2 2]', "cubic"), -%! repmat ([5, 7, 3], [3, 1]), 10 * tol) -%!assert (interp2 (z, [2 3 1], [2 2 2]', "spline"), +%!assert (interp2 (z, [2 3 1], [2 2 2].', "cubic"), +%! repmat ([5, 7, 3], [3, 1]), tol) +%!assert (interp2 (z, [2 3 1], [2 2 2].', "spline"), %! repmat ([5, 7, 3], [3, 1]), tol) %!assert (interp2 (z, [2 3 1], [2 2 2], "linear"), [5 7 3], tol) %!assert (interp2 (z, [2 3 1], [2 2 2], "pchip"), [5 7 3], tol) -%!assert (interp2 (z, [2 3 1], [2 2 2], "cubic"), [5 7 3], 10 * tol) +%!assert (interp2 (z, [2 3 1], [2 2 2], "cubic"), [5 7 3], tol) %!assert (interp2 (z, [2 3 1], [2 2 2], "spline"), [5 7 3], tol) +%!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "linear"), [7; 9; 5], tol) +%!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "pchip"), [7; 9; 5], tol) +%!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "cubic"), [7; 9; 5], tol) +%!test <62132> +%! # FIXME: single column yields single row with spline interpolation (numbers are correct) +%! assert (interp2 (z, [3; 3; 3], [2; 3; 1], "spline"), [7; 9; 5], tol) ## Test input validation %!error interp2 (1, 1, 1, 1, 1, 2) # only 5 numeric inputs @@ -594,10 +772,10 @@ %!error interp2 (ones (2), -1) %!error interp2 (ones (2), 1.5) %!warning interp2 (rand (3,3), 1, "*linear"); -%!error interp2 (1, 1, 1, 1, 1, 'linear', {1}) -%!error interp2 (1, 1, 1, 1, 1, 'linear', ones (2,2)) -%!error interp2 (1, 1, 1, 1, 1, 'linear', "abc") -%!error interp2 (1, 1, 1, 1, 1, 'linear', "extrap") +%!error interp2 (1, 1, 1, 1, 1, "linear", {1}) +%!error interp2 (1, 1, 1, 1, 1, "linear", ones (2,2)) +%!error interp2 (1, 1, 1, 1, 1, "linear", "abc") +%!error interp2 (1, 1, 1, 1, 1, "linear", "extrap") %!error interp2 ({1}, 1, ones (2), 1, 1) %!error interp2 (1, {1}, ones (2), 1, 1) %!error interp2 (1, 1, ones (2), {1}, 1) @@ -608,6 +786,7 @@ %!error interp2 (1:2, 1:2, ones (3,2), 1, 1) %!error interp2 ([1 0 2], 1:3, ones (3,3), 1, 1) %!error interp2 (1:3, [1 0 2], ones (3,3), 1, 1) +%!warning interp2 (eye(2), 1.5, 1.5, "cubic"); %!error interp2 (1:2, 1:2, ones (2), ones (2,2), 1) %!error interp2 (1:2, 1:2, ones (2), 1, ones (2,2)) %!error interp2 (1:2, 1:2, ones (2), [1 2 4], [1 2 3], "spline") diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/interpft.m --- a/scripts/general/interpft.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/interpft.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} interpft (@var{x}, @var{n}) -## @deftypefnx {} {} interpft (@var{x}, @var{n}, @var{dim}) +## @deftypefn {} {@var{y} =} interpft (@var{x}, @var{n}) +## @deftypefnx {} {@var{y} =} interpft (@var{x}, @var{n}, @var{dim}) ## ## Fourier interpolation. ## @@ -41,7 +41,7 @@ ## @seealso{interp1} ## @end deftypefn -function z = interpft (x, n, dim) +function y = interpft (x, n, dim) if (nargin < 2) print_usage (); @@ -70,36 +70,36 @@ m = rows (x); inc = ceil (m/n); - y = fft (x) / m; + xfft = fft (x) / m; k = ceil (m / 2); sz = size (x); sz(1) = n * inc - m; idx = repmat ({':'}, nd, 1); idx{1} = 1:k; - z = cat (1, y(idx{:}), zeros (sz)); + y = cat (1, xfft(idx{:}), zeros (sz)); idx{1} = k+1:m; - z = cat (1, z, y(idx{:})); + y = cat (1, y, xfft(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; + tmp = y(idx{:}) / 2; + y(idx{:}) = tmp; idx{1} = k + 1; - z(idx{:}) = tmp; + y(idx{:}) = tmp; endif - z = n * ifft (z); + y = n * ifft (y); if (inc != 1) sz(1) = n; - z = inc * reshape (z(1:inc:end), sz); + y = inc * reshape (y(1:inc:end), sz); endif - z = ipermute (z, perm); + y = ipermute (y, perm); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/interpn.m --- a/scripts/general/interpn.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/interpn.m Sun Apr 03 11:30:26 2022 -0400 @@ -185,11 +185,6 @@ if (strcmp (method, "linear")) vi = __lin_interpn__ (x{:}, v, y{:}); - if (iscomplex (v)) - ## __lin_interpn__ ignores imaginary part. Do it again for imag part. - ## FIXME: Adapt __lin_interpn__ to correctly handle complex input. - vi += 1i * __lin_interpn__ (x{:}, imag (v), y{:}); - endif vi(isna (vi)) = extrapval; elseif (strcmp (method, "nearest")) ## FIXME: This seems overly complicated. Is there a way to simplify diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/isequal.m --- a/scripts/general/isequal.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/isequal.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isequal (@var{x1}, @var{x2}, @dots{}) +## @deftypefn {} {@var{tf} =} isequal (@var{x1}, @var{x2}, @dots{}) ## Return true if all of @var{x1}, @var{x2}, @dots{} are equal. ## @seealso{isequaln} ## @end deftypefn @@ -46,7 +46,7 @@ ## e. cell compare each member with isequal (recursive) ## f. fcn_handle compare using overloaded "eq" operator -function t = isequal (x, varargin) +function tf = isequal (x, varargin) if (nargin < 2) print_usage (); @@ -65,22 +65,22 @@ ## All arguments must either be of the same class, ## or they must be "numeric" values. if (two_args) - t = (strcmp (class (x), class (y)) - || ((isreal (x) || iscomplex (x)) && (isreal (y) || iscomplex (y)))); + tf = (strcmp (class (x), class (y)) + || ((isreal (x) || iscomplex (x)) && (isreal (y) || iscomplex (y)))); else - t = (all (cellfun ("isclass", varargin, class (x))) - || ((isreal (x) || iscomplex (x)) - && all (cellfun ("isreal", varargin) - | cellfun ("isnumeric", varargin)))); + tf = (all (cellfun ("isclass", varargin, class (x))) + || ((isreal (x) || iscomplex (x)) + && all (cellfun ("isreal", varargin) + | cellfun ("isnumeric", varargin)))); endif ## Test that everything is the same size (which also tests dimensions) - if (t) - t = size_equal (x, varargin{:}); + if (tf) + tf = size_equal (x, varargin{:}); endif ## From here on, compare any objects as if they were structures. - if (t && isobject (x)) + if (tf && isobject (x)) ## Locally suppress class-to-struct warning. We know what we are doing. warning ("off", "Octave:classdef-to-struct", "local"); x = builtin ("struct", x); @@ -98,44 +98,44 @@ ############################################################ ## Check individual classes. - if (t) + if (tf) if (two_args) if (ischar (x) && ischar (y)) ## char type. Optimization, strcmp is ~35% faster than '==' operator. - t = strcmp (x, y); + tf = strcmp (x, y); elseif (isreal (x) || iscomplex (x)) if (issparse (x)) ## sparse types. [xi, xj, xv] = find (x); [yi, yj, yv] = find (y); - t = (length (xi) == length (yi)) && all (xi == yi) ... + tf = (length (xi) == length (yi)) && all (xi == yi) ... && all (xj == yj) && all (xv == yv); else ## general "numeric" type. Use '==' operator. m = (x == y); - t = all (m(:)); + tf = all (m(:)); endif elseif (isstruct (x)) ## struct type. Compare # of fields, fieldnames, then field values. ## Test number of fields are equal. - t = (numfields (x) == numfields (y)); + tf = (numfields (x) == numfields (y)); ## Test that all the field names are equal. - if (t) + if (tf) s_fnm_x = sort (fieldnames (x)); - t = all (strcmp (s_fnm_x, sort (fieldnames (y)))); + tf = all (strcmp (s_fnm_x, sort (fieldnames (y)))); endif ## Test that all field values are equal. Slow because of recursion. - if (t) + if (tf) if (isscalar (x)) for fldnm = s_fnm_x.' - t = isequal (x.(fldnm{1}), y.(fldnm{1})); - if (! t) + tf = isequal (x.(fldnm{1}), y.(fldnm{1})); + if (! tf) break; endif endfor @@ -143,8 +143,8 @@ ## struct arrays have to have the contents of each field wrapped ## in a cell since it expands to a collection of values. for fldnm = s_fnm_x.' - t = isequal ({x.(fldnm{1})}, {y.(fldnm{1})}); - if (! t) + tf = isequal ({x.(fldnm{1})}, {y.(fldnm{1})}); + if (! tf) break; endif endfor @@ -156,20 +156,20 @@ ## FIXME: It would be faster to use strcmp on whole cellstr arrays, ## but bug #51412 needs to be fixed. Instead, time/space trade-off. ## Convert to char (space) for faster processing with strcmp (time). - t = strcmp (char (x), char (y)); + tf = strcmp (char (x), char (y)); elseif (iscell (x)) ## cell type. Check that each element of a cell is equal. Slow. n = numel (x); idx = 1; - while (t && idx <= n) - t = isequal (x{idx}, y{idx}); + while (tf && idx <= n) + tf = isequal (x{idx}, y{idx}); idx += 1; endwhile elseif (is_function_handle (x)) ## function type. Use '==' operator which is overloaded. - t = (x == y); + tf = (x == y); else error ("isequal: Impossible to reach code. File a bug report."); @@ -181,8 +181,8 @@ if (ischar (x) && all (cellfun ("isclass", varargin, "char"))) ## char type. Optimization, strcmp is ~35% faster than '==' operator. idx = 1; - while (t && idx <= nvarargin) - t = strcmp (x, varargin{idx}); + while (tf && idx <= nvarargin) + tf = strcmp (x, varargin{idx}); idx += 1; endwhile @@ -193,11 +193,11 @@ idx = 1; [xi, xj, xv] = find (x); - while (t && idx <= nvarargin) + while (tf && idx <= nvarargin) y = varargin{idx}; [yi, yj, yv] = find (y); - t = (length (xi) == length (yi)) && all (xi == yi) ... - && all (xj == yj) && all (xv == yv); + tf = (length (xi) == length (yi)) && all (xi == yi) ... + && all (xj == yj) && all (xv == yv); idx += 1; endwhile @@ -206,10 +206,10 @@ ## general "numeric" type. Use '==' operator. idx = 1; - while (t && idx <= nvarargin) + while (tf && idx <= nvarargin) y = varargin{idx}; m = (x == y); - t = all (m(:)); + tf = all (m(:)); idx += 1; endwhile @@ -223,21 +223,21 @@ fnm_x = fieldnames (x); n = numel (fnm_x); fnm_v = cellfun ("fieldnames", varargin, "uniformoutput", false); - t = all (n == cellfun ("numel", fnm_v)); + tf = all (n == cellfun ("numel", fnm_v)); ## Test that all the field names are equal. - if (t) + if (tf) fnm_x = sort (fnm_x); idx = 1; - while (t && idx <= nvarargin) + while (tf && idx <= nvarargin) ## Allow the fieldnames to be in a different order. - t = all (strcmp (fnm_x, sort (fnm_v{idx}))); + tf = all (strcmp (fnm_x, sort (fnm_v{idx}))); idx += 1; endwhile endif ## Test that all field values are equal. Slow because of recursion. - if (t) + if (tf) args = cell (1, 1 + nvarargin); if (isscalar (x)) for fldnm = fnm_x.' @@ -246,9 +246,9 @@ args{argn+1} = varargin{argn}.(fldnm{1}); endfor - t = isequal (args{:}); + tf = isequal (args{:}); - if (! t) + if (! tf) break; endif endfor @@ -261,9 +261,9 @@ args{argn+1} = { varargin{argn}.(fldnm{1}) }; endfor - t = isequal (args{:}); + tf = isequal (args{:}); - if (! t) + if (! tf) break; endif endfor @@ -277,8 +277,8 @@ ## Convert to char (space) for faster processing with strcmp (time). idx = 1; x = char (x); - while (t && idx <= nvarargin) - t = strcmp (x, char (varargin{idx})); + while (tf && idx <= nvarargin) + tf = strcmp (x, char (varargin{idx})); idx += 1; endwhile @@ -287,18 +287,18 @@ n = numel (x); args = cell (1, 1 + nvarargin); idx = 1; - while (t && idx <= n) + while (tf && idx <= n) args(1) = x{idx}; args(2:end) = [cellindexmat(varargin, idx){:}]; - t = isequal (args{:}); + tf = isequal (args{:}); idx += 1; endwhile elseif (is_function_handle (x)) ## function type. Use '==' operator which is overloaded. - t = all (cellfun ("eq", {x}, varargin)); + tf = all (cellfun ("eq", {x}, varargin)); else error ("isequal: Impossible to reach code. File a bug report."); @@ -308,7 +308,7 @@ endif endif - t = full (t); # Always return full logical value for Matlab compatibility. + tf = full (tf); # Always return full logical value for Matlab compatibility. endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/isequaln.m --- a/scripts/general/isequaln.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/isequaln.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isequaln (@var{x1}, @var{x2}, @dots{}) +## @deftypefn {} {@var{tf} =} 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). @@ -48,7 +48,7 @@ ## e. cell compare each member with isequaln (recursive) ## f. fcn_handle compare using overloaded "eq" operator -function t = isequaln (x, varargin) +function tf = isequaln (x, varargin) if (nargin < 2) print_usage (); @@ -67,22 +67,22 @@ ## All arguments must either be of the same class, ## or they must be "numeric" values. if (two_args) - t = (strcmp (class (x), class (y)) - || ((isreal (x) || iscomplex (x)) && (isreal (y) || iscomplex (y)))); + tf = (strcmp (class (x), class (y)) + || ((isreal (x) || iscomplex (x)) && (isreal (y) || iscomplex (y)))); else - t = (all (cellfun ("isclass", varargin, class (x))) - || ((isreal (x) || iscomplex (x)) - && all (cellfun ("isreal", varargin) - | cellfun ("isnumeric", varargin)))); + tf = (all (cellfun ("isclass", varargin, class (x))) + || ((isreal (x) || iscomplex (x)) + && all (cellfun ("isreal", varargin) + | cellfun ("isnumeric", varargin)))); endif ## Test that everything is the same size (which also tests dimensions) - if (t) - t = size_equal (x, varargin{:}); + if (tf) + tf = size_equal (x, varargin{:}); endif ## From here on, compare any objects as if they were structures. - if (t && isobject (x)) + if (tf && isobject (x)) ## Locally suppress class-to-struct warning. We know what we are doing. warning ("off", "Octave:classdef-to-struct", "local"); x = builtin ("struct", x); @@ -100,40 +100,40 @@ ############################################################ ## Check individual classes. - if (t) + if (tf) if (two_args) if (ischar (x) && ischar (y)) ## char type. Optimization, strcmp is ~35% faster than '==' operator. - t = strcmp (x, y); + tf = strcmp (x, y); elseif (isreal (x) || iscomplex (x)) ## general "numeric" type. Use '==' operator. m = (x == y); - t = all (m(:)); + tf = all (m(:)); - if (! t && isfloat (x) && isfloat (y)) - t = isnan (x(! m)) && isnan (y(! m)); + if (! tf && isfloat (x) && isfloat (y)) + tf = isnan (x(! m)) && isnan (y(! m)); endif elseif (isstruct (x)) ## struct type. Compare # of fields, fieldnames, then field values. ## Test number of fields are equal. - t = (numfields (x) == numfields (y)); + tf = (numfields (x) == numfields (y)); ## Test that all the field names are equal. - if (t) + if (tf) s_fnm_x = sort (fieldnames (x)); - t = all (strcmp (s_fnm_x, sort (fieldnames (y)))); + tf = all (strcmp (s_fnm_x, sort (fieldnames (y)))); endif ## Test that all field values are equal. Slow because of recursion. - if (t) + if (tf) if (isscalar (x)) for fldnm = s_fnm_x.' - t = isequaln (x.(fldnm{1}), y.(fldnm{1})); - if (! t) + tf = isequaln (x.(fldnm{1}), y.(fldnm{1})); + if (! tf) break; endif endfor @@ -141,8 +141,8 @@ ## struct arrays have to have the contents of each field wrapped ## in a cell since it expands to a collection of values. for fldnm = s_fnm_x.' - t = isequaln ({x.(fldnm{1})}, {y.(fldnm{1})}); - if (! t) + tf = isequaln ({x.(fldnm{1})}, {y.(fldnm{1})}); + if (! tf) break; endif endfor @@ -154,20 +154,20 @@ ## FIXME: It would be faster to use strcmp on whole cellstr arrays, ## but bug #51412 needs to be fixed. Instead, time/space trade-off. ## Convert to char (space) for faster processing with strcmp (time). - t = strcmp (char (x), char (y)); + tf = strcmp (char (x), char (y)); elseif (iscell (x)) ## cell type. Check that each element of a cell is equal. Slow. n = numel (x); idx = 1; - while (t && idx <= n) - t = isequaln (x{idx}, y{idx}); + while (tf && idx <= n) + tf = isequaln (x{idx}, y{idx}); idx += 1; endwhile elseif (is_function_handle (x)) ## function type. Use '==' operator which is overloaded. - t = (x == y); + tf = (x == y); else error ("isequaln: Impossible to reach code. File a bug report."); @@ -179,8 +179,8 @@ if (ischar (x) && all (cellfun ("isclass", varargin, "char"))) ## char type. Optimization, strcmp is ~35% faster than '==' operator. idx = 1; - while (t && idx <= nvarargin) - t = strcmp (x, varargin{idx}); + while (tf && idx <= nvarargin) + tf = strcmp (x, varargin{idx}); idx += 1; endwhile @@ -188,13 +188,13 @@ ## general "numeric" type. Use '==' operator. idx = 1; - while (t && idx <= nvarargin) + while (tf && idx <= nvarargin) y = varargin{idx}; m = (x == y); - t = all (m(:)); + tf = all (m(:)); - if (! t && isfloat (x) && isfloat (y)) - t = isnan (x(! m)) && isnan (y(! m)); + if (! tf && isfloat (x) && isfloat (y)) + tf = isnan (x(! m)) && isnan (y(! m)); endif idx += 1; @@ -207,21 +207,21 @@ fnm_x = fieldnames (x); n = numel (fnm_x); fnm_v = cellfun ("fieldnames", varargin, "uniformoutput", false); - t = all (n == cellfun ("numel", fnm_v)); + tf = all (n == cellfun ("numel", fnm_v)); ## Test that all the field names are equal. - if (t) + if (tf) fnm_x = sort (fnm_x); idx = 1; - while (t && idx <= nvarargin) + while (tf && idx <= nvarargin) ## Allow the fieldnames to be in a different order. - t = all (strcmp (fnm_x, sort (fnm_v{idx}))); + tf = all (strcmp (fnm_x, sort (fnm_v{idx}))); idx += 1; endwhile endif ## Test that all field values are equal. Slow because of recursion. - if (t) + if (tf) args = cell (1, 1 + nvarargin); if (isscalar (x)) for fldnm = fnm_x.' @@ -230,9 +230,9 @@ args{argn+1} = varargin{argn}.(fldnm{1}); endfor - t = isequaln (args{:}); + tf = isequaln (args{:}); - if (! t) + if (! tf) break; endif endfor @@ -245,9 +245,9 @@ args{argn+1} = { varargin{argn}.(fldnm{1}) }; endfor - t = isequaln (args{:}); + tf = isequaln (args{:}); - if (! t) + if (! tf) break; endif endfor @@ -261,8 +261,8 @@ ## Convert to char (space) for faster processing with strcmp (time). idx = 1; x = char (x); - while (t && idx <= nvarargin) - t = strcmp (x, char (varargin{idx})); + while (tf && idx <= nvarargin) + tf = strcmp (x, char (varargin{idx})); idx += 1; endwhile @@ -271,18 +271,18 @@ n = numel (x); args = cell (1, 1 + nvarargin); idx = 1; - while (t && idx <= n) + while (tf && idx <= n) args(1) = x{idx}; args(2:end) = [cellindexmat(varargin, idx){:}]; - t = isequaln (args{:}); + tf = isequaln (args{:}); idx += 1; endwhile elseif (is_function_handle (x)) ## function type. Use '==' operator which is overloaded. - t = all (cellfun ("eq", {x}, varargin)); + tf = all (cellfun ("eq", {x}, varargin)); else error ("isequaln: Impossible to reach code. File a bug report."); @@ -292,7 +292,7 @@ endif endif - t = full (t); # Always return full logical value for Matlab compatibility. + tf = full (tf); # Always return full logical value for Matlab compatibility. endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/logspace.m --- a/scripts/general/logspace.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/logspace.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} logspace (@var{a}, @var{b}) -## @deftypefnx {} {} logspace (@var{a}, @var{b}, @var{n}) -## @deftypefnx {} {} logspace (@var{a}, pi, @var{n}) +## @deftypefn {} {@var{y} =} logspace (@var{a}, @var{b}) +## @deftypefnx {} {@var{y} =} logspace (@var{a}, @var{b}, @var{n}) +## @deftypefnx {} {@var{y} =} logspace (@var{a}, pi, @var{n}) ## Return a row vector with @var{n} elements logarithmically spaced from ## @tex ## $10^{a}$ to $10^{b}$. @@ -72,7 +72,7 @@ ## @seealso{linspace} ## @end deftypefn -function retval = logspace (a, b, n = 50) +function y = logspace (a, b, n = 50) if (nargin < 2) print_usage (); @@ -88,7 +88,7 @@ b = log10 (pi); endif - retval = 10 .^ (linspace (a, b, npoints)); + y = 10 .^ (linspace (a, b, npoints)); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/module.mk --- a/scripts/general/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -64,7 +64,6 @@ %reldir%/rng.m \ %reldir%/rot90.m \ %reldir%/rotdim.m \ - %reldir%/shift.m \ %reldir%/shiftdim.m \ %reldir%/sortrows.m \ %reldir%/sph2cart.m \ diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/num2str.m --- a/scripts/general/num2str.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/num2str.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} num2str (@var{x}) -## @deftypefnx {} {} num2str (@var{x}, @var{precision}) -## @deftypefnx {} {} num2str (@var{x}, @var{format}) +## @deftypefn {} {@var{str} =} num2str (@var{x}) +## @deftypefnx {} {@var{str} =} num2str (@var{x}, @var{precision}) +## @deftypefnx {} {@var{str} =} num2str (@var{x}, @var{format}) ## Convert a number (or array) to a string (or a character array). ## ## The optional second argument may either give the number of significant @@ -78,7 +78,7 @@ ## @seealso{sprintf, int2str, mat2str} ## @end deftypefn -function retval = num2str (x, arg) +function str = num2str (x, arg) if (nargin < 1) print_usage (); @@ -87,9 +87,9 @@ endif if (ischar (x)) - retval = x; + str = x; elseif (isempty (x)) - retval = ""; + str = ""; elseif (isreal (x)) if (nargin == 2) if (ischar (arg)) @@ -143,7 +143,7 @@ fmt = [deblank(repmat (fmt, 1, nc)), "\n"]; endif strtmp = sprintf (fmt, x); - retval = strtrim (char (ostrsplit (strtmp, "\n", true))); + str = strtrim (char (ostrsplit (strtmp, "\n", true))); else # Complex matrix input if (nargin == 2) if (ischar (arg)) @@ -195,7 +195,7 @@ tmp = regexprep (tmp, " +i\n", "i\n"); tmp = regexprep (tmp, "( +)i", "i$1"); - retval = strtrim (char (ostrsplit (tmp(1:end-1), "\n"))); + str = strtrim (char (ostrsplit (tmp(1:end-1), "\n"))); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/polyarea.m --- a/scripts/general/polyarea.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/polyarea.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyarea (@var{x}, @var{y}) -## @deftypefnx {} {} polyarea (@var{x}, @var{y}, @var{dim}) +## @deftypefn {} {@var{a} =} polyarea (@var{x}, @var{y}) +## @deftypefnx {} {@var{a} =} polyarea (@var{x}, @var{y}, @var{dim}) ## ## Determine area of a polygon by triangle method. ## @@ -55,9 +55,9 @@ endif if (nargin == 2) - a = abs (sum (x .* (shift (y, -1) - shift (y, 1)))) / 2; + a = abs (sum (x .* (circshift (y, -1) - circshift (y, 1)))) / 2; else - a = abs (sum (x .* (shift (y, -1, dim) - shift (y, 1, dim)), dim)) / 2; + a = abs (sum (x .* (circshift (y, -1, dim) - circshift (y, 1, dim)), dim)) / 2; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/postpad.m --- a/scripts/general/postpad.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/postpad.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,25 +24,25 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} postpad (@var{x}, @var{l}) -## @deftypefnx {} {} postpad (@var{x}, @var{l}, @var{c}) -## @deftypefnx {} {} postpad (@var{x}, @var{l}, @var{c}, @var{dim}) -## Append the scalar value @var{c} to the vector @var{x} until it is of length +## @deftypefn {} {@var{B} =} postpad (@var{A}, @var{l}) +## @deftypefnx {} {@var{B} =} postpad (@var{A}, @var{l}, @var{c}) +## @deftypefnx {} {@var{B} =} postpad (@var{A}, @var{l}, @var{c}, @var{dim}) +## Append the scalar value @var{c} to the vector @var{A} until it is of length ## @var{l}. If @var{c} is not given, a value of 0 is used. ## -## If @code{length (@var{x}) > @var{l}}, elements from the end of @var{x} are +## If @code{length (@var{A}) > @var{l}}, elements from the end of @var{A} are ## removed until a vector of length @var{l} is obtained. ## -## If @var{x} is a matrix, elements are appended or removed from each row. +## If @var{A} is a matrix, elements are appended or removed from each row. ## ## If the optional argument @var{dim} is given, operate along this dimension. ## -## If @var{dim} is larger than the dimensions of @var{x}, the result will have +## If @var{dim} is larger than the dimensions of @var{A}, the result will have ## @var{dim} dimensions. ## @seealso{prepad, cat, resize} ## @end deftypefn -function y = postpad (x, l, c, dim) +function B = postpad (A, l, c, dim) if (nargin < 2) print_usage (); @@ -56,8 +56,8 @@ endif endif - nd = ndims (x); - sz = size (x); + nd = ndims (A); + sz = size (A); if (nargin < 4) ## Find the first non-singleton dimension. (dim = find (sz > 1, 1)) || (dim = 1); @@ -84,14 +84,14 @@ ## ml = max (numel (v1), numel (v2)); ## v1 = postpad (v1, ml); ## v2 = postpad (v2, ml); - y = x; + B = A; elseif (d >= l) idx = repmat ({':'}, nd, 1); idx{dim} = 1:l; - y = x(idx{:}); + B = A(idx{:}); else sz(dim) = l - d; - y = cat (dim, x, c(ones (sz))); + B = cat (dim, A, c(ones (sz))); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/prepad.m --- a/scripts/general/prepad.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/prepad.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,25 +24,25 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} prepad (@var{x}, @var{l}) -## @deftypefnx {} {} prepad (@var{x}, @var{l}, @var{c}) -## @deftypefnx {} {} prepad (@var{x}, @var{l}, @var{c}, @var{dim}) -## Prepend the scalar value @var{c} to the vector @var{x} until it is of length +## @deftypefn {} {@var{B} =} prepad (@var{A}, @var{l}) +## @deftypefnx {} {@var{B} =} prepad (@var{A}, @var{l}, @var{c}) +## @deftypefnx {} {@var{B} =} prepad (@var{A}, @var{l}, @var{c}, @var{dim}) +## Prepend the scalar value @var{c} to the vector @var{A} until it is of length ## @var{l}. If @var{c} is not given, a value of 0 is used. ## -## If @code{length (@var{x}) > @var{l}}, elements from the beginning of @var{x} +## If @code{length (@var{A}) > @var{l}}, elements from the beginning of @var{A} ## are removed until a vector of length @var{l} is obtained. ## -## If @var{x} is a matrix, elements are prepended or removed from each row. +## If @var{A} is a matrix, elements are prepended or removed from each row. ## ## If the optional argument @var{dim} is given, operate along this dimension. ## -## If @var{dim} is larger than the dimensions of @var{x}, the result will have +## If @var{dim} is larger than the dimensions of @var{A}, the result will have ## @var{dim} dimensions. ## @seealso{postpad, cat, resize} ## @end deftypefn -function y = prepad (x, l, c, dim) +function B = prepad (A, l, c, dim) if (nargin < 2) print_usage (); @@ -56,8 +56,8 @@ endif endif - nd = ndims (x); - sz = size (x); + nd = ndims (A); + sz = size (A); if (nargin < 4) ## Find the first non-singleton dimension. (dim = find (sz > 1, 1)) || (dim = 1); @@ -84,14 +84,14 @@ ## ml = max (numel (v1), numel (v2)); ## v1 = prepad (v1, ml); ## v2 = prepad (v2, ml); - y = x; + B = A; elseif (d >= l) idx = repmat ({':'}, nd, 1); idx{dim} = d-l+1:d; - y = x(idx{:}); + B = A(idx{:}); else sz(dim) = l - d; - y = cat (dim, c(ones (sz)), x); + B = cat (dim, c(ones (sz)), A); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/randi.m --- a/scripts/general/randi.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/randi.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} randi (@var{imax}) -## @deftypefnx {} {} randi (@var{imax}, @var{n}) -## @deftypefnx {} {} randi (@var{imax}, @var{m}, @var{n}, @dots{}) -## @deftypefnx {} {} randi ([@var{imin} @var{imax}], @dots{}) -## @deftypefnx {} {} randi (@dots{}, "@var{class}") +## @deftypefn {} {@var{R} =} randi (@var{imax}) +## @deftypefnx {} {@var{R} =} randi (@var{imax}, @var{n}) +## @deftypefnx {} {@var{R} =} randi (@var{imax}, @var{m}, @var{n}, @dots{}) +## @deftypefnx {} {@var{R} =} randi ([@var{imin} @var{imax}], @dots{}) +## @deftypefnx {} {@var{R} =} randi (@dots{}, "@var{class}") ## Return random integers in the range 1:@var{imax}. ## ## Additional arguments determine the shape of the return matrix. When no @@ -37,7 +37,7 @@ ## is returned. Two or more arguments will return a multi-dimensional matrix ## @w{(@var{m} x @var{n} x @dots{})}. ## -## The integer range may optionally be described by a two element matrix with a +## The integer range may optionally be described by a two-element matrix with a ## lower and upper bound in which case the returned integers will be on the ## interval @w{[@var{imin}, @var{imax}]}. ## @@ -56,10 +56,10 @@ ## returned by the @code{flintmax} function. For IEEE floating point numbers ## this value is @w{@math{2^{53} - 1}}. ## -## @seealso{rand} +## @seealso{rand, randn} ## @end deftypefn -function ri = randi (bounds, varargin) +function R = randi (bounds, varargin) if (nargin < 1) print_usage (); @@ -121,7 +121,7 @@ r_prim = r_prim(r_prim < K*rng); until (numel (r_prim) >= N) # should practically always be true - ri = imin + floor (reshape (r_prim(1:N), varargin{:}) / K); + R = imin + floor (reshape (r_prim(1:N), varargin{:}) / K); if (! strcmp (rclass, "double")) if (strfind (rclass, "int")) @@ -141,7 +141,7 @@ " Values might be truncated to requested type."]); endif - ri = cast (ri, rclass); + R = cast (R, rclass); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/repmat.m --- a/scripts/general/repmat.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/repmat.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} repmat (@var{A}, @var{m}) -## @deftypefnx {} {} repmat (@var{A}, @var{m}, @var{n}) -## @deftypefnx {} {} repmat (@var{A}, @var{m}, @var{n}, @var{p} @dots{}) -## @deftypefnx {} {} repmat (@var{A}, [@var{m} @var{n}]) -## @deftypefnx {} {} repmat (@var{A}, [@var{m} @var{n} @var{p} @dots{}]) +## @deftypefn {} {@var{B} =} repmat (@var{A}, @var{m}) +## @deftypefnx {} {@var{B} =} repmat (@var{A}, @var{m}, @var{n}) +## @deftypefnx {} {@var{B} =} repmat (@var{A}, @var{m}, @var{n}, @var{p} @dots{}) +## @deftypefnx {} {@var{B} =} repmat (@var{A}, [@var{m} @var{n}]) +## @deftypefnx {} {@var{B} =} repmat (@var{A}, [@var{m} @var{n} @var{p} @dots{}]) ## Repeat matrix or N-D array. ## ## Form a block matrix of size @var{m} by @var{n}, with a copy of matrix @@ -42,7 +42,7 @@ ## @seealso{bsxfun, kron, repelems} ## @end deftypefn -function x = repmat (A, m, varargin) +function B = repmat (A, m, varargin) if (nargin < 2) print_usage (); @@ -107,21 +107,21 @@ if (numel (A) == 1) ## optimize the scalar fill case. if (any (idx == 0)) - x = resize (A, idx); + B = resize (A, idx); else - x(1:prod (idx)) = A; - x = reshape (x, idx); + B(1:prod (idx)) = A; + B = reshape (B, idx); endif elseif (ndims (A) == 2 && length (idx) < 3) if (issparse (A)) - x = kron (ones (idx), A); + B = kron (ones (idx), A); else ## indexing is now faster, so we use it rather than kron. m = rows (A); n = columns (A); p = idx(1); q = idx(2); - x = reshape (A, m, 1, n, 1); - x = x(:, ones (1, p), :, ones (1, q)); - x = reshape (x, m*p, n*q); + B = reshape (A, m, 1, n, 1); + B = B(:, ones (1, p), :, ones (1, q)); + B = reshape (B, m*p, n*q); endif else aidx = size (A); @@ -138,7 +138,7 @@ ## add singleton dims aaidx(2,:) = 1; A = reshape (A, aaidx(:)); - x = reshape (A (cidx{:}), idx .* aidx); + B = reshape (A (cidx{:}), idx .* aidx); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/rng.m --- a/scripts/general/rng.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/rng.m Sun Apr 03 11:30:26 2022 -0400 @@ -75,7 +75,7 @@ ## @seealso{rand, randn} ## @end deftypefn -function retval = rng (varargin) +function s = rng (varargin) if (nargin > 2) print_usage (); @@ -93,12 +93,12 @@ ## Type is the generator name. ## Seed is the initial seed value. ## State is a structure describing internal state of the generator. - s = struct ("Type", "twister", - "Seed", "Not applicable", - "State", {{rand("state"), randn("state")}}); + srng = struct ("Type", "twister", + "Seed", "Not applicable", + "State", {{rand("state"), randn("state")}}); if (nargin == 0) - retval = s; + s = srng; return; endif @@ -135,7 +135,7 @@ ## Set the type of random number generator and seed it if (isempty (generator)) - generator = s.Type; + generator = srng.Type; endif switch (generator) case "twister" @@ -158,7 +158,7 @@ endswitch if (nargout > 0) - retval = s; + s = srng; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/rot90.m --- a/scripts/general/rot90.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/rot90.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rot90 (@var{A}) -## @deftypefnx {} {} rot90 (@var{A}, @var{k}) +## @deftypefn {} {@var{B} =} rot90 (@var{A}) +## @deftypefnx {} {@var{B} =} rot90 (@var{A}, @var{k}) ## Rotate array by 90 degree increments. ## ## Return a copy of @var{A} with the elements rotated counterclockwise in diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/rotdim.m --- a/scripts/general/rotdim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/rotdim.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rotdim (@var{x}) -## @deftypefnx {} {} rotdim (@var{x}, @var{n}) -## @deftypefnx {} {} rotdim (@var{x}, @var{n}, @var{plane}) -## Return a copy of @var{x} with the elements rotated counterclockwise in +## @deftypefn {} {@var{B} =} rotdim (@var{A}) +## @deftypefnx {} {@var{B} =} rotdim (@var{A}, @var{n}) +## @deftypefnx {} {@var{B} =} rotdim (@var{A}, @var{n}, @var{plane}) +## Return a copy of @var{A} with the elements rotated counterclockwise in ## 90-degree increments. ## ## The second argument @var{n} is optional, and specifies how many 90-degree @@ -63,7 +63,7 @@ ## @seealso{rot90, fliplr, flipud, flip} ## @end deftypefn -function y = rotdim (x, n, plane) +function B = rotdim (A, n, plane) if (nargin < 1) print_usage (); @@ -77,8 +77,8 @@ n = 1; endif - nd = ndims (x); - sz = size (x); + nd = ndims (A); + sz = size (A); if (nargin < 3) if (nd > 2) ## Find the first two non-singleton dimension. @@ -105,7 +105,7 @@ if (! (isvector (plane) && length (plane) == 2 && all (plane == fix (plane)) && all (plane > 0) && all (plane < (nd + 1)) && plane(1) != plane(2))) - error ("rotdim: PLANE must be a 2 element integer vector defining a valid PLANE"); + error ("rotdim: PLANE must be a 2-element integer vector defining a valid plane"); endif endif @@ -114,21 +114,19 @@ n += 4; endif if (n == 0) - y = x; + B = A; elseif (n == 2) - y = flip (flip (x, plane(1)), plane(2)); + B = flip (flip (A, plane(1)), plane(2)); elseif (n == 1 || n == 3) perm = 1:nd; perm(plane(1)) = plane(2); perm(plane(2)) = plane(1); - y = permute (x, perm); + B = permute (A, perm); if (n == 1) - y = flip (y, min (plane)); + B = flip (B, min (plane)); else - y = flip (y, max (plane)); + B = flip (B, max (plane)); endif - else - error ("rotdim: internal error!"); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/shift.m --- a/scripts/general/shift.m Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -######################################################################## -## -## Copyright (C) 1995-2022 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or . -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {} shift (@var{x}, @var{b}) -## @deftypefnx {} {} shift (@var{x}, @var{b}, @var{dim}) -## If @var{x} is a vector, perform a circular shift of length @var{b} of -## the elements of @var{x}. -## -## If @var{x} is a matrix, do the same for each column of @var{x}. -## -## If the optional @var{dim} argument is given, operate along this dimension. -## @end deftypefn - -function y = shift (x, b, dim) - - if (nargin < 2) - print_usage (); - endif - - if (numel (x) < 1) - error ("shift: X must not be empty"); - elseif (! (isscalar (b) && b == fix (b))) - error ("shift: B must be an integer"); - endif - - nd = ndims (x); - sz = size (x); - - if (nargin == 3) - if (!(isscalar (dim) && dim == fix (dim)) - || !(1 <= dim && dim <= nd)) - error ("shift: DIM must be an integer and a valid dimension"); - endif - else - ## Find the first non-singleton dimension. - (dim = find (sz > 1, 1)) || (dim = 1); - endif - - d = sz(dim); - - idx = repmat ({':'}, nd, 1); - if (b > 0) - b = rem (b, d); - idx{dim} = [d-b+1:d, 1:d-b]; - elseif (b < 0) - b = rem (abs (b), d); - idx{dim} = [b+1:d, 1:b]; - endif - - y = x(idx{:}); - -endfunction - - -%!test -%! a = [1, 2, 3]; -%! b = [4, 5, 6]; -%! c = [7, 8, 9]; -%! -%! r = [a, b, c]; -%! m = [a; b; c]; -%! -%! assert (shift (r, 0), r); -%! assert (shift (r, 3), [c, a, b]); -%! assert (shift (r, -6), [c, a, b]); -%! assert (shift (r, -3), [b, c, a]); -%! assert (shift (m, 1), [c; a; b]); -%! assert (shift (m, -2), [c; a; b]); - -## Test input validation -%!error shift () -%!error shift (1) -%!error shift ([], 1) -%!error shift (ones (2), ones (2)) -%!error shift (ones (2), 1.5) -%!error shift (1, 1, 1.5) -%!error shift (1, 1, 0) -%!error shift (1, 1, 3) diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/structfun.m --- a/scripts/general/structfun.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/structfun.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} structfun (@var{func}, @var{S}) -## @deftypefnx {} {[@var{A}, @dots{}] =} structfun (@dots{}) -## @deftypefnx {} {} structfun (@dots{}, "ErrorHandler", @var{errfunc}) -## @deftypefnx {} {} structfun (@dots{}, "UniformOutput", @var{val}) +## @deftypefn {} {@var{A} =} structfun (@var{func}, @var{S}) +## @deftypefnx {} {@var{A} =} structfun (@dots{}, "ErrorHandler", @var{errfunc}) +## @deftypefnx {} {@var{A} =} structfun (@dots{}, "UniformOutput", @var{val}) +## @deftypefnx {} {[@var{A}, @var{B}, @dots{}] =} structfun (@dots{}) ## ## Evaluate the function named @var{name} on the fields of the structure ## @var{S}. The fields of @var{S} are passed to the function @var{func} diff -r 0a1aec50a0c8 -r 960909469245 scripts/general/triplequad.m --- a/scripts/general/triplequad.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/general/triplequad.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}) -## @deftypefnx {} {} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}) -## @deftypefnx {} {} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}, @var{quadf}) -## @deftypefnx {} {} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}, @var{quadf}, @dots{}) +## @deftypefn {} {@var{q} =} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}) +## @deftypefnx {} {@var{q} =} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}) +## @deftypefnx {} {@var{q} =} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}, @var{quadf}) +## @deftypefnx {} {@var{q} =} triplequad (@var{f}, @var{xa}, @var{xb}, @var{ya}, @var{yb}, @var{za}, @var{zb}, @var{tol}, @var{quadf}, @dots{}) ## Numerically evaluate the triple integral of @var{f}. ## ## @var{f} is a function handle, inline function, or string containing the name diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uibuttongroup.m --- a/scripts/gui/uibuttongroup.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uibuttongroup.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{hui} =} uibuttongroup (@var{property}, @var{value}, @dots{}) +## @deftypefn {} {@var{hui} =} uibuttongroup () +## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{parent}) ## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{parent}, @var{property}, @var{value}, @dots{}) +## @c FIXME: 3rd form is not documented by Matlab nor implemented in Octave. +## @c Should it be removed? (1/9/2022). ## @deftypefnx {} {} uibuttongroup (@var{h}) ## ## Create a uibuttongroup object and return a handle to it. diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uicontrol.m --- a/scripts/gui/uicontrol.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uicontrol.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{hui} =} uicontrol (@var{property}, @var{value}, @dots{}) +## @deftypefn {} {@var{hui} =} uicontrol () +## @deftypefnx {} {@var{hui} =} uicontrol (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {@var{hui} =} uicontrol (@var{parent}) ## @deftypefnx {} {@var{hui} =} uicontrol (@var{parent}, @var{property}, @var{value}, @dots{}) ## @deftypefnx {} {} uicontrol (@var{h}) ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uipanel.m --- a/scripts/gui/uipanel.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uipanel.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} uipanel (@var{property}, @var{value}, @dots{}) -## @deftypefnx {} {} uipanel (@var{parent}, @var{property}, @var{value}, @dots{}) -## @deftypefnx {} {@var{hui} =} uipanel (@dots{}) +## @deftypefn {} {@var{hui} =} uipanel () +## @deftypefnx {} {@var{hui} =} uipanel (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {@var{hui} =} uipanel (@var{parent}) +## @deftypefnx {} {@var{hui} =} uipanel (@var{parent}, @var{property}, @var{value}, @dots{}) ## ## Create a uipanel object. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uipushtool.m --- a/scripts/gui/uipushtool.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uipushtool.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} uipushtool (@var{property}, @var{value}, @dots{}) +## @deftypefn {} {} uipushtool () +## @deftypefnx {} {} uipushtool (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {} uipushtool (@var{parent}) ## @deftypefnx {} {} uipushtool (@var{parent}, @var{property}, @var{value}, @dots{}) -## @deftypefnx {} {@var{hui} =} uipushtool (@dots{}) ## ## Create a uipushtool object. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uitoggletool.m --- a/scripts/gui/uitoggletool.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uitoggletool.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} uitoggletool (@var{property}, @var{value}, @dots{}) -## @deftypefnx {} {} uitoggletool (@var{parent}, @var{property}, @var{value}, @dots{}) -## @deftypefnx {} {@var{hui} =} uitoggletool (@dots{}) +## @deftypefn {} {@var{hui} =} uitoggletool () +## @deftypefnx {} {@var{hui} =} uitoggletool (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {@var{hui} =} uitoggletool (@var{parent}) +## @deftypefnx {} {@var{hui} =} uitoggletool (@var{parent}, @var{property}, @var{value}, @dots{}) ## ## Create a uitoggletool object. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/uitoolbar.m --- a/scripts/gui/uitoolbar.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/uitoolbar.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} uitoolbar (@var{property}, @var{value}, @dots{}) -## @deftypefnx {} {} uitoolbar (@var{parent}, @var{property}, @var{value}, @dots{}) -## @deftypefnx {} {@var{hui} =} uitoolbar (@dots{}) +## @deftypefn {} {@var{hui} =} uitoolbar () +## @deftypefnx {} {@var{hui} =} uitoolbar (@var{property}, @var{value}, @dots{}) +## @deftypefnx {} {@var{hui} =} uitoolbar (@var{parent}) +## @deftypefnx {} {@var{hui} =} uitoolbar (@var{parent}, @var{property}, @var{value}, @dots{}) ## ## Create a uitoolbar object. A uitoolbar displays uitoggletool and uipushtool ## buttons. diff -r 0a1aec50a0c8 -r 960909469245 scripts/gui/waitforbuttonpress.m --- a/scripts/gui/waitforbuttonpress.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/gui/waitforbuttonpress.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} waitforbuttonpress () -## @deftypefnx {} {@var{b} =} waitforbuttonpress () +## @deftypefn {} {@var{b} =} 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 diff -r 0a1aec50a0c8 -r 960909469245 scripts/help/__makeinfo__.m --- a/scripts/help/__makeinfo__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/help/__makeinfo__.m Sun Apr 03 11:30:26 2022 -0400 @@ -101,7 +101,12 @@ endif ## Texinfo crashes if @end tex does not appear first on the line. text = regexprep (text, '^ +@end tex', '@end tex', 'lineanchors'); - text = regexprep (text, '@seealso', '@xseealso'); + ## Replace @seealso with Octave specific @xseealso macro, and escape '@' + [s, e] = regexp (text, '@seealso{.*}'); + if (! isempty (s)) + esc_text = strrep (text(s+8:e), '@', '@@'); + text = [text(1:s), 'xseealso', esc_text, text(e+1:end)]; + endif ## We don't want *ref macros to clutter plain text output with "Note ..." if (strcmp (output_type, "plain text")) diff -r 0a1aec50a0c8 -r 960909469245 scripts/help/help.m --- a/scripts/help/help.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/help/help.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,6 +28,7 @@ ## @deftypefnx {} {} help --list ## @deftypefnx {} {} help . ## @deftypefnx {} {} help +## @deftypefnx {} {@var{help_text} =} help (@dots{}) ## Display the help text for @var{name}. ## ## For example, the command @kbd{help help} prints a short message describing diff -r 0a1aec50a0c8 -r 960909469245 scripts/help/private/__additional_help_message__.m --- a/scripts/help/private/__additional_help_message__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/help/private/__additional_help_message__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __additional_help_message__ () +## @deftypefn {} {@var{msg} =} __additional_help_message__ () ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/help/warning_ids.m --- a/scripts/help/warning_ids.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/help/warning_ids.m Sun Apr 03 11:30:26 2022 -0400 @@ -178,6 +178,13 @@ ## different file target than the programmer intended is being used. ## By default, the @code{Octave:data-file-in-path} warning is enabled. ## +## @item Octave:datevec:date-format-spec +## If the @code{Octave:datevec:date-format-spec} warning is enabled, a warning +## is printed if the date format specification contains questionable date or +## time specifiers. Typical bad patterns are using upper case date specifiers +## or lower case time specifiers. +## By default, the @code{Octave:datevec:date-format-spec} warning is enabled. +## ## @item Octave:deprecated-function ## If the @code{Octave:deprecated-function} warning is enabled, a ## warning is issued when Octave encounters a function that is obsolete and @@ -354,6 +361,11 @@ ## By default, the @code{Octave:possible-matlab-short-circuit-operator} warning ## is enabled. ## +## @item Octave:pow2:imaginary-ignored +## If the @code{Octave:pow2:imaginary-ignored} warning is enabled, a warning is +## printed if either input to @code{pow2} is complex. +## By default, the @code{Octave:pow2:imaginary-ignored} warning is enabled. +## ## @item Octave:recursive-path-search ## If the @code{Octave:recursive-path-search} warning is enabled, Octave ## will issue a warning if @code{addpath} is used with double trailing diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/hsv.m --- a/scripts/image/hsv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/hsv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hsv (@var{n}) +## @deftypefn {} {@var{map} =} hsv () +## @deftypefnx {} {@var{map} =} hsv (@var{n}) ## Create color colormap. This colormap begins with red, changes through ## yellow, green, cyan, blue, and magenta, before returning to red. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/im2double.m --- a/scripts/image/im2double.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/im2double.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,20 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} im2double (@var{img}) -## @deftypefnx {} {} im2double (@var{img}, "indexed") +## @deftypefn {} {@var{dimg} =} im2double (@var{img}) +## @deftypefnx {} {@var{dimg} =} im2double (@var{img}, "indexed") ## Convert image to double precision. ## -## The conversion of @var{img} to double precision, is dependent -## on the type of input image. The following input classes are -## supported: +## The conversion of @var{img} to double precision, is dependent on the type of +## input image. The following input classes are supported: ## ## @table @samp ## @item uint8, uint16, and int16 ## The range of values from the class is scaled to the interval [0 1]. ## ## @item logical -## True and false values are assigned a value of 0 and 1 respectively. +## True and false values are assigned a value of 1 and 0 respectively. ## ## @item single ## Values are cast to double. @@ -47,15 +46,15 @@ ## ## @end table ## -## If @var{img} is an indexed image, then the second argument should be -## the string @qcode{"indexed"}. If so, then @var{img} must either be -## of floating point class, or unsigned integer class and it will simply -## be cast to double. If it is an integer class, a +1 offset is applied. +## If @var{img} is an indexed image, then the second argument should be the +## string @qcode{"indexed"}. If so, then @var{img} must either be of floating +## point class, or unsigned integer class and it will simply be cast to double. +## If it is an integer class, an offset of +1 is applied. ## ## @seealso{double} ## @end deftypefn -function img = im2double (img, im_type) +function dimg = im2double (img, im_type) if (nargin < 1) print_usage (); @@ -64,12 +63,12 @@ if (nargin == 1) ## "normal" (non-indexed) images switch (class (img)) - case "uint8", img = double (img) / 255; - case "uint16", img = double (img) / 65535; - case "int16", img = (double (img) + 32768) / 65535; - case "single", img = double (img); - case "logical", img = double (img); - case "double", # do nothing + case "uint8", dimg = double (img) / 255; + case "uint16", dimg = double (img) / 65535; + case "int16", dimg = (double (img) + 32768) / 65535; + case "single", dimg = double (img); + case "logical", dimg = double (img); + case "double", dimg = img; otherwise, error ('im2double: IMG is of unsupported class "%s"', class (img)); endswitch else @@ -77,9 +76,9 @@ if (! strcmpi (im_type, "indexed")) error ('im2double: second input argument must be the string "indexed"'); elseif (any (isa (img, {"uint8", "uint16"}))) - img = double (img) + 1; + dimg = double (img) + 1; elseif (isfloat (img) || isbool (img)) - img = double (img); + dimg = double (img); else ## Technically, it could also be of logical class and we do not ## enforce positive integers for floating for Matlab compatibility. diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/im2frame.m --- a/scripts/image/im2frame.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/im2frame.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} im2frame (@var{rgb}) -## @deftypefnx {} {} im2frame (@var{x}, @var{map}) +## @deftypefn {} {@var{frame} =} im2frame (@var{rgb}) +## @deftypefnx {} {@var{frame} =} im2frame (@var{x}, @var{map}) ## Convert image to movie frame. ## ## A movie frame is simply a struct with the fields @qcode{"cdata"} and diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/iscolormap.m --- a/scripts/image/iscolormap.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/iscolormap.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} iscolormap (@var{cmap}) +## @deftypefn {} {@var{tf} =} iscolormap (@var{cmap}) ## Return true if @var{cmap} is a colormap. ## ## A colormap is a real matrix, of class single or double, with 3 columns. @@ -38,15 +38,14 @@ ## @seealso{colormap, rgbplot} ## @end deftypefn -function retval = iscolormap (cmap) +function tf = iscolormap (cmap) if (nargin < 1) print_usage (); endif - retval = (isnumeric (cmap) && isreal (cmap) - && ndims (cmap) == 2 && columns (cmap) == 3 - && isfloat (cmap)); + tf = isnumeric (cmap) && isreal (cmap) && isfloat (cmap) ... + && ndims (cmap) == 2 && columns (cmap) == 3; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/private/__imread__.m --- a/scripts/image/private/__imread__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/private/__imread__.m Sun Apr 03 11:30:26 2022 -0400 @@ -61,7 +61,7 @@ if (sum (idx) > 1) error ("imread: Index or Frames may only be specified once"); endif - val = varargin{shift (idx, 1)}; + val = varargin{circshift (idx, 1)}; if (! is_valid_index_option (val) && ! strcmpi (val, "all")) error ("imread: %s must be a vector or the string 'all'", varargin{idx}); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/image/spinmap.m --- a/scripts/image/spinmap.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/image/spinmap.m Sun Apr 03 11:30:26 2022 -0400 @@ -56,7 +56,7 @@ t0 = clock (); while (etime (clock (), t0) < t) - cmap = shift (cmap, inc, 1); + cmap = circshift (cmap, inc, 1); set (gcf (), "colormap", cmap); drawnow (); endwhile diff -r 0a1aec50a0c8 -r 960909469245 scripts/io/is_valid_file_id.m --- a/scripts/io/is_valid_file_id.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/io/is_valid_file_id.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,23 +24,23 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} is_valid_file_id (@var{fid}) +## @deftypefn {} {@var{tf} =} is_valid_file_id (@var{fid}) ## Return true if @var{fid} refers to an open file. ## @seealso{freport, fopen} ## @end deftypefn -function retval = is_valid_file_id (fid) +function tf = is_valid_file_id (fid) if (nargin < 1) print_usage (); endif - retval = false; + tf = false; try if (isscalar (fid)) [file, mode, arch] = fopen (fid); - retval = ! isempty (file); + tf = ! isempty (file); endif end_try_catch diff -r 0a1aec50a0c8 -r 960909469245 scripts/java/javachk.m --- a/scripts/java/javachk.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/java/javachk.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} javachk (@var{feature}) -## @deftypefnx {} {} javachk (@var{feature}, @var{caller}) -## @deftypefnx {} {@var{msg} =} javachk (@dots{}) +## @deftypefn {} {@var{msg} =} javachk (@var{feature}) +## @deftypefnx {} {@var{msg} =} javachk (@var{feature}, @var{caller}) ## Check for the presence of the Java @var{feature} in the current session. ## Return an error structure if @var{feature} is not available, not enabled, ## or not recognized. diff -r 0a1aec50a0c8 -r 960909469245 scripts/java/usejava.m --- a/scripts/java/usejava.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/java/usejava.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} usejava (@var{feature}) +## @deftypefn {} {@var{tf} =} usejava (@var{feature}) ## Return true if the Java element @var{feature} is available. ## ## Possible features are: @@ -52,32 +52,32 @@ ## @seealso{javachk} ## @end deftypefn -function retval = usejava (feature) +function tf = usejava (feature) if (nargin < 1 || ! ischar (feature)) print_usage (); endif - retval = false; + tf = false; switch (feature) ## For each feature, try methods() on a Java class of a feature case "awt" try dum = methods ("java.awt.Frame"); - retval = ! javaMethod ("isHeadless", "java.awt.GraphicsEnvironment"); + tf = ! javaMethod ("isHeadless", "java.awt.GraphicsEnvironment"); end_try_catch case "desktop" - ## Octave has no Java based GUI/desktop, leave retval = false + ## Octave has no Java based GUI/desktop, leave tf = false case "jvm" try dum = methods ("java.lang.Runtime"); - retval = true; + tf = true; end_try_catch case "swing" try dum = methods ("javax.swing.Popup"); - retval = ! javaMethod ("isHeadless", "java.awt.GraphicsEnvironment"); + tf = ! javaMethod ("isHeadless", "java.awt.GraphicsEnvironment"); end_try_catch otherwise error ("usejava: unrecognized FEATURE '%s'", feature); diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/@inline/argnames.m --- a/scripts/legacy/@inline/argnames.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/@inline/argnames.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} argnames (@var{fun}) +## @deftypefn {} {@var{args} =} argnames (@var{fun}) ## Return a cell array of character strings containing the names of the ## arguments of the inline function @var{fun}. ## @seealso{inline, formula, vectorize} diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/@inline/char.m --- a/scripts/legacy/@inline/char.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/@inline/char.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,20 +24,20 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} char (@var{fun}) -## Return a character string representing the inline function @var{fun}. +## @deftypefn {} {@var{fcnstr} =} char (@var{fcn}) +## Return a character string representing the inline function @var{fcn}. ## -## Note that @code{char (@var{fun})} is equivalent to -## @code{formula (@var{fun})}. +## Note that @code{char (@var{fcn})} is equivalent to +## @code{formula (@var{fcn})}. ## @seealso{char, argnames, inline, vectorize} ## @end deftypefn -function expr = char (obj) +function fcnstr = char (obj) if (nargin < 1) print_usage (); endif - expr = obj.expr; + fcnstr = obj.expr; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/@inline/formula.m --- a/scripts/legacy/@inline/formula.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/@inline/formula.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,20 +24,20 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} formula (@var{fun}) -## Return a character string representing the inline function @var{fun}. +## @deftypefn {} {@var{fcnstr} =} formula (@var{fcn}) +## Return a character string representing the inline function @var{fcn}. ## -## Note that @code{char (@var{fun})} is equivalent to -## @code{formula (@var{fun})}. +## Note that @code{char (@var{fcn})} is equivalent to +## @code{formula (@var{fcn})}. ## @seealso{char, argnames, inline, vectorize} ## @end deftypefn -function expr = formula (obj) +function fcnstr = formula (obj) if (nargin < 1) print_usage (); endif - expr = obj.expr; + fcnstr = obj.expr; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/@inline/inline.m --- a/scripts/legacy/@inline/inline.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/@inline/inline.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} inline (@var{str}) -## @deftypefnx {} {} inline (@var{str}, @var{arg1}, @dots{}) -## @deftypefnx {} {} inline (@var{str}, @var{n}) +## @deftypefn {} {@var{fobj} =} inline (@var{str}) +## @deftypefnx {} {@var{fobj} =} inline (@var{str}, @var{arg1}, @dots{}) +## @deftypefnx {} {@var{fobj} =} inline (@var{str}, @var{n}) ## ## This function is obsolete. Use anonymous functions ## (@pxref{Anonymous Functions}) instead. ## -## Create an inline function from the character string @var{str}. +## Create an inline function object from the character string @var{str}. ## ## If called with a single argument, the arguments of the generated ## function are extracted from the function itself. The generated @@ -55,7 +55,7 @@ ## @seealso{argnames, formula, vectorize, str2func} ## @end deftypefn -function obj = inline (expr, varargin) +function fobj = inline (expr, varargin) persistent warned = false; if (! warned) @@ -103,7 +103,7 @@ p.isEmpty = false; p.version = 1; - obj = __inline_ctor__ (p); + fobj = __inline_ctor__ (p); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/__vectorize__.m --- a/scripts/legacy/__vectorize__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/__vectorize__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __vectorize__ (@var{expr}) +## @deftypefn {} {@var{new_expr} =} __vectorize__ (@var{expr}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/findstr.m --- a/scripts/legacy/findstr.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/findstr.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} findstr (@var{s}, @var{t}) -## @deftypefnx {} {} findstr (@var{s}, @var{t}, @var{overlap}) +## @deftypefn {} {@var{v} =} findstr (@var{s}, @var{t}) +## @deftypefnx {} {@var{v} =} findstr (@var{s}, @var{t}, @var{overlap}) ## ## This function is obsolete. Use @code{strfind} instead. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/flipdim.m --- a/scripts/legacy/flipdim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/flipdim.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,13 +24,13 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} flipdim (@var{x}) -## @deftypefnx {} {} flipdim (@var{x}, @var{dim}) +## @deftypefn {} {@var{B} =} flipdim (@var{A}) +## @deftypefnx {} {@var{B} =} flipdim (@var{A}, @var{dim}) ## This function is obsolete. Use @code{flip} instead. ## @seealso{flip, fliplr, flipud, rot90, rotdim} ## @end deftypefn -function y = flipdim (varargin) +function B = flipdim (varargin) persistent warned = false; if (! warned) @@ -39,6 +39,6 @@ "flipdim is obsolete; please use flip instead"); endif - y = flip (varargin{:}); + B = flip (varargin{:}); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/isdir.m --- a/scripts/legacy/isdir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/isdir.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isdir (@var{f}) +## @deftypefn {} {@var{tf} =} isdir (@var{f}) ## ## This function is not recommended. Use @code{isfolder} or ## @code{file_in_loadpath} instead. @@ -43,7 +43,7 @@ ## is_rooted_relative_filename} ## @end deftypefn -function retval = isdir (f) +function tf = isdir (f) persistent warned = false; if (! warned) @@ -57,7 +57,7 @@ endif ## Exist returns an integer but isdir should return a logical. - retval = (exist (f, "dir") == 7); + tf = (exist (f, "dir") == 7); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/isstr.m --- a/scripts/legacy/isstr.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/isstr.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isstr (@var{x}) +## @deftypefn {} {@var{tf} =} isstr (@var{x}) ## This function is obsolete. Use @code{ischar} instead. ## @seealso{ischar} ## @end deftypefn @@ -33,7 +33,7 @@ ## removed in some future version. Now users are told that it should be ## avoided, but there is no mention of possible future removal. -function retval = isstr (varargin) +function tf = isstr (varargin) persistent warned = false; if (! warned) @@ -42,6 +42,6 @@ "isstr is obsolete; please use ischar instead"); endif - retval = ischar (varargin{:}); + tf = ischar (varargin{:}); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/strmatch.m --- a/scripts/legacy/strmatch.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/strmatch.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} strmatch (@var{s}, @var{A}) -## @deftypefnx {} {} strmatch (@var{s}, @var{A}, "exact") +## @deftypefn {} {@var{idx} =} strmatch (@var{s}, @var{A}) +## @deftypefnx {} {@var{idx} =} strmatch (@var{s}, @var{A}, "exact") ## ## This function is obsolete. @strong{Use an alternative} such as ## @code{strncmp} or @code{strcmp} instead. diff -r 0a1aec50a0c8 -r 960909469245 scripts/legacy/vectorize.m --- a/scripts/legacy/vectorize.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/legacy/vectorize.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} vectorize (@var{fun}) +## @deftypefn {} {@var{vfun} =} vectorize (@var{fun}) ## Create a vectorized version of the anonymous function or expression ## @var{fun} by replacing all occurrences of @code{*}, @code{/}, etc., ## with @code{.*}, @code{./}, etc. @@ -39,7 +39,7 @@ ## anyway, and most expressions will probably be short. It may also be ## buggy. Well, don't use this function! -function retval = vectorize (fun) +function vfun = vectorize (fun) persistent warned = false; if (! warned) @@ -62,9 +62,9 @@ args = expr(1:idx); expr = expr(idx+1:end); new_expr = __vectorize__ (expr); - retval = str2func ([args, new_expr]); + vfun = str2func ([args, new_expr]); elseif (ischar (fun)) - retval = __vectorize__ (fun); + vfun = __vectorize__ (fun); else error ("vectorize: FUN must be a string or anonymous function handle"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/commutation_matrix.m --- a/scripts/linear-algebra/commutation_matrix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/commutation_matrix.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} commutation_matrix (@var{m}, @var{n}) +## @deftypefn {} {@var{k} =} commutation_matrix (@var{m}, @var{n}) ## Return the commutation matrix ## @tex ## $K_{m,n}$ diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/cond.m --- a/scripts/linear-algebra/cond.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/cond.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cond (@var{A}) -## @deftypefnx {} {} cond (@var{A}, @var{p}) +## @deftypefn {} {@var{c} =} cond (@var{A}) +## @deftypefnx {} {@var{c} =} cond (@var{A}, @var{p}) ## Compute the @var{p}-norm condition number of a matrix with respect to ## inversion. ## @@ -51,7 +51,7 @@ ## @seealso{condest, rcond, condeig, norm, svd} ## @end deftypefn -function retval = cond (A, p = 2) +function c = cond (A, p = 2) if (nargin < 1) print_usage (); @@ -63,7 +63,7 @@ if (p == 2) if (isempty (A)) - retval = 0.0; + c = 0.0; elseif (any (! isfinite (A(:)))) error ("cond: A must not contain Inf or NaN values"); else @@ -71,13 +71,13 @@ sigma_1 = sigma(1); sigma_n = sigma(end); if (sigma_1 == 0 || sigma_n == 0) - retval = Inf; + c = Inf; else - retval = sigma_1 / sigma_n; + c = sigma_1 / sigma_n; endif endif else - retval = norm (A, p) * norm (inv (A), p); + c = norm (A, p) * norm (inv (A), p); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/cross.m --- a/scripts/linear-algebra/cross.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/cross.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cross (@var{x}, @var{y}) -## @deftypefnx {} {} cross (@var{x}, @var{y}, @var{dim}) +## @deftypefn {} {@var{z} =} cross (@var{x}, @var{y}) +## @deftypefnx {} {@var{z} =} cross (@var{x}, @var{y}, @var{dim}) ## Compute the vector cross product of two 3-dimensional vectors @var{x} and ## @var{y}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/duplication_matrix.m --- a/scripts/linear-algebra/duplication_matrix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/duplication_matrix.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} duplication_matrix (@var{n}) +## @deftypefn {} {@var{d} =} duplication_matrix (@var{n}) ## Return the duplication matrix ## @tex ## $D_n$ @@ -37,21 +37,21 @@ ## $n^2 \times n(n+1)/2$ ## @end tex ## @ifnottex -## @math{n^2} by @math{n*(n+1)/2} +## @math{N^2}-by-@math{N*(N+1)/2} ## @end ifnottex ## matrix such that ## @tex ## $D_n * {\rm vech} (A) = {\rm vec} (A)$ ## @end tex ## @ifnottex -## @nospell{@math{Dn vech (A) = vec (A)}} +## @nospell{@code{Dn * vech (A) = vec (A)}} ## @end ifnottex ## for all symmetric ## @tex ## $n \times n$ ## @end tex ## @ifnottex -## @math{n} by @math{n} +## @math{N}-by-@math{N} ## @end ifnottex ## matrices ## @tex diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/expm.m --- a/scripts/linear-algebra/expm.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/expm.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} expm (@var{A}) +## @deftypefn {} {@var{r} =} expm (@var{A}) ## Return the exponential of a matrix. ## ## The matrix exponential is defined as the infinite Taylor series diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/isbanded.m --- a/scripts/linear-algebra/isbanded.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/isbanded.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isbanded (@var{A}, @var{lower}, @var{upper}) +## @deftypefn {} {@var{tf} =} isbanded (@var{A}, @var{lower}, @var{upper}) ## Return true if @var{A} is a matrix with entries confined between ## @var{lower} diagonals below the main diagonal and @var{upper} diagonals ## above the main diagonal. @@ -33,7 +33,7 @@ ## @seealso{isdiag, istril, istriu, bandwidth} ## @end deftypefn -function retval = isbanded (A, lower, upper) +function tf = isbanded (A, lower, upper) if (nargin != 3) print_usage (); @@ -44,16 +44,16 @@ endif if (isempty (A)) - retval = []; + tf = []; else - retval = (isnumeric (A) || islogical (A)) && ndims (A) == 2; - if (retval) + tf = (isnumeric (A) || islogical (A)) && ndims (A) == 2; + if (tf) [i, j] = find (A); pupp = j >= i; - retval = all (j(pupp) - i(pupp) <= upper); - if (retval) + tf = all (j(pupp) - i(pupp) <= upper); + if (tf) plow = i >= j; - retval = all (i(plow) - j(plow) <= lower); + tf = all (i(plow) - j(plow) <= lower); endif endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/isdefinite.m --- a/scripts/linear-algebra/isdefinite.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/isdefinite.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isdefinite (@var{A}) -## @deftypefnx {} {} isdefinite (@var{A}, @var{tol}) +## @deftypefn {} {@var{tf} =} isdefinite (@var{A}) +## @deftypefnx {} {@var{tf} =} isdefinite (@var{A}, @var{tol}) ## Return true if @var{A} is symmetric positive definite matrix within the ## tolerance specified by @var{tol}. ## @@ -47,14 +47,14 @@ ## @seealso{issymmetric, ishermitian} ## @end deftypefn -function retval = isdefinite (A, tol) +function tf = isdefinite (A, tol) if (nargin < 1) print_usage (); endif ## Validate inputs - retval = false; + tf = false; if (! isnumeric (A)) return; endif @@ -76,7 +76,7 @@ e = tol * eye (rows (A)); [~, p] = chol (A - e); if (p == 0) - retval = true; + tf = true; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/isdiag.m --- a/scripts/linear-algebra/isdiag.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/isdiag.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,24 +24,24 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isdiag (@var{A}) +## @deftypefn {} {@var{tf} =} isdiag (@var{A}) ## Return true if @var{A} is a diagonal matrix. ## @seealso{isbanded, istril, istriu, diag, bandwidth} ## @end deftypefn -function retval = isdiag (A) +function tf = isdiag (A) if (nargin < 1) print_usage (); endif if (strfind (typeinfo (A), "diagonal matrix")) - retval = true; + tf = true; elseif ((isnumeric (A) || islogical (A)) && ndims (A) == 2) [i, j] = find (A); - retval = all (i == j); + tf = all (i == j); else - retval = false; + tf = false; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/ishermitian.m --- a/scripts/linear-algebra/ishermitian.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/ishermitian.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ishermitian (@var{A}) -## @deftypefnx {} {} ishermitian (@var{A}, @var{tol}) -## @deftypefnx {} {} ishermitian (@var{A}, @qcode{"skew"}) -## @deftypefnx {} {} ishermitian (@var{A}, @qcode{"skew"}, @var{tol}) +## @deftypefn {} {@var{tf} =} ishermitian (@var{A}) +## @deftypefnx {} {@var{tf} =} ishermitian (@var{A}, @var{tol}) +## @deftypefnx {} {@var{tf} =} ishermitian (@var{A}, @qcode{"skew"}) +## @deftypefnx {} {@var{tf} =} ishermitian (@var{A}, @qcode{"skew"}, @var{tol}) ## Return true if @var{A} is a Hermitian or skew-Hermitian matrix within the ## tolerance specified by @var{tol}. ## @@ -50,7 +50,7 @@ ## @seealso{issymmetric, isdefinite} ## @end deftypefn -function retval = ishermitian (A, skewopt = "nonskew", tol = 0) +function tf = ishermitian (A, skewopt = "nonskew", tol = 0) if (nargin < 1) print_usage (); @@ -67,8 +67,8 @@ endif ## Validate inputs - retval = (isnumeric (A) || islogical (A)) && issquare (A); - if (! retval) + tf = (isnumeric (A) || islogical (A)) && issquare (A); + if (! tf) return; endif @@ -84,26 +84,26 @@ if (strcmp (skewopt, "nonskew")) if (tol == 0) ## check for exact symmetry - retval = full (! any ((A != A')(:))); + tf = full (! any ((A != A')(:))); else if (islogical (A)) ## Hack to allow norm to work. Choose single to minimize memory. A = single (A); endif norm_x = norm (A, Inf); - retval = norm_x == 0 || norm (A - A', Inf) / norm_x <= tol; + tf = norm_x == 0 || norm (A - A', Inf) / norm_x <= tol; endif else ## skew-Hermitian if (tol == 0) - retval = full (! any ((A != -A')(:))); + tf = full (! any ((A != -A')(:))); else if (islogical (A)) ## Hack to allow norm to work. Choose single to minimize memory. A = single (A); endif norm_x = norm (A, Inf); - retval = norm_x == 0 || norm (A + A', Inf) / norm_x <= tol; + tf = norm_x == 0 || norm (A + A', Inf) / norm_x <= tol; endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/issymmetric.m --- a/scripts/linear-algebra/issymmetric.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/issymmetric.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} issymmetric (@var{A}) -## @deftypefnx {} {} issymmetric (@var{A}, @var{tol}) -## @deftypefnx {} {} issymmetric (@var{A}, @qcode{"skew"}) -## @deftypefnx {} {} issymmetric (@var{A}, @qcode{"skew"}, @var{tol}) +## @deftypefn {} {@var{tf} =} issymmetric (@var{A}) +## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @var{tol}) +## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @qcode{"skew"}) +## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @qcode{"skew"}, @var{tol}) ## Return true if @var{A} is a symmetric or skew-symmetric matrix within the ## tolerance specified by @var{tol}. ## @@ -49,7 +49,7 @@ ## @seealso{ishermitian, isdefinite} ## @end deftypefn -function retval = issymmetric (A, skewopt = "nonskew", tol = 0) +function tf = issymmetric (A, skewopt = "nonskew", tol = 0) if (nargin < 1) print_usage (); @@ -79,7 +79,7 @@ endif if (! issquare (A)) - retval = false; + tf = false; return; endif @@ -87,26 +87,26 @@ if (strcmp (skewopt, "nonskew")) if (tol == 0) ## check for exact symmetry - retval = full (! any ((A != A.')(:))); + tf = full (! any ((A != A.')(:))); else if (! isnumeric (A)) ## Hack to allow norm to work. Choose single to minimize memory. A = single (A); endif norm_x = norm (A, Inf); - retval = norm_x == 0 || norm (A - A.', Inf) / norm_x <= tol; + tf = norm_x == 0 || norm (A - A.', Inf) / norm_x <= tol; endif else ## skew symmetry if (tol == 0) - retval = full (! any ((A != -A.')(:))); + tf = full (! any ((A != -A.')(:))); else if (! isnumeric (A)) ## Hack to allow norm to work. Choose single to minimize memory. A = single (A); endif norm_x = norm (A, Inf); - retval = norm_x == 0 || norm (A + A.', Inf) / norm_x <= tol; + tf = norm_x == 0 || norm (A + A.', Inf) / norm_x <= tol; endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/istril.m --- a/scripts/linear-algebra/istril.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/istril.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} istril (@var{A}) +## @deftypefn {} {@var{tf} =} istril (@var{A}) ## Return true if @var{A} is a lower triangular matrix. ## ## A lower triangular matrix has nonzero entries only on the main diagonal and @@ -32,16 +32,16 @@ ## @seealso{istriu, isbanded, isdiag, tril, bandwidth} ## @end deftypefn -function retval = istril (A) +function tf = istril (A) if (nargin < 1) print_usage (); endif - retval = (isnumeric (A) || islogical (A)) && ndims (A) == 2; - if (retval) + tf = (isnumeric (A) || islogical (A)) && ndims (A) == 2; + if (tf) [i, j] = find (A); - retval = all (i >= j); + tf = all (i >= j); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/istriu.m --- a/scripts/linear-algebra/istriu.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/istriu.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} istriu (@var{A}) +## @deftypefn {} {@var{tf} =} istriu (@var{A}) ## Return true if @var{A} is an upper triangular matrix. ## ## An upper triangular matrix has nonzero entries only on the main diagonal and @@ -32,16 +32,16 @@ ## @seealso{isdiag, isbanded, istril, triu, bandwidth} ## @end deftypefn -function retval = istriu (A) +function tf = istriu (A) if (nargin < 1) print_usage (); endif - retval = (isnumeric (A) || islogical (A)) && ndims (A) == 2; - if (retval) + tf = (isnumeric (A) || islogical (A)) && ndims (A) == 2; + if (tf) [i, j] = find (A); - retval = all (i <= j); + tf = all (i <= j); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/orth.m --- a/scripts/linear-algebra/orth.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/orth.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} orth (@var{A}) -## @deftypefnx {} {} orth (@var{A}, @var{tol}) +## @deftypefn {} {@var{B} =} orth (@var{A}) +## @deftypefnx {} {@var{B} =} orth (@var{A}, @var{tol}) ## Return an orthonormal basis of the range space of @var{A}. ## ## The dimension of the range space is taken as the number of singular values @@ -38,14 +38,14 @@ ## @seealso{null} ## @end deftypefn -function retval = orth (A, tol) +function B = orth (A, tol) if (nargin < 1) print_usage (); endif if (isempty (A)) - retval = []; + B = []; return; endif @@ -72,9 +72,9 @@ rank = sum (s > tol); if (rank > 0) - retval = -U(:, 1:rank); + B = -U(:, 1:rank); else - retval = zeros (rows, 0); + B = zeros (rows, 0); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/rank.m --- a/scripts/linear-algebra/rank.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/rank.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rank (@var{A}) -## @deftypefnx {} {} rank (@var{A}, @var{tol}) +## @deftypefn {} {@var{k} =} rank (@var{A}) +## @deftypefnx {} {@var{k} =} rank (@var{A}, @var{tol}) ## 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 @@ -79,7 +79,7 @@ ## @seealso{null, orth, sprank, svd, eps} ## @end deftypefn -function retval = rank (A, tol) +function k = rank (A, tol) if (nargin < 1) print_usage (); @@ -101,7 +101,7 @@ tolerance = tol; endif - retval = sum (sigma > tolerance); + k = sum (sigma > tolerance); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/rref.m --- a/scripts/linear-algebra/rref.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/rref.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rref (@var{A}) -## @deftypefnx {} {} rref (@var{A}, @var{tol}) +## @deftypefn {} {@var{r} =} rref (@var{A}) +## @deftypefnx {} {@var{r} =} rref (@var{A}, @var{tol}) ## @deftypefnx {} {[@var{r}, @var{k}] =} rref (@dots{}) ## Return the reduced row echelon form of @var{A}. ## @@ -89,7 +89,9 @@ endif endif endfor - k = find (used); + if (nargout > 1) + k = find (used); + endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/trace.m --- a/scripts/linear-algebra/trace.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/trace.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} trace (@var{A}) +## @deftypefn {} {@var{t} =} trace (@var{A}) ## Compute the trace of @var{A}, the sum of the elements along the main ## diagonal. ## @@ -32,7 +32,7 @@ ## @seealso{eig} ## @end deftypefn -function y = trace (A) +function t = trace (A) if (nargin < 1) print_usage (); @@ -41,11 +41,11 @@ if (ndims (A) > 2) error ("trace: only valid on 2-D objects"); elseif (isempty (A)) - y = 0; + t = 0; elseif (isvector (A)) - y = A(1); + t = A(1); else - y = sum (diag (A)); + t = sum (diag (A)); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/linear-algebra/vech.m --- a/scripts/linear-algebra/vech.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/linear-algebra/vech.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} vech (@var{x}) +## @deftypefn {} {@var{v} =} vech (@var{x}) ## Return the vector obtained by eliminating all superdiagonal elements of ## the square matrix @var{x} and stacking the result one column above the ## other. @@ -37,8 +37,6 @@ ## See Magnus and Neudecker (1988), Matrix differential calculus with ## applications in statistics and econometrics. -## Author KH - function v = vech (x) if (nargin < 1) @@ -58,4 +56,6 @@ %!assert (vech ([1, 2, 3; 4, 5, 6; 7, 8, 9]), [1; 4; 7; 5; 8; 9]) +## Test input validation %!error vech () +%!error vech ([1,2,3;4,5,6]) diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/cast.m --- a/scripts/miscellaneous/cast.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/cast.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,16 +24,16 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cast (@var{val}, "@var{type}") -## @deftypefnx {} {} cast (@var{val}, "@var{like}", @var{var}) -## Convert @var{val} to data type @var{type}. +## @deftypefn {} {@var{y} =} cast (@var{x}, "@var{type}") +## @deftypefnx {} {@var{y} =} cast (@var{x}, "@var{like}", @var{var}) +## Convert @var{x} to data type @var{type}. ## -## The input @var{val} may be a scalar, vector, or matrix of a class that is +## The input @var{x} may be a scalar, vector, or matrix of a class that is ## convertible to the target class (see below). ## -## If a variable @var{var} is specified after @qcode{"like"}, @var{val} is +## If a variable @var{var} is specified after @qcode{"like"}, @var{x} is ## converted to the same data type and sparsity attribute. If @var{var} is -## complex, @var{val} will be complex, too. +## complex, @var{x} will be complex, too. ## ## @var{var} may be and @var{type} may name any of the following built-in ## numeric classes: @@ -55,7 +55,7 @@ ## @end group ## @end example ## -## The value @var{val} may be modified to fit within the range of the new type. +## The value @var{x} may be modified to fit within the range of the new type. ## ## Examples: ## @@ -68,7 +68,7 @@ ## @end group ## @end example ## -## Programming Note: This function relies on the object @var{val} having a +## Programming Note: This function relies on the object @var{x} having a ## conversion method named @var{type}. User-defined classes may implement only ## a subset of the full list of types shown above. In that case, it may be ## necessary to call cast twice in order to reach the desired type. @@ -84,7 +84,7 @@ ## double, single, logical, char, class, typeinfo} ## @end deftypefn -function retval = cast (val, type, var) +function y = cast (x, type, var) if (nargin < 2 || nargin > 3) print_usage (); @@ -105,8 +105,8 @@ print_usage (); endif - if (! isnumeric (val) && ! islogical (val) && ! ischar (val)) - error ("cast: type conversion from '%s' is not supported", class (val)); + if (! isnumeric (x) && ! islogical (x) && ! ischar (x)) + error ("cast: type conversion from '%s' is not supported", class (x)); endif if (! any (strcmp (type, {"int8"; "uint8"; "int16"; "uint16"; "int32"; @@ -115,17 +115,17 @@ error ("cast: type conversion to '%s' is not supported", type); endif - retval = feval (type, val); + y = feval (type, x); if (is_like) - if (issparse (var) && ! issparse (retval)) - ## retval is of the same type as var, so it must be convertible to sparse - retval = sparse (retval); - elseif (! issparse (var) && issparse (retval)) - retval = full (retval); + if (issparse (var) && ! issparse (y)) + ## y is of the same type as var, so it must be convertible to sparse + y = sparse (y); + elseif (! issparse (var) && issparse (y)) + y = full (y); endif - if (iscomplex (var) || iscomplex (val)) - retval = complex (retval); + if (iscomplex (var) || iscomplex (x)) + y = complex (y); endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/compare_versions.m --- a/scripts/miscellaneous/compare_versions.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/compare_versions.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} compare_versions (@var{v1}, @var{v2}, @var{operator}) +## @deftypefn {} {@var{tf} =} compare_versions (@var{v1}, @var{v2}, @var{operator}) ## Compare two version strings using the given @var{operator}. ## ## This function assumes that versions @var{v1} and @var{v2} are arbitrarily @@ -72,7 +72,7 @@ ## @code{double ("1").} ## @end deftypefn -function out = compare_versions (v1, v2, operator) +function tf = compare_versions (v1, v2, operator) if (nargin != 3) print_usage (); @@ -165,18 +165,18 @@ if (isempty (firstdiff)) ## They're equal. - out = equal_op; + tf = equal_op; elseif (lt_op || gt_op) ## They're correctly less than or greater than. - out = (vcmp(firstdiff) > 0); + tf = (vcmp(firstdiff) > 0); else ## They're not correctly less than or greater than, and they're not equal. - out = false; + tf = false; endif ## Reverse the output if not is given. if (not_op) - out = ! out; + tf = ! tf; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/delete.m --- a/scripts/miscellaneous/delete.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/delete.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} delete (@var{file}) +## @deftypefn {} {} delete @var{file} +## @deftypefnx {} {} delete @var{file1} @var{file2} @dots{} +## @deftypefnx {} {} delete (@var{file}) ## @deftypefnx {} {} delete (@var{file1}, @var{file2}, @dots{}) ## @deftypefnx {} {} delete (@var{handle}) ## Delete the named file or graphics handle. diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/dir.m --- a/scripts/miscellaneous/dir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/dir.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,7 +25,7 @@ ## -*- texinfo -*- ## @deftypefn {} {} dir -## @deftypefnx {} {} dir (@var{directory}) +## @deftypefnx {} {} dir @var{directory} ## @deftypefnx {} {[@var{list}] =} dir (@var{directory}) ## Display file listing for directory @var{directory}. ## @@ -75,13 +75,13 @@ ## FIXME: This is quite slow for large directories. ## Perhaps it should be converted to C++? -function retval = dir (directory = ".") +function list = dir (directory = ".") if (! ischar (directory)) error ("dir: DIRECTORY argument must be a string"); endif - ## Prep the retval. + ## Prep the list. info = struct (zeros (0, 1), {"name", "folder" "date", "bytes", "isdir", "datenum", "statinfo"}); @@ -181,7 +181,7 @@ ## Return the output arguments. if (nargout > 0) ## Return the requested structure. - retval = info; + list = info; elseif (numel (info) > 0) ## Print the structure to the screen. printf ("%s", list_in_columns ({info.name})); diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/fileattrib.m --- a/scripts/miscellaneous/fileattrib.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/fileattrib.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fileattrib () +## @deftypefn {} {} fileattrib +## @deftypefnx {} {} fileattrib @var{file} ## @deftypefnx {} {} fileattrib (@var{file}) ## @deftypefnx {} {[@var{status}, @var{attrib}] =} fileattrib (@dots{}) ## @deftypefnx {} {[@var{status}, @var{msg}, @var{msgid}] =} fileattrib (@dots{}) diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/grabcode.m --- a/scripts/miscellaneous/grabcode.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/grabcode.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} grabcode (@var{url}) -## @deftypefnx {} {} grabcode (@var{filename}) +## @deftypefn {} {} grabcode @var{filename} +## @deftypefnx {} {} grabcode @var{url} ## @deftypefnx {} {@var{code_str} =} grabcode (@dots{}) ## ## Grab the code from a report created by the @code{publish} function. @@ -35,8 +35,8 @@ ## The @code{publish} function creates this format automatically. ## ## If no return value is requested the code is saved to a temporary file and -## opened in the default editor. NOTE: The temporary file must be saved under -## a new or the code will be lost. +## opened in the default editor. NOTE: The temporary file must be saved to a +## new filename or the code will be lost. ## ## If an output is requested the grabbed code will be returned as string ## @var{code_str}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/gunzip.m --- a/scripts/miscellaneous/gunzip.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/gunzip.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,34 +25,34 @@ ## -*- texinfo -*- ## @deftypefn {} {} gunzip (@var{gzfile}) -## @deftypefnx {} {} gunzip (@var{gzfile}, @var{dir}) +## @deftypefnx {} {} gunzip (@var{gzfile}, @var{outdir}) ## @deftypefnx {} {@var{filelist} =} gunzip (@dots{}) ## Unpack the gzip archive @var{gzfile}. ## ## If @var{gzfile} is a directory, all gzfiles in the directory will be ## recursively unpacked. ## -## If @var{dir} is specified the files are unpacked in this directory rather +## If @var{outdir} is specified the files are unpacked in this directory rather ## than the one where @var{gzfile} is located. ## ## The optional output @var{filelist} is a list of the uncompressed files. ## @seealso{gzip, unpack, bunzip2, unzip, untar} ## @end deftypefn -function filelist = gunzip (gzfile, dir = []) +function filelist = gunzip (gzfile, outdir = []) if (nargin < 1) print_usage (); endif - if (isempty (dir) && ischar (gzfile)) - dir = fileparts (gzfile); + if (isempty (outdir) && ischar (gzfile)) + outdir = fileparts (gzfile); endif if (nargout > 0) - filelist = unpack (gzfile, dir, "gz"); + filelist = unpack (gzfile, outdir, "gz"); else - unpack (gzfile, dir, "gz"); + unpack (gzfile, outdir, "gz"); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/inputname.m --- a/scripts/miscellaneous/inputname.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/inputname.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,8 +27,8 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} inputname (@var{n}) -## @deftypefnx {} {} inputname (@var{n}, @var{ids_only}) +## @deftypefn {} {@var{namestr} =} inputname (@var{n}) +## @deftypefnx {} {@var{namestr} =} inputname (@var{n}, @var{ids_only}) ## Return the name of the @var{n}-th argument to the calling function. ## ## If the argument is not a simple variable name, return an empty string. @@ -73,7 +73,7 @@ ## arrayfun (fn, a, 'uniformoutput', false) ## % output is {'fn', 'a', '', ''} -function name = inputname (n, ids_only = true) +function namestr = inputname (n, ids_only = true) if (nargin < 1) print_usage (); @@ -84,16 +84,16 @@ endif try - name = evalin ("caller", sprintf ("__varval__ ('.argn.'){%d}", n)); + namestr = evalin ("caller", sprintf ("__varval__ ('.argn.'){%d}", n)); catch - name = ""; + namestr = ""; return; end_try_catch ## For compatibility with Matlab, return empty string if argument name is ## not a valid identifier. - if (ids_only && ! isvarname (name)) - name = ""; + if (ids_only && ! isvarname (namestr)) + namestr = ""; elseif (ids_only) ## More complicated checking is required to verify name (bug #59103). ## NAME may be text, like "Inf", which is an acceptable variable name @@ -101,9 +101,9 @@ ## variable name, rather than a function or IEEE number. try v = evalin ("caller", - sprintf ("evalin ('caller', '__varval__ (\"%s\")')", name)); + sprintf ("evalin ('caller', '__varval__ (\"%s\")')", namestr)); catch - name = ""; + namestr = ""; end_try_catch endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/isdeployed.m --- a/scripts/miscellaneous/isdeployed.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/isdeployed.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isdeployed () +## @deftypefn {} {@var{tf} =} isdeployed () ## Return true if the current program has been compiled and is running ## separately from the Octave interpreter and false if it is running in ## the Octave interpreter. @@ -32,8 +32,8 @@ ## Currently, this function always returns false in Octave. ## @end deftypefn -function retval = isdeployed () - retval = false; +function tf = isdeployed () + tf = false; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/isfolder.m --- a/scripts/miscellaneous/isfolder.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/isfolder.m Sun Apr 03 11:30:26 2022 -0400 @@ -33,7 +33,7 @@ ## is_rooted_relative_filename} ## @end deftypefn -function retval = isfolder (f) +function tf = isfolder (f) if (nargin < 1) print_usage (); @@ -44,10 +44,10 @@ endif f = cellstr (f); - retval = false (size (f)); + tf = false (size (f)); for i = 1:numel (f) [info, err] = stat (f{i}); - retval(i) = (! err && S_ISDIR (info.mode)); + tf(i) = (! err && S_ISDIR (info.mode)); endfor endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/ismac.m --- a/scripts/miscellaneous/ismac.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/ismac.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ismac () +## @deftypefn {} {@var{tf} =} ismac () ## Return true if Octave is running on a Mac OS X system and false otherwise. ## @seealso{isunix, ispc} ## @end deftypefn -function retval = ismac () +function tf = ismac () - retval = __octave_config_info__ ("mac"); + tf = __octave_config_info__ ("mac"); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/ismethod.m --- a/scripts/miscellaneous/ismethod.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/ismethod.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ismethod (@var{obj}, @var{method}) -## @deftypefnx {} {} ismethod (@var{class_name}, @var{method}) +## @deftypefn {} {@var{tf} =} ismethod (@var{obj}, @var{method}) +## @deftypefnx {} {@var{tf} =} ismethod (@var{class_name}, @var{method}) ## Return true if the string @var{method} is a valid method of the object ## @var{obj} or of the class @var{clsname}. ## @seealso{isprop, isobject, isjava, methods} ## @end deftypefn -function retval = ismethod (obj, method) +function tf = ismethod (obj, method) if (nargin != 2) print_usage (); @@ -47,7 +47,7 @@ method_list = methods (obj); - retval = ismember (method, method_list); + tf = ismember (method, method_list); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/ispc.m --- a/scripts/miscellaneous/ispc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/ispc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ispc () +## @deftypefn {} {@var{tf} =} ispc () ## Return true if Octave is running on a Windows system and false otherwise. ## @seealso{isunix, ismac} ## @end deftypefn -function retval = ispc () +function tf = ispc () - retval = __octave_config_info__ ("windows"); + tf = __octave_config_info__ ("windows"); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/isunix.m --- a/scripts/miscellaneous/isunix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/isunix.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isunix () +## @deftypefn {} {@var{tf} =} isunix () ## Return true if Octave is running on a Unix-like system and false otherwise. ## @seealso{ismac, ispc} ## @end deftypefn -function retval = isunix () +function tf = isunix () - retval = __octave_config_info__ ("unix"); + tf = __octave_config_info__ ("unix"); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/license.m --- a/scripts/miscellaneous/license.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/license.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,10 +28,11 @@ ## @deftypefnx {} {} license inuse ## @deftypefnx {} {} license inuse @var{feature} ## @deftypefnx {} {} license ("inuse") -## @deftypefnx {} {@var{retval} =} license ("inuse") -## @deftypefnx {} {@var{retval} =} license ("test", @var{feature}) -## @deftypefnx {} {@var{retval} =} license ("checkout", @var{feature}) -## @deftypefnx {} {[@var{retval}, @var{errmsg}] =} license ("checkout", @var{feature}) +## @deftypefnx {} {@var{license_struct} =} license ("inuse") +## @deftypefnx {} {@var{license_struct} =} license ("inuse", @var{feature}) +## @deftypefnx {} {@var{status} =} license ("test", @var{feature}) +## @deftypefnx {} {@var{status} =} license ("checkout", @var{feature}) +## @deftypefnx {} {[@var{status}, @var{errmsg}] =} license ("checkout", @var{feature}) ## Get license information for Octave and Octave packages. ## ## GNU Octave is free software distributed under the GNU General Public @@ -41,12 +42,12 @@ ## When called with no extra input arguments, it returns the Octave license, ## otherwise the first input defines the operation mode and must be one of ## the following strings: @code{inuse}, @code{test}, and @code{checkout}. -## The optional @var{feature} argument can either be @qcode{"octave"} (core), -## or an Octave package. +## The optional @var{feature} argument can either be @qcode{"octave"} (core) +## or the name of an Octave package. ## ## @table @asis ## @item @qcode{"inuse"} -## Returns a list of loaded features, i.e., octave and the list of loaded +## Print a list of loaded features, i.e., "octave" and the list of loaded ## packages. If an output is requested, it returns a struct array with ## the fields @qcode{"feature"}, and @qcode{"user"}. ## @@ -66,11 +67,11 @@ ## @seealso{pkg, ver, version} ## @end deftypefn -function [retval, errmsg] = license (cmd, feature, toggle) +function [status, errmsg] = license (cmd, feature, toggle) if (nargin == 0) ## then only give information about Octave core - retval = "GNU General Public License"; + status = "GNU General Public License"; return; endif @@ -86,7 +87,7 @@ if (nargout == 0) printf ("%s\n", features{:}); else - retval = struct ("feature", features, "user", get_username ()); + status = struct ("feature", features, "user", get_username ()); endif case "test" @@ -105,7 +106,7 @@ endswitch endif - retval = any (strcmp (features, feature)); + status = any (strcmp (features, feature)); case "checkout" ## I guess we could have the checkout command load packages but it's not @@ -116,10 +117,10 @@ print_usage (); endif - retval = any (strcmp (features, feature)); + status = any (strcmp (features, feature)); errmsg = ""; - if (! retval) + if (! status) errmsg = ['No package named "' feature '" installed']; endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/list_primes.m --- a/scripts/miscellaneous/list_primes.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/list_primes.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,15 +24,15 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} list_primes () -## @deftypefnx {} {} list_primes (@var{n}) +## @deftypefn {} {@var{p} =} list_primes () +## @deftypefnx {} {@var{p} =} list_primes (@var{n}) ## List the first @var{n} primes. ## ## If @var{n} is unspecified, the first 25 primes are listed. ## @seealso{primes, isprime} ## @end deftypefn -function retval = list_primes (n = 25) +function p = list_primes (n = 25) if (! isreal (n) || ! isscalar (n)) error ("list_primes: N must be a real scalar"); @@ -41,10 +41,10 @@ n = floor (n); if (n < 1) - retval = []; + p = []; return; elseif (n == 1) - retval = 2; + p = 2; return; endif @@ -54,7 +54,7 @@ error ("list_primes: Algorithm failed. Try primes (n*log (6*n))(1:n)"); endif - retval = list(1:n); + p = list(1:n); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/ls.m --- a/scripts/miscellaneous/ls.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/ls.m Sun Apr 03 11:30:26 2022 -0400 @@ -58,7 +58,7 @@ ## @seealso{dir, readdir, glob, what, stat, filesep, ls_command} ## @end deftypefn -function retval = ls (varargin) +function list = ls (varargin) if (! iscellstr (varargin)) error ("ls: all arguments must be character strings"); @@ -100,7 +100,7 @@ elseif (nargout == 0) puts (output); else - retval = strvcat (regexp (output, "[\r\n]+", "split"){:}); + list = strvcat (regexp (output, "[\r\n]+", "split"){:}); endif else ## Just let the output flow if the pager is off. That way the diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/mexext.m --- a/scripts/miscellaneous/mexext.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/mexext.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,13 +24,17 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} mexext () +## @deftypefn {} {@var{ext} =} mexext () ## Return the filename extension used for MEX files. +## +## Programming Note: Octave uses the extension @file{mex} for all MEX files +## regardless of the operating system (Linux, Windows, Apple) or the bit-width +## (32-bit or 64-bit) of the hardware. ## @seealso{mex} ## @end deftypefn -function retval = mexext () - retval = "mex"; +function ext = mexext () + ext = "mex"; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/module.mk --- a/scripts/miscellaneous/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -94,7 +94,6 @@ %reldir%/swapbytes.m \ %reldir%/symvar.m \ %reldir%/tar.m \ - %reldir%/tempdir.m \ %reldir%/unix.m \ %reldir%/unpack.m \ %reldir%/untar.m \ diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/movefile.m --- a/scripts/miscellaneous/movefile.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/movefile.m Sun Apr 03 11:30:26 2022 -0400 @@ -30,6 +30,8 @@ ## @deftypefnx {} {} movefile (@var{f1}) ## @deftypefnx {} {} movefile (@var{f1}, @var{f2}) ## @deftypefnx {} {} movefile (@var{f1}, @var{f2}, 'f') +## @deftypefnx {} {[@var{status}] =} movefile (@dots{}) +## @deftypefnx {} {[@var{status}, @var{msg}] =} movefile (@dots{}) ## @deftypefnx {} {[@var{status}, @var{msg}, @var{msgid}] =} movefile (@dots{}) ## Move the source file or directory @var{f1} to the destination @var{f2}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/namelengthmax.m --- a/scripts/miscellaneous/namelengthmax.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/namelengthmax.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} namelengthmax () +## @deftypefn {} {@var{n} =} namelengthmax () ## Return the @sc{matlab} compatible maximum variable name length. ## ## Octave is capable of storing strings up to @math{2^{31} - 1} in length. diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/nargoutchk.m --- a/scripts/miscellaneous/nargoutchk.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/nargoutchk.m Sun Apr 03 11:30:26 2022 -0400 @@ -49,12 +49,12 @@ function msg = nargoutchk (minargs, maxargs, nargs, outtype) - ## before matlab's 2011b, nargoutchk would return an error message (just the + ## Before Matlab 2011b, nargoutchk would return an error message (just the ## message in a string). With 2011b, it no longer returns anything, it ## simply gives an error if the args number is incorrect. ## To try to keep compatibility with both versions, check nargout and nargin - ## to guess if the caller is expecting a value (old syntax) - ## or none (new syntax). + ## to guess if the caller is expecting a value (old syntax) or none + ## (new syntax). if (nargout == 1 && (nargin == 3 || nargin == 4)) diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/nthargout.m --- a/scripts/miscellaneous/nthargout.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/nthargout.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} nthargout (@var{n}, @var{func}, @dots{}) -## @deftypefnx {} {} nthargout (@var{n}, @var{ntot}, @var{func}, @dots{}) +## @deftypefn {} {@var{arg} =} nthargout (@var{n}, @var{func}, @dots{}) +## @deftypefnx {} {@var{arg} =} nthargout (@var{n}, @var{ntot}, @var{func}, @dots{}) ## Return the @var{n}th output argument of the function specified by the ## function handle or string @var{func}. ## @@ -35,9 +35,9 @@ ## indices of the output, in which case the output will be a cell array of the ## requested output arguments. ## -## The intended use @code{nthargout} is to avoid intermediate variables. For -## example, when finding the indices of the maximum entry of a matrix, the -## following two compositions of nthargout +## The intended use of @code{nthargout} is to avoid intermediate variables. +## For example, when finding the indices of the maximum entry of a matrix, the +## following two compositions of @code{nthargout} ## ## @example ## @group @@ -61,8 +61,8 @@ ## @end group ## @end example ## -## It can also be helpful to have all output arguments in a single cell in the -## following manner: +## It can also be helpful to have all output arguments collected in a single +## cell array as the following code demonstrates: ## ## @example ## @var{USV} = nthargout ([1:3], @@svd, hilb (5)); @@ -71,7 +71,7 @@ ## @seealso{nargin, nargout, varargin, varargout, isargout} ## @end deftypefn -function out = nthargout (n, varargin) +function arg = nthargout (n, varargin) if (nargin < 2) print_usage (); @@ -99,9 +99,9 @@ try [outargs{:}] = feval (func, args{:}); if (numel (n) > 1) - out = outargs(n); + arg = outargs(n); else - out = outargs{n}; + arg = outargs{n}; endif catch err = lasterr (); diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/substruct.m --- a/scripts/miscellaneous/substruct.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/substruct.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} substruct (@var{type}, @var{subs}, @dots{}) +## @deftypefn {} {@var{s} =} substruct (@var{type}, @var{subs}, @dots{}) ## Create a subscript structure for use with @code{subsref} or @code{subsasgn}. ## ## For example: @@ -50,7 +50,7 @@ ## @seealso{subsref, subsasgn} ## @end deftypefn -function retval = substruct (varargin) +function s = substruct (varargin) if (nargin < 2 || mod (nargin, 2) != 0) print_usage (); @@ -72,7 +72,7 @@ error ('substruct: TYPE must be one of "()", "{}", or ""'); endif - retval = struct ("type", typ, "subs", sub); + s = struct ("type", typ, "subs", sub); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/swapbytes.m --- a/scripts/miscellaneous/swapbytes.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/swapbytes.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} swapbytes (@var{x}) +## @deftypefn {} {@var{y} =} swapbytes (@var{x}) ## Swap the byte order on values, converting from little endian to big endian ## and vice versa. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/tempdir.m --- a/scripts/miscellaneous/tempdir.m Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -######################################################################## -## -## Copyright (C) 2003-2022 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or . -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {@var{dir} =} tempdir () -## Return the name of the host system's directory for temporary files. -## -## The directory name is taken first from the environment variable -## @env{TMPDIR}. If that does not exist the system default returned by -## @code{P_tmpdir} is used. -## @seealso{P_tmpdir, tempname, mkstemp, tmpfile} -## @end deftypefn - -function dirname = tempdir () - - dirname = getenv ("TMPDIR"); - if (isempty (dirname)) - dirname = P_tmpdir (); - endif - - if (! strcmp (dirname(end), filesep)) - dirname = [dirname filesep]; - endif - - if (! isfolder (dirname)) - warning ("tempdir: '%s' does not exist or is not a directory", dirname); - endif - -endfunction - - -%!assert (ischar (tempdir ())) - -%!test -%! old_wstate = warning ("query"); -%! warning ("off"); -%! old_tmpdir = getenv ("TMPDIR"); -%! unwind_protect -%! setenv ("TMPDIR", "__MY_TMP_DIR__"); -%! assert (tempdir (), ["__MY_TMP_DIR__" filesep()]); -%! unwind_protect_cleanup -%! if (! isempty (old_tmpdir)) -%! setenv ("TMPDIR", old_tmpdir); -%! else -%! unsetenv ("TMPDIR"); -%! endif -%! warning (old_wstate); -%! end_unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/ver.m --- a/scripts/miscellaneous/ver.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/ver.m Sun Apr 03 11:30:26 2022 -0400 @@ -56,7 +56,7 @@ ## @seealso{version, usejava, pkg} ## @end deftypefn -function retval = ver (package = "") +function v = ver (package = "") if (nargout == 0) hg_id = __octave_config_info__ ("hg_id"); @@ -91,24 +91,24 @@ if (isempty (package)) ## Start with the version info for Octave [octver, octdate] = version (); - retval = struct ("Name", "Octave", "Version", octver, - "Release", [], "Date", octdate); + v = struct ("Name", "Octave", "Version", octver, + "Release", [], "Date", octdate); lst = pkg ("list"); for i = 1:numel (lst) - retval(end+1) = struct ("Name", lst{i}.name, "Version", lst{i}.version, - "Release", [], "Date", lst{i}.date); + v(end+1) = struct ("Name", lst{i}.name, "Version", lst{i}.version, + "Release", [], "Date", lst{i}.date); endfor elseif (strcmpi (package, "Octave")) [octver, octdate] = version (); - retval = struct ("Name", "Octave", "Version", octver, - "Release", [], "Date", octdate); + v = struct ("Name", "Octave", "Version", octver, + "Release", [], "Date", octdate); else lst = pkg ("list", package); if (isempty (lst)) - retval = struct ("Name", {}, "Version", {}, "Release", {}, "Date", {}); + v = struct ("Name", {}, "Version", {}, "Release", {}, "Date", {}); else - retval = struct ("Name", lst{1}.name, "Version", lst{1}.version, - "Release", [], "Date", lst{1}.date); + v = struct ("Name", lst{1}.name, "Version", lst{1}.version, + "Release", [], "Date", lst{1}.date); endif endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/verLessThan.m --- a/scripts/miscellaneous/verLessThan.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/verLessThan.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} verLessThan (@var{package}, @var{version}) +## @deftypefn {} {@var{tf} =} verLessThan (@var{package}, @var{version}) ## Return true if the installed version of the package is less than ## @var{version}. ## @@ -56,7 +56,7 @@ ## @seealso{compare_versions, version, ver, pkg} ## @end deftypefn -function retval = verLessThan (package, version) +function tf = verLessThan (package, version) if (nargin != 2) print_usage (); @@ -72,7 +72,7 @@ error ('verLessThan: package "%s" is not installed', package); endif - retval = compare_versions (v(idx).Version, version, "<"); + tf = compare_versions (v(idx).Version, version, "<"); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/miscellaneous/what.m --- a/scripts/miscellaneous/what.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/miscellaneous/what.m Sun Apr 03 11:30:26 2022 -0400 @@ -71,7 +71,7 @@ ## @seealso{which, ls, exist} ## @end deftypefn -function retval = what (dir) +function w = what (dir) if (nargin == 0) dir = { pwd() }; @@ -98,26 +98,26 @@ ## Lookup info for each directory for i = 1 : numel (dir) - w(i) = __what__ (dir{i}); + ws(i) = __what__ (dir{i}); endfor ## If none was found, return an empty struct if (numel (dir) == 0) - w = __what__ (""); - w = resize (w, [0, 1]); # Matlab compatibility, return 0x1 empty array + ws = __what__ (""); + ws = resize (ws, [0, 1]); # Matlab compatibility, return 0x1 empty array endif if (nargout == 0) - for i = 1 : numel (w) - __print_fnames__ ("M-files in directory", w(i).path, w(i).m); - __print_fnames__ ("\nMAT-files in directory", w(i).path, w(i).mat); - __print_fnames__ ("\nMEX-files in directory", w(i).path, w(i).mex); - __print_fnames__ ("\nOCT-files in directory", w(i).path, w(i).oct); - __print_fnames__ ("\nClasses in directory", w(i).path, w(i).classes); - __print_fnames__ ("\nPackages in directory", w(i).path, w(i).packages); + for i = 1 : numel (ws) + __print_fnames__ ("M-files in directory", ws(i).path, ws(i).m); + __print_fnames__ ("\nMAT-files in directory", ws(i).path, ws(i).mat); + __print_fnames__ ("\nMEX-files in directory", ws(i).path, ws(i).mex); + __print_fnames__ ("\nOCT-files in directory", ws(i).path, ws(i).oct); + __print_fnames__ ("\nClasses in directory", ws(i).path, ws(i).classes); + __print_fnames__ ("\nPackages in directory", ws(i).path, ws(i).packages); endfor else - retval = w; + w = ws; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/fminunc.m --- a/scripts/optimization/fminunc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/fminunc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fminunc (@var{fcn}, @var{x0}) -## @deftypefnx {} {} fminunc (@var{fcn}, @var{x0}, @var{options}) +## @deftypefn {} {@var{x} =} fminunc (@var{fcn}, @var{x0}) +## @deftypefnx {} {@var{x} =} fminunc (@var{fcn}, @var{x0}, @var{options}) +## @deftypefnx {} {[@var{x}, @var{fval}] =} fminunc (@var{fcn}, @dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}] =} fminunc (@var{fcn}, @dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}] =} fminunc (@var{fcn}, @dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}, @var{grad}] =} fminunc (@var{fcn}, @dots{}) ## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}, @var{grad}, @var{hess}] =} fminunc (@var{fcn}, @dots{}) ## Solve an unconstrained optimization problem defined by the function ## @var{fcn}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/fsolve.m --- a/scripts/optimization/fsolve.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/fsolve.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fsolve (@var{fcn}, @var{x0}) -## @deftypefnx {} {} fsolve (@var{fcn}, @var{x0}, @var{options}) +## @deftypefn {} {@var{x} =} fsolve (@var{fcn}, @var{x0}) +## @deftypefnx {} {@var{x} =} fsolve (@var{fcn}, @var{x0}, @var{options}) +## @deftypefnx {} {[@var{x}, @var{fval}] =} fsolve (@dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}] =} fsolve (@dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}] =} fsolve (@dots{}) ## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}, @var{fjac}] =} fsolve (@dots{}) ## Solve a system of nonlinear equations defined by the function @var{fcn}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/fzero.m --- a/scripts/optimization/fzero.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/fzero.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fzero (@var{fun}, @var{x0}) -## @deftypefnx {} {} fzero (@var{fun}, @var{x0}, @var{options}) +## @deftypefn {} {@var{x} =} fzero (@var{fun}, @var{x0}) +## @deftypefnx {} {@var{x} =} fzero (@var{fun}, @var{x0}, @var{options}) +## @deftypefnx {} {[@var{x}, @var{fval}] =} fzero (@dots{}) +## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}] =} fzero (@dots{}) ## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}] =} fzero (@dots{}) ## Find a zero of a univariate function. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/optimget.m --- a/scripts/optimization/optimget.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/optimget.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,43 +24,43 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} optimget (@var{options}, @var{parname}) -## @deftypefnx {} {} optimget (@var{options}, @var{parname}, @var{default}) -## Return the specific option @var{parname} from the optimization options +## @deftypefn {} {@var{optval} =} optimget (@var{options}, @var{optname}) +## @deftypefnx {} {@var{optval} =} optimget (@var{options}, @var{optname}, @var{default}) +## Return the specific option @var{optname} from the optimization options ## structure @var{options} created by @code{optimset}. ## -## If @var{parname} is not defined then return @var{default} if supplied, +## If @var{optname} is not defined then return @var{default} if supplied, ## otherwise return an empty matrix. ## @seealso{optimset} ## @end deftypefn -function retval = optimget (options, parname, default) +function optval = optimget (options, optname, default) - if (nargin < 2 || ! isstruct (options) || ! ischar (parname)) + if (nargin < 2 || ! isstruct (options) || ! ischar (optname)) print_usage (); endif ## Expand partial-length names into full names opts = __all_opts__ (); - idx = strncmpi (opts, parname, length (parname)); + idx = strncmpi (opts, optname, length (optname)); nmatch = sum (idx); if (nmatch == 1) - parname = opts{idx}; + optname = opts{idx}; elseif (nmatch == 0) - warning ("optimget: unrecognized option: %s", parname); + warning ("optimget: unrecognized option: %s", optname); else fmt = sprintf ("optimget: ambiguous option: %%s (%s%%s)", repmat ("%s, ", 1, nmatch-1)); - warning (fmt, parname, opts{idx}); + warning (fmt, optname, opts{idx}); endif - if (isfield (options, parname) && ! isempty (options.(parname))) - retval = options.(parname); + if (isfield (options, optname) && ! isempty (options.(optname))) + optval = options.(optname); elseif (nargin > 2) - retval = default; + optval = default; else - retval = []; + optval = []; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/private/__fdjac__.m --- a/scripts/optimization/private/__fdjac__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/private/__fdjac__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __fdjac__ (@var{fcn}, @var{x}, @var{fvec}, @var{typicalx}, @var{cdif}, @var{err}) +## @deftypefn {} {@var{fjac} =} __fdjac__ (@var{fcn}, @var{x}, @var{fvec}, @var{typicalx}, @var{cdif}, @var{err}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/optimization/qp.m --- a/scripts/optimization/qp.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/optimization/qp.m Sun Apr 03 11:30:26 2022 -0400 @@ -347,7 +347,12 @@ in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+abs (bin)))); info = 0; - if (eq_infeasible || in_infeasible) + + if (isdefinite (H) != 1) + info = 2; + endif + + if (info == 0 && (eq_infeasible || in_infeasible)) ## The initial guess is not feasible. ## First, define an xbar that is feasible with respect to the ## equality constraints. @@ -454,3 +459,9 @@ %! %! assert (isstruct (INFO) && isfield (INFO, "info") && (INFO.info == 0)); %! assert ([x obj_qp], [1.0 0.5], eps); + +%!test <*61762> +%! [x, obj, info] = qp ([], [21, 30, 39; 30, 45, 60; 39, 60, 81], [-40; -65; -90]); +%! assert (x, zeros (3, 1)); +%! assert (obj, 0); +%! assert (info.info, 2); diff -r 0a1aec50a0c8 -r 960909469245 scripts/path/matlabroot.m --- a/scripts/path/matlabroot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/path/matlabroot.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} matlabroot () +## @deftypefn {} {@var{dir} =} matlabroot () ## Return the name of the top-level Octave installation directory. ## ## This is an alias for the function @w{@code{OCTAVE_HOME}} provided for @@ -32,9 +32,9 @@ ## @seealso{OCTAVE_HOME} ## @end deftypefn -function retval = matlabroot () +function dir = matlabroot () - retval = OCTAVE_HOME (); + dir = OCTAVE_HOME (); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/path/savepath.m --- a/scripts/path/savepath.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/path/savepath.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} savepath () -## @deftypefnx {} {} savepath (@var{file}) +## @deftypefn {} {} savepath +## @deftypefnx {} {} savepath @var{file} ## @deftypefnx {} {@var{status} =} savepath (@dots{}) ## Save the unique portion of the current function search path that is ## not set during Octave's initialization process to @var{file}. @@ -46,7 +46,7 @@ ## @seealso{path, addpath, rmpath, genpath, pathdef} ## @end deftypefn -function retval = savepath (file) +function status = savepath (file) beginstring = "## Begin savepath auto-created section, do not edit"; endstring = "## End savepath auto-created section"; @@ -170,8 +170,8 @@ fprintf (fid, "%s\n", post{:}); unwind_protect_cleanup - status = fclose (fid); - if (status < 0) + sts = fclose (fid); + if (sts < 0) error ("savepath: could not close savefile after writing, %s", file); elseif (nargin == 0) warning ("off", "backtrace", "local"); @@ -181,7 +181,7 @@ end_unwind_protect if (nargout > 0) - retval = 0; + status = 0; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/pkg/private/configure_make.m --- a/scripts/pkg/private/configure_make.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/pkg/private/configure_make.m Sun Apr 03 11:30:26 2022 -0400 @@ -53,13 +53,13 @@ endif if (ispc () && ! isunix ()) - # replace all backslashes with forward slashes + ## Replace all backslashes with forward slashes mkoctfile_program = strrep (mkoctfile_program, '\', '/'); octave_config_program = strrep (octave_config_program, '\', '/'); octave_binary = strrep (octave_binary, '\', '/'); endif - # escape spaces in file paths unless they are already escaped + ## Escape spaces in file paths unless they are already escaped mkoctfile_program = regexprep (mkoctfile_program, '([^\\]) ', '$1\\ '); octave_config_program = regexprep (octave_config_program, ... '([^\\]) ', '$1\\ '); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/axis.m --- a/scripts/plot/appearance/axis.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/axis.m Sun Apr 03 11:30:26 2022 -0400 @@ -83,9 +83,16 @@ ## @item @qcode{"manual"} ## Fix the current axes limits. ## +## @item @qcode{"tickaligned"} +## Fix axes to the limits of the closest ticks. +## ## @item @qcode{"tight"} ## Fix axes to the limits of the data. ## +## @item @qcode{"padded"} +## Fix axes to the limits of the data plus margins of about 7% of the +## data extent. +## ## @item @qcode{"image"} ## Equivalent to @qcode{"tight"} and @qcode{"equal"}. ## @@ -213,8 +220,10 @@ ## aspect ratio elseif (strcmpi (opt, "image")) __axis__ (ca, "equal"); - set (ca, "plotboxaspectratiomode", "auto"); - __do_tight_option__ (ca); + set (ca, "plotboxaspectratiomode", "auto", ... + "xlimmode", "auto", "ylimmode", "auto", ... + "zlimmode", "auto", ... + "xlimitmethod", "tight", "ylimitmethod", "tight"); elseif (strcmpi (opt, "square")) set (ca, "dataaspectratiomode", "auto", "plotboxaspectratio", [1, 1, 1]); @@ -280,10 +289,26 @@ ## fixes the axis limits set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual"); + elseif (strcmpi (opt, "tickaligned")) + ## sets the axis limits to closest ticks. + set (ca, "xlimmode", "auto", "ylimmode", "auto", ... + "zlimmode", "auto", ... + "xlimitmethod", "tickaligned", ... + "ylimitmethod", "tickaligned", ... + "zlimitmethod", "tickaligned"); elseif (strcmpi (opt, "tight")) ## sets the axis limits to the min and max of all data. - __do_tight_option__ (ca); - + set (ca, "xlimmode", "auto", "ylimmode", "auto", ... + "zlimmode", "auto", ... + "xlimitmethod", "tight", "ylimitmethod", "tight", + "zlimitmethod", "tight"); + elseif (strcmpi (opt, "padded")) + ## sets the axis limits to the min and max of all data plus padding. + set (ca, "xlimmode", "auto", "ylimmode", "auto", ... + "zlimmode", "auto", ... + "xlimitmethod", "padded", ... + "ylimitmethod", "padded", ... + "zlimitmethod", "padded"); ## visibility elseif (strcmpi (opt, "on")) set (ca, "visible", "on"); @@ -376,87 +401,6 @@ endfunction -## Find the limits for axis ("tight"). -## AX should be one of "x", "y", or "z". -function lims = __get_tight_lims__ (ca, ax) - - kids = findobj (ca, "-property", [ax "data"]); - ## The data properties for hggroups mirror their children. - ## Exclude the redundant hggroup values. - hg_kids = findobj (kids, "type", "hggroup"); - kids = setdiff (kids, hg_kids); - if (isempty (kids)) - ## Return the current limits. - ## FIXME: Is this the correct thing to do? - lims = get (ca, [ax "lim"]); - else - data = get (kids, [ax "data"]); - types = get (kids, "type"); - - scale = get (ca, [ax "scale"]); - if (! iscell (data)) - data = {data}; - endif - - ## Extend image data one pixel - idx = strcmp (types, "image"); - if (any (idx) && (ax == "x" || ax == "y")) - imdata = data(idx); - px = arrayfun (@__image_pixel_size__, kids(idx), "uniformoutput", false); - ipx = ifelse (ax == "x", 1, 2); - imdata = cellfun (@(x,dx) [(min (x) - dx(ipx)), (max (x) + dx(ipx))], - imdata, px, "uniformoutput", false); - data(idx) = imdata; - 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, +eps]; - elseif (diff (xlim == 0)) - xlim .*= [1-eps, 1+eps]; - endif - ylim = __get_tight_lims__ (ca, "y"); - if (all (ylim == 0)) - ylim = [-eps, +eps]; - elseif (diff (ylim == 0)) - ylim .*= [1-eps, 1+eps]; - 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, +eps]; - elseif (diff (zlim == 0)) - zlim .*= [1-eps, 1+eps]; - endif - set (ca, "zlim", zlim); - endif - -endfunction - %!demo %! clf; @@ -618,6 +562,38 @@ %! axis tight; %! title ('"tight" on loglog plot'); +%!demo +%! clf; +%! x = y = 0.5:0.5:12; +%! subplot (3,1,1); +%! plot (x, y, "-s"); +%! axis tickaligned +%! title ("tickaligned"); +%! subplot (3,1,2); +%! plot (x, y, "-s"); +%! axis padded +%! title ("padded"); +%! subplot (3,1,3); +%! plot (x, y, "-s"); +%! axis tight +%! title ("tight"); + +%!demo +%! clf; +%! x = y = 0.5:0.5:12; +%! subplot (3,1,1); +%! loglog (x, y, "-s"); +%! axis tickaligned +%! title ("tickaligned"); +%! subplot (3,1,2); +%! loglog (x, y, "-s"); +%! axis padded +%! title ("padded"); +%! subplot (3,1,3); +%! loglog (x, y, "-s"); +%! axis tight +%! title ("tight"); + %!test %! hf = figure ("visible", "off"); %! unwind_protect @@ -655,6 +631,19 @@ %! close (hf); %! end_unwind_protect +## Test 'axis tight' remains after addition of new data +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! plot (1:10) +%! axis tight; +%! assert (axis (), [1 10 1 10]); +%! plot (1:11) +%! assert (axis (), [1 11 1 11]); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + ## Even on errors, axis can display a figure. %!error %! hf = figure ("visible", "off"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camlookat.m --- a/scripts/plot/appearance/camlookat.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camlookat.m Sun Apr 03 11:30:26 2022 -0400 @@ -281,7 +281,7 @@ %! end_unwind_protect ## compare to Matlab R2016a output -%!test +%!test <61532> %! hf = figure ("visible", "off"); %! unwind_protect %! [x, y, z] = peaks (); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/campos.m --- a/scripts/plot/appearance/campos.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/campos.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,12 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{P} =} campos () +## @deftypefn {} {@var{p} =} campos () ## @deftypefnx {} {} campos ([@var{x} @var{y} @var{z}]) ## @deftypefnx {} {@var{mode} =} campos ("mode") ## @deftypefnx {} {} campos (@var{mode}) -## @deftypefnx {} {} campos (@var{ax}, @dots{}) -## Set or get the camera position. +## @deftypefnx {} {} campos (@var{hax}, @dots{}) +## Get or set the camera position. ## ## The default camera position is determined automatically based on the scene. ## For example, to get the camera position: @@ -77,7 +77,7 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{camup, camtarget, camva} ## @end deftypefn @@ -161,7 +161,7 @@ %! delete (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camroll.m --- a/scripts/plot/appearance/camroll.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camroll.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,7 +25,7 @@ ## -*- texinfo -*- ## @deftypefn {} {} camroll (@var{theta}) -## @deftypefnx {} {} camroll (@var{ax}, @var{theta}) +## @deftypefnx {} {} camroll (@var{hax}, @var{theta}) ## Roll the camera. ## ## Roll the camera clockwise by @var{theta} degrees. @@ -60,7 +60,7 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{camzoom, camorbit, camlookat, camup} ## @end deftypefn @@ -149,7 +149,7 @@ %! close (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camtarget.m --- a/scripts/plot/appearance/camtarget.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camtarget.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,12 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{T} =} camtarget () +## @deftypefn {} {@var{t} =} camtarget () ## @deftypefnx {} {} camtarget ([@var{x} @var{y} @var{z}]) ## @deftypefnx {} {@var{mode} =} camtarget ("mode") ## @deftypefnx {} {} camtarget (@var{mode}) -## @deftypefnx {} {} camtarget (@var{ax}, @dots{}) -## Set or get where the camera is pointed. +## @deftypefnx {} {} camtarget (@var{hax}, @dots{}) +## Get or set where the camera is pointed. ## ## The camera target is a point in space where the camera is pointing. ## Usually, it is determined automatically based on the scene: @@ -89,13 +89,13 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{campos, camup, camva} ## @end deftypefn -function p = camtarget (varargin) +function t = camtarget (varargin) [hax, varargin, nargin] = __plt_get_axis_arg__ ("camtarget", varargin{:}); @@ -111,13 +111,13 @@ prop = "cameratarget"; if (nargin == 0) - p = get (hax, prop); + t = get (hax, prop); elseif (nargin == 1 && isnumeric (varargin{1}) && numel (varargin{1}) == 3) set (hax, prop, varargin{1}); elseif (nargin == 1 && ischar (varargin{1})) s = varargin{1}; if (strcmp (s, "mode")) - p = get (hax, [prop "mode"]); + t = get (hax, [prop "mode"]); else set (hax, [prop "mode"], s); endif @@ -172,7 +172,7 @@ %! delete (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camup.m --- a/scripts/plot/appearance/camup.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camup.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,8 +28,8 @@ ## @deftypefnx {} {} camup ([@var{x} @var{y} @var{z}]) ## @deftypefnx {} {@var{mode} =} camup ("mode") ## @deftypefnx {} {} camup (@var{mode}) -## @deftypefnx {} {} camup (@var{ax}, @dots{}) -## Set or get the camera up vector. +## @deftypefnx {} {} camup (@var{hax}, @dots{}) +## Get or set the camera up vector. ## ## By default, the camera is oriented so that ``up'' corresponds to the ## positive z-axis: @@ -85,13 +85,13 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{campos, camtarget, camva} ## @end deftypefn -function p = camup (varargin) +function up = camup (varargin) [hax, varargin, nargin] = __plt_get_axis_arg__ ("camup", varargin{:}); @@ -107,13 +107,13 @@ prop = "cameraupvector"; if (nargin == 0) - p = get (hax, prop); + up = get (hax, prop); elseif (nargin == 1 && isnumeric (varargin{1}) && numel (varargin{1}) == 3) set (hax, prop, varargin{1}); elseif (nargin == 1 && ischar (varargin{1})) s = varargin{1}; if (strcmp (s, "mode")) - p = get (hax, [prop "mode"]); + up = get (hax, [prop "mode"]); else set (hax, [prop "mode"], s); endif @@ -168,7 +168,7 @@ %! close (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camva.m --- a/scripts/plot/appearance/camva.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camva.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,8 +28,8 @@ ## @deftypefnx {} {} camva (@var{a}) ## @deftypefnx {} {@var{mode} =} camva ("mode") ## @deftypefnx {} {} camva (@var{mode}) -## @deftypefnx {} {} camva (@var{ax}, @dots{}) -## Set or get the camera viewing angle. +## @deftypefnx {} {} camva (@var{hax}, @dots{}) +## Get or set the camera viewing angle. ## ## The camera has a viewing angle which determines how much can be seen. By ## default this is: @@ -68,13 +68,13 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{campos, camtarget, camup} ## @end deftypefn -function p = camva (varargin) +function a = camva (varargin) [hax, varargin, nargin] = __plt_get_axis_arg__ ("camva", varargin{:}); @@ -90,13 +90,13 @@ prop = "cameraviewangle"; if (nargin == 0) - p = get (hax, prop); + a = get (hax, prop); elseif (nargin == 1 && isnumeric (varargin{1}) && isscalar (varargin{1})) set (hax, prop, varargin{1}); elseif (nargin == 1 && ischar (varargin{1})) s = varargin{1}; if (strcmp (s, "mode")) - p = get (hax, [prop "mode"]); + a = get (hax, [prop "mode"]); else set (hax, [prop "mode"], s); endif @@ -151,7 +151,7 @@ %! close (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/camzoom.m --- a/scripts/plot/appearance/camzoom.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/camzoom.m Sun Apr 03 11:30:26 2022 -0400 @@ -25,7 +25,7 @@ ## -*- texinfo -*- ## @deftypefn {} {} camzoom (@var{zf}) -## @deftypefnx {} {} camzoom (@var{ax}, @var{zf}) +## @deftypefnx {} {} camzoom (@var{hax}, @var{zf}) ## Zoom the camera in or out. ## ## A value of @var{zf} larger than 1 ``zooms in'' such that the scene appears @@ -59,7 +59,7 @@ ## @end example ## ## By default, these commands affect the current axis; alternatively, an axis -## can be specified by the optional argument @var{ax}. +## can be specified by the optional argument @var{hax}. ## ## @seealso{camroll, camorbit, camlookat, camva} ## @end deftypefn @@ -143,7 +143,7 @@ %! close (hf); %! end_unwind_protect -## test ax input by creating another axis +## test hax input by creating another axis %!test %! hf = figure ("visible", "off"); %! unwind_protect diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/clabel.m --- a/scripts/plot/appearance/clabel.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/clabel.m Sun Apr 03 11:30:26 2022 -0400 @@ -29,7 +29,7 @@ ## @deftypefnx {} {} clabel (@var{c}, @var{h}, "manual") ## @deftypefnx {} {} clabel (@var{c}) ## @deftypefnx {} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{}) -## @deftypefnx {} {@var{h} =} clabel (@dots{}) +## @deftypefnx {} {@var{hlabels} =} clabel (@dots{}) ## Add labels to the contours of a contour plot. ## ## The contour levels are specified by the contour matrix @var{c} which is @@ -51,7 +51,7 @@ ## 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 optional return value @var{hlabels} 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. @@ -69,7 +69,7 @@ ## @seealso{contour, contourf, contour3, meshc, surfc, text} ## @end deftypefn -function h = clabel (c, varargin) +function hlabels = clabel (c, varargin) have_hg = false; have_labelspacing = false; @@ -138,7 +138,7 @@ endif if (nargout > 0) - h = htmp; + hlabels = htmp; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/diffuse.m --- a/scripts/plot/appearance/diffuse.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/diffuse.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv}) +## @deftypefn {} {@var{d} =} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv}) ## Calculate the diffuse reflection strength of a surface defined by the normal ## vector elements @var{sx}, @var{sy}, @var{sz}. ## @@ -33,7 +33,7 @@ ## @seealso{specular, surfl} ## @end deftypefn -function retval = diffuse (sx, sy, sz, lv) +function d = diffuse (sx, sy, sz, lv) if (nargin != 4) print_usage (); @@ -57,7 +57,7 @@ endif ns = sqrt (sx.^2 + sy.^2 + sz.^2); - retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns; - retval(retval < 0) = 0; + d = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns; + d(d < 0) = 0; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/legend.m --- a/scripts/plot/appearance/legend.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/legend.m Sun Apr 03 11:30:26 2022 -0400 @@ -34,7 +34,7 @@ ## @deftypefnx {} {} legend ("@var{command}") ## @deftypefnx {} {} legend (@var{hax}, @dots{}) ## @deftypefnx {} {} legend (@var{hleg}, @dots{}) -## @deftypefnx {} {@var{hleg, hplt} =} legend (@dots{}) +## @deftypefnx {} {@var{hleg} =} legend (@dots{}) ## ## Display a legend for the current axes using the specified strings as labels. ## @@ -308,7 +308,7 @@ "deletefcn", {@reset_cb, hl}); ## Listeners to foreign objects properties are stored for later - ## deletion in "delfunction" + ## deletion in "reset_cb" hax = opts.axes_handles(1); hf = ancestor (hax, "figure"); @@ -350,7 +350,7 @@ addlistener (hl, "textcolor", ... @(h, ~) set (findobj (h, "type", "text"), ... - "color", get (hl, "textcolor"))); + "color", get (hl, "textcolor"))); addlistener (hl, "visible", @update_visible_cb); @@ -1076,14 +1076,22 @@ ## Main line vals = get (hplt(1), lprops); - hicon = __go_line__ (hl, [lprops; vals]{:}); + hicon = __go_line__ (hl, [lprops; vals]{:}, ... + "pickableparts", "all", ... + "buttondownfcn", ... + {@execute_itemhit, hl, hplt, "icon"}); + addproperty ("markerxdata", hicon, "double", 0); addproperty ("markerydata", hicon, "double", 0); ## Additional line for the marker vals = get (hplt(end), mprops); hmarker = __go_line__ (hl, "handlevisibility", "off", ... - "xdata", 0, "ydata", 0, [mprops; vals]{:}); + "xdata", 0, "ydata", 0, [mprops; vals]{:}, ... + "pickableparts", "all", ... + "buttondownfcn", ... + {@execute_itemhit, hl, hplt, "icon"}); + addproperty ("markertruesize", hmarker, "double", NaN); update_marker_cb (hmarker); ## Listeners @@ -1095,7 +1103,8 @@ @(h, ~) set (hmarker, "xdata", get (h, "markerxdata"))); addlistener (hicon, "visible", ... @(h, ~) set (hmarker, "visible", get (h, "visible"))); - addlistener (hmarker, "markersize", @update_marker_cb); + addlistener (hmarker, "markersize", {@update_marker_cb, true}); + addlistener (hmarker, "marker", {@update_marker_cb, false}); add_safe_listener (hl, hplt(1), "beingdeleted", @(~, ~) delete ([hicon hmarker])) if (! strcmp (typ, "__errplot__")) @@ -1127,7 +1136,10 @@ vals {end-1} = mean (vals {end-1}, 1); vals {end} = mean (vals {end}, 1); - hicon = __go_scatter__ (hl, [all_sprops; vals]{:}); + hicon = __go_scatter__ (hl, [all_sprops; vals]{:}, ... + "pickableparts", "all", ... + "buttondownfcn", ... + {@execute_itemhit, hl, hplt, "icon"}); ## Simple Listeners safe_property_link (hplt(1), hicon, sprops); @@ -1151,7 +1163,10 @@ ## Main patch vals = get (hplt(1), pprops); - hicon = __go_patch__ (hl, [pprops; vals]{:}); + hicon = __go_patch__ (hl, [pprops; vals]{:}, ... + "pickableparts", "all", ... + "buttondownfcn", ... + {@execute_itemhit, hl, hplt, "icon"}); addproperty ("innerxdata", hicon, "any", 0); addproperty ("innerydata", hicon, "any", 0); @@ -1159,7 +1174,10 @@ ## Additional patch for the inner contour vals = get (hplt(end), pprops); htmp = __go_patch__ (hl, "handlevisibility", "off", ... - "xdata", 0, "ydata", 0, [pprops; vals]{:}); + "xdata", 0, "ydata", 0, [pprops; vals]{:}, ... + "pickableparts", "all", ... + "buttondownfcn", ... + {@execute_itemhit, hl, hplt, "icon"}); ## Listeners safe_property_link (hplt(1), hicon, pprops); @@ -1177,13 +1195,30 @@ endswitch - htxt = __go_text__ (hl, txtpval{:}, "string", str); + htxt = __go_text__ (hl, txtpval{:}, "string", str, ... + "pickableparts", "all", ... + "buttondownfcn", {@execute_itemhit, hl, hplt, "label"}); + + set (htxt, "buttondownfcn", {@execute_itemhit, hl, hplt, "label"}); addproperty ("peer_object", htxt, "double", base_hplt); addproperty ("peer_object", hicon, "double", base_hplt); endfunction +function execute_itemhit (h, ~, hl, hplt, region) + + fcn = get (hl, "itemhitfcn"); + + if (! isempty (fcn)) + evt = struct ("Peer", hplt, "Region", region, ... + "SelectionType", get (gcbf (), "selectiontype"), ... + "Source", hl, "EventName", "ItemHit"); + fcn (hl, evt) + endif + +endfunction + function safe_property_link (h1, h2, props) for ii = 1:numel (props) @@ -1213,10 +1248,47 @@ endfunction -function update_marker_cb (h, ~) +## Enforce maximum size of marker so it doesn't overflow legend key +function update_marker_cb (h, ~, sz_updated = true) + persistent is_updating = false; + + if (is_updating) + return; + endif + + if (sz_updated) + ## Size was changed + sz = get (h, "markersize"); + set (h, "markertruesize", sz); # store true marker size + + if (sz > 8) + is_updating = true; - if (get (h, "markersize") > 8) - set (h, "markersize", 8); + mark = get (h, "marker"); + if (strcmp (mark, '.')) + set (h, "markersize", min ([sz, 24])); + else + set (h, "markersize", 8); + endif + + is_updating = false; + endif + + else + ## Marker style was changed + sz = get (h, "markertruesize"); + if (sz > 8) + is_updating = true; + + mark = get (h, "marker"); + if (strcmp (mark, '.')) + set (h, "markersize", min ([sz, 24])); + else + set (h, "markersize", 8); + endif + + is_updating = false; + endif endif endfunction @@ -2040,6 +2112,18 @@ %! legend ("Legend Text"); %! title ({"Multi-line", "titles", "are *not* a", "problem"}); +%!demo # bug 61814 +%! clf; +%! data = [ [1:5]' , [5:-1:1]', 2.5*ones(5,1) ]; +%! hp = plot (data); +%! set (hp(1), "marker", 'x', "markersize", 15); +%! set (hp(2), "marker", 'o', "markersize", 30); +%! set (hp(3), "marker", '.', "markersize", 30); +%! legend ({"data1", "data2", "data3"}, "location", "north"); +%! set (hp(2), "marker", '.'); +%! set (hp(3), "marker", 'o'); +%! title ("Marker sizes do not overflow legend box"); + ## Test input validation %!test %! hf = figure ("visible", "off"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/orient.m --- a/scripts/plot/appearance/orient.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/orient.m Sun Apr 03 11:30:26 2022 -0400 @@ -51,7 +51,7 @@ ## @seealso{print, saveas} ## @end deftypefn -function retval = orient (varargin) +function orientation = orient (varargin) cf = []; if (nargin > 0 && isscalar (varargin{1}) && isfigure (varargin{1})) @@ -73,28 +73,28 @@ set (cf, "paperunits", "inches"); # All Matlab calculations assume inches. if (nargin == 0) - retval = get (cf, "paperorientation"); - if (strcmp (retval, "portrait")) + orientation = get (cf, "paperorientation"); + if (strcmp (orientation, "portrait")) papersize = get (cf, "papersize"); paperposition = get (cf, "paperposition"); if (paperposition == [0.25 0.25 (papersize - 0.5)]) - retval = "tall"; + orientation = "tall"; endif endif else - orientation = varargin{1}; - if (strcmpi (orientation, "landscape") - || strcmpi (orientation, "portrait")) - if (! strcmpi (get (cf, "paperorientation"), orientation)) + paporient = varargin{1}; + if (strcmpi (paporient, "landscape") + || strcmpi (paporient, "portrait")) + if (! strcmpi (get (cf, "paperorientation"), paporient)) ## FIXME: with the proper listeners in place there won't be a need to ## set the papersize and paperposition here. papersize = get (cf, "papersize"); paperposition = get (cf, "paperposition"); - set (cf, "paperorientation", orientation, + set (cf, "paperorientation", paporient, "papersize", papersize([2, 1]), "paperposition", paperposition([2, 1, 4, 3])); endif - if (strcmpi (orientation, "portrait")) + if (strcmpi (paporient, "portrait")) ## portrait restores the default ## FIXME: Should use "default" here, but Octave complains ## that "paperposition" is not a default property. @@ -104,7 +104,7 @@ papersize = get (cf, "papersize"); set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]); endif - elseif (strcmpi (orientation, "tall")) + elseif (strcmpi (paporient, "tall")) orient ("portrait"); papersize = get (cf, "papersize"); set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/rticks.m --- a/scripts/plot/appearance/rticks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/rticks.m Sun Apr 03 11:30:26 2022 -0400 @@ -48,17 +48,17 @@ ## @seealso{thetaticks, xticks, yticks, zticks, polar, get, set} ## @end deftypefn -function retval = rticks (varargin) +function tickval = rticks (varargin) hax = []; switch (nargin) case 0 - retval = get (gca (), "rtick"); # will error if no rtick exists. + tickval = get (gca (), "rtick"); # will error if no rtick exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "rtick"); + tickval = get (varargin{1}, "rtick"); return; else arg = varargin{1}; @@ -95,7 +95,7 @@ ## arg = tolower (arg); ## switch (arg) ## case "mode" - ## retval = get (hax, "rtickmode"); + ## tickval = get (hax, "rtickmode"); ## ## case {"auto", "manual"} ## if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/specular.m --- a/scripts/plot/appearance/specular.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/specular.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}) -## @deftypefnx {} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se}) +## @deftypefn {} {@var{refl} =} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}) +## @deftypefnx {} {@var{refl} =} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se}) ## Calculate the specular reflection strength of a surface defined by the ## normal vector elements @var{sx}, @var{sy}, @var{sz} using Phong's ## approximation. @@ -40,7 +40,7 @@ ## @seealso{diffuse, surfl} ## @end deftypefn -function retval = specular (sx, sy, sz, lv, vv, se) +function refl = specular (sx, sy, sz, lv, vv, se) if (nargin < 5) print_usage (); @@ -86,13 +86,13 @@ 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); + refl = 2 * l_dot_n .* v_dot_n - dot (lv, vv); ## Set reflectance to zero if light is on the other side - retval(l_dot_n < 0) = 0; + refl(l_dot_n < 0) = 0; ## Allow positive values only - retval(retval < 0) = 0; - retval .^= se; + refl(refl < 0) = 0; + refl .^= se; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/thetaticks.m --- a/scripts/plot/appearance/thetaticks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/thetaticks.m Sun Apr 03 11:30:26 2022 -0400 @@ -48,7 +48,7 @@ ## @seealso{rticks, xticks, yticks, zticks, polar, get, set} ## @end deftypefn -function retval = thetaticks (varargin) +function tickval = thetaticks (varargin) ## FIXME: Update function to work with polaraxes objects once that function ## is implemented in Octave. For compatibility with Matlab this may @@ -57,12 +57,12 @@ hax = []; switch (nargin) case 0 - retval = get (gca , "ttick"); # will error if no ttick exists. + tickval = get (gca , "ttick"); # will error if no ttick exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "ttick"); + tickval = get (varargin{1}, "ttick"); return; else arg = varargin{1}; @@ -99,7 +99,7 @@ ## arg = tolower (arg); ## switch (arg) ## case "mode" - ## retval = get (hax, "ttickmode"); + ## tickval = get (hax, "ttickmode"); ## ## case {"auto", "manual"} ## if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/xlim.m --- a/scripts/plot/appearance/xlim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/xlim.m Sun Apr 03 11:30:26 2022 -0400 @@ -55,12 +55,12 @@ ## @seealso{ylim, zlim, axis, set, get, gca} ## @end deftypefn -function retval = xlim (varargin) +function xlimits = xlim (varargin) - ret = __axis_limits__ ("xlim", varargin{:}); + lims = __axis_limits__ ("xlim", varargin{:}); - if (! isempty (ret)) - retval = ret; + if (! isempty (lims)) + xlimits = lims; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/xtickangle.m --- a/scripts/plot/appearance/xtickangle.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/xtickangle.m Sun Apr 03 11:30:26 2022 -0400 @@ -45,22 +45,22 @@ ## @seealso{ytickangle, ztickangle, get, set} ## @end deftypefn -function retval = xtickangle (hax, angle) +function angle = xtickangle (hax, angle) switch (nargin) case 0 - retval = __tickangle__ (mfilename ()); + angle = __tickangle__ (mfilename ()); case 1 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax); + angle = __tickangle__ (mfilename (), hax); else __tickangle__ (mfilename (), hax); endif case 2 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax, angle); + angle = __tickangle__ (mfilename (), hax, angle); else __tickangle__ (mfilename (), hax, angle); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/xticklabels.m --- a/scripts/plot/appearance/xticklabels.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/xticklabels.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{tickval} =} xticklabels +## @deftypefn {} {@var{labels} =} xticklabels ## @deftypefnx {} {@var{mode} =} xticklabels ("mode") ## @deftypefnx {} {} xticklabels (@var{tickval}) ## @deftypefnx {} {} xticklabels ("auto") @@ -56,17 +56,17 @@ ## @seealso{xticks, yticklabels, zticklabels, get, set} ## @end deftypefn -function retval = xticklabels (varargin) +function labels = xticklabels (varargin) hax = []; switch (nargin) case 0 - retval = get (gca , "xticklabel"); # will error if no xticklabel exists. + labels = get (gca , "xticklabel"); # will error if no xticklabel exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "xticklabel"); + labels = get (varargin{1}, "xticklabel"); return; else arg = varargin{1}; @@ -117,7 +117,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "xticklabelmode"); + labels = get (hax, "xticklabelmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/xticks.m --- a/scripts/plot/appearance/xticks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/xticks.m Sun Apr 03 11:30:26 2022 -0400 @@ -53,17 +53,17 @@ ## @seealso{xticklabels, yticks, zticks, rticks, thetaticks, get, set} ## @end deftypefn -function retval = xticks (varargin) +function tickval = xticks (varargin) hax = []; switch (nargin) case 0 - retval = get (gca, "xtick"); # will error if no xtick exists. + tickval = get (gca, "xtick"); # will error if no xtick exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "xtick"); + tickval = get (varargin{1}, "xtick"); return; else arg = varargin{1}; @@ -97,7 +97,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "xtickmode"); + tickval = get (hax, "xtickmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/ylim.m --- a/scripts/plot/appearance/ylim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/ylim.m Sun Apr 03 11:30:26 2022 -0400 @@ -55,12 +55,12 @@ ## @seealso{xlim, zlim, axis, set, get, gca} ## @end deftypefn -function retval = ylim (varargin) +function ylimits = ylim (varargin) - ret = __axis_limits__ ("ylim", varargin{:}); + lims = __axis_limits__ ("ylim", varargin{:}); - if (! isempty (ret)) - retval = ret; + if (! isempty (lims)) + ylimits = lims; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/ytickangle.m --- a/scripts/plot/appearance/ytickangle.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/ytickangle.m Sun Apr 03 11:30:26 2022 -0400 @@ -45,22 +45,22 @@ ## @seealso{xtickangle, ztickangle, get, set} ## @end deftypefn -function retval = ytickangle (hax, angle) +function angle = ytickangle (hax, angle) switch (nargin) case 0 - retval = __tickangle__ (mfilename ()); + angle = __tickangle__ (mfilename ()); case 1 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax); + angle = __tickangle__ (mfilename (), hax); else __tickangle__ (mfilename (), hax); endif case 2 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax, angle); + angle = __tickangle__ (mfilename (), hax, angle); else __tickangle__ (mfilename (), hax, angle); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/yticklabels.m --- a/scripts/plot/appearance/yticklabels.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/yticklabels.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{tickval} =} yticklabels +## @deftypefn {} {@var{labels} =} yticklabels ## @deftypefnx {} {@var{mode} =} yticklabels ("mode") ## @deftypefnx {} {} yticklabels (@var{tickval}) ## @deftypefnx {} {} yticklabels ("auto") @@ -56,17 +56,17 @@ ## @seealso{yticks, xticklabels, zticklabels, get, set} ## @end deftypefn -function retval = yticklabels (varargin) +function labels = yticklabels (varargin) hax = []; switch (nargin) case 0 - retval = get (gca , "yticklabel"); # will error if no yticklabel exists. + labels = get (gca , "yticklabel"); # will error if no yticklabel exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "yticklabel"); + labels = get (varargin{1}, "yticklabel"); return; else arg = varargin{1}; @@ -117,7 +117,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "yticklabelmode"); + labels = get (hax, "yticklabelmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/yticks.m --- a/scripts/plot/appearance/yticks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/yticks.m Sun Apr 03 11:30:26 2022 -0400 @@ -53,17 +53,17 @@ ## @seealso{yticklabels, xticks, zticks, rticks, thetaticks, get, set} ## @end deftypefn -function retval = yticks (varargin) +function tickval = yticks (varargin) hax = []; switch (nargin) case 0 - retval = get (gca , "ytick"); # will error if no ytick exists. + tickval = get (gca , "ytick"); # will error if no ytick exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "ytick"); + tickval = get (varargin{1}, "ytick"); return; else arg = varargin{1}; @@ -99,7 +99,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "ytickmode"); + tickval = get (hax, "ytickmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/zlim.m --- a/scripts/plot/appearance/zlim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/zlim.m Sun Apr 03 11:30:26 2022 -0400 @@ -55,12 +55,12 @@ ## @seealso{xlim, ylim, axis, set, get, gca} ## @end deftypefn -function retval = zlim (varargin) +function zlimits = zlim (varargin) - ret = __axis_limits__ ("zlim", varargin{:}); + lims = __axis_limits__ ("zlim", varargin{:}); - if (! isempty (ret)) - retval = ret; + if (! isempty (lims)) + zlimits = lims; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/ztickangle.m --- a/scripts/plot/appearance/ztickangle.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/ztickangle.m Sun Apr 03 11:30:26 2022 -0400 @@ -45,22 +45,22 @@ ## @seealso{xtickangle, ytickangle, get, set} ## @end deftypefn -function retval = ztickangle (hax, angle) +function angle = ztickangle (hax, angle) switch (nargin) case 0 - retval = __tickangle__ (mfilename ()); + angle = __tickangle__ (mfilename ()); case 1 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax); + angle = __tickangle__ (mfilename (), hax); else __tickangle__ (mfilename (), hax); endif case 2 if (nargout > 0) - retval = __tickangle__ (mfilename (), hax, angle); + angle = __tickangle__ (mfilename (), hax, angle); else __tickangle__ (mfilename (), hax, angle); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/zticklabels.m --- a/scripts/plot/appearance/zticklabels.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/zticklabels.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{tickval} =} zticklabels +## @deftypefn {} {@var{labels} =} zticklabels ## @deftypefnx {} {@var{mode} =} zticklabels ("mode") ## @deftypefnx {} {} zticklabels (@var{tickval}) ## @deftypefnx {} {} zticklabels ("auto") @@ -56,17 +56,17 @@ ## @seealso{zticks, xticklabels, zticklabels, get, set} ## @end deftypefn -function retval = zticklabels (varargin) +function labels = zticklabels (varargin) hax = []; switch (nargin) case 0 - retval = get (gca , "zticklabel"); # will error if no zticklabel exists. + labels = get (gca , "zticklabel"); # will error if no zticklabel exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "zticklabel"); + labels = get (varargin{1}, "zticklabel"); return; else arg = varargin{1}; @@ -117,7 +117,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "zticklabelmode"); + labels = get (hax, "zticklabelmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/appearance/zticks.m --- a/scripts/plot/appearance/zticks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/appearance/zticks.m Sun Apr 03 11:30:26 2022 -0400 @@ -53,17 +53,17 @@ ## @seealso{zticklabels, xticks, yticks, rticks, thetaticks, get, set} ## @end deftypefn -function retval = zticks (varargin) +function tickval = zticks (varargin) hax = []; switch (nargin) case 0 - retval = get (gca , "ztick"); # will error if no ztick exists. + tickval = get (gca , "ztick"); # will error if no ztick exists. return; case 1 if (isaxes (varargin{1})) - retval = get (varargin{1}, "ztick"); + tickval = get (varargin{1}, "ztick"); return; else arg = varargin{1}; @@ -97,7 +97,7 @@ arg = tolower (arg); switch (arg) case "mode" - retval = get (hax, "ztickmode"); + tickval = get (hax, "ztickmode"); case {"auto", "manual"} if (nargout > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/cylinder.m --- a/scripts/plot/draw/cylinder.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/cylinder.m Sun Apr 03 11:30:26 2022 -0400 @@ -57,7 +57,7 @@ ## @seealso{ellipsoid, rectangle, sphere} ## @end deftypefn -function [xx, yy, zz] = cylinder (varargin) +function [x, y, z] = cylinder (varargin) [hax, args, nargs] = __plt_get_axis_arg__ ("cylinder", varargin{:}); @@ -74,21 +74,24 @@ n = args{2}; endif - if (length (r) < 2) - error ("cylinder: length (R) must be larger than 2"); + if (! isvector (r)) + error ("cylinder: R must be a scalar or vector"); + endif + if (isscalar (r)) + r .*= [1 1]; # expand single radius specification to required 2-term form endif phi = linspace (0, 2*pi, n+1); idx = 1:length (r); [phi, idx] = meshgrid (phi, idx); - z = (idx - 1) / (length (r) - 1); + zz = (idx - 1) / (length (r) - 1); r = r(idx); - [x, y] = pol2cart (phi, r); + [xx, yy] = pol2cart (phi, r); if (nargout > 0) - xx = x; - yy = y; - zz = z; + x = xx; + y = yy; + z = zz; else oldfig = []; if (! isempty (hax)) @@ -96,7 +99,7 @@ endif unwind_protect hax = newplot (hax); - surf (x, y, z); + surf (xx, yy, zz); unwind_protect_cleanup if (! isempty (oldfig)) set (0, "currentfigure", oldfig); @@ -113,3 +116,8 @@ %! [x, y, z] = cylinder (10:-1:0, 50); %! surf (x, y, z); %! title ("cylinder() with linearly shrinking radius produces a cone"); + +## Test input validation +%!error cylinder (1,2,3) +%!error cylinder ([]) +%!error cylinder (ones (2,2)) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/ellipsoid.m --- a/scripts/plot/draw/ellipsoid.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/ellipsoid.m Sun Apr 03 11:30:26 2022 -0400 @@ -64,20 +64,24 @@ n = 20; else n = varargin{7}; + if (! (isreal (n) && isscalar (n) && n > 0)) + error ("ellipsoid: N must be a real scalar > 0"); + endif + n = floor (n); 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; + xx = xr .* cos (phi) .* cos (theta) + xc; + yy = yr .* cos (phi) .* sin (theta) + yc; + zz = zr .* sin (phi) + zc; if (nargout > 0) - xx = x; - yy = y; - zz = z; + x = xx; + y = yy; + z = zz; else oldfig = []; if (! isempty (hax)) @@ -86,7 +90,7 @@ unwind_protect hax = newplot (hax); - surf (x, y, z); + surf (xx, yy, zz); unwind_protect_cleanup if (! isempty (oldfig)) set (0, "currentfigure", oldfig); @@ -101,3 +105,10 @@ %! clf; %! ellipsoid (0, 0, 1, 2, 3, 4, 20); %! title ("ellipsoid()"); + +## Test input validation +%!error ellipsoid (1,2,3,4,5) +%!error ellipsoid (1,2,3,4,5,6,7,8) +%!error ellipsoid (1,2,3,4,5,6, 2i) +%!error ellipsoid (1,2,3,4,5,6, ones (2,2)) +%!error ellipsoid (1,2,3,4,5,6, -1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/fill.m --- a/scripts/plot/draw/fill.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/fill.m Sun Apr 03 11:30:26 2022 -0400 @@ -141,12 +141,9 @@ ## For Matlab compatibility, return 1 patch object for each column for j = 1 : columns (x) if (one_color) - [htmp, err] = __patch__ (hax, x(:,j), y(:,j), cdata, opts{:}); + htmp = __patch__ (hax, x(:,j), y(:,j), cdata, opts{:}); else - [htmp, err] = __patch__ (hax, x(:,j), y(:,j), cdata(:,j), opts{:}); - endif - if (err) - print_usage (); + htmp = __patch__ (hax, x(:,j), y(:,j), cdata(:,j), opts{:}); endif hlist(end+1, 1) = htmp; endfor diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/fill3.m --- a/scripts/plot/draw/fill3.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/fill3.m Sun Apr 03 11:30:26 2022 -0400 @@ -154,14 +154,9 @@ ## For Matlab compatibility, return 1 patch object for each column for j = 1 : columns (x) if (one_color) - [htmp, err] = __patch__ (hax, x(:,j), y(:,j), z(:,j), ... - cdata, opts{:}); + htmp = __patch__ (hax, x(:,j), y(:,j), z(:,j), cdata, opts{:}); else - [htmp, err] = __patch__ (hax, x(:,j), y(:,j), z(:,j), ... - cdata(:,j), opts{:}); - endif - if (err) - print_usage (); + htmp = __patch__ (hax, x(:,j), y(:,j), z(:,j), cdata(:,j), opts{:}); endif hlist(end+1, 1) = htmp; endfor diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/isocolors.m --- a/scripts/plot/draw/isocolors.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/isocolors.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,8 +28,8 @@ ## @deftypefnx {} {@var{cdat} =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v}) ## @deftypefnx {} {@var{cdat} =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v}) ## @deftypefnx {} {@var{cdat} =} isocolors (@var{r}, @var{g}, @var{b}, @var{v}) -## @deftypefnx {} {@var{cdat} =} isocolors (@dots{}, @var{p}) -## @deftypefnx {} {} isocolors (@dots{}) +## @deftypefnx {} {@var{cdat} =} isocolors (@dots{}, @var{hp}) +## @deftypefnx {} {} isocolors (@dots{}, @var{hp}) ## ## Compute isosurface colors. ## @@ -50,10 +50,10 @@ ## @var{y}, @var{z} are not given then @code{meshgrid} computed values are ## used. ## -## Optionally, a patch handle @var{p} can be given as the last input argument +## Optionally, a patch handle @var{hp} can be given as the last input argument ## to all function call variations and the vertex data will be extracted ## from the isosurface patch object. Finally, if no output argument is given -## then the colors of the patch given by the patch handle @var{p} are changed. +## then the colors of the patch given by the patch handle @var{hp} are changed. ## ## @seealso{isosurface, isonormals} ## @end deftypefn @@ -97,11 +97,11 @@ endswitch if (isnumeric (vp) && columns (vp) == 3) - pa = []; + hp = []; v = vp; elseif (isgraphics (vp, "patch")) - pa = vp; - v = get (pa, "Vertices"); + hp = vp; + v = get (hp, "Vertices"); else error ("isocolors: last argument must be a vertex list or patch handle"); endif @@ -116,8 +116,8 @@ endif if (nargout == 0) - if (! isempty (pa)) - set (pa, "FaceVertexCData", new_colors); + if (! isempty (hp)) + set (hp, "FaceVertexCData", new_colors); endif else cdat = new_colors; diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/isonormals.m --- a/scripts/plot/draw/isonormals.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/isonormals.m Sun Apr 03 11:30:26 2022 -0400 @@ -97,11 +97,11 @@ endswitch if (isnumeric (vp) && columns (vp) == 3) - pa = []; + hp = []; v = vp; elseif (isgraphics (vp, "patch")) - pa = vp; - v = get (pa, "Vertices"); + hp = vp; + v = get (hp, "Vertices"); else error ("isonormals: input must be a list of vertices or a patch handle"); endif @@ -113,8 +113,8 @@ endif if (nargout == 0) - if (! isempty (pa)) - set (pa, "VertexNormals", normals); + if (! isempty (hp)) + set (hp, "VertexNormals", normals); endif else vn = normals; diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/patch.m --- a/scripts/plot/draw/patch.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/patch.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,7 @@ ## @deftypefnx {} {} patch (@var{x}, @var{y}, @var{c}) ## @deftypefnx {} {} patch (@var{x}, @var{y}, @var{z}, @var{c}) ## @deftypefnx {} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{}) -## @deftypefnx {} {} patch (@dots{}, @var{prop}, @var{val}, @dots{}) +## @deftypefnx {} {} patch (@dots{}, "@var{prop}", @var{val}, @dots{}) ## @deftypefnx {} {} patch (@dots{}, @var{propstruct}, @dots{}) ## @deftypefnx {} {} patch (@var{hax}, @dots{}) ## @deftypefnx {} {@var{h} =} patch (@dots{}) @@ -82,17 +82,11 @@ [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:}); - if (isempty (hax)) - hax = gca (); - else + if (! isempty (hax)) hax = hax(1); - endif + endif - [htmp, failed] = __patch__ (hax, varargin{:}); - - if (failed) - print_usage (); - endif + htmp = __patch__ (hax, varargin{:}); if (nargout > 0) h = htmp; @@ -308,3 +302,9 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect + +## Test input validation +%!error patch (1, 1, 'x') +%!error patch (1, 1, rand (1,2,3)) +%!error patch (1, 1, [1, 2]) +%!error patch (1, 1, {1}) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/private/__patch__.m --- a/scripts/plot/draw/private/__patch__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/private/__patch__.m Sun Apr 03 11:30:26 2022 -0400 @@ -32,153 +32,154 @@ ## Create patch object from x and y with color c and parent p. ## Return handle to patch object. -function [h, failed] = __patch__ (p, varargin) +function h = __patch__ (p, varargin) h = NaN; - failed = false; + nargin = nargin - 1; is_numeric_arg = cellfun (@isnumeric, varargin); if (isempty (varargin)) - args = varargin; + args = {}; 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}; + print_usage ("patch"); + endif + + 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}; + if (nargin > 3 && iscolorspec (varargin{4})) z = varargin{3}; c = varargin{4}; iarg = 5; - elseif (nargin > 3 && all (is_numeric_arg(1:3))) - x = varargin{1}; - y = varargin{2}; - if (nargin > 4 && iscolorspec (varargin{4})) - z = varargin{3}; - c = varargin{4}; - iarg = 5; - else - z = []; - c = varargin{3}; - iarg = 4; - endif - elseif (nargin > 2 && all (is_numeric_arg(1:2))) - x = varargin{1}; - y = varargin{2}; + else z = []; - if (iscolorspec (varargin{3})) - c = varargin{3}; - iarg = 4; - else - c = []; - iarg = 3; - endif + c = varargin{3}; + iarg = 4; endif + elseif (nargin >= 3 && all (is_numeric_arg(1:2))) + x = varargin{1}; + y = varargin{2}; + z = []; + if (iscolorspec (varargin{3})) + c = varargin{3}; + iarg = 4; + elseif (nargin == 3) + error ("patch: invalid color specification C"); + else + c = []; + iarg = 3; + endif + endif - if (isvector (x)) - x = x(:); - y = y(:); - z = z(:); - if (isnumeric (c)) - if (isvector (c)) - if (isequal (size (c), [1, 3])) - ## Do nothing, this is a single RGB color specification - elseif (numel (c) == numel (x)) - c = c(:); - endif - elseif (rows (c) != numel (x) && columns (c) == numel (x)) - c = c.'; + if (isvector (x)) + x = x(:); + y = y(:); + z = z(:); + if (isnumeric (c)) + if (isvector (c)) + if (isequal (size (c), [1, 3])) + ## Do nothing, this is a single RGB color specification + elseif (numel (c) == numel (x)) + c = c(:); endif + elseif (rows (c) != numel (x) && columns (c) == numel (x)) + c = c.'; endif endif - args{1} = "xdata"; - args{2} = x; - args{3} = "ydata"; - args{4} = y; - args{5} = "zdata"; - args{6} = z; + endif + args{1} = "xdata"; + args{2} = x; + args{3} = "ydata"; + args{4} = y; + args{5} = "zdata"; + args{6} = z; - if (isnumeric (c)) + if (isnumeric (c) && ! isempty (c)) - if (ndims (c) == 3 && columns (c) == 1) - c = permute (c, [1, 3, 2]); - endif + 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 data C must be numeric"); - endif - elseif (isrow (c) && numel (c) == 3) + if (isvector (c) && numel (c) == columns (x)) + ## One color per face + if (isnan (c)) + args{7} = "facecolor"; + args{8} = [1, 1, 1]; + else args{7} = "facecolor"; - args{8} = c; + args{8} = "flat"; + endif + args{9} = "cdata"; + args{10} = c; + elseif (isrow (c) && numel (c) == 3) + ## One RGB color + args{7} = "facecolor"; + args{8} = c; + args{9} = "cdata"; + args{10} = []; + elseif (ndims (c) == 3 && size (c, 3) == 3) + ## CDATA is specified as 3-D 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: invalid TrueColor data C"); + endif + else + ## Color vectors + if (isempty (c)) + args{7} = "facecolor"; + args{8} = "interp"; 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: Invalid TrueColor data C"); - endif + elseif (size_equal (c, x) && size_equal (c, y)) + args{7} = "facecolor"; + args{8} = "interp"; + args{9} = "cdata"; + args{10} = c; else - ## Color Vectors - if (isempty (c)) - args{7} = "facecolor"; - args{8} = "interp"; - args{9} = "cdata"; - args{10} = []; - elseif (size_equal (c, x) && size_equal (c, 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 + error ("patch: size of X, Y, and C must be equal"); endif - elseif (iscolorspec (c)) - args{7} = "facecolor"; - args{8} = tolower (c); - args{9} = "cdata"; - args{10} = []; - else - args{7} = "facecolor"; - args{8} = [0, 0, 0]; - args{9} = "cdata"; - args{10} = []; endif + elseif (iscolorspec (c)) + ## Color specification is a string + args{7} = "facecolor"; + args{8} = tolower (c); + args{9} = "cdata"; + args{10} = []; + elseif (! isempty (c)) + error ("patch: invalid color specification C"); + endif - args = [args, varargin(iarg:end)]; - endif + args = [args, varargin(iarg:end)]; + else + ## "Property"/Value pair input args = varargin; endif - if (! failed) - h = __go_patch__ (p, args{:}); + if (isempty (p)) + p = gca (); endif + h = __go_patch__ (p, args{:}); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/sphere.m --- a/scripts/plot/draw/sphere.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/sphere.m Sun Apr 03 11:30:26 2022 -0400 @@ -53,7 +53,7 @@ ## @seealso{cylinder, ellipsoid, rectangle} ## @end deftypefn -function [xx, yy, zz] = sphere (varargin) +function [x, y, z] = sphere (varargin) [hax, varargin, nargin] = __plt_get_axis_arg__ ("sphere", varargin{:}); @@ -61,22 +61,25 @@ print_usage (); elseif (nargin == 1) n = varargin{1}; + if (! (isreal (n) && isscalar (n) && n > 0)) + error ("sphere: N must be a real scalar > 0"); + endif else n = 20; endif theta = linspace (0, 2*pi, n+1); phi = linspace (-pi/2, pi/2, n+1); - [theta,phi] = meshgrid (theta, phi); + [theta, phi] = meshgrid (theta, phi); - x = cos (phi) .* cos (theta); - y = cos (phi) .* sin (theta); - z = sin (phi); + xx = cos (phi) .* cos (theta); + yy = cos (phi) .* sin (theta); + zz = sin (phi); if (nargout > 0) - xx = x; - yy = y; - zz = z; + x = xx; + y = yy; + z = zz; else oldfig = []; if (! isempty (hax)) @@ -85,7 +88,7 @@ unwind_protect hax = newplot (hax); - surf (x, y, z); + surf (xx, yy, zz); unwind_protect_cleanup if (! isempty (oldfig)) set (0, "currentfigure", oldfig); @@ -94,3 +97,19 @@ endif endfunction + + +%!demo +%! clf; +%! colormap ("default"); +%! [x, y, z] = sphere (40); +%! surf (3*x, 3*y, 3*z); +%! axis equal; +%! title ("sphere of radius 3"); + +## Test input validation +%!error sphere (-1,1) +%!error sphere (2i) +%!error sphere ([]) +%!error sphere (ones (2,2)) +%!error sphere (-1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/stairs.m --- a/scripts/plot/draw/stairs.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/stairs.m Sun Apr 03 11:30:26 2022 -0400 @@ -71,7 +71,7 @@ ## @seealso{bar, hist, plot, stem} ## @end deftypefn -function [xs, ys] = stairs (varargin) +function [xstep, ystep] = stairs (varargin) [hax, varargin, nargin] = __plt_get_axis_arg__ ("stairs", varargin{:}); @@ -86,7 +86,7 @@ endif unwind_protect hax = newplot (hax); - [htmp, xxs, yys] = __stairs__ (true, varargin{:}); + htmp = __stairs__ (true, varargin{:}); if (! ishold ()) set (hax, "box", "on"); @@ -98,10 +98,10 @@ endif end_unwind_protect if (nargout == 1) - xs = htmp; + xstep = htmp; endif else - [~, xs, ys] = __stairs__ (false, varargin{:}); + [~, xstep, ystep] = __stairs__ (false, varargin{:}); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/draw/surfnorm.m --- a/scripts/plot/draw/surfnorm.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/draw/surfnorm.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,7 @@ ## @deftypefnx {} {} surfnorm (@var{z}) ## @deftypefnx {} {} surfnorm (@dots{}, @var{prop}, @var{val}, @dots{}) ## @deftypefnx {} {} surfnorm (@var{hax}, @dots{}) -## @deftypefnx {} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{}) +## @deftypefnx {} {[@var{Nx}, @var{Ny}, @var{Nz}] =} surfnorm (@dots{}) ## Find the vectors normal to a meshgridded surface. ## ## If @var{x} and @var{y} are vectors, then a typical vertex is @@ -48,7 +48,7 @@ ## rather than the current axes returned by @code{gca}. ## ## If output arguments are requested then the components of the normal -## vectors are returned in @var{nx}, @var{ny}, and @var{nz} and no plot is +## vectors are returned in @var{Nx}, @var{Ny}, and @var{Nz} and no plot is ## made. The normal vectors are unnormalized (magnitude != 1). To normalize, ## use ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/__actual_axis_position__.m --- a/scripts/plot/util/__actual_axis_position__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/__actual_axis_position__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __actual_axis_position__ (@var{h}) -## @deftypefnx {} {} __actual_axis_position__ (@var{axis_struct}) +## @deftypefn {} {@var{pos} =} __actual_axis_position__ (@var{h}) +## @deftypefnx {} {@var{pos} =} __actual_axis_position__ (@var{axis_struct}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/__pltopt__.m --- a/scripts/plot/util/__pltopt__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/__pltopt__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __pltopt__ (@var{caller}, @var{opt}, @var{err_on_invalid}) +## @deftypefn {} {[@var{options}, @var{valid}] =} __pltopt__ (@var{caller}, @var{opt}, @var{err_on_invalid}) ## ## Decode plot option strings. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/close.m --- a/scripts/plot/util/close.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/close.m Sun Apr 03 11:30:26 2022 -0400 @@ -30,6 +30,7 @@ ## @deftypefnx {} {} close all ## @deftypefnx {} {} close all hidden ## @deftypefnx {} {} close all force +## @deftypefnx {} {@var{status} =} close (@dots{}) ## Close figure window(s). ## ## When called with no arguments, close the current figure. This is equivalent @@ -48,6 +49,9 @@ ## even when @qcode{"closerequestfcn"} has been altered to prevent closing the ## window. ## +## If the optional output @var{status} is requested then Octave returns 1 if +## the figure windows were closed successfully. +## ## Implementation Note: @code{close} operates by making the handle @var{h} the ## current figure, and then calling the function specified by the ## @qcode{"closerequestfcn"} property of the figure. By default, the function @@ -59,7 +63,7 @@ ## @seealso{closereq, delete} ## @end deftypefn -function retval = close (arg1, arg2) +function status = close (arg1, arg2) figs = []; @@ -122,7 +126,7 @@ endif if (nargout > 0) - retval = 1; + status = 1; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/findobj.m --- a/scripts/plot/util/findobj.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/findobj.m Sun Apr 03 11:30:26 2022 -0400 @@ -217,7 +217,7 @@ numpairs = np - 1; if (! isempty (logicaloperator)) - logicaloperator = shift (logicaloperator, 1); + logicaloperator = circshift (logicaloperator, 1); endif ## Load all objects which qualify for being searched. diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/graphics_toolkit.m --- a/scripts/plot/util/graphics_toolkit.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/graphics_toolkit.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{name} =} graphics_toolkit () -## @deftypefnx {} {@var{name} =} graphics_toolkit (@var{hlist}) +## @deftypefn {} {@var{tkit} =} graphics_toolkit () +## @deftypefnx {} {@var{tkit} =} graphics_toolkit (@var{hlist}) ## @deftypefnx {} {} graphics_toolkit (@var{name}) ## @deftypefnx {} {} graphics_toolkit (@var{hlist}, @var{name}) ## Query or set the default graphics toolkit which is assigned to new figures. @@ -43,19 +43,19 @@ ## @seealso{available_graphics_toolkits} ## @end deftypefn -function retval = graphics_toolkit (name, hlist = []) +function tkit = graphics_toolkit (name, hlist = []) if (nargout > 0 || nargin == 0) - retval = get (0, "defaultfigure__graphics_toolkit__"); + tkit = get (0, "defaultfigure__graphics_toolkit__"); ## Handle case where graphics_toolkit has been called before any plotting - if (isempty (retval)) + if (isempty (tkit)) toolkits = available_graphics_toolkits (); if (any (strcmp ("qt", toolkits))) - retval = "qt"; + tkit = "qt"; elseif (any (strcmp ("fltk", toolkits))) - retval = "fltk"; + tkit = "fltk"; elseif (! isempty (toolkits)) - retval = toolkits{1}; + tkit = toolkits{1}; endif endif endif @@ -65,7 +65,7 @@ elseif (nargin == 1) if (all (isfigure (name))) hlist = name; - retval = get (hlist, "__graphics_toolkit__"); + tkit = get (hlist, "__graphics_toolkit__"); return; elseif (! ischar (name)) error ("graphics_toolkit: invalid graphics toolkit NAME"); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/isaxes.m --- a/scripts/plot/util/isaxes.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/isaxes.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isaxes (@var{h}) +## @deftypefn {} {@var{tf} =} 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 @@ -32,16 +32,16 @@ ## @seealso{isfigure, ishghandle, isgraphics} ## @end deftypefn -function retval = isaxes (h) +function tf = isaxes (h) if (nargin < 1) print_usage (); endif - retval = ishghandle (h); + tf = ishghandle (h); - if (any (retval)) - retval(retval) = strcmp (get (h(retval), "type"), "axes"); + if (any (tf)) + tf(tf) = strcmp (get (h(tf), "type"), "axes"); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/isfigure.m --- a/scripts/plot/util/isfigure.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/isfigure.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isfigure (@var{h}) +## @deftypefn {} {@var{tf} =} 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 @@ -33,16 +33,16 @@ ## @seealso{isaxes, ishghandle, isgraphics} ## @end deftypefn -function retval = isfigure (h) +function tf = isfigure (h) if (nargin < 1) print_usage (); endif - retval = ishghandle (h); + tf = ishghandle (h); - if (any (retval)) - retval(retval) = strcmp (get (h(retval), "type"), "figure"); + if (any (tf)) + tf(tf) = strcmp (get (h(tf), "type"), "figure"); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/isgraphics.m --- a/scripts/plot/util/isgraphics.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/isgraphics.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isgraphics (@var{h}) -## @deftypefnx {} {} isgraphics (@var{h}, @var{type}) +## @deftypefn {} {@var{tf} =} isgraphics (@var{h}) +## @deftypefnx {} {@var{tf} =} isgraphics (@var{h}, @var{type}) ## Return true if @var{h} is a graphics handle (of type @var{type}) and false ## otherwise. ## @@ -34,7 +34,7 @@ ## @seealso{ishghandle, ishandle, isaxes, isfigure} ## @end deftypefn -function retval = isgraphics (h, type = "") +function tf = isgraphics (h, type = "") if (nargin < 1) print_usage (); @@ -45,10 +45,10 @@ endif ## Octave has no Simulink equivalent so it is sufficient to call ishghandle. - retval = ishghandle (h); + tf = ishghandle (h); - if (nargin == 2 && any (retval)) - retval(retval) = strcmpi (get (h(retval), "type"), type); + if (nargin == 2 && any (tf)) + tf(tf) = strcmpi (get (h(tf), "type"), type); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/ishandle.m --- a/scripts/plot/util/ishandle.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/ishandle.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ishandle (@var{h}) +## @deftypefn {} {@var{tf} =} ishandle (@var{h}) ## Return true if @var{h} is a handle to a graphics or Java object and false ## otherwise. ## @@ -39,13 +39,13 @@ ## @seealso{ishghandle, isgraphics, isjava} ## @end deftypefn -function retval = ishandle (h) +function tf = ishandle (h) if (nargin < 1) print_usage (); endif - retval = ishghandle (h) | isjava (h); + tf = ishghandle (h) | isjava (h); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/ishold.m --- a/scripts/plot/util/ishold.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/ishold.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ishold -## @deftypefnx {} {} ishold (@var{hax}) -## @deftypefnx {} {} ishold (@var{hfig}) +## @deftypefn {} {@var{tf} =} ishold +## @deftypefnx {} {@var{tf} =} ishold (@var{hax}) +## @deftypefnx {} {@var{tf} =} 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. ## @@ -35,7 +35,7 @@ ## @seealso{hold, newplot} ## @end deftypefn -function retval = ishold (h) +function tf = ishold (h) if (nargin == 0) fig = gcf (); @@ -60,7 +60,7 @@ endswitch endif - retval = (strcmp (get (fig, "nextplot"), "add") + tf = (strcmp (get (fig, "nextplot"), "add") && ! isempty (ax) && strcmp (get (ax, "nextplot"), "add")); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/pan.m --- a/scripts/plot/util/pan.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/pan.m Sun Apr 03 11:30:26 2022 -0400 @@ -46,7 +46,7 @@ ## @seealso{rotate3d, zoom} ## @end deftypefn -function h = pan (hfig, option) +function pan (hfig, option) ## FIXME: Presumably should implement this for Matlab compatibility. if (nargin == 1 && nargout > 0 && isfigure (hfig)) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/print.m --- a/scripts/plot/util/print.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/print.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,7 @@ ## @deftypefnx {} {} print (@var{options}) ## @deftypefnx {} {} print (@var{filename}, @var{options}) ## @deftypefnx {} {} print (@var{hfig}, @dots{}) -## @deftypefnx {} {@var{rgb} =} print (@qcode{"-RGBImage"}, @dots{}) +## @deftypefnx {} {@var{RGB} =} print (@qcode{"-RGBImage"}, @dots{}) ## Format a figure for printing and either save it to a file, send it to a ## printer, or return an RGB image. ## @@ -415,7 +415,7 @@ ## @seealso{saveas, getframe, savefig, hgsave, orient, figure} ## @end deftypefn -function rgbout = print (varargin) +function RGB = print (varargin) opts = __print_parse_opts__ (varargin{:}); @@ -754,7 +754,7 @@ otherwise if (strcmp (opts.renderer, "opengl")) if (opts.rgb_output) - rgbout = __get_frame__ (opts.figure); + RGB = __get_frame__ (opts.figure); else compression = "none"; diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/printd.m --- a/scripts/plot/util/printd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/printd.m Sun Apr 03 11:30:26 2022 -0400 @@ -30,7 +30,7 @@ ## 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 +## If the optional output @var{out_file} is requested, the name of the created ## file is returned. ## ## This function is intended to facilitate manipulation of the output of diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/private/__ghostscript__.m --- a/scripts/plot/util/private/__ghostscript__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/private/__ghostscript__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __ghostscript__ (@var{@dots{}}) +## @deftypefn {} {[@var{gs_cmd}, @var{cleanup_cmd}] =} __ghostscript__ (@var{@dots{}}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/private/__gnuplot_print__.m --- a/scripts/plot/util/private/__gnuplot_print__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/private/__gnuplot_print__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __gnuplot_print__ (@var{@dots{}}) +## @deftypefn {} {@var{opts} =} __gnuplot_print__ (@var{@dots{}}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/private/__opengl_print__.m --- a/scripts/plot/util/private/__opengl_print__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/private/__opengl_print__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __opengl_print__ (@var{@dots{}}) +## @deftypefn {} {@var{opts} =} __opengl_print__ (@var{@dots{}}) ## Undocumented internal function. ## @end deftypefn @@ -71,9 +71,8 @@ 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); + pipeline = {sprintf('findstr . > "%s-inc.%s"', name, suffix)}; + pipeline{2} = sprintf ('findstr . > "%s.tex"', name); else pipeline = {sprintf('cat > "%s-inc.%s"', name, suffix)}; pipeline{2} = sprintf ('cat > "%s.tex"', name); diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/rotate3d.m --- a/scripts/plot/util/rotate3d.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/rotate3d.m Sun Apr 03 11:30:26 2022 -0400 @@ -41,7 +41,7 @@ ## @seealso{pan, zoom} ## @end deftypefn -function h = rotate3d (hfig, option) +function rotate3d (hfig, option) ## FIXME: Presumably should implement this for Matlab compatibility. if (nargin == 1 && nargout > 0 && isfigure (hfig)) diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/subplot.m --- a/scripts/plot/util/subplot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/subplot.m Sun Apr 03 11:30:26 2022 -0400 @@ -132,7 +132,7 @@ ## @seealso{axes, plot, gca, set} ## @end deftypefn -function h = subplot (varargin) +function hax = subplot (varargin) align_axes = false; replace_axes = false; @@ -357,7 +357,7 @@ end_unwind_protect if (nargout > 0) - h = hsubplot; + hax = hsubplot; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/plot/util/zoom.m --- a/scripts/plot/util/zoom.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/plot/util/zoom.m Sun Apr 03 11:30:26 2022 -0400 @@ -64,7 +64,7 @@ ## Eventually we need to also support these features: ## @deftypefnx {} {zoom_object_handle =} zoom (@var{hfig}) -function h = zoom (hfig, option) +function zoom (hfig, option) ## FIXME: Presumably should implement this for Matlab compatibility. if (nargin == 1 && nargout > 0 && isfigure (hfig)) diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/compan.m --- a/scripts/polynomial/compan.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/compan.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} compan (@var{c}) +## @deftypefn {} {@var{A} =} compan (@var{c}) ## Compute the companion matrix corresponding to polynomial coefficient vector ## @var{c}. ## @@ -63,7 +63,7 @@ function A = compan (c) - if (nargin < 1) + if (nargin != 1) print_usage (); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/conv.m --- a/scripts/polynomial/conv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/conv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} conv (@var{a}, @var{b}) -## @deftypefnx {} {} conv (@var{a}, @var{b}, @var{shape}) +## @deftypefn {} {@var{y} =} conv (@var{a}, @var{b}) +## @deftypefnx {} {@var{y} =} conv (@var{a}, @var{b}, @var{shape}) ## Convolve two vectors @var{a} and @var{b}. ## ## When @var{a} and @var{b} are the coefficient vectors of two polynomials, the diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/pchip.m --- a/scripts/polynomial/pchip.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/pchip.m Sun Apr 03 11:30:26 2022 -0400 @@ -111,11 +111,6 @@ ## Compute derivatives. d = __pchip_deriv__ (x, y, 2); - if (iscomplex (y)) - ## __pchip_deriv__ ignores imaginary part. Do it again for imag part. - ## FIXME: Adapt __pchip_deriv__ to correctly handle complex input. - d += 1i * __pchip_deriv__ (x, imag (y), 2); - endif d1 = d(:, 1:n-1); d2 = d(:, 2:n); diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/poly.m --- a/scripts/polynomial/poly.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/poly.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} poly (@var{A}) -## @deftypefnx {} {} poly (@var{x}) +## @deftypefn {} {@var{y} =} poly (@var{A}) +## @deftypefnx {} {@var{y} =} poly (@var{x}) ## If @var{A} is a square @math{N}-by-@math{N} matrix, @code{poly (@var{A})} ## is the row vector of the coefficients of @code{det (z * eye (N) - A)}, ## the characteristic polynomial of @var{A}. @@ -61,17 +61,21 @@ print_usage (); endif - m = min (size (x)); - n = max (size (x)); - if (m == 0) + if (! isnumeric (x)) + error ("poly: input must be numeric, not type %s", class (x)); + elseif (ndims (x) > 2) + error ("poly: input must be a vector or a square matrix"); + elseif (isempty (x)) y = 1; return; - elseif (m == 1) + elseif (isvector (x)) + n = numel (x); v = x; - elseif (m == n) + elseif (! issquare (x)) + error ("poly: input matrix must be square"); + else + n = size (x,1); v = eig (x); - else - print_usage (); endif y = zeros (1, n+1); @@ -113,4 +117,7 @@ %! assert (y, [1 + 0i, -9 - 3i, 25 + 24i, -17 - 57i, -12 + 36i]); %!error poly () -%!error poly ([1, 2, 3; 4, 5, 6]) +%!error poly ("foo") +%!error poly ({1, "foo"; "bar", 1}) +%!error poly (ones (2, 2, 2)) +%!error poly ([1, 2, 3; 4, 5, 6]) diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyaffine.m --- a/scripts/polynomial/polyaffine.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyaffine.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyaffine (@var{f}, @var{mu}) +## @deftypefn {} {@var{g} =} polyaffine (@var{f}, @var{mu}) ## Return the coefficients of the polynomial vector @var{f} after an affine ## transformation. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyder.m --- a/scripts/polynomial/polyder.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyder.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyder (@var{p}) -## @deftypefnx {} {[@var{k}] =} polyder (@var{a}, @var{b}) +## @deftypefn {} {@var{k} =} polyder (@var{p}) +## @deftypefnx {} {@var{k} =} polyder (@var{a}, @var{b}) ## @deftypefnx {} {[@var{q}, @var{d}] =} polyder (@var{b}, @var{a}) ## Return the coefficients of the derivative of the polynomial whose ## coefficients are given by the vector @var{p}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyint.m --- a/scripts/polynomial/polyint.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyint.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyint (@var{p}) -## @deftypefnx {} {} polyint (@var{p}, @var{k}) +## @deftypefn {} {@var{q} =} polyint (@var{p}) +## @deftypefnx {} {@var{q} =} polyint (@var{p}, @var{k}) ## Return the coefficients of the integral of the polynomial whose ## coefficients are represented by the vector @var{p}. ## @@ -34,7 +34,7 @@ ## @seealso{polyder, polyval} ## @end deftypefn -function retval = polyint (p, k) +function q = polyint (p, k) if (nargin < 1) print_usage (); @@ -53,7 +53,7 @@ lp = length (p); if (lp == 0) - retval = []; + q = []; return; endif @@ -62,7 +62,7 @@ p = p.'; endif - retval = [(p ./ [lp:-1:1]), k]; + q = [(p ./ [lp:-1:1]), k]; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyout.m --- a/scripts/polynomial/polyout.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyout.m Sun Apr 03 11:30:26 2022 -0400 @@ -47,7 +47,7 @@ ## @seealso{polyreduce} ## @end deftypefn -function y = polyout (c, x) +function str = polyout (c, x) if (nargin < 1) print_usage (); @@ -67,26 +67,26 @@ if (n > 0) n1 = n+1; - tmp = coeff (c(1)); - for ii = 2:n - if (real (c(ii)) < 0) + s = coeff (c(1)); + for i = 2:n + if (real (c(i)) < 0) ns = " - "; - c(ii) = -c(ii); + c(i) = -c(i); else ns = " + "; endif - tmp = sprintf ("%s*%s^%d%s%s", tmp, x, n1-ii, ns, coeff (c(ii))); + s = sprintf ("%s*%s^%d%s%s", s, x, n1-i, ns, coeff (c(i))); endfor else - tmp = " "; + s = " "; endif if (nargout == 0) - disp (tmp); + disp (s); else - y = tmp; + str = s; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyreduce.m --- a/scripts/polynomial/polyreduce.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyreduce.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyreduce (@var{c}) +## @deftypefn {} {@var{p} =} polyreduce (@var{c}) ## Reduce a polynomial coefficient vector to a minimum number of terms by ## stripping off any leading zeros. ## @seealso{polyout} diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/polyvalm.m --- a/scripts/polynomial/polyvalm.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/polyvalm.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} polyvalm (@var{c}, @var{x}) +## @deftypefn {} {@var{y} =} polyvalm (@var{c}, @var{x}) ## Evaluate a polynomial in the matrix sense. ## ## @code{polyvalm (@var{c}, @var{x})} will evaluate the polynomial in the diff -r 0a1aec50a0c8 -r 960909469245 scripts/polynomial/roots.m --- a/scripts/polynomial/roots.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/polynomial/roots.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} roots (@var{c}) +## @deftypefn {} {@var{r} =} roots (@var{c}) ## ## Compute the roots of the polynomial @var{c}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/prefs/ispref.m --- a/scripts/prefs/ispref.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/prefs/ispref.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ispref ("@var{group}", "@var{pref}") -## @deftypefnx {} {} ispref ("@var{group}", @{"@var{pref1}", "@var{pref2"}, @dots{}@}) -## @deftypefnx {} {} ispref ("@var{group}") +## @deftypefn {} {@var{tf} =} ispref ("@var{group}", "@var{pref}") +## @deftypefnx {} {@var{tf} =} ispref ("@var{group}", @{"@var{pref1}", "@var{pref2"}, @dots{}@}) +## @deftypefnx {} {@var{tf} =} ispref ("@var{group}") ## Return true if the named preference @var{pref} exists in the preference ## group @var{group}. ## @@ -39,7 +39,7 @@ ## @seealso{getpref, addpref, setpref, rmpref} ## @end deftypefn -function retval = ispref (group, pref = "") +function tf = ispref (group, pref = "") if (nargin == 0) print_usage (); @@ -53,16 +53,16 @@ endif if (nargin == 1) - retval = isfield (loadprefs (), group); + tf = isfield (loadprefs (), group); else prefs = loadprefs (); if (isfield (prefs, group)) - retval = isfield (prefs.(group), pref); + tf = isfield (prefs.(group), pref); else if (ischar (pref)) - retval = false; + tf = false; else - retval = false (size (pref)); + tf = false (size (pref)); endif endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/prefs/prefdir.m --- a/scripts/prefs/prefdir.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/prefs/prefdir.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} prefdir -## @deftypefnx {} {} prefdir (1) -## @deftypefnx {} {@var{dir} =} prefdir +## @deftypefn {} {@var{dir} =} prefdir +## @deftypefnx {} {@var{dir} =} prefdir (1) ## Return the directory that holds the preferences for Octave. ## ## Examples: diff -r 0a1aec50a0c8 -r 960909469245 scripts/prefs/private/prefsfile.m --- a/scripts/prefs/private/prefsfile.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/prefs/private/prefsfile.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,12 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} prefsfile () +## @deftypefn {} {@var{fname} =} prefsfile () ## Return the full path and name of the file containing Octave preferences. ## @end deftypefn -function retval = prefsfile () +function fname = prefsfile () - retval = [prefdir() filesep() ".octave_prefs"]; + fname = [prefdir() filesep() ".octave_prefs"]; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/profiler/profexplore.m --- a/scripts/profiler/profexplore.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/profiler/profexplore.m Sun Apr 03 11:30:26 2022 -0400 @@ -36,13 +36,10 @@ ## @seealso{profile, profshow} ## @end deftypefn -## Built-in profiler. function profexplore (data) if (nargin == 0) data = profile ("info"); - elseif (nargin < 1) - print_usage (); endif ## The actual work is done by a recursive worker function, since that diff -r 0a1aec50a0c8 -r 960909469245 scripts/profiler/profexport.m --- a/scripts/profiler/profexport.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/profiler/profexport.m Sun Apr 03 11:30:26 2022 -0400 @@ -44,7 +44,6 @@ ## @seealso{profshow, profexplore, profile} ## @end deftypefn -## Built-in profiler. function profexport (dir, name = "", data) if (nargin < 1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/profiler/profshow.m --- a/scripts/profiler/profshow.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/profiler/profshow.m Sun Apr 03 11:30:26 2022 -0400 @@ -43,7 +43,6 @@ ## @seealso{profexplore, profile} ## @end deftypefn -## Built-in profiler. function profshow (data, n = 20) if (nargin == 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/set/powerset.m --- a/scripts/set/powerset.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/set/powerset.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} powerset (@var{a}) -## @deftypefnx {} {} powerset (@var{a}, "rows") +## @deftypefn {} {@var{p} =} powerset (@var{a}) +## @deftypefnx {} {@var{p} =} powerset (@var{a}, "rows") ## Compute the powerset (all subsets) of the set @var{a}. ## ## The set @var{a} must be a numerical matrix or a cell array of strings. The diff -r 0a1aec50a0c8 -r 960909469245 scripts/set/unique.m --- a/scripts/set/unique.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/set/unique.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} unique (@var{x}) -## @deftypefnx {} {} unique (@var{x}, "rows") -## @deftypefnx {} {} unique (@dots{}, "sorted") -## @deftypefnx {} {} unique (@dots{}, "stable") +## @deftypefn {} {@var{y} =} unique (@var{x}) +## @deftypefnx {} {@var{y} =} unique (@var{x}, "rows") +## @deftypefnx {} {@var{y} =} unique (@dots{}, "sorted") +## @deftypefnx {} {@var{y} =} unique (@dots{}, "stable") ## @deftypefnx {} {[@var{y}, @var{i}, @var{j}] =} unique (@dots{}) ## @deftypefnx {} {[@var{y}, @var{i}, @var{j}] =} unique (@dots{}, "first") ## @deftypefnx {} {[@var{y}, @var{i}, @var{j}] =} unique (@dots{}, "last") diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/arch_rnd.m --- a/scripts/signal/arch_rnd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/arch_rnd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} arch_rnd (@var{a}, @var{b}, @var{t}) +## @deftypefn {} {@var{y} =} arch_rnd (@var{a}, @var{b}, @var{t}) ## Simulate an ARCH sequence of length @var{t} with AR coefficients @var{b} and ## CH coefficients @var{a}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/arma_rnd.m --- a/scripts/signal/arma_rnd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/arma_rnd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} arma_rnd (@var{a}, @var{b}, @var{v}, @var{t}, @var{n}) +## @deftypefn {} {@var{x} =} arma_rnd (@var{a}, @var{b}, @var{v}, @var{t}, @var{n}) ## Return a simulation of the ARMA model. ## ## The ARMA model is defined by diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/autoreg_matrix.m --- a/scripts/signal/autoreg_matrix.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/autoreg_matrix.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} autoreg_matrix (@var{y}, @var{k}) +## @deftypefn {} {@var{x} =} autoreg_matrix (@var{y}, @var{k}) ## Given a time series (vector) @var{y}, return a matrix with ones in the first ## column and the first @var{k} lagged values of @var{y} in the other columns. ## @@ -35,7 +35,7 @@ ## The resulting matrix may be used as a regressor matrix in autoregressions. ## @end deftypefn -function X = autoreg_matrix (y, k) +function x = autoreg_matrix (y, k) if (nargin != 2) print_usage (); @@ -47,9 +47,9 @@ T = length (y); y = reshape (y, T, 1); - X = ones (T, k+1); + x = ones (T, k+1); for j = 1 : k - X(:, j+1) = [(zeros (j, 1)); y(1:T-j)]; + x(:, j+1) = [(zeros (j, 1)); y(1:T-j)]; endfor endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/bartlett.m --- a/scripts/signal/bartlett.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/bartlett.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} bartlett (@var{m}) +## @deftypefn {} {@var{c} =} bartlett (@var{m}) ## Return the filter coefficients of a Bartlett (triangular) window of length ## @var{m}. ## @@ -35,11 +35,11 @@ function c = bartlett (m) - if (nargin < 1) + if (nargin != 1) print_usage (); endif - if (! (isscalar (m) && (m == fix (m)) && (m > 0))) + if (! (isscalar (m) && m > 0 && m == fix (m))) error ("bartlett: M must be a positive integer"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/blackman.m --- a/scripts/signal/blackman.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/blackman.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} blackman (@var{m}) -## @deftypefnx {} {} blackman (@var{m}, "periodic") -## @deftypefnx {} {} blackman (@var{m}, "symmetric") +## @deftypefn {} {@var{c} =} blackman (@var{m}) +## @deftypefnx {} {@var{c} =} blackman (@var{m}, "periodic") +## @deftypefnx {} {@var{c} =} blackman (@var{m}, "symmetric") ## Return the filter coefficients of a @nospell{Blackman} window of length ## @var{m}. ## @@ -46,7 +46,7 @@ print_usage (); endif - if (! (isscalar (m) && (m == fix (m)) && (m > 0))) + if (! (isscalar (m) && m > 0 && m == fix (m))) error ("blackman: M must be a positive integer"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/detrend.m --- a/scripts/signal/detrend.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/detrend.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} detrend (@var{x}, @var{p}) +## @deftypefn {} {@var{y} =} detrend (@var{x}, @var{p}) ## If @var{x} is a vector, @code{detrend (@var{x}, @var{p})} removes the ## best fit of a polynomial of order @var{p} from the data @var{x}. ## @@ -55,7 +55,7 @@ elseif (ischar (p) && strcmpi (p, "linear")) p = 1; elseif (! isscalar (p) || p < 0 || p != fix (p)) - error ("detrend: P must be \"constant\", \"linear\", or a positive integer"); + error ('detrend: P must be "constant", "linear", or a positive integer'); endif [m, n] = size (x); @@ -107,4 +107,3 @@ %!error detrend (1, "invalid") %!error detrend (1, -1) %!error detrend (1, 1.25) - diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/durbinlevinson.m --- a/scripts/signal/durbinlevinson.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/durbinlevinson.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} durbinlevinson (@var{c}, @var{oldphi}, @var{oldv}) +## @deftypefn {} {[@var{newphi}, @var{newv}] =} durbinlevinson (@var{c}, @var{oldphi}, @var{oldv}) ## Perform one step of the @nospell{Durbin-Levinson} algorithm. ## ## The vector @var{c} specifies the autocovariances diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/fftconv.m --- a/scripts/signal/fftconv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/fftconv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fftconv (@var{x}, @var{y}) -## @deftypefnx {} {} fftconv (@var{x}, @var{y}, @var{n}) +## @deftypefn {} {@var{c} =} fftconv (@var{x}, @var{y}) +## @deftypefnx {} {@var{c} =} fftconv (@var{x}, @var{y}, @var{n}) ## Convolve two vectors using the FFT for computation. ## ## @code{c = fftconv (@var{x}, @var{y})} returns a vector of length equal to diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/fftfilt.m --- a/scripts/signal/fftfilt.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/fftfilt.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fftfilt (@var{b}, @var{x}) -## @deftypefnx {} {} fftfilt (@var{b}, @var{x}, @var{n}) +## @deftypefn {} {@var{y} =} fftfilt (@var{b}, @var{x}) +## @deftypefnx {} {@var{y} =} fftfilt (@var{b}, @var{x}, @var{n}) ## Filter @var{x} with the FIR filter @var{b} using the FFT. ## ## If @var{x} is a matrix, filter each column of the matrix. diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/fftshift.m --- a/scripts/signal/fftshift.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/fftshift.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fftshift (@var{x}) -## @deftypefnx {} {} fftshift (@var{x}, @var{dim}) +## @deftypefn {} {@var{y} =} fftshift (@var{x}) +## @deftypefnx {} {@var{y} =} fftshift (@var{x}, @var{dim}) ## Perform a shift of the vector @var{x}, for use with the @code{fft} and ## @code{ifft} functions, in order to move the frequency 0 to the center of ## the vector or matrix. @@ -49,7 +49,7 @@ ## @seealso{ifftshift} ## @end deftypefn -function retval = fftshift (x, dim) +function y = fftshift (x, dim) if (nargin < 1) print_usage (); @@ -69,12 +69,12 @@ idx = cell (); idx = repmat ({':'}, nd, 1); idx{dim} = [sz2+1:sz(dim), 1:sz2]; - retval = x(idx{:}); + y = x(idx{:}); else if (isvector (x)) xl = length (x); xx = ceil (xl/2); - retval = x([xx+1:xl, 1:xx]); + y = x([xx+1:xl, 1:xx]); else nd = ndims (x); sz = size (x); @@ -83,7 +83,7 @@ for i = 1:nd idx{i} = [sz2(i)+1:sz(i), 1:sz2(i)]; endfor - retval = x(idx{:}); + y = x(idx{:}); endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/fractdiff.m --- a/scripts/signal/fractdiff.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/fractdiff.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} fractdiff (@var{x}, @var{d}) +## @deftypefn {} {@var{fd} =} fractdiff (@var{x}, @var{d}) ## Compute the fractional differences @math{(1-L)^d x} where @math{L} ## denotes the lag-operator and @math{d} is greater than -1. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/hamming.m --- a/scripts/signal/hamming.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/hamming.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hamming (@var{m}) -## @deftypefnx {} {} hamming (@var{m}, "periodic") -## @deftypefnx {} {} hamming (@var{m}, "symmetric") +## @deftypefn {} {@var{c} =} hamming (@var{m}) +## @deftypefnx {} {@var{c} =} hamming (@var{m}, "periodic") +## @deftypefnx {} {@var{c} =} hamming (@var{m}, "symmetric") ## Return the filter coefficients of a Hamming window of length @var{m}. ## ## If the optional argument @qcode{"periodic"} is given, the periodic form @@ -45,7 +45,7 @@ print_usage (); endif - if (! (isscalar (m) && (m == fix (m)) && (m > 0))) + if (! (isscalar (m) && m > 0 && m == fix (m))) error ("hamming: M must be a positive integer"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/hanning.m --- a/scripts/signal/hanning.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/hanning.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hanning (@var{m}) -## @deftypefnx {} {} hanning (@var{m}, "periodic") -## @deftypefnx {} {} hanning (@var{m}, "symmetric") +## @deftypefn {} {@var{c} =} hanning (@var{m}) +## @deftypefnx {} {@var{c} =} hanning (@var{m}, "periodic") +## @deftypefnx {} {@var{c} =} hanning (@var{m}, "symmetric") ## Return the filter coefficients of a Hanning window of length @var{m}. ## ## If the optional argument @qcode{"periodic"} is given, the periodic form @@ -45,7 +45,7 @@ print_usage (); endif - if (! (isscalar (m) && (m == fix (m)) && (m > 0))) + if (! (isscalar (m) && m > 0 && m == fix (m))) error ("hanning: M must be a positive integer"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/hurst.m --- a/scripts/signal/hurst.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/hurst.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hurst (@var{x}) +## @deftypefn {} {@var{H} =} hurst (@var{x}) ## Estimate the Hurst parameter of sample @var{x} via the rescaled range ## statistic. ## @@ -33,14 +33,14 @@ function H = hurst (x) - if (nargin < 1) + if (nargin != 1) print_usage (); endif if (isscalar (x)) error ("hurst: X must not be a scalar"); elseif (isvector (x)) - x = reshape (x, length (x), 1); + x = x(:); # always use column vector endif [xr, xc] = size (x); diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/ifftshift.m --- a/scripts/signal/ifftshift.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/ifftshift.m Sun Apr 03 11:30:26 2022 -0400 @@ -33,40 +33,40 @@ ## @seealso{fftshift} ## @end deftypefn -function retval = ifftshift (x, dim) +function x = ifftshift (y, dim) if (nargin < 1) print_usage (); endif - if (! (isnumeric (x) || islogical (x) || ischar (x))) - error ("ifftshift: X must be a vector or matrix"); + if (! (isnumeric (y) || islogical (y) || ischar (y))) + error ("ifftshift: Y must be a vector or matrix"); endif if (nargin == 2) if (! (isscalar (dim) && dim > 0 && dim == fix (dim))) error ("ifftshift: dimension DIM must be a positive integer"); endif - nd = ndims (x); - sz = size (x); + nd = ndims (y); + sz = size (y); sz2 = floor (sz(dim) / 2); idx = repmat ({':'}, nd, 1); idx{dim} = [sz2+1:sz(dim), 1:sz2]; - retval = x(idx{:}); + x = y(idx{:}); else - if (isvector (x)) - xl = length (x); - xx = floor (xl/2); - retval = x([xx+1:xl, 1:xx]); + if (isvector (y)) + yl = length (y); + y2 = floor (yl/2); + x = y([y2+1:yl, 1:y2]); else - nd = ndims (x); - sz = size (x); + nd = ndims (y); + sz = size (y); sz2 = floor (sz ./ 2); idx = cell (); for i = 1:nd idx{i} = [sz2(i)+1:sz(i), 1:sz2(i)]; endfor - retval = x(idx{:}); + x = y(idx{:}); endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/private/rectangle_lw.m --- a/scripts/signal/private/rectangle_lw.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/private/rectangle_lw.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,16 +24,18 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rectangle_lw (@var{n}, @var{b}) -## Rectangular lag window. Subfunction used for spectral density -## estimation. +## @deftypefn {} {@var{c} =} rectangle_lw (@var{n}, @var{b}) +## Rectangular lag window. +## +## Subfunction used for spectral density estimation. +## @seealso{spectral_adf} ## @end deftypefn -function retval = rectangle_lw (n, b) +function c = rectangle_lw (n, b) - retval = zeros (n, 1); + c = zeros (n, 1); t = floor (1 / b); - retval(1:t, 1) = ones (t, 1); + c(1:t) = 1; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/private/rectangle_sw.m --- a/scripts/signal/private/rectangle_sw.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/private/rectangle_sw.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,19 +24,21 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rectangle_sw (@var{n}, @var{b}) -## Rectangular spectral window. Subfunction used for spectral density -## estimation. +## @deftypefn {} {@var{c} =} rectangle_sw (@var{n}, @var{b}) +## Rectangular spectral window. +## +## Subfunction used for spectral density estimation. +## @seealso{spectral_xdf} ## @end deftypefn -function retval = rectangle_sw (n, b) +function c = rectangle_sw (n, b) - retval = zeros (n, 1); - retval(1) = 2 / b + 1; + c = zeros (n, 1); + c(1) = 2 / b + 1; l = (2:n)' - 1; l = 2 * pi * l / n; - retval(2:n) = sin ((2/b + 1) * l / 2) ./ sin (l / 2); + c(2:n) = sin ((2/b + 1) * l / 2) ./ sin (l / 2); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/private/triangle_lw.m --- a/scripts/signal/private/triangle_lw.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/private/triangle_lw.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,16 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} triangle_lw (@var{n}, @var{b}) -## Triangular lag window. Subfunction used for spectral density -## estimation. +## @deftypefn {} {@var{c} =} triangle_lw (@var{n}, @var{b}) +## Triangular lag window. +## +## Subfunction used for spectral density estimation. +## @seealso{spectral_adf} ## @end deftypefn -function retval = triangle_lw (n, b) +function c = triangle_lw (n, b) - retval = 1 - (0 : n-1)' * b; - retval = max ([retval'; (zeros (1, n))])'; + c = 1 - (0 : n-1)' * b; + c = max ([c'; (zeros (1, n))])'; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/sinc.m --- a/scripts/signal/sinc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/sinc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sinc (@var{x}) +## @deftypefn {} {@var{y} =} sinc (@var{x}) ## Compute the sinc function. ## ## Return @@ -36,19 +36,19 @@ ## @end ifnottex ## @end deftypefn -function result = sinc (x) +function y = sinc (x) - if (nargin < 1) + if (nargin != 1) print_usage (); endif - result = ones (size (x)); + y = ones (size (x)); i = (x != 0); if (any (i(:))) t = pi * x(i); - result(i) = sin (t) ./ t; + y(i) = sin (t) ./ t; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/sinetone.m --- a/scripts/signal/sinetone.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/sinetone.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sinetone (@var{freq}, @var{rate}, @var{sec}, @var{ampl}) +## @deftypefn {} {@var{y} =} sinetone (@var{freq}, @var{rate}, @var{sec}, @var{ampl}) ## Return a sinetone of frequency @var{freq} with a length of @var{sec} ## seconds at sampling rate @var{rate} and with amplitude @var{ampl}. ## @@ -34,7 +34,7 @@ ## @seealso{sinewave} ## @end deftypefn -function retval = sinetone (freq, rate = 8000, sec = 1, ampl = 64) +function y = sinetone (freq, rate = 8000, sec = 1, ampl = 64) if (nargin < 1) print_usage (); @@ -52,10 +52,10 @@ n = length (freq); ns = round (rate * sec); - retval = zeros (ns, n); + y = zeros (ns, n); for k = 1:n - retval(:, k) = ampl(k) * sin (2 * pi * (1:ns) / rate * freq(k))'; + y(:, k) = ampl(k) * sin (2 * pi * (1:ns) / rate * freq(k))'; endfor endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/sinewave.m --- a/scripts/signal/sinewave.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/sinewave.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sinewave (@var{m}, @var{n}, @var{d}) +## @deftypefn {} {@var{y} =} sinewave (@var{m}, @var{n}, @var{d}) ## Return an @var{m}-element vector with @var{i}-th element given by ## @code{sin (2 * pi * (@var{i}+@var{d}-1) / @var{n})}. ## @@ -33,7 +33,7 @@ ## @seealso{sinetone} ## @end deftypefn -function x = sinewave (m, n, d = 0) +function y = sinewave (m, n, d = 0) if (nargin < 1) print_usage (); @@ -47,7 +47,7 @@ d = 0; endif - x = sin (((1 : m) + d - 1) * 2 * pi / n); + y = sin (((1 : m) + d - 1) * 2 * pi / n); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/spectral_adf.m --- a/scripts/signal/spectral_adf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/spectral_adf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} spectral_adf (@var{c}) -## @deftypefnx {} {} spectral_adf (@var{c}, @var{win}) -## @deftypefnx {} {} spectral_adf (@var{c}, @var{win}, @var{b}) +## @deftypefn {} {@var{sde} =} spectral_adf (@var{c}) +## @deftypefnx {} {@var{sde} =} spectral_adf (@var{c}, @var{win}) +## @deftypefnx {} {@var{sde} =} 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}. ## @@ -39,7 +39,7 @@ ## @seealso{spectral_xdf} ## @end deftypefn -function retval = spectral_adf (c, win, b) +function sde = spectral_adf (c, win, b) if (nargin < 1) print_usage (); @@ -66,9 +66,9 @@ c .*= w; - retval = 2 * real (fft (c)) - c(1); - retval = [(zeros (cr, 1)), retval]; - retval(:, 1) = (0 : cr-1)' / cr; + sde = 2 * real (fft (c)) - c(1); + sde = [(zeros (cr, 1)), sde]; + sde(:, 1) = (0 : cr-1)' / cr; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/spectral_xdf.m --- a/scripts/signal/spectral_xdf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/spectral_xdf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} spectral_xdf (@var{x}) -## @deftypefnx {} {} spectral_xdf (@var{x}, @var{win}) -## @deftypefnx {} {} spectral_xdf (@var{x}, @var{win}, @var{b}) +## @deftypefn {} {@var{sde} =} spectral_xdf (@var{x}) +## @deftypefnx {} {@var{sde} =} spectral_xdf (@var{x}, @var{win}) +## @deftypefnx {} {@var{sde} =} 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}. ## @@ -39,7 +39,7 @@ ## @seealso{spectral_adf} ## @end deftypefn -function retval = spectral_xdf (x, win, b) +function sde = spectral_xdf (x, win, b) if (nargin < 1) print_usage (); @@ -66,11 +66,11 @@ x -= sum (x) / xr; - retval = (abs (fft (x)) / xr).^2; - retval = real (ifft (fft (retval) .* fft (w))); + sde = (abs (fft (x)) / xr).^2; + sde = real (ifft (fft (sde) .* fft (w))); - retval = [(zeros (xr, 1)), retval]; - retval(:, 1) = (0 : xr-1)' / xr; + sde = [(zeros (xr, 1)), sde]; + sde(:, 1) = (0 : xr-1)' / xr; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/signal/spencer.m --- a/scripts/signal/spencer.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/signal/spencer.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,14 +24,14 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} spencer (@var{x}) +## @deftypefn {} {@var{savg} =} spencer (@var{x}) ## Return @nospell{Spencer's} 15-point moving average of each column of ## @var{x}. ## @end deftypefn -function retval = spencer (x) +function savg = spencer (x) - if (nargin < 1) + if (nargin != 1) print_usage (); endif @@ -48,9 +48,9 @@ w = [-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3] / 320; - retval = fftfilt (w, x); - retval = [zeros(7,c); retval(15:n,:); zeros(7,c);]; + savg = fftfilt (w, x); + savg = [zeros(7,c); savg(15:n,:); zeros(7,c);]; - retval = reshape (retval, xr, xc); + savg = reshape (savg, xr, xc); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/ilu.m --- a/scripts/sparse/ilu.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/ilu.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ilu (@var{A}) -## @deftypefnx {} {} ilu (@var{A}, @var{opts}) +## @deftypefn {} {@var{LUA} =} ilu (@var{A}) +## @deftypefnx {} {@var{LUA} =} ilu (@var{A}, @var{opts}) ## @deftypefnx {} {[@var{L}, @var{U}] =} ilu (@dots{}) ## @deftypefnx {} {[@var{L}, @var{U}, @var{P}] =} ilu (@dots{}) ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/private/__sprand__.m --- a/scripts/sparse/private/__sprand__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/private/__sprand__.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,9 +27,9 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} __sprand__ (@var{s}, @var{randfun}) -## @deftypefnx {} {} __sprand__ (@var{m}, @var{n}, @var{d}, @var{fcnname}, @var{randfun}) -## @deftypefnx {} {} __sprand__ (@var{m}, @var{n}, @var{d}, @var{rc}, @var{fcnname}, @var{randfun}) +## @deftypefn {} {@var{S} =} __sprand__ (@var{s}, @var{randfun}) +## @deftypefnx {} {@var{S} =} __sprand__ (@var{m}, @var{n}, @var{d}, @var{fcnname}, @var{randfun}) +## @deftypefnx {} {@var{S} =} __sprand__ (@var{m}, @var{n}, @var{d}, @var{rc}, @var{fcnname}, @var{randfun}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/sprand.m --- a/scripts/sparse/sprand.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/sprand.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,9 +27,9 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} sprand (@var{m}, @var{n}, @var{d}) -## @deftypefnx {} {} sprand (@var{m}, @var{n}, @var{d}, @var{rc}) -## @deftypefnx {} {} sprand (@var{s}) +## @deftypefn {} {@var{s} =} sprand (@var{m}, @var{n}, @var{d}) +## @deftypefnx {} {@var{s} =} sprand (@var{m}, @var{n}, @var{d}, @var{rc}) +## @deftypefnx {} {@var{s} =} sprand (@var{s}) ## Generate a sparse matrix with uniformly distributed random values. ## ## The size of the matrix is @var{m}x@var{n} with a density of values @var{d}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/sprandn.m --- a/scripts/sparse/sprandn.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/sprandn.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,9 +27,9 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} sprandn (@var{m}, @var{n}, @var{d}) -## @deftypefnx {} {} sprandn (@var{m}, @var{n}, @var{d}, @var{rc}) -## @deftypefnx {} {} sprandn (@var{s}) +## @deftypefn {} {@var{s} =} sprandn (@var{m}, @var{n}, @var{d}) +## @deftypefnx {} {@var{s} =} sprandn (@var{m}, @var{n}, @var{d}, @var{rc}) +## @deftypefnx {} {@var{s} =} sprandn (@var{s}) ## Generate a sparse matrix with normally distributed random values. ## ## The size of the matrix is @var{m}x@var{n} with a density of values @var{d}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/sprandsym.m --- a/scripts/sparse/sprandsym.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/sprandsym.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sprandsym (@var{n}, @var{d}) -## @deftypefnx {} {} sprandsym (@var{s}) +## @deftypefn {} {@var{S} =} sprandsym (@var{n}, @var{d}) +## @deftypefnx {} {@var{S} =} sprandsym (@var{s}) ## Generate a symmetric random sparse matrix. ## ## The size of the matrix will be @var{n}x@var{n}, with a density of values diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/treelayout.m --- a/scripts/sparse/treelayout.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/treelayout.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,21 +24,21 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} treelayout (@var{tree}) -## @deftypefnx {} {} treelayout (@var{tree}, @var{permutation}) +## @deftypefn {} {[@var{x}, @var{y}] =} treelayout (@var{tree}) +## @deftypefnx {} {[@var{x}, @var{y}] =} treelayout (@var{tree}, @var{permutation}) +## @deftypefnx {} {[@var{x}, @var{y}, @var{h}, @var{s}] =} treelayout (@dots{}) ## treelayout lays out a tree or a forest. ## ## The first argument @var{tree} is a vector of predecessors. ## -## The parameter @var{permutation} is an optional postorder permutation. +## The optional parameter @var{permutation} is a postorder permutation. ## ## The complexity of the algorithm is O(n) in terms of time and memory ## requirements. ## @seealso{etreeplot, gplot, treeplot} ## @end deftypefn -function [x_coordinate, y_coordinate, height, s] = ... - treelayout (tree, permutation) +function [x, y, h, s] = treelayout (tree, permutation) if (nargin < 1) print_usage (); @@ -162,16 +162,16 @@ ## If there is not any descendant of "parent node": if (stk(end,2) != par_number) left_most += 1; - x_coordinate_r(par_number) = left_most; + x_r(par_number) = left_most; max_ht = min (max_ht, level); - if (length (stk) > 1 && find ((shift (stk,1) - stk) == 0) > 1 + if (length (stk) > 1 && find ((circshift (stk,1) - stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) ## Return to the nearest branching the position to return ## position is the position on the stack, where should be ## started further search (there are two nodes which has the ## same parent node). - position = (find ((shift (stk(:,2), 1) - stk(:,2)) == 0))(end) + 1; + position = (find ((circshift (stk(:,2), 1) - stk(:,2)) == 0))(end) + 1; par_number_vec = stk(position:end,2); ## The vector of removed nodes (the content of stack form @@ -181,7 +181,7 @@ ## The level have to be decreased. - x_coordinate_r(par_number_vec) = left_most; + x_r(par_number_vec) = left_most; stk(position:end,:) = []; endif @@ -192,8 +192,8 @@ par_number = stk(end,1); ## If there is another branch start to search it. if (par_number != -1) - y_coordinate(par_number) = level; - x_coordinate_l(par_number) = left_most + 1; + y(par_number) = level; + x_l(par_number) = left_most + 1; endif else @@ -201,16 +201,16 @@ ## them and go on through it. level -= 1; par_number = stk(end,1); - y_coordinate(par_number) = level; - x_coordinate_l(par_number) = left_most + 1; + y(par_number) = level; + x_l(par_number) = left_most + 1; endif endwhile ## Calculate the x coordinates (the known values are the position ## of most left and most right descendants). - x_coordinate = (x_coordinate_l + x_coordinate_r) / 2; + x = (x_l + x_r) / 2; - height = num_nodes - max_ht - 1; + h = num_nodes - max_ht - 1; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/sparse/treeplot.m --- a/scripts/sparse/treeplot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/sparse/treeplot.m Sun Apr 03 11:30:26 2022 -0400 @@ -127,13 +127,13 @@ left_most += 1; x_coordinate_r(par_number) = left_most; max_ht = min (max_ht, level); - if (length (stk) > 1 && find ((shift (stk,1) - stk) == 0) > 1 + if (length (stk) > 1 && find ((circshift (stk,1) - stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) ## Return to the nearest branching the position to return ## position is the position on the stack, where should be ## started further search (there are two nodes which has the ## same parent node). - position = (find ((shift (stk(:,2),1) - stk(:,2)) == 0))(end) + 1; + position = (find ((circshift (stk(:,2),1) - stk(:,2)) == 0))(end) + 1; par_number_vec = stk(position:end,2); ## The vector of removed nodes (the content of stack form ## position to end). diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/beta.m --- a/scripts/specfun/beta.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/beta.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} beta (@var{a}, @var{b}) +## @deftypefn {} {@var{y} =} beta (@var{a}, @var{b}) ## Compute the Beta function for real inputs @var{a} and @var{b}. ## ## The Beta function definition is @@ -48,7 +48,7 @@ ## @seealso{betaln, betainc, betaincinv} ## @end deftypefn -function retval = beta (a, b) +function y = beta (a, b) if (nargin != 2) print_usage (); @@ -60,7 +60,7 @@ error ("beta: A and B must have consistent sizes"); endif - retval = real (exp (gammaln (a) + gammaln (b) - gammaln (a+b))); + y = real (exp (gammaln (a) + gammaln (b) - gammaln (a+b))); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/betainc.m --- a/scripts/specfun/betainc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/betainc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} betainc (@var{x}, @var{a}, @var{b}) -## @deftypefnx {} {} betainc (@var{x}, @var{a}, @var{b}, @var{tail}) +## @deftypefn {} {@var{I} =} betainc (@var{x}, @var{a}, @var{b}) +## @deftypefnx {} {@var{I} =} betainc (@var{x}, @var{a}, @var{b}, @var{tail}) ## Compute the incomplete beta function. ## ## This is defined as @@ -72,7 +72,7 @@ ## @seealso{beta, betaincinv, betaln} ## @end deftypefn -function y = betainc (x, a, b, tail = "lower") +function I = betainc (x, a, b, tail = "lower") if (nargin < 3) print_usage (); @@ -115,7 +115,7 @@ ## Convert to floating point if necessary if (isinteger (x)) - y = double (x); + I = double (x); endif if (isinteger (a)) a = double (a); @@ -125,7 +125,7 @@ endif ## Initialize output array - y = zeros (size (x), class (x)); + I = zeros (size (x), class (x)); ## Trivial cases (long code here trades memory for speed) a_one = (a == 1); @@ -138,13 +138,13 @@ b_one &= a_not_one; if (strcmpi (tail, "lower")) - y(a_b_one) = x(a_b_one); - y(a_one) = 1 - (1 - x(a_one)) .^ b(a_one); - y(b_one) = x(b_one) .^ a(b_one); + I(a_b_one) = x(a_b_one); + I(a_one) = 1 - (1 - x(a_one)) .^ b(a_one); + I(b_one) = x(b_one) .^ a(b_one); elseif (strcmpi (tail, "upper")) - y(a_b_one) = 1 - x(a_b_one); - y(a_one) = (1 - x(a_one)) .^ b(a_one); - y(b_one) = 1 - x(b_one) .^ a(b_one); + I(a_b_one) = 1 - x(a_b_one); + I(a_one) = (1 - x(a_one)) .^ b(a_one); + I(b_one) = 1 - x(b_one) .^ a(b_one); endif ## Non-Trivial cases @@ -183,10 +183,10 @@ y_nt = real (exp (y_nt)); y_nt(fflag) = 1 - y_nt(fflag); - y(non_trivial) = y_nt; + I(non_trivial) = y_nt; ## Restore original shape - y = reshape (y, orig_sz); + I = reshape (I, orig_sz); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/betaincinv.m --- a/scripts/specfun/betaincinv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/betaincinv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} betaincinv (@var{y}, @var{a}, @var{b}) -## @deftypefnx {} {} betaincinv (@var{y}, @var{a}, @var{b}, "lower") -## @deftypefnx {} {} betaincinv (@var{y}, @var{a}, @var{b}, "upper") +## @deftypefn {} {@var{x} =} betaincinv (@var{y}, @var{a}, @var{b}) +## @deftypefnx {} {@var{x} =} betaincinv (@var{y}, @var{a}, @var{b}, "lower") +## @deftypefnx {} {@var{x} =} betaincinv (@var{y}, @var{a}, @var{b}, "upper") ## Compute the inverse of the normalized incomplete beta function. ## ## The normalized incomplete beta function is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/betaln.m --- a/scripts/specfun/betaln.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/betaln.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} betaln (@var{a}, @var{b}) +## @deftypefn {} {@var{lnb} =} betaln (@var{a}, @var{b}) ## Compute the natural logarithm of the Beta function for real inputs @var{a} ## and @var{b}. ## @@ -48,7 +48,7 @@ ## @seealso{beta, betainc, betaincinv, gammaln} ## @end deftypefn -function retval = betaln (a, b) +function lnb = betaln (a, b) if (nargin != 2) print_usage (); @@ -60,7 +60,7 @@ error ("betaln: A and B must have consistent sizes"); endif - retval = gammaln (a) + gammaln (b) - gammaln (a + b); + lnb = gammaln (a) + gammaln (b) - gammaln (a + b); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/cosint.m --- a/scripts/specfun/cosint.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/cosint.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cosint (@var{x}) +## @deftypefn {} {@var{y} =} cosint (@var{x}) ## Compute the cosine integral function: ## @tex ## $$ @@ -76,7 +76,7 @@ function y = cosint (x) - if (nargin < 1) + if (nargin != 1) print_usage (); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/expint.m --- a/scripts/specfun/expint.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/expint.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} expint (@var{x}) +## @deftypefn {} {@var{y} =} expint (@var{x}) ## Compute the exponential integral. ## ## The exponential integral is defined as: diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/factorial.m --- a/scripts/specfun/factorial.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/factorial.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,12 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} factorial (@var{n}) +## @deftypefn {} {@var{f} =} factorial (@var{n}) ## Return the factorial of @var{n} where @var{n} is a real non-negative ## integer. ## +## @c FIXME: This documentation is wrong. Apparently gamma() is used for +## @c calculations rather than prod(). ## If @var{n} is a scalar, this is equivalent to @code{prod (1:@var{n})}. For ## vector or matrix arguments, return the factorial of each element in the ## array. @@ -39,7 +41,7 @@ ## @seealso{prod, gamma, gammaln} ## @end deftypefn -function x = factorial (n) +function f = factorial (n) if (nargin < 1) print_usage (); @@ -47,14 +49,14 @@ error ("factorial: all N must be real non-negative integers"); endif - x = round (gamma (n+1)); + f = round (gamma (n+1)); ## FIXME: Matlab returns an output of the same type as the input. ## This doesn't seem particularly worth copying--for example uint8 would ## saturate for n > 5. If desired, however, the following code could be ## uncommented. - ## if (! isfloat (x)) - ## x = cast (x, class (n)); + ## if (! isfloat (f)) + ## f = cast (f, class (n)); ## endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/gammainc.m --- a/scripts/specfun/gammainc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/gammainc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} gammainc (@var{x}, @var{a}) -## @deftypefnx {} {} gammainc (@var{x}, @var{a}, @var{tail}) +## @deftypefn {} {@var{y} =} gammainc (@var{x}, @var{a}) +## @deftypefnx {} {@var{y} =} gammainc (@var{x}, @var{a}, @var{tail}) ## Compute the normalized incomplete gamma function. ## ## This is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/gammaincinv.m --- a/scripts/specfun/gammaincinv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/gammaincinv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} gammaincinv (@var{y}, @var{a}) -## @deftypefnx {} {} gammaincinv (@var{y}, @var{a}, @var{tail}) +## @deftypefn {} {@var{x} =} gammaincinv (@var{y}, @var{a}) +## @deftypefnx {} {@var{x} =} gammaincinv (@var{y}, @var{a}, @var{tail}) ## Compute the inverse of the normalized incomplete gamma function. ## ## The normalized incomplete gamma function is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/isprime.m --- a/scripts/specfun/isprime.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/isprime.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isprime (@var{x}) +## @deftypefn {} {@var{tf} =} isprime (@var{x}) ## Return a logical array which is true where the elements of @var{x} are prime ## numbers and false where they are not. ## @@ -72,7 +72,7 @@ ## @seealso{primes, factor, gcd, lcm} ## @end deftypefn -function t = isprime (x) +function tf = isprime (x) if (nargin < 1) print_usage (); @@ -81,12 +81,12 @@ endif if (isempty (x)) - t = x; + tf = x; return; endif if (iscomplex (x)) - t = isgaussianprime (x); + tf = isgaussianprime (x); return; endif @@ -101,7 +101,7 @@ ## because of the method used by __isprimelarge__ below. maxp = 37; pr = [2 3 5 7 11 13 17 19 23 29 31 37]; - t = lookup (pr, x, "b"); # quick search for table matches. + tf = lookup (pr, x, "b"); # quick search for table matches. THRESHOLD = 29e9; ## FIXME: THRESHOLD is the input value at which Miller-Rabin @@ -143,7 +143,7 @@ ## Start by dividing through by the small primes until the remaining list ## of entries is small (and most likely prime themselves). pr2 = primes (sqrt (max (m))); - t |= lookup (pr2, x, "b"); + tf |= lookup (pr2, x, "b"); for p = pr2 m = m(rem (m, p) != 0); if (numel (m) < numel (pr) / 10) @@ -160,20 +160,20 @@ ## Add any remaining entries, which are truly prime, to the results. if ( ! isempty (m)) - t |= lookup (sort (m), x, "b"); + tf |= lookup (sort (m), x, "b"); endif endif ## Process remaining entries (everything above THRESHOLD) with Miller-Rabin ii = (x(:)' > THRESHOLD); - t(ii) = __isprimelarge__ (x(ii)); + tf(ii) = __isprimelarge__ (x(ii)); endfunction -function t = isgaussianprime (z) +function tf = isgaussianprime (z) ## Assume prime unless proven otherwise - t = true (size (z)); + tf = true (size (z)); x = real (z); y = imag (z); @@ -183,13 +183,13 @@ xidx = y==0 & mod (x, 4) == 3; yidx = x==0 & mod (y, 4) == 3; - t(xidx) &= isprime (x(xidx)); - t(yidx) &= isprime (y(yidx)); + tf(xidx) &= isprime (x(xidx)); + tf(yidx) &= isprime (y(yidx)); ## Otherwise, prime if x^2 + y^2 is prime zidx = ! (xidx | yidx); # Skip entries that were already evaluated zabs = x(zidx).^2 + y(zidx).^2; - t(zidx) &= isprime (zabs); + tf(zidx) &= isprime (zabs); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/lcm.m --- a/scripts/specfun/lcm.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/lcm.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} lcm (@var{x}, @var{y}) -## @deftypefnx {} {} lcm (@var{x}, @var{y}, @dots{}) +## @deftypefn {} {@var{l} =} lcm (@var{x}, @var{y}) +## @deftypefnx {} {@var{l} =} lcm (@var{x}, @var{y}, @dots{}) ## Compute the least common multiple of @var{x} and @var{y}, or of the list of ## all arguments. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/module.mk --- a/scripts/specfun/module.mk Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/module.mk Sun Apr 03 11:30:26 2022 -0400 @@ -19,7 +19,6 @@ %reldir%/nchoosek.m \ %reldir%/nthroot.m \ %reldir%/perms.m \ - %reldir%/pow2.m \ %reldir%/primes.m \ %reldir%/reallog.m \ %reldir%/realpow.m \ diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/nthroot.m --- a/scripts/specfun/nthroot.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/nthroot.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,7 +27,7 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} nthroot (@var{x}, @var{n}) +## @deftypefn {} {@var{y} =} nthroot (@var{x}, @var{n}) ## ## Compute the real (non-complex) @var{n}-th root of @var{x}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/perms.m --- a/scripts/specfun/perms.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/perms.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} perms (@var{v}) +## @deftypefn {} {@var{P} =} perms (@var{v}) ## Generate all permutations of vector @var{v} with one row per permutation. ## ## Results are returned in inverse lexicographic order. The result has size @@ -56,7 +56,7 @@ ## type. However, benchmarking shows doubles are faster. If this changes in ## a later version of Octave the index variables here can be made uint8. -function A = perms (v) +function P = perms (v) if (nargin < 1) print_usage (); @@ -73,13 +73,13 @@ if (n < 4) # special cases for small n switch (n) case 0 - A = reshape (v, 1, 0); + P = reshape (v, 1, 0); case 1 - A = v; + P = v; case 2 - A = [v([2 1]);v]; + P = [v([2 1]);v]; case 3 - A = v([3 2 1; 3 1 2; 2 3 1; 2 1 3; 1 3 2; 1 2 3]); + P = v([3 2 1; 3 1 2; 2 3 1; 2 1 3; 1 3 2; 1 2 3]); endswitch else v = v(end:-1:1); @@ -101,12 +101,12 @@ n += 1; f *= n-1; - A = v(1)(ones (factorial (n), n)); - A(:,1) = v(ones (f, 1),:)(:); + P = v(1)(ones (factorial (n), n)); + P(:,1) = v(ones (f, 1),:)(:); for i = 1:n b = v([1:i-1 i+1:n]); - A((1:f)+(i-1)*f, 2:end) = b(idx); + P((1:f)+(i-1)*f, 2:end) = b(idx); endfor endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/pow2.m --- a/scripts/specfun/pow2.m Sun Apr 03 11:29:17 2022 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -######################################################################## -## -## Copyright (C) 1995-2022 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or . -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {} pow2 (@var{x}) -## @deftypefnx {} {} pow2 (@var{f}, @var{e}) -## With one input argument, compute -## @tex -## $2^x$ -## @end tex -## @ifnottex -## 2 .^ x -## @end ifnottex -## for each element of @var{x}. -## -## With two input arguments, return -## @tex -## $f \cdot 2^e$. -## @end tex -## @ifnottex -## f .* (2 .^ e). -## @end ifnottex -## @seealso{log2, nextpow2, power} -## @end deftypefn - -function y = pow2 (f, e) - - if (nargin < 1) - print_usage (); - endif - - if (nargin == 1) - y = 2 .^ f; - else - y = f .* (2 .^ e); - endif - -endfunction - - -%!test -%! x = [3, 0, -3]; -%! v = [8, 1, .125]; -%! assert (pow2 (x), v, sqrt (eps)); - -%!test -%! x = [3, 0, -3, 4, 0, -4, 5, 0, -5]; -%! y = [-2, -2, -2, 1, 1, 1, 3, 3, 3]; -%! z = x .* (2 .^ y); -%! assert (pow2 (x,y), z, sqrt (eps)); - -%!error pow2 () diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/reallog.m --- a/scripts/specfun/reallog.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/reallog.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} reallog (@var{x}) +## @deftypefn {} {@var{y} =} reallog (@var{x}) ## Return the real-valued natural logarithm of each element of @var{x}. ## ## If any element results in a complex return value @code{reallog} aborts and diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/realpow.m --- a/scripts/specfun/realpow.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/realpow.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} realpow (@var{x}, @var{y}) +## @deftypefn {} {@var{z} =} realpow (@var{x}, @var{y}) ## Compute the real-valued, element-by-element power operator. ## ## This is equivalent to @w{@code{@var{x} .^ @var{y}}}, except that diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/realsqrt.m --- a/scripts/specfun/realsqrt.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/realsqrt.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} realsqrt (@var{x}) +## @deftypefn {} {@var{y} =} realsqrt (@var{x}) ## Return the real-valued square root of each element of @var{x}. ## ## If any element results in a complex return value @code{realsqrt} aborts and diff -r 0a1aec50a0c8 -r 960909469245 scripts/specfun/sinint.m --- a/scripts/specfun/sinint.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/specfun/sinint.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} sinint (@var{x}) +## @deftypefn {} {@var{y} =} sinint (@var{x}) ## Compute the sine integral function: ## @tex ## $$ diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/hadamard.m --- a/scripts/special-matrix/hadamard.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/hadamard.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,7 +27,7 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} hadamard (@var{n}) +## @deftypefn {} {@var{h} =} hadamard (@var{n}) ## Construct a Hadamard matrix (@nospell{Hn}) of size @var{n}-by-@var{n}. ## ## The size @var{n} must be of the form @math{2^k * p} in which p is one of diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/hankel.m --- a/scripts/special-matrix/hankel.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/hankel.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hankel (@var{c}) -## @deftypefnx {} {} hankel (@var{c}, @var{r}) +## @deftypefn {} {@var{h} =} hankel (@var{c}) +## @deftypefnx {} {@var{h} =} hankel (@var{c}, @var{r}) ## Return the Hankel matrix constructed from the first column @var{c}, and ## (optionally) the last row @var{r}. ## @@ -54,7 +54,7 @@ ## @seealso{hadamard, toeplitz} ## @end deftypefn -function retval = hankel (c, r) +function h = hankel (c, r) if (nargin < 1) print_usage (); @@ -85,7 +85,7 @@ endif slices = cellslices (data, 1:nc, nr:1:nc+nr-1); - retval = horzcat (slices{:}); + h = horzcat (slices{:}); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/hilb.m --- a/scripts/special-matrix/hilb.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/hilb.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hilb (@var{n}) +## @deftypefn {} {@var{h} =} hilb (@var{n}) ## Return the Hilbert matrix of order @var{n}. ## ## The @math{i,j} element of a Hilbert matrix is defined as @@ -58,9 +58,9 @@ ## @seealso{invhilb} ## @end deftypefn -function retval = hilb (n) +function h = hilb (n) - if (nargin < 1) + if (nargin != 1) print_usage (); elseif (! isscalar (n)) error ("hilb: N must be a scalar integer"); @@ -69,7 +69,7 @@ ## Very elegant solution by N. Higham ## https://nhigham.com/2020/06/30/what-is-the-hilbert-matrix/ j = 1:n; - retval = 1 ./ (j' + j - 1); + h = 1 ./ (j' + j - 1); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/invhilb.m --- a/scripts/special-matrix/invhilb.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/invhilb.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} invhilb (@var{n}) +## @deftypefn {} {@var{hinv} =} invhilb (@var{n}) ## Return the inverse of the Hilbert matrix of order @var{n}. ## ## This can be computed exactly using @@ -79,7 +79,7 @@ ## @seealso{hilb} ## @end deftypefn -function retval = invhilb (n) +function hinv = invhilb (n) if (nargin < 1) print_usage (); @@ -101,17 +101,17 @@ ## However, it rounds the answer to the nearest integer, which ## justifies the claim about exactness made above. - retval = zeros (n); + hinv = zeros (n); k = [1:n]; p = k .* bincoeff (k+n-1, k-1) .* bincoeff (n, k); p(2:2:n) = -p(2:2:n); if (n < 203) for l = 1:n - retval(l,:) = (p(l) * p) ./ [l:l+n-1]; + hinv(l,:) = (p(l) * p) ./ [l:l+n-1]; endfor else for l = 1:n - retval(l,:) = p(l) * (p ./ [l:l+n-1]); + hinv(l,:) = p(l) * (p ./ [l:l+n-1]); endfor endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/magic.m --- a/scripts/special-matrix/magic.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/magic.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} magic (@var{n}) +## @deftypefn {} {@var{M} =} magic (@var{n}) ## ## Create an @var{n}-by-@var{n} magic square. ## @@ -36,7 +36,7 @@ ## degenerate magic squares 1 and []. ## @end deftypefn -function A = magic (n) +function M = magic (n) if (nargin < 1) print_usage (); @@ -46,40 +46,40 @@ if (n < 0) error ("magic: N must be non-negative"); elseif (n < 1) - A = []; + M = []; elseif (mod (n, 2) == 1) shift = floor ((0:n*n-1)/n); c = mod ([1:n*n] - shift + (n-3)/2, n); r = mod ([n*n:-1:1] + 2*shift, n); - A(c*n+r+1) = 1:n*n; - A = reshape (A, n, n); + M(c*n+r+1) = 1:n*n; + M = reshape (M, n, n); elseif (mod (n, 4) == 0) - A = reshape (1:n*n, n, n)'; + M = reshape (1:n*n, n, n)'; I = [1:4:n, 4:4:n]; J = fliplr (I); - A(I,I) = A(J,J); + M(I,I) = M(J,J); I = [2:4:n, 3:4:n]; J = fliplr (I); - A(I,I) = A(J,J); + M(I,I) = M(J,J); elseif (mod (n, 4) == 2) m = n/2; - A = magic (m); - A = [A, A+2*m*m; A+3*m*m, A+m*m]; + M = magic (m); + M = [M, M+2*m*m; M+3*m*m, M+m*m]; k = (m-1)/2; if (k > 1) I = 1:m; J = [2:k, n-k+2:n]; - A([I,I+m],J) = A([I+m,I],J); + M([I,I+m],J) = M([I+m,I],J); endif I = [1:k, k+2:m]; - A([I,I+m],1) = A([I+m,I],1); + M([I,I+m],1) = M([I+m,I],1); I = k + 1; - A([I,I+m],I) = A([I+m,I],I); + M([I,I+m],I) = M([I+m,I],I); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/pascal.m --- a/scripts/special-matrix/pascal.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/pascal.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} pascal (@var{n}) -## @deftypefnx {} {} pascal (@var{n}, @var{t}) +## @deftypefn {} {@var{P} =} pascal (@var{n}) +## @deftypefnx {} {@var{P} =} pascal (@var{n}, @var{t}) ## Return the Pascal matrix of order @var{n} if @code{@var{t} = 0}. ## ## The default value of @var{t} is 0. @@ -45,7 +45,7 @@ ## @seealso{chol} ## @end deftypefn -function retval = pascal (n, t = 0) +function P = pascal (n, t = 0) if (nargin < 1) print_usage (); @@ -55,27 +55,27 @@ error ("pascal: T must be -1, 0, 1, or 2, found %d", t); endif - retval = zeros (n); + P = zeros (n); if (n > 0) - retval(:,1) = 1; + P(:,1) = 1; endif if (t == -1) for j = 2:n - retval(j:n,j) = cumsum (retval(j-1:n-1,j-1)); + P(j:n,j) = cumsum (P(j-1:n-1,j-1)); endfor else for j = 2:n - retval(j:n,j) = -cumsum (retval(j-1:n-1,j-1)); + P(j:n,j) = -cumsum (P(j-1:n-1,j-1)); endfor endif if (t == 0) - retval = retval*retval'; + P = P*P'; elseif (t == 2) - retval = rot90 (retval, 3); + P = rot90 (P, 3); if (rem (n,2) != 1) - retval *= -1; + P *= -1; endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/rosser.m --- a/scripts/special-matrix/rosser.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/rosser.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,23 +24,23 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rosser () +## @deftypefn {} {@var{R} =} rosser () ## Return the @nospell{Rosser} matrix. ## ## This is a difficult test case used to evaluate eigenvalue algorithms. ## @seealso{wilkinson, eig} ## @end deftypefn -function retval = rosser () +function R = rosser () - retval = [611, 196, -192, 407, -8, -52, -49, 29; - 196, 899, 113, -192, -71, -43, -8, -44; - -192, 113, 899, 196, 61, 49, 8, 52; - 407, -192, 196, 611, 8, 44, 59, -23; - -8, -71, 61, 8, 411, -599, 208, 208; - -52, -43, 49, 44, -599, 411, 208, 208; - -49, -8, 8, 59, 208, 208, 99, -911; - 29, -44, 52, -23, 208, 208, -911, 99]; + R = [611, 196, -192, 407, -8, -52, -49, 29; + 196, 899, 113, -192, -71, -43, -8, -44; + -192, 113, 899, 196, 61, 49, 8, 52; + 407, -192, 196, 611, 8, 44, 59, -23; + -8, -71, 61, 8, 411, -599, 208, 208; + -52, -43, 49, 44, -599, 411, 208, 208; + -49, -8, 8, 59, 208, 208, 99, -911; + 29, -44, 52, -23, 208, 208, -911, 99]; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/toeplitz.m --- a/scripts/special-matrix/toeplitz.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/toeplitz.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} toeplitz (@var{c}) -## @deftypefnx {} {} toeplitz (@var{c}, @var{r}) +## @deftypefn {} {@var{T} =} toeplitz (@var{c}) +## @deftypefnx {} {@var{T} =} toeplitz (@var{c}, @var{r}) ## Return the Toeplitz matrix constructed from the first column @var{c}, ## and optionally the first row @var{r}. ## @@ -63,7 +63,7 @@ ## @seealso{hankel} ## @end deftypefn -function retval = toeplitz (c, r) +function T = toeplitz (c, r) if (nargin < 1) print_usage (); @@ -90,7 +90,7 @@ if (nr == 0 || nc == 0) ## Empty matrix. - retval = zeros (nr, nc, class (c)); + T = zeros (nr, nc, class (c)); return; endif @@ -112,8 +112,8 @@ ridx = ridx(ridx > 1); ## Form matrix. - retval = spdiags (repmat (c(cidx),nr,1),1-cidx,nr,nc) + ... - spdiags (repmat (r(ridx),nr,1),ridx-1,nr,nc); + T = spdiags (repmat (c(cidx),nr,1),1-cidx,nr,nc) + ... + spdiags (repmat (r(ridx),nr,1),ridx-1,nr,nc); else ## Concatenate data into a single column vector. data = [r(end:-1:2)(:); c(:)]; @@ -122,7 +122,7 @@ slices = cellslices (data, nc:-1:1, nc+nr-1:-1:nr); ## Form matrix. - retval = horzcat (slices{:}); + T = horzcat (slices{:}); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/vander.m --- a/scripts/special-matrix/vander.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/vander.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} vander (@var{c}) -## @deftypefnx {} {} vander (@var{c}, @var{n}) +## @deftypefn {} {@var{V} =} vander (@var{c}) +## @deftypefnx {} {@var{V} =} vander (@var{c}, @var{n}) ## Return the @nospell{Vandermonde} matrix whose next to last column is ## @var{c}. ## @@ -58,11 +58,9 @@ ## @seealso{polyfit} ## @end deftypefn -function retval = vander (c, n) +function V = vander (c, n) - if (nargin == 1) - n = length (c); - elseif (nargin != 2) + if (nargin < 1) print_usage (); endif @@ -70,12 +68,18 @@ error ("vander: polynomial C must be a vector"); endif + if (nargin == 1) + n = length (c); + elseif (! isscalar (n)) + error ("vander: N must be a positive scalar integer"); + endif + ## avoiding many ^s appears to be faster for n >= 100. - retval = zeros (length (c), n, class (c)); + V = zeros (numel (c), n, class (c)); + c = c(:); d = 1; - c = c(:); for i = n:-1:1 - retval(:,i) = d; + V(:,i) = d; d .*= c; endfor @@ -95,5 +99,7 @@ %!assert (vander (2, 3), [4, 2, 1]) %!assert (vander ([2, 3], 3), [4, 2, 1; 9, 3, 1]) +## Test input validation %!error vander () %!error vander ([1, 2; 3, 4]) +%!error vander (1, [1, 2]) diff -r 0a1aec50a0c8 -r 960909469245 scripts/special-matrix/wilkinson.m --- a/scripts/special-matrix/wilkinson.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/special-matrix/wilkinson.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} wilkinson (@var{n}) +## @deftypefn {} {@var{W} =} wilkinson (@var{n}) ## Return the Wilkinson matrix of order @var{n}. ## ## Wilkinson matrices are symmetric and tridiagonal with pairs of nearly, but @@ -34,7 +34,7 @@ ## @seealso{rosser, eig} ## @end deftypefn -function retval = wilkinson (n) +function W = wilkinson (n) if (nargin < 1) print_usage (); @@ -46,7 +46,7 @@ side = ones (n-1, 1); center = abs (-(n-1)/2:(n-1)/2); - retval = diag (side, -1) + diag (center) + diag (side, 1); + W = diag (side, -1) + diag (center) + diag (side, 1); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/center.m --- a/scripts/statistics/center.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/center.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} center (@var{x}) -## @deftypefnx {} {} center (@var{x}, @var{dim}) +## @deftypefn {} {@var{y} =} center (@var{x}) +## @deftypefnx {} {@var{y} =} center (@var{x}, @var{dim}) ## Center data by subtracting its mean. ## ## If @var{x} is a vector, subtract its mean. @@ -42,7 +42,7 @@ ## @seealso{zscore} ## @end deftypefn -function retval = center (x, dim) +function y = center (x, dim) if (nargin < 1) print_usage (); @@ -70,12 +70,12 @@ n = size (x, dim); if (n == 0) - retval = x; + y = x; else ## FIXME: Use bsxfun, rather than broadcasting, until broadcasting ## supports diagonal and sparse matrices (Bugs #41441, #35787). - retval = bsxfun (@minus, x, mean (x, dim)); - ## retval = x - mean (x, dim); # automatic broadcasting + y = bsxfun (@minus, x, mean (x, dim)); + ## y = x - mean (x, dim); # automatic broadcasting endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/corr.m --- a/scripts/statistics/corr.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/corr.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} corr (@var{x}) -## @deftypefnx {} {} corr (@var{x}, @var{y}) +## @deftypefn {} {@var{r} =} corr (@var{x}) +## @deftypefnx {} {@var{r} =} corr (@var{x}, @var{y}) ## Compute matrix of correlation coefficients. ## ## If each row of @var{x} and @var{y} is an observation and each column is @@ -49,7 +49,7 @@ ## @seealso{cov} ## @end deftypefn -function retval = corr (x, y = []) +function r = corr (x, y = []) if (nargin < 1) print_usage (); @@ -60,9 +60,9 @@ ## Special case, scalar is always 100% correlated with itself if (isscalar (x)) if (isa (x, "single")) - retval = single (1); + r = single (1); else - retval = 1; + r = 1; endif return; endif @@ -72,11 +72,11 @@ if (nargin == 2) c = cov (x, y); s = std (x)' * std (y); - retval = c ./ s; + r = c ./ s; else c = cov (x); s = sqrt (diag (c)); - retval = c ./ (s * s'); + r = c ./ (s * s'); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/cov.m --- a/scripts/statistics/cov.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/cov.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cov (@var{x}) -## @deftypefnx {} {} cov (@var{x}, @var{opt}) -## @deftypefnx {} {} cov (@var{x}, @var{y}) -## @deftypefnx {} {} cov (@var{x}, @var{y}, @var{opt}) +## @deftypefn {} {@var{c} =} cov (@var{x}) +## @deftypefnx {} {@var{c} =} cov (@var{x}, @var{opt}) +## @deftypefnx {} {@var{c} =} cov (@var{x}, @var{y}) +## @deftypefnx {} {@var{c} =} cov (@var{x}, @var{y}, @var{opt}) ## Compute the covariance matrix. ## ## If each row of @var{x} and @var{y} is an observation, and each column is diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/discrete_cdf.m --- a/scripts/statistics/discrete_cdf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/discrete_cdf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} discrete_cdf (@var{x}, @var{v}, @var{p}) +## @deftypefn {} {@var{cdf} =} discrete_cdf (@var{x}, @var{v}, @var{p}) ## For each element of @var{x}, compute the cumulative distribution function ## (CDF) at @var{x} of a univariate discrete distribution which assumes the ## values in @var{v} with probabilities @var{p}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/discrete_inv.m --- a/scripts/statistics/discrete_inv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/discrete_inv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,13 +24,13 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} discrete_inv (@var{x}, @var{v}, @var{p}) +## @deftypefn {} {@var{q} =} discrete_inv (@var{x}, @var{v}, @var{p}) ## For each element of @var{x}, compute the quantile (the inverse of the CDF) ## at @var{x} of the univariate distribution which assumes the values in ## @var{v} with probabilities @var{p}. ## @end deftypefn -function inv = discrete_inv (x, v, p) +function q = discrete_inv (x, v, p) if (nargin != 3) print_usage (); @@ -47,9 +47,9 @@ endif if (isa (x, "single") || isa (v, "single") || isa (p, "single")) - inv = NaN (size (x), "single"); + q = NaN (size (x), "single"); else - inv = NaN (size (x)); + q = NaN (size (x)); endif ## FIXME: This isn't elegant. But cumsum and lookup together produce @@ -62,13 +62,13 @@ p = cumsum (p(idx)(:)) / sum (p); # Reshape and normalize probability vector k = (x == 0); - inv(k) = v(1); + q(k) = v(1); k = (x == 1); - inv(k) = v(end); + q(k) = v(end); k = (x > 0) & (x < 1); - inv(k) = v(length (p) - lookup (sort (p, "descend"), x(k)) + 1); + q(k) = v(length (p) - lookup (sort (p, "descend"), x(k)) + 1); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/discrete_pdf.m --- a/scripts/statistics/discrete_pdf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/discrete_pdf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} discrete_pdf (@var{x}, @var{v}, @var{p}) +## @deftypefn {} {@var{pdf} =} discrete_pdf (@var{x}, @var{v}, @var{p}) ## For each element of @var{x}, compute the probability density function (PDF) ## at @var{x} of a univariate discrete distribution which assumes the values ## in @var{v} with probabilities @var{p}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/discrete_rnd.m --- a/scripts/statistics/discrete_rnd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/discrete_rnd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} discrete_rnd (@var{v}, @var{p}) -## @deftypefnx {} {} discrete_rnd (@var{v}, @var{p}, @var{r}) -## @deftypefnx {} {} discrete_rnd (@var{v}, @var{p}, @var{r}, @var{c}, @dots{}) -## @deftypefnx {} {} discrete_rnd (@var{v}, @var{p}, [@var{sz}]) +## @deftypefn {} {@var{rnd} =} discrete_rnd (@var{v}, @var{p}) +## @deftypefnx {} {@var{rnd} =} discrete_rnd (@var{v}, @var{p}, @var{r}) +## @deftypefnx {} {@var{rnd} =} discrete_rnd (@var{v}, @var{p}, @var{r}, @var{c}, @dots{}) +## @deftypefnx {} {@var{rnd} =} discrete_rnd (@var{v}, @var{p}, [@var{sz}]) ## Return a matrix of random samples from the univariate distribution which ## assumes the values in @var{v} with probabilities @var{p}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/empirical_cdf.m --- a/scripts/statistics/empirical_cdf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/empirical_cdf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} empirical_cdf (@var{x}, @var{data}) +## @deftypefn {} {@var{cdf} =} empirical_cdf (@var{x}, @var{data}) ## For each element of @var{x}, compute the cumulative distribution function ## (CDF) at @var{x} of the empirical distribution obtained from ## the univariate sample @var{data}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/empirical_inv.m --- a/scripts/statistics/empirical_inv.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/empirical_inv.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,13 +24,13 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} empirical_inv (@var{x}, @var{data}) +## @deftypefn {} {@var{q} =} empirical_inv (@var{x}, @var{data}) ## For each element of @var{x}, compute the quantile (the inverse of the CDF) ## at @var{x} of the empirical distribution obtained from the ## univariate sample @var{data}. ## @end deftypefn -function inv = empirical_inv (x, data) +function q = empirical_inv (x, data) if (nargin != 2) print_usage (); @@ -40,7 +40,7 @@ error ("empirical_inv: DATA must be a vector"); endif - inv = discrete_inv (x, data, ones (size (data))); + q = discrete_inv (x, data, ones (size (data))); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/empirical_pdf.m --- a/scripts/statistics/empirical_pdf.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/empirical_pdf.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} empirical_pdf (@var{x}, @var{data}) +## @deftypefn {} {@var{pdf} =} empirical_pdf (@var{x}, @var{data}) ## For each element of @var{x}, compute the probability density function (PDF) ## at @var{x} of the empirical distribution obtained from the ## univariate sample @var{data}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/empirical_rnd.m --- a/scripts/statistics/empirical_rnd.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/empirical_rnd.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} empirical_rnd (@var{data}) -## @deftypefnx {} {} empirical_rnd (@var{data}, @var{r}) -## @deftypefnx {} {} empirical_rnd (@var{data}, @var{r}, @var{c}, @dots{}) -## @deftypefnx {} {} empirical_rnd (@var{data}, [@var{sz}]) +## @deftypefn {} {@var{rnd} =} empirical_rnd (@var{data}) +## @deftypefnx {} {@var{rnd} =} empirical_rnd (@var{data}, @var{r}) +## @deftypefnx {} {@var{rnd} =} empirical_rnd (@var{data}, @var{r}, @var{c}, @dots{}) +## @deftypefnx {} {@var{rnd} =} empirical_rnd (@var{data}, [@var{sz}]) ## Return a matrix of random samples from the empirical distribution obtained ## from the univariate sample @var{data}. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/kendall.m --- a/scripts/statistics/kendall.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/kendall.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} kendall (@var{x}) -## @deftypefnx {} {} kendall (@var{x}, @var{y}) +## @deftypefn {} {@var{tau} =} kendall (@var{x}) +## @deftypefnx {} {@var{tau} =} kendall (@var{x}, @var{y}) ## @cindex Kendall's Tau ## Compute Kendall's ## @tex diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/kurtosis.m --- a/scripts/statistics/kurtosis.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/kurtosis.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} kurtosis (@var{x}) -## @deftypefnx {} {} kurtosis (@var{x}, @var{flag}) -## @deftypefnx {} {} kurtosis (@var{x}, @var{flag}, @var{dim}) +## @deftypefn {} {@var{y} =} kurtosis (@var{x}) +## @deftypefnx {} {@var{y} =} kurtosis (@var{x}, @var{flag}) +## @deftypefnx {} {@var{y} =} kurtosis (@var{x}, @var{flag}, @var{dim}) ## Compute the sample kurtosis of the elements of @var{x}. ## ## The sample kurtosis is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/mad.m --- a/scripts/statistics/mad.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/mad.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} mad (@var{x}) -## @deftypefnx {} {} mad (@var{x}, @var{opt}) -## @deftypefnx {} {} mad (@var{x}, @var{opt}, @var{dim}) +## @deftypefn {} {@var{y} =} mad (@var{x}) +## @deftypefnx {} {@var{y} =} mad (@var{x}, @var{opt}) +## @deftypefnx {} {@var{y} =} mad (@var{x}, @var{opt}, @var{dim}) ## Compute the mean or median absolute deviation of the elements of @var{x}. ## ## The mean absolute deviation is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/mean.m --- a/scripts/statistics/mean.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/mean.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} mean (@var{x}) -## @deftypefnx {} {} mean (@var{x}, @var{dim}) -## @deftypefnx {} {} mean (@var{x}, @var{opt}) -## @deftypefnx {} {} mean (@var{x}, @var{dim}, @var{opt}) -## @deftypefnx {} {} mean (@dots{}, @var{outtype}) +## @deftypefn {} {@var{y} =} mean (@var{x}) +## @deftypefnx {} {@var{y} =} mean (@var{x}, @var{dim}) +## @deftypefnx {} {@var{y} =} mean (@var{x}, @var{opt}) +## @deftypefnx {} {@var{y} =} mean (@var{x}, @var{dim}, @var{opt}) +## @deftypefnx {} {@var{y} =} mean (@dots{}, @var{outtype}) ## Compute the mean of the elements of the vector @var{x}. ## ## The mean is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/meansq.m --- a/scripts/statistics/meansq.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/meansq.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} meansq (@var{x}) -## @deftypefnx {} {} meansq (@var{x}, @var{dim}) +## @deftypefn {} {@var{y} =} meansq (@var{x}) +## @deftypefnx {} {@var{y} =} meansq (@var{x}, @var{dim}) ## Compute the mean square of the elements of the vector @var{x}. ## ## The mean square is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/median.m --- a/scripts/statistics/median.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/median.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} median (@var{x}) -## @deftypefnx {} {} median (@var{x}, @var{dim}) +## @deftypefn {} {@var{y} =} median (@var{x}) +## @deftypefnx {} {@var{y} =} median (@var{x}, @var{dim}) ## Compute the median value of the elements of the vector @var{x}. ## ## When the elements of @var{x} are sorted, say @@ -60,7 +60,7 @@ ## @seealso{mean, mode} ## @end deftypefn -function retval = median (x, dim) +function y = median (x, dim) if (nargin < 1) print_usage (); @@ -88,16 +88,16 @@ n = size (x, dim); k = floor ((n+1) / 2); if (mod (n, 2) == 1) - retval = nth_element (x, k, dim); + y = nth_element (x, k, dim); else - retval = sum (nth_element (x, k:k+1, dim), dim, "native") / 2; + y = sum (nth_element (x, k:k+1, dim), dim, "native") / 2; if (islogical (x)) - retval = logical (retval); + y = logical (y); endif endif ## Inject NaNs where needed, to be consistent with Matlab. if (isfloat (x)) - retval(any (isnan (x), dim)) = NaN; + y(any (isnan (x), dim)) = NaN; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/mode.m --- a/scripts/statistics/mode.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/mode.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} mode (@var{x}) -## @deftypefnx {} {} mode (@var{x}, @var{dim}) +## @deftypefn {} {@var{m} =} mode (@var{x}) +## @deftypefnx {} {@var{m} =} mode (@var{x}, @var{dim}) ## @deftypefnx {} {[@var{m}, @var{f}, @var{c}] =} mode (@dots{}) ## Compute the most frequently occurring value in a dataset (mode). ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/moment.m --- a/scripts/statistics/moment.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/moment.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} moment (@var{x}, @var{p}) -## @deftypefnx {} {} moment (@var{x}, @var{p}, @var{type}) -## @deftypefnx {} {} moment (@var{x}, @var{p}, @var{dim}) -## @deftypefnx {} {} moment (@var{x}, @var{p}, @var{type}, @var{dim}) -## @deftypefnx {} {} moment (@var{x}, @var{p}, @var{dim}, @var{type}) +## @deftypefn {} {@var{m} =} moment (@var{x}, @var{p}) +## @deftypefnx {} {@var{m} =} moment (@var{x}, @var{p}, @var{type}) +## @deftypefnx {} {@var{m} =} moment (@var{x}, @var{p}, @var{dim}) +## @deftypefnx {} {@var{m} =} moment (@var{x}, @var{p}, @var{type}, @var{dim}) +## @deftypefnx {} {@var{m} =} moment (@var{x}, @var{p}, @var{dim}, @var{type}) ## Compute the @var{p}-th central moment of the vector @var{x}. ## ## The @var{p}-th central moment of @var{x} is defined as: diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/range.m --- a/scripts/statistics/range.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/range.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} range (@var{x}) -## @deftypefnx {} {} range (@var{x}, @var{dim}) +## @deftypefn {} {@var{y} =} range (@var{x}) +## @deftypefnx {} {@var{y} =} range (@var{x}, @var{dim}) ## Return the range, i.e., the difference between the maximum and the minimum ## of the input data. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/ranks.m --- a/scripts/statistics/ranks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/ranks.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ranks (@var{x}) -## @deftypefnx {} {} ranks (@var{x}, @var{dim}) -## @deftypefnx {} {} ranks (@var{x}, @var{dim}, @var{rtype}) +## @deftypefn {} {@var{y} =} ranks (@var{x}) +## @deftypefnx {} {@var{y} =} ranks (@var{x}, @var{dim}) +## @deftypefnx {} {@var{y} =} ranks (@var{x}, @var{dim}, @var{rtype}) ## Return the ranks (in the sense of order statistics) of @var{x} along the ## first non-singleton dimension adjusted for ties. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/run_count.m --- a/scripts/statistics/run_count.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/run_count.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} run_count (@var{x}, @var{n}) -## @deftypefnx {} {} run_count (@var{x}, @var{n}, @var{dim}) +## @deftypefn {} {@var{cnt} =} run_count (@var{x}, @var{n}) +## @deftypefnx {} {@var{cnt} =} run_count (@var{x}, @var{n}, @var{dim}) ## Count the upward runs along the first non-singleton dimension of @var{x} ## of length 1, 2, @dots{}, @var{n}-1 and greater than or equal to @var{n}. ## @@ -34,7 +34,7 @@ ## @seealso{runlength} ## @end deftypefn -function retval = run_count (x, n, dim) +function cnt = run_count (x, n, dim) if (nargin < 2) print_usage (); @@ -44,7 +44,7 @@ error ("run_count: X must be a numeric vector or matrix"); endif - if (!(isscalar (n) && n == fix (n) && n > 0)) + if (! (isscalar (n) && n == fix (n) && n > 0)) error ("run_count: N must be a positive integer"); endif @@ -82,16 +82,16 @@ tmp = tmp(idx{:}); sz(1) = n; - retval = zeros (sz); + cnt = zeros (sz); for k = 1 : (n-1) idx{1} = k; - retval(idx{:}) = sum (tmp == k); + cnt(idx{:}) = sum (tmp == k); endfor idx{1} = n; - retval(idx{:}) = sum (tmp >= n); + cnt(idx{:}) = sum (tmp >= n); if (dim != 1) - retval = ipermute (retval, perm); + cnt = ipermute (cnt, perm); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/skewness.m --- a/scripts/statistics/skewness.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/skewness.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} skewness (@var{x}) -## @deftypefnx {} {} skewness (@var{x}, @var{flag}) -## @deftypefnx {} {} skewness (@var{x}, @var{flag}, @var{dim}) +## @deftypefn {} {@var{y} =} skewness (@var{x}) +## @deftypefnx {} {@var{y} =} skewness (@var{x}, @var{flag}) +## @deftypefnx {} {@var{y} =} skewness (@var{x}, @var{flag}, @var{dim}) ## Compute the sample skewness of the elements of @var{x}. ## ## The sample skewness is defined as diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/spearman.m --- a/scripts/statistics/spearman.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/spearman.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} spearman (@var{x}) -## @deftypefnx {} {} spearman (@var{x}, @var{y}) +## @deftypefn {} {@var{rho} =} spearman (@var{x}) +## @deftypefnx {} {@var{rho} =} spearman (@var{x}, @var{y}) ## @cindex Spearman's Rho ## Compute Spearman's rank correlation coefficient ## @tex diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/statistics.m --- a/scripts/statistics/statistics.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/statistics.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} statistics (@var{x}) -## @deftypefnx {} {} statistics (@var{x}, @var{dim}) +## @deftypefn {} {@var{stats} =} statistics (@var{x}) +## @deftypefnx {} {@var{stats} =} statistics (@var{x}, @var{dim}) ## Return a vector with the minimum, first quartile, median, third quartile, ## maximum, mean, standard deviation, skewness, and kurtosis of the elements of ## the vector @var{x}. diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/std.m --- a/scripts/statistics/std.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/statistics/std.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,10 +24,10 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} std (@var{x}) -## @deftypefnx {} {} std (@var{x}, @var{w}) -## @deftypefnx {} {} std (@var{x}, @var{w}, @var{dim}) -## @deftypefnx {} {} std (@var{x}, @var{w}, @qcode{"ALL"}) +## @deftypefn {} {@var{y} =} std (@var{x}) +## @deftypefnx {} {@var{y} =} std (@var{x}, @var{w}) +## @deftypefnx {} {@var{y} =} std (@var{x}, @var{w}, @var{dim}) +## @deftypefnx {} {@var{y} =} std (@var{x}, @var{w}, @qcode{"ALL"}) ## Compute the standard deviation of the elements of the vector @var{x}. ## ## The standard deviation is defined as @@ -87,9 +87,9 @@ ## @seealso{var, bounds, mad, range, iqr, mean, median} ## @end deftypefn -function retval = std (varargin) +function y = std (varargin) - retval = sqrt (var (varargin{:})); + y = sqrt (var (varargin{:})); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/statistics/var.m diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/base2dec.m --- a/scripts/strings/base2dec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/base2dec.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} base2dec (@var{s}, @var{base}) -## Convert @var{s} from a string of digits in base @var{base} to a decimal +## @deftypefn {} {@var{d} =} base2dec (@var{str}, @var{base}) +## Convert @var{str} from a string of digits in base @var{base} to a decimal ## integer (base 10). ## ## @example @@ -35,15 +35,16 @@ ## @end group ## @end example ## -## 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 +## If @var{str} is a string matrix, return a column vector with one value per +## row of @var{str}. If a row contains invalid symbols then the 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}. +## If @var{str} is a cell array of strings, return a column vector with one +## value per cell element in @var{str}. ## ## If @var{base} is a string, the characters of @var{base} are used as the -## symbols for the digits of @var{s}. Space (' ') may not be used as a symbol. +## symbols for the digits of @var{str}. Space (' ') may not be used as a +## symbol. ## ## @example ## @group @@ -54,16 +55,16 @@ ## @seealso{dec2base, bin2dec, hex2dec} ## @end deftypefn -function out = base2dec (s, base) +function d = base2dec (str, base) if (nargin != 2) print_usage (); endif - if (iscellstr (s)) - s = char (s); - elseif (! ischar (s)) - error ("base2dec: S must be a string or cellstring"); + if (iscellstr (str)) + str = char (str); + elseif (! ischar (str)) + error ("base2dec: STR must be a string or cellstring"); endif symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -81,16 +82,16 @@ elseif (! (base >= 2 && base <= length (symbols))) error ("base2dec: BASE must be between 2 and 36, or a string of symbols"); else - s = toupper (s); + str = toupper (str); endif ## Right justify the values and squeeze out any spaces. ## This looks complicated, but indexing solution is very fast ## compared to alternatives which use cellstr or cellfun or looping. - [nr, nc] = size (s); + [nr, nc] = size (str); if (nc > 1) # Bug #35621 - s = s.'; - nonbl = s != " "; + str = str.'; + nonbl = str != " "; num_nonbl = sum (nonbl); nc = max (num_nonbl); num_blank = nc - num_nonbl; @@ -102,8 +103,8 @@ ## Create a blank matrix and position the nonblank characters. s2 = repmat (" ", nc, nr); - s2(idx) = s(nonbl); - s = s2.'; + s2(idx) = str(nonbl); + str = s2.'; endif ## Lookup value of symbols in symbol table, with invalid symbols @@ -111,11 +112,11 @@ table = NaN (1, 256); table(double (symbols(1:base))) = 0 : base-1; table(double (" ")) = 0; - s = reshape (table(double (s)), size (s)); + str = reshape (table(double (str)), size (str)); ## Multiply the resulting digits by the appropriate power ## and sum the rows. - out = s * (base .^ (columns (s)-1 : -1 : 0)'); + d = str * (base .^ (columns (str)-1 : -1 : 0)'); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/bin2dec.m --- a/scripts/strings/bin2dec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/bin2dec.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} bin2dec (@var{s}) +## @deftypefn {} {} bin2dec (@var{str}) ## Return the decimal number corresponding to the binary number represented -## by the string @var{s}. +## by the string @var{str}. ## ## For example: ## @@ -47,21 +47,21 @@ ## @end group ## @end example ## -## If @var{s} is a string matrix, return a column vector with one converted -## number per row of @var{s}; Invalid rows evaluate to NaN@. +## If @var{str} is a string matrix, return a column vector with one converted +## number per row of @var{str}; Invalid rows evaluate to NaN@. ## -## If @var{s} is a cell array of strings, return a column vector with one -## converted number per cell element in @var{s}. +## If @var{str} is a cell array of strings, return a column vector with one +## converted number per cell element in @var{str}. ## @seealso{dec2bin, base2dec, hex2dec} ## @end deftypefn -function d = bin2dec (s) +function d = bin2dec (str) - if (nargin < 1) + if (nargin != 1) print_usage (); endif - d = base2dec (s, 2); + d = base2dec (str, 2); endfunction @@ -76,4 +76,4 @@ ## Test input validation %!error bin2dec () -%!error bin2dec (1) +%!error bin2dec (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/blanks.m --- a/scripts/strings/blanks.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/blanks.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} blanks (@var{n}) +## @deftypefn {} {@var{str} =} blanks (@var{n}) ## Return a string of @var{n} blanks. ## ## For example: @@ -42,7 +42,7 @@ ## @seealso{repmat} ## @end deftypefn -function s = blanks (n) +function str = blanks (n) if (nargin < 1) print_usage (); @@ -52,7 +52,7 @@ ## If 1:n is empty, the following expression will create an empty ## character string. Otherwise, it will create a row vector. - s(1:n) = " "; + str(1:n) = " "; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/cstrcat.m --- a/scripts/strings/cstrcat.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/cstrcat.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} cstrcat (@var{s1}, @var{s2}, @dots{}) +## @deftypefn {} {@var{str} =} cstrcat (@var{s1}, @var{s2}, @dots{}) ## Return a string containing all the arguments concatenated horizontally ## with trailing white space preserved. ## @@ -48,14 +48,14 @@ ## @seealso{strcat, char, strvcat} ## @end deftypefn -function st = cstrcat (varargin) +function str = cstrcat (varargin) if (nargin == 0) - ## Special because if varargin is empty, iscellstr still returns + ## Special case because if varargin is empty, iscellstr still returns ## true but then "[varargin{:}]" would be of class double. - st = ""; + str = ""; elseif (iscellstr (varargin)) - st = [varargin{:}]; + str = [varargin{:}]; else error ("cstrcat: arguments must be character strings"); endif @@ -64,15 +64,16 @@ ## Test the dimensionality -## 1d +## 1-D %!assert (cstrcat ("ab ", "ab "), "ab ab ") -## 2d +## 2-D %!assert (cstrcat (["ab ";"cde"], ["ab ";"cde"]), ["ab ab ";"cdecde"]) %!assert (cstrcat ("foo", "bar"), "foobar") %!assert (cstrcat (["a "; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"]) +## Special null case %!assert (cstrcat (), "") ## Test input validation -%!error cstrcat (1, 2) +%!error cstrcat (1, 2) diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/deblank.m --- a/scripts/strings/deblank.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/deblank.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} deblank (@var{s}) +## @deftypefn {} {@var{s} =} deblank (@var{s}) ## Remove trailing whitespace and nulls from @var{s}. ## ## If @var{s} is a matrix, @var{deblank} trims each row to the length of -## longest string. If @var{s} is a cell array of strings, operate +## the longest string. If @var{s} is a cell array of strings, operate ## recursively on each string element. ## ## Examples: @@ -47,7 +47,7 @@ function s = deblank (s) - if (nargin < 1) + if (nargin != 1) print_usage (); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/dec2base.m --- a/scripts/strings/dec2base.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/dec2base.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} dec2base (@var{d}, @var{base}) -## @deftypefnx {} {} dec2base (@var{d}, @var{base}, @var{len}) +## @deftypefn {} {@var{str} =} dec2base (@var{d}, @var{base}) +## @deftypefnx {} {@var{str} =} dec2base (@var{d}, @var{base}, @var{len}) ## Return a string of symbols in base @var{base} corresponding to the ## non-negative integer @var{d}. ## @@ -56,7 +56,7 @@ ## @seealso{base2dec, dec2bin, dec2hex} ## @end deftypefn -function retval = dec2base (d, base, len) +function str = dec2base (d, base, len) if (nargin < 2) print_usage (); @@ -109,7 +109,7 @@ endfor ## convert digits to symbols - retval = reshape (symbols(digits+1), size (digits)); + str = reshape (symbols(digits+1), size (digits)); ## Check if the first element is the zero symbol. It seems possible ## that LEN is provided, and is less than the computed MAX_LEN and @@ -117,8 +117,8 @@ ## have a leading zero to remove. But if LEN >= MAX_LEN, we should ## not remove any leading zeros. if ((nargin == 2 || (nargin == 3 && max_len > len)) - && columns (retval) != 1 && ! any (retval(:,1) != symbols(1))) - retval = retval(:,2:end); + && columns (str) != 1 && ! any (str(:,1) != symbols(1))) + str = str(:,2:end); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/dec2bin.m --- a/scripts/strings/dec2bin.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/dec2bin.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} dec2bin (@var{d}) -## @deftypefnx {} {} dec2bin (@var{d}, @var{len}) +## @deftypefn {} {@var{bstr} =} dec2bin (@var{d}) +## @deftypefnx {} {@var{bstr} =} dec2bin (@var{d}, @var{len}) ## Return a string of ones and zeros representing the conversion of the integer ## @var{d} to a binary number. ## @@ -63,7 +63,7 @@ ## @seealso{bin2dec, dec2base, dec2hex} ## @end deftypefn -function b = dec2bin (d, len) +function bstr = dec2bin (d, len) if (nargin == 0) print_usage (); @@ -92,9 +92,9 @@ endif if (nargin == 1) - b = dec2base (d, 2); + bstr = dec2base (d, 2); else - b = dec2base (d, 2, len); + bstr = dec2base (d, 2, len); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/dec2hex.m --- a/scripts/strings/dec2hex.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/dec2hex.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} dec2hex (@var{d}) -## @deftypefnx {} {} dec2hex (@var{d}, @var{len}) +## @deftypefn {} {@var{hstr} =} dec2hex (@var{d}) +## @deftypefnx {} {@var{hstr} =} dec2hex (@var{d}, @var{len}) ## Return a string representing the conversion of the integer @var{d} to a ## hexadecimal (base16) number. ## @@ -53,7 +53,7 @@ ## @seealso{hex2dec, dec2base, dec2bin} ## @end deftypefn -function h = dec2hex (d, len) +function hstr = dec2hex (d, len) if (nargin == 0) print_usage (); @@ -82,9 +82,9 @@ endif if (nargin == 1) - h = dec2base (d, 16); + hstr = dec2base (d, 16); else - h = dec2base (d, 16, len); + hstr = dec2base (d, 16, len); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/hex2dec.m --- a/scripts/strings/hex2dec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/hex2dec.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} hex2dec (@var{s}) +## @deftypefn {} {@var{d} =} hex2dec (@var{str}) ## Return the integer corresponding to the hexadecimal number represented by -## the string @var{s}. +## the string @var{str}. ## ## For example: ## @@ -39,22 +39,22 @@ ## @end group ## @end example ## -## If @var{s} is a string matrix, return a column vector with one converted -## number per row of @var{s}; Invalid rows evaluate to NaN@. +## If @var{str} is a string matrix, return a column vector with one converted +## number per row of @var{str}; Invalid rows evaluate to NaN@. ## -## If @var{s} is a cell array of strings, return a column vector with one -## converted number per cell element in @var{s}. +## If @var{str} is a cell array of strings, return a column vector with one +## converted number per cell element in @var{str}. ## ## @seealso{dec2hex, base2dec, bin2dec} ## @end deftypefn -function d = hex2dec (s) +function d = hex2dec (str) - if (nargin < 1) + if (nargin != 1) print_usage (); endif - d = base2dec (s, 16); + d = base2dec (str, 16); endfunction @@ -66,4 +66,4 @@ ## Test input validation %!error hex2dec () -%!error hex2dec (1) +%!error hex2dec (1) diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/index.m --- a/scripts/strings/index.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/index.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} index (@var{s}, @var{t}) -## @deftypefnx {} {} index (@var{s}, @var{t}, @var{direction}) +## @deftypefn {} {@var{n} =} index (@var{s}, @var{t}) +## @deftypefnx {} {@var{n} =} index (@var{s}, @var{t}, @var{direction}) ## Return the position of the first occurrence of the string @var{t} in the ## string @var{s}, or 0 if no occurrence is found. ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/isletter.m --- a/scripts/strings/isletter.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/isletter.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isletter (@var{s}) +## @deftypefn {} {@var{tf} =} isletter (@var{s}) ## Return a logical array which is true where the elements of @var{s} ## are letters and false where they are not. ## @@ -32,13 +32,13 @@ ## @seealso{isalpha, isdigit, ispunct, isspace, iscntrl, isalnum} ## @end deftypefn -function retval = isletter (s) +function tf = isletter (s) if (nargin < 1) print_usage (); endif - retval = isalpha (s); + tf = isalpha (s); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/isstring.m --- a/scripts/strings/isstring.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/isstring.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isstring (@var{s}) +## @deftypefn {} {@var{tf} =} isstring (@var{s}) ## Return true if @var{s} is a string array. ## ## A string array is a data type that stores strings (row vectors of @@ -40,13 +40,13 @@ ## @seealso{ischar, iscellstr, isfloat, isinteger, islogical, isnumeric, isa} ## @end deftypefn -function retval = isstring (s) +function tf = isstring (s) if (nargin < 1) print_usage (); endif - retval = false; + tf = false; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/isstrprop.m --- a/scripts/strings/isstrprop.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/isstrprop.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} isstrprop (@var{str}, @var{prop}) +## @deftypefn {} {@var{tf} =} isstrprop (@var{str}, @var{prop}) ## Test character string properties. ## ## For example: @@ -91,7 +91,7 @@ ## isspace, ispunct, iscntrl, isgraph, isprint, isascii} ## @end deftypefn -function retval = isstrprop (str, prop) +function tf = isstrprop (str, prop) if (nargin != 2) print_usage (); @@ -99,29 +99,29 @@ switch (prop) case "alpha" - retval = isalpha (str); + tf = isalpha (str); case {"alnum", "alphanum"} - retval = isalnum (str); + tf = isalnum (str); case "ascii" - retval = isascii (str); + tf = isascii (str); case "cntrl" - retval = iscntrl (str); + tf = iscntrl (str); case "digit" - retval = isdigit (str); + tf = isdigit (str); case {"graph", "graphic"} - retval = isgraph (str); + tf = isgraph (str); case "lower" - retval = islower (str); + tf = islower (str); case "print" - retval = isprint (str); + tf = isprint (str); case "punct" - retval = ispunct (str); + tf = ispunct (str); case {"space", "wspace"} - retval = isspace (str); + tf = isspace (str); case "upper" - retval = isupper (str); + tf = isupper (str); case "xdigit" - retval = isxdigit (str); + tf = isxdigit (str); otherwise error ("isstrprop: invalid string property"); endswitch diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/regexptranslate.m --- a/scripts/strings/regexptranslate.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/regexptranslate.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} regexptranslate (@var{op}, @var{s}) +## @deftypefn {} {@var{str} =} regexptranslate (@var{op}, @var{s}) ## Translate a string for use in a regular expression. ## ## This may include either wildcard replacement or special character escaping. @@ -59,7 +59,7 @@ ## @seealso{regexp, regexpi, regexprep} ## @end deftypefn -function y = regexptranslate (op, s) +function str = regexptranslate (op, s) if (nargin != 2) print_usage (); @@ -71,11 +71,11 @@ op = tolower (op); if (strcmp ("wildcard", op)) - y = strrep (strrep (strrep (s, '.', '\.'), - '*', '.*'), - '?', '.'); + str = strrep (strrep (strrep (s, '.', '\.'), + '*', '.*'), + '?', '.'); elseif (strcmp ("escape", op)) - y = regexprep (s, '([][(){}.*+?^$|\\])', '\\$1'); + str = regexprep (s, '([][(){}.*+?^$|\\])', '\\$1'); else error ("regexptranslate: invalid operation OP"); endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/rindex.m --- a/scripts/strings/rindex.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/rindex.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} rindex (@var{s}, @var{t}) +## @deftypefn {} {@var{n} =} rindex (@var{s}, @var{t}) ## Return the position of the last occurrence of the character string ## @var{t} in the character string @var{s}, or 0 if no occurrence is ## found. diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/strcat.m --- a/scripts/strings/strcat.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/strcat.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} strcat (@var{s1}, @var{s2}, @dots{}) -## Return a string containing all the arguments concatenated -## horizontally. +## @deftypefn {} {@var{str} =} strcat (@var{s1}, @var{s2}, @dots{}) +## Return a string containing all the arguments concatenated horizontally. ## ## If the arguments are cell strings, @code{strcat} returns a cell string ## with the individual cells concatenated. For numerical input, each element @@ -83,15 +82,15 @@ ## @seealso{cstrcat, char, strvcat} ## @end deftypefn -function st = strcat (varargin) +function str = strcat (varargin) if (nargin == 0) - st = ""; + str = ""; elseif (nargin == 1) if (iscellstr (varargin{1})) - st = varargin{1}; + str = varargin{1}; elseif (isreal (varargin{1}) || ischar (varargin{1})) - st = char (cellstr (varargin{1})); + str = char (cellstr (varargin{1})); else error ("strcat: inputs must be strings or cells of strings"); endif @@ -118,11 +117,11 @@ endif ## Cellfun handles everything for us. - st = cellfun ("horzcat", varargin{:}, uo, false); + str = cellfun ("horzcat", varargin{:}, uo, false); if (allchar) ## If all inputs were strings, return strings. - st = char (st); + str = char (str); endif endif diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/strjust.m --- a/scripts/strings/strjust.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/strjust.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} strjust (@var{s}) -## @deftypefnx {} {} strjust (@var{s}, @var{pos}) +## @deftypefn {} {@var{str} =} strjust (@var{s}) +## @deftypefnx {} {@var{str} =} strjust (@var{s}, @var{pos}) ## Return the text, @var{s}, justified according to @var{pos}, which may ## be @qcode{"left"}, @qcode{"center"}, or @qcode{"right"}. ## @@ -49,7 +49,7 @@ ## @seealso{deblank, strrep, strtrim, untabify} ## @end deftypefn -function y = strjust (s, pos = "right") +function str = strjust (s, pos = "right") if (nargin < 1) print_usage (); @@ -58,7 +58,7 @@ endif if (isempty (s)) - y = s; + str = s; return; endif @@ -94,11 +94,11 @@ endif ## Adjust the column indices. - jdx += shift (idx); + jdx += shift(idx); ## Create a blank matrix and position the nonblank characters. - y = repmat (" ", nr, nc); - y(sub2ind ([nr, nc], idx, jdx)) = s(nonbl); + str = repmat (" ", nr, nc); + str(sub2ind ([nr, nc], idx, jdx)) = s(nonbl); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/strtrim.m --- a/scripts/strings/strtrim.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/strtrim.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} strtrim (@var{s}) +## @deftypefn {} {@var{s} =} strtrim (@var{s}) ## Remove leading and trailing whitespace from @var{s}. ## ## If @var{s} is a matrix, @var{strtrim} trims each row to the length of diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/strtrunc.m --- a/scripts/strings/strtrunc.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/strtrunc.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} strtrunc (@var{s}, @var{n}) +## @deftypefn {} {@var{s} =} strtrunc (@var{s}, @var{n}) ## Truncate the character string @var{s} to length @var{n}. ## ## If @var{s} is a character matrix, then the number of columns is adjusted. diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/substr.m --- a/scripts/strings/substr.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/substr.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} substr (@var{s}, @var{offset}) +## @deftypefn {} {@var{str} =} substr (@var{s}, @var{offset}) ## @deftypefnx {} {} substr (@var{s}, @var{offset}, @var{len}) ## Return the substring of @var{s} which starts at character number ## @var{offset} and is @var{len} characters long. @@ -52,7 +52,7 @@ ## This function is patterned after the equivalent function in Perl. ## @end deftypefn -function t = substr (s, offset, len) +function str = substr (s, offset, len) if (nargin < 2) print_usage (); @@ -91,7 +91,7 @@ error ("substr: No overlap with chosen values of OFFSET and LEN"); endif - t = s(:, offset:eos); + str = s(:, offset:eos); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/strings/untabify.m --- a/scripts/strings/untabify.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/strings/untabify.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,9 +24,9 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} untabify (@var{t}) -## @deftypefnx {} {} untabify (@var{t}, @var{tw}) -## @deftypefnx {} {} untabify (@var{t}, @var{tw}, @var{deblank}) +## @deftypefn {} {@var{str} =} untabify (@var{t}) +## @deftypefnx {} {@var{str} =} untabify (@var{t}, @var{tw}) +## @deftypefnx {} {@var{str} =} untabify (@var{t}, @var{tw}, @var{deblank}) ## Replace TAB characters in @var{t} with spaces. ## ## The input, @var{t}, may be either a 2-D character array, or a cell array of @@ -55,7 +55,7 @@ ## @seealso{strjust, strsplit, deblank} ## @end deftypefn -function s = untabify (t, tw = 8, deblank_arg = false) +function str = untabify (t, tw = 8, deblank_arg = false) if (nargin < 1) print_usage (); @@ -64,13 +64,13 @@ endif if (ischar (t)) - s = replace_tabs (t, tw); + str = replace_tabs (t, tw); else - s = cellfun (@replace_tabs, t, {tw}, "uniformoutput", false); + str = cellfun (@replace_tabs, t, {tw}, "uniformoutput", false); endif if (deblank_arg) - s = deblank (s); + str = deblank (str); endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/testfun/__have_feature__.m --- a/scripts/testfun/__have_feature__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/testfun/__have_feature__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,11 +24,11 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __have_feature__ (feature) +## @deftypefn {} {@var{tf} =} __have_feature__ (feature) ## Undocumented internal function. ## @end deftypefn -function retval = __have_feature__ (feature) +function tf = __have_feature__ (feature) if (strncmp (feature, "ENABLE_", 7)) features = __octave_config_info__ (); @@ -37,12 +37,12 @@ endif if (iscellstr (feature)) - retval = (all (isfield (features, feature)) + tf = (all (isfield (features, feature)) && all (cellfun (@(x) features.(x), feature))); elseif (ischar (feature)) - retval = isfield (features, feature) && features.(feature); + tf = isfield (features, feature) && features.(feature); else - retval = false; + tf = false; endif endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/testfun/__prog_output_assert__.m --- a/scripts/testfun/__prog_output_assert__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/testfun/__prog_output_assert__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,19 +24,19 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __prog_output_assert__ (@var{str}) +## @deftypefn {} {@var{retval} =} __prog_output_assert__ (@var{str}) ## Undocumented internal function. ## @end deftypefn -function ret = __prog_output_assert__ (str) +function retval = __prog_output_assert__ (str) global __assert_printf__ = ""; if (isempty (__assert_printf__)) - ret = isempty (str); + retval = isempty (str); elseif (__assert_printf__(end) == "\n") - ret = strcmp (__assert_printf__(1:(end-1)), str); + retval = strcmp (__assert_printf__(1:(end-1)), str); else - ret = strcmp (__assert_printf__, str); + retval = strcmp (__assert_printf__, str); endif __assert_printf__ = ""; diff -r 0a1aec50a0c8 -r 960909469245 scripts/testfun/__run_test_suite__.m --- a/scripts/testfun/__run_test_suite__.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/testfun/__run_test_suite__.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} __run_test_suite__ (@var{fcndirs}, @var{fixedtestdirs}) -## @deftypefnx {} {} __run_test_suite__ (@var{fcndirs}, @var{fixedtestdirs}, @var{topsrcdir}, @var{topbuilddir}) +## @deftypefn {} {[@var{pass}, @var{fail}, @var{xfail}, @var{xbug}, @var{skip}, @var{rtskip}, @var{regress}]} __run_test_suite__ (@var{fcndirs}, @var{fixedtestdirs}) +## @deftypefnx {} {[@var{pass}, @var{fail}, @var{xfail}, @var{xbug}, @var{skip}, @var{rtskip}, @var{regress}]} __run_test_suite__ (@var{fcndirs}, @var{fixedtestdirs}, @var{topsrcdir}, @var{topbuilddir}) ## Undocumented internal function. ## @end deftypefn diff -r 0a1aec50a0c8 -r 960909469245 scripts/testfun/example.m --- a/scripts/testfun/example.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/testfun/example.m Sun Apr 03 11:30:26 2022 -0400 @@ -28,7 +28,7 @@ ## @deftypefnx {} {} example @var{name} @var{n} ## @deftypefnx {} {} example ("@var{name}") ## @deftypefnx {} {} example ("@var{name}", @var{n}) -## @deftypefnx {} {[@var{s}, @var{idx}] =} example (@dots{}) +## @deftypefnx {} {[@var{codestr}, @var{codeidx}] =} example (@dots{}) ## ## Display the code for example @var{n} associated with the function ## @var{name}, but do not run it. @@ -36,14 +36,14 @@ ## If @var{n} is not specified, all examples are displayed. ## ## When called with output arguments, the examples are returned in the form of -## a string @var{s}, with @var{idx} indicating the ending position of the -## various examples. +## a string @var{codestr}, with @var{codeidx} indicating the ending position of +## the various examples. ## ## For a complete explanation @pxref{XREFdemo,,@code{demo}}. ## @seealso{demo, test} ## @end deftypefn -function [ex_code, ex_idx] = example (name, n = 0) +function [codestr, codeidx] = example (name, n = 0) if (nargin < 1) print_usage (); @@ -74,15 +74,15 @@ if (nargout > 0) if (n > 0) if (n <= length (idx)) - ex_code = code(idx(n):idx(n+1)-1); - ex_idx = [1, length(ex_code)+1]; + codestr = code(idx(n):idx(n+1)-1); + codeidx = [1, length(codestr)+1]; else - ex_code = ""; - ex_idx = []; + codestr = ""; + codeidx = []; endif else - ex_code = code; - ex_idx = idx; + codestr = code; + codeidx = idx; endif else if (n > 0) diff -r 0a1aec50a0c8 -r 960909469245 scripts/testfun/fail.m --- a/scripts/testfun/fail.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/testfun/fail.m Sun Apr 03 11:30:26 2022 -0400 @@ -27,10 +27,10 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {} {} fail (@var{code}) -## @deftypefnx {} {} fail (@var{code}, @var{pattern}) -## @deftypefnx {} {} fail (@var{code}, "warning") -## @deftypefnx {} {} fail (@var{code}, "warning", @var{pattern}) +## @deftypefn {} {@var{status} =} fail (@var{code}) +## @deftypefnx {} {@var{status} =} fail (@var{code}, @var{pattern}) +## @deftypefnx {} {@var{status} =} fail (@var{code}, "warning") +## @deftypefnx {} {@var{status} =} fail (@var{code}, "warning", @var{pattern}) ## ## Return true if @var{code} fails with an error message matching ## @var{pattern}, otherwise produce an error. @@ -65,7 +65,7 @@ ## @seealso{assert, error} ## @end deftypefn -function retval = fail (code, pattern, warning_pattern) +function status = fail (code, pattern, warning_pattern) if (nargin < 1) print_usage (); @@ -95,7 +95,7 @@ ## Allow assert (fail ()) if (nargout) - retval = true; + status = true; endif if (test_warning) diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/asctime.m --- a/scripts/time/asctime.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/asctime.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} asctime (@var{tm_struct}) +## @deftypefn {} {@var{str} =} asctime (@var{tm_struct}) ## Convert a time structure to a string using the following ## format: @qcode{"ddd mmm mm HH:MM:SS yyyy@backslashchar{}n"}. ## @@ -41,13 +41,13 @@ ## @seealso{ctime, localtime, time} ## @end deftypefn -function retval = asctime (tm_struct) +function str = asctime (tm_struct) if (nargin < 1) print_usage (); endif - retval = strftime ("%a %b %d %H:%M:%S %Y\n", tm_struct); + str = strftime ("%a %b %d %H:%M:%S %Y\n", tm_struct); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/calendar.m --- a/scripts/time/calendar.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/calendar.m Sun Apr 03 11:30:26 2022 -0400 @@ -41,7 +41,7 @@ ## @seealso{datenum, datestr} ## @end deftypefn -function varargout = calendar (varargin) +function c = calendar (y, m) switch (nargin) case 0 @@ -49,31 +49,30 @@ y = v(1); m = v(2); d = v(3); + case 1 - v = datevec (varargin{1}); + v = datevec (y); y = v(1); m = v(2); d = v(3); + case 2 - y = varargin{1}; - m = varargin{2}; d = []; - otherwise - print_usage (); + endswitch - c = zeros (7, 6); + cal = zeros (7, 6); dayone = datenum (y, m, 1); ndays = eomday (y, m); - c(weekday (dayone) - 1 + [1:ndays]) = 1:ndays; + cal(weekday (dayone) - 1 + [1:ndays]) = 1:ndays; if (nargout > 0) - varargout{1} = c'; + c = cal'; else ## Layout the calendar days, 6 columns per day, 7 days per row. - str = sprintf (" %2d %2d %2d %2d %2d %2d %2d\n", c); + str = sprintf (" %2d %2d %2d %2d %2d %2d %2d\n", cal); - ## Print an asterisk before the specified date + ## Print an asterisk before the specified date. if (! isempty (d)) pos = weekday (dayone) + d - 1; idx = 6*pos + fix (pos / 7.1) - ifelse (d < 10, 1, 2); @@ -101,6 +100,3 @@ %!assert ((calendar(2000,2))'(2:31), [0:29]) %!assert ((calendar(1957,10))'(2:33), [0:31]) - -## Test input validation -%!error calendar (1,2,3) diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/clock.m --- a/scripts/time/clock.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/clock.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,13 +24,17 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} clock () +## @deftypefn {} {@var{datevec} =} clock () +## @deftypefnx {} {[@var{datevec}, @var{isdst}] =} clock () ## Return the current local date and time as a date vector. ## ## The date vector contains the following fields: current year, month (1-12), ## day (1-31), hour (0-23), minute (0-59), and second (0-61). The seconds ## field has a fractional part after the decimal point for extended accuracy. ## +## The optional second output @var{isdst} is true if Daylight Savings Time +## (DST) is in effect for the system's time zone. +## ## For example: ## ## @example @@ -45,18 +49,19 @@ ## @seealso{now, date, datevec} ## @end deftypefn -function retval = clock () +function [datevec, isdst] = clock () tm = localtime (time ()); - retval = zeros (1, 6); + datevec = zeros (1, 6); + datevec(1) = tm.year + 1900; + datevec(2) = tm.mon + 1; + datevec(3) = tm.mday; + datevec(4) = tm.hour; + datevec(5) = tm.min; + datevec(6) = tm.sec + tm.usec / 1e6; - retval(1) = tm.year + 1900; - retval(2) = tm.mon + 1; - retval(3) = tm.mday; - retval(4) = tm.hour; - retval(5) = tm.min; - retval(6) = tm.sec + tm.usec / 1e6; + isdst = tm.isdst; endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/ctime.m --- a/scripts/time/ctime.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/ctime.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} ctime (@var{t}) +## @deftypefn {} {@var{str} =} ctime (@var{t}) ## Convert a value returned from @code{time} (or any other non-negative ## integer), to the local time and return a string of the same form as ## @code{asctime}. @@ -41,13 +41,13 @@ ## @seealso{asctime, time, localtime} ## @end deftypefn -function retval = ctime (t) +function str = ctime (t) - if (nargin < 1) + if (nargin != 1) print_usage (); endif - retval = asctime (localtime (t)); + str = asctime (localtime (t)); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/date.m --- a/scripts/time/date.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/date.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} date () +## @deftypefn {} {@var{str} =} date () ## Return the current date as a character string in the form DD-MMM-YYYY@. ## ## For example: @@ -38,9 +38,9 @@ ## @seealso{now, clock, datestr, localtime} ## @end deftypefn -function retval = date () +function str = date () - retval = strftime ("%d-%b-%Y", localtime (time ())); + str = strftime ("%d-%b-%Y", localtime (time ())); endfunction diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/datevec.m --- a/scripts/time/datevec.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/datevec.m Sun Apr 03 11:30:26 2022 -0400 @@ -208,6 +208,13 @@ original_f = f; # Store for error messages. + if (any (strchr (f, "hsfYD", 1))) + warning ("Octave:datevec:date-format-spec", ... + ["datevec: Format specifiers for dates should be lower case,", ... + " format specifiers for time should be upper case. ", ... + " Possible issue with 'm' (month) and 'M' (minutes)?"]); + endif + ## Play safe with percent signs. f = strrep (f, "%", "%%"); @@ -461,3 +468,8 @@ %!error datevec ("15:38:21.251", "HH:HH:SS") %!error datevec ("15:38:21.251", "MM:MM:SS") %!error datevec ("15:38:21.251", "HH:SS:SS") +%!fail ("datevec ('2015-03-31 0:00','YYYY-mm-DD HH:MM')", ... +%! "warning", "Format specifiers for dates should be lower case"); +%!fail ("datevec ('2015-03-31 hh:00','yyyy-mm-dd hh:MM')", ... +%! "warning", "format specifiers for time should be upper case"); + diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/etime.m --- a/scripts/time/etime.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/etime.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,7 +24,7 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} etime (@var{t2}, @var{t1}) +## @deftypefn {} {@var{secs} =} etime (@var{t2}, @var{t1}) ## Return the difference in seconds between two time values returned from ## @code{clock} (@math{@var{t2} - @var{t1}}). ## diff -r 0a1aec50a0c8 -r 960909469245 scripts/time/is_leap_year.m --- a/scripts/time/is_leap_year.m Sun Apr 03 11:29:17 2022 -0400 +++ b/scripts/time/is_leap_year.m Sun Apr 03 11:30:26 2022 -0400 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {} is_leap_year () -## @deftypefnx {} {} is_leap_year (@var{year}) +## @deftypefn {} {@var{tf} =} is_leap_year () +## @deftypefnx {} {@var{tf} =} is_leap_year (@var{year}) ## Return true if @var{year} is a leap year and false otherwise. ## ## If no year is specified, @code{is_leap_year} uses the current year. @@ -41,14 +41,14 @@ ## @seealso{weekday, eomday, calendar} ## @end deftypefn -function retval = is_leap_year (year) +function tf = is_leap_year (year) if (nargin == 0) t = clock (); year = t(1); endif - retval = (rem (year, 4) == 0 & rem (year, 100) != 0) | (rem (year, 400) == 0); + tf = (rem (year, 4) == 0 & rem (year, 100) != 0) | (rem (year, 400) == 0); endfunction diff -r 0a1aec50a0c8 -r 960909469245 src/mkoctfile.in.cc diff -r 0a1aec50a0c8 -r 960909469245 test/pkg/pkg.tst --- a/test/pkg/pkg.tst Sun Apr 03 11:29:17 2022 -0400 +++ b/test/pkg/pkg.tst Sun Apr 03 11:30:26 2022 -0400 @@ -73,7 +73,9 @@ %!testif HAVE_Z %! for i = 1:numel (mfile_pkg_name) %! silent_pkg_install (mfile_pkg_tgz{i}); -%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! if (isunix ()) +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! endif %! pkg ("uninstall", mfile_pkg_name{i}); %! endfor %! @@ -83,7 +85,9 @@ %!testif HAVE_Z %! for i = 1:numel (mfile_pkg_name) %! silent_pkg_install ("-local", mfile_pkg_tgz{i}); -%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! if (isunix) +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! endif %! pkg ("uninstall", mfile_pkg_name{i}); %! endfor @@ -111,7 +115,9 @@ %! pkg ("load", name); %! pkg ("unload", name); %! unwind_protect_cleanup -%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! if (isunix) +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! endif %! pkg ("uninstall", name); %! end_unwind_protect %! endfor @@ -138,7 +144,9 @@ %! [desc, flag] = pkg ("describe", mfile_pkg_name{1}); %! ## FIXME: this only tests that the describe command runs, %! ## not that the output is in anyway correct. -%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! if (isunix) +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! endif %! pkg ("uninstall", mfile_pkg_name{1}); ## -verbose