comparison scripts/general/nargoutchk.m @ 11470:eb9e0b597d61

Use common names for variables in documentation and code for a few more m-script files.
author Rik <octave@nomad.inbox5.com>
date Sun, 09 Jan 2011 13:44:15 -0800
parents be55736a0783
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11469:c776f063fefe 11470:eb9e0b597d61
28 ## @seealso{nargchk, error, nargout, nargin} 28 ## @seealso{nargchk, error, nargout, nargin}
29 ## @end deftypefn 29 ## @end deftypefn
30 30
31 ## Author: Bill Denney <bill@denney.ws> 31 ## Author: Bill Denney <bill@denney.ws>
32 32
33 function msg = nargoutchk (mina, maxa, narg, outtype) 33 function msg = nargoutchk (minargs, maxargs, nargs, outtype)
34 34
35 if (nargin < 3 || nargin > 4) 35 if (nargin < 3 || nargin > 4)
36 print_usage (); 36 print_usage ();
37 elseif (mina > maxa) 37 elseif (minargs > maxargs)
38 error ("nargoutchk: minargs must be <= maxargs"); 38 error ("nargoutchk: MINARGS must be <= MAXARGS");
39 elseif (nargin == 3) 39 elseif (nargin == 3)
40 outtype = "string"; 40 outtype = "string";
41 elseif (! any (strcmpi (outtype, {"string" "struct"}))) 41 elseif (! any (strcmpi (outtype, {"string" "struct"})))
42 error ("nargoutchk: output type must be either string or struct"); 42 error ("nargoutchk: output type must be either string or struct");
43 elseif (! (isscalar (mina) && isscalar (maxa) && isscalar (narg))) 43 elseif (! (isscalar (minargs) && isscalar (maxargs) && isscalar (nargs)))
44 error ("nargoutchk: mina, maxa, and narg must be scalars"); 44 error ("nargoutchk: MINARGS, MAXARGS, and NARGS must be scalars");
45 endif 45 endif
46 46
47 msg = struct ("message", "", "identifier", ""); 47 msg = struct ("message", "", "identifier", "");
48 if (narg < mina) 48 if (nargs < minargs)
49 msg.message = "not enough output arguments"; 49 msg.message = "not enough output arguments";
50 msg.identifier = "Octave:nargoutchk:not-enough-outputs"; 50 msg.identifier = "Octave:nargoutchk:not-enough-outputs";
51 elseif (narg > maxa) 51 elseif (nargs > maxargs)
52 msg.message = "too many output arguments"; 52 msg.message = "too many output arguments";
53 msg.identifier = "Octave:nargoutchk:too-many-outputs"; 53 msg.identifier = "Octave:nargoutchk:too-many-outputs";
54 endif 54 endif
55 55
56 if (strcmpi (outtype, "string")) 56 if (strcmpi (outtype, "string"))