| 1 |
'\" |
| 2 |
'\" Copyright 1991-1998 by Bell Labs Innovations for Lucent Technologies. |
| 3 |
'\" |
| 4 |
'\" Permission to use, copy, modify, and distribute this software and its |
| 5 |
'\" documentation for any purpose and without fee is hereby granted, provided |
| 6 |
'\" that the above copyright notice appear in all copies and that both that the |
| 7 |
'\" copyright notice and warranty disclaimer appear in supporting documentation, |
| 8 |
'\" and that the names of Lucent Technologies any of their entities not be used |
| 9 |
'\" in advertising or publicity pertaining to distribution of the software |
| 10 |
'\" without specific, written prior permission. |
| 11 |
'\" |
| 12 |
'\" Lucent Technologies disclaims all warranties with regard to this software, |
| 13 |
'\" including all implied warranties of merchantability and fitness. In no event |
| 14 |
'\" shall Lucent Technologies be liable for any special, indirect or |
| 15 |
'\" consequential damages or any damages whatsoever resulting from loss of use, |
| 16 |
'\" data or profits, whether in an action of contract, negligence or other |
| 17 |
'\" tortuous action, arising out of or in connection with the use or performance |
| 18 |
'\" of this software. |
| 19 |
'\" |
| 20 |
'\" |
| 21 |
.so man.macros |
| 22 |
.TH Blt_TreeCreate 3 BLT_VERSION BLT "BLT Library Procedures" |
| 23 |
.BS |
| 24 |
.SH NAME |
| 25 |
Blt_TreeCreate \- Create tree data object. |
| 26 |
.SH SYNOPSIS |
| 27 |
.nf |
| 28 |
\fB#include <bltTree.h>\fR |
| 29 |
.sp |
| 30 |
int |
| 31 |
\fBBlt_TreeCreate\fR(\fIinterp\fR, \fIname\fR, \fItokenPtr\fR) |
| 32 |
.fi |
| 33 |
.SH ARGUMENTS |
| 34 |
.AS Tcl_Interp *interp |
| 35 |
.AP Tcl_Interp *interp in |
| 36 |
Interpreter to report results back to. |
| 37 |
.AP "const char" *name in |
| 38 |
Name of the new tree. Can be qualified by a namespace. |
| 39 |
.AP Blt_Tree *tokenPtr out |
| 40 |
If not NULL, points to location to store the client tree token. |
| 41 |
.BE |
| 42 |
.SH DESCRIPTION |
| 43 |
.PP |
| 44 |
This procedure creates a C-based tree data object and optionally |
| 45 |
returns a token to it. The arguments are as follows: |
| 46 |
.TP 1i |
| 47 |
\fIinterp\fR |
| 48 |
Interpreter to report results back to. If an error occurs, then |
| 49 |
interp->result will contain an error message. |
| 50 |
.TP 1i |
| 51 |
\fIname\fR |
| 52 |
Name of the new tree object. You can think of \fIname\fR as |
| 53 |
the memory address of the object. It's a unique name that identifies |
| 54 |
the tree object. No tree object \fIname\fR |
| 55 |
can already exist. \fIName\fR can be qualified by a namespace such |
| 56 |
as \fBfred::myTree\fR. If no namespace qualifier is used, the tree |
| 57 |
will be created in the current namespace, not the global namespace. |
| 58 |
If a qualifier is present, the namespace must already exist. |
| 59 |
.TP 1i |
| 60 |
\fItokenPtr\fR |
| 61 |
Holds the returned token. \fITokenPtr\fR points to a location |
| 62 |
where it is stored. Tree tokens are used to work with the tree object. |
| 63 |
If NULL, no token is allocated. You can later use |
| 64 |
\fBTcl_TreeGetToken\fR to obtain a token. |
| 65 |
.PP |
| 66 |
The new tree data object created will initially contain only a root |
| 67 |
node. You can add new nodes with \fBBlt_TreeCreateNode\fR. |
| 68 |
.PP |
| 69 |
Optionally a token for the tree data object is returned. Tree data |
| 70 |
objects can be shared. For example, the \fBtree\fR and |
| 71 |
\fBhiertable\fR commands may be accessing the same tree data object. |
| 72 |
Each client grabs a token that is associated with the tree. When all |
| 73 |
tokens are released (see \fBBlt_TreeReleaseToken\fR) the tree data |
| 74 |
object is automatically destroyed. |
| 75 |
.PP |
| 76 |
.SH RETURNS |
| 77 |
A standard Tcl result is returned. If TCL_ERROR is returned, then |
| 78 |
\fIinterp->result\fR will contain an error message. The following |
| 79 |
errors may occur: |
| 80 |
.IP \(bu 3 |
| 81 |
There already exists a tree by the same name as \fIname\fR. You can |
| 82 |
use \fBTcl_TreeExists\fR to determine if a tree exists beforehand. |
| 83 |
.IP \(bu |
| 84 |
The tree name is prefixed by a namespace that doesn't exist. If you |
| 85 |
qualified the tree name with a namespace, the namespace must exist. |
| 86 |
Unlike Tcl procs and variables, the namespace is not automatically |
| 87 |
created for you. |
| 88 |
.IP \(bu |
| 89 |
Memory can't be allocated for the tree or token. |
| 90 |
.SH EXAMPLE |
| 91 |
The following example creates a new |
| 92 |
.CS |
| 93 |
Blt_Tree token; |
| 94 |
|
| 95 |
if (Blt_TreeCreate(interp, "myTree", &token) != TCL_OK) { |
| 96 |
return TCL_ERROR; |
| 97 |
} |
| 98 |
printf("tree is %s\\n", Blt_TreeName(token)); |
| 99 |
.CE |
| 100 |
.SH KEYWORDS |
| 101 |
Tcl_TreeGetToken, Tcl_TreeExists, Tcl_TreeReleaseToken |