Artifact
63720e65517a85c45ce538580a71d849b847779a:
Attachment "patch" to
ticket [958919ffff]
added by
aotto1968
2004-05-23 20:56:54.
0000: 49 6e 64 65 78 3a 20 62 69 6e 61 72 79 2e 74 65 Index: binary.te
0010: 73 74 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d st.=============
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0050: 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a ======.RCS file:
0060: 20 54 63 6c 42 61 73 65 2f 73 72 63 2f 74 63 6c TclBase/src/tcl
0070: 38 2e 34 2e 36 2f 74 65 73 74 73 2f 62 69 6e 61 8.4.6/tests/bina
0080: 72 79 2e 74 65 73 74 2c 76 0a 72 65 74 72 69 65 ry.test,v.retrie
0090: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e ving revision 1.
00a0: 31 0a 64 69 66 66 20 2d 43 32 20 2d 72 31 2e 31 1.diff -C2 -r1.1
00b0: 20 62 69 6e 61 72 79 2e 74 65 73 74 0a 2a 2a 2a binary.test.***
00c0: 20 62 69 6e 61 72 79 2e 74 65 73 74 09 33 30 20 binary.test.30
00d0: 41 70 72 20 32 30 30 34 20 30 37 3a 31 30 3a 34 Apr 2004 07:10:4
00e0: 30 20 2d 30 30 30 30 09 31 2e 31 0a 2d 2d 2d 20 0 -0000.1.1.---
00f0: 62 69 6e 61 72 79 2e 74 65 73 74 09 32 33 20 4d binary.test.23 M
0100: 61 79 20 32 30 30 34 20 31 33 3a 35 37 3a 31 30 ay 2004 13:57:10
0110: 20 2d 30 30 30 30 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a -0000.*********
0120: 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 38 2c 32 31 ******.*** 18,21
0130: 20 2a 2a 2a 2a 0a 2d 2d 2d 20 31 38 2c 32 35 20 ****.--- 18,25
0140: 2d 2d 2d 2d 0a 20 20 7d 0a 20 20 0a 2b 20 74 65 ----. }. .+ te
0150: 73 74 43 6f 6e 73 74 72 61 69 6e 74 20 62 69 67 stConstraint big
0160: 45 6e 64 69 61 6e 20 5b 65 78 70 72 20 7b 24 74 Endian [expr {$t
0170: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 62 79 74 65 cl_platform(byte
0180: 4f 72 64 65 72 29 20 3d 3d 20 22 62 69 67 45 6e Order) == "bigEn
0190: 64 69 61 6e 22 7d 5d 0a 2b 20 74 65 73 74 43 6f dian"}].+ testCo
01a0: 6e 73 74 72 61 69 6e 74 20 6c 69 74 74 6c 65 45 nstraint littleE
01b0: 6e 64 69 61 6e 20 5b 65 78 70 72 20 7b 24 74 63 ndian [expr {$tc
01c0: 6c 5f 70 6c 61 74 66 6f 72 6d 28 62 79 74 65 4f l_platform(byteO
01d0: 72 64 65 72 29 20 3d 3d 20 22 6c 69 74 74 6c 65 rder) == "little
01e0: 45 6e 64 69 61 6e 22 7d 5d 0a 2b 20 74 65 73 74 Endian"}].+ test
01f0: 43 6f 6e 73 74 72 61 69 6e 74 20 68 61 73 4e 61 Constraint hasNa
0200: 6e 20 5b 65 78 70 72 20 7b 21 5b 63 61 74 63 68 n [expr {![catch
0210: 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 {binary format
0220: 64 20 4e 61 4e 7d 5d 7d 5d 0a 2b 20 0a 20 20 74 d NaN}]}].+ . t
0230: 65 73 74 20 62 69 6e 61 72 79 2d 30 2e 31 20 7b est binary-0.1 {
0240: 44 75 70 42 79 74 65 41 72 72 61 79 49 6e 74 65 DupByteArrayInte
0250: 72 6e 61 6c 52 65 70 7d 20 7b 0a 20 20 20 20 20 rnalRep} {.
0260: 20 73 65 74 20 68 64 72 20 5b 62 69 6e 61 72 79 set hdr [binary
0270: 20 66 6f 72 6d 61 74 20 63 63 20 30 20 30 33 31 format cc 0 031
0280: 36 5d 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 6].*************
0290: 2a 2a 0a 2a 2a 2a 20 34 32 37 2c 34 36 34 20 2a **.*** 427,464 *
02a0: 2a 2a 2a 0a 20 20 20 20 20 20 62 69 6e 61 72 79 ***. binary
02b0: 20 66 6f 72 6d 61 74 20 66 30 20 31 2e 36 0a 20 format f0 1.6.
02c0: 20 7d 20 7b 7d 0a 21 20 74 65 73 74 20 62 69 6e } {}.! test bin
02d0: 61 72 79 2d 31 33 2e 34 20 7b 54 63 6c 5f 42 69 ary-13.4 {Tcl_Bi
02e0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d naryObjCmd: form
02f0: 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 at} {nonPortable
0300: 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 macOrUnix} {.
0310: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 binary forma
0320: 74 20 66 20 31 2e 36 0a 20 20 7d 20 5c 78 33 66 t f 1.6. } \x3f
0330: 5c 78 63 63 5c 78 63 63 5c 78 63 64 0a 21 20 74 \xcc\xcc\xcd.! t
0340: 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e 35 20 est binary-13.5
0350: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d {Tcl_BinaryObjCm
0360: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 d: format} {nonP
0370: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 ortable pcOnly}
0380: 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 {. binary f
0390: 6f 72 6d 61 74 20 66 20 31 2e 36 0a 20 20 7d 20 ormat f 1.6. }
03a0: 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 33 66 \xcd\xcc\xcc\x3f
03b0: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 .! test binary-1
03c0: 33 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 3.6 {Tcl_BinaryO
03d0: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b bjCmd: format} {
03e0: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f nonPortable macO
03f0: 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 62 rUnix} {. b
0400: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 2a 20 inary format f*
0410: 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 7d 20 5c 78 {1.6 3.4}. } \x
0420: 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c 78 3f\xcc\xcc\xcd\x
0430: 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 61 0a 21 40\x59\x99\x9a.!
0440: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e test binary-13.
0450: 37 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 7 {Tcl_BinaryObj
0460: 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f Cmd: format} {no
0470: 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 nPortable pcOnly
0480: 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 } {. binary
0490: 20 66 6f 72 6d 61 74 20 66 2a 20 7b 31 2e 36 20 format f* {1.6
04a0: 33 2e 34 7d 0a 20 20 7d 20 5c 78 63 64 5c 78 63 3.4}. } \xcd\xc
04b0: 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78 39 c\xcc\x3f\x9a\x9
04c0: 39 5c 78 35 39 5c 78 34 30 0a 21 20 74 65 73 74 9\x59\x40.! test
04d0: 20 62 69 6e 61 72 79 2d 31 33 2e 38 20 7b 54 63 binary-13.8 {Tc
04e0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
04f0: 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 format} {nonPort
0500: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 able macOrUnix}
0510: 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 {. binary f
0520: 6f 72 6d 61 74 20 66 32 20 7b 31 2e 36 20 33 2e ormat f2 {1.6 3.
0530: 34 7d 0a 20 20 7d 20 5c 78 33 66 5c 78 63 63 5c 4}. } \x3f\xcc\
0540: 78 63 63 5c 78 63 64 5c 78 34 30 5c 78 35 39 5c xcc\xcd\x40\x59\
0550: 78 39 39 5c 78 39 61 0a 21 20 74 65 73 74 20 62 x99\x9a.! test b
0560: 69 6e 61 72 79 2d 31 33 2e 39 20 7b 54 63 6c 5f inary-13.9 {Tcl_
0570: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f BinaryObjCmd: fo
0580: 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 rmat} {nonPortab
0590: 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 le pcOnly} {.
05a0: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
05b0: 20 66 32 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 f2 {1.6 3.4}.
05c0: 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 } \xcd\xcc\xcc\x
05d0: 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 39 5c 78 3f\x9a\x99\x59\x
05e0: 34 30 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 40.! test binary
05f0: 2d 31 33 2e 31 30 20 7b 54 63 6c 5f 42 69 6e 61 -13.10 {Tcl_Bina
0600: 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 ryObjCmd: format
0610: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d } {nonPortable m
0620: 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 acOrUnix} {.
0630: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
0640: 66 32 20 7b 31 2e 36 20 33 2e 34 20 35 2e 36 7d f2 {1.6 3.4 5.6}
0650: 0a 20 20 7d 20 5c 78 33 66 5c 78 63 63 5c 78 63 . } \x3f\xcc\xc
0660: 63 5c 78 63 64 5c 78 34 30 5c 78 35 39 5c 78 39 c\xcd\x40\x59\x9
0670: 39 5c 78 39 61 0a 21 20 74 65 73 74 20 62 69 6e 9\x9a.! test bin
0680: 61 72 79 2d 31 33 2e 31 31 20 7b 54 63 6c 5f 42 ary-13.11 {Tcl_B
0690: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 inaryObjCmd: for
06a0: 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c mat} {nonPortabl
06b0: 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 e pcOnly} {.
06c0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
06d0: 66 32 20 7b 31 2e 36 20 33 2e 34 20 35 2e 36 7d f2 {1.6 3.4 5.6}
06e0: 0a 20 20 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63 . } \xcd\xcc\xc
06f0: 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 c\x3f\x9a\x99\x5
0700: 39 5c 78 34 30 0a 21 20 74 65 73 74 20 62 69 6e 9\x40.! test bin
0710: 61 72 79 2d 31 33 2e 31 32 20 7b 54 63 6c 5f 42 ary-13.12 {Tcl_B
0720: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f inaryObjCmd: flo
0730: 61 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 6e 6f at overflow} {no
0740: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 nPortable macOrU
0750: 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e nix} {. bin
0760: 61 72 79 20 66 6f 72 6d 61 74 20 66 20 2d 33 2e ary format f -3.
0770: 34 30 32 38 32 35 65 2b 33 38 0a 20 20 7d 20 5c 402825e+38. } \
0780: 78 66 66 5c 78 37 66 5c 78 66 66 5c 78 66 66 0a xff\x7f\xff\xff.
0790: 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 33 ! test binary-13
07a0: 2e 31 33 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f .13 {Tcl_BinaryO
07b0: 62 6a 43 6d 64 3a 20 66 6c 6f 61 74 20 6f 76 65 bjCmd: float ove
07c0: 72 66 6c 6f 77 7d 20 7b 6e 6f 6e 50 6f 72 74 61 rflow} {nonPorta
07d0: 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 ble pcOnly} {.
07e0: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 binary forma
07f0: 74 20 66 20 2d 33 2e 34 30 32 38 32 35 65 2b 33 t f -3.402825e+3
0800: 38 0a 20 20 7d 20 5c 78 66 66 5c 78 66 66 5c 78 8. } \xff\xff\x
0810: 37 66 5c 78 66 66 0a 21 20 74 65 73 74 20 62 69 7f\xff.! test bi
0820: 6e 61 72 79 2d 31 33 2e 31 34 20 7b 54 63 6c 5f nary-13.14 {Tcl_
0830: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c BinaryObjCmd: fl
0840: 6f 61 74 20 75 6e 64 65 72 66 6c 6f 77 7d 20 7b oat underflow} {
0850: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f nonPortable macO
0860: 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 62 rUnix} {. b
0870: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 20 2d inary format f -
0880: 33 2e 34 30 32 38 32 35 65 2d 31 30 30 0a 20 20 3.402825e-100.
0890: 7d 20 5c 78 38 30 5c 78 30 30 5c 78 30 30 5c 78 } \x80\x00\x00\x
08a0: 30 30 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 00.! test binary
08b0: 2d 31 33 2e 31 35 20 7b 54 63 6c 5f 42 69 6e 61 -13.15 {Tcl_Bina
08c0: 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f 61 74 20 ryObjCmd: float
08d0: 75 6e 64 65 72 66 6c 6f 77 7d 20 7b 6e 6f 6e 50 underflow} {nonP
08e0: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 ortable pcOnly}
08f0: 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 {. binary f
0900: 6f 72 6d 61 74 20 66 20 2d 33 2e 34 30 32 38 32 ormat f -3.40282
0910: 35 65 2d 31 30 30 0a 20 20 7d 20 5c 78 30 30 5c 5e-100. } \x00\
0920: 78 30 30 5c 78 30 30 5c 78 38 30 0a 2d 2d 2d 20 x00\x00\x80.---
0930: 34 33 31 2c 34 36 38 20 2d 2d 2d 2d 0a 20 20 20 431,468 ----.
0940: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
0950: 20 66 30 20 31 2e 36 0a 20 20 7d 20 7b 7d 0a 21 f0 1.6. } {}.!
0960: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e test binary-13.
0970: 34 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 4 {Tcl_BinaryObj
0980: 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 62 69 Cmd: format} {bi
0990: 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 gEndian} {.
09a0: 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 binary format f
09b0: 20 31 2e 36 0a 20 20 7d 20 5c 78 33 66 5c 78 63 1.6. } \x3f\xc
09c0: 63 5c 78 63 63 5c 78 63 64 0a 21 20 74 65 73 74 c\xcc\xcd.! test
09d0: 20 62 69 6e 61 72 79 2d 31 33 2e 35 20 7b 54 63 binary-13.5 {Tc
09e0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
09f0: 66 6f 72 6d 61 74 7d 20 7b 6c 69 74 74 6c 65 45 format} {littleE
0a00: 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 ndian} {. b
0a10: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 20 31 inary format f 1
0a20: 2e 36 0a 20 20 7d 20 5c 78 63 64 5c 78 63 63 5c .6. } \xcd\xcc\
0a30: 78 63 63 5c 78 33 66 0a 21 20 74 65 73 74 20 62 xcc\x3f.! test b
0a40: 69 6e 61 72 79 2d 31 33 2e 36 20 7b 54 63 6c 5f inary-13.6 {Tcl_
0a50: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f BinaryObjCmd: fo
0a60: 72 6d 61 74 7d 20 7b 62 69 67 45 6e 64 69 61 6e rmat} {bigEndian
0a70: 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 } {. binary
0a80: 20 66 6f 72 6d 61 74 20 66 2a 20 7b 31 2e 36 20 format f* {1.6
0a90: 33 2e 34 7d 0a 20 20 7d 20 5c 78 33 66 5c 78 63 3.4}. } \x3f\xc
0aa0: 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78 35 c\xcc\xcd\x40\x5
0ab0: 39 5c 78 39 39 5c 78 39 61 0a 21 20 74 65 73 74 9\x99\x9a.! test
0ac0: 20 62 69 6e 61 72 79 2d 31 33 2e 37 20 7b 54 63 binary-13.7 {Tc
0ad0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
0ae0: 66 6f 72 6d 61 74 7d 20 7b 6c 69 74 74 6c 65 45 format} {littleE
0af0: 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 ndian} {. b
0b00: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 2a 20 inary format f*
0b10: 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 7d 20 5c 78 {1.6 3.4}. } \x
0b20: 63 64 5c 78 63 63 5c 78 63 63 5c 78 33 66 5c 78 cd\xcc\xcc\x3f\x
0b30: 39 61 5c 78 39 39 5c 78 35 39 5c 78 34 30 0a 21 9a\x99\x59\x40.!
0b40: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e test binary-13.
0b50: 38 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 8 {Tcl_BinaryObj
0b60: 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 62 69 Cmd: format} {bi
0b70: 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 gEndian} {.
0b80: 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 binary format f
0b90: 32 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 7d 20 2 {1.6 3.4}. }
0ba0: 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 \x3f\xcc\xcc\xcd
0bb0: 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 61 \x40\x59\x99\x9a
0bc0: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 .! test binary-1
0bd0: 33 2e 39 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 3.9 {Tcl_BinaryO
0be0: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b bjCmd: format} {
0bf0: 6c 69 74 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a littleEndian} {.
0c00: 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 binary for
0c10: 6d 61 74 20 66 32 20 7b 31 2e 36 20 33 2e 34 7d mat f2 {1.6 3.4}
0c20: 0a 20 20 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63 . } \xcd\xcc\xc
0c30: 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 c\x3f\x9a\x99\x5
0c40: 39 5c 78 34 30 0a 21 20 74 65 73 74 20 62 69 6e 9\x40.! test bin
0c50: 61 72 79 2d 31 33 2e 31 30 20 7b 54 63 6c 5f 42 ary-13.10 {Tcl_B
0c60: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 inaryObjCmd: for
0c70: 6d 61 74 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d mat} {bigEndian}
0c80: 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 {. binary
0c90: 66 6f 72 6d 61 74 20 66 32 20 7b 31 2e 36 20 33 format f2 {1.6 3
0ca0: 2e 34 20 35 2e 36 7d 0a 20 20 7d 20 5c 78 33 66 .4 5.6}. } \x3f
0cb0: 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 \xcc\xcc\xcd\x40
0cc0: 5c 78 35 39 5c 78 39 39 5c 78 39 61 0a 21 20 74 \x59\x99\x9a.! t
0cd0: 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e 31 31 est binary-13.11
0ce0: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
0cf0: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6c 69 74 md: format} {lit
0d00: 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 tleEndian} {.
0d10: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
0d20: 20 66 32 20 7b 31 2e 36 20 33 2e 34 20 35 2e 36 f2 {1.6 3.4 5.6
0d30: 7d 0a 20 20 7d 20 5c 78 63 64 5c 78 63 63 5c 78 }. } \xcd\xcc\x
0d40: 63 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 cc\x3f\x9a\x99\x
0d50: 35 39 5c 78 34 30 0a 21 20 74 65 73 74 20 62 69 59\x40.! test bi
0d60: 6e 61 72 79 2d 31 33 2e 31 32 20 7b 54 63 6c 5f nary-13.12 {Tcl_
0d70: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c BinaryObjCmd: fl
0d80: 6f 61 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 62 oat overflow} {b
0d90: 69 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 igEndian} {.
0da0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
0db0: 66 20 2d 33 2e 34 30 32 38 32 35 65 2b 33 38 0a f -3.402825e+38.
0dc0: 20 20 7d 20 5c 78 66 66 5c 78 37 66 5c 78 66 66 } \xff\x7f\xff
0dd0: 5c 78 66 66 0a 21 20 74 65 73 74 20 62 69 6e 61 \xff.! test bina
0de0: 72 79 2d 31 33 2e 31 33 20 7b 54 63 6c 5f 42 69 ry-13.13 {Tcl_Bi
0df0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f 61 naryObjCmd: floa
0e00: 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 6c 69 74 t overflow} {lit
0e10: 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 tleEndian} {.
0e20: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
0e30: 20 66 20 2d 33 2e 34 30 32 38 32 35 65 2b 33 38 f -3.402825e+38
0e40: 0a 20 20 7d 20 5c 78 66 66 5c 78 66 66 5c 78 37 . } \xff\xff\x7
0e50: 66 5c 78 66 66 0a 21 20 74 65 73 74 20 62 69 6e f\xff.! test bin
0e60: 61 72 79 2d 31 33 2e 31 34 20 7b 54 63 6c 5f 42 ary-13.14 {Tcl_B
0e70: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f inaryObjCmd: flo
0e80: 61 74 20 75 6e 64 65 72 66 6c 6f 77 7d 20 7b 62 at underflow} {b
0e90: 69 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 igEndian} {.
0ea0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
0eb0: 66 20 2d 33 2e 34 30 32 38 32 35 65 2d 31 30 30 f -3.402825e-100
0ec0: 0a 20 20 7d 20 5c 78 38 30 5c 78 30 30 5c 78 30 . } \x80\x00\x0
0ed0: 30 5c 78 30 30 0a 21 20 74 65 73 74 20 62 69 6e 0\x00.! test bin
0ee0: 61 72 79 2d 31 33 2e 31 35 20 7b 54 63 6c 5f 42 ary-13.15 {Tcl_B
0ef0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f inaryObjCmd: flo
0f00: 61 74 20 75 6e 64 65 72 66 6c 6f 77 7d 20 7b 6c at underflow} {l
0f10: 69 74 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 ittleEndian} {.
0f20: 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d binary form
0f30: 61 74 20 66 20 2d 33 2e 34 30 32 38 32 35 65 2d at f -3.402825e-
0f40: 31 30 30 0a 20 20 7d 20 5c 78 30 30 5c 78 30 30 100. } \x00\x00
0f50: 5c 78 30 30 5c 78 38 30 0a 2a 2a 2a 2a 2a 2a 2a \x00\x80.*******
0f60: 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 34 37 30 ********.*** 470
0f70: 2c 34 37 38 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 ,478 ****.
0f80: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e list [catch {bin
0f90: 61 72 79 20 66 6f 72 6d 61 74 20 66 20 24 61 7d ary format f $a}
0fa0: 20 6d 73 67 5d 20 24 6d 73 67 0a 20 20 7d 20 5b msg] $msg. } [
0fb0: 6c 69 73 74 20 31 20 22 65 78 70 65 63 74 65 64 list 1 "expected
0fc0: 20 66 6c 6f 61 74 69 6e 67 2d 70 6f 69 6e 74 20 floating-point
0fd0: 6e 75 6d 62 65 72 20 62 75 74 20 67 6f 74 20 5c number but got \
0fe0: 22 31 2e 36 20 33 2e 34 5c 22 22 5d 0a 21 20 74 "1.6 3.4\""].! t
0ff0: 65 73 74 20 62 69 6e 61 72 79 2d 31 33 2e 31 38 est binary-13.18
1000: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
1010: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e md: format} {non
1020: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e Portable macOrUn
1030: 69 78 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 20 ix} {. set
1040: 61 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 20 20 a {1.6 3.4}.
1050: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
1060: 66 31 20 24 61 0a 20 20 7d 20 5c 78 33 66 5c 78 f1 $a. } \x3f\x
1070: 63 63 5c 78 63 63 5c 78 63 64 0a 21 20 74 65 73 cc\xcc\xcd.! tes
1080: 74 20 62 69 6e 61 72 79 2d 31 33 2e 31 39 20 7b t binary-13.19 {
1090: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
10a0: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f : format} {nonPo
10b0: 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b rtable pcOnly} {
10c0: 0a 20 20 20 20 20 20 73 65 74 20 61 20 7b 31 2e . set a {1.
10d0: 36 20 33 2e 34 7d 0a 20 20 20 20 20 20 62 69 6e 6 3.4}. bin
10e0: 61 72 79 20 66 6f 72 6d 61 74 20 66 31 20 24 61 ary format f1 $a
10f0: 0a 2d 2d 2d 20 34 37 34 2c 34 38 32 20 2d 2d 2d .--- 474,482 ---
1100: 2d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 63 61 -. list [ca
1110: 74 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d tch {binary form
1120: 61 74 20 66 20 24 61 7d 20 6d 73 67 5d 20 24 6d at f $a} msg] $m
1130: 73 67 0a 20 20 7d 20 5b 6c 69 73 74 20 31 20 22 sg. } [list 1 "
1140: 65 78 70 65 63 74 65 64 20 66 6c 6f 61 74 69 6e expected floatin
1150: 67 2d 70 6f 69 6e 74 20 6e 75 6d 62 65 72 20 62 g-point number b
1160: 75 74 20 67 6f 74 20 5c 22 31 2e 36 20 33 2e 34 ut got \"1.6 3.4
1170: 5c 22 22 5d 0a 21 20 74 65 73 74 20 62 69 6e 61 \""].! test bina
1180: 72 79 2d 31 33 2e 31 38 20 7b 54 63 6c 5f 42 69 ry-13.18 {Tcl_Bi
1190: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d naryObjCmd: form
11a0: 61 74 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 at} {bigEndian}
11b0: 7b 0a 20 20 20 20 20 20 73 65 74 20 61 20 7b 31 {. set a {1
11c0: 2e 36 20 33 2e 34 7d 0a 20 20 20 20 20 20 62 69 .6 3.4}. bi
11d0: 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 31 20 24 nary format f1 $
11e0: 61 0a 20 20 7d 20 5c 78 33 66 5c 78 63 63 5c 78 a. } \x3f\xcc\x
11f0: 63 63 5c 78 63 64 0a 21 20 74 65 73 74 20 62 69 cc\xcd.! test bi
1200: 6e 61 72 79 2d 31 33 2e 31 39 20 7b 54 63 6c 5f nary-13.19 {Tcl_
1210: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f BinaryObjCmd: fo
1220: 72 6d 61 74 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 rmat} {littleEnd
1230: 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 ian} {. set
1240: 20 61 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 20 a {1.6 3.4}.
1250: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
1260: 20 66 31 20 24 61 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a f1 $a.*********
1270: 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 34 38 38 2c 35 ******.*** 488,5
1280: 31 39 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 62 69 19 ****. bi
1290: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 30 20 31 nary format d0 1
12a0: 2e 36 0a 20 20 7d 20 7b 7d 0a 21 20 74 65 73 74 .6. } {}.! test
12b0: 20 62 69 6e 61 72 79 2d 31 34 2e 34 20 7b 54 63 binary-14.4 {Tc
12c0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
12d0: 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 format} {nonPort
12e0: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 able macOrUnix}
12f0: 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 {. binary f
1300: 6f 72 6d 61 74 20 64 20 31 2e 36 0a 20 20 7d 20 ormat d 1.6. }
1310: 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 \x3f\xf9\x99\x99
1320: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 \x99\x99\x99\x9a
1330: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 .! test binary-1
1340: 34 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 4.5 {Tcl_BinaryO
1350: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b bjCmd: format} {
1360: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e nonPortable pcOn
1370: 6c 79 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 ly} {. bina
1380: 72 79 20 66 6f 72 6d 61 74 20 64 20 31 2e 36 0a ry format d 1.6.
1390: 20 20 7d 20 5c 78 39 61 5c 78 39 39 5c 78 39 39 } \x9a\x99\x99
13a0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 \x99\x99\x99\xf9
13b0: 5c 78 33 66 0a 21 20 74 65 73 74 20 62 69 6e 61 \x3f.! test bina
13c0: 72 79 2d 31 34 2e 36 20 7b 54 63 6c 5f 42 69 6e ry-14.6 {Tcl_Bin
13d0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 aryObjCmd: forma
13e0: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 t} {nonPortable
13f0: 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 macOrUnix} {.
1400: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
1410: 20 64 2a 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 d* {1.6 3.4}.
1420: 7d 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 } \x3f\xf9\x99\x
1430: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
1440: 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c 78 9a\x40\x0b\x33\x
1450: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
1460: 33 33 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 33.! test binary
1470: 2d 31 34 2e 37 20 7b 54 63 6c 5f 42 69 6e 61 72 -14.7 {Tcl_Binar
1480: 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d yObjCmd: format}
1490: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 {nonPortable pc
14a0: 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 62 69 Only} {. bi
14b0: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 2a 20 7b nary format d* {
14c0: 31 2e 36 20 33 2e 34 7d 0a 20 20 7d 20 5c 78 39 1.6 3.4}. } \x9
14d0: 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 a\x99\x99\x99\x9
14e0: 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 5c 78 33 9\x99\xf9\x3f\x3
14f0: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 3\x33\x33\x33\x3
1500: 33 5c 78 33 33 5c 78 30 62 5c 78 34 30 0a 21 20 3\x33\x0b\x40.!
1510: 74 65 73 74 20 62 69 6e 61 72 79 2d 31 34 2e 38 test binary-14.8
1520: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
1530: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e md: format} {non
1540: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e Portable macOrUn
1550: 69 78 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 ix} {. bina
1560: 72 79 20 66 6f 72 6d 61 74 20 64 32 20 7b 31 2e ry format d2 {1.
1570: 36 20 33 2e 34 7d 0a 20 20 7d 20 5c 78 33 66 5c 6 3.4}. } \x3f\
1580: 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c xf9\x99\x99\x99\
1590: 78 39 39 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c x99\x99\x9a\x40\
15a0: 78 30 62 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x0b\x33\x33\x33\
15b0: 78 33 33 5c 78 33 33 5c 78 33 33 0a 21 20 74 65 x33\x33\x33.! te
15c0: 73 74 20 62 69 6e 61 72 79 2d 31 34 2e 39 20 7b st binary-14.9 {
15d0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
15e0: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f : format} {nonPo
15f0: 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b rtable pcOnly} {
1600: 0a 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f . binary fo
1610: 72 6d 61 74 20 64 32 20 7b 31 2e 36 20 33 2e 34 rmat d2 {1.6 3.4
1620: 7d 0a 20 20 7d 20 5c 78 39 61 5c 78 39 39 5c 78 }. } \x9a\x99\x
1630: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
1640: 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c 78 f9\x3f\x33\x33\x
1650: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
1660: 30 62 5c 78 34 30 0a 21 20 74 65 73 74 20 62 69 0b\x40.! test bi
1670: 6e 61 72 79 2d 31 34 2e 31 30 20 7b 54 63 6c 5f nary-14.10 {Tcl_
1680: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f BinaryObjCmd: fo
1690: 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 rmat} {nonPortab
16a0: 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a le macOrUnix} {.
16b0: 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 binary for
16c0: 6d 61 74 20 64 32 20 7b 31 2e 36 20 33 2e 34 20 mat d2 {1.6 3.4
16d0: 35 2e 36 7d 0a 20 20 7d 20 5c 78 33 66 5c 78 66 5.6}. } \x3f\xf
16e0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
16f0: 39 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 9\x99\x9a\x40\x0
1700: 62 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 b\x33\x33\x33\x3
1710: 33 5c 78 33 33 5c 78 33 33 0a 21 20 74 65 73 74 3\x33\x33.! test
1720: 20 62 69 6e 61 72 79 2d 31 34 2e 31 31 20 7b 54 binary-14.11 {T
1730: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
1740: 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 format} {nonPor
1750: 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a table pcOnly} {.
1760: 20 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 binary for
1770: 6d 61 74 20 64 32 20 7b 31 2e 36 20 33 2e 34 20 mat d2 {1.6 3.4
1780: 35 2e 36 7d 0a 20 20 7d 20 5c 78 39 61 5c 78 39 5.6}. } \x9a\x9
1790: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
17a0: 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 9\xf9\x3f\x33\x3
17b0: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 3\x33\x33\x33\x3
17c0: 33 5c 78 30 62 5c 78 34 30 0a 21 20 74 65 73 74 3\x0b\x40.! test
17d0: 20 62 69 6e 61 72 79 2d 31 34 2e 31 32 20 7b 54 binary-14.12 {T
17e0: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
17f0: 20 66 6c 6f 61 74 20 6f 76 65 72 66 6c 6f 77 7d float overflow}
1800: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 75 6e {nonPortable un
1810: 69 78 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 ixOnly} {.
1820: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 20 binary format d
1830: 4e 61 4e 0a 20 20 7d 20 5c 78 37 66 5c 78 66 66 NaN. } \x7f\xff
1840: 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 \xff\xff\xff\xff
1850: 5c 78 66 66 5c 78 66 66 0a 21 20 74 65 73 74 20 \xff\xff.! test
1860: 62 69 6e 61 72 79 2d 31 34 2e 31 33 20 7b 54 63 binary-14.13 {Tc
1870: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
1880: 66 6c 6f 61 74 20 6f 76 65 72 66 6c 6f 77 7d 20 float overflow}
1890: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 {nonPortable mac
18a0: 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 62 69 Only} {. bi
18b0: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 20 4e 61 nary format d Na
18c0: 4e 0a 20 20 7d 20 5c 78 37 66 5c 78 66 38 5c 78 N. } \x7f\xf8\x
18d0: 30 32 5c 78 61 30 5c 78 30 30 5c 78 30 30 5c 78 02\xa0\x00\x00\x
18e0: 30 30 5c 78 30 30 0a 2d 2d 2d 20 34 39 32 2c 35 00\x00.--- 492,5
18f0: 32 33 20 2d 2d 2d 2d 0a 20 20 20 20 20 20 62 69 23 ----. bi
1900: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 30 20 31 nary format d0 1
1910: 2e 36 0a 20 20 7d 20 7b 7d 0a 21 20 74 65 73 74 .6. } {}.! test
1920: 20 62 69 6e 61 72 79 2d 31 34 2e 34 20 7b 54 63 binary-14.4 {Tc
1930: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
1940: 66 6f 72 6d 61 74 7d 20 7b 62 69 67 45 6e 64 69 format} {bigEndi
1950: 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 an} {. bina
1960: 72 79 20 66 6f 72 6d 61 74 20 64 20 31 2e 36 0a ry format d 1.6.
1970: 20 20 7d 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 } \x3f\xf9\x99
1980: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
1990: 5c 78 39 61 0a 21 20 74 65 73 74 20 62 69 6e 61 \x9a.! test bina
19a0: 72 79 2d 31 34 2e 35 20 7b 54 63 6c 5f 42 69 6e ry-14.5 {Tcl_Bin
19b0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 aryObjCmd: forma
19c0: 74 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 6e t} {littleEndian
19d0: 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 } {. binary
19e0: 20 66 6f 72 6d 61 74 20 64 20 31 2e 36 0a 20 20 format d 1.6.
19f0: 7d 20 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 } \x9a\x99\x99\x
1a00: 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 99\x99\x99\xf9\x
1a10: 33 66 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 3f.! test binary
1a20: 2d 31 34 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 -14.6 {Tcl_Binar
1a30: 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d yObjCmd: format}
1a40: 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 {bigEndian} {.
1a50: 20 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d binary form
1a60: 61 74 20 64 2a 20 7b 31 2e 36 20 33 2e 34 7d 0a at d* {1.6 3.4}.
1a70: 20 20 7d 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 } \x3f\xf9\x99
1a80: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
1a90: 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 \x9a\x40\x0b\x33
1aa0: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 \x33\x33\x33\x33
1ab0: 5c 78 33 33 0a 21 20 74 65 73 74 20 62 69 6e 61 \x33.! test bina
1ac0: 72 79 2d 31 34 2e 37 20 7b 54 63 6c 5f 42 69 6e ry-14.7 {Tcl_Bin
1ad0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 aryObjCmd: forma
1ae0: 74 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 6e t} {littleEndian
1af0: 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 72 79 } {. binary
1b00: 20 66 6f 72 6d 61 74 20 64 2a 20 7b 31 2e 36 20 format d* {1.6
1b10: 33 2e 34 7d 0a 20 20 7d 20 5c 78 39 61 5c 78 39 3.4}. } \x9a\x9
1b20: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
1b30: 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 9\xf9\x3f\x33\x3
1b40: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 3\x33\x33\x33\x3
1b50: 33 5c 78 30 62 5c 78 34 30 0a 21 20 74 65 73 74 3\x0b\x40.! test
1b60: 20 62 69 6e 61 72 79 2d 31 34 2e 38 20 7b 54 63 binary-14.8 {Tc
1b70: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
1b80: 66 6f 72 6d 61 74 7d 20 7b 62 69 67 45 6e 64 69 format} {bigEndi
1b90: 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e 61 an} {. bina
1ba0: 72 79 20 66 6f 72 6d 61 74 20 64 32 20 7b 31 2e ry format d2 {1.
1bb0: 36 20 33 2e 34 7d 0a 20 20 7d 20 5c 78 33 66 5c 6 3.4}. } \x3f\
1bc0: 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c xf9\x99\x99\x99\
1bd0: 78 39 39 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c x99\x99\x9a\x40\
1be0: 78 30 62 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x0b\x33\x33\x33\
1bf0: 78 33 33 5c 78 33 33 5c 78 33 33 0a 21 20 74 65 x33\x33\x33.! te
1c00: 73 74 20 62 69 6e 61 72 79 2d 31 34 2e 39 20 7b st binary-14.9 {
1c10: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
1c20: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6c 69 74 74 6c : format} {littl
1c30: 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 eEndian} {.
1c40: 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 binary format d
1c50: 32 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 7d 20 2 {1.6 3.4}. }
1c60: 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x9a\x99\x99\x99
1c70: 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 \x99\x99\xf9\x3f
1c80: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 \x33\x33\x33\x33
1c90: 5c 78 33 33 5c 78 33 33 5c 78 30 62 5c 78 34 30 \x33\x33\x0b\x40
1ca0: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 31 .! test binary-1
1cb0: 34 2e 31 30 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4.10 {Tcl_Binary
1cc0: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 ObjCmd: format}
1cd0: 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 {bigEndian} {.
1ce0: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 binary forma
1cf0: 74 20 64 32 20 7b 31 2e 36 20 33 2e 34 20 35 2e t d2 {1.6 3.4 5.
1d00: 36 7d 0a 20 20 7d 20 5c 78 33 66 5c 78 66 39 5c 6}. } \x3f\xf9\
1d10: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
1d20: 78 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c x99\x9a\x40\x0b\
1d30: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x33\x33\x33\x33\
1d40: 78 33 33 5c 78 33 33 0a 21 20 74 65 73 74 20 62 x33\x33.! test b
1d50: 69 6e 61 72 79 2d 31 34 2e 31 31 20 7b 54 63 6c inary-14.11 {Tcl
1d60: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 _BinaryObjCmd: f
1d70: 6f 72 6d 61 74 7d 20 7b 6c 69 74 74 6c 65 45 6e ormat} {littleEn
1d80: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 69 dian} {. bi
1d90: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 32 20 7b nary format d2 {
1da0: 31 2e 36 20 33 2e 34 20 35 2e 36 7d 0a 20 20 7d 1.6 3.4 5.6}. }
1db0: 20 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 \x9a\x99\x99\x9
1dc0: 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 9\x99\x99\xf9\x3
1dd0: 66 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 f\x33\x33\x33\x3
1de0: 33 5c 78 33 33 5c 78 33 33 5c 78 30 62 5c 78 34 3\x33\x33\x0b\x4
1df0: 30 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 0.! test binary-
1e00: 31 34 2e 31 32 20 7b 54 63 6c 5f 42 69 6e 61 72 14.12 {Tcl_Binar
1e10: 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f 61 74 20 6f yObjCmd: float o
1e20: 76 65 72 66 6c 6f 77 7d 20 7b 62 69 67 45 6e 64 verflow} {bigEnd
1e30: 69 61 6e 20 75 6e 69 78 4f 6e 6c 79 20 68 61 73 ian unixOnly has
1e40: 4e 61 6e 7d 20 7b 0a 20 20 20 20 20 20 62 69 6e Nan} {. bin
1e50: 61 72 79 20 66 6f 72 6d 61 74 20 64 20 4e 61 4e ary format d NaN
1e60: 0a 20 20 7d 20 5c 78 37 66 5c 78 66 66 5c 78 66 . } \x7f\xff\xf
1e70: 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 f\xff\xff\xff\xf
1e80: 66 5c 78 66 66 0a 21 20 74 65 73 74 20 62 69 6e f\xff.! test bin
1e90: 61 72 79 2d 31 34 2e 31 33 20 7b 54 63 6c 5f 42 ary-14.13 {Tcl_B
1ea0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f inaryObjCmd: flo
1eb0: 61 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 62 69 at overflow} {bi
1ec0: 67 45 6e 64 69 61 6e 20 6d 61 63 4f 6e 6c 79 20 gEndian macOnly
1ed0: 68 61 73 4e 61 6e 7d 20 7b 0a 20 20 20 20 20 20 hasNan} {.
1ee0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 20 binary format d
1ef0: 4e 61 4e 0a 20 20 7d 20 5c 78 37 66 5c 78 66 38 NaN. } \x7f\xf8
1f00: 5c 78 30 32 5c 78 61 30 5c 78 30 30 5c 78 30 30 \x02\xa0\x00\x00
1f10: 5c 78 30 30 5c 78 30 30 0a 2a 2a 2a 2a 2a 2a 2a \x00\x00.*******
1f20: 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 35 32 35 ********.*** 525
1f30: 2c 35 33 33 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 ,533 ****.
1f40: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e list [catch {bin
1f50: 61 72 79 20 66 6f 72 6d 61 74 20 64 20 24 61 7d ary format d $a}
1f60: 20 6d 73 67 5d 20 24 6d 73 67 0a 20 20 7d 20 5b msg] $msg. } [
1f70: 6c 69 73 74 20 31 20 22 65 78 70 65 63 74 65 64 list 1 "expected
1f80: 20 66 6c 6f 61 74 69 6e 67 2d 70 6f 69 6e 74 20 floating-point
1f90: 6e 75 6d 62 65 72 20 62 75 74 20 67 6f 74 20 5c number but got \
1fa0: 22 31 2e 36 20 33 2e 34 5c 22 22 5d 0a 21 20 74 "1.6 3.4\""].! t
1fb0: 65 73 74 20 62 69 6e 61 72 79 2d 31 34 2e 31 36 est binary-14.16
1fc0: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
1fd0: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e md: format} {non
1fe0: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e Portable macOrUn
1ff0: 69 78 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 20 ix} {. set
2000: 61 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 20 20 a {1.6 3.4}.
2010: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 binary format
2020: 64 31 20 24 61 0a 20 20 7d 20 5c 78 33 66 5c 78 d1 $a. } \x3f\x
2030: 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 f9\x99\x99\x99\x
2040: 39 39 5c 78 39 39 5c 78 39 61 0a 21 20 74 65 73 99\x99\x9a.! tes
2050: 74 20 62 69 6e 61 72 79 2d 31 34 2e 31 37 20 7b t binary-14.17 {
2060: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
2070: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f : format} {nonPo
2080: 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b rtable pcOnly} {
2090: 0a 20 20 20 20 20 20 73 65 74 20 61 20 7b 31 2e . set a {1.
20a0: 36 20 33 2e 34 7d 0a 20 20 20 20 20 20 62 69 6e 6 3.4}. bin
20b0: 61 72 79 20 66 6f 72 6d 61 74 20 64 31 20 24 61 ary format d1 $a
20c0: 0a 2d 2d 2d 20 35 32 39 2c 35 33 37 20 2d 2d 2d .--- 529,537 ---
20d0: 2d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 63 61 -. list [ca
20e0: 74 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d tch {binary form
20f0: 61 74 20 64 20 24 61 7d 20 6d 73 67 5d 20 24 6d at d $a} msg] $m
2100: 73 67 0a 20 20 7d 20 5b 6c 69 73 74 20 31 20 22 sg. } [list 1 "
2110: 65 78 70 65 63 74 65 64 20 66 6c 6f 61 74 69 6e expected floatin
2120: 67 2d 70 6f 69 6e 74 20 6e 75 6d 62 65 72 20 62 g-point number b
2130: 75 74 20 67 6f 74 20 5c 22 31 2e 36 20 33 2e 34 ut got \"1.6 3.4
2140: 5c 22 22 5d 0a 21 20 74 65 73 74 20 62 69 6e 61 \""].! test bina
2150: 72 79 2d 31 34 2e 31 36 20 7b 54 63 6c 5f 42 69 ry-14.16 {Tcl_Bi
2160: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d naryObjCmd: form
2170: 61 74 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 at} {bigEndian}
2180: 7b 0a 20 20 20 20 20 20 73 65 74 20 61 20 7b 31 {. set a {1
2190: 2e 36 20 33 2e 34 7d 0a 20 20 20 20 20 20 62 69 .6 3.4}. bi
21a0: 6e 61 72 79 20 66 6f 72 6d 61 74 20 64 31 20 24 nary format d1 $
21b0: 61 0a 20 20 7d 20 5c 78 33 66 5c 78 66 39 5c 78 a. } \x3f\xf9\x
21c0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
21d0: 39 39 5c 78 39 61 0a 21 20 74 65 73 74 20 62 69 99\x9a.! test bi
21e0: 6e 61 72 79 2d 31 34 2e 31 37 20 7b 54 63 6c 5f nary-14.17 {Tcl_
21f0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f BinaryObjCmd: fo
2200: 72 6d 61 74 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 rmat} {littleEnd
2210: 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 ian} {. set
2220: 20 61 20 7b 31 2e 36 20 33 2e 34 7d 0a 20 20 20 a {1.6 3.4}.
2230: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 binary format
2240: 20 64 31 20 24 61 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a d1 $a.*********
2250: 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 30 37 30 2c ******.*** 1070,
2260: 31 31 31 30 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 1110 ****.
2270: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e list [catch {bin
2280: 61 72 79 20 73 63 61 6e 20 61 62 63 20 66 7d 20 ary scan abc f}
2290: 6d 73 67 5d 20 24 6d 73 67 0a 20 20 7d 20 7b 31 msg] $msg. } {1
22a0: 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 20 61 72 67 {not enough arg
22b0: 75 6d 65 6e 74 73 20 66 6f 72 20 61 6c 6c 20 66 uments for all f
22c0: 6f 72 6d 61 74 20 73 70 65 63 69 66 69 65 72 73 ormat specifiers
22d0: 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 }}.! test binary
22e0: 2d 33 31 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72 -31.2 {Tcl_Binar
22f0: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b yObjCmd: scan} {
2300: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f nonPortable macO
2310: 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 63 rUnix} {. c
2320: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
2330: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
2340: 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 nary scan \x3f\x
2350: 63 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78 cc\xcc\xcd\x40\x
2360: 35 39 5c 78 39 39 5c 78 39 61 20 66 2a 20 61 72 59\x99\x9a f* ar
2370: 67 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 g1] $arg1. } {1
2380: 20 7b 31 2e 36 30 30 30 30 30 30 32 33 38 34 20 {1.60000002384
2390: 33 2e 34 30 30 30 30 30 30 39 35 33 37 7d 7d 0a 3.40000009537}}.
23a0: 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 31 ! test binary-31
23b0: 2e 33 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 .3 {Tcl_BinaryOb
23c0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e jCmd: scan} {non
23d0: 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d Portable pcOnly}
23e0: 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b {. catch {
23f0: 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 unset arg1}.
2400: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 list [binary s
2410: 63 61 6e 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 can \xcd\xcc\xcc
2420: 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 39 \x3f\x9a\x99\x59
2430: 5c 78 34 30 20 66 2a 20 61 72 67 31 5d 20 24 61 \x40 f* arg1] $a
2440: 72 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e 36 30 rg1. } {1 {1.60
2450: 30 30 30 30 30 32 33 38 34 20 33 2e 34 30 30 30 000002384 3.4000
2460: 30 30 30 39 35 33 37 7d 7d 0a 21 20 74 65 73 74 0009537}}.! test
2470: 20 62 69 6e 61 72 79 2d 33 31 2e 34 20 7b 54 63 binary-31.4 {Tc
2480: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
2490: 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 scan} {nonPortab
24a0: 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a le macOrUnix} {.
24b0: 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 catch {uns
24c0: 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c et arg1}. l
24d0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e ist [binary scan
24e0: 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 \x3f\xcc\xcc\xc
24f0: 64 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 d\x40\x59\x99\x9
2500: 61 20 66 20 61 72 67 31 5d 20 24 61 72 67 31 0a a f arg1] $arg1.
2510: 20 20 7d 20 7b 31 20 31 2e 36 30 30 30 30 30 30 } {1 1.6000000
2520: 32 33 38 34 7d 0a 21 20 74 65 73 74 20 62 69 6e 2384}.! test bin
2530: 61 72 79 2d 33 31 2e 35 20 7b 54 63 6c 5f 42 69 ary-31.5 {Tcl_Bi
2540: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
2550: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 } {nonPortable p
2560: 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 cOnly} {. c
2570: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
2580: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
2590: 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78 nary scan \xcd\x
25a0: 63 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78 cc\xcc\x3f\x9a\x
25b0: 39 39 5c 78 35 39 5c 78 34 30 20 66 20 61 72 67 99\x59\x40 f arg
25c0: 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 1] $arg1. } {1
25d0: 31 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0a 21 1.60000002384}.!
25e0: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 31 2e test binary-31.
25f0: 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 6 {Tcl_BinaryObj
2600: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 Cmd: scan} {nonP
2610: 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 ortable macOrUni
2620: 78 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 x} {. catch
2630: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
2640: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
2650: 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 63 5c 78 scan \x3f\xcc\x
2660: 63 63 5c 78 63 64 20 66 31 20 61 72 67 31 5d 20 cc\xcd f1 arg1]
2670: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 31 2e 36 $arg1. } {1 1.6
2680: 30 30 30 30 30 30 32 33 38 34 7d 0a 21 20 74 65 0000002384}.! te
2690: 73 74 20 62 69 6e 61 72 79 2d 33 31 2e 37 20 7b st binary-31.7 {
26a0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
26b0: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 : scan} {nonPort
26c0: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 able pcOnly} {.
26d0: 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 catch {unse
26e0: 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 t arg1}. li
26f0: 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 st [binary scan
2700: 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 33 66 \xcd\xcc\xcc\x3f
2710: 20 66 31 20 61 72 67 31 5d 20 24 61 72 67 31 0a f1 arg1] $arg1.
2720: 20 20 7d 20 7b 31 20 31 2e 36 30 30 30 30 30 30 } {1 1.6000000
2730: 32 33 38 34 7d 0a 21 20 74 65 73 74 20 62 69 6e 2384}.! test bin
2740: 61 72 79 2d 33 31 2e 38 20 7b 54 63 6c 5f 42 69 ary-31.8 {Tcl_Bi
2750: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
2760: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d } {nonPortable m
2770: 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 acOrUnix} {.
2780: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 catch {unset a
2790: 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 rg1}. list
27a0: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 [binary scan \x3
27b0: 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 20 66 30 f\xcc\xcc\xcd f0
27c0: 20 61 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d arg1] $arg1. }
27d0: 20 7b 31 20 7b 7d 7d 0a 21 20 74 65 73 74 20 62 {1 {}}.! test b
27e0: 69 6e 61 72 79 2d 33 31 2e 39 20 7b 54 63 6c 5f inary-31.9 {Tcl_
27f0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
2800: 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 an} {nonPortable
2810: 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 pcOnly} {.
2820: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
2830: 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b g1}. list [
2840: 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 binary scan \xcd
2850: 5c 78 63 63 5c 78 63 63 5c 78 33 66 20 66 30 20 \xcc\xcc\x3f f0
2860: 61 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 arg1] $arg1. }
2870: 7b 31 20 7b 7d 7d 0a 21 20 74 65 73 74 20 62 69 {1 {}}.! test bi
2880: 6e 61 72 79 2d 33 31 2e 31 30 20 7b 54 63 6c 5f nary-31.10 {Tcl_
2890: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
28a0: 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 an} {nonPortable
28b0: 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 macOrUnix} {.
28c0: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 catch {unset
28d0: 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 arg1}. lis
28e0: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c t [binary scan \
28f0: 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c x3f\xcc\xcc\xcd\
2900: 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 61 20 x40\x59\x99\x9a
2910: 66 32 20 61 72 67 31 5d 20 24 61 72 67 31 0a 20 f2 arg1] $arg1.
2920: 20 7d 20 7b 31 20 7b 31 2e 36 30 30 30 30 30 30 } {1 {1.6000000
2930: 32 33 38 34 20 33 2e 34 30 30 30 30 30 30 39 35 2384 3.400000095
2940: 33 37 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 37}}.! test bina
2950: 72 79 2d 33 31 2e 31 31 20 7b 54 63 6c 5f 42 69 ry-31.11 {Tcl_Bi
2960: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
2970: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 } {nonPortable p
2980: 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 cOnly} {. c
2990: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
29a0: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
29b0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78 nary scan \xcd\x
29c0: 63 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78 cc\xcc\x3f\x9a\x
29d0: 39 39 5c 78 35 39 5c 78 34 30 20 66 32 20 61 72 99\x59\x40 f2 ar
29e0: 67 31 5d 20 24 61 72 67 31 0a 2d 2d 2d 20 31 30 g1] $arg1.--- 10
29f0: 37 34 2c 31 31 31 34 20 2d 2d 2d 2d 0a 20 20 20 74,1114 ----.
2a00: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b list [catch {
2a10: 62 69 6e 61 72 79 20 73 63 61 6e 20 61 62 63 20 binary scan abc
2a20: 66 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 20 20 7d f} msg] $msg. }
2a30: 20 7b 31 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 20 {1 {not enough
2a40: 61 72 67 75 6d 65 6e 74 73 20 66 6f 72 20 61 6c arguments for al
2a50: 6c 20 66 6f 72 6d 61 74 20 73 70 65 63 69 66 69 l format specifi
2a60: 65 72 73 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e ers}}.! test bin
2a70: 61 72 79 2d 33 31 2e 32 20 7b 54 63 6c 5f 42 69 ary-31.2 {Tcl_Bi
2a80: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
2a90: 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b 0a } {bigEndian} {.
2aa0: 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 catch {uns
2ab0: 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c et arg1}. l
2ac0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e ist [binary scan
2ad0: 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 \x3f\xcc\xcc\xc
2ae0: 64 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 d\x40\x59\x99\x9
2af0: 61 20 66 2a 20 61 72 67 31 5d 20 24 61 72 67 31 a f* arg1] $arg1
2b00: 0a 20 20 7d 20 7b 31 20 7b 31 2e 36 30 30 30 30 . } {1 {1.60000
2b10: 30 30 32 33 38 34 20 33 2e 34 30 30 30 30 30 30 002384 3.4000000
2b20: 39 35 33 37 7d 7d 0a 21 20 74 65 73 74 20 62 69 9537}}.! test bi
2b30: 6e 61 72 79 2d 33 31 2e 33 20 7b 54 63 6c 5f 42 nary-31.3 {Tcl_B
2b40: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 inaryObjCmd: sca
2b50: 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 6e n} {littleEndian
2b60: 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 } {. catch
2b70: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 {unset arg1}.
2b80: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
2b90: 73 63 61 6e 20 5c 78 63 64 5c 78 63 63 5c 78 63 scan \xcd\xcc\xc
2ba0: 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 c\x3f\x9a\x99\x5
2bb0: 39 5c 78 34 30 20 66 2a 20 61 72 67 31 5d 20 24 9\x40 f* arg1] $
2bc0: 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e 36 arg1. } {1 {1.6
2bd0: 30 30 30 30 30 30 32 33 38 34 20 33 2e 34 30 30 0000002384 3.400
2be0: 30 30 30 30 39 35 33 37 7d 7d 0a 21 20 74 65 73 00009537}}.! tes
2bf0: 74 20 62 69 6e 61 72 79 2d 33 31 2e 34 20 7b 54 t binary-31.4 {T
2c00: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
2c10: 20 73 63 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 scan} {bigEndia
2c20: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
2c30: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
2c40: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
2c50: 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 63 5c 78 scan \x3f\xcc\x
2c60: 63 63 5c 78 63 64 5c 78 34 30 5c 78 35 39 5c 78 cc\xcd\x40\x59\x
2c70: 39 39 5c 78 39 61 20 66 20 61 72 67 31 5d 20 24 99\x9a f arg1] $
2c80: 61 72 67 31 0a 20 20 7d 20 7b 31 20 31 2e 36 30 arg1. } {1 1.60
2c90: 30 30 30 30 30 32 33 38 34 7d 0a 21 20 74 65 73 000002384}.! tes
2ca0: 74 20 62 69 6e 61 72 79 2d 33 31 2e 35 20 7b 54 t binary-31.5 {T
2cb0: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
2cc0: 20 73 63 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e scan} {littleEn
2cd0: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 dian} {. ca
2ce0: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d tch {unset arg1}
2cf0: 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e . list [bin
2d00: 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78 63 ary scan \xcd\xc
2d10: 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78 39 c\xcc\x3f\x9a\x9
2d20: 39 5c 78 35 39 5c 78 34 30 20 66 20 61 72 67 31 9\x59\x40 f arg1
2d30: 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 31 ] $arg1. } {1 1
2d40: 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0a 21 20 .60000002384}.!
2d50: 74 65 73 74 20 62 69 6e 61 72 79 2d 33 31 2e 36 test binary-31.6
2d60: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
2d70: 6d 64 3a 20 73 63 61 6e 7d 20 7b 62 69 67 45 6e md: scan} {bigEn
2d80: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 dian} {. ca
2d90: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d tch {unset arg1}
2da0: 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e . list [bin
2db0: 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 ary scan \x3f\xc
2dc0: 63 5c 78 63 63 5c 78 63 64 20 66 31 20 61 72 67 c\xcc\xcd f1 arg
2dd0: 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 1] $arg1. } {1
2de0: 31 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0a 21 1.60000002384}.!
2df0: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 31 2e test binary-31.
2e00: 37 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 7 {Tcl_BinaryObj
2e10: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6c 69 74 74 Cmd: scan} {litt
2e20: 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 leEndian} {.
2e30: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 catch {unset a
2e40: 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 rg1}. list
2e50: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 [binary scan \xc
2e60: 64 5c 78 63 63 5c 78 63 63 5c 78 33 66 20 66 31 d\xcc\xcc\x3f f1
2e70: 20 61 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d arg1] $arg1. }
2e80: 20 7b 31 20 31 2e 36 30 30 30 30 30 30 32 33 38 {1 1.6000000238
2e90: 34 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 4}.! test binary
2ea0: 2d 33 31 2e 38 20 7b 54 63 6c 5f 42 69 6e 61 72 -31.8 {Tcl_Binar
2eb0: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b yObjCmd: scan} {
2ec0: 6c 69 74 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a littleEndian} {.
2ed0: 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 catch {uns
2ee0: 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c et arg1}. l
2ef0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e ist [binary scan
2f00: 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 \x3f\xcc\xcc\xc
2f10: 64 20 66 30 20 61 72 67 31 5d 20 24 61 72 67 31 d f0 arg1] $arg1
2f20: 0a 20 20 7d 20 7b 31 20 7b 7d 7d 0a 21 20 74 65 . } {1 {}}.! te
2f30: 73 74 20 62 69 6e 61 72 79 2d 33 31 2e 39 20 7b st binary-31.9 {
2f40: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
2f50: 3a 20 73 63 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 : scan} {littleE
2f60: 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 ndian} {. c
2f70: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
2f80: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
2f90: 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78 nary scan \xcd\x
2fa0: 63 63 5c 78 63 63 5c 78 33 66 20 66 30 20 61 72 cc\xcc\x3f f0 ar
2fb0: 67 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 g1] $arg1. } {1
2fc0: 20 7b 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 {}}.! test bina
2fd0: 72 79 2d 33 31 2e 31 30 20 7b 54 63 6c 5f 42 69 ry-31.10 {Tcl_Bi
2fe0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
2ff0: 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b 0a } {bigEndian} {.
3000: 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 catch {uns
3010: 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c et arg1}. l
3020: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e ist [binary scan
3030: 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 \x3f\xcc\xcc\xc
3040: 64 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 d\x40\x59\x99\x9
3050: 61 20 66 32 20 61 72 67 31 5d 20 24 61 72 67 31 a f2 arg1] $arg1
3060: 0a 20 20 7d 20 7b 31 20 7b 31 2e 36 30 30 30 30 . } {1 {1.60000
3070: 30 30 32 33 38 34 20 33 2e 34 30 30 30 30 30 30 002384 3.4000000
3080: 39 35 33 37 7d 7d 0a 21 20 74 65 73 74 20 62 69 9537}}.! test bi
3090: 6e 61 72 79 2d 33 31 2e 31 31 20 7b 54 63 6c 5f nary-31.11 {Tcl_
30a0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
30b0: 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 an} {littleEndia
30c0: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
30d0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
30e0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
30f0: 20 73 63 61 6e 20 5c 78 63 64 5c 78 63 63 5c 78 scan \xcd\xcc\x
3100: 63 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 cc\x3f\x9a\x99\x
3110: 35 39 5c 78 34 30 20 66 32 20 61 72 67 31 5d 20 59\x40 f2 arg1]
3120: 24 61 72 67 31 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a $arg1.**********
3130: 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 31 32 30 2c 31 *****.*** 1120,1
3140: 31 32 34 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 6c 124 ****. l
3150: 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e 61 ist [catch {bina
3160: 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 63 ry scan \x3f\xcc
3170: 5c 78 63 63 5c 78 63 64 20 66 31 20 61 72 67 31 \xcc\xcd f1 arg1
3180: 28 61 29 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 20 (a)} msg] $msg.
3190: 20 7d 20 7b 31 20 7b 63 61 6e 27 74 20 73 65 74 } {1 {can't set
31a0: 20 22 61 72 67 31 28 61 29 22 3a 20 76 61 72 69 "arg1(a)": vari
31b0: 61 62 6c 65 20 69 73 6e 27 74 20 61 72 72 61 79 able isn't array
31c0: 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 }}.! test binary
31d0: 2d 33 31 2e 31 34 20 7b 54 63 6c 5f 42 69 6e 61 -31.14 {Tcl_Bina
31e0: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 ryObjCmd: scan}
31f0: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 {nonPortable mac
3200: 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 OrUnix} {.
3210: 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 catch {unset arg
3220: 31 20 61 72 67 32 7d 0a 20 20 20 20 20 20 73 65 1 arg2}. se
3230: 74 20 61 72 67 31 20 66 6f 6f 0a 2d 2d 2d 20 31 t arg1 foo.--- 1
3240: 31 32 34 2c 31 31 32 38 20 2d 2d 2d 2d 0a 20 20 124,1128 ----.
3250: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 list [catch
3260: 7b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 {binary scan \x3
3270: 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 20 66 31 f\xcc\xcc\xcd f1
3280: 20 61 72 67 31 28 61 29 7d 20 6d 73 67 5d 20 24 arg1(a)} msg] $
3290: 6d 73 67 0a 20 20 7d 20 7b 31 20 7b 63 61 6e 27 msg. } {1 {can'
32a0: 74 20 73 65 74 20 22 61 72 67 31 28 61 29 22 3a t set "arg1(a)":
32b0: 20 76 61 72 69 61 62 6c 65 20 69 73 6e 27 74 20 variable isn't
32c0: 61 72 72 61 79 7d 7d 0a 21 20 74 65 73 74 20 62 array}}.! test b
32d0: 69 6e 61 72 79 2d 33 31 2e 31 34 20 7b 54 63 6c inary-31.14 {Tcl
32e0: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 _BinaryObjCmd: s
32f0: 63 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d can} {bigEndian}
3300: 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b {. catch {
3310: 75 6e 73 65 74 20 61 72 67 31 20 61 72 67 32 7d unset arg1 arg2}
3320: 0a 20 20 20 20 20 20 73 65 74 20 61 72 67 31 20 . set arg1
3330: 66 6f 6f 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a foo.************
3340: 2a 2a 2a 0a 2a 2a 2a 20 31 31 32 36 2c 31 31 33 ***.*** 1126,113
3350: 30 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 6c 69 73 0 ****. lis
3360: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c t [binary scan \
3370: 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c x3f\xcc\xcc\xcd\
3380: 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 61 5c x40\x59\x99\x9a\
3390: 78 30 35 20 66 32 63 2a 20 61 72 67 31 20 61 72 x05 f2c* arg1 ar
33a0: 67 32 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a g2] $arg1 $arg2.
33b0: 20 20 7d 20 7b 32 20 7b 31 2e 36 30 30 30 30 30 } {2 {1.600000
33c0: 30 32 33 38 34 20 33 2e 34 30 30 30 30 30 30 39 02384 3.40000009
33d0: 35 33 37 7d 20 35 7d 0a 21 20 74 65 73 74 20 62 537} 5}.! test b
33e0: 69 6e 61 72 79 2d 33 31 2e 31 35 20 7b 54 63 6c inary-31.15 {Tcl
33f0: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 _BinaryObjCmd: s
3400: 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c can} {nonPortabl
3410: 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 e pcOnly} {.
3420: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 catch {unset a
3430: 72 67 31 20 61 72 67 32 7d 0a 20 20 20 20 20 20 rg1 arg2}.
3440: 73 65 74 20 61 72 67 31 20 66 6f 6f 0a 2d 2d 2d set arg1 foo.---
3450: 20 31 31 33 30 2c 31 31 33 34 20 2d 2d 2d 2d 0a 1130,1134 ----.
3460: 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 list [bina
3470: 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 63 ry scan \x3f\xcc
3480: 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78 35 39 \xcc\xcd\x40\x59
3490: 5c 78 39 39 5c 78 39 61 5c 78 30 35 20 66 32 63 \x99\x9a\x05 f2c
34a0: 2a 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 * arg1 arg2] $ar
34b0: 67 31 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 g1 $arg2. } {2
34c0: 7b 31 2e 36 30 30 30 30 30 30 32 33 38 34 20 33 {1.60000002384 3
34d0: 2e 34 30 30 30 30 30 30 39 35 33 37 7d 20 35 7d .40000009537} 5}
34e0: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 .! test binary-3
34f0: 31 2e 31 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79 1.15 {Tcl_Binary
3500: 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6c ObjCmd: scan} {l
3510: 69 74 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 ittleEndian} {.
3520: 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 catch {unse
3530: 74 20 61 72 67 31 20 61 72 67 32 7d 0a 20 20 20 t arg1 arg2}.
3540: 20 20 20 73 65 74 20 61 72 67 31 20 66 6f 6f 0a set arg1 foo.
3550: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a ***************.
3560: 2a 2a 2a 20 31 31 33 36 2c 31 31 37 36 20 2a 2a *** 1136,1176 **
3570: 2a 2a 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 63 **. list [c
3580: 61 74 63 68 20 7b 62 69 6e 61 72 79 20 73 63 61 atch {binary sca
3590: 6e 20 61 62 63 20 64 7d 20 6d 73 67 5d 20 24 6d n abc d} msg] $m
35a0: 73 67 0a 20 20 7d 20 7b 31 20 7b 6e 6f 74 20 65 sg. } {1 {not e
35b0: 6e 6f 75 67 68 20 61 72 67 75 6d 65 6e 74 73 20 nough arguments
35c0: 66 6f 72 20 61 6c 6c 20 66 6f 72 6d 61 74 20 73 for all format s
35d0: 70 65 63 69 66 69 65 72 73 7d 7d 0a 21 20 74 65 pecifiers}}.! te
35e0: 73 74 20 62 69 6e 61 72 79 2d 33 32 2e 32 20 7b st binary-32.2 {
35f0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
3600: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 : scan} {nonPort
3610: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 able macOrUnix}
3620: 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 {. catch {u
3630: 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 nset arg1}.
3640: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 list [binary sc
3650: 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c an \x3f\xf9\x99\
3660: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
3670: 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c x9a\x40\x0b\x33\
3680: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x33\x33\x33\x33\
3690: 78 33 33 20 64 2a 20 61 72 67 31 5d 20 24 61 72 x33 d* arg1] $ar
36a0: 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e 36 20 33 g1. } {1 {1.6 3
36b0: 2e 34 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 .4}}.! test bina
36c0: 72 79 2d 33 32 2e 33 20 7b 54 63 6c 5f 42 69 6e ry-32.3 {Tcl_Bin
36d0: 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d aryObjCmd: scan}
36e0: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 {nonPortable pc
36f0: 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 61 Only} {. ca
3700: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d tch {unset arg1}
3710: 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e . list [bin
3720: 61 72 79 20 73 63 61 6e 20 5c 78 39 61 5c 78 39 ary scan \x9a\x9
3730: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
3740: 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 9\xf9\x3f\x33\x3
3750: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 3\x33\x33\x33\x3
3760: 33 5c 78 30 62 5c 78 34 30 20 64 2a 20 61 72 67 3\x0b\x40 d* arg
3770: 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 1] $arg1. } {1
3780: 7b 31 2e 36 20 33 2e 34 7d 7d 0a 21 20 74 65 73 {1.6 3.4}}.! tes
3790: 74 20 62 69 6e 61 72 79 2d 33 32 2e 34 20 7b 54 t binary-32.4 {T
37a0: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
37b0: 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 scan} {nonPorta
37c0: 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b ble macOrUnix} {
37d0: 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e . catch {un
37e0: 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 set arg1}.
37f0: 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 list [binary sca
3800: 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 n \x3f\xf9\x99\x
3810: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
3820: 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c 78 9a\x40\x0b\x33\x
3830: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
3840: 33 33 20 64 20 61 72 67 31 5d 20 24 61 72 67 31 33 d arg1] $arg1
3850: 0a 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 20 74 . } {1 1.6}.! t
3860: 65 73 74 20 62 69 6e 61 72 79 2d 33 32 2e 35 20 est binary-32.5
3870: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d {Tcl_BinaryObjCm
3880: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 d: scan} {nonPor
3890: 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a table pcOnly} {.
38a0: 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 catch {uns
38b0: 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c et arg1}. l
38c0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e ist [binary scan
38d0: 20 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 \x9a\x99\x99\x9
38e0: 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 9\x99\x99\xf9\x3
38f0: 66 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 f\x33\x33\x33\x3
3900: 33 5c 78 33 33 5c 78 33 33 5c 78 30 62 5c 78 34 3\x33\x33\x0b\x4
3910: 30 20 64 20 61 72 67 31 5d 20 24 61 72 67 31 0a 0 d arg1] $arg1.
3920: 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 20 74 65 } {1 1.6}.! te
3930: 73 74 20 62 69 6e 61 72 79 2d 33 32 2e 36 20 7b st binary-32.6 {
3940: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 Tcl_BinaryObjCmd
3950: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 : scan} {nonPort
3960: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 able macOrUnix}
3970: 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 {. catch {u
3980: 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 nset arg1}.
3990: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 list [binary sc
39a0: 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c an \x3f\xf9\x99\
39b0: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
39c0: 78 39 61 20 64 31 20 61 72 67 31 5d 20 24 61 72 x9a d1 arg1] $ar
39d0: 67 31 0a 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 g1. } {1 1.6}.!
39e0: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 32 2e test binary-32.
39f0: 37 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 7 {Tcl_BinaryObj
3a00: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 Cmd: scan} {nonP
3a10: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 ortable pcOnly}
3a20: 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 {. catch {u
3a30: 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 nset arg1}.
3a40: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 list [binary sc
3a50: 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78 39 39 5c an \x9a\x99\x99\
3a60: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 39 5c x99\x99\x99\xf9\
3a70: 78 33 66 20 64 31 20 61 72 67 31 5d 20 24 61 72 x3f d1 arg1] $ar
3a80: 67 31 0a 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 g1. } {1 1.6}.!
3a90: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 32 2e test binary-32.
3aa0: 38 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 8 {Tcl_BinaryObj
3ab0: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 Cmd: scan} {nonP
3ac0: 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 ortable macOrUni
3ad0: 78 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 x} {. catch
3ae0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
3af0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
3b00: 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 scan \x3f\xf9\x
3b10: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
3b20: 39 39 5c 78 39 61 20 64 30 20 61 72 67 31 5d 20 99\x9a d0 arg1]
3b30: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 7d 7d $arg1. } {1 {}}
3b40: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 .! test binary-3
3b50: 32 2e 39 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 2.9 {Tcl_BinaryO
3b60: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f bjCmd: scan} {no
3b70: 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 nPortable pcOnly
3b80: 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 } {. catch
3b90: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 {unset arg1}.
3ba0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
3bb0: 73 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78 39 scan \x9a\x99\x9
3bc0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 9\x99\x99\x99\xf
3bd0: 39 5c 78 33 66 20 64 30 20 61 72 67 31 5d 20 24 9\x3f d0 arg1] $
3be0: 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 7d 7d 0a arg1. } {1 {}}.
3bf0: 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 32 ! test binary-32
3c00: 2e 31 30 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f .10 {Tcl_BinaryO
3c10: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f bjCmd: scan} {no
3c20: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 nPortable macOrU
3c30: 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 nix} {. cat
3c40: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a ch {unset arg1}.
3c50: 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 list [bina
3c60: 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 ry scan \x3f\xf9
3c70: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
3c80: 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 \x99\x9a\x40\x0b
3c90: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 \x33\x33\x33\x33
3ca0: 5c 78 33 33 5c 78 33 33 20 64 32 20 61 72 67 31 \x33\x33 d2 arg1
3cb0: 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b ] $arg1. } {1 {
3cc0: 31 2e 36 20 33 2e 34 7d 7d 0a 21 20 74 65 73 74 1.6 3.4}}.! test
3cd0: 20 62 69 6e 61 72 79 2d 33 32 2e 31 31 20 7b 54 binary-32.11 {T
3ce0: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
3cf0: 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 scan} {nonPorta
3d00: 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 ble pcOnly} {.
3d10: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 catch {unset
3d20: 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 arg1}. lis
3d30: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c t [binary scan \
3d40: 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x9a\x99\x99\x99\
3d50: 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 5c x99\x99\xf9\x3f\
3d60: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x33\x33\x33\x33\
3d70: 78 33 33 5c 78 33 33 5c 78 30 62 5c 78 34 30 20 x33\x33\x0b\x40
3d80: 64 32 20 61 72 67 31 5d 20 24 61 72 67 31 0a 2d d2 arg1] $arg1.-
3d90: 2d 2d 20 31 31 34 30 2c 31 31 38 30 20 2d 2d 2d -- 1140,1180 ---
3da0: 2d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 63 61 -. list [ca
3db0: 74 63 68 20 7b 62 69 6e 61 72 79 20 73 63 61 6e tch {binary scan
3dc0: 20 61 62 63 20 64 7d 20 6d 73 67 5d 20 24 6d 73 abc d} msg] $ms
3dd0: 67 0a 20 20 7d 20 7b 31 20 7b 6e 6f 74 20 65 6e g. } {1 {not en
3de0: 6f 75 67 68 20 61 72 67 75 6d 65 6e 74 73 20 66 ough arguments f
3df0: 6f 72 20 61 6c 6c 20 66 6f 72 6d 61 74 20 73 70 or all format sp
3e00: 65 63 69 66 69 65 72 73 7d 7d 0a 21 20 74 65 73 ecifiers}}.! tes
3e10: 74 20 62 69 6e 61 72 79 2d 33 32 2e 32 20 7b 54 t binary-32.2 {T
3e20: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
3e30: 20 73 63 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 scan} {bigEndia
3e40: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
3e50: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
3e60: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
3e70: 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 scan \x3f\xf9\x
3e80: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
3e90: 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 99\x9a\x40\x0b\x
3ea0: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
3eb0: 33 33 5c 78 33 33 20 64 2a 20 61 72 67 31 5d 20 33\x33 d* arg1]
3ec0: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e $arg1. } {1 {1.
3ed0: 36 20 33 2e 34 7d 7d 0a 21 20 74 65 73 74 20 62 6 3.4}}.! test b
3ee0: 69 6e 61 72 79 2d 33 32 2e 33 20 7b 54 63 6c 5f inary-32.3 {Tcl_
3ef0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
3f00: 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 an} {littleEndia
3f10: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
3f20: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
3f30: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
3f40: 20 73 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78 scan \x9a\x99\x
3f50: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
3f60: 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c 78 f9\x3f\x33\x33\x
3f70: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
3f80: 30 62 5c 78 34 30 20 64 2a 20 61 72 67 31 5d 20 0b\x40 d* arg1]
3f90: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e $arg1. } {1 {1.
3fa0: 36 20 33 2e 34 7d 7d 0a 21 20 74 65 73 74 20 62 6 3.4}}.! test b
3fb0: 69 6e 61 72 79 2d 33 32 2e 34 20 7b 54 63 6c 5f inary-32.4 {Tcl_
3fc0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
3fd0: 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 an} {bigEndian}
3fe0: 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 {. catch {u
3ff0: 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 nset arg1}.
4000: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 list [binary sc
4010: 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c an \x3f\xf9\x99\
4020: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
4030: 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c x9a\x40\x0b\x33\
4040: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x33\x33\x33\x33\
4050: 78 33 33 20 64 20 61 72 67 31 5d 20 24 61 72 67 x33 d arg1] $arg
4060: 31 0a 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 20 1. } {1 1.6}.!
4070: 74 65 73 74 20 62 69 6e 61 72 79 2d 33 32 2e 35 test binary-32.5
4080: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
4090: 6d 64 3a 20 73 63 61 6e 7d 20 7b 6c 69 74 74 6c md: scan} {littl
40a0: 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 eEndian} {.
40b0: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
40c0: 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b g1}. list [
40d0: 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 39 61 binary scan \x9a
40e0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
40f0: 5c 78 39 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 \x99\xf9\x3f\x33
4100: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 \x33\x33\x33\x33
4110: 5c 78 33 33 5c 78 30 62 5c 78 34 30 20 64 20 61 \x33\x0b\x40 d a
4120: 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b rg1] $arg1. } {
4130: 31 20 31 2e 36 7d 0a 21 20 74 65 73 74 20 62 69 1 1.6}.! test bi
4140: 6e 61 72 79 2d 33 32 2e 36 20 7b 54 63 6c 5f 42 nary-32.6 {Tcl_B
4150: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 inaryObjCmd: sca
4160: 6e 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b n} {bigEndian} {
4170: 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e . catch {un
4180: 73 65 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 set arg1}.
4190: 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 list [binary sca
41a0: 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 n \x3f\xf9\x99\x
41b0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
41c0: 39 61 20 64 31 20 61 72 67 31 5d 20 24 61 72 67 9a d1 arg1] $arg
41d0: 31 0a 20 20 7d 20 7b 31 20 31 2e 36 7d 0a 21 20 1. } {1 1.6}.!
41e0: 74 65 73 74 20 62 69 6e 61 72 79 2d 33 32 2e 37 test binary-32.7
41f0: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 {Tcl_BinaryObjC
4200: 6d 64 3a 20 73 63 61 6e 7d 20 7b 6c 69 74 74 6c md: scan} {littl
4210: 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 eEndian} {.
4220: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
4230: 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b g1}. list [
4240: 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 39 61 binary scan \x9a
4250: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
4260: 5c 78 39 39 5c 78 66 39 5c 78 33 66 20 64 31 20 \x99\xf9\x3f d1
4270: 61 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d 20 arg1] $arg1. }
4280: 7b 31 20 31 2e 36 7d 0a 21 20 74 65 73 74 20 62 {1 1.6}.! test b
4290: 69 6e 61 72 79 2d 33 32 2e 38 20 7b 54 63 6c 5f inary-32.8 {Tcl_
42a0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 BinaryObjCmd: sc
42b0: 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 an} {littleEndia
42c0: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
42d0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
42e0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
42f0: 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 scan \x3f\xf9\x
4300: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
4310: 39 39 5c 78 39 61 20 64 30 20 61 72 67 31 5d 20 99\x9a d0 arg1]
4320: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 7d 7d $arg1. } {1 {}}
4330: 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 .! test binary-3
4340: 32 2e 39 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 2.9 {Tcl_BinaryO
4350: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6c 69 bjCmd: scan} {li
4360: 74 74 6c 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 ttleEndian} {.
4370: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 catch {unset
4380: 20 61 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 arg1}. lis
4390: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c t [binary scan \
43a0: 78 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x9a\x99\x99\x99\
43b0: 78 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 20 x99\x99\xf9\x3f
43c0: 64 30 20 61 72 67 31 5d 20 24 61 72 67 31 0a 20 d0 arg1] $arg1.
43d0: 20 7d 20 7b 31 20 7b 7d 7d 0a 21 20 74 65 73 74 } {1 {}}.! test
43e0: 20 62 69 6e 61 72 79 2d 33 32 2e 31 30 20 7b 54 binary-32.10 {T
43f0: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
4400: 20 73 63 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 scan} {bigEndia
4410: 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 n} {. catch
4420: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 {unset arg1}.
4430: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
4440: 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 scan \x3f\xf9\x
4450: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
4460: 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 99\x9a\x40\x0b\x
4470: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33\x33\x33\x33\x
4480: 33 33 5c 78 33 33 20 64 32 20 61 72 67 31 5d 20 33\x33 d2 arg1]
4490: 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 7b 31 2e $arg1. } {1 {1.
44a0: 36 20 33 2e 34 7d 7d 0a 21 20 74 65 73 74 20 62 6 3.4}}.! test b
44b0: 69 6e 61 72 79 2d 33 32 2e 31 31 20 7b 54 63 6c inary-32.11 {Tcl
44c0: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 _BinaryObjCmd: s
44d0: 63 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 can} {littleEndi
44e0: 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 an} {. catc
44f0: 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 h {unset arg1}.
4500: 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 list [binar
4510: 79 20 73 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c y scan \x9a\x99\
4520: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
4530: 78 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c xf9\x3f\x33\x33\
4540: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c x33\x33\x33\x33\
4550: 78 30 62 5c 78 34 30 20 64 32 20 61 72 67 31 5d x0b\x40 d2 arg1]
4560: 20 24 61 72 67 31 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a $arg1.*********
4570: 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 31 38 36 2c ******.*** 1186,
4580: 31 31 39 30 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 1190 ****.
4590: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e list [catch {bin
45a0: 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 ary scan \x3f\xf
45b0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
45c0: 39 5c 78 39 39 5c 78 39 61 20 64 31 20 61 72 67 9\x99\x9a d1 arg
45d0: 31 28 61 29 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 1(a)} msg] $msg.
45e0: 20 20 7d 20 7b 31 20 7b 63 61 6e 27 74 20 73 65 } {1 {can't se
45f0: 74 20 22 61 72 67 31 28 61 29 22 3a 20 76 61 72 t "arg1(a)": var
4600: 69 61 62 6c 65 20 69 73 6e 27 74 20 61 72 72 61 iable isn't arra
4610: 79 7d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 y}}.! test binar
4620: 79 2d 33 32 2e 31 34 20 7b 54 63 6c 5f 42 69 6e y-32.14 {Tcl_Bin
4630: 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d aryObjCmd: scan}
4640: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 {nonPortable ma
4650: 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 cOrUnix} {.
4660: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
4670: 67 31 20 61 72 67 32 7d 0a 20 20 20 20 20 20 73 g1 arg2}. s
4680: 65 74 20 61 72 67 31 20 66 6f 6f 0a 2d 2d 2d 20 et arg1 foo.---
4690: 31 31 39 30 2c 31 31 39 34 20 2d 2d 2d 2d 0a 20 1190,1194 ----.
46a0: 20 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 list [catch
46b0: 20 7b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 {binary scan \x
46c0: 33 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 3f\xf9\x99\x99\x
46d0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 20 64 99\x99\x99\x9a d
46e0: 31 20 61 72 67 31 28 61 29 7d 20 6d 73 67 5d 20 1 arg1(a)} msg]
46f0: 24 6d 73 67 0a 20 20 7d 20 7b 31 20 7b 63 61 6e $msg. } {1 {can
4700: 27 74 20 73 65 74 20 22 61 72 67 31 28 61 29 22 't set "arg1(a)"
4710: 3a 20 76 61 72 69 61 62 6c 65 20 69 73 6e 27 74 : variable isn't
4720: 20 61 72 72 61 79 7d 7d 0a 21 20 74 65 73 74 20 array}}.! test
4730: 62 69 6e 61 72 79 2d 33 32 2e 31 34 20 7b 54 63 binary-32.14 {Tc
4740: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 l_BinaryObjCmd:
4750: 73 63 61 6e 7d 20 7b 62 69 67 45 6e 64 69 61 6e scan} {bigEndian
4760: 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 } {. catch
4770: 7b 75 6e 73 65 74 20 61 72 67 31 20 61 72 67 32 {unset arg1 arg2
4780: 7d 0a 20 20 20 20 20 20 73 65 74 20 61 72 67 31 }. set arg1
4790: 20 66 6f 6f 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a foo.***********
47a0: 2a 2a 2a 2a 0a 2a 2a 2a 20 31 31 39 32 2c 31 31 ****.*** 1192,11
47b0: 39 36 20 2a 2a 2a 2a 0a 20 20 20 20 20 20 6c 69 96 ****. li
47c0: 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 st [binary scan
47d0: 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 \x3f\xf9\x99\x99
47e0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 \x99\x99\x99\x9a
47f0: 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c 78 33 33 \x40\x0b\x33\x33
4800: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 \x33\x33\x33\x33
4810: 5c 78 30 35 20 64 32 63 2a 20 61 72 67 31 20 61 \x05 d2c* arg1 a
4820: 72 67 32 5d 20 24 61 72 67 31 20 24 61 72 67 32 rg2] $arg1 $arg2
4830: 0a 20 20 7d 20 7b 32 20 7b 31 2e 36 20 33 2e 34 . } {2 {1.6 3.4
4840: 7d 20 35 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 } 5}.! test bina
4850: 72 79 2d 33 32 2e 31 35 20 7b 54 63 6c 5f 42 69 ry-32.15 {Tcl_Bi
4860: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e naryObjCmd: scan
4870: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 } {nonPortable p
4880: 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 cOnly} {. c
4890: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
48a0: 20 61 72 67 32 7d 0a 20 20 20 20 20 20 73 65 74 arg2}. set
48b0: 20 61 72 67 31 20 66 6f 6f 0a 2d 2d 2d 20 31 31 arg1 foo.--- 11
48c0: 39 36 2c 31 32 30 30 20 2d 2d 2d 2d 0a 20 20 20 96,1200 ----.
48d0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
48e0: 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c 78 39 scan \x3f\xf9\x9
48f0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
4900: 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 9\x9a\x40\x0b\x3
4910: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 3\x33\x33\x33\x3
4920: 33 5c 78 33 33 5c 78 30 35 20 64 32 63 2a 20 61 3\x33\x05 d2c* a
4930: 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 20 rg1 arg2] $arg1
4940: 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 7b 31 2e $arg2. } {2 {1.
4950: 36 20 33 2e 34 7d 20 35 7d 0a 21 20 74 65 73 74 6 3.4} 5}.! test
4960: 20 62 69 6e 61 72 79 2d 33 32 2e 31 35 20 7b 54 binary-32.15 {T
4970: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a cl_BinaryObjCmd:
4980: 20 73 63 61 6e 7d 20 7b 6c 69 74 74 6c 65 45 6e scan} {littleEn
4990: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 dian} {. ca
49a0: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 20 tch {unset arg1
49b0: 61 72 67 32 7d 0a 20 20 20 20 20 20 73 65 74 20 arg2}. set
49c0: 61 72 67 31 20 66 6f 6f 0a 2a 2a 2a 2a 2a 2a 2a arg1 foo.*******
49d0: 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 33 35 ********.*** 135
49e0: 32 2c 31 33 36 35 20 2a 2a 2a 2a 0a 20 20 20 20 2,1365 ****.
49f0: 20 20 73 65 74 20 78 20 5b 62 69 6e 61 72 79 20 set x [binary
4a00: 66 6f 72 6d 61 74 20 63 31 49 31 20 31 20 31 5d format c1I1 1 1]
4a10: 0a 20 20 7d 20 5c 78 30 31 5c 78 30 30 5c 78 30 . } \x01\x00\x0
4a20: 30 5c 78 30 30 5c 78 30 31 0a 21 20 74 65 73 74 0\x00\x01.! test
4a30: 20 62 69 6e 61 72 79 2d 33 38 2e 35 20 7b 46 6f binary-38.5 {Fo
4a40: 72 6d 61 74 4e 75 6d 62 65 72 3a 20 77 6f 72 64 rmatNumber: word
4a50: 20 61 6c 69 67 6e 6d 65 6e 74 7d 20 7b 6e 6f 6e alignment} {non
4a60: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e Portable macOrUn
4a70: 69 78 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 20 ix} {. set
4a80: 78 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 x [binary format
4a90: 20 63 31 64 31 20 31 20 31 2e 36 5d 0a 20 20 7d c1d1 1 1.6]. }
4aa0: 20 5c 78 30 31 5c 78 33 66 5c 78 66 39 5c 78 39 \x01\x3f\xf9\x9
4ab0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 9\x99\x99\x99\x9
4ac0: 39 5c 78 39 61 0a 21 20 74 65 73 74 20 62 69 6e 9\x9a.! test bin
4ad0: 61 72 79 2d 33 38 2e 36 20 7b 46 6f 72 6d 61 74 ary-38.6 {Format
4ae0: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 Number: word ali
4af0: 67 6e 6d 65 6e 74 7d 20 7b 6e 6f 6e 50 6f 72 74 gnment} {nonPort
4b00: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 able pcOnly} {.
4b10: 20 20 20 20 20 73 65 74 20 78 20 5b 62 69 6e 61 set x [bina
4b20: 72 79 20 66 6f 72 6d 61 74 20 63 31 64 31 20 31 ry format c1d1 1
4b30: 20 31 2e 36 5d 0a 20 20 7d 20 5c 78 30 31 5c 78 1.6]. } \x01\x
4b40: 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 9a\x99\x99\x99\x
4b50: 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 0a 21 99\x99\xf9\x3f.!
4b60: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 33 38 2e test binary-38.
4b70: 37 20 7b 46 6f 72 6d 61 74 4e 75 6d 62 65 72 3a 7 {FormatNumber:
4b80: 20 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e 74 7d word alignment}
4b90: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 {nonPortable ma
4ba0: 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 cOrUnix} {.
4bb0: 20 73 65 74 20 78 20 5b 62 69 6e 61 72 79 20 66 set x [binary f
4bc0: 6f 72 6d 61 74 20 63 31 66 31 20 31 20 31 2e 36 ormat c1f1 1 1.6
4bd0: 5d 0a 20 20 7d 20 5c 78 30 31 5c 78 33 66 5c 78 ]. } \x01\x3f\x
4be0: 63 63 5c 78 63 63 5c 78 63 64 0a 21 20 74 65 73 cc\xcc\xcd.! tes
4bf0: 74 20 62 69 6e 61 72 79 2d 33 38 2e 38 20 7b 46 t binary-38.8 {F
4c00: 6f 72 6d 61 74 4e 75 6d 62 65 72 3a 20 77 6f 72 ormatNumber: wor
4c10: 64 20 61 6c 69 67 6e 6d 65 6e 74 7d 20 7b 6e 6f d alignment} {no
4c20: 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 nPortable pcOnly
4c30: 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 20 78 20 } {. set x
4c40: 5b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 63 [binary format c
4c50: 31 66 31 20 31 20 31 2e 36 5d 0a 20 20 7d 20 5c 1f1 1 1.6]. } \
4c60: 78 30 31 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c x01\xcd\xcc\xcc\
4c70: 78 33 66 0a 2d 2d 2d 20 31 33 35 36 2c 31 33 36 x3f.--- 1356,136
4c80: 39 20 2d 2d 2d 2d 0a 20 20 20 20 20 20 73 65 74 9 ----. set
4c90: 20 78 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d 61 x [binary forma
4ca0: 74 20 63 31 49 31 20 31 20 31 5d 0a 20 20 7d 20 t c1I1 1 1]. }
4cb0: 5c 78 30 31 5c 78 30 30 5c 78 30 30 5c 78 30 30 \x01\x00\x00\x00
4cc0: 5c 78 30 31 0a 21 20 74 65 73 74 20 62 69 6e 61 \x01.! test bina
4cd0: 72 79 2d 33 38 2e 35 20 7b 46 6f 72 6d 61 74 4e ry-38.5 {FormatN
4ce0: 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 67 umber: word alig
4cf0: 6e 6d 65 6e 74 7d 20 7b 62 69 67 45 6e 64 69 61 nment} {bigEndia
4d00: 6e 7d 20 7b 0a 20 20 20 20 20 20 73 65 74 20 78 n} {. set x
4d10: 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 [binary format
4d20: 63 31 64 31 20 31 20 31 2e 36 5d 0a 20 20 7d 20 c1d1 1 1.6]. }
4d30: 5c 78 30 31 5c 78 33 66 5c 78 66 39 5c 78 39 39 \x01\x3f\xf9\x99
4d40: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 \x99\x99\x99\x99
4d50: 5c 78 39 61 0a 21 20 74 65 73 74 20 62 69 6e 61 \x9a.! test bina
4d60: 72 79 2d 33 38 2e 36 20 7b 46 6f 72 6d 61 74 4e ry-38.6 {FormatN
4d70: 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 67 umber: word alig
4d80: 6e 6d 65 6e 74 7d 20 7b 6c 69 74 74 6c 65 45 6e nment} {littleEn
4d90: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 73 65 dian} {. se
4da0: 74 20 78 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d t x [binary form
4db0: 61 74 20 63 31 64 31 20 31 20 31 2e 36 5d 0a 20 at c1d1 1 1.6].
4dc0: 20 7d 20 5c 78 30 31 5c 78 39 61 5c 78 39 39 5c } \x01\x9a\x99\
4dd0: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c x99\x99\x99\x99\
4de0: 78 66 39 5c 78 33 66 0a 21 20 74 65 73 74 20 62 xf9\x3f.! test b
4df0: 69 6e 61 72 79 2d 33 38 2e 37 20 7b 46 6f 72 6d inary-38.7 {Form
4e00: 61 74 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 atNumber: word a
4e10: 6c 69 67 6e 6d 65 6e 74 7d 20 7b 62 69 67 45 6e lignment} {bigEn
4e20: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 73 65 dian} {. se
4e30: 74 20 78 20 5b 62 69 6e 61 72 79 20 66 6f 72 6d t x [binary form
4e40: 61 74 20 63 31 66 31 20 31 20 31 2e 36 5d 0a 20 at c1f1 1 1.6].
4e50: 20 7d 20 5c 78 30 31 5c 78 33 66 5c 78 63 63 5c } \x01\x3f\xcc\
4e60: 78 63 63 5c 78 63 64 0a 21 20 74 65 73 74 20 62 xcc\xcd.! test b
4e70: 69 6e 61 72 79 2d 33 38 2e 38 20 7b 46 6f 72 6d inary-38.8 {Form
4e80: 61 74 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 atNumber: word a
4e90: 6c 69 67 6e 6d 65 6e 74 7d 20 7b 6c 69 74 74 6c lignment} {littl
4ea0: 65 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 eEndian} {.
4eb0: 20 73 65 74 20 78 20 5b 62 69 6e 61 72 79 20 66 set x [binary f
4ec0: 6f 72 6d 61 74 20 63 31 66 31 20 31 20 31 2e 36 ormat c1f1 1 1.6
4ed0: 5d 0a 20 20 7d 20 5c 78 30 31 5c 78 63 64 5c 78 ]. } \x01\xcd\x
4ee0: 63 63 5c 78 63 63 5c 78 33 66 0a 2a 2a 2a 2a 2a cc\xcc\x3f.*****
4ef0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 **********.*** 1
4f00: 33 38 36 2c 31 34 30 32 20 2a 2a 2a 2a 0a 20 20 386,1402 ****.
4f10: 7d 20 7b 31 20 7b 31 36 38 34 33 30 31 30 20 2d } {1 {16843010 -
4f20: 32 31 33 30 36 34 30 36 33 39 20 32 35 32 39 37 2130640639 25297
4f30: 31 35 33 20 31 36 38 37 36 30 33 33 20 31 36 38 153 16876033 168
4f40: 34 33 31 33 37 7d 7d 0a 20 20 0a 21 20 74 65 73 43137}}. .! tes
4f50: 74 20 62 69 6e 61 72 79 2d 34 30 2e 31 20 7b 53 t binary-40.1 {S
4f60: 63 61 6e 4e 75 6d 62 65 72 3a 20 66 6c 6f 61 74 canNumber: float
4f70: 69 6e 67 20 70 6f 69 6e 74 20 6f 76 65 72 66 6c ing point overfl
4f80: 6f 77 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 ow} {nonPortable
4f90: 20 75 6e 69 78 4f 6e 6c 79 7d 20 7b 0a 21 20 20 unixOnly} {.!
4fa0: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 catch {unset
4fb0: 61 72 67 31 7d 0a 21 20 20 20 20 20 6c 69 73 74 arg1}.! list
4fc0: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 [binary scan \x
4fd0: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 20 66 ff\xff\xff\xff f
4fe0: 31 20 61 72 67 31 5d 20 24 61 72 67 31 0a 21 20 1 arg1] $arg1.!
4ff0: 7d 20 7b 31 20 2d 4e 61 4e 7d 0a 21 20 74 65 73 } {1 -NaN}.! tes
5000: 74 20 62 69 6e 61 72 79 2d 34 30 2e 32 20 7b 53 t binary-40.2 {S
5010: 63 61 6e 4e 75 6d 62 65 72 3a 20 66 6c 6f 61 74 canNumber: float
5020: 69 6e 67 20 70 6f 69 6e 74 20 6f 76 65 72 66 6c ing point overfl
5030: 6f 77 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 ow} {nonPortable
5040: 20 6d 61 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 macOnly} {.
5050: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 catch {unset a
5060: 72 67 31 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 rg1}. list
5070: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 66 [binary scan \xf
5080: 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 20 66 31 f\xff\xff\xff f1
5090: 20 61 72 67 31 5d 20 24 61 72 67 31 0a 20 20 7d arg1] $arg1. }
50a0: 20 7b 31 20 2d 4e 41 4e 28 32 35 35 29 7d 0a 21 {1 -NAN(255)}.!
50b0: 20 74 65 73 74 20 62 69 6e 61 72 79 2d 34 30 2e test binary-40.
50c0: 33 20 7b 53 63 61 6e 4e 75 6d 62 65 72 3a 20 66 3 {ScanNumber: f
50d0: 6c 6f 61 74 69 6e 67 20 70 6f 69 6e 74 20 6f 76 loating point ov
50e0: 65 72 66 6c 6f 77 7d 20 7b 6e 6f 6e 50 6f 72 74 erflow} {nonPort
50f0: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 able pcOnly} {.
5100: 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 catch {unse
5110: 74 20 61 72 67 31 7d 0a 20 20 20 20 20 20 73 65 t arg1}. se
5120: 74 20 72 65 73 75 6c 74 20 5b 62 69 6e 61 72 79 t result [binary
5130: 20 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c 78 scan \xff\xff\x
5140: 66 66 5c 78 66 66 20 66 31 20 61 72 67 31 5d 0a ff\xff f1 arg1].
5150: 20 20 20 20 20 20 69 66 20 7b 28 5b 73 74 72 69 if {([stri
5160: 6e 67 20 63 6f 6d 70 61 72 65 20 24 61 72 67 31 ng compare $arg1
5170: 20 2d 31 2e 5c 23 51 4e 41 4e 5d 20 3d 3d 20 30 -1.\#QNAN] == 0
5180: 29 0a 21 20 09 7c 7c 20 28 5b 73 74 72 69 6e 67 ).! .|| ([string
5190: 20 63 6f 6d 70 61 72 65 20 24 61 72 67 31 20 2d compare $arg1 -
51a0: 4e 41 4e 5d 20 3d 3d 20 30 29 7d 20 7b 0a 20 20 NAN] == 0)} {.
51b0: 09 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 .lappend result
51c0: 73 75 63 63 65 73 73 0a 20 20 20 20 20 20 7d 20 success. }
51d0: 65 6c 73 65 20 7b 0a 2d 2d 2d 20 31 33 39 30 2c else {.--- 1390,
51e0: 31 34 31 31 20 2d 2d 2d 2d 0a 20 20 7d 20 7b 31 1411 ----. } {1
51f0: 20 7b 31 36 38 34 33 30 31 30 20 2d 32 31 33 30 {16843010 -2130
5200: 36 34 30 36 33 39 20 32 35 32 39 37 31 35 33 20 640639 25297153
5210: 31 36 38 37 36 30 33 33 20 31 36 38 34 33 31 33 16876033 1684313
5220: 37 7d 7d 0a 20 20 0a 21 20 74 65 73 74 20 62 69 7}}. .! test bi
5230: 6e 61 72 79 2d 34 30 2e 31 20 7b 53 63 61 6e 4e nary-40.1 {ScanN
5240: 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 6e 67 20 umber: floating
5250: 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f 77 7d 20 point overflow}
5260: 5c 0a 21 20 20 20 20 20 2d 63 6f 6e 73 74 72 61 \.! -constra
5270: 69 6e 74 73 20 7b 62 69 67 45 6e 64 69 61 6e 20 ints {bigEndian
5280: 75 6e 69 78 4f 6e 6c 79 7d 20 5c 0a 21 20 20 20 unixOnly} \.!
5290: 20 20 2d 62 6f 64 79 20 20 20 7b 0a 21 20 09 63 -body {.! .c
52a0: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
52b0: 7d 0a 21 20 09 6c 69 73 74 20 5b 62 69 6e 61 72 }.! .list [binar
52c0: 79 20 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c y scan \xff\xff\
52d0: 78 66 66 5c 78 66 66 20 66 31 20 61 72 67 31 5d xff\xff f1 arg1]
52e0: 20 24 61 72 67 31 0a 21 20 20 20 20 20 7d 20 5c $arg1.! } \
52f0: 0a 21 20 20 20 20 20 2d 6d 61 74 63 68 20 72 65 .! -match re
5300: 67 65 78 70 20 5c 0a 21 20 20 20 20 20 2d 72 65 gexp \.! -re
5310: 73 75 6c 74 20 7b 31 20 2d 3f 5b 6e 4e 5d 61 5b sult {1 -?[nN]a[
5320: 6e 4e 5d 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 nN]}.! test bina
5330: 72 79 2d 34 30 2e 32 20 7b 53 63 61 6e 4e 75 6d ry-40.2 {ScanNum
5340: 62 65 72 3a 20 66 6c 6f 61 74 69 6e 67 20 70 6f ber: floating po
5350: 69 6e 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 62 int overflow} {b
5360: 69 67 45 6e 64 69 61 6e 20 6d 61 63 4f 6e 6c 79 igEndian macOnly
5370: 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 } {. catch
5380: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 {unset arg1}.
5390: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
53a0: 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c 78 66 scan \xff\xff\xf
53b0: 66 5c 78 66 66 20 66 31 20 61 72 67 31 5d 20 24 f\xff f1 arg1] $
53c0: 61 72 67 31 0a 20 20 7d 20 7b 31 20 2d 4e 41 4e arg1. } {1 -NAN
53d0: 28 32 35 35 29 7d 0a 21 20 74 65 73 74 20 62 69 (255)}.! test bi
53e0: 6e 61 72 79 2d 34 30 2e 33 20 7b 53 63 61 6e 4e nary-40.3 {ScanN
53f0: 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 6e 67 20 umber: floating
5400: 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f 77 7d 20 point overflow}
5410: 7b 6c 69 74 74 6c 65 45 6e 64 69 61 6e 20 68 61 {littleEndian ha
5420: 73 4e 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 sNan} {. ca
5430: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d tch {unset arg1}
5440: 0a 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c . set resul
5450: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c t [binary scan \
5460: 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 20 xff\xff\xff\xff
5470: 66 31 20 61 72 67 31 5d 0a 20 20 20 20 20 20 69 f1 arg1]. i
5480: 66 20 7b 28 5b 73 74 72 69 6e 67 20 63 6f 6d 70 f {([string comp
5490: 61 72 65 20 24 61 72 67 31 20 2d 31 2e 5c 23 51 are $arg1 -1.\#Q
54a0: 4e 41 4e 5d 20 3d 3d 20 30 29 0a 21 20 09 7c 7c NAN] == 0).! .||
54b0: 20 28 5b 73 74 72 69 6e 67 20 63 6f 6d 70 61 72 ([string compar
54c0: 65 20 24 61 72 67 31 20 2d 4e 41 4e 5d 20 3d 3d e $arg1 -NAN] ==
54d0: 20 30 29 0a 21 20 09 7c 7c 20 28 5b 73 74 72 69 0).! .|| ([stri
54e0: 6e 67 20 63 6f 6d 70 61 72 65 20 24 61 72 67 31 ng compare $arg1
54f0: 20 6e 61 6e 5d 20 3d 3d 20 30 29 7d 20 7b 0a 20 nan] == 0)} {.
5500: 20 09 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 .lappend result
5510: 20 73 75 63 63 65 73 73 0a 20 20 20 20 20 20 7d success. }
5520: 20 65 6c 73 65 20 7b 0a 2a 2a 2a 2a 2a 2a 2a 2a else {.********
5530: 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 34 30 34 *******.*** 1404
5540: 2c 31 34 32 30 20 2a 2a 2a 2a 0a 20 20 20 20 20 ,1420 ****.
5550: 20 7d 0a 20 20 7d 20 7b 31 20 73 75 63 63 65 73 }. } {1 succes
5560: 73 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 s}.! test binary
5570: 2d 34 30 2e 34 20 7b 53 63 61 6e 4e 75 6d 62 65 -40.4 {ScanNumbe
5580: 72 3a 20 66 6c 6f 61 74 69 6e 67 20 70 6f 69 6e r: floating poin
5590: 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 6e 6f 6e t overflow} {non
55a0: 50 6f 72 74 61 62 6c 65 20 75 6e 69 78 4f 6e 6c Portable unixOnl
55b0: 79 7d 20 7b 0a 21 20 20 20 20 20 63 61 74 63 68 y} {.! catch
55c0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 21 20 {unset arg1}.!
55d0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
55e0: 20 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c 78 scan \xff\xff\x
55f0: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 ff\xff\xff\xff\x
5600: 66 66 5c 78 66 66 20 64 31 20 61 72 67 31 5d 20 ff\xff d1 arg1]
5610: 24 61 72 67 31 0a 21 20 7d 20 7b 31 20 2d 4e 61 $arg1.! } {1 -Na
5620: 4e 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 N}.! test binary
5630: 2d 34 30 2e 35 20 7b 53 63 61 6e 4e 75 6d 62 65 -40.5 {ScanNumbe
5640: 72 3a 20 66 6c 6f 61 74 69 6e 67 20 70 6f 69 6e r: floating poin
5650: 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 6e 6f 6e t overflow} {non
5660: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 6e 6c 79 Portable macOnly
5670: 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 63 68 20 } {. catch
5680: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a 20 20 20 {unset arg1}.
5690: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
56a0: 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 5c 78 66 scan \xff\xff\xf
56b0: 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 f\xff\xff\xff\xf
56c0: 66 5c 78 66 66 20 64 31 20 61 72 67 31 5d 20 24 f\xff d1 arg1] $
56d0: 61 72 67 31 0a 20 20 7d 20 7b 31 20 2d 4e 41 4e arg1. } {1 -NAN
56e0: 28 32 35 35 29 7d 0a 21 20 74 65 73 74 20 62 69 (255)}.! test bi
56f0: 6e 61 72 79 2d 34 30 2e 36 20 7b 53 63 61 6e 4e nary-40.6 {ScanN
5700: 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 6e 67 20 umber: floating
5710: 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f 77 7d 20 point overflow}
5720: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f {nonPortable pcO
5730: 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 nly} {. cat
5740: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a ch {unset arg1}.
5750: 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 set result
5760: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 [binary scan \x
5770: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 ff\xff\xff\xff\x
5780: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 20 64 ff\xff\xff\xff d
5790: 31 20 61 72 67 31 5d 0a 20 20 20 20 20 20 69 66 1 arg1]. if
57a0: 20 7b 28 5b 73 74 72 69 6e 67 20 63 6f 6d 70 61 {([string compa
57b0: 72 65 20 24 61 72 67 31 20 2d 31 2e 5c 23 51 4e re $arg1 -1.\#QN
57c0: 41 4e 5d 20 3d 3d 20 30 29 0a 21 20 09 7c 7c 20 AN] == 0).! .||
57d0: 28 5b 73 74 72 69 6e 67 20 63 6f 6d 70 61 72 65 ([string compare
57e0: 20 24 61 72 67 31 20 2d 4e 41 4e 5d 20 3d 3d 20 $arg1 -NAN] ==
57f0: 30 29 7d 20 7b 0a 20 20 09 6c 61 70 70 65 6e 64 0)} {. .lappend
5800: 20 72 65 73 75 6c 74 20 73 75 63 63 65 73 73 0a result success.
5810: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2d } else {.-
5820: 2d 2d 20 31 34 31 33 2c 31 34 33 34 20 2d 2d 2d -- 1413,1434 ---
5830: 2d 0a 20 20 20 20 20 20 7d 0a 20 20 7d 20 7b 31 -. }. } {1
5840: 20 73 75 63 63 65 73 73 7d 0a 21 20 74 65 73 74 success}.! test
5850: 20 62 69 6e 61 72 79 2d 34 30 2e 34 20 7b 53 63 binary-40.4 {Sc
5860: 61 6e 4e 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 anNumber: floati
5870: 6e 67 20 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f ng point overflo
5880: 77 7d 20 5c 0a 21 20 20 20 20 20 2d 63 6f 6e 73 w} \.! -cons
5890: 74 72 61 69 6e 74 73 20 7b 62 69 67 45 6e 64 69 traints {bigEndi
58a0: 61 6e 20 75 6e 69 78 4f 6e 6c 79 7d 20 5c 0a 21 an unixOnly} \.!
58b0: 20 20 20 20 20 2d 62 6f 64 79 20 20 20 7b 0a 21 -body {.!
58c0: 20 09 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 .catch {unset a
58d0: 72 67 31 7d 0a 21 20 09 6c 69 73 74 20 5b 62 69 rg1}.! .list [bi
58e0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 66 66 5c 78 nary scan \xff\x
58f0: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 ff\xff\xff\xff\x
5900: 66 66 5c 78 66 66 5c 78 66 66 20 64 31 20 61 72 ff\xff\xff d1 ar
5910: 67 31 5d 20 24 61 72 67 31 0a 21 20 20 20 20 20 g1] $arg1.!
5920: 7d 20 5c 0a 21 20 20 20 20 20 2d 6d 61 74 63 68 } \.! -match
5930: 20 72 65 67 65 78 70 20 5c 0a 21 20 20 20 20 20 regexp \.!
5940: 2d 72 65 73 75 6c 74 20 7b 31 20 2d 3f 5b 6e 4e -result {1 -?[nN
5950: 5d 61 5b 6e 4e 5d 7d 0a 21 20 74 65 73 74 20 62 ]a[nN]}.! test b
5960: 69 6e 61 72 79 2d 34 30 2e 35 20 7b 53 63 61 6e inary-40.5 {Scan
5970: 4e 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 6e 67 Number: floating
5980: 20 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f 77 7d point overflow}
5990: 20 7b 62 69 67 45 6e 64 69 61 6e 20 6d 61 63 4f {bigEndian macO
59a0: 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 63 61 74 nly} {. cat
59b0: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0a ch {unset arg1}.
59c0: 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 list [bina
59d0: 72 79 20 73 63 61 6e 20 5c 78 66 66 5c 78 66 66 ry scan \xff\xff
59e0: 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 \xff\xff\xff\xff
59f0: 5c 78 66 66 5c 78 66 66 20 64 31 20 61 72 67 31 \xff\xff d1 arg1
5a00: 5d 20 24 61 72 67 31 0a 20 20 7d 20 7b 31 20 2d ] $arg1. } {1 -
5a10: 4e 41 4e 28 32 35 35 29 7d 0a 21 20 74 65 73 74 NAN(255)}.! test
5a20: 20 62 69 6e 61 72 79 2d 34 30 2e 36 20 7b 53 63 binary-40.6 {Sc
5a30: 61 6e 4e 75 6d 62 65 72 3a 20 66 6c 6f 61 74 69 anNumber: floati
5a40: 6e 67 20 70 6f 69 6e 74 20 6f 76 65 72 66 6c 6f ng point overflo
5a50: 77 7d 20 7b 6c 69 74 74 6c 65 45 6e 64 69 61 6e w} {littleEndian
5a60: 20 68 61 73 4e 61 6e 7d 20 7b 0a 20 20 20 20 20 hasNan} {.
5a70: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 catch {unset ar
5a80: 67 31 7d 0a 20 20 20 20 20 20 73 65 74 20 72 65 g1}. set re
5a90: 73 75 6c 74 20 5b 62 69 6e 61 72 79 20 73 63 61 sult [binary sca
5aa0: 6e 20 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 n \xff\xff\xff\x
5ab0: 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 ff\xff\xff\xff\x
5ac0: 66 66 20 64 31 20 61 72 67 31 5d 0a 20 20 20 20 ff d1 arg1].
5ad0: 20 20 69 66 20 7b 28 5b 73 74 72 69 6e 67 20 63 if {([string c
5ae0: 6f 6d 70 61 72 65 20 24 61 72 67 31 20 2d 31 2e ompare $arg1 -1.
5af0: 5c 23 51 4e 41 4e 5d 20 3d 3d 20 30 29 0a 21 20 \#QNAN] == 0).!
5b00: 09 7c 7c 20 28 5b 73 74 72 69 6e 67 20 63 6f 6d .|| ([string com
5b10: 70 61 72 65 20 24 61 72 67 31 20 2d 4e 41 4e 5d pare $arg1 -NAN]
5b20: 20 3d 3d 20 30 29 0a 21 20 09 7c 7c 20 28 5b 73 == 0).! .|| ([s
5b30: 74 72 69 6e 67 20 63 6f 6d 70 61 72 65 20 24 61 tring compare $a
5b40: 72 67 31 20 6e 61 6e 5d 20 3d 3d 20 30 29 7d 20 rg1 nan] == 0)}
5b50: 7b 0a 20 20 09 6c 61 70 70 65 6e 64 20 72 65 73 {. .lappend res
5b60: 75 6c 74 20 73 75 63 63 65 73 73 0a 20 20 20 20 ult success.
5b70: 20 20 7d 20 65 6c 73 65 20 7b 0a 2a 2a 2a 2a 2a } else {.*****
5b80: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 2a 20 31 **********.*** 1
5b90: 34 33 39 2c 31 34 35 35 20 2a 2a 2a 2a 0a 20 20 439,1455 ****.
5ba0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
5bb0: 20 73 63 61 6e 20 5c 78 30 31 5c 78 30 30 5c 78 scan \x01\x00\x
5bc0: 30 30 5c 78 30 30 5c 78 30 31 20 63 31 49 31 20 00\x00\x01 c1I1
5bd0: 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 arg1 arg2] $arg1
5be0: 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 31 20 $arg2. } {2 1
5bf0: 31 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 1}.! test binary
5c00: 2d 34 31 2e 35 20 7b 53 63 61 6e 4e 75 6d 62 65 -41.5 {ScanNumbe
5c10: 72 3a 20 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e r: word alignmen
5c20: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 t} {nonPortable
5c30: 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 macOrUnix} {.
5c40: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 catch {unset
5c50: 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67 32 arg1; unset arg2
5c60: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
5c70: 6e 61 72 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 nary scan \x01\x
5c80: 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 20 63 3f\xcc\xcc\xcd c
5c90: 31 66 31 20 61 72 67 31 20 61 72 67 32 5d 20 24 1f1 arg1 arg2] $
5ca0: 61 72 67 31 20 24 61 72 67 32 0a 20 20 7d 20 7b arg1 $arg2. } {
5cb0: 32 20 31 20 31 2e 36 30 30 30 30 30 30 32 33 38 2 1 1.6000000238
5cc0: 34 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 4}.! test binary
5cd0: 2d 34 31 2e 36 20 7b 53 63 61 6e 4e 75 6d 62 65 -41.6 {ScanNumbe
5ce0: 72 3a 20 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e r: word alignmen
5cf0: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 t} {nonPortable
5d00: 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 20 20 20 pcOnly} {.
5d10: 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 catch {unset arg
5d20: 31 3b 20 75 6e 73 65 74 20 61 72 67 32 7d 0a 20 1; unset arg2}.
5d30: 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 list [binar
5d40: 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 63 64 5c y scan \x01\xcd\
5d50: 78 63 63 5c 78 63 63 5c 78 33 66 20 63 31 66 31 xcc\xcc\x3f c1f1
5d60: 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 arg1 arg2] $arg
5d70: 31 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 31 1 $arg2. } {2 1
5d80: 20 31 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0a 1.60000002384}.
5d90: 21 20 74 65 73 74 20 62 69 6e 61 72 79 2d 34 31 ! test binary-41
5da0: 2e 37 20 7b 53 63 61 6e 4e 75 6d 62 65 72 3a 20 .7 {ScanNumber:
5db0: 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e 74 7d 20 word alignment}
5dc0: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 {nonPortable mac
5dd0: 4f 72 55 6e 69 78 7d 20 7b 0a 20 20 20 20 20 20 OrUnix} {.
5de0: 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 catch {unset arg
5df0: 31 3b 20 75 6e 73 65 74 20 61 72 67 32 7d 0a 20 1; unset arg2}.
5e00: 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 list [binar
5e10: 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 33 66 5c y scan \x01\x3f\
5e20: 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c xf9\x99\x99\x99\
5e30: 78 39 39 5c 78 39 39 5c 78 39 61 20 63 31 64 31 x99\x99\x9a c1d1
5e40: 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 arg1 arg2] $arg
5e50: 31 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 31 1 $arg2. } {2 1
5e60: 20 31 2e 36 7d 0a 21 20 74 65 73 74 20 62 69 6e 1.6}.! test bin
5e70: 61 72 79 2d 34 31 2e 38 20 7b 53 63 61 6e 4e 75 ary-41.8 {ScanNu
5e80: 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 67 6e mber: word align
5e90: 6d 65 6e 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 ment} {nonPortab
5ea0: 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0a 20 20 20 le pcOnly} {.
5eb0: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 catch {unset
5ec0: 61 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67 32 arg1; unset arg2
5ed0: 7d 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 }. list [bi
5ee0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 nary scan \x01\x
5ef0: 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 9a\x99\x99\x99\x
5f00: 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 20 63 99\x99\xf9\x3f c
5f10: 31 64 31 20 61 72 67 31 20 61 72 67 32 5d 20 24 1d1 arg1 arg2] $
5f20: 61 72 67 31 20 24 61 72 67 32 0a 2d 2d 2d 20 31 arg1 $arg2.--- 1
5f30: 34 35 33 2c 31 34 36 39 20 2d 2d 2d 2d 0a 20 20 453,1469 ----.
5f40: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
5f50: 20 73 63 61 6e 20 5c 78 30 31 5c 78 30 30 5c 78 scan \x01\x00\x
5f60: 30 30 5c 78 30 30 5c 78 30 31 20 63 31 49 31 20 00\x00\x01 c1I1
5f70: 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 arg1 arg2] $arg1
5f80: 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 31 20 $arg2. } {2 1
5f90: 31 7d 0a 21 20 74 65 73 74 20 62 69 6e 61 72 79 1}.! test binary
5fa0: 2d 34 31 2e 35 20 7b 53 63 61 6e 4e 75 6d 62 65 -41.5 {ScanNumbe
5fb0: 72 3a 20 77 6f 72 64 20 61 6c 69 67 6e 6d 65 6e r: word alignmen
5fc0: 74 7d 20 7b 62 69 67 45 6e 64 69 61 6e 7d 20 7b t} {bigEndian} {
5fd0: 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 6e . catch {un
5fe0: 73 65 74 20 61 72 67 31 3b 20 75 6e 73 65 74 20 set arg1; unset
5ff0: 61 72 67 32 7d 0a 20 20 20 20 20 20 6c 69 73 74 arg2}. list
6000: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 [binary scan \x
6010: 30 31 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 01\x3f\xcc\xcc\x
6020: 63 64 20 63 31 66 31 20 61 72 67 31 20 61 72 67 cd c1f1 arg1 arg
6030: 32 5d 20 24 61 72 67 31 20 24 61 72 67 32 0a 20 2] $arg1 $arg2.
6040: 20 7d 20 7b 32 20 31 20 31 2e 36 30 30 30 30 30 } {2 1 1.600000
6050: 30 32 33 38 34 7d 0a 21 20 74 65 73 74 20 62 69 02384}.! test bi
6060: 6e 61 72 79 2d 34 31 2e 36 20 7b 53 63 61 6e 4e nary-41.6 {ScanN
6070: 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 67 umber: word alig
6080: 6e 6d 65 6e 74 7d 20 7b 6c 69 74 74 6c 65 45 6e nment} {littleEn
6090: 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 61 dian} {. ca
60a0: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 3b tch {unset arg1;
60b0: 20 75 6e 73 65 74 20 61 72 67 32 7d 0a 20 20 20 unset arg2}.
60c0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 list [binary
60d0: 73 63 61 6e 20 5c 78 30 31 5c 78 63 64 5c 78 63 scan \x01\xcd\xc
60e0: 63 5c 78 63 63 5c 78 33 66 20 63 31 66 31 20 61 c\xcc\x3f c1f1 a
60f0: 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 20 rg1 arg2] $arg1
6100: 24 61 72 67 32 0a 20 20 7d 20 7b 32 20 31 20 31 $arg2. } {2 1 1
6110: 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0a 21 20 .60000002384}.!
6120: 74 65 73 74 20 62 69 6e 61 72 79 2d 34 31 2e 37 test binary-41.7
6130: 20 7b 53 63 61 6e 4e 75 6d 62 65 72 3a 20 77 6f {ScanNumber: wo
6140: 72 64 20 61 6c 69 67 6e 6d 65 6e 74 7d 20 7b 62 rd alignment} {b
6150: 69 67 45 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 igEndian} {.
6160: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 catch {unset a
6170: 72 67 31 3b 20 75 6e 73 65 74 20 61 72 67 32 7d rg1; unset arg2}
6180: 0a 20 20 20 20 20 20 6c 69 73 74 20 5b 62 69 6e . list [bin
6190: 61 72 79 20 73 63 61 6e 20 5c 78 30 31 5c 78 33 ary scan \x01\x3
61a0: 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 f\xf9\x99\x99\x9
61b0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 20 63 31 9\x99\x99\x9a c1
61c0: 64 31 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 d1 arg1 arg2] $a
61d0: 72 67 31 20 24 61 72 67 32 0a 20 20 7d 20 7b 32 rg1 $arg2. } {2
61e0: 20 31 20 31 2e 36 7d 0a 21 20 74 65 73 74 20 62 1 1.6}.! test b
61f0: 69 6e 61 72 79 2d 34 31 2e 38 20 7b 53 63 61 6e inary-41.8 {Scan
6200: 4e 75 6d 62 65 72 3a 20 77 6f 72 64 20 61 6c 69 Number: word ali
6210: 67 6e 6d 65 6e 74 7d 20 7b 6c 69 74 74 6c 65 45 gnment} {littleE
6220: 6e 64 69 61 6e 7d 20 7b 0a 20 20 20 20 20 20 63 ndian} {. c
6230: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 atch {unset arg1
6240: 3b 20 75 6e 73 65 74 20 61 72 67 32 7d 0a 20 20 ; unset arg2}.
6250: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 list [binary
6260: 20 73 63 61 6e 20 5c 78 30 31 5c 78 39 61 5c 78 scan \x01\x9a\x
6270: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 99\x99\x99\x99\x
6280: 39 39 5c 78 66 39 5c 78 33 66 20 63 31 64 31 20 99\xf9\x3f c1d1
6290: 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 arg1 arg2] $arg1
62a0: 20 24 61 72 67 32 0a $arg2.