info.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:10k
- '"
- '" Copyright (c) 1993 The Regents of the University of California.
- '" Copyright (c) 1994-1997 Sun Microsystems, Inc.
- '" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies
- '" Copyright (c) 1998-2000 Ajuba Solutions
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: info.n,v 1.8.2.3 2004/10/27 14:23:56 dkf Exp $
- '"
- .so man.macros
- .TH info n 8.4 Tcl "Tcl Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- info - Return information about the state of the Tcl interpreter
- .SH SYNOPSIS
- fBinfo fIoption fR?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- This command provides information about various internals of the Tcl
- interpreter.
- The legal fIoptionfR's (which may be abbreviated) are:
- .TP
- fBinfo args fIprocnamefR
- Returns a list containing the names of the arguments to procedure
- fIprocnamefR, in order. fIProcnamefR must be the name of a
- Tcl command procedure.
- .TP
- fBinfo body fIprocnamefR
- Returns the body of procedure fIprocnamefR. fIProcnamefR must be
- the name of a Tcl command procedure.
- .TP
- fBinfo cmdcountfR
- Returns a count of the total number of commands that have been invoked
- in this interpreter.
- .TP
- fBinfo commands fR?fIpatternfR?
- If fIpatternfR isn't specified,
- returns a list of names of all the Tcl commands in the current namespace,
- including both the built-in commands written in C and
- the command procedures defined using the fBprocfR command.
- If fIpatternfR is specified,
- only those names matching fIpatternfR are returned.
- Matching is determined using the same rules as for fBstring matchfR.
- fIpatternfR can be a qualified name like fBFoo::print*fR.
- That is, it may specify a particular namespace
- using a sequence of namespace names separated by double colons (fB::fR),
- and may have pattern matching special characters
- at the end to specify a set of commands in that namespace.
- If fIpatternfR is a qualified name,
- the resulting list of command names has each one qualified with the name
- of the specified namespace.
- .TP
- fBinfo complete fIcommandfR
- Returns 1 if fIcommandfR is a complete Tcl command in the sense of
- having no unclosed quotes, braces, brackets or array element names.
- If the command doesn't appear to be complete then 0 is returned.
- This command is typically used in line-oriented input environments
- to allow users to type in commands that span multiple lines; if the
- command isn't complete, the script can delay evaluating it until additional
- lines have been typed to complete the command.
- .TP
- fBinfo default fIprocname arg varnamefR
- fIProcnamefR must be the name of a Tcl command procedure and fIargfR
- must be the name of an argument to that procedure. If fIargfR
- doesn't have a default value then the command returns fB0fR.
- Otherwise it returns fB1fR and places the default value of fIargfR
- into variable fIvarnamefR.
- .TP
- fBinfo exists fIvarNamefR
- Returns fB1fR if the variable named fIvarNamefR exists in the
- current context (either as a global or local variable) and has been
- defined by being given a value, returns fB0fR otherwise.
- .VS 8.4
- .TP
- fBinfo functions fR?fIpatternfR?
- If fIpatternfR isn't specified, returns a list of all the math
- functions currently defined.
- If fIpatternfR is specified, only those functions whose name matches
- fIpatternfR are returned. Matching is determined using the same
- rules as for fBstring matchfR.
- .VE
- .TP
- fBinfo globals fR?fIpatternfR?
- If fIpatternfR isn't specified, returns a list of all the names
- of currently-defined global variables.
- Global variables are variables in the global namespace.
- If fIpatternfR is specified, only those names matching fIpatternfR
- are returned. Matching is determined using the same rules as for
- fBstring matchfR.
- .TP
- fBinfo hostnamefR
- Returns the name of the computer on which this invocation is being
- executed.
- .VS
- Note that this name is not guaranteed to be the fully qualified domain
- name of the host. Where machines have several different names (as is
- common on systems with both TCP/IP (DNS) and NetBIOS-based networking
- installed,) it is the name that is suitable for TCP/IP networking that
- is returned.
- .VE
- .TP
- fBinfo levelfR ?fInumberfR?
- If fInumberfR is not specified, this command returns a number
- giving the stack level of the invoking procedure, or 0 if the
- command is invoked at top-level. If fInumberfR is specified,
- then the result is a list consisting of the name and arguments for the
- procedure call at level fInumberfR on the stack. If fInumberfR
- is positive then it selects a particular stack level (1 refers
- to the top-most active procedure, 2 to the procedure it called, and
- so on); otherwise it gives a level relative to the current level
- (0 refers to the current procedure, -1 to its caller, and so on).
- See the fBuplevelfR command for more information on what stack
- levels mean.
- .TP
- fBinfo libraryfR
- Returns the name of the library directory in which standard Tcl
- scripts are stored.
- This is actually the value of the fBtcl_libraryfR
- variable and may be changed by setting fBtcl_libraryfR.
- See the fBtclvarsfR manual entry for more information.
- .TP
- fBinfo loaded fR?fIinterpfR?
- Returns a list describing all of the packages that have been loaded into
- fIinterpfR with the fBloadfR command.
- Each list element is a sub-list with two elements consisting of the
- name of the file from which the package was loaded and the name of
- the package.
- For statically-loaded packages the file name will be an empty string.
- If fIinterpfR is omitted then information is returned for all packages
- loaded in any interpreter in the process.
- To get a list of just the packages in the current interpreter, specify
- an empty string for the fIinterpfR argument.
- .TP
- fBinfo locals fR?fIpatternfR?
- If fIpatternfR isn't specified, returns a list of all the names
- of currently-defined local variables, including arguments to the
- current procedure, if any.
- Variables defined with the fBglobalfR, fBupvarfR and
- fBvariablefR commands will not be returned.
- If fIpatternfR is specified, only those names matching fIpatternfR
- are returned. Matching is determined using the same rules as for
- fBstring matchfR.
- .TP
- fBinfo nameofexecutablefR
- Returns the full path name of the binary file from which the application
- was invoked. If Tcl was unable to identify the file, then an empty
- string is returned.
- .TP
- fBinfo patchlevelfR
- Returns the value of the global variable fBtcl_patchLevelfR; see
- the fBtclvarsfR manual entry for more information.
- .TP
- fBinfo procs fR?fIpatternfR?
- If fIpatternfR isn't specified, returns a list of all the
- names of Tcl command procedures in the current namespace.
- If fIpatternfR is specified,
- only those procedure names in the current namespace
- matching fIpatternfR are returned.
- Matching is determined using the same rules as for
- fBstring matchfR.
- If fIpatternfR contains any namespace separators, they are used to
- select a namespace relative to the current namespace (or relative to
- the global namespace if fIpatternfR starts with fB::fR) to match
- within; the matching pattern is taken to be the part after the last
- namespace separator.
- .TP
- fBinfo scriptfR ?fIfilenamefR?
- If a Tcl script file is currently being evaluated (i.e. there is a
- call to fBTcl_EvalFilefR active or there is an active invocation
- of the fBsourcefR command), then this command returns the name
- of the innermost file being processed. If fIfilenamefR is specified,
- then the return value of this command will be modified for the
- duration of the active invocation to return that name. This is
- useful in virtual file system applications.
- Otherwise the command returns an empty string.
- .TP
- fBinfo sharedlibextensionfR
- Returns the extension used on this platform for the names of files
- containing shared libraries (for example, fB.sofR under Solaris).
- If shared libraries aren't supported on this platform then an empty
- string is returned.
- .TP
- fBinfo tclversionfR
- Returns the value of the global variable fBtcl_versionfR; see
- the fBtclvarsfR manual entry for more information.
- .TP
- fBinfo varsfR ?fIpatternfR?
- If fIpatternfR isn't specified,
- returns a list of all the names of currently-visible variables.
- This includes locals and currently-visible globals.
- If fIpatternfR is specified, only those names matching fIpatternfR
- are returned. Matching is determined using the same rules as for
- fBstring matchfR.
- fIpatternfR can be a qualified name like fBFoo::option*fR.
- That is, it may specify a particular namespace
- using a sequence of namespace names separated by double colons (fB::fR),
- and may have pattern matching special characters
- at the end to specify a set of variables in that namespace.
- If fIpatternfR is a qualified name,
- the resulting list of variable names
- has each matching namespace variable qualified with the name
- of its namespace.
- Note that a currently-visible variable may not yet "exist" if it has not
- been set (e.g. a variable declared but not set by fBvariablefR).
- .SH EXAMPLE
- This command prints out a procedure suitable for saving in a Tcl
- script:
- .CS
- proc printProc {procName} {
- set result [list proc $procName]
- set formals {}
- foreach var [fBinfo argsfR $procName] {
- if {[fBinfo defaultfR $procName $var def]} {
- lappend formals [list $var $def]
- } else {
- # Still need the list-quoting because variable
- # names may properly contain spaces.
- lappend formals [list $var]
- }
- }
- puts [lappend result $formals [fBinfo bodyfR $procName]]
- }
- .CE
- .SH "SEE ALSO"
- global(n), proc(n)
- .SH KEYWORDS
- command, information, interpreter, level, namespace, procedure, variable
- '" Local Variables:
- '" mode: nroff
- '" End: