Mercurial > hg > octave-nkf
changeset 20711:1f330d33388f
maint: Periodic merge of stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 22 Sep 2015 04:50:47 -0700 |
parents | bb09279e5c99 (current diff) caa5de39147e (diff) |
children | afdb856e44f1 |
files | NEWS libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-usr-fcn.cc |
diffstat | 10 files changed, 40 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -322,6 +322,7 @@ finite | isfinite fmod | rem fnmatch | glob or regexp + gmap40 | ---- loadaudio | audioread luinc | ilu or ichol mouse_wheel_zoom | mousewheelzoom axes property
--- a/doc/interpreter/image.txi +++ b/doc/interpreter/image.txi @@ -196,15 +196,6 @@ @DOCSTRING(contrast) -An additional colormap is @code{gmap40}. This code map contains only -colors with integer values of the red, green and blue components. This -is a workaround for a limitation of gnuplot 4.0, that does not allow the color -of line or patch objects to be set. @code{gmap40} is chiefly useful to gnuplot -4.0 users, and particularly in conjunction with the @var{bar}, @var{surf}, -and @var{contour} functions. - -@DOCSTRING(gmap40) - The following three functions modify the existing colormap rather than replace it.
--- a/doc/interpreter/vectorize.txi +++ b/doc/interpreter/vectorize.txi @@ -455,25 +455,19 @@ @noindent that may have relied on matrices of different size producing an error. -Due to how broadcasting changes semantics with older versions of Octave, -by default Octave warns if a broadcasting operation is performed. To -disable this warning, refer to its ID (@pxref{XREFwarning_ids,,warning_ids}): +Because such operation is now valid Octave syntax, this will no longer +produce an error. Instead, the following code should be used: @example -warning ("off", "Octave:broadcast"); +@group +if (isequal (size (a), size (b))) + c = a .* b; +else + c = a .* a; +endif +@end group @end example -@noindent -If you want to recover the old behavior and produce an error, turn this -warning into an error: - -@example -warning ("error", "Octave:broadcast"); -@end example - -@noindent -For broadcasting on scalars that worked in previous versions of Octave, -this warning will not be emitted. @node Function Application @section Function Application
--- a/libgui/src/octave-cmd.cc +++ b/libgui/src/octave-cmd.cc @@ -78,5 +78,5 @@ command_editor::set_initial_input (pending_input); command_editor::redisplay (); - command_editor::interrupt (); + command_editor::accept_line (); }
--- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -1856,8 +1856,8 @@ functions are ignored in the lookup.\n\ \n\ Note: @code{str2func} does not currently accept strings which define\n\ -anonymous functions (those which begin with @samp{a}).\n\ -Use @code{eval (@var{str})} as a replacement.\n\ +anonymous functions (those which begin with @samp{@@}).\n\ +Use @w{@code{eval (@var{str})}} as a replacement.\n\ @seealso{func2str, inline}\n\ @end deftypefn") {
--- a/libinterp/octave-value/ov-usr-fcn.cc +++ b/libinterp/octave-value/ov-usr-fcn.cc @@ -866,7 +866,10 @@ std::string name = func.string_value (); func = symbol_table::find_function (name); if (func.is_undefined ()) - error ("nargout: invalid function name: %s", name.c_str ()); + { + error ("nargin: invalid function name: %s", name.c_str ()); + return retval; + } } octave_function *fcn_val = func.function_value (); @@ -973,7 +976,10 @@ std::string name = func.string_value (); func = symbol_table::find_function (name); if (func.is_undefined ()) - error ("nargout: invalid function name: %s", name.c_str ()); + { + error ("nargout: invalid function name: %s", name.c_str ()); + return retval; + } } if (func.is_inline_function ())
--- a/libinterp/octave.cc +++ b/libinterp/octave.cc @@ -714,7 +714,8 @@ octave_print_terse_usage_and_exit (); } - an_octave_program = (script_file || ! code_to_eval.empty ()) && ! persist; + an_octave_program = ((script_file || ! code_to_eval.empty ()) + && ! persist && ! traditional); }
--- a/scripts/plot/draw/private/__ezplot__.m +++ b/scripts/plot/draw/private/__ezplot__.m @@ -71,35 +71,13 @@ fun = varargin{1}; if (ischar (fun)) if (exist (fun, "file") || exist (fun, "builtin")) - fun = inline ([fun "(t)"]); + fun = str2func (fun); # convert to function handle else - fun = vectorize (inline (fun)); - endif - argids = argnames (fun); - if (isplot && length (argids) == 2) - nargs = 2; - elseif (numel (argids) != nargs) - error ("%s: expecting a function of %d arguments", ezfunc, nargs); + fun = vectorize (inline (fun)); # convert to inline function endif - fstr = formula (fun); - if (isplot) - xarg = argids{1}; - if (nargs == 2) - yarg = argids{2}; - else - yarg = ""; - endif - elseif (isplot3) - xarg = "x"; - yarg = "y"; - elseif (ispolar) - xarg = ""; - yarg = ""; - else - xarg = argids{1}; - yarg = argids{2}; - endif - elseif (strcmp (typeinfo (fun), "inline function")) + endif + + if (strcmp (typeinfo (fun), "inline function")) argids = argnames (fun); if (isplot && length (argids) == 2) nargs = 2; @@ -133,6 +111,11 @@ fstr = fstr(idx+2:end); # remove '@(x) ' from string name else args = {"x"}; + try + if (builtin ("nargin", fun) == 2) + args{2} = "y"; + endif + end_try_catch endif if (isplot && length (args) == 2) nargs = 2;
--- a/scripts/time/asctime.m +++ b/scripts/time/asctime.m @@ -19,14 +19,14 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} asctime (@var{tm_struct}) ## Convert a time structure to a string using the following -## format: @qcode{"ddd mmm mm HH:MM:SS yyyy"}. +## format: @qcode{"ddd mmm mm HH:MM:SS yyyy@xbackslashchar{}n"}. ## ## For example: ## ## @example ## @group ## asctime (localtime (time ())) -## @result{} "Mon Feb 17 01:15:06 1997" +## @result{} "Mon Feb 17 01:15:06 1997@xbackslashchar{}n" ## @end group ## @end example ## @@ -51,6 +51,8 @@ %! t = time (); %! assert (strcmp (asctime (localtime (t)), ctime (t))); +%!assert (asctime (localtime (time ()))(end), "\n") + %!error asctime () %!error asctime (1, 2)
--- a/scripts/time/ctime.m +++ b/scripts/time/ctime.m @@ -28,7 +28,7 @@ ## @example ## @group ## ctime (time ()) -## @result{} "Mon Feb 17 01:15:06 1997" +## @result{} "Mon Feb 17 01:15:06 1997@xbackslashchar{}n" ## @end group ## @end example ## @seealso{asctime, time, localtime} @@ -51,6 +51,8 @@ %! t = time (); %! assert (strcmp (asctime (localtime (t)), ctime (t))); +%!assert (ctime (time ())(end), "\n") + %!error ctime () %!error ctime (1, 2)