diff options
Diffstat (limited to 'doc/tclvars.n')
-rw-r--r-- | doc/tclvars.n | 179 |
1 files changed, 40 insertions, 139 deletions
diff --git a/doc/tclvars.n b/doc/tclvars.n index adefe40..9aa14d5 100644 --- a/doc/tclvars.n +++ b/doc/tclvars.n @@ -4,13 +4,13 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH tclvars n 8.0 Tcl "Tcl Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME -argc, argv, argv0, auto_path, env, errorCode, errorInfo, tcl_interactive, tcl_library, tcl_nonwordchars, tcl_patchLevel, tcl_pkgPath, tcl_platform, tcl_precision, tcl_rcFileName, tcl_traceCompile, tcl_traceExec, tcl_wordchars, tcl_version \- Variables used by Tcl +tclvars \- Variables used by Tcl .BE .SH DESCRIPTION .PP @@ -18,27 +18,7 @@ The following global variables are created and managed automatically by the Tcl library. Except where noted below, these variables should normally be treated as read-only by application-specific code and by users. .TP -\fBauto_path\fR -. -If set, then it must contain a valid Tcl list giving directories to -search during auto-load operations (including for package index -files when using the default \fBpackage unknown\fR handler). -This variable is initialized during startup to contain, in order: -the directories listed in the \fBTCLLIBPATH\fR environment variable, -the directory named by the \fBtcl_library\fR global variable, -the parent directory of \fBtcl_library\fR, -the directories listed in the \fBtcl_pkgPath\fR variable. -Additional locations to look for files and package indices should -normally be added to this variable using \fBlappend\fR. -.RS -.PP -Additional variables relating to package management exist. More -details are listed in the \fBVARIABLES\fR section of the \fBlibrary\fR -manual page. -.RE -.TP \fBenv\fR -. This variable is maintained by Tcl as an array whose elements are the environment variables for the process. Reading an element will return the value of the corresponding @@ -94,32 +74,19 @@ Note that this environment variable should \fInot\fR normally be set. \fBenv(TCLLIBPATH)\fR . If set, then it must contain a valid Tcl list giving directories to -search during auto-load operations. Directories must be specified in +search during auto-load operations. Directories must be specified in Tcl format, using .QW / as the path separator, regardless of platform. This variable is only used when initializing the \fBauto_path\fR variable. .TP -\fBenv(TCL_TZ)\fR, \fBenv(TZ)\fR -. -These specify the default timezone used for parsing and formatting times and -dates in the \fBclock\fR command. On many platforms, the TZ environment -variable is set up by the operating system. -.TP -\fBenv(LC_ALL)\fR, \fBenv(LC_MESSAGES)\fR, \fBenv(LANG)\fR -. -These environment variables are used by the \fBmsgcat\fR package to -determine what locale to format messages using. -.TP \fBenv(TCL_INTERP_DEBUG_FRAME)\fR . -If existing, it has the same effect as running \fBinterp debug\fR -\fB{} -frame 1\fR +If existing, it has the same effect as running \fBinterp debug {} -frame 1\fR as the very first command of each new Tcl interpreter. .RE .TP \fBerrorCode\fR -. This variable holds the value of the \fB\-errorcode\fR return option set by the most recent error that occurred in this interpreter. This list value represents additional information about the error @@ -149,7 +116,6 @@ and system libraries. .RE .TP \fBCHILDKILLED\fI pid sigName msg\fR -. This format is used when a child process has been killed because of a signal. The \fIpid\fR element will be the process's identifier (in decimal). The \fIsigName\fR element will be the symbolic name of the signal that caused @@ -161,14 +127,12 @@ describing the signal, such as for \fBSIGPIPE\fR. .TP \fBCHILDSTATUS\fI pid code\fR -. This format is used when a child process has exited with a non-zero exit status. The \fIpid\fR element will be the process's identifier (in decimal) and the \fIcode\fR element will be the exit code returned by the process (also in decimal). .TP \fBCHILDSUSP\fI pid sigName msg\fR -. This format is used when a child process has been suspended because of a signal. The \fIpid\fR element will be the process's identifier, in decimal. @@ -181,7 +145,6 @@ describing the signal, such as for \fBSIGTTIN\fR. .TP \fBNONE\fR -. This format is used for errors where no additional information is available for an error besides the message returned with the error. In these cases the \fB\-errorcode\fR return option @@ -189,7 +152,6 @@ will consist of a list containing a single element whose contents are \fBNONE\fR. .TP \fBPOSIX \fIerrName msg\fR -. If the first element is \fBPOSIX\fR, then the error occurred during a POSIX kernel call. The \fIerrName\fR element will contain the symbolic name @@ -199,11 +161,6 @@ The \fImsg\fR element will be a human-readable message corresponding to \fIerrName\fR, such as .QW "no such file or directory" for the \fBENOENT\fR case. -.TP -\fBTCL\fR ... -. -Indicates some sort of problem generated in relation to Tcl itself, e.g. a -failure to look up a channel or variable. .PP To set the \fB\-errorcode\fR return option, applications should use library procedures such as \fBTcl_SetObjErrorCode\fR, \fBTcl_SetReturnOptions\fR, @@ -213,9 +170,13 @@ If none of these methods for setting the error code has been used, the Tcl interpreter will reset the variable to \fBNONE\fR after the next error. .RE +.\" .TP +.\" \fBTCL\fR ... +.\" . +.\" Indicates some sort of problem generated in relation to Tcl itself, +.\" e.g. a failure to look up a channel or variable. .TP \fBerrorInfo\fR -. This variable holds the value of the \fB\-errorinfo\fR return option set by the most recent error that occurred in this interpreter. This string value will contain one or more lines @@ -225,11 +186,10 @@ Its contents take the form of a stack trace showing the various nested Tcl commands that had been invoked at the time of the error. .TP \fBtcl_library\fR -. This variable holds the name of a directory containing the system library of Tcl scripts, such as those used for auto-loading. The value of this variable is returned by the \fBinfo library\fR command. -See the \fBlibrary\fR manual entry for details of the facilities +See the \fBlibrary\fR manual entry for details of the facilities provided by the Tcl script library. Normally each application or package will have its own application-specific script library in addition to the Tcl script library; @@ -256,16 +216,14 @@ The value of this variable is returned by the \fBinfo patchlevel\fR command. .TP \fBtcl_pkgPath\fR -. This variable holds a list of directories indicating where packages are normally installed. It is not used on Windows. It typically contains either one or two entries; if it contains two entries, the first is normally a directory for platform-dependent packages (e.g., shared library binaries) and the second is normally a directory for platform-independent packages (e.g., script files). Typically a package is installed as a -subdirectory of one of the entries in the \fBtcl_pkgPath\fR -variable. The directories in the \fBtcl_pkgPath\fR variable are -included by default in the \fBauto_path\fR +subdirectory of one of the entries in \fB$tcl_pkgPath\fR. The directories +in \fB$tcl_pkgPath\fR are included by default in the \fBauto_path\fR variable, so they and their immediate subdirectories are automatically searched for packages during \fBpackage require\fR commands. Note: \fBtcl_pkgPath\fR is not intended to be modified by the application. Its @@ -275,7 +233,6 @@ directories for packages you should add the names of those directories to \fBauto_path\fR, not \fBtcl_pkgPath\fR. .TP \fBtcl_platform\fR -. This is an associative array whose elements contain information about the platform on which the application is running, such as the name of the operating system, its current release number, and the machine's @@ -287,12 +244,10 @@ predefined elements are: .RS .TP \fBbyteOrder\fR -. The native byte order of this machine: either \fBlittleEndian\fR or -\fBbigEndian\fR. +\fBbigEndian\fR. .TP \fBdebug\fR -. If this variable exists, then the interpreter was compiled with and linked to a debug-enabled C run-time. This variable will only exist on Windows, so extension writers can specify which package to load depending on the @@ -305,55 +260,45 @@ The name of the Tcl language implementation. When the interpreter is first created, this is always set to the string \fBTcl\fR. .TP \fBmachine\fR -. The instruction set executed by this machine, such as \fBintel\fR, \fBPPC\fR, \fB68k\fR, or \fBsun4m\fR. On UNIX machines, this is the value returned by \fBuname -m\fR. .TP -\fBos\fR -. +\fBos\fR The name of the operating system running on this machine, -such as \fBWindows NT\fR or \fBSunOS\fR. +such as \fBWindows 95\fR, \fBWindows NT\fR, or \fBSunOS\fR. On UNIX machines, this is the value returned by \fBuname -s\fR. +On Windows 95 and Windows 98, the value returned will be \fBWindows +95\fR to provide better backwards compatibility to Windows 95; to +distinguish between the two, check the \fBosVersion\fR. .TP \fBosVersion\fR -. The version number for the operating system running on this machine. -On UNIX machines, this is the value returned by \fBuname -r\fR. -.TP -\fBpathSeparator\fR -.VS 8.6 -'\" Defined by TIP #315 -The character that should be used to \fBsplit\fR PATH-like environment -variables into their corresponding list of directory names. -.VE 8.6 +On UNIX machines, this is the value returned by \fBuname -r\fR. On +Windows 95, the version will be 4.0; on Windows 98, the version will +be 4.10. .TP \fBplatform\fR -. Either \fBwindows\fR, or \fBunix\fR. This identifies the general operating environment of the machine. .TP -\fBpointerSize\fR -. -This gives the size of the native-machine pointer in bytes (strictly, it -is same as the result of evaluating \fIsizeof(void*)\fR in C.) -.TP \fBthreaded\fR -. If this variable exists, then the interpreter was compiled with threads enabled. .TP \fBuser\fR -. This identifies the current user based on the login information available on the platform. This value comes from the getuid() and getpwuid() system calls on Unix, and the value from the GetUserName() system call on Windows. .TP \fBwordSize\fR -. This gives the size of the native-machine word in bytes (strictly, it is same as the result of evaluating \fIsizeof(long)\fR in C.) +.TP +\fBpointerSize\fR +This gives the size of the native-machine pointer in bytes (strictly, it +is same as the result of evaluating \fIsizeof(void*)\fR in C.) .RE .TP \fBtcl_precision\fR @@ -376,7 +321,7 @@ binary number. .PP .RS If \fBtcl_precision\fR is not zero, then when Tcl converts a floating -point number, it creates a decimal representation of at most +point number, it creates a decimal representation of at most \fBtcl_precision\fR significant digits; the result may be shorter if the shorter result represents the original number exactly. If no result of at most \fBtcl_precision\fR digits is an exact representation @@ -412,7 +357,6 @@ Valid values for \fBtcl_precision\fR range from 0 to 17. .RE .TP \fBtcl_rcFileName\fR -. This variable is used during initialization to indicate the name of a user-specific startup file. If it is set by application-specific initialization, then the Tcl startup code will check for the existence @@ -421,14 +365,13 @@ the variable is set to \fB~/.wishrc\fR for Unix and \fB~/wishrc.tcl\fR for Windows. .TP \fBtcl_traceCompile\fR -. The value of this variable can be set to control how much tracing information is displayed during bytecode compilation. -By default, \fBtcl_traceCompile\fR is zero and no information is displayed. -Setting \fBtcl_traceCompile\fR to 1 generates a one-line summary in \fBstdout\fR +By default, tcl_traceCompile is zero and no information is displayed. +Setting tcl_traceCompile to 1 generates a one-line summary in stdout whenever a procedure or top-level command is compiled. -Setting it to 2 generates a detailed listing in \fBstdout\fR of the +Setting it to 2 generates a detailed listing in stdout of the bytecode instructions emitted during every compilation. This variable is useful in tracking down suspected problems with the Tcl compiler. @@ -439,19 +382,18 @@ This variable and functionality only exist if .RE .TP \fBtcl_traceExec\fR -. The value of this variable can be set to control how much tracing information is displayed during bytecode execution. -By default, \fBtcl_traceExec\fR is zero and no information is displayed. -Setting \fBtcl_traceExec\fR to 1 generates a one-line trace in \fBstdout\fR +By default, tcl_traceExec is zero and no information is displayed. +Setting tcl_traceExec to 1 generates a one-line trace in stdout on each call to a Tcl procedure. Setting it to 2 generates a line of output whenever any Tcl command is invoked that contains the name of the command and its arguments. Setting it to 3 produces a detailed trace showing the result of executing each bytecode instruction. -Note that when \fBtcl_traceExec\fR is 2 or 3, +Note that when tcl_traceExec is 2 or 3, commands such as \fBset\fR and \fBincr\fR that have been entirely replaced by a sequence of bytecode instructions are not shown. @@ -465,7 +407,6 @@ This variable and functionality only exist if .RE .TP \fBtcl_wordchars\fR -. The value of this variable is a regular expression that can be set to control what are considered .QW word @@ -476,7 +417,6 @@ but a Unicode space character. Otherwise it defaults to \fB\ew\fR, which is any Unicode word character (number, letter, or underscore). .TP \fBtcl_nonwordchars\fR -. The value of this variable is a regular expression that can be set to control what are considered .QW non-word @@ -487,7 +427,6 @@ character. Otherwise it defaults to \fB\eW\fR, which is anything but a Unicode word character (number, letter, or underscore). .TP \fBtcl_version\fR -. When an interpreter is created Tcl initializes this variable to hold the version number for this version of Tcl in the form \fIx.y\fR. Changes to \fIx\fR represent major changes with probable @@ -496,71 +435,33 @@ bug fixes that retain backward compatibility. The value of this variable is returned by the \fBinfo tclversion\fR command. .SH "OTHER GLOBAL VARIABLES" -.PP The following variables are only guaranteed to exist in \fBtclsh\fR and \fBwish\fR executables; the Tcl library does not define them itself but many Tcl environments do. .TP 6 \fBargc\fR -. The number of arguments to \fBtclsh\fR or \fBwish\fR. .TP 6 \fBargv\fR -. Tcl list of arguments to \fBtclsh\fR or \fBwish\fR. .TP 6 \fBargv0\fR -. The script that \fBtclsh\fR or \fBwish\fR started executing (if it was specified) or otherwise the name by which \fBtclsh\fR or \fBwish\fR was invoked. .TP 6 \fBtcl_interactive\fR -. Contains 1 if \fBtclsh\fR or \fBwish\fR is running interactively (no script was specified and standard input is a terminal-like device), 0 otherwise. -.SH EXAMPLES -.PP -To add a directory to the collection of locations searched by -\fBpackage require\fR, e.g., because of some application-specific -packages that are used, the \fBauto_path\fR variable needs to be -updated: -.PP -.CS -lappend ::\fBauto_path\fR [file join [pwd] "theLibDir"] -.CE .PP -A simple though not very robust way to handle command line arguments -of the form -.QW "\-foo 1 \-bar 2" -is to load them into an array having first loaded in the default settings: -.CS -array set arguments {-foo 0 -bar 0 -grill 0} -array set arguments $::\fBargv\fR -puts "foo is $arguments(-foo)" -puts "bar is $arguments(-bar)" -puts "grill is $arguments(-grill)" -.CE -.PP -The \fBargv0\fR global variable can be used (in conjunction with the -\fBinfo script\fR command) to determine whether the current script is -being executed as the main script or loaded as a library. This is -useful because it allows a single script to be used as both a library -and a demonstration of that library: -.PP -.CS -if {$::\fBargv0\fR eq [info script]} { - # running as: tclsh example.tcl -} else { - package provide Example 1.0 -} -.CE +The \fBwish\fR executable additionally specifies the following global +variable: +.TP 6 +\fBgeometry\fR +If set, contains the user-supplied geometry specification to use for +the main Tk window. .SH "SEE ALSO" -eval(n), library(n), tclsh(1), tkvars(n), wish(1) +eval(n), tclsh(1), wish(1) .SH KEYWORDS -arithmetic, bytecode, compiler, error, environment, POSIX, precision, -subprocess, user, variables -'\" Local Variables: -'\" mode: nroff -'\" End: +arithmetic, bytecode, compiler, error, environment, POSIX, precision, subprocess, variables |