⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcl.n

📁 tcl是工具命令语言
💻 N
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 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: Tcl.n,v 1.9 2003/02/01 19:48:23 kennykb Exp $'\".so man.macros.TH Tcl n "8.1" Tcl "Tcl Built-In Commands".BS.SH NAMETcl \- Tool Command Language.SH SYNOPSISSummary of Tcl language syntax..BE.SH DESCRIPTION.PPThe following rules define the syntax and semantics of the Tcl language:.IP "[1] \fBCommands.\fR"A Tcl script is a string containing one or more commands.Semi-colons and newlines are command separators unless quoted asdescribed below.Close brackets are command terminators during command substitution(see below) unless quoted..IP "[2] \fBEvaluation.\fR"A command is evaluated in two steps.First, the Tcl interpreter breaks the command into \fIwords\fRand performs substitutions as described below.These substitutions are performed in the same way for allcommands.The first word is used to locate a command procedure tocarry out the command, then all of the words of the command arepassed to the command procedure.The command procedure is free to interpret each of its wordsin any way it likes, such as an integer, variable name, list,or Tcl script.Different commands interpret their words differently..IP "[3] \fBWords.\fR"Words of a command are separated by white space (except fornewlines, which are command separators)..IP "[4] \fBDouble quotes.\fR"If the first character of a word is double-quote (``"'') thenthe word is terminated by the next double-quote character.If semi-colons, close brackets, or white space characters(including newlines) appear between the quotes then they are treatedas ordinary characters and included in the word.Command substitution, variable substitution, and backslash substitutionare performed on the characters between the quotes as described below.The double-quotes are not retained as part of the word..IP "[5] \fBBraces.\fR"If the first character of a word is an open brace (``{'') thenthe word is terminated by the matching close brace (``}'').Braces nest within the word: for each additional openbrace there must be an additional close brace (however,if an open brace or close brace within the word isquoted with a backslash then it is not counted in locating thematching close brace).No substitutions are performed on the characters between thebraces except for backslash-newline substitutions describedbelow, nor do semi-colons, newlines, close brackets,or white space receive any special interpretation.The word will consist of exactly the characters between theouter braces, not including the braces themselves..IP "[6] \fBCommand substitution.\fR"If a word contains an open bracket (``['') then Tcl performs\fIcommand substitution\fR.To do this it invokes the Tcl interpreter recursively to processthe characters following the open bracket as a Tcl script.The script may contain any number of commands and must be terminatedby a close bracket (``]'').The result of the script (i.e. the result of its last command) issubstituted into the word in place of the brackets and all of thecharacters between them.There may be any number of command substitutions in a single word.Command substitution is not performed on words enclosed in braces..IP "[7] \fBVariable substitution.\fR"If a word contains a dollar-sign (``$'') then Tcl performs \fIvariablesubstitution\fR:  the dollar-sign and the following characters arereplaced in the word by the value of a variable.Variable substitution may take any of the following forms:.RS.TP 15\fB$\fIname\fR\fIName\fR is the name of a scalar variable;  the name is a sequenceof one or more characters that are a letter, digit, underscore,or namespace separators (two or more colons)..TP 15\fB$\fIname\fB(\fIindex\fB)\fR\fIName\fR gives the name of an array variable and \fIindex\fR givesthe name of an element within that array.\fIName\fR must contain only letters, digits, underscores, andnamespace separators, and may be an empty string.Command substitutions, variable substitutions, and backslashsubstitutions are performed on the characters of \fIindex\fR..TP 15\fB${\fIname\fB}\fR\fIName\fR is the name of a scalar variable.  It may contain anycharacters whatsoever except for close braces..LPThere may be any number of variable substitutions in a single word.Variable substitution is not performed on words enclosed in braces..RE.IP "[8] \fBBackslash substitution.\fR"If a backslash (``\e'') appears within a word then\fIbackslash substitution\fR occurs.In all cases but those described below the backslash is dropped andthe following character is treated as an ordinarycharacter and included in the word.This allows characters such as double quotes, close brackets,and dollar signs to be included in words without triggeringspecial processing.The following table lists the backslash sequences that arehandled specially, along with the value that replaces each sequence..RS.TP 7\e\fBa\fRAudible alert (bell) (0x7)..TP 7\e\fBb\fRBackspace (0x8)..TP 7\e\fBf\fRForm feed (0xc)..TP 7\e\fBn\fRNewline (0xa)..TP 7\e\fBr\fRCarriage-return (0xd)..TP 7\e\fBt\fRTab (0x9)..TP 7\e\fBv\fRVertical tab (0xb)..TP 7\e\fB<newline>\fIwhiteSpace\fR.A single space character replaces the backslash, newline, and all spacesand tabs after the newline.  This backslash sequence is unique in that itis replaced in a separate pre-pass before the command is actually parsed.This means that it will be replaced even when it occurs between braces,and the resulting space will be treated as a word separator if it isn'tin braces or quotes..TP 7\e\eBackslash (``\e'')..VS 8.1 br.TP 7\e\fIooo\fR .The digits \fIooo\fR (one, two, or three of them) give an eight-bit octal value for the Unicode character that will be inserted.  The upper bits of theUnicode character will be 0..TP 7\e\fBx\fIhh\fR .The hexadecimal digits \fIhh\fR give an eight-bit hexadecimal value for theUnicode character that will be inserted.  Any number of hexadecimal digitsmay be present; however, all but the last two are ignored (the result isalways a one-byte quantity).  The upper bits of the Unicode character willbe 0..TP 7\e\fBu\fIhhhh\fR .The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give asixteen-bit hexadecimal value for the Unicode character that will beinserted..VE.LPBackslash substitution is not performed on words enclosed in braces,except for backslash-newline as described above..RE.IP "[9] \fBComments.\fR"If a hash character (``#'') appears at a point where Tcl isexpecting the first character of the first word of a command,then the hash character and the characters that follow it, upthrough the next newline, are treated as a comment and ignored.The comment character only has significance when it appearsat the beginning of a command..IP "[10] \fBOrder of substitution.\fR"Each character is processed exactly once by the Tcl interpreteras part of creating the words of a command.For example, if variable substitution occurs then no furthersubstitutions are performed on the value of the variable;  thevalue is inserted into the word verbatim.If command substitution occurs then the nested command isprocessed entirely by the recursive call to the Tcl interpreter;no substitutions are performed before making the recursivecall and no additional substitutions are performed on the resultof the nested script..RS.LPSubstitutions take place from left to right, and each substitution isevaluated completely before attempting to evaluate the next.  Thus, asequence like.CSset y [set x 0][incr x][incr x].CEwill always set the variable \fIy\fR to the value, \fI012\fR..RE.IP "[11] \fBSubstitution and word boundaries.\fR"Substitutions do not affect the word boundaries of a command.For example, during variable substitution the entire value ofthe variable becomes part of a single word, even if the variable'svalue contains spaces.

⌨️ 快捷键说明

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