Provided by: tcl8.4-doc_8.4.20-7_all bug

NAME

       Tcl_IsSafe,    Tcl_MakeSafe,    Tcl_CreateSlave,    Tcl_GetSlave,    Tcl_GetMaster,    Tcl_GetInterpPath,
       Tcl_CreateAlias, Tcl_CreateAliasObj, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_ExposeCommand, Tcl_HideCommand  -
       manage multiple Tcl interpreters, aliases and hidden commands.

SYNOPSIS

       #include <tcl.h>

       int
       Tcl_IsSafe(interp)

       int
       Tcl_MakeSafe(interp)

       Tcl_Interp *
       Tcl_CreateSlave(interp, slaveName, isSafe)

       Tcl_Interp *
       Tcl_GetSlave(interp, slaveName)

       Tcl_Interp *
       Tcl_GetMaster(interp)

       int
       Tcl_GetInterpPath(askingInterp, slaveInterp)

       int                                                                                                       2
       Tcl_CreateAlias(slaveInterp, slaveCmd, targetInterp, targetCmd, argc, argv)                               2

       int                                                                                                       2
       Tcl_CreateAliasObj(slaveInterp, slaveCmd, targetInterp, targetCmd, objc, objv)                            2

       int
       Tcl_GetAlias(interp, slaveCmd, targetInterpPtr, targetCmdPtr, argcPtr, argvPtr)

       int                                                                                                       2
       Tcl_GetAliasObj(interp, slaveCmd, targetInterpPtr, targetCmdPtr, objcPtr, objvPtr)                        2

       int                                                                                                       2
       Tcl_ExposeCommand(interp, hiddenCmdName, cmdName)                                                         2

       int                                                                                                       2
       Tcl_HideCommand(interp, cmdName, hiddenCmdName)                                                           2

ARGUMENTS                                                                                                        2
       Tcl_Interp             *interp           (in)                                                             2
                                                          Interpreter in which to execute the specified command. 2

       CONST char             *slaveName        (in)                                                             2
                                                          Name of slave interpreter to create or manipulate.     2

       int                    isSafe            (in)                                                             2
                                                          If  non-zero,  a  ``safe''  slave that is suitable for 2
                                                          running untrusted code is created, otherwise a trusted 2
                                                          slave is created.                                      2

       Tcl_Interp             *slaveInterp      (in)                                                             2
                                                          Interpreter to use for creating the source command for 2
                                                          an alias (see below).                                  2

       CONST char             *slaveCmd         (in)                                                             2
                                                          Name of source command for alias.                      2

       Tcl_Interp             *targetInterp     (in)                                                             2
                                                          Interpreter that contains the target  command  for  an 2
                                                          alias.                                                 2

       CONST char             *targetCmd        (in)                                                             2
                                                          Name of target command for alias in targetInterp.      2

       int                    argc              (in)                                                             2
                                                          Count  of  additional  arguments  to pass to the alias 2
                                                          command.                                               2

       CONST char * CONST     *argv             (in)                                                             2
                                                          Vector of strings, the additional arguments to pass to 2
                                                          the alias command.   This  storage  is  owned  by  the 2
                                                          caller.                                                2

       int                    objc              (in)                                                             2
                                                          Count  of  additional  object arguments to pass to the 2
                                                          alias object command.                                  2

       Tcl_Object             **objv            (in)                                                             2
                                                          Vector of Tcl_Obj structures,  the  additional  object 2
                                                          arguments  to  pass to the alias object command.  This 2
                                                          storage is owned by the caller.                        2

       Tcl_Interp             **targetInterpPtr (in)                                                             2
                                                          Pointer to  location  to  store  the  address  of  the 2
                                                          interpreter  where  a target command is defined for an 2
                                                          alias.                                                 2

       CONST char             **targetCmdPtr    (out)                                                            2
                                                          Pointer to location to store the address of  the  name 2
                                                          of the target command for an alias.                    2

       int                    *argcPtr          (out)                                                            2
                                                          Pointer  to  location  to  store  count  of additional 2
                                                          arguments to be passed to the alias. The  location  is 2
                                                          in storage owned by the caller.                        2

       CONST char             ***argvPtr        (out)                                                            2
                                                          Pointer  to location to store a vector of strings, the 2
                                                          additional arguments to pass to an alias. The location 2
                                                          is in storage owned  by  the  caller,  the  vector  of 2
                                                          strings is owned by the called function.               2

       int                    *objcPtr          (out)                                                            2
                                                          Pointer  to  location  to  store  count  of additional 2
                                                          object arguments  to  be  passed  to  the  alias.  The 2
                                                          location is in storage owned by the caller.            2

       Tcl_Obj                ***objvPtr        (out)                                                            2
                                                          Pointer  to  location  to  store  a  vector of Tcl_Obj 2
                                                          structures, the additional arguments  to  pass  to  an 2
                                                          object alias command. The location is in storage owned 2
                                                          by  the  caller,  the  vector of Tcl_Obj structures is 2
                                                          owned by the called function.                          2

       CONST char             *cmdName          (in)                                                             2
                                                          Name of an exposed command to hide or create.          2

       CONST char             *hiddenCmdName    (in)                                                             2
                                                          Name under which a hidden command is stored  and  with
                                                          which it can be exposed or invoked.
_________________________________________________________________

