[Changeset]: Re: cla() ?

John W. Eaton jwe at bevo.che.wisc.edu
Mon Oct 6 13:02:55 CDT 2008


On  6-Oct-2008, Ben Abbott wrote:

| Everything compiled and make check had no problem.
| 
| Given that I don't see any failures, does it make sense to also apply  
| a changeset such as the one I've attached?
| 
| As my c++ skill is wanting, please review this proposal before  
| committing.

I don't see any C++ in this patch.

| diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
| --- a/scripts/plot/__plt_get_axis_arg__.m
| +++ b/scripts/plot/__plt_get_axis_arg__.m
| @@ -32,8 +32,8 @@
|  
|    ## Figure handles are integers, but object handles are non integer,
|    ## therefore ignore integer scalars.
| -  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
| -      && floor(varargin{1}) != varargin{1})
| +  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
| +      && floor(varargin{1}(1)) != varargin{1}(1))

I think a test like

  floor(varargin{1}(1)) != varargin{1}(1))

depends too much on the current implementation of figure handles.
Maybe it would be better to use "! isfigure (varargin{1}(1))" instead?

| diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
| --- a/scripts/plot/hold.m
| +++ b/scripts/plot/hold.m
| @@ -44,8 +44,10 @@
|  
|  function hold (varargin)
|  
| -  if (nargin > 0 && ishandle (varargin{1}))
| +  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
|      [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
| +  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
| +    error ('Invalid input or option')

Unless you can provide a better diagnostic, I think this should just
be a call to print_usage.

jwe


More information about the Octave-maintainers mailing list