summaryrefslogtreecommitdiff
path: root/cpp.h
diff options
context:
space:
mode:
authorotto <otto>2007-10-12 07:23:55 +0000
committerotto <otto>2007-10-12 07:23:55 +0000
commit83650bc133fbf9213f2c1f3c7bb0f6990205d1f0 (patch)
tree822ded25a70f5cc86331f4536f3be73279a705f6 /cpp.h
parent580bad01e8dd336eb807a440bbf15e641e748954 (diff)
rewrite of constant expression evaluation; taking into account
signed vs unsigned and shortcutting of && and || ok ragge@
Diffstat (limited to 'cpp.h')
-rw-r--r--cpp.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/cpp.h b/cpp.h
index f59618f..c065ddc 100644
--- a/cpp.h
+++ b/cpp.h
@@ -90,6 +90,34 @@ struct initar {
char *str;
};
+struct val {
+ 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);
+
struct recur; /* not used outside cpp.c */
int subst(struct symtab *, struct recur *);
struct symtab *lookup(usch *namep, int enterf);