7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI not be used in advertising or publicity pertaining to
19 distribution of the software without specific, written prior permission.
21 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
22 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
23 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
24 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
26 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 ******************************************************************/
31 /* Parse tree node interface */
33 typedef struct _node
{
38 struct _node
*n_child
;
41 extern node
*PyNode_New
Py_PROTO((int type
));
42 extern node
*PyNode_AddChild
Py_PROTO((node
*n
, int type
, char *str
, int lineno
));
43 extern void PyNode_Free
Py_PROTO((node
*n
));
45 /* Node access functions */
46 #define NCH(n) ((n)->n_nchildren)
47 #define CHILD(n, i) (&(n)->n_child[i])
48 #define TYPE(n) ((n)->n_type)
49 #define STR(n) ((n)->n_str)
51 /* Assert that the type of a node is what we expect */
53 #define REQ(n, type) { /*pass*/ ; }
55 #define REQ(n, type) \
56 { if (TYPE(n) != (type)) { \
57 fprintf(stderr, "FATAL: node type %d, required %d\n", \
63 extern void PyNode_ListTree
Py_PROTO((node
*));
68 #endif /* !Py_NODE_H */