Blt_Tree(3) | Blt Library Procedures | Blt_Tree(3) |
Blt_Tree - Tree data object.
#include <bltTree.h> struct Blt_Tree { Tcl_Alloc(size) Tcl_Free(ptr) char * Tcl_Realloc(ptr, size)
These procedures provide a platform and compiler independent interface for memory allocation. Programs that need to transfer ownership of memory blocks between Tcl and other modules should use these routines rather than the native malloc() and free() routines provided by the C run-time library.
Tcl_Alloc returns a pointer to a block of at least size bytes suitably aligned for any use.
Tcl_Free makes the space referred to by ptr available for further allocation.
Tcl_Realloc changes the size of the block pointed to by ptr to size bytes and returns a pointer to the new block. The contents will be unchanged up to the lesser of the new and old sizes. The returned location may be different from ptr.
The following library routines allow you to create and destroy tree objects. Each tree object has a name that uniquely identifies it. Tree objects can also be shared. For example, the tree and hiertable commands may access the same tree data object. Each client grabs a token associated with the tree. When all tokens are released the tree data object is automatically destroyed.
Tree objects initially contain only a root node. You can add or delete nodes with the following routines.
Each node can have zero or more children nodes. These routines let you navigate the tree hierarchy.
Data values can be stored at any node. Values have by both a string key and a Tcl_Obj value. Data value keys do not have to be homogenous across all nodes (i.e. nodes do not have to contain the same keys). There is also a special node array data type.
alloc, allocation, free, malloc, memory, realloc
2.5 | BLT |