Tcl Source Code

Hex Artifact Content
Login

Artifact 54c28404a0a6aecfc919640c2de9a7680e73dd98:

Attachment "tip129.patch" to ticket [858211ffff] added by mrohr 2003-12-11 18:59:17.
0000: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74  Index: generic/t
0010: 63 6c 42 69 6e 61 72 79 2e 63 0d 0a 3d 3d 3d 3d  clBinary.c..====
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 0d  ===============.
0060: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72  .RCS file: /cvsr
0070: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65  oot/tcl/tcl/gene
0080: 72 69 63 2f 74 63 6c 42 69 6e 61 72 79 2e 63 2c  ric/tclBinary.c,
0090: 76 0d 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65  v..retrieving re
00a0: 76 69 73 69 6f 6e 20 31 2e 31 34 0d 0a 64 69 66  vision 1.14..dif
00b0: 66 20 2d 75 20 2d 72 31 2e 31 34 20 74 63 6c 42  f -u -r1.14 tclB
00c0: 69 6e 61 72 79 2e 63 0d 0a 2d 2d 2d 20 67 65 6e  inary.c..--- gen
00d0: 65 72 69 63 2f 74 63 6c 42 69 6e 61 72 79 2e 63  eric/tclBinary.c
00e0: 09 32 20 44 65 63 20 32 30 30 33 20 30 39 3a 32  .2 Dec 2003 09:2
00f0: 39 3a 35 34 20 2d 30 30 30 30 09 31 2e 31 34 0d  9:54 -0000.1.14.
0100: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
0110: 42 69 6e 61 72 79 2e 63 09 31 31 20 44 65 63 20  Binary.c.11 Dec 
0120: 32 30 30 33 20 31 31 3a 34 38 3a 31 31 20 2d 30  2003 11:48:11 -0
0130: 30 30 30 0d 0a 40 40 20 2d 36 35 36 2c 32 35 20  000..@@ -656,25 
0140: 2b 36 35 36 2c 33 32 20 40 40 0d 0a 20 09 09 09  +656,32 @@.. ...
0150: 73 69 7a 65 20 3d 20 31 3b 0d 0a 20 09 09 09 67  size = 1;.. ...g
0160: 6f 74 6f 20 64 6f 4e 75 6d 62 65 72 73 3b 0d 0a  oto doNumbers;..
0170: 20 09 09 20 20 20 20 7d 0d 0a 2b 09 09 20 20 20   ..    }..+..   
0180: 20 63 61 73 65 20 27 74 27 3a 0d 0a 20 09 09 20   case 't':.. .. 
0190: 20 20 20 63 61 73 65 20 27 73 27 3a 0d 0a 20 09     case 's':.. .
01a0: 09 20 20 20 20 63 61 73 65 20 27 53 27 3a 20 7b  .    case 'S': {
01b0: 0d 0a 20 09 09 09 73 69 7a 65 20 3d 20 32 3b 0d  .. ...size = 2;.
01c0: 0a 20 09 09 09 67 6f 74 6f 20 64 6f 4e 75 6d 62  . ...goto doNumb
01d0: 65 72 73 3b 0d 0a 20 09 09 20 20 20 20 7d 0d 0a  ers;.. ..    }..
01e0: 2b 09 09 20 20 20 20 63 61 73 65 20 27 6e 27 3a  +..    case 'n':
01f0: 0d 0a 20 09 09 20 20 20 20 63 61 73 65 20 27 69  .. ..    case 'i
0200: 27 3a 0d 0a 20 09 09 20 20 20 20 63 61 73 65 20  ':.. ..    case 
0210: 27 49 27 3a 20 7b 0d 0a 20 09 09 09 73 69 7a 65  'I': {.. ...size
0220: 20 3d 20 34 3b 0d 0a 20 09 09 09 67 6f 74 6f 20   = 4;.. ...goto 
0230: 64 6f 4e 75 6d 62 65 72 73 3b 0d 0a 20 09 09 20  doNumbers;.. .. 
0240: 20 20 20 7d 0d 0a 2b 09 09 20 20 20 20 63 61 73     }..+..    cas
0250: 65 20 27 6d 27 3a 0d 0a 20 09 09 20 20 20 20 63  e 'm':.. ..    c
0260: 61 73 65 20 27 77 27 3a 0d 0a 20 09 09 20 20 20  ase 'w':.. ..   
0270: 20 63 61 73 65 20 27 57 27 3a 20 7b 0d 0a 20 09   case 'W': {.. .
0280: 09 09 73 69 7a 65 20 3d 20 38 3b 0d 0a 20 09 09  ..size = 8;.. ..
0290: 09 67 6f 74 6f 20 64 6f 4e 75 6d 62 65 72 73 3b  .goto doNumbers;
02a0: 0d 0a 20 09 09 20 20 20 20 7d 0d 0a 2b 09 09 20  .. ..    }..+.. 
02b0: 20 20 20 63 61 73 65 20 27 72 27 3a 0d 0a 2b 09     case 'r':..+.
02c0: 09 20 20 20 20 63 61 73 65 20 27 52 27 3a 0d 0a  .    case 'R':..
02d0: 20 09 09 20 20 20 20 63 61 73 65 20 27 66 27 3a   ..    case 'f':
02e0: 20 7b 0d 0a 20 09 09 09 73 69 7a 65 20 3d 20 73   {.. ...size = s
02f0: 69 7a 65 6f 66 28 66 6c 6f 61 74 29 3b 0d 0a 20  izeof(float);.. 
0300: 09 09 09 67 6f 74 6f 20 64 6f 4e 75 6d 62 65 72  ...goto doNumber
0310: 73 3b 0d 0a 20 09 09 20 20 20 20 7d 0d 0a 2b 09  s;.. ..    }..+.
0320: 09 20 20 20 20 63 61 73 65 20 27 71 27 3a 0d 0a  .    case 'q':..
0330: 2b 09 09 20 20 20 20 63 61 73 65 20 27 51 27 3a  +..    case 'Q':
0340: 0d 0a 20 09 09 20 20 20 20 63 61 73 65 20 27 64  .. ..    case 'd
0350: 27 3a 20 7b 0d 0a 20 09 09 09 73 69 7a 65 20 3d  ': {.. ...size =
0360: 20 73 69 7a 65 6f 66 28 64 6f 75 62 6c 65 29 3b   sizeof(double);
0370: 0d 0a 20 09 09 09 0d 0a 40 40 20 2d 37 30 33 2c  .. .....@@ -703,
0380: 37 20 2b 37 31 30 2c 37 20 40 40 0d 0a 20 09 09  7 +710,7 @@.. ..
0390: 09 20 20 20 20 69 66 20 28 63 6f 75 6e 74 20 3d  .    if (count =
03a0: 3d 20 42 49 4e 41 52 59 5f 41 4c 4c 29 20 7b 0d  = BINARY_ALL) {.
03b0: 0a 20 09 09 09 09 63 6f 75 6e 74 20 3d 20 6c 69  . ....count = li
03c0: 73 74 63 3b 0d 0a 20 09 09 09 20 20 20 20 7d 20  stc;.. ...    } 
03d0: 65 6c 73 65 20 69 66 20 28 63 6f 75 6e 74 20 3e  else if (count >
03e0: 20 6c 69 73 74 63 29 20 7b 0d 0a 2d 09 09 09 20   listc) {..-... 
03f0: 20 20 20 20 20 20 20 54 63 6c 5f 41 70 70 65 6e         Tcl_Appen
0400: 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20  dResult(interp, 
0410: 0d 0a 2b 09 09 09 09 54 63 6c 5f 41 70 70 65 6e  ..+....Tcl_Appen
0420: 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20  dResult(interp, 
0430: 0d 0a 20 09 09 09 09 09 22 6e 75 6d 62 65 72 20  .. ....."number 
0440: 6f 66 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 6c  of elements in l
0450: 69 73 74 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74  ist does not mat
0460: 63 68 20 63 6f 75 6e 74 22 2c 0d 0a 20 09 09 09  ch count",.. ...
0470: 09 09 28 63 68 61 72 20 2a 29 20 4e 55 4c 4c 29  ..(char *) NULL)
0480: 3b 0d 0a 20 09 09 09 09 72 65 74 75 72 6e 20 54  ;.. ....return T
0490: 43 4c 5f 45 52 52 4f 52 3b 0d 0a 40 40 20 2d 37  CL_ERROR;..@@ -7
04a0: 35 32 2c 37 20 2b 37 35 39 2c 37 20 40 40 0d 0a  52,7 +759,7 @@..
04b0: 20 09 09 20 20 20 20 7d 0d 0a 20 09 09 20 20 20   ..    }.. ..   
04c0: 20 64 65 66 61 75 6c 74 3a 20 7b 0d 0a 20 09 09   default: {.. ..
04d0: 09 65 72 72 6f 72 53 74 72 69 6e 67 20 3d 20 73  .errorString = s
04e0: 74 72 3b 0d 0a 2d 09 09 09 67 6f 74 6f 20 62 61  tr;..-...goto ba
04f0: 64 46 69 65 6c 64 3b 0d 0a 2b 09 09 09 67 6f 74  dField;..+...got
0500: 6f 20 62 61 64 66 69 65 6c 64 3b 0d 0a 20 09 09  o badfield;.. ..
0510: 20 20 20 20 7d 0d 0a 20 09 09 7d 0d 0a 20 09 20      }.. ..}.. . 
0520: 20 20 20 7d 0d 0a 40 40 20 2d 38 31 30 2c 37 20     }..@@ -810,7 
0530: 2b 38 31 37 2c 37 20 40 40 0d 0a 20 09 09 09 20  +817,7 @@.. ... 
0540: 20 20 20 6d 65 6d 63 70 79 28 28 56 4f 49 44 20     memcpy((VOID 
0550: 2a 29 20 63 75 72 73 6f 72 2c 20 28 56 4f 49 44  *) cursor, (VOID
0560: 20 2a 29 20 62 79 74 65 73 2c 0d 0a 20 09 09 09   *) bytes,.. ...
0570: 09 20 20 20 20 28 73 69 7a 65 5f 74 29 20 6c 65  .    (size_t) le
0580: 6e 67 74 68 29 3b 0d 0a 20 09 09 09 20 20 20 20  ngth);.. ...    
0590: 6d 65 6d 73 65 74 28 28 56 4f 49 44 20 2a 29 20  memset((VOID *) 
05a0: 28 63 75 72 73 6f 72 20 2b 20 6c 65 6e 67 74 68  (cursor + length
05b0: 29 2c 20 70 61 64 2c 0d 0a 2d 09 09 09 20 20 20  ), pad,..-...   
05c0: 20 20 20 20 20 20 20 20 20 28 73 69 7a 65 5f 74           (size_t
05d0: 29 20 28 63 6f 75 6e 74 20 2d 20 6c 65 6e 67 74  ) (count - lengt
05e0: 68 29 29 3b 0d 0a 2b 09 09 09 09 20 20 20 20 28  h));..+....    (
05f0: 73 69 7a 65 5f 74 29 20 28 63 6f 75 6e 74 20 2d  size_t) (count -
0600: 20 6c 65 6e 67 74 68 29 29 3b 0d 0a 20 09 09 09   length));.. ...
0610: 7d 0d 0a 20 09 09 09 63 75 72 73 6f 72 20 2b 3d  }.. ...cursor +=
0620: 20 63 6f 75 6e 74 3b 0d 0a 20 09 09 09 62 72 65   count;.. ...bre
0630: 61 6b 3b 0d 0a 40 40 20 2d 39 35 33 2c 36 20 2b  ak;..@@ -953,6 +
0640: 39 36 30 2c 31 33 20 40 40 0d 0a 20 09 09 20 20  960,13 @@.. ..  
0650: 20 20 63 61 73 65 20 27 49 27 3a 0d 0a 20 09 09    case 'I':.. ..
0660: 20 20 20 20 63 61 73 65 20 27 77 27 3a 0d 0a 20      case 'w':.. 
0670: 09 09 20 20 20 20 63 61 73 65 20 27 57 27 3a 0d  ..    case 'W':.
0680: 0a 2b 09 09 20 20 20 20 63 61 73 65 20 27 71 27  .+..    case 'q'
0690: 3a 0d 0a 2b 09 09 20 20 20 20 63 61 73 65 20 27  :..+..    case '
06a0: 51 27 3a 0d 0a 2b 09 09 20 20 20 20 63 61 73 65  Q':..+..    case
06b0: 20 27 72 27 3a 0d 0a 2b 09 09 20 20 20 20 63 61   'r':..+..    ca
06c0: 73 65 20 27 52 27 3a 0d 0a 2b 09 09 20 20 20 20  se 'R':..+..    
06d0: 63 61 73 65 20 27 74 27 3a 0d 0a 2b 09 09 20 20  case 't':..+..  
06e0: 20 20 63 61 73 65 20 27 6d 27 3a 0d 0a 2b 09 09    case 'm':..+..
06f0: 20 20 20 20 63 61 73 65 20 27 6e 27 3a 0d 0a 20      case 'n':.. 
0700: 09 09 20 20 20 20 63 61 73 65 20 27 64 27 3a 0d  ..    case 'd':.
0710: 0a 20 09 09 20 20 20 20 63 61 73 65 20 27 66 27  . ..    case 'f'
0720: 3a 20 7b 0d 0a 20 09 09 09 69 6e 74 20 6c 69 73  : {.. ...int lis
0730: 74 63 2c 20 69 3b 0d 0a 40 40 20 2d 31 32 30 39  tc, i;..@@ -1209
0740: 2c 32 34 20 2b 31 32 32 33 2c 33 31 20 40 40 0d  ,24 +1223,31 @@.
0750: 0a 20 09 09 09 67 6f 74 6f 20 73 63 61 6e 4e 75  . ...goto scanNu
0760: 6d 62 65 72 3b 0d 0a 20 09 09 20 20 20 20 7d 0d  mber;.. ..    }.
0770: 0a 20 09 09 20 20 20 20 63 61 73 65 20 27 73 27  . ..    case 's'
0780: 3a 0d 0a 2b 09 09 20 20 20 20 63 61 73 65 20 27  :..+..    case '
0790: 74 27 3a 0d 0a 20 09 09 20 20 20 20 63 61 73 65  t':.. ..    case
07a0: 20 27 53 27 3a 20 7b 0d 0a 20 09 09 09 73 69 7a   'S': {.. ...siz
07b0: 65 20 3d 20 32 3b 0d 0a 20 09 09 09 67 6f 74 6f  e = 2;.. ...goto
07c0: 20 73 63 61 6e 4e 75 6d 62 65 72 3b 0d 0a 20 09   scanNumber;.. .
07d0: 09 20 20 20 20 7d 0d 0a 20 09 09 20 20 20 20 63  .    }.. ..    c
07e0: 61 73 65 20 27 69 27 3a 0d 0a 2b 09 09 20 20 20  ase 'i':..+..   
07f0: 20 63 61 73 65 20 27 6e 27 3a 0d 0a 20 09 09 20   case 'n':.. .. 
0800: 20 20 20 63 61 73 65 20 27 49 27 3a 20 7b 0d 0a     case 'I': {..
0810: 20 09 09 09 73 69 7a 65 20 3d 20 34 3b 0d 0a 20   ...size = 4;.. 
0820: 09 09 09 67 6f 74 6f 20 73 63 61 6e 4e 75 6d 62  ...goto scanNumb
0830: 65 72 3b 0d 0a 20 09 09 20 20 20 20 7d 0d 0a 20  er;.. ..    }.. 
0840: 09 09 20 20 20 20 63 61 73 65 20 27 77 27 3a 0d  ..    case 'w':.
0850: 0a 2b 09 09 20 20 20 20 63 61 73 65 20 27 6d 27  .+..    case 'm'
0860: 3a 0d 0a 20 09 09 20 20 20 20 63 61 73 65 20 27  :.. ..    case '
0870: 57 27 3a 20 7b 0d 0a 20 09 09 09 73 69 7a 65 20  W': {.. ...size 
0880: 3d 20 38 3b 0d 0a 20 09 09 09 67 6f 74 6f 20 73  = 8;.. ...goto s
0890: 63 61 6e 4e 75 6d 62 65 72 3b 0d 0a 20 09 09 20  canNumber;.. .. 
08a0: 20 20 20 7d 0d 0a 2b 09 09 20 20 20 20 63 61 73     }..+..    cas
08b0: 65 20 27 72 27 3a 0d 0a 2b 09 09 20 20 20 20 63  e 'r':..+..    c
08c0: 61 73 65 20 27 52 27 3a 0d 0a 20 09 09 20 20 20  ase 'R':.. ..   
08d0: 20 63 61 73 65 20 27 66 27 3a 20 7b 0d 0a 20 09   case 'f': {.. .
08e0: 09 09 73 69 7a 65 20 3d 20 73 69 7a 65 6f 66 28  ..size = sizeof(
08f0: 66 6c 6f 61 74 29 3b 0d 0a 20 09 09 09 67 6f 74  float);.. ...got
0900: 6f 20 73 63 61 6e 4e 75 6d 62 65 72 3b 0d 0a 20  o scanNumber;.. 
0910: 09 09 20 20 20 20 7d 0d 0a 2b 09 09 20 20 20 20  ..    }..+..    
0920: 63 61 73 65 20 27 71 27 3a 0d 0a 2b 09 09 20 20  case 'q':..+..  
0930: 20 20 63 61 73 65 20 27 51 27 3a 0d 0a 20 09 09    case 'Q':.. ..
0940: 20 20 20 20 63 61 73 65 20 27 64 27 3a 20 7b 0d      case 'd': {.
0950: 0a 20 09 09 09 75 6e 73 69 67 6e 65 64 20 63 68  . ...unsigned ch
0960: 61 72 20 2a 73 72 63 3b 0d 0a 20 0d 0a 40 40 20  ar *src;.. ..@@ 
0970: 2d 31 33 31 32 2c 37 20 2b 31 33 33 33 2c 37 20  -1312,7 +1333,7 
0980: 40 40 0d 0a 20 09 09 20 20 20 20 64 65 66 61 75  @@.. ..    defau
0990: 6c 74 3a 20 7b 0d 0a 20 09 09 09 44 65 6c 65 74  lt: {.. ...Delet
09a0: 65 53 63 61 6e 4e 75 6d 62 65 72 43 61 63 68 65  eScanNumberCache
09b0: 28 6e 75 6d 62 65 72 43 61 63 68 65 50 74 72 29  (numberCachePtr)
09c0: 3b 0d 0a 20 09 09 09 65 72 72 6f 72 53 74 72 69  ;.. ...errorStri
09d0: 6e 67 20 3d 20 73 74 72 3b 0d 0a 2d 09 09 09 67  ng = str;..-...g
09e0: 6f 74 6f 20 62 61 64 46 69 65 6c 64 3b 0d 0a 2b  oto badField;..+
09f0: 09 09 09 67 6f 74 6f 20 62 61 64 66 69 65 6c 64  ...goto badfield
0a00: 3b 0d 0a 20 09 09 20 20 20 20 7d 0d 0a 20 09 09  ;.. ..    }.. ..
0a10: 7d 0d 0a 20 09 20 20 20 20 7d 0d 0a 40 40 20 2d  }.. .    }..@@ -
0a20: 31 33 34 34 2c 38 20 2b 31 33 36 35 2c 37 20 40  1344,8 +1365,7 @
0a30: 40 0d 0a 20 20 20 20 20 65 72 72 6f 72 53 74 72  @..     errorStr
0a40: 69 6e 67 20 3d 20 22 6e 6f 74 20 65 6e 6f 75 67  ing = "not enoug
0a50: 68 20 61 72 67 75 6d 65 6e 74 73 20 66 6f 72 20  h arguments for 
0a60: 61 6c 6c 20 66 6f 72 6d 61 74 20 73 70 65 63 69  all format speci
0a70: 66 69 65 72 73 22 3b 0d 0a 20 20 20 20 20 67 6f  fiers";..     go
0a80: 74 6f 20 65 72 72 6f 72 3b 0d 0a 20 0d 0a 2d 20  to error;.. ..- 
0a90: 20 20 20 62 61 64 46 69 65 6c 64 3a 0d 0a 2d 20     badField:..- 
0aa0: 20 20 20 7b 0d 0a 2b 20 20 20 20 62 61 64 66 69     {..+    badfi
0ab0: 65 6c 64 3a 20 7b 0d 0a 20 09 54 63 6c 5f 55 6e  eld: {.. .Tcl_Un
0ac0: 69 43 68 61 72 20 63 68 3b 0d 0a 20 09 63 68 61  iChar ch;.. .cha
0ad0: 72 20 62 75 66 5b 54 43 4c 5f 55 54 46 5f 4d 41  r buf[TCL_UTF_MA
0ae0: 58 20 2b 20 31 5d 3b 0d 0a 20 0d 0a 40 40 20 2d  X + 1];.. ..@@ -
0af0: 31 34 32 31 2c 36 20 2b 31 34 34 31 2c 31 32 39  1421,6 +1441,129
0b00: 20 40 40 0d 0a 20 7d 0d 0a 20 0c 0d 0a 20 2f 2a   @@.. }.. ... /*
0b10: 0d 0a 2b 20 2a 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..+ * ----------
0b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 2b 20 2a  -----------..+ *
0b60: 0d 0a 2b 20 2a 20 4e 65 65 64 52 65 76 65 72 73  ..+ * NeedRevers
0b70: 69 6f 6e 20 2d 2d 0d 0a 2b 20 2a 0d 0a 2b 20 2a  ion --..+ *..+ *
0b80: 20 20 20 54 68 69 73 20 72 6f 75 74 69 6e 65 20     This routine 
0b90: 64 65 74 65 72 6d 69 6e 65 73 2c 20 69 66 20 62  determines, if b
0ba0: 79 74 65 73 20 6f 66 20 61 20 6e 75 6d 62 65 72  ytes of a number
0bb0: 20 6e 65 65 64 20 74 6f 20 62 65 20 72 65 76 65   need to be reve
0bc0: 72 73 65 64 2e 20 20 54 68 69 73 20 0d 0a 2b 20  rsed.  This ..+ 
0bd0: 2a 20 20 20 64 65 70 65 6e 64 73 20 6f 6e 20 74  *   depends on t
0be0: 68 65 20 65 6e 64 69 61 6e 6e 65 73 20 6f 66 20  he endiannes of 
0bf0: 74 68 65 20 6d 61 63 68 69 6e 65 20 61 6e 64 20  the machine and 
0c00: 74 68 65 20 64 65 73 69 72 65 64 20 66 6f 72 6d  the desired form
0c10: 61 74 2e 0d 0a 2b 20 2a 0d 0a 2b 20 2a 20 20 52  at...+ *..+ *  R
0c20: 65 73 75 6c 74 73 3a 0d 0a 2b 20 2a 20 20 20 69  esults:..+ *   i
0c30: 6e 74 3a 20 31 20 69 66 20 72 65 76 65 72 73 69  nt: 1 if reversi
0c40: 6f 6e 20 69 73 20 72 65 71 75 69 72 65 64 2c 20  on is required, 
0c50: 30 20 69 66 20 6e 6f 74 2e 0d 0a 2b 20 2a 0d 0a  0 if not...+ *..
0c60: 2b 20 2a 20 20 53 69 64 65 20 65 66 66 65 63 74  + *  Side effect
0c70: 73 3a 0d 0a 2b 20 2a 20 20 20 4e 6f 6e 65 0d 0a  s:..+ *   None..
0c80: 2b 20 2a 20 20 20 0d 0a 2b 20 2a 20 2d 2d 2d 2d  + *   ..+ * ----
0c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ca0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cd0: 2d 0d 0a 2b 20 2a 2f 0d 0a 2b 73 74 61 74 69 63  -..+ */..+static
0ce0: 20 69 6e 74 20 0d 0a 2b 4e 65 65 64 52 65 76 65   int ..+NeedReve
0cf0: 72 73 69 6f 6e 28 20 66 6f 72 6d 61 74 20 29 0d  rsion( format ).
0d00: 0a 2b 20 20 69 6e 74 20 66 6f 72 6d 61 74 3b 20  .+  int format; 
0d10: 0d 0a 2b 7b 0d 0a 2b 20 20 20 20 73 74 61 74 69  ..+{..+    stati
0d20: 63 20 69 6e 74 20 74 65 73 74 44 75 6d 6d 79 20  c int testDummy 
0d30: 3d 20 30 78 30 31 3b 0d 0a 2b 20 20 20 20 69 6e  = 0x01;..+    in
0d40: 74 20 62 42 69 67 45 6e 64 69 61 6e 3b 0d 0a 2b  t bBigEndian;..+
0d50: 0d 0a 2b 20 20 20 20 2f 2f 20 6c 61 73 74 20 62  ..+    // last b
0d60: 79 74 65 20 69 73 20 31 20 3d 3e 20 62 69 67 20  yte is 1 => big 
0d70: 65 6e 64 69 61 6e 2e 0d 0a 2b 20 20 20 20 62 42  endian...+    bB
0d80: 69 67 45 6e 64 69 61 6e 20 3d 20 28 28 28 75 6e  igEndian = (((un
0d90: 73 69 67 6e 65 64 20 63 68 61 72 2a 29 26 74 65  signed char*)&te
0da0: 73 74 44 75 6d 6d 79 29 5b 73 69 7a 65 6f 66 28  stDummy)[sizeof(
0db0: 74 65 73 74 44 75 6d 6d 79 29 2d 31 5d 29 3d 3d  testDummy)-1])==
0dc0: 31 3b 0d 0a 2b 0d 0a 2b 20 20 20 20 73 77 69 74  1;..+..+    swit
0dd0: 63 68 28 20 66 6f 72 6d 61 74 20 29 0d 0a 2b 20  ch( format )..+ 
0de0: 20 20 20 20 20 7b 0d 0a 2b 20 20 20 20 20 20 2f       {..+      /
0df0: 2f 20 6e 61 74 69 76 65 20 66 6c 6f 61 74 73 20  / native floats 
0e00: 61 6e 64 20 64 6f 75 62 6c 65 73 3a 20 6e 6f 0d  and doubles: no.
0e10: 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27 64 27  .+      case 'd'
0e20: 3a 0d 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27  :..+      case '
0e30: 66 27 3a 0d 0a 2b 09 72 65 74 75 72 6e 20 30 3b  f':..+.return 0;
0e40: 0d 0a 2b 20 20 20 20 20 20 0d 0a 2b 20 20 20 20  ..+      ..+    
0e50: 20 20 2f 2f 20 6e 61 74 69 76 65 20 69 6e 74 73    // native ints
0e60: 3a 0d 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27  :..+      case '
0e70: 6e 27 3a 0d 0a 2b 20 20 20 20 20 20 63 61 73 65  n':..+      case
0e80: 20 27 74 27 3a 0d 0a 2b 20 20 20 20 20 20 63 61   't':..+      ca
0e90: 73 65 20 27 6d 27 3a 0d 0a 2b 09 72 65 74 75 72  se 'm':..+.retur
0ea0: 6e 20 62 42 69 67 45 6e 64 69 61 6e 20 3f 20 30  n bBigEndian ? 0
0eb0: 20 3a 20 31 3b 0d 0a 2b 20 20 20 20 20 20 0d 0a   : 1;..+      ..
0ec0: 2b 20 20 20 20 20 20 2f 2f 20 66 2b 64 0d 0a 2b  +      // f+d..+
0ed0: 20 20 20 20 20 20 63 61 73 65 20 27 51 27 3a 0d        case 'Q':.
0ee0: 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27 52 27  .+      case 'R'
0ef0: 3a 0d 0a 2b 09 72 65 74 75 72 6e 20 62 42 69 67  :..+.return bBig
0f00: 45 6e 64 69 61 6e 20 3f 20 30 20 3a 20 31 3b 0d  Endian ? 0 : 1;.
0f10: 0a 2b 20 20 20 20 20 20 0d 0a 2b 20 20 20 20 20  .+      ..+     
0f20: 20 2f 2f 20 62 69 67 20 65 6e 64 69 61 6e 20 69   // big endian i
0f30: 6e 74 73 0d 0a 2b 20 20 20 20 20 20 63 61 73 65  nts..+      case
0f40: 20 27 49 27 3a 0d 0a 2b 20 20 20 20 20 20 63 61   'I':..+      ca
0f50: 73 65 20 27 53 27 3a 0d 0a 2b 20 20 20 20 20 20  se 'S':..+      
0f60: 63 61 73 65 20 27 57 27 3a 0d 0a 2b 09 72 65 74  case 'W':..+.ret
0f70: 75 72 6e 20 30 3b 0d 0a 2b 09 20 20 0d 0a 2b 20  urn 0;..+.  ..+ 
0f80: 20 20 20 20 20 2f 2f 20 73 6d 61 6c 6c 20 65 6e       // small en
0f90: 64 69 61 6e 20 66 6c 6f 61 74 73 0d 0a 2b 20 20  dian floats..+  
0fa0: 20 20 20 20 63 61 73 65 20 27 71 27 3a 0d 0a 2b      case 'q':..+
0fb0: 20 20 20 20 20 20 63 61 73 65 20 27 72 27 3a 0d        case 'r':.
0fc0: 0a 2b 09 72 65 74 75 72 6e 20 62 42 69 67 45 6e  .+.return bBigEn
0fd0: 64 69 61 6e 20 3f 20 31 20 3a 20 30 3b 0d 0a 2b  dian ? 1 : 0;..+
0fe0: 0d 0a 2b 20 20 20 20 20 20 2f 2f 20 73 6d 61 6c  ..+      // smal
0ff0: 6c 20 65 6e 64 69 61 6e 20 69 6e 74 73 0d 0a 2b  l endian ints..+
1000: 20 20 20 20 20 20 63 61 73 65 20 27 69 27 3a 0d        case 'i':.
1010: 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27 73 27  .+      case 's'
1020: 3a 0d 0a 2b 20 20 20 20 20 20 63 61 73 65 20 27  :..+      case '
1030: 77 27 3a 0d 0a 2b 09 72 65 74 75 72 6e 20 31 3b  w':..+.return 1;
1040: 0d 0a 2b 20 20 20 20 0d 0a 2b 20 20 20 20 20 20  ..+    ..+      
1050: 64 65 66 61 75 6c 74 3a 0d 0a 2b 09 2f 2f 20 77  default:..+.// w
1060: 65 20 6e 65 76 65 72 20 63 6f 6d 65 20 68 65 72  e never come her
1070: 65 0d 0a 2b 09 2f 2f 20 61 73 73 65 72 74 28 30  e..+.// assert(0
1080: 29 3b 0d 0a 2b 20 20 20 20 20 20 72 65 74 75 72  );..+      retur
1090: 6e 20 30 3b 0d 0a 2b 20 20 20 20 7d 0d 0a 2b 7d  n 0;..+    }..+}
10a0: 0d 0a 2b 0c 0d 0a 2b 2f 2a 0d 0a 2b 20 2a 20 2d  ..+...+/*..+ * -
10b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10f0: 2d 2d 2d 2d 0d 0a 2b 20 2a 0d 0a 2b 20 2a 20 43  ----..+ *..+ * C
1100: 6f 70 79 4e 75 6d 62 65 72 20 2d 2d 0d 0a 2b 20  opyNumber --..+ 
1110: 2a 0d 0a 2b 20 2a 20 20 20 54 68 69 73 20 72 6f  *..+ *   This ro
1120: 75 74 69 6e 65 20 69 73 20 63 61 6c 6c 65 64 20  utine is called 
1130: 62 79 20 46 6f 72 6d 61 74 4e 75 6d 65 72 20 61  by FormatNumer a
1140: 6e 64 20 53 63 61 6e 4e 75 6d 62 65 72 20 74 6f  nd ScanNumber to
1150: 20 63 6f 70 79 20 61 20 6e 75 6d 62 65 72 2e 0d   copy a number..
1160: 0a 2b 20 2a 20 20 20 49 66 20 72 65 71 75 69 72  .+ *   If requir
1170: 65 64 2c 20 62 79 74 65 73 20 61 72 65 20 72 65  ed, bytes are re
1180: 76 65 72 73 65 64 20 77 68 69 6c 65 20 63 6f 70  versed while cop
1190: 79 69 6e 67 0d 0a 2b 20 2a 0d 0a 2b 20 2a 20 20  ying..+ *..+ *  
11a0: 52 65 73 75 6c 74 73 3a 0d 0a 2b 20 2a 20 20 20  Results:..+ *   
11b0: 4e 6f 6e 65 0d 0a 2b 20 2a 0d 0a 2b 20 2a 20 20  None..+ *..+ *  
11c0: 53 69 64 65 20 65 66 66 65 63 74 73 3a 0d 0a 2b  Side effects:..+
11d0: 20 2a 20 20 20 20 43 6f 70 69 65 73 20 6c 65 6e   *    Copies len
11e0: 67 74 68 20 62 79 74 65 73 0d 0a 2b 20 20 0d 0a  gth bytes..+  ..
11f0: 2b 20 2a 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + * ------------
1200: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 2b 20 2a 2f 0d  ---------..+ */.
1240: 0a 2b 73 74 61 74 69 63 20 76 6f 69 64 20 0d 0a  .+static void ..
1250: 2b 43 6f 70 79 4e 75 6d 62 65 72 28 20 66 72 6f  +CopyNumber( fro
1260: 6d 2c 20 74 6f 2c 20 6c 65 6e 67 74 68 2c 20 72  m, to, length, r
1270: 65 76 65 72 73 65 20 29 0d 0a 2b 20 20 20 20 75  everse )..+    u
1280: 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 66 72  nsigned char *fr
1290: 6f 6d 3b 20 2f 2a 20 73 6f 75 72 63 65 20 2a 2f  om; /* source */
12a0: 0d 0a 2b 20 20 20 20 75 6e 73 69 67 6e 65 64 20  ..+    unsigned 
12b0: 63 68 61 72 20 2a 74 6f 3b 20 2f 2a 20 64 65 73  char *to; /* des
12c0: 74 69 6e 61 74 69 6f 6e 20 2a 2f 0d 0a 2b 20 20  tination */..+  
12d0: 20 20 69 6e 74 20 6c 65 6e 67 74 68 3b 20 20 2f    int length;  /
12e0: 2a 20 4e 75 6d 62 65 72 20 6f 66 20 62 79 74 65  * Number of byte
12f0: 73 20 74 6f 20 63 6f 70 79 20 2a 2f 0d 0a 2b 20  s to copy */..+ 
1300: 20 20 20 69 6e 74 20 72 65 76 65 72 73 65 3b 20     int reverse; 
1310: 2f 2a 20 69 66 20 74 72 75 65 2c 20 72 65 76 65  /* if true, reve
1320: 72 73 65 20 6f 72 64 65 72 20 77 68 69 6c 65 20  rse order while 
1330: 63 6f 70 79 69 6e 67 20 2a 2f 0d 0a 2b 7b 0d 0a  copying */..+{..
1340: 2b 20 20 20 20 69 66 28 20 72 65 76 65 72 73 65  +    if( reverse
1350: 20 29 0d 0a 2b 20 20 20 20 20 20 7b 0d 0a 2b 20   )..+      {..+ 
1360: 20 20 20 20 20 73 77 69 74 63 68 28 20 6c 65 6e       switch( len
1370: 67 74 68 20 29 0d 0a 2b 09 7b 0d 0a 2b 09 63 61  gth )..+.{..+.ca
1380: 73 65 20 32 3a 0d 0a 2b 09 20 20 74 6f 5b 30 5d  se 2:..+.  to[0]
1390: 3d 66 72 6f 6d 5b 31 5d 3b 0d 0a 2b 09 20 20 74  =from[1];..+.  t
13a0: 6f 5b 31 5d 3d 66 72 6f 6d 5b 30 5d 3b 0d 0a 2b  o[1]=from[0];..+
13b0: 09 20 20 62 72 65 61 6b 3b 0d 0a 2b 09 63 61 73  .  break;..+.cas
13c0: 65 20 34 3a 0d 0a 2b 09 20 20 74 6f 5b 30 5d 3d  e 4:..+.  to[0]=
13d0: 66 72 6f 6d 5b 33 5d 3b 0d 0a 2b 09 20 20 74 6f  from[3];..+.  to
13e0: 5b 31 5d 3d 66 72 6f 6d 5b 32 5d 3b 0d 0a 2b 09  [1]=from[2];..+.
13f0: 20 20 74 6f 5b 32 5d 3d 66 72 6f 6d 5b 31 5d 3b    to[2]=from[1];
1400: 0d 0a 2b 09 20 20 74 6f 5b 33 5d 3d 66 72 6f 6d  ..+.  to[3]=from
1410: 5b 30 5d 3b 0d 0a 2b 09 20 20 62 72 65 61 6b 3b  [0];..+.  break;
1420: 0d 0a 2b 09 63 61 73 65 20 38 3a 0d 0a 2b 09 20  ..+.case 8:..+. 
1430: 20 74 6f 5b 30 5d 3d 66 72 6f 6d 5b 37 5d 3b 0d   to[0]=from[7];.
1440: 0a 2b 09 20 20 74 6f 5b 31 5d 3d 66 72 6f 6d 5b  .+.  to[1]=from[
1450: 36 5d 3b 0d 0a 2b 09 20 20 74 6f 5b 32 5d 3d 66  6];..+.  to[2]=f
1460: 72 6f 6d 5b 35 5d 3b 0d 0a 2b 09 20 20 74 6f 5b  rom[5];..+.  to[
1470: 33 5d 3d 66 72 6f 6d 5b 34 5d 3b 0d 0a 2b 09 20  3]=from[4];..+. 
1480: 20 74 6f 5b 34 5d 3d 66 72 6f 6d 5b 33 5d 3b 0d   to[4]=from[3];.
1490: 0a 2b 09 20 20 74 6f 5b 35 5d 3d 66 72 6f 6d 5b  .+.  to[5]=from[
14a0: 32 5d 3b 0d 0a 2b 09 20 20 74 6f 5b 36 5d 3d 66  2];..+.  to[6]=f
14b0: 72 6f 6d 5b 31 5d 3b 0d 0a 2b 09 20 20 74 6f 5b  rom[1];..+.  to[
14c0: 37 5d 3d 66 72 6f 6d 5b 30 5d 3b 0d 0a 2b 09 20  7]=from[0];..+. 
14d0: 20 62 72 65 61 6b 3b 0d 0a 2b 09 7d 0d 0a 2b 20   break;..+.}..+ 
14e0: 20 20 20 20 20 7d 0d 0a 2b 20 20 20 20 65 6c 73       }..+    els
14f0: 65 0d 0a 2b 20 20 20 20 20 20 7b 0d 0a 2b 20 20  e..+      {..+  
1500: 20 20 20 20 6d 65 6d 63 70 79 28 20 74 6f 2c 20      memcpy( to, 
1510: 66 72 6f 6d 2c 20 6c 65 6e 67 74 68 20 29 3b 20  from, length ); 
1520: 0d 0a 2b 20 20 20 20 20 20 7d 0d 0a 2b 7d 0d 0a  ..+      }..+}..
1530: 2b 0c 0d 0a 2b 2f 2a 0d 0a 20 20 2a 2d 2d 2d 2d  +...+/*..  *----
1540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1580: 2d 2d 0d 0a 20 20 2a 0d 0a 20 20 2a 20 46 6f 72  --..  *..  * For
1590: 6d 61 74 4e 75 6d 62 65 72 20 2d 2d 0d 0a 40 40  matNumber --..@@
15a0: 20 2d 31 34 34 38 2c 33 38 20 2b 31 35 39 31 2c   -1448,38 +1591,
15b0: 34 30 20 40 40 0d 0a 20 20 20 20 20 6c 6f 6e 67  40 @@..     long
15c0: 20 76 61 6c 75 65 3b 0d 0a 20 20 20 20 20 64 6f   value;..     do
15d0: 75 62 6c 65 20 64 76 61 6c 75 65 3b 0d 0a 20 20  uble dvalue;..  
15e0: 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77     Tcl_WideInt w
15f0: 76 61 6c 75 65 3b 0d 0a 2d 0d 0a 2b 20 20 20 20  value;..-..+    
1600: 66 6c 6f 61 74 20 66 76 61 6c 75 65 3b 0d 0a 20  float fvalue;.. 
1610: 20 20 20 20 73 77 69 74 63 68 20 28 74 79 70 65      switch (type
1620: 29 20 7b 0d 0a 2d 20 20 20 20 63 61 73 65 20 27  ) {..-    case '
1630: 64 27 3a 0d 0a 2d 20 20 20 20 63 61 73 65 20 27  d':..-    case '
1640: 66 27 3a 0d 0a 2d 09 2f 2a 0d 0a 2d 09 20 2a 20  f':..-./*..-. * 
1650: 46 6f 72 20 66 6c 6f 61 74 69 6e 67 20 70 6f 69  For floating poi
1660: 6e 74 20 74 79 70 65 73 2c 20 77 65 20 6e 65 65  nt types, we nee
1670: 64 20 74 6f 20 63 6f 70 79 20 74 68 65 20 64 61  d to copy the da
1680: 74 61 20 75 73 69 6e 67 0d 0a 2d 09 20 2a 20 6d  ta using..-. * m
1690: 65 6d 63 70 79 20 74 6f 20 61 76 6f 69 64 20 61  emcpy to avoid a
16a0: 6c 69 67 6e 6d 65 6e 74 20 69 73 73 75 65 73 2e  lignment issues.
16b0: 0d 0a 2d 09 20 2a 2f 0d 0a 2b 20 20 20 20 20 20  ..-. */..+      
16c0: 2f 2f 20 64 6f 75 62 6c 65 20 0d 0a 2b 20 20 20  // double ..+   
16d0: 20 20 20 63 61 73 65 20 27 64 27 3a 0d 0a 2b 20     case 'd':..+ 
16e0: 20 20 20 20 20 63 61 73 65 20 27 71 27 3a 0d 0a       case 'q':..
16f0: 2b 20 20 20 20 20 20 63 61 73 65 20 27 51 27 3a  +      case 'Q':
1700: 0d 0a 2b 20 20 20 09 69 66 20 28 54 63 6c 5f 47  ..+   .if (Tcl_G
1710: 65 74 44 6f 75 62 6c 65 46 72 6f 6d 4f 62 6a 28  etDoubleFromObj(
1720: 69 6e 74 65 72 70 2c 20 73 72 63 2c 20 26 64 76  interp, src, &dv
1730: 61 6c 75 65 29 20 21 3d 20 54 43 4c 5f 4f 4b 29  alue) != TCL_OK)
1740: 20 7b 0d 0a 2b 09 20 20 20 20 72 65 74 75 72 6e   {..+.    return
1750: 20 54 43 4c 5f 45 52 52 4f 52 3b 0d 0a 2b 09 7d   TCL_ERROR;..+.}
1760: 0d 0a 2b 09 43 6f 70 79 4e 75 6d 62 65 72 28 20  ..+.CopyNumber( 
1770: 26 64 76 61 6c 75 65 2c 20 2a 63 75 72 73 6f 72  &dvalue, *cursor
1780: 50 74 72 2c 20 73 69 7a 65 6f 66 28 64 6f 75 62  Ptr, sizeof(doub
1790: 6c 65 29 2c 20 4e 65 65 64 52 65 76 65 72 73 69  le), NeedReversi
17a0: 6f 6e 28 74 79 70 65 29 20 29 3b 0d 0a 2b 09 2a  on(type) );..+.*
17b0: 63 75 72 73 6f 72 50 74 72 20 2b 3d 20 73 69 7a  cursorPtr += siz
17c0: 65 6f 66 28 64 6f 75 62 6c 65 29 3b 0d 0a 2b 09  eof(double);..+.
17d0: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0d 0a  return TCL_OK;..
17e0: 20 0d 0a 2b 20 20 20 20 20 20 2f 2f 20 66 6c 6f   ..+      // flo
17f0: 61 74 20 20 20 20 0d 0a 2b 20 20 20 20 20 20 63  at    ..+      c
1800: 61 73 65 20 27 66 27 3a 0d 0a 2b 20 20 20 20 20  ase 'f':..+     
1810: 20 63 61 73 65 20 27 72 27 3a 0d 0a 2b 20 20 20   case 'r':..+   
1820: 20 20 20 63 61 73 65 20 27 52 27 3a 0d 0a 20 09     case 'R':.. .
1830: 69 66 20 28 54 63 6c 5f 47 65 74 44 6f 75 62 6c  if (Tcl_GetDoubl
1840: 65 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c  eFromObj(interp,
1850: 20 73 72 63 2c 20 26 64 76 61 6c 75 65 29 20 21   src, &dvalue) !
1860: 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0d 0a 20 09 20  = TCL_OK) {.. . 
1870: 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 45 52     return TCL_ER
1880: 52 4f 52 3b 0d 0a 20 09 7d 0d 0a 2d 09 69 66 20  ROR;.. .}..-.if 
1890: 28 74 79 70 65 20 3d 3d 20 27 64 27 29 20 7b 0d  (type == 'd') {.
18a0: 0a 2d 09 20 20 20 20 6d 65 6d 63 70 79 28 28 56  .-.    memcpy((V
18b0: 4f 49 44 20 2a 29 20 2a 63 75 72 73 6f 72 50 74  OID *) *cursorPt
18c0: 72 2c 20 28 56 4f 49 44 20 2a 29 20 26 64 76 61  r, (VOID *) &dva
18d0: 6c 75 65 2c 20 73 69 7a 65 6f 66 28 64 6f 75 62  lue, sizeof(doub
18e0: 6c 65 29 29 3b 0d 0a 2d 09 20 20 20 20 2a 63 75  le));..-.    *cu
18f0: 72 73 6f 72 50 74 72 20 2b 3d 20 73 69 7a 65 6f  rsorPtr += sizeo
1900: 66 28 64 6f 75 62 6c 65 29 3b 0d 0a 2d 09 7d 20  f(double);..-.} 
1910: 65 6c 73 65 20 7b 0d 0a 2d 09 20 20 20 20 66 6c  else {..-.    fl
1920: 6f 61 74 20 66 76 61 6c 75 65 3b 0d 0a 20 0d 0a  oat fvalue;.. ..
1930: 2d 09 20 20 20 20 2f 2a 0d 0a 2d 09 20 20 20 20  -.    /*..-.    
1940: 20 2a 20 42 65 63 61 75 73 65 20 73 6f 6d 65 20   * Because some 
1950: 63 6f 6d 70 69 6c 65 72 73 20 77 69 6c 6c 20 67  compilers will g
1960: 65 6e 65 72 61 74 65 20 66 6c 6f 61 74 69 6e 67  enerate floating
1970: 20 70 6f 69 6e 74 20 65 78 63 65 70 74 69 6f 6e   point exception
1980: 73 0d 0a 2d 09 20 20 20 20 20 2a 20 6f 6e 20 61  s..-.     * on a
1990: 6e 20 6f 76 65 72 66 6c 6f 77 20 63 61 73 74 20  n overflow cast 
19a0: 28 65 2e 67 2e 20 42 6f 72 6c 61 6e 64 29 2c 20  (e.g. Borland), 
19b0: 77 65 20 72 65 73 74 72 69 63 74 20 74 68 65 20  we restrict the 
19c0: 76 61 6c 75 65 73 0d 0a 2d 09 20 20 20 20 20 2a  values..-.     *
19d0: 20 74 6f 20 74 68 65 20 76 61 6c 69 64 20 72 61   to the valid ra
19e0: 6e 67 65 20 66 6f 72 20 66 6c 6f 61 74 2e 0d 0a  nge for float...
19f0: 2d 09 20 20 20 20 20 2a 2f 0d 0a 2b 09 2f 2a 0d  -.     */..+./*.
1a00: 0a 2b 09 20 2a 20 42 65 63 61 75 73 65 20 73 6f  .+. * Because so
1a10: 6d 65 20 63 6f 6d 70 69 6c 65 72 73 20 77 69 6c  me compilers wil
1a20: 6c 20 67 65 6e 65 72 61 74 65 20 66 6c 6f 61 74  l generate float
1a30: 69 6e 67 20 70 6f 69 6e 74 20 65 78 63 65 70 74  ing point except
1a40: 69 6f 6e 73 0d 0a 2b 09 20 2a 20 6f 6e 20 61 6e  ions..+. * on an
1a50: 20 6f 76 65 72 66 6c 6f 77 20 63 61 73 74 20 28   overflow cast (
1a60: 65 2e 67 2e 20 42 6f 72 6c 61 6e 64 29 2c 20 77  e.g. Borland), w
1a70: 65 20 72 65 73 74 72 69 63 74 20 74 68 65 20 76  e restrict the v
1a80: 61 6c 75 65 73 0d 0a 2b 09 20 2a 20 74 6f 20 74  alues..+. * to t
1a90: 68 65 20 76 61 6c 69 64 20 72 61 6e 67 65 20 66  he valid range f
1aa0: 6f 72 20 66 6c 6f 61 74 2e 0d 0a 2b 09 20 2a 2f  or float...+. */
1ab0: 0d 0a 20 0d 0a 2d 09 20 20 20 20 69 66 20 28 66  .. ..-.    if (f
1ac0: 61 62 73 28 64 76 61 6c 75 65 29 20 3e 20 28 64  abs(dvalue) > (d
1ad0: 6f 75 62 6c 65 29 46 4c 54 5f 4d 41 58 29 20 7b  ouble)FLT_MAX) {
1ae0: 0d 0a 2d 09 09 66 76 61 6c 75 65 20 3d 20 28 64  ..-..fvalue = (d
1af0: 76 61 6c 75 65 20 3e 3d 20 30 2e 30 29 20 3f 20  value >= 0.0) ? 
1b00: 46 4c 54 5f 4d 41 58 20 3a 20 2d 46 4c 54 5f 4d  FLT_MAX : -FLT_M
1b10: 41 58 3b 0d 0a 2d 09 20 20 20 20 7d 20 65 6c 73  AX;..-.    } els
1b20: 65 20 7b 0d 0a 2d 09 09 66 76 61 6c 75 65 20 3d  e {..-..fvalue =
1b30: 20 28 66 6c 6f 61 74 29 20 64 76 61 6c 75 65 3b   (float) dvalue;
1b40: 0d 0a 2d 09 20 20 20 20 7d 0d 0a 2d 09 20 20 20  ..-.    }..-.   
1b50: 20 6d 65 6d 63 70 79 28 28 56 4f 49 44 20 2a 29   memcpy((VOID *)
1b60: 20 2a 63 75 72 73 6f 72 50 74 72 2c 20 28 56 4f   *cursorPtr, (VO
1b70: 49 44 20 2a 29 20 26 66 76 61 6c 75 65 2c 20 73  ID *) &fvalue, s
1b80: 69 7a 65 6f 66 28 66 6c 6f 61 74 29 29 3b 0d 0a  izeof(float));..
1b90: 2d 09 20 20 20 20 2a 63 75 72 73 6f 72 50 74 72  -.    *cursorPtr
1ba0: 20 2b 3d 20 73 69 7a 65 6f 66 28 66 6c 6f 61 74   += sizeof(float
1bb0: 29 3b 0d 0a 2b 09 69 66 20 28 66 61 62 73 28 64  );..+.if (fabs(d
1bc0: 76 61 6c 75 65 29 20 3e 20 28 64 6f 75 62 6c 65  value) > (double
1bd0: 29 46 4c 54 5f 4d 41 58 29 20 7b 0d 0a 2b 09 20  )FLT_MAX) {..+. 
1be0: 20 20 20 66 76 61 6c 75 65 20 3d 20 28 64 76 61     fvalue = (dva
1bf0: 6c 75 65 20 3e 3d 20 30 2e 30 29 20 3f 20 46 4c  lue >= 0.0) ? FL
1c00: 54 5f 4d 41 58 20 3a 20 2d 46 4c 54 5f 4d 41 58  T_MAX : -FLT_MAX
1c10: 3b 0d 0a 2b 09 7d 20 65 6c 73 65 20 7b 0d 0a 2b  ;..+.} else {..+
1c20: 09 20 20 20 20 66 76 61 6c 75 65 20 3d 20 28 66  .    fvalue = (f
1c30: 6c 6f 61 74 29 20 64 76 61 6c 75 65 3b 0d 0a 20  loat) dvalue;.. 
1c40: 09 7d 0d 0a 2b 09 43 6f 70 79 4e 75 6d 62 65 72  .}..+.CopyNumber
1c50: 28 20 26 66 76 61 6c 75 65 2c 20 2a 63 75 72 73  ( &fvalue, *curs
1c60: 6f 72 50 74 72 2c 20 73 69 7a 65 6f 66 28 66 6c  orPtr, sizeof(fl
1c70: 6f 61 74 29 2c 20 4e 65 65 64 52 65 76 65 72 73  oat), NeedRevers
1c80: 69 6f 6e 28 74 79 70 65 29 20 29 3b 0d 0a 2b 09  ion(type) );..+.
1c90: 2a 63 75 72 73 6f 72 50 74 72 20 2b 3d 20 73 69  *cursorPtr += si
1ca0: 7a 65 6f 66 28 66 6c 6f 61 74 29 3b 0d 0a 20 09  zeof(float);.. .
1cb0: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0d 0a  return TCL_OK;..
1cc0: 20 0d 0a 20 09 2f 2a 0d 0a 40 40 20 2d 31 34 38   .. ./*..@@ -148
1cd0: 38 2c 31 30 20 2b 31 36 33 33 2c 31 31 20 40 40  8,10 +1633,11 @@
1ce0: 0d 0a 20 09 20 2a 2f 0d 0a 20 20 20 20 20 63 61  .. . */..     ca
1cf0: 73 65 20 27 77 27 3a 0d 0a 20 20 20 20 20 63 61  se 'w':..     ca
1d00: 73 65 20 27 57 27 3a 0d 0a 2b 20 20 20 20 63 61  se 'W':..+    ca
1d10: 73 65 20 27 6d 27 3a 0d 0a 20 09 69 66 20 28 54  se 'm':.. .if (T
1d20: 63 6c 5f 47 65 74 57 69 64 65 49 6e 74 46 72 6f  cl_GetWideIntFro
1d30: 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 73 72 63  mObj(interp, src
1d40: 2c 20 26 77 76 61 6c 75 65 29 20 21 3d 20 54 43  , &wvalue) != TC
1d50: 4c 5f 4f 4b 29 20 7b 0d 0a 20 09 20 20 20 20 72  L_OK) {.. .    r
1d60: 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b  eturn TCL_ERROR;
1d70: 0d 0a 20 09 7d 0d 0a 2d 09 69 66 20 28 74 79 70  .. .}..-.if (typ
1d80: 65 20 3d 3d 20 27 77 27 29 20 7b 0d 0a 2b 09 69  e == 'w') {..+.i
1d90: 66 28 20 4e 65 65 64 52 65 76 65 72 73 69 6f 6e  f( NeedReversion
1da0: 28 74 79 70 65 29 20 29 20 7b 0d 0a 20 09 20 20  (type) ) {.. .  
1db0: 20 20 2a 28 2a 63 75 72 73 6f 72 50 74 72 29 2b    *(*cursorPtr)+
1dc0: 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64 20 63 68  + = (unsigned ch
1dd0: 61 72 29 20 77 76 61 6c 75 65 3b 0d 0a 20 09 20  ar) wvalue;.. . 
1de0: 20 20 20 2a 28 2a 63 75 72 73 6f 72 50 74 72 29     *(*cursorPtr)
1df0: 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64 20 63  ++ = (unsigned c
1e00: 68 61 72 29 20 28 77 76 61 6c 75 65 20 3e 3e 20  har) (wvalue >> 
1e10: 38 29 3b 0d 0a 20 09 20 20 20 20 2a 28 2a 63 75  8);.. .    *(*cu
1e20: 72 73 6f 72 50 74 72 29 2b 2b 20 3d 20 28 75 6e  rsorPtr)++ = (un
1e30: 73 69 67 6e 65 64 20 63 68 61 72 29 20 28 77 76  signed char) (wv
1e40: 61 6c 75 65 20 3e 3e 20 31 36 29 3b 0d 0a 40 40  alue >> 16);..@@
1e50: 20 2d 31 35 31 31 2c 32 39 20 2b 31 36 35 37 2c   -1511,29 +1657,
1e60: 35 32 20 40 40 0d 0a 20 09 20 20 20 20 2a 28 2a  52 @@.. .    *(*
1e70: 63 75 72 73 6f 72 50 74 72 29 2b 2b 20 3d 20 28  cursorPtr)++ = (
1e80: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29 20 77  unsigned char) w
1e90: 76 61 6c 75 65 3b 0d 0a 20 09 7d 0d 0a 20 09 72  value;.. .}.. .r
1ea0: 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0d 0a 2d  eturn TCL_OK;..-
1eb0: 20 20 20 20 64 65 66 61 75 6c 74 3a 0d 0a 2d 09      default:..-.
1ec0: 69 66 20 28 54 63 6c 5f 47 65 74 4c 6f 6e 67 46  if (Tcl_GetLongF
1ed0: 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 73  romObj(interp, s
1ee0: 72 63 2c 20 26 76 61 6c 75 65 29 20 21 3d 20 54  rc, &value) != T
1ef0: 43 4c 5f 4f 4b 29 20 7b 0d 0a 2d 09 20 20 20 20  CL_OK) {..-.    
1f00: 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52  return TCL_ERROR
1f10: 3b 0d 0a 2d 09 7d 0d 0a 2d 09 69 66 20 28 74 79  ;..-.}..-.if (ty
1f20: 70 65 20 3d 3d 20 27 63 27 29 20 7b 0d 0a 2d 09  pe == 'c') {..-.
1f30: 20 20 20 20 2a 28 2a 63 75 72 73 6f 72 50 74 72      *(*cursorPtr
1f40: 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64 20  )++ = (unsigned 
1f50: 63 68 61 72 29 20 76 61 6c 75 65 3b 0d 0a 2d 09  char) value;..-.
1f60: 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 20  } else if (type 
1f70: 3d 3d 20 27 73 27 29 20 7b 0d 0a 2d 09 20 20 20  == 's') {..-.   
1f80: 20 2a 28 2a 63 75 72 73 6f 72 50 74 72 29 2b 2b   *(*cursorPtr)++
1f90: 20 3d 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61   = (unsigned cha
1fa0: 72 29 20 76 61 6c 75 65 3b 0d 0a 2b 0d 0a 2b 20  r) value;..+..+ 
1fb0: 20 20 20 2f 2f 20 73 68 6f 72 74 0d 0a 2b 20 20     // short..+  
1fc0: 20 20 63 61 73 65 20 27 73 27 3a 20 0d 0a 2b 20    case 's': ..+ 
1fd0: 20 20 20 63 61 73 65 20 27 53 27 3a 20 0d 0a 2b     case 'S': ..+
1fe0: 20 20 20 20 63 61 73 65 20 27 74 27 3a 0d 0a 2b      case 't':..+
1ff0: 20 20 20 20 20 20 69 66 20 28 54 63 6c 5f 47 65        if (Tcl_Ge
2000: 74 4c 6f 6e 67 46 72 6f 6d 4f 62 6a 28 69 6e 74  tLongFromObj(int
2010: 65 72 70 2c 20 73 72 63 2c 20 26 76 61 6c 75 65  erp, src, &value
2020: 29 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0d 0a  ) != TCL_OK) {..
2030: 2b 09 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 45  +.  return TCL_E
2040: 52 52 4f 52 3b 0d 0a 2b 20 20 20 20 20 20 7d 0d  RROR;..+      }.
2050: 0a 2b 20 20 20 20 20 20 69 66 28 20 4e 65 65 64  .+      if( Need
2060: 52 65 76 65 72 73 69 6f 6e 28 74 79 70 65 29 20  Reversion(type) 
2070: 29 20 7b 0d 0a 2b 20 20 20 20 20 20 09 20 20 20  ) {..+      .   
2080: 20 2a 28 2a 63 75 72 73 6f 72 50 74 72 29 2b 2b   *(*cursorPtr)++
2090: 20 3d 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61   = (unsigned cha
20a0: 72 29 20 76 61 6c 75 65 3b 0d 0a 20 09 20 20 20  r) value;.. .   
20b0: 20 2a 28 2a 63 75 72 73 6f 72 50 74 72 29 2b 2b   *(*cursorPtr)++
20c0: 20 3d 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61   = (unsigned cha
20d0: 72 29 20 28 76 61 6c 75 65 20 3e 3e 20 38 29 3b  r) (value >> 8);
20e0: 0d 0a 2d 09 7d 20 65 6c 73 65 20 69 66 20 28 74  ..-.} else if (t
20f0: 79 70 65 20 3d 3d 20 27 53 27 29 20 7b 0d 0a 2b  ype == 'S') {..+
2100: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a        } else {..
2110: 20 09 20 20 20 20 2a 28 2a 63 75 72 73 6f 72 50   .    *(*cursorP
2120: 74 72 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65  tr)++ = (unsigne
2130: 64 20 63 68 61 72 29 20 28 76 61 6c 75 65 20 3e  d char) (value >
2140: 3e 20 38 29 3b 0d 0a 20 09 20 20 20 20 2a 28 2a  > 8);.. .    *(*
2150: 63 75 72 73 6f 72 50 74 72 29 2b 2b 20 3d 20 28  cursorPtr)++ = (
2160: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29 20 76  unsigned char) v
2170: 61 6c 75 65 3b 0d 0a 2d 09 7d 20 65 6c 73 65 20  alue;..-.} else 
2180: 69 66 20 28 74 79 70 65 20 3d 3d 20 27 69 27 29  if (type == 'i')
2190: 20 7b 0d 0a 2b 20 20 20 20 20 20 7d 0d 0a 2b 20   {..+      }..+ 
21a0: 20 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f       return TCL_
21b0: 4f 4b 3b 0d 0a 2b 20 20 20 20 20 20 0d 0a 2b 20  OK;..+      ..+ 
21c0: 20 20 20 2f 2f 20 6c 6f 6e 67 0d 0a 2b 20 20 20     // long..+   
21d0: 20 63 61 73 65 20 27 69 27 3a 0d 0a 2b 20 20 20   case 'i':..+   
21e0: 20 63 61 73 65 20 27 49 27 3a 0d 0a 2b 20 20 20   case 'I':..+   
21f0: 20 63 61 73 65 20 27 6e 27 3a 0d 0a 2b 20 20 20   case 'n':..+   
2200: 20 20 20 69 66 20 28 54 63 6c 5f 47 65 74 4c 6f     if (Tcl_GetLo
2210: 6e 67 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70  ngFromObj(interp
2220: 2c 20 73 72 63 2c 20 26 76 61 6c 75 65 29 20 21  , src, &value) !
2230: 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0d 0a 2b 09 20  = TCL_OK) {..+. 
2240: 20 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f   return TCL_ERRO
2250: 52 3b 0d 0a 2b 20 20 20 20 20 20 7d 0d 0a 2b 20  R;..+      }..+ 
2260: 20 20 20 20 20 69 66 28 20 4e 65 65 64 52 65 76       if( NeedRev
2270: 65 72 73 69 6f 6e 28 74 79 70 65 29 20 29 20 7b  ersion(type) ) {
2280: 0d 0a 20 09 20 20 20 20 2a 28 2a 63 75 72 73 6f  .. .    *(*curso
2290: 72 50 74 72 29 2b 2b 20 3d 20 28 75 6e 73 69 67  rPtr)++ = (unsig
22a0: 6e 65 64 20 63 68 61 72 29 20 76 61 6c 75 65 3b  ned char) value;
22b0: 0d 0a 20 09 20 20 20 20 2a 28 2a 63 75 72 73 6f  .. .    *(*curso
22c0: 72 50 74 72 29 2b 2b 20 3d 20 28 75 6e 73 69 67  rPtr)++ = (unsig
22d0: 6e 65 64 20 63 68 61 72 29 20 28 76 61 6c 75 65  ned char) (value
22e0: 20 3e 3e 20 38 29 3b 0d 0a 20 09 20 20 20 20 2a   >> 8);.. .    *
22f0: 28 2a 63 75 72 73 6f 72 50 74 72 29 2b 2b 20 3d  (*cursorPtr)++ =
2300: 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29   (unsigned char)
2310: 20 28 76 61 6c 75 65 20 3e 3e 20 31 36 29 3b 0d   (value >> 16);.
2320: 0a 20 09 20 20 20 20 2a 28 2a 63 75 72 73 6f 72  . .    *(*cursor
2330: 50 74 72 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e  Ptr)++ = (unsign
2340: 65 64 20 63 68 61 72 29 20 28 76 61 6c 75 65 20  ed char) (value 
2350: 3e 3e 20 32 34 29 3b 0d 0a 2d 09 7d 20 65 6c 73  >> 24);..-.} els
2360: 65 20 69 66 20 28 74 79 70 65 20 3d 3d 20 27 49  e if (type == 'I
2370: 27 29 20 7b 0d 0a 2b 20 20 20 20 20 20 7d 20 65  ') {..+      } e
2380: 6c 73 65 20 7b 0d 0a 20 09 20 20 20 20 2a 28 2a  lse {.. .    *(*
2390: 63 75 72 73 6f 72 50 74 72 29 2b 2b 20 3d 20 28  cursorPtr)++ = (
23a0: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29 20 28  unsigned char) (
23b0: 76 61 6c 75 65 20 3e 3e 20 32 34 29 3b 0d 0a 20  value >> 24);.. 
23c0: 09 20 20 20 20 2a 28 2a 63 75 72 73 6f 72 50 74  .    *(*cursorPt
23d0: 72 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64  r)++ = (unsigned
23e0: 20 63 68 61 72 29 20 28 76 61 6c 75 65 20 3e 3e   char) (value >>
23f0: 20 31 36 29 3b 0d 0a 20 09 20 20 20 20 2a 28 2a   16);.. .    *(*
2400: 63 75 72 73 6f 72 50 74 72 29 2b 2b 20 3d 20 28  cursorPtr)++ = (
2410: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 29 20 28  unsigned char) (
2420: 76 61 6c 75 65 20 3e 3e 20 38 29 3b 0d 0a 20 09  value >> 8);.. .
2430: 20 20 20 20 2a 28 2a 63 75 72 73 6f 72 50 74 72      *(*cursorPtr
2440: 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64 20  )++ = (unsigned 
2450: 63 68 61 72 29 20 76 61 6c 75 65 3b 0d 0a 2d 09  char) value;..-.
2460: 7d 0d 0a 2b 20 20 20 20 20 20 7d 0d 0a 2b 20 20  }..+      }..+  
2470: 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f      return TCL_O
2480: 4b 3b 0d 0a 2b 20 20 20 20 0d 0a 2b 20 20 20 20  K;..+    ..+    
2490: 63 61 73 65 20 27 63 27 3a 0d 0a 2b 20 20 20 20  case 'c':..+    
24a0: 20 20 69 66 20 28 54 63 6c 5f 47 65 74 4c 6f 6e    if (Tcl_GetLon
24b0: 67 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c  gFromObj(interp,
24c0: 20 73 72 63 2c 20 26 76 61 6c 75 65 29 20 21 3d   src, &value) !=
24d0: 20 54 43 4c 5f 4f 4b 29 20 7b 0d 0a 2b 09 20 20   TCL_OK) {..+.  
24e0: 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52  return TCL_ERROR
24f0: 3b 0d 0a 2b 20 20 20 20 20 20 7d 0d 0a 2b 20 20  ;..+      }..+  
2500: 20 20 20 20 2a 28 2a 63 75 72 73 6f 72 50 74 72      *(*cursorPtr
2510: 29 2b 2b 20 3d 20 28 75 6e 73 69 67 6e 65 64 20  )++ = (unsigned 
2520: 63 68 61 72 29 20 76 61 6c 75 65 3b 0d 0a 2b 20  char) value;..+ 
2530: 20 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f       return TCL_
2540: 4f 4b 3b 0d 0a 2b 0d 0a 2b 20 20 20 20 64 65 66  OK;..+..+    def
2550: 61 75 6c 74 3a 0d 0a 2b 09 2f 2f 61 73 73 65 72  ault:..+.//asser
2560: 74 28 30 29 3b 0d 0a 20 09 72 65 74 75 72 6e 20  t(0);.. .return 
2570: 54 43 4c 5f 4f 4b 3b 0d 0a 20 20 20 20 20 7d 0d  TCL_OK;..     }.
2580: 0a 20 7d 0d 0a 40 40 20 2d 31 35 39 32 2c 34 30  . }..@@ -1592,40
2590: 20 2b 31 37 36 31 2c 34 33 20 40 40 0d 0a 20 09   +1761,43 @@.. .
25a0: 09 76 61 6c 75 65 20 7c 3d 20 2d 30 78 31 30 30  .value |= -0x100
25b0: 3b 0d 0a 20 09 20 20 20 20 7d 0d 0a 20 09 20 20  ;.. .    }.. .  
25c0: 20 20 67 6f 74 6f 20 72 65 74 75 72 6e 4e 75 6d    goto returnNum
25d0: 65 72 69 63 4f 62 6a 65 63 74 3b 0d 0a 2d 0d 0a  ericObject;..-..
25e0: 2d 09 63 61 73 65 20 27 73 27 3a 0d 0a 2d 09 20  -.case 's':..-. 
25f0: 20 20 20 76 61 6c 75 65 20 3d 20 28 6c 6f 6e 67     value = (long
2600: 29 20 28 62 75 66 66 65 72 5b 30 5d 20 2b 20 28  ) (buffer[0] + (
2610: 62 75 66 66 65 72 5b 31 5d 20 3c 3c 20 38 29 29  buffer[1] << 8))
2620: 3b 0d 0a 2d 09 20 20 20 20 67 6f 74 6f 20 73 68  ;..-.    goto sh
2630: 6f 72 74 56 61 6c 75 65 3b 0d 0a 2b 20 20 20 20  ortValue;..+    
2640: 20 20 20 0d 0a 2b 09 2f 2a 20 73 68 6f 72 74 73     ..+./* shorts
2650: 20 2a 2f 0d 0a 2b 09 63 61 73 65 20 27 74 27 3a   */..+.case 't':
2660: 0d 0a 20 09 63 61 73 65 20 27 53 27 3a 0d 0a 2d  .. .case 'S':..-
2670: 09 20 20 20 20 76 61 6c 75 65 20 3d 20 28 6c 6f  .    value = (lo
2680: 6e 67 29 20 28 62 75 66 66 65 72 5b 31 5d 20 2b  ng) (buffer[1] +
2690: 20 28 62 75 66 66 65 72 5b 30 5d 20 3c 3c 20 38   (buffer[0] << 8
26a0: 29 29 3b 0d 0a 2d 09 20 20 20 20 73 68 6f 72 74  ));..-.    short
26b0: 56 61 6c 75 65 3a 0d 0a 2d 09 20 20 20 20 69 66  Value:..-.    if
26c0: 20 28 76 61 6c 75 65 20 26 20 30 78 38 30 30 30   (value & 0x8000
26d0: 29 20 7b 0d 0a 2b 09 63 61 73 65 20 27 73 27 3a  ) {..+.case 's':
26e0: 0d 0a 2b 09 20 20 20 20 69 66 28 20 4e 65 65 64  ..+.    if( Need
26f0: 52 65 76 65 72 73 69 6f 6e 28 74 79 70 65 29 20  Reversion(type) 
2700: 29 20 7b 0d 0a 2b 20 20 09 09 76 61 6c 75 65 20  ) {..+  ..value 
2710: 3d 20 28 6c 6f 6e 67 29 20 28 62 75 66 66 65 72  = (long) (buffer
2720: 5b 30 5d 20 2b 20 28 62 75 66 66 65 72 5b 31 5d  [0] + (buffer[1]
2730: 20 3c 3c 20 38 29 29 3b 0d 0a 2b 09 20 20 20 20   << 8));..+.    
2740: 7d 20 65 6c 73 65 20 7b 0d 0a 2b 09 09 76 61 6c  } else {..+..val
2750: 75 65 20 3d 20 28 6c 6f 6e 67 29 20 28 62 75 66  ue = (long) (buf
2760: 66 65 72 5b 31 5d 20 2b 20 28 62 75 66 66 65 72  fer[1] + (buffer
2770: 5b 30 5d 20 3c 3c 20 38 29 29 3b 0d 0a 2b 09 20  [0] << 8));..+. 
2780: 20 20 20 7d 0d 0a 2b 20 20 20 20 20 20 09 20 20     }..+      .  
2790: 20 20 69 66 20 28 76 61 6c 75 65 20 26 20 30 78    if (value & 0x
27a0: 38 30 30 30 29 20 7b 0d 0a 20 09 09 76 61 6c 75  8000) {.. ..valu
27b0: 65 20 7c 3d 20 2d 30 78 31 30 30 30 30 3b 0d 0a  e |= -0x10000;..
27c0: 20 09 20 20 20 20 7d 0d 0a 20 09 20 20 20 20 67   .    }.. .    g
27d0: 6f 74 6f 20 72 65 74 75 72 6e 4e 75 6d 65 72 69  oto returnNumeri
27e0: 63 4f 62 6a 65 63 74 3b 0d 0a 2d 0d 0a 2b 09 20  cObject;..-..+. 
27f0: 20 20 0d 0a 2b 09 2f 2a 20 69 6e 74 34 20 2a 2f    ..+./* int4 */
2800: 0d 0a 20 09 63 61 73 65 20 27 69 27 3a 0d 0a 2d  .. .case 'i':..-
2810: 09 20 20 20 20 76 61 6c 75 65 20 3d 20 28 6c 6f  .    value = (lo
2820: 6e 67 29 20 28 62 75 66 66 65 72 5b 30 5d 20 0d  ng) (buffer[0] .
2830: 0a 2d 09 09 20 20 20 20 2b 20 28 62 75 66 66 65  .-..    + (buffe
2840: 72 5b 31 5d 20 3c 3c 20 38 29 0d 0a 2d 09 09 20  r[1] << 8)..-.. 
2850: 20 20 20 2b 20 28 62 75 66 66 65 72 5b 32 5d 20     + (buffer[2] 
2860: 3c 3c 20 31 36 29 0d 0a 2d 09 09 20 20 20 20 2b  << 16)..-..    +
2870: 20 28 62 75 66 66 65 72 5b 33 5d 20 3c 3c 20 32   (buffer[3] << 2
2880: 34 29 29 3b 0d 0a 2d 09 20 20 20 20 67 6f 74 6f  4));..-.    goto
2890: 20 69 6e 74 56 61 6c 75 65 3b 0d 0a 20 09 63 61   intValue;.. .ca
28a0: 73 65 20 27 49 27 3a 0d 0a 2d 09 20 20 20 20 76  se 'I':..-.    v
28b0: 61 6c 75 65 20 3d 20 28 6c 6f 6e 67 29 20 28 62  alue = (long) (b
28c0: 75 66 66 65 72 5b 33 5d 0d 0a 2d 09 09 20 20 20  uffer[3]..-..   
28d0: 20 2b 20 28 62 75 66 66 65 72 5b 32 5d 20 3c 3c   + (buffer[2] <<
28e0: 20 38 29 0d 0a 2d 09 09 20 20 20 20 2b 20 28 62   8)..-..    + (b
28f0: 75 66 66 65 72 5b 31 5d 20 3c 3c 20 31 36 29 0d  uffer[1] << 16).
2900: 0a 2d 09 09 20 20 20 20 2b 20 28 62 75 66 66 65  .-..    + (buffe
2910: 72 5b 30 5d 20 3c 3c 20 32 34 29 29 3b 0d 0a 2d  r[0] << 24));..-
2920: 09 20 20 20 20 69 6e 74 56 61 6c 75 65 3a 0d 0a  .    intValue:..
2930: 2d 09 20 20 20 20 2f 2a 0d 0a 2d 09 20 20 20 20  -.    /*..-.    
2940: 20 2a 20 43 68 65 63 6b 20 74 6f 20 73 65 65 20   * Check to see 
2950: 69 66 20 74 68 65 20 76 61 6c 75 65 20 77 61 73  if the value was
2960: 20 73 69 67 6e 20 65 78 74 65 6e 64 65 64 20 70   sign extended p
2970: 72 6f 70 65 72 6c 79 20 6f 6e 0d 0a 2d 09 20 20  roperly on..-.  
2980: 20 20 20 2a 20 73 79 73 74 65 6d 73 20 77 68 65     * systems whe
2990: 72 65 20 61 6e 20 69 6e 74 20 69 73 20 6d 6f 72  re an int is mor
29a0: 65 20 74 68 61 6e 20 33 32 2d 62 69 74 73 2e 0d  e than 32-bits..
29b0: 0a 2d 09 20 20 20 20 20 2a 2f 0d 0a 2d 0d 0a 2b  .-.     */..-..+
29c0: 09 63 61 73 65 20 27 6e 27 3a 0d 0a 2b 09 20 20  .case 'n':..+.  
29d0: 20 20 69 66 28 20 4e 65 65 64 52 65 76 65 72 73    if( NeedRevers
29e0: 69 6f 6e 28 74 79 70 65 29 20 29 20 7b 0d 0a 2b  ion(type) ) {..+
29f0: 09 09 76 61 6c 75 65 20 3d 20 28 6c 6f 6e 67 29  ..value = (long)
2a00: 20 28 62 75 66 66 65 72 5b 30 5d 20 0d 0a 2b 09   (buffer[0] ..+.
2a10: 09 20 20 20 20 20 20 2b 20 28 62 75 66 66 65 72  .      + (buffer
2a20: 5b 31 5d 20 3c 3c 20 38 29 0d 0a 2b 09 09 20 20  [1] << 8)..+..  
2a30: 20 20 20 20 2b 20 28 62 75 66 66 65 72 5b 32 5d      + (buffer[2]
2a40: 20 3c 3c 20 31 36 29 0d 0a 2b 09 09 20 20 20 20   << 16)..+..    
2a50: 20 20 2b 20 28 62 75 66 66 65 72 5b 33 5d 20 3c    + (buffer[3] <
2a60: 3c 20 32 34 29 29 3b 0d 0a 2b 09 20 20 20 20 7d  < 24));..+.    }
2a70: 20 65 6c 73 65 20 7b 0d 0a 2b 09 09 76 61 6c 75   else {..+..valu
2a80: 65 20 3d 20 28 6c 6f 6e 67 29 20 28 62 75 66 66  e = (long) (buff
2a90: 65 72 5b 33 5d 0d 0a 2b 09 09 20 20 20 20 20 20  er[3]..+..      
2aa0: 2b 20 28 62 75 66 66 65 72 5b 32 5d 20 3c 3c 20  + (buffer[2] << 
2ab0: 38 29 0d 0a 2b 09 09 20 20 20 20 20 20 2b 20 28  8)..+..      + (
2ac0: 62 75 66 66 65 72 5b 31 5d 20 3c 3c 20 31 36 29  buffer[1] << 16)
2ad0: 0d 0a 2b 09 09 20 20 20 20 20 20 2b 20 28 62 75  ..+..      + (bu
2ae0: 66 66 65 72 5b 30 5d 20 3c 3c 20 32 34 29 29 3b  ffer[0] << 24));
2af0: 0d 0a 2b 09 20 20 20 20 7d 0d 0a 20 09 20 20 20  ..+.    }.. .   
2b00: 20 69 66 20 28 28 76 61 6c 75 65 20 26 20 28 28   if ((value & ((
2b10: 28 75 6e 73 69 67 6e 65 64 20 69 6e 74 29 31 29  (unsigned int)1)
2b20: 3c 3c 33 31 29 29 20 26 26 20 28 76 61 6c 75 65  <<31)) && (value
2b30: 20 3e 20 30 29 29 20 7b 0d 0a 20 09 09 76 61 6c   > 0)) {.. ..val
2b40: 75 65 20 2d 3d 20 28 28 28 75 6e 73 69 67 6e 65  ue -= (((unsigne
2b50: 64 20 69 6e 74 29 31 29 3c 3c 33 31 29 3b 0d 0a  d int)1)<<31);..
2b60: 20 09 09 76 61 6c 75 65 20 2d 3d 20 28 28 28 75   ..value -= (((u
2b70: 6e 73 69 67 6e 65 64 20 69 6e 74 29 31 29 3c 3c  nsigned int)1)<<
2b80: 33 31 29 3b 0d 0a 2d 09 20 20 20 20 7d 0d 0a 2d  31);..-.    }..-
2b90: 09 20 20 20 20 72 65 74 75 72 6e 4e 75 6d 65 72  .    returnNumer
2ba0: 69 63 4f 62 6a 65 63 74 3a 0d 0a 2b 09 20 20 20  icObject:..+.   
2bb0: 20 7d 20 20 20 20 20 20 0d 0a 2b 0d 0a 2b 09 20   }      ..+..+. 
2bc0: 20 20 72 65 74 75 72 6e 4e 75 6d 65 72 69 63 4f    returnNumericO
2bd0: 62 6a 65 63 74 3a 0d 0a 2b 0d 0a 20 09 20 20 20  bject:..+.. .   
2be0: 20 69 66 20 28 2a 6e 75 6d 62 65 72 43 61 63 68   if (*numberCach
2bf0: 65 50 74 72 50 74 72 20 3d 3d 20 4e 55 4c 4c 29  ePtrPtr == NULL)
2c00: 20 7b 0d 0a 20 09 09 72 65 74 75 72 6e 20 54 63   {.. ..return Tc
2c10: 6c 5f 4e 65 77 4c 6f 6e 67 4f 62 6a 28 76 61 6c  l_NewLongObj(val
2c20: 75 65 29 3b 0d 0a 20 09 20 20 20 20 7d 20 65 6c  ue);.. .    } el
2c30: 73 65 20 7b 0d 0a 40 40 20 2d 31 36 35 39 2c 31  se {..@@ -1659,1
2c40: 32 20 2b 31 38 33 31 2c 31 36 20 40 40 0d 0a 20  2 +1831,16 @@.. 
2c50: 09 09 7d 0d 0a 20 09 20 20 20 20 7d 0d 0a 20 0d  ..}.. .    }.. .
2c60: 0a 2d 09 20 20 20 20 2f 2a 0d 0a 2d 09 20 20 20  .-.    /*..-.   
2c70: 20 20 2a 20 44 6f 20 6e 6f 74 20 63 61 63 68 65    * Do not cache
2c80: 20 77 69 64 65 20 76 61 6c 75 65 73 3b 20 74 68   wide values; th
2c90: 65 79 20 61 72 65 20 61 6c 72 65 61 64 79 20 74  ey are already t
2ca0: 6f 6f 20 6c 61 72 67 65 20 74 6f 0d 0a 2d 09 20  oo large to..-. 
2cb0: 20 20 20 20 2a 20 75 73 65 20 61 73 20 6b 65 79      * use as key
2cc0: 73 2e 0d 0a 2d 09 20 20 20 20 20 2a 2f 0d 0a 2b  s...-.     */..+
2cd0: 0d 0a 2b 09 2f 2a 0d 0a 2b 09 20 2a 20 44 6f 20  ..+./*..+. * Do 
2ce0: 6e 6f 74 20 63 61 63 68 65 20 77 69 64 65 20 76  not cache wide v
2cf0: 61 6c 75 65 73 3b 20 74 68 65 79 20 61 72 65 20  alues; they are 
2d00: 61 6c 72 65 61 64 79 20 74 6f 6f 20 6c 61 72 67  already too larg
2d10: 65 20 74 6f 0d 0a 2b 09 20 2a 20 75 73 65 20 61  e to..+. * use a
2d20: 73 20 6b 65 79 73 2e 0d 0a 2b 09 20 2a 2f 0d 0a  s keys...+. */..
2d30: 2b 09 63 61 73 65 20 27 6d 27 3a 0d 0a 20 09 63  +.case 'm':.. .c
2d40: 61 73 65 20 27 77 27 3a 0d 0a 2d 09 20 20 20 20  ase 'w':..-.    
2d50: 75 77 76 61 6c 75 65 20 3d 20 20 28 28 54 63 6c  uwvalue =  ((Tcl
2d60: 5f 57 69 64 65 55 49 6e 74 29 20 62 75 66 66 65  _WideUInt) buffe
2d70: 72 5b 30 5d 29 0d 0a 2b 09 63 61 73 65 20 27 57  r[0])..+.case 'W
2d80: 27 3a 0d 0a 2b 09 20 20 20 20 69 66 28 20 4e 65  ':..+.    if( Ne
2d90: 65 64 52 65 76 65 72 73 69 6f 6e 28 74 79 70 65  edReversion(type
2da0: 29 20 29 20 7b 0d 0a 2b 09 09 75 77 76 61 6c 75  ) ) {..+..uwvalu
2db0: 65 20 3d 20 20 28 28 54 63 6c 5f 57 69 64 65 55  e =  ((Tcl_WideU
2dc0: 49 6e 74 29 20 62 75 66 66 65 72 5b 30 5d 29 0d  Int) buffer[0]).
2dd0: 0a 20 09 09 20 20 20 20 7c 20 28 28 28 54 63 6c  . ..    | (((Tcl
2de0: 5f 57 69 64 65 55 49 6e 74 29 20 62 75 66 66 65  _WideUInt) buffe
2df0: 72 5b 31 5d 29 20 3c 3c 20 38 29 0d 0a 20 09 09  r[1]) << 8).. ..
2e00: 20 20 20 20 7c 20 28 28 28 54 63 6c 5f 57 69 64      | (((Tcl_Wid
2e10: 65 55 49 6e 74 29 20 62 75 66 66 65 72 5b 32 5d  eUInt) buffer[2]
2e20: 29 20 3c 3c 20 31 36 29 0d 0a 20 09 09 20 20 20  ) << 16).. ..   
2e30: 20 7c 20 28 28 28 54 63 6c 5f 57 69 64 65 55 49   | (((Tcl_WideUI
2e40: 6e 74 29 20 62 75 66 66 65 72 5b 33 5d 29 20 3c  nt) buffer[3]) <
2e50: 3c 20 32 34 29 0d 0a 40 40 20 2d 31 36 37 32 2c  < 24)..@@ -1672,
2e60: 39 20 2b 31 38 34 38 2c 38 20 40 40 0d 0a 20 09  9 +1848,8 @@.. .
2e70: 09 20 20 20 20 7c 20 28 28 28 54 63 6c 5f 57 69  .    | (((Tcl_Wi
2e80: 64 65 55 49 6e 74 29 20 62 75 66 66 65 72 5b 35  deUInt) buffer[5
2e90: 5d 29 20 3c 3c 20 34 30 29 0d 0a 20 09 09 20 20  ]) << 40).. ..  
2ea0: 20 20 7c 20 28 28 28 54 63 6c 5f 57 69 64 65 55    | (((Tcl_WideU
2eb0: 49 6e 74 29 20 62 75 66 66 65 72 5b 36 5d 29 20  Int) buffer[6]) 
2ec0: 3c 3c 20 34 38 29 0d 0a 20 09 09 20 20 20 20 7c  << 48).. ..    |
2ed0: 20 28 28 28 54 63 6c 5f 57 69 64 65 55 49 6e 74   (((Tcl_WideUInt
2ee0: 29 20 62 75 66 66 65 72 5b 37 5d 29 20 3c 3c 20  ) buffer[7]) << 
2ef0: 35 36 29 3b 0d 0a 2d 09 20 20 20 20 72 65 74 75  56);..-.    retu
2f00: 72 6e 20 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e  rn Tcl_NewWideIn
2f10: 74 4f 62 6a 28 28 54 63 6c 5f 57 69 64 65 49 6e  tObj((Tcl_WideIn
2f20: 74 29 20 75 77 76 61 6c 75 65 29 3b 0d 0a 2d 09  t) uwvalue);..-.
2f30: 63 61 73 65 20 27 57 27 3a 0d 0a 2d 09 20 20 20  case 'W':..-.   
2f40: 20 75 77 76 61 6c 75 65 20 3d 20 20 28 28 54 63   uwvalue =  ((Tc
2f50: 6c 5f 57 69 64 65 55 49 6e 74 29 20 62 75 66 66  l_WideUInt) buff
2f60: 65 72 5b 37 5d 29 0d 0a 2b 09 20 20 20 20 7d 20  er[7])..+.    } 
2f70: 65 6c 73 65 20 7b 0d 0a 2b 09 09 75 77 76 61 6c  else {..+..uwval
2f80: 75 65 20 3d 20 20 28 28 54 63 6c 5f 57 69 64 65  ue =  ((Tcl_Wide
2f90: 55 49 6e 74 29 20 62 75 66 66 65 72 5b 37 5d 29  UInt) buffer[7])
2fa0: 0d 0a 20 09 09 20 20 20 20 7c 20 28 28 28 54 63  .. ..    | (((Tc
2fb0: 6c 5f 57 69 64 65 55 49 6e 74 29 20 62 75 66 66  l_WideUInt) buff
2fc0: 65 72 5b 36 5d 29 20 3c 3c 20 38 29 0d 0a 20 09  er[6]) << 8).. .
2fd0: 09 20 20 20 20 7c 20 28 28 28 54 63 6c 5f 57 69  .    | (((Tcl_Wi
2fe0: 64 65 55 49 6e 74 29 20 62 75 66 66 65 72 5b 35  deUInt) buffer[5
2ff0: 5d 29 20 3c 3c 20 31 36 29 0d 0a 20 09 09 20 20  ]) << 16).. ..  
3000: 20 20 7c 20 28 28 28 54 63 6c 5f 57 69 64 65 55    | (((Tcl_WideU
3010: 49 6e 74 29 20 62 75 66 66 65 72 5b 34 5d 29 20  Int) buffer[4]) 
3020: 3c 3c 20 32 34 29 0d 0a 40 40 20 2d 31 36 38 32  << 24)..@@ -1682
3030: 2c 32 33 20 2b 31 38 35 37 2c 33 33 20 40 40 0d  ,23 +1857,33 @@.
3040: 0a 20 09 09 20 20 20 20 7c 20 28 28 28 54 63 6c  . ..    | (((Tcl
3050: 5f 57 69 64 65 55 49 6e 74 29 20 62 75 66 66 65  _WideUInt) buffe
3060: 72 5b 32 5d 29 20 3c 3c 20 34 30 29 0d 0a 20 09  r[2]) << 40).. .
3070: 09 20 20 20 20 7c 20 28 28 28 54 63 6c 5f 57 69  .    | (((Tcl_Wi
3080: 64 65 55 49 6e 74 29 20 62 75 66 66 65 72 5b 31  deUInt) buffer[1
3090: 5d 29 20 3c 3c 20 34 38 29 0d 0a 20 09 09 20 20  ]) << 48).. ..  
30a0: 20 20 7c 20 28 28 28 54 63 6c 5f 57 69 64 65 55    | (((Tcl_WideU
30b0: 49 6e 74 29 20 62 75 66 66 65 72 5b 30 5d 29 20  Int) buffer[0]) 
30c0: 3c 3c 20 35 36 29 3b 0d 0a 2b 09 20 20 20 20 7d  << 56);..+.    }
30d0: 0d 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20 54  .. .    return T
30e0: 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a  cl_NewWideIntObj
30f0: 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29 20 75  ((Tcl_WideInt) u
3100: 77 76 61 6c 75 65 29 3b 0d 0a 2b 09 20 20 0d 0a  wvalue);..+.  ..
3110: 20 0d 0a 2d 09 20 20 20 20 2f 2a 0d 0a 2d 09 20   ..-.    /*..-. 
3120: 20 20 20 20 2a 20 44 6f 20 6e 6f 74 20 63 61 63      * Do not cac
3130: 68 65 20 64 6f 75 62 6c 65 20 76 61 6c 75 65 73  he double values
3140: 3b 20 74 68 65 79 20 61 72 65 20 61 6c 72 65 61  ; they are alrea
3150: 64 79 20 74 6f 6f 20 6c 61 72 67 65 0d 0a 2d 09  dy too large..-.
3160: 20 20 20 20 20 2a 20 74 6f 20 75 73 65 20 61 73       * to use as
3170: 20 6b 65 79 73 20 61 6e 64 20 74 68 65 20 76 61   keys and the va
3180: 6c 75 65 73 20 73 74 6f 72 65 64 20 61 72 65 20  lues stored are 
3190: 75 74 74 65 72 6c 79 0d 0a 2d 09 20 20 20 20 20  utterly..-.     
31a0: 2a 20 69 6e 63 6f 6d 70 61 74 69 62 6c 65 20 74  * incompatible t
31b0: 6f 6f 2e 0d 0a 2d 09 20 20 20 20 20 2a 2f 0d 0a  oo...-.     */..
31c0: 2d 09 63 61 73 65 20 27 66 27 3a 20 7b 0d 0a 2d  -.case 'f': {..-
31d0: 09 20 20 20 20 66 6c 6f 61 74 20 66 76 61 6c 75  .    float fvalu
31e0: 65 3b 0d 0a 2d 09 20 20 20 20 6d 65 6d 63 70 79  e;..-.    memcpy
31f0: 28 28 56 4f 49 44 20 2a 29 20 26 66 76 61 6c 75  ((VOID *) &fvalu
3200: 65 2c 20 28 56 4f 49 44 20 2a 29 20 62 75 66 66  e, (VOID *) buff
3210: 65 72 2c 20 73 69 7a 65 6f 66 28 66 6c 6f 61 74  er, sizeof(float
3220: 29 29 3b 0d 0a 2d 09 20 20 20 20 72 65 74 75 72  ));..-.    retur
3230: 6e 20 54 63 6c 5f 4e 65 77 44 6f 75 62 6c 65 4f  n Tcl_NewDoubleO
3240: 62 6a 28 66 76 61 6c 75 65 29 3b 0d 0a 2d 09 7d  bj(fvalue);..-.}
3250: 0d 0a 2d 09 63 61 73 65 20 27 64 27 3a 20 7b 0d  ..-.case 'd': {.
3260: 0a 2d 09 20 20 20 20 64 6f 75 62 6c 65 20 64 76  .-.    double dv
3270: 61 6c 75 65 3b 0d 0a 2d 09 20 20 20 20 6d 65 6d  alue;..-.    mem
3280: 63 70 79 28 28 56 4f 49 44 20 2a 29 20 26 64 76  cpy((VOID *) &dv
3290: 61 6c 75 65 2c 20 28 56 4f 49 44 20 2a 29 20 62  alue, (VOID *) b
32a0: 75 66 66 65 72 2c 20 73 69 7a 65 6f 66 28 64 6f  uffer, sizeof(do
32b0: 75 62 6c 65 29 29 3b 0d 0a 2d 09 20 20 20 20 72  uble));..-.    r
32c0: 65 74 75 72 6e 20 54 63 6c 5f 4e 65 77 44 6f 75  eturn Tcl_NewDou
32d0: 62 6c 65 4f 62 6a 28 64 76 61 6c 75 65 29 3b 0d  bleObj(dvalue);.
32e0: 0a 2d 09 7d 0d 0a 2b 09 2f 2a 0d 0a 2b 09 20 2a  .-.}..+./*..+. *
32f0: 20 44 6f 20 6e 6f 74 20 63 61 63 68 65 20 64 6f   Do not cache do
3300: 75 62 6c 65 20 76 61 6c 75 65 73 3b 20 74 68 65  uble values; the
3310: 79 20 61 72 65 20 61 6c 72 65 61 64 79 20 74 6f  y are already to
3320: 6f 20 6c 61 72 67 65 0d 0a 2b 09 20 2a 20 74 6f  o large..+. * to
3330: 20 75 73 65 20 61 73 20 6b 65 79 73 20 61 6e 64   use as keys and
3340: 20 74 68 65 20 76 61 6c 75 65 73 20 73 74 6f 72   the values stor
3350: 65 64 20 61 72 65 20 75 74 74 65 72 6c 79 0d 0a  ed are utterly..
3360: 2b 09 20 2a 20 69 6e 63 6f 6d 70 61 74 69 62 6c  +. * incompatibl
3370: 65 20 74 6f 6f 2e 0d 0a 2b 09 20 2a 2f 0d 0a 2b  e too...+. */..+
3380: 09 2f 2a 20 66 6c 6f 61 74 27 73 20 2a 2f 0d 0a  ./* float's */..
3390: 2b 09 63 61 73 65 20 27 66 27 3a 0d 0a 2b 09 63  +.case 'f':..+.c
33a0: 61 73 65 20 27 52 27 3a 0d 0a 2b 09 63 61 73 65  ase 'R':..+.case
33b0: 20 27 72 27 3a 20 7b 0d 0a 2b 09 20 20 20 66 6c   'r': {..+.   fl
33c0: 6f 61 74 20 66 76 61 6c 75 65 3b 0d 0a 2b 09 20  oat fvalue;..+. 
33d0: 20 20 43 6f 70 79 4e 75 6d 62 65 72 28 20 62 75    CopyNumber( bu
33e0: 66 66 65 72 2c 20 26 66 76 61 6c 75 65 2c 20 73  ffer, &fvalue, s
33f0: 69 7a 65 6f 66 28 66 6c 6f 61 74 29 2c 20 4e 65  izeof(float), Ne
3400: 65 64 52 65 76 65 72 73 69 6f 6e 28 74 79 70 65  edReversion(type
3410: 29 20 29 3b 0d 0a 2b 09 20 20 20 72 65 74 75 72  ) );..+.   retur
3420: 6e 20 54 63 6c 5f 4e 65 77 44 6f 75 62 6c 65 4f  n Tcl_NewDoubleO
3430: 62 6a 28 66 76 61 6c 75 65 29 3b 0d 0a 2b 09 20  bj(fvalue);..+. 
3440: 20 20 7d 0d 0a 2b 0d 0a 2b 09 2f 2a 20 64 6f 75    }..+..+./* dou
3450: 62 6c 65 73 27 73 20 2a 2f 0d 0a 2b 09 63 61 73  bles's */..+.cas
3460: 65 20 27 64 27 3a 0d 0a 2b 09 63 61 73 65 20 27  e 'd':..+.case '
3470: 51 27 3a 0d 0a 2b 09 63 61 73 65 20 27 71 27 3a  Q':..+.case 'q':
3480: 20 7b 0d 0a 2b 09 20 20 20 64 6f 75 62 6c 65 20   {..+.   double 
3490: 64 76 61 6c 75 65 3b 0d 0a 2b 09 20 20 20 43 6f  dvalue;..+.   Co
34a0: 70 79 4e 75 6d 62 65 72 28 20 62 75 66 66 65 72  pyNumber( buffer
34b0: 2c 20 26 64 76 61 6c 75 65 2c 20 73 69 7a 65 6f  , &dvalue, sizeo
34c0: 66 28 64 6f 75 62 6c 65 29 2c 20 4e 65 65 64 52  f(double), NeedR
34d0: 65 76 65 72 73 69 6f 6e 28 74 79 70 65 29 20 29  eversion(type) )
34e0: 3b 0d 0a 2b 09 20 20 20 72 65 74 75 72 6e 20 54  ;..+.   return T
34f0: 63 6c 5f 4e 65 77 44 6f 75 62 6c 65 4f 62 6a 28  cl_NewDoubleObj(
3500: 64 76 61 6c 75 65 29 3b 0d 0a 2b 09 20 20 20 7d  dvalue);..+.   }
3510: 0d 0a 2b 09 20 20 20 20 0d 0a 20 20 20 20 20 7d  ..+.    ..     }
3520: 0d 0a 20 20 20 20 20 72 65 74 75 72 6e 20 4e 55  ..     return NU
3530: 4c 4c 3b 0d 0a 20 7d 0d 0a 49 6e 64 65 78 3a 20  LL;.. }..Index: 
3540: 74 65 73 74 73 2f 62 69 6e 61 72 79 2e 74 65 73  tests/binary.tes
3550: 74 0d 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  t..=============
3560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3590: 3d 3d 3d 3d 3d 3d 0d 0a 52 43 53 20 66 69 6c 65  ======..RCS file
35a0: 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74  : /cvsroot/tcl/t
35b0: 63 6c 2f 74 65 73 74 73 2f 62 69 6e 61 72 79 2e  cl/tests/binary.
35c0: 74 65 73 74 2c 76 0d 0a 72 65 74 72 69 65 76 69  test,v..retrievi
35d0: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 33  ng revision 1.13
35e0: 0d 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 31 33  ..diff -u -r1.13
35f0: 20 62 69 6e 61 72 79 2e 74 65 73 74 0d 0a 2d 2d   binary.test..--
3600: 2d 20 74 65 73 74 73 2f 62 69 6e 61 72 79 2e 74  - tests/binary.t
3610: 65 73 74 09 32 20 44 65 63 20 32 30 30 33 20 30  est.2 Dec 2003 0
3620: 39 3a 32 39 3a 35 34 20 2d 30 30 30 30 09 31 2e  9:29:54 -0000.1.
3630: 31 33 0d 0a 2b 2b 2b 20 74 65 73 74 73 2f 62 69  13..+++ tests/bi
3640: 6e 61 72 79 2e 74 65 73 74 09 31 31 20 44 65 63  nary.test.11 Dec
3650: 20 32 30 30 33 20 31 31 3a 34 38 3a 31 36 20 2d   2003 11:48:16 -
3660: 30 30 30 30 0d 0a 40 40 20 2d 31 35 32 34 2c 36  0000..@@ -1524,6
3670: 20 2b 31 35 32 34 2c 35 38 35 20 40 40 0d 0a 20   +1524,585 @@.. 
3680: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79      list [binary
3690: 20 73 63 61 6e 20 61 62 61 20 63 63 63 20 78 20   scan aba ccc x 
36a0: 78 20 78 5d 20 24 78 0d 0a 20 7d 20 7b 33 20 39  x x] $x.. } {3 9
36b0: 37 7d 0d 0a 20 0d 0a 2b 23 20 66 6f 72 6d 61 74  7}.. ..+# format
36c0: 20 74 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79   t..+test binary
36d0: 2d 34 38 2e 31 20 7b 54 63 6c 5f 42 69 6e 61 72  -48.1 {Tcl_Binar
36e0: 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d  yObjCmd: format}
36f0: 20 7b 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63   {..+    list [c
3700: 61 74 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72  atch {binary for
3710: 6d 61 74 20 74 7d 20 6d 73 67 5d 20 24 6d 73 67  mat t} msg] $msg
3720: 0d 0a 2b 7d 20 7b 31 20 7b 6e 6f 74 20 65 6e 6f  ..+} {1 {not eno
3730: 75 67 68 20 61 72 67 75 6d 65 6e 74 73 20 66 6f  ugh arguments fo
3740: 72 20 61 6c 6c 20 66 6f 72 6d 61 74 20 73 70 65  r all format spe
3750: 63 69 66 69 65 72 73 7d 7d 0d 0a 2b 74 65 73 74  cifiers}}..+test
3760: 20 62 69 6e 61 72 79 2d 34 38 2e 32 20 7b 54 63   binary-48.2 {Tc
3770: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
3780: 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20  format} {..+    
3790: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
37a0: 61 72 79 20 66 6f 72 6d 61 74 20 74 20 62 6c 61  ary format t bla
37b0: 74 7d 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d  t} msg] $msg..+}
37c0: 20 7b 31 20 7b 65 78 70 65 63 74 65 64 20 69 6e   {1 {expected in
37d0: 74 65 67 65 72 20 62 75 74 20 67 6f 74 20 22 62  teger but got "b
37e0: 6c 61 74 22 7d 7d 0d 0a 2b 74 65 73 74 20 62 69  lat"}}..+test bi
37f0: 6e 61 72 79 2d 34 38 2e 33 20 7b 54 63 6c 5f 42  nary-48.3 {Tcl_B
3800: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
3810: 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e  mat} {..+    bin
3820: 61 72 79 20 66 6f 72 6d 61 74 20 53 30 20 30 78  ary format S0 0x
3830: 35 30 0d 0a 2b 7d 20 7b 7d 0d 0a 2b 74 65 73 74  50..+} {}..+test
3840: 20 62 69 6e 61 72 79 2d 34 38 2e 34 20 7b 54 63   binary-48.4 {Tc
3850: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
3860: 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74  format} {nonPort
3870: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20  able macOrUnix} 
3880: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
3890: 6f 72 6d 61 74 20 74 20 30 78 35 30 0d 0a 2b 7d  ormat t 0x50..+}
38a0: 20 5c 78 30 30 50 0d 0a 2b 74 65 73 74 20 62 69   \x00P..+test bi
38b0: 6e 61 72 79 2d 34 38 2e 35 20 7b 54 63 6c 5f 42  nary-48.5 {Tcl_B
38c0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
38d0: 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c  mat} {nonPortabl
38e0: 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20  e pcOnly} {..+  
38f0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20    binary format 
3900: 74 20 30 78 35 30 0d 0a 2b 7d 20 50 5c 78 30 30  t 0x50..+} P\x00
3910: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34  ..+test binary-4
3920: 38 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  8.6 {Tcl_BinaryO
3930: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b  bjCmd: format} {
3940: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f  nonPortable macO
3950: 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62  rUnix} {..+    b
3960: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 20 30  inary format t 0
3970: 78 35 30 35 32 0d 0a 2b 7d 20 50 52 0d 0a 2b 74  x5052..+} PR..+t
3980: 65 73 74 20 62 69 6e 61 72 79 2d 34 38 2e 37 20  est binary-48.7 
3990: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
39a0: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50  d: format} {nonP
39b0: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20  ortable pcOnly} 
39c0: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
39d0: 6f 72 6d 61 74 20 74 20 30 78 35 30 35 32 0d 0a  ormat t 0x5052..
39e0: 2b 7d 20 52 50 0d 0a 2b 74 65 73 74 20 62 69 6e  +} RP..+test bin
39f0: 61 72 79 2d 34 38 2e 38 20 7b 54 63 6c 5f 42 69  ary-48.8 {Tcl_Bi
3a00: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d  naryObjCmd: form
3a10: 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65  at} {nonPortable
3a20: 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b   macOrUnix} {..+
3a30: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
3a40: 74 20 74 20 30 78 35 30 35 32 35 31 20 30 78 35  t t 0x505251 0x5
3a50: 33 0d 0a 2b 7d 20 52 51 0d 0a 2b 74 65 73 74 20  3..+} RQ..+test 
3a60: 62 69 6e 61 72 79 2d 34 38 2e 39 20 7b 54 63 6c  binary-48.9 {Tcl
3a70: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66  _BinaryObjCmd: f
3a80: 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61  ormat} {nonPorta
3a90: 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b  ble pcOnly} {..+
3aa0: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
3ab0: 74 20 74 20 30 78 35 30 35 32 35 31 20 30 78 35  t t 0x505251 0x5
3ac0: 33 0d 0a 2b 7d 20 51 52 0d 0a 2b 74 65 73 74 20  3..+} QR..+test 
3ad0: 62 69 6e 61 72 79 2d 34 38 2e 31 30 20 7b 54 63  binary-48.10 {Tc
3ae0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
3af0: 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74  format} {nonPort
3b00: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20  able macOrUnix} 
3b10: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
3b20: 6f 72 6d 61 74 20 74 32 20 7b 30 78 35 30 20 30  ormat t2 {0x50 0
3b30: 78 35 32 7d 0d 0a 2b 7d 20 5c 78 30 30 50 5c 78  x52}..+} \x00P\x
3b40: 30 30 52 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  00R..+test binar
3b50: 79 2d 34 38 2e 31 31 20 7b 54 63 6c 5f 42 69 6e  y-48.11 {Tcl_Bin
3b60: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
3b70: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
3b80: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
3b90: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 32  binary format t2
3ba0: 20 7b 30 78 35 30 20 30 78 35 32 7d 0d 0a 2b 7d   {0x50 0x52}..+}
3bb0: 20 50 5c 78 30 30 52 5c 78 30 30 0d 0a 2b 74 65   P\x00R\x00..+te
3bc0: 73 74 20 62 69 6e 61 72 79 2d 34 38 2e 31 32 20  st binary-48.12 
3bd0: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
3be0: 64 3a 20 66 6f 72 6d 61 74 7d 20 20 7b 6e 6f 6e  d: format}  {non
3bf0: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e  Portable macOrUn
3c00: 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61  ix} {..+    bina
3c10: 72 79 20 66 6f 72 6d 61 74 20 74 2a 20 7b 30 78  ry format t* {0x
3c20: 35 30 35 31 20 30 78 35 32 7d 0d 0a 2b 7d 20 50  5051 0x52}..+} P
3c30: 51 5c 78 30 30 52 0d 0a 2b 74 65 73 74 20 62 69  Q\x00R..+test bi
3c40: 6e 61 72 79 2d 34 38 2e 31 33 20 7b 54 63 6c 5f  nary-48.13 {Tcl_
3c50: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f  BinaryObjCmd: fo
3c60: 72 6d 61 74 7d 20 20 7b 6e 6f 6e 50 6f 72 74 61  rmat}  {nonPorta
3c70: 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b  ble pcOnly} {..+
3c80: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
3c90: 74 20 74 2a 20 7b 30 78 35 30 35 31 20 30 78 35  t t* {0x5051 0x5
3ca0: 32 7d 0d 0a 2b 7d 20 51 50 52 5c 78 30 30 0d 0a  2}..+} QPR\x00..
3cb0: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34 38 2e  +test binary-48.
3cc0: 31 34 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  14 {Tcl_BinaryOb
3cd0: 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e  jCmd: format} {n
3ce0: 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72  onPortable macOr
3cf0: 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69  Unix} {..+    bi
3d00: 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 32 20 7b  nary format t2 {
3d10: 30 78 35 30 20 30 78 35 32 20 30 78 35 33 7d 20  0x50 0x52 0x53} 
3d20: 30 78 35 34 0d 0a 2b 7d 20 5c 78 30 30 50 5c 78  0x54..+} \x00P\x
3d30: 30 30 52 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  00R..+test binar
3d40: 79 2d 34 38 2e 31 35 20 7b 54 63 6c 5f 42 69 6e  y-48.15 {Tcl_Bin
3d50: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
3d60: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
3d70: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
3d80: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 32  binary format t2
3d90: 20 7b 30 78 35 30 20 30 78 35 32 20 30 78 35 33   {0x50 0x52 0x53
3da0: 7d 20 30 78 35 34 0d 0a 2b 7d 20 50 5c 78 30 30  } 0x54..+} P\x00
3db0: 52 5c 78 30 30 0d 0a 2b 74 65 73 74 20 62 69 6e  R\x00..+test bin
3dc0: 61 72 79 2d 34 38 2e 31 36 20 7b 54 63 6c 5f 42  ary-48.16 {Tcl_B
3dd0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
3de0: 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20 6c 69 73  mat} {..+    lis
3df0: 74 20 5b 63 61 74 63 68 20 7b 62 69 6e 61 72 79  t [catch {binary
3e00: 20 66 6f 72 6d 61 74 20 74 32 20 7b 30 78 35 30   format t2 {0x50
3e10: 7d 7d 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d  }} msg] $msg..+}
3e20: 20 7b 31 20 7b 6e 75 6d 62 65 72 20 6f 66 20 65   {1 {number of e
3e30: 6c 65 6d 65 6e 74 73 20 69 6e 20 6c 69 73 74 20  lements in list 
3e40: 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 63  does not match c
3e50: 6f 75 6e 74 7d 7d 0d 0a 2b 74 65 73 74 20 62 69  ount}}..+test bi
3e60: 6e 61 72 79 2d 34 38 2e 31 37 20 7b 54 63 6c 5f  nary-48.17 {Tcl_
3e70: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f  BinaryObjCmd: fo
3e80: 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20 73 65  rmat} {..+    se
3e90: 74 20 61 20 7b 30 78 35 30 20 30 78 35 31 7d 0d  t a {0x50 0x51}.
3ea0: 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63  .+    list [catc
3eb0: 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74  h {binary format
3ec0: 20 74 20 24 61 7d 20 6d 73 67 5d 20 24 6d 73 67   t $a} msg] $msg
3ed0: 0d 0a 2b 7d 20 5b 6c 69 73 74 20 31 20 22 65 78  ..+} [list 1 "ex
3ee0: 70 65 63 74 65 64 20 69 6e 74 65 67 65 72 20 62  pected integer b
3ef0: 75 74 20 67 6f 74 20 5c 22 30 78 35 30 20 30 78  ut got \"0x50 0x
3f00: 35 31 5c 22 22 5d 0d 0a 2b 74 65 73 74 20 62 69  51\""]..+test bi
3f10: 6e 61 72 79 2d 34 38 2e 31 38 20 7b 54 63 6c 5f  nary-48.18 {Tcl_
3f20: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f  BinaryObjCmd: fo
3f30: 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62  rmat} {nonPortab
3f40: 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d  le macOrUnix} {.
3f50: 0a 2b 20 20 20 20 73 65 74 20 61 20 7b 30 78 35  .+    set a {0x5
3f60: 30 20 30 78 35 31 7d 0d 0a 2b 20 20 20 20 62 69  0 0x51}..+    bi
3f70: 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 31 20 24  nary format t1 $
3f80: 61 0d 0a 2b 7d 20 5c 78 30 30 50 0d 0a 2b 74 65  a..+} \x00P..+te
3f90: 73 74 20 62 69 6e 61 72 79 2d 34 38 2e 31 38 20  st binary-48.18 
3fa0: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
3fb0: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50  d: format} {nonP
3fc0: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20  ortable pcOnly} 
3fd0: 7b 0d 0a 2b 20 20 20 20 73 65 74 20 61 20 7b 30  {..+    set a {0
3fe0: 78 35 30 20 30 78 35 31 7d 0d 0a 2b 20 20 20 20  x50 0x51}..+    
3ff0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 74 31  binary format t1
4000: 20 24 61 0d 0a 2b 7d 20 50 5c 78 30 30 0d 0a 2b   $a..+} P\x00..+
4010: 0d 0a 2b 23 20 66 6f 72 6d 61 74 20 6e 0d 0a 2b  ..+# format n..+
4020: 74 65 73 74 20 62 69 6e 61 72 79 2d 34 39 2e 31  test binary-49.1
4030: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
4040: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b  md: format} {..+
4050: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
4060: 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 6e  {binary format n
4070: 7d 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20  } msg] $msg..+} 
4080: 7b 31 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 20 61  {1 {not enough a
4090: 72 67 75 6d 65 6e 74 73 20 66 6f 72 20 61 6c 6c  rguments for all
40a0: 20 66 6f 72 6d 61 74 20 73 70 65 63 69 66 69 65   format specifie
40b0: 72 73 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61  rs}}..+test bina
40c0: 72 79 2d 34 39 2e 32 20 7b 54 63 6c 5f 42 69 6e  ry-49.2 {Tcl_Bin
40d0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
40e0: 74 7d 20 7b 0d 0a 2b 20 20 20 20 6c 69 73 74 20  t} {..+    list 
40f0: 5b 63 61 74 63 68 20 7b 62 69 6e 61 72 79 20 66  [catch {binary f
4100: 6f 72 6d 61 74 20 6e 20 62 6c 61 74 7d 20 6d 73  ormat n blat} ms
4110: 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b  g] $msg..+} {1 {
4120: 65 78 70 65 63 74 65 64 20 69 6e 74 65 67 65 72  expected integer
4130: 20 62 75 74 20 67 6f 74 20 22 62 6c 61 74 22 7d   but got "blat"}
4140: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
4150: 34 39 2e 33 20 7b 54 63 6c 5f 42 69 6e 61 72 79  49.3 {Tcl_Binary
4160: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
4170: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
4180: 6f 72 6d 61 74 20 6e 30 20 30 78 35 30 0d 0a 2b  ormat n0 0x50..+
4190: 7d 20 7b 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61  } {}..+test bina
41a0: 72 79 2d 34 39 2e 34 20 7b 54 63 6c 5f 42 69 6e  ry-49.4 {Tcl_Bin
41b0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
41c0: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
41d0: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
41e0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 6e 20  binary format n 
41f0: 30 78 35 30 0d 0a 2b 7d 20 50 5c 78 30 30 5c 78  0x50..+} P\x00\x
4200: 30 30 5c 78 30 30 0d 0a 2b 74 65 73 74 20 62 69  00\x00..+test bi
4210: 6e 61 72 79 2d 34 39 2e 35 20 7b 54 63 6c 5f 42  nary-49.5 {Tcl_B
4220: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
4230: 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c  mat} {nonPortabl
4240: 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20  e pcOnly} {..+  
4250: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20    binary format 
4260: 6e 20 30 78 35 30 35 32 0d 0a 2b 7d 20 52 50 5c  n 0x5052..+} RP\
4270: 78 30 30 5c 78 30 30 0d 0a 2b 74 65 73 74 20 62  x00\x00..+test b
4280: 69 6e 61 72 79 2d 34 39 2e 36 20 7b 54 63 6c 5f  inary-49.6 {Tcl_
4290: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f  BinaryObjCmd: fo
42a0: 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62  rmat} {nonPortab
42b0: 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20  le pcOnly} {..+ 
42c0: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74     binary format
42d0: 20 6e 20 30 78 35 30 35 32 35 31 20 30 78 35 33   n 0x505251 0x53
42e0: 0d 0a 2b 7d 20 51 52 50 5c 78 30 30 0d 0a 2b 74  ..+} QRP\x00..+t
42f0: 65 73 74 20 62 69 6e 61 72 79 2d 34 39 2e 37 20  est binary-49.7 
4300: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
4310: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50  d: format} {nonP
4320: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20  ortable pcOnly} 
4330: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
4340: 6f 72 6d 61 74 20 69 31 20 7b 30 78 35 30 35 32  ormat i1 {0x5052
4350: 35 31 20 30 78 35 33 7d 0d 0a 2b 7d 20 51 52 50  51 0x53}..+} QRP
4360: 5c 78 30 30 0d 0a 2b 74 65 73 74 20 62 69 6e 61  \x00..+test bina
4370: 72 79 2d 34 39 2e 38 20 7b 54 63 6c 5f 42 69 6e  ry-49.8 {Tcl_Bin
4380: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
4390: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
43a0: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
43b0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 6e 20  binary format n 
43c0: 30 78 35 33 35 32 35 31 35 30 0d 0a 2b 7d 20 50  0x53525150..+} P
43d0: 51 52 53 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  QRS..+test binar
43e0: 79 2d 34 39 2e 39 20 7b 54 63 6c 5f 42 69 6e 61  y-49.9 {Tcl_Bina
43f0: 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74  ryObjCmd: format
4400: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70  } {nonPortable p
4410: 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 62  cOnly} {..+    b
4420: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 6e 32 20  inary format n2 
4430: 7b 30 78 35 30 20 30 78 35 32 7d 0d 0a 2b 7d 20  {0x50 0x52}..+} 
4440: 50 5c 78 30 30 5c 78 30 30 5c 78 30 30 52 5c 78  P\x00\x00\x00R\x
4450: 30 30 5c 78 30 30 5c 78 30 30 0d 0a 2b 74 65 73  00\x00\x00..+tes
4460: 74 20 62 69 6e 61 72 79 2d 34 39 2e 31 30 20 7b  t binary-49.10 {
4470: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
4480: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f  : format} {nonPo
4490: 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b  rtable pcOnly} {
44a0: 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f  ..+    binary fo
44b0: 72 6d 61 74 20 6e 2a 20 7b 30 78 35 30 35 31 35  rmat n* {0x50515
44c0: 32 35 33 20 30 78 35 32 7d 0d 0a 2b 7d 20 53 52  253 0x52}..+} SR
44d0: 51 50 52 5c 78 30 30 5c 78 30 30 5c 78 30 30 0d  QPR\x00\x00\x00.
44e0: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34 39  .+test binary-49
44f0: 2e 31 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  .11 {Tcl_BinaryO
4500: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b  bjCmd: format} {
4510: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74  ..+    list [cat
4520: 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61  ch {binary forma
4530: 74 20 6e 32 20 7b 30 78 35 30 7d 7d 20 6d 73 67  t n2 {0x50}} msg
4540: 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b 6e  ] $msg..+} {1 {n
4550: 75 6d 62 65 72 20 6f 66 20 65 6c 65 6d 65 6e 74  umber of element
4560: 73 20 69 6e 20 6c 69 73 74 20 64 6f 65 73 20 6e  s in list does n
4570: 6f 74 20 6d 61 74 63 68 20 63 6f 75 6e 74 7d 7d  ot match count}}
4580: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34  ..+test binary-4
4590: 39 2e 31 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79  9.12 {Tcl_Binary
45a0: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
45b0: 7b 0d 0a 2b 20 20 20 20 73 65 74 20 61 20 7b 30  {..+    set a {0
45c0: 78 35 30 20 30 78 35 31 7d 0d 0a 2b 20 20 20 20  x50 0x51}..+    
45d0: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
45e0: 61 72 79 20 66 6f 72 6d 61 74 20 6e 20 24 61 7d  ary format n $a}
45f0: 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 5b   msg] $msg..+} [
4600: 6c 69 73 74 20 31 20 22 65 78 70 65 63 74 65 64  list 1 "expected
4610: 20 69 6e 74 65 67 65 72 20 62 75 74 20 67 6f 74   integer but got
4620: 20 5c 22 30 78 35 30 20 30 78 35 31 5c 22 22 5d   \"0x50 0x51\""]
4630: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34  ..+test binary-4
4640: 39 2e 31 33 20 7b 54 63 6c 5f 42 69 6e 61 72 79  9.13 {Tcl_Binary
4650: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
4660: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f  {nonPortable pcO
4670: 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 73 65 74  nly} {..+    set
4680: 20 61 20 7b 30 78 35 30 20 30 78 35 31 7d 0d 0a   a {0x50 0x51}..
4690: 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d  +    binary form
46a0: 61 74 20 6e 31 20 24 61 0d 0a 2b 7d 20 50 5c 78  at n1 $a..+} P\x
46b0: 30 30 5c 78 30 30 5c 78 30 30 0d 0a 2b 74 65 73  00\x00\x00..+tes
46c0: 74 20 62 69 6e 61 72 79 2d 34 39 2e 31 34 20 7b  t binary-49.14 {
46d0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
46e0: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f  : format} {nonPo
46f0: 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78  rtable macOrUnix
4700: 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79  } {..+    binary
4710: 20 66 6f 72 6d 61 74 20 6e 20 30 78 35 30 0d 0a   format n 0x50..
4720: 2b 7d 20 5c 78 30 30 5c 78 30 30 5c 78 30 30 50  +} \x00\x00\x00P
4730: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34  ..+test binary-4
4740: 39 2e 31 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79  9.15 {Tcl_Binary
4750: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
4760: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63  {nonPortable mac
4770: 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20  OrUnix} {..+    
4780: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 6e 20  binary format n 
4790: 30 78 35 30 35 32 0d 0a 2b 7d 20 5c 78 30 30 5c  0x5052..+} \x00\
47a0: 78 30 30 50 52 0d 0a 2b 74 65 73 74 20 62 69 6e  x00PR..+test bin
47b0: 61 72 79 2d 34 39 2e 31 36 20 7b 54 63 6c 5f 42  ary-49.16 {Tcl_B
47c0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
47d0: 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c  mat} {nonPortabl
47e0: 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a  e macOrUnix} {..
47f0: 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d  +    binary form
4800: 61 74 20 6e 20 30 78 35 30 35 32 35 31 20 30 78  at n 0x505251 0x
4810: 35 33 0d 0a 2b 7d 20 5c 78 30 30 50 52 51 0d 0a  53..+} \x00PRQ..
4820: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 34 39 2e  +test binary-49.
4830: 31 37 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  17 {Tcl_BinaryOb
4840: 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e  jCmd: format} {n
4850: 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72  onPortable macOr
4860: 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69  Unix} {..+    bi
4870: 6e 61 72 79 20 66 6f 72 6d 61 74 20 69 31 20 7b  nary format i1 {
4880: 30 78 35 30 35 32 35 31 20 30 78 35 33 7d 0d 0a  0x505251 0x53}..
4890: 2b 7d 20 51 52 50 5c 78 30 30 0d 0a 2b 74 65 73  +} QRP\x00..+tes
48a0: 74 20 62 69 6e 61 72 79 2d 34 39 2e 31 38 20 7b  t binary-49.18 {
48b0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
48c0: 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f  : format} {nonPo
48d0: 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78  rtable macOrUnix
48e0: 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79  } {..+    binary
48f0: 20 66 6f 72 6d 61 74 20 6e 20 30 78 35 33 35 32   format n 0x5352
4900: 35 31 35 30 0d 0a 2b 7d 20 53 52 51 50 0d 0a 2b  5150..+} SRQP..+
4910: 74 65 73 74 20 62 69 6e 61 72 79 2d 34 39 2e 31  test binary-49.1
4920: 39 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a  9 {Tcl_BinaryObj
4930: 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 6e 6f  Cmd: format} {no
4940: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55  nPortable macOrU
4950: 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e  nix} {..+    bin
4960: 61 72 79 20 66 6f 72 6d 61 74 20 6e 32 20 7b 30  ary format n2 {0
4970: 78 35 30 20 30 78 35 32 7d 0d 0a 2b 7d 20 5c 78  x50 0x52}..+} \x
4980: 30 30 5c 78 30 30 5c 78 30 30 50 5c 78 30 30 5c  00\x00\x00P\x00\
4990: 78 30 30 5c 78 30 30 52 0d 0a 2b 74 65 73 74 20  x00\x00R..+test 
49a0: 62 69 6e 61 72 79 2d 34 39 2e 32 30 20 7b 54 63  binary-49.20 {Tc
49b0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
49c0: 66 6f 72 6d 61 74 7d 20 7b 6e 6f 6e 50 6f 72 74  format} {nonPort
49d0: 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20  able macOrUnix} 
49e0: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
49f0: 6f 72 6d 61 74 20 6e 2a 20 7b 30 78 35 30 35 31  ormat n* {0x5051
4a00: 35 32 35 33 20 30 78 35 32 7d 0d 0a 2b 7d 20 50  5253 0x52}..+} P
4a10: 51 52 53 5c 78 30 30 5c 78 30 30 5c 78 30 30 52  QRS\x00\x00\x00R
4a20: 0d 0a 2b 0d 0a 2b 23 20 66 6f 72 6d 61 74 20 6d  ..+..+# format m
4a30: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35  ..+test binary-5
4a40: 30 2e 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  0.1 {Tcl_BinaryO
4a50: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 20 77 69  bjCmd: format wi
4a60: 64 65 20 69 6e 74 7d 20 7b 6e 6f 6e 50 6f 72 74  de int} {nonPort
4a70: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a  able pcOnly} {..
4a80: 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d  +    binary form
4a90: 61 74 20 6d 20 37 38 31 30 31 37 39 30 31 36 33  at m 78101790163
4aa0: 32 37 37 31 38 32 31 36 0d 0a 2b 7d 20 48 65 6c  27718216..+} Hel
4ab0: 6c 6f 54 63 6c 0d 0a 2b 74 65 73 74 20 62 69 6e  loTcl..+test bin
4ac0: 61 72 79 2d 35 30 2e 32 20 7b 54 63 6c 5f 42 69  ary-50.2 {Tcl_Bi
4ad0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d  naryObjCmd: form
4ae0: 61 74 20 77 69 64 65 20 69 6e 74 7d 20 7b 6e 6f  at wide int} {no
4af0: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55  nPortable macOrU
4b00: 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e  nix} {..+    bin
4b10: 61 72 79 20 66 6f 72 6d 61 74 20 6d 20 37 38 31  ary format m 781
4b20: 30 31 37 39 30 31 36 33 32 37 37 31 38 32 31 36  0179016327718216
4b30: 0d 0a 2b 7d 20 6c 63 54 6f 6c 6c 65 48 0d 0a 2b  ..+} lcTolleH..+
4b40: 74 65 73 74 20 62 69 6e 61 72 79 2d 35 30 2e 33  test binary-50.3
4b50: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
4b60: 6d 64 3a 20 73 63 61 6e 20 77 69 64 65 20 69 6e  md: scan wide in
4b70: 74 20 77 69 74 68 20 62 69 74 20 33 31 20 73 65  t with bit 31 se
4b80: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
4b90: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
4ba0: 62 69 6e 61 72 79 20 73 63 61 6e 20 5b 62 69 6e  binary scan [bin
4bb0: 61 72 79 20 66 6f 72 6d 61 74 20 6d 20 5b 65 78  ary format m [ex
4bc0: 70 72 20 7b 77 69 64 65 28 33 29 20 3c 3c 20 33  pr {wide(3) << 3
4bd0: 31 7d 5d 5d 20 77 20 78 0d 0a 2b 20 20 20 20 73  1}]] w x..+    s
4be0: 65 74 20 78 0d 0a 2b 7d 20 36 34 34 32 34 35 30  et x..+} 6442450
4bf0: 39 34 34 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  944..+test binar
4c00: 79 2d 35 30 2e 34 20 7b 54 63 6c 5f 42 69 6e 61  y-50.4 {Tcl_Bina
4c10: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 20 77  ryObjCmd: scan w
4c20: 69 64 65 20 69 6e 74 20 77 69 74 68 20 62 69 74  ide int with bit
4c30: 20 33 31 20 73 65 74 7d 20 7b 6e 6f 6e 50 6f 72   31 set} {nonPor
4c40: 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d  table macOrUnix}
4c50: 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20   {..+    binary 
4c60: 73 63 61 6e 20 5b 62 69 6e 61 72 79 20 66 6f 72  scan [binary for
4c70: 6d 61 74 20 6d 20 5b 65 78 70 72 20 7b 77 69 64  mat m [expr {wid
4c80: 65 28 33 29 20 3c 3c 20 33 31 7d 5d 5d 20 57 20  e(3) << 31}]] W 
4c90: 78 0d 0a 2b 20 20 20 20 73 65 74 20 78 0d 0a 2b  x..+    set x..+
4ca0: 7d 20 36 34 34 32 34 35 30 39 34 34 0d 0a 2b 0d  } 6442450944..+.
4cb0: 0a 2b 0d 0a 2b 23 20 66 6f 72 6d 61 74 20 51 2f  .+..+# format Q/
4cc0: 71 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  q..+test binary-
4cd0: 35 31 2e 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79  51.1 {Tcl_Binary
4ce0: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
4cf0: 7b 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61  {..+    list [ca
4d00: 74 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d  tch {binary form
4d10: 61 74 20 51 7d 20 6d 73 67 5d 20 24 6d 73 67 0d  at Q} msg] $msg.
4d20: 0a 2b 7d 20 7b 31 20 7b 6e 6f 74 20 65 6e 6f 75  .+} {1 {not enou
4d30: 67 68 20 61 72 67 75 6d 65 6e 74 73 20 66 6f 72  gh arguments for
4d40: 20 61 6c 6c 20 66 6f 72 6d 61 74 20 73 70 65 63   all format spec
4d50: 69 66 69 65 72 73 7d 7d 0d 0a 2b 74 65 73 74 20  ifiers}}..+test 
4d60: 62 69 6e 61 72 79 2d 35 31 2e 32 20 7b 54 63 6c  binary-51.2 {Tcl
4d70: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66  _BinaryObjCmd: f
4d80: 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20 6c  ormat} {..+    l
4d90: 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e 61  ist [catch {bina
4da0: 72 79 20 66 6f 72 6d 61 74 20 71 20 62 6c 61 74  ry format q blat
4db0: 7d 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20  } msg] $msg..+} 
4dc0: 7b 31 20 7b 65 78 70 65 63 74 65 64 20 66 6c 6f  {1 {expected flo
4dd0: 61 74 69 6e 67 2d 70 6f 69 6e 74 20 6e 75 6d 62  ating-point numb
4de0: 65 72 20 62 75 74 20 67 6f 74 20 22 62 6c 61 74  er but got "blat
4df0: 22 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  "}}..+test binar
4e00: 79 2d 35 31 2e 33 20 7b 54 63 6c 5f 42 69 6e 61  y-51.3 {Tcl_Bina
4e10: 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74  ryObjCmd: format
4e20: 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79  } {..+    binary
4e30: 20 66 6f 72 6d 61 74 20 71 30 20 31 2e 36 0d 0a   format q0 1.6..
4e40: 2b 7d 20 7b 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  +} {}..+test bin
4e50: 61 72 79 2d 35 31 2e 34 20 7b 54 63 6c 5f 42 69  ary-51.4 {Tcl_Bi
4e60: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d  naryObjCmd: form
4e70: 61 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62  at} {} {..+    b
4e80: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 51 20 31  inary format Q 1
4e90: 2e 36 0d 0a 2b 7d 20 5c 78 33 66 5c 78 66 39 5c  .6..+} \x3f\xf9\
4ea0: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  x99\x99\x99\x99\
4eb0: 78 39 39 5c 78 39 61 0d 0a 2b 74 65 73 74 20 62  x99\x9a..+test b
4ec0: 69 6e 61 72 79 2d 35 31 2e 35 20 7b 54 63 6c 5f  inary-51.5 {Tcl_
4ed0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f  BinaryObjCmd: fo
4ee0: 72 6d 61 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20  rmat} {} {..+   
4ef0: 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 71   binary format q
4f00: 20 31 2e 36 0d 0a 2b 7d 20 5c 78 39 61 5c 78 39   1.6..+} \x9a\x9
4f10: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39  9\x99\x99\x99\x9
4f20: 39 5c 78 66 39 5c 78 33 66 0d 0a 2b 74 65 73 74  9\xf9\x3f..+test
4f30: 20 62 69 6e 61 72 79 2d 35 31 2e 36 20 7b 54 63   binary-51.6 {Tc
4f40: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
4f50: 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b 0d 0a 2b 20  format} {} {..+ 
4f60: 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74     binary format
4f70: 20 51 2a 20 7b 31 2e 36 20 33 2e 34 7d 0d 0a 2b   Q* {1.6 3.4}..+
4f80: 7d 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78  } \x3f\xf9\x99\x
4f90: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78  99\x99\x99\x99\x
4fa0: 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33 5c 78  9a\x40\x0b\x33\x
4fb0: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78  33\x33\x33\x33\x
4fc0: 33 33 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  33..+test binary
4fd0: 2d 35 31 2e 37 20 7b 54 63 6c 5f 42 69 6e 61 72  -51.7 {Tcl_Binar
4fe0: 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d  yObjCmd: format}
4ff0: 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61   {} {..+    bina
5000: 72 79 20 66 6f 72 6d 61 74 20 71 2a 20 7b 31 2e  ry format q* {1.
5010: 36 20 33 2e 34 7d 0d 0a 2b 7d 20 5c 78 39 61 5c  6 3.4}..+} \x9a\
5020: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  x99\x99\x99\x99\
5030: 78 39 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 5c  x99\xf9\x3f\x33\
5040: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c  x33\x33\x33\x33\
5050: 78 33 33 5c 78 30 62 5c 78 34 30 0d 0a 2b 74 65  x33\x0b\x40..+te
5060: 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 38 20 7b  st binary-51.8 {
5070: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
5080: 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b 0d 0a  : format} {} {..
5090: 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d  +    binary form
50a0: 61 74 20 51 32 20 7b 31 2e 36 20 33 2e 34 7d 0d  at Q2 {1.6 3.4}.
50b0: 0a 2b 7d 20 5c 78 33 66 5c 78 66 39 5c 78 39 39  .+} \x3f\xf9\x99
50c0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39  \x99\x99\x99\x99
50d0: 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c 78 33 33  \x9a\x40\x0b\x33
50e0: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33  \x33\x33\x33\x33
50f0: 5c 78 33 33 0d 0a 2b 74 65 73 74 20 62 69 6e 61  \x33..+test bina
5100: 72 79 2d 35 31 2e 39 20 7b 54 63 6c 5f 42 69 6e  ry-51.9 {Tcl_Bin
5110: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
5120: 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62 69  t} {} {..+    bi
5130: 6e 61 72 79 20 66 6f 72 6d 61 74 20 71 32 20 7b  nary format q2 {
5140: 31 2e 36 20 33 2e 34 7d 0d 0a 2b 7d 20 5c 78 39  1.6 3.4}..+} \x9
5150: 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39  a\x99\x99\x99\x9
5160: 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 5c 78 33  9\x99\xf9\x3f\x3
5170: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33  3\x33\x33\x33\x3
5180: 33 5c 78 33 33 5c 78 30 62 5c 78 34 30 0d 0a 2b  3\x33\x0b\x40..+
5190: 74 65 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 31  test binary-51.1
51a0: 30 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a  0 {Tcl_BinaryObj
51b0: 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20  Cmd: format} {} 
51c0: 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66  {..+    binary f
51d0: 6f 72 6d 61 74 20 51 32 20 7b 31 2e 36 20 33 2e  ormat Q2 {1.6 3.
51e0: 34 20 35 2e 36 7d 0d 0a 2b 7d 20 5c 78 33 66 5c  4 5.6}..+} \x3f\
51f0: 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  xf9\x99\x99\x99\
5200: 78 39 39 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c  x99\x99\x9a\x40\
5210: 78 30 62 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c  x0b\x33\x33\x33\
5220: 78 33 33 5c 78 33 33 5c 78 33 33 0d 0a 2b 74 65  x33\x33\x33..+te
5230: 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 31 31 20  st binary-51.11 
5240: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
5250: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b 0d  d: format} {} {.
5260: 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72  .+    binary for
5270: 6d 61 74 20 71 32 20 7b 31 2e 36 20 33 2e 34 20  mat q2 {1.6 3.4 
5280: 35 2e 36 7d 0d 0a 2b 7d 20 5c 78 39 61 5c 78 39  5.6}..+} \x9a\x9
5290: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39  9\x99\x99\x99\x9
52a0: 39 5c 78 66 39 5c 78 33 66 5c 78 33 33 5c 78 33  9\xf9\x3f\x33\x3
52b0: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33  3\x33\x33\x33\x3
52c0: 33 5c 78 30 62 5c 78 34 30 0d 0a 2b 23 74 65 73  3\x0b\x40..+#tes
52d0: 74 20 62 69 6e 61 72 79 2d 35 31 2e 31 32 20 7b  t binary-51.12 {
52e0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
52f0: 3a 20 66 6c 6f 61 74 20 6f 76 65 72 66 6c 6f 77  : float overflow
5300: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 75  } {nonPortable u
5310: 6e 69 78 4f 6e 6c 79 7d 20 7b 0d 0a 2b 23 20 20  nixOnly} {..+#  
5320: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20    binary format 
5330: 64 20 4e 61 4e 0d 0a 2b 23 7d 20 5c 78 37 66 5c  d NaN..+#} \x7f\
5340: 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c  xff\xff\xff\xff\
5350: 78 66 66 5c 78 66 66 5c 78 66 66 0d 0a 2b 23 74  xff\xff\xff..+#t
5360: 65 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 31 33  est binary-51.13
5370: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
5380: 6d 64 3a 20 66 6c 6f 61 74 20 6f 76 65 72 66 6c  md: float overfl
5390: 6f 77 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65  ow} {nonPortable
53a0: 20 6d 61 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 23 20   macOnly} {..+# 
53b0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20    binary format 
53c0: 64 20 4e 61 4e 0d 0a 2b 23 7d 20 5c 78 37 66 5c  d NaN..+#} \x7f\
53d0: 78 66 38 5c 78 30 32 5c 78 61 30 5c 78 30 30 5c  xf8\x02\xa0\x00\
53e0: 78 30 30 5c 78 30 30 5c 78 30 30 0d 0a 2b 74 65  x00\x00\x00..+te
53f0: 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 31 34 20  st binary-51.14 
5400: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
5410: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20  d: format} {..+ 
5420: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b     list [catch {
5430: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 71 32  binary format q2
5440: 20 7b 31 2e 36 7d 7d 20 6d 73 67 5d 20 24 6d 73   {1.6}} msg] $ms
5450: 67 0d 0a 2b 7d 20 7b 31 20 7b 6e 75 6d 62 65 72  g..+} {1 {number
5460: 20 6f 66 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20   of elements in 
5470: 6c 69 73 74 20 64 6f 65 73 20 6e 6f 74 20 6d 61  list does not ma
5480: 74 63 68 20 63 6f 75 6e 74 7d 7d 0d 0a 2b 74 65  tch count}}..+te
5490: 73 74 20 62 69 6e 61 72 79 2d 35 31 2e 31 35 20  st binary-51.15 
54a0: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
54b0: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20  d: format} {..+ 
54c0: 20 20 20 73 65 74 20 61 20 7b 31 2e 36 20 33 2e     set a {1.6 3.
54d0: 34 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63  4}..+    list [c
54e0: 61 74 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72  atch {binary for
54f0: 6d 61 74 20 71 20 24 61 7d 20 6d 73 67 5d 20 24  mat q $a} msg] $
5500: 6d 73 67 0d 0a 2b 7d 20 5b 6c 69 73 74 20 31 20  msg..+} [list 1 
5510: 22 65 78 70 65 63 74 65 64 20 66 6c 6f 61 74 69  "expected floati
5520: 6e 67 2d 70 6f 69 6e 74 20 6e 75 6d 62 65 72 20  ng-point number 
5530: 62 75 74 20 67 6f 74 20 5c 22 31 2e 36 20 33 2e  but got \"1.6 3.
5540: 34 5c 22 22 5d 0d 0a 2b 74 65 73 74 20 62 69 6e  4\""]..+test bin
5550: 61 72 79 2d 35 31 2e 31 36 20 7b 54 63 6c 5f 42  ary-51.16 {Tcl_B
5560: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
5570: 6d 61 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20  mat} {} {..+    
5580: 73 65 74 20 61 20 7b 31 2e 36 20 33 2e 34 7d 0d  set a {1.6 3.4}.
5590: 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72  .+    binary for
55a0: 6d 61 74 20 51 31 20 24 61 0d 0a 2b 7d 20 5c 78  mat Q1 $a..+} \x
55b0: 33 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 5c 78  3f\xf9\x99\x99\x
55c0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 0d 0a  99\x99\x99\x9a..
55d0: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 31 2e  +test binary-51.
55e0: 31 37 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  17 {Tcl_BinaryOb
55f0: 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d  jCmd: format} {}
5600: 20 7b 0d 0a 2b 20 20 20 20 73 65 74 20 61 20 7b   {..+    set a {
5610: 31 2e 36 20 33 2e 34 7d 0d 0a 2b 20 20 20 20 62  1.6 3.4}..+    b
5620: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 71 31 20  inary format q1 
5630: 24 61 0d 0a 2b 7d 20 5c 78 39 61 5c 78 39 39 5c  $a..+} \x9a\x99\
5640: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  x99\x99\x99\x99\
5650: 78 66 39 5c 78 33 66 0d 0a 2b 0d 0a 2b 23 20 66  xf9\x3f..+..+# f
5660: 6f 72 6d 61 74 20 52 2f 72 0d 0a 2b 74 65 73 74  ormat R/r..+test
5670: 20 62 69 6e 61 72 79 2d 35 33 2e 31 20 7b 54 63   binary-53.1 {Tc
5680: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
5690: 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20 20  format} {..+    
56a0: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
56b0: 61 72 79 20 66 6f 72 6d 61 74 20 72 7d 20 6d 73  ary format r} ms
56c0: 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b  g] $msg..+} {1 {
56d0: 6e 6f 74 20 65 6e 6f 75 67 68 20 61 72 67 75 6d  not enough argum
56e0: 65 6e 74 73 20 66 6f 72 20 61 6c 6c 20 66 6f 72  ents for all for
56f0: 6d 61 74 20 73 70 65 63 69 66 69 65 72 73 7d 7d  mat specifiers}}
5700: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35  ..+test binary-5
5710: 33 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  3.2 {Tcl_BinaryO
5720: 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b  bjCmd: format} {
5730: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74  ..+    list [cat
5740: 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61  ch {binary forma
5750: 74 20 72 20 62 6c 61 74 7d 20 6d 73 67 5d 20 24  t r blat} msg] $
5760: 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b 65 78 70 65  msg..+} {1 {expe
5770: 63 74 65 64 20 66 6c 6f 61 74 69 6e 67 2d 70 6f  cted floating-po
5780: 69 6e 74 20 6e 75 6d 62 65 72 20 62 75 74 20 67  int number but g
5790: 6f 74 20 22 62 6c 61 74 22 7d 7d 0d 0a 2b 74 65  ot "blat"}}..+te
57a0: 73 74 20 62 69 6e 61 72 79 2d 35 33 2e 33 20 7b  st binary-53.3 {
57b0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
57c0: 3a 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20  : format} {..+  
57d0: 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20    binary format 
57e0: 66 30 20 31 2e 36 0d 0a 2b 7d 20 7b 7d 0d 0a 2b  f0 1.6..+} {}..+
57f0: 74 65 73 74 20 62 69 6e 61 72 79 2d 35 33 2e 34  test binary-53.4
5800: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
5810: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b  md: format} {} {
5820: 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f  ..+    binary fo
5830: 72 6d 61 74 20 52 20 31 2e 36 0d 0a 2b 7d 20 5c  rmat R 1.6..+} \
5840: 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 0d  x3f\xcc\xcc\xcd.
5850: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 33  .+test binary-53
5860: 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .5 {Tcl_BinaryOb
5870: 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d  jCmd: format} {}
5880: 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20   {..+    binary 
5890: 66 6f 72 6d 61 74 20 72 20 31 2e 36 0d 0a 2b 7d  format r 1.6..+}
58a0: 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 33   \xcd\xcc\xcc\x3
58b0: 66 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  f..+test binary-
58c0: 35 33 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79  53.6 {Tcl_Binary
58d0: 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74 7d 20  ObjCmd: format} 
58e0: 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72  {} {..+    binar
58f0: 79 20 66 6f 72 6d 61 74 20 52 2a 20 7b 31 2e 36  y format R* {1.6
5900: 20 33 2e 34 7d 0d 0a 2b 7d 20 5c 78 33 66 5c 78   3.4}..+} \x3f\x
5910: 63 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78  cc\xcc\xcd\x40\x
5920: 35 39 5c 78 39 39 5c 78 39 61 0d 0a 2b 74 65 73  59\x99\x9a..+tes
5930: 74 20 62 69 6e 61 72 79 2d 35 33 2e 37 20 7b 54  t binary-53.7 {T
5940: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a  cl_BinaryObjCmd:
5950: 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b 0d 0a 2b   format} {} {..+
5960: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
5970: 74 20 72 2a 20 7b 31 2e 36 20 33 2e 34 7d 0d 0a  t r* {1.6 3.4}..
5980: 2b 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c  +} \xcd\xcc\xcc\
5990: 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 39 5c  x3f\x9a\x99\x59\
59a0: 78 34 30 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  x40..+test binar
59b0: 79 2d 35 33 2e 38 20 7b 54 63 6c 5f 42 69 6e 61  y-53.8 {Tcl_Bina
59c0: 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61 74  ryObjCmd: format
59d0: 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e  } {} {..+    bin
59e0: 61 72 79 20 66 6f 72 6d 61 74 20 52 32 20 7b 31  ary format R2 {1
59f0: 2e 36 20 33 2e 34 7d 0d 0a 2b 7d 20 5c 78 33 66  .6 3.4}..+} \x3f
5a00: 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c 78 34 30  \xcc\xcc\xcd\x40
5a10: 5c 78 35 39 5c 78 39 39 5c 78 39 61 0d 0a 2b 74  \x59\x99\x9a..+t
5a20: 65 73 74 20 62 69 6e 61 72 79 2d 35 33 2e 39 20  est binary-53.9 
5a30: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
5a40: 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b 0d  d: format} {} {.
5a50: 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72  .+    binary for
5a60: 6d 61 74 20 72 32 20 7b 31 2e 36 20 33 2e 34 7d  mat r2 {1.6 3.4}
5a70: 0d 0a 2b 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63  ..+} \xcd\xcc\xc
5a80: 63 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35  c\x3f\x9a\x99\x5
5a90: 39 5c 78 34 30 0d 0a 2b 74 65 73 74 20 62 69 6e  9\x40..+test bin
5aa0: 61 72 79 2d 35 33 2e 31 30 20 7b 54 63 6c 5f 42  ary-53.10 {Tcl_B
5ab0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72  inaryObjCmd: for
5ac0: 6d 61 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20  mat} {} {..+    
5ad0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 52 32  binary format R2
5ae0: 20 7b 31 2e 36 20 33 2e 34 20 35 2e 36 7d 0d 0a   {1.6 3.4 5.6}..
5af0: 2b 7d 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c  +} \x3f\xcc\xcc\
5b00: 78 63 64 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c  xcd\x40\x59\x99\
5b10: 78 39 61 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  x9a..+test binar
5b20: 79 2d 35 33 2e 31 31 20 7b 54 63 6c 5f 42 69 6e  y-53.11 {Tcl_Bin
5b30: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
5b40: 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62 69  t} {} {..+    bi
5b50: 6e 61 72 79 20 66 6f 72 6d 61 74 20 72 32 20 7b  nary format r2 {
5b60: 31 2e 36 20 33 2e 34 20 35 2e 36 7d 0d 0a 2b 7d  1.6 3.4 5.6}..+}
5b70: 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 33   \xcd\xcc\xcc\x3
5b80: 66 5c 78 39 61 5c 78 39 39 5c 78 35 39 5c 78 34  f\x9a\x99\x59\x4
5b90: 30 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  0..+test binary-
5ba0: 35 33 2e 31 32 20 7b 54 63 6c 5f 42 69 6e 61 72  53.12 {Tcl_Binar
5bb0: 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f 61 74 20 6f  yObjCmd: float o
5bc0: 76 65 72 66 6c 6f 77 7d 20 7b 7d 20 7b 0d 0a 2b  verflow} {} {..+
5bd0: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
5be0: 74 20 52 20 2d 33 2e 34 30 32 38 32 35 65 2b 33  t R -3.402825e+3
5bf0: 38 0d 0a 2b 7d 20 5c 78 66 66 5c 78 37 66 5c 78  8..+} \xff\x7f\x
5c00: 66 66 5c 78 66 66 0d 0a 2b 74 65 73 74 20 62 69  ff\xff..+test bi
5c10: 6e 61 72 79 2d 35 33 2e 31 33 20 7b 54 63 6c 5f  nary-53.13 {Tcl_
5c20: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6c  BinaryObjCmd: fl
5c30: 6f 61 74 20 6f 76 65 72 66 6c 6f 77 7d 20 7b 7d  oat overflow} {}
5c40: 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79 20   {..+    binary 
5c50: 66 6f 72 6d 61 74 20 72 20 2d 33 2e 34 30 32 38  format r -3.4028
5c60: 32 35 65 2b 33 38 0d 0a 2b 7d 20 5c 78 66 66 5c  25e+38..+} \xff\
5c70: 78 66 66 5c 78 37 66 5c 78 66 66 0d 0a 2b 74 65  xff\x7f\xff..+te
5c80: 73 74 20 62 69 6e 61 72 79 2d 35 33 2e 31 34 20  st binary-53.14 
5c90: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
5ca0: 64 3a 20 66 6c 6f 61 74 20 75 6e 64 65 72 66 6c  d: float underfl
5cb0: 6f 77 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 62  ow} {} {..+    b
5cc0: 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 52 20 2d  inary format R -
5cd0: 33 2e 34 30 32 38 32 35 65 2d 31 30 30 0d 0a 2b  3.402825e-100..+
5ce0: 7d 20 5c 78 38 30 5c 78 30 30 5c 78 30 30 5c 78  } \x80\x00\x00\x
5cf0: 30 30 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  00..+test binary
5d00: 2d 35 33 2e 31 35 20 7b 54 63 6c 5f 42 69 6e 61  -53.15 {Tcl_Bina
5d10: 72 79 4f 62 6a 43 6d 64 3a 20 66 6c 6f 61 74 20  ryObjCmd: float 
5d20: 75 6e 64 65 72 66 6c 6f 77 7d 20 7b 7d 20 7b 0d  underflow} {} {.
5d30: 0a 2b 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72  .+    binary for
5d40: 6d 61 74 20 72 20 2d 33 2e 34 30 32 38 32 35 65  mat r -3.402825e
5d50: 2d 31 30 30 0d 0a 2b 7d 20 5c 78 30 30 5c 78 30  -100..+} \x00\x0
5d60: 30 5c 78 30 30 5c 78 38 30 0d 0a 2b 74 65 73 74  0\x00\x80..+test
5d70: 20 62 69 6e 61 72 79 2d 35 33 2e 31 36 20 7b 54   binary-53.16 {T
5d80: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a  cl_BinaryObjCmd:
5d90: 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20   format} {..+   
5da0: 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69   list [catch {bi
5db0: 6e 61 72 79 20 66 6f 72 6d 61 74 20 72 32 20 7b  nary format r2 {
5dc0: 31 2e 36 7d 7d 20 6d 73 67 5d 20 24 6d 73 67 0d  1.6}} msg] $msg.
5dd0: 0a 2b 7d 20 7b 31 20 7b 6e 75 6d 62 65 72 20 6f  .+} {1 {number o
5de0: 66 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 6c 69  f elements in li
5df0: 73 74 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63  st does not matc
5e00: 68 20 63 6f 75 6e 74 7d 7d 0d 0a 2b 74 65 73 74  h count}}..+test
5e10: 20 62 69 6e 61 72 79 2d 35 33 2e 31 37 20 7b 54   binary-53.17 {T
5e20: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a  cl_BinaryObjCmd:
5e30: 20 66 6f 72 6d 61 74 7d 20 7b 0d 0a 2b 20 20 20   format} {..+   
5e40: 20 73 65 74 20 61 20 7b 31 2e 36 20 33 2e 34 7d   set a {1.6 3.4}
5e50: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74  ..+    list [cat
5e60: 63 68 20 7b 62 69 6e 61 72 79 20 66 6f 72 6d 61  ch {binary forma
5e70: 74 20 72 20 24 61 7d 20 6d 73 67 5d 20 24 6d 73  t r $a} msg] $ms
5e80: 67 0d 0a 2b 7d 20 5b 6c 69 73 74 20 31 20 22 65  g..+} [list 1 "e
5e90: 78 70 65 63 74 65 64 20 66 6c 6f 61 74 69 6e 67  xpected floating
5ea0: 2d 70 6f 69 6e 74 20 6e 75 6d 62 65 72 20 62 75  -point number bu
5eb0: 74 20 67 6f 74 20 5c 22 31 2e 36 20 33 2e 34 5c  t got \"1.6 3.4\
5ec0: 22 22 5d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  ""]..+test binar
5ed0: 79 2d 35 33 2e 31 38 20 7b 54 63 6c 5f 42 69 6e  y-53.18 {Tcl_Bin
5ee0: 61 72 79 4f 62 6a 43 6d 64 3a 20 66 6f 72 6d 61  aryObjCmd: forma
5ef0: 74 7d 20 7b 7d 20 7b 0d 0a 2b 20 20 20 20 73 65  t} {} {..+    se
5f00: 74 20 61 20 7b 31 2e 36 20 33 2e 34 7d 0d 0a 2b  t a {1.6 3.4}..+
5f10: 20 20 20 20 62 69 6e 61 72 79 20 66 6f 72 6d 61      binary forma
5f20: 74 20 52 31 20 24 61 0d 0a 2b 7d 20 5c 78 33 66  t R1 $a..+} \x3f
5f30: 5c 78 63 63 5c 78 63 63 5c 78 63 64 0d 0a 2b 74  \xcc\xcc\xcd..+t
5f40: 65 73 74 20 62 69 6e 61 72 79 2d 35 33 2e 31 39  est binary-53.19
5f50: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
5f60: 6d 64 3a 20 66 6f 72 6d 61 74 7d 20 7b 7d 20 7b  md: format} {} {
5f70: 0d 0a 2b 20 20 20 20 73 65 74 20 61 20 7b 31 2e  ..+    set a {1.
5f80: 36 20 33 2e 34 7d 0d 0a 2b 20 20 20 20 62 69 6e  6 3.4}..+    bin
5f90: 61 72 79 20 66 6f 72 6d 61 74 20 72 31 20 24 61  ary format r1 $a
5fa0: 0d 0a 2b 7d 20 5c 78 63 64 5c 78 63 63 5c 78 63  ..+} \xcd\xcc\xc
5fb0: 63 5c 78 33 66 0d 0a 2b 0d 0a 2b 23 20 73 63 61  c\x3f..+..+# sca
5fc0: 6e 20 74 20 28 73 29 0d 0a 2b 74 65 73 74 20 62  n t (s)..+test b
5fd0: 69 6e 61 72 79 2d 35 34 2e 31 20 7b 54 63 6c 5f  inary-54.1 {Tcl_
5fe0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63  BinaryObjCmd: sc
5ff0: 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20 6c 69 73 74  an} {..+    list
6000: 20 5b 63 61 74 63 68 20 7b 62 69 6e 61 72 79 20   [catch {binary 
6010: 73 63 61 6e 20 61 62 63 20 74 7d 20 6d 73 67 5d  scan abc t} msg]
6020: 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b 6e 6f   $msg..+} {1 {no
6030: 74 20 65 6e 6f 75 67 68 20 61 72 67 75 6d 65 6e  t enough argumen
6040: 74 73 20 66 6f 72 20 61 6c 6c 20 66 6f 72 6d 61  ts for all forma
6050: 74 20 73 70 65 63 69 66 69 65 72 73 7d 7d 0d 0a  t specifiers}}..
6060: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 34 2e  +test binary-54.
6070: 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a  2 {Tcl_BinaryObj
6080: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50  Cmd: scan} {nonP
6090: 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20  ortable pcOnly} 
60a0: 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75  {..+    catch {u
60b0: 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20  nset arg1}..+   
60c0: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63   list [binary sc
60d0: 61 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35 33 5c  an \x52\xa3\x53\
60e0: 78 35 34 20 74 2a 20 61 72 67 31 5d 20 24 61 72  x54 t* arg1] $ar
60f0: 67 31 0d 0a 2b 7d 20 7b 31 20 7b 2d 32 33 37 32  g1..+} {1 {-2372
6100: 36 20 32 31 35 38 37 7d 7d 0d 0a 2b 74 65 73 74  6 21587}}..+test
6110: 20 62 69 6e 61 72 79 2d 35 34 2e 33 20 7b 54 63   binary-54.3 {Tc
6120: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
6130: 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62  scan} {nonPortab
6140: 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20  le pcOnly} {..+ 
6150: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20     catch {unset 
6160: 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74  arg1}..+    list
6170: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78   [binary scan \x
6180: 35 32 5c 78 61 33 5c 78 35 33 5c 78 35 34 20 74  52\xa3\x53\x54 t
6190: 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d   arg1] $arg1..+}
61a0: 20 7b 31 20 2d 32 33 37 32 36 7d 0d 0a 2b 74 65   {1 -23726}..+te
61b0: 73 74 20 62 69 6e 61 72 79 2d 35 34 2e 34 20 7b  st binary-54.4 {
61c0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
61d0: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74  : scan} {nonPort
61e0: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a  able pcOnly} {..
61f0: 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65  +    catch {unse
6200: 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69  t arg1}..+    li
6210: 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20  st [binary scan 
6220: 5c 78 35 32 5c 78 61 33 20 74 31 20 61 72 67 31  \x52\xa3 t1 arg1
6230: 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 2d  ] $arg1..+} {1 -
6240: 32 33 37 32 36 7d 0d 0a 2b 74 65 73 74 20 62 69  23726}..+test bi
6250: 6e 61 72 79 2d 35 34 2e 35 20 7b 54 63 6c 5f 42  nary-54.5 {Tcl_B
6260: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
6270: 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  n} {nonPortable 
6280: 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20  pcOnly} {..+    
6290: 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67  catch {unset arg
62a0: 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62  1}..+    list [b
62b0: 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c  inary scan \x52\
62c0: 78 61 33 20 74 30 20 61 72 67 31 5d 20 24 61 72  xa3 t0 arg1] $ar
62d0: 67 31 0d 0a 2b 7d 20 7b 31 20 7b 7d 7d 0d 0a 2b  g1..+} {1 {}}..+
62e0: 74 65 73 74 20 62 69 6e 61 72 79 2d 35 34 2e 36  test binary-54.6
62f0: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
6300: 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f  md: scan} {nonPo
6310: 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b  rtable pcOnly} {
6320: 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e  ..+    catch {un
6330: 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20  set arg1}..+    
6340: 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61  list [binary sca
6350: 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35 33 5c 78  n \x52\xa3\x53\x
6360: 35 34 20 74 32 20 61 72 67 31 5d 20 24 61 72 67  54 t2 arg1] $arg
6370: 31 0d 0a 2b 7d 20 7b 31 20 7b 2d 32 33 37 32 36  1..+} {1 {-23726
6380: 20 32 31 35 38 37 7d 7d 0d 0a 2b 74 65 73 74 20   21587}}..+test 
6390: 62 69 6e 61 72 79 2d 35 34 2e 37 20 7b 54 63 6c  binary-54.7 {Tcl
63a0: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73  _BinaryObjCmd: s
63b0: 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c  can} {nonPortabl
63c0: 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20  e pcOnly} {..+  
63d0: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61    catch {unset a
63e0: 72 67 31 7d 0d 0a 2b 20 20 20 20 73 65 74 20 61  rg1}..+    set a
63f0: 72 67 31 20 66 6f 6f 0d 0a 2b 20 20 20 20 6c 69  rg1 foo..+    li
6400: 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20  st [binary scan 
6410: 5c 78 35 32 20 74 31 20 61 72 67 31 5d 20 24 61  \x52 t1 arg1] $a
6420: 72 67 31 0d 0a 2b 7d 20 7b 30 20 66 6f 6f 7d 0d  rg1..+} {0 foo}.
6430: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 34  .+test binary-54
6440: 2e 38 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .8 {Tcl_BinaryOb
6450: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 7d 20 7b  jCmd: scan} {} {
6460: 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e  ..+    catch {un
6470: 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20  set arg1}..+    
6480: 73 65 74 20 61 72 67 31 20 31 0d 0a 2b 20 20 20  set arg1 1..+   
6490: 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69   list [catch {bi
64a0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78  nary scan \x52\x
64b0: 35 33 20 74 31 20 61 72 67 31 28 61 29 7d 20 6d  53 t1 arg1(a)} m
64c0: 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20  sg] $msg..+} {1 
64d0: 7b 63 61 6e 27 74 20 73 65 74 20 22 61 72 67 31  {can't set "arg1
64e0: 28 61 29 22 3a 20 76 61 72 69 61 62 6c 65 20 69  (a)": variable i
64f0: 73 6e 27 74 20 61 72 72 61 79 7d 7d 0d 0a 2b 74  sn't array}}..+t
6500: 65 73 74 20 62 69 6e 61 72 79 2d 35 34 2e 39 20  est binary-54.9 
6510: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
6520: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72  d: scan} {nonPor
6530: 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d  table pcOnly} {.
6540: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73  .+    catch {uns
6550: 65 74 20 61 72 67 31 20 61 72 67 32 7d 0d 0a 2b  et arg1 arg2}..+
6560: 20 20 20 20 73 65 74 20 61 72 67 31 20 66 6f 6f      set arg1 foo
6570: 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67 32 20  ..+    set arg2 
6580: 62 61 72 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b  bar..+    list [
6590: 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32  binary scan \x52
65a0: 5c 78 61 33 5c 78 35 33 5c 78 35 34 5c 78 30 35  \xa3\x53\x54\x05
65b0: 20 74 32 63 2a 20 61 72 67 31 20 61 72 67 32 5d   t2c* arg1 arg2]
65c0: 20 24 61 72 67 31 20 24 61 72 67 32 0d 0a 2b 7d   $arg1 $arg2..+}
65d0: 20 7b 32 20 7b 2d 32 33 37 32 36 20 32 31 35 38   {2 {-23726 2158
65e0: 37 7d 20 35 7d 0d 0a 2b 0d 0a 2b 23 20 73 63 61  7} 5}..+..+# sca
65f0: 6e 20 74 20 28 62 29 0d 0a 2b 74 65 73 74 20 62  n t (b)..+test b
6600: 69 6e 61 72 79 2d 35 35 2e 31 20 7b 54 63 6c 5f  inary-55.1 {Tcl_
6610: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63  BinaryObjCmd: sc
6620: 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20 6c 69 73 74  an} {..+    list
6630: 20 5b 63 61 74 63 68 20 7b 62 69 6e 61 72 79 20   [catch {binary 
6640: 73 63 61 6e 20 61 62 63 20 74 7d 20 6d 73 67 5d  scan abc t} msg]
6650: 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b 6e 6f   $msg..+} {1 {no
6660: 74 20 65 6e 6f 75 67 68 20 61 72 67 75 6d 65 6e  t enough argumen
6670: 74 73 20 66 6f 72 20 61 6c 6c 20 66 6f 72 6d 61  ts for all forma
6680: 74 20 73 70 65 63 69 66 69 65 72 73 7d 7d 0d 0a  t specifiers}}..
6690: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 35 2e  +test binary-55.
66a0: 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a  2 {Tcl_BinaryObj
66b0: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50  Cmd: scan} {nonP
66c0: 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69  ortable macOrUni
66d0: 78 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63  x}  {..+    catc
66e0: 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a  h {unset arg1}..
66f0: 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72  +    list [binar
6700: 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c  y scan \x52\xa3\
6710: 78 35 33 5c 78 35 34 20 74 2a 20 61 72 67 31 5d  x53\x54 t* arg1]
6720: 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 32   $arg1..+} {1 {2
6730: 31 31 35 35 20 32 31 33 33 32 7d 7d 0d 0a 2b 74  1155 21332}}..+t
6740: 65 73 74 20 62 69 6e 61 72 79 2d 35 35 2e 33 20  est binary-55.3 
6750: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
6760: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72  d: scan} {nonPor
6770: 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d  table macOrUnix}
6780: 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20    {..+    catch 
6790: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20  {unset arg1}..+ 
67a0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20     list [binary 
67b0: 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35  scan \x52\xa3\x5
67c0: 33 5c 78 35 34 20 74 20 61 72 67 31 5d 20 24 61  3\x54 t arg1] $a
67d0: 72 67 31 0d 0a 2b 7d 20 7b 31 20 32 31 31 35 35  rg1..+} {1 21155
67e0: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
67f0: 35 35 2e 34 20 7b 54 63 6c 5f 42 69 6e 61 72 79  55.4 {Tcl_Binary
6800: 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e  ObjCmd: scan} {n
6810: 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72  onPortable macOr
6820: 55 6e 69 78 7d 20 20 7b 0d 0a 2b 20 20 20 20 63  Unix}  {..+    c
6830: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
6840: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
6850: 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78  nary scan \x52\x
6860: 61 33 20 74 31 20 61 72 67 31 5d 20 24 61 72 67  a3 t1 arg1] $arg
6870: 31 0d 0a 2b 7d 20 7b 31 20 32 31 31 35 35 7d 0d  1..+} {1 21155}.
6880: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 35  .+test binary-55
6890: 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .5 {Tcl_BinaryOb
68a0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e  jCmd: scan} {non
68b0: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e  Portable macOrUn
68c0: 69 78 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74  ix}  {..+    cat
68d0: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d  ch {unset arg1}.
68e0: 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61  .+    list [bina
68f0: 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61 33  ry scan \x52\xa3
6900: 20 74 30 20 61 72 67 31 5d 20 24 61 72 67 31 0d   t0 arg1] $arg1.
6910: 0a 2b 7d 20 7b 31 20 7b 7d 7d 0d 0a 2b 74 65 73  .+} {1 {}}..+tes
6920: 74 20 62 69 6e 61 72 79 2d 35 35 2e 36 20 7b 54  t binary-55.6 {T
6930: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a  cl_BinaryObjCmd:
6940: 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61   scan} {nonPorta
6950: 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 20  ble macOrUnix}  
6960: 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75  {..+    catch {u
6970: 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20  nset arg1}..+   
6980: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63   list [binary sc
6990: 61 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35 33 5c  an \x52\xa3\x53\
69a0: 78 35 34 20 74 32 20 61 72 67 31 5d 20 24 61 72  x54 t2 arg1] $ar
69b0: 67 31 0d 0a 2b 7d 20 7b 31 20 7b 32 31 31 35 35  g1..+} {1 {21155
69c0: 20 32 31 33 33 32 7d 7d 0d 0a 2b 74 65 73 74 20   21332}}..+test 
69d0: 62 69 6e 61 72 79 2d 35 35 2e 37 20 7b 54 63 6c  binary-55.7 {Tcl
69e0: 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73  _BinaryObjCmd: s
69f0: 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c  can} {nonPortabl
6a00: 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 20 7b 0d  e macOrUnix}  {.
6a10: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73  .+    catch {uns
6a20: 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 73  et arg1}..+    s
6a30: 65 74 20 61 72 67 31 20 66 6f 6f 0d 0a 2b 20 20  et arg1 foo..+  
6a40: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73    list [binary s
6a50: 63 61 6e 20 5c 78 35 32 20 74 31 20 61 72 67 31  can \x52 t1 arg1
6a60: 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 30 20 66  ] $arg1..+} {0 f
6a70: 6f 6f 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  oo}..+test binar
6a80: 79 2d 35 35 2e 38 20 7b 54 63 6c 5f 42 69 6e 61  y-55.8 {Tcl_Bina
6a90: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
6aa0: 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75  {..+    catch {u
6ab0: 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20  nset arg1}..+   
6ac0: 20 73 65 74 20 61 72 67 31 20 31 0d 0a 2b 20 20   set arg1 1..+  
6ad0: 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62    list [catch {b
6ae0: 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c  inary scan \x52\
6af0: 78 35 33 20 74 31 20 61 72 67 31 28 61 29 7d 20  x53 t1 arg1(a)} 
6b00: 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31  msg] $msg..+} {1
6b10: 20 7b 63 61 6e 27 74 20 73 65 74 20 22 61 72 67   {can't set "arg
6b20: 31 28 61 29 22 3a 20 76 61 72 69 61 62 6c 65 20  1(a)": variable 
6b30: 69 73 6e 27 74 20 61 72 72 61 79 7d 7d 0d 0a 2b  isn't array}}..+
6b40: 74 65 73 74 20 62 69 6e 61 72 79 2d 35 35 2e 39  test binary-55.9
6b50: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
6b60: 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f  md: scan} {nonPo
6b70: 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78  rtable macOrUnix
6b80: 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68  }  {..+    catch
6b90: 20 7b 75 6e 73 65 74 20 61 72 67 31 20 61 72 67   {unset arg1 arg
6ba0: 32 7d 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67  2}..+    set arg
6bb0: 31 20 66 6f 6f 0d 0a 2b 20 20 20 20 73 65 74 20  1 foo..+    set 
6bc0: 61 72 67 32 20 62 61 72 0d 0a 2b 20 20 20 20 6c  arg2 bar..+    l
6bd0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e  ist [binary scan
6be0: 20 5c 78 35 32 5c 78 61 33 5c 78 35 33 5c 78 35   \x52\xa3\x53\x5
6bf0: 34 5c 78 30 35 20 74 32 63 2a 20 61 72 67 31 20  4\x05 t2c* arg1 
6c00: 61 72 67 32 5d 20 24 61 72 67 31 20 24 61 72 67  arg2] $arg1 $arg
6c10: 32 0d 0a 2b 7d 20 7b 32 20 7b 32 31 31 35 35 20  2..+} {2 {21155 
6c20: 32 31 33 33 32 7d 20 35 7d 0d 0a 2b 0d 0a 2b 23  21332} 5}..+..+#
6c30: 20 73 63 61 6e 20 6e 20 28 73 29 0d 0a 2b 74 65   scan n (s)..+te
6c40: 73 74 20 62 69 6e 61 72 79 2d 35 36 2e 31 20 7b  st binary-56.1 {
6c50: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
6c60: 3a 20 73 63 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20  : scan} {..+    
6c70: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
6c80: 61 72 79 20 73 63 61 6e 20 61 62 63 20 6e 7d 20  ary scan abc n} 
6c90: 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31  msg] $msg..+} {1
6ca0: 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 20 61 72 67   {not enough arg
6cb0: 75 6d 65 6e 74 73 20 66 6f 72 20 61 6c 6c 20 66  uments for all f
6cc0: 6f 72 6d 61 74 20 73 70 65 63 69 66 69 65 72 73  ormat specifiers
6cd0: 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  }}..+test binary
6ce0: 2d 35 36 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72  -56.2 {Tcl_Binar
6cf0: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b  yObjCmd: scan} {
6d00: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e  nonPortable pcOn
6d10: 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63  ly} {..+    catc
6d20: 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a  h {unset arg1}..
6d30: 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72  +    list [binar
6d40: 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c  y scan \x52\xa3\
6d50: 78 35 33 5c 78 35 34 5c 78 30 31 5c 78 30 32 5c  x53\x54\x01\x02\
6d60: 78 30 33 5c 78 30 34 20 6e 2a 20 61 72 67 31 5d  x03\x04 n* arg1]
6d70: 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 31   $arg1..+} {1 {1
6d80: 34 31 34 37 36 37 34 34 32 20 36 37 33 30 35 39  414767442 673059
6d90: 38 35 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61  85}}..+test bina
6da0: 72 79 2d 35 36 2e 33 20 7b 54 63 6c 5f 42 69 6e  ry-56.3 {Tcl_Bin
6db0: 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d  aryObjCmd: scan}
6dc0: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63   {nonPortable pc
6dd0: 4f 6e 6c 79 7d 20 20 7b 0d 0a 2b 20 20 20 20 63  Only}  {..+    c
6de0: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
6df0: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
6e00: 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78  nary scan \x52\x
6e10: 61 33 5c 78 35 33 5c 78 35 34 5c 78 30 31 5c 78  a3\x53\x54\x01\x
6e20: 30 32 5c 78 30 33 5c 78 30 34 20 6e 20 61 72 67  02\x03\x04 n arg
6e30: 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20  1] $arg1..+} {1 
6e40: 31 34 31 34 37 36 37 34 34 32 7d 0d 0a 2b 74 65  1414767442}..+te
6e50: 73 74 20 62 69 6e 61 72 79 2d 35 36 2e 34 20 7b  st binary-56.4 {
6e60: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
6e70: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74  : scan} {nonPort
6e80: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 20 7b 0d  able pcOnly}  {.
6e90: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73  .+    catch {uns
6ea0: 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c  et arg1}..+    l
6eb0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e  ist [binary scan
6ec0: 20 5c 78 35 32 5c 78 61 33 5c 78 35 33 5c 78 35   \x52\xa3\x53\x5
6ed0: 34 20 6e 31 20 61 72 67 31 5d 20 24 61 72 67 31  4 n1 arg1] $arg1
6ee0: 0d 0a 2b 7d 20 7b 31 20 31 34 31 34 37 36 37 34  ..+} {1 14147674
6ef0: 34 32 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  42}..+test binar
6f00: 79 2d 35 36 2e 35 20 7b 54 63 6c 5f 42 69 6e 61  y-56.5 {Tcl_Bina
6f10: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
6f20: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f  {nonPortable pcO
6f30: 6e 6c 79 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61  nly}  {..+    ca
6f40: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d  tch {unset arg1}
6f50: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e  ..+    list [bin
6f60: 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61  ary scan \x52\xa
6f70: 33 5c 78 35 33 20 6e 30 20 61 72 67 31 5d 20 24  3\x53 n0 arg1] $
6f80: 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 7d 7d 0d  arg1..+} {1 {}}.
6f90: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 36  .+test binary-56
6fa0: 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .6 {Tcl_BinaryOb
6fb0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e  jCmd: scan} {non
6fc0: 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d  Portable pcOnly}
6fd0: 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20    {..+    catch 
6fe0: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20  {unset arg1}..+ 
6ff0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20     list [binary 
7000: 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35  scan \x52\xa3\x5
7010: 33 5c 78 35 34 5c 78 30 31 5c 78 30 32 5c 78 30  3\x54\x01\x02\x0
7020: 33 5c 78 30 34 20 6e 32 20 61 72 67 31 5d 20 24  3\x04 n2 arg1] $
7030: 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 31 34 31  arg1..+} {1 {141
7040: 34 37 36 37 34 34 32 20 36 37 33 30 35 39 38 35  4767442 67305985
7050: 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  }}..+test binary
7060: 2d 35 36 2e 37 20 7b 54 63 6c 5f 42 69 6e 61 72  -56.7 {Tcl_Binar
7070: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b  yObjCmd: scan} {
7080: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e  nonPortable pcOn
7090: 6c 79 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74  ly}  {..+    cat
70a0: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d  ch {unset arg1}.
70b0: 0a 2b 20 20 20 20 73 65 74 20 61 72 67 31 20 66  .+    set arg1 f
70c0: 6f 6f 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62  oo..+    list [b
70d0: 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 20  inary scan \x52 
70e0: 6e 31 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a  n1 arg1] $arg1..
70f0: 2b 7d 20 7b 30 20 66 6f 6f 7d 0d 0a 2b 74 65 73  +} {0 foo}..+tes
7100: 74 20 62 69 6e 61 72 79 2d 35 36 2e 38 20 7b 54  t binary-56.8 {T
7110: 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a  cl_BinaryObjCmd:
7120: 20 73 63 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20 63   scan} {..+    c
7130: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
7140: 7d 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67 31  }..+    set arg1
7150: 20 31 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63   1..+    list [c
7160: 61 74 63 68 20 7b 62 69 6e 61 72 79 20 73 63 61  atch {binary sca
7170: 6e 20 5c 78 35 32 5c 78 35 33 5c 78 35 33 5c 78  n \x52\x53\x53\x
7180: 35 34 20 6e 31 20 61 72 67 31 28 61 29 7d 20 6d  54 n1 arg1(a)} m
7190: 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20  sg] $msg..+} {1 
71a0: 7b 63 61 6e 27 74 20 73 65 74 20 22 61 72 67 31  {can't set "arg1
71b0: 28 61 29 22 3a 20 76 61 72 69 61 62 6c 65 20 69  (a)": variable i
71c0: 73 6e 27 74 20 61 72 72 61 79 7d 7d 0d 0a 2b 74  sn't array}}..+t
71d0: 65 73 74 20 62 69 6e 61 72 79 2d 35 36 2e 39 20  est binary-56.9 
71e0: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
71f0: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72  d: scan} {nonPor
7200: 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 20 7b  table pcOnly}  {
7210: 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e  ..+    catch {un
7220: 73 65 74 20 61 72 67 31 20 61 72 67 32 7d 0d 0a  set arg1 arg2}..
7230: 2b 20 20 20 20 73 65 74 20 61 72 67 31 20 66 6f  +    set arg1 fo
7240: 6f 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67 32  o..+    set arg2
7250: 20 62 61 72 0d 0a 2b 20 20 20 20 6c 69 73 74 20   bar..+    list 
7260: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 35  [binary scan \x5
7270: 32 5c 78 61 33 5c 78 35 33 5c 78 35 34 5c 78 30  2\xa3\x53\x54\x0
7280: 31 5c 78 30 32 5c 78 30 33 5c 78 30 34 5c 78 30  1\x02\x03\x04\x0
7290: 35 20 6e 32 63 2a 20 61 72 67 31 20 61 72 67 32  5 n2c* arg1 arg2
72a0: 5d 20 24 61 72 67 31 20 24 61 72 67 32 0d 0a 2b  ] $arg1 $arg2..+
72b0: 7d 20 7b 32 20 7b 31 34 31 34 37 36 37 34 34 32  } {2 {1414767442
72c0: 20 36 37 33 30 35 39 38 35 7d 20 35 7d 0d 0a 2b   67305985} 5}..+
72d0: 0d 0a 2b 23 20 73 63 61 6e 20 6e 20 28 62 29 0d  ..+# scan n (b).
72e0: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 37  .+test binary-57
72f0: 2e 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .1 {Tcl_BinaryOb
7300: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 0d 0a 2b  jCmd: scan} {..+
7310: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
7320: 7b 62 69 6e 61 72 79 20 73 63 61 6e 20 61 62 63  {binary scan abc
7330: 20 6e 7d 20 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b   n} msg] $msg..+
7340: 7d 20 7b 31 20 7b 6e 6f 74 20 65 6e 6f 75 67 68  } {1 {not enough
7350: 20 61 72 67 75 6d 65 6e 74 73 20 66 6f 72 20 61   arguments for a
7360: 6c 6c 20 66 6f 72 6d 61 74 20 73 70 65 63 69 66  ll format specif
7370: 69 65 72 73 7d 7d 0d 0a 2b 74 65 73 74 20 62 69  iers}}..+test bi
7380: 6e 61 72 79 2d 35 37 2e 32 20 7b 54 63 6c 5f 42  nary-57.2 {Tcl_B
7390: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
73a0: 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  n} {nonPortable 
73b0: 6d 61 63 4f 72 55 6e 69 78 7d 20 20 7b 0d 0a 2b  macOrUnix}  {..+
73c0: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74      catch {unset
73d0: 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73   arg1}..+    lis
73e0: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c  t [binary scan \
73f0: 78 35 32 5c 78 61 33 5c 78 35 33 5c 78 35 34 5c  x52\xa3\x53\x54\
7400: 78 30 31 5c 78 30 32 5c 78 30 33 5c 78 30 34 20  x01\x02\x03\x04 
7410: 6e 2a 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a  n* arg1] $arg1..
7420: 2b 7d 20 7b 31 20 7b 31 33 38 36 34 33 35 34 31  +} {1 {138643541
7430: 32 20 31 36 39 30 39 30 36 30 7d 7d 0d 0a 2b 74  2 16909060}}..+t
7440: 65 73 74 20 62 69 6e 61 72 79 2d 35 37 2e 33 20  est binary-57.3 
7450: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
7460: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72  d: scan} {nonPor
7470: 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d  table macOrUnix}
7480: 20 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20    {..+    catch 
7490: 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20  {unset arg1}..+ 
74a0: 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20     list [binary 
74b0: 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c 78 35  scan \x52\xa3\x5
74c0: 33 5c 78 35 34 5c 78 30 31 5c 78 30 32 5c 78 30  3\x54\x01\x02\x0
74d0: 33 5c 78 30 34 20 6e 20 61 72 67 31 5d 20 24 61  3\x04 n arg1] $a
74e0: 72 67 31 0d 0a 2b 7d 20 7b 31 20 31 33 38 36 34  rg1..+} {1 13864
74f0: 33 35 34 31 32 7d 0d 0a 2b 74 65 73 74 20 62 69  35412}..+test bi
7500: 6e 61 72 79 2d 35 37 2e 34 20 7b 54 63 6c 5f 42  nary-57.4 {Tcl_B
7510: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
7520: 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  n} {nonPortable 
7530: 6d 61 63 4f 72 55 6e 69 78 7d 20 20 7b 0d 0a 2b  macOrUnix}  {..+
7540: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74      catch {unset
7550: 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73   arg1}..+    lis
7560: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c  t [binary scan \
7570: 78 35 32 5c 78 61 33 5c 78 35 33 5c 78 35 34 20  x52\xa3\x53\x54 
7580: 6e 31 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a  n1 arg1] $arg1..
7590: 2b 7d 20 7b 31 20 31 33 38 36 34 33 35 34 31 32  +} {1 1386435412
75a0: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
75b0: 35 37 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79  57.5 {Tcl_Binary
75c0: 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e  ObjCmd: scan} {n
75d0: 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72  onPortable macOr
75e0: 55 6e 69 78 7d 20 20 7b 0d 0a 2b 20 20 20 20 63  Unix}  {..+    c
75f0: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
7600: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
7610: 6e 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78  nary scan \x52\x
7620: 61 33 5c 78 35 33 20 6e 30 20 61 72 67 31 5d 20  a3\x53 n0 arg1] 
7630: 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 7d 7d  $arg1..+} {1 {}}
7640: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35  ..+test binary-5
7650: 37 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  7.6 {Tcl_BinaryO
7660: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f  bjCmd: scan} {no
7670: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55  nPortable macOrU
7680: 6e 69 78 7d 20 20 7b 0d 0a 2b 20 20 20 20 63 61  nix}  {..+    ca
7690: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d  tch {unset arg1}
76a0: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e  ..+    list [bin
76b0: 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61  ary scan \x52\xa
76c0: 33 5c 78 35 33 5c 78 35 34 5c 78 30 31 5c 78 30  3\x53\x54\x01\x0
76d0: 32 5c 78 30 33 5c 78 30 34 20 6e 32 20 61 72 67  2\x03\x04 n2 arg
76e0: 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20  1] $arg1..+} {1 
76f0: 7b 31 33 38 36 34 33 35 34 31 32 20 31 36 39 30  {1386435412 1690
7700: 39 30 36 30 7d 7d 0d 0a 2b 74 65 73 74 20 62 69  9060}}..+test bi
7710: 6e 61 72 79 2d 35 37 2e 37 20 7b 54 63 6c 5f 42  nary-57.7 {Tcl_B
7720: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
7730: 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  n} {nonPortable 
7740: 6d 61 63 4f 72 55 6e 69 78 7d 20 20 7b 0d 0a 2b  macOrUnix}  {..+
7750: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74      catch {unset
7760: 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 73 65 74   arg1}..+    set
7770: 20 61 72 67 31 20 66 6f 6f 0d 0a 2b 20 20 20 20   arg1 foo..+    
7780: 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61  list [binary sca
7790: 6e 20 5c 78 35 32 20 6e 31 20 61 72 67 31 5d 20  n \x52 n1 arg1] 
77a0: 24 61 72 67 31 0d 0a 2b 7d 20 7b 30 20 66 6f 6f  $arg1..+} {0 foo
77b0: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
77c0: 35 37 2e 38 20 7b 54 63 6c 5f 42 69 6e 61 72 79  57.8 {Tcl_Binary
77d0: 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 0d  ObjCmd: scan} {.
77e0: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73  .+    catch {uns
77f0: 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 73  et arg1}..+    s
7800: 65 74 20 61 72 67 31 20 31 0d 0a 2b 20 20 20 20  et arg1 1..+    
7810: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
7820: 61 72 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 35  ary scan \x52\x5
7830: 33 5c 78 35 33 5c 78 35 34 20 6e 31 20 61 72 67  3\x53\x54 n1 arg
7840: 31 28 61 29 7d 20 6d 73 67 5d 20 24 6d 73 67 0d  1(a)} msg] $msg.
7850: 0a 2b 7d 20 7b 31 20 7b 63 61 6e 27 74 20 73 65  .+} {1 {can't se
7860: 74 20 22 61 72 67 31 28 61 29 22 3a 20 76 61 72  t "arg1(a)": var
7870: 69 61 62 6c 65 20 69 73 6e 27 74 20 61 72 72 61  iable isn't arra
7880: 79 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  y}}..+test binar
7890: 79 2d 35 37 2e 39 20 7b 54 63 6c 5f 42 69 6e 61  y-57.9 {Tcl_Bina
78a0: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
78b0: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63  {nonPortable mac
78c0: 4f 72 55 6e 69 78 7d 20 20 7b 0d 0a 2b 20 20 20  OrUnix}  {..+   
78d0: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72   catch {unset ar
78e0: 67 31 20 61 72 67 32 7d 0d 0a 2b 20 20 20 20 73  g1 arg2}..+    s
78f0: 65 74 20 61 72 67 31 20 66 6f 6f 0d 0a 2b 20 20  et arg1 foo..+  
7900: 20 20 73 65 74 20 61 72 67 32 20 62 61 72 0d 0a    set arg2 bar..
7910: 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72  +    list [binar
7920: 79 20 73 63 61 6e 20 5c 78 35 32 5c 78 61 33 5c  y scan \x52\xa3\
7930: 78 35 33 5c 78 35 34 5c 78 30 31 5c 78 30 32 5c  x53\x54\x01\x02\
7940: 78 30 33 5c 78 30 34 5c 78 30 35 20 6e 32 63 2a  x03\x04\x05 n2c*
7950: 20 61 72 67 31 20 61 72 67 32 5d 20 24 61 72 67   arg1 arg2] $arg
7960: 31 20 24 61 72 67 32 0d 0a 2b 7d 20 7b 32 20 7b  1 $arg2..+} {2 {
7970: 31 33 38 36 34 33 35 34 31 32 20 31 36 39 30 39  1386435412 16909
7980: 30 36 30 7d 20 35 7d 0d 0a 2b 0d 0a 2b 23 20 73  060} 5}..+..+# s
7990: 63 61 6e 20 6d 0d 0a 2b 74 65 73 74 20 62 69 6e  can m..+test bin
79a0: 61 72 79 2d 36 30 2e 31 20 7b 54 63 6c 5f 42 69  ary-60.1 {Tcl_Bi
79b0: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
79c0: 20 77 69 64 65 20 69 6e 74 7d 20 7b 6e 6f 6e 50   wide int} {nonP
79d0: 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69  ortable macOrUni
79e0: 78 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72  x} {..+    binar
79f0: 79 20 73 63 61 6e 20 48 65 6c 6c 6f 54 63 6c 20  y scan HelloTcl 
7a00: 6d 20 78 0d 0a 2b 20 20 20 20 73 65 74 20 78 0d  m x..+    set x.
7a10: 0a 2b 7d 20 35 32 31 36 36 39 34 39 35 36 33 35  .+} 521669495635
7a20: 38 36 35 36 38 37 36 0d 0a 2b 74 65 73 74 20 62  8656876..+test b
7a30: 69 6e 61 72 79 2d 36 30 2e 32 20 7b 54 63 6c 5f  inary-60.2 {Tcl_
7a40: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63  BinaryObjCmd: sc
7a50: 61 6e 20 77 69 64 65 20 69 6e 74 7d 20 7b 6e 6f  an wide int} {no
7a60: 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79  nPortable pcOnly
7a70: 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79  } {..+    binary
7a80: 20 73 63 61 6e 20 6c 63 54 6f 6c 6c 65 48 20 6d   scan lcTolleH m
7a90: 20 78 0d 0a 2b 20 20 20 20 73 65 74 20 78 0d 0a   x..+    set x..
7aa0: 2b 7d 20 35 32 31 36 36 39 34 39 35 36 33 35 38  +} 5216694956358
7ab0: 36 35 36 38 37 36 0d 0a 2b 74 65 73 74 20 62 69  656876..+test bi
7ac0: 6e 61 72 79 2d 36 30 2e 33 20 7b 54 63 6c 5f 42  nary-60.3 {Tcl_B
7ad0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
7ae0: 6e 20 77 69 64 65 20 69 6e 74 20 77 69 74 68 20  n wide int with 
7af0: 62 69 74 20 33 31 20 73 65 74 7d 20 20 7b 6e 6f  bit 31 set}  {no
7b00: 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79  nPortable pcOnly
7b10: 7d 20 7b 0d 0a 2b 20 20 20 20 62 69 6e 61 72 79  } {..+    binary
7b20: 20 73 63 61 6e 20 5b 62 69 6e 61 72 79 20 66 6f   scan [binary fo
7b30: 72 6d 61 74 20 77 20 5b 65 78 70 72 20 7b 77 69  rmat w [expr {wi
7b40: 64 65 28 33 29 20 3c 3c 20 33 31 7d 5d 5d 20 6d  de(3) << 31}]] m
7b50: 20 78 0d 0a 2b 20 20 20 20 73 65 74 20 78 0d 0a   x..+    set x..
7b60: 2b 7d 20 36 34 34 32 34 35 30 39 34 34 0d 0a 2b  +} 6442450944..+
7b70: 74 65 73 74 20 62 69 6e 61 72 79 2d 36 30 2e 34  test binary-60.4
7b80: 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43   {Tcl_BinaryObjC
7b90: 6d 64 3a 20 73 63 61 6e 20 77 69 64 65 20 69 6e  md: scan wide in
7ba0: 74 20 77 69 74 68 20 62 69 74 20 33 31 20 73 65  t with bit 31 se
7bb0: 74 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  t} {nonPortable 
7bc0: 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20  macOrUnix} {..+ 
7bd0: 20 20 20 62 69 6e 61 72 79 20 73 63 61 6e 20 5b     binary scan [
7be0: 62 69 6e 61 72 79 20 66 6f 72 6d 61 74 20 57 20  binary format W 
7bf0: 5b 65 78 70 72 20 7b 77 69 64 65 28 33 29 20 3c  [expr {wide(3) <
7c00: 3c 20 33 31 7d 5d 5d 20 6d 20 78 0d 0a 2b 20 20  < 31}]] m x..+  
7c10: 20 20 73 65 74 20 78 0d 0a 2b 7d 20 36 34 34 32    set x..+} 6442
7c20: 34 35 30 39 34 34 0d 0a 2b 0d 0a 2b 0d 0a 2b 23  450944..+..+..+#
7c30: 20 73 63 61 6e 20 51 2f 71 0d 0a 2b 74 65 73 74   scan Q/q..+test
7c40: 20 62 69 6e 61 72 79 2d 35 38 2e 31 20 7b 54 63   binary-58.1 {Tc
7c50: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
7c60: 73 63 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20 6c 69  scan} {..+    li
7c70: 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e 61 72  st [catch {binar
7c80: 79 20 73 63 61 6e 20 61 62 63 20 71 7d 20 6d 73  y scan abc q} ms
7c90: 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b  g] $msg..+} {1 {
7ca0: 6e 6f 74 20 65 6e 6f 75 67 68 20 61 72 67 75 6d  not enough argum
7cb0: 65 6e 74 73 20 66 6f 72 20 61 6c 6c 20 66 6f 72  ents for all for
7cc0: 6d 61 74 20 73 70 65 63 69 66 69 65 72 73 7d 7d  mat specifiers}}
7cd0: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35  ..+test binary-5
7ce0: 38 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  8.2 {Tcl_BinaryO
7cf0: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f  bjCmd: scan} {no
7d00: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55  nPortable macOrU
7d10: 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74  nix} {..+    cat
7d20: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d  ch {unset arg1}.
7d30: 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61  .+    list [bina
7d40: 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39  ry scan \x3f\xf9
7d50: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39  \x99\x99\x99\x99
7d60: 5c 78 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62  \x99\x9a\x40\x0b
7d70: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33  \x33\x33\x33\x33
7d80: 5c 78 33 33 5c 78 33 33 20 51 2a 20 61 72 67 31  \x33\x33 Q* arg1
7d90: 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b  ] $arg1..+} {1 {
7da0: 31 2e 36 20 33 2e 34 7d 7d 0d 0a 2b 74 65 73 74  1.6 3.4}}..+test
7db0: 20 62 69 6e 61 72 79 2d 35 38 2e 33 20 7b 54 63   binary-58.3 {Tc
7dc0: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
7dd0: 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62  scan} {nonPortab
7de0: 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20  le pcOnly} {..+ 
7df0: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20     catch {unset 
7e00: 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74  arg1}..+    list
7e10: 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78   [binary scan \x
7e20: 39 61 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78  9a\x99\x99\x99\x
7e30: 39 39 5c 78 39 39 5c 78 66 39 5c 78 33 66 5c 78  99\x99\xf9\x3f\x
7e40: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78  33\x33\x33\x33\x
7e50: 33 33 5c 78 33 33 5c 78 30 62 5c 78 34 30 20 71  33\x33\x0b\x40 q
7e60: 2a 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b  * arg1] $arg1..+
7e70: 7d 20 7b 31 20 7b 31 2e 36 20 33 2e 34 7d 7d 0d  } {1 {1.6 3.4}}.
7e80: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 38  .+test binary-58
7e90: 2e 34 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .4 {Tcl_BinaryOb
7ea0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e  jCmd: scan} {non
7eb0: 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e  Portable macOrUn
7ec0: 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63  ix} {..+    catc
7ed0: 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a  h {unset arg1}..
7ee0: 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72  +    list [binar
7ef0: 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39 5c  y scan \x3f\xf9\
7f00: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  x99\x99\x99\x99\
7f10: 78 39 39 5c 78 39 61 5c 78 34 30 5c 78 30 62 5c  x99\x9a\x40\x0b\
7f20: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c  x33\x33\x33\x33\
7f30: 78 33 33 5c 78 33 33 20 51 20 61 72 67 31 5d 20  x33\x33 Q arg1] 
7f40: 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 31 2e 36  $arg1..+} {1 1.6
7f50: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
7f60: 35 38 2e 35 20 7b 54 63 6c 5f 42 69 6e 61 72 79  58.5 {Tcl_Binary
7f70: 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e  ObjCmd: scan} {n
7f80: 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c  onPortable pcOnl
7f90: 79 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68  y} {..+    catch
7fa0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b   {unset arg1}..+
7fb0: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79      list [binary
7fc0: 20 73 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78   scan \x9a\x99\x
7fd0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78  99\x99\x99\x99\x
7fe0: 66 39 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c 78  f9\x3f\x33\x33\x
7ff0: 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78  33\x33\x33\x33\x
8000: 30 62 5c 78 34 30 20 71 20 61 72 67 31 5d 20 24  0b\x40 q arg1] $
8010: 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 31 2e 36 7d  arg1..+} {1 1.6}
8020: 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35  ..+test binary-5
8030: 38 2e 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  8.6 {Tcl_BinaryO
8040: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f  bjCmd: scan} {no
8050: 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55  nPortable macOrU
8060: 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74  nix} {..+    cat
8070: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d  ch {unset arg1}.
8080: 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61  .+    list [bina
8090: 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 66 39  ry scan \x3f\xf9
80a0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39  \x99\x99\x99\x99
80b0: 5c 78 39 39 5c 78 39 61 20 51 31 20 61 72 67 31  \x99\x9a Q1 arg1
80c0: 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 31  ] $arg1..+} {1 1
80d0: 2e 36 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  .6}..+test binar
80e0: 79 2d 35 38 2e 37 20 7b 54 63 6c 5f 42 69 6e 61  y-58.7 {Tcl_Bina
80f0: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
8100: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f  {nonPortable pcO
8110: 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74  nly} {..+    cat
8120: 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d  ch {unset arg1}.
8130: 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61  .+    list [bina
8140: 72 79 20 73 63 61 6e 20 5c 78 39 61 5c 78 39 39  ry scan \x9a\x99
8150: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39  \x99\x99\x99\x99
8160: 5c 78 66 39 5c 78 33 66 20 71 31 20 61 72 67 31  \xf9\x3f q1 arg1
8170: 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 31  ] $arg1..+} {1 1
8180: 2e 36 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72  .6}..+test binar
8190: 79 2d 35 38 2e 38 20 7b 54 63 6c 5f 42 69 6e 61  y-58.8 {Tcl_Bina
81a0: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
81b0: 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63  {nonPortable mac
81c0: 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20  OrUnix} {..+    
81d0: 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67  catch {unset arg
81e0: 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62  1}..+    list [b
81f0: 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c  inary scan \x3f\
8200: 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c  xf9\x99\x99\x99\
8210: 78 39 39 5c 78 39 39 5c 78 39 61 20 51 30 20 61  x99\x99\x9a Q0 a
8220: 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b  rg1] $arg1..+} {
8230: 31 20 7b 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  1 {}}..+test bin
8240: 61 72 79 2d 35 38 2e 39 20 7b 54 63 6c 5f 42 69  ary-58.9 {Tcl_Bi
8250: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
8260: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70  } {nonPortable p
8270: 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63  cOnly} {..+    c
8280: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
8290: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
82a0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 39 61 5c 78  nary scan \x9a\x
82b0: 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78  99\x99\x99\x99\x
82c0: 39 39 5c 78 66 39 5c 78 33 66 20 71 30 20 61 72  99\xf9\x3f q0 ar
82d0: 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31  g1] $arg1..+} {1
82e0: 20 7b 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61   {}}..+test bina
82f0: 72 79 2d 35 38 2e 31 30 20 7b 54 63 6c 5f 42 69  ry-58.10 {Tcl_Bi
8300: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
8310: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d  } {nonPortable m
8320: 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20  acOrUnix} {..+  
8330: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61    catch {unset a
8340: 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20  rg1}..+    list 
8350: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33  [binary scan \x3
8360: 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 5c 78 39  f\xf9\x99\x99\x9
8370: 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 5c 78 34  9\x99\x99\x9a\x4
8380: 30 5c 78 30 62 5c 78 33 33 5c 78 33 33 5c 78 33  0\x0b\x33\x33\x3
8390: 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 20 51 32  3\x33\x33\x33 Q2
83a0: 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d   arg1] $arg1..+}
83b0: 20 7b 31 20 7b 31 2e 36 20 33 2e 34 7d 7d 0d 0a   {1 {1.6 3.4}}..
83c0: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 38 2e  +test binary-58.
83d0: 31 31 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  11 {Tcl_BinaryOb
83e0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e  jCmd: scan} {non
83f0: 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d  Portable pcOnly}
8400: 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b   {..+    catch {
8410: 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20  unset arg1}..+  
8420: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73    list [binary s
8430: 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78 39 39  can \x9a\x99\x99
8440: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 39  \x99\x99\x99\xf9
8450: 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c 78 33 33  \x3f\x33\x33\x33
8460: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 30 62  \x33\x33\x33\x0b
8470: 5c 78 34 30 20 71 32 20 61 72 67 31 5d 20 24 61  \x40 q2 arg1] $a
8480: 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 31 2e 36 20  rg1..+} {1 {1.6 
8490: 33 2e 34 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  3.4}}..+test bin
84a0: 61 72 79 2d 35 38 2e 31 32 20 7b 54 63 6c 5f 42  ary-58.12 {Tcl_B
84b0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
84c0: 6e 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68  n} {..+    catch
84d0: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b   {unset arg1}..+
84e0: 20 20 20 20 73 65 74 20 61 72 67 31 20 66 6f 6f      set arg1 foo
84f0: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e  ..+    list [bin
8500: 61 72 79 20 73 63 61 6e 20 5c 78 35 32 20 71 31  ary scan \x52 q1
8510: 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d   arg1] $arg1..+}
8520: 20 7b 30 20 66 6f 6f 7d 0d 0a 2b 74 65 73 74 20   {0 foo}..+test 
8530: 62 69 6e 61 72 79 2d 35 38 2e 31 33 20 7b 54 63  binary-58.13 {Tc
8540: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
8550: 73 63 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20 63 61  scan} {..+    ca
8560: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 7d  tch {unset arg1}
8570: 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67 31 20  ..+    set arg1 
8580: 31 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61  1..+    list [ca
8590: 74 63 68 20 7b 62 69 6e 61 72 79 20 73 63 61 6e  tch {binary scan
85a0: 20 5c 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 39   \x3f\xf9\x99\x9
85b0: 39 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39  9\x99\x99\x99\x9
85c0: 61 20 71 31 20 61 72 67 31 28 61 29 7d 20 6d 73  a q1 arg1(a)} ms
85d0: 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31 20 7b  g] $msg..+} {1 {
85e0: 63 61 6e 27 74 20 73 65 74 20 22 61 72 67 31 28  can't set "arg1(
85f0: 61 29 22 3a 20 76 61 72 69 61 62 6c 65 20 69 73  a)": variable is
8600: 6e 27 74 20 61 72 72 61 79 7d 7d 0d 0a 2b 74 65  n't array}}..+te
8610: 73 74 20 62 69 6e 61 72 79 2d 35 38 2e 31 34 20  st binary-58.14 
8620: 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d  {Tcl_BinaryObjCm
8630: 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72  d: scan} {nonPor
8640: 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d  table macOrUnix}
8650: 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b   {..+    catch {
8660: 75 6e 73 65 74 20 61 72 67 31 20 61 72 67 32 7d  unset arg1 arg2}
8670: 0d 0a 2b 20 20 20 20 73 65 74 20 61 72 67 31 20  ..+    set arg1 
8680: 66 6f 6f 0d 0a 2b 20 20 20 20 73 65 74 20 61 72  foo..+    set ar
8690: 67 32 20 62 61 72 0d 0a 2b 20 20 20 20 6c 69 73  g2 bar..+    lis
86a0: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c  t [binary scan \
86b0: 78 33 66 5c 78 66 39 5c 78 39 39 5c 78 39 39 5c  x3f\xf9\x99\x99\
86c0: 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 39 61 5c  x99\x99\x99\x9a\
86d0: 78 34 30 5c 78 30 62 5c 78 33 33 5c 78 33 33 5c  x40\x0b\x33\x33\
86e0: 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c  x33\x33\x33\x33\
86f0: 78 30 35 20 51 32 63 2a 20 61 72 67 31 20 61 72  x05 Q2c* arg1 ar
8700: 67 32 5d 20 24 61 72 67 31 20 24 61 72 67 32 0d  g2] $arg1 $arg2.
8710: 0a 2b 7d 20 7b 32 20 7b 31 2e 36 20 33 2e 34 7d  .+} {2 {1.6 3.4}
8720: 20 35 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72   5}..+test binar
8730: 79 2d 35 38 2e 31 35 20 7b 54 63 6c 5f 42 69 6e  y-58.15 {Tcl_Bin
8740: 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d  aryObjCmd: scan}
8750: 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63   {nonPortable pc
8760: 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63 61  Only} {..+    ca
8770: 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31 20  tch {unset arg1 
8780: 61 72 67 32 7d 0d 0a 2b 20 20 20 20 73 65 74 20  arg2}..+    set 
8790: 61 72 67 31 20 66 6f 6f 0d 0a 2b 20 20 20 20 73  arg1 foo..+    s
87a0: 65 74 20 61 72 67 32 20 62 61 72 0d 0a 2b 20 20  et arg2 bar..+  
87b0: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73    list [binary s
87c0: 63 61 6e 20 5c 78 39 61 5c 78 39 39 5c 78 39 39  can \x9a\x99\x99
87d0: 5c 78 39 39 5c 78 39 39 5c 78 39 39 5c 78 66 39  \x99\x99\x99\xf9
87e0: 5c 78 33 66 5c 78 33 33 5c 78 33 33 5c 78 33 33  \x3f\x33\x33\x33
87f0: 5c 78 33 33 5c 78 33 33 5c 78 33 33 5c 78 30 62  \x33\x33\x33\x0b
8800: 5c 78 34 30 5c 78 30 35 20 71 32 63 2a 20 61 72  \x40\x05 q2c* ar
8810: 67 31 20 61 72 67 32 5d 20 24 61 72 67 31 20 24  g1 arg2] $arg1 $
8820: 61 72 67 32 0d 0a 2b 7d 20 7b 32 20 7b 31 2e 36  arg2..+} {2 {1.6
8830: 20 33 2e 34 7d 20 35 7d 0d 0a 2b 0d 0a 2b 0d 0a   3.4} 5}..+..+..
8840: 2b 23 20 73 63 61 6e 20 52 2f 72 0d 0a 2b 74 65  +# scan R/r..+te
8850: 73 74 20 62 69 6e 61 72 79 2d 35 39 2e 31 20 7b  st binary-59.1 {
8860: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
8870: 3a 20 73 63 61 6e 7d 20 7b 0d 0a 2b 20 20 20 20  : scan} {..+    
8880: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62 69 6e  list [catch {bin
8890: 61 72 79 20 73 63 61 6e 20 61 62 63 20 72 7d 20  ary scan abc r} 
88a0: 6d 73 67 5d 20 24 6d 73 67 0d 0a 2b 7d 20 7b 31  msg] $msg..+} {1
88b0: 20 7b 6e 6f 74 20 65 6e 6f 75 67 68 20 61 72 67   {not enough arg
88c0: 75 6d 65 6e 74 73 20 66 6f 72 20 61 6c 6c 20 66  uments for all f
88d0: 6f 72 6d 61 74 20 73 70 65 63 69 66 69 65 72 73  ormat specifiers
88e0: 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  }}..+test binary
88f0: 2d 35 39 2e 32 20 7b 54 63 6c 5f 42 69 6e 61 72  -59.2 {Tcl_Binar
8900: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b  yObjCmd: scan} {
8910: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d 61 63 4f  nonPortable macO
8920: 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20 20 20 63  rUnix} {..+    c
8930: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
8940: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
8950: 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78  nary scan \x3f\x
8960: 63 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78  cc\xcc\xcd\x40\x
8970: 35 39 5c 78 39 39 5c 78 39 61 20 52 2a 20 61 72  59\x99\x9a R* ar
8980: 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31  g1] $arg1..+} {1
8990: 20 7b 31 2e 36 30 30 30 30 30 30 32 33 38 34 20   {1.60000002384 
89a0: 33 2e 34 30 30 30 30 30 30 39 35 33 37 7d 7d 0d  3.40000009537}}.
89b0: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 39  .+test binary-59
89c0: 2e 33 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62  .3 {Tcl_BinaryOb
89d0: 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e  jCmd: scan} {non
89e0: 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e 6c 79 7d  Portable pcOnly}
89f0: 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b   {..+    catch {
8a00: 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20  unset arg1}..+  
8a10: 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73    list [binary s
8a20: 63 61 6e 20 5c 78 63 64 5c 78 63 63 5c 78 63 63  can \xcd\xcc\xcc
8a30: 5c 78 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 39  \x3f\x9a\x99\x59
8a40: 5c 78 34 30 20 72 2a 20 61 72 67 31 5d 20 24 61  \x40 r* arg1] $a
8a50: 72 67 31 0d 0a 2b 7d 20 7b 31 20 7b 31 2e 36 30  rg1..+} {1 {1.60
8a60: 30 30 30 30 30 32 33 38 34 20 33 2e 34 30 30 30  000002384 3.4000
8a70: 30 30 30 39 35 33 37 7d 7d 0d 0a 2b 74 65 73 74  0009537}}..+test
8a80: 20 62 69 6e 61 72 79 2d 35 39 2e 34 20 7b 54 63   binary-59.4 {Tc
8a90: 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20  l_BinaryObjCmd: 
8aa0: 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62  scan} {nonPortab
8ab0: 6c 65 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d  le macOrUnix} {.
8ac0: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73  .+    catch {uns
8ad0: 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c  et arg1}..+    l
8ae0: 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e  ist [binary scan
8af0: 20 5c 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63   \x3f\xcc\xcc\xc
8b00: 64 5c 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39  d\x40\x59\x99\x9
8b10: 61 20 52 20 61 72 67 31 5d 20 24 61 72 67 31 0d  a R arg1] $arg1.
8b20: 0a 2b 7d 20 7b 31 20 31 2e 36 30 30 30 30 30 30  .+} {1 1.6000000
8b30: 32 33 38 34 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  2384}..+test bin
8b40: 61 72 79 2d 35 39 2e 35 20 7b 54 63 6c 5f 42 69  ary-59.5 {Tcl_Bi
8b50: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
8b60: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70  } {nonPortable p
8b70: 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63  cOnly} {..+    c
8b80: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
8b90: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
8ba0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78  nary scan \xcd\x
8bb0: 63 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78  cc\xcc\x3f\x9a\x
8bc0: 39 39 5c 78 35 39 5c 78 34 30 20 72 20 61 72 67  99\x59\x40 r arg
8bd0: 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20  1] $arg1..+} {1 
8be0: 31 2e 36 30 30 30 30 30 30 32 33 38 34 7d 0d 0a  1.60000002384}..
8bf0: 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 39 2e  +test binary-59.
8c00: 36 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a  6 {Tcl_BinaryObj
8c10: 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50  Cmd: scan} {nonP
8c20: 6f 72 74 61 62 6c 65 20 6d 61 63 4f 72 55 6e 69  ortable macOrUni
8c30: 78 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68  x} {..+    catch
8c40: 20 7b 75 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b   {unset arg1}..+
8c50: 20 20 20 20 6c 69 73 74 20 5b 62 69 6e 61 72 79      list [binary
8c60: 20 73 63 61 6e 20 5c 78 33 66 5c 78 63 63 5c 78   scan \x3f\xcc\x
8c70: 63 63 5c 78 63 64 20 52 31 20 61 72 67 31 5d 20  cc\xcd R1 arg1] 
8c80: 24 61 72 67 31 0d 0a 2b 7d 20 7b 31 20 31 2e 36  $arg1..+} {1 1.6
8c90: 30 30 30 30 30 30 32 33 38 34 7d 0d 0a 2b 74 65  0000002384}..+te
8ca0: 73 74 20 62 69 6e 61 72 79 2d 35 39 2e 37 20 7b  st binary-59.7 {
8cb0: 54 63 6c 5f 42 69 6e 61 72 79 4f 62 6a 43 6d 64  Tcl_BinaryObjCmd
8cc0: 3a 20 73 63 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74  : scan} {nonPort
8cd0: 61 62 6c 65 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a  able pcOnly} {..
8ce0: 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65  +    catch {unse
8cf0: 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69  t arg1}..+    li
8d00: 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20  st [binary scan 
8d10: 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78 33 66  \xcd\xcc\xcc\x3f
8d20: 20 72 31 20 61 72 67 31 5d 20 24 61 72 67 31 0d   r1 arg1] $arg1.
8d30: 0a 2b 7d 20 7b 31 20 31 2e 36 30 30 30 30 30 30  .+} {1 1.6000000
8d40: 32 33 38 34 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  2384}..+test bin
8d50: 61 72 79 2d 35 39 2e 38 20 7b 54 63 6c 5f 42 69  ary-59.8 {Tcl_Bi
8d60: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
8d70: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 6d  } {nonPortable m
8d80: 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20 20  acOrUnix} {..+  
8d90: 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61    catch {unset a
8da0: 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20  rg1}..+    list 
8db0: 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33  [binary scan \x3
8dc0: 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 20 52 30  f\xcc\xcc\xcd R0
8dd0: 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d   arg1] $arg1..+}
8de0: 20 7b 31 20 7b 7d 7d 0d 0a 2b 74 65 73 74 20 62   {1 {}}..+test b
8df0: 69 6e 61 72 79 2d 35 39 2e 39 20 7b 54 63 6c 5f  inary-59.9 {Tcl_
8e00: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63  BinaryObjCmd: sc
8e10: 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65  an} {nonPortable
8e20: 20 70 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20   pcOnly} {..+   
8e30: 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72   catch {unset ar
8e40: 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b  g1}..+    list [
8e50: 62 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64  binary scan \xcd
8e60: 5c 78 63 63 5c 78 63 63 5c 78 33 66 20 72 30 20  \xcc\xcc\x3f r0 
8e70: 61 72 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20  arg1] $arg1..+} 
8e80: 7b 31 20 7b 7d 7d 0d 0a 2b 74 65 73 74 20 62 69  {1 {}}..+test bi
8e90: 6e 61 72 79 2d 35 39 2e 31 30 20 7b 54 63 6c 5f  nary-59.10 {Tcl_
8ea0: 42 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63  BinaryObjCmd: sc
8eb0: 61 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65  an} {nonPortable
8ec0: 20 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b   macOrUnix} {..+
8ed0: 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74      catch {unset
8ee0: 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 6c 69 73   arg1}..+    lis
8ef0: 74 20 5b 62 69 6e 61 72 79 20 73 63 61 6e 20 5c  t [binary scan \
8f00: 78 33 66 5c 78 63 63 5c 78 63 63 5c 78 63 64 5c  x3f\xcc\xcc\xcd\
8f10: 78 34 30 5c 78 35 39 5c 78 39 39 5c 78 39 61 20  x40\x59\x99\x9a 
8f20: 52 32 20 61 72 67 31 5d 20 24 61 72 67 31 0d 0a  R2 arg1] $arg1..
8f30: 2b 7d 20 7b 31 20 7b 31 2e 36 30 30 30 30 30 30  +} {1 {1.6000000
8f40: 32 33 38 34 20 33 2e 34 30 30 30 30 30 30 39 35  2384 3.400000095
8f50: 33 37 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61  37}}..+test bina
8f60: 72 79 2d 35 39 2e 31 31 20 7b 54 63 6c 5f 42 69  ry-59.11 {Tcl_Bi
8f70: 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e  naryObjCmd: scan
8f80: 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70  } {nonPortable p
8f90: 63 4f 6e 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63  cOnly} {..+    c
8fa0: 61 74 63 68 20 7b 75 6e 73 65 74 20 61 72 67 31  atch {unset arg1
8fb0: 7d 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69  }..+    list [bi
8fc0: 6e 61 72 79 20 73 63 61 6e 20 5c 78 63 64 5c 78  nary scan \xcd\x
8fd0: 63 63 5c 78 63 63 5c 78 33 66 5c 78 39 61 5c 78  cc\xcc\x3f\x9a\x
8fe0: 39 39 5c 78 35 39 5c 78 34 30 20 72 32 20 61 72  99\x59\x40 r2 ar
8ff0: 67 31 5d 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 31  g1] $arg1..+} {1
9000: 20 7b 31 2e 36 30 30 30 30 30 30 32 33 38 34 20   {1.60000002384 
9010: 33 2e 34 30 30 30 30 30 30 39 35 33 37 7d 7d 0d  3.40000009537}}.
9020: 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d 35 39  .+test binary-59
9030: 2e 31 32 20 7b 54 63 6c 5f 42 69 6e 61 72 79 4f  .12 {Tcl_BinaryO
9040: 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b 0d 0a  bjCmd: scan} {..
9050: 2b 20 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65  +    catch {unse
9060: 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20 20 73 65  t arg1}..+    se
9070: 74 20 61 72 67 31 20 66 6f 6f 0d 0a 2b 20 20 20  t arg1 foo..+   
9080: 20 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63   list [binary sc
9090: 61 6e 20 5c 78 35 32 20 72 31 20 61 72 67 31 5d  an \x52 r1 arg1]
90a0: 20 24 61 72 67 31 0d 0a 2b 7d 20 7b 30 20 66 6f   $arg1..+} {0 fo
90b0: 6f 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79  o}..+test binary
90c0: 2d 35 39 2e 31 33 20 7b 54 63 6c 5f 42 69 6e 61  -59.13 {Tcl_Bina
90d0: 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20  ryObjCmd: scan} 
90e0: 7b 0d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 75  {..+    catch {u
90f0: 6e 73 65 74 20 61 72 67 31 7d 0d 0a 2b 20 20 20  nset arg1}..+   
9100: 20 73 65 74 20 61 72 67 31 20 31 0d 0a 2b 20 20   set arg1 1..+  
9110: 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 62    list [catch {b
9120: 69 6e 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c  inary scan \x3f\
9130: 78 63 63 5c 78 63 63 5c 78 63 64 20 72 31 20 61  xcc\xcc\xcd r1 a
9140: 72 67 31 28 61 29 7d 20 6d 73 67 5d 20 24 6d 73  rg1(a)} msg] $ms
9150: 67 0d 0a 2b 7d 20 7b 31 20 7b 63 61 6e 27 74 20  g..+} {1 {can't 
9160: 73 65 74 20 22 61 72 67 31 28 61 29 22 3a 20 76  set "arg1(a)": v
9170: 61 72 69 61 62 6c 65 20 69 73 6e 27 74 20 61 72  ariable isn't ar
9180: 72 61 79 7d 7d 0d 0a 2b 74 65 73 74 20 62 69 6e  ray}}..+test bin
9190: 61 72 79 2d 35 39 2e 31 34 20 7b 54 63 6c 5f 42  ary-59.14 {Tcl_B
91a0: 69 6e 61 72 79 4f 62 6a 43 6d 64 3a 20 73 63 61  inaryObjCmd: sca
91b0: 6e 7d 20 7b 6e 6f 6e 50 6f 72 74 61 62 6c 65 20  n} {nonPortable 
91c0: 6d 61 63 4f 72 55 6e 69 78 7d 20 7b 0d 0a 2b 20  macOrUnix} {..+ 
91d0: 20 20 20 63 61 74 63 68 20 7b 75 6e 73 65 74 20     catch {unset 
91e0: 61 72 67 31 20 61 72 67 32 7d 0d 0a 2b 20 20 20  arg1 arg2}..+   
91f0: 20 73 65 74 20 61 72 67 31 20 66 6f 6f 0d 0a 2b   set arg1 foo..+
9200: 20 20 20 20 73 65 74 20 61 72 67 32 20 62 61 72      set arg2 bar
9210: 0d 0a 2b 20 20 20 20 6c 69 73 74 20 5b 62 69 6e  ..+    list [bin
9220: 61 72 79 20 73 63 61 6e 20 5c 78 33 66 5c 78 63  ary scan \x3f\xc
9230: 63 5c 78 63 63 5c 78 63 64 5c 78 34 30 5c 78 35  c\xcc\xcd\x40\x5
9240: 39 5c 78 39 39 5c 78 39 61 5c 78 30 35 20 52 32  9\x99\x9a\x05 R2
9250: 63 2a 20 61 72 67 31 20 61 72 67 32 5d 20 24 61  c* arg1 arg2] $a
9260: 72 67 31 20 24 61 72 67 32 0d 0a 2b 7d 20 7b 32  rg1 $arg2..+} {2
9270: 20 7b 31 2e 36 30 30 30 30 30 30 32 33 38 34 20   {1.60000002384 
9280: 33 2e 34 30 30 30 30 30 30 39 35 33 37 7d 20 35  3.40000009537} 5
9290: 7d 0d 0a 2b 74 65 73 74 20 62 69 6e 61 72 79 2d  }..+test binary-
92a0: 35 39 2e 31 35 20 7b 54 63 6c 5f 42 69 6e 61 72  59.15 {Tcl_Binar
92b0: 79 4f 62 6a 43 6d 64 3a 20 73 63 61 6e 7d 20 7b  yObjCmd: scan} {
92c0: 6e 6f 6e 50 6f 72 74 61 62 6c 65 20 70 63 4f 6e  nonPortable pcOn
92d0: 6c 79 7d 20 7b 0d 0a 2b 20 20 20 20 63 61 74 63  ly} {..+    catc
92e0: 68 20 7b 75 6e 73 65 74 20 61 72 67 31 20 61 72  h {unset arg1 ar
92f0: 67 32 7d 0d 0a 2b 20 20 20 20 73 65 74 20 61 72  g2}..+    set ar
9300: 67 31 20 66 6f 6f 0d 0a 2b 20 20 20 20 73 65 74  g1 foo..+    set
9310: 20 61 72 67 32 20 62 61 72 0d 0a 2b 20 20 20 20   arg2 bar..+    
9320: 6c 69 73 74 20 5b 62 69 6e 61 72 79 20 73 63 61  list [binary sca
9330: 6e 20 5c 78 63 64 5c 78 63 63 5c 78 63 63 5c 78  n \xcd\xcc\xcc\x
9340: 33 66 5c 78 39 61 5c 78 39 39 5c 78 35 39 5c 78  3f\x9a\x99\x59\x
9350: 34 30 5c 78 30 35 20 72 32 63 2a 20 61 72 67 31  40\x05 r2c* arg1
9360: 20 61 72 67 32 5d 20 24 61 72 67 31 20 24 61 72   arg2] $arg1 $ar
9370: 67 32 0d 0a 2b 7d 20 7b 32 20 7b 31 2e 36 30 30  g2..+} {2 {1.600
9380: 30 30 30 30 32 33 38 34 20 33 2e 34 30 30 30 30  00002384 3.40000
9390: 30 30 39 35 33 37 7d 20 35 7d 0d 0a 2b 0d 0a 20  009537} 5}..+.. 
93a0: 23 20 63 6c 65 61 6e 75 70 0d 0a 20 3a 3a 74 63  # cleanup.. ::tc
93b0: 6c 74 65 73 74 3a 3a 63 6c 65 61 6e 75 70 54 65  ltest::cleanupTe
93c0: 73 74 73 0d 0a 20 72 65 74 75 72 6e 0d 0a        sts.. return..