
#include "yodl.h"

void
gram_ADDTOCOUNTER ()
{
  char
   *name, *addst;
  int
    addnr, index;

  name = gram_parlist (builtin[idx_ADDTOCOUNTER], 0);
  index = gram_findcounter (builtin[idx_ADDTOCOUNTER], name);
  addst = gram_parlist (builtin[idx_ADDTOCOUNTER], 0);
  addnr = gram_onenumber (builtin[idx_ADDTOCOUNTER], addst);

  message (3, "%s %s %s\n", builtin[idx_ADDTOCOUNTER], name, addst);
  counterval[index] += addnr;

  free (name);
  free (addst);
}
