GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TCL_GETCURRENTNAMESPACE (3)

NAME

Tcl_AppendExportList, Tcl_CreateNamespace, Tcl_DeleteNamespace, Tcl_Export, Tcl_FindCommand, Tcl_FindNamespace, Tcl_ForgetImport, Tcl_GetCurrentNamespace, Tcl_GetGlobalNamespace, Tcl_GetNamespaceUnknownHandler, Tcl_Import, Tcl_SetNamespaceUnknownHandler - manipulate namespaces

CONTENTS

Synopsis
Arguments
Description
Keywords

SYNOPSIS

#include <tcl.h>

Tcl_Namespace * Tcl_CreateNamespace(interp, name, clientData, deleteProc)

Tcl_DeleteNamespace(nsPtr)

int Tcl_AppendExportList(interp, nsPtr, objPtr)

int Tcl_Export(interp, nsPtr, pattern, resetListFirst)

int Tcl_Import(interp, nsPtr, pattern, allowOverwrite)

int Tcl_ForgetImport(interp, nsPtr, pattern)

Tcl_Namespace * Tcl_GetCurrentNamespace(interp)

Tcl_Namespace * Tcl_GetGlobalNamespace(interp)

Tcl_Namespace * Tcl_FindNamespace(interp, name, contextNsPtr, flags)

Tcl_Command Tcl_FindCommand(interp, name, contextNsPtr, flags)

Tcl_Obj * Tcl_GetNamespaceUnknownHandler(interp, nsPtr)

int Tcl_SetNamespaceUnknownHandler(interp, nsPtr, handlerPtr)

ARGUMENTS


.TP 15 Tcl_Interp *interp (in/out)
Tcl_Interp*interp Tcl_Interp The interpreter in which the namespace exists and where name lookups are performed. Also where error result messages are written.
.TP 15 const char *name (in)
const char*name const char The name of the namespace or command to be created or accessed.
.TP 15 ClientData clientData (in)
ClientDataclientData ClientData A context pointer by the creator of the namespace. Not interpreted by Tcl at all.
.TP 15 Tcl_NamespaceDeleteProc *deleteProc (in)
Tcl_NamespaceDeleteProc*deleteProc Tcl_NamespaceDeleteProc A pointer to function to call when the namespace is deleted, or NULL if no such callback is to be performed.
.TP 15 Tcl_Namespace *nsPtr (in)
Tcl_Namespace*nsPtr Tcl_Namespace The namespace to be manipulated, or NULL (for other than Tcl_DeleteNamespace) to manipulate the current namespace.
.TP 15 Tcl_Obj *objPtr (out)
Tcl_Obj   *objPtr Tcl_Obj A reference to an unshared object to which the function output will be written.
.TP 15 const char *pattern (in)
const char*pattern const char The glob-style pattern (see Tcl_StringMatch) that describes the commands to be imported or exported.
.TP 15 int resetListFirst (in)
int       resetListFirst int Whether the list of export patterns should be reset before adding the current pattern to it.
.TP 15 int allowOverwrite (in)
int       allowOverwrite int Whether new commands created by this import action can overwrite existing commands.
.TP 15 Tcl_Namespace *contextNsPtr (in)
Tcl_Namespace*contextNsPtr Tcl_Namespace The location in the namespace hierarchy where the search for a namespace or command should be conducted relative to when the search term is not rooted at the global namespace. NULL indicates the current namespace.
.TP 15 int flags (in)
int       flags int OR-ed combination of bits controlling how the search is to be performed. The following flags are supported: TCL_GLOBAL_ONLY (indicates that the search is always to be conducted relative to the global namespace), TCL_NAMESPACE_ONLY (just for Tcl_FindCommand; indicates that the search is always to be conducted relative to the context namespace), and TCL_LEAVE_ERR_MSG (indicates that an error message should be left in the interpreter if the search fails.)
.TP 15 Tcl_Obj *handlerPtr (in)
Tcl_Obj   *handlerPtr Tcl_Obj A script fragment to be installed as the unknown command handler for the namespace, or NULL to reset the handler to its default.

   








\L’|0u-1v’\l’75u+3n_’\L’0u+1v-0u’\l’|0u-1.5n_’



\L’|0u-1v’\L’0u+1v-0u’\l’|0u-1.5n_’





DESCRIPTION

Namespaces are hierarchic naming contexts that can contain commands and variables. They also maintain a list of patterns that describes what commands are exported, and can import commands that have been exported by other namespaces. Namespaces can also be manipulated through the Tcl command namespace.

The Tcl_Namespace structure encapsulates a namespace, and is guaranteed to have the following fields in it: name (the local name of the namespace, with no namespace separator characters in it, with empty denoting the global namespace), fullName (the fully specified name of the namespace), clientData, deleteProc (the values specified in the call to Tcl_CreateNamespace), and parentPtr (a pointer to the containing namespace, or NULL for the global namespace.)

Tcl_CreateNamespace creates a new namespace. The deleteProc will have the following type signature:


typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData);


Tcl_DeleteNamespace deletes a namespace.

Tcl_AppendExportList retrieves the export patterns for a namespace given namespace and appends them (as list items) to objPtr.

Tcl_Export sets and appends to the export patterns for a namespace. Patterns are appended unless the resetListFirst flag is true.

Tcl_Import imports commands matching a pattern into a namespace. Note that the pattern must include the name of the namespace to import from. This function returns an error if an attempt to import a command over an existing command is made, unless the allowOverwrite flag has been set.

Tcl_ForgetImport removes imports matching a pattern.

Tcl_GetCurrentNamespace returns the current namespace for an interpreter.

Tcl_GetGlobalNamespace returns the global namespace for an interpreter.

Tcl_FindNamespace searches for a namespace named name within the context of the namespace contextNsPtr. If the namespace cannot be found, NULL is returned.

Tcl_FindCommand searches for a command named name within the context of the namespace contextNsPtr. If the command cannot be found, NULL is returned.

Tcl_GetNamespaceUnknownHandler returns the unknown command handler for the namespace, or NULL if none is set.

Tcl_SetNamespaceUnknownHandler sets the unknown command handler for the namespace. If handlerPtr is NULL, then the handler is reset to its default.

SEE ALSO

Tcl_CreateCommand, Tcl_ListObjAppendElements, Tcl_SetVar

KEYWORDS

namespace, command
Search for    or go to Top of page |  Section 3 |  Main Index


Tcl TCL_NAMESPACE (3) 8.5

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.