|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)tree.h 5.1 (Berkeley) 6/6/85 ! 7: */ ! 8: ! 9: /* ! 10: * This file contains the declarations of the variables and routines ! 11: * within the "tree" subdirectory that are accessible from outside. ! 12: */ ! 13: ! 14: #include "tree/opinfo.h" ! 15: ! 16: /* ! 17: * Evaluation stack manipulation macros. These are publically ! 18: * available because "eval" leaves it's result on the stack. ! 19: * ! 20: * These macros allow one to operate on stacks of arbitrary types ! 21: * (including a stack of different typed objects). ! 22: * ! 23: * Sadly, underflow and overflow are not checked for. ! 24: */ ! 25: ! 26: typedef char STACK; ! 27: ! 28: #define WMASK (sizeof(int) - 1) ! 29: ! 30: #define push(type, value) ((type *) (sp += sizeof(type)))[-1] = (value) ! 31: #define pop(type) (*((type *) (sp -= sizeof(type)))) ! 32: #define alignstack() sp = (char *) (( ((int) sp) + WMASK)&~WMASK) ! 33: ! 34: STACK stack[]; ! 35: STACK *sp; ! 36: ! 37: NODE *build(); /* create a node in the parse tree */ ! 38: prtree(); /* print a tree in source form */ ! 39: eval(); /* evaluate a tree, leaving value on stack */ ! 40: long popsmall(); /* pop a small item from the stack given its type */ ! 41: tfree(); /* release storage for a tree */ ! 42: BOOLEAN tr_equal(); /* test if two trees are structurally equivalent */ ! 43: BOOLEAN cond(); /* evaluate a node for a conditional */ ! 44: ADDRESS lval(); /* return the object address of a node */ ! 45: BOOLEAN isredirected(); /* TRUE if output is being redirected */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.