diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-29 01:42:18 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-29 01:42:18 (GMT) |
commit | 71f78ed1de764f208d95b703744c7682d448c3e3 (patch) | |
tree | 8e72d3dd4068fc22320de66ab7145fa75119f54c | |
parent | ccacc920f9cd610a9a9d8e800f623c20bf43a702 (diff) | |
download | tcl-71f78ed1de764f208d95b703744c7682d448c3e3.zip tcl-71f78ed1de764f208d95b703744c7682d448c3e3.tar.gz tcl-71f78ed1de764f208d95b703744c7682d448c3e3.tar.bz2 |
Next stage of doing GOOBE improvements to documentation now that the html generation works
-rw-r--r-- | doc/append.n | 11 | ||||
-rw-r--r-- | doc/apply.n | 5 | ||||
-rw-r--r-- | doc/array.n | 27 | ||||
-rw-r--r-- | doc/bgerror.n | 6 | ||||
-rw-r--r-- | doc/binary.n | 22 | ||||
-rw-r--r-- | doc/chan.n | 25 | ||||
-rw-r--r-- | doc/clock.n | 188 | ||||
-rw-r--r-- | doc/concat.n | 14 | ||||
-rw-r--r-- | doc/dde.n | 8 | ||||
-rw-r--r-- | doc/dict.n | 10 | ||||
-rw-r--r-- | doc/encoding.n | 7 | ||||
-rw-r--r-- | doc/exec.n | 66 | ||||
-rw-r--r-- | doc/exit.n | 4 | ||||
-rw-r--r-- | doc/expr.n | 27 | ||||
-rw-r--r-- | doc/fcopy.n | 19 | ||||
-rw-r--r-- | doc/file.n | 97 | ||||
-rw-r--r-- | doc/fileevent.n | 8 | ||||
-rw-r--r-- | doc/filename.n | 26 | ||||
-rw-r--r-- | doc/for.n | 4 | ||||
-rw-r--r-- | doc/format.n | 17 | ||||
-rw-r--r-- | doc/glob.n | 81 | ||||
-rw-r--r-- | doc/history.n | 14 | ||||
-rw-r--r-- | doc/http.n | 37 | ||||
-rw-r--r-- | doc/if.n | 5 | ||||
-rw-r--r-- | doc/info.n | 55 | ||||
-rw-r--r-- | doc/interp.n | 13 | ||||
-rw-r--r-- | doc/lappend.n | 12 | ||||
-rw-r--r-- | doc/lassign.n | 6 | ||||
-rw-r--r-- | doc/library.n | 27 | ||||
-rw-r--r-- | doc/load.n | 16 | ||||
-rw-r--r-- | doc/lrange.n | 13 | ||||
-rw-r--r-- | doc/lsearch.n | 6 | ||||
-rw-r--r-- | doc/lsort.n | 8 | ||||
-rw-r--r-- | doc/memory.n | 4 | ||||
-rw-r--r-- | doc/msgcat.n | 66 | ||||
-rw-r--r-- | doc/namespace.n | 26 | ||||
-rw-r--r-- | doc/open.n | 46 | ||||
-rw-r--r-- | doc/package.n | 115 | ||||
-rw-r--r-- | doc/packagens.n | 6 | ||||
-rw-r--r-- | doc/pid.n | 100 | ||||
-rw-r--r-- | doc/pkgMkIndex.n | 17 | ||||
-rw-r--r-- | doc/platform.n | 4 | ||||
-rw-r--r-- | doc/proc.n | 194 | ||||
-rw-r--r-- | doc/puts.n | 196 | ||||
-rw-r--r-- | doc/refchan.n | 10 | ||||
-rw-r--r-- | doc/regexp.n | 43 | ||||
-rw-r--r-- | doc/registry.n | 17 | ||||
-rw-r--r-- | doc/regsub.n | 62 | ||||
-rw-r--r-- | doc/return.n | 11 | ||||
-rw-r--r-- | doc/safe.n | 14 | ||||
-rw-r--r-- | doc/scan.n | 10 | ||||
-rw-r--r-- | doc/set.n | 7 | ||||
-rw-r--r-- | doc/socket.n | 4 | ||||
-rw-r--r-- | doc/source.n | 20 | ||||
-rw-r--r-- | doc/string.n | 52 | ||||
-rw-r--r-- | doc/subst.n | 54 | ||||
-rw-r--r-- | doc/switch.n | 9 | ||||
-rw-r--r-- | doc/tcltest.n | 568 | ||||
-rw-r--r-- | doc/tclvars.n | 43 | ||||
-rw-r--r-- | doc/time.n | 4 | ||||
-rw-r--r-- | doc/tm.n | 45 | ||||
-rw-r--r-- | doc/trace.n | 38 | ||||
-rw-r--r-- | doc/unknown.n | 9 | ||||
-rw-r--r-- | doc/unset.n | 129 | ||||
-rw-r--r-- | doc/update.n | 5 | ||||
-rw-r--r-- | doc/uplevel.n | 7 | ||||
-rw-r--r-- | doc/upvar.n | 9 |
67 files changed, 1598 insertions, 1230 deletions
diff --git a/doc/append.n b/doc/append.n index 71a1bc5..66f7c52 100644 --- a/doc/append.n +++ b/doc/append.n @@ -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. '\" -'\" RCS: @(#) $Id: append.n,v 1.8 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: append.n,v 1.9 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH append n "" Tcl "Tcl Built-In Commands" @@ -20,15 +20,18 @@ append \- Append to variable .SH DESCRIPTION .PP Append all of the \fIvalue\fR arguments to the current value -of variable \fIvarName\fR. If \fIvarName\fR doesn't exist, +of variable \fIvarName\fR. If \fIvarName\fR does not exist, it is given a value equal to the concatenation of all the \fIvalue\fR arguments. The result of this command is the new value stored in variable \fIvarName\fR. This command provides an efficient way to build up long variables incrementally. -For example, ``\fBappend a $b\fR'' is much more efficient than -``\fBset a $a$b\fR'' if \fB$a\fR is long. +For example, +.QW "\fBappend a $b\fR" +is much more efficient than +.QW "\fBset a $a$b\fR" +if \fB$a\fR is long. .SH EXAMPLE Building a string of comma-separated numbers piecemeal using a loop. .CS diff --git a/doc/apply.n b/doc/apply.n index fea6a5f..bcdf6bd 100644 --- a/doc/apply.n +++ b/doc/apply.n @@ -41,7 +41,8 @@ The invocation of \fBapply\fR adds a call frame to Tcl's evaluation stack proceeds in this call frame, in the namespace given by \fInamespace\fR or in the global namespace if none was specified. If given, \fInamespace\fR is interpreted relative to the global namespace even if its name does not start -with '::'. +with +.QW :: . .PP The semantics of \fBapply\fR can also be described by: .PP @@ -67,7 +68,7 @@ to each element of a list. .CS proc map {lambda list} { set result {} - foreach $item $list { + foreach item $list { lappend result [\fBapply\fR $lambda $item] } return $result diff --git a/doc/array.n b/doc/array.n index 73e6ad2..669f17e 100644 --- a/doc/array.n +++ b/doc/array.n @@ -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. '\" -'\" RCS: @(#) $Id: array.n,v 1.18 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: array.n,v 1.19 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH array n 8.3 Tcl "Tcl Built-In Commands" @@ -16,7 +16,6 @@ array \- Manipulate array variables .SH SYNOPSIS \fBarray \fIoption arrayName\fR ?\fIarg arg ...\fR? .BE - .SH DESCRIPTION .PP This command performs one of several operations on the @@ -36,7 +35,7 @@ check, and must have been the return value from a previous invocation of \fBarray startsearch\fR. This option is particularly useful if an array has an element with an empty name, since the return value from -\fBarray nextelement\fR won't indicate whether the search +\fBarray nextelement\fR will not indicate whether the search has been completed. .TP \fBarray donesearch \fIarrayName searchId\fR @@ -60,10 +59,10 @@ array are included in the result. If \fIpattern\fR is specified, then only those elements whose names match \fIpattern\fR (using the matching rules of \fBstring match\fR) are included. -If \fIarrayName\fR isn't the name of an array variable, or if +If \fIarrayName\fR is not the name of an array variable, or if the array contains no elements, then an empty list is returned. -If traces on the array modify the list of elements, the elements -returned are those that exist both before and after the call to +If traces on the array modify the list of elements, the elements +returned are those that exist both before and after the call to \fBarray get\fR. .TP \fBarray names \fIarrayName\fR ?\fImode\fR? ?\fIpattern\fR? @@ -77,7 +76,7 @@ for information on glob style matching, and the documentation for \fBregexp\fR for information on regexp matching. If \fIpattern\fR is omitted then the command returns all of the element names in the array. If there are no (matching) elements -in the array, or if \fIarrayName\fR isn't the name of an array +in the array, or if \fIarrayName\fR is not the name of an array variable, then an empty string is returned. .TP \fBarray nextelement \fIarrayName searchId\fR @@ -105,7 +104,7 @@ and \fIlist\fR is empty, \fBarray size \fIarrayName\fR Returns a decimal string giving the number of elements in the array. -If \fIarrayName\fR isn't the name of an array then 0 is returned. +If \fIarrayName\fR is not the name of an array then 0 is returned. .TP \fBarray startsearch \fIarrayName\fR This command initializes an element-by-element search through the @@ -131,7 +130,7 @@ the buckets. .TP \fBarray unset \fIarrayName\fR ?\fIpattern\fR? Unsets all of the elements in the array that match \fIpattern\fR (using the -matching rules of \fBstring match\fR). If \fIarrayName\fR isn't the name +matching rules of \fBstring match\fR). If \fIarrayName\fR is not the name of an array variable or there are no matching elements in the array, no error will be raised. If \fIpattern\fR is omitted and \fIarrayName\fR is an array variable, then the command unsets the entire array. @@ -148,7 +147,7 @@ The command always returns an empty string. foreach {color count} [\fBarray get\fR colorcount] { puts "Color: $color Count: $count" } - => Color: blue Count: 4 + \fB\(->\fR Color: blue Count: 4 Color: white Count: 9 Color: green Count: 5 Color: red Count: 1 @@ -156,7 +155,7 @@ foreach {color count} [\fBarray get\fR colorcount] { foreach color [\fBarray names\fR colorcount] { puts "Color: $color Count: $colorcount($color)" } - => Color: blue Count: 4 + \fB\(->\fR Color: blue Count: 4 Color: white Count: 9 Color: green Count: 5 Color: red Count: 1 @@ -164,13 +163,13 @@ foreach color [\fBarray names\fR colorcount] { foreach color [lsort [\fBarray names\fR colorcount]] { puts "Color: $color Count: $colorcount($color)" } - => Color: blue Count: 4 + \fB\(->\fR Color: blue Count: 4 Color: green Count: 5 Color: red Count: 1 Color: white Count: 9 \fBarray statistics\fR colorcount - => 4 entries in table, 4 buckets + \fB\(->\fR 4 entries in table, 4 buckets number of buckets with 0 entries: 1 number of buckets with 1 entries: 2 number of buckets with 2 entries: 1 @@ -184,9 +183,7 @@ foreach color [lsort [\fBarray names\fR colorcount]] { number of buckets with 10 or more entries: 0 average search distance for entry: 1.2 .CE - .SH "SEE ALSO" list(n), string(n), variable(n), trace(n), foreach(n) - .SH KEYWORDS array, element names, search diff --git a/doc/bgerror.n b/doc/bgerror.n index c8887d5..7740acf 100644 --- a/doc/bgerror.n +++ b/doc/bgerror.n @@ -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. '\" -'\" RCS: @(#) $Id: bgerror.n,v 1.11 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: bgerror.n,v 1.12 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH bgerror n 7.5 Tcl "Tcl Built-In Commands" @@ -32,13 +32,13 @@ releases of Tcl. Applications intending to support only Tcl releases 8.5 and later should simply make use of \fBinterp bgerror\fR. .VE 8.5 .PP -The \fBbgerror\fR command doesn't exist as built-in part of Tcl. Instead, +The \fBbgerror\fR command does not exist as built-in part of Tcl. Instead, individual applications or users can define a \fBbgerror\fR command (e.g. as a Tcl procedure) if they wish to handle background errors. .PP A background error is one that occurs in an event handler or some -other command that didn't originate with the application. +other command that did not originate with the application. For example, if an error occurs while executing a command specified with the \fBafter\fR command, then it is a background error. For a non-background error, the error can simply be returned up diff --git a/doc/binary.n b/doc/binary.n index df990b4..62a7b87 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: binary.n,v 1.33 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: binary.n,v 1.34 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH binary n 8.0 Tcl "Tcl Built-In Commands" @@ -129,8 +129,9 @@ will return a string equivalent to \fB\exe0\exe1\exa0\fR. .IP \fBh\fR 5 Stores a string of \fIcount\fR hexadecimal digits in low-to-high within each byte in the output string. \fIArg\fR must contain a -sequence of characters in the set ``0123456789abcdefABCDEF''. The -resulting bytes are emitted in first to last order with the hex digits +sequence of characters in the set +.QW 0123456789abcdefABCDEF . +The resulting bytes are emitted in first to last order with the hex digits being formatted in low-to-high order within each byte. If \fIarg\fR has fewer than \fIcount\fR digits, then zeros will be used for the remaining digits. If \fIarg\fR has more than the specified number of @@ -395,7 +396,8 @@ position to satisfy the current field specifier, then the corresponding variable is left untouched and \fBbinary scan\fR returns immediately with the number of variables that were set. If there are not enough arguments for all of the fields in the format string that -consume arguments, then an error is generated. The flag character 'u' +consume arguments, then an error is generated. The flag character +.QW u may be given to cause some types to be read as unsigned values. The flag is accepted for all field types but is ignored for non-integer fields. .PP @@ -434,7 +436,9 @@ will be sign extended. Thus the following will occur: set signShort [\fBbinary format\fR s1 0x8000] \fBbinary scan\fR $signShort s1 val; \fI# val == 0xFFFF8000\fR .CE -If you require unsigned values you can include the 'u' flag character following +If you require unsigned values you can include the +.QW u +flag character following the field type. For example, to read an unsigned short value: .CS set signShort [\fBbinary format\fR s1 0x8000] @@ -472,7 +476,10 @@ will return \fB1\fR with \fBabc efghi\fR stored in \fIvar1\fR. .RE .IP \fBb\fR 5 The data is turned into a string of \fIcount\fR binary digits in -low-to-high order represented as a sequence of ``1'' and ``0'' +low-to-high order represented as a sequence of +.QW 1 +and +.QW 0 characters. The data bytes are scanned in first to last order with the bits being taken in low-to-high order within each byte. Any extra bits in the last byte are ignored. If \fIcount\fR is \fB*\fR, then @@ -498,7 +505,8 @@ will return \fB2\fR with \fB01110\fR stored in \fIvar1\fR and .IP \fBH\fR 5 The data is turned into a string of \fIcount\fR hexadecimal digits in high-to-low order represented as a sequence of characters in the set -``0123456789abcdef''. The data bytes are scanned in first to last +.QW 0123456789abcdef . +The data bytes are scanned in first to last order with the hex digits being taken in high-to-low order within each byte. Any extra bits in the last byte are ignored. If \fIcount\fR is \fB*\fR, then all of the remaining hex digits in \fIstring\fR will be @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: chan.n,v 1.13 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: chan.n,v 1.14 2007/10/29 01:42:18 dkf Exp $ .so man.macros .TH chan n 8.5 Tcl "Tcl Built-In Commands" .BS @@ -293,7 +293,9 @@ Note that \fIinputChan\fR can become readable during a background copy. You should turn off any \fBchan event\fR or \fBfileevent\fR handlers during a background copy so those handlers do not interfere with the copy. Any I/O attempted by a \fBchan event\fR or -\fBfileevent\fR handler will get a "channel busy" error. +\fBfileevent\fR handler will get a +.QW "channel busy" +error. .PP \fBChan copy\fR translates end-of-line sequences in \fIinputChan\fR and \fIoutputChan\fR according to the \fB\-translation\fR option for @@ -333,7 +335,11 @@ the channel. .PP The argument \fImode\fR specifies if the new channel is opened for reading, writing, or both. It has to be a list containing any of the -strings "\fBread\fR" or "\fBwrite\fR". The list must have at least one +strings +.QW \fBread\fR +or +.QW \fBwrite\fR . +The list must have at least one element, as a channel you can neither write to nor read from makes no sense. The handler command for the new channel must support the chosen mode, or an error is thrown. @@ -411,9 +417,11 @@ while waiting for the data to arrive. If an application invokes \fBchan gets\fR or \fBchan read\fR on a blocking channel when there is no input data available, the process will block; until the input data arrives, it will not be able to service other events, so it will -appear to the user to ``freeze up''. With \fBchan event\fR, the +appear to the user to +.QW "freeze up" . +With \fBchan event\fR, the process can tell when data is present and only invoke \fBchan gets\fR -or \fBchan read\fR when they won't block. +or \fBchan read\fR when they will not block. .PP A channel is considered to be readable if there is unread data available on the underlying device. A channel is also considered to @@ -496,7 +504,8 @@ only those channel names that match it (according to the rules of .TP \fBchan pending \fImode channelId\fR . -Depending on whether \fImode\fR is "input" or "output", returns the number of +Depending on whether \fImode\fR is \fBinput\fR or \fBoutput\fR, +returns the number of bytes of input or output (respectively) currently buffered internally for \fIchannelId\fR (especially useful in a readable event callback to impose application-specific limits on input line lengths to avoid @@ -510,7 +519,7 @@ This subcommand is used by command handlers specified with \fBchan create\fR. It notifies the channel represented by the handle \fIchannelId\fR that the event(s) listed in the \fIeventSpec\fR have occurred. The argument has to be a list containing any of the strings -"\fBread\fR" and "\fBwrite\fR". The list must contain at least one +\fBread\fR and \fBwrite\fR. The list must contain at least one element as it does not make sense to invoke the command if there are no events to post. .RS @@ -575,7 +584,7 @@ is possible for an arbitrarily large amount of data to be buffered for a channel in nonblocking mode, which could consume a large amount of memory. To avoid wasting memory, nonblocking I/O should normally be used in an event-driven fashion with the \fBchan event\fR command -(don't invoke \fBchan puts\fR unless you have recently been notified +(do not invoke \fBchan puts\fR unless you have recently been notified via a file event that the channel is ready for more output data). .RE .TP diff --git a/doc/clock.n b/doc/clock.n index f2bf2a8..97d05e1 100644 --- a/doc/clock.n +++ b/doc/clock.n @@ -10,17 +10,17 @@ clock \- Obtain and manipulate dates and times .SH "SYNOPSIS" package require \fBTcl 8.5\fR .sp -\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI-option value\fR? +\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI\-option value\fR? .sp -\fBclock clicks\fR ?\fI-option\fR? +\fBclock clicks\fR ?\fI\-option\fR? .sp -\fBclock format\fR \fItimeVal\fR ?\fI-option value\fR...? +\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...? .sp \fBclock microseconds\fR .sp \fBclock milliseconds\fR .sp -\fBclock scan\fR \fIinputString\fR ?\fI-option value\fR...? +\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...? .sp \fBclock seconds\fR .sp @@ -31,27 +31,27 @@ The \fBclock\fR command performs several operations that obtain and manipulate values that represent times. The command supports several subcommands that determine what action is carried out by the command. .TP -\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI-option value\fR? +\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI\-option value\fR? Adds a (possibly negative) offset to a time that is expressed as an integer number of seconds. See \fBCLOCK ARITHMETIC\fR for a full description. .TP -\fBclock clicks\fR ?\fI-option\fR? -If no \fI-option\fR argument is supplied, returns a high-resolution +\fBclock clicks\fR ?\fI\-option\fR? +If no \fI\-option\fR argument is supplied, returns a high-resolution time value as a system-dependent integer value. The unit of the value is system-dependent but should be the highest resolution clock available on the system such as a CPU cycle counter. See \fBHIGH RESOLUTION TIMERS\fR for a full description. .sp -If the \fI-option\fR argument is \fI-milliseconds\fR, then the command +If the \fI\-option\fR argument is \fI\-milliseconds\fR, then the command is synonymous with \fBclock milliseconds\fR (see below). This usage is obsolete, and \fBclock milliseconds\fR is to be considered the preferred way of obtaining a count of milliseconds. .sp -If the \fI-option\fR argument is \fI-microseconds\fR, then the command +If the \fI\-option\fR argument is \fI\-microseconds\fR, then the command is synonymous with \fBclock microseconds\fR (see below). This usage is obsolete, and \fBclock microseconds\fR is to be considered the preferred way of obtaining a count of microseconds. .TP -\fBclock format\fR \fItimeVal\fR ?\fI-option value\fR...? +\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...? Formats a time that is expressed as an integer number of seconds into a format intended for consumption by users or external programs. See \fBFORMATTING TIMES\fR for a full description. @@ -62,7 +62,7 @@ Returns the current time as an integer number of microseconds. See \fBHIGH RESO \fBclock milliseconds\fR Returns the current time as an integer number of milliseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description. .TP -\fBclock scan\fR \fIinputString\fR ?\fI-option value\fR...? +\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...? Scans a time that is expressed as a character string and produces an integer number of seconds. See \fBSCANNING TIMES\fR for a full description. @@ -93,15 +93,16 @@ to identify an interval of time, for example, \fI3 seconds\fR or \fI1 year\fR. .SS "OPTIONS" .TP -\fB-base\fR time +\fB\-base\fR time Specifies that any relative times present in a \fBclock scan\fR command are to be given relative to \fItime\fR. \fItime\fR must be expressed as a count of nominal seconds from the epoch time of 1 January 1970, 00:00 UTC. .TP -\fB-format\fR format +\fB\-format\fR format Specifies the desired output format for \fBclock format\fR or the expected input format for \fBclock scan\fR. The \fIformat\fR string consists -of any number of characters other than the per-cent sign ('\fI%\fR') +of any number of characters other than the per-cent sign +.PQ \fB%\fR interspersed with any number of \fIformat groups\fR, which are two-character sequences beginning with the per-cent sign. The permissible format groups, and their interpretation, are described under \fBFORMAT GROUPS\fR. @@ -112,20 +113,21 @@ On \fBclock format\fR, the default format is %a %b %d %H:%M:%S %z %Y .CE .PP -On \fBclock scan\fR, the lack of a \fI-format\fR option indicates that -a "free format scan" is requested; see \fBFREE FORM SCAN\fR for a -description of what happens. +On \fBclock scan\fR, the lack of a \fI\-format\fR option indicates that a +.QW "free format scan" +is requested; see \fBFREE FORM SCAN\fR for a description of what happens. .RE .TP -\fB-gmt\fR boolean +\fB\-gmt\fR boolean If \fIboolean\fR is true, specifies that a time specified to \fBclock add\fR, \fBclock format\fR or \fBclock scan\fR should be processed in UTC. If \fIboolean\fR is false, the processing defaults to the local time zone. This usage is obsolete; the correct current usage is to -specify the UTC time zone with '\fB-timezone\fR \fI:UTC\fR' or any of -the equivalent ways to specify it. +specify the UTC time zone with +.QW "\fB\-timezone\fR \fI:UTC\fR" +or any of the equivalent ways to specify it. .TP -\fB-locale\fR localeName +\fB\-locale\fR localeName Specifies that locale-dependent scanning and formatting (and date arithmetic for dates preceding the adoption of the Gregorian calendar) is to be done in the locale identified by \fIlocaleName\fR. The locale name may be any of @@ -138,12 +140,12 @@ descriptions of the individual format groups under \fBFORMAT GROUPS\fR. The effect of locale on clock arithmetic is discussed under \fBCLOCK ARITHMETIC\fR. .TP -\fB-timezone\fR zoneName +\fB\-timezone\fR zoneName Specifies that clock arithmetic, formatting, and scanning are to be done according to the rules for the time zone specified by \fIzoneName\fR. The permissible values, and their interpretation, are discussed under \fBTIME ZONES\fR. -On subcommands that expect a \fB-timezone\fR argument, the default +On subcommands that expect a \fB\-timezone\fR argument, the default is to use the \fIcurrent time zone\fR. The current time zone is determined, in order of preference, by: .RS @@ -163,7 +165,7 @@ years 1902 to 2037) that can be represented in a 32-bit integer. The \fBclock add\fR command performs clock arithmetic on a value (expressed as nominal seconds from the epoch time of 1 January 1970, 00:00 UTC) given as its first argument. The remaining arguments (other than the -possible \fB-timezone\fR, \fB-locale\fR and \fB-gmt\fR options) +possible \fB\-timezone\fR, \fB\-locale\fR and \fB\-gmt\fR options) are integers and keywords in alternation, where the keywords are chosen from \fBseconds\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR, or @@ -284,70 +286,75 @@ expressed in seconds from the epoch time of 1 January 1970, 00:00 UTC, as returned by \fBclock seconds\fR, \fBclock scan\fR, \fBclock add\fR, \fBfile atime\fR or \fBfile mtime\fR. .PP -If a \fB-format\fR option is present, the following argument is +If a \fB\-format\fR option is present, the following argument is a string that specifies how the date and time are to be formatted. The string consists -of any number of characters other than the per-cent sign ('\fI%\fR') +of any number of characters other than the per-cent sign +.PQ \fB%\fR interspersed with any number of \fIformat groups\fR, which are two-character sequences beginning with the per-cent sign. The permissible format groups, and their interpretation, are described under \fBFORMAT GROUPS\fR. .PP -If a \fB-timezone\fR option is present, the following +If a \fB\-timezone\fR option is present, the following argument is a string that specifies the time zone in which the date and time -are to be formatted. As an alternative to \fB-timezone\fR \fI:UTC\fR, -the obsolete usage \fB-gmt\fR \fItrue\fR may be used. See +are to be formatted. As an alternative to +.QW "\fB\-timezone\fR \fI:UTC\fR" , +the obsolete usage +.QW "\fB\-gmt\fR \fItrue\fR" +may be used. See \fBTIME ZONES\fR for the permissible variants for the time zone. .PP -If a \fB-locale\fR option is present, the following argument is +If a \fB\-locale\fR option is present, the following argument is a string that specifies the locale in which the time is to be formatted, in the same format that is used for the \fBmsgcat\fR package. Note -that the default, if \fB-locale\fR is not specified, is the root locale +that the default, if \fB\-locale\fR is not specified, is the root locale \fB{}\fR rather than the current locale. The current locale may -be obtained by using \fB-locale\fR \fBcurrent\fR. +be obtained by using \fB\-locale\fR \fBcurrent\fR. In addition, some platforms support a \fBsystem\fR locale that reflects the user's current choices. For instance, on Windows, the format that the user has selected from dates and times in the Control Panel can be obtained by using the \fBsystem\fR locale. On platforms that do not define a user selection of date and time formats -separate from \fBLC_TIME\fR, \fB-locale\fR \fBsystem\fR is -synonymous with \fB-locale\fR \fBcurrent\fR. +separate from \fBLC_TIME\fR, \fB\-locale\fR \fBsystem\fR is +synonymous with \fB\-locale\fR \fBcurrent\fR. .SH "SCANNING TIMES" The \fBclock scan\fR command accepts times that are formatted as strings and converts them to counts of seconds from the epoch time -of 1 January 1970, 00:00 UTC. It normally takes a \fB-format\fR +of 1 January 1970, 00:00 UTC. It normally takes a \fB\-format\fR option that is followed by a string describing the expected format of the input. (See \fBFREE FORM SCAN\fR for the effect of \fBclock scan\fR without such an argument.) The string consists of any number of -characters other than the per-cent sign ('\fI%\fR'), +characters other than the per-cent sign +.PQ \fB%\fR "" , interspersed with any number of \fIformat groups\fR, which are two-character sequences beginning with the per-cent sign. The permissible format groups, and their interpretation, are described under \fBFORMAT GROUPS\fR. .PP -If a \fB-timezone\fR option is present, the following +If a \fB\-timezone\fR option is present, the following argument is a string that specifies the time zone in which the date and time -are to be interpreted. As an alternative to \fB-timezone\fR \fI:UTC\fR, -the obsolete usage \fB-gmt\fR \fItrue\fR may be used. See +are to be interpreted. As an alternative to \fB\-timezone\fR \fI:UTC\fR, +the obsolete usage \fB\-gmt\fR \fItrue\fR may be used. See \fBTIME ZONES\fR for the permissible variants for the time zone. .PP -If a \fB-locale\fR option is present, the following argument is +If a \fB\-locale\fR option is present, the following argument is a string that specifies the locale in which the time is to be interpreted, in the same format that is used for the \fBmsgcat\fR package. Note -that the default, if \fB-locale\fR is not specified, is the root locale +that the default, if \fB\-locale\fR is not specified, is the root locale \fB{}\fR rather than the current locale. The current locale may -be obtained by using \fB-locale\fR \fBcurrent\fR. +be obtained by using \fB\-locale\fR \fBcurrent\fR. In addition, some platforms support a \fBsystem\fR locale that reflects the user's current choices. For instance, on Windows, the format that the user has selected from dates and times in the Control Panel can be obtained by using the \fBsystem\fR locale. On platforms that do not define a user selection of date and time formats -separate from \fBLC_TIME\fR, \fB-locale\fR \fBsystem\fR is -synonymous with \fB-locale\fR \fBcurrent\fR. +separate from \fBLC_TIME\fR, \fB\-locale\fR \fBsystem\fR is +synonymous with \fB\-locale\fR \fBcurrent\fR. .PP -If a \fB-base\fR option is present, the following argument is +If a \fB\-base\fR option is present, the following argument is a time (expressed in seconds from the epoch time) that is used as a \fIbase time\fR for interpreting relative times. If no -\fB-base\fR option is present, the base time is the current time. +\fB\-base\fR option is present, the base time is the current time. .PP Scanning of times in fixed format works by determining three things: the date, the time of day, and the time zone. These three are then @@ -422,7 +429,7 @@ combines with the hour and minute. If the string contains neither a \fB%s\fR format group nor a group specifying the hour of the day, then midnight (\fB00:00\fR, the start of the given date) is used. -The time zone is determined by either the \fB-timezone\fR or \fB-gmt\fR +The time zone is determined by either the \fB\-timezone\fR or \fB\-gmt\fR options, or by using the current time zone. .PP If a format string lacks a \fB%z\fR or \fB%Z\fR format group, @@ -463,7 +470,7 @@ any unique prefix of either form). \fB%c\fR On output, receives a localized representation of date and time of day; the localized representation is expected to use the Gregorian calendar. -On input, matches whatever %c produces. +On input, matches whatever \fB%c\fR produces. .TP \fB%C\fR On output, receives the number of the century in Indo-Arabic numerals. @@ -489,7 +496,7 @@ whitespace, that are expected to be the number of the day of the month. \fB%Ec\fR On output, produces a locale-dependent representation of the date and time of day in the locale's alternative calendar. On input, matches -whatever %Ec produces. The locale's alternative calendar need not +whatever \fB%Ec\fR produces. The locale's alternative calendar need not be the Gregorian calendar. .TP \fB%EC\fR @@ -509,13 +516,13 @@ Common Era. \fB%Ex\fR On output, produces a locale-dependent representation of the date in the locale's alternative calendar. On input, matches -whatever %Ex produces. The locale's alternative calendar need not +whatever \fB%Ex\fR produces. The locale's alternative calendar need not be the Gregorian calendar. .TP \fB%EX\fR On output, produces a locale-dependent representation of the time of day in the locale's alternative numerals. On input, matches -whatever %EX produces. +whatever \fB%EX\fR produces. .TP \fB%Ey\fR On output, produces a locale-dependent number of the year of the era @@ -587,7 +594,9 @@ and interprets them as the number of the month. .TP \fB%Od\fR, \fB%Oe\fR, \fB%OH\fR, \fB%OI\fR, \fB%Ok\fR, \fB%Ol\fR, \fB%Om\fR, \fB%OM\fR, \fB%OS\fR, \fB%Ou\fR, \fB%Ow\fR, \fB%Oy\fR All of these format groups are synonymous with their counterparts -without the '\fBO\fR', except that the string is produced and parsed in the +without the +.QW \fBO\fR , +except that the string is produced and parsed in the locale-dependent alternative numerals. .TP \fB%p\fR @@ -635,7 +644,7 @@ Synonymous with \fB%H:%M:%S\fR. .TP \fB%u\fR On output, produces the number of the day of the week -(\fB1\fR-Monday, \fB7\fR-Sunday). On input, accepts a single digit and +(\fB1\fR\(->Monday, \fB7\fR\(->Sunday). On input, accepts a single digit and interprets it as the day of the week. Sunday may be either \fB0\fR or \fB7\fR. .TP @@ -694,7 +703,7 @@ week number \fB%V\fR; programs should use \fB%G\fR for that purpose. .TP \fB%z\fR On output, produces the current time zone, expressed in hours and -minutes east (+hhmm) or west (-hhmm) of Greenwich. On input, accepts a +minutes east (+hhmm) or west (\-hhmm) of Greenwich. On input, accepts a time zone specifier (see \fBTIME ZONES\fR below) that will be used to determine the time zone. .TP @@ -709,11 +718,15 @@ Brazilian Standard Time. It is recommended that date/time strings for use by computers use numeric time zones instead. .TP \fB%%\fR -On output, produces a literal '\fB%\fR' character. On input, matches -a literal '\fB%\fR' character. +On output, produces a literal +.QW \fB%\fR +character. On input, matches a literal +.QW \fB%\fR +character. .TP \fB%+\fR -Synonymous with '\fB%a %b %e %H:%M:%S %Z %Y\fR'. +Synonymous with +.QW "\fB%a %b %e %H:%M:%S %Z %Y\fR" . .SH "TIME ZONES" When the \fBclock\fR command is processing a local time, it has several possible sources for the time zone to use. In order of preference, they @@ -722,8 +735,8 @@ are: A time zone specified inside a string being parsed and matched by a \fB%z\fR or \fB%Z\fR format group. .IP [2] -A time zone specified with the \fB-timezone\fR option to the \fBclock\fR -command (or, equivalently, by \fB-gmt\fR \fB1\fR). +A time zone specified with the \fB\-timezone\fR option to the \fBclock\fR +command (or, equivalently, by \fB\-gmt\fR \fB1\fR). .IP [3] A time zone specified in an environment variable \fBTCL_TZ\fR. .IP [4] @@ -759,10 +772,13 @@ that give the rules for various locales. A complete list of the location names is too lengthy to be listed here. On most Tcl installations, the definitions of the locations are to be found in named files in the directory - "\fI/no_backup/tools/lib/tcl8.5/clock/tzdata\fR". On some Unix systems, these -files are omitted, and the definitions are instead -obtained from system files in "\fI/usr/share/zoneinfo\fR", - "\fI/usr/share/lib/zoneinfo\fR" or "\fI/usr/local/etc/zoneinfo\fR". +.QW "\fI/no_backup/tools/lib/tcl8.5/clock/tzdata\fR" . +On some Unix systems, these files are omitted, and the definitions are +instead obtained from system files in +.QW "\fI/usr/share/zoneinfo\fR" , +.QW "\fI/usr/share/lib/zoneinfo\fR" +or +.QW "\fI/usr/local/etc/zoneinfo\fR" . As a special case, the name \fB:localtime\fR refers to the local time zone as defined by the C library. .PP @@ -784,17 +800,18 @@ Developers wishing to localize the date and time formatting and parsing are referred to \fIhttp://tip.tcl.tk/173\fR for a specification. .SH "FREE FORM SCAN" -If the \fBclock scan\fR command is invoked without a \fB-format\fR +If the \fBclock scan\fR command is invoked without a \fB\-format\fR option, then it requests a \fIfree-form scan.\fR \fI This form of scan is deprecated.\fR The reason for the deprecation -is that there are too many ambiguities. (Does the string '2000' +is that there are too many ambiguities. (Does the string +.QW 2000 represent a year, a time of day, or a quantity?) No set of rules for interpreting free-form dates and times has been found to give unsurprising results in all cases. .PP -If free-form scan is used, only the \fB-base\fR and \fB-gmt\fR -options are accepted. The \fB-timezone\fR and \fB-locale\fR -options will result in an error if \fB-format\fR is not supplied. +If free-form scan is used, only the \fB\-base\fR and \fB\-gmt\fR +options are accepted. The \fB\-timezone\fR and \fB\-locale\fR +options will result in an error if \fB\-format\fR is not supplied. .PP For the benefit of users who need to understand legacy code that uses free-form scan, the documentation for how free-form scan @@ -803,13 +820,13 @@ interprets a string is included here: If only a time is specified, the current date is assumed. If the \fIinputString\fR does not contain a -time zone mnemonic, the local time zone is assumed, unless the \fB-gmt\fR +time zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR argument is true, in which case the clock value is calculated assuming that the specified time is relative to Greenwich Mean Time. -\fB-gmt\fR, if specified, affects only the computed time value; it does not -impact the interpretation of \fB-base\fR. +\fB\-gmt\fR, if specified, affects only the computed time value; it does not +impact the interpretation of \fB\-base\fR. .PP -If the \fB-base\fR flag is specified, the next argument should contain +If the \fB\-base\fR flag is specified, the next argument should contain an integer clock value. Only the date in this value is used, not the time. This is useful for determining the time on a specific day or doing other date-relative conversions. @@ -825,24 +842,31 @@ a 24-hour clock. .TP \fIdate\fR A specific month and day with optional year. The -acceptable formats are "\fBmm/dd\fR?\fB/yy\fR?", - "\fBmonthname dd\fR?\fB, yy\fR?", - "\fBday, dd monthname \fR?\fByy\fR?", - "\fBdd monthname yy\fR", - "?\fBCC\fR?\fByymmdd\fR", and - "\fBdd-monthname-\fR?\fBCC\fR?\fByy\fR". +acceptable formats are +.QW "\fBmm/dd\fR?\fB/yy\fR?" , +.QW "\fBmonthname dd\fR?\fB, yy\fR?" , +.QW "\fBday, dd monthname \fR?\fByy\fR?" , +.QW "\fBdd monthname yy\fR" , +.QW "?\fBCC\fR?\fByymmdd\fR" , +and +.QW "\fBdd-monthname-\fR?\fBCC\fR?\fByy\fR" . The default year is the current year. If the year is less than 100, we treat the years 00-68 as 2000-2068 and the years 69-99 as 1969-1999. Not all platforms can represent the years 38-70, so an error may result if these years are used. .TP \fIISO 8601 point-in-time\fR -An ISO 8601 point-in-time specification, such as \fBCCyymmddThhmmss\fR, -where \fBT\fR is the literal T, "\fBCCyymmdd hhmmss\fR", or -\fBCCyymmddThh:mm:ss\fR. Note that only these three formats are accepted. +An ISO 8601 point-in-time specification, such as +.QW \fICCyymmdd\fBT\fIhhmmss\fR, +where \fBT\fR is the literal +.QW T , +.QW "\fICCyymmdd hhmmss\fR" , +or +.QW \fICCyymmdd\fBT\fIhh:mm:ss\fR . +Note that only these three formats are accepted. The command does \fInot\fR accept the full range of point-in-time specifications specified in ISO8601. Other formats can be recognized by -giving an explicit \fI-format\fR option to the \fBclock scan\fR command. +giving an explicit \fI\-format\fR option to the \fBclock scan\fR command. .TP \fIrelative time\fR A specification relative to the current time. The format is \fBnumber diff --git a/doc/concat.n b/doc/concat.n index ccc4be0..947cad3 100644 --- a/doc/concat.n +++ b/doc/concat.n @@ -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. '\" -'\" RCS: @(#) $Id: concat.n,v 1.9 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: concat.n,v 1.10 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH concat n 8.3 Tcl "Tcl Built-In Commands" @@ -30,19 +30,25 @@ Although \fBconcat\fR will concatenate lists (so the command: .CS \fBconcat\fR a b {c d e} {f {g h}} .CE -will return "\fBa b c d e f {g h}\fR" as its result), it will also +will return +.QW "\fBa b c d e f {g h}\fR" +as its result), it will also concatenate things that are not lists, and hence the command: .CS \fBconcat\fR " a b {c " d " e} f" .CE -will return "\fBa b {c d e} f\fR" as its result. +will return +.QW "\fBa b {c d e} f\fR" +as its result. .PP Note that the concatenation does not remove spaces from the middle of its arguments, so the command: .CS \fBconcat\fR "a b c" { d e f } .CE -will return "\fBa b c d e f\fR" (i.e. with three spaces between +will return +.QW "\fBa b c d e f\fR" +(i.e. with three spaces between the \fBa\fR, the \fBb\fR and the \fBc\fR). .SH "SEE ALSO" @@ -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. '\" -'\" RCS: @(#) $Id: dde.n,v 1.20 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: dde.n,v 1.21 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH dde n 1.3 dde "Tcl Bundled Packages" @@ -53,7 +53,11 @@ the service name \fBTclEval\fR and the topic name specified by \fItopic\fR. If no \fItopic\fR is given, \fBdde servername\fR returns the name of the current topic or the empty string if it is not registered as a service. If the given \fItopic\fR name is already in use, then a -suffix of the form ' #2' or ' #3' is appended to the name to make it +suffix of the form +.QW " #2" +or +.QW " #3" +is appended to the name to make it unique. The command's result will be the name actually used. The \fB-force\fR option is used to force registration of precisely the given \fItopic\fR name. @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: dict.n,v 1.14 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: dict.n,v 1.15 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH dict n 8.5 Tcl "Tcl Built-In Commands" @@ -122,8 +122,8 @@ Return a list of all keys in the given dictionary value. If a pattern is supplied, only those keys that match it (according to the rules of \fBstring match\fR) will be returned. The returned keys will be in an arbitrary implementation-specific order, though where no pattern is -supplied the i'th key returned by \fBdict keys\fR will be the key for -the i'th value returned by \fBdict values\fR applied to the same +supplied the \fIi\fR'th key returned by \fBdict keys\fR will be the key for +the \fIi\fR'th value returned by \fBdict values\fR applied to the same dictionary value. .TP \fBdict lappend \fIdictionaryVariable key \fR?\fIvalue ...\fR? @@ -195,8 +195,8 @@ Return a list of all values in the given dictionary value. If a pattern is supplied, only those values that match it (according to the rules of \fBstring match\fR) will be returned. The returned values will be in an arbitrary implementation-specific order, though where no -pattern is supplied the i'th key returned by \fBdict keys\fR will be -the key for the i'th value returned by \fBdict values\fR applied to +pattern is supplied the \fIi\fR'th key returned by \fBdict keys\fR will be +the key for the \fIi\fR'th value returned by \fBdict values\fR applied to the same dictionary value. .TP \fBdict with \fIdictionaryVariable \fR?\fIkey ...\fR? \fIbody\fR diff --git a/doc/encoding.n b/doc/encoding.n index 0ebc35a..a045575 100644 --- a/doc/encoding.n +++ b/doc/encoding.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: encoding.n,v 1.13 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: encoding.n,v 1.14 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH encoding n "8.1" Tcl "Tcl Built-In Commands" @@ -84,8 +84,9 @@ example, .CS set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"] .CE -would return the Unicode string "\eu306F", which is the Hiragana -letter HA. +would return the Unicode string +.QW "\eu306F" , +which is the Hiragana letter HA. .SH "SEE ALSO" Tcl_GetEncoding(3) @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: exec.n,v 1.19 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: exec.n,v 1.20 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH exec n 8.5 Tcl "Tcl Built-In Commands" @@ -49,9 +49,12 @@ If an \fIarg\fR (or pair of \fIarg\fRs) has one of the forms described below then it is used by \fBexec\fR to control the flow of input and output among the subprocess(es). Such arguments will not be passed to the subprocess(es). In forms -such as ``< \fIfileName\fR'' \fIfileName\fR may either be in a -separate argument from ``<'' or in the same argument with no -intervening space (i.e. ``<\fIfileName\fR''). +such as +.QW "\fB<\fR \fIfileName\fR" , +\fIfileName\fR may either be in a separate argument from +.QW \fB<\fR +or in the same argument with no intervening space (i.e. +.QW \fB<\fIfileName\fR ). .TP 15 | Separates distinct commands in the pipeline. The standard output @@ -134,8 +137,9 @@ If standard output has not been redirected then the \fBexec\fR command returns the standard output from the last command in the pipeline, .VS 8.5 -unless ``2>@1'' was specified, in which case -standard error is included as well. +unless +.QW 2>@1 +was specified, in which case standard error is included as well. .VE 8.5 If any of the commands in the pipeline exit abnormally or are killed or suspended, then \fBexec\fR will return an error @@ -144,7 +148,7 @@ error messages describing the abnormal terminations; the \fB-errorcode\fR return option will contain additional information about the last abnormal termination encountered. If any of the commands writes to its standard error file and that -standard error isn't redirected +standard error is not redirected .VS 8.5 and \fB\-ignorestderr\fR is not specified, .VE 8.5 @@ -156,22 +160,27 @@ output. If the last character of the result or error message is a newline then that character is normally deleted from the result or error message. -This is consistent with other Tcl return values, which don't +This is consistent with other Tcl return values, which do not normally end with newlines. However, if \fB\-keepnewline\fR is specified then the trailing newline is retained. .PP -If standard input isn't redirected with ``<'' or ``<<'' -or ``<@'' then the standard input for the first command in the +If standard input is not redirected with +.QW < , +.QW << +or +.QW <@ +then the standard input for the first command in the pipeline is taken from the application's current standard input. .PP -If the last \fIarg\fR is ``&'' then the pipeline will be -executed in background. +If the last \fIarg\fR is +.QW & +then the pipeline will be executed in background. In this case the \fBexec\fR command will return a list whose elements are the process identifiers for all of the subprocesses in the pipeline. The standard output from the last command in the pipeline will -go to the application's standard output if it hasn't been +go to the application's standard output if it has not been redirected, and error output from all of the commands in the pipeline will go to the application's standard error file unless redirected. @@ -183,13 +192,16 @@ in the PATH environment variable are searched for an executable by the given name. If the name contains a slash then it must refer to an executable reachable from the current directory. -No ``glob'' expansion or other shell-like substitutions +No +.QW glob +expansion or other shell-like substitutions are performed on the arguments to commands. .SH "PORTABILITY ISSUES" .TP \fBWindows\fR (all versions) . -Reading from or writing to a socket, using the ``\fB@\0\fIfileId\fR'' +Reading from or writing to a socket, using the +.QW \fB@\0\fIfileId\fR notation, does not work. When reading from a socket, a 16-bit DOS application will hang and a 32-bit application will return immediately with end-of-file. When either type of application writes to a socket, the @@ -214,9 +226,13 @@ path separator, it may or may not be recognized as a path name, depending on the program. .PP Additionally, when calling a 16-bit DOS or Windows 3.X application, all path -names must use the short, cryptic, path format (e.g., using ``applba~1.def'' -instead of ``applbakery.default''), which can be obtained with the -\fBfile attributes $fileName -shortname\fR command. +names must use the short, cryptic, path format (e.g., using +.QW applba~1.def +instead of +.QW applbakery.default ), +which can be obtained with the +.QW "\fBfile attributes \fIfileName \fB\-shortname\fR" +command. .PP Two or more forward or backward slashes in a row in a path refer to a network path. For example, a simple concatenation of the root directory @@ -274,7 +290,8 @@ The Windows NT home directory. The directories listed in the path. .PP In order to execute shell built-in commands like \fBdir\fR and \fBcopy\fR, -the caller must prepend the desired command with ``\fBcmd.exe /c\0\fR'' +the caller must prepend the desired command with +.QW "\fBcmd.exe /c\0\fR" because built-in commands are not implemented using executables. .RE .TP @@ -299,7 +316,8 @@ The Windows 9x home directory. The directories listed in the path. .PP In order to execute shell built-in commands like \fBdir\fR and \fBcopy\fR, -the caller must prepend the desired command with ``\fBcommand.com /c\0\fR'' +the caller must prepend the desired command with +.QW "\fBcommand.com /c\0\fR" because built-in commands are not implemented using executables. .PP Once a 16-bit DOS application has read standard input from a console and @@ -311,7 +329,9 @@ at this time. .PP Redirection between the \fBNUL:\fR device and a 16-bit application does not always work. When redirecting from \fBNUL:\fR, some applications may hang, -others will get an infinite stream of ``0x01'' bytes, and some will actually +others will get an infinite stream of +.QW 0x01 +bytes, and some will actually correctly get an immediate end-of-file; the behavior seems to depend upon something compiled into the application itself. When redirecting greater than 4K or so to \fBNUL:\fR, some applications will hang. The above problems do not @@ -410,7 +430,9 @@ differences in behaviour between \fBexec\fR and DOS batch files. .PP When in doubt, use the command \fBauto_execok\fR: it will return the complete path to the program as seen by the \fBexec\fR command. This -applies especially when you want to run "internal" commands like +applies especially when you want to run +.QW internal +commands like \fIdir\fR from a Tcl script (if you just want to list filenames, use the \fBglob\fR command.) To do that, use this: .CS @@ -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. '\" -'\" RCS: @(#) $Id: exit.n,v 1.7 2007/02/18 18:42:54 dkf Exp $ +'\" RCS: @(#) $Id: exit.n,v 1.8 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH exit n "" Tcl "Tcl Built-In Commands" @@ -21,7 +21,7 @@ exit \- End the application .PP Terminate the process, returning \fIreturnCode\fR to the system as the exit status. -If \fIreturnCode\fR isn't specified then it defaults +If \fIreturnCode\fR is not specified then it defaults to 0. .SH EXAMPLE Since non-zero exit codes are usually interpreted as error cases by @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: expr.n,v 1.27 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: expr.n,v 1.28 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH expr n 8.5 Tcl "Tcl Built-In Commands" @@ -203,9 +203,9 @@ precedence level. For example, the command .CE returns 0. .PP -The \fB&&\fR, \fB||\fR, and \fB?:\fR operators have ``lazy -evaluation'', just as in C, -which means that operands are not evaluated if they are +The \fB&&\fR, \fB||\fR, and \fB?:\fR operators have +.QW "lazy evaluation" , +just as in C, which means that operands are not evaluated if they are not needed to determine the outcome. For example, in the command .CS \fBexpr {$v ? [a] : [b]}\fR @@ -274,9 +274,11 @@ returns 1, while \fBexpr\fR {5 / ( [string length "abcd"] + 0.0 )} .CE both return 1.25. -Floating-point values are always returned with a ``\fB.\fR'' -or an \fBe\fR so that they will not look like integer values. For -example, +Floating-point values are always returned with a +.QW \fB.\fR +or an +.QW \fBe\fR +so that they will not look like integer values. For example, .CS \fBexpr\fR {20.0/5.0} .CE @@ -302,9 +304,9 @@ both return 1. The first comparison is done using integer comparison, and the second is done using string comparison after the second operand is converted to the string \fB18\fR. Because of Tcl's tendency to treat values as numbers whenever -possible, it isn't generally a good idea to use operators like \fB==\fR +possible, it is not generally a good idea to use operators like \fB==\fR when you really want string comparison and the values of the -operands could be arbitrary; it's better in these cases to use +operands could be arbitrary; it is better in these cases to use the \fBeq\fR or \fBne\fR operators, or the \fBstring\fR command instead. .SH "PERFORMANCE CONSIDERATIONS" .PP @@ -328,7 +330,7 @@ then the \fBexpr\fR command will evaluate the expression \fB$a + 2*4\fR. Most expressions do not require a second round of substitutions. Either they are enclosed in braces or, if not, their variable and command substitutions yield numbers or strings -that don't themselves require substitutions. +that do not themselves require substitutions. However, because a few unbraced expressions need two rounds of substitutions, the bytecode compiler must emit @@ -338,8 +340,9 @@ unbraced expressions that contain command substitutions. These expressions must be implemented by generating new code each time the expression is executed. .SH EXAMPLES -Define a procedure that computes an "interesting" mathematical -function: +Define a procedure that computes an +.QW interesting +mathematical function: .CS proc tcl::mathfunc::calc {x y} { \fBexpr\fR { ($x**2 - $y**2) / exp($x**2 + $y**2) } diff --git a/doc/fcopy.n b/doc/fcopy.n index 7441b66..30c1a8a 100644 --- a/doc/fcopy.n +++ b/doc/fcopy.n @@ -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. '\" -'\" RCS: @(#) $Id: fcopy.n,v 1.15 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: fcopy.n,v 1.16 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH fcopy n 8.0 Tcl "Tcl Built-In Commands" @@ -59,7 +59,9 @@ then all data already queued for \fIoutchan\fR is written out. Note that \fIinchan\fR can become readable during a background copy. You should turn off any \fBfileevent\fR handlers during a background copy so those handlers do not interfere with the copy. -Any I/O attempted by a \fBfileevent\fR handler will get a "channel busy" error. +Any I/O attempted by a \fBfileevent\fR handler will get a +.QW "channel busy" +error. .PP \fBFcopy\fR translates end-of-line sequences in \fIinchan\fR and \fIoutchan\fR according to the \fB\-translation\fR option @@ -79,11 +81,14 @@ UTF-8 and then into the encoding of the channel \fBfcopy\fR writes to. See the manual entry for \fBfconfigure\fR for details on the \fB\-encoding\fR and \fB\-translation\fR options. No conversion is done if both channels are -set to encoding "binary" and have matching translations. If only the -output channel is set to -encoding "binary" the system will write the internal UTF-8 -representation of the incoming characters. If only the input channel -is set to encoding "binary" the system will assume that the incoming +set to encoding +.QW binary +and have matching translations. If only the output channel is set to encoding +.QW binary +the system will write the internal UTF-8 representation of the incoming +characters. If only the input channel is set to encoding +.QW binary +the system will assume that the incoming bytes are valid UTF-8 characters and convert them according to the output encoding. The behaviour of the system for bytes which are not valid UTF-8 characters is undefined in this case. @@ -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. '\" -'\" RCS: @(#) $Id: file.n,v 1.47 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: file.n,v 1.48 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH file n 8.3 Tcl "Tcl Built-In Commands" @@ -32,7 +32,7 @@ Returns a decimal string giving the time at which file \fIname\fR was last accessed. If \fItime\fR is specified, it is an access time to set for the file. The time is measured in the standard POSIX fashion as seconds from a fixed starting time (often January 1, 1970). If the file -doesn't exist or its access time cannot be queried or set then an error is +does not exist or its access time cannot be queried or set then an error is generated. On Windows, FAT file systems do not support access time. .TP \fBfile attributes \fIname\fR @@ -84,7 +84,7 @@ off the file. .TP \fBfile channels ?\fIpattern\fR? . -If \fIpattern\fR isn't specified, returns a list of names of all +If \fIpattern\fR is not specified, returns a list of names of all registered open channels in this interpreter. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. @@ -122,7 +122,9 @@ Trying to delete a non-existent file is not considered an error. Trying to delete a read-only file will cause the file to be deleted, even if the \fB\-force\fR flags is not specified. If the \fB\-force\fR option is specified on a directory, Tcl will attempt both to change -permissions and move the current directory 'pwd' out of the given path +permissions and move the current directory +.QW pwd +out of the given path if that is necessary to allow the deletion to proceed. Arguments are processed in the order specified, halting at the first error, if any. A \fB\-\|\-\fR marks the end of switches; the argument following the @@ -132,7 +134,9 @@ a \fB\-\fR. \fBfile dirname \fIname\fR Returns a name comprised of all of the path components in \fIname\fR excluding the last element. If \fIname\fR is a relative file name and -only contains one path element, then returns ``\fB.\fR''. If \fIname\fR +only contains one path element, then returns +.QW \fB.\fR . +If \fIname\fR refers to a root directory, then the root directory is returned. For example, .RS @@ -200,31 +204,37 @@ Windows. If only one argument is given, that argument is assumed to be \fIlinkName\fR, and this command returns the value of the link given by \fIlinkName\fR (i.e. the name of the file it points to). If -\fIlinkName\fR isn't a link or its value cannot be read (as, for example, +\fIlinkName\fR is not a link or its value cannot be read (as, for example, seems to be the case with hard links, which look just like ordinary files), then an error is returned. -. +.RS +.PP If 2 arguments are given, then these are assumed to be \fIlinkName\fR and \fItarget\fR. If \fIlinkName\fR already exists, or if \fItarget\fR -doesn't exist, an error will be returned. Otherwise, Tcl creates a new +does not exist, an error will be returned. Otherwise, Tcl creates a new link called \fIlinkName\fR which points to the existing filesystem object at \fItarget\fR (which is also the returned value), where the type of the link is platform-specific (on Unix a symbolic link will be the default). This is useful for the case where the user wishes to -create a link in a cross-platform way, and doesn't care what type of +create a link in a cross-platform way, and does not care what type of link is created. -. +.PP If the user wishes to make a link of a specific type only, (and signal an error if for some reason that is not possible), then the optional -\fI-linktype\fR argument should be given. Accepted values for -\fI-linktype\fR are "-symbolic" and "-hard". -. +\fI\-linktype\fR argument should be given. Accepted values for +\fI\-linktype\fR are +.QW \-symbolic +and +.QW \-hard . +.PP On Unix, symbolic links can be made to relative paths, and those paths must be relative to the actual \fIlinkName\fR's location (not to the cwd), but on all other platforms where relative links are not supported, target paths will always be converted to absolute, normalized form before the link is created (and therefore relative paths are interpreted -as relative to the cwd). Furthermore, "~user" paths are always expanded +as relative to the cwd). Furthermore, +.QW ~user +paths are always expanded to absolute form. When creating links on filesystems that either do not support any links, or do not support the specific type requested, an error message will be returned. In particular Windows 95, 98 and ME do @@ -232,6 +242,7 @@ not support any links at present, but most Unix platforms support both symbolic and hard links (the latter for files only) and Windows NT/2000/XP (on NTFS drives) support symbolic directory links and hard file links. +.RE .TP \fBfile lstat \fIname varName\fR . @@ -239,7 +250,7 @@ Same as \fBstat\fR option (see below) except uses the \fIlstat\fR kernel call instead of \fIstat\fR. This means that if \fIname\fR refers to a symbolic link the information returned in \fIvarName\fR is for the link rather than the file it refers to. On systems that -don't support symbolic links this option behaves exactly the same +do not support symbolic links this option behaves exactly the same as the \fBstat\fR option. .TP \fBfile mkdir \fIdir\fR ?\fIdir\fR ...? @@ -257,7 +268,7 @@ Returns a decimal string giving the time at which file \fIname\fR was last modified. If \fItime\fR is specified, it is a modification time to set for the file (equivalent to Unix \fBtouch\fR). The time is measured in the standard POSIX fashion as seconds from a fixed starting time (often January -1, 1970). If the file doesn't exist or its modified time cannot be queried +1, 1970). If the file does not exist or its modified time cannot be queried or set then an error is generated. .TP \fBfile nativename \fIname\fR @@ -272,16 +283,20 @@ under Windows. Returns a unique normalized path representation for the file-system object (file, directory, link, etc), whose string value can be used as a unique identifier for it. A normalized path is an absolute path which has -all '../', './' removed. Also it is one which is in the ``standard'' +all +.QW ../ , +.QW ./ +removed. Also it is one which is in the +.QW standard format for the native platform. On Unix, this means the segments leading up to the path must be free of symbolic links/aliases (but the very last path component may be a symbolic link), and on Windows it also means we want the long form with that form's case-dependence (which gives us a unique, case-dependent path). The one exception concerning the last link in the path is necessary, because Tcl or the user may wish to -operate on the actual symbolic link itself (for example 'file delete', 'file -rename', 'file copy' are defined to operate on symbolic links, not on the -things that they point to). +operate on the actual symbolic link itself (for example \fBfile delete\fR, +\fBfile rename\fR, \fBfile copy\fR are defined to operate on symbolic +links, not on the things that they point to). .RE .TP \fBfile owned \fIname\fR @@ -307,8 +322,8 @@ Returns \fB1\fR if file \fIname\fR is readable by the current user, \fBfile readlink \fIname\fR . Returns the value of the symbolic link given by \fIname\fR (i.e. the name -of the file it points to). If \fIname\fR isn't a symbolic link or its -value cannot be read, then an error is returned. On systems that don't +of the file it points to). If \fIname\fR is not a symbolic link or its +value cannot be read, then an error is returned. On systems that do not support symbolic links this option is undefined. .TP \fBfile rename \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR \fItarget\fR @@ -334,8 +349,10 @@ switches; the argument following the \fB\-\|\-\fR will be treated as a \fBfile rootname \fIname\fR . Returns all of the characters in \fIname\fR up to but not including the -last ``.'' character in the last component of name. If the last -component of \fIname\fR doesn't contain a dot, then returns \fIname\fR. +last +.QW . +character in the last component of name. If the last +component of \fIname\fR does not contain a dot, then returns \fIname\fR. .TP \fBfile separator\fR ?\fIname\fR? . @@ -348,7 +365,7 @@ is generated. \fBfile size \fIname\fR . Returns a decimal string giving the size of file \fIname\fR in bytes. If -the file doesn't exist or its size cannot be queried then an error is +the file does not exist or its size cannot be queried then an error is generated. .TP \fBfile split \fIname\fR @@ -388,12 +405,20 @@ the filesystem to use for the file, and the second, if given, an arbitrary string representing the filesystem-specific nature or type of the location within that filesystem. If a filesystem only supports one type of file, the second element may not be supplied. For example the -native files have a first element 'native', and a second element which +native files have a first element +.QW native , +and a second element which when given is a platform-specific type name for the file's system -(e.g. 'NTFS', 'FAT', on Windows). A generic virtual file system might return -the list 'vfs ftp' to represent a file on a remote ftp site mounted as a -virtual filesystem through an extension called 'vfs'. If the file does -not belong to any filesystem, an error is generated. +(e.g. +.QW NTFS , +.QW FAT , +on Windows). A generic virtual file system might return +the list +.QW "vfs ftp" +to represent a file on a remote ftp site mounted as a +virtual filesystem through an extension called +.QW vfs . +If the file does not belong to any filesystem, an error is generated. .TP \fBfile tail \fIname\fR . @@ -410,13 +435,16 @@ Returns a string giving the type of file \fIname\fR, which will be one of \fBfifo\fR, \fBlink\fR, or \fBsocket\fR. .TP \fBfile volumes\fR -. +. Returns the absolute paths to the volumes mounted on the system, as a proper Tcl list. Without any virtual filesystems mounted as root -volumes, on UNIX, the command will always return "/", since all -filesystems are locally mounted. +volumes, on UNIX, the command will always return +.QW / , +since all filesystems are locally mounted. On Windows, it will return a list of the available local drives -(e.g. {a:/ c:/}). If any virtual filesystem has mounted additional +(e.g. +.QW "a:/ c:/" ). +If any virtual filesystem has mounted additional volumes, they will be in the returned list. .TP \fBfile writable \fIname\fR @@ -469,7 +497,6 @@ if {![\fBfile isdirectory\fR [\fBfile dirname\fR $newName]]} { \fBfile rename\fR $oldName $newName \fBfile link\fR -symbolic $oldName $newName .CE - .SH "SEE ALSO" chan(n), close(n), eof(n), fblocked(n), filename(n), flush(n), gets(n), open(n), seek(n), tell(n) diff --git a/doc/fileevent.n b/doc/fileevent.n index 6d3bc19..f654cfa 100644 --- a/doc/fileevent.n +++ b/doc/fileevent.n @@ -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. '\" -'\" RCS: @(#) $Id: fileevent.n,v 1.11 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: fileevent.n,v 1.12 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH fileevent n 7.5 Tcl "Tcl Built-In Commands" @@ -30,9 +30,11 @@ interact with the user while waiting for the data to arrive. If an application invokes \fBgets\fR or \fBread\fR on a blocking channel when there is no input data available, the process will block; until the input data arrives, it will not be able to service other events, so it will -appear to the user to ``freeze up''. With \fBfileevent\fR, the process can +appear to the user to +.QW "freeze up" . +With \fBfileevent\fR, the process can tell when data is present and only invoke \fBgets\fR or \fBread\fR when -they won't block. +they will not block. .PP The \fIchannelId\fR argument to \fBfileevent\fR refers to an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, diff --git a/doc/filename.n b/doc/filename.n index 8f70f1f..2c2c68d 100644 --- a/doc/filename.n +++ b/doc/filename.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: filename.n,v 1.17 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: filename.n,v 1.18 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH filename n 7.5 Tcl "Tcl Built-In Commands" @@ -146,7 +146,9 @@ Not all file systems are case sensitive, so scripts should avoid code that depends on the case of characters in a file name. In addition, the character sets allowed on different devices may differ, so scripts should choose file names that do not contain special characters like: -\fB<>:?"/\e|\fR. The safest approach is to use names consisting of +\fB<>:?"/\e|\fR. +'\""\" reset emacs highlighting +The safest approach is to use names consisting of alphanumeric characters only. Care should be taken with filenames which contain spaces (common on Windows systems) and filenames where the backslash is the directory separator (Windows @@ -158,13 +160,19 @@ On Windows platforms there are file and path length restrictions. Complete paths or filenames longer than about 260 characters will lead to errors in most file operations. .PP -Another Windows peculiarity is that any number of trailing dots '.' in -filenames are totally ignored, so, for example, attempts to create a -file or directory with a name "foo." will result in the creation of a -file/directory with name "foo". This fact is reflected in the -results of 'file normalize'. Furthermore, a file name consisting only -of dots '.........' or dots with trailing characters '.....abc' is -illegal. +Another Windows peculiarity is that any number of trailing dots +.QW . +in filenames are totally ignored, so, for example, attempts to create a +file or directory with a name +.QW foo. +will result in the creation of a file/directory with name +.QW foo . +This fact is reflected in the results of \fBfile normalize\fR. +Furthermore, a file name consisting only of dots +.QW ......... +or dots with trailing characters +.QW .....abc +is illegal. .SH KEYWORDS current directory, absolute file name, relative file name, volume-relative file name, portability @@ -5,14 +5,14 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: for.n,v 1.7 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: for.n,v 1.8 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH for n "" Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME -for \- ``For'' loop +for \- 'For' loop .SH SYNOPSIS \fBfor \fIstart test next body\fR .BE diff --git a/doc/format.n b/doc/format.n index eae486d..51c3160 100644 --- a/doc/format.n +++ b/doc/format.n @@ -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. '\" -'\" RCS: @(#) $Id: format.n,v 1.18 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: format.n,v 1.19 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH format n 8.1 Tcl "Tcl Built-In Commands" @@ -50,8 +50,8 @@ The fields that are present must appear in the order given above. The paragraphs below discuss each of these fields in turn. .PP If the \fB%\fR is followed by a decimal number and a \fB$\fR, as in -``\fB%2$d\fR'', then the value to convert is not taken from the -next sequential argument. +.QW \fB%2$d\fR , +then the value to convert is not taken from the next sequential argument. Instead, it is taken from the argument indicated by the number, where 1 corresponds to the first \fIarg\fR. If the conversion specifier requires multiple arguments because @@ -75,8 +75,8 @@ Specifies that a number should always be printed with a sign, even if positive. .TP 10 \fIspace\fR -Specifies that a space should be added to the beginning of the -number if the first character isn't a sign. +Specifies that a space should be added to the beginning of the +number if the first character is not a sign. .TP 10 \fB0\fR Specifies that the number should be padded on the left with @@ -156,7 +156,10 @@ Convert integer to unsigned octal string. .TP 10 \fBx\fR or \fBX\fR Convert integer to unsigned hexadecimal string, using digits -``0123456789abcdef'' for \fBx\fR and ``0123456789ABCDEF'' for \fBX\fR). +.QW 0123456789abcdef +for \fBx\fR and +.QW 0123456789ABCDEF +for \fBX\fR). .TP 10 \fBc\fR Convert integer to the Unicode character it represents. @@ -254,9 +257,7 @@ for {set i 0} {$i<=20} {incr i} { # Finish off by printing the separator again puts $sep .CE - .SH "SEE ALSO" scan(n), sprintf(3), string(n) - .SH KEYWORDS conversion specifier, format, sprintf, string, substitution @@ -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. '\" -'\" RCS: @(#) $Id: glob.n,v 1.20 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: glob.n,v 1.21 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH glob n 8.3 Tcl "Tcl Built-In Commands" @@ -19,7 +19,9 @@ glob \- Return names of files that match patterns .SH DESCRIPTION .PP -This command performs file name ``globbing'' in a fashion similar to +This command performs file name +.QW globbing +in a fashion similar to the csh shell. It returns a list of the files whose names match any of the \fIpattern\fR arguments. No particular order is guaranteed in the list, so if a sorted list is required the caller should use @@ -101,8 +103,9 @@ The following are equivalent: \fBglob */\fR .CE .RE -except that the first case doesn't return the trailing ``/'' and -is more platform independent. +except that the first case doesn't return the trailing +.QW / +and is more platform independent. .RE .TP \fB\-\|\-\fR @@ -129,20 +132,35 @@ Matches the character \fIx\fR. \fB{\fIa\fB,\fIb\fB,\fI...\fR} Matches any of the strings \fIa\fR, \fIb\fR, etc. .LP -On Unix, as with csh, a ``.'' at the beginning of a file's name or just -after a ``/'' must be matched explicitly or with a {} construct, -unless the ``-types hidden'' flag is given (since ``.'' at the beginning -of a file's name indicates that it is hidden). On other platforms, -files beginning with a ``.'' are handled no differently to any others, -except the special directories ``.'' and ``..'' which must be matched -explicitly (this is to avoid a recursive pattern like ``glob -join * * -* *'' from recursing up the directory hierarchy as well as down). -In addition, all ``/'' characters must be matched explicitly. +On Unix, as with csh, a +.QW . +at the beginning of a file's name or just after a +.QW / +must be matched explicitly or with a {} construct, unless the +\fB\-types hidden\fR flag is given (since +.QW . +at the beginning of a file's name indicates that it is hidden). On +other platforms, files beginning with a +.QW . +are handled no differently to any others, except the special directories +.QW . +and +.QW .. +which must be matched explicitly (this is to avoid a recursive pattern like +.QW "glob -join * * * *" +from recursing up the directory hierarchy as well as down). In addition, all +.QW / +characters must be matched explicitly. .LP -If the first character in a \fIpattern\fR is ``~'' then it refers -to the home directory for the user whose name follows the ``~''. -If the ``~'' is followed immediately by ``/'' then the value of -the HOME environment variable is used. +If the first character in a \fIpattern\fR is +.QW ~ +then it refers to the home directory for the user whose name follows the +.QW ~ . +If the +.QW ~ +is followed immediately by +.QW / +then the value of the HOME environment variable is used. .LP The \fBglob\fR command differs from csh globbing in two ways. First, it does not sort its result list (use the \fBlsort\fR @@ -152,9 +170,12 @@ exist; in csh no check for existence is made unless a pattern contains a ?, *, or [] construct. .LP When the \fBglob\fR command returns relative paths whose filenames -start with a tilde ``~'' (for example through \fBglob *\fR or -\fBglob -tails\fR, the returned list will not quote the tilde with -``./''. This means care must be taken if those names are later to +start with a tilde +.QW ~ +(for example through \fBglob *\fR or \fBglob -tails\fR, the returned +list will not quote the tilde with +.QW ./ . +This means care must be taken if those names are later to be used with \fBfile join\fR, to avoid them being interpreted as absolute paths pointing to a given user's home directory. .SH "PORTABILITY ISSUES" @@ -163,13 +184,18 @@ absolute paths pointing to a given user's home directory. . For Windows UNC names, the servername and sharename components of the path may not contain ?, *, or [] constructs. On Windows NT, if \fIpattern\fR is -of the form ``\fB~\fIusername\fB@\fIdomain\fR'' it refers to the home +of the form +.QW \fB~\fIusername\fB@\fIdomain\fR , +it refers to the home directory of the user whose account information resides on the specified NT domain server. Otherwise, user account information is obtained from the local computer. On Windows 95 and 98, \fBglob\fR accepts patterns -like ``.../'' and ``..../'' for successively higher up parent directories. - -. +like +.QW .../ +and +.QW ..../ +for successively higher up parent directories. +.PP Since the backslash character has a special meaning to the glob command, glob patterns containing Windows style path separators need special care. The pattern \fIC:\e\efoo\e\e*\fR is interpreted as @@ -196,7 +222,12 @@ Find all subdirectories of the current directory: \fBglob\fR \-type d * .CE .PP -Find all files whose name contains an "a", a "b" or the sequence "cde": +Find all files whose name contains an +.QW a , +a +.QW b +or the sequence +.QW cde : .CS \fBglob\fR \-type f *{a,b,cde}* .CE diff --git a/doc/history.n b/doc/history.n index b27c485..0c87ef5 100644 --- a/doc/history.n +++ b/doc/history.n @@ -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. '\" -'\" RCS: @(#) $Id: history.n,v 1.6 2007/10/26 20:11:52 dgp Exp $ +'\" RCS: @(#) $Id: history.n,v 1.7 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH history n "" Tcl "Tcl Built-In Commands" @@ -16,13 +16,13 @@ history \- Manipulate the history list .SH SYNOPSIS \fBhistory \fR?\fIoption\fR? ?\fIarg arg ...\fR? .BE - .SH DESCRIPTION .PP The \fBhistory\fR command performs one of several operations related to recently-executed commands recorded in a history list. Each of -these recorded commands is referred to as an ``event''. When -specifying an event to the \fBhistory\fR command, the following +these recorded commands is referred to as an +.QW event . +When specifying an event to the \fBhistory\fR command, the following forms may be used: .IP [1] A number: if positive, it refers to the event with @@ -45,7 +45,7 @@ as \fBhistory info\fR, described below. \fBhistory add\fI command \fR?\fBexec\fR? Adds the \fIcommand\fR argument to the history list as a new event. If \fBexec\fR is specified (or abbreviated) then the command is also -executed and its result is returned. If \fBexec\fR isn't specified +executed and its result is returned. If \fBexec\fR is not specified then an empty string is returned as result. .TP \fBhistory change\fI newValue\fR ?\fIevent\fR? @@ -92,13 +92,13 @@ The current mechanism is more limited, and the old history operations \fBsubstitute\fR and \fBwords\fR have been removed. (As a consolation, the \fBclear\fR operation was added.) .PP -The history option \fBredo\fR results in much simpler ``history revision''. +The history option \fBredo\fR results in much simpler +.QW "history revision" . When this option is invoked then the most recent event is modified to eliminate the history command and replace it with the result of the history command. If you want to redo an event without modifying history, then use the \fBevent\fR operation to retrieve some event, and the \fBadd\fR operation to add it to history and execute it. - .SH KEYWORDS event, history, record @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: http.n,v 1.28 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: http.n,v 1.29 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH "http" n 2.5 http "Tcl Bundled Packages" @@ -16,6 +16,7 @@ http \- Client-side implementation of the HTTP/1.0 protocol .SH SYNOPSIS \fBpackage require http ?2.5?\fR +.\" See Also -useragent option documentation in body! .sp \fB::http::config \fI?options?\fR .sp @@ -45,7 +46,6 @@ http \- Client-side implementation of the HTTP/1.0 protocol .sp \fB::http::unregister \fIproto\fR .BE - .SH DESCRIPTION .PP The \fBhttp\fR package provides the client side of the HTTP/1.0 @@ -89,7 +89,8 @@ flags and values that define the configuration: The Accept header of the request. The default is */*, which means that all types of documents are accepted. Otherwise you can supply a comma-separated list of mime type patterns that you are -willing to receive. For example, "image/gif, image/jpeg, text/*". +willing to receive. For example, +.QW "image/gif, image/jpeg, text/*" . .TP \fB\-proxyhost\fR \fIhostname\fR The name of the proxy host, if any. If this value is the @@ -119,8 +120,8 @@ returned by specifying the empty string (\fB{}\fR), although characters. .TP \fB\-useragent\fR \fIstring\fR -The value of the User-Agent header in the HTTP request. The default -is \fB"Tcl http client package 2.4."\fR +The value of the User-Agent header in the HTTP request. The default is +.QW "\fBTcl http client package 2.5\fR" . .RE .TP \fB::http::geturl\fR \fIurl\fR ?\fIoptions\fR? @@ -281,10 +282,10 @@ any. This sets the \fBstate(status)\fR value to \fIwhy\fR, which defaults to \f \fB::http::wait\fR \fItoken\fR This is a convenience procedure that blocks and waits for the transaction to complete. This only works in trusted code because it -uses \fBvwait\fR. Also, it's not useful for the case where +uses \fBvwait\fR. Also, it is not useful for the case where \fB::http::geturl\fR is called \fIwithout\fR the \fB-command\fR option -because in this case the \fB::http::geturl\fR call doesn't return -until the HTTP transaction is complete, and thus there's nothing to +because in this case the \fB::http::geturl\fR call does not return +until the HTTP transaction is complete, and thus there is nothing to wait for. .TP \fB::http::data\fR \fItoken\fR @@ -317,7 +318,7 @@ This procedure cleans up the state associated with the connection identified by \fItoken\fR. After this call, the procedures like \fB::http::data\fR cannot be used to get information about the operation. It is \fIstrongly\fR recommended that you call -this function after you're done with a given HTTP request. Not doing +this function after you are done with a given HTTP request. Not doing so will result in memory not being freed, and if your app calls \fB::http::geturl\fR enough times, the memory leak could cause a performance hit...or worse. @@ -340,8 +341,7 @@ set token [::http::geturl https://my.secure.site/] \fB::http::unregister\fR \fIproto\fR This procedure unregisters a protocol handler that was previously registered via \fB::http::register\fR. - -.SH "ERRORS" +.SH ERRORS The \fB::http::geturl\fR procedure will raise errors in the following cases: invalid command line options, an invalid URL, @@ -354,13 +354,12 @@ writing out the HTTP request header. For synchronous \fB::http::geturl\fR calls (where \fB-command\fR is not specified), it will raise an error if it gets an I/O error while reading the HTTP reply headers or data. Because \fB::http::geturl\fR -doesn't return a token in these cases, it does all the required -cleanup and there's no issue of your app having to call +does not return a token in these cases, it does all the required +cleanup and there is no issue of your app having to call \fB::http::cleanup\fR. .PP For asynchronous \fB::http::geturl\fR calls, all of the above error -situations apply, except that if there's any error while -reading the +situations apply, except that if there is any error while reading the HTTP reply headers or data, no exception is thrown. This is because after writing the HTTP headers, \fB::http::geturl\fR returns, and the rest of the HTTP transaction occurs in the background. The command @@ -374,7 +373,7 @@ to know the result of the asynchronous HTTP request, it can call callback does. .PP In any case, you must still call -\fB::http::cleanup\fR to delete the state array when you're done. +\fB::http::cleanup\fR to delete the state array when you are done. .PP There are other possible results of the HTTP transaction determined by examining the status from \fB::http::status\fR. @@ -385,7 +384,8 @@ If the HTTP transaction completes entirely, then status will be \fBok\fR. However, you should still check the \fB::http::code\fR value to get the HTTP status. The \fB::http::ncode\fR procedure provides just the numeric error (e.g., 200, 404 or 500) while the \fB::http::code\fR -procedure returns a value like "HTTP 404 File not found". +procedure returns a value like +.QW "HTTP 404 File not found" . .TP eof If the server closes the socket without replying, then no error @@ -404,7 +404,6 @@ transaction. If it can read the server's response it will end up with an \fBok\fR status, otherwise it will have an \fBeof\fR status. - .SH "STATE ARRAY" The \fB::http::geturl\fR procedure returns a \fItoken\fR that can be used to get to the state of the HTTP transaction in the form of a Tcl array. @@ -534,9 +533,7 @@ proc httpCopyProgress {args} { flush stderr } .CE - .SH "SEE ALSO" safe(n), socket(n), safesock(n) - .SH KEYWORDS security policy, socket @@ -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. '\" -'\" RCS: @(#) $Id: if.n,v 1.7 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: if.n,v 1.8 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH if n "" Tcl "Tcl Built-In Commands" @@ -32,7 +32,8 @@ then \fBbody2\fR is executed, and so on. If none of the expressions evaluates to true then \fIbodyN\fR is executed. The \fBthen\fR and \fBelse\fR arguments are optional -``noise words'' to make the command easier to read. +.QW "noise words" +to make the command easier to read. There may be any number of \fBelseif\fR clauses, including zero. \fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too. The return value from the command is the result of the body script @@ -7,7 +7,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: info.n,v 1.21 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: info.n,v 1.22 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH info n 8.4 Tcl "Tcl Built-In Commands" @@ -23,7 +23,7 @@ info \- Return information about the state of the Tcl interpreter .PP This command provides information about various internals of the Tcl interpreter. -The legal \fIoption\fR's (which may be abbreviated) are: +The legal \fIoption\fRs (which may be abbreviated) are: .TP \fBinfo args \fIprocname\fR Returns a list containing the names of the arguments to procedure @@ -39,8 +39,8 @@ Returns a count of the total number of commands that have been invoked in this interpreter. .TP \fBinfo commands \fR?\fIpattern\fR? -If \fIpattern\fR isn't specified, -'\" Do not move this .VS above the .TP +If \fIpattern\fR is not specified, +.\" Do not move this .VS above the .TP .VS 8.5 returns a list of names of all the Tcl commands visible (i.e. executable without using a qualified name) to the current namespace, @@ -58,23 +58,23 @@ If \fIpattern\fR is a qualified name, the resulting list of command names has each one qualified with the name of the specified namespace, and only the commands defined in the named namespace are returned. -'\" Technically, most of this hasn't changed; that's mostly just the -'\" way it always worked. Hardly anyone knew that though. +.\" Technically, most of this hasn't changed; that's mostly just the +.\" way it always worked. Hardly anyone knew that though. .VE 8.5 .TP \fBinfo complete \fIcommand\fR Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of having no unclosed quotes, braces, brackets or array element names. -If the command doesn't appear to be complete then 0 is returned. +If the command does not appear to be complete then 0 is returned. This command is typically used in line-oriented input environments to allow users to type in commands that span multiple lines; if the -command isn't complete, the script can delay evaluating it until additional +command is not complete, the script can delay evaluating it until additional lines have been typed to complete the command. .TP \fBinfo default \fIprocname arg varname\fR \fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR must be the name of an argument to that procedure. If \fIarg\fR -doesn't have a default value then the command returns \fB0\fR. +does not have a default value then the command returns \fB0\fR. Otherwise it returns \fB1\fR and places the default value of \fIarg\fR into variable \fIvarname\fR. .TP @@ -98,12 +98,16 @@ gives a level relative to the current command (0 refers to the current command, i.e., \fBinfo frame\fR itself, -1 to its caller, and so on). .sp This is similar to how \fBinfo level\fR works, except that this -subcommand reports all frames, like \fBsource\fR'd scripts, -\fBeval\fR's, \fBuplevel\fR's, etc. +subcommand reports all frames, like \fBsource\fRd scripts, +\fBeval\fRs, \fBuplevel\fRs, etc. .sp -Note that for nested commands, like "foo [[bar [[x]]]]" only "x" will -be seen by an \fBinfo frame\fR invoked within "x". This is the same as -for \fBinfo level\fR and error stack traces. +Note that for nested commands, like +.QW "foo [[bar [[x]]]]" , +only +.QW x +will be seen by an \fBinfo frame\fR invoked within +.QW x . +This is the same as for \fBinfo level\fR and error stack traces. .sp The result dictionary may contain the keys listed below, with the specified meanings for their values: @@ -189,14 +193,14 @@ counted relative to the start of each word (smallest scope) .RE .TP \fBinfo functions \fR?\fIpattern\fR? -If \fIpattern\fR isn't specified, returns a list of all the math +If \fIpattern\fR is not specified, returns a list of all the math functions currently defined. If \fIpattern\fR is specified, only those functions whose name matches \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring match\fR. .TP \fBinfo globals \fR?\fIpattern\fR? -If \fIpattern\fR isn't specified, returns a list of all the names +If \fIpattern\fR is not specified, returns a list of all the names of currently-defined global variables. Global variables are variables in the global namespace. If \fIpattern\fR is specified, only those names matching \fIpattern\fR @@ -245,7 +249,7 @@ To get a list of just the packages in the current interpreter, specify an empty string for the \fIinterp\fR argument. .TP \fBinfo locals \fR?\fIpattern\fR? -If \fIpattern\fR isn't specified, returns a list of all the names +If \fIpattern\fR is not specified, returns a list of all the names of currently-defined local variables, including arguments to the current procedure, if any. Variables defined with the \fBglobal\fR, \fBupvar\fR and @@ -264,7 +268,7 @@ Returns the value of the global variable \fBtcl_patchLevel\fR; see the \fBtclvars\fR manual entry for more information. .TP \fBinfo procs \fR?\fIpattern\fR? -If \fIpattern\fR isn't specified, returns a list of all the +If \fIpattern\fR is not specified, returns a list of all the names of Tcl command procedures in the current namespace. If \fIpattern\fR is specified, only those procedure names in the current namespace @@ -290,7 +294,7 @@ Otherwise the command returns an empty string. \fBinfo sharedlibextension\fR Returns the extension used on this platform for the names of files containing shared libraries (for example, \fB.so\fR under Solaris). -If shared libraries aren't supported on this platform then an empty +If shared libraries are not supported on this platform then an empty string is returned. .TP \fBinfo tclversion\fR @@ -298,7 +302,7 @@ Returns the value of the global variable \fBtcl_version\fR; see the \fBtclvars\fR manual entry for more information. .TP \fBinfo vars\fR ?\fIpattern\fR? -If \fIpattern\fR isn't specified, +If \fIpattern\fR is not specified, returns a list of all the names of currently-visible variables. This includes locals and currently-visible globals. If \fIpattern\fR is specified, only those names matching \fIpattern\fR @@ -313,7 +317,9 @@ If \fIpattern\fR is a qualified name, the resulting list of variable names has each matching namespace variable qualified with the name of its namespace. -Note that a currently-visible variable may not yet "exist" if it has not +Note that a currently-visible variable may not yet +.QW exist +if it has not been set (e.g. a variable declared but not set by \fBvariable\fR). .SH EXAMPLE This command prints out a procedure suitable for saving in a Tcl @@ -339,7 +345,6 @@ proc printProc {procName} { global(n), proc(n) .SH KEYWORDS command, information, interpreter, level, namespace, procedure, variable - -'\" Local Variables: -'\" mode: nroff -'\" End: +.\" Local Variables: +.\" mode: nroff +.\" End: diff --git a/doc/interp.n b/doc/interp.n index 852b84a..3a48cfd 100644 --- a/doc/interp.n +++ b/doc/interp.n @@ -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. '\" -'\" RCS: @(#) $Id: interp.n,v 1.31 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: interp.n,v 1.32 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH interp n 7.6 Tcl "Tcl Built-In Commands" @@ -16,7 +16,6 @@ interp \- Create and manipulate Tcl interpreters .SH SYNOPSIS \fBinterp \fIoption \fR?\fIarg arg ...\fR? .BE - .SH DESCRIPTION .PP This command makes it possible to create one or more new Tcl @@ -107,7 +106,9 @@ may be anywhere in the hierarchy of interpreters under the interpreter invoking the command. \fISrcPath\fR and \fIsrcCmd\fR identify the source of the alias. \fISrcPath\fR is a Tcl list whose elements select a particular -interpreter. For example, ``\fBa b\fR'' identifies an interpreter +interpreter. For example, +.QW "\fBa b\fR" +identifies an interpreter \fBb\fR, which is a slave of interpreter \fBa\fR, which is a slave of the invoking interpreter. An empty list specifies the interpreter invoking the command. \fIsrcCmd\fR gives the name of a new @@ -568,9 +569,10 @@ as they would be for any other command invoked in that interpreter. The command procedure for the source command takes its arguments and merges them with the \fItargetCmd\fR and \fIarg\fRs for the alias to create a new array of arguments. If the words -of \fIsrcCmd\fR were ``\fIsrcCmd arg1 arg2 ... argN\fR'', +of \fIsrcCmd\fR were +.QW "\fIsrcCmd arg1 arg2 ... argN\fR" , the new set of words will be -``\fItargetCmd arg arg ... arg arg1 arg2 ... argN\fR'', +.QW "\fItargetCmd arg arg ... arg arg1 arg2 ... argN\fR" , where \fItargetCmd\fR and \fIarg\fRs are the values supplied when the alias was created. \fITargetCmd\fR is then used to locate a command procedure in the target interpreter, and that command procedure @@ -789,7 +791,6 @@ set i [\fBinterp create\fR] } .CE .VE 8.5 - .SH "SEE ALSO" bgerror(n), load(n), safe(n), Tcl_CreateSlave(3) .SH KEYWORDS diff --git a/doc/lappend.n b/doc/lappend.n index 7a20649..f195cbd 100644 --- a/doc/lappend.n +++ b/doc/lappend.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lappend.n,v 1.13 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lappend.n,v 1.14 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH lappend n "" Tcl "Tcl Built-In Commands" @@ -23,14 +23,16 @@ lappend \- Append list elements onto a variable This command treats the variable given by \fIvarName\fR as a list and appends each of the \fIvalue\fR arguments to that list as a separate element, with spaces between elements. -If \fIvarName\fR doesn't exist, it is created as a list with elements +If \fIvarName\fR does not exist, it is created as a list with elements given by the \fIvalue\fR arguments. \fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs are appended as list elements rather than raw text. This command provides a relatively efficient way to build up -large lists. For example, ``\fBlappend a $b\fR'' is much -more efficient than ``\fBset a [concat $a [list $b]]\fR'' when -\fB$a\fR is long. +large lists. For example, +.QW "\fBlappend a $b\fR" +is much more efficient than +.QW "\fBset a [concat $a [list $b]]\fR" +when \fB$a\fR is long. .SH EXAMPLE Using \fBlappend\fR to build up a list of numbers. .CS diff --git a/doc/lassign.n b/doc/lassign.n index b01f308..ce47c18 100644 --- a/doc/lassign.n +++ b/doc/lassign.n @@ -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. '\" -'\" RCS: @(#) $Id: lassign.n,v 1.3 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lassign.n,v 1.4 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH lassign n 8.5 Tcl "Tcl Built-In Commands" @@ -44,7 +44,9 @@ puts $x ;# Prints "f" puts $y ;# Prints "g" .CE The \fBlassign\fR command has other uses. It can be used to create -the analogue of the "shift" command in many shell languages like this: +the analogue of the +.QW shift +command in many shell languages like this: .CS set ::argv [lassign $::argv argumentToReadOff] .CE diff --git a/doc/library.n b/doc/library.n index faf9ec8..886b561 100644 --- a/doc/library.n +++ b/doc/library.n @@ -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. '\" -'\" RCS: @(#) $Id: library.n,v 1.20 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: library.n,v 1.21 2007/10/29 01:42:18 dkf Exp $ .so man.macros .TH library n "8.0" Tcl "Tcl Built-In Commands" .BS @@ -28,7 +28,6 @@ auto_execok, auto_import, auto_load, auto_mkindex, auto_mkindex_old, auto_qualif \fBtcl_wordBreakAfter \fIstr start\fR \fBtcl_wordBreakBefore \fIstr start\fR .BE - .SH INTRODUCTION .PP Tcl includes a library of Tcl procedures for commonly-needed functions. @@ -54,7 +53,6 @@ If the library procedure \fBTcl_Init\fR is invoked from an application's The code in \fBinit.tcl\fR will define the \fBunknown\fR procedure and arrange for the other procedures to be loaded on-demand using the auto-load mechanism defined below. - .SH "COMMAND PROCEDURES" .PP The following procedures are provided in the Tcl library: @@ -97,7 +95,7 @@ with the \fBauto_mkindex\fR command. If \fIcmd\fR is found in an index file, then the appropriate script is evaluated to create the command. The \fBauto_load\fR command returns 1 if \fIcmd\fR was successfully created. The command returns 0 if there was no index -entry for \fIcmd\fR or if the script didn't actually define \fIcmd\fR +entry for \fIcmd\fR or if the script did not actually define \fIcmd\fR (e.g. because index information is out of date). If an error occurs while processing the script, then that error is returned. \fBAuto_load\fR only reads the index information once and saves it in @@ -135,9 +133,11 @@ unsophisticated way: if any line contains the word \fBproc\fR 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 this way (e.g. they +Procedure definitions that do not appear in this way (e.g. they have spaces before the \fBproc\fR) will not be indexed. If your -script contains "dangerous" code, such as global initialization +script contains +.QW dangerous +code, such as global initialization code or procedure names with special characters like \fB$\fR, \fB*\fR, \fB[\fR or \fB]\fR, you are safer using auto_mkindex_old. .RE @@ -147,7 +147,7 @@ Destroys all the information cached by \fBauto_execok\fR and \fBauto_load\fR. This information will be re-read from disk the next time it is needed. \fBAuto_reset\fR also deletes any procedures listed in the auto-load index, so that fresh copies of them will be -loaded the next time that they're used. +loaded the next time that they are used. .TP \fBauto_qualify \fIcommand namespace\fR Computes a list of fully qualified names for \fIcommand\fR. This list @@ -174,7 +174,9 @@ their initialization. They call this procedure to look for their script library in several standard directories. The last component of the name of the library directory is normally \fIbasenameversion\fR -(e.g., tk8.0), but it might be "library" when in the build hierarchies. +(e.g., tk8.0), but it might be +.QW library +when in the build hierarchies. The \fIinitScript\fR file will be sourced into the interpreter once it is found. The directory in which this file is found is stored into the global variable \fIvarName\fR. @@ -230,7 +232,6 @@ Returns the index of the first word boundary before the starting index boundaries before the starting point in the given string. The index returned refers to the second character of the pair that comprises a boundary. - .SH "VARIABLES" .PP The following global variables are defined or used by the procedures in @@ -265,13 +266,15 @@ the directories listed in the $tcl_pkgPath variable. If set, then it specifies the location of the directory containing library scripts (the value of this variable will be assigned to the \fBtcl_library\fR variable and therefore returned by -the command \fBinfo library\fR). If this variable isn't set then +the command \fBinfo library\fR). If this variable is not set then a default value is used. .TP \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 -Tcl format, using "/" as the path separator, regardless of platform. +Tcl format, using +.QW / +as the path separator, regardless of platform. This variable is only used when initializing the \fBauto_path\fR variable. .TP \fBtcl_nonwordchars\fR @@ -290,9 +293,7 @@ word or not. If the pattern matches a character, the character is considered to be a word character. On Windows platforms, words are comprised of any character that is not a space, tab, or newline. Under Unix, words are comprised of numbers, letters or underscores. - .SH "SEE ALSO" info(n), re_syntax(n) - .SH KEYWORDS auto-exec, auto-load, library, unknown, word, whitespace @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: load.n,v 1.20 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: load.n,v 1.21 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH load n 7.5 Tcl "Tcl Built-In Commands" @@ -110,12 +110,16 @@ the package, Tcl picks the file that was loaded first. .TP \fBWindows\fR\0\0\0\0\0 . -When a load fails with "library not found" error, it is also possible +When a load fails with +.QW "library not found" +error, it is also possible that a dependent library was not found. To see the dependent libraries, -type ``dumpbin -imports <dllname>'' in a DOS console to see what the -library must import. -When loading a DLL in the current directory, Windows will ignore ``./'' as -a path specifier and use a search heuristic to find the DLL instead. +type +.QW "dumpbin -imports <dllname>" +in a DOS console to see what the library must import. +When loading a DLL in the current directory, Windows will ignore +.QW ./ +as a path specifier and use a search heuristic to find the DLL instead. To avoid this, load the DLL with: .CS \fBload\fR [file join [pwd] mylib.DLL] diff --git a/doc/lrange.n b/doc/lrange.n index b2fb3b8..fea3fa2 100644 --- a/doc/lrange.n +++ b/doc/lrange.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lrange.n,v 1.14 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lrange.n,v 1.15 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH lrange n 7.4 Tcl "Tcl Built-In Commands" @@ -34,10 +34,13 @@ If \fIlast\fR is greater than or equal to the number of elements in the list, then it is treated as if it were \fBend\fR. If \fIfirst\fR is greater than \fIlast\fR then an empty string is returned. -Note: ``\fBlrange \fIlist first first\fR'' does not always produce the -same result as ``\fBlindex \fIlist first\fR'' (although it often does -for simple fields that aren't enclosed in braces); it does, however, -produce exactly the same results as ``\fBlist [lindex \fIlist first\fB]\fR'' +Note: +.QW "\fBlrange \fIlist first first\fR" +does not always produce the same result as +.QW "\fBlindex \fIlist first\fR" +(although it often does for simple fields that are not enclosed in +braces); it does, however, produce exactly the same results as +.QW "\fBlist [lindex \fIlist first\fB]\fR" .SH EXAMPLES Selecting the first two elements: .CS diff --git a/doc/lsearch.n b/doc/lsearch.n index de37270..0ee3697 100644 --- a/doc/lsearch.n +++ b/doc/lsearch.n @@ -7,7 +7,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lsearch.n,v 1.29 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lsearch.n,v 1.30 2007/10/29 01:42:18 dkf Exp $ '\" .so man.macros .TH lsearch n 8.5 Tcl "Tcl Built-In Commands" @@ -159,7 +159,9 @@ Using \fBlsearch\fR to filter lists: \fBlsearch\fR -all -not {a20 b35 c47} b* => 0 2 .CE -This can even do a "set-like" removal operation: +This can even do a +.QW set-like +removal operation: .CS \fBlsearch\fR -all -inline -not -exact {a b c a d e a f g a} a => b c d e f g diff --git a/doc/lsort.n b/doc/lsort.n index da516b5..2567c55 100644 --- a/doc/lsort.n +++ b/doc/lsort.n @@ -7,7 +7,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lsort.n,v 1.25 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: lsort.n,v 1.26 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH lsort n 8.5 Tcl "Tcl Built-In Commands" @@ -59,11 +59,13 @@ be considered less than, equal to, or greater than the second, respectively. .TP 20 \fB\-increasing\fR -Sort the list in increasing order (``smallest'' items first). +Sort the list in increasing order +.PQ smallest "items first" . This is the default. .TP 20 \fB\-decreasing\fR -Sort the list in decreasing order (``largest'' items first). +Sort the list in decreasing order +.PQ largest "items first" . .TP 20 \fB\-indices\fR .VS "8.5 (TIP#217)" diff --git a/doc/memory.n b/doc/memory.n index 05d107a..ed45620 100644 --- a/doc/memory.n +++ b/doc/memory.n @@ -3,7 +3,7 @@ '\" Copyright (c) 2000 by Scriptics Corporation. '\" All rights reserved. '\" -'\" RCS: @(#) $Id: memory.n,v 1.8 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: memory.n,v 1.9 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH memory n 8.1 Tcl "Tcl Built-In Commands" @@ -71,7 +71,7 @@ Calls to \fBckfree\fR are traced in the same manner. .RE .TP \fBmemory trace_on_at_malloc\fR \fIcount\fR -Enable memory tracing after \fIcount\fR \fBckalloc\fR's have been performed. +Enable memory tracing after \fIcount\fR \fBckalloc\fRs have been performed. For example, if you enter \fBmemory trace_on_at_malloc 100\fR, after the 100th call to \fBckalloc\fR, memory trace information will begin being displayed for all allocations and frees. Since there can be a lot diff --git a/doc/msgcat.n b/doc/msgcat.n index 9a3a8fd..a00de1d 100644 --- a/doc/msgcat.n +++ b/doc/msgcat.n @@ -33,13 +33,13 @@ msgcat \- Tcl message catalog .sp \fB::msgcat::mcunknown \fIlocale src-string\fR .BE - .SH DESCRIPTION .PP The \fBmsgcat\fR package provides a set of functions that can be used to manage multi-lingual user interfaces. -Text strings are defined in a ``message catalog'' which -is independent from the application, and +Text strings are defined in a +.QW "message catalog" +which is independent from the application, and which can be edited or localized without modifying the application source code. New languages or locales are provided by adding a new file to @@ -100,8 +100,9 @@ returns \fB{en_US_funky en_US en {}}\fR. \fB::msgcat::mcload \fIdirname\fR Searches the specified directory for files that match the language specifications returned by \fB::msgcat::mcpreferences\fR -(note that these are all lowercase), extended by the file -extension ``.msg''. Each matching file is +(note that these are all lowercase), extended by the file extension +.QW .msg . +Each matching file is read in order, assuming a UTF-8 encoding. The file contents are then evaluated as a Tcl script. This means that Unicode characters may be present in the message file either directly in their UTF-8 @@ -141,10 +142,15 @@ The locale is specified to \fBmsgcat\fR by a locale string passed to \fB::msgcat::mclocale\fR. The locale string consists of a language code, an optional country code, and an optional -system-specific code, each separated by ``_''. The country and language +system-specific code, each separated by +.QW _ . +The country and language codes are specified in standards ISO-639 and ISO-3166. -For example, the locale ``en'' specifies English and ``en_US'' specifies -U.S. English. +For example, the locale +.QW en +specifies English and +.QW en_US +specifies U.S. English. .PP When the msgcat package is first loaded, the locale is initialized according to the user's environment. The variables \fBenv(LC_ALL)\fR, @@ -163,12 +169,20 @@ On Windows, if none of those environment variables is set, msgcat will attempt to extract locale information from the registry. If all these attempts to discover an initial locale from the user's environment fail, msgcat defaults to an initial -locale of ``C''. +locale of +.QW C . .PP -When a locale is specified by the user, a ``best match'' search is -performed during string translation. For example, if a user specifies +When a locale is specified by the user, a +.QW "best match" +search is performed during string translation. For example, if a user +specifies .VS 1.4 -en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``'' +en_GB_Funky, the locales +.QW en_GB_Funky , +.QW en_GB , +.QW en +and +.MT (the empty string) .VE 1.4 are searched in order until a matching translation @@ -201,10 +215,13 @@ hello from ::foo When searching for a translation of a message, the message catalog will search first the current namespace, then the parent of the current namespace, and so on until -the global namespace is reached. This allows child namespaces -to "inherit" messages from their parent namespace. +the global namespace is reached. This allows child namespaces to +.QW inherit +messages from their parent namespace. .PP -For example, executing (in the ``en'' locale) the code +For example, executing (in the +.QW en +locale) the code .CS \fB::msgcat::mcset\fR en m1 ":: message1" \fB::msgcat::mcset\fR en m2 ":: message2" @@ -234,17 +251,20 @@ to the following conditions: .IP [1] All message files for a package are in the same directory. .IP [2] -The message file name is a msgcat locale specifier (all lowercase) -followed by ``.msg''. For example: +The message file name is a msgcat locale specifier (all lowercase) followed by +.QW .msg . +For example: .CS -es.msg -- spanish -en_gb.msg -- United Kingdom English +es.msg \(em spanish +en_gb.msg \(em United Kingdom English .CE .VS 1.4 -\fIException:\fR The message file for the root locale ``'' is -called \fBROOT.msg\fR. This exception is made so as not to +\fIException:\fR The message file for the root locale +.MT +is called \fBROOT.msg\fR. This exception is made so as not to cause peculiar behavior, such as marking the message file as -``hidden'' on Unix file systems. +.QW hidden +on Unix file systems. .VE 1.4 .IP [3] The file contains a series of calls to \fBmcset\fR and @@ -298,9 +318,7 @@ extract values from internationalized strings. .SH CREDITS .PP The message catalog code was developed by Mark Harrison. - .SH "SEE ALSO" format(n), scan(n), namespace(n), package(n) - .SH KEYWORDS internationalization, i18n, localization, l10n, message, text, translation diff --git a/doc/namespace.n b/doc/namespace.n index 4b77a32..448ecc5 100644 --- a/doc/namespace.n +++ b/doc/namespace.n @@ -7,7 +7,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: namespace.n,v 1.24 2007/10/27 13:52:02 msofer Exp $ +'\" RCS: @(#) $Id: namespace.n,v 1.25 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH namespace n 8.5 Tcl "Tcl Built-In Commands" @@ -72,7 +72,8 @@ of how this is used to create callback scripts. .TP \fBnamespace current\fR Returns the fully-qualified name for the current namespace. -The actual name of the global namespace is ``'' +The actual name of the global namespace is +.MT (i.e., an empty string), but this command returns \fB::\fR for the global namespace as a convenience to programmers. @@ -85,7 +86,7 @@ If a procedure is currently executing inside the namespace, the namespace will be kept alive until the procedure returns; however, the namespace is marked to prevent other code from looking it up by name. -If a namespace doesn't exist, this command returns an error. +If a namespace does not exist, this command returns an error. If no namespace names are given, this command does nothing. .TP \fBnamespace ensemble\fR \fIoption\fR ?\fIarg ...\fR? @@ -127,10 +128,10 @@ but it may not include any namespace qualifiers. That is, the pattern can only specify commands in the current (exporting) namespace. Each \fIpattern\fR is appended onto the namespace's list of export patterns. -If the \-\fBclear\fR flag is given, +If the \fB\-clear\fR flag is given, the namespace's export pattern list is reset to empty before any \fIpattern\fR arguments are appended. -If no \fIpattern\fRs are given and the \-\fBclear\fR flag isn't given, +If no \fIpattern\fRs are given and the \fB\-clear\fR flag is not given, this command returns the namespace's current export list. .TP \fBnamespace forget \fR?\fIpattern pattern ...\fR? @@ -218,7 +219,7 @@ If \fInamespace\fR is not specified, the fully-qualified name of the current namespace's parent is returned. .TP \fBnamespace path\fR ?\fInamespaceList\fR? -'\" Should really have the .TP inside the .VS, but that triggers a groff bug +.\" Should really have the .TP inside the .VS, but that triggers a groff bug .VS 8.5 Returns the command resolution path of the current namespace. If \fInamespaceList\fR is specified as a list of named namespaces, the @@ -288,7 +289,7 @@ the rules regarding name resolution. .PP A namespace is a collection of commands and variables. It encapsulates the commands and variables to ensure that they -won't interfere with the commands and variables of other namespaces. +will not interfere with the commands and variables of other namespaces. Tcl has always had one such collection, which we refer to as the \fIglobal namespace\fR. The global namespace holds all global variables and commands. @@ -359,8 +360,9 @@ Qualified names are similar to the hierarchical path names for Unix files or Tk widgets, except that \fB::\fR is used as the separator instead of \fB/\fR or \fB.\fR. -The topmost or global namespace has the name ``'' (i.e., an empty string), -although \fB::\fR is a synonym. +The topmost or global namespace has the name +.MT +(i.e., an empty string), although \fB::\fR is a synonym. As an example, the name \fB::safe::interp::create\fR refers to the command \fBcreate\fR in the namespace \fBinterp\fR that is a child of namespace \fB::safe\fR, @@ -534,7 +536,7 @@ from a namespace that that namespace exported with a \fBnamespace export\fR command. .PP Importing \fIevery\fR command from a namespace is generally -a bad idea since you don't know what you will get. +a bad idea since you do not know what you will get. It is better to import just the specific commands you need. For example, the command .CS @@ -776,7 +778,7 @@ supply all namespace qualifiers if the implementing subcommand is not in the namespace of the caller of the ensemble command. Also note that when ensemble commands are chained (e.g. if you make one of the commands that implement an ensemble subcommand into an ensemble, in a -manner similar to the text widget's tag and mark subcommands) then the +manner similar to the \fBtext\fR widget's tag and mark subcommands) then the rewrite happens in the context of the caller of the outermost ensemble. That is to say that ensembles do not in themselves place any namespace contexts on the Tcl call stack. @@ -831,9 +833,7 @@ Look up where the command imported in the previous example came from: .CS puts "grill came from [\fBnamespace origin\fR grill]" .CE - .SH "SEE ALSO" interp(n), upvar(n), variable(n) - .SH KEYWORDS command, ensemble, exported, internal, variable @@ -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. '\" -'\" RCS: @(#) $Id: open.n,v 1.30 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: open.n,v 1.31 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH open n 8.3 Tcl "Tcl Built-In Commands" @@ -21,7 +21,6 @@ open \- Open a file-based or command pipeline channel .br \fBopen \fIfileName access permissions\fR .BE - .SH DESCRIPTION .PP This command opens a file, serial port, or command pipeline and returns a @@ -45,20 +44,20 @@ Open the file for both reading and writing; the file must already exist. .TP 15 \fBw\fR -Open the file for writing only. Truncate it if it exists. If it doesn't +Open the file for writing only. Truncate it if it exists. If it does not exist, create a new file. .TP 15 \fBw+\fR Open the file for reading and writing. Truncate it if it exists. -If it doesn't exist, create a new file. +If it does not exist, create a new file. .TP 15 \fBa\fR -Open the file for writing only. If the file doesn't exist, +Open the file for writing only. If the file does not exist, create a new empty file. Set the file pointer to the end of the file prior to each write. .TP 15 \fBa+\fR -Open the file for reading and writing. If the file doesn't exist, +Open the file for reading and writing. If the file does not exist, create a new empty file. Set the initial access position to the end of the file. .VS 8.5 @@ -92,7 +91,7 @@ Configure the opened channel with the \fB-translation binary\fR option. .VE 8.5 .TP 15 \fBCREAT\fR -Create the file if it doesn't already exist (without this flag it +Create the file if it does not already exist (without this flag it is an error for the file not to exist). .TP 15 \fBEXCL\fR @@ -119,10 +118,11 @@ If a new file is created as part of opening it, \fIpermissions\fR (an integer) is used to set the permissions for the new file in conjunction with the process's file mode creation mask. \fIPermissions\fR defaults to 0666. - .SH "COMMAND PIPELINES" .PP -If the first character of \fIfileName\fR is ``|'' then the +If the first character of \fIfileName\fR is +.QW | +then the remaining characters of \fIfileName\fR are treated as a list of arguments that describe a command pipeline to invoke, in the same style as the arguments for \fBexec\fR. @@ -162,8 +162,14 @@ This option is a set of 4 comma-separated values: the baud rate, parity, number of data bits, and number of stop bits for this serial port. The \fIbaud\fR rate is a simple integer that specifies the connection speed. \fIParity\fR is one of the following letters: \fBn\fR, \fBo\fR, \fBe\fR, -\fBm\fR, \fBs\fR; respectively signifying the parity options of ``none'', -``odd'', ``even'', ``mark'', or ``space''. \fIData\fR is the number of +\fBm\fR, \fBs\fR; respectively signifying the parity options of +.QW none , +.QW odd , +.QW even , +.QW mark , +or +.QW space . +\fIData\fR is the number of data bits and should be an integer from 5 to 8, while \fIstop\fR is the number of stop bits and should be the integer 1 or 2. .TP @@ -203,10 +209,10 @@ The \fIsignal\fR names are case-independent. \fB{RTS 1 DTR 0}\fR sets the RTS output to high and the DTR output to low. The BREAK condition (see below) is enabled and disabled with \fB{BREAK 1}\fR and \fB{BREAK 0}\fR respectively. -It's not a good idea to change the \fBRTS\fR (or \fBDTR\fR) signal +It is not a good idea to change the \fBRTS\fR (or \fBDTR\fR) signal with active hardware handshake \fBrtscts\fR (or \fBdtrdsr\fR). The result is unpredictable. -The \fB-ttycontrol\fR option cannot be queried. +The \fB\-ttycontrol\fR option cannot be queried. .TP \fB\-ttystatus\fR (Windows and Unix). The \fB-ttystatus\fR option can only be @@ -245,7 +251,6 @@ In case of a serial communication error, \fBread\fR or \fBputs\fR returns a general Tcl file I/O error. \fBfconfigure -lasterror\fR can be called to get a list of error details. See below for an explanation of the various error codes. - .SH "SERIAL PORT SIGNALS" .PP RS-232 is the most commonly used standard electrical interface for serial @@ -256,7 +261,6 @@ lines and handshaking. Here we are using the terms \fIworkstation\fR for your computer and \fImodem\fR for the external device, because some signal names (DCD, RI) come from modems. Of course your external device may use these signal lines for other purposes. - .IP \fBTXD(output)\fR \fBTransmitted Data:\fR Outgoing serial data. .IP \fBRXD(input)\fR @@ -276,8 +280,9 @@ serial port is opened. \fBData Set Ready:\fR The complement to DTR. Tells the workstation that the modem is ready to establish a link. .IP \fBDCD(input)\fR -\fBData Carrier Detect:\fR This line becomes active when a modem detects -a "Carrier" signal. +\fBData Carrier Detect:\fR This line becomes active when a modem detects a +.QW Carrier +signal. .IP \fBRI(input)\fR \fBRing Indicator:\fR Goes active when the modem detects an incoming call. .IP \fBBREAK\fR @@ -287,17 +292,15 @@ milliseconds. Normally a receive or transmit data signal stays at the mark (on=1) voltage until the next character is transferred. A BREAK is sometimes used to reset the communications line or change the operating mode of communications hardware. - .SH "ERROR CODES (Windows only)" .PP A lot of different errors may occur during serial read operations or during event polling in background. The external device may have been switched off, the data lines may be noisy, system buffers may overrun or your mode -settings may be wrong. That's why a reliable software should always +settings may be wrong. That is why a reliable software should always \fBcatch\fR serial read operations. In cases of an error Tcl returns a general file I/O error. Then \fBfconfigure -lasterror\fR may help to locate the problem. The following error codes may be returned. - .TP 10 \fBRXOVER\fR Windows input buffer overrun. The data comes faster than your scripts reads @@ -326,7 +329,6 @@ may cause this error. .TP 10 \fBBREAK\fR A BREAK condition has been detected by your UART (see above). - .SH "PORTABILITY ISSUES" .TP \fBWindows \fR(all versions) @@ -412,11 +414,9 @@ if {[catch {close $fl} err]} { puts "ls command failed: $err" } .CE - .SH "SEE ALSO" file(n), close(n), filename(n), fconfigure(n), gets(n), read(n), puts(n), exec(n), pid(n), fopen(3) - .SH KEYWORDS access mode, append, create, file, non-blocking, open, permissions, pipeline, process, serial diff --git a/doc/package.n b/doc/package.n index ce5c955..8042e7f 100644 --- a/doc/package.n +++ b/doc/package.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: package.n,v 1.20 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: package.n,v 1.21 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH package n 7.5 Tcl "Tcl Built-In Commands" @@ -110,10 +110,13 @@ vsatisfies\fR. If multiple versions are suitable the implementation with the highest version is chosen. This last part is additionally influenced by the selection mode set with \fBpackage prefer\fR. .PP -In the "stable" selection mode the command will select the highest +In the +.QW stable +selection mode the command will select the highest stable version satisfying the requirements, if any. If no stable version satisfies the requirements, the highest unstable version -satisfying the requirements will be selected. In the "latest" +satisfying the requirements will be selected. In the +.QW latest selection mode the command will accept the highest version satisfying all the requirements, regardless of its stableness. .PP @@ -143,7 +146,9 @@ of \fIpackage\fR is acceptable to the caller. This command is equivalent to \fBpackage require \fIpackage version\fR-\fIversion\fR. .TP \fBpackage unknown \fR?\fIcommand\fR? -This command supplies a ``last resort'' command to invoke during +This command supplies a +.QW "last resort" +command to invoke during \fBpackage require\fR if no suitable version of a package can be found in the \fBpackage ifneeded\fR database. If the \fIcommand\fR argument is supplied, it contains the first part @@ -178,17 +183,24 @@ have any of the forms: .RS .TP min -This form is called "min-bounded". +This form is called +.QW min-bounded . .TP min- -This form is called "min-unbound". +This form is called +.QW min-unbound . .TP min-max -This form is called "bounded". +This form is called +.QW bounded . .RE .RS .PP -where "min" and "max" are valid version numbers. The legacy syntax is +where +.QW min +and +.QW max +are valid version numbers. The legacy syntax is a special case of the extended syntax, keeping backward compatibility. Regarding satisfaction the rules are: .RE @@ -197,7 +209,9 @@ compatibility. Regarding satisfaction the rules are: The \fIversion\fR has to pass at least one of the listed \fIrequirement\fRs to be satisfactory. .IP [2] -A version satisfies a "bounded" requirement when +A version satisfies a +.QW bounded +requirement when .RS .IP [a] For \fImin\fR equal to the \fImax\fR if, and only if the \fIversion\fR @@ -205,42 +219,63 @@ is equal to the \fImin\fR. .IP [b] Otherwise if, and only if the \fIversion\fR is greater than or equal to the \fImin\fR, and less than the \fImax\fR, where both \fImin\fR -and \fImax\fR have been padded internally with 'a0'. Note that while -the comparison to \fImin\fR is inclusive, the comparison to -\fImax\fR is exclusive. +and \fImax\fR have been padded internally with +.QW a0 . +Note that while the comparison to \fImin\fR is inclusive, the +comparison to \fImax\fR is exclusive. .RE .IP [3] -A "min-bounded" requirement is a "bounded" requirement in disguise, +A +.QW min-bounded +requirement is a +.QW bounded +requirement in disguise, with the \fImax\fR part implicitly specified as the next higher major version number of the \fImin\fR part. A version satisfies it per the rules above. .IP [4] -A \fIversion\fR satisfies a "min-unbound" requirement if, and only if -it is greater than or equal to the \fImin\fR, where the \fImin\fR has -been padded internally with 'a0'. There is no constraint to a maximum. +A \fIversion\fR satisfies a +.QW min-unbound +requirement if, and only if it is greater than or equal to the +\fImin\fR, where the \fImin\fR has been padded internally with +.QW a0 . +There is no constraint to a maximum. .RE .TP \fBpackage prefer \fR?\fBlatest\fR|\fBstable\fR? -With no arguments, the commands returns either "latest" or "stable", +With no arguments, the commands returns either +.QW latest +or +.QW stable , whichever describes the current mode of selection logic used by \fBpackage require\fR. .RS .PP -When passed the argument "latest", it sets the selection logic mode to -"latest". +When passed the argument +.QW latest , +it sets the selection logic mode to +.QW latest . .PP -When passed the argument "stable", if the mode is already "stable", -that value is kept. If the mode is already "latest", then the attempt -to set it back to "stable" is ineffective and the mode value remains -"latest". +When passed the argument +.QW stable , +if the mode is already +.QW stable , +that value is kept. If the mode is already +.QW latest , +then the attempt to set it back to +.QW stable +is ineffective and the mode value remains +.QW latest . .PP When passed any other value as an argument, raise an invalid argument error. .PP When an interpreter is created, its initial selection mode value is set to -"stable" unless the environment variable \fBTCL_PKG_PREFER_LATEST\fR +.QW stable +unless the environment variable \fBTCL_PKG_PREFER_LATEST\fR is set. If that environment variable is defined (with any value) then -the initial (and permanent) selection mode value is set to "latest". +the initial (and permanent) selection mode value is set to +.QW latest . .RE .SH "VERSION NUMBERS" .PP @@ -253,14 +288,28 @@ For example, version 2.1 is later than 1.3 and version 3.4.6 is later than 3.3.5. Missing fields are equivalent to zeroes: version 1.3 is the same as version 1.3.0 and 1.3.0.0, so it is earlier than 1.3.1 or 1.3.0.2. -In addition, the letters 'a' (alpha) and/or 'b' (beta) may appear +In addition, the letters +.QW a +(alpha) and/or +.QW b +(beta) may appear exactly once to replace a dot for separation. These letters -semantically add a negative specifier into the version, where 'a' is --2, and 'b' is -1. Each may be specified only once, and 'a' or 'b' are -mutually exclusive in a specifier. Thus 1.3a1 becomes (semantically) -1.3.-2.1, 1.3b1 is 1.3.-1.1. Negative numbers are not directly allowed +semantically add a negative specifier into the version, where +.QW a +is \-2, and +.QW b +is \-1. Each may be specified only once, and +.QW a +or +.QW b +are mutually exclusive in a specifier. Thus 1.3a1 becomes (semantically) +1.3.\-2.1, 1.3b1 is 1.3.\-1.1. Negative numbers are not directly allowed in version specifiers. -A version number not containing the letters 'a' or 'b' as specified +A version number not containing the letters +.QW a +or +.QW b +as specified above is called a \fBstable\fR version, whereas presence of the letters causes the version to be called is \fBunstable\fR. A later version number is assumed to be upwards compatible with @@ -276,7 +325,7 @@ to work unmodified with either version 1.7.3 or version 3.1. The recommended way to use packages in Tcl is to invoke \fBpackage require\fR and \fBpackage provide\fR commands in scripts, and use the procedure \fBpkg_mkIndex\fR to create package index files. -Once you've done this, packages will be loaded automatically +Once you have done this, packages will be loaded automatically in response to \fBpackage require\fR commands. See the documentation for \fBpkg_mkIndex\fR for details. .SH EXAMPLES @@ -298,9 +347,7 @@ if {[catch {\fBpackage require\fR Snack}]} { # We have the package, configure the app to use it } .CE - .SH "SEE ALSO" msgcat(n), packagens(n), pkgMkIndex(n) - .SH KEYWORDS package, version diff --git a/doc/packagens.n b/doc/packagens.n index beef5f1..e96a9d5 100644 --- a/doc/packagens.n +++ b/doc/packagens.n @@ -2,14 +2,14 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -'\" RCS: @(#) $Id: packagens.n,v 1.7 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: packagens.n,v 1.8 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH pkg::create n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME -pkg::create \- Construct an appropriate `package ifneeded' command for a given package specification +pkg::create \- Construct an appropriate 'package ifneeded' command for a given package specification .SH SYNOPSIS \fB::pkg::create \fI\-name packageName\fR \fI\-version packageVersion\fR ?\fI\-load filespec\fR? ... ?\fI\-source filespec\fR? ... .BE @@ -46,9 +46,7 @@ specifies a Tcl library that must be loaded with the specified. .PP At least one \fB\-load\fR or \fB\-source\fR parameter must be given. - .SH "SEE ALSO" package(n) - .SH KEYWORDS auto-load, index, package, version @@ -1,50 +1,50 @@ -'\" -'\" 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: pid.n,v 1.6 2004/10/27 14:24:37 dkf Exp $ -'\" -.so man.macros -.TH pid n 7.0 Tcl "Tcl Built-In Commands" -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -pid \- Retrieve process identifiers -.SH SYNOPSIS -\fBpid \fR?\fIfileId\fR? -.BE - -.SH DESCRIPTION -.PP -If the \fIfileId\fR argument is given then it should normally -refer to a process pipeline created with the \fBopen\fR command. -In this case the \fBpid\fR command will return a list whose elements -are the process identifiers of all the processes in the pipeline, -in order. -The list will be empty if \fIfileId\fR refers to an open file -that isn't a process pipeline. -If no \fIfileId\fR argument is given then \fBpid\fR returns the process -identifier of the current process. -All process identifiers are returned as decimal strings. -.SH EXAMPLE -Print process information about the processes in a pipeline using the -SysV \fBps\fR program before reading the output of that pipeline: -.PP -.CS -set pipeline [open "| zcat somefile.gz | grep foobar | sort -u"] -# Print process information -exec ps -fp [\fBpid\fR $pipeline] >@stdout -# Print a separator and then the output of the pipeline -puts [string repeat - 70] -puts [read $pipeline] -close $pipeline -.CE - -.SH "SEE ALSO" -exec(n), open(n) - -.SH KEYWORDS -file, pipeline, process identifier +'\"
+'\" 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: pid.n,v 1.7 2007/10/29 01:42:19 dkf Exp $
+'\"
+.so man.macros
+.TH pid n 7.0 Tcl "Tcl Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+pid \- Retrieve process identifiers
+.SH SYNOPSIS
+\fBpid \fR?\fIfileId\fR?
+.BE
+
+.SH DESCRIPTION
+.PP
+If the \fIfileId\fR argument is given then it should normally
+refer to a process pipeline created with the \fBopen\fR command.
+In this case the \fBpid\fR command will return a list whose elements
+are the process identifiers of all the processes in the pipeline,
+in order.
+The list will be empty if \fIfileId\fR refers to an open file
+that is not a process pipeline.
+If no \fIfileId\fR argument is given then \fBpid\fR returns the process
+identifier of the current process.
+All process identifiers are returned as decimal strings.
+.SH EXAMPLE
+Print process information about the processes in a pipeline using the
+SysV \fBps\fR program before reading the output of that pipeline:
+.PP
+.CS
+set pipeline [open "| zcat somefile.gz | grep foobar | sort -u"]
+# Print process information
+exec ps -fp [\fBpid\fR $pipeline] >@stdout
+# Print a separator and then the output of the pipeline
+puts [string repeat - 70]
+puts [read $pipeline]
+close $pipeline
+.CE
+
+.SH "SEE ALSO"
+exec(n), open(n)
+
+.SH KEYWORDS
+file, pipeline, process identifier
diff --git a/doc/pkgMkIndex.n b/doc/pkgMkIndex.n index e1083ef..1cb9937 100644 --- a/doc/pkgMkIndex.n +++ b/doc/pkgMkIndex.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: pkgMkIndex.n,v 1.20 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: pkgMkIndex.n,v 1.21 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH pkg_mkIndex n 8.3 Tcl "Tcl Built-In Commands" @@ -17,7 +17,6 @@ pkg_mkIndex \- Build an index for automatic loading of packages \fBpkg_mkIndex ?\fI\-direct\fR? ?\fI\-lazy\fR? ?\fI\-load pkgPat\fR? ?\fI\-verbose\fR? \fIdir\fR ?\fIpattern pattern ...\fR? .fi .BE - .SH DESCRIPTION .PP \fBPkg_mkIndex\fR is a utility procedure that is part of the standard @@ -53,8 +52,7 @@ If you have a package split among scripts and binary files, or if you have dependencies among files, you may have to use the \fB\-load\fR option or adjust the order in which \fBpkg_mkIndex\fR processes -the files. See COMPLEX CASES below. - +the files. See \fBCOMPLEX CASES\fR below. .IP [3] Install the package as a subdirectory of one of the directories given by the \fBtcl_pkgPath\fR variable. If \fB$tcl_pkgPath\fR contains more @@ -94,7 +92,6 @@ in \fBauto_path\fR, but only one will actually be loaded in a given interpreter, based on the first call to \fBpackage require\fR. Different versions of a package may be loaded in different interpreters. - .SH OPTIONS The optional switches are: .TP 15 @@ -121,7 +118,6 @@ the \fBtclLog\fR procedure, which by default prints to stderr. .TP 15 \fB\-\-\fR End of the flags, in case \fIdir\fR begins with a dash. - .SH "PACKAGES AND THE AUTO-LOADER" .PP The package management facilities overlap somewhat with the auto-loader, @@ -141,7 +137,6 @@ If you use \fBpkg_mkIndex\fR to index a package, its commands cannot be invoked until \fBpackage require\fR has been used to select a version; in contrast, packages indexed with \fBauto_mkindex\fR can be used immediately since there is no version control. - .SH "HOW IT WORKS" .PP \fBPkg_mkIndex\fR depends on the \fBpackage unknown\fR command, @@ -158,13 +153,12 @@ availability of the package, and they setup auto-loader information to load the files of the package. If the \fI\-lazy\fR flag was provided when the \fBpkgIndex.tcl\fR was generated, -a given file of a given version of a given package isn't +a given file of a given version of a given package is not actually loaded until the first time one of its commands is invoked. Thus, after invoking \fBpackage require\fR you may not see the package's commands in the interpreter, but you will be able to invoke the commands and they will be auto-loaded. - .SH "DIRECT LOADING" .PP Some packages, for instance packages which use namespaces and export @@ -173,7 +167,6 @@ that their package files be loaded immediately upon \fBpackage require\fR instead of delaying the actual loading to the first use of one of the package's command. This is the default mode when generating the package index. It can be overridden by specifying the \fI\-lazy\fR argument. - .SH "COMPLEX CASES" Most complex cases of dependencies among scripts and binary files, and packages being split among scripts and @@ -220,7 +213,7 @@ will be available when the second file is processed. You may also need to load the first package into the temporary interpreter used to create the index by using the \fB\-load\fR flag; -it won't hurt to specify package patterns that are not yet loaded. +it will not hurt to specify package patterns that are not yet loaded. .PP If you have a package that is split across scripts and a binary file, then you should avoid the \fB\-load\fR flag. The problem is that @@ -229,9 +222,7 @@ other files that provide part of the same package. If you must use \fB\-load\fR, then you must specify the scripts first; otherwise the package loaded from the binary file may mask the package defined by the scripts. - .SH "SEE ALSO" package(n) - .SH KEYWORDS auto-load, index, package, version diff --git a/doc/platform.n b/doc/platform.n index 8b202a3..d02b49a 100644 --- a/doc/platform.n +++ b/doc/platform.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: platform.n,v 1.2 2007/07/20 16:49:38 andreas_kupries Exp $ +'\" RCS: @(#) $Id: platform.n,v 1.3 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH "platform" n 1.0.3 platform "Tcl Bundled Packages" @@ -30,7 +30,7 @@ Whilst Tcl provides the \fBtcl_platform\fR array for identifying the current architecture (in particular, the platform and machine elements) this is not always sufficient. This is because (on Unix machines) \fBtcl_platform\fR reflects the values returned by the -\fBuname\fR command and these aren't standardized across platforms and +\fBuname\fR command and these are not standardized across platforms and architectures. In addition, on at least one platform (AIX) the \fBtcl_platform(machine)\fR contains the CPU serial number. .PP @@ -1,97 +1,97 @@ -'\" -'\" 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: proc.n,v 1.5 2004/10/27 14:24:37 dkf Exp $ -'\" -.so man.macros -.TH proc n "" Tcl "Tcl Built-In Commands" -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -proc \- Create a Tcl procedure -.SH SYNOPSIS -\fBproc \fIname args body\fR -.BE - -.SH DESCRIPTION -.PP -The \fBproc\fR command creates a new Tcl procedure named -\fIname\fR, replacing -any existing command or procedure there may have been by that name. -Whenever the new command is invoked, the contents of \fIbody\fR will -be executed by the Tcl interpreter. -Normally, \fIname\fR is unqualified -(does not include the names of any containing namespaces), -and the new procedure is created in the current namespace. -If \fIname\fR includes any namespace qualifiers, -the procedure is created in the specified namespace. -\fIArgs\fR specifies the formal arguments to the -procedure. It consists of a list, possibly empty, each of whose -elements specifies -one argument. Each argument specifier is also a list with either -one or two fields. If there is only a single field in the specifier -then it is the name of the argument; if there are two fields, then -the first is the argument name and the second is its default value. -.PP -When \fIname\fR is invoked a local variable -will be created for each of the formal arguments to the procedure; its -value will be the value of corresponding argument in the invoking command -or the argument's default value. -Arguments with default values need not be -specified in a procedure invocation. However, there must be enough -actual arguments for all the -formal arguments that don't have defaults, and there must not be any extra -actual arguments. There is one special case to permit procedures with -variable numbers of arguments. If the last formal argument has the name -\fBargs\fR, then a call to the procedure may contain more actual arguments -than the procedure has formals. In this case, all of the actual arguments -starting at the one that would be assigned to \fBargs\fR are combined into -a list (as if the \fBlist\fR command had been used); this combined value -is assigned to the local variable \fBargs\fR. -.PP -When \fIbody\fR is being executed, variable names normally refer to -local variables, which are created automatically when referenced and -deleted when the procedure returns. One local variable is automatically -created for each of the procedure's arguments. -Global variables can only be accessed by invoking -the \fBglobal\fR command or the \fBupvar\fR command. -Namespace variables can only be accessed by invoking -the \fBvariable\fR command or the \fBupvar\fR command. -.PP -The \fBproc\fR command returns an empty string. When a procedure is -invoked, the procedure's return value is the value specified in a -\fBreturn\fR command. If the procedure doesn't execute an explicit -\fBreturn\fR, then its return value is the value of the last command -executed in the procedure's body. -If an error occurs while executing the procedure -body, then the procedure-as-a-whole will return that same error. -.SH EXAMPLES -This is a procedure that accepts arbitrarily many arguments and prints -them out, one by one. -.CS -\fBproc\fR printArguments args { - foreach arg $args { - puts $arg - } -} -.CE -.PP -This procedure is a bit like the \fBincr\fR command, except it -multiplies the contents of the named variable by the value, which -defaults to \fB2\fR: -.CS -\fBproc\fR mult {varName {multiplier 2}} { - upvar 1 $varName var - set var [expr {$var * $multiplier}] -} -.CE - -.SH "SEE ALSO" -info(n), unknown(n) - -.SH KEYWORDS -argument, procedure +'\"
+'\" 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: proc.n,v 1.6 2007/10/29 01:42:19 dkf Exp $
+'\"
+.so man.macros
+.TH proc n "" Tcl "Tcl Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+proc \- Create a Tcl procedure
+.SH SYNOPSIS
+\fBproc \fIname args body\fR
+.BE
+
+.SH DESCRIPTION
+.PP
+The \fBproc\fR command creates a new Tcl procedure named
+\fIname\fR, replacing
+any existing command or procedure there may have been by that name.
+Whenever the new command is invoked, the contents of \fIbody\fR will
+be executed by the Tcl interpreter.
+Normally, \fIname\fR is unqualified
+(does not include the names of any containing namespaces),
+and the new procedure is created in the current namespace.
+If \fIname\fR includes any namespace qualifiers,
+the procedure is created in the specified namespace.
+\fIArgs\fR specifies the formal arguments to the
+procedure. It consists of a list, possibly empty, each of whose
+elements specifies
+one argument. Each argument specifier is also a list with either
+one or two fields. If there is only a single field in the specifier
+then it is the name of the argument; if there are two fields, then
+the first is the argument name and the second is its default value.
+.PP
+When \fIname\fR is invoked a local variable
+will be created for each of the formal arguments to the procedure; its
+value will be the value of corresponding argument in the invoking command
+or the argument's default value.
+Arguments with default values need not be
+specified in a procedure invocation. However, there must be enough
+actual arguments for all the
+formal arguments that do not have defaults, and there must not be any extra
+actual arguments. There is one special case to permit procedures with
+variable numbers of arguments. If the last formal argument has the name
+\fBargs\fR, then a call to the procedure may contain more actual arguments
+than the procedure has formals. In this case, all of the actual arguments
+starting at the one that would be assigned to \fBargs\fR are combined into
+a list (as if the \fBlist\fR command had been used); this combined value
+is assigned to the local variable \fBargs\fR.
+.PP
+When \fIbody\fR is being executed, variable names normally refer to
+local variables, which are created automatically when referenced and
+deleted when the procedure returns. One local variable is automatically
+created for each of the procedure's arguments.
+Global variables can only be accessed by invoking
+the \fBglobal\fR command or the \fBupvar\fR command.
+Namespace variables can only be accessed by invoking
+the \fBvariable\fR command or the \fBupvar\fR command.
+.PP
+The \fBproc\fR command returns an empty string. When a procedure is
+invoked, the procedure's return value is the value specified in a
+\fBreturn\fR command. If the procedure does not execute an explicit
+\fBreturn\fR, then its return value is the value of the last command
+executed in the procedure's body.
+If an error occurs while executing the procedure
+body, then the procedure-as-a-whole will return that same error.
+.SH EXAMPLES
+This is a procedure that accepts arbitrarily many arguments and prints
+them out, one by one.
+.CS
+\fBproc\fR printArguments args {
+ foreach arg $args {
+ puts $arg
+ }
+}
+.CE
+.PP
+This procedure is a bit like the \fBincr\fR command, except it
+multiplies the contents of the named variable by the value, which
+defaults to \fB2\fR:
+.CS
+\fBproc\fR mult {varName {multiplier 2}} {
+ upvar 1 $varName var
+ set var [expr {$var * $multiplier}]
+}
+.CE
+
+.SH "SEE ALSO"
+info(n), unknown(n)
+
+.SH KEYWORDS
+argument, procedure
@@ -1,98 +1,98 @@ -'\" -'\" 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: puts.n,v 1.10 2005/05/10 18:34:02 kennykb Exp $ -'\" -.so man.macros -.TH puts n 7.5 Tcl "Tcl Built-In Commands" -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -puts \- Write to a channel -.SH SYNOPSIS -\fBputs \fR?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR -.BE - -.SH DESCRIPTION -.PP -Writes the characters given by \fIstring\fR to the channel given -by \fIchannelId\fR. -.PP -\fIChannelId\fR must be an identifier for an open channel such as a -Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return -value from an invocation of \fBopen\fR or \fBsocket\fR, or the result -of a channel creation command provided by a Tcl extension. The channel -must have been opened for output. -.PP -If no \fIchannelId\fR is specified then it defaults to -\fBstdout\fR. \fBPuts\fR normally outputs a newline character after -\fIstring\fR, but this feature may be suppressed by specifying the -\fB\-nonewline\fR switch. -.PP -Newline characters in the output are translated by \fBputs\fR to -platform-specific end-of-line sequences according to the current -value of the \fB\-translation\fR option for the channel (for example, -on PCs newlines are normally replaced with carriage-return-linefeed -sequences. -See the \fBfconfigure\fR manual entry for a discussion on ways in -which \fBfconfigure\fR will alter output. -.PP -Tcl buffers output internally, so characters written with \fBputs\fR -may not appear immediately on the output file or device; Tcl will -normally delay output until the buffer is full or the channel is -closed. -You can force output to appear immediately with the \fBflush\fR -command. -.PP -When the output buffer fills up, the \fBputs\fR command will normally -block until all the buffered data has been accepted for output by the -operating system. -If \fIchannelId\fR is in nonblocking mode then the \fBputs\fR command -will not block even if the operating system cannot accept the data. -Instead, Tcl continues to buffer the data and writes it in the -background as fast as the underlying file or device can accept it. -The application must use the Tcl event loop for nonblocking output -to work; otherwise Tcl never finds out that the file or device is -ready for more output data. -It is possible for an arbitrarily large amount of data to be -buffered for a channel in nonblocking mode, which could consume a -large amount of memory. -To avoid wasting memory, nonblocking I/O should normally -be used in an event-driven fashion with the \fBfileevent\fR command -(don't invoke \fBputs\fR unless you have recently been notified -via a file event that the channel is ready for more output data). -.SH EXAMPLES -Write a short message to the console (or wherever \fBstdout\fR is -directed): -.CS -\fBputs\fR "Hello, World!" -.CE -.PP -Print a message in several parts: -.CS -\fBputs\fR -nonewline "Hello, " -\fBputs\fR "World!" -.CE -.PP -Print a message to the standard error channel: -.CS -\fBputs\fR stderr "Hello, World!" -.CE -.PP -Append a log message to a file: -.CS -set chan [open my.log a] -set timestamp [clock format [clock seconds]] -\fBputs\fR $chan "$timestamp - Hello, World!" -close $chan -.CE - -.SH "SEE ALSO" -file(n), fileevent(n), Tcl_StandardChannels(3) - -.SH KEYWORDS -channel, newline, output, write +'\"
+'\" 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: puts.n,v 1.11 2007/10/29 01:42:19 dkf Exp $
+'\"
+.so man.macros
+.TH puts n 7.5 Tcl "Tcl Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+puts \- Write to a channel
+.SH SYNOPSIS
+\fBputs \fR?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
+.BE
+
+.SH DESCRIPTION
+.PP
+Writes the characters given by \fIstring\fR to the channel given
+by \fIchannelId\fR.
+.PP
+\fIChannelId\fR must be an identifier for an open channel such as a
+Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return
+value from an invocation of \fBopen\fR or \fBsocket\fR, or the result
+of a channel creation command provided by a Tcl extension. The channel
+must have been opened for output.
+.PP
+If no \fIchannelId\fR is specified then it defaults to
+\fBstdout\fR. \fBPuts\fR normally outputs a newline character after
+\fIstring\fR, but this feature may be suppressed by specifying the
+\fB\-nonewline\fR switch.
+.PP
+Newline characters in the output are translated by \fBputs\fR to
+platform-specific end-of-line sequences according to the current
+value of the \fB\-translation\fR option for the channel (for example,
+on PCs newlines are normally replaced with carriage-return-linefeed
+sequences.
+See the \fBfconfigure\fR manual entry for a discussion on ways in
+which \fBfconfigure\fR will alter output.
+.PP
+Tcl buffers output internally, so characters written with \fBputs\fR
+may not appear immediately on the output file or device; Tcl will
+normally delay output until the buffer is full or the channel is
+closed.
+You can force output to appear immediately with the \fBflush\fR
+command.
+.PP
+When the output buffer fills up, the \fBputs\fR command will normally
+block until all the buffered data has been accepted for output by the
+operating system.
+If \fIchannelId\fR is in nonblocking mode then the \fBputs\fR command
+will not block even if the operating system cannot accept the data.
+Instead, Tcl continues to buffer the data and writes it in the
+background as fast as the underlying file or device can accept it.
+The application must use the Tcl event loop for nonblocking output
+to work; otherwise Tcl never finds out that the file or device is
+ready for more output data.
+It is possible for an arbitrarily large amount of data to be
+buffered for a channel in nonblocking mode, which could consume a
+large amount of memory.
+To avoid wasting memory, nonblocking I/O should normally
+be used in an event-driven fashion with the \fBfileevent\fR command
+(do not invoke \fBputs\fR unless you have recently been notified
+via a file event that the channel is ready for more output data).
+.SH EXAMPLES
+Write a short message to the console (or wherever \fBstdout\fR is
+directed):
+.CS
+\fBputs\fR "Hello, World!"
+.CE
+.PP
+Print a message in several parts:
+.CS
+\fBputs\fR -nonewline "Hello, "
+\fBputs\fR "World!"
+.CE
+.PP
+Print a message to the standard error channel:
+.CS
+\fBputs\fR stderr "Hello, World!"
+.CE
+.PP
+Append a log message to a file:
+.CS
+set chan [open my.log a]
+set timestamp [clock format [clock seconds]]
+\fBputs\fR $chan "$timestamp - Hello, World!"
+close $chan
+.CE
+
+.SH "SEE ALSO"
+file(n), fileevent(n), Tcl_StandardChannels(3)
+
+.SH KEYWORDS
+channel, newline, output, write
diff --git a/doc/refchan.n b/doc/refchan.n index a556555..62d9701 100644 --- a/doc/refchan.n +++ b/doc/refchan.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: refchan.n,v 1.7 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: refchan.n,v 1.8 2007/10/29 01:42:19 dkf Exp $ .so man.macros .TH reflectedchan n 8.5 Tcl "Tcl Built-In Commands" .BS @@ -53,7 +53,7 @@ here, then the \fBfinalize\fR subcommand will not be called. .PP The \fImode\fR argument tells the handler whether the channel was opened for reading, writing, or both. It is a list containing any of -the strings "\fBread\fR" or "\fBwrite\fR". The list will always +the strings \fBread\fR or \fBwrite\fR. The list will always contain at least one element. .PP The subcommand must throw an error if the chosen mode is not @@ -86,8 +86,8 @@ aborted during \fBinitialize\fR (See above). . This subcommand notifies the \fIcmdPrefix\fR that the specified \fIchannelId\fR is interested in the events listed in the -\fIeventspec\fR. This argument is a list containing any of "\fBread\fR" -and "\fBwrite\fR". The list may be empty, which signals that the +\fIeventspec\fR. This argument is a list containing any of \fBread\fR +and \fBwrite\fR. The list may be empty, which signals that the channel does not wish to be notified of any events. In that situation, the handler should disable event generation completely. .RS @@ -185,7 +185,7 @@ invocation (usually \fBseek\fR, or \fBtell\fR) will appear to have thrown this error. Any exception beyond \fIerror\fR (e.g. \fIbreak\fR, etc.) is treated as and converted to an error. .PP -The offset/base combination of 0/"\fBcurrent\fR" signals a \fBtell\fR +The offset/base combination of 0/\fBcurrent\fR signals a \fBtell\fR request, i.e. seek nothing relative to the current location, making the new location identical to the current one, which is then returned. .RE diff --git a/doc/regexp.n b/doc/regexp.n index d626e37..f7baefa 100644 --- a/doc/regexp.n +++ b/doc/regexp.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: regexp.n,v 1.24 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: regexp.n,v 1.25 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH regexp n 8.3 Tcl "Tcl Built-In Commands" @@ -20,7 +20,7 @@ regexp \- Match a regular expression against a string .SH DESCRIPTION .PP Determines whether the regular expression \fIexp\fR matches part or -all of \fIstring\fR and returns 1 if it does, 0 if it doesn't, unless +all of \fIstring\fR and returns 1 if it does, 0 if it does not, unless \fB-inline\fR is specified (see below). (Regular expression matching is described in the \fBre_syntax\fR reference page.) @@ -62,20 +62,37 @@ range of characters. \fB\-line\fR Enables newline-sensitive matching. By default, newline is a completely ordinary character with no special meaning. With this -flag, `[^' bracket expressions and `.' never match newline, `^' +flag, +.QW [^ +bracket expressions and +.QW . +never match newline, +.QW ^ matches an empty string after any newline in addition to its normal -function, and `$' matches an empty string before any newline in +function, and +.QW $ +matches an empty string before any newline in addition to its normal function. This flag is equivalent to specifying both \fB\-linestop\fR and \fB\-lineanchor\fR, or the \fB(?n)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-linestop\fR -Changes the behavior of `[^' bracket expressions and `.' so that they +Changes the behavior of +.QW [^ +bracket expressions and +.QW . +so that they stop at newlines. This is the same as specifying the \fB(?p)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-lineanchor\fR -Changes the behavior of `^' and `$' (the ``anchors'') so they match the +Changes the behavior of +.QW ^ +and +.QW $ +(the +.QW anchors ) +so they match the beginning and end of a line respectively. This is the same as specifying the \fB(?w)\fR embedded option (see the \fBre_syntax\fR manual page). @@ -112,7 +129,8 @@ matching the regular expression at. The \fIindex\fR value is interpreted in the same manner as the \fIindex\fR argument to \fBstring index\fR. .VE 8.5 -When using this switch, `^' +When using this switch, +.QW ^ will not match the beginning of the line, and \eA will still match the start of the string at \fIindex\fR. If \fB\-indices\fR is specified, the indices will be indexed starting from the @@ -123,12 +141,13 @@ absolute beginning of the input string. Marks the end of switches. The argument following this one will be treated as \fIexp\fR even if it starts with a \fB\-\fR. .PP -If there are more \fIsubMatchVar\fR's than parenthesized +If there are more \fIsubMatchVar\fRs than parenthesized subexpressions within \fIexp\fR, or if a particular subexpression -in \fIexp\fR doesn't match the string (e.g. because it was in a -portion of the expression that wasn't matched), then the corresponding -\fIsubMatchVar\fR will be set to ``\fB\-1 \-1\fR'' if \fB\-indices\fR -has been specified or to an empty string otherwise. +in \fIexp\fR does not match the string (e.g. because it was in a +portion of the expression that was not matched), then the corresponding +\fIsubMatchVar\fR will be set to +.QW "\fB\-1 \-1\fR" +if \fB\-indices\fR has been specified or to an empty string otherwise. .SH EXAMPLES Find the first occurrence of a word starting with \fBfoo\fR in a string that is not actually an instance of \fBfoobar\fR, and get the diff --git a/doc/registry.n b/doc/registry.n index f5e839e..f66b369 100644 --- a/doc/registry.n +++ b/doc/registry.n @@ -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. '\" -'\" RCS: @(#) $Id: registry.n,v 1.18 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: registry.n,v 1.19 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH registry n 1.1 registry "Tcl Bundled Packages" @@ -93,7 +93,7 @@ data, see SUPPORTED TYPES, below. .TP \fBregistry keys \fIkeyName\fR ?\fIpattern\fR? . -If \fIpattern\fR isn't specified, returns a list of names of all the +If \fIpattern\fR is not specified, returns a list of names of all the subkeys of \fIkeyName\fR. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring\fR \fBmatch\fR. If the @@ -101,11 +101,11 @@ specified \fIkeyName\fR does not exist, then an error is generated. .TP \fBregistry set \fIkeyName\fR ?\fIvalueName data \fR?\fItype\fR?? . -If \fIvalueName\fR isn't specified, creates the key \fIkeyName\fR if -it doesn't already exist. If \fIvalueName\fR is specified, creates +If \fIvalueName\fR is not specified, creates the key \fIkeyName\fR if +it does not already exist. If \fIvalueName\fR is specified, creates the key \fIkeyName\fR and value \fIvalueName\fR if necessary. The contents of \fIvalueName\fR are set to \fIdata\fR with the type -indicated by \fItype\fR. If \fItype\fR isn't specified, the type +indicated by \fItype\fR. If \fItype\fR is not specified, the type \fBsz\fR is assumed. For more details on the data and type arguments, see SUPPORTED TYPES below. .TP @@ -117,7 +117,7 @@ SUPPORTED TYPES, below. .TP \fBregistry values \fIkeyName\fR ?\fIpattern\fR? . -If \fIpattern\fR isn't specified, returns a list of names of all the +If \fIpattern\fR is not specified, returns a list of names of all the values of \fIkeyName\fR. If \fIpattern\fR is specified, only those names matching \fIpattern\fR are returned. Matching is determined using the same rules as for \fBstring\fR \fBmatch\fR. @@ -152,8 +152,9 @@ represented in Tcl as a string. . The registry value contains a null-terminated string that contains unexpanded references to environment variables in the normal Windows -style (for example, "%PATH%"). The data is represented in Tcl as a -string. +style (for example, +.QW %PATH% ). +The data is represented in Tcl as a string. .TP \fBdword\fR . diff --git a/doc/regsub.n b/doc/regsub.n index fecc357..84514fc 100644 --- a/doc/regsub.n +++ b/doc/regsub.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: regsub.n,v 1.20 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: regsub.n,v 1.21 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH regsub n 8.3 Tcl "Tcl Built-In Commands" @@ -17,7 +17,6 @@ regsub \- Perform substitutions based on regular expression pattern matching .SH SYNOPSIS \fBregsub \fR?\fIswitches\fR? \fIexp string subSpec \fR?\fIvarName\fR? .BE - .SH DESCRIPTION .PP This command matches the regular expression \fIexp\fR against @@ -31,18 +30,26 @@ If there is a match, then while copying \fIstring\fR to \fIvarName\fR (or to the result of this command if \fIvarName\fR is not present) the portion of \fIstring\fR that matched \fIexp\fR is replaced with \fIsubSpec\fR. -If \fIsubSpec\fR contains a ``&'' or ``\e0'', then it is replaced -in the substitution with the portion of \fIstring\fR that -matched \fIexp\fR. -If \fIsubSpec\fR contains a ``\e\fIn\fR'', where \fIn\fR is a digit +If \fIsubSpec\fR contains a +.QW & +or +.QW \e0 , +then it is replaced in the substitution with the portion of +\fIstring\fR that matched \fIexp\fR. +If \fIsubSpec\fR contains a +.QW \e\fIn\fR , +where \fIn\fR is a digit between 1 and 9, then it is replaced in the substitution with -the portion of \fIstring\fR that matched the \fIn\fR-th +the portion of \fIstring\fR that matched the \fIn\fR'th parenthesized subexpression of \fIexp\fR. Additional backslashes may be used in \fIsubSpec\fR to prevent special -interpretation of ``&'' or ``\e0'' or ``\e\fIn\fR'' or -backslash. +interpretation of +.QW & , +.QW \e0 , +.QW \e\fIn\fR +and backslashes. The use of backslashes in \fIsubSpec\fR tends to interact badly -with the Tcl parser's use of backslashes, so it's generally +with the Tcl parser's use of backslashes, so it is generally safest to enclose \fIsubSpec\fR in braces if it includes backslashes. .LP @@ -55,7 +62,10 @@ All ranges in \fIstring\fR that match \fIexp\fR are found and substitution is performed for each of these ranges. Without this switch only the first matching range is found and substituted. -If \fB\-all\fR is specified, then ``&'' and ``\e\fIn\fR'' +If \fB\-all\fR is specified, then +.QW & +and +.QW \e\fIn\fR sequences are handled for each substitution using the information from the corresponding match. .TP 15 @@ -66,21 +76,37 @@ the \fB(?x)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-line\fR Enables newline-sensitive matching. By default, newline is a -completely ordinary character with no special meaning. With this -flag, `[^' bracket expressions and `.' never match newline, `^' +completely ordinary character with no special meaning. With this flag, +.QW [^ +bracket expressions and +.QW . +never match newline, +.QW ^ matches an empty string after any newline in addition to its normal -function, and `$' matches an empty string before any newline in +function, and +.QW $ +matches an empty string before any newline in addition to its normal function. This flag is equivalent to specifying both \fB\-linestop\fR and \fB\-lineanchor\fR, or the \fB(?n)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-linestop\fR -Changes the behavior of `[^' bracket expressions and `.' so that they +Changes the behavior of +.QW [^ +bracket expressions and +.QW . +so that they stop at newlines. This is the same as specifying the \fB(?p)\fR embedded option (see the \fBre_syntax\fR manual page). .TP 15 \fB\-lineanchor\fR -Changes the behavior of `^' and `$' (the ``anchors'') so they match the +Changes the behavior of +.QW ^ +and +.QW $ +(the +.QW anchors ) +so they match the beginning and end of a line respectively. This is the same as specifying the \fB(?w)\fR embedded option (see the \fBre_syntax\fR manual page). @@ -97,7 +123,8 @@ matching the regular expression at. The \fIindex\fR value is interpreted in the same manner as the \fIindex\fR argument to \fBstring index\fR. .VE 8.5 -When using this switch, `^' +When using this switch, +.QW ^ will not match the beginning of the line, and \eA will still match the start of the string at \fIindex\fR. \fIindex\fR will be constrained to the bounds of the input string. @@ -137,7 +164,6 @@ set substitution {[format \e\e\e\eu%04x [scan "\e\e&" %c]]} # will perform the computational parts of the conversion. set quoted [subst [\fBregsub\fR -all $RE $string $substitution]] .CE - .SH "SEE ALSO" regexp(n), re_syntax(n), subst(n), .VS 8.5 diff --git a/doc/return.n b/doc/return.n index a38f40a..efa5c0c 100644 --- a/doc/return.n +++ b/doc/return.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: return.n,v 1.15 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: return.n,v 1.16 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH return n 8.5 Tcl "Tcl Built-In Commands" @@ -21,7 +21,6 @@ return \- Return from a procedure, or set return code of a script .sp \fBreturn \fR?\fIoption value \fR...? ?\fIresult\fR? .BE - .SH DESCRIPTION .PP In its simplest usage, the \fBreturn\fR command is used without options @@ -42,7 +41,7 @@ will be returned as the result of the \fBsource\fR command. In addition to the result of a procedure, the return code of a procedure may also be set by \fBreturn\fR through use of the \fB-code\fR option. -In the usual case where the \fB\-code\fR option isn't +In the usual case where the \fB\-code\fR option is not specified the procedure will return normally. However, the \fB\-code\fR option may be used to generate an exceptional return from the procedure. @@ -83,10 +82,10 @@ with \fIresult\fR set to a suitable error message. Otherwise usage of the \fBreturn -code\fR option is mostly limited to procedures that implement a new control structure. .PP -The \fBreturn -code\fR command acts similarly within script +The \fBreturn \-code\fR command acts similarly within script files that are evaluated by the \fBsource\fR command. During the evaluation of the contents of a file as a script by \fBsource\fR, -an invocation of the \fBreturn -code \fIcode\fR command will cause +an invocation of the \fBreturn \-code \fIcode\fR command will cause the return code of \fBsource\fR to be \fIcode\fR. .SH "RETURN OPTIONS" .PP @@ -292,9 +291,7 @@ proc myReturn {args} { } .CE .VE 8.5 - .SH "SEE ALSO" break(n), catch(n), continue(n), dict(n), error(n), proc(n), source(n), tclvars(n) - .SH KEYWORDS break, catch, continue, error, procedure, return @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: safe.n,v 1.9 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: safe.n,v 1.10 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH "Safe Tcl" n 8.0 Tcl "Tcl Built-In Commands" @@ -313,8 +313,12 @@ To further prevent potential information leakage from sensitive files that are accidentally included in the set of files that can be sourced by a safe interpreter, the \fBsource\fR alias restricts access to files meeting the following constraints: the file name must -fourteen characters or shorter, must not contain more than one dot ("\fB.\fR"), -must end up with the extension \fB.tcl\fR or be called \fBtclIndex\fR. +fourteen characters or shorter, must not contain more than one dot +.PQ \fB.\fR "" , +must end up with the extension +.PQ \fB.tcl\fR +or be called +.PQ \fBtclIndex\fR . .PP Each element of the initial access path list will be assigned a token that will be set in @@ -324,9 +328,9 @@ the \fBtcl_library\fR for that slave. If the access path argument is not given or is the empty list, the default behavior is to let the slave access the same packages as the master has access to (Or to be more precise: -only packages written in Tcl (which by definition can't be dangerous +only packages written in Tcl (which by definition cannot be dangerous as they run in the slave interpreter) and C extensions that -provides a Safe_Init entry point). For that purpose, the master's +provides a _SafeInit entry point). For that purpose, the master's \fBauto_path\fR will be used to construct the slave access path. In order that the slave successfully loads the Tcl library files (which includes the auto-loading mechanism itself) the \fBtcl_library\fR will be @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: scan.n,v 1.22 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: scan.n,v 1.23 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH scan n 8.4 Tcl "Tcl Built-In Commands" @@ -17,7 +17,6 @@ scan \- Parse string using conversion specifiers in the style of sscanf .SH SYNOPSIS \fBscan \fIstring format \fR?\fIvarName varName ...\fR? .BE - .SH INTRODUCTION .PP This command parses substrings from an input string in a fashion similar @@ -40,7 +39,7 @@ performed. If the next character in \fIformat\fR is a blank or tab then it matches any number of white space characters in \fIstring\fR (including zero). -Otherwise, if it isn't a \fB%\fR character then it +Otherwise, if it is not a \fB%\fR character then it must match the next character of \fIstring\fR. When a \fB%\fR is encountered in \fIformat\fR, it indicates the start of a conversion specifier. @@ -60,7 +59,8 @@ conversion specifier and stores the result in the variable given by the next argument to \fBscan\fR. .PP If the \fB%\fR is followed by a decimal number and a \fB$\fR, as in -``\fB%2$d\fR'', then the variable to use is not taken from the next +.QW \fB%2$d\fR , +then the variable to use is not taken from the next sequential argument. Instead, it is taken from the argument indicated by the number, where 1 corresponds to the first \fIvarName\fR. If there are any positional specifiers in \fIformat\fR then all of the @@ -263,9 +263,7 @@ values determined by size modifiers: 20000000000000000000 .CE .VE 8.5 - .SH "SEE ALSO" format(n), sscanf(3) - .SH KEYWORDS conversion specifier, parse, scan @@ -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. '\" -'\" RCS: @(#) $Id: set.n,v 1.7 2006/08/09 10:06:28 dkf Exp $ +'\" RCS: @(#) $Id: set.n,v 1.8 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH set n "" Tcl "Tcl Built-In Commands" @@ -16,13 +16,12 @@ set \- Read and write variables .SH SYNOPSIS \fBset \fIvarName \fR?\fIvalue\fR? .BE - .SH DESCRIPTION .PP Returns the value of variable \fIvarName\fR. If \fIvalue\fR is specified, then set the value of \fIvarName\fR to \fIvalue\fR, creating a new variable -if one doesn't already exist, and return its value. +if one does not already exist, and return its value. If \fIvarName\fR contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, @@ -67,9 +66,7 @@ practice instead of doing double-dereferencing): \fBset\fR vbl in[expr {rand() >= 0.5}] \fBset\fR out [\fBset\fR $vbl] .CE - .SH "SEE ALSO" expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n) - .SH KEYWORDS read, write, variable diff --git a/doc/socket.n b/doc/socket.n index c2ba501..63c7db8 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -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. '\" -'\" RCS: @(#) $Id: socket.n,v 1.13 2005/12/07 09:30:09 dkf Exp $ +'\" RCS: @(#) $Id: socket.n,v 1.14 2007/10/29 01:42:19 dkf Exp $ .so man.macros .TH socket n 8.0 Tcl "Tcl Built-In Commands" .BS @@ -118,7 +118,7 @@ channel shuts down the server so that no new connections will be accepted; however, existing connections will be unaffected. .PP Server sockets depend on the Tcl event mechanism to find out when -new connections are opened. If the application doesn't enter the +new connections are opened. If the application does not enter the event loop, for example by invoking the \fBvwait\fR command or calling the C procedure \fBTcl_DoOneEvent\fR, then no connections will be accepted. diff --git a/doc/source.n b/doc/source.n index 8269734..34c7913 100644 --- a/doc/source.n +++ b/doc/source.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: source.n,v 1.15 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: source.n,v 1.16 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH source n "" Tcl "Tcl Built-In Commands" @@ -21,7 +21,6 @@ source \- Evaluate a file or resource as a Tcl script \fBsource\fR \fB\-encoding \fIencodingName fileName\fR .VE 8.5 .BE - .SH DESCRIPTION .PP This command takes the contents of the specified file or resource @@ -33,13 +32,20 @@ If a \fBreturn\fR command is invoked from within the script then the remainder of the file will be skipped and the \fBsource\fR command will return normally with the result from the \fBreturn\fR command. .PP -The end-of-file character for files is '\e32' (^Z) for all platforms. +The end-of-file character for files is +.QW \e32 +(^Z) for all platforms. The source command will read files up to this character. This restriction does not exist for the \fBread\fR or \fBgets\fR commands, allowing for files containing code and data segments (scripted documents). -If you require a ``^Z'' in code for string comparison, you can use -``\e032'' or ``\eu001a'', which will be safely substituted by the Tcl -interpreter into ``^Z''. +If you require a +.QW ^Z +in code for string comparison, you can use +.QW \e032 +or +.QW \eu001a , +which will be safely substituted by the Tcl interpreter into +.QW ^Z . .PP .VS 8.5 The \fB-encoding\fR option is used to specify the encoding of @@ -59,9 +65,7 @@ foreach scriptFile {foo.tcl bar.tcl} { \fBsource\fR $scriptFile } .CE - .SH "SEE ALSO" file(n), cd(n), encoding(n), info(n) - .SH KEYWORDS file, script diff --git a/doc/string.n b/doc/string.n index 6c6761a..e9f8e2c 100644 --- a/doc/string.n +++ b/doc/string.n @@ -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. .\" -.\" RCS: @(#) $Id: string.n,v 1.39 2007/10/28 14:17:40 dkf Exp $ +.\" RCS: @(#) $Id: string.n,v 1.40 2007/10/29 01:42:19 dkf Exp $ .\" .so man.macros .TH string n 8.1 Tcl "Tcl Built-In Commands" @@ -77,24 +77,42 @@ string. \fIcharIndex\fR may be specified as follows: .IP \fIinteger\fR 10 For any index value that passes \fBstring is integer -strict\fR, the char specified at this integral index -(e.g. \fB2\fR would refer to the "c" in "abcd"). +(e.g. \fB2\fR would refer to the +.QW c +in +.QW abcd ). .IP \fBend\fR 10 The last char of the string -(e.g. \fBend\fR would refer to the "d" in "abcd"). +(e.g. \fBend\fR would refer to the +.QW d +in +.QW abcd ). .IP \fBend\fR\-\fIN\fR 10 The last char of the string minus the specified integer offset \fIN\fR -(e.g. \fBend\fR\-1 would refer to the "c" in "abcd"). +(e.g. \fBend\fR\-1 would refer to the +.QW c +in +.QW abcd ). .IP \fBend\fR+\fIN\fR 10 The last char of the string plus the specified integer offset \fIN\fR -(e.g. \fBend\fR+\-1 would refer to the "c" in "abcd"). +(e.g. \fBend\fR+\-1 would refer to the +.QW c +in +.QW abcd ). .IP \fIM\fR+\fIN\fR 10 The char specified at the integral index that is the sum of integer values \fIM\fR and \fIN\fR -(e.g. \fB1+1\fR would refer to the "c" in "abcd"). +(e.g. \fB1+1\fR would refer to the +.QW c +in +.QW abcd ). .IP \fIM\fR\-\fIN\fR 10 The char specified at the integral index that is the difference of integer values \fIM\fR and \fIN\fR -(e.g. \fB2\-1\fR would refer to the "b" in "abcd"). +(e.g. \fB2\-1\fR would refer to the +.QW b +in +.QW abcd ). .PP In the specifications above, the integer value \fIM\fR contains no trailing whitespace and the integer value \fIN\fR contains no @@ -145,8 +163,9 @@ the value, 0 is returned and the \fIvarname\fR will contain \-1. .IP \fBlist\fR 12 Any proper list structure, with optional surrounding whitespace. In case of improper list structure, 0 is returned and the \fIvarname\fR -will contain the index of the "element" where the list parsing fails, -or \-1 if this cannot be determined. +will contain the index of the +.QW element +where the list parsing fails, or \-1 if this cannot be determined. .IP \fBlower\fR 12 Any Unicode lower case alphabet character. .IP \fBprint\fR 12 @@ -231,7 +250,7 @@ it will return the string \fB02c322c222c\fR. .TP \fBstring match\fR ?\fB\-nocase\fR? \fIpattern\fR \fIstring\fR See if \fIpattern\fR matches \fIstring\fR; return 1 if it does, 0 if -it doesn't. If \fB\-nocase\fR is specified, then the pattern attempts +it does not. If \fB\-nocase\fR is specified, then the pattern attempts to match against the string in a case insensitive manner. For the two strings to match, their contents must be identical except that the following special sequences may appear in \fIpattern\fR: @@ -246,10 +265,15 @@ Matches any character in the set given by \fIchars\fR. If a sequence of the form \fIx\fB\-\fIy\fR appears in \fIchars\fR, then any character between \fIx\fR and \fIy\fR, inclusive, will match. When used with \fB\-nocase\fR, the end points of the range are converted to -lower case first. Whereas {[A\-z]} matches '_' when matching -case-sensitively ('_' falls between the 'Z' and 'a'), with -\fB\-nocase\fR this is considered like {[A\-Za\-z]} (and probably what -was meant in the first place). +lower case first. Whereas {[A\-z]} matches +.QW _ +when matching case-sensitively (since +.QW _ +falls between the +.QW Z +and +.QW a ), with \fB\-nocase\fR this is considered like {[A\-Za\-z]} (and +probably what was meant in the first place). .IP \fB\e\fIx\fR 10 Matches the single character \fIx\fR. This provides a way of avoiding the special interpretation of the characters \fB*?[]\e\fR in diff --git a/doc/subst.n b/doc/subst.n index f52a155..8f4cb91 100644 --- a/doc/subst.n +++ b/doc/subst.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: subst.n,v 1.13 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: subst.n,v 1.14 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH subst n 7.4 Tcl "Tcl Built-In Commands" @@ -17,7 +17,6 @@ subst \- Perform backslash, command, and variable substitutions .SH SYNOPSIS \fBsubst \fR?\fB\-nobackslashes\fR? ?\fB\-nocommands\fR? ?\fB\-novariables\fR? \fIstring\fR .BE - .SH DESCRIPTION .PP This command performs variable substitutions, command substitutions, @@ -56,7 +55,9 @@ will be substituted for that entire command or variable substitution or any other return code is returned during command or variable substitution, then the returned value is substituted for that substitution. See the EXAMPLES below. In this way, all exceptional -return codes are ``caught'' by \fBsubst\fR. The \fBsubst\fR command +return codes are +.QW caught +by \fBsubst\fR. The \fBsubst\fR command itself will either return an error, or will complete successfully. .SH EXAMPLES .PP @@ -67,21 +68,31 @@ command substitutions) so the script set a 44 \fBsubst\fR {xyz {$a}} .CE -returns ``\fBxyz {44}\fR'', not ``\fBxyz {$a}\fR'' +returns +.QW "\fBxyz {44}\fR" , +not +.QW "\fBxyz {$a}\fR" and the script .CS set a "p\e} q \e{r" \fBsubst\fR {xyz {$a}} .CE -return ``\fBxyz {p} q {r}\fR'', not ``\fBxyz {p\e} q \e{r}\fR''. +returns +.QW "\fBxyz {p} q {r}\fR" , +not +.QW "\fBxyz {p\e} q \e{r}\fR". .PP When command substitution is performed, it includes any variable -substitution necessary to evaluate the script. +substitution necessary to evaluate the script. .CS set a 44 \fBsubst\fR -novariables {$a [format $a]} .CE -returns ``\fB$a 44\fR'', not ``\fB$a $a\fR''. Similarly, when +returns +.QW "\fB$a 44\fR" , +not +.QW "\fB$a $a\fR" . +Similarly, when variable substitution is performed, it includes any command substitution necessary to retrieve the value of the variable. .CS @@ -89,7 +100,10 @@ proc b {} {return c} array set a {c c [b] tricky} \fBsubst\fR -nocommands {[b] $a([b])} .CE -returns ``\fB[b] c\fR'', not ``\fB[b] tricky\fR''. +returns +.QW "\fB[b] c\fR" , +not +.QW "\fB[b] tricky\fR" . .PP The continue and break exceptions allow command substitutions to prevent substitution of the rest of the command substitution and the @@ -98,24 +112,36 @@ when processing text using \fIsubst\fR. For example, the script .CS \fBsubst\fR {abc,[break],def} .CE -returns ``\fBabc,\fR'', not ``\fBabc,,def\fR'' and the script +returns +.QW \fBabc,\fR , +not +.QW \fBabc,,def\fR +and the script .CS \fBsubst\fR {abc,[continue;expr {1+2}],def} .CE -returns ``\fBabc,,def\fR'', not ``\fBabc,3,def\fR''. +returns +.QW \fBabc,,def\fR , +not +.QW \fBabc,3,def\fR . .PP Other exceptional return codes substitute the returned value .CS \fBsubst\fR {abc,[return foo;expr {1+2}],def} .CE -returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR'' and +returns +.QW \fBabc,foo,def\fR , +not +.QW \fBabc,3,def\fR +and .CS \fBsubst\fR {abc,[return -code 10 foo;expr {1+2}],def} .CE -also returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR''. - +also returns +.QW \fBabc,foo,def\fR , +not +.QW \fBabc,3,def\fR . .SH "SEE ALSO" Tcl(n), eval(n), break(n), continue(n) - .SH KEYWORDS backslash substitution, command substitution, variable substitution diff --git a/doc/switch.n b/doc/switch.n index c446aff..554eb6f 100644 --- a/doc/switch.n +++ b/doc/switch.n @@ -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. '\" -'\" RCS: @(#) $Id: switch.n,v 1.13 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: switch.n,v 1.14 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH switch n 8.5 Tcl "Tcl Built-In Commands" @@ -102,9 +102,12 @@ no command or variable substitutions are performed on them; this makes the behavior of the second form different than the first form in some cases. .PP -If a \fIbody\fR is specified as ``\fB\-\fR'' it means that the \fIbody\fR +If a \fIbody\fR is specified as +.QW \fB\-\fR +it means that the \fIbody\fR for the next pattern should also be used as the body for this -pattern (if the next pattern also has a body of ``\fB\-\fR'' +pattern (if the next pattern also has a body of +.QW \fB\-\fR then the body after that is used, and so on). This feature makes it possible to share a single \fIbody\fR among several patterns. diff --git a/doc/tcltest.n b/doc/tcltest.n index db841f6..6739a7a 100644 --- a/doc/tcltest.n +++ b/doc/tcltest.n @@ -8,7 +8,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: tcltest.n,v 1.52 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: tcltest.n,v 1.53 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH "tcltest" n 2.3 tcltest "Tcl Bundled Packages" @@ -79,12 +79,12 @@ in and exported from the \fB::tcltest\fR namespace, as indicated in the \fBSYNOPSIS\fR above. In the following sections, all commands will be described by their simple names, in the interest of brevity. .PP -The central command of \fBtcltest\fR is [\fBtest\fR] that defines -and runs a test. Testing with [\fBtest\fR] involves evaluation +The central command of \fBtcltest\fR is \fBtest\fR that defines +and runs a test. Testing with \fBtest\fR involves evaluation of a Tcl script and comparing the result to an expected result, as configured and controlled by a number of options. Several other commands provided by \fBtcltest\fR govern the configuration of -[\fBtest\fR] and the collection of many [\fBtest\fR] commands into +\fBtest\fR and the collection of many \fBtest\fR commands into test suites. .PP See \fBCREATING TEST SUITES WITH TCLTEST\fR below for an extended example @@ -95,29 +95,30 @@ for your Tcl-enabled code. \fBtest\fR \fIname description ?option value ...?\fR Defines and possibly runs a test with the name \fIname\fR and description \fIdescription\fR. The name and description of a test -are used in messages reported by [\fBtest\fR] during the +are used in messages reported by \fBtest\fR during the test, as configured by the options of \fBtcltest\fR. The -remaining \fIoption value\fR arguments to [\fBtest\fR] +remaining \fIoption value\fR arguments to \fBtest\fR define the test, including the scripts to run, the conditions under which to run them, the expected result, and the means by which the expected and actual results should be compared. See \fBTESTS\fR below for a complete description of the valid -options and how they define a test. The [\fBtest\fR] command -returns an empty string. +options and how they define a test. The \fBtest\fR command +returns an empty string. .TP \fBtest\fR \fIname description ?constraints? body result\fR -This form of [\fBtest\fR] is provided to support test suites written +This form of \fBtest\fR is provided to support test suites written for version 1 of the \fBtcltest\fR package, and also a simpler interface for a common usage. It is the same as -[\fBtest\fR \fIname description\fB -constraints \fIconstraints\fB -body -\fIbody\fB -result \fIresult\fR]. All other options to [\fBtest\fR] +.QW "\fBtest\fR \fIname description\fB \-constraints \fIconstraints\fB \-body \fIbody\fB \-result \fIresult\fR" . +All other options to \fBtest\fR take their default values. When \fIconstraints\fR is omitted, this -form of [\fBtest\fR] can be distinguished from the first because -all \fIoption\fRs begin with ``-''. +form of \fBtest\fR can be distinguished from the first because +all \fIoption\fRs begin with +.QW \- . .TP \fBloadTestedCommands\fR Evaluates in the caller's context the script specified by -[\fBconfigure -load\fR] or [\fBconfigure -loadfile\fR]. +\fBconfigure \-load\fR or \fBconfigure \-loadfile\fR. Returns the result of that script evaluation, including any error raised by the script. Use this command and the related configuration options to provide the commands to be tested to @@ -126,31 +127,31 @@ the interpreter running the test suite. \fBmakeFile\fR \fIcontents name ?directory?\fR Creates a file named \fIname\fR relative to directory \fIdirectory\fR and write \fIcontents\fR -to that file using the encoding [\fBencoding system\fR]. +to that file using the encoding \fBencoding system\fR. If \fIcontents\fR does not end with a newline, a newline will be appended so that the file named \fIname\fR does end with a newline. Because the system encoding is used, this command is only suitable for making text files. The file will be removed by the next evaluation -of [\fBcleanupTests\fR], unless it is removed by -[\fBremoveFile\fR] first. The default value of -\fIdirectory\fR is the directory [\fBconfigure -tmpdir\fR]. +of \fBcleanupTests\fR, unless it is removed by +\fBremoveFile\fR first. The default value of +\fIdirectory\fR is the directory \fBconfigure \-tmpdir\fR. Returns the full path of the file created. Use this command to create any text file required by a test with contents as needed. .TP \fBremoveFile\fR \fIname ?directory?\fR Forces the file referenced by \fIname\fR to be removed. This file name should be relative to \fIdirectory\fR. The default value of -\fIdirectory\fR is the directory [\fBconfigure -tmpdir\fR]. +\fIdirectory\fR is the directory \fBconfigure \-tmpdir\fR. Returns an empty string. Use this command to delete files -created by [\fBmakeFile\fR]. +created by \fBmakeFile\fR. .TP \fBmakeDirectory\fR \fIname ?directory?\fR Creates a directory named \fIname\fR relative to directory \fIdirectory\fR. -The directory will be removed by the next evaluation of [\fBcleanupTests\fR], -unless it is removed by [\fBremoveDirectory\fR] first. +The directory will be removed by the next evaluation of \fBcleanupTests\fR, +unless it is removed by \fBremoveDirectory\fR first. The default value of \fIdirectory\fR is the directory -[\fBconfigure -tmpdir\fR]. +\fBconfigure \-tmpdir\fR. Returns the full path of the directory created. Use this command to create any directories that are required to exist by a test. .TP @@ -158,16 +159,16 @@ to create any directories that are required to exist by a test. Forces the directory referenced by \fIname\fR to be removed. This directory should be relative to \fIdirectory\fR. The default value of \fIdirectory\fR is the directory -[\fBconfigure -tmpdir\fR]. +\fBconfigure \-tmpdir\fR. Returns an empty string. Use this command to delete any directories -created by [\fBmakeDirectory\fR]. +created by \fBmakeDirectory\fR. .TP \fBviewFile\fR \fIfile ?directory?\fR Returns the contents of \fIfile\fR, except for any -final newline, just as [\fBread -nonewline\fR] would return. -This file name should be relative to \fIdirectory\fR. +final newline, just as \fBread \-nonewline\fR would return. +This file name should be relative to \fIdirectory\fR. The default value of \fIdirectory\fR is the directory -[\fBconfigure -tmpdir\fR]. Use this command +\fBconfigure \-tmpdir\fR. Use this command as a convenient way to turn the contents of a file generated by a test into the result of that test for matching against an expected result. The contents of the file are read using @@ -178,17 +179,17 @@ files. Intended to clean up and summarize after several tests have been run. Typically called once per test file, at the end of the file after all tests have been completed. For best effectiveness, be -sure that the [\fBcleanupTests\fR] is evaluated even if an error -occurs earlier in the test file evaluation. +sure that the \fBcleanupTests\fR is evaluated even if an error +occurs earlier in the test file evaluation. .sp Prints statistics about the tests run and removes files that were -created by [\fBmakeDirectory\fR] and [\fBmakeFile\fR] since the -last [\fBcleanupTests\fR]. Names of files and directories -in the directory [\fBconfigure -tmpdir\fR] created since -the last [\fBcleanupTests\fR], but not created by -[\fBmakeFile\fR] or [\fBmakeDirectory\fR] are printed -to [\fBoutputChannel\fR]. This command also restores the original -shell environment, as described by the ::env +created by \fBmakeDirectory\fR and \fBmakeFile\fR since the +last \fBcleanupTests\fR. Names of files and directories +in the directory \fBconfigure \-tmpdir\fR created since +the last \fBcleanupTests\fR, but not created by +\fBmakeFile\fR or \fBmakeDirectory\fR are printed +to \fBoutputChannel\fR. This command also restores the original +shell environment, as described by the \fB::env\fR array. Returns an empty string. .TP \fBrunAllTests\fR @@ -196,7 +197,7 @@ This is a master command meant to run an entire suite of tests, spanning multiple files and/or directories, as governed by the configurable options of \fBtcltest\fR. See \fBRUNNING ALL TESTS\fR below for a complete description of the many variations possible -with [\fBrunAllTests\fR]. +with \fBrunAllTests\fR. .SH "CONFIGURATION COMMANDS" .TP \fBconfigure\fR @@ -214,19 +215,19 @@ corresponding value \fIvalue\fR, in order. Raises an error if an \fIoption\fR is not a supported configurable option, or if \fIvalue\fR is not a valid value for the corresponding \fIoption\fR, or if a \fIvalue\fR is not provided. When an error is raised, the -operation of [\fBconfigure\fR] is halted, and subsequent \fIoption value\fR +operation of \fBconfigure\fR is halted, and subsequent \fIoption value\fR arguments are not processed. .sp If the environment variable \fB::env(TCLTEST_OPTIONS)\fR exists when -the \fBtcltest\fR package is loaded (by [\fBpackage require tcltest\fR]) -then its value is taken as a list of arguments to pass to [\fBconfigure\fR]. +the \fBtcltest\fR package is loaded (by \fBpackage require tcltest\fR) +then its value is taken as a list of arguments to pass to \fBconfigure\fR. This allows the default values of the configuration options to be set by the environment. .TP \fBcustomMatch \fImode script\fR -Registers \fImode\fR as a new legal value of the \fB-match\fR option -to [\fBtest\fR]. When the \fB-match \fImode\fR option is -passed to [\fBtest\fR], the script \fIscript\fR will be evaluated +Registers \fImode\fR as a new legal value of the \fB\-match\fR option +to \fBtest\fR. When the \fB\-match \fImode\fR option is +passed to \fBtest\fR, the script \fIscript\fR will be evaluated to compare the actual result of evaluating the body of the test to the expected result. To perform the match, the \fIscript\fR is completed with two additional @@ -234,82 +235,82 @@ words, the expected result, and the actual result, and the completed script is evaluated in the global namespace. The completed script is expected to return a boolean value indicating whether or not the results match. The built-in matching modes of -[\fBtest\fR] are \fBexact\fR, \fBglob\fR, and \fBregexp\fR. +\fBtest\fR are \fBexact\fR, \fBglob\fR, and \fBregexp\fR. .TP \fBtestConstraint \fIconstraint ?boolean?\fR Sets or returns the boolean value associated with the named \fIconstraint\fR. See \fBTEST CONSTRAINTS\fR below for more information. .TP \fBinterpreter\fR \fI?executableName?\fR -Sets or returns the name of the executable to be [\fBexec\fR]ed by -[\fBrunAllTests\fR] to run each test file when -[\fBconfigure -singleproc\fR] is false. -The default value for [\fBinterpreter\fR] is the name of the -currently running program as returned by [\fBinfo nameofexecutable\fR]. +Sets or returns the name of the executable to be \fBexec\fRed by +\fBrunAllTests\fR to run each test file when +\fBconfigure \-singleproc\fR is false. +The default value for \fBinterpreter\fR is the name of the +currently running program as returned by \fBinfo nameofexecutable\fR. .TP \fBoutputChannel\fR \fI?channelID?\fR Sets or returns the output channel ID. This defaults to stdout. Any test that prints test related output should send -that output to [\fBoutputChannel\fR] rather than letting +that output to \fBoutputChannel\fR rather than letting that output default to stdout. .TP \fBerrorChannel\fR \fI?channelID?\fR Sets or returns the error channel ID. This defaults to stderr. Any test that prints error messages should send -that output to [\fBerrorChannel\fR] rather than printing +that output to \fBerrorChannel\fR rather than printing directly to stderr. .SH "SHORTCUT COMMANDS" .TP \fBdebug \fI?level?\fR -Same as [\fBconfigure -debug \fI?level?\fR]. +Same as \fBconfigure \-debug \fI?level?\fR. .TP \fBerrorFile \fI?filename?\fR -Same as [\fBconfigure -errfile \fI?filename?\fR]. +Same as \fBconfigure \-errfile \fI?filename?\fR. .TP \fBlimitConstraints \fI?boolean?\fR -Same as [\fBconfigure -limitconstraints \fI?boolean?\fR]. +Same as \fBconfigure \-limitconstraints \fI?boolean?\fR. .TP \fBloadFile \fI?filename?\fR -Same as [\fBconfigure -loadfile \fI?filename?\fR]. +Same as \fBconfigure \-loadfile \fI?filename?\fR. .TP \fBloadScript \fI?script?\fR -Same as [\fBconfigure -load \fI?script?\fR]. +Same as \fBconfigure \-load \fI?script?\fR. .TP \fBmatch \fI?patternList?\fR -Same as [\fBconfigure -match \fI?patternList?\fR]. +Same as \fBconfigure \-match \fI?patternList?\fR. .TP \fBmatchDirectories \fI?patternList?\fR -Same as [\fBconfigure -relateddir \fI?patternList?\fR]. +Same as \fBconfigure \-relateddir \fI?patternList?\fR. .TP \fBmatchFiles \fI?patternList?\fR -Same as [\fBconfigure -file \fI?patternList?\fR]. +Same as \fBconfigure \-file \fI?patternList?\fR. .TP \fBoutputFile \fI?filename?\fR -Same as [\fBconfigure -outfile \fI?filename?\fR]. +Same as \fBconfigure \-outfile \fI?filename?\fR. .TP \fBpreserveCore \fI?level?\fR -Same as [\fBconfigure -preservecore \fI?level?\fR]. +Same as \fBconfigure \-preservecore \fI?level?\fR. .TP \fBsingleProcess \fI?boolean?\fR -Same as [\fBconfigure -singleproc \fI?boolean?\fR]. +Same as \fBconfigure \-singleproc \fI?boolean?\fR. .TP \fBskip \fI?patternList?\fR -Same as [\fBconfigure -skip \fI?patternList?\fR]. +Same as \fBconfigure \-skip \fI?patternList?\fR. .TP \fBskipDirectories \fI?patternList?\fR -Same as [\fBconfigure -asidefromdir \fI?patternList?\fR]. +Same as \fBconfigure \-asidefromdir \fI?patternList?\fR. .TP \fBskipFiles \fI?patternList?\fR -Same as [\fBconfigure -notfile \fI?patternList?\fR]. +Same as \fBconfigure \-notfile \fI?patternList?\fR. .TP \fBtemporaryDirectory \fI?directory?\fR -Same as [\fBconfigure -tmpdir \fI?directory?\fR]. +Same as \fBconfigure \-tmpdir \fI?directory?\fR. .TP \fBtestsDirectory \fI?directory?\fR -Same as [\fBconfigure -testdir \fI?directory?\fR]. +Same as \fBconfigure \-testdir \fI?directory?\fR. .TP \fBverbose \fI?level?\fR -Same as [\fBconfigure -verbose \fI?level?\fR]. +Same as \fBconfigure \-verbose \fI?level?\fR. .SH "OTHER COMMANDS" .PP The remaining commands provided by \fBtcltest\fR have better @@ -318,43 +319,49 @@ are retained to support existing test suites, but should be avoided in new code. .TP \fBtest\fR \fIname description optionList\fR -This form of [\fBtest\fR] was provided to enable passing many -options spanning several lines to [\fBtest\fR] as a single +This form of \fBtest\fR was provided to enable passing many +options spanning several lines to \fBtest\fR as a single argument quoted by braces, rather than needing to backslash quote -the newlines between arguments to [\fBtest\fR]. The \fIoptionList\fR +the newlines between arguments to \fBtest\fR. The \fIoptionList\fR argument is expected to be a list with an even number of elements representing \fIoption\fR and \fIvalue\fR arguments to pass -to [\fBtest\fR]. However, these values are not passed directly, as -in the alternate forms of [\fBswitch\fR]. Instead, this form makes +to \fBtest\fR. However, these values are not passed directly, as +in the alternate forms of \fBswitch\fR. Instead, this form makes an unfortunate attempt to overthrow Tcl's substitution rules by performing substitutions on some of the list elements as an attempt to -implement a ``do what I mean'' interpretation of a brace-enclosed -``block''. The result is nearly impossible to document clearly, and +implement a +.QW "do what I mean" +interpretation of a brace-enclosed +.QW block . +The result is nearly impossible to document clearly, and for that reason this form is not recommended. See the examples in \fBCREATING TEST SUITES WITH TCLTEST\fR below to see that this form is really not necessary to avoid backslash-quoted newlines. If you insist on using this form, examine the source code of \fBtcltest\fR if you want to know the substitution details, or just enclose the third through last argument -to [\fBtest\fR] in braces and hope for the best. +to \fBtest\fR in braces and hope for the best. .TP \fBworkingDirectory\fR \fI?directoryName?\fR Sets or returns the current working directory when the test suite is running. The default value for workingDirectory is the directory in -which the test suite was launched. The Tcl commands [\fBcd\fR] and -[\fBpwd\fR] are sufficient replacements. +which the test suite was launched. The Tcl commands \fBcd\fR and +\fBpwd\fR are sufficient replacements. .TP \fBnormalizeMsg\fR \fImsg\fR -Returns the result of removing the ``extra'' newlines from \fImsg\fR, -where ``extra'' is rather imprecise. Tcl offers plenty of string +Returns the result of removing the +.QW extra +newlines from \fImsg\fR, where +.QW extra +is rather imprecise. Tcl offers plenty of string processing commands to modify strings as you wish, and -[\fBcustomMatch\fR] allows flexible matching of actual and expected +\fBcustomMatch\fR allows flexible matching of actual and expected results. .TP \fBnormalizePath\fR \fIpathVar\fR Resolves symlinks in a path, thus creating a path without internal redirection. It is assumed that \fIpathVar\fR is absolute. -\fIpathVar\fR is modified in place. The Tcl command [\fBfile normalize\fR] +\fIpathVar\fR is modified in place. The Tcl command \fBfile normalize\fR is a sufficient replacement. .TP \fBbytestring\fR \fIstring\fR @@ -364,18 +371,18 @@ value supplied in \fIstring\fR. This allows the tester to create denormalized or improperly formed strings to pass to C procedures that are supposed to accept strings with embedded NULL types and confirm that a string result has a certain pattern of bytes. This is -exactly equivalent to the Tcl command [\fBencoding convertfrom identity\fR]. +exactly equivalent to the Tcl command \fBencoding convertfrom identity\fR. .SH TESTS .PP -The [\fBtest\fR] command is the heart of the \fBtcltest\fR package. +The \fBtest\fR command is the heart of the \fBtcltest\fR package. Its essential function is to evaluate a Tcl script and compare -the result with an expected result. The options of [\fBtest\fR] +the result with an expected result. The options of \fBtest\fR define the test script, the environment in which to evaluate it, the expected result, and how the compare the actual result to the expected result. Some configuration options of \fBtcltest\fR -also influence how [\fBtest\fR] operates. +also influence how \fBtest\fR operates. .PP -The valid options for [\fBtest\fR] are summarized: +The valid options for \fBtest\fR are summarized: .PP .CS \fBtest\fR \fIname\fR \fIdescription\fR @@ -403,16 +410,15 @@ target should be the name of the feature being tested. Some conventions call for the names of black-box tests to have the suffix \fB_bb\fR. Related tests should share a major number. As a test suite evolves, it is best to have the same test name continue to correspond to the -same test, so that it remains meaningful to say things like ``Test -foo-1.3 passed in all releases up to 3.4, but began failing in -release 3.5.'' +same test, so that it remains meaningful to say things like +.QW "Test foo-1.3 passed in all releases up to 3.4, but began failing in release 3.5." .PP -During evaluation of [\fBtest\fR], the \fIname\fR will be compared +During evaluation of \fBtest\fR, the \fIname\fR will be compared to the lists of string matching patterns returned by -[\fBconfigure -match\fR], and [\fBconfigure -skip\fR]. The test +\fBconfigure \-match\fR, and \fBconfigure \-skip\fR. The test will be run only if \fIname\fR matches any of the patterns from -[\fBconfigure -match\fR] and matches none of the patterns -from [\fBconfigure -skip\fR]. +\fBconfigure \-match\fR and matches none of the patterns +from \fBconfigure \-skip\fR. .PP The \fIdescription\fR should be a short textual description of the test. The \fIdescription\fR is included in output produced by the @@ -424,124 +430,125 @@ a bug, include the bug ID in the description. .PP Valid attributes and associated values are: .TP -\fB-constraints \fIkeywordList|expression\fR -The optional \fB-constraints\fR attribute can be list of one or more -keywords or an expression. If the \fB-constraints\fR value is a list of +\fB\-constraints \fIkeywordList|expression\fR +The optional \fB\-constraints\fR attribute can be list of one or more +keywords or an expression. If the \fB\-constraints\fR value is a list of keywords, each of these keywords should be the name of a constraint -defined by a call to [\fBtestConstraint\fR]. If any of the listed +defined by a call to \fBtestConstraint\fR. If any of the listed constraints is false or does not exist, the test is skipped. If the -\fB-constraints\fR value is an expression, that expression +\fB\-constraints\fR value is an expression, that expression is evaluated. If the expression evaluates to true, then the test is run. -Note that the expression form of \fB-constraints\fR may interfere with the -operation of [\fBconfigure -constraints\fR] and -[\fBconfigure -limitconstraints\fR], and is not recommended. +Note that the expression form of \fB\-constraints\fR may interfere with the +operation of \fBconfigure \-constraints\fR and +\fBconfigure \-limitconstraints\fR, and is not recommended. Appropriate constraints should be added to any tests that should not always be run. That is, conditional evaluation of a test -should be accomplished by the \fB-constraints\fR option, not by -conditional evaluation of [\fBtest\fR]. In that way, the same +should be accomplished by the \fB\-constraints\fR option, not by +conditional evaluation of \fBtest\fR. In that way, the same number of tests are always reported by the test suite, though the number skipped may change based on the testing environment. The default value is an empty list. See \fBTEST CONSTRAINTS\fR below for a list of built-in constraints and information on how to add your own constraints. .TP -\fB-setup \fIscript\fR -The optional \fB-setup\fR attribute indicates a \fIscript\fR that will be run -before the script indicated by the \fB-body\fR attribute. If evaluation +\fB\-setup \fIscript\fR +The optional \fB\-setup\fR attribute indicates a \fIscript\fR that will be run +before the script indicated by the \fB\-body\fR attribute. If evaluation of \fIscript\fR raises an error, the test will fail. The default value is an empty script. .TP -\fB-body \fIscript\fR -The \fB-body\fR attribute indicates the \fIscript\fR to run to carry out the +\fB\-body \fIscript\fR +The \fB\-body\fR attribute indicates the \fIscript\fR to run to carry out the test. It must return a result that can be checked for correctness. If evaluation of \fIscript\fR raises an error, the test will fail. The default value is an empty script. .TP -\fB-cleanup \fIscript\fR -The optional \fB-cleanup\fR attribute indicates a \fIscript\fR that will be -run after the script indicated by the \fB-body\fR attribute. +\fB\-cleanup \fIscript\fR +The optional \fB\-cleanup\fR attribute indicates a \fIscript\fR that will be +run after the script indicated by the \fB\-body\fR attribute. If evaluation of \fIscript\fR raises an error, the test will fail. The default value is an empty script. .TP -\fB-match \fImode\fR -The \fB-match\fR attribute determines how expected answers supplied by -\fB-result\fR, \fB-output\fR, and \fB-errorOutput\fR are compared. Valid +\fB\-match \fImode\fR +The \fB\-match\fR attribute determines how expected answers supplied by +\fB\-result\fR, \fB\-output\fR, and \fB\-errorOutput\fR are compared. Valid values for \fImode\fR are \fBregexp\fR, \fBglob\fR, \fBexact\fR, and -any value registered by a prior call to [\fBcustomMatch\fR]. The default +any value registered by a prior call to \fBcustomMatch\fR. The default value is \fBexact\fR. .TP -\fB-result \fIexpectedValue\fR -The \fB-result\fR attribute supplies the \fIexpectedValue\fR against which +\fB\-result \fIexpectedValue\fR +The \fB\-result\fR attribute supplies the \fIexpectedValue\fR against which the return value from script will be compared. The default value is an empty string. .TP -\fB-output \fIexpectedValue\fR -The \fB-output\fR attribute supplies the \fIexpectedValue\fR against which -any output sent to \fBstdout\fR or [\fBoutputChannel\fR] during evaluation +\fB\-output \fIexpectedValue\fR +The \fB\-output\fR attribute supplies the \fIexpectedValue\fR against which +any output sent to \fBstdout\fR or \fBoutputChannel\fR during evaluation of the script(s) will be compared. Note that only output printed using -[\fB::puts\fR] is used for comparison. If \fB-output\fR is not specified, -output sent to \fBstdout\fR and [\fBoutputChannel\fR] is not processed for +\fB::puts\fR is used for comparison. If \fB\-output\fR is not specified, +output sent to \fBstdout\fR and \fBoutputChannel\fR is not processed for comparison. .TP -\fB-errorOutput \fIexpectedValue\fR -The \fB-errorOutput\fR attribute supplies the \fIexpectedValue\fR against -which any output sent to \fBstderr\fR or [\fBerrorChannel\fR] during +\fB\-errorOutput \fIexpectedValue\fR +The \fB\-errorOutput\fR attribute supplies the \fIexpectedValue\fR against +which any output sent to \fBstderr\fR or \fBerrorChannel\fR during evaluation of the script(s) will be compared. Note that only output -printed using [\fB::puts\fR] is used for comparison. If \fB-errorOutput\fR -is not specified, output sent to \fBstderr\fR and [\fBerrorChannel\fR] is +printed using \fB::puts\fR is used for comparison. If \fB\-errorOutput\fR +is not specified, output sent to \fBstderr\fR and \fBerrorChannel\fR is not processed for comparison. .TP -\fB-returnCodes \fIexpectedCodeList\fR -The optional \fB-returnCodes\fR attribute supplies \fIexpectedCodeList\fR, +\fB\-returnCodes \fIexpectedCodeList\fR +The optional \fB\-returnCodes\fR attribute supplies \fIexpectedCodeList\fR, a list of return codes that may be accepted from evaluation of the -\fB-body\fR script. If evaluation of the \fB-body\fR script returns +\fB\-body\fR script. If evaluation of the \fB\-body\fR script returns a code not in the \fIexpectedCodeList\fR, the test fails. All -return codes known to [\fBreturn\fR], in both numeric and symbolic +return codes known to \fBreturn\fR, in both numeric and symbolic form, including extended return codes, are acceptable elements in -the \fIexpectedCodeList\fR. Default value is \fB{ok return}\fR. +the \fIexpectedCodeList\fR. Default value is +.QW \fBok return\fR. .PP -To pass, a test must successfully evaluate its \fB-setup\fR, \fB-body\fR, -and \fB-cleanup\fR scripts. The return code of the \fB-body\fR script and +To pass, a test must successfully evaluate its \fB\-setup\fR, \fB\-body\fR, +and \fB\-cleanup\fR scripts. The return code of the \fB\-body\fR script and its result must match expected values, and if specified, output and error -data from the test must match expected \fB-output\fR and \fB-errorOutput\fR +data from the test must match expected \fB\-output\fR and \fB\-errorOutput\fR values. If any of these conditions are not met, then the test fails. Note that all scripts are evaluated in the context of the caller -of [\fBtest\fR]. +of \fBtest\fR. .PP -As long as [\fBtest\fR] is called with valid syntax and legal +As long as \fBtest\fR is called with valid syntax and legal values for all attributes, it will not raise an error. Test -failures are instead reported as output written to [\fBoutputChannel\fR]. +failures are instead reported as output written to \fBoutputChannel\fR. In default operation, a successful test produces no output. The output -messages produced by [\fBtest\fR] are controlled by the -[\fBconfigure -verbose\fR] option as described in \fBCONFIGURABLE OPTIONS\fR +messages produced by \fBtest\fR are controlled by the +\fBconfigure \-verbose\fR option as described in \fBCONFIGURABLE OPTIONS\fR below. Any output produced by the test scripts themselves should be -produced using [\fB::puts\fR] to [\fBoutputChannel\fR] or -[\fBerrorChannel\fR], so that users of the test suite may -easily capture output with the [\fBconfigure -outfile\fR] and -[\fBconfigure -errfile\fR] options, and so that the \fB-output\fR -and \fB-errorOutput\fR attributes work properly. +produced using \fB::puts\fR to \fBoutputChannel\fR or +\fBerrorChannel\fR, so that users of the test suite may +easily capture output with the \fBconfigure \-outfile\fR and +\fBconfigure \-errfile\fR options, and so that the \fB\-output\fR +and \fB\-errorOutput\fR attributes work properly. .SH "TEST CONSTRAINTS" .PP Constraints are used to determine whether or not a test should be skipped. Each constraint has a name, which may be any string, and a boolean -value. Each [\fBtest\fR] has a \fB-constraints\fR value which is a +value. Each \fBtest\fR has a \fB\-constraints\fR value which is a list of constraint names. There are two modes of constraint control. Most frequently, the default mode is used, indicated by a setting -of [\fBconfigure -limitconstraints\fR] to false. The test will run +of \fBconfigure \-limitconstraints\fR to false. The test will run only if all constraints in the list are true-valued. Thus, -the \fB-constraints\fR option of [\fBtest\fR] is a convenient, symbolic +the \fB\-constraints\fR option of \fBtest\fR is a convenient, symbolic way to define any conditions required for the test to be possible or -meaningful. For example, a [\fBtest\fR] with \fB-constraints unix\fR +meaningful. For example, a \fBtest\fR with \fB\-constraints unix\fR will only be run if the constraint \fBunix\fR is true, which indicates the test suite is being run on a Unix platform. .PP -Each [\fBtest\fR] should include whatever \fB-constraints\fR are +Each \fBtest\fR should include whatever \fB\-constraints\fR are required to constrain it to run only where appropriate. Several constraints are pre-defined in the \fBtcltest\fR package, listed below. The registration of user-defined constraints is performed -by the [\fBtestConstraint\fR] command. User-defined constraints +by the \fBtestConstraint\fR command. User-defined constraints may appear within a test file, or within the script specified -by the [\fBconfigure -load\fR] or [\fBconfigure -loadfile\fR] +by the \fBconfigure \-load\fR or \fBconfigure \-loadfile\fR options. .PP The following is a list of constraints pre-defined by the @@ -586,15 +593,15 @@ test can not be run on a Mac. This flag is used to temporarily disable a test. .TP \fIunixCrash\fR -test crashes if it's run on Unix. This flag is used to temporarily +test crashes if it is run on Unix. This flag is used to temporarily disable a test. .TP \fIwinCrash\fR -test crashes if it's run on Windows. This flag is used to temporarily +test crashes if it is run on Windows. This flag is used to temporarily disable a test. .TP \fImacCrash\fR -test crashes if it's run on a Mac. This flag is used to temporarily +test crashes if it is run on a Mac. This flag is used to temporarily disable a test. .TP \fIemptyTest\fR @@ -648,21 +655,23 @@ test can only run if Unix user is not root .TP \fIeformat\fR test can only run if app has a working version of sprintf with respect -to the "e" format of floating-point numbers. +to the +.QW e +format of floating-point numbers. .TP \fIstdio\fR -test can only be run if [\fBinterpreter\fR] can be [\fBopen\fR]ed +test can only be run if \fBinterpreter\fR can be \fBopen\fRed as a pipe. .PP The alternative mode of constraint control is enabled by setting -[\fBconfigure -limitconstraints\fR] to true. With that configuration +\fBconfigure \-limitconstraints\fR to true. With that configuration setting, all existing constraints other than those in the constraint -list returned by [\fBconfigure -constraints\fR] are set to false. -When the value of [\fBconfigure -constraints\fR] +list returned by \fBconfigure \-constraints\fR are set to false. +When the value of \fBconfigure \-constraints\fR is set, all those constraints are set to true. The effect is that -when both options [\fBconfigure -constraints\fR] and -[\fBconfigure -limitconstraints\fR] are in use, only those tests including -only constraints from the [\fBconfigure -constraints\fR] list +when both options \fBconfigure \-constraints\fR and +\fBconfigure \-limitconstraints\fR are in use, only those tests including +only constraints from the \fBconfigure \-constraints\fR list are run; all others are skipped. For example, one might set up a configuration with .PP @@ -673,23 +682,23 @@ up a configuration with .CE .PP to run exactly those tests that exercise known bugs, and discover -whether any of them pass, indicating the bug had been fixed. +whether any of them pass, indicating the bug had been fixed. .SH "RUNNING ALL TESTS" .PP -The single command [\fBrunAllTests\fR] is evaluated to run an entire +The single command \fBrunAllTests\fR is evaluated to run an entire test suite, spanning many files and directories. The configuration options of \fBtcltest\fR control the precise operations. The -[\fBrunAllTests\fR] command begins by printing a summary of its -configuration to [\fBoutputChannel\fR]. +\fBrunAllTests\fR command begins by printing a summary of its +configuration to \fBoutputChannel\fR. .PP Test files to be evaluated are sought in the directory -[\fBconfigure -testdir\fR]. The list of files in that directory -that match any of the patterns in [\fBconfigure -file\fR] and -match none of the patterns in [\fBconfigure -notfile\fR] is generated +\fBconfigure \-testdir\fR. The list of files in that directory +that match any of the patterns in \fBconfigure \-file\fR and +match none of the patterns in \fBconfigure \-notfile\fR is generated and sorted. Then each file will be evaluated in turn. If -[\fBconfigure -singleproc\fR] is true, then each file will -be [\fBsource\fR]d in the caller's context. If it is false, -then a copy of [\fBinterpreter\fR] will be [\fBexec\fR]d to +\fBconfigure \-singleproc\fR is true, then each file will +be \fBsource\fRd in the caller's context. If it is false, +then a copy of \fBinterpreter\fR will be \fBexec\fR'd to evaluate each file. The multi-process operation is useful when testing can cause errors so severe that a process terminates. Although such an error may terminate a child @@ -697,17 +706,17 @@ process evaluating one file, the master process can continue with the rest of the test suite. In multi-process operation, the configuration of \fBtcltest\fR in the master process is passed to the child processes as command line arguments, -with the exception of [\fBconfigure -outfile\fR]. The -[\fBrunAllTests\fR] command in the +with the exception of \fBconfigure \-outfile\fR. The +\fBrunAllTests\fR command in the master process collects all output from the child processes and collates their results into one master report. Any reports of individual test failures, or messages requested -by a [\fBconfigure -verbose\fR] setting are passed directly -on to [\fBoutputChannel\fR] by the master process. +by a \fBconfigure \-verbose\fR setting are passed directly +on to \fBoutputChannel\fR by the master process. .PP After evaluating all selected test files, a summary of the -results is printed to [\fBoutputChannel\fR]. The summary -includes the total number of [\fBtest\fR]s evaluated, broken +results is printed to \fBoutputChannel\fR. The summary +includes the total number of \fBtest\fRs evaluated, broken down into those skipped, those passed, and those failed. The summary also notes the number of files evaluated, and the names of any files with failing tests or errors. A list of @@ -715,45 +724,45 @@ the constraints that caused tests to be skipped, and the number of tests skipped for each is also printed. Also, messages are printed if it appears that evaluation of a test file has caused any temporary files to be left -behind in [\fBconfigure -tmpdir\fR]. +behind in \fBconfigure \-tmpdir\fR. .PP Having completed and summarized all selected test files, -[\fBrunAllTests\fR] then recursively acts on subdirectories -of [\fBconfigure -testdir\fR]. All subdirectories that -match any of the patterns in [\fBconfigure -relateddir\fR] +\fBrunAllTests\fR then recursively acts on subdirectories +of \fBconfigure \-testdir\fR. All subdirectories that +match any of the patterns in \fBconfigure \-relateddir\fR and do not match any of the patterns in -[\fBconfigure -asidefromdir\fR] are examined. If +\fBconfigure \-asidefromdir\fR are examined. If a file named \fBall.tcl\fR is found in such a directory, -it will be [\fBsource\fR]d in the caller's context. +it will be \fBsource\fRd in the caller's context. Whether or not an examined directory contains an \fBall.tcl\fR file, its subdirectories are also scanned -against the [\fBconfigure -relateddir\fR] and -[\fBconfigure -asidefromdir\fR] patterns. In this way, +against the \fBconfigure \-relateddir\fR and +\fBconfigure \-asidefromdir\fR patterns. In this way, many directories in a directory tree can have all their -test files evaluated by a single [\fBrunAllTests\fR] +test files evaluated by a single \fBrunAllTests\fR command. .SH "CONFIGURABLE OPTIONS" -The [\fBconfigure\fR] command is used to set and query the configurable +The \fBconfigure\fR command is used to set and query the configurable options of \fBtcltest\fR. The valid options are: .TP -\fB-singleproc \fIboolean\fR -Controls whether or not [\fBrunAllTests\fR] spawns a child process for +\fB\-singleproc \fIboolean\fR +Controls whether or not \fBrunAllTests\fR spawns a child process for each test file. No spawning when \fIboolean\fR is true. Default value is false. .TP -\fB-debug \fIlevel\fR +\fB\-debug \fIlevel\fR Sets the debug level to \fIlevel\fR, an integer value indicating how much debugging information should be printed to stdout. Note that debug messages always go to stdout, independent of the value of -[\fBconfigure -outfile\fR]. Default value is 0. Levels are defined as: +\fBconfigure \-outfile\fR. Default value is 0. Levels are defined as: .RS .IP 0 Do not display any debug information. .IP 1 Display information regarding whether a test is skipped because it -doesn't match any of the tests that were specified using by -[\fBconfigure -match\fR] (userSpecifiedNonMatch) or matches any of -the tests specified by [\fBconfigure -skip\fR] (userSpecifiedSkip). Also +does not match any of the tests that were specified using by +\fBconfigure \-match\fR (userSpecifiedNonMatch) or matches any of +the tests specified by \fBconfigure \-skip\fR (userSpecifiedSkip). Also print warnings about possible lack of cleanup or balance in test files. Also print warnings about any re-use of test names. .IP 2 @@ -765,7 +774,7 @@ Display information regarding what individual procs in the test harness are doing. .RE .TP -\fB-verbose \fIlevel\fR +\fB\-verbose \fIlevel\fR Sets the type of output verbosity desired to \fIlevel\fR, a list of zero or more of the elements \fBbody\fR, \fBpass\fR, \fBskip\fR, \fBstart\fR, \fBerror\fR and \fBline\fR. Default value @@ -787,95 +796,101 @@ does not match its expected return code Print source file line information of failed tests .RE The single letter abbreviations noted above are also recognized -so that [\fBconfigure -verbose pt\fR] is the same as -[\fBconfigure -verbose {pass start}\fR]. +so that +.QW "\fBconfigure \-verbose pt\fR" +is the same as +.QW "\fBconfigure \-verbose {pass start}\fR" . .TP -\fB-preservecore \fIlevel\fR +\fB\-preservecore \fIlevel\fR Sets the core preservation level to \fIlevel\fR. This level determines how stringent checks for core files are. Default value is 0. Levels are defined as: .RS .IP 0 -No checking - do not check for core files at the end of each test -command, but do check for them in [\fBrunAllTests\fR] after all +No checking \(em do not check for core files at the end of each test +command, but do check for them in \fBrunAllTests\fR after all test files have been evaluated. .IP 1 -Also check for core files at the end of each [\fBtest\fR] command. +Also check for core files at the end of each \fBtest\fR command. .IP 2 Check for core files at all times described above, and save a -copy of each core file produced in [\fBconfigure -tmpdir\fR]. +copy of each core file produced in \fBconfigure \-tmpdir\fR. .RE .TP -\fB-limitconstraints \fIboolean\fR -Sets the mode by which [\fBtest\fR] honors constraints as described +\fB\-limitconstraints \fIboolean\fR +Sets the mode by which \fBtest\fR honors constraints as described in \fBTESTS\fR above. Default value is false. .TP -\fB-constraints \fIlist\fR +\fB\-constraints \fIlist\fR Sets all the constraints in \fIlist\fR to true. Also used in -combination with [\fBconfigure -limitconstraints true\fR] to control an +combination with \fBconfigure \-limitconstraints true\fR to control an alternative constraint mode as described in \fBTESTS\fR above. Default value is an empty list. .TP -\fB-tmpdir \fIdirectory\fR -Sets the temporary directory to be used by [\fBmakeFile\fR], -[\fBmakeDirectory\fR], [\fBviewFile\fR], [\fBremoveFile\fR], -and [\fBremoveDirectory\fR] as the default directory where +\fB\-tmpdir \fIdirectory\fR +Sets the temporary directory to be used by \fBmakeFile\fR, +\fBmakeDirectory\fR, \fBviewFile\fR, \fBremoveFile\fR, +and \fBremoveDirectory\fR as the default directory where temporary files and directories created by test files should -be created. Default value is [\fBworkingDirectory\fR]. +be created. Default value is \fBworkingDirectory\fR. .TP -\fB-testdir \fIdirectory\fR -Sets the directory searched by [\fBrunAllTests\fR] for test files -and subdirectories. Default value is [\fBworkingDirectory\fR]. +\fB\-testdir \fIdirectory\fR +Sets the directory searched by \fBrunAllTests\fR for test files +and subdirectories. Default value is \fBworkingDirectory\fR. .TP -\fB-file \fIpatternList\fR -Sets the list of patterns used by [\fBrunAllTests\fR] to determine -what test files to evaluate. Default value is \fB*.test\fR. +\fB\-file \fIpatternList\fR +Sets the list of patterns used by \fBrunAllTests\fR to determine +what test files to evaluate. Default value is +.QW \fB*.test\fR . .TP -\fB-notfile \fIpatternList\fR -Sets the list of patterns used by [\fBrunAllTests\fR] to determine -what test files to skip. Default value is \fBl.*.test\fR, so -that any SCCS lock files are skipped. +\fB\-notfile \fIpatternList\fR +Sets the list of patterns used by \fBrunAllTests\fR to determine +what test files to skip. Default value is +.QW \fBl.*.test\fR , +so that any SCCS lock files are skipped. .TP -\fB-relateddir \fIpatternList\fR -Sets the list of patterns used by [\fBrunAllTests\fR] to determine +\fB\-relateddir \fIpatternList\fR +Sets the list of patterns used by \fBrunAllTests\fR to determine what subdirectories to search for an \fBall.tcl\fR file. Default -value is \fB*\fR. +value is +.QW \fB*\fR . .TP -\fB-asidefromdir \fIpatternList\fR -Sets the list of patterns used by [\fBrunAllTests\fR] to determine +\fB\-asidefromdir \fIpatternList\fR +Sets the list of patterns used by \fBrunAllTests\fR to determine what subdirectories to skip when searching for an \fBall.tcl\fR file. Default value is an empty list. .TP -\fB-match \fIpatternList\fR -Set the list of patterns used by [\fBtest\fR] to determine whether -a test should be run. Default value is \fB*\fR. +\fB\-match \fIpatternList\fR +Set the list of patterns used by \fBtest\fR to determine whether +a test should be run. Default value is +.QW \fB*\fR . .TP -\fB-skip \fIpatternList\fR -Set the list of patterns used by [\fBtest\fR] to determine whether +\fB\-skip \fIpatternList\fR +Set the list of patterns used by \fBtest\fR to determine whether a test should be skipped. Default value is an empty list. .TP -\fB-load \fIscript\fR -Sets a script to be evaluated by [\fBloadTestedCommands\fR]. +\fB\-load \fIscript\fR +Sets a script to be evaluated by \fBloadTestedCommands\fR. Default value is an empty script. .TP -\fB-loadfile \fIfilename\fR +\fB\-loadfile \fIfilename\fR Sets the filename from which to read a script to be evaluated -by [\fBloadTestedCommands\fR]. This is an alternative to -\fB-load\fR. They cannot be used together. +by \fBloadTestedCommands\fR. This is an alternative to +\fB\-load\fR. They cannot be used together. .TP -\fB-outfile \fIfilename\fR +\fB\-outfile \fIfilename\fR Sets the file to which all output produced by tcltest should be -written. A file named \fIfilename\fR will be [\fBopen\fR]ed for writing, -and the resulting channel will be set as the value of [\fBoutputChannel\fR]. +written. A file named \fIfilename\fR will be \fBopen\fRed for writing, +and the resulting channel will be set as the value of \fBoutputChannel\fR. .TP -\fB-errfile \fIfilename\fR +\fB\-errfile \fIfilename\fR Sets the file to which all error output produced by tcltest -should be written. A file named \fIfilename\fR will be [\fBopen\fR]ed +should be written. A file named \fIfilename\fR will be \fBopen\fRed for writing, and the resulting channel will be set as the value -of [\fBerrorChannel\fR]. +of \fBerrorChannel\fR. .SH "CREATING TEST SUITES WITH TCLTEST" .PP -The fundamental element of a test suite is the individual [\fBtest\fR] +The fundamental element of a test suite is the individual \fBtest\fR command. We begin with several examples. .IP [1] Test of a script that returns normally. @@ -929,17 +944,17 @@ Test with a constraint. .CE .RE .PP -At the next higher layer of organization, several [\fBtest\fR] commands +At the next higher layer of organization, several \fBtest\fR commands are gathered together into a single test file. Test files should have names with the \fB.test\fR extension, because that is the default pattern -used by [\fBrunAllTests\fR] to find test files. It is a good rule of +used by \fBrunAllTests\fR to find test files. It is a good rule of thumb to have one test file for each source code file of your project. It is good practice to edit the test file and the source code file together, keeping tests synchronized with code changes. .PP -Most of the code in the test file should be the [\fBtest\fR] commands. +Most of the code in the test file should be the \fBtest\fR commands. Use constraints to skip tests, rather than conditional evaluation -of [\fBtest\fR]. +of \fBtest\fR. .IP [5] Recommended system for writing conditional tests, using constraints to guard: @@ -966,18 +981,18 @@ if $myRequirement { .CE .RE .PP -Use the \fB-setup\fR and \fB-cleanup\fR options to establish and release +Use the \fB\-setup\fR and \fB\-cleanup\fR options to establish and release all context requirements of the test body. Do not make tests depend on prior tests in the file. Those prior tests might be skipped. If several consecutive tests require the same context, the appropriate setup and cleanup scripts may be stored in variable for passing to each tests -\fB-setup\fR and \fB-cleanup\fR options. This is a better solution than -performing setup outside of [\fBtest\fR] commands, because the setup will +\fB\-setup\fR and \fB\-cleanup\fR options. This is a better solution than +performing setup outside of \fBtest\fR commands, because the setup will only be done if necessary, and any errors during setup will be reported, and not cause the test file to abort. .PP A test file should be able to be combined with other test files and not -interfere with them, even when [\fBconfigure -singleproc 1\fR] causes +interfere with them, even when \fBconfigure \-singleproc 1\fR causes all files to be evaluated in a common interpreter. A simple way to achieve this is to have your tests define all their commands and variables in a namespace that is deleted when the test file evaluation is complete. @@ -985,11 +1000,11 @@ A good namespace to use is a child namespace \fBtest\fR of the namespace of the module you are testing. .PP A test file should also be able to be evaluated directly as a script, -not depending on being called by a master [\fBrunAllTests\fR]. This +not depending on being called by a master \fBrunAllTests\fR. This means that each test file should process command line arguments to give the tester all the configuration control that \fBtcltest\fR provides. .PP -After all [\fBtest\fR]s in a test file, the command [\fBcleanupTests\fR] +After all \fBtest\fRs in a test file, the command \fBcleanupTests\fR should be called. .IP [7] Here is a sketch of a sample test file illustrating those points: @@ -1021,9 +1036,9 @@ namespace delete ::example::test .PP The next level of organization is a full test suite, made up of several test files. One script is used to control the entire suite. The -basic function of this script is to call [\fBrunAllTests\fR] after +basic function of this script is to call \fBrunAllTests\fR after doing any necessary setup. This script is usually named \fBall.tcl\fR -because that's the default name used by [\fBrunAllTests\fR] when combining +because that is the default name used by \fBrunAllTests\fR when combining multiple test suites into one testing run. .IP [8] Here is a sketch of a sample test suite master script: @@ -1048,8 +1063,8 @@ here. They are no longer part of the supported public interface of to continue to support existing test suites written to the older interface specifications, many of those deprecated commands and variables still work as before. For example, in many circumstances, -[\fBconfigure\fR] will be automatically called shortly after -[\fBpackage require tcltest 2.1\fR] succeeds with arguments +\fBconfigure\fR will be automatically called shortly after +\fBpackage require tcltest 2.1\fR succeeds with arguments from the variable \fB::argv\fR. This is to support test suites that depend on the old behavior that \fBtcltest\fR was automatically configured from command line arguments. New test files should not @@ -1061,7 +1076,7 @@ eval \fB::tcltest::configure\fR $::argv .PP to establish a configuration from command line arguments. .SH "KNOWN ISSUES" -There are two known issues related to nested evaluations of [\fBtest\fR]. +There are two known issues related to nested evaluations of \fBtest\fR. The first issue relates to the stack level in which test scripts are executed. Tests nested within other tests may be executed at the same stack level as the outermost test. For example, in the following code: @@ -1078,23 +1093,34 @@ stack level as the outermost test. For example, in the following code: any script executed in level-2.1 may be executed at the same stack level as the script defined for level-1.1. .PP -In addition, while two [\fBtest\fR]s have been run, results will only -be reported by [\fBcleanupTests\fR] for tests at the same level as +In addition, while two \fBtest\fRs have been run, results will only +be reported by \fBcleanupTests\fR for tests at the same level as test level-1.1. However, test results for all tests run prior to level-1.1 will be available when test level-2.1 runs. What this means is that if you try to access the test results for test level-2.1, -it will may say that 'm' tests have run, 'n' tests have -been skipped, 'o' tests have passed and 'p' tests have failed, -where 'm', 'n', 'o', and 'p' refer to tests that were run at the -same test level as test level-1.1. +it will may say that +.QW m +tests have run, +.QW n +tests have been skipped, +.QW o +tests have passed and +.QW p +tests have failed, where +.QW m , +.QW n , +.QW o , +and +.QW p +refer to tests that were run at the same test level as test level-1.1. .PP Implementation of output and error comparison in the test command depends on usage of ::puts in your application code. Output is intercepted by redefining the ::puts command while the defined test script is being run. Errors thrown by C procedures or printed directly from C applications will not be caught by the test command. -Therefore, usage of the \fB-output\fR and \fB-errorOutput\fR -options to [\fBtest\fR] is useful only for pure Tcl applications -that use [\fB::puts\fR] to produce output. +Therefore, usage of the \fB\-output\fR and \fB\-errorOutput\fR +options to \fBtest\fR is useful only for pure Tcl applications +that use \fB::puts\fR to produce output. .SH KEYWORDS test, test harness, test suite diff --git a/doc/tclvars.n b/doc/tclvars.n index d664784..4317436 100644 --- a/doc/tclvars.n +++ b/doc/tclvars.n @@ -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. '\" -'\" RCS: @(#) $Id: tclvars.n,v 1.30 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: tclvars.n,v 1.31 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH tclvars n 8.0 Tcl "Tcl Built-In Commands" @@ -14,7 +14,6 @@ .SH NAME tclvars \- Variables used by Tcl .BE - .SH DESCRIPTION .PP The following global variables are created and managed automatically @@ -27,7 +26,7 @@ whose elements are the environment variables for the process. Reading an element will return the value of the corresponding environment variable. Setting an element of the array will modify the corresponding -environment variable or create a new one if it doesn't already +environment variable or create a new one if it does not already exist. Unsetting an element of \fBenv\fR will remove the corresponding environment variable. @@ -39,13 +38,16 @@ variables. .RS Under Windows, the environment variables PATH and COMSPEC in any capitalization are converted automatically to upper case. For instance, the -PATH variable could be exported by the operating system as ``path'', -``Path'', ``PaTh'', etc., causing otherwise simple Tcl code to have to +PATH variable could be exported by the operating system as +.QW path , +.QW Path , +.QW PaTh , +etc., causing otherwise simple Tcl code to have to support many special cases. All other environment variables inherited by Tcl are left unmodified. Setting an env array variable to blank is the same 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 variable -won't work on windows and is discouraged for cross-platform usage. +will not work on Windows and is discouraged for cross-platform usage. .RE .TP \fBerrorCode\fR @@ -78,7 +80,8 @@ The \fIsigName\fR element will be the symbolic name of the signal that caused the process to terminate; it will be one of the names from the include file signal.h, such as \fBSIGPIPE\fR. The \fImsg\fR element will be a short human-readable message -describing the signal, such as ``write on pipe with no readers'' +describing the signal, such as +.QW "write on pipe with no readers" for \fBSIGPIPE\fR. .TP \fBCHILDSTATUS\fI pid code\fR @@ -95,7 +98,8 @@ The \fIsigName\fR element will be the symbolic name of the signal that caused the process to suspend; this will be one of the names from the include file signal.h, such as \fBSIGTTIN\fR. The \fImsg\fR element will be a short human-readable message -describing the signal, such as ``background tty read'' +describing the signal, such as +.QW "background tty read" for \fBSIGTTIN\fR. .TP \fBNONE\fR @@ -113,13 +117,14 @@ of the error that occurred, such as \fBENOENT\fR; this will be one of the values defined in the include file errno.h. The \fImsg\fR element will be a human-readable message corresponding to \fIerrName\fR, such as -``no such file or directory'' for the \fBENOENT\fR case. +"no such file or directory" +for the \fBENOENT\fR case. .PP To set the \fB-errorcode\fR return option, applications should use library procedures such as \fBTcl_SetObjErrorCode\fR, \fBTcl_SetReturnOptions\fR, and \fBTcl_PosixError\fR, or they may invoke the \fB-errorcode\fR option of the \fBreturn\fR command. -If one of these methods hasn't been used, then the Tcl +If one of these methods has not been used, then the Tcl interpreter will reset the variable to \fBNONE\fR after the next error. .RE @@ -149,7 +154,7 @@ is created by searching several different directories until one is found that contains an appropriate Tcl startup script. If the \fBTCL_LIBRARY\fR environment variable exists, then the directory it names is checked first. -If \fBTCL_LIBRARY\fR isn't set or doesn't refer to an appropriate +If \fBTCL_LIBRARY\fR is not set or doesn't refer to an appropriate directory, then Tcl checks several other directories based on a compiled-in default location, the location of the binary containing the application, and the current working directory. @@ -184,7 +189,7 @@ 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 instruction set. The elements listed below will always -be defined, but they may have empty strings as values if Tcl couldn't +be defined, but they may have empty strings as values if Tcl could not retrieve any relevant information. In addition, extensions and applications may add additional values to the array. The predefined elements are: @@ -263,7 +268,9 @@ binary number. .VE 8.5 .PP .RS -17 digits is ``perfect'' for IEEE floating-point in that it allows +17 digits is +.QW perfect +for IEEE floating-point in that it allows double-precision values to be converted to strings and back to binary with no loss of information. However, using 17 digits prevents any rounding, which produces longer, less intuitive results. For example, @@ -334,7 +341,9 @@ This variable and functionality only exist if .TP \fBtcl_wordchars\fR The value of this variable is a regular expression that can be set to -control what are considered ``word'' characters, for instances like +control what are considered +.QW word +characters, for instances like selecting a word by double-clicking in text in Tk. It is platform dependent. On Windows, it defaults to \fB\eS\fR, meaning anything but a Unicode space character. Otherwise it defaults to \fB\ew\fR, @@ -342,7 +351,9 @@ 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 ``non-word'' characters, for instances like +control what are considered +.QW non-word +characters, for instances like selecting a word by double-clicking in text in Tk. It is platform dependent. On Windows, it defaults to \fB\es\fR, meaning any Unicode space character. Otherwise it defaults to \fB\eW\fR, which is anything but a @@ -383,9 +394,7 @@ variable: \fBgeometry\fR If set, contains the user-supplied geometry specification to use for the main Tk window. - .SH "SEE ALSO" eval(n), tclsh(1), wish(1) - .SH KEYWORDS arithmetic, bytecode, compiler, error, environment, POSIX, precision, subprocess, variables @@ -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. '\" -'\" RCS: @(#) $Id: time.n,v 1.7 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: time.n,v 1.8 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH time n "" Tcl "Tcl Built-In Commands" @@ -20,7 +20,7 @@ time \- Time the execution of a script .SH DESCRIPTION .PP This command will call the Tcl interpreter \fIcount\fR -times to evaluate \fIscript\fR (or once if \fIcount\fR isn't +times to evaluate \fIscript\fR (or once if \fIcount\fR is not specified). It will then return a string of the form .CS \fB503 microseconds per iteration\fR @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: tm.n,v 1.10 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: tm.n,v 1.11 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH tm n 8.5 Tcl "Tcl Built-In Commands" @@ -20,7 +20,6 @@ tm \- Facilities for locating and loading of Tcl Modules \fB::tcl::tm::roots\fR \fIpath\fR... .fi .BE - .SH DESCRIPTION This document describes the facilities for locating and loading Tcl Modules. The following commands are supported: @@ -56,8 +55,11 @@ that they are searched for modules. .TP \fB::tcl::tm::roots\fR \fIpath\fR... Similar to \fBpath add\fR, and layered on top of it. This command -takes a list of paths, extends each with "\fBtcl\fIX\fB/site-tcl\fR", -and "\fBtcl\fIX\fB/\fIX\fB.\fIy\fR", for major version \fIX\fR of the +takes a list of paths, extends each with +.QW "\fBtcl\fIX\fB/site-tcl\fR" , +and +.QW "\fBtcl\fIX\fB/\fIX\fB.\fIy\fR" , +for major version \fIX\fR of the Tcl interpreter and minor version \fIy\fR less than or equal to the minor version of the interpreter, and adds the resulting set of paths to the list of paths to search. @@ -112,7 +114,11 @@ For any two directories, neither is an ancestor directory of the other. .PP This is required to avoid ambiguities in package naming. If for -example the two directories "\fIfoo/\fR" and "\fIfoo/cool\fR" were on +example the two directories +.QW "\fIfoo/\fR" +and +.QW "\fIfoo/cool\fR" +were on the path a package named \fBcool::ice\fR could be found via the names \fBcool::ice\fR or \fBice\fR, the latter potentially obscuring a package named \fBice\fR, unqualified. @@ -120,14 +126,18 @@ obscuring a package named \fBice\fR, unqualified. Before the search is started, the name of the requested package is translated into a partial path, using the following algorithm: .IP -All occurrences of "\fB::\fR" in the package name are replaced by +All occurrences of +.QW "\fB::\fR" +in the package name are replaced by the appropriate directory separator character for the platform we are -on. On Unix, for example, this is "\fB/\fR". +on. On Unix, for example, this is +.QW "\fB/\fR" . .PP Example: .IP The requested package is \fBencoding::base64\fR. The generated -partial path is "\fIencoding/base64\fR" +partial path is +.QW "\fIencoding/base64\fR" . .PP After this translation the package is looked for in all module paths, by combining them one-by-one, first to last with the partial path to @@ -157,12 +167,13 @@ Both package name \fBPNAME\fR and package version \fBPVERSION\fR are extracted from the filename \fBMF\fR according to the definition below: .CS -\fBMF\fR = /module_path/\fBPNAME'\fR-\fBPVERSION\fR.tm +\fBMF\fR = /module_path/\fBPNAME\(fm\fR-\fBPVERSION\fR.tm .CE .PP -Where \fBPNAME'\fR is the partial path of the module as defined in +Where \fBPNAME\(fm\fR is the partial path of the module as defined in section \fBFINDING MODULES\fR, and translated into \fB\fRPNAME by -changing all directory separators to "\fB::\fR", +changing all directory separators to +.QW "\fB::\fR" , and \fBmodule_path\fR is the path (from the list of paths to search) that we found the module file under. .PP @@ -253,13 +264,11 @@ environment variables: \fB$::env(TCL8.0_TM_PATH)\fR .CE .RE - .SH "SEE ALSO" -package(n), Tcl Improvement Proposal #189 "\fITcl Modules\fR" (online -at http://tip.tcl.tk/189.html), Tcl Improvement Proposal #190 -"\fIImplementation Choices for Tcl Modules\fR" (online at -http://tip.tcl.tk/190.html) - - +package(n), Tcl Improvement Proposal #189 +.QW "\fITcl Modules\fR" +(online at http://tip.tcl.tk/189.html), Tcl Improvement Proposal #190 +.QW "\fIImplementation Choices for Tcl Modules\fR" +(online at http://tip.tcl.tk/190.html) .SH "KEYWORDS" modules, package diff --git a/doc/trace.n b/doc/trace.n index e929a53..2b69afc 100644 --- a/doc/trace.n +++ b/doc/trace.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: trace.n,v 1.21 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: trace.n,v 1.22 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH trace n "8.4" Tcl "Tcl Built-In Commands" @@ -17,11 +17,10 @@ trace \- Monitor variable accesses, command usages and command executions .SH SYNOPSIS \fBtrace \fIoption\fR ?\fIarg arg ...\fR? .BE - .SH DESCRIPTION .PP This command causes Tcl commands to be executed whenever certain operations are -invoked. The legal \fIoption\fR's (which may be abbreviated) are: +invoked. The legal \fIoption\fRs (which may be abbreviated) are: .TP \fBtrace add \fItype name ops ?args?\fR Where \fItype\fR is \fBcommand\fR, \fBexecution\fR, or \fBvariable\fR. @@ -40,7 +39,8 @@ one or more of the following items: \fBrename\fR Invoke \fIcommand\fR whenever the command is renamed. Note that renaming to the empty string is considered deletion, and will not -be traced with '\fBrename\fR'. +be traced with +.QW \fBrename\fR . .TP \fBdelete\fR Invoke \fIcommand\fR when the command is deleted. Commands can be @@ -57,7 +57,9 @@ command is as follows: .CE \fIOldName\fR and \fInewName\fR give the traced command's current (old) name, and the name to which it is being renamed (the empty -string if this is a 'delete' operation). +string if this is a +.QW delete +operation). \fIOp\fR indicates what operation is being performed on the command, and is one of \fBrename\fR or \fBdelete\fR as defined above. The trace operation cannot be used to stop a command @@ -92,9 +94,12 @@ just after the actual execution takes place. \fBenterstep\fR Invoke \fIcommand\fR for every Tcl command which is executed inside the procedure \fIname\fR, just before the actual execution -takes place. For example if we have 'proc foo {} { puts "hello" }', +takes place. For example if we have +.QW "proc foo {} { puts \N'34'hello\N'34' }" , then an \fIenterstep\fR trace would be -invoked just before \fIputs "hello"\fR is executed. +invoked just before +.QW "\fIputs \N'34'hello\N'34'\fR" +is executed. Setting an \fIenterstep\fR trace on a \fIcommand\fR will not result in an error and is simply ignored. .TP @@ -121,7 +126,8 @@ all arguments in their fully expanded form. command execution, and is one of \fBenter\fR or \fBenterstep\fR as defined above. The trace operation can be used to stop the command from executing, by deleting the command in question. Of -course when the command is subsequently executed, an 'invalid command' +course when the command is subsequently executed, an +.QW "invalid command" error will occur. .PP For \fBleave\fR and \fBleavestep\fR operations: @@ -289,14 +295,14 @@ Where \fItype\fR is either \fBcommand\fR, \fBexecution\fR or \fBvariable\fR. If there is a trace set on command \fIname\fR with the operations and command given by \fIopList\fR and \fIcommand\fR, then the trace is removed, so that \fIcommand\fR will never again be invoked. Returns -an empty string. If \fIname\fR doesn't exist, the command will throw +an empty string. If \fIname\fR does not exist, the command will throw an error. .TP \fBtrace remove execution\fI name opList command\fR If there is a trace set on command \fIname\fR with the operations and command given by \fIopList\fR and \fIcommand\fR, then the trace is removed, so that \fIcommand\fR will never again be invoked. Returns -an empty string. If \fIname\fR doesn't exist, the command will throw +an empty string. If \fIname\fR does not exist, the command will throw an error. .TP \fBtrace remove variable\fI name opList command\fR @@ -314,23 +320,23 @@ Where \fItype\fR is either \fBcommand\fR, \fBexecution\fR or \fBvariable\fR. Returns a list containing one element for each trace currently set on command \fIname\fR. Each element of the list is itself a list containing two elements, which are the \fIopList\fR and \fIcommand\fR -associated with the trace. If \fIname\fR doesn't have any traces set, +associated with the trace. If \fIname\fR does not have any traces set, then the result of the command will be an empty string. If \fIname\fR -doesn't exist, the command will throw an error. +does not exist, the command will throw an error. .TP \fBtrace info execution\fI name\fR Returns a list containing one element for each trace currently set on command \fIname\fR. Each element of the list is itself a list containing two elements, which are the \fIopList\fR and \fIcommand\fR -associated with the trace. If \fIname\fR doesn't have any traces set, +associated with the trace. If \fIname\fR does not have any traces set, then the result of the command will be an empty string. If \fIname\fR -doesn't exist, the command will throw an error. +does not exist, the command will throw an error. .TP \fBtrace info variable\fI name\fR Returns a list containing one element for each trace currently set on variable \fIname\fR. Each element of the list is itself a list containing two elements, which are the \fIopList\fR and \fIcommand\fR -associated with the trace. If \fIname\fR doesn't exist or doesn't +associated with the trace. If \fIname\fR does not exist or does not have any traces set, then the result of the command will be an empty string. .RE @@ -377,9 +383,7 @@ proc doMult args { \fBtrace add\fR variable foo write doMult \fBtrace add\fR variable bar write doMult .CE - .SH "SEE ALSO" set(n), unset(n) - .SH KEYWORDS read, command, rename, variable, write, trace, unset diff --git a/doc/unknown.n b/doc/unknown.n index 5b6f41e..c0fab20 100644 --- a/doc/unknown.n +++ b/doc/unknown.n @@ -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. '\" -'\" RCS: @(#) $Id: unknown.n,v 1.7 2006/11/03 00:34:52 hobbs Exp $ +'\" RCS: @(#) $Id: unknown.n,v 1.8 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH unknown n "" Tcl "Tcl Built-In Commands" @@ -16,11 +16,10 @@ unknown \- Handle attempts to use non-existent commands .SH SYNOPSIS \fBunknown \fIcmdName \fR?\fIarg arg ...\fR? .BE - .SH DESCRIPTION .PP This command is invoked by the Tcl interpreter whenever a script -tries to invoke a command that doesn't exist. The default implementation +tries to invoke a command that does not exist. The default implementation of \fBunknown\fR is a library procedure defined when Tcl initializes an interpreter. You can override the default \fBunknown\fR to change its functionality, or you can register a new handler for individual namespaces @@ -54,7 +53,7 @@ If the auto-load fails then \fBunknown\fR calls \fBauto_execok\fR to see if there is an executable file by the name \fIcmd\fR. If so, it invokes the Tcl \fBexec\fR command with \fIcmd\fR and all the \fIargs\fR as arguments. -If \fIcmd\fR can't be auto-executed, \fBunknown\fR checks to +If \fIcmd\fR cannot be auto-executed, \fBunknown\fR checks to see if the command was invoked at top-level and outside of any script. If so, then \fBunknown\fR takes two additional steps. First, it sees if \fIcmd\fR has one of the following three forms: @@ -88,9 +87,7 @@ proc \fBunknown\fR args { uplevel 1 [list _original_unknown {*}$args] } .CE - .SH "SEE ALSO" info(n), proc(n), interp(n), library(n), namespace(n) - .SH KEYWORDS error, non-existent command diff --git a/doc/unset.n b/doc/unset.n index 036429f..655ec0f 100644 --- a/doc/unset.n +++ b/doc/unset.n @@ -1,66 +1,63 @@ -'\" -'\" Copyright (c) 1993 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. -'\" Copyright (c) 2000 Ajuba Solutions. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -'\" RCS: @(#) $Id: unset.n,v 1.10 2005/05/10 18:34:03 kennykb Exp $ -'\" -.so man.macros -.TH unset n 8.4 Tcl "Tcl Built-In Commands" -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -unset \- Delete variables -.SH SYNOPSIS -\fBunset \fR?\fI\-nocomplain\fR? ?\fI\-\-\fR? ?\fIname name name ...\fR? -.BE - -.SH DESCRIPTION -.PP -This command removes one or more variables. -Each \fIname\fR is a variable name, specified in any of the -ways acceptable to the \fBset\fR command. -If a \fIname\fR refers to an element of an array then that -element is removed without affecting the rest of the array. -If a \fIname\fR consists of an array name with no parenthesized -index, then the entire array is deleted. -The \fBunset\fR command returns an empty string as result. -If \fI\-nocomplain\fR is specified as the first argument, any possible -errors are suppressed. The option may not be abbreviated, in order to -disambiguate it from possible variable names. The option \fI\-\-\fR -indicates the end of the options, and should be used if you wish to -remove a variable with the same name as any of the options. -If an error occurs, any variables after the named one causing the error not -deleted. An error can occur when the named variable doesn't exist, or the -name refers to an array element but the variable is a scalar, or the name -refers to a variable in a non-existent namespace. -.SH EXAMPLE -Create an array containing a mapping from some numbers to their -squares and remove the array elements for non-prime numbers: -.CS -array set squares { - 1 1 6 36 - 2 4 7 49 - 3 9 8 64 - 4 16 9 81 - 5 25 10 100 -} - -puts "The squares are:" -parray squares - -\fBunset\fR squares(1) squares(4) squares(6) -\fBunset\fR squares(8) squares(9) squares(10) - -puts "The prime squares are:" -parray squares -.CE - -.SH "SEE ALSO" -set(n), trace(n), upvar(n) - -.SH KEYWORDS -remove, variable +'\"
+'\" Copyright (c) 1993 The Regents of the University of California.
+'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
+'\" Copyright (c) 2000 Ajuba Solutions.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" RCS: @(#) $Id: unset.n,v 1.11 2007/10/29 01:42:19 dkf Exp $
+'\"
+.so man.macros
+.TH unset n 8.4 Tcl "Tcl Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+unset \- Delete variables
+.SH SYNOPSIS
+\fBunset \fR?\fI\-nocomplain\fR? ?\fI\-\-\fR? ?\fIname name name ...\fR?
+.BE
+.SH DESCRIPTION
+.PP
+This command removes one or more variables.
+Each \fIname\fR is a variable name, specified in any of the
+ways acceptable to the \fBset\fR command.
+If a \fIname\fR refers to an element of an array then that
+element is removed without affecting the rest of the array.
+If a \fIname\fR consists of an array name with no parenthesized
+index, then the entire array is deleted.
+The \fBunset\fR command returns an empty string as result.
+If \fI\-nocomplain\fR is specified as the first argument, any possible
+errors are suppressed. The option may not be abbreviated, in order to
+disambiguate it from possible variable names. The option \fI\-\-\fR
+indicates the end of the options, and should be used if you wish to
+remove a variable with the same name as any of the options.
+If an error occurs, any variables after the named one causing the error not
+deleted. An error can occur when the named variable does not exist, or the
+name refers to an array element but the variable is a scalar, or the name
+refers to a variable in a non-existent namespace.
+.SH EXAMPLE
+Create an array containing a mapping from some numbers to their
+squares and remove the array elements for non-prime numbers:
+.CS
+array set squares {
+ 1 1 6 36
+ 2 4 7 49
+ 3 9 8 64
+ 4 16 9 81
+ 5 25 10 100
+}
+
+puts "The squares are:"
+parray squares
+
+\fBunset\fR squares(1) squares(4) squares(6)
+\fBunset\fR squares(8) squares(9) squares(10)
+
+puts "The prime squares are:"
+parray squares
+.CE
+.SH "SEE ALSO"
+set(n), trace(n), upvar(n)
+.SH KEYWORDS
+remove, variable
diff --git a/doc/update.n b/doc/update.n index e0e5a5f..4f7880a 100644 --- a/doc/update.n +++ b/doc/update.n @@ -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. '\" -'\" RCS: @(#) $Id: update.n,v 1.8 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: update.n,v 1.9 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH update n 7.5 Tcl "Tcl Built-In Commands" @@ -19,7 +19,8 @@ update \- Process pending events and idle callbacks .SH DESCRIPTION .PP -This command is used to bring the application ``up to date'' +This command is used to bring the application +.QW "up to date" by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed. .PP diff --git a/doc/uplevel.n b/doc/uplevel.n index cb760ae..ddce400 100644 --- a/doc/uplevel.n +++ b/doc/uplevel.n @@ -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. '\" -'\" RCS: @(#) $Id: uplevel.n,v 1.8 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: uplevel.n,v 1.9 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH uplevel n "" Tcl "Tcl Built-In Commands" @@ -16,7 +16,6 @@ uplevel \- Execute a script in a different stack frame .SH SYNOPSIS \fBuplevel \fR?\fIlevel\fR?\fI arg \fR?\fIarg ...\fR? .BE - .SH DESCRIPTION .PP All of the \fIarg\fR arguments are concatenated as if they had @@ -55,7 +54,7 @@ the command .CE then the \fBset\fR command will modify the same variable \fBx\fR in \fBb\fR's context: the procedure \fBc\fR does not appear to be on the call stack -when \fBd\fR is executing. The command ``\fBinfo level\fR'' may +when \fBd\fR is executing. The \fBinfo level\fR command may be used to obtain the level of the current procedure. .PP \fBUplevel\fR makes it possible to implement new control @@ -92,9 +91,7 @@ proc do {body while condition} { } } .CE - .SH "SEE ALSO" apply(n), namespace(n), upvar(n) - .SH KEYWORDS context, level, namespace, stack frame, variables diff --git a/doc/upvar.n b/doc/upvar.n index c99f73d..0db712a 100644 --- a/doc/upvar.n +++ b/doc/upvar.n @@ -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. '\" -'\" RCS: @(#) $Id: upvar.n,v 1.14 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: upvar.n,v 1.15 2007/10/29 01:42:19 dkf Exp $ '\" .so man.macros .TH upvar n "" Tcl "Tcl Built-In Commands" @@ -24,7 +24,7 @@ procedure to refer to variables in an enclosing procedure call or to global variables. \fILevel\fR may have any of the forms permitted for the \fBuplevel\fR command, and may be omitted if the first letter of the first \fIotherVar\fR -isn't \fB#\fR or a digit (it defaults to \fB1\fR). +is not \fB#\fR or a digit (it defaults to \fB1\fR). For each \fIotherVar\fR argument, \fBupvar\fR makes the variable by that name in the procedure frame given by \fIlevel\fR (or at global level, if \fIlevel\fR is \fB#0\fR) accessible @@ -81,7 +81,10 @@ unexpected manner. If a variable trace is defined on \fIotherVar\fR, that trace will be triggered by actions involving \fImyVar\fR. However, the trace procedure will be passed the name of \fImyVar\fR, rather than the name of \fIotherVar\fR. Thus, the output of the following code -will be "\fIlocalVar\fR" rather than "\fIoriginalVar\fR": +will be +.QW "\fIlocalVar\fR" +rather than +.QW "\fIoriginalVar\fR" : .CS proc \fItraceproc\fR { name index op } { puts $name |