1mNAME0m
       info - Return information about the state of the Tcl interpreter

1mSYNOPSIS0m
       1minfo 4m22moption24m ?4marg24m 4marg24m 4m...24m?


1mDESCRIPTION0m
       This  command  provides  information about various internals of the Tcl
       interpreter.  The legal 4moption24m's (which may be abbreviated) are:

       1minfo args 4m22mprocname0m
              Returns a list containing the names of the arguments  to  proce-
              dure  4mprocname24m,  in  order.   4mProcname24m must be the name of a Tcl
              command procedure.

       1minfo body 4m22mprocname0m
              Returns the body of procedure 4mprocname24m.  4mProcname24m  must  be  the
              name of a Tcl command procedure.

       1minfo cmdcount0m
              Returns  a  count of the total number of commands that have been
              invoked in this interpreter.

       1minfo commands 22m?4mpattern24m?
              If 4mpattern24m 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  1mproc  22mcommand.   If 4mpattern24m is specified, only those
              names matching 4mpattern24m are  returned.   Matching  is  determined
              using  the  same  rules  as  for 1mstring match22m.  4mpattern24m can be a
              qualified name like 1mFoo::print*22m.  That is, it may specify a par-
              ticular  namespace using a sequence of namespace names separated
              by double colons (1m::22m), and may  have  pattern  matching  special
              characters  at  the  end  to  specify  a set of commands in that
              namespace.  If 4mpattern24m is a qualified name, the  resulting  list
              of  command  names  has  each one qualified with the name of the
              specified namespace.

       1minfo complete 4m22mcommand0m
              Returns 1 if 4mcommand24m 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 multi-
              ple  lines;  if the command isn't complete, the script can delay
              evaluating it until additional lines have been typed to complete
              the command.

       1minfo default 4m22mprocname24m 4marg24m 4mvarname0m
              4mProcname24m  must  be  the  name of a Tcl command procedure and 4marg0m
              must be the name of an  argument  to  that  procedure.   If  4marg0m
              doesn't have a default value then the command returns 1m022m.  Other-
              wise it returns 1m1 22mand places the default value of 4marg24m into vari-
              able 4mvarname24m.

       1minfo exists 4m22mvarName0m
              Returns  1m1  22mif  the variable named 4mvarName24m exists in the current
              context (either as a global or  local  variable)  and  has  been
              defined by being given a value, returns 1m0 22motherwise.

       1minfo functions 22m?4mpattern24m?
              If 4mpattern24m isn't specified, returns a list of all the math func-
              tions currently defined.  If 4mpattern24m is  specified,  only  those
              functions  whose name matches 4mpattern24m are returned.  Matching is
              determined using the same rules as for 1mstring match22m.

       1minfo globals 22m?4mpattern24m?
              If 4mpattern24m isn't specified, returns a list of all the  names  of
              currently-defined  global variables.  Global variables are vari-
              ables in the global namespace.  If 4mpattern24m  is  specified,  only
              those  names  matching 4mpattern24m are returned.  Matching is deter-
              mined using the same rules as for 1mstring match22m.

       1minfo hostname0m
              Returns the name of the computer on  which  this  invocation  is
              being executed.  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.

       1minfo level 22m?4mnumber24m?
              If 4mnumber24m 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  4mnumber24m  is specified, then the
              result is a list consisting of the name and  arguments  for  the
              procedure call at level 4mnumber24m on the stack.  If 4mnumber24m is posi-
              tive 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 1muplevel 22mcommand for more information on what stack  lev-
              els mean.

       1minfo library0m
              Returns  the name of the library directory in which standard Tcl
              scripts  are  stored.   This  is  actually  the  value  of   the
              1mtcl_library  22mvariable and may be changed by setting 1mtcl_library22m.
              See the 1mtclvars 22mmanual entry for more information.

       1minfo loaded 22m?4minterp24m?
              Returns a list describing all of the  packages  that  have  been
              loaded  into 4minterp24m with the 1mload 22mcommand.  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  4minterp24m 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 4minterp24m argument.

       1minfo locals 22m?4mpattern24m?
              If 4mpattern24m 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  1mglobal22m,
              1mupvar   22mand  1mvariable 22mcommands will not be returned.  If 4mpattern0m
              is specified, only those names matching  4mpattern24m  are  returned.
              Matching is determined using the same rules as for 1mstring match22m.

       1minfo nameofexecutable0m
              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.

       1minfo patchlevel0m
              Returns the value of the global variable 1mtcl_patchLevel22m; see the
              1mtclvars 22mmanual entry for more information.

       1minfo procs 22m?4mpattern24m?
              If  4mpattern24m  isn't specified, returns a list of all the names of
              Tcl command procedures in the current namespace.  If 4mpattern24m  is
              specified,  only  those procedure names in the current namespace
              matching 4mpattern24m are returned.  Matching is determined using the
              same  rules as for 1mstring match22m.  If 4mpattern24m contains any names-
              pace separators, they are used to select a namespace relative to
              the  current  namespace  (or relative to the global namespace if
              4mpattern24m starts with 1m::22m) to match within; the matching pattern is
              taken to be the part after the last namespace separator.

       1minfo script 22m?4mfilename24m?
              If a Tcl script file is currently being evaluated (i.e. there is
              a call to 1mTcl_EvalFile 22mactive or there is an  active  invocation
              of  the  1msource  22mcommand), then this command returns the name of
              the innermost file being processed.  If 4mfilename24m  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 com-
              mand returns an empty string.

       1minfo sharedlibextension0m
              Returns the extension used on this platform  for  the  names  of
              files  containing  shared  libraries  (for  example,  1m.so  22munder
              Solaris).  If shared libraries aren't supported on this platform
              then an empty string is returned.

       1minfo tclversion0m
              Returns  the  value  of the global variable 1mtcl_version22m; see the
              1mtclvars 22mmanual entry for more information.

       1minfo vars 22m?4mpattern24m?
              If 4mpattern24m isn't specified, returns a list of all the  names  of
              currently-visible  variables.   This  includes  locals  and cur-
              rently-visible globals.  If 4mpattern24m  is  specified,  only  those
              names  matching  4mpattern24m  are  returned.  Matching is determined
              using the same rules as for 1mstring  match22m.   4mpattern24m  can  be  a
              qualified  name  like  1mFoo::option*22m.   That is, it may specify a
              particular namespace using a sequence of namespace  names  sepa-
              rated  by double colons (1m::22m), and may have pattern matching spe-
              cial characters at the end to specify a set of variables in that
              namespace.   If  4mpattern24m 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 1mvariable22m).

1mEXAMPLE0m
       This  command  prints  out  a  procedure  suitable  for saving in a Tcl
       script:
              proc printProc {procName} {
                  set result [list proc $procName]
                  set formals {}
                  foreach var [1minfo args 22m$procName] {
                      if {[1minfo default 22m$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 [1minfo body 22m$procName]]
              }


1mSEE ALSO0m
       global(n), proc(n)


1mKEYWORDS0m
       command, information, interpreter, level, namespace,  procedure,  vari-
