Seth Woolley's Man Viewer

library(n) - auto_execok, auto_import, auto_load, auto_mkindex, auto_mkindex_old, auto_qualify, auto_reset, parray, tcl_endOfWord, tcl_findLibrary, tcl_startOfNextWord, tcl_startOfPreviousWord, tcl_wordBreakAfter, tcl_wordBreakBefore, auto_execok, auto_import, auto_load, auto_mkindex, auto_mkindex_old, auto_qualify, auto_reset, parray, tcl_endOfWord, tcl_findLibrary, tcl_startOfNextWord, tcl_startOfPreviousWord, tcl_wordBreakAfter, tcl_wordBreakBefore - standard library of Tcl procedures - man n library

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

library(n)                   Tcl Built-In Commands                  library(n)



NAME
       auto_execok,  auto_import,  auto_load,  auto_mkindex, auto_mkindex_old,
       auto_qualify,  auto_reset,  tcl_findLibrary,   parray,   tcl_endOfWord,
       tcl_startOfNextWord,    tcl_startOfPreviousWord,    tcl_wordBreakAfter,
       tcl_wordBreakBefore - standard library of Tcl procedures

SYNOPSIS
       auto_execok cmd
       auto_import pattern
       auto_load cmd
       auto_mkindex dir pattern pattern ...
       auto_mkindex_old dir pattern pattern ...
       auto_qualify command namespace
       auto_reset
       tcl_findLibrary basename(1,3,3 File::Basename) version(1,3,5) patch initScript enVarName varName
       parray arrayName
       tcl_endOfWord str start
       tcl_startOfNextWord str start
       tcl_startOfPreviousWord str start
       tcl_wordBreakAfter str start
       tcl_wordBreakBefore str start


INTRODUCTION
       Tcl includes a library of Tcl procedures for commonly-needed functions.
       The procedures defined in(1,8) the Tcl library are generic ones suitable for
       use by many different applications.  The location of the Tcl library is
       returned  by the info(1,5,n) library command.  In addition to the Tcl library,
       each application will normally have its own library of  support  proce-
       dures  as  well;  the location of this library is normally given by the
       value of the $app_library global variable, where app is the name of the
       application.   For  example,  the location of the Tk library is kept in(1,8)
       the variable $tk_library.

       To access(2,5) the procedures in(1,8) the  Tcl  library,  an  application  should
       source  the file(1,n) init.tcl in(1,8) the library, for example with the Tcl com-
       mand source [file(1,n) join(1,n) [info(1,5,n) library] init.tcl] If the  library  proce-
       dure  Tcl_Init  is invoked from an application's Tcl_AppInit procedure,
       this happens automatically.  The  code  in(1,8)  init.tcl  will  define  the
       unknown procedure and arrange for the other procedures to be loaded on-
       demand using the auto-load mechanism defined below.


