Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / include / python2.4 / node.h
CommitLineData
86530b38
AT
1#ifndef Py_NODE_H
2#define Py_NODE_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7typedef struct _node {
8 short n_type;
9 char *n_str;
10 int n_lineno;
11 int n_nchildren;
12 struct _node *n_child;
13} node;
14
15PyAPI_FUNC(node *) PyNode_New(int type);
16PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
17 char *str, int lineno);
18PyAPI_FUNC(void) PyNode_Free(node *n);
19
20/* Node access functions */
21#define NCH(n) ((n)->n_nchildren)
22
23#define CHILD(n, i) (&(n)->n_child[i])
24#define RCHILD(n, i) (CHILD(n, NCH(n) + i))
25#define TYPE(n) ((n)->n_type)
26#define STR(n) ((n)->n_str)
27
28/* Assert that the type of a node is what we expect */
29#define REQ(n, type) assert(TYPE(n) == (type))
30
31PyAPI_FUNC(void) PyNode_ListTree(node *);
32
33#ifdef __cplusplus
34}
35#endif
36#endif /* !Py_NODE_H */