diff options
Diffstat (limited to 'doc/Tcl.n')
-rw-r--r-- | doc/Tcl.n | 101 |
1 files changed, 30 insertions, 71 deletions
@@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -.TH Tcl n "8.6" Tcl "Tcl Built-In Commands" +.TH Tcl n "8.5" Tcl "Tcl Built-In Commands" .so man.macros .BS .SH NAME @@ -28,7 +28,7 @@ First, the Tcl interpreter breaks the command into \fIwords\fR and performs substitutions as described below. These substitutions are performed in the same way for all commands. -Secondly, the first word is used to locate a command procedure to +The first word is used to locate a command procedure to carry out the command, then all of the words of the command are passed to the command procedure. The command procedure is free to interpret each of its words @@ -48,6 +48,7 @@ as ordinary characters and included in the word. Command substitution, variable substitution, and backslash substitution are performed on the characters between the quotes as described below. The double-quotes are not retained as part of the word. +.VS 8.5 br .IP "[5] \fBArgument expansion.\fR" If a word starts with the string .QW {*} @@ -59,9 +60,10 @@ variable substitutions; backslash substitutions are performed as is normal for a list and individual internal words may be surrounded by either braces or double-quote characters), and its words are added to the command being substituted. For instance, -.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}" +.QW "cmd a {*}{b [c]} d {*}{$e f \N'34'g h\N'34'}" is equivalent to -.QW "cmd a b {[c]} d {$e} f {g h}" . +.QW "cmd a b {[c]} d {$e} f \N'34'g h\N'34'" . +.VE 8.5 .IP "[6] \fBBraces.\fR" If the first character of a word is an open brace .PQ { @@ -104,44 +106,24 @@ 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 sequence of one or more characters that are a letter, digit, underscore, or namespace separators (two or more colons). -Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR, -\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR). .TP 15 \fB$\fIname\fB(\fIindex\fB)\fR -. \fIName\fR gives the name of an array variable and \fIindex\fR gives the name of an element within that array. \fIName\fR must contain only letters, digits, underscores, and namespace separators, and may be an empty string. -Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR, -\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR). Command substitutions, variable substitutions, and backslash substitutions are performed on the characters of \fIindex\fR. .TP 15 \fB${\fIname\fB}\fR -. -\fIName\fR is the name of a scalar variable or array element. It may contain -any characters whatsoever except for close braces. It indicates an array -element if \fIname\fR is in the form -.QW \fIarrayName\fB(\fIindex\fB)\fR -where \fIarrayName\fR does not contain any open parenthesis characters, -.QW \fB(\fR , -or close brace characters, -.QW \fB}\fR , -and \fIindex\fR can be any sequence of characters except for close brace -characters. No further -substitutions are performed during the parsing of \fIname\fR. -.PP +\fIName\fR is the name of a scalar variable. It may contain any +characters whatsoever except for close braces. +.LP There may be any number of variable substitutions in a single word. Variable substitution is not performed on words enclosed in braces. -.PP -Note that variables may contain character sequences other than those listed -above, but in that case other mechanisms must be used to access them (e.g., -via the \fBset\fR command's single-argument form). .RE .IP "[9] \fBBackslash substitution.\fR" If a backslash @@ -158,25 +140,25 @@ handled specially, along with the value that replaces each sequence. .RS .TP 7 \e\fBa\fR -Audible alert (bell) (Unicode U+000007). +Audible alert (bell) (0x7). .TP 7 \e\fBb\fR -Backspace (Unicode U+000008). +Backspace (0x8). .TP 7 \e\fBf\fR -Form feed (Unicode U+00000C). +Form feed (0xc). .TP 7 \e\fBn\fR -Newline (Unicode U+00000A). +Newline (0xa). .TP 7 \e\fBr\fR -Carriage-return (Unicode U+00000D). +Carriage-return (0xd). .TP 7 \e\fBt\fR -Tab (Unicode U+000009). +Tab (0x9). .TP 7 \e\fBv\fR -Vertical tab (Unicode U+00000B). +Vertical tab (0xb). .TP 7 \e\fB<newline>\fIwhiteSpace\fR . @@ -191,41 +173,26 @@ in braces or quotes. Backslash .PQ \e "" . .TP 7 -\e\fIooo\fR +\e\fIooo\fR . -The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal -value for the Unicode character that will be inserted, in the range -\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF). -The parser will stop just before this range overflows, or when -the maximum of three digits is reached. The upper bits of the Unicode -character will be 0. +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 the +Unicode character will be 0. .TP 7 -\e\fBx\fIhh\fR +\e\fBx\fIhh\fR . -The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit -hexadecimal value for the Unicode character that will be inserted. The upper -bits of the Unicode character will be 0 (i.e., the character will be in the -range U+000000\(enU+0000FF). +The hexadecimal digits \fIhh\fR give an eight-bit hexadecimal value for the +Unicode character that will be inserted. Any number of hexadecimal digits +may be present; however, all but the last two are ignored (the result is +always a one-byte quantity). The upper bits of the Unicode character will +be 0. .TP 7 -\e\fBu\fIhhhh\fR +\e\fBu\fIhhhh\fR . The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a sixteen-bit hexadecimal value for the Unicode character that will be -inserted. The upper bits of the Unicode character will be 0 (i.e., the -character will be in the range U+000000\(enU+00FFFF). -.TP 7 -\e\fBU\fIhhhhhhhh\fR -. -The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a -twenty-one-bit hexadecimal value for the Unicode character that will be -inserted, in the range U+000000\(enU+10FFFF. The parser will stop just -before this range overflows, or when the maximum of eight digits -is reached. The upper bits of the Unicode character will be 0. -.RS -.PP -The range U+010000\(enU+10FFFD is reserved for the future. -.RE -.PP +inserted. +.LP Backslash substitution is not performed on words enclosed in braces, except for backslash-newline as described above. .RE @@ -250,15 +217,13 @@ no substitutions are performed before making the recursive call and no additional substitutions are performed on the result of the nested script. .RS -.PP +.LP Substitutions take place from left to right, and each substitution is evaluated completely before attempting to evaluate the next. Thus, a sequence like -.PP .CS set y [set x 0][incr x][incr x] .CE -.PP will always set the variable \fIy\fR to the value, \fI012\fR. .RE .IP "[12] \fBSubstitution and word boundaries.\fR" @@ -267,9 +232,3 @@ except for argument expansion as specified in rule [5]. For example, during variable substitution the entire value of the variable becomes part of a single word, even if the variable's value contains spaces. -.SH KEYWORDS -backslash, command, comment, script, substitution, variable -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: |