Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/global.n @ 33

Last change on this file since 33 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 1.8 KB
Line 
1'\"
2'\" Copyright (c) 1993 The Regents of the University of California.
3'\" Copyright (c) 1994-1997 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: global.n,v 1.12 2007/12/13 15:22:32 dgp Exp $
9'\"
10.so man.macros
11.TH global n "" Tcl "Tcl Built-In Commands"
12.BS
13'\" Note:  do not modify the .SH NAME line immediately below!
14.SH NAME
15global \- Access global variables
16.SH SYNOPSIS
17\fBglobal \fIvarname \fR?\fIvarname ...\fR?
18.BE
19
20.SH DESCRIPTION
21.PP
22This command has no effect unless executed in the context of a proc body.
23If the \fBglobal\fR command is executed in the context of a proc body, it
24creates local variables linked to the corresponding global variables (and
25therefore these variables are listed by info locals).
26.PP
27If \fIvarname\fR contains namespace qualifiers, the local variable's name is
28the unqualified name of the global variable, as determined by the
29\fBnamespace tail\fR command.
30.PP
31\fIvarname\fR is always treated as the name of a variable, not an
32array element.  An error is returned if the name looks like an array element,
33such as \fBa(b)\fR.
34.SH EXAMPLES
35This procedure sets the namespace variable \fI::a::x\fR
36.CS
37proc reset {} {
38    \fBglobal\fR a::x
39    set x 0
40}
41.CE
42.PP
43This procedure accumulates the strings passed to it in a global
44buffer, separated by newlines.  It is useful for situations when you
45want to build a message piece-by-piece (as if with \fBputs\fR) but
46send that full message in a single piece (e.g. over a connection
47opened with \fBsocket\fR or as part of a counted HTTP response).
48.CS
49proc accum {string} {
50    \fBglobal\fR accumulator
51    append accumulator $string \en
52}
53.CE
54
55.SH "SEE ALSO"
56namespace(n), upvar(n), variable(n)
57
58.SH KEYWORDS
59global, namespace, procedure, variable
Note: See TracBrowser for help on using the repository browser.