while (tok == '&' || tok == tLABEL || tok == tCONST || tok != tELLIPS && matchtoken(','));
while (tok == '&' || tok == tLABEL || tok == tCONST || (tok != tELLIPS && matchtoken(',')));
declargs(symbol * sym){#define MAXTAGS 16   char               *ptr;   int                 argcnt, oldargcnt, tok, tags[MAXTAGS], numtags;   cell                val;   arginfo             arg, *arglist;   char                name[sNAMEMAX + 1];   int                 ident, fpublic, fconst;   int                 idx;   /* if the function is already defined earlier, get the number of    * arguments of the existing definition    */   oldargcnt = 0;   if ((sym->usage & uPROTOTYPED) != 0)      while (sym->dim.arglist[oldargcnt].ident != 0)	 oldargcnt++;   argcnt = 0;			/* zero aruments up to now */   ident = iVARIABLE;   numtags = 0;   fconst = FALSE;   fpublic = (sym->usage & uPUBLIC) != 0;   /* the '(' parantheses has already been parsed */   if (!matchtoken(')'))     {	do	  {			/* there are arguments; process them */	     /* any legal name increases argument count (and stack offset) */	     tok = lex(&val, &ptr);	     switch (tok)	       {	       case 0:		  /* nothing */		  break;	       case '&':		  if (ident != iVARIABLE || numtags > 0)		     error(1, "-identifier-", "&");		  ident = iREFERENCE;		  break;	       case tCONST:		  if (ident != iVARIABLE || numtags > 0)		     error(1, "-identifier-", "const");		  fconst = TRUE;		  break;	       case tLABEL:		  if (numtags > 0)		     error(1, "-identifier-", "-tagname-");		  tags[0] = sc_addtag(ptr);		  numtags = 1;		  break;	       case '{':		  if (numtags > 0)		     error(1, "-identifier-", "-tagname-");		  numtags = 0;		  while (numtags < MAXTAGS)		    {		       if (!matchtoken('_') && !needtoken(tSYMBOL))			  break;		       tokeninfo(&val, &ptr);		       tags[numtags++] = sc_addtag(ptr);		       if (matchtoken('}'))			  break;		       needtoken(',');		    }		/* for */		  needtoken(':');		  tok = tLABEL;	/* for outer loop:				 * flag that we have seen a tagname */		  break;	       case tSYMBOL:		  if (argcnt >= sMAXARGS)		     error(45);	/* too many function arguments */		  strcpy(name, ptr);	/* save symbol name */		  if (name[0] == PUBLIC_CHAR)		     error(56, name);	/* function arguments cannot be public */		  if (numtags == 0)		     tags[numtags++] = 0;	/* default tag */		  /* Stack layout:		   *   base + 0*sizeof(cell)  == previous "base"		   *   base + 1*sizeof(cell)  == function return address		   *   base + 2*sizeof(cell)  == number of arguments		   *   base + 3*sizeof(cell)  == first argument of the function		   * So the offset of each argument is:		   * "(argcnt+3) * sizeof(cell)".		   */		  doarg(name, ident, (argcnt + 3) * sizeof(cell), tags, numtags,			fpublic, fconst, &arg);		  if (fpublic && arg.hasdefault)		     error(59, name);	/* arguments of a public function may not					 * have a default value */		  if ((sym->usage & uPROTOTYPED) == 0)		    {		       /* redimension the argument list, add the entry */		       sym->dim.arglist =			  (arginfo *) realloc(sym->dim.arglist,					      (argcnt + 2) * sizeof(arginfo));		       if (sym->dim.arglist == 0)			  error(103);	/* insufficient memory */		       sym->dim.arglist[argcnt] = arg;		       sym->dim.arglist[argcnt + 1].ident = 0;	/* keep the list 								 * terminated */		    }		  else		    {		       /* check the argument with the earlier definition */		       if (argcnt > oldargcnt			   || !argcompare(&sym->dim.arglist[argcnt], &arg))			  error(25);	/* function definition does not match prototype */		       /* may need to free default array argument and the tag list */		       if (arg.ident == iREFARRAY && arg.hasdefault)			  free(arg.defvalue.array.data);		       else if (arg.ident == iVARIABLE				&& ((arg.hasdefault & uSIZEOF) != 0				    || (arg.hasdefault & uTAGOF) != 0))			  free(arg.defvalue.size.symname);		       free(arg.tags);		    }		/* if */		  argcnt++;		  ident = iVARIABLE;		  numtags = 0;		  fconst = FALSE;		  break;	       case tELLIPS:		  if (ident != iVARIABLE)		     error(10);	/* illegal function or declaration */		  if (numtags == 0)		     tags[numtags++] = 0;	/* default tag */		  if ((sym->usage & uPROTOTYPED) == 0)		    {		       /* redimension the argument list, add the entry iVARARGS */		       sym->dim.arglist =			  (arginfo *) realloc(sym->dim.arglist,					      (argcnt + 2) * sizeof(arginfo));		       if (sym->dim.arglist == 0)			  error(103);	/* insufficient memory */		       sym->dim.arglist[argcnt + 1].ident = 0;	/* keep the list 								 * terminated */		       sym->dim.arglist[argcnt].ident = iVARARGS;		       sym->dim.arglist[argcnt].hasdefault = FALSE;		       sym->dim.arglist[argcnt].defvalue.val = 0;		       sym->dim.arglist[argcnt].defvalue_tag = 0;		       sym->dim.arglist[argcnt].numtags = numtags;		       sym->dim.arglist[argcnt].tags =			  (int *)malloc(numtags * sizeof tags[0]);		       if (sym->dim.arglist[argcnt].tags == NULL)			  error(103);	/* insufficient memory */		       memcpy(sym->dim.arglist[argcnt].tags, tags,			      numtags * sizeof tags[0]);		    }		  else		    {		       if (argcnt > oldargcnt			   || sym->dim.arglist[argcnt].ident != iVARARGS)			  error(25);	/* function definition does not match prototype */		    }		/* if */		  argcnt++;		  break;	       default:		  error(10);	/* illegal function or declaration */	       }		/* switch */	  }	while (tok == '&' || tok == tLABEL || tok == tCONST || tok != tELLIPS && matchtoken(','));	/* more? */	/* if the next token is not ",", it should be ")" */	needtoken(')');     }				/* if */   /* resolve any "sizeof" arguments (now that all arguments are known) */   assert(sym->dim.arglist != NULL);   arglist = sym->dim.arglist;   for (idx = 0; idx < argcnt && arglist[idx].ident != 0; idx++)     {	if ((arglist[idx].hasdefault & uSIZEOF) != 0	    || (arglist[idx].hasdefault & uTAGOF) != 0)	  {	     int                 altidx;	     /* Find the argument with the name mentioned after the "sizeof".	      * Note that we cannot use findloc here because we need the 	      * arginfo struct, not the symbol.	      */	     ptr = arglist[idx].defvalue.size.symname;	     for (altidx = 0;		  altidx < argcnt && strcmp(ptr, arglist[altidx].name) != 0;		  altidx++)		/* nothing */ ;	     if (altidx >= argcnt)	       {		  error(17, ptr);	/* undefined symbol */	       }	     else	       {		  /* check the level against the number of dimensions */		  /* the level must be zero for "tagof" values */		  assert(arglist[idx].defvalue.size.level == 0			 || (arglist[idx].hasdefault & uSIZEOF) != 0);		  if (arglist[idx].defvalue.size.level > 0		      && arglist[idx].defvalue.size.level >=		      arglist[altidx].numdim)		     error(28);	/* invalid subscript */		  if (arglist[altidx].ident != iREFARRAY)		    {		       assert(arglist[altidx].ident == iVARIABLE			      || arglist[altidx].ident == iREFERENCE);		       error(223, ptr);	/* redundant sizeof */		    }		/* if */	       }		/* if */	  }			/* if */     }				/* for */   sym->usage |= uPROTOTYPED;   errorset(sRESET);		/* reset error flag (clear the "panic mode") */   return argcnt;}