Mozilla/mozilla/ef/Tools/Burg/operator.c
fur%netscape.com d6c51785c1 Added Todd Proebsting's BURG to the tree, now that it's in the public domain.
git-svn-id: svn://10.0.0.236/trunk@16557 18797224-902f-48f8-a5cc-f745e15eee43
1998-12-17 06:36:50 +00:00

49 lines
764 B
C

char rcsid_operator[] = "$Id: operator.c,v 1.1 1998-12-17 06:36:48 fur%netscape.com Exp $";
#include "b.h"
#include <stdio.h>
int max_arity = -1;
List operators;
List leaves;
Operator
newOperator(name, num, arity) char *name; OperatorNum num; ArityNum arity;
{
Operator op;
assert(arity <= MAX_ARITY);
op = (Operator) zalloc(sizeof(struct operator));
assert(op);
op->name = name;
op->num = num;
op->arity = arity;
operators = newList(op, operators);
return op;
}
void
dumpOperator_s(op) Operator op;
{
printf("Op: %s(%d)=%d\n", op->name, op->arity, op->num);
}
void
dumpOperator(op, full) Operator op; int full;
{
dumpOperator_s(op);
if (full) {
dumpTable(op->table, 0);
}
}
void
dumpOperator_l(op) Operator op;
{
dumpOperator(op, 1);
}