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


#include <tcl.h>

Tcl_Namespace *
(interp, name, clientData, deleteProc)


(interp, nsPtr, objPtr)

(interp, nsPtr, pattern, resetListFirst)

(interp, nsPtr, pattern, allowOverwrite)

(interp, nsPtr, pattern)

Tcl_Namespace *

Tcl_Namespace *

Tcl_Namespace *
(interp, name, contextNsPtr, flags)

(interp, name, contextNsPtr, flags)

Tcl_Obj *
interp, nsPtr)

interp, nsPtr, handlerPtr)


Tcl_Interp *interp (in/out)

The interpreter in which the namespace exists and where name lookups are performed. Also where error result messages are written.

const char *name (in)

The name of the namespace or command to be created or accessed.

ClientData clientData (in)

A context pointer by the creator of the namespace. Not interpreted by Tcl at all.

Tcl_NamespaceDeleteProc *deleteProc (in)

A pointer to function to call when the namespace is deleted, or NULL if no such callback is to be performed.

Tcl_Namespace *nsPtr (in)

The namespace to be manipulated, or NULL (for other than Tcl_DeleteNamespace) to manipulate the current namespace.

Tcl_Obj *objPtr (out)

A reference to an unshared object to which the function output will be written.

const char *pattern (in)

The glob-style pattern (see Tcl_StringMatch) that describes the commands to be imported or exported.

int resetListFirst (in)

Whether the list of export patterns should be reset before adding the current pattern to it.

int allowOverwrite (in)

Whether new commands created by this import action can overwrite existing commands.

Tcl_Namespace *contextNsPtr (in)

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.

int flags (in)

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.)

Tcl_Obj *handlerPtr (in)

A script fragment to be installed as the unknown command handler for the namespace, or NULL to reset the handler to its default.



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.


Tcl_CreateCommand, Tcl_ListObjAppendElements, Tcl_SetVar


namespace, command

More Linux Commands

FcCharSetAddChar(3) - Add a character to a charset (ManPage)
FcCharSetAddChar adds a single unicode char to the set, returning FcFalse on failure, either as a result of a constant set or from running out of memory. VERSIO

gluQuadricDrawStyle(3gl) - specify the draw style desired fo
gluQuadricDrawStyle specifies the draw style for quadrics rendered with quad. The legal values are as follows: GLU_FILL Quadrics are rendered with polygon primi

wcsncpy(3) - copy a fixed-size string of wide characters....
The wcsncpy() function is the wide-character equivalent of the strncpy(3) function. It copies at most n wide characters from the wide-character string pointed t

Tk_Colormap(3) - retrieve information from Tk's local data s
Tk_WindowId and the other names listed above are all macros that return fields from Tks local data structure for tkwin. None of these macros requires any intera

pcre32_study(3) Perl-compatible regular expressions.........
This function studies a compiled pattern, to see if additional information can be extracted that might speed up matching. Its arguments are: code A compiled reg

XGetWMProtocols(3) - set or read a window's WM_PROTOCOLS pro
The XSetWMProtocols function replaces the WM_PROTOCOLS property on the specified window with the list of atoms specified by the protocols argument. If the prope

gnutls_psk_set_params_function(3) - API function (Man Page)
This function will set a callback in order for the server to get the Diffie-Hellman or RSA parameters for PSK authentication. The callback should return GNUTLS_

XClipBox(3) - generate regions (Library - Linux man page)...
The XPolygonRegion function returns a region for the polygon defined by the points array. For an explanation of fill_rule, see XCreateGC. The XClipBox function

ausearch(8) a tool to query audit daemon logs (Man Page)....
ausearch is a tool that can query the audit daemon logs based for events based on different search criteria. The ausearch utility can also take input from stdin

Tk_ConfigureValue(3) - process configuration options for wid
Note: Tk_ConfigureWidget should be replaced with the new Tcl_Obj based API Tk_SetOptions. The old interface is retained for backward compatibility. Tk_Configure

rmiregistry(1) - The Java Remote Object Registry (Man Page)
The rmiregistry command creates and starts a remote object registry on the specified port on the current host. If port is omitted, the registry is started on po

FcDefaultSubstitute(3) - Perform default substitutions in a
Supplies default values for underspecified font patterns: * Patterns without a specified style or weight are set to Medium * Patterns without a specified style

We can't live, work or learn in freedom unless the software we use is free.