Debian Codegraph @

man/Blt_Tree.man3

raw
1 '\"
2 '\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 '\" RCS: @(#) $Id: Blt_Tree.man3,v 1.1.1.1 2009/05/09 16:27:39 pcmacdon Exp $
8 '\"
9 .so man.macros
10 .TH Blt_Tree 3 BLT_VERSION BLT "Blt Library Procedures"
11 .BS
12 '\" Note: do not modify the .SH NAME line immediately below!
13 .SH NAME
14 Blt_Tree \- Tree data object.
15 .SH SYNOPSIS
16 .nf
17 #include <bltTree.h>
18 .sp
19 struct Blt_Tree {
20 \fBTcl_Alloc\fR(\fIsize\fR)
21 .sp
22 \fBTcl_Free\fR(\fIptr\fR)
23 .sp
24 char *
25 \fBTcl_Realloc\fR(\fIptr, size\fR)
26 .fi
27 .SH ARGUMENTS
28 .AS char *size
29 .AP int size in
30 Size in bytes of the memory block to allocate.
31 .AP char *ptr in
32 Pointer to memory block to free or realloc.
33 .BE
34
35 .SH DESCRIPTION
36 .PP
37 These procedures provide a platform and compiler independent interface
38 for memory allocation. Programs that need to transfer ownership of
39 memory blocks between Tcl and other modules should use these routines
40 rather than the native \fBmalloc()\fR and \fBfree()\fR routines
41 provided by the C run-time library.
42 .PP
43 \fBTcl_Alloc\fR returns a pointer to a block of at least \fIsize\fR
44 bytes suitably aligned for any use.
45 .PP
46 \fBTcl_Free\fR makes the space referred to by \fIptr\fR available for
47 further allocation.
48 .PP
49 \fBTcl_Realloc\fR changes the size of the block pointed to by
50 \fIptr\fR to \fIsize\fR bytes and returns a pointer to the new block.
51 The contents will be unchanged up to the lesser of the new and old
52 sizes. The returned location may be different from \fIptr\fR.
53 .SH TREE OBJECT ROUTINES
54 The following library routines allow you to create and destroy tree
55 objects. Each tree object has a name that uniquely identifies it.
56 Tree objects can also be shared. For example, the \fBtree\fR
57 and \fBhiertable\fR commands may access the same tree data object.
58 Each client grabs a token associated with the tree. When all tokens
59 are released the tree data object is automatically destroyed.
60 .TP 2.0i
61 \fBBlt_TreeCreate\fR
62 Create a tree data object and optionally obtains a token associated
63 with it.
64 .TP
65 \fBBlt_TreeExists\fR
66 Indicates if a tree by a given name exists.
67 .TP
68 \fBBlt_TreeGetToken\fR
69 Obtains a token for an existing tree data object.
70 .TP
71 \fBBlt_TreeReleaseToken\fR
72 Releases a token for a tree data object. The tree object is deleted
73 when all outstanding tokens have been released.
74 .TP
75 \fBBlt_TreeName\fR
76 Returns the name of the tree object.
77 .TP
78 \fBBlt_TreeChangeRoot\fR
79 Specifies a node as the new root to a tree.
80 .SH TREENODE ROUTINES
81 Tree objects initially contain only a root node. You can add or
82 delete nodes with the following routines.
83 .TP 2i
84 \fBBlt_TreeCreateNode\fR
85 Creates a new child node for a given parent in the tree.
86 .TP
87 \fBBlt_TreeDeleteNode\fR
88 Deletes a node and its children.
89 .TP
90 \fBBlt_TreeNodeId\fR
91 Returns the unique node identifier for a node.
92 .TP
93 \fBBlt_TreeGetNode\fR
94 Gets a node based upon its identifier.
95 .TP
96 \fBBlt_TreeFindChild\fR
97 Searches for a child node given by its label in a parent node.
98 .TP
99 \fBBlt_TreeNodeLabel\fR
100 Returns the current label for a node.
101 .TP
102 \fBBlt_TreeRelabelNode\fR
103 Resets a node's label.
104 .TP
105 \fBBlt_TreeNodePath\fR
106 Returns the fullpath to a node.
107 .TP
108 \fBBlt_TreeNodeDepth\fR
109 Returns the depth of the node.
110 .TP
111 \fBBlt_TreeNodeDegree\fR
112 Returns the number of children for a node.
113 .TP
114 \fBBlt_TreeIsLeaf\fR
115 Indicates if a node has no children.
116 .TP
117 \fBBlt_TreeIsBefore\fR
118 Indicates if a node is before another node in depth-first search order.
119 .TP
120 \fBBlt_TreeIsAncestor\fR
121 Indicates if a node is an ancestor or another.
122 .TP
123 \fBBlt_TreeSortNode\fR
124 Sorts the children of a node.
125 .TP
126 \fBBlt_TreeSize\fR
127 Returns the number of nodes in a node and its descendants.
128 .TP
129 \fBBlt_TreeMoveNode\fR
130 .SH NODE NAVIGATION
131 Each node can have zero or more children nodes. These routines
132 let you navigate the tree hierarchy.
133 .TP 2i
134 \fBBlt_TreeNodeParent\fR
135 Returns the parent node.
136 .TP
137 \fBBlt_TreeFirstChild\fR
138 Returns the first child of a parent node.
139 .TP
140 \fBBlt_TreeLastChild\fR
141 Returns the last child of a parent node.
142 .TP
143 \fBBlt_TreeNextSibling\fR
144 Returns the next sibling node in the parent's list of children.
145 .TP
146 \fBBlt_TreePrevSibling\fR
147 Returns the previous sibling node in the parent's list of children.
148 .TP
149 \fBBlt_TreeRootNode\fR
150 Returns the root node of the tree.
151 .TP
152 \fBBlt_TreeNextNode\fR
153 Returns the next node in depth-first order.
154 .TP
155 \fBBlt_TreePrevNode\fR
156 Returns the previous node in depth-first order.
157 .TP
158 \fBBlt_TreeEndNode\fR
159 Returns the last node in the tree as determined by depth-first order.
160 .TP
161 \fBBlt_TreeApply\fR
162 Walks through a node and all it descendants, applying a given
163 callback procedure.
164 .TP
165 \fBBlt_TreeApplyDFS\fR
166 Walks through a node and all it descendants in depth-first search
167 order, applying a given callback procedure.
168 .TP
169 \fBBlt_TreeApplyBFS\fR
170 Walks through a node and all it descendants in breadth-first search
171 order, applying a given callback procedure.
172 .SH NODE DATA VALUES
173 Data values can be stored at any node. Values have by both a string
174 key and a Tcl_Obj value. Data value keys do not have to be homogenous
175 across all nodes (i.e. nodes do not have to contain the same keys).
176 There is also a special node array data type.
177 .TP 2i
178 \fBBlt_TreeGetValue\fR
179 Gets the node data value given by a key.
180 .TP
181 \fBBlt_TreeValueExists\fR
182 Indicates if a node data value given by a key exists.
183 .TP
184 \fBBlt_TreeSetValue\fR
185 Sets a node's value of a key.
186 .TP
187 \fBBlt_TreeUnsetValue\fR
188 Remove the node data value and key.
189 .TP
190 \fBBlt_TreeGetArrayValue\fR
191 Gets the node data array value given by a key and an array index.
192 .TP
193 \fBBlt_TreeSetArrayValue\fR
194 Sets the node data array value given by a key and an array index.
195 .TP
196 \fBBlt_TreeUnsetArrayValue\fR
197 Remove the node data array value.
198 .TP
199 \fBBlt_TreeArrayValueExists\fR
200 Determines if an array element by a given index exists.
201 .TP
202 \fBBlt_TreeFirstKey\fR
203 Returns the key of the first value in the node.
204 .TP
205 \fBBlt_TreeNextKey\fR
206 Returns the key of the next value in the node.
207 .TP
208 \fBBlt_TreePrivateValue\fR
209 Lock the value to current client, making it private.
210 .TP
211 \fBBlt_TreePublicValue\fR
212 Unlock the value so that all clients can access it.
213 .TP
214 \fBBlt_TreeGetKey\fR
215 .SH NODE TRACES
216 .TP 2i
217 \fBBlt_TreeCreateTrace\fR
218 Sets up a trace callback to be invoked when the node value is
219 read, set, or unset.
220 .TP
221 \fBBlt_TreeDeleteTrace\fR
222 Deletes an existing trace.
223 .SH NODE EVENTS
224 .TP 2i
225 \fBBlt_TreeCreateEventHandler\fR
226 Sets up a callback to be invoked when events (create, delete,
227 relabel, etc) take place on a node.
228 .TP
229 \fBBlt_TreeDeleteEventHandler\fR
230 Deletes an existing node callback.
231 .SH KEYWORDS
232 alloc, allocation, free, malloc, memory, realloc
233