octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patches to script files on argument checking


From: Muthiah Annamalai
Subject: Re: patches to script files on argument checking
Date: Sun, 04 Nov 2007 08:23:47 -0700

> On Sun, 2007-11-04 at 10:07 -0500, John W. Eaton wrote:
> > On  3-Nov-2007, Muthiah Annamalai wrote:
> > 
> > | Patch is attached.
> > | 
> > | The changelog entry will be,
> > | 
> > | 2007-11-03  Muthiah Annamalai  <address@hidden>
> > | 
> > |   * general/isa.m, geometry/inpolygon.m, quaternion/, signal/,
> > |         control/, and sparse/: Fix argument checking.
> > 
> > You need to list the files individually.
> > 
> > | Index: control/base/bode_bounds.m
> > | ===================================================================
> > | RCS file: /cvs/octave/scripts/control/base/bode_bounds.m,v
> > | retrieving revision 1.8
> > | diff -u -p -r1.8 bode_bounds.m
> > | --- control/base/bode_bounds.m    12 Oct 2007 21:27:17 -0000      1.8
> > | +++ control/base/bode_bounds.m    3 Nov 2007 21:47:03 -0000
> > | @@ -35,7 +35,9 @@
> > |  ## @end deftypefn
> > |  
> > |  function [wmin, wmax] = bode_bounds (zer, pol, DIGITAL, tsam)
> > | -
> > | +   
> > | +  if ( nargin != 4 ), print_usage(); endif
> > | +  
> > 
> > If you want this patch to be considered, you will need to follow the
> > coding conventions of Octave, so the above should be written
> > 
> >   if (nargin != 4)
> >     print_usage ();
> >   endif
> > 
> > But I don't think I can apply this patch as it is anyway,
> > because it seems that every case is just
> > 
> >   if (nargin != X)
> > 
> > where X is the number of function parameters.  In many cases, Octave
> > function parameters have default values set, so they can accept fewer
> > arguments.  Have you verified that none of the functions you have
> > modified can accept fewer arguments than are listed in the parameter
> > list?
> > 
> > jwe
> 
> I will correct the style of the patches, and make a new ChangeLog entry.
> 
> AFAIK I checked the files for default arguments. I can do that again, to
> make doubly sure.
> 
> Sometimes the functions accept a first parameter, along with varargin.
> In those cases I did use something like the following,
> 
>    if ( nargin < 1 ), error() , endif
> 
> I will ensure this once more, and get back.
> 
> Thanks,
> Muthu

I have verified for the default cases, and the argument numbers.

I have changed the style of the patches. I have split one patch to the
file scripts/control/util/axis2dlim.m for setting a default case,
through nargin; this patch is in axis.patch.

The argchk.diff has the patches to the argument checking in the files 
mentioned in the previous emails.

The ChangeLog comments are present in changelog.txt .

Thanks,
Muthu







Attachment: argchk.diff
Description: Text Data

Attachment: axis.patch
Description: Text Data

Attachment: changelog.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]