📄 upvar.3
字号:
'\"'\" Copyright (c) 1994 The Regents of the University of California.'\" Copyright (c) 1994-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: @(#) UpVar.3 1.6 96/03/25 20:09:19'\" .so man.macros.TH Tcl_UpVar 3 7.4 Tcl "Tcl Library Procedures".BS.SH NAMETcl_UpVar, Tcl_UpVar2 \- link one variable to another.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spint\fBTcl_UpVar(\fIinterp, frameName, sourceName, destName, flags\fB)\fR.spint\fBTcl_UpVar2(\fIinterp, frameName, name1, name2, destName, flags\fB)\fR.SH ARGUMENTS.AS Tcl_VarTraceProc prevClientData.AP Tcl_Interp *interp inInterpreter containing variables; also used for error reporting..AP char *frameName inIdentifies the stack frame containing source variable.May have any of the forms accepted bythe \fBupvar\fR command, such as \fB#0\fR or \fB1\fR..AP char *sourceName inName of source variable, in the frame given by \fIframeName\fR.May refer to a scalar variable or to an array variable with aparenthesized index..AP char *destName inName of destination variable, which is to be linked to sourcevariable so that references to \fIdestName\fRrefer to the other variable. Must not currently exist except asan upvar-ed variable..AP int flags inEither TCL_GLOBAL_ONLY or 0; if non-zero, then \fIdestName\fR isa global variable; otherwise it is a local to the current procedure(or global if no procedure is active)..AP char *name1 inFirst part of source variable's name (scalar name, or name of arraywithout array index)..AP char *name2 inIf source variable is an element of an array, gives the index of the element.For scalar source variables, is NULL..BE.SH DESCRIPTION.PP\fBTcl_UpVar\fR and \fBTcl_UpVar2\fR provide the same functionalityas the \fBupvar\fR command: they make a link from a source variableto a destination variable, so that references to the destination arepassed transparently through to the source.The name of the source variable may be specified either as a singlestring such as \fBxyx\fR or \fBa(24)\fR (by calling \fBTcl_UpVar\fR)or in two parts where the array name has been separated from theelement name (by calling \fBTcl_UpVar2\fR).The destination variable name is specified in a single string; itmay not be an array element..PPBoth procedures return either TCL_OK or TCL_ERROR, and theyleave an error message in \fIinterp->result\fR if an erroroccurs..PPAs with the \fBupvar\fR command, the source variable need not exist;if it does exist, unsetting it later does not destroy the link. Thedestination variable may exist at the time of the call, but if soit must exist as a linked variable..SH KEYWORDSlinked variable, upvar, variable
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -