Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 2044

mozart-1.4.0-1mdv2010.0.i586.rpm

<HTML><HEAD><TITLE>Tcl Library Procedures - Tcl_CreateSlave manual page</TITLE></HEAD><BODY>
<H3><A NAME="M2">NAME</A></H3>
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.
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tcl.h&gt;</B><BR>
int<BR>
<B>Tcl_IsSafe</B>(<I>interp</I>)<BR>
int<BR>
<B>Tcl_MakeSafe</B>(<I>interp</I>)<BR>
<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<BR>
<B>Tcl_CreateSlave</B>(<I>interp, slaveName, isSafe</I>)<BR>
<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<BR>
<B>Tcl_GetSlave</B>(<I>interp, slaveName</I>)<BR>
<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<BR>
<B>Tcl_GetMaster</B>(<I>interp</I>)<BR>
int<BR>
<B>Tcl_GetInterpPath</B>(<I>askingInterp, slaveInterp</I>)<BR>
int<BR>
<B>Tcl_CreateAlias</B>(<I>slaveInterp, srcCmd, targetInterp, targetCmd, argc, argv</I>)<BR>
int<BR>
<B>Tcl_CreateAliasObj</B>(<I>slaveInterp, srcCmd, targetInterp, targetCmd, objc, objv</I>)<BR>
int<BR>
<B>Tcl_GetAlias</B>(<I>interp, srcCmd, targetInterpPtr, targetCmdPtr, argcPtr, argvPtr</I>)<BR>
int<BR>
<B>Tcl_GetAliasObj</B>(<I>interp, srcCmd, targetInterpPtr, targetCmdPtr, objcPtr, objvPtr</I>)<BR>
int<BR>
<B>Tcl_ExposeCommand</B>(<I>interp, hiddenCmdName, cmdName</I>)<BR>
int<BR>
<B>Tcl_HideCommand</B>(<I>interp, cmdName, hiddenCmdName</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL>
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter in which to execute the specified command.
<P><DT>char <B>*slaveName</B> (in)<DD>
Name of slave interpreter to create or manipulate.
<P><DT>int <B>isSafe</B> (in)<DD>
If non-zero, a ``safe'' slave that is suitable for running untrusted code
is created, otherwise a trusted slave is created.
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*slaveInterp</B> (in)<DD>
Interpreter to use for creating the source command for an alias (see
below).
<P><DT>char <B>*srcCmd</B> (in)<DD>
Name of source command for alias.
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*targetInterp</B> (in)<DD>
Interpreter that contains the target command for an alias.
<P><DT>char <B>*targetCmd</B> (in)<DD>
Name of target command for alias in <I>targetInterp</I>.
<P><DT>int <B>argc</B> (in)<DD>
Count of additional arguments to pass to the alias command.
<P><DT>char <B>**argv</B> (in)<DD>
Vector of strings, the additional arguments to pass to the alias command.
This storage is owned by the caller.
<P><DT>int <B>objc</B> (in)<DD>
Count of additional object arguments to pass to the alias object command.
<P><DT>Tcl_Object <B>**objv</B> (in)<DD>
Vector of Tcl_Obj structures, the additional object argumenst to pass to
the alias object command.
This storage is owned by the caller.
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>**targetInterpPtr</B> (in)<DD>
Pointer to location to store the address of the interpreter where a target
command is defined for an alias.
<P><DT>char <B>**targetCmdPtr</B> (out)<DD>
Pointer to location to store the address of the name of the target command
for an alias.
<P><DT>int <B>*argcPtr</B> (out)<DD>
Pointer to location to store count of additional arguments to be passed to
the alias. The location is in storage owned by the caller.
<P><DT>char <B>***argvPtr</B> (out)<DD>
Pointer to location to store a vector of strings, the additional arguments
to pass to an alias. The location is in storage owned by the caller, the
vector of strings is owned by the called function.
<P><DT>int <B>*objcPtr</B> (out)<DD>
Pointer to location to store count of additional object arguments to be
passed to the alias. The location is in storage owned by the caller.
<P><DT>Tcl_Obj <B>***objvPtr</B> (out)<DD>
Pointer to location to store a vector of Tcl_Obj structures, the additional
arguments to pass to an object alias command. The location is in storage
owned by the caller, the vector of Tcl_Obj structures is owned by the
called function.
<P><DT>char <B>*cmdName</B> (in)<DD>
Name of an exposed command to hide or create.
<P><DT>char <B>*hiddenCmdName</B> (in)<DD>
Name under which a hidden command is stored and with which it can be
exposed or invoked.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
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 <B>int</B>
is either <B>TCL_OK</B> or <B>TCL_ERROR</B>. If <B>TCL_ERROR</B> is returned
then the <B>result</B> field of the interpreter contains an error message.
<P>
<B>Tcl_CreateSlave</B> creates a new interpreter as a slave of <I>interp</I>.
It also creates a slave command named <I>slaveName</I> in <I>interp</I> which 
allows <I>interp</I> to manipulate the new slave. 
If <I>isSafe</I> is zero, the command creates a trusted slave in which Tcl
code has access to all the Tcl commands.
If it is <B>1</B>, 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 <B><A HREF="../TclCmd/interp.htm">interp</A></B> command for details.
If the creation of the new slave interpreter failed, <B>NULL</B> is returned.
<P>
<B>Tcl_IsSafe</B> returns <B>1</B> if <I>interp</I> is ``safe'' (was created
with the <B>TCL_SAFE_INTERPRETER</B> flag specified),
<B>0</B> otherwise.
<P>
<B>Tcl_MakeSafe</B> makes <I>interp</I> ``safe'' by removing all
non-core and core unsafe functionality. Note that if you call this after
adding some extension to an interpreter, all traces of that extension will
be removed from the interpreter.
<P>
<B>Tcl_GetSlave</B> returns a pointer to a slave interpreter of
<I>interp</I>. The slave interpreter is identified by <I>slaveName</I>.
If no such slave interpreter exists, <B>NULL</B> is returned.
<P>
<B>Tcl_GetMaster</B> returns a pointer to the master interpreter of
<I>interp</I>. If <I>interp</I> has no master (it is a
top-level interpreter) then <B>NULL</B> is returned.
<P>
<B>Tcl_GetInterpPath</B> sets the <I>result</I> field in <I>askingInterp</I>
to the relative path between <I>askingInterp</I> and <I>slaveInterp</I>;
<I>slaveInterp</I> must be a slave of <I>askingInterp</I>. If the computation
of the relative path succeeds, <B>TCL_OK</B> is returned, else
<B>TCL_ERROR</B> is returned and the <I>result</I> field in
<I>askingInterp</I> contains the error message.
<P>
<B>Tcl_CreateAlias</B> creates an object command named <I>srcCmd</I> in
<I>slaveInterp</I> that when invoked, will cause the command <I>targetCmd</I>
to be invoked in <I>targetInterp</I>. The arguments specified by the strings
contained in <I>argv</I> are always prepended to any arguments supplied in the
invocation of <I>srcCmd</I> and passed to <I>targetCmd</I>.
This operation returns <B>TCL_OK</B> if it succeeds, or <B>TCL_ERROR</B> if
it fails; in that case, an error message is left in the object result
of <I>slaveInterp</I>.
Note that there are no restrictions on the ancestry relationship (as
created by <B>Tcl_CreateSlave</B>) between <I>slaveInterp</I> and
<I>targetInterp</I>. Any two interpreters can be used, without any
restrictions on how they are related.
<P>
<B>Tcl_CreateAliasObj</B> is similar to <B>Tcl_CreateAliasObj</B> except 
that it takes a vector of objects to pass as additional arguments instead
of a vector of strings.
<P>
<B>Tcl_GetAlias</B> returns information about an alias <I>aliasName</I>
in <I>interp</I>. Any of the result fields can be <B>NULL</B>, in
which case the corresponding datum is not returned. If a result field is
non-<B>NULL</B>, the address indicated is set to the corresponding datum.
For example, if <I>targetNamePtr</I> is non-<B>NULL</B> it is set to a
pointer to the string containing the name of the target command.
<P>
<B>Tcl_GetAliasObj</B> is similar to <B>Tcl_GetAlias</B> except that it
returns a pointer to a vector of Tcl_Obj structures instead of a vector of
strings.
<P>
<B>Tcl_ExposeCommand</B> moves the command named <I>hiddenCmdName</I> from
the set of hidden commands to the set of exposed commands, putting
it under the name
<I>cmdName</I>. 
<I>HiddenCmdName</I> must be the name of an existing hidden
command, or the operation will return <B>TCL_ERROR</B> and leave an error
message in the <I>result</I> field in <I>interp</I>.
If an exposed command named <I>cmdName</I> already exists,
the operation returns <B>TCL_ERROR</B> and leaves an error message in the
object result of <I>interp</I>.
If the operation succeeds, it returns <B>TCL_OK</B>.
After executing this command, attempts to use <I>cmdName</I> in a call to
<B><A HREF="../TclLib/Eval.htm">Tcl_Eval</A></B> or with the Tcl <B><A HREF="../TclCmd/eval.htm">eval</A></B> command will again succeed.
<P>
<B>Tcl_HideCommand</B> moves the command named <I>cmdName</I> from the set of
exposed commands to the set of hidden commands, under the name
<I>hiddenCmdName</I>.
<I>CmdName</I> must be the name of an existing exposed
command, or the operation will return <B>TCL_ERROR</B> and leave an error
message in the object result of <I>interp</I>.
Currently both <I>cmdName</I> and <I>hiddenCmdName</I> must not contain
namespace qualifiers, or the operation will return <B>TCL_ERROR</B> and
leave an error message in the object result of <I>interp</I>.
The <I>CmdName</I> will be looked up in the global namespace, and not
relative to the current namespace, even if the current namespace is not the
global one.
If a hidden command whose name is <I>hiddenCmdName</I> already
exists, the operation also returns <B>TCL_ERROR</B> and the <I>result</I>
field in <I>interp</I> contains an error message.
If the operation succeeds, it returns <B>TCL_OK</B>.
After executing this command, attempts to use <I>cmdName</I> in a call to
<B><A HREF="../TclLib/Eval.htm">Tcl_Eval</A></B> or with the Tcl <B><A HREF="../TclCmd/eval.htm">eval</A></B> command will fail.
<P>
<H3><A NAME="M6">SEE ALSO</A></H3>
<B>For a description of the Tcl interface to multiple interpreters</B>, <B>see
<I>interp(n)</I>.</B>
<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/A.htm#alias">alias</A>, <A href="../Keywords/C.htm#command">command</A>, <A href="../Keywords/E.htm#exposed commands">exposed commands</A>, <A href="../Keywords/H.htm#hidden commands">hidden commands</A>, <A href="../Keywords/I.htm#interpreter">interpreter</A>, <A href="../Keywords/I.htm#invoke">invoke</A>, <A href="../Keywords/M.htm#master">master</A>, <A href="../Keywords/S.htm#slave">slave</A>, <A href="../Keywords/.htm#"></A>
<HR><PRE>
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1996 Sun Microsystems, Inc.
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>