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