Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/UpVar.3 @ 42

Last change on this file since 42 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 2.9 KB
Line 
1'\"
2'\" Copyright (c) 1994 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\"
5'\" See the file "license.terms" for information on usage and redistribution
6'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7'\"
8'\" RCS: @(#) $Id: UpVar.3,v 1.11 2006/10/09 23:38:56 msofer Exp $
9'\"
10.so man.macros
11.TH Tcl_UpVar 3 7.4 Tcl "Tcl Library Procedures"
12.BS
13.SH NAME
14Tcl_UpVar, Tcl_UpVar2 \- link one variable to another
15.SH SYNOPSIS
16.nf
17\fB#include <tcl.h>\fR
18.sp
19int
20\fBTcl_UpVar(\fIinterp, frameName, sourceName, destName, flags\fB)\fR
21.sp
22int
23\fBTcl_UpVar2(\fIinterp, frameName, name1, name2, destName, flags\fB)\fR
24.SH ARGUMENTS
25.AS "const char" *sourceName
26.AP Tcl_Interp *interp in
27Interpreter containing variables;  also used for error reporting.
28.AP "const char" *frameName in
29Identifies the stack frame containing source variable.
30May have any of the forms accepted by
31the \fBupvar\fR command, such as \fB#0\fR or \fB1\fR.
32.AP "const char" *sourceName in
33Name of source variable, in the frame given by \fIframeName\fR.
34May refer to a scalar variable or to an array variable with a
35parenthesized index.
36.AP "const char" *destName in
37Name of destination variable, which is to be linked to source
38variable so that references to \fIdestName\fR
39refer to the other variable.  Must not currently exist except as
40an upvar-ed variable.
41.AP int flags in
42One of \fBTCL_GLOBAL_ONLY\fR, \fBTCL_NAMESPACE_ONLY\fR or 0;  if non-zero,
43then \fIdestName\fR is a global or namespace variable;  otherwise it is
44local to the current procedure (or current namespace if no procedure is
45active).
46.AP "const char" *name1 in
47First part of source variable's name (scalar name, or name of array
48without array index).
49.AP "const char" *name2 in
50If source variable is an element of an array, gives the index of the element.
51For scalar source variables, is NULL.
52.BE
53
54.SH DESCRIPTION
55.PP
56\fBTcl_UpVar\fR and \fBTcl_UpVar2\fR provide the same functionality
57as the \fBupvar\fR command:  they make a link from a source variable
58to a destination variable, so that references to the destination are
59passed transparently through to the source.
60The name of the source variable may be specified either as a single
61string such as \fBxyx\fR or \fBa(24)\fR (by calling \fBTcl_UpVar\fR)
62or in two parts where the array name has been separated from the
63element name (by calling \fBTcl_UpVar2\fR).
64The destination variable name is specified in a single string;  it
65may not be an array element.
66.PP
67Both procedures return either \fBTCL_OK\fR or \fBTCL_ERROR\fR, and they
68leave an error message in the interpreter's result if an error occurs.
69.PP
70As with the \fBupvar\fR command, the source variable need not exist;
71if it does exist, unsetting it later does not destroy the link.  The
72destination variable may exist at the time of the call, but if so
73it must exist as a linked variable.
74
75.SH KEYWORDS
76linked variable, upvar, variable
Note: See TracBrowser for help on using the repository browser.