⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interp.n

📁 linux系统下的音频通信
💻 N
📖 第 1 页 / 共 2 页
字号:
'\"'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) interp.n 1.37 97/10/31 12:51:11'\" .so man.macros.TH interp n 7.6 Tcl "Tcl Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEinterp \- Create and manipulate Tcl interpreters.SH SYNOPSIS\fBinterp \fIoption \fR?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThis command makes it possible to create one or more new Tcl interpreters that co-exist with the creating interpreter in thesame application.  The creating interpreter is called the \fImaster\fRand the new interpreter is called a \fIslave\fR. A master can create any number of slaves, and each slave canitself create additional slaves for which it is master, resultingin a hierarchy of interpreters..PPEach interpreter is independent from the others: it has its own namespace for commands, procedures, and global variables.A master interpreter may create connections between its slaves anditself using a mechanism called an \fIalias\fR.  An \fIalias\fR isa command in a slave interpreter which, when invoked, causes acommand to be invoked in its master interpreter or in another slaveinterpreter.  The only other connections between interpreters arethrough environment variables (the \fBenv\fR variable), which arenormally shared among all interpreters in the application. Note that thename space for files (such as the names returned by the \fBopen\fR command)is no longer shared between interpreters. Explicit commands are provided toshare files and to transfer references to open files from one interpreterto another..PPThe \fBinterp\fR command also provides support for \fIsafe\fRinterpreters.  A safe interpreter is a slave whose functions havebeen greatly restricted, so that it is safe to execute untrustedscripts without fear of them damaging other interpreters or theapplication's environment. For example, all IO channel creationcommands and subprocess creation commands are made inaccessible to safeinterpreters..VSSee SAFE INTERPRETERS below for more information onwhat features are present in a safe interpreter.The dangerous functionality is not removed from the safe interpreter;instead, it is \fIhidden\fR, so that only trusted interpreters can obtainaccess to it. For a detailed explanation of hidden commands, seeHIDDEN COMMANDS, below.The alias mechanism can be used for protected communication (analogous to akernel call) between a slave interpreter and its master. See ALIASINVOCATION, below, for more details on how the alias mechanism works..VE.PPA qualified interpreter name is a proper Tcl lists containing a subset of itsancestors in the interpreter hierarchy, terminated by the string naming theinterpreter in its immediate master. Interpreter names are relative to theinterpreter in which they are used. For example, if \fBa\fR is a slave ofthe current interpreter and it has a slave \fBa1\fR, which in turn has aslave \fBa11\fR, the qualified name of \fBa11\fR in \fBa\fR is the list\fBa1 a11\fR..PPThe \fBinterp\fR command, described below, accepts qualified interpreternames as arguments; the interpreter in which the command is being evaluatedcan always be referred to as \fB{}\fR (the empty list or string). Note thatit is impossible to refer to a master (ancestor) interpreter by name in aslave interpreter except through aliases. Also, there is no global name bywhich one can refer to the first interpreter created in an application.Both restrictions are motivated by safety concerns..VS.SH "THE INTERP COMMAND".PP.VEThe \fBinterp\fR command is used to create, delete, and manipulateslave interpreters, and to share or transferchannels between interpreters.  It can have any of several forms, dependingon the \fIoption\fR argument:.TP\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcCmd\fRReturns a Tcl list whose elements are the \fItargetCmd\fR and\fIarg\fRs associated with the alias named \fIsrcCmd\fR(all of these are the values specified when the alias wascreated; it is possible that the actual source command in theslave is different from \fIsrcCmd\fR if it was renamed)..TP\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcCmd\fR \fB{}\fRDeletes the alias for \fIsrcCmd\fR in the slave interpreter identified by\fIsrcPath\fR.\fIsrcCmd\fR refers to the name under which the aliaswas created;  if the source command has been renamed, the renamedcommand will be deleted..TP\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcCmd\fR \fItargetPath\fR \fItargetCmd \fR?\fIarg arg ...\fR?This command creates an alias between one slave and another (see the\fBalias\fR slave command below for creating aliases between a slaveand its master).  In this command, either of the slave interpretersmay be anywhere in the hierarchy of interpreters under the interpreterinvoking the command.\fISrcPath\fR and \fIsrcCmd\fR identify the source of the alias.\fISrcPath\fR is a Tcl list whose elements select a particularinterpreter.  For example, ``\fBa b\fR'' identifies an interpreter\fBb\fR, which is a slave of interpreter \fBa\fR, which is a slaveof the invoking interpreter.  An empty list specifies the interpreterinvoking the command.  \fIsrcCmd\fR gives the name of a newcommand, which will be created in the source interpreter.\fITargetPath\fR and \fItargetCmd\fR specify a target interpreterand command, and the \fIarg\fR arguments, if any, specify additionalarguments to \fItargetCmd\fR which are prepended to any arguments specifiedin the invocation of \fIsrcCmd\fR.\fITargetCmd\fR may be undefined at the time of this call, or it mayalready exist; it is not created by this command.The alias arranges for the given target command to be invokedin the target interpreter whenever the given source command isinvoked in the source interpreter.  See ALIAS INVOCATION below formore details..TP\fBinterp\fR \fBaliases \fR?\fIpath\fR?This command returns a Tcl list of the names of all the source commands foraliases defined in the interpreter identified by \fIpath\fR..TP\fBinterp\fR \fBcreate \fR?\fB\-safe\fR? ?\fB\-\|\-\fR? ?\fIpath\fR?Creates a slave interpreter identified by \fIpath\fR and a new command,called a \fIslave command\fR. The name of the slave command is the lastcomponent of \fIpath\fR. The new slave interpreter and the slave commandare created in the interpreter identified by the path obtained by removingthe last component from \fIpath\fR. For example, if \fIpath is \fBa bc\fR then a new slave interpreter and slave command named \fBc\fR arecreated in the interpreter identified by the path \fBa b\fR.The slave command may be used to manipulate the new interpreter asdescribed below. If \fIpath\fR is omitted, Tcl creates a unique name of theform \fBinterp\fIx\fR, where \fIx\fR is an integer, and uses it for theinterpreter and the slave command. If the \fB\-safe\fR switch is specified(or if the master interpreter is a safe interpreter), the new slaveinterpreter will be created as a safe interpreter with limitedfunctionality; otherwise the slave will include the full set of Tclbuilt-in commands and variables. The \fB\-\|\-\fR switch can be used tomark the end of switches;  it may be needed if \fIpath\fR is an unusualvalue such as \fB\-safe\fR. The result of the command is the name of thenew interpreter. The name of a slave interpreter must be unique among allthe slaves for its master;  an error occurs if a slave interpreter by thegiven name already exists in this master..TP\fBinterp\fR \fBdelete \fR?\fIpath ...?\fRDeletes zero or more interpreters given by the optional \fIpath\fRarguments, and for each interpreter, it also deletes its slaves. Thecommand also deletes the slave command for each interpreter deleted.For each \fIpath\fR argument, if no interpreter by that nameexists, the command raises an error..TP\fBinterp\fR \fBeval\fR \fIpath arg \fR?\fIarg ...\fR?This command concatenates all of the \fIarg\fR arguments in the samefashion as the \fBconcat\fR command, then evaluates the resulting string asa Tcl script in the slave interpreter identified by \fIpath\fR. The resultof this evaluation (including error information such as the \fBerrorInfo\fRand \fBerrorCode\fR variables, if an error occurs) is returned to theinvoking interpreter..TP\fBinterp exists \fIpath\fRReturns  \fB1\fR if a slave interpreter by the specified \fIpath\fRexists in this master, \fB0\fR otherwise. If \fIpath\fR is omitted, theinvoking interpreter is used..VS "" BR.TP\fBinterp expose \fIpath\fR \fIhiddenName\fR ?\fIexposedCmdName\fR?Makes the hidden command \fIhiddenName\fR exposed, eventually bringingit back under a new \fIexposedCmdName\fR name (this name is currentlyaccepted only if it is a valid global name space name without any ::),in the interpreterdenoted by \fIpath\fR.If an exposed command with the targetted name already exists, this commandfails.Hidden commands are explained in more detail in HIDDEN COMMANDS, below..TP\fBinterp\fR \fBhide\fR \fIpath\fR \fIexposedCmdName\fR ?\fIhiddenCmdName\fR?Makes the exposed command \fIexposedCmdName\fR hidden, renamingit to the hidden command \fIhiddenCmdName\fR, or keeping the same name if\fIhiddenCmdName\fR is not given, in the interpreter denoted by \fIpath\fR.If a hidden command with the targetted name already exists, this commandfails.Currently both \fIexposedCmdName\fR and \fIhiddenCmdName\fR can not contain namespace qualifiers, or an error is raised.Commands to be hidden by \fBinterp hide\fR are looked up in the globalnamespace even if the current namespace is not the global one. Thisprevents slaves from fooling a master interpreter into hiding the wrongcommand, by making the current namespace be different from the global one.Hidden commands are explained in more detail in HIDDEN COMMANDS, below..TP\fBinterp\fR \fBhidden\fR \fIpath\fRReturns a list of the names of all hidden commands in the interpreteridentified by \fIpath\fR..TP\fBinterp\fR \fBinvokehidden\fR \fIpath\fR ?\fB-global\fR? \fIhiddenCmdName\fR ?\fIarg ...\fR?Invokes the hidden command \fIhiddenCmdName\fR with the arguments suppliedin the interpreter denoted by \fIpath\fR. No substitutions or evaluationare applied to the arguments.If the \fB-global\fR flag is present, the hidden command is invoked at theglobal level in the target interpreter; otherwise it is invoked at thecurrent call frame and can access local variables in that and outer callframes.Hidden commands are explained in more detail in HIDDEN COMMANDS, below..VE.TP\fBinterp issafe\fR ?\fIpath\fR?Returns \fB1\fR if the interpreter identified by the specified \fIpath\fRis safe, \fB0\fR otherwise..VS "" BR.TP\fBinterp marktrusted\fR \fIpath\fRMarks the interpreter identified by \fIpath\fR as trusted. Doesnot expose the hidden commands. This command can only be invoked from atrusted interpreter.The command has no effect if the interpreter identified by \fIpath\fR isalready trusted..VE.TP\fBinterp\fR \fBshare\fR \fIsrcPath channelId destPath\fRCauses the IO channel identified by \fIchannelId\fR to become sharedbetween the interpreter identified by \fIsrcPath\fR and the interpreteridentified by \fIdestPath\fR. Both interpreters have the same permissionson the IO channel.Both interpreters must close it to close the underlying IO channel; IOchannels accessible in an interpreter are automatically closed when aninterpreter is destroyed..TP\fBinterp\fR \fBslaves\fR ?\fIpath\fR?Returns a Tcl list of the names of all the slave interpreters associatedwith the interpreter identified by \fIpath\fR. If \fIpath\fR is omitted,the invoking interpreter is used..TP\fBinterp\fR \fBtarget\fR \fIpath alias\fRReturns a Tcl list describing the target interpreter for an alias. Thealias is specified with an interpreter path and source command name, justas in \fBinterp alias\fR above. The name of the target interpreter isreturned as an interpreter path, relative to the invoking interpreter.If the target interpreter for the alias is the invoking interpreter then anempty list is returned. If the target interpreter for the alias is not theinvoking interpreter or one of its descendants then an error is generated.The target command does not have to be defined at the time of this invocation..TP\fBinterp\fR \fBtransfer\fR \fIsrcPath channelId destPath\fRCauses the IO channel identified by \fIchannelId\fR to become available inthe interpreter identified by \fIdestPath\fR and unavailable in theinterpreter identified by \fIsrcPath\fR..SH "SLAVE COMMAND".PPFor each slave interpreter created with the \fBinterp\fR command, anew Tcl command is created in the master interpreter with the samename as the new interpreter. This command may be used to invokevarious operations on the interpreter.  It has the followinggeneral form:.CS\fIslave command \fR?\fIarg arg ...\fR?.CE\fISlave\fR is the name of the interpreter, and \fIcommand\fRand the \fIarg\fRs determine the exact behavior of the command.The valid forms of this command are:.TP\fIslave \fBaliases\fRReturns a Tcl list whose elements are the names of all thealiases in \fIslave\fR.  The names returned are the \fIsrcCmd\fRvalues used when the aliases were created (which may not be the same

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -