| 1 | '\" |
| 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 | '\" Copyright (c) 1998-2000 Ajuba Solutions |
| 6 | '\" |
| 7 | '\" See the file "license.terms" for information on usage and redistribution |
| 8 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 9 | '\" |
| 10 | '\" RCS: @(#) $Id: info.n,v 1.8.2.3 2004/10/27 14:23:56 dkf Exp $ |
| 11 | '\" |
| 12 | '\" The definitions below are for supplemental macros used in Tcl/Tk |
| 13 | '\" manual entries. |
| 14 | '\" |
| 15 | '\" .AP type name in/out ?indent? |
| 16 | '\" Start paragraph describing an argument to a library procedure. |
| 17 | '\" type is type of argument (int, etc.), in/out is either "in", "out", |
| 18 | '\" or "in/out" to describe whether procedure reads or modifies arg, |
| 19 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be |
| 20 | '\" needed; use .AS below instead) |
| 21 | '\" |
| 22 | '\" .AS ?type? ?name? |
| 23 | '\" Give maximum sizes of arguments for setting tab stops. Type and |
| 24 | '\" name are examples of largest possible arguments that will be passed |
| 25 | '\" to .AP later. If args are omitted, default tab stops are used. |
| 26 | '\" |
| 27 | '\" .BS |
| 28 | '\" Start box enclosure. From here until next .BE, everything will be |
| 29 | '\" enclosed in one large box. |
| 30 | '\" |
| 31 | '\" .BE |
| 32 | '\" End of box enclosure. |
| 33 | '\" |
| 34 | '\" .CS |
| 35 | '\" Begin code excerpt. |
| 36 | '\" |
| 37 | '\" .CE |
| 38 | '\" End code excerpt. |
| 39 | '\" |
| 40 | '\" .VS ?version? ?br? |
| 41 | '\" Begin vertical sidebar, for use in marking newly-changed parts |
| 42 | '\" of man pages. The first argument is ignored and used for recording |
| 43 | '\" the version when the .VS was added, so that the sidebars can be |
| 44 | '\" found and removed when they reach a certain age. If another argument |
| 45 | '\" is present, then a line break is forced before starting the sidebar. |
| 46 | '\" |
| 47 | '\" .VE |
| 48 | '\" End of vertical sidebar. |
| 49 | '\" |
| 50 | '\" .DS |
| 51 | '\" Begin an indented unfilled display. |
| 52 | '\" |
| 53 | '\" .DE |
| 54 | '\" End of indented unfilled display. |
| 55 | '\" |
| 56 | '\" .SO |
| 57 | '\" Start of list of standard options for a Tk widget. The |
| 58 | '\" options follow on successive lines, in four columns separated |
| 59 | '\" by tabs. |
| 60 | '\" |
| 61 | '\" .SE |
| 62 | '\" End of list of standard options for a Tk widget. |
| 63 | '\" |
| 64 | '\" .OP cmdName dbName dbClass |
| 65 | '\" Start of description of a specific option. cmdName gives the |
| 66 | '\" option's name as specified in the class command, dbName gives |
| 67 | '\" the option's name in the option database, and dbClass gives |
| 68 | '\" the option's class in the option database. |
| 69 | '\" |
| 70 | '\" .UL arg1 arg2 |
| 71 | '\" Print arg1 underlined, then print arg2 normally. |
| 72 | '\" |
| 73 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ |
| 74 | '\" |
| 75 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. |
| 76 | .if t .wh -1.3i ^B |
| 77 | .nr ^l \n(.l |
| 78 | .ad b |
| 79 | '\" # Start an argument description |
| 80 | .de AP |
| 81 | .ie !"\\$4"" .TP \\$4 |
| 82 | .el \{\ |
| 83 | . ie !"\\$2"" .TP \\n()Cu |
| 84 | . el .TP 15 |
| 85 | .\} |
| 86 | .ta \\n()Au \\n()Bu |
| 87 | .ie !"\\$3"" \{\ |
| 88 | \&\\$1 \\fI\\$2\\fP (\\$3) |
| 89 | .\".b |
| 90 | .\} |
| 91 | .el \{\ |
| 92 | .br |
| 93 | .ie !"\\$2"" \{\ |
| 94 | \&\\$1 \\fI\\$2\\fP |
| 95 | .\} |
| 96 | .el \{\ |
| 97 | \&\\fI\\$1\\fP |
| 98 | .\} |
| 99 | .\} |
| 100 | .. |
| 101 | '\" # define tabbing values for .AP |
| 102 | .de AS |
| 103 | .nr )A 10n |
| 104 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n |
| 105 | .nr )B \\n()Au+15n |
| 106 | .\" |
| 107 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n |
| 108 | .nr )C \\n()Bu+\\w'(in/out)'u+2n |
| 109 | .. |
| 110 | .AS Tcl_Interp Tcl_CreateInterp in/out |
| 111 | '\" # BS - start boxed text |
| 112 | '\" # ^y = starting y location |
| 113 | '\" # ^b = 1 |
| 114 | .de BS |
| 115 | .br |
| 116 | .mk ^y |
| 117 | .nr ^b 1u |
| 118 | .if n .nf |
| 119 | .if n .ti 0 |
| 120 | .if n \l'\\n(.lu\(ul' |
| 121 | .if n .fi |
| 122 | .. |
| 123 | '\" # BE - end boxed text (draw box now) |
| 124 | .de BE |
| 125 | .nf |
| 126 | .ti 0 |
| 127 | .mk ^t |
| 128 | .ie n \l'\\n(^lu\(ul' |
| 129 | .el \{\ |
| 130 | .\" Draw four-sided box normally, but don't draw top of |
| 131 | .\" box if the box started on an earlier page. |
| 132 | .ie !\\n(^b-1 \{\ |
| 133 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 134 | .\} |
| 135 | .el \}\ |
| 136 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' |
| 137 | .\} |
| 138 | .\} |
| 139 | .fi |
| 140 | .br |
| 141 | .nr ^b 0 |
| 142 | .. |
| 143 | '\" # VS - start vertical sidebar |
| 144 | '\" # ^Y = starting y location |
| 145 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) |
| 146 | .de VS |
| 147 | .if !"\\$2"" .br |
| 148 | .mk ^Y |
| 149 | .ie n 'mc \s12\(br\s0 |
| 150 | .el .nr ^v 1u |
| 151 | .. |
| 152 | '\" # VE - end of vertical sidebar |
| 153 | .de VE |
| 154 | .ie n 'mc |
| 155 | .el \{\ |
| 156 | .ev 2 |
| 157 | .nf |
| 158 | .ti 0 |
| 159 | .mk ^t |
| 160 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' |
| 161 | .sp -1 |
| 162 | .fi |
| 163 | .ev |
| 164 | .\} |
| 165 | .nr ^v 0 |
| 166 | .. |
| 167 | '\" # Special macro to handle page bottom: finish off current |
| 168 | '\" # box/sidebar if in box/sidebar mode, then invoked standard |
| 169 | '\" # page bottom macro. |
| 170 | .de ^B |
| 171 | .ev 2 |
| 172 | 'ti 0 |
| 173 | 'nf |
| 174 | .mk ^t |
| 175 | .if \\n(^b \{\ |
| 176 | .\" Draw three-sided box if this is the box's first page, |
| 177 | .\" draw two sides but no top otherwise. |
| 178 | .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
| 179 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c |
| 180 | .\} |
| 181 | .if \\n(^v \{\ |
| 182 | .nr ^x \\n(^tu+1v-\\n(^Yu |
| 183 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c |
| 184 | .\} |
| 185 | .bp |
| 186 | 'fi |
| 187 | .ev |
| 188 | .if \\n(^b \{\ |
| 189 | .mk ^y |
| 190 | .nr ^b 2 |
| 191 | .\} |
| 192 | .if \\n(^v \{\ |
| 193 | .mk ^Y |
| 194 | .\} |
| 195 | .. |
| 196 | '\" # DS - begin display |
| 197 | .de DS |
| 198 | .RS |
| 199 | .nf |
| 200 | .sp |
| 201 | .. |
| 202 | '\" # DE - end display |
| 203 | .de DE |
| 204 | .fi |
| 205 | .RE |
| 206 | .sp |
| 207 | .. |
| 208 | '\" # SO - start of list of standard options |
| 209 | .de SO |
| 210 | .SH "STANDARD OPTIONS" |
| 211 | .LP |
| 212 | .nf |
| 213 | .ta 5.5c 11c |
| 214 | .ft B |
| 215 | .. |
| 216 | '\" # SE - end of list of standard options |
| 217 | .de SE |
| 218 | .fi |
| 219 | .ft R |
| 220 | .LP |
| 221 | See the \\fBoptions\\fR manual entry for details on the standard options. |
| 222 | .. |
| 223 | '\" # OP - start of full description for a single option |
| 224 | .de OP |
| 225 | .LP |
| 226 | .nf |
| 227 | .ta 4c |
| 228 | Command-Line Name: \\fB\\$1\\fR |
| 229 | Database Name: \\fB\\$2\\fR |
| 230 | Database Class: \\fB\\$3\\fR |
| 231 | .fi |
| 232 | .IP |
| 233 | .. |
| 234 | '\" # CS - begin code excerpt |
| 235 | .de CS |
| 236 | .RS |
| 237 | .nf |
| 238 | .ta .25i .5i .75i 1i |
| 239 | .. |
| 240 | '\" # CE - end code excerpt |
| 241 | .de CE |
| 242 | .fi |
| 243 | .RE |
| 244 | .. |
| 245 | .de UL |
| 246 | \\$1\l'|0\(ul'\\$2 |
| 247 | .. |
| 248 | .TH info n 8.4 Tcl "Tcl Built-In Commands" |
| 249 | .BS |
| 250 | '\" Note: do not modify the .SH NAME line immediately below! |
| 251 | .SH NAME |
| 252 | info \- Return information about the state of the Tcl interpreter |
| 253 | .SH SYNOPSIS |
| 254 | \fBinfo \fIoption \fR?\fIarg arg ...\fR? |
| 255 | .BE |
| 256 | |
| 257 | .SH DESCRIPTION |
| 258 | .PP |
| 259 | This command provides information about various internals of the Tcl |
| 260 | interpreter. |
| 261 | The legal \fIoption\fR's (which may be abbreviated) are: |
| 262 | .TP |
| 263 | \fBinfo args \fIprocname\fR |
| 264 | Returns a list containing the names of the arguments to procedure |
| 265 | \fIprocname\fR, in order. \fIProcname\fR must be the name of a |
| 266 | Tcl command procedure. |
| 267 | .TP |
| 268 | \fBinfo body \fIprocname\fR |
| 269 | Returns the body of procedure \fIprocname\fR. \fIProcname\fR must be |
| 270 | the name of a Tcl command procedure. |
| 271 | .TP |
| 272 | \fBinfo cmdcount\fR |
| 273 | Returns a count of the total number of commands that have been invoked |
| 274 | in this interpreter. |
| 275 | .TP |
| 276 | \fBinfo commands \fR?\fIpattern\fR? |
| 277 | If \fIpattern\fR isn't specified, |
| 278 | returns a list of names of all the Tcl commands in the current namespace, |
| 279 | including both the built-in commands written in C and |
| 280 | the command procedures defined using the \fBproc\fR command. |
| 281 | If \fIpattern\fR is specified, |
| 282 | only those names matching \fIpattern\fR are returned. |
| 283 | Matching is determined using the same rules as for \fBstring match\fR. |
| 284 | \fIpattern\fR can be a qualified name like \fBFoo::print*\fR. |
| 285 | That is, it may specify a particular namespace |
| 286 | using a sequence of namespace names separated by double colons (\fB::\fR), |
| 287 | and may have pattern matching special characters |
| 288 | at the end to specify a set of commands in that namespace. |
| 289 | If \fIpattern\fR is a qualified name, |
| 290 | the resulting list of command names has each one qualified with the name |
| 291 | of the specified namespace. |
| 292 | .TP |
| 293 | \fBinfo complete \fIcommand\fR |
| 294 | Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of |
| 295 | having no unclosed quotes, braces, brackets or array element names. |
| 296 | If the command doesn't appear to be complete then 0 is returned. |
| 297 | This command is typically used in line-oriented input environments |
| 298 | to allow users to type in commands that span multiple lines; if the |
| 299 | command isn't complete, the script can delay evaluating it until additional |
| 300 | lines have been typed to complete the command. |
| 301 | .TP |
| 302 | \fBinfo default \fIprocname arg varname\fR |
| 303 | \fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR |
| 304 | must be the name of an argument to that procedure. If \fIarg\fR |
| 305 | doesn't have a default value then the command returns \fB0\fR. |
| 306 | Otherwise it returns \fB1\fR and places the default value of \fIarg\fR |
| 307 | into variable \fIvarname\fR. |
| 308 | .TP |
| 309 | \fBinfo exists \fIvarName\fR |
| 310 | Returns \fB1\fR if the variable named \fIvarName\fR exists in the |
| 311 | current context (either as a global or local variable) and has been |
| 312 | defined by being given a value, returns \fB0\fR otherwise. |
| 313 | .VS 8.4 |
| 314 | .TP |
| 315 | \fBinfo functions \fR?\fIpattern\fR? |
| 316 | If \fIpattern\fR isn't specified, returns a list of all the math |
| 317 | functions currently defined. |
| 318 | If \fIpattern\fR is specified, only those functions whose name matches |
| 319 | \fIpattern\fR are returned. Matching is determined using the same |
| 320 | rules as for \fBstring match\fR. |
| 321 | .VE |
| 322 | .TP |
| 323 | \fBinfo globals \fR?\fIpattern\fR? |
| 324 | If \fIpattern\fR isn't specified, returns a list of all the names |
| 325 | of currently-defined global variables. |
| 326 | Global variables are variables in the global namespace. |
| 327 | If \fIpattern\fR is specified, only those names matching \fIpattern\fR |
| 328 | are returned. Matching is determined using the same rules as for |
| 329 | \fBstring match\fR. |
| 330 | .TP |
| 331 | \fBinfo hostname\fR |
| 332 | Returns the name of the computer on which this invocation is being |
| 333 | executed. |
| 334 | .VS |
| 335 | Note that this name is not guaranteed to be the fully qualified domain |
| 336 | name of the host. Where machines have several different names (as is |
| 337 | common on systems with both TCP/IP (DNS) and NetBIOS-based networking |
| 338 | installed,) it is the name that is suitable for TCP/IP networking that |
| 339 | is returned. |
| 340 | .VE |
| 341 | .TP |
| 342 | \fBinfo level\fR ?\fInumber\fR? |
| 343 | If \fInumber\fR is not specified, this command returns a number |
| 344 | giving the stack level of the invoking procedure, or 0 if the |
| 345 | command is invoked at top-level. If \fInumber\fR is specified, |
| 346 | then the result is a list consisting of the name and arguments for the |
| 347 | procedure call at level \fInumber\fR on the stack. If \fInumber\fR |
| 348 | is positive then it selects a particular stack level (1 refers |
| 349 | to the top-most active procedure, 2 to the procedure it called, and |
| 350 | so on); otherwise it gives a level relative to the current level |
| 351 | (0 refers to the current procedure, -1 to its caller, and so on). |
| 352 | See the \fBuplevel\fR command for more information on what stack |
| 353 | levels mean. |
| 354 | .TP |
| 355 | \fBinfo library\fR |
| 356 | Returns the name of the library directory in which standard Tcl |
| 357 | scripts are stored. |
| 358 | This is actually the value of the \fBtcl_library\fR |
| 359 | variable and may be changed by setting \fBtcl_library\fR. |
| 360 | See the \fBtclvars\fR manual entry for more information. |
| 361 | .TP |
| 362 | \fBinfo loaded \fR?\fIinterp\fR? |
| 363 | Returns a list describing all of the packages that have been loaded into |
| 364 | \fIinterp\fR with the \fBload\fR command. |
| 365 | Each list element is a sub-list with two elements consisting of the |
| 366 | name of the file from which the package was loaded and the name of |
| 367 | the package. |
| 368 | For statically-loaded packages the file name will be an empty string. |
| 369 | If \fIinterp\fR is omitted then information is returned for all packages |
| 370 | loaded in any interpreter in the process. |
| 371 | To get a list of just the packages in the current interpreter, specify |
| 372 | an empty string for the \fIinterp\fR argument. |
| 373 | .TP |
| 374 | \fBinfo locals \fR?\fIpattern\fR? |
| 375 | If \fIpattern\fR isn't specified, returns a list of all the names |
| 376 | of currently-defined local variables, including arguments to the |
| 377 | current procedure, if any. |
| 378 | Variables defined with the \fBglobal\fR, \fBupvar\fR and |
| 379 | \fBvariable\fR commands will not be returned. |
| 380 | If \fIpattern\fR is specified, only those names matching \fIpattern\fR |
| 381 | are returned. Matching is determined using the same rules as for |
| 382 | \fBstring match\fR. |
| 383 | .TP |
| 384 | \fBinfo nameofexecutable\fR |
| 385 | Returns the full path name of the binary file from which the application |
| 386 | was invoked. If Tcl was unable to identify the file, then an empty |
| 387 | string is returned. |
| 388 | .TP |
| 389 | \fBinfo patchlevel\fR |
| 390 | Returns the value of the global variable \fBtcl_patchLevel\fR; see |
| 391 | the \fBtclvars\fR manual entry for more information. |
| 392 | .TP |
| 393 | \fBinfo procs \fR?\fIpattern\fR? |
| 394 | If \fIpattern\fR isn't specified, returns a list of all the |
| 395 | names of Tcl command procedures in the current namespace. |
| 396 | If \fIpattern\fR is specified, |
| 397 | only those procedure names in the current namespace |
| 398 | matching \fIpattern\fR are returned. |
| 399 | Matching is determined using the same rules as for |
| 400 | \fBstring match\fR. |
| 401 | If \fIpattern\fR contains any namespace separators, they are used to |
| 402 | select a namespace relative to the current namespace (or relative to |
| 403 | the global namespace if \fIpattern\fR starts with \fB::\fR) to match |
| 404 | within; the matching pattern is taken to be the part after the last |
| 405 | namespace separator. |
| 406 | .TP |
| 407 | \fBinfo script\fR ?\fIfilename\fR? |
| 408 | If a Tcl script file is currently being evaluated (i.e. there is a |
| 409 | call to \fBTcl_EvalFile\fR active or there is an active invocation |
| 410 | of the \fBsource\fR command), then this command returns the name |
| 411 | of the innermost file being processed. If \fIfilename\fR is specified, |
| 412 | then the return value of this command will be modified for the |
| 413 | duration of the active invocation to return that name. This is |
| 414 | useful in virtual file system applications. |
| 415 | Otherwise the command returns an empty string. |
| 416 | .TP |
| 417 | \fBinfo sharedlibextension\fR |
| 418 | Returns the extension used on this platform for the names of files |
| 419 | containing shared libraries (for example, \fB.so\fR under Solaris). |
| 420 | If shared libraries aren't supported on this platform then an empty |
| 421 | string is returned. |
| 422 | .TP |
| 423 | \fBinfo tclversion\fR |
| 424 | Returns the value of the global variable \fBtcl_version\fR; see |
| 425 | the \fBtclvars\fR manual entry for more information. |
| 426 | .TP |
| 427 | \fBinfo vars\fR ?\fIpattern\fR? |
| 428 | If \fIpattern\fR isn't specified, |
| 429 | returns a list of all the names of currently-visible variables. |
| 430 | This includes locals and currently-visible globals. |
| 431 | If \fIpattern\fR is specified, only those names matching \fIpattern\fR |
| 432 | are returned. Matching is determined using the same rules as for |
| 433 | \fBstring match\fR. |
| 434 | \fIpattern\fR can be a qualified name like \fBFoo::option*\fR. |
| 435 | That is, it may specify a particular namespace |
| 436 | using a sequence of namespace names separated by double colons (\fB::\fR), |
| 437 | and may have pattern matching special characters |
| 438 | at the end to specify a set of variables in that namespace. |
| 439 | If \fIpattern\fR is a qualified name, |
| 440 | the resulting list of variable names |
| 441 | has each matching namespace variable qualified with the name |
| 442 | of its namespace. |
| 443 | Note that a currently-visible variable may not yet "exist" if it has not |
| 444 | been set (e.g. a variable declared but not set by \fBvariable\fR). |
| 445 | .SH EXAMPLE |
| 446 | This command prints out a procedure suitable for saving in a Tcl |
| 447 | script: |
| 448 | .CS |
| 449 | proc printProc {procName} { |
| 450 | set result [list proc $procName] |
| 451 | set formals {} |
| 452 | foreach var [\fBinfo args\fR $procName] { |
| 453 | if {[\fBinfo default\fR $procName $var def]} { |
| 454 | lappend formals [list $var $def] |
| 455 | } else { |
| 456 | # Still need the list-quoting because variable |
| 457 | # names may properly contain spaces. |
| 458 | lappend formals [list $var] |
| 459 | } |
| 460 | } |
| 461 | puts [lappend result $formals [\fBinfo body\fR $procName]] |
| 462 | } |
| 463 | .CE |
| 464 | |
| 465 | .SH "SEE ALSO" |
| 466 | global(n), proc(n) |
| 467 | |
| 468 | .SH KEYWORDS |
| 469 | command, information, interpreter, level, namespace, procedure, variable |
| 470 | |
| 471 | '\" Local Variables: |
| 472 | '\" mode: nroff |
| 473 | '\" End: |