DESCRIPTION

       These  procedures  are  intended  for access to the multiple interpreter facility from inside C programs.
       They enable managing multiple interpreters in a hierarchical relationship, and the management of aliases,
       commands that when invoked in one interpreter execute a command in another interpreter. The return  value
       for  those procedures that return an int is either TCL_OK or TCL_ERROR. If TCL_ERROR is returned then the
       result field of the interpreter contains an error message.

       Tcl_CreateSlave creates a new interpreter as a slave of interp.  It also creates a  slave  command  named
       slaveName  in  interp  which  allows  interp to manipulate the new slave.  If isSafe is zero, the command
       creates a trusted slave in which Tcl code has access to all the Tcl commands.  If it is  1,  the  command
       creates  a  ``safe''  slave  in  which  Tcl code has access only to set of Tcl commands defined as ``Safe
       Tcl''; see the manual entry for the Tcl interp command for details.  If the creation  of  the  new  slave
       interpreter failed, NULL is returned.

       Tcl_IsSafe  returns 1 if interp is ``safe'' (was created with the TCL_SAFE_INTERPRETER flag specified), 0
       otherwise.

       Tcl_MakeSafe marks interp as ``safe'', so that future calls to Tcl_IsSafe will return 1.  It also removes
       all known potentially-unsafe core functionality (both commands and variables) from interp.   However,  it
       cannot  know  what  parts of an extension or application are safe and does not make any attempt to remove
       those parts, so safety is not guaranteed after calling Tcl_MakeSafe.  Callers will want to take care with
       their use of Tcl_MakeSafe to avoid false claims of safety.  For many situations, Tcl_CreateSlave may be a
       better choice, since it creates interpreters in a known-safe state.

       Tcl_GetSlave returns a pointer to a slave interpreter of interp. The slave interpreter is  identified  by
       slaveName.  If no such slave interpreter exists, NULL is returned.

       Tcl_GetMaster  returns  a  pointer  to the master interpreter of interp. If interp has no master (it is a
       top-level interpreter) then NULL is returned.

       Tcl_GetInterpPath sets the result field in askingInterp to the relative  path  between  askingInterp  and
       slaveInterp;  slaveInterp  must  be  a  slave  of  askingInterp.  If the computation of the relative path
       succeeds, TCL_OK is returned, else TCL_ERROR is returned and the result field  in  askingInterp  contains
       the error message.

       Tcl_CreateAlias creates an object command named slaveCmd in slaveInterp that when invoked, will cause the 2
       command targetCmd to be invoked in targetInterp. The arguments specified by the strings contained in argv 2
       are  always  prepended  to  any arguments supplied in the invocation of slaveCmd and passed to targetCmd. 2
       This operation returns TCL_OK if it succeeds, or TCL_ERROR if it fails; in that case, an error message is 2
       left in the object result  of  slaveInterp.   Note  that  there  are  no  restrictions  on  the  ancestry 2
       relationship  (as  created by Tcl_CreateSlave) between slaveInterp and targetInterp. Any two interpreters 2
       can be used, without any restrictions on how they are related.                                            2

       Tcl_CreateAliasObj is similar to Tcl_CreateAlias except that it takes a vector  of  objects  to  pass  as 2
       additional arguments instead of a vector of strings.

       Tcl_GetAlias  returns  information  about  an  alias aliasName in interp. Any of the result fields can be
       NULL, in which case the corresponding datum is not returned. If a result field is non-NULL,  the  address
       indicated  is  set  to the corresponding datum.  For example, if targetNamePtr is non-NULL it is set to a
       pointer to the string containing the name of the target command.                                          2

       Tcl_GetAliasObj is similar to Tcl_GetAlias except that it returns  a  pointer  to  a  vector  of  Tcl_Obj 2
       structures instead of a vector of strings.                                                                2

       Tcl_ExposeCommand  moves  the  command  named hiddenCmdName from the set of hidden commands to the set of 2
       exposed commands, putting it under the name cmdName.  HiddenCmdName must  be  the  name  of  an  existing 2
       hidden  command, or the operation will return TCL_ERROR and leave an error message in the result field in 2
       interp.  If an exposed command named cmdName already exists, the operation returns TCL_ERROR  and  leaves 2
       an  error  message  in the object result of interp.  If the operation succeeds, it returns TCL_OK.  After 2
       executing this command, attempts to use cmdName in a call to Tcl_Eval or with the Tcl eval  command  will 2
       again succeed.                                                                                            2

       Tcl_HideCommand  moves  the  command  named cmdName from the set of exposed commands to the set of hidden 2
       commands, under the name hiddenCmdName.  CmdName must be the name of an existing exposed command, or  the 2
       operation  will  return  TCL_ERROR  and leave an error message in the object result of interp.  Currently 2
       both cmdName and hiddenCmdName must not contain  namespace  qualifiers,  or  the  operation  will  return 2
       TCL_ERROR  and  leave  an error message in the object result of interp.  The CmdName will be looked up in 2
       the global namespace, and not relative to the current namespace, even if the current namespace is not the 2
       global one.  If a hidden command whose name is hiddenCmdName already exists, the operation  also  returns 2
       TCL_ERROR  and  the  result  field  in  interp  contains an error message.  If the operation succeeds, it 2
       returns TCL_OK.  After executing this command, attempts to use cmdName in a call to Tcl_Eval or with  the 2
       Tcl eval command will fail.                                                                               2

       For a description of the Tcl interface to multiple interpreters, see interp(3tcl).                        2

SEE ALSO                                                                                                         2
       interp                                                                                                    2

KEYWORDS                                                                                                         2
       alias, command, exposed commands, hidden commands, interpreter, invoke, master, slave                     2

Tcl                                                    7.6                                 Tcl_CreateSlave(3tcl)