1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 /* static char sccsid[] = "@(#)tree.h 1.2 01/18/82"; */ 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 24 #define STACKSIZE 1024 25 #define WMASK (sizeof(int) - 1) 26 27 #define push(type, value) ((type *) (sp += sizeof(type)))[-1] = (value) 28 #define pop(type) (*((type *) (sp -= sizeof(type)))) 29 #define alignstack() sp = (char *) (( ((int) sp) + WMASK)&~WMASK) 30 31 STACK stack[STACKSIZE]; 32 STACK *sp; 33 34 NODE *build(); /* create a node in the parse tree */ 35 prtree(); /* print a tree in source form */ 36 eval(); /* evaluate a tree, leaving value on stack */ 37 tfree(); /* release storage for a tree */ 38 BOOLEAN tr_equal(); /* test if two trees are structurally equivalent */ 39 BOOLEAN cond(); /* evaluate a node for a conditional */ 40 ADDRESS lval(); /* return the object address of a node */ 41 BOOLEAN isredirected(); /* TRUE if output is being redirected */ 42