DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Tcl_SetNamespaceUnknownHandler(3tcl)




Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(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


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

     Tcl_Interp *interp (in/out)                          The
                                                          inter-
                                                          preter

Tcl                     Last change: 8.5                        1

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          in
                                                          which
                                                          the
                                                          namespace
                                                          exists
                                                          and
                                                          where
                                                          name
                                                          lookups
                                                          are
                                                          per-
                                                          formed.
                                                          Also
                                                          where
                                                          error
                                                          result
                                                          mes-
                                                          sages
                                                          are
                                                          writ-
                                                          ten.

     const char *name (in)                                The
                                                          name of
                                                          the
                                                          namespace
                                                          or com-
                                                          mand to
                                                          be
                                                          created
                                                          or
                                                          accessed.

     ClientData clientData (in)                           A  con-
                                                          text
                                                          pointer
                                                          by  the
                                                          creator
                                                          of  the
                                                          namespace.
                                                          Not
                                                          inter-
                                                          preted
                                                          by  Tcl
                                                          at all.

     Tcl_NamespaceDeleteProc *deleteProc (in)             A
                                                          pointer
                                                          to
                                                          func-
                                                          tion to
                                                          call

Tcl                     Last change: 8.5                        2

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          when
                                                          the
                                                          namespace
                                                          is
                                                          deleted,
                                                          or NULL
                                                          if   no
                                                          such
                                                          call-
                                                          back is
                                                          to   be
                                                          per-
                                                          formed.

     Tcl_Namespace *nsPtr (in)                            The
                                                          namespace
                                                          to   be
                                                          manipu-
                                                          lated,
                                                          or NULL
                                                          (for
                                                          other
                                                          than
                                                          Tcl_DeleteNamespace)
                                                          to
                                                          manipu-
                                                          late
                                                          the
                                                          current
                                                          namespace.

     Tcl_Obj *objPtr (out)                                A
                                                          refer-
                                                          ence to
                                                          an
                                                          unshared
                                                          object
                                                          to
                                                          which
                                                          the
                                                          func-
                                                          tion
                                                          output
                                                          will be
                                                          writ-
                                                          ten.

     const char *pattern (in)                             The
                                                          glob-
                                                          style
                                                          pattern
                                                          (see

Tcl                     Last change: 8.5                        3

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          Tcl_StringMatch)
                                                          that
                                                          describes
                                                          the
                                                          com-
                                                          mands
                                                          to   be
                                                          imported
                                                          or
                                                          exported.

     int resetListFirst (in)                              Whether
                                                          the
                                                          list of
                                                          export
                                                          pat-
                                                          terns
                                                          should
                                                          be
                                                          reset
                                                          before
                                                          adding
                                                          the
                                                          current
                                                          pattern
                                                          to it.

     int allowOverwrite (in)                              Whether
                                                          new
                                                          com-
                                                          mands
                                                          created
                                                          by this
                                                          import
                                                          action
                                                          can
                                                          overwrite
                                                          exist-
                                                          ing
                                                          com-
                                                          mands.

     Tcl_Namespace *contextNsPtr (in)                     The
                                                          loca-
                                                          tion in
                                                          the
                                                          namespace
                                                          hierar-
                                                          chy
                                                          where
                                                          the
                                                          search

Tcl                     Last change: 8.5                        4

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          for   a
                                                          namespace
                                                          or com-
                                                          mand
                                                          should
                                                          be con-
                                                          ducted
                                                          rela-
                                                          tive to
                                                          when
                                                          the
                                                          search
                                                          term is
                                                          not
                                                          rooted
                                                          at  the
                                                          global
                                                          namespace.
                                                          NULL
                                                          indi-
                                                          cates
                                                          the
                                                          current
                                                          namespace.

     int flags (in)                                       OR-ed
                                                          combi-
                                                          nation
                                                          of bits
                                                          con-
                                                          trol-
                                                          ling
                                                          how the
                                                          search
                                                          is   to
                                                          be per-
                                                          formed.
                                                          The
                                                          follow-
                                                          ing
                                                          flags
                                                          are
                                                          sup-
                                                          ported:
                                                          TCL_GLOBAL_ONLY
                                                          (indi-
                                                          cates
                                                          that
                                                          the
                                                          search
                                                          is
                                                          always

Tcl                     Last change: 8.5                        5

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          to   be
                                                          con-
                                                          ducted
                                                          rela-
                                                          tive to
                                                          the
                                                          global
                                                          namespace),
                                                          TCL_NAMESPACE_ONLY
                                                          (just
                                                          for
                                                          Tcl_FindCommand;
                                                          indi-
                                                          cates
                                                          that
                                                          the
                                                          search
                                                          is
                                                          always
                                                          to   be
                                                          con-
                                                          ducted
                                                          rela-
                                                          tive to
                                                          the
                                                          context
                                                          namespace),
                                                          and
                                                          TCL_LEAVE_ERR_MSG
                                                          (indi-
                                                          cates
                                                          that an
                                                          error
                                                          message
                                                          should
                                                          be left
                                                          in  the
                                                          inter-
                                                          preter
                                                          if  the
                                                          search
                                                          fails.)

     Tcl_Obj *handlerPtr (in)                             A
                                                          script
                                                          frag-
                                                          ment to
                                                          be
                                                          installed
                                                          as  the
                                                          unknown
                                                          command

Tcl                     Last change: 8.5                        6

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

                                                          handler
                                                          for the
                                                          namespace,
                                                          or NULL
                                                          to
                                                          reset
                                                          the
                                                          handler
                                                          to  its
                                                          default.
_________________________________________________________________


DESCRIPTION

     Namespaces are hierarchic naming contexts that  can  contain
     commands  and  variables.  They also maintain a list of pat-
     terns 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  con-
     taining 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                     Last change: 8.5                        7

Tcl_Namespace(3)     Tcl Library Procedures      Tcl_Namespace(3)

     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 can-
     not 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

Tcl                     Last change: 8.5                        8


Man(1) output converted with man2html