File: Blt_TreeCreate.man3

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

if (Blt_TreeCreate(interp, "myTree", &token) != TCL_OK) {
    return TCL_ERROR;
}
printf("tree is %s\\n", Blt_TreeName(token));
.CE
.SH KEYWORDS
Tcl_TreeGetToken, Tcl_TreeExists, Tcl_TreeReleaseToken