Tcl Source Code

View Ticket
Login
Ticket UUID: 218684
Title: errors on manual page of binary command
Type: Bug Created on: 2000-10-26 01:04:06
Submitter: nobody Assigned to: nobody
Subsystem: 12. ByteArray Object Severity:
Priority: 2 Last modified: 2001-04-05 06:03:10
Status: Closed Closed by: dgp
Resolution: Fixed Closed on: 2001-04-04 23:03:10
Version: final: 8.0.5
Description:
OriginalBugID: 1733 Bug
Version: 8.0.5
SubmitDate: '1999-04-06'
LastModified: '1999-04-09'
Severity: MED
Status: Released
Submitter: pat
ChangedBy: surles
OS: Digital Unix
OSVersion: V4.0 878
Machine: Other
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 12:11 - surles - Applied all changes.