Commit | Line | Data |
---|---|---|
ccc7210e ML |
1 | /* Copyright (c) 1982 Regents of the University of California */ |
2 | ||
df3ebce4 | 3 | /* static char sccsid[] = "@(#)tree.h 1.3 %G%"; */ |
ccc7210e ML |
4 | |
5 | /* | |
6 | * This file contains the declarations of the variables and routines | |
7 | * within the "tree" subdirectory that are accessible from outside. | |
8 | */ | |
9 | ||
10 | #include "tree/opinfo.h" | |
11 | ||
12 | /* | |
13 | * Evaluation stack manipulation macros. These are publically | |
14 | * available because "eval" leaves it's result on the stack. | |
15 | * | |
16 | * These macros allow one to operate on stacks of arbitrary types | |
17 | * (including a stack of different typed objects). | |
18 | * | |
19 | * Sadly, underflow and overflow are not checked for. | |
20 | */ | |
21 | ||
22 | typedef char STACK; | |
23 | ||
ccc7210e ML |
24 | #define WMASK (sizeof(int) - 1) |
25 | ||
26 | #define push(type, value) ((type *) (sp += sizeof(type)))[-1] = (value) | |
27 | #define pop(type) (*((type *) (sp -= sizeof(type)))) | |
28 | #define alignstack() sp = (char *) (( ((int) sp) + WMASK)&~WMASK) | |
29 | ||
df3ebce4 | 30 | STACK stack[]; |
ccc7210e ML |
31 | STACK *sp; |
32 | ||
33 | NODE *build(); /* create a node in the parse tree */ | |
34 | prtree(); /* print a tree in source form */ | |
35 | eval(); /* evaluate a tree, leaving value on stack */ | |
36 | tfree(); /* release storage for a tree */ | |
37 | BOOLEAN tr_equal(); /* test if two trees are structurally equivalent */ | |
38 | BOOLEAN cond(); /* evaluate a node for a conditional */ | |
39 | ADDRESS lval(); /* return the object address of a node */ | |
40 | BOOLEAN isredirected(); /* TRUE if output is being redirected */ |