Mercurial > octave
changeset 30578:9002e595f219
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 31 Dec 2021 17:04:20 +0100 |
parents | d2cd9ead4c84 (diff) fa2a4ce2099c (current diff) |
children | 35efc47720bd |
files | |
diffstat | 245 files changed, 2302 insertions(+), 2009 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Dec 31 17:03:44 2021 +0100 +++ b/configure.ac Fri Dec 31 17:04:20 2021 +0100 @@ -27,7 +27,7 @@ ### Initialize Autoconf AC_PREREQ([2.65]) -AC_INIT([GNU Octave], [7.0.1], [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=1 +OCTAVE_PATCH_VERSION=0 dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument. OCTAVE_VERSION="$PACKAGE_VERSION" @@ -2658,10 +2658,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 ;;
--- a/doc/interpreter/mk-doc-cache.pl Fri Dec 31 17:03:44 2021 +0100 +++ b/doc/interpreter/mk-doc-cache.pl Fri Dec 31 17:04:20 2021 +0100 @@ -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: <cell-element>\n"; - print "# type: sq_string\n"; - print "# elements: 1\n"; - print "# length: $len\n"; - print "$str\n\n\n"; + print <<__END_OF_ELEMENT__; +# name: <cell-element> +# 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;
--- a/etc/HACKING.md Fri Dec 31 17:03:44 2021 +0100 +++ b/etc/HACKING.md Fri Dec 31 17:04:20 2021 +0100 @@ -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). + ################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/NEWS.8.md Fri Dec 31 17:04:20 2021 +0100 @@ -0,0 +1,52 @@ +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 + + +### 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): + + +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)
--- a/etc/module.mk Fri Dec 31 17:03:44 2021 +0100 +++ b/etc/module.mk Fri Dec 31 17:04:20 2021 +0100 @@ -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 += \
--- a/libgui/src/m-editor/file-editor-tab.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Dec 31 17:04:20 2021 +0100 @@ -45,6 +45,7 @@ #include <QPrintDialog> #include <QPushButton> #include <QScrollBar> +#include <QSaveFile> #include <QStyle> #include <QTextBlock> #include <QTextCodec> @@ -2183,7 +2184,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 +2240,50 @@ 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 (); + + // 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) + { + 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)
--- a/libinterp/corefcn/__isprimelarge__.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/__isprimelarge__.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 <unable to convert input> (__isprimelarge__ ({'foo'; 'bar'})) */
--- a/libinterp/corefcn/bsxfun.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/bsxfun.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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.
--- a/libinterp/corefcn/cellfun.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/cellfun.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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]); */
--- a/libinterp/corefcn/chol.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/chol.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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))
--- a/libinterp/corefcn/data.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/data.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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. @@ -3714,7 +3758,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 +3774,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 +3793,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 +3826,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 +3865,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 +3906,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 +3955,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 +4004,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 +4053,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 @@ -4715,7 +4759,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]) @@ -4723,7 +4768,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)) @@ -4794,14 +4840,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])) @@ -4952,7 +5000,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))) @@ -4963,7 +5011,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 <X must be of a floating point type> eps (uint8 ([0 1 2])) */ @@ -7026,16 +7074,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 @@ -7045,16 +7103,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 @@ -7067,10 +7135,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 @@ -7079,14 +7151,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); @@ -7101,14 +7181,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); @@ -7124,14 +7212,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])); @@ -7231,9 +7327,9 @@ DEFUN (issorted, args, , doc: /* -*- texinfo -*- -@deftypefn {} {} issorted (@var{a}) -@deftypefnx {} {} issorted (@var{a}, @var{mode}) -@deftypefnx {} {} issorted (@var{a}, "rows", @var{mode}) +@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 array is sorted according to @var{mode}, which may be either @qcode{"ascend"}, @qcode{"descend"}, or @qcode{"either"}.
--- a/libinterp/corefcn/debug.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/debug.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 */)
--- a/libinterp/corefcn/error.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/error.cc Fri Dec 31 17:04:20 2021 +0100 @@ -2187,8 +2187,3 @@ } OCTAVE_NAMESPACE_END - -// Deprecated variables and functions. - -// This variable is obsolete and always has the value 0. -int error_state = 0;
--- a/libinterp/corefcn/error.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/error.h Fri Dec 31 17:04:20 2021 +0100 @@ -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; } @@ -566,14 +568,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
--- a/libinterp/corefcn/errwarn.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/errwarn.h Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/event-manager.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/event-manager.h Fri Dec 31 17:04:20 2021 +0100 @@ -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 ()) {
--- a/libinterp/corefcn/file-io.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/file-io.cc Fri Dec 31 17:04:20 2021 +0100 @@ -67,7 +67,6 @@ #include "defun.h" #include "error.h" #include "errwarn.h" -#include "file-io.h" #include "interpreter-private.h" #include "interpreter.h" #include "load-path.h" @@ -3253,24 +3252,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
--- a/libinterp/corefcn/file-io.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/file-io.h Fri Dec 31 17:04:20 2021 +0100 @@ -23,43 +23,9 @@ // //////////////////////////////////////////////////////////////////////// -// Written by John C. Campbell <jcc@bevo.che.wisc.edu> - #if ! defined (octave_file_io_h) #define octave_file_io_h 1 -#include "octave-config.h" - -#include <string> - -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
--- a/libinterp/corefcn/filter.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/filter.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/find.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/find.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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) {
--- a/libinterp/corefcn/gcd.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/gcd.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/gl-render.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/gl-render.h Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/corefcn/gl2ps-print.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/gl2ps-print.cc Fri Dec 31 17:04:20 2021 +0100 @@ -1325,16 +1325,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;
--- a/libinterp/corefcn/graphics-toolkit.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/graphics-toolkit.h Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/graphics.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/graphics.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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"); @@ -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"); } @@ -10324,8 +10328,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 +12650,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
--- a/libinterp/corefcn/graphics.in.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/graphics.in.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<double, bool> (octave_NaN, true)), m_maxval (std::pair<double, bool> (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<double, bool> (octave_NaN, true)), m_maxval (std::pair<double, bool> (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<double, bool> (octave_NaN, true)), m_maxval (std::pair<double, bool> (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" @@ -4109,7 +4123,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)
--- a/libinterp/corefcn/hash.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/hash.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/help.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/help.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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') {
--- a/libinterp/corefcn/hex2num.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/hex2num.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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")
--- a/libinterp/corefcn/input.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/input.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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)) { }
--- a/libinterp/corefcn/input.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/input.h Fri Dec 31 17:04:20 2021 +0100 @@ -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;
--- a/libinterp/corefcn/interpreter.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/interpreter.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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" @@ -1998,24 +1997,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)
--- a/libinterp/corefcn/interpreter.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/interpreter.h Fri Dec 31 17:04:20 2021 +0100 @@ -538,30 +538,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:
--- a/libinterp/corefcn/inv.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/inv.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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); } @@ -367,7 +372,8 @@ %! 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 ()
--- a/libinterp/corefcn/load-path.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/load-path.cc Fri Dec 31 17:04:20 2021 +0100 @@ -974,7 +974,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 @@ -1745,7 +1746,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")) @@ -1916,7 +1918,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", @@ -1938,7 +1941,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", @@ -2038,7 +2042,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 (); @@ -2392,7 +2397,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)); } } }
--- a/libinterp/corefcn/load-save.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/load-save.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::size_t> (124)); + std::size_t len = std::min (comment_string.length (), + static_cast<std::size_t> (124)); memset (headertext, ' ', 124); memcpy (headertext, comment_string.data (), len);
--- a/libinterp/corefcn/ls-hdf5.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/ls-hdf5.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/corefcn/ls-hdf5.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/ls-hdf5.h Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/corefcn/ls-mat5.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/ls-mat5.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/libinterp/corefcn/lu.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/lu.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/mappers.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/mappers.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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) @@ -1763,7 +1787,8 @@ /* %!assert (log1p ([0, 2*eps, -2*eps]), [0, 2*eps, -2*eps], 1e-29) -%!assert (log1p (single ([0, 2*eps, -2*eps])), single ([0, 2*eps, -2*eps]), 1e-29) +%!assert (log1p (single ([0, 2*eps, -2*eps])), +%! single ([0, 2*eps, -2*eps]), 1e-29) %!error log1p () %!error log1p (1, 2) @@ -2054,12 +2079,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) @@ -2155,10 +2184,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]}) @@ -2221,10 +2252,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]})
--- a/libinterp/corefcn/matrix_type.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/matrix_type.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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"); @@ -531,11 +544,13 @@ %#!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(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
--- a/libinterp/corefcn/max.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/max.cc Fri Dec 31 17:04:20 2021 +0100 @@ -290,7 +290,8 @@ retval(0) = range.max (); if (nargout > 1) retval(1) = static_cast<double> - (range.increment () >= 0 ? range.numel () : 1); + (range.increment () >= 0 ? range.numel () + : 1); } } else if (arg.issparse ())
--- a/libinterp/corefcn/mex.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/mex.cc Fri Dec 31 17:04:20 2021 +0100 @@ -772,9 +772,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. */ @@ -1531,8 +1533,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, @@ -1582,7 +1584,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<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize)))) { m_dims[0] = m;
--- a/libinterp/corefcn/mxarray.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/mxarray.h Fri Dec 31 17:04:20 2021 +0100 @@ -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 (); }
--- a/libinterp/corefcn/oct-errno.in.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/oct-errno.in.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/oct-map.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/oct-map.cc Fri Dec 31 17:04:20 2021 +0100 @@ -984,7 +984,8 @@ octave_map octave_map::page (octave_idx_type k) const { - static Array<octave::idx_vector> ia (dim_vector (3, 1), octave::idx_vector::colon); + static Array<octave::idx_vector> ia (dim_vector (3, 1), + octave::idx_vector::colon); ia(2) = k; return index (ia);
--- a/libinterp/corefcn/oct-stream.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/oct-stream.cc Fri Dec 31 17:04:20 2021 +0100 @@ -348,9 +348,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, @@ -1752,7 +1752,8 @@ int read_first_row (delimited_stream& is, textscan& ts); - std::list<octave_value> out_buf (void) const { return (m_output_container); } + std::list<octave_value> out_buf (void) const + { return (m_output_container); } private: @@ -2907,7 +2908,7 @@ // Check for +/- inf and NaN if (! valid && width_left >= 3) { - int i = lookahead (is, m_inf_nan, 3, false); // false -> case insensitive + int i = lookahead (is, m_inf_nan, 3, false); // false->case insensitive if (i == 0) { retval = numeric_limits<double>::Inf ();
--- a/libinterp/corefcn/oct-stream.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/oct-stream.h Fri Dec 31 17:04:20 2021 +0100 @@ -476,7 +476,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);
--- a/libinterp/corefcn/pr-output.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/pr-output.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/corefcn/psi.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/psi.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/libinterp/corefcn/qr.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/qr.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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, ,
--- a/libinterp/corefcn/rand.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/rand.cc Fri Dec 31 17:04:20 2021 +0100 @@ -797,7 +797,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 @@ -902,7 +902,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. @@ -1022,7 +1022,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); @@ -1034,7 +1034,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); @@ -1047,7 +1049,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. @@ -1076,7 +1080,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.
--- a/libinterp/corefcn/regexp.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/regexp.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/corefcn/sparse-xdiv.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/sparse-xdiv.h Fri Dec 31 17:04:20 2021 +0100 @@ -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); }
--- a/libinterp/corefcn/sparse.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/sparse.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 */)
--- a/libinterp/corefcn/stack-frame.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/stack-frame.cc Fri Dec 31 17:04:20 2021 +0100 @@ -1041,7 +1041,8 @@ const std::shared_ptr<stack_frame>& parent_link, const std::shared_ptr<stack_frame>& 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 +1060,8 @@ const std::shared_ptr<stack_frame>& static_link, const std::shared_ptr<stack_frame>& 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 +1071,9 @@ const local_vars_map& local_vars, const std::shared_ptr<stack_frame>& 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,
--- a/libinterp/corefcn/strfind.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/strfind.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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, []})
--- a/libinterp/corefcn/strfns.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/strfns.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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))
--- a/libinterp/corefcn/sylvester.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/sylvester.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 ()
--- a/libinterp/corefcn/symbfact.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/symbfact.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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"); */
--- a/libinterp/corefcn/symrec.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/symrec.h Fri Dec 31 17:04:20 2021 +0100 @@ -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 (); }
--- a/libinterp/corefcn/symscope.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/symscope.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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++;
--- a/libinterp/corefcn/symtab.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/symtab.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::string> symbol_table::global_variable_names_deprecated (void) - { - return m_interpreter.global_variable_names (); - } - - // Remove when corresponding public deprecated function is removed. - std::list<std::string> 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<std::string> 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__ ()
--- a/libinterp/corefcn/symtab.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/symtab.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::string> global_variable_names_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - std::list<std::string> top_level_variable_names_deprecated (void); - - // Remove when corresponding public deprecated function is removed. - std::list<std::string> 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<std::string> global_variable_names (void) - { - return global_variable_names_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_variable_names' instead") - std::list<std::string> top_level_variable_names (void) - { - return top_level_variable_names_deprecated (); - } - - OCTAVE_DEPRECATED (6, "use 'interpreter::variable_names' instead") - std::list<std::string> 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;
--- a/libinterp/corefcn/sysdep.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/sysdep.cc Fri Dec 31 17:04:20 2021 +0100 @@ -1361,7 +1361,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.
--- a/libinterp/corefcn/toplev.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/toplev.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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"
--- a/libinterp/corefcn/typecast.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/typecast.cc Fri Dec 31 17:04:20 2021 +0100 @@ -239,8 +239,8 @@ ; else if (numclass == "char") retval = octave_value (reinterpret_copy<charNDArray> - (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")
--- a/libinterp/corefcn/utils.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/utils.cc Fri Dec 31 17:04:20 2021 +0100 @@ -93,7 +93,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 +1099,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 +1120,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,7 +1491,8 @@ return s.length (); } - std::size_t format (std::ostream& os, const std::string& enc, const char *fmt, ...) + std::size_t format (std::ostream& os, const std::string& enc, + const char *fmt, ...) { std::size_t retval; @@ -1505,8 +1506,8 @@ return retval; } - std::size_t vformat (std::ostream& os, const std::string& enc, const char *fmt, - va_list args) + std::size_t vformat (std::ostream& os, const std::string& enc, + const char *fmt, va_list args) { std::string s = vasprintf (fmt, args); @@ -1628,8 +1629,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 +1769,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.
--- a/libinterp/corefcn/variables.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/variables.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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: @@ -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; -}
--- a/libinterp/corefcn/variables.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/variables.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<int>::min (), int maxval = std::numeric_limits<int>::max ()) +set_internal_variable (int& var, const octave_value_list& args, int nargout, + const char *nm, + int minval = std::numeric_limits<int>::min (), + int maxval = std::numeric_limits<int>::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<double>::Inf (), double maxval = octave::numeric_limits<double>::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.
--- a/libinterp/corefcn/xdiv.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/xdiv.h Fri Dec 31 17:04:20 2021 +0100 @@ -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); }
--- a/libinterp/corefcn/xpow.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/corefcn/xpow.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<double>& r); +extern OCTINTERP_API octave_value elem_xpow (double a, + const octave::range<double>& 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<double>& r); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, + const octave::range<double>& r); extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, double b); extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a,
--- a/libinterp/dldfcn/__init_fltk__.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/dldfcn/__init_fltk__.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 (); }
--- a/libinterp/dldfcn/__ode15__.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/dldfcn/__ode15__.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/dldfcn/audiodevinfo.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/dldfcn/audiodevinfo.cc Fri Dec 31 17:04:20 2021 +0100 @@ -500,7 +500,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]; @@ -564,8 +565,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); @@ -885,7 +886,7 @@ if (isplaying ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting playing audioplayer"); + "interrupting audioplayer during playback"); stop (); } } @@ -1557,7 +1558,7 @@ if (isrecording ()) { warning_with_id ("Octave:audio-interrupt", - "interrupting recording audiorecorder"); + "interrupting audiorecorder during recording"); stop (); } } @@ -1656,7 +1657,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; } @@ -1934,7 +1937,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) @@ -2368,7 +2371,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 ());
--- a/libinterp/dldfcn/audioread.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/dldfcn/audioread.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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, ,
--- a/libinterp/dldfcn/convhulln.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/dldfcn/convhulln.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/cdef-class.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-class.cc Fri Dec 31 17:04:20 2021 +0100 @@ -312,7 +312,8 @@ } void - cdef_class::cdef_class_rep::find_methods (std::map<std::string, cdef_method>& meths, + cdef_class::cdef_class_rep::find_methods (std::map<std::string, + cdef_method>& 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<std::string> 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<tree_classdef_properties_block *> 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);
--- a/libinterp/octave-value/cdef-class.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-class.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<cdef_class> m_implicit_ctor_list; @@ -239,7 +239,8 @@ cdef_class (void) : cdef_meta_object () { } - cdef_class (const std::string& nm, const std::list<cdef_class>& superclasses) + cdef_class (const std::string& nm, + const std::list<cdef_class>& superclasses) : cdef_meta_object (new cdef_class_rep (superclasses)) { get_rep ()->set_name (nm);
--- a/libinterp/octave-value/cdef-manager.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-manager.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::string, cdef_package> toplevel_packages;
--- a/libinterp/octave-value/cdef-method.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-method.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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:
--- a/libinterp/octave-value/cdef-object.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-object.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<cdef_object> array_value (void) const { return m_rep->array_value (); } + Array<cdef_object> array_value (void) const + { return m_rep->array_value (); } void put (const std::string& pname, const octave_value& val) {
--- a/libinterp/octave-value/cdef-package.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-package.h Fri Dec 31 17:04:20 2021 +0100 @@ -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; }
--- a/libinterp/octave-value/cdef-utils.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/cdef-utils.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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; }
--- a/libinterp/octave-value/ov-base-diag.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-base-diag.cc Fri Dec 31 17:04:20 2021 +0100 @@ -299,7 +299,8 @@ // FIXME: We really need some traits so that ad hoc hooks like this // are not necessary. template <typename T> inline T helper_iscomplex (T) { return false; } -template <typename T> inline T helper_iscomplex (std::complex<T>) { return true; } +template <typename T> inline T helper_iscomplex (std::complex<T>) +{ return true; } template <typename DMT, typename MT> double
--- a/libinterp/octave-value/ov-base-int.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-base-int.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-base.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-base.h Fri Dec 31 17:04:20 2021 +0100 @@ -301,7 +301,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) { }
--- a/libinterp/octave-value/ov-bool-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-bool-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-bool.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-bool.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-cell.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-cell.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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}
--- a/libinterp/octave-value/ov-ch-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-ch-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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<const uint8_t *> (in_m.data ()); \ uint8_t *buf = reinterpret_cast<uint8_t *> (ch_array.fortran_vec ()); \ U8_FCN (in, matrix.numel (), nullptr, buf, &output_length); \ - if (output_length != static_cast<std::size_t> (matrix.numel ())) \ + if (output_length != static_cast<std::size_t> (matrix.numel ())) \ { \ warning_with_id ("Octave:multi_byte_char_length", \ "UMAP: Possible multi-byte error."); \
--- a/libinterp/octave-value/ov-class.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-class.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 */)
--- a/libinterp/octave-value/ov-class.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-class.h Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-classdef.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-classdef.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-colon.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-colon.h Fri Dec 31 17:04:20 2021 +0100 @@ -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:
--- a/libinterp/octave-value/ov-complex.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-complex.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-cx-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-cx-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-cx-sparse.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-cx-sparse.cc Fri Dec 31 17:04:20 2021 +0100 @@ -400,7 +400,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 +426,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 +452,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 +491,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 +530,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 +587,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 +607,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);
--- a/libinterp/octave-value/ov-dld-fcn.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-dld-fcn.h Fri Dec 31 17:04:20 2021 +0100 @@ -69,7 +69,8 @@ ~octave_dld_function (void); - void mark_fcn_file_up_to_date (const octave::sys::time& t) { m_t_checked = t; } + void mark_fcn_file_up_to_date (const octave::sys::time& t) + { m_t_checked = t; } std::string fcn_file_name (void) const;
--- a/libinterp/octave-value/ov-fcn-handle.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-fcn-handle.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 @@ -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 */)
--- a/libinterp/octave-value/ov-fcn-handle.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-fcn-handle.h Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-float.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-float.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-flt-complex.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-flt-complex.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-flt-cx-diag.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-flt-cx-diag.cc Fri Dec 31 17:04:20 2021 +0100 @@ -148,8 +148,7 @@ return ::imag (m_matrix); case umap_sqrt: { - FloatComplexColumnVector tmp = m_matrix.extract_diag ().map<FloatComplex> - (std::sqrt); + FloatComplexColumnVector tmp = m_matrix.extract_diag ().map<FloatComplex> (std::sqrt); FloatComplexDiagMatrix retval (tmp); retval.resize (m_matrix.rows (), m_matrix.columns ()); return retval;
--- a/libinterp/octave-value/ov-flt-cx-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-flt-cx-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-flt-re-diag.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-flt-re-diag.cc Fri Dec 31 17:04:20 2021 +0100 @@ -166,8 +166,7 @@ return DiagMatrix (m_matrix.rows (), m_matrix.cols (), 0.0); case umap_sqrt: { - FloatComplexColumnVector tmp = m_matrix.extract_diag ().map<FloatComplex> - (octave::math::rc_sqrt); + FloatComplexColumnVector tmp = m_matrix.extract_diag ().map<FloatComplex> (octave::math::rc_sqrt); FloatComplexDiagMatrix retval (tmp); retval.resize (m_matrix.rows (), m_matrix.columns ()); return retval;
--- a/libinterp/octave-value/ov-flt-re-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-flt-re-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-java.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-java.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 (""); @@ -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>
--- a/libinterp/octave-value/ov-lazy-idx.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-lazy-idx.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/libinterp/octave-value/ov-lazy-idx.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-lazy-idx.h Fri Dec 31 17:04:20 2021 +0100 @@ -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;
--- a/libinterp/octave-value/ov-null-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-null-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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.
--- a/libinterp/octave-value/ov-range.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-range.cc Fri Dec 31 17:04:20 2021 +0100 @@ -1042,7 +1042,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
--- a/libinterp/octave-value/ov-re-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-re-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-re-mat.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-re-mat.h Fri Dec 31 17:04:20 2021 +0100 @@ -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; }
--- a/libinterp/octave-value/ov-re-sparse.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-re-sparse.cc Fri Dec 31 17:04:20 2021 +0100 @@ -421,7 +421,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 +446,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 +472,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 +511,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 +549,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 +599,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 +613,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);
--- a/libinterp/octave-value/ov-scalar.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-scalar.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-str-mat.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-str-mat.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/octave-value/ov-struct.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-struct.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 <arguments must occur as "field", VALUE pairs> 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}.
--- a/libinterp/octave-value/ov-typeinfo.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-typeinfo.cc Fri Dec 31 17:04:20 2021 +0100 @@ -645,7 +645,8 @@ { octave_scalar_map retval; - int len = std::min (static_cast<int> (m_binary_ops.columns ()), m_num_types); + int len = std::min (static_cast<int> (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<int> (m_assign_ops.columns ()), m_num_types); + int len = std::min (static_cast<int> (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<int> (m_assignany_ops.columns ()), m_num_types); + int len = std::min (static_cast<int> (m_assignany_ops.columns ()), + m_num_types); dim_vector tab_dims (1, len);
--- a/libinterp/octave-value/ov-usr-fcn.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov-usr-fcn.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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.
--- a/libinterp/octave-value/ov.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov.cc Fri Dec 31 17:04:20 2021 +0100 @@ -3179,28 +3179,36 @@ return make_range<float> (base, increment, limit, is_for_cmd_expr); case btyp_int8: - return make_range<octave_int8> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_int8> (base, increment, limit, + is_for_cmd_expr); case btyp_int16: - return make_range<octave_int16> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_int16> (base, increment, limit, + is_for_cmd_expr); case btyp_int32: - return make_range<octave_int32> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_int32> (base, increment, limit, + is_for_cmd_expr); case btyp_int64: - return make_range<octave_int64> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_int64> (base, increment, limit, + is_for_cmd_expr); case btyp_uint8: - return make_range<octave_uint8> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_uint8> (base, increment, limit, + is_for_cmd_expr); case btyp_uint16: - return make_range<octave_uint16> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_uint16> (base, increment, limit, + is_for_cmd_expr); case btyp_uint32: - return make_range<octave_uint32> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_uint32> (base, increment, limit, + is_for_cmd_expr); case btyp_uint64: - return make_range<octave_uint64> (base, increment, limit, is_for_cmd_expr); + return make_range<octave_uint64> (base, increment, limit, + is_for_cmd_expr); case btyp_char: return make_range<char> (base, increment, limit, is_for_cmd_expr); @@ -3617,7 +3625,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 */) @@ -3640,7 +3648,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 */)
--- a/libinterp/octave-value/ov.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave-value/ov.h Fri Dec 31 17:04:20 2021 +0100 @@ -1526,7 +1526,8 @@ bool islocked (void) const { return m_rep->islocked (); } - void call_object_destructor (void) { return m_rep->call_object_destructor (); } + void call_object_destructor (void) + { return m_rep->call_object_destructor (); } octave_value dump (void) const { return m_rep->dump (); }
--- a/libinterp/octave.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 */)
--- a/libinterp/octave.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/octave.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::string> command_line_path (void) const { return m_command_line_path; } + std::list<std::string> 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<std::string>& arg) { m_command_line_path = arg; } + void command_line_path (const std::list<std::string>& 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; }
--- a/libinterp/parse-tree/bp-table.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/bp-table.cc Fri Dec 31 17:04:20 2021 +0100 @@ -176,7 +176,7 @@ { Array<octave_value> 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 @@ -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);
--- a/libinterp/parse-tree/bp-table.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/bp-table.h Fri Dec 31 17:04:20 2021 +0100 @@ -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:
--- a/libinterp/parse-tree/lex.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/lex.h Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/libinterp/parse-tree/oct-lvalue.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/oct-lvalue.h Fri Dec 31 17:04:20 2021 +0100 @@ -68,7 +68,8 @@ octave_idx_type numel (void) const; - void set_index (const std::string& t, const std::list<octave_value_list>& i); + void set_index (const std::string& t, + const std::list<octave_value_list>& i); void clear_index (void) { m_type = ""; m_idx.clear (); }
--- a/libinterp/parse-tree/profiler.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/profiler.cc Fri Dec 31 17:04:20 2021 +0100 @@ -99,7 +99,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]; @@ -230,19 +231,21 @@ 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. + // 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); - // 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. + // 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 ()); m_active_fcn = m_active_fcn->exit (pos->second);
--- a/libinterp/parse-tree/profiler.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/profiler.h Fri Dec 31 17:04:20 2021 +0100 @@ -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<std::string> function_set; typedef std::map<std::string, octave_idx_type> 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
--- a/libinterp/parse-tree/pt-binop.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/pt-binop.h Fri Dec 31 17:04:20 2021 +0100 @@ -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;
--- a/libinterp/parse-tree/pt-colon.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/pt-colon.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/libinterp/parse-tree/pt-eval.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/pt-eval.cc Fri Dec 31 17:04:20 2021 +0100 @@ -4294,11 +4294,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; }
--- a/libinterp/parse-tree/pt-exp.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/pt-exp.h Fri Dec 31 17:04:20 2021 +0100 @@ -89,7 +89,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; }
--- a/libinterp/parse-tree/pt-select.h Fri Dec 31 17:03:44 2021 +0100 +++ b/libinterp/parse-tree/pt-select.h Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/liboctave/system/lo-sysdep.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/liboctave/system/lo-sysdep.cc Fri Dec 31 17:04:20 2021 +0100 @@ -699,17 +699,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
--- a/liboctave/util/lo-array-errwarn.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/liboctave/util/lo-array-errwarn.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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 */
--- a/liboctave/util/lo-array-errwarn.h Fri Dec 31 17:03:44 2021 +0100 +++ b/liboctave/util/lo-array-errwarn.h Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/liboctave/util/quit.cc Fri Dec 31 17:03:44 2021 +0100 +++ b/liboctave/util/quit.cc Fri Dec 31 17:04:20 2021 +0100 @@ -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; - } - } -}
--- a/liboctave/util/quit.h Fri Dec 31 17:03:44 2021 +0100 +++ b/liboctave/util/quit.h Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/+containers/Map.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/+containers/Map.m Fri Dec 31 17:04:20 2021 +0100 @@ -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. ##
--- a/scripts/@ftp/ascii.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/ascii.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/binary.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/binary.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/cd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/cd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/close.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/close.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/delete.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/delete.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/dir.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/dir.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/ftp.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/ftp.m Fri Dec 31 17:04:20 2021 +0100 @@ -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 = "")
--- a/scripts/@ftp/mget.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/mget.m Fri Dec 31 17:04:20 2021 +0100 @@ -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 = "")
--- a/scripts/@ftp/mkdir.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/mkdir.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/mput.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/mput.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/rename.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/rename.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/@ftp/rmdir.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/@ftp/rmdir.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/__get_properties__.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/__get_properties__.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/audio/@audioplayer/audioplayer.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/audioplayer.m Fri Dec 31 17:04:20 2021 +0100 @@ -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 <first argument cannot be a callback> audioplayer (@ls, 8000) +%!error <first argument cannot be a callback> audioplayer ("ls", 8000)
--- a/scripts/audio/@audioplayer/disp.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/disp.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/get.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/get.m Fri Dec 31 17:04:20 2021 +0100 @@ -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');
--- a/scripts/audio/@audioplayer/isplaying.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/isplaying.m Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/scripts/audio/@audioplayer/pause.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/pause.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/play.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/play.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/playblocking.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/playblocking.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/resume.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/resume.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/set.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/set.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audioplayer/stop.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/stop.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audioplayer/subsasgn.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/subsasgn.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audioplayer/subsref.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audioplayer/subsref.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audiorecorder/__get_properties__.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/__get_properties__.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/audio/@audiorecorder/audiorecorder.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/audiorecorder.m Fri Dec 31 17:04:20 2021 +0100 @@ -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 <first argument cannot be a callback> audiorecorder (@ls) +%!error <first argument cannot be a callback> audiorecorder ("ls")
--- a/scripts/audio/@audiorecorder/disp.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/disp.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/get.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/get.m Fri Dec 31 17:04:20 2021 +0100 @@ -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');
--- a/scripts/audio/@audiorecorder/getaudiodata.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/getaudiodata.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audiorecorder/getplayer.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/getplayer.m Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/scripts/audio/@audiorecorder/isrecording.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/isrecording.m Fri Dec 31 17:04:20 2021 +0100 @@ -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);
--- a/scripts/audio/@audiorecorder/pause.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/pause.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/play.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/play.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/record.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/record.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/recordblocking.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/recordblocking.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/resume.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/resume.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/set.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/set.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audiorecorder/stop.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/stop.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/@audiorecorder/subsasgn.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/subsasgn.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/@audiorecorder/subsref.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/@audiorecorder/subsref.m Fri Dec 31 17:04:20 2021 +0100 @@ -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");
--- a/scripts/audio/record.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/record.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/audio/sound.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/sound.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/audio/soundsc.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/audio/soundsc.m Fri Dec 31 17:04:20 2021 +0100 @@ -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)
--- a/scripts/deprecated/module.mk Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/deprecated/module.mk Fri Dec 31 17:04:20 2021 +0100 @@ -4,8 +4,7 @@ %reldir%/.oct-config \ %reldir%/disable_diagonal_matrix.m \ %reldir%/disable_permutation_matrix.m \ - %reldir%/disable_range.m \ - %reldir%/runtests.m + %reldir%/disable_range.m %canon_reldir%dir = $(fcnfiledir)/deprecated
--- a/scripts/deprecated/runtests.m Fri Dec 31 17:03:44 2021 +0100 +++ /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 <https://octave.org/copyright/>. -## -## 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 -## <https://www.gnu.org/licenses/>. -## -######################################################################## - -## -*- 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
--- a/scripts/elfun/acosd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acosd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acot.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acot.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acotd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acotd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acoth.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acoth.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acsc.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acsc.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acscd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acscd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/acsch.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/acsch.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/asec.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/asec.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/asecd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/asecd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/asech.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/asech.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/asind.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/asind.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/atan2d.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/atan2d.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/atand.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/atand.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/cosd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/cosd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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}
--- a/scripts/elfun/cot.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/cot.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/cotd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/cotd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/coth.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/coth.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/csc.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/csc.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/cscd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/cscd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/csch.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/csch.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/sec.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/sec.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/secd.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/secd.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/sech.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/sech.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/elfun/sind.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/sind.m Fri Dec 31 17:04:20 2021 +0100 @@ -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}
--- a/scripts/elfun/tand.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/elfun/tand.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/general/isequal.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/general/isequal.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/general/isequaln.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/general/isequaln.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/help/__makeinfo__.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/help/__makeinfo__.m Fri Dec 31 17:04:20 2021 +0100 @@ -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"))
--- a/scripts/image/iscolormap.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/image/iscolormap.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/io/is_valid_file_id.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/io/is_valid_file_id.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/legacy/isdir.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/legacy/isdir.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/legacy/isstr.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/legacy/isstr.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/isbanded.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/isbanded.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/isdefinite.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/isdefinite.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/isdiag.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/isdiag.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/ishermitian.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/ishermitian.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/issymmetric.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/issymmetric.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/istril.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/istril.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/linear-algebra/istriu.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/linear-algebra/istriu.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/isdeployed.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/isdeployed.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/isfolder.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/isfolder.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/ismac.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/ismac.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/ismethod.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/ismethod.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/ispc.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/ispc.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/miscellaneous/isunix.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/miscellaneous/isunix.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/plot/util/isaxes.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/plot/util/isaxes.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/plot/util/isfigure.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/plot/util/isfigure.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/plot/util/isgraphics.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/plot/util/isgraphics.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/plot/util/ishandle.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/plot/util/ishandle.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/plot/util/ishold.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/plot/util/ishold.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/prefs/ispref.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/prefs/ispref.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/specfun/isprime.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/specfun/isprime.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/statistics/var.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/statistics/var.m Fri Dec 31 17:04:20 2021 +0100 @@ -216,7 +216,7 @@ endif den = sum (w); mu = sum (w .* x, dim) ./ sum (w); - retval = sum (w .* ((x .- mu) .^ 2), dim) / den; + retval = sum (w .* ((x - mu) .^ 2), dim) / den; endif endif endif
--- a/scripts/strings/isletter.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/strings/isletter.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/strings/isstring.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/strings/isstring.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/strings/isstrprop.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/strings/isstrprop.m Fri Dec 31 17:04:20 2021 +0100 @@ -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
--- a/scripts/time/is_leap_year.m Fri Dec 31 17:03:44 2021 +0100 +++ b/scripts/time/is_leap_year.m Fri Dec 31 17:04:20 2021 +0100 @@ -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