OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [CrtSlave.3] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: CrtSlave.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
8
'\"
9
.so man.macros
10
.TH Tcl_CreateSlave 3 7.6 Tcl "Tcl Library Procedures"
11
.BS
12
.SH NAME
13
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.
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
int
19
\fBTcl_IsSafe\fR(\fIinterp\fR)
20
.sp
21
int
22
\fBTcl_MakeSafe\fR(\fIinterp\fR)
23
.sp
24
Tcl_Interp *
25
\fBTcl_CreateSlave\fR(\fIinterp, slaveName, isSafe\fR)
26
.sp
27
Tcl_Interp *
28
\fBTcl_GetSlave\fR(\fIinterp, slaveName\fR)
29
.sp
30
Tcl_Interp *
31
\fBTcl_GetMaster\fR(\fIinterp\fR)
32
.sp
33
int
34
\fBTcl_GetInterpPath\fR(\fIaskingInterp, slaveInterp\fR)
35
.sp
36
.VS
37
int
38
\fBTcl_CreateAlias\fR(\fIslaveInterp, srcCmd, targetInterp, targetCmd, argc, argv\fR)
39
.sp
40
int
41
\fBTcl_CreateAliasObj\fR(\fIslaveInterp, srcCmd, targetInterp, targetCmd, objc, objv\fR)
42
.VE
43
.sp
44
int
45
\fBTcl_GetAlias\fR(\fIinterp, srcCmd, targetInterpPtr, targetCmdPtr, argcPtr, argvPtr\fR)
46
.sp
47
.VS
48
int
49
\fBTcl_GetAliasObj\fR(\fIinterp, srcCmd, targetInterpPtr, targetCmdPtr, objcPtr, objvPtr\fR)
50
.sp
51
int
52
\fBTcl_ExposeCommand\fR(\fIinterp, hiddenCmdName, cmdName\fR)
53
.sp
54
int
55
\fBTcl_HideCommand\fR(\fIinterp, cmdName, hiddenCmdName\fR)
56
.SH ARGUMENTS
57
.AS Tcl_InterpDeleteProc **hiddenCmdName
58
.AP Tcl_Interp *interp in
59
Interpreter in which to execute the specified command.
60
.AP char *slaveName in
61
Name of slave interpreter to create or manipulate.
62
.AP int isSafe in
63
If non-zero, a ``safe'' slave that is suitable for running untrusted code
64
is created, otherwise a trusted slave is created.
65
.AP Tcl_Interp *slaveInterp in
66
Interpreter to use for creating the source command for an alias (see
67
below).
68
.AP char *srcCmd in
69
Name of source command for alias.
70
.AP Tcl_Interp *targetInterp in
71
Interpreter that contains the target command for an alias.
72
.AP char *targetCmd in
73
Name of target command for alias in \fItargetInterp\fR.
74
.AP int argc in
75
Count of additional arguments to pass to the alias command.
76
.AP char **argv in
77
Vector of strings, the additional arguments to pass to the alias command.
78
This storage is owned by the caller.
79
.AP int objc in
80
Count of additional object arguments to pass to the alias object command.
81
.AP Tcl_Object **objv in
82
Vector of Tcl_Obj structures, the additional object argumenst to pass to
83
the alias object command.
84
This storage is owned by the caller.
85
.AP Tcl_Interp **targetInterpPtr in
86
Pointer to location to store the address of the interpreter where a target
87
command is defined for an alias.
88
.AP char **targetCmdPtr out
89
Pointer to location to store the address of the name of the target command
90
for an alias.
91
.AP int *argcPtr out
92
Pointer to location to store count of additional arguments to be passed to
93
the alias. The location is in storage owned by the caller.
94
.AP char ***argvPtr out
95
Pointer to location to store a vector of strings, the additional arguments
96
to pass to an alias. The location is in storage owned by the caller, the
97
vector of strings is owned by the called function.
98
.AP int *objcPtr out
99
Pointer to location to store count of additional object arguments to be
100
passed to the alias. The location is in storage owned by the caller.
101
.AP Tcl_Obj ***objvPtr out
102
Pointer to location to store a vector of Tcl_Obj structures, the additional
103
arguments to pass to an object alias command. The location is in storage
104
owned by the caller, the vector of Tcl_Obj structures is owned by the
105
called function.
106
.VS
107
.AP char *cmdName in
108
Name of an exposed command to hide or create.
109
.AP char *hiddenCmdName in
110
Name under which a hidden command is stored and with which it can be
111
exposed or invoked.
112
.VE
113
.BE
114
 
115
.SH DESCRIPTION
116
.PP
117
These procedures are intended for access to the multiple interpreter
118
facility from inside C programs. They enable managing multiple interpreters
119
in a hierarchical relationship, and the management of aliases, commands
120
that when invoked in one interpreter execute a command in another
121
interpreter. The return value for those procedures that return an \fBint\fR
122
is either \fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fBTCL_ERROR\fR is returned
123
then the \fBresult\fR field of the interpreter contains an error message.
124
.PP
125
\fBTcl_CreateSlave\fR creates a new interpreter as a slave of \fIinterp\fR.
126
It also creates a slave command named \fIslaveName\fR in \fIinterp\fR which
127
allows \fIinterp\fR to manipulate the new slave.
128
If \fIisSafe\fR is zero, the command creates a trusted slave in which Tcl
129
code has access to all the Tcl commands.
130
If it is \fB1\fR, the command creates a ``safe'' slave in which Tcl code
131
has access only to set of Tcl commands defined as ``Safe Tcl''; see the
132
manual entry for the Tcl \fBinterp\fR command for details.
133
If the creation of the new slave interpreter failed, \fBNULL\fR is returned.
134
.PP
135
\fBTcl_IsSafe\fR returns \fB1\fR if \fIinterp\fR is ``safe'' (was created
136
with the \fBTCL_SAFE_INTERPRETER\fR flag specified),
137
\fB0\fR otherwise.
138
.PP
139
\fBTcl_MakeSafe\fR makes \fIinterp\fR ``safe'' by removing all
140
non-core and core unsafe functionality. Note that if you call this after
141
adding some extension to an interpreter, all traces of that extension will
142
be removed from the interpreter.
143
.PP
144
\fBTcl_GetSlave\fR returns a pointer to a slave interpreter of
145
\fIinterp\fR. The slave interpreter is identified by \fIslaveName\fR.
146
If no such slave interpreter exists, \fBNULL\fR is returned.
147
.PP
148
\fBTcl_GetMaster\fR returns a pointer to the master interpreter of
149
\fIinterp\fR. If \fIinterp\fR has no master (it is a
150
top-level interpreter) then \fBNULL\fR is returned.
151
.PP
152
\fBTcl_GetInterpPath\fR sets the \fIresult\fR field in \fIaskingInterp\fR
153
to the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
154
\fIslaveInterp\fR must be a slave of \fIaskingInterp\fR. If the computation
155
of the relative path succeeds, \fBTCL_OK\fR is returned, else
156
\fBTCL_ERROR\fR is returned and the \fIresult\fR field in
157
\fIaskingInterp\fR contains the error message.
158
.PP
159
.VS
160
\fBTcl_CreateAlias\fR creates an object command named \fIsrcCmd\fR in
161
\fIslaveInterp\fR that when invoked, will cause the command \fItargetCmd\fR
162
to be invoked in \fItargetInterp\fR. The arguments specified by the strings
163
contained in \fIargv\fR are always prepended to any arguments supplied in the
164
invocation of \fIsrcCmd\fR and passed to \fItargetCmd\fR.
165
This operation returns \fBTCL_OK\fR if it succeeds, or \fBTCL_ERROR\fR if
166
it fails; in that case, an error message is left in the object result
167
of \fIslaveInterp\fR.
168
Note that there are no restrictions on the ancestry relationship (as
169
created by \fBTcl_CreateSlave\fR) between \fIslaveInterp\fR and
170
\fItargetInterp\fR. Any two interpreters can be used, without any
171
restrictions on how they are related.
172
.PP
173
\fBTcl_CreateAliasObj\fR is similar to \fBTcl_CreateAliasObj\fR except
174
that it takes a vector of objects to pass as additional arguments instead
175
of a vector of strings.
176
.VE
177
.PP
178
\fBTcl_GetAlias\fR returns information about an alias \fIaliasName\fR
179
in \fIinterp\fR. Any of the result fields can be \fBNULL\fR, in
180
which case the corresponding datum is not returned. If a result field is
181
non\-\fBNULL\fR, the address indicated is set to the corresponding datum.
182
For example, if \fItargetNamePtr\fR is non\-\fBNULL\fR it is set to a
183
pointer to the string containing the name of the target command.
184
.VS
185
.PP
186
\fBTcl_GetAliasObj\fR is similar to \fBTcl_GetAlias\fR except that it
187
returns a pointer to a vector of Tcl_Obj structures instead of a vector of
188
strings.
189
.PP
190
\fBTcl_ExposeCommand\fR moves the command named \fIhiddenCmdName\fR from
191
the set of hidden commands to the set of exposed commands, putting
192
it under the name
193
\fIcmdName\fR.
194
\fIHiddenCmdName\fR must be the name of an existing hidden
195
command, or the operation will return \fBTCL_ERROR\fR and leave an error
196
message in the \fIresult\fR field in \fIinterp\fR.
197
If an exposed command named \fIcmdName\fR already exists,
198
the operation returns \fBTCL_ERROR\fR and leaves an error message in the
199
object result of \fIinterp\fR.
200
If the operation succeeds, it returns \fBTCL_OK\fR.
201
After executing this command, attempts to use \fIcmdName\fR in a call to
202
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will again succeed.
203
.PP
204
\fBTcl_HideCommand\fR moves the command named \fIcmdName\fR from the set of
205
exposed commands to the set of hidden commands, under the name
206
\fIhiddenCmdName\fR.
207
\fICmdName\fR must be the name of an existing exposed
208
command, or the operation will return \fBTCL_ERROR\fR and leave an error
209
message in the object result of \fIinterp\fR.
210
Currently both \fIcmdName\fR and \fIhiddenCmdName\fR must not contain
211
namespace qualifiers, or the operation will return \fBTCL_ERROR\fR and
212
leave an error message in the object result of \fIinterp\fR.
213
The \fICmdName\fR will be looked up in the global namespace, and not
214
relative to the current namespace, even if the current namespace is not the
215
global one.
216
If a hidden command whose name is \fIhiddenCmdName\fR already
217
exists, the operation also returns \fBTCL_ERROR\fR and the \fIresult\fR
218
field in \fIinterp\fR contains an error message.
219
If the operation succeeds, it returns \fBTCL_OK\fR.
220
After executing this command, attempts to use \fIcmdName\fR in a call to
221
\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will fail.
222
.PP
223
.SH "SEE ALSO"
224
For a description of the Tcl interface to multiple interpreters, see
225
\fIinterp(n)\fR.
226
 
227
.SH KEYWORDS
228
alias, command, exposed commands, hidden commands, interpreter, invoke,
229
master, slave,
230
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.