<!-- manual page source format generated by PolyglotMan v3.0.9, --> <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> <HTML> <HEAD> <TITLE>Blt_TreeCreate(3) manual page</TITLE> </HEAD> <BODY bgcolor=white> <A HREF="#toc">Table of Contents</A><P> <H2><A NAME="sect0" HREF="#toc0">Name</A></H2> Blt_TreeCreate - Create tree data object. <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2> <BR> <PRE>#include <bltTree.h> int Blt_TreeCreate(interp, name, tokenPtr) </PRE> <H2><A NAME="sect2" HREF="#toc2">Arguments</A></H2> <P> Tcl_Interp <I>*interp</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Interpreter to report results back to. <P> const char <I>*name</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Name of the new tree. Can be qualified by a namespace. <P> Blt_Tree <I>*tokenPtr</I><tt> </tt> <tt> </tt> (out)<BR> <tt> </tt> <tt> </tt> If not NULL, points to location to store the client tree token. <H2><A NAME="sect3" HREF="#toc3">Description</A></H2> <P> This procedure creates a C-based tree data object and optionally returns a token to it. The arguments are as follows: <DL> <DT><I>interp</I> </DT> <DD>Interpreter to report results back to. If an error occurs, then interp->result will contain an error message. </DD> <DT><I>name</I> </DT> <DD>Name of the new tree object. You can think of <I>name</I> as the memory address of the object. It's a unique name that identifies the tree object. No tree object <I>name</I> can already exist. <I>Name</I> can be qualified by a namespace such as fred::myTree. 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. </DD> <DT><I>tokenPtr</I> </DT> <DD>Holds the returned token. <I>TokenPtr</I> 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 <B>Tcl_TreeGetToken</B> to obtain a token. </DD> </DL> <P> The new tree data object created will initially contain only a root node. You can add new nodes with <B>Blt_TreeCreateNode</B>. <P> Optionally a token for the tree data object is returned. Tree data objects can be shared. For example, the <B>tree</B> and <B>hiertable</B> 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 <B>Blt_TreeReleaseToken</B>) the tree data object is automatically destroyed. <P> <H2><A NAME="sect4" HREF="#toc4">Returns</A></H2> A standard Tcl result is returned. If TCL_ERROR is returned, then <I>interp->result</I> will contain an error message. The following errors may occur: <UL> <LI>There already exists a tree by the same name as <I>name</I>. You can use <B>Tcl_TreeExists</B> to determine if a tree exists beforehand. </LI><LI>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. </LI><LI>Memory can't be allocated for the tree or token. </LI> </UL> <H2><A NAME="sect5" HREF="#toc5">Example</A></H2> The following example creates a new <BR> <CODE>Blt_Tree token;<BR> <P> if (Blt_TreeCreate(interp, "myTree", &token) != TCL_OK) {<BR> return TCL_ERROR;<BR> }<BR> printf("tree is %s\n", Blt_TreeName(token));<BR> <H2><A NAME="sect6" HREF="#toc6"></CODE>Keywords</A></H2> Tcl_TreeGetToken, Tcl_TreeExists, Tcl_TreeReleaseToken <P> <HR><P> <A NAME="toc"><B>Table of Contents</B></A><P> <UL> <LI><A NAME="toc0" HREF="#sect0">Name</A></LI> <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> <LI><A NAME="toc2" HREF="#sect2">Arguments</A></LI> <LI><A NAME="toc3" HREF="#sect3">Description</A></LI> <LI><A NAME="toc4" HREF="#sect4">Returns</A></LI> <LI><A NAME="toc5" HREF="#sect5">Example</A></LI> <LI><A NAME="toc6" HREF="#sect6">Keywords</A></LI> </UL> </BODY></HTML>