UpVar.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" 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.
- '"
- '" RCS: @(#) $Id: UpVar.3,v 1.7 2002/08/05 03:24:39 dgp Exp $
- '"
- .so man.macros
- .TH Tcl_UpVar 3 7.4 Tcl "Tcl Library Procedures"
- .BS
- .SH NAME
- Tcl_UpVar, Tcl_UpVar2 - link one variable to another
- .SH SYNOPSIS
- .nf
- fB#include <tcl.h>fR
- .sp
- int
- fBTcl_UpVar(fIinterp, frameName, sourceName, destName, flagsfB)fR
- .sp
- int
- fBTcl_UpVar2(fIinterp, frameName, name1, name2, destName, flagsfB)fR
- .SH ARGUMENTS
- .AS Tcl_VarTraceProc prevClientData
- .AP Tcl_Interp *interp in
- Interpreter containing variables; also used for error reporting.
- .AP "CONST char" *frameName in
- Identifies the stack frame containing source variable.
- May have any of the forms accepted by
- the fBupvarfR command, such as fB#0fR or fB1fR.
- .AP "CONST char" *sourceName in
- Name of source variable, in the frame given by fIframeNamefR.
- May refer to a scalar variable or to an array variable with a
- parenthesized index.
- .AP "CONST char" *destName in
- Name of destination variable, which is to be linked to source
- variable so that references to fIdestNamefR
- refer to the other variable. Must not currently exist except as
- an upvar-ed variable.
- .AP int flags in
- Either TCL_GLOBAL_ONLY or 0; if non-zero, then fIdestNamefR is
- a global variable; otherwise it is a local to the current procedure
- (or global if no procedure is active).
- .AP "CONST char" *name1 in
- First part of source variable's name (scalar name, or name of array
- without array index).
- .AP "CONST char" *name2 in
- If 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_UpVarfR and fBTcl_UpVar2fR provide the same functionality
- as the fBupvarfR command: they make a link from a source variable
- to a destination variable, so that references to the destination are
- passed transparently through to the source.
- The name of the source variable may be specified either as a single
- string such as fBxyxfR or fBa(24)fR (by calling fBTcl_UpVarfR)
- or in two parts where the array name has been separated from the
- element name (by calling fBTcl_UpVar2fR).
- The destination variable name is specified in a single string; it
- may not be an array element.
- .PP
- Both procedures return either TCL_OK or TCL_ERROR, and they
- leave an error message in the interpreter's result if an error occurs.
- .PP
- As with the fBupvarfR command, the source variable need not exist;
- if it does exist, unsetting it later does not destroy the link. The
- destination variable may exist at the time of the call, but if so
- it must exist as a linked variable.
- .SH KEYWORDS
- linked variable, upvar, variable