Two common container data structures can be represented directly with
tree nodes. A
TREE_LIST is a singly linked list containing two
trees per node. These are the
of each node. (Often, the
TREE_PURPOSE contains some kind of
tag, or additional information, while the
TREE_VALUE contains the
majority of the payload. In other cases, the
NULL_TREE, while in still others both the
TREE_VALUE are of equal stature.) Given
TREE_LIST node, the next node is found by following the
TREE_CHAIN. If the
you have reached the end of the list.
TREE_VEC is a simple vector. The
TREE_VEC_LENGTH is an
integer (not a tree) giving the number of nodes in the vector. The
nodes themselves are accessed using the
TREE_VEC_ELT macro, which
takes two arguments. The first is the
TREE_VEC in question; the
second is an integer indicating which element in the vector is desired.
The elements are indexed from zero.