Lines Matching refs:node

76 #define TREE_DEFINE(node, field)									\  argument
78 static struct node *_HU_FUNCTION(TREE_BALANCE_##node##_##field)(struct node *); \
80 static struct node *_HU_FUNCTION(TREE_ROTL_##node##_##field)(struct node *self) \
82 struct node *r= self->field.avl_right; \
84 r->field.avl_left= TREE_BALANCE_##node##_##field(self); \
85 return TREE_BALANCE_##node##_##field(r); \
88 static struct node *_HU_FUNCTION(TREE_ROTR_##node##_##field)(struct node *self) \
90 struct node *l= self->field.avl_left; \
92 l->field.avl_right= TREE_BALANCE_##node##_##field(self); \
93 return TREE_BALANCE_##node##_##field(l); \
96 static struct node *_HU_FUNCTION(TREE_BALANCE_##node##_##field)(struct node *self) \
103 self->field.avl_right= TREE_ROTR_##node##_##field(self->field.avl_right); \
104 return TREE_ROTL_##node##_##field(self); \
109 self->field.avl_left= TREE_ROTL_##node##_##field(self->field.avl_left); \
110 return TREE_ROTR_##node##_##field(self); \
121 static struct node *_HU_FUNCTION(TREE_INSERT_##node##_##field) \
122 (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
127 self->field.avl_left= TREE_INSERT_##node##_##field(self->field.avl_left, elm, compare); \
129 self->field.avl_right= TREE_INSERT_##node##_##field(self->field.avl_right, elm, compare); \
130 return TREE_BALANCE_##node##_##field(self); \
133 static struct node *_HU_FUNCTION(TREE_FIND_##node##_##field) \
134 (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
141 return TREE_FIND_##node##_##field(self->field.avl_left, elm, compare); \
143 return TREE_FIND_##node##_##field(self->field.avl_right, elm, compare); \
146 static struct node *_HU_FUNCTION(TREE_MOVE_RIGHT)(struct node *self, struct node *rhs) \
151 return TREE_BALANCE_##node##_##field(self); \
154 static struct node *_HU_FUNCTION(TREE_REMOVE_##node##_##field) \
155 (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
161 struct node *tmp= TREE_MOVE_RIGHT(self->field.avl_left, self->field.avl_right); \
167 self->field.avl_left= TREE_REMOVE_##node##_##field(self->field.avl_left, elm, compare); \
169 self->field.avl_right= TREE_REMOVE_##node##_##field(self->field.avl_right, elm, compare); \
170 return TREE_BALANCE_##node##_##field(self); \
173 static void _HU_FUNCTION(TREE_FORWARD_APPLY_ALL_##node##_##field) \
174 (struct node *self, void (*function)(struct node *node, void *data), void *data) \
178 TREE_FORWARD_APPLY_ALL_##node##_##field(self->field.avl_left, function, data); \
180 TREE_FORWARD_APPLY_ALL_##node##_##field(self->field.avl_right, function, data); \
184 static void _HU_FUNCTION(TREE_REVERSE_APPLY_ALL_##node##_##field) \
185 (struct node *self, void (*function)(struct node *node, void *data), void *data) \
189 TREE_REVERSE_APPLY_ALL_##node##_##field(self->field.avl_right, function, data); \
191 TREE_REVERSE_APPLY_ALL_##node##_##field(self->field.avl_left, function, data); \
195 #define TREE_INSERT(head, node, field, elm) \ argument
196 ((head)->th_root= TREE_INSERT_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
198 #define TREE_FIND(head, node, field, elm) \ argument
199 (TREE_FIND_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
201 #define TREE_REMOVE(head, node, field, elm) \ argument
202 ((head)->th_root= TREE_REMOVE_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
207 #define TREE_FORWARD_APPLY(head, node, field, function, data) \ argument
208 TREE_FORWARD_APPLY_ALL_##node##_##field((head)->th_root, function, data)
210 #define TREE_REVERSE_APPLY(head, node, field, function, data) \ argument
211 TREE_REVERSE_APPLY_ALL_##node##_##field((head)->th_root, function, data)