numberAtomExpr(2)

ORIGIN
Cao-vlsi libraries, log package, libablmmm.a

NAME
numberAtomExpr - returns the number of atoms in an expression

SYNOPSIS
#include "logmmm.h"
int numberAtomExpr(expr)
chain_list *expr;

PARAMETER

expr
    expression

DESCRIPTION
numberAtomExpr() returns the number of atoms of expr.

EXAMPLE
#include "mutnnn.h"		/* mbk utilities */
#include "logmmm.h"
chain_list *expr1,*expr2;
expr1 = createExpr(OR);
addQExpr(expr1,createAtom("a"));
addQExpr(expr1,createAtom("b"));
expr2 = createExpr(OR);
addQExpr(expr2,createAtom("c"));
addQExpr(expr2,createAtom("d"));
addQExpr(expr1,expr2);
printf("%d",numberAtomExpr(expr1));
/* it will display
4
*/
freeExpr(expr1);		/* don't free expr2 ! */

PROGRAM
int numberAtomExpr(expr)
chain_list *expr;
{
if (ATOM(expr))
   return(1)
else
   {
   int cpt = 0;
   while (expr = CDR(expr))
      cpt = cpt + numberAtomExpr(CAR(expr));
   return(cpt);
   }
}

SEE ALSO
log(1), abl(1), profExpr(2), lengthExpr(2), equalExpr(2), equalVarExpr(2), searchExpr(2), searchOperExpr(2).

SUPPORT STATUS
if bugs arise, please e-mail to cao-vlsi@masi.ibp.fr