diff src/parse.y @ 3726:b7d997d593d9

[project @ 2000-10-27 17:51:21 by jwe]
author jwe
date Fri, 27 Oct 2000 17:51:27 +0000 (2000-10-27)
parents 7066a8065e7e
children e10451597802
line wrap: on
line diff
--- a/src/parse.y
+++ b/src/parse.y
@@ -3253,6 +3253,11 @@
   return retval;
 }
 
+// Evaluate an Octave function (built-in or interpreted) and return
+// the list of result values.  the results.  NAME is the name of the
+// function to call.  ARGS are the arguments to the function.  NARGOUT
+// is the number of output arguments expected.
+
 octave_value_list
 feval (const std::string& name, const octave_value_list& args, int nargout)
 {
@@ -3266,6 +3271,12 @@
   return retval;
 }
 
+// Evaluate an Octave function (built-in or interpreted) and return
+// the list of result values.  The first element of ARGS should be a
+// string containing the name of the function to call, then the rest
+// are the actual arguments to the function.  NARGOUT is the number of
+// output arguments expected.
+
 octave_value_list
 feval (const octave_value_list& args, int nargout)
 {
@@ -3288,11 +3299,16 @@
 
 	  if (! arg_names.empty ())
 	    {
-	      assert (arg_names.length () == tmp_nargin + 1);
-
-	      string_vector tmp_arg_names (tmp_nargin);
-
-	      for (int i = 0; i < tmp_nargin; i++)
+	      // tmp_nargin and arg_names.length () - 1 may differ if
+	      // we are passed all_va_args.
+
+	      int n = arg_names.length () - 1;
+
+	      int len = n > tmp_nargin ? tmp_nargin : n;
+
+	      string_vector tmp_arg_names (len);
+
+	      for (int i = 0; i < len; i++)
 		tmp_arg_names(i) = arg_names(i+1);
 
 	      tmp_args.stash_name_tags (tmp_arg_names);