modifications for centralizing the printing of a source line
[unix-history] / usr / src / usr.bin / pascal / pdx / tree.h
CommitLineData
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
22typedef 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 30STACK stack[];
ccc7210e
ML
31STACK *sp;
32
33NODE *build(); /* create a node in the parse tree */
34prtree(); /* print a tree in source form */
35eval(); /* evaluate a tree, leaving value on stack */
36tfree(); /* release storage for a tree */
37BOOLEAN tr_equal(); /* test if two trees are structurally equivalent */
38BOOLEAN cond(); /* evaluate a node for a conditional */
39ADDRESS lval(); /* return the object address of a node */
40BOOLEAN isredirected(); /* TRUE if output is being redirected */