# HG changeset patch # User John W. Eaton # Date 1334867216 14400 # Node ID 1c0f0e8f9a1b457b78ceec026ee1e976a8988874 # Parent 3a9a56999ce5138e4fb0732021a5b1ffe18735e4# Parent 000cd393f3c1391f57569bb79746cd5c2314807f maint: periodic merge of stable to default diff -r 3a9a56999ce5 -r 1c0f0e8f9a1b doc/interpreter/system.txi --- a/doc/interpreter/system.txi Tue Apr 17 13:18:56 2012 -0400 +++ b/doc/interpreter/system.txi Thu Apr 19 16:26:56 2012 -0400 @@ -53,7 +53,7 @@ Microseconds after the second (0-999999). @item sec -Seconds after the minute (0-61). This number can be 61 to account +Seconds after the minute (0-60). This number can be 60 to account for leap seconds. @item min diff -r 3a9a56999ce5 -r 1c0f0e8f9a1b src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc Tue Apr 17 13:18:56 2012 -0400 +++ b/src/ov-usr-fcn.cc Thu Apr 19 16:26:56 2012 -0400 @@ -602,6 +602,9 @@ if (takes_varargs ()) symbol_table::varref ("varargin") = va_args.cell_value (); + // Force .ignored. variable to be undefined by default. + symbol_table::varref (".ignored.") = octave_value (); + if (lvalue_list) { octave_idx_type nbh = 0; @@ -623,11 +626,11 @@ } symbol_table::varref (".ignored.") = bh; - - symbol_table::mark_hidden (".ignored."); - symbol_table::mark_automatic (".ignored."); } } + + symbol_table::mark_hidden (".ignored."); + symbol_table::mark_automatic (".ignored."); } DEFUN (nargin, args, , @@ -924,3 +927,40 @@ return retval; } + +/* +%!function [x, y] = try_isargout () +%! if (isargout (1)) +%! if (isargout (2)) +%! x = 1; y = 2; +%! else +%! x = -1; +%! endif +%! else +%! if (isargout (2)) +%! y = -2; +%! else +%! error ("no outputs requested"); +%! endif +%! endif +%!endfunction +%! +%!test +%! [x, y] = try_isargout (); +%! assert ([x, y], [1, 2]); +%! +%!test +%! [x, ~] = try_isargout (); +%! assert (x, -1); +%! +%!test +%! [~, y] = try_isargout (); +%! assert (y, -2); +%! +%!error [~, ~] = try_isargout (); +%! +%% Check to see that isargout isn't sticky: +%!test +%! [x, y] = try_isargout (); +%! assert ([x, y], [1, 2]); +*/ diff -r 3a9a56999ce5 -r 1c0f0e8f9a1b src/pt-assign.cc --- a/src/pt-assign.cc Tue Apr 17 13:18:56 2012 -0400 +++ b/src/pt-assign.cc Thu Apr 19 16:26:56 2012 -0400 @@ -431,7 +431,30 @@ } } else - error ("element number %d undefined in return list", k+1); + { + // This can happen for a function like + // + // function varargout = f () + // varargout{1} = nargout; + // endfunction + // + // called with + // + // [a, ~] = f (); + // + // Then the list of of RHS values will contain one + // element but we are iterating over the list of all + // RHS values. We shouldn't complain that a value we + // don't need is missing from the list. + + if (ult.is_black_hole ()) + { + k++; + continue; + } + else + error ("element number %d undefined in return list", k+1); + } } if (error_state) @@ -467,6 +490,19 @@ return retval; } +/* +%!function varargout = f () +%! varargout{1} = nargout; +%!endfunction +%! +%!test +%! [a, ~] = f (); +%! assert (a, 2); +%!test +%! [a, ~, ~, ~, ~] = f (); +%! assert (a, 5); +*/ + std::string tree_multi_assignment::oper (void) const {