diff options
author | Chris Lattner <sabre@nondot.org> | 2002-09-17 23:03:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-09-17 23:03:30 +0000 |
commit | 633a5b1aacb135957b20e5f11e779ea23ccb9619 (patch) | |
tree | 3ddd35119d12cadf13e31f3cae9f67b057332440 /utils/Burg/operator.c | |
parent | 24b70926d5750dacadc3252f8fbcc964b369e2af (diff) | |
download | external_llvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.zip external_llvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.tar.gz external_llvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.tar.bz2 |
Initial checkin of burg files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/Burg/operator.c')
-rw-r--r-- | utils/Burg/operator.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/utils/Burg/operator.c b/utils/Burg/operator.c new file mode 100644 index 0000000..a6df9e3 --- /dev/null +++ b/utils/Burg/operator.c @@ -0,0 +1,48 @@ +char rcsid_operator[] = "$Id$"; + +#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); +} + |