lengthExpr(2)

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

NAME
lengthExpr - returns the number of arguments in an expression

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

PARAMETER

expr
    expression

DESCRIPTION
lengthExpr() returns the number of arguments of expr of the first level. If expr is an atomic expression, the function returns 1.

EXAMPLE
#include "mutnnn.h"		/* mbk utilities */
#include "logmmm.h"
chain_list *expr;
expr = createExpr(OR);
addQExpr(expr,createAtom("a"));
addQExpr(expr,createAtom("b"));
printf("%d",lengthExpr(expr));
/* it will display
2
*/
freeExpr(expr);

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

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

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