OriginalBugID: 790 Bug
Version: 8.0.3
SubmitDate: '1998-11-04'
LastModified: '1999-04-09'
Severity: MED
Status: Released
Submitter: pat
ChangedBy: surles
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1999-04-09'
FixedInVersion: 8.1b3
ClosedDate: '2000-10-25'
Name:
Massimo Foppa Uberti
Comments:
I have replaced the (correct) examples:
binary format c3cc* {3 -3 128 1} 257 {2 5}
will return:
\x03\xfd\x80\x01\x02\x05
because the value x01 generated by 257 can generate confusion with the
value 1
that is discarded
ObservedBehavior:
some examples in the manual page of binary command have wrong results.
There are several other mistakes.
Patch:
*** binary.n.old Tue Apr 6 12:48:01 1999
--- binary.n.new Tue Apr 6 13:12:05 1999
***************
*** 119,125 ****
.CS
\fBbinary format h3h* AB def\fR
.CE
! will return a string equivalent to \fB\\xba\\xed\\x0f\fR.
.RE
.IP \fBH\fR 5
This form is the same as \fBh\fR except that the digits are stored in
--- 119,125 ----
.CS
\fBbinary format h3h* AB def\fR
.CE
! will return a string equivalent to \fB\\xba\\x00\\xed\\x0f\fR.
.RE
.IP \fBH\fR 5
This form is the same as \fBh\fR except that the digits are stored in
***************
*** 128,134 ****
.CS
\fBbinary format H3H* ab DEF\fR
.CE
! will return a string equivalent to \fB\\xab\\xde\\xf0\fR.
.RE
.IP \fBc\fR 5
Stores one or more 8-bit integer values in the output string. If no
--- 128,134 ----
.CS
\fBbinary format H3H* ab DEF\fR
.CE
! will return a string equivalent to \fB\\xab\\x00\\xde\\xf0\fR.
.RE
.IP \fBc\fR 5
Stores one or more 8-bit integer values in the output string. If no
***************
*** 142,151 ****
than \fIcount\fR, then the extra elements are ignored. For example,
.RS
.CS
! \fBbinary format c3cc* {3 -3 128 1} 257 {2 5}\fR
.CE
will return a string equivalent to
! \fB\\x03\\xfd\\x80\\x01\\x02\\x05\fR, whereas
.CS
\fBbinary format c {2 5}\fR
.CE
--- 142,151 ----
than \fIcount\fR, then the extra elements are ignored. For example,
.RS
.CS
! \fBbinary format c3cc* {3 -3 128 1} 260 {2 5}\fR
.CE
will return a string equivalent to
! \fB\\x03\\xfd\\x80\\x04\\x02\\x05\fR, whereas
.CS
\fBbinary format c {2 5}\fR
.CE
***************
*** 186,192 ****
\fBbinary format i3 {3 -3 65536 1}\fR
.CE
will return a string equivalent to
! \fB\\x03\\x00\\x00\\x00\\xfd\\xff\\xff\\xff\\x00\\x00\\x10\\x00\fR.
.RE
.IP \fBI\fR 5
This form is the same as \fBi\fR except that it stores one or more one
--- 186,192 ----
\fBbinary format i3 {3 -3 65536 1}\fR
.CE
will return a string equivalent to
! \fB\\x03\\x00\\x00\\x00\\xfd\\xff\\xff\\xff\\x00\\x00\\x01\\x00\fR.
.RE
.IP \fBI\fR 5
This form is the same as \fBi\fR except that it stores one or more one
***************
*** 197,203 ****
\fBbinary format I3 {3 -3 65536 1}\fR
.CE
will return a string equivalent to
! \fB\\x00\\x00\\x00\\x03\\xff\\xff\\xff\\xfd\\x00\\x10\\x00\\x00\fR.
.RE
.IP \fBf\fR 5
This form is the same as \fBc\fR except that it stores one or more one
--- 197,203 ----
\fBbinary format I3 {3 -3 65536 1}\fR
.CE
will return a string equivalent to
! \fB\\x00\\x00\\x00\\x03\\xff\\xff\\xff\\xfd\\x00\\x01\\x00\\x00\fR.
.RE
.IP \fBf\fR 5
This form is the same as \fBc\fR except that it stores one or more one
***************
*** 318,324 ****
the scanned value before it is stored in the variable. For example,
.RS
.CS
! \fBbinary scan "abc efghi \\000" a* var1\fR
.CE
will return \fB1\fR with \fBabc efghi\fR stored in \fBvar1\fR.
.RE
--- 318,324 ----
the scanned value before it is stored in the variable. For example,
.RS
.CS
! \fBbinary scan "abc efghi \\000" A* var1\fR
.CE
will return \fB1\fR with \fBabc efghi\fR stored in \fBvar1\fR.
.RE
***************
*** 338,348 ****
\fB1110000110100000\fR stored in \fBvar2\fR.
.RE
.IP \fBB\fR 5
! This form is the same as \fBB\fR, except the bits are taken in
high-to-low order within each byte. For example,
.RS
.CS
! \fBbinary scan \\x70\\x87\\x05 b5b* var1 var2\fR
.CE
will return \fB2\fR with \fB01110\fR stored in \fBvar1\fR and
\fB1000011100000101\fR stored in \fBvar2\fR.
--- 338,348 ----
\fB1110000110100000\fR stored in \fBvar2\fR.
.RE
.IP \fBB\fR 5
! This form is the same as \fBb\fR, except the bits are taken in
high-to-low order within each byte. For example,
.RS
.CS
! \fBbinary scan \\x70\\x87\\x05 B5B* var1 var2\fR
.CE
will return \fB2\fR with \fB01110\fR stored in \fBvar1\fR and
\fB1000011100000101\fR stored in \fBvar2\fR.
***************
*** 365,371 ****
.RE
.IP \fBH\fR 5
This form is the same as \fBh\fR, except the digits are taken in
! low-to-high order within each byte. For example,
.RS
.CS
\fBbinary scan \\x07\\x86\\x05 H3H* var1 var2\fR
--- 365,371 ----
.RE
.IP \fBH\fR 5
This form is the same as \fBh\fR, except the digits are taken in
! high-to-low order within each byte. For example,
.RS
.CS
\fBbinary scan \\x07\\x86\\x05 H3H* var1 var2\fR
PatchFiles:
.../tcl8.0.5/doc/binary.n
04/09/1999 13:53 - surles - The documentation already states this information:
"The remainder will always have the same sign as the divisor and an absolute value smaller
than the divisor."
|