tclvars.n

来自「tcl是工具命令语言」· N 代码 · 共 413 行 · 第 1/2 页

N
413
字号
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" RCS: @(#) $Id: tclvars.n,v 1.13 2002/07/01 18:24:39 jenglish Exp $'\" .so man.macros.TH tclvars n 8.0 Tcl "Tcl Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEtclvars \- Variables used by Tcl.BE.SH DESCRIPTION.PPThe following global variables are created and managed automaticallyby the Tcl library.  Except where noted below, these variables shouldnormally be treated as read-only by application-specific code and by users..TP\fBenv\fRThis variable is maintained by Tcl as an arraywhose elements are the environment variables for the process.Reading an element will return the value of the correspondingenvironment variable.Setting an element of the array will modify the correspondingenvironment variable or create a new one if it doesn't alreadyexist.Unsetting an element of \fBenv\fR will remove the correspondingenvironment variable.Changes to the \fBenv\fR array will affect the environmentpassed to children by commands like \fBexec\fR.If the entire \fBenv\fR array is unset then Tcl will stopmonitoring \fBenv\fR accesses and will not update environmentvariables..RS.VS 8.0 Under Windows, the environment variables PATH and COMSPEC in anycapitalization are converted automatically to upper case.  For instance, thePATH variable could be exported by the operating system as ``path'',``Path'', ``PaTh'', etc., causing otherwise simple Tcl code to have tosupport many special cases.  All other environment variables inherited byTcl are left unmodified.  Setting an env array variable to blank is thesame as unsetting it as this is the behavior of the underlying Windows OS.It should be noted that relying on an existing and empty environment variablewon't work on windows and is discouraged for cross-platform usage..VE.RE.RSOn the Macintosh, the environment variable is constructed by Tcl as noglobal environment variable exists.  The environment variables thatare created for Tcl include:.TP\fBLOGIN\fRThis holds the Chooser name of the Macintosh..TP\fBUSER\fRThis also holds the Chooser name of the Macintosh..TP\fBSYS_FOLDER\fRThe path to the system directory..TP\fBAPPLE_M_FOLDER\fRThe path to the Apple Menu directory..TP\fBCP_FOLDER\fRThe path to the control panels directory..TP\fBDESK_FOLDER\fRThe path to the desk top directory..TP\fBEXT_FOLDER\fRThe path to the system extensions directory..TP\fBPREF_FOLDER\fRThe path to the preferences directory..TP\fBPRINT_MON_FOLDER\fRThe path to the print monitor directory..TP\fBSHARED_TRASH_FOLDER\fRThe path to the network trash directory..TP\fBTRASH_FOLDER\fRThe path to the trash directory..TP\fBSTART_UP_FOLDER\fRThe path to the start up directory..TP\fBHOME\fRThe path to the application's default directory..PPYou can also create your own environment variables for the Macintosh.A file named  \fITcl Environment Variables\fR may be placed in thepreferences folder in the Mac system folder.  Each line of this fileshould be of the form \fIVAR_NAME=var_data\fR..PPThe last alternative is to place environment variables in a 'STR#' resource named \fITcl Environment Variables\fR of the application.  Thisis considered a little more ``Mac like'' than a Unix style EnvironmentVariable file.  Each entry in the 'STR#' resource has the same formatas above.  The source code file \fItclMacEnv.c\fR contains theimplementation of the env mechanisms.  This file contains many#define's that allow customization of the env mechanisms to fit yourapplications needs..RE.TP\fBerrorCode\fRAfter an error has occurred, this variable will be set to holdadditional information about the error in a form that is easyto process with programs.\fBerrorCode\fR consists of a Tcl list with one or more elements.The first element of the list identifies a general class oferrors, and determines the format of the rest of the list.The following formats for \fBerrorCode\fR are used by theTcl core; individual applications may define additional formats..RS.TP\fBARITH\fI code msg\fRThis format is used when an arithmetic error occurs (e.g. an attemptto divide by zero in the \fBexpr\fR command).\fICode\fR identifies the precise error and \fImsg\fR provides ahuman-readable description of the error.  \fICode\fR will be eitherDIVZERO (for an attempt to divide by zero),DOMAIN (if an argument is outside the domain of a function, such as acos(\-3)),IOVERFLOW (for integer overflow),OVERFLOW (for a floating-point overflow),or UNKNOWN (if the cause of the error cannot be determined)..TP\fBCHILDKILLED\fI pid sigName msg\fRThis format is used when a child process has been killed because ofa signal.  The second element of \fBerrorCode\fR will be theprocess's identifier (in decimal).The third element will be the symbolic name of the signal that causedthe process to terminate; it will be one of the names from theinclude file signal.h, such as \fBSIGPIPE\fR.The fourth element will be a short human-readable messagedescribing the signal, such as ``write on pipe with no readers''for \fBSIGPIPE\fR..TP\fBCHILDSTATUS\fI pid code\fRThis format is used when a child process has exited with a non-zeroexit status.  The second element of \fBerrorCode\fR will be theprocess's identifier (in decimal) and the third element will be the exitcode returned by the process (also in decimal)..TP\fBCHILDSUSP\fI pid sigName msg\fRThis format is used when a child process has been suspended becauseof a signal.The second element of \fBerrorCode\fR will be the process's identifier,in decimal.The third element will be the symbolic name of the signal that causedthe process to suspend; this will be one of the names from theinclude file signal.h, such as \fBSIGTTIN\fR.The fourth element will be a short human-readable messagedescribing the signal, such as ``background tty read''for \fBSIGTTIN\fR..TP\fBNONE\fRThis format is used for errors where no additional information isavailable for an error besides the message returned with theerror.  In these cases \fBerrorCode\fR will consist of a listcontaining a single element whose contents are \fBNONE\fR..TP\fBPOSIX \fIerrName msg\fRIf the first element of \fBerrorCode\fR is \fBPOSIX\fR, thenthe error occurred during a POSIX kernel call.The second element of the list will contain the symbolic nameof the error that occurred, such as \fBENOENT\fR; this willbe one of the values defined in the include file errno.h.The third element of the list will be a human-readablemessage corresponding to \fIerrName\fR, such as``no such file or directory'' for the \fBENOENT\fR case..PPTo set \fBerrorCode\fR, applications should use libraryprocedures such as \fBTcl_SetErrorCode\fR and \fBTcl_PosixError\fR,or they may invoke the \fBerror\fR command.If one of these methods hasn't been used, then the Tclinterpreter will reset the variable to \fBNONE\fR afterthe next error..RE.TP\fBerrorInfo\fRAfter an error has occurred, this string will contain one or more linesidentifying the Tcl commands and procedures that were being executedwhen the most recent error occurred.Its contents take the form of a stack trace showing the variousnested Tcl commands that had been invoked at the time of the error..TP\fBtcl_library\fRThis variable holds the name of a directory containing thesystem 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 provided by the Tcl script library.Normally each application or package will have its own application-specificscript library in addition to the Tcl script library;each application should set a global variable with a name like\fB$\fIapp\fB_library\fR (where \fIapp\fR is the application's name)to hold the network file name for that application's library directory.The initial value of \fBtcl_library\fR is set when an interpreteris created by searching several different directories until one isfound that contains an appropriate Tcl startup script.If the \fBTCL_LIBRARY\fR environment variable exists, then

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?