summaryrefslogtreecommitdiff
path: root/cpp.h
diff options
context:
space:
mode:
authorragge <ragge>2007-10-18 20:41:41 +0000
committerragge <ragge>2007-10-18 20:41:41 +0000
commit1fe448760d95b13aabd5f78001afcfa52872662e (patch)
tree5ad382a22cc2990cc743356785bb5e9979b549f9 /cpp.h
parent5423d472aaa22fd5bf8b9c342a99a1ea8198ac15 (diff)
More fixes to cpp arithmetic, sanitychecked by otto and stefan.
Diffstat (limited to 'cpp.h')
-rw-r--r--cpp.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/cpp.h b/cpp.h
index 3f4650f..e2688d1 100644
--- a/cpp.h
+++ b/cpp.h
@@ -90,33 +90,22 @@ struct initar {
char *str;
};
-struct val {
+/*
+ * Struct used in parse tree evaluation.
+ * op is one of:
+ * - number type (NUMBER, UNUMBER)
+ * - zero (0) if divided by zero.
+ */
+struct nd {
+ int op;
union {
long long val;
unsigned long long uval;
- } v;
- int type;
-};
-
-struct nd {
- union {
- struct {
- struct nd *left;
- struct nd *right;
- } t;
- struct val v;
} n;
- int op;
};
-#define nd_left n.t.left
-#define nd_right n.t.right
-#define nd_val n.v.v.val
-#define nd_uval n.v.v.uval
-#define nd_type n.v.type
-
-struct nd *mknode(int, struct nd *, struct nd *);
-struct nd *mknum(struct val);
+#define nd_val n.val
+#define nd_uval n.uval
struct recur; /* not used outside cpp.c */
int subst(struct symtab *, struct recur *);