Annotation of libwww/Library/src/HTBTree.html, revision 1.2
1.1 timbl 1: <PRE>
2: /* Balanced Binary Tree for sorting things HTBTree.h
3: ** =======================================
4: **
5: ** Tree createion, trversal and freeing. User-supplied
6: ** comparison routine.
7: */
8:
9:
10: typedef struct _HTBTree_element {
11: void *object; /* User object */
12: struct _HTBTree_element *up;
13: struct _HTBTree_element *left;
14: int left_depth;
15: struct _HTBTree_element *right;
16: int right_depth;
17: } HTBTElement;
18:
19: typedef (int *HTComparer) PARAMS((void * a, void * b));
20:
21: typedef struct _HTBTree_top {
22: HTComparer compare;
23: struct _HTBTree_element *top;
24: } HTBTree;
25:
26:
27: /* Create a binary tree given its discrimination routine
28: ** -----------------------------------------------------
29: */
30:
31: extern HTBTree * HTBTree_new PARAMS((HTComparer comp));
32:
33:
34: /* Free storage
35: ** ------------
36: */
37: extern void HTBTree_free PARAMS((HTBTree* tree));
38:
39:
40: /* Add an object to a binary tree
41: ** ------------------------------
42: */
43:
44: extern void HTBTree_add PARAMS((HTBTree* tree, void * object));
45:
46:
47: /* Find user object for element
48: ** ---------------------------
49: */
50:
1.2 ! timbl 51: #define HTBTree_object(element) ((element)->object)
1.1 timbl 52:
53:
54: /* Find next element in depth-first order
55: ** -------------------------------------
56: **
57: ** On entry,
58: ** ele if NULL, start with leftmost element.
59: ** if != 0 give next object to the right.
60: **
61: ** returns Pointer to element ot NULL if none left.
62: **
63: */
64:
65: extern HTBTElement * HTBTree_next PARAMS((HTBTree* tree, HTBTElement * ele));
66:
67:
68: </PRE>
Webmaster