| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
<HTML> |
| 6 |
<HEAD> |
| 7 |
<TITLE>Blt_TreeGetToken(3) manual page</TITLE> |
| 8 |
</HEAD> |
| 9 |
<BODY bgcolor=white> |
| 10 |
<A HREF="#toc">Table of Contents</A><P> |
| 11 |
|
| 12 |
<H2><A NAME="sect0" HREF="#toc0">Name</A></H2> |
| 13 |
Blt_TreeGetToken - Grabs a token |
| 14 |
associated with existing tree data object. |
| 15 |
<H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2> |
| 16 |
<BR> |
| 17 |
<PRE>#include <bltTree.h> |
| 18 |
|
| 19 |
int |
| 20 |
Blt_TreeGetToken(interp, name, tokenPtr) |
| 21 |
</PRE> |
| 22 |
<H2><A NAME="sect2" HREF="#toc2">Arguments</A></H2> |
| 23 |
<P> |
| 24 |
Tcl_Interp <I>*interp</I><tt> </tt> <tt> </tt> (in)<BR> |
| 25 |
<tt> </tt> <tt> </tt> Interpreter to report results back to. <P> |
| 26 |
const char <I>*name</I><tt> </tt> <tt> </tt> (in)<BR> |
| 27 |
<tt> </tt> <tt> </tt> Name of an existing tree data object. Can be qualified by a namespace. <P> |
| 28 |
Blt_Tree |
| 29 |
<I>*tokenPtr</I><tt> </tt> <tt> </tt> (out)<BR> |
| 30 |
<tt> </tt> <tt> </tt> Points to location to store the client tree token. |
| 31 |
<H2><A NAME="sect3" HREF="#toc3">Description</A></H2> |
| 32 |
<P> |
| 33 |
This procedure |
| 34 |
obtains a token to a C-based tree data object. The arguments are as follows: |
| 35 |
|
| 36 |
<DL> |
| 37 |
|
| 38 |
<DT><I>interp</I> </DT> |
| 39 |
<DD>Interpreter to report results back to. If an error occurs, then |
| 40 |
interp->result will contain an error message. </DD> |
| 41 |
|
| 42 |
<DT><I>name</I> </DT> |
| 43 |
<DD>Name of an existing tree |
| 44 |
data object. It's an error if a tree <I>name</I> doesn't already exist. <I>Name</I> can |
| 45 |
be qualified by a namespace such as fred::myTree. If no namespace qualifier |
| 46 |
is used, the tree the current namespace is searched, then the global namespace. |
| 47 |
</DD> |
| 48 |
|
| 49 |
<DT><I>tokenPtr</I> </DT> |
| 50 |
<DD>Points to the location where the returned token is stored. A tree |
| 51 |
token is used to work with the tree object. </DD> |
| 52 |
</DL> |
| 53 |
<P> |
| 54 |
A token for the tree data |
| 55 |
object is returned. Tree data objects can be shared. For example, the <B>tree</B> |
| 56 |
and <B>hiertable</B> commands may be accessing the same tree data object. Each |
| 57 |
client grabs a token that is associated with the tree. When all tokens |
| 58 |
are released (see <B>Blt_TreeReleaseToken</B>) the tree data object is automatically |
| 59 |
destroyed. <P> |
| 60 |
|
| 61 |
<H2><A NAME="sect4" HREF="#toc4">Returns</A></H2> |
| 62 |
A standard Tcl result is returned. If TCL_ERROR is returned, |
| 63 |
then <I>interp->result</I> will contain an error message. The following errors may |
| 64 |
occur: |
| 65 |
<UL> |
| 66 |
<LI>No tree exists as <I>name</I>. You can use <B>Tcl_TreeExists</B> to determine if |
| 67 |
a tree exists beforehand. </LI><LI>Memory can't be allocated for the token. </LI> |
| 68 |
</UL> |
| 69 |
|
| 70 |
<H2><A NAME="sect5" HREF="#toc5">Example</A></H2> |
| 71 |
The |
| 72 |
following example allocated a token for an existing tree. <BR> |
| 73 |
<CODE>Blt_Tree token;<BR> |
| 74 |
<P> |
| 75 |
if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) {<BR> |
| 76 |
return TCL_ERROR;<BR> |
| 77 |
}<BR> |
| 78 |
printf("tree is %s\n", Blt_TreeName(token));<BR> |
| 79 |
|
| 80 |
<H2><A NAME="sect6" HREF="#toc6"></CODE>See Also</A></H2> |
| 81 |
Tcl_TreeCreate, Tcl_TreeExists, Tcl_TreeReleaseToken <P> |
| 82 |
|
| 83 |
<HR><P> |
| 84 |
<A NAME="toc"><B>Table of Contents</B></A><P> |
| 85 |
<UL> |
| 86 |
<LI><A NAME="toc0" HREF="#sect0">Name</A></LI> |
| 87 |
<LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> |
| 88 |
<LI><A NAME="toc2" HREF="#sect2">Arguments</A></LI> |
| 89 |
<LI><A NAME="toc3" HREF="#sect3">Description</A></LI> |
| 90 |
<LI><A NAME="toc4" HREF="#sect4">Returns</A></LI> |
| 91 |
<LI><A NAME="toc5" HREF="#sect5">Example</A></LI> |
| 92 |
<LI><A NAME="toc6" HREF="#sect6">See Also</A></LI> |
| 93 |
</UL> |
| 94 |
</BODY></HTML> |