diff src/bytecode.c @ 1737:68ed93de81b7

[xemacs-hg @ 2003-10-10 11:50:56 by stephent] E Benson bytecomp patch <87oewpmi1m.fsf_-_@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Fri, 10 Oct 2003 11:51:05 +0000
parents 2264738f7ae4
children 90502933fb98
line wrap: on
line diff
--- a/src/bytecode.c	Fri Oct 10 10:51:11 2003 +0000
+++ b/src/bytecode.c	Fri Oct 10 11:51:05 2003 +0000
@@ -1724,6 +1724,48 @@
   int varbind_count;
   Opbyte *program;
 
+  {
+    int minargs = 0, maxargs = 0, totalargs = 0;
+    int optional_p = 0, rest_p = 0, i = 0;
+    {
+      LIST_LOOP_2 (arg, f->arglist)
+	{
+	  if (EQ (arg, Qand_optional))
+	    optional_p = 1;
+	  else if (EQ (arg, Qand_rest))
+	    rest_p = 1;
+	  else
+	    {
+	      if (rest_p)
+		{
+		  maxargs = MANY;
+		  totalargs++;
+		  break;
+		}
+	      if (!optional_p)
+		minargs++;
+	      maxargs++;
+	      totalargs++;
+	    }
+	}
+    }
+  
+    if (totalargs)
+      f->args = xnew_array (Lisp_Object, totalargs);
+
+    {
+      LIST_LOOP_2 (arg, f->arglist)
+	{
+	  if (!EQ (arg, Qand_optional) && !EQ (arg, Qand_rest))
+	    f->args[i++] = arg;
+	}
+    }
+
+    f->max_args = maxargs;
+    f->min_args = minargs;
+    f->args_in_array = totalargs;
+  }
+  
   /* If we have not actually read the bytecode string
      and constants vector yet, fetch them from the file.  */
   if (CONSP (f->instructions))