1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
4 |
|
|
'\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies
|
5 |
|
|
'\"
|
6 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
7 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
8 |
|
|
'\"
|
9 |
|
|
'\" RCS: @(#) $Id: info.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
|
10 |
|
|
'\"
|
11 |
|
|
.so man.macros
|
12 |
|
|
.TH info n 7.5 Tcl "Tcl Built-In Commands"
|
13 |
|
|
.BS
|
14 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
15 |
|
|
.SH NAME
|
16 |
|
|
info \- Return information about the state of the Tcl interpreter
|
17 |
|
|
.SH SYNOPSIS
|
18 |
|
|
\fBinfo \fIoption \fR?\fIarg arg ...\fR?
|
19 |
|
|
.BE
|
20 |
|
|
|
21 |
|
|
.SH DESCRIPTION
|
22 |
|
|
.PP
|
23 |
|
|
This command provides information about various internals of the Tcl
|
24 |
|
|
interpreter.
|
25 |
|
|
The legal \fIoption\fR's (which may be abbreviated) are:
|
26 |
|
|
.TP
|
27 |
|
|
\fBinfo args \fIprocname\fR
|
28 |
|
|
Returns a list containing the names of the arguments to procedure
|
29 |
|
|
\fIprocname\fR, in order. \fIProcname\fR must be the name of a
|
30 |
|
|
Tcl command procedure.
|
31 |
|
|
.TP
|
32 |
|
|
\fBinfo body \fIprocname\fR
|
33 |
|
|
Returns the body of procedure \fIprocname\fR. \fIProcname\fR must be
|
34 |
|
|
the name of a Tcl command procedure.
|
35 |
|
|
.TP
|
36 |
|
|
\fBinfo cmdcount\fR
|
37 |
|
|
Returns a count of the total number of commands that have been invoked
|
38 |
|
|
in this interpreter.
|
39 |
|
|
.TP
|
40 |
|
|
\fBinfo commands \fR?\fIpattern\fR?
|
41 |
|
|
If \fIpattern\fR isn't specified,
|
42 |
|
|
returns a list of names of all the Tcl commands in the current namespace,
|
43 |
|
|
including both the built-in commands written in C and
|
44 |
|
|
the command procedures defined using the \fBproc\fR command.
|
45 |
|
|
If \fIpattern\fR is specified,
|
46 |
|
|
only those names matching \fIpattern\fR are returned.
|
47 |
|
|
Matching is determined using the same rules as for \fBstring match\fR.
|
48 |
|
|
\fIpattern\fR can be a qualified name like \fBFoo::print*\fR.
|
49 |
|
|
That is, it may specify a particular namespace
|
50 |
|
|
using a sequence of namespace names separated by \fB::\fRs,
|
51 |
|
|
and may have pattern matching special characters
|
52 |
|
|
at the end to specify a set of commands in that namespace.
|
53 |
|
|
If \fIpattern\fR is a qualified name,
|
54 |
|
|
the resulting list of command names has each one qualified with the name
|
55 |
|
|
of the specified namespace.
|
56 |
|
|
.TP
|
57 |
|
|
\fBinfo complete \fIcommand\fR
|
58 |
|
|
Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of
|
59 |
|
|
having no unclosed quotes, braces, brackets or array element names,
|
60 |
|
|
If the command doesn't appear to be complete then 0 is returned.
|
61 |
|
|
This command is typically used in line-oriented input environments
|
62 |
|
|
to allow users to type in commands that span multiple lines; if the
|
63 |
|
|
command isn't complete, the script can delay evaluating it until additional
|
64 |
|
|
lines have been typed to complete the command.
|
65 |
|
|
.TP
|
66 |
|
|
\fBinfo default \fIprocname arg varname\fR
|
67 |
|
|
\fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR
|
68 |
|
|
must be the name of an argument to that procedure. If \fIarg\fR
|
69 |
|
|
doesn't have a default value then the command returns \fB0\fR.
|
70 |
|
|
Otherwise it returns \fB1\fR and places the default value of \fIarg\fR
|
71 |
|
|
into variable \fIvarname\fR.
|
72 |
|
|
.TP
|
73 |
|
|
\fBinfo exists \fIvarName\fR
|
74 |
|
|
Returns \fB1\fR if the variable named \fIvarName\fR exists in the
|
75 |
|
|
current context (either as a global or local variable), returns \fB0\fR
|
76 |
|
|
otherwise.
|
77 |
|
|
.TP
|
78 |
|
|
\fBinfo globals \fR?\fIpattern\fR?
|
79 |
|
|
If \fIpattern\fR isn't specified, returns a list of all the names
|
80 |
|
|
of currently-defined global variables.
|
81 |
|
|
Global variables are variables in the global namespace.
|
82 |
|
|
If \fIpattern\fR is specified, only those names matching \fIpattern\fR
|
83 |
|
|
are returned. Matching is determined using the same rules as for
|
84 |
|
|
\fBstring match\fR.
|
85 |
|
|
.TP
|
86 |
|
|
\fBinfo hostname\fR
|
87 |
|
|
Returns the name of the computer on which this invocation is being
|
88 |
|
|
executed.
|
89 |
|
|
.TP
|
90 |
|
|
\fBinfo level\fR ?\fInumber\fR?
|
91 |
|
|
If \fInumber\fR is not specified, this command returns a number
|
92 |
|
|
giving the stack level of the invoking procedure, or 0 if the
|
93 |
|
|
command is invoked at top-level. If \fInumber\fR is specified,
|
94 |
|
|
then the result is a list consisting of the name and arguments for the
|
95 |
|
|
procedure call at level \fInumber\fR on the stack. If \fInumber\fR
|
96 |
|
|
is positive then it selects a particular stack level (1 refers
|
97 |
|
|
to the top-most active procedure, 2 to the procedure it called, and
|
98 |
|
|
so on); otherwise it gives a level relative to the current level
|
99 |
|
|
(0 refers to the current procedure, -1 to its caller, and so on).
|
100 |
|
|
See the \fBuplevel\fR command for more information on what stack
|
101 |
|
|
levels mean.
|
102 |
|
|
.TP
|
103 |
|
|
\fBinfo library\fR
|
104 |
|
|
Returns the name of the library directory in which standard Tcl
|
105 |
|
|
scripts are stored.
|
106 |
|
|
This is actually the value of the \fBtcl_library\fR
|
107 |
|
|
variable and may be changed by setting \fBtcl_library\fR.
|
108 |
|
|
See the \fBtclvars\fR manual entry for more information.
|
109 |
|
|
.TP
|
110 |
|
|
\fBinfo loaded \fR?\fIinterp\fR?
|
111 |
|
|
Returns a list describing all of the packages that have been loaded into
|
112 |
|
|
\fIinterp\fR with the \fBload\fR command.
|
113 |
|
|
Each list element is a sub-list with two elements consisting of the
|
114 |
|
|
name of the file from which the package was loaded and the name of
|
115 |
|
|
the package.
|
116 |
|
|
For statically-loaded packages the file name will be an empty string.
|
117 |
|
|
If \fIinterp\fR is omitted then information is returned for all packages
|
118 |
|
|
loaded in any interpreter in the process.
|
119 |
|
|
To get a list of just the packages in the current interpreter, specify
|
120 |
|
|
an empty string for the \fIinterp\fR argument.
|
121 |
|
|
.TP
|
122 |
|
|
\fBinfo locals \fR?\fIpattern\fR?
|
123 |
|
|
If \fIpattern\fR isn't specified, returns a list of all the names
|
124 |
|
|
of currently-defined local variables, including arguments to the
|
125 |
|
|
current procedure, if any.
|
126 |
|
|
Variables defined with the \fBglobal\fR and \fBupvar\fR commands
|
127 |
|
|
will not be returned.
|
128 |
|
|
If \fIpattern\fR is specified, only those names matching \fIpattern\fR
|
129 |
|
|
are returned. Matching is determined using the same rules as for
|
130 |
|
|
\fBstring match\fR.
|
131 |
|
|
.TP
|
132 |
|
|
\fBinfo nameofexecutable\fR
|
133 |
|
|
Returns the full path name of the binary file from which the application
|
134 |
|
|
was invoked. If Tcl was unable to identify the file, then an empty
|
135 |
|
|
string is returned.
|
136 |
|
|
.TP
|
137 |
|
|
\fBinfo patchlevel\fR
|
138 |
|
|
Returns the value of the global variable \fBtcl_patchLevel\fR; see
|
139 |
|
|
the \fBtclvars\fR manual entry for more information.
|
140 |
|
|
.TP
|
141 |
|
|
\fBinfo procs \fR?\fIpattern\fR?
|
142 |
|
|
If \fIpattern\fR isn't specified, returns a list of all the
|
143 |
|
|
names of Tcl command procedures in the current namespace.
|
144 |
|
|
If \fIpattern\fR is specified,
|
145 |
|
|
only those procedure names in the current namespace
|
146 |
|
|
matching \fIpattern\fR are returned.
|
147 |
|
|
Matching is determined using the same rules as for
|
148 |
|
|
\fBstring match\fR.
|
149 |
|
|
.TP
|
150 |
|
|
\fBinfo script\fR
|
151 |
|
|
If a Tcl script file is currently being evaluated (i.e. there is a
|
152 |
|
|
call to \fBTcl_EvalFile\fR active or there is an active invocation
|
153 |
|
|
of the \fBsource\fR command), then this command returns the name
|
154 |
|
|
of the innermost file being processed. Otherwise the command returns an
|
155 |
|
|
empty string.
|
156 |
|
|
.TP
|
157 |
|
|
\fBinfo sharedlibextension\fR
|
158 |
|
|
Returns the extension used on this platform for the names of files
|
159 |
|
|
containing shared libraries (for example, \fB.so\fR under Solaris).
|
160 |
|
|
If shared libraries aren't supported on this platform then an empty
|
161 |
|
|
string is returned.
|
162 |
|
|
.TP
|
163 |
|
|
\fBinfo tclversion\fR
|
164 |
|
|
Returns the value of the global variable \fBtcl_version\fR; see
|
165 |
|
|
the \fBtclvars\fR manual entry for more information.
|
166 |
|
|
.TP
|
167 |
|
|
\fBinfo vars\fR ?\fIpattern\fR?
|
168 |
|
|
If \fIpattern\fR isn't specified,
|
169 |
|
|
returns a list of all the names of currently-visible variables.
|
170 |
|
|
This includes locals and currently-visible globals.
|
171 |
|
|
If \fIpattern\fR is specified, only those names matching \fIpattern\fR
|
172 |
|
|
are returned. Matching is determined using the same rules as for
|
173 |
|
|
\fBstring match\fR.
|
174 |
|
|
\fIpattern\fR can be a qualified name like \fBFoo::option*\fR.
|
175 |
|
|
That is, it may specify a particular namespace
|
176 |
|
|
using a sequence of namespace names separated by \fB::\fRs,
|
177 |
|
|
and may have pattern matching special characters
|
178 |
|
|
at the end to specify a set of variables in that namespace.
|
179 |
|
|
If \fIpattern\fR is a qualified name,
|
180 |
|
|
the resulting list of variable names
|
181 |
|
|
has each matching namespace variable qualified with the name
|
182 |
|
|
of its namespace.
|
183 |
|
|
|
184 |
|
|
.SH KEYWORDS
|
185 |
|
|
command, information, interpreter, level, namespace, procedure, variable
|