COMMAND PROCEDURES
       The following procedures are provided in(1,8) the Tcl library:

       auto_execok cmd
              Determines whether there is an executable file(1,n) or shell  builtin
              by  the  name  cmd.  If so, it returns a list of arguments to be
              passed to exec(3,n,1 builtins) to execute the executable file(1,n) or  shell  builtin
              named(5,8) by cmd.  If not, it returns an empty string.  This command
              examines the directories in(1,8) the current search  path  (given  by
              the  PATH  environment variable) in(1,8) its search for an executable
              file(1,n) named(5,8) cmd.  On Windows platforms, the  search  is  expanded
              with  the  same directories and file(1,n) extensions as used by exec(3,n,1 builtins).
              Auto_exec remembers information about previous  searches  in(1,8)  an
              array  named(5,8)  auto_execs;  this avoids the path search in(1,8) future
              calls for the same cmd.  The command auto_reset may be  used  to
              force auto_execok to forget its cached information.

       auto_import pattern
              Auto_import  is  invoked  during  namespace import to see if(3,n) the
              imported commands specified by pattern reside in(1,8)  an  autoloaded
              library.   If  so,  the commands are loaded so that they will be
              available to the interpreter for creating the import links.   If
              the commands do not reside in(1,8) an autoloaded library, auto_import
              does nothing.  The pattern matching is  performed  according  to
              the matching rules of namespace import.

       auto_load cmd
              This  command  attempts to load(7,n) the definition for a Tcl command
              named(5,8) cmd.  To do this, it searches an auto-load path, which  is
              a  list of one or more directories.  The auto-load path is given
              by the global variable $auto_path if(3,n) it exists.  If there is  no
              $auto_path variable, then the TCLLIBPATH environment variable is
              used, if(3,n) it exists.  Otherwise the auto-load  path  consists  of
              just  the  Tcl  library directory.  Within each directory in(1,8) the
              auto-load path there must be a file(1,n) tclIndex that describes  one
              or more commands defined in(1,8) that directory and a script to eval-
              uate to load(7,n) each of the commands.  The tclIndex file(1,n) should  be
              generated  with the auto_mkindex command.  If cmd is found in(1,8) an
              index file(1,n), then the appropriate script is evaluated  to  create
              the  command.   The  auto_load command returns 1 if(3,n) cmd was suc-
              cessfully created.  The command returns 0 if(3,n) there was no  index
              entry  for cmd or if(3,n) the script didn't actually define cmd (e.g.
              because index information is out of date).  If an  error(8,n)  occurs
              while  processing  the  script,  then  that  error(8,n)  is returned.
              Auto_load only reads the index information once and saves it  in(1,8)
              the  array  auto_index;  future calls to auto_load check for cmd
              in(1,8) the array rather than re-reading the index files.  The cached
              index  information  may  be deleted with the command auto_reset.
              This will force the next auto_load command to reload  the  index
              database from disk.

       auto_mkindex dir pattern pattern ...
              Generates  an  index suitable for use by auto_load.  The command
              searches dir for all files whose names match any of the  pattern
              arguments (matching is done with the glob(1,3,7,n) command), generates an
              index of all the Tcl  command  procedures  defined  in(1,8)  all  the
              matching files, and stores the index information in(1,8) a file(1,n) named(5,8)
              tclIndex in(1,8) dir. If no pattern is given a pattern of *.tcl  will
              be assumed.  For example, the command
              auto_mkindex foo *.tcl

              will  read(2,n,1 builtins) all the .tcl files in(1,8) subdirectory foo and generate a
              new index file(1,n) foo/tclIndex.

              Auto_mkindex parses the Tcl scripts  by  sourcing  them  into  a
              slave interpreter and monitoring the proc(5,n) and namespace commands
              that  are  executed.   Extensions  can  use  the  (undocumented(2,3))
              auto_mkindex_parser  package to register other commands that can
              contribute to the auto_load index. You will have to read(2,n,1 builtins) through
              auto.tcl to see how this works.

              Auto_mkindex_old  parses  the  Tcl scripts in(1,8) a relatively unso-
              phisticated way:  if(3,n) any line contains  the  word  proc(5,n)  as  its
              first characters then it is assumed to be a procedure definition
              and the next word of the line is taken as the procedure's  name.
              Procedure  definitions  that don't appear in(1,8) this way (e.g. they
              have spaces before the proc(5,n))  will  not  be  indexed.   If  your
              script  contains "dangerous" code, such as global initialization
              code or procedure names with special characters like $, *, [  or
              ], you are safer using auto_mkindex_old.

       auto_reset
              Destroys   all   the   information  cached  by  auto_execok  and
              auto_load.  This information will be re-read from disk the  next
              time(1,2,n)  it  is  needed.   Auto_reset  also  deletes any procedures
              listed in(1,8) the auto-load index, so that fresh copies of them will
              be loaded the next time(1,2,n) that they're used.

       auto_qualify command namespace
              Computes a list of fully qualified names for command.  This list
              mirrors the path a standard Tcl interpreter follows for  command
              lookups:   first  it looks for the command in(1,8) the current names-
              pace, and then in(1,8) the global namespace.  Accordingly, if(3,n) command
              is  relative  and namespace is not ::, the list returned has two
              elements:  command scoped by namespace, as if(3,n) it were a  command
              in(1,8)  the namespace namespace; and command as if(3,n) it were a command
              in(1,8) the global namespace.  Otherwise, if(3,n) either command is  abso-
              lute  (it begins with ::), or namespace is ::, the list contains
              only command as if(3,n) it were a command in(1,8) the global namespace.

              Auto_qualify is used by the auto-loading facilities in(1,8) Tcl, both
              for producing auto-loading indexes such as pkgIndex.tcl, and for
              performing the actual auto-loading of functions at runtime.

       tcl_findLibrary basename(1,3,3 File::Basename) version(1,3,5) patch initScript enVarName varName
              This is a standard search procedure for use by extensions during
              their  initialization.   They  call  this  procedure to look(1,8,3 Search::Dict) for
              their script library in(1,8) several standard directories.  The  last
              component of the name of the library directory is normally base-
              nameversion (e.g., tk8.0), but it might be "library" when in(1,8) the
              build hierarchies.  The initScript file(1,n) will be sourced into the
              interpreter once it is found.  The directory in(1,8) which this  file(1,n)
              is  found  is  stored into the global variable varName.  If this
              variable is already defined (e.g., by C code during  application
              initialization) then no searching is done.  Otherwise the search
              looks in(1,8) these directories: the directory named(5,8) by the  environ-
              ment  variable enVarName; relative to the Tcl library directory;
              relative to the executable file(1,n) in(1,8) the standard installation bin
              or  bin/arch  directory;  relative to the executable file(1,n) in(1,8) the
              current build tree; relative to the executable file(1,n) in(1,8) a  paral-
              lel build tree.

       parray arrayName
              Prints  on  standard output the names and values of all the ele-
              ments in(1,8) the array arrayName.  ArrayName must be an array acces-
              sible  to  the  caller  of  parray.   It  may be either local or
              global.

       tcl_endOfWord str start
              Returns the index of the first end-of-word location that  occurs
              after  a starting index start in(1,8) the string(3,n) str.  An end-of-word
              location is defined to be the first non-word character following
              the  first  word character after the starting point.  Returns -1
              if(3,n) there are no more end-of-word locations  after  the  starting
              point.   See  the  description of tcl_wordchars and tcl_nonword-
              chars below for more details on how Tcl determines which charac-
              ters are word characters.

       tcl_startOfNextWord str start
              Returns  the  index  of  the  first  start-of-word location that
              occurs after a starting index start in(1,8) the string(3,n) str.  A start-
              of-word  location is defined to be the first word character fol-
              lowing a non-word character.  Returns -1 if(3,n) there  are  no  more
              start-of-word locations after the starting point.

       tcl_startOfPreviousWord str start
              Returns  the  index  of  the  first  start-of-word location that
              occurs before a starting index start in(1,8) the string(3,n) str.  Returns
              -1  if(3,n)  there  are  no  more  start-of-word locations before the
              starting point.

       tcl_wordBreakAfter str start
              Returns the index of the first word boundary after the  starting
              index  start in(1,8) the string(3,n) str.  Returns -1 if(3,n) there are no more
              boundaries after the starting point in(1,8) the  given  string.   The
              index  returned  refers to the second character of the pair that
              comprises a boundary.

       tcl_wordBreakBefore str start
              Returns the index of the first word boundary before the starting
              index  start in(1,8) the string(3,n) str.  Returns -1 if(3,n) there are no more
              boundaries before the starting point in(1,8) the given  string.   The
              index  returned  refers to the second character of the pair that
              comprises a boundary.


VARIABLES
       The following global variables are defined or used by the procedures in(1,8)
       the Tcl library:

       auto_execs
              Used by auto_execok to record information about whether particu-
              lar commands exist as executable files.

       auto_index
              Used by auto_load to save the index information read(2,n,1 builtins) from  disk.

       auto_noexec
              If  set(7,n,1 builtins) to any value, then unknown will not attempt to auto-exec
              any commands.

       auto_noload
              If set(7,n,1 builtins) to any value, then unknown will not attempt to  auto-load
              any commands.

       auto_path
              If set(7,n,1 builtins), then it must contain a valid Tcl list giving directories
              to search during auto-load operations.  This  variable  is  ini-
              tialized  during  startup  to contain, in(1,8) order: the directories
              listed in(1,8) the TCLLIBPATH  environment  variable,  the  directory
              named(5,8)  by  the  $tcl_library  variable,  the parent directory of
              $tcl_library, the directories listed in(1,8) the  $tcl_pkgPath  vari-
              able.

       env(1,3)(TCL_LIBRARY)
              If set(7,n,1 builtins), then it specifies the location of the directory contain-
              ing library scripts (the value of this variable will be assigned
              to  the  tcl_library variable and therefore returned by the com-
              mand info(1,5,n) library).  If this variable isn't set(7,n,1 builtins) then  a  default
              value is used.

       env(1,3)(TCLLIBPATH)
              If set(7,n,1 builtins), then it must contain a valid Tcl list giving directories
              to search during  auto-load  operations.   Directories  must  be
              specified  in(1,8)  Tcl  format,  using  "/"  as  the path separator,
              regardless of platform.  This variable is only  used  when  ini-
              tializing the auto_path variable.

       tcl_nonwordchars
              This variable contains a regular expression that is used by rou-
              tines like tcl_endOfWord to identify whether a character is part
              of a word or not.  If the pattern matches a character, the char-
              acter is considered to be  a  non-word  character.   On  Windows
              platforms,  spaces,  tabs,  and newlines are considered non-word
              characters.  Under Unix, everything  but  numbers,  letters  and
              underscores are considered non-word characters.

       tcl_wordchars
              This variable contains a regular expression that is used by rou-
              tines like tcl_endOfWord to identify whether a character is part
              of a word or not.  If the pattern matches a character, the char-
              acter is considered to be a word character.   On  Windows  plat-
              forms, words are comprised of any character that is not a space,
              tab, or newline.  Under Unix, words are  comprised  of  numbers,
              letters or underscores.

       unknown_pending
              Used by unknown to record the command(s) for which it is search-
              ing.  It is used to detect  errors  where  unknown  recurses  on
              itself   infinitely.   The  variable  is  unset  before  unknown
              returns.


SEE ALSO
       info(1,5,n)(n), re_syntax(n)


KEYWORDS
       auto-exec, auto-load, library, unknown, word, whitespace



Tcl                                   8.0                           library(n)

References for this manual (incoming links)