summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-11-16 15:26:12 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-11-16 15:26:12 (GMT)
commita3b4f81896bf2f0b9eef411b23e362eeccfddbc1 (patch)
treeef176966a51f0776480f63d711b30bf1c191b408 /doc
parent837b9c9c7f6f3f01e286eb8ab111b268eba47842 (diff)
downloadtcl-a3b4f81896bf2f0b9eef411b23e362eeccfddbc1.zip
tcl-a3b4f81896bf2f0b9eef411b23e362eeccfddbc1.tar.gz
tcl-a3b4f81896bf2f0b9eef411b23e362eeccfddbc1.tar.bz2
Improvements after review by Arjen Markus.
Diffstat (limited to 'doc')
-rw-r--r--doc/binary.n68
-rw-r--r--doc/tclvars.n28
2 files changed, 61 insertions, 35 deletions
diff --git a/doc/binary.n b/doc/binary.n
index 0f33bfc..0a4058a 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.35 2007/10/29 11:28:50 dkf Exp $
+'\" RCS: @(#) $Id: binary.n,v 1.36 2007/11/16 15:26:12 dkf Exp $
'\"
.so man.macros
.TH binary n 8.0 Tcl "Tcl Built-In Commands"
@@ -69,9 +69,10 @@ Stores a byte string of length \fIcount\fR in the output string.
Every character is taken as modulo 256 (i.e. the low byte of every
character is used, and the high byte discarded) so when storing
character strings not wholly expressible using the characters \eu0000-\eu00ff,
-the \fBencoding convertto\fR command should be used
-first if this truncation is not desired (i.e. if the characters are
-not part of the ISO 8859-1 character set.)
+the \fBencoding convertto\fR command should be used first to change
+the string into an external representation
+if this truncation is not desired (i.e. if the characters are
+not part of the ISO 8859\-1 character set.)
If \fIarg\fR has fewer than \fIcount\fR bytes, then additional zero
bytes are used to pad out the field. If \fIarg\fR is longer than the
specified length, the extra characters will be ignored. If
@@ -82,12 +83,24 @@ formatted. For example,
.CS
\fBbinary format\fR a7a*a alpha bravo charlie
.CE
-will return a string equivalent to \fBalpha\e000\e000bravoc\fR and
+will return a string equivalent to \fBalpha\e000\e000bravoc\fR,
.CS
\fBbinary format\fR a* [encoding convertto utf-8 \eu20ac]
.CE
will return a string equivalent to \fB\e342\e202\e254\fR (which is the
-UTF-8 byte sequence for a Euro-currency character).
+UTF-8 byte sequence for a Euro-currency character) and
+.CS
+\fBbinary format\fR a* [encoding convertto iso8859-15 \eu20ac]
+.CE
+will return a string equivalent to \fB\e244\fR (which is the ISO
+8859\-15 byte sequence for a Euro-currency character). Contrast these
+last two with:
+.CS
+\fBbinary format\fR a* \eu20ac
+.CE
+which returns a string equivalent to \fB\e254\fR (i.e. \fB\exac\fR) by
+truncating the high-bits of the character, and which is probably not
+what is desired.
.RE
.IP \fBA\fR 5
This form is the same as \fBa\fR except that spaces are used for
@@ -158,12 +171,11 @@ will return a string equivalent to \fB\exab\ex00\exde\exf0\fR.
.IP \fBc\fR 5
Stores one or more 8-bit integer values in the output string. If no
\fIcount\fR is specified, then \fIarg\fR must consist of an integer
-value; otherwise \fIarg\fR must consist of a list containing at least
-\fIcount\fR integer elements. The low-order 8 bits of each integer
+value. If \fIcount\fR is specified, \fIarg\fR must consist of a list
+containing at least that many integers. The low-order 8 bits of each integer
are stored as a one-byte value at the cursor position. If \fIcount\fR
-is \fB*\fR, then all of the integers in the list are formatted. If
-the number of elements in the list is fewer than \fIcount\fR, then an
-error is generated. If the number of elements in the list is greater
+is \fB*\fR, then all of the integers in the list are formatted. If the
+number of elements in the list is greater
than \fIcount\fR, then the extra elements are ignored. For example,
.RS
.CS
@@ -455,15 +467,21 @@ is \fB*\fR, then all of the remaining bytes in \fIstring\fR will be
scanned into the variable. If \fIcount\fR is omitted, then one
byte will be scanned.
All bytes scanned will be interpreted as being characters in the
-range \eu0000-\eu00ff so the \fBencoding convertfrom\fR command might be
-needed if the string is not an ISO 8859\-1 string.
+range \eu0000-\eu00ff so the \fBencoding convertfrom\fR command will be
+needed if the string is not a binary string or a string encoded in ISO
+8859\-1.
For example,
.RS
.CS
\fBbinary scan\fR abcde\e000fghi a6a10 var1 var2
.CE
will return \fB1\fR with the string equivalent to \fBabcde\e000\fR
-stored in \fIvar1\fR and \fIvar2\fR left unmodified.
+stored in \fIvar1\fR and \fIvar2\fR left unmodified, and
+.CS
+\fBbinary scan\fR \e342\e202\e254 a* var1
+set var2 [encoding convertfrom utf-8 $var1]
+.CE
+will store a Euro-currency character in \fIvar2\fR.
.RE
.IP \fBA\fR 5
This form is the same as \fBa\fR, except trailing blanks and nulls are stripped from
@@ -514,10 +532,10 @@ scanned. If \fIcount\fR is omitted, then one hex digit will be
scanned. For example,
.RS
.CS
-\fBbinary scan\fR \ex07\ex86\ex05\ex12\ex34 H3H* var1 var2
+\fBbinary scan\fR \ex07\exC6\ex05\ex1f\ex34 H3H* var1 var2
.CE
-will return \fB2\fR with \fB078\fR stored in \fIvar1\fR and
-\fB051234\fR stored in \fIvar2\fR.
+will return \fB2\fR with \fB0c8\fR stored in \fIvar1\fR and
+\fB051f34\fR stored in \fIvar2\fR.
.RE
.IP \fBh\fR 5
This form is the same as \fBH\fR, except the digits are taken in
@@ -686,15 +704,15 @@ will return \fB1\fR with \fB1.6000000238418579\fR stored in
.VS 8.5
This form is the same as \fBf\fR except that the data is interpreted
as \fIcount\fR single-precision floating point number in little-endian
-order. This conversion is not portable to systems not using IEEE
-floating point representations.
+order. This conversion is not portable to the minority of systems not
+using IEEE floating point representations.
.VE 8.5
.IP \fBR\fR 5
.VS 8.5
This form is the same as \fBf\fR except that the data is interpreted
as \fIcount\fR single-precision floating point number in big-endian
-order. This conversion is not portable to systems not using IEEE
-floating point representations.
+order. This conversion is not portable to the minority of systems not
+using IEEE floating point representations.
.VE 8.5
.IP \fBd\fR 5
This form is the same as \fBf\fR except that the data is interpreted
@@ -712,15 +730,15 @@ stored in \fIvar1\fR.
.VS 8.5
This form is the same as \fBd\fR except that the data is interpreted
as \fIcount\fR double-precision floating point number in little-endian
-order. This conversion is not portable to systems not using IEEE
-floating point representations.
+order. This conversion is not portable to the minority of systems not
+using IEEE floating point representations.
.VE 8.5
.IP \fBQ\fR 5
.VS 8.5
This form is the same as \fBd\fR except that the data is interpreted
as \fIcount\fR double-precision floating point number in big-endian
-order. This conversion is not portable to systems not using IEEE
-floating point representations.
+order. This conversion is not portable to the minority of systems not
+using IEEE floating point representations.
.VE 8.5
.IP \fBx\fR 5
Moves the cursor forward \fIcount\fR bytes in \fIstring\fR. If
diff --git a/doc/tclvars.n b/doc/tclvars.n
index f912704..dfcc4b8 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.33 2007/10/30 23:50:54 dkf Exp $
+'\" RCS: @(#) $Id: tclvars.n,v 1.34 2007/11/16 15:26:12 dkf Exp $
'\"
.so man.macros
.TH tclvars n 8.0 Tcl "Tcl Built-In Commands"
@@ -64,8 +64,9 @@ additional formats.
.RS
.TP
\fBARITH\fI code msg\fR
+.
This format is used when an arithmetic error occurs (e.g. an attempt
-to divide by zero in the \fBexpr\fR command).
+to divide zero by zero in the \fBexpr\fR command).
\fICode\fR identifies the precise error and \fImsg\fR provides a
human-readable description of the error. \fICode\fR will be either
DIVZERO (for an attempt to divide by zero),
@@ -73,6 +74,11 @@ DOMAIN (if an argument is outside the domain of a function, such as acos(\-3)),
IOVERFLOW (for integer overflow),
OVERFLOW (for a floating-point overflow),
or UNKNOWN (if the cause of the error cannot be determined).
+.RS
+.PP
+Detection of these errors depends in part on the underlying hardware
+and system libraries.
+.RE
.TP
\fBCHILDKILLED\fI pid sigName msg\fR
This format is used when a child process has been killed because of
@@ -125,10 +131,15 @@ 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 has not been used, then the Tcl
-interpreter will reset the variable to \fBNONE\fR after
+If none of these methods for setting the error code has been used,
+the Tcl interpreter will reset the variable to \fBNONE\fR after
the next error.
.RE
+.\" .TP
+.\" \fBTCL\fR ...
+.\" .
+.\" Indicates some sort of problem generated in relation to Tcl itself,
+.\" e.g. a failure to look up a channel or variable.
.TP
\fBerrorInfo\fR
This variable holds the value of the \fB\-errorinfo\fR return option
@@ -161,10 +172,11 @@ compiled-in default location, the location of the binary containing
the application, and the current working directory.
.TP
\fBtcl_patchLevel\fR
+.
When an interpreter is created Tcl initializes this variable to
hold a string giving the current patch level for Tcl, such as
-\fB7.3p2\fR for Tcl 7.3 with the first two official patches, or
-\fB7.4b4\fR for the fourth beta release of Tcl 7.4.
+\fB8.4.16\fR for Tcl 8.4 with the first sixteen official patches, or
+\fB8.5b3\fR for the third beta release of Tcl 8.5.
The value of this variable is returned by the \fBinfo patchlevel\fR
command.
.TP
@@ -305,8 +317,6 @@ Setting it to 2 generates a detailed listing in stdout of the
bytecode instructions emitted during every compilation.
This variable is useful in
tracking down suspected problems with the Tcl compiler.
-It is also occasionally useful when converting
-existing code to use Tcl8.0.
.PP
.RS
This variable and functionality only exist if
@@ -332,8 +342,6 @@ of bytecode instructions are not shown.
Setting this variable is useful in
tracking down suspected problems with the bytecode compiler
and interpreter.
-It is also occasionally useful when converting
-code to use Tcl8.0.
.PP
.RS
This variable and functionality only exist if