Mercurial > hg > octave-shane
changeset 15580:673889d49256
maint: merge in Juan Pablo's changes
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Fri, 02 Nov 2012 15:19:05 -0400 |
parents | 5fb80374c881 (current diff) cef958fbae2d (diff) |
children | 5649e84ea3ce |
files | |
diffstat | 8 files changed, 154 insertions(+), 100 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/oop.txi +++ b/doc/interpreter/oop.txi @@ -495,6 +495,13 @@ @cindex transpose, complex-conjugate @cindex unary minus +@c Need at least one plaintext sentence here between the @node and @float +@c table below or the two will overlap due to a bug in Texinfo. +@c This is not our fault; this *is* a ridiculous kluge. +The following table shows, for each built-in numerical operation, the +corresponding function name to use when providing an overloaded method for a +user class. + @float Table,tab:overload_ops @opindex + @opindex -
--- a/libinterp/interpfcn/debug.cc +++ b/libinterp/interpfcn/debug.cc @@ -794,21 +794,24 @@ DEFUN (dbtype, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} dbtype ()\n\ -@deftypefnx {Built-in Function} {} dbtype (\"startl:endl\")\n\ -@deftypefnx {Built-in Function} {} dbtype (\"startl:end\")\n\ -@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\")\n\ -@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl\")\n\ -@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl:endl\")\n\ -@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl:end\")\n\ -When in debugging mode and called with no arguments, list the script file\n\ -being debugged with line numbers. An optional range specification,\n\ -specified as a string, can be used to list only a portion of the file.\n\ -The special keyword \"end\" is a valid line number specification.\n\ +@deftypefn {Command} {} dbtype\n\ +@deftypefnx {Command} {} dbtype @var{lineno}\n\ +@deftypefnx {Command} {} dbtype @var{startl:endl}\n\ +@deftypefnx {Command} {} dbtype @var{startl:end}\n\ +@deftypefnx {Command} {} dbtype @var{func}\n\ +@deftypefnx {Command} {} dbtype @var{func} @var{lineno}\n\ +@deftypefnx {Command} {} dbtype @var{func} @var{startl:endl}\n\ +@deftypefnx {Command} {} dbtype @var{func} @var{startl:end}\n\ +Display a script file with line numbers.\n\ \n\ -When called with the name of a function, list that script file\n\ -with line numbers.\n\ -@seealso{dbstatus, dbstop}\n\ +When called with no arguments in debugging mode, display the script file\n\ +currently being debugged. An optional range specification can be used to\n\ +list only a portion of the file. The special keyword \"end\" is a valid\n\ +line number specification for the last line of the file.\n\ +\n\ +When called with the name of a function, list that script file with line\n\ +numbers.\n\ +@seealso{dbwhere, dbstatus, dbstop}\n\ @end deftypefn") { octave_value retval;
--- a/libinterp/interpfcn/load-save.cc +++ b/libinterp/interpfcn/load-save.cc @@ -1121,6 +1121,14 @@ use_zlib = true; } #endif + else if (argv[i] == "-struct") + { + retval.append (argv[i]); + } + else if (argv[i][0] == '-') + { + error ("save: Unrecognized option '%s'", argv[i].c_str ()); + } else retval.append (argv[i]); }
--- a/libinterp/interpfcn/symtab.h +++ b/libinterp/interpfcn/symtab.h @@ -1772,15 +1772,18 @@ inst->do_mark_global (name); } + // exclude: Storage classes to exclude, you can OR them together static std::list<symbol_record> all_variables (scope_id scope = xcurrent_scope, context_id context = xdefault_context, - bool defined_only = true) + bool defined_only = true, + unsigned int exclude = symbol_record::hidden) { symbol_table *inst = get_instance (scope); return inst - ? inst->do_all_variables (context, defined_only) : std::list<symbol_record> (); + ? inst->do_all_variables (context, defined_only, exclude) + : std::list<symbol_record> (); } static std::list<symbol_record> glob (const std::string& pattern) @@ -2538,7 +2541,8 @@ } std::list<symbol_record> - do_all_variables (context_id context, bool defined_only) const + do_all_variables (context_id context, bool defined_only, + unsigned int exclude) const { std::list<symbol_record> retval; @@ -2546,7 +2550,8 @@ { const symbol_record& sr = p->second; - if (defined_only && ! sr.is_defined (context)) + if ((defined_only && ! sr.is_defined (context)) + || (sr.xstorage_class () & exclude)) continue; retval.push_back (sr);
--- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -1311,6 +1311,7 @@ %! mode = modes{i}; %! nm = tmpnam (); %! unwind_protect +%! f2 (1); # bug #33857 %! save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2"); %! clear f2 g2 hm2 hdld2 hbi2 %! load (nm);
--- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -1136,22 +1136,6 @@ { bool break_on_this_statement = false; - // Don't decrement break flag unless we are in the same frame as we - // were when we saw the "dbstep N" command. - - if (dbstep_flag > 1) - { - if (octave_call_stack::current_frame () == current_frame) - { - // Don't allow dbstep N to step past end of current frame. - - if (is_end_of_fcn_or_script) - dbstep_flag = 1; - else - dbstep_flag--; - } - } - if (octave_debug_on_interrupt_state) { break_on_this_statement = true; @@ -1168,17 +1152,29 @@ current_frame = octave_call_stack::current_frame (); } - else if (dbstep_flag == 1) + else if (dbstep_flag > 0) { if (octave_call_stack::current_frame () == current_frame) { - // We get here if we are doing a "dbstep" or a "dbstep N" - // and the count has reached 1 and we are in the current - // debugging frame. + if (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. + + break_on_this_statement = true; - break_on_this_statement = true; + dbstep_flag = 0; + } + else + { + // Executing "dbstep N". Decrease N by one and continue. - dbstep_flag = 0; + dbstep_flag--; + } + } } else if (dbstep_flag == -1)
--- a/scripts/plot/area.m +++ b/scripts/plot/area.m @@ -18,26 +18,37 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} area (@var{x}, @var{y}) -## @deftypefnx {Function File} {} area (@var{x}, @var{y}, @var{lvl}) +## @deftypefn {Function File} {} area (@var{y}) +## @deftypefnx {Function File} {} area (@var{x}, @var{y}) +## @deftypefnx {Function File} {} area (@dots{}, @var{lvl}) ## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{}) -## @deftypefnx {Function File} {} area (@var{y}, @dots{}) ## @deftypefnx {Function File} {} area (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} area (@dots{}) -## Area plot of cumulative sum of the columns of @var{y}. This shows the -## contributions of a value to a sum, and is functionally similar to +## Area plot of the columns of @var{y}. This shows the +## contributions of each column value to the row sum. It is functionally similar to ## @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the area under ## the curve is shaded. ## -## If the @var{x} argument is omitted it is assumed to be given by +## If the @var{x} argument is omitted it defaults to ## @code{1 : rows (@var{y})}. A value @var{lvl} can be defined that determines -## where the base level of the shading under the curve should be defined. +## where the base level of the shading under the curve should be defined. The +## default level is 0. ## -## Additional arguments to the @code{area} function are passed to -## @code{patch}. +## Additional arguments to the @code{area} function are passed directly to +## @code{patch}. ## ## The optional return value @var{h} is a graphics handle to the hggroup -## object representing the area patch objects. +## object representing the area patch objects. The "BaseValue" property +## of the hggroup can be used to adjust the level where shading begins. +## +## Example: Verify identity sin^2 + cos^2 = 1 +## +## @example +## t = linspace (0, 2*pi, 100)'; +## y = [sin(t).^2, cos(t).^2)]; +## area (t, y); +## legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside'); +## @end example ## @seealso{plot, patch} ## @end deftypefn @@ -45,60 +56,60 @@ [ax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:}); - if (nargin > 0) - idx = 1; - x = y = []; - bv = 0; - args = {}; - ## Check for (X) or (X,Y) arguments and possible base value. - if (nargin >= idx && ismatrix (varargin{idx})) - y = varargin{idx}; - idx++; - if (nargin >= idx) - if (isscalar (varargin{idx})) + if (nargin == 0) + print_usage (); + endif + + idx = 1; + x = y = []; + bv = 0; + args = {}; + ## Check for (X) or (X,Y) arguments and possible base value. + if (nargin >= idx && ismatrix (varargin{idx})) + y = varargin{idx}; + idx++; + if (nargin >= idx) + if (isscalar (varargin{idx})) + bv = varargin{idx}; + idx++; + elseif (ismatrix (varargin{idx})) + x = y; + y = varargin{idx}; + idx++; + if (nargin >= idx && isscalar (varargin{idx})) bv = varargin{idx}; idx++; - elseif (ismatrix (varargin{idx})) - x = y; - y = varargin{idx}; - idx++; - if (nargin >= idx && isscalar (varargin{idx})) - bv = varargin{idx}; - idx++; - endif endif endif - else - print_usage (); - endif - ## Check for additional args. - if (nargin >= idx) - args = {varargin{idx:end}}; - endif - newplot (); - if (isvector (y)) - y = y(:); - endif - if (isempty (x)) - x = repmat ([1:rows(y)]', 1, columns (y)); - elseif (isvector (x)) - x = repmat (x(:), 1, columns (y)); - endif - - oldax = gca (); - unwind_protect - axes (ax); - tmp = __area__ (ax, x, y, bv, args{:}); - unwind_protect_cleanup - axes (oldax); - end_unwind_protect - - if (nargout > 0) - h = tmp; endif else print_usage (); endif + ## Check for additional args. + if (nargin >= idx) + args = {varargin{idx:end}}; + endif + newplot (); + if (isvector (y)) + y = y(:); + endif + if (isempty (x)) + x = repmat ([1:rows(y)]', 1, columns (y)); + elseif (isvector (x)) + x = repmat (x(:), 1, columns (y)); + endif + + oldax = gca (); + unwind_protect + axes (ax); + tmp = __area__ (ax, x, y, bv, args{:}); + unwind_protect_cleanup + axes (oldax); + end_unwind_protect + + if (nargout > 0) + h = tmp; + endif endfunction @@ -157,9 +168,9 @@ function update_props (h, d) kids = get (h, "children"); set (kids, "edgecolor", get (h, "edgecolor"), - "linewidth", get (h, "linewidth"), - "linestyle", get (h, "linestyle"), - "facecolor", get (h, "facecolor")); + "linewidth", get (h, "linewidth"), + "linestyle", get (h, "linestyle"), + "facecolor", get (h, "facecolor")); endfunction function move_baseline (h, d) @@ -206,3 +217,26 @@ y0 = y1; endfor endfunction + + +%!demo +%! # Verify identity sin^2 + cos^2 = 1 +%! clf; +%! t = linspace (0, 2*pi, 100)'; +%! y = [sin(t).^2, cos(t).^2]; +%! area (t, y); +%! legend ('sin^2', 'cos^2', 'location', 'NorthEastOutside'); + +%!demo +%! # Show effects of setting BaseValue +%! clf; +%! x = [-2:0.1:2]'; +%! y = x.^2 - 1; +%! subplot (1, 2, 1) +%! area (x, y); +%! title ({'Parabola y = x^2 -1';'BaseValue = 0'}); +%! subplot (1, 2, 2) +%! h = area (x, y); +%! set (h, 'basevalue', -1); +%! title ({'Parabola y = x^2 -1';'BaseValue = -1'}); +
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -976,7 +976,7 @@ set (t1, "deletefcn", ""); delete (t1); for i = 1 : numel (hplots) - if (strcmp (get (hplots(i), "type"), "line")) + if (ishandle (hplots(i)) && strcmp (get (hplots (i), "type"), "line")) dellistener (hplots(i), "color"); dellistener (hplots(i), "linestyle"); dellistener (hplots(i), "marker");