# HG changeset patch # User Rik # Date 1453398470 28800 # Node ID df789122470905908f1f549fda31dff450755146 # Parent ba0a4b4f021da2e85c1da6049ddabc819c340383 maint: Use "return ovl (...)" in DEFUN macros. * cellfun.cc, data.cc, debug.cc, defaults.cc, det.cc, dirfns.cc, dlmread.cc, error.cc, file-io.cc, getrusage.cc, graphics.cc, help.cc, input.cc, inv.cc, kron.cc, load-path.cc, pager.cc, pinv.cc, rand.cc, strfns.cc, urlwrite.cc, chol.cc, ov-classdef.cc, ov-struct.cc: Use "return ovl (...)" in DEFUN macros, rather than "return octave_value (...)". diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/cellfun.cc --- a/libinterp/corefcn/cellfun.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/cellfun.cc Thu Jan 21 09:47:50 2016 -0800 @@ -2343,7 +2343,7 @@ } } - return octave_value (retcell); + return ovl (retcell); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/data.cc Thu Jan 21 09:47:50 2016 -0800 @@ -2423,7 +2423,7 @@ if (dim < 0) error ("cat: DIM must be a valid dimension"); - return octave_value (do_cat (args.slice (1, args.length () - 1), dim, "cat")); + return ovl (do_cat (args.slice (1, args.length () - 1), dim, "cat")); } /* @@ -2653,7 +2653,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).length ()); + return ovl (args(0).length ()); } DEFUN (ndims, args, , @@ -2676,7 +2676,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).ndims ()); + return ovl (args(0).ndims ()); } DEFUN (numel, args, , @@ -2863,7 +2863,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).nnz ()); + return ovl (args(0).nnz ()); } DEFUN (nzmax, args, , @@ -2880,7 +2880,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).nzmax ()); + return ovl (args(0).nzmax ()); } DEFUN (rows, args, , @@ -2893,7 +2893,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).rows ()); + return ovl (args(0).rows ()); } /* @@ -2933,7 +2933,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).columns ()); + return ovl (args(0).columns ()); } DEFUN (sum, args, , @@ -3215,7 +3215,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_bool_type ()); + return ovl (args(0).is_bool_type ()); } DEFALIAS (isbool, islogical); @@ -3247,7 +3247,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_integer_type ()); + return ovl (args(0).is_integer_type ()); } DEFUN (iscomplex, args, , @@ -3260,7 +3260,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_complex_type ()); + return ovl (args(0).is_complex_type ()); } DEFUN (isfloat, args, , @@ -3275,7 +3275,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_float_type ()); + return ovl (args(0).is_float_type ()); } // FIXME: perhaps this should be implemented with an @@ -3558,7 +3558,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_real_type ()); + return ovl (args(0).is_real_type ()); } DEFUN (isempty, args, , @@ -3572,7 +3572,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_empty ()); + return ovl (args(0).is_empty ()); } /* @@ -3593,7 +3593,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).is_numeric_type ()); + return ovl (args(0).is_numeric_type ()); } /* @@ -3622,7 +3622,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).numel () == 1); + return ovl (args(0).numel () == 1); } /* @@ -3659,7 +3659,7 @@ dim_vector sz = args(0).dims (); - return octave_value (sz.length () == 2 && (sz(0) == 1 || sz(1) == 1)); + return ovl (sz.length () == 2 && (sz(0) == 1 || sz(1) == 1)); } /* @@ -3694,7 +3694,7 @@ dim_vector sz = args(0).dims (); - return octave_value (sz.length () == 2 && sz(0) == 1); + return ovl (sz.length () == 2 && sz(0) == 1); } /* @@ -3739,7 +3739,7 @@ dim_vector sz = args(0).dims (); - return octave_value (sz.length () == 2 && sz(1) == 1); + return ovl (sz.length () == 2 && sz(1) == 1); } /* @@ -3783,7 +3783,7 @@ dim_vector sz = args(0).dims (); - return octave_value (sz.length () == 2 && sz(0) >= 0 && sz(1) >= 0); + return ovl (sz.length () == 2 && sz(0) >= 0 && sz(1) >= 0); } /* @@ -3826,7 +3826,7 @@ dim_vector sz = args(0).dims (); - return octave_value (sz.length () == 2 && sz(0) == sz(1)); + return ovl (sz.length () == 2 && sz(0) == sz(1)); } /* @@ -5510,7 +5510,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).squeeze ()); + return ovl (args(0).squeeze ()); } DEFUN (full, args, , @@ -5524,7 +5524,7 @@ if (args.length () != 1) print_usage (); - return octave_value (args(0).full_value ()); + return ovl (args(0).full_value ()); } // Compute various norms of the vector X. @@ -6709,6 +6709,7 @@ Array idx = arg.sort_rows_idx (smode); + // This cannot be ovl(), relies on special overloaded octave_value call. return octave_value (idx, true, true); } @@ -7859,7 +7860,7 @@ retval = retval.reshape (dims); } - return octave_value (retval); + return ovl (retval); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/debug.cc Thu Jan 21 09:47:50 2016 -0800 @@ -1432,7 +1432,7 @@ if (args.length () != 0) print_usage (); - return octave_value (Vdebugging); + return ovl (Vdebugging); } DEFUN (__db_next_breakpoint_quiet__, args, , diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/defaults.cc --- a/libinterp/corefcn/defaults.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/defaults.cc Thu Jan 21 09:47:50 2016 -0800 @@ -587,7 +587,7 @@ if (args.length () != 0) print_usage (); - return octave_value (Voctave_home); + return ovl (Voctave_home); } /* @@ -605,7 +605,7 @@ if (args.length () != 0) print_usage (); - return octave_value (OCTAVE_VERSION); + return ovl (OCTAVE_VERSION); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/det.cc --- a/libinterp/corefcn/det.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/det.cc Thu Jan 21 09:47:50 2016 -0800 @@ -73,13 +73,13 @@ octave_idx_type nc = arg.columns (); if (nr == 0 && nc == 0) - return octave_value (1.0); + return ovl (1.0); int arg_is_empty = empty_arg ("det", nr, nc); if (arg_is_empty < 0) return ovl (); if (arg_is_empty > 0) - return octave_value (1.0); + return ovl (1.0); if (nr != nc) err_square_matrix_required ("det", "A"); diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/dirfns.cc --- a/libinterp/corefcn/dirfns.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/dirfns.cc Thu Jan 21 09:47:50 2016 -0800 @@ -158,7 +158,7 @@ @seealso{cd, dir, ls, mkdir, rmdir}\n\ @end deftypefn") { - return octave_value (octave_env::get_current_directory ()); + return ovl (octave_env::get_current_directory ()); } DEFUN (readdir, args, , @@ -483,7 +483,7 @@ glob_match pattern (file_ops::tilde_expand (pat)); - return octave_value (Cell (pattern.glob ())); + return ovl (Cell (pattern.glob ())); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/dlmread.cc --- a/libinterp/corefcn/dlmread.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/dlmread.cc Thu Jan 21 09:47:50 2016 -0800 @@ -458,9 +458,9 @@ } if (iscmplx) - return octave_value (cdata); + return ovl (cdata); else - return octave_value (rdata); + return ovl (rdata); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/error.cc Thu Jan 21 09:47:50 2016 -0800 @@ -1930,7 +1930,7 @@ error ("lasterror: argument must be a structure or a string"); } - return octave_value (err); + return ovl (err); } DEFUN (lasterr, args, nargout, diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/file-io.cc Thu Jan 21 09:47:50 2016 -0800 @@ -248,7 +248,7 @@ if (args.length () != 1) print_usage (); - return octave_value (octave_stream_list::remove (args(0), "fclose")); + return ovl (octave_stream_list::remove (args(0), "fclose")); } DEFUN (fclear, args, , @@ -741,7 +741,7 @@ octave_value origin_arg = (nargin == 3) ? args(2) : octave_value (-1.0); - return octave_value (os.seek (args(1), origin_arg)); + return ovl (os.seek (args(1), origin_arg)); } DEFUN (ftell, args, , @@ -757,7 +757,7 @@ octave_stream os = octave_stream_list::lookup (args(0), "ftell"); - return octave_value (os.tell ()); + return ovl (os.tell ()); } DEFUN (fprintf, args, nargout, @@ -815,7 +815,7 @@ result = os.printf (args(fmt_n), tmp_args, who); if (nargout > 0) - return octave_value (result); + return ovl (result); else return ovl (); } @@ -889,7 +889,7 @@ octave_stream os = octave_stream_list::lookup (args(0), who); - return octave_value (os.puts (args(1), who)); + return ovl (os.puts (args(1), who)); } DEFUN (puts, args, , @@ -910,7 +910,7 @@ if (args.length () != 1) print_usage (); - return octave_value (stdout_stream.puts (args(0), who)); + return ovl (stdout_stream.puts (args(0), who)); } DEFUN (sprintf, args, , @@ -1509,7 +1509,7 @@ skip = 0; } - return octave_value (do_fwrite (os, data, prec, skip, arch)); + return ovl (do_fwrite (os, data, prec, skip, arch)); } DEFUNX ("feof", Ffeof, args, , @@ -1529,7 +1529,7 @@ octave_stream os = octave_stream_list::lookup (args(0), "feof"); - return octave_value (os.eof () ? 1.0 : 0.0); + return ovl (os.eof () ? 1.0 : 0.0); } DEFUNX ("ferror", Fferror, args, , @@ -1652,7 +1652,7 @@ if (args.length () != 1) print_usage (); - return octave_value (octave_stream_list::remove (args(0), "pclose")); + return ovl (octave_stream_list::remove (args(0), "pclose")); } DEFUN (tempname, args, , @@ -1690,7 +1690,7 @@ if (nargin > 1) pfx = args(1).xstring_value ("tempname: PREFIX must be a string"); - return octave_value (octave_tempnam (dir, pfx)); + return ovl (octave_tempnam (dir, pfx)); } /* @@ -1948,7 +1948,7 @@ if (args.length () != 0) print_usage (); - return octave_value (get_P_tmpdir ()); + return ovl (get_P_tmpdir ()); } // NOTE: the values of SEEK_SET, SEEK_CUR, and SEEK_END have to be diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/getrusage.cc --- a/libinterp/corefcn/getrusage.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/getrusage.cc Thu Jan 21 09:47:50 2016 -0800 @@ -202,7 +202,7 @@ #endif - return octave_value (m); + return ovl (m); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/graphics.cc Thu Jan 21 09:47:50 2016 -0800 @@ -10062,9 +10062,9 @@ octave_idx_type vals_len = vals.numel (); if (vals_len > 1) - return octave_value (vals); + return ovl (vals); else if (vals_len == 1) - return octave_value (vals(0)); + return ovl (vals(0)); else return ovl (); } @@ -10275,7 +10275,7 @@ double h = args(0).xdouble_value ("__calc_dimensions__: first argument must be a graphics handle"); - return octave_value (calc_dimensions (gh_manager::get_object (h))); + return ovl (calc_dimensions (gh_manager::get_object (h))); } DEFUN (__go_axes__, args, , @@ -10484,7 +10484,7 @@ if (args.length () > 0) show_hidden = args(0).bool_value (); - return octave_value (gh_manager::handle_list (show_hidden)); + return ovl (gh_manager::handle_list (show_hidden)); } DEFUN (__go_figure_handles__, args, , @@ -10500,7 +10500,7 @@ if (args.length () > 0) show_hidden = args(0).bool_value (); - return octave_value (gh_manager::figure_handle_list (show_hidden)); + return ovl (gh_manager::figure_handle_list (show_hidden)); } DEFUN (__go_execute_callback__, args, , @@ -10651,7 +10651,7 @@ { gh_manager::auto_lock guard; - return octave_value (gtk_manager::available_toolkits_list ()); + return ovl (gtk_manager::available_toolkits_list ()); } DEFUN (register_graphics_toolkit, args, , @@ -10682,7 +10682,7 @@ { gh_manager::auto_lock guard; - return octave_value (gtk_manager::loaded_toolkits_list ()); + return ovl (gtk_manager::loaded_toolkits_list ()); } DEFUN (drawnow, args, , diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/help.cc --- a/libinterp/corefcn/help.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/help.cc Thu Jan 21 09:47:50 2016 -0800 @@ -1167,7 +1167,7 @@ Undocumented internal function.\n\ @end deftypefn") { - return octave_value (Cell (names (operators_map))); + return ovl (Cell (names (operators_map))); } // Return a cell array of strings containing the names of all @@ -1179,7 +1179,7 @@ Undocumented internal function.\n\ @end deftypefn") { - return octave_value (Cell (names (keywords_map))); + return ovl (Cell (names (keywords_map))); } // Return a cell array of strings containing the names of all builtin @@ -1193,7 +1193,7 @@ { const string_vector bif = symbol_table::built_in_function_names (); - return octave_value (Cell (bif)); + return ovl (Cell (bif)); } static std::string diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/input.cc --- a/libinterp/corefcn/input.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/input.cc Thu Jan 21 09:47:50 2016 -0800 @@ -852,7 +852,7 @@ if (nargin == 1) prompt = args(0).xstring_value ("yes_or_no: PROMPT must be a string"); - return octave_value (octave_yes_or_no (prompt)); + return ovl (octave_yes_or_no (prompt)); } octave_value @@ -1250,7 +1250,7 @@ input_event_hook_functions.insert (hook_fcn.id (), hook_fcn); - return octave_value (hook_fcn.id ()); + return ovl (hook_fcn.id ()); } DEFUN (remove_input_event_hook, args, , diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/inv.cc --- a/libinterp/corefcn/inv.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/inv.cc Thu Jan 21 09:47:50 2016 -0800 @@ -71,7 +71,7 @@ if (arg_is_empty < 0) return ovl (); else if (arg_is_empty > 0) - return octave_value (Matrix ()); + return ovl (Matrix ()); if (nr != nc) err_square_matrix_required ("inverse", "A"); diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/kron.cc --- a/libinterp/corefcn/kron.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/kron.cc Thu Jan 21 09:47:50 2016 -0800 @@ -156,6 +156,7 @@ { MTA am = octave_value_extract (a); MTB bm = octave_value_extract (b); + return octave_value (kron (am, bm)); } diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/load-path.cc --- a/libinterp/corefcn/load-path.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/load-path.cc Thu Jan 21 09:47:50 2016 -0800 @@ -2300,7 +2300,7 @@ @seealso{path, addpath, rmpath, genpath, pathdef, savepath, pathsep}\n\ @end deftypefn") { - return octave_value (load_path::get_command_line_path ()); + return ovl (load_path::get_command_line_path ()); } DEFUN (restoredefaultpath, , , @@ -2313,7 +2313,7 @@ { load_path::initialize (true); - return octave_value (load_path::system_path ()); + return ovl (load_path::system_path ()); } // Return Octave's original default list of directories in which to @@ -2327,7 +2327,7 @@ Undocumented internal function.\n\ @end deftypefn") { - return octave_value (load_path::system_path ()); + return ovl (load_path::system_path ()); } DEFUN (path, args, nargout, @@ -2368,7 +2368,7 @@ } if (nargout > 0) - return octave_value (load_path::path ()); + return ovl (load_path::path ()); else if (nargin == 0 && nargout == 0) { octave_stdout << diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/pager.cc --- a/libinterp/corefcn/pager.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/pager.cc Thu Jan 21 09:47:50 2016 -0800 @@ -635,7 +635,7 @@ size(0) = command_editor::terminal_rows (); size(1) = command_editor::terminal_cols (); - return octave_value (size); + return ovl (size); } DEFUN (page_output_immediately, args, nargout, diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/pinv.cc --- a/libinterp/corefcn/pinv.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/pinv.cc Thu Jan 21 09:47:50 2016 -0800 @@ -66,7 +66,7 @@ if (arg_is_empty < 0) return ovl (); else if (arg_is_empty > 0) - return octave_value (Matrix ()); + return ovl (Matrix ()); octave_value retval; diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/rand.cc Thu Jan 21 09:47:50 2016 -0800 @@ -1173,7 +1173,7 @@ idx.resize (dim_vector (1, m)); // Now create an array object with a cached idx_vector. - return octave_value (new octave_matrix (r, idx_vector (idx))); + return ovl (new octave_matrix (r, idx_vector (idx))); } /* diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/strfns.cc --- a/libinterp/corefcn/strfns.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/strfns.cc Thu Jan 21 09:47:50 2016 -0800 @@ -259,6 +259,7 @@ } } + // Cannot use ovl. Relies on overloaded octave_value call. return octave_value (result, '\''); } diff -r ba0a4b4f021d -r df7891224709 libinterp/corefcn/urlwrite.cc --- a/libinterp/corefcn/urlwrite.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/corefcn/urlwrite.cc Thu Jan 21 09:47:50 2016 -0800 @@ -515,7 +515,7 @@ curl_handle ch = ch_manager::make_curl_handle (host, user, passwd, octave_stdout); - return octave_value (ch.value ()); + return ovl (ch.value ()); } DEFUN (__ftp_pwd__, args, , diff -r ba0a4b4f021d -r df7891224709 libinterp/dldfcn/chol.cc --- a/libinterp/dldfcn/chol.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/dldfcn/chol.cc Thu Jan 21 09:47:50 2016 -0800 @@ -182,7 +182,7 @@ if (arg_is_empty < 0) return ovl (); if (arg_is_empty > 0) - return octave_value (Matrix ()); + return ovl (Matrix ()); if (arg.is_sparse_type ()) { diff -r ba0a4b4f021d -r df7891224709 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Thu Jan 21 09:47:50 2016 -0800 @@ -3730,7 +3730,7 @@ Undocumented internal function.\n\ @end deftypefn") { - return octave_value (new octave_classdef_superclass_ref (args)); + return ovl (new octave_classdef_superclass_ref (args)); } DEFUN (__meta_class_query__, args, , diff -r ba0a4b4f021d -r df7891224709 libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Thu Jan 21 11:24:36 2016 -0500 +++ b/libinterp/octave-value/ov-struct.cc Thu Jan 21 09:47:50 2016 -0800 @@ -1671,8 +1671,6 @@ @seealso{cell2struct, fieldnames, getfield, setfield, rmfield, isfield, orderfields, isstruct, structfun}\n\ @end deftypefn") { - octave_value retval; - int nargin = args.length (); // struct ([]) returns an empty struct. @@ -1684,14 +1682,10 @@ // compatibility with Matlab. if (nargin == 1 && args(0).is_map ()) - return args(0); + return ovl (args(0)); if (nargin == 1 && args(0).is_object ()) - { - retval = args(0).map_value (); - - return retval; - } + return ovl (args(0).map_value ()); if ((nargin == 1 || nargin == 2) && args(0).is_empty () && args(0).is_real_matrix ()) @@ -1700,12 +1694,10 @@ { Array cstr = args(1).xcellstr_value ("struct: second argument should be a cell array of field names"); - retval = octave_map (args(0).dims (), cstr); + return ovl (octave_map (args(0).dims (), cstr)); } else - retval = octave_map (args(0).dims ()); - - return retval; + return ovl (octave_map (args(0).dims ())); } // Check for "field", VALUE pairs. @@ -1737,9 +1729,9 @@ } else if (dims != argdims) { - error ("struct: dimensions of parameter %d do not match those of parameter %d", + error ("struct: dimensions of parameter %d " + "do not match those of parameter %d", first_dimensioned_value, i+1); - return retval; } } } @@ -1776,7 +1768,7 @@ map.setfield (key, Cell (dims, args(i+1))); } - return octave_value (map); + return ovl (map); } /*