Tcl Source Code

Check-in [81502a66ed]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge 8.7 Move up some stub entries related to Tcl_UniChar Use TCL_UTF_MAX=4 for full Unicode in stead of TCL_UTF_MAX=6 (TCL_UTF_MAX: 3 is default)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | utf-max
Files: files | file ages | folders
SHA3-256: 81502a66ed4175657f249d26c80f7f2361a5db4181feb1e5b8fd962db800a470
User & Date: jan.nijtmans 2019-03-16 21:10:20
Context
2019-03-17
22:01
More WIP. Seems to be *almost* working. check-in: ab13cbd74c user: jan.nijtmans tags: utf-max
2019-03-16
21:10
Merge 8.7 Move up some stub entries related to Tcl_UniChar Use TCL_UTF_MAX=4 for full Unicode in ste... check-in: 81502a66ed user: jan.nijtmans tags: utf-max
2019-03-15
20:52
Eliminate usage of mp_isneg(), just check bignum->sign directly (as libtommath itself does) Make Tcl... check-in: 515a22d41d user: jan.nijtmans tags: core-8-branch
2019-03-14
20:59
Merge 8.7. Fix 2 test-cases which were failing for TCL_UTF_MAX=6 check-in: 4032e7fe99 user: jan.nijtmans tags: utf-max
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to .travis.yml.

76
77
78
79
80
81
82
83












84
85
86
87
88
89
90
...
132
133
134
135
136
137
138
139
















140
141
142
143
144
145
146
...
163
164
165
166
167
168
169
170
171
172















173
174
175
176
177
178
179
180
181
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - BUILD_DIR=unix
        - CFGOPT=CFLAGS=-DTCL_UTF_MAX=6












    - os: osx
      osx_image: xcode8
      env:
        - BUILD_DIR=unix
    - os: osx
      osx_image: xcode8
      env:
................................................................................
            - binutils-mingw-w64-i686
            - gcc-mingw-w64-i686
            - gcc-mingw-w64
            - gcc-multilib
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=6"
















        - NO_DIRECT_TEST=1
# Test with mingw-w64 (64 bit)
    - os: linux
      dist: xenial
      compiler: x86_64-w64-mingw32-gcc
      addons:
        apt:
................................................................................
            - gcc-mingw-w64-base
            - binutils-mingw-w64-x86-64
            - gcc-mingw-w64-x86-64
            - gcc-mingw-w64
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=6"
        - NO_DIRECT_TEST=1
















before_install:
  - export ERROR_ON_FAILURES=1
  - cd ${BUILD_DIR}
install:
  - test -n "$NO_DIRECT_CONFIGURE" || ./configure ${CFGOPT}
script:
  - make
  # The styles=develop avoids some weird problems on OSX
  - test -n "$NO_DIRECT_TEST" || make test styles=develop






|
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|

<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
191
192
193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - BUILD_DIR=unix
        - CFGOPT=CFLAGS=-DTCL_UTF_MAX=4
    - os: linux
      dist: xenial
      compiler: gcc-7
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - BUILD_DIR=unix
        - CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1
    - os: osx
      osx_image: xcode8
      env:
        - BUILD_DIR=unix
    - os: osx
      osx_image: xcode8
      env:
................................................................................
            - binutils-mingw-w64-i686
            - gcc-mingw-w64-i686
            - gcc-mingw-w64
            - gcc-multilib
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=4"
        - NO_DIRECT_TEST=1
    - os: linux
      dist: xenial
      compiler: i686-w64-mingw32-gcc
      addons:
        apt:
          packages:
            - gcc-mingw-w64-base
            - binutils-mingw-w64-i686
            - gcc-mingw-w64-i686
            - gcc-mingw-w64
            - gcc-multilib
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_NO_DEPRECATED=1"
        - NO_DIRECT_TEST=1
# Test with mingw-w64 (64 bit)
    - os: linux
      dist: xenial
      compiler: x86_64-w64-mingw32-gcc
      addons:
        apt:
................................................................................
            - gcc-mingw-w64-base
            - binutils-mingw-w64-x86-64
            - gcc-mingw-w64-x86-64
            - gcc-mingw-w64
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=4"
        - NO_DIRECT_TEST=1

    - os: linux
      dist: xenial
      compiler: x86_64-w64-mingw32-gcc
      addons:
        apt:
          packages:
            - gcc-mingw-w64-base
            - binutils-mingw-w64-x86-64
            - gcc-mingw-w64-x86-64
            - gcc-mingw-w64
            - wine
      env:
        - BUILD_DIR=win
        - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1"
        - NO_DIRECT_TEST=1
before_install:
  - export ERROR_ON_FAILURES=1
  - cd ${BUILD_DIR}
install:
  - test -n "$NO_DIRECT_CONFIGURE" || ./configure ${CFGOPT}
script:
  - make
  # The styles=develop avoids some weird problems on OSX
  - test -n "$NO_DIRECT_TEST" || make test styles=develop

Changes to generic/regcustom.h.

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
typedef Tcl_UniChar chr;	/* The type itself. */
typedef int pchr;		/* What it promotes to. */
typedef unsigned uchr;		/* Unsigned type that will hold a chr. */
typedef int celt;		/* Type to hold chr, or NOCELT */
#define	NOCELT (-1)		/* Celt value which is not valid chr */
#define	CHR(c) (UCHAR(c))	/* Turn char literal into chr literal */
#define	DIGITVAL(c) ((c)-'0')	/* Turn chr digit into its value */
#if TCL_UTF_MAX > 4
#define	CHRBITS	32		/* Bits in a chr; must not use sizeof */
#define	CHR_MIN	0x00000000	/* Smallest and largest chr; the value */
#define	CHR_MAX	0x10ffff	/* CHR_MAX-CHR_MIN+1 should fit in uchr */
#else
#define	CHRBITS	16		/* Bits in a chr; must not use sizeof */
#define	CHR_MIN	0x0000		/* Smallest and largest chr; the value */
#define	CHR_MAX	0xffff		/* CHR_MAX-CHR_MIN+1 should fit in uchr */






|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
typedef Tcl_UniChar chr;	/* The type itself. */
typedef int pchr;		/* What it promotes to. */
typedef unsigned uchr;		/* Unsigned type that will hold a chr. */
typedef int celt;		/* Type to hold chr, or NOCELT */
#define	NOCELT (-1)		/* Celt value which is not valid chr */
#define	CHR(c) (UCHAR(c))	/* Turn char literal into chr literal */
#define	DIGITVAL(c) ((c)-'0')	/* Turn chr digit into its value */
#if TCL_UTF_MAX > 3
#define	CHRBITS	32		/* Bits in a chr; must not use sizeof */
#define	CHR_MIN	0x00000000	/* Smallest and largest chr; the value */
#define	CHR_MAX	0x10ffff	/* CHR_MAX-CHR_MIN+1 should fit in uchr */
#else
#define	CHRBITS	16		/* Bits in a chr; must not use sizeof */
#define	CHR_MIN	0x0000		/* Smallest and largest chr; the value */
#define	CHR_MAX	0xffff		/* CHR_MAX-CHR_MIN+1 should fit in uchr */

Changes to generic/tcl.decls.

1193
1194
1195
1196
1197
1198
1199
1200
1201
1202

1203
1204
1205
1206
1207
1208
1209
....
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250

1251
1252
1253
1254

1255
1256
1257
1258

1259
1260
1261
1262

1263
1264
1265
1266
1267
1268
1269
....
2375
2376
2377
2378
2379
2380
2381

2382
2383
2384
2385
2386
2387



















2388
2389
2390
2391
2392
2393
2394
}
declare 334 {
    int Tcl_UtfToLower(char *src)
}
declare 335 {
    int Tcl_UtfToTitle(char *src)
}
declare 336 {
    int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr)
}

declare 337 {
    int Tcl_UtfToUpper(char *src)
}
declare 338 {
    int Tcl_WriteChars(Tcl_Channel chan, const char *src, int srcLen)
}
declare 339 {
................................................................................
}
declare 350 {
    int Tcl_UniCharIsUpper(int ch)
}
declare 351 {
    int Tcl_UniCharIsWordChar(int ch)
}
declare 352 {
    int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
}

declare 353 {
    int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
	    unsigned long numChars)
}

declare 354 {
    char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
	    int uniLength, Tcl_DString *dsPtr)
}

declare 355 {
    Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
	    int length, Tcl_DString *dsPtr)
}

declare 356 {
    Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
	    int flags)
}
declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
    Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
	    int count)
................................................................................
    void Tcl_DecrRefCount(Tcl_Obj *objPtr)
}

declare 643 {
    int Tcl_IsShared(Tcl_Obj *objPtr)
}


declare 644 {
    int *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr)
}
declare 645 {
    Tcl_Obj *Tcl_NewUnicodeObj(const int *unicode, int numChars)
}




















# ----- BASELINE -- FOR -- 8.7.0 ----- #

##############################################################################

# Define the platform specific public Tcl interface. These functions are only
# available on the designated platform.






|
|
<
>







 







|
|
<
>
|
|
|
<
>
|
|
|
<
>
|
|
|
<
>







 







>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1193
1194
1195
1196
1197
1198
1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
1209
....
1241
1242
1243
1244
1245
1246
1247
1248
1249

1250
1251
1252
1253

1254
1255
1256
1257

1258
1259
1260
1261

1262
1263
1264
1265
1266
1267
1268
1269
....
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
}
declare 334 {
    int Tcl_UtfToLower(char *src)
}
declare 335 {
    int Tcl_UtfToTitle(char *src)
}
#declare 336 {
#    int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr)

#}
declare 337 {
    int Tcl_UtfToUpper(char *src)
}
declare 338 {
    int Tcl_WriteChars(Tcl_Channel chan, const char *src, int srcLen)
}
declare 339 {
................................................................................
}
declare 350 {
    int Tcl_UniCharIsUpper(int ch)
}
declare 351 {
    int Tcl_UniCharIsWordChar(int ch)
}
#declare 352 {
#    int Tcl_UniCharLen(const Tcl_UniChar *uniStr)

#}
#declare 353 {
#    int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
#	    unsigned long numChars)

#}
#declare 354 {
#    char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
#	    int uniLength, Tcl_DString *dsPtr)

#}
#declare 355 {
#    Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
#	    int length, Tcl_DString *dsPtr)

#}
declare 356 {
    Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
	    int flags)
}
declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
    Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
	    int count)
................................................................................
    void Tcl_DecrRefCount(Tcl_Obj *objPtr)
}

declare 643 {
    int Tcl_IsShared(Tcl_Obj *objPtr)
}

# TIP #???
declare 644 {
    int *Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr)
}
declare 645 {
    Tcl_Obj *Tcl_NewUnicodeObj(const int *unicode, int numChars)
}
declare 646 {
    int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr)
}
declare 647 {
    int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
}
declare 648 {
    int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
	    unsigned long numChars)
}
declare 649 {
    char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
	    int uniLength, Tcl_DString *dsPtr)
}
declare 650 {
    Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
	    int length, Tcl_DString *dsPtr)
}


# ----- BASELINE -- FOR -- 8.7.0 ----- #

##############################################################################

# Define the platform specific public Tcl interface. These functions are only
# available on the designated platform.

Changes to generic/tcl.h.

2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
....
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
 * then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
 * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
 * is the default and recommended mode. UCS-4 is experimental and not
 * recommended. It works for the core, but most extensions expect UCS-2.
 */

#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX		4
#endif

/*
 * This represents a Unicode character. Any changes to this should also be
 * reflected in regcustom.h.
 */

#if TCL_UTF_MAX > 4
    /*
     * unsigned int isn't 100% accurate as it should be a strict 4-byte value
     * (perhaps wchar_t). 64-bit systems may have troubles. The size of this
     * value must be reflected correctly in regcustom.h and
     * in tclEncoding.c.
     * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
     * XXX: string rep that Tcl_UniChar represents.  Changing the size
................................................................................

typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
				int result);

/*
 *----------------------------------------------------------------------------
 * The following constant is used to test for older versions of Tcl in the
 * stubs tables. If TCL_UTF_MAX>4 use a different value.
 */

#define TCL_STUB_MAGIC		((int) 0xFCA3BACF + (TCL_UTF_MAX>4))

/*
 * The following function is required to be defined in all stubs aware
 * extensions. The function is actually implemented in the stub library, not
 * the main Tcl library, although there is a trivial implementation in the
 * main library in case an extension is statically linked into an application.
 */






|







|







 







|


|







2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
....
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
 * then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
 * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
 * is the default and recommended mode. UCS-4 is experimental and not
 * recommended. It works for the core, but most extensions expect UCS-2.
 */

#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX		3
#endif

/*
 * This represents a Unicode character. Any changes to this should also be
 * reflected in regcustom.h.
 */

#if TCL_UTF_MAX > 3
    /*
     * unsigned int isn't 100% accurate as it should be a strict 4-byte value
     * (perhaps wchar_t). 64-bit systems may have troubles. The size of this
     * value must be reflected correctly in regcustom.h and
     * in tclEncoding.c.
     * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode
     * XXX: string rep that Tcl_UniChar represents.  Changing the size
................................................................................

typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
				int result);

/*
 *----------------------------------------------------------------------------
 * The following constant is used to test for older versions of Tcl in the
 * stubs tables.
 */

#define TCL_STUB_MAGIC		((int) 0xFCA3BACF)

/*
 * The following function is required to be defined in all stubs aware
 * extensions. The function is actually implemented in the stub library, not
 * the main Tcl library, although there is a trivial implementation in the
 * main library in case an extension is statically linked into an application.
 */

Changes to generic/tclBasic.c.

7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
....
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
....
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
	    }
	}
	break;
    case TCL_NUMBER_BIG:
	if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
	    return TCL_ERROR;
	}
	if (mp_isneg(&big)) {
	    mp_clear(&big);
	    goto negarg;
	}
	break;
    default:
	if (TclGetWideIntFromObj(interp, objv[1], &w) != TCL_OK) {
	    return TCL_ERROR;
................................................................................
    if (TclGetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
	return TCL_ERROR;
    }

    if (type == TCL_NUMBER_INT) {
	Tcl_WideInt l = *((const Tcl_WideInt *) ptr);

	if (l > (Tcl_WideInt)0) {
	    goto unChanged;
	} else if (l == (Tcl_WideInt)0) {
	    if (TclHasStringRep(objv[1])) {
		int numBytes;
		const char *bytes = TclGetStringFromObj(objv[1], &numBytes);

		while (numBytes) {
		    if (*bytes == '-') {
			Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
................................................................................
	    goto unChanged;
	}
	Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d));
	return TCL_OK;
    }

    if (type == TCL_NUMBER_BIG) {
	if (mp_isneg((const mp_int *) ptr)) {
	    Tcl_GetBignumFromObj(NULL, objv[1], &big);
	tooLarge:
	    mp_neg(&big, &big);
	    Tcl_SetObjResult(interp, Tcl_NewBignumObj(&big));
	} else {
	unChanged:
	    Tcl_SetObjResult(interp, objv[1]);






|







 







|

|







 







|







7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
....
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
....
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
	    }
	}
	break;
    case TCL_NUMBER_BIG:
	if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
	    return TCL_ERROR;
	}
	if (big.sign != MP_ZPOS) {
	    mp_clear(&big);
	    goto negarg;
	}
	break;
    default:
	if (TclGetWideIntFromObj(interp, objv[1], &w) != TCL_OK) {
	    return TCL_ERROR;
................................................................................
    if (TclGetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
	return TCL_ERROR;
    }

    if (type == TCL_NUMBER_INT) {
	Tcl_WideInt l = *((const Tcl_WideInt *) ptr);

	if (l > 0) {
	    goto unChanged;
	} else if (l == 0) {
	    if (TclHasStringRep(objv[1])) {
		int numBytes;
		const char *bytes = TclGetStringFromObj(objv[1], &numBytes);

		while (numBytes) {
		    if (*bytes == '-') {
			Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
................................................................................
	    goto unChanged;
	}
	Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d));
	return TCL_OK;
    }

    if (type == TCL_NUMBER_BIG) {
	if (((const mp_int *) ptr)->sign != MP_ZPOS) {
	    Tcl_GetBignumFromObj(NULL, objv[1], &big);
	tooLarge:
	    mp_neg(&big, &big);
	    Tcl_SetObjResult(interp, Tcl_NewBignumObj(&big));
	} else {
	unChanged:
	    Tcl_SetObjResult(interp, objv[1]);

Changes to generic/tclBinary.c.

1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
....
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
 badIndex:
    errorString = "not enough arguments for all format specifiers";
    goto error;

 badField:
    {
	Tcl_UniChar ch = 0;
	char buf[TCL_UTF_MAX + 1] = "";

	TclUtfToUniChar(errorString, &ch);
	buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"bad field specifier \"%s\"", buf));
	return TCL_ERROR;
    }
................................................................................
 badIndex:
    errorString = "not enough arguments for all format specifiers";
    goto error;

 badField:
    {
	Tcl_UniChar ch = 0;
	char buf[TCL_UTF_MAX + 1] = "";

	TclUtfToUniChar(errorString, &ch);
	buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"bad field specifier \"%s\"", buf));
	return TCL_ERROR;
    }






|







 







|







1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
....
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
 badIndex:
    errorString = "not enough arguments for all format specifiers";
    goto error;

 badField:
    {
	Tcl_UniChar ch = 0;
	char buf[5] = "";

	TclUtfToUniChar(errorString, &ch);
	buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"bad field specifier \"%s\"", buf));
	return TCL_ERROR;
    }
................................................................................
 badIndex:
    errorString = "not enough arguments for all format specifiers";
    goto error;

 badField:
    {
	Tcl_UniChar ch = 0;
	char buf[5] = "";

	TclUtfToUniChar(errorString, &ch);
	buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"bad field specifier \"%s\"", buf));
	return TCL_ERROR;
    }

Changes to generic/tclCmdMZ.c.

1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
....
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
....
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
	Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS);

	for ( ; stringPtr < end; stringPtr += len) {
	    int fullchar;
	    len = TclUtfToUniChar(stringPtr, &ch);
	    fullchar = ch;

#if TCL_UTF_MAX <= 4
	    if ((ch >= 0xD800) && (len < 3)) {
		len += TclUtfToUniChar(stringPtr + len, &ch);
		fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	    }
#endif

	    /*
................................................................................
	 */

	if (TclIsPureByteArray(objv[1])) {
	    unsigned char uch = (unsigned char) ch;

	    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(&uch, 1));
	} else {
	    char buf[TCL_UTF_MAX] = "";

	    length = Tcl_UniCharToUtf(ch, buf);
	    if ((ch >= 0xD800) && (length < 3)) {
		length += Tcl_UniCharToUtf(-1, buf + length);
	    }
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, length));
	}
................................................................................
	    goto str_is_done;
	}
	end = string1 + length1;
	for (; string1 < end; string1 += length2, failat++) {
	    int fullchar;
	    length2 = TclUtfToUniChar(string1, &ch);
	    fullchar = ch;
#if TCL_UTF_MAX <= 4
	    if ((ch >= 0xD800) && (length2 < 3)) {
	    	length2 += TclUtfToUniChar(string1 + length2, &ch);
	    	fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	    }
#endif
	    if (!chcomp(fullchar)) {
		result = 0;






|







 







|







 







|







1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
....
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
....
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
	Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS);

	for ( ; stringPtr < end; stringPtr += len) {
	    int fullchar;
	    len = TclUtfToUniChar(stringPtr, &ch);
	    fullchar = ch;

#if TCL_UTF_MAX == 3
	    if ((ch >= 0xD800) && (len < 3)) {
		len += TclUtfToUniChar(stringPtr + len, &ch);
		fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	    }
#endif

	    /*
................................................................................
	 */

	if (TclIsPureByteArray(objv[1])) {
	    unsigned char uch = (unsigned char) ch;

	    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(&uch, 1));
	} else {
	    char buf[4] = "";

	    length = Tcl_UniCharToUtf(ch, buf);
	    if ((ch >= 0xD800) && (length < 3)) {
		length += Tcl_UniCharToUtf(-1, buf + length);
	    }
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, length));
	}
................................................................................
	    goto str_is_done;
	}
	end = string1 + length1;
	for (; string1 < end; string1 += length2, failat++) {
	    int fullchar;
	    length2 = TclUtfToUniChar(string1, &ch);
	    fullchar = ch;
#if TCL_UTF_MAX == 3
	    if ((ch >= 0xD800) && (length2 < 3)) {
	    	length2 += TclUtfToUniChar(string1 + length2, &ch);
	    	fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	    }
#endif
	    if (!chcomp(fullchar)) {
		result = 0;

Changes to generic/tclCompCmdsSZ.c.

1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
	PUSH("");
	count++;
    }

    for (endTokenPtr = tokenPtr + parse.numTokens;
	    tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
	int length, literal, catchRange, breakJump;
	char buf[TCL_UTF_MAX] = "";
	JumpFixup startFixup, okFixup, returnFixup, breakFixup;
	JumpFixup continueFixup, otherFixup, endFixup;

	switch (tokenPtr->type) {
	case TCL_TOKEN_TEXT:
	    literal = TclRegisterLiteral(envPtr,
		    tokenPtr->start, tokenPtr->size, 0);






|







1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
	PUSH("");
	count++;
    }

    for (endTokenPtr = tokenPtr + parse.numTokens;
	    tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
	int length, literal, catchRange, breakJump;
	char buf[4] = "";
	JumpFixup startFixup, okFixup, returnFixup, breakFixup;
	JumpFixup continueFixup, otherFixup, endFixup;

	switch (tokenPtr->type) {
	case TCL_TOKEN_TEXT:
	    literal = TclRegisterLiteral(envPtr,
		    tokenPtr->start, tokenPtr->size, 0);

Changes to generic/tclCompExpr.c.

2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
     * have no direct relevance here.
     */

    if (!TclIsBareword(*start) || *start == '_') {
	if (Tcl_UtfCharComplete(start, numBytes)) {
	    scanned = TclUtfToUniChar(start, &ch);
	} else {
	    char utfBytes[TCL_UTF_MAX];

	    memcpy(utfBytes, start, numBytes);
	    utfBytes[numBytes] = '\0';
	    scanned = TclUtfToUniChar(utfBytes, &ch);
	}
	*lexemePtr = INVALID;
	Tcl_DecrRefCount(literal);






|







2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
     * have no direct relevance here.
     */

    if (!TclIsBareword(*start) || *start == '_') {
	if (Tcl_UtfCharComplete(start, numBytes)) {
	    scanned = TclUtfToUniChar(start, &ch);
	} else {
	    char utfBytes[4];

	    memcpy(utfBytes, start, numBytes);
	    utfBytes[numBytes] = '\0';
	    scanned = TclUtfToUniChar(utfBytes, &ch);
	}
	*lexemePtr = INVALID;
	Tcl_DecrRefCount(literal);

Changes to generic/tclCompile.c.

1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
....
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
	    if (tempPtr != NULL) {
		Tcl_AppendToObj(tempPtr, tokenPtr->start, tokenPtr->size);
	    }
	    break;

	case TCL_TOKEN_BS:
	    if (tempPtr != NULL) {
		char utfBuf[TCL_UTF_MAX] = "";
		int length = TclParseBackslash(tokenPtr->start,
			tokenPtr->size, NULL, utfBuf);

		Tcl_AppendToObj(tempPtr, utfBuf, length);
	    }
	    break;

................................................................................
				 * compile. */
    int count,			/* Number of tokens to consider at tokenPtr.
				 * Must be at least 1. */
    CompileEnv *envPtr)		/* Holds the resulting instructions. */
{
    Tcl_DString textBuffer;	/* Holds concatenated chars from adjacent
				 * TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
    char buffer[TCL_UTF_MAX] = "";
    int i, numObjsToConcat, length, adjust;
    unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
    int isLiteral, maxNumCL, numCL;
    int *clPosition = NULL;
    int depth = TclGetStackDepth(envPtr);







|







 







|







1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
....
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
	    if (tempPtr != NULL) {
		Tcl_AppendToObj(tempPtr, tokenPtr->start, tokenPtr->size);
	    }
	    break;

	case TCL_TOKEN_BS:
	    if (tempPtr != NULL) {
		char utfBuf[4] = "";
		int length = TclParseBackslash(tokenPtr->start,
			tokenPtr->size, NULL, utfBuf);

		Tcl_AppendToObj(tempPtr, utfBuf, length);
	    }
	    break;

................................................................................
				 * compile. */
    int count,			/* Number of tokens to consider at tokenPtr.
				 * Must be at least 1. */
    CompileEnv *envPtr)		/* Holds the resulting instructions. */
{
    Tcl_DString textBuffer;	/* Holds concatenated chars from adjacent
				 * TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
    char buffer[4] = "";
    int i, numObjsToConcat, length, adjust;
    unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
    int isLiteral, maxNumCL, numCL;
    int *clPosition = NULL;
    int depth = TclGetStackDepth(envPtr);

Changes to generic/tclDecls.h.

1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
....
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
....
1896
1897
1898
1899
1900
1901
1902














1903
1904
1905
1906
1907
1908
1909
....
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
....
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
....
2577
2578
2579
2580
2581
2582
2583





2584
2585
2586
2587
2588
2589
2590
....
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
....
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
....
3899
3900
3901
3902
3903
3904
3905










3906
3907
3908
3909
3910
3911
3912
....
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
EXTERN char *		Tcl_UtfToExternalDString(Tcl_Encoding encoding,
				const char *src, int srcLen,
				Tcl_DString *dsPtr);
/* 334 */
EXTERN int		Tcl_UtfToLower(char *src);
/* 335 */
EXTERN int		Tcl_UtfToTitle(char *src);
/* 336 */
EXTERN int		Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr);
/* 337 */
EXTERN int		Tcl_UtfToUpper(char *src);
/* 338 */
EXTERN int		Tcl_WriteChars(Tcl_Channel chan, const char *src,
				int srcLen);
/* 339 */
EXTERN int		Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
................................................................................
EXTERN int		Tcl_UniCharIsLower(int ch);
/* 349 */
EXTERN int		Tcl_UniCharIsSpace(int ch);
/* 350 */
EXTERN int		Tcl_UniCharIsUpper(int ch);
/* 351 */
EXTERN int		Tcl_UniCharIsWordChar(int ch);
/* 352 */
EXTERN int		Tcl_UniCharLen(const Tcl_UniChar *uniStr);
/* 353 */
EXTERN int		Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
				const Tcl_UniChar *uct,
				unsigned long numChars);
/* 354 */
EXTERN char *		Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
				int uniLength, Tcl_DString *dsPtr);
/* 355 */
EXTERN Tcl_UniChar *	Tcl_UtfToUniCharDString(const char *src, int length,
				Tcl_DString *dsPtr);
/* 356 */
EXTERN Tcl_RegExp	Tcl_GetRegExpFromObj(Tcl_Interp *interp,
				Tcl_Obj *patObj, int flags);
/* 357 */
TCL_DEPRECATED("Use Tcl_EvalTokensStandard")
Tcl_Obj *		Tcl_EvalTokens(Tcl_Interp *interp,
				Tcl_Token *tokenPtr, int count);
................................................................................
/* 643 */
EXTERN int		Tcl_IsShared(Tcl_Obj *objPtr);
/* 644 */
EXTERN int *		Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
				int *lengthPtr);
/* 645 */
EXTERN Tcl_Obj *	Tcl_NewUnicodeObj(const int *unicode, int numChars);















typedef struct {
    const struct TclPlatStubs *tclPlatStubs;
    const struct TclIntStubs *tclIntStubs;
    const struct TclIntPlatStubs *tclIntPlatStubs;
} TclStubHooks;

................................................................................
    const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */
    const char * (*tcl_UtfNext) (const char *src); /* 330 */
    const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */
    int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
    char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */
    int (*tcl_UtfToLower) (char *src); /* 334 */
    int (*tcl_UtfToTitle) (char *src); /* 335 */
    int (*tcl_UtfToUniChar) (const char *src, Tcl_UniChar *chPtr); /* 336 */
    int (*tcl_UtfToUpper) (char *src); /* 337 */
    int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */
    int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
    char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
    TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") const char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */
    TCL_DEPRECATED_API("Use Tcl_SetEncodingSearchPath") void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */
    void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */
................................................................................
    int (*tcl_UniCharIsAlnum) (int ch); /* 345 */
    int (*tcl_UniCharIsAlpha) (int ch); /* 346 */
    int (*tcl_UniCharIsDigit) (int ch); /* 347 */
    int (*tcl_UniCharIsLower) (int ch); /* 348 */
    int (*tcl_UniCharIsSpace) (int ch); /* 349 */
    int (*tcl_UniCharIsUpper) (int ch); /* 350 */
    int (*tcl_UniCharIsWordChar) (int ch); /* 351 */
    int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */
    int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */
    char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */
    Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */
    Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */
    TCL_DEPRECATED_API("Use Tcl_EvalTokensStandard") Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */
    void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */
    void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */
    int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */
    int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */
    int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */
................................................................................
    void (*tcl_StoreIntRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr, const Tcl_ObjIntRep *irPtr); /* 639 */
    int (*tcl_HasStringRep) (Tcl_Obj *objPtr); /* 640 */
    void (*tcl_IncrRefCount) (Tcl_Obj *objPtr); /* 641 */
    void (*tcl_DecrRefCount) (Tcl_Obj *objPtr); /* 642 */
    int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
    int * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 644 */
    Tcl_Obj * (*tcl_NewUnicodeObj) (const int *unicode, int numChars); /* 645 */





} TclStubs;

extern const TclStubs *tclStubsPtr;

#ifdef __cplusplus
}
#endif
................................................................................
	(tclStubsPtr->tcl_UtfToExternal) /* 332 */
#define Tcl_UtfToExternalDString \
	(tclStubsPtr->tcl_UtfToExternalDString) /* 333 */
#define Tcl_UtfToLower \
	(tclStubsPtr->tcl_UtfToLower) /* 334 */
#define Tcl_UtfToTitle \
	(tclStubsPtr->tcl_UtfToTitle) /* 335 */
#define Tcl_UtfToUniChar \
	(tclStubsPtr->tcl_UtfToUniChar) /* 336 */
#define Tcl_UtfToUpper \
	(tclStubsPtr->tcl_UtfToUpper) /* 337 */
#define Tcl_WriteChars \
	(tclStubsPtr->tcl_WriteChars) /* 338 */
#define Tcl_WriteObj \
	(tclStubsPtr->tcl_WriteObj) /* 339 */
#define Tcl_GetString \
................................................................................
	(tclStubsPtr->tcl_UniCharIsLower) /* 348 */
#define Tcl_UniCharIsSpace \
	(tclStubsPtr->tcl_UniCharIsSpace) /* 349 */
#define Tcl_UniCharIsUpper \
	(tclStubsPtr->tcl_UniCharIsUpper) /* 350 */
#define Tcl_UniCharIsWordChar \
	(tclStubsPtr->tcl_UniCharIsWordChar) /* 351 */
#define Tcl_UniCharLen \
	(tclStubsPtr->tcl_UniCharLen) /* 352 */
#define Tcl_UniCharNcmp \
	(tclStubsPtr->tcl_UniCharNcmp) /* 353 */
#define Tcl_UniCharToUtfDString \
	(tclStubsPtr->tcl_UniCharToUtfDString) /* 354 */
#define Tcl_UtfToUniCharDString \
	(tclStubsPtr->tcl_UtfToUniCharDString) /* 355 */
#define Tcl_GetRegExpFromObj \
	(tclStubsPtr->tcl_GetRegExpFromObj) /* 356 */
#define Tcl_EvalTokens \
	(tclStubsPtr->tcl_EvalTokens) /* 357 */
#define Tcl_FreeParse \
	(tclStubsPtr->tcl_FreeParse) /* 358 */
#define Tcl_LogCommandInfo \
................................................................................
	(tclStubsPtr->tcl_DecrRefCount) /* 642 */
#define Tcl_IsShared \
	(tclStubsPtr->tcl_IsShared) /* 643 */
#define Tcl_GetUnicodeFromObj \
	(tclStubsPtr->tcl_GetUnicodeFromObj) /* 644 */
#define Tcl_NewUnicodeObj \
	(tclStubsPtr->tcl_NewUnicodeObj) /* 645 */











#endif /* defined(USE_TCL_STUBS) */

/* !END!: Do not edit above this line. */

#if defined(USE_TCL_STUBS)
#   undef Tcl_CreateInterp
................................................................................
#undef Tcl_SetLongObj
#define Tcl_SetLongObj(objPtr, value)	Tcl_SetWideIntObj((objPtr), (long)(value))
#undef Tcl_GetUnicode
#define Tcl_GetUnicode(objPtr)	Tcl_GetUnicodeFromObj((objPtr), NULL)
#undef Tcl_BackgroundError
#define Tcl_BackgroundError(interp)	Tcl_BackgroundException((interp), TCL_ERROR)

#if TCL_UTF_MAX <= 4
#   undef Tcl_GetUnicodeFromObj
#   define Tcl_GetUnicodeFromObj Tcl_GetUtf16FromObj
#   undef Tcl_NewUnicodeObj
#   define Tcl_NewUnicodeObj Tcl_NewUtf16Obj
#endif

/*






|
<







 







|
|
|
|
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







|
|
|
|







 







>
>
>
>
>







 







|
<







 







|
|
|
|
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>







 







|







1021
1022
1023
1024
1025
1026
1027
1028

1029
1030
1031
1032
1033
1034
1035
....
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065








1066
1067
1068
1069
1070
1071
1072
....
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
....
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
....
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
....
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
....
3289
3290
3291
3292
3293
3294
3295
3296

3297
3298
3299
3300
3301
3302
3303
....
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330




3331
3332
3333
3334
3335
3336
3337
....
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
....
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
EXTERN char *		Tcl_UtfToExternalDString(Tcl_Encoding encoding,
				const char *src, int srcLen,
				Tcl_DString *dsPtr);
/* 334 */
EXTERN int		Tcl_UtfToLower(char *src);
/* 335 */
EXTERN int		Tcl_UtfToTitle(char *src);
/* Slot 336 is reserved */

/* 337 */
EXTERN int		Tcl_UtfToUpper(char *src);
/* 338 */
EXTERN int		Tcl_WriteChars(Tcl_Channel chan, const char *src,
				int srcLen);
/* 339 */
EXTERN int		Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
................................................................................
EXTERN int		Tcl_UniCharIsLower(int ch);
/* 349 */
EXTERN int		Tcl_UniCharIsSpace(int ch);
/* 350 */
EXTERN int		Tcl_UniCharIsUpper(int ch);
/* 351 */
EXTERN int		Tcl_UniCharIsWordChar(int ch);
/* Slot 352 is reserved */
/* Slot 353 is reserved */
/* Slot 354 is reserved */
/* Slot 355 is reserved */








/* 356 */
EXTERN Tcl_RegExp	Tcl_GetRegExpFromObj(Tcl_Interp *interp,
				Tcl_Obj *patObj, int flags);
/* 357 */
TCL_DEPRECATED("Use Tcl_EvalTokensStandard")
Tcl_Obj *		Tcl_EvalTokens(Tcl_Interp *interp,
				Tcl_Token *tokenPtr, int count);
................................................................................
/* 643 */
EXTERN int		Tcl_IsShared(Tcl_Obj *objPtr);
/* 644 */
EXTERN int *		Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
				int *lengthPtr);
/* 645 */
EXTERN Tcl_Obj *	Tcl_NewUnicodeObj(const int *unicode, int numChars);
/* 646 */
EXTERN int		Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr);
/* 647 */
EXTERN int		Tcl_UniCharLen(const Tcl_UniChar *uniStr);
/* 648 */
EXTERN int		Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
				const Tcl_UniChar *uct,
				unsigned long numChars);
/* 649 */
EXTERN char *		Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
				int uniLength, Tcl_DString *dsPtr);
/* 650 */
EXTERN Tcl_UniChar *	Tcl_UtfToUniCharDString(const char *src, int length,
				Tcl_DString *dsPtr);

typedef struct {
    const struct TclPlatStubs *tclPlatStubs;
    const struct TclIntStubs *tclIntStubs;
    const struct TclIntPlatStubs *tclIntPlatStubs;
} TclStubHooks;

................................................................................
    const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */
    const char * (*tcl_UtfNext) (const char *src); /* 330 */
    const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */
    int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
    char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */
    int (*tcl_UtfToLower) (char *src); /* 334 */
    int (*tcl_UtfToTitle) (char *src); /* 335 */
    void (*reserved336)(void);
    int (*tcl_UtfToUpper) (char *src); /* 337 */
    int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */
    int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */
    char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */
    TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") const char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */
    TCL_DEPRECATED_API("Use Tcl_SetEncodingSearchPath") void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */
    void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */
................................................................................
    int (*tcl_UniCharIsAlnum) (int ch); /* 345 */
    int (*tcl_UniCharIsAlpha) (int ch); /* 346 */
    int (*tcl_UniCharIsDigit) (int ch); /* 347 */
    int (*tcl_UniCharIsLower) (int ch); /* 348 */
    int (*tcl_UniCharIsSpace) (int ch); /* 349 */
    int (*tcl_UniCharIsUpper) (int ch); /* 350 */
    int (*tcl_UniCharIsWordChar) (int ch); /* 351 */
    void (*reserved352)(void);
    void (*reserved353)(void);
    void (*reserved354)(void);
    void (*reserved355)(void);
    Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */
    TCL_DEPRECATED_API("Use Tcl_EvalTokensStandard") Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */
    void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */
    void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */
    int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */
    int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */
    int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */
................................................................................
    void (*tcl_StoreIntRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr, const Tcl_ObjIntRep *irPtr); /* 639 */
    int (*tcl_HasStringRep) (Tcl_Obj *objPtr); /* 640 */
    void (*tcl_IncrRefCount) (Tcl_Obj *objPtr); /* 641 */
    void (*tcl_DecrRefCount) (Tcl_Obj *objPtr); /* 642 */
    int (*tcl_IsShared) (Tcl_Obj *objPtr); /* 643 */
    int * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 644 */
    Tcl_Obj * (*tcl_NewUnicodeObj) (const int *unicode, int numChars); /* 645 */
    int (*tcl_UtfToUniChar) (const char *src, Tcl_UniChar *chPtr); /* 646 */
    int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 647 */
    int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 648 */
    char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, int uniLength, Tcl_DString *dsPtr); /* 649 */
    Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 650 */
} TclStubs;

extern const TclStubs *tclStubsPtr;

#ifdef __cplusplus
}
#endif
................................................................................
	(tclStubsPtr->tcl_UtfToExternal) /* 332 */
#define Tcl_UtfToExternalDString \
	(tclStubsPtr->tcl_UtfToExternalDString) /* 333 */
#define Tcl_UtfToLower \
	(tclStubsPtr->tcl_UtfToLower) /* 334 */
#define Tcl_UtfToTitle \
	(tclStubsPtr->tcl_UtfToTitle) /* 335 */
/* Slot 336 is reserved */

#define Tcl_UtfToUpper \
	(tclStubsPtr->tcl_UtfToUpper) /* 337 */
#define Tcl_WriteChars \
	(tclStubsPtr->tcl_WriteChars) /* 338 */
#define Tcl_WriteObj \
	(tclStubsPtr->tcl_WriteObj) /* 339 */
#define Tcl_GetString \
................................................................................
	(tclStubsPtr->tcl_UniCharIsLower) /* 348 */
#define Tcl_UniCharIsSpace \
	(tclStubsPtr->tcl_UniCharIsSpace) /* 349 */
#define Tcl_UniCharIsUpper \
	(tclStubsPtr->tcl_UniCharIsUpper) /* 350 */
#define Tcl_UniCharIsWordChar \
	(tclStubsPtr->tcl_UniCharIsWordChar) /* 351 */
/* Slot 352 is reserved */
/* Slot 353 is reserved */
/* Slot 354 is reserved */
/* Slot 355 is reserved */




#define Tcl_GetRegExpFromObj \
	(tclStubsPtr->tcl_GetRegExpFromObj) /* 356 */
#define Tcl_EvalTokens \
	(tclStubsPtr->tcl_EvalTokens) /* 357 */
#define Tcl_FreeParse \
	(tclStubsPtr->tcl_FreeParse) /* 358 */
#define Tcl_LogCommandInfo \
................................................................................
	(tclStubsPtr->tcl_DecrRefCount) /* 642 */
#define Tcl_IsShared \
	(tclStubsPtr->tcl_IsShared) /* 643 */
#define Tcl_GetUnicodeFromObj \
	(tclStubsPtr->tcl_GetUnicodeFromObj) /* 644 */
#define Tcl_NewUnicodeObj \
	(tclStubsPtr->tcl_NewUnicodeObj) /* 645 */
#define Tcl_UtfToUniChar \
	(tclStubsPtr->tcl_UtfToUniChar) /* 646 */
#define Tcl_UniCharLen \
	(tclStubsPtr->tcl_UniCharLen) /* 647 */
#define Tcl_UniCharNcmp \
	(tclStubsPtr->tcl_UniCharNcmp) /* 648 */
#define Tcl_UniCharToUtfDString \
	(tclStubsPtr->tcl_UniCharToUtfDString) /* 649 */
#define Tcl_UtfToUniCharDString \
	(tclStubsPtr->tcl_UtfToUniCharDString) /* 650 */

#endif /* defined(USE_TCL_STUBS) */

/* !END!: Do not edit above this line. */

#if defined(USE_TCL_STUBS)
#   undef Tcl_CreateInterp
................................................................................
#undef Tcl_SetLongObj
#define Tcl_SetLongObj(objPtr, value)	Tcl_SetWideIntObj((objPtr), (long)(value))
#undef Tcl_GetUnicode
#define Tcl_GetUnicode(objPtr)	Tcl_GetUnicodeFromObj((objPtr), NULL)
#undef Tcl_BackgroundError
#define Tcl_BackgroundError(interp)	Tcl_BackgroundException((interp), TCL_ERROR)

#if TCL_UTF_MAX == 3
#   undef Tcl_GetUnicodeFromObj
#   define Tcl_GetUnicodeFromObj Tcl_GetUtf16FromObj
#   undef Tcl_NewUnicodeObj
#   define Tcl_NewUnicodeObj Tcl_NewUtf16Obj
#endif

/*

Changes to generic/tclDisassemble.c.

899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
	    i += 2;
	    continue;
	case '\v':
	    Tcl_AppendToObj(appendObj, "\\v", -1);
	    i += 2;
	    continue;
	default:
#if TCL_UTF_MAX > 4
	    if (ch > 0xffff) {
		Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
		i += 10;
	    } else
#else
	    /* If len == 0, this means we have a char > 0xffff, resulting in
	     * TclUtfToUniChar producing a surrogate pair. We want to output






|







899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
	    i += 2;
	    continue;
	case '\v':
	    Tcl_AppendToObj(appendObj, "\\v", -1);
	    i += 2;
	    continue;
	default:
#if TCL_UTF_MAX > 3
	    if (ch > 0xffff) {
		Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch);
		i += 10;
	    } else
#else
	    /* If len == 0, this means we have a char > 0xffff, resulting in
	     * TclUtfToUniChar producing a surrogate pair. We want to output

Changes to generic/tclEncoding.c.

1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
....
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
....
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
....
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
....
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
....
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
....
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
....
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
	result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
		flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
		dstCharsPtr);
	if (*dstCharsPtr <= maxChars) {
	    break;
	}
	dstLen = Tcl_UtfAtIndex(dst, maxChars) - 1 - dst + TCL_UTF_MAX;
	flags = savedFlags;
	*statePtr = savedState;
    } while (1);
    if (!noTerminate) {
	/* ...and then append it */

	dst[*dstWrotePtr] = '\0';
................................................................................
	    *chPtr = (unsigned char) *src;
	    src += 1;
	    dst += Tcl_UniCharToUtf(*chPtr, dst);
	} else {
	    int len = TclUtfToUniChar(src, chPtr);
	    src += len;
	    dst += Tcl_UniCharToUtf(*chPtr, dst);
#if TCL_UTF_MAX <= 4
	    if ((*chPtr >= 0xD800) && (len < 3)) {
		src += TclUtfToUniChar(src + len, chPtr);
		dst += Tcl_UniCharToUtf(*chPtr, dst);
	    }
#endif
	}
    }
................................................................................

	/*
	 * Need to handle this in a way that won't cause misalignment by
	 * casting dst to a Tcl_UniChar. [Bug 1122671]
	 */

#ifdef WORDS_BIGENDIAN
#if TCL_UTF_MAX > 4
	if (*chPtr <= 0xFFFF) {
	    *dst++ = (*chPtr >> 8);
	    *dst++ = (*chPtr & 0xFF);
	} else {
	    *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC;
	    *dst++ = (*chPtr & 0xFF);
	    *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
................................................................................
	    *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
	}
#else
	*dst++ = (*chPtr >> 8);
	*dst++ = (*chPtr & 0xFF);
#endif
#else
#if TCL_UTF_MAX > 4
	if (*chPtr <= 0xFFFF) {
	    *dst++ = (*chPtr & 0xFF);
	    *dst++ = (*chPtr >> 8);
	} else {
	    *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
	    *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
	    *dst++ = (*chPtr & 0xFF);
................................................................................
				 * the conversion. */
    int *dstCharsPtr)		/* Filled with the number of characters that
				 * correspond to the bytes stored in the
				 * output buffer. */
{
    const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
    int result, numChars;
#if TCL_UTF_MAX <= 4
    int len;
#endif
    Tcl_UniChar ch = 0;

    srcStart = src;
    srcEnd = src + srcLen;
    srcClose = srcEnd;
................................................................................
	    result = TCL_CONVERT_MULTIBYTE;
	    break;
	}
	if (dst > dstEnd) {
	    result = TCL_CONVERT_NOSPACE;
	    break;
	}
#if TCL_UTF_MAX <= 4
	src += (len = TclUtfToUniChar(src, &ch));
	if ((ch >= 0xD800) && (len < 3)) {
	    src += TclUtfToUniChar(src, &ch);
	    ch = 0xFFFD;
	}
#else
	src += TclUtfToUniChar(src, &ch);
................................................................................
	     */

	    result = TCL_CONVERT_MULTIBYTE;
	    break;
	}
	len = TclUtfToUniChar(src, &ch);

#if TCL_UTF_MAX > 4
	/*
	 * This prevents a crash condition. More evaluation is required for
	 * full support of int Tcl_UniChar. [Bug 1004065]
	 */

	if (ch & 0xffff0000) {
	    word = 0;
................................................................................
	len = TclUtfToUniChar(src, &ch);

	/*
	 * Check for illegal characters.
	 */

	if (ch > 0xff
#if TCL_UTF_MAX <= 4
		|| ((ch >= 0xD800) && (len < 3))
#endif
		) {
	    if (flags & TCL_ENCODING_STOPONERROR) {
		result = TCL_CONVERT_UNKNOWN;
		break;
	    }
#if TCL_UTF_MAX <= 4
	    if ((ch >= 0xD800) && (len < 3)) len = 4;
#endif
	    /*
	     * Plunge on, using '?' as a fallback character.
	     */

	    ch = (Tcl_UniChar) '?';






|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







|







1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
....
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
....
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
....
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
....
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
....
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
....
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
....
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
	result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
		flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
		dstCharsPtr);
	if (*dstCharsPtr <= maxChars) {
	    break;
	}
	dstLen = Tcl_UtfAtIndex(dst, maxChars) - dst + (TCL_UTF_MAX - 1);
	flags = savedFlags;
	*statePtr = savedState;
    } while (1);
    if (!noTerminate) {
	/* ...and then append it */

	dst[*dstWrotePtr] = '\0';
................................................................................
	    *chPtr = (unsigned char) *src;
	    src += 1;
	    dst += Tcl_UniCharToUtf(*chPtr, dst);
	} else {
	    int len = TclUtfToUniChar(src, chPtr);
	    src += len;
	    dst += Tcl_UniCharToUtf(*chPtr, dst);
#if TCL_UTF_MAX == 3
	    if ((*chPtr >= 0xD800) && (len < 3)) {
		src += TclUtfToUniChar(src + len, chPtr);
		dst += Tcl_UniCharToUtf(*chPtr, dst);
	    }
#endif
	}
    }
................................................................................

	/*
	 * Need to handle this in a way that won't cause misalignment by
	 * casting dst to a Tcl_UniChar. [Bug 1122671]
	 */

#ifdef WORDS_BIGENDIAN
#if TCL_UTF_MAX > 3
	if (*chPtr <= 0xFFFF) {
	    *dst++ = (*chPtr >> 8);
	    *dst++ = (*chPtr & 0xFF);
	} else {
	    *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC;
	    *dst++ = (*chPtr & 0xFF);
	    *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
................................................................................
	    *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
	}
#else
	*dst++ = (*chPtr >> 8);
	*dst++ = (*chPtr & 0xFF);
#endif
#else
#if TCL_UTF_MAX > 3
	if (*chPtr <= 0xFFFF) {
	    *dst++ = (*chPtr & 0xFF);
	    *dst++ = (*chPtr >> 8);
	} else {
	    *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
	    *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
	    *dst++ = (*chPtr & 0xFF);
................................................................................
				 * the conversion. */
    int *dstCharsPtr)		/* Filled with the number of characters that
				 * correspond to the bytes stored in the
				 * output buffer. */
{
    const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
    int result, numChars;
#if TCL_UTF_MAX == 3
    int len;
#endif
    Tcl_UniChar ch = 0;

    srcStart = src;
    srcEnd = src + srcLen;
    srcClose = srcEnd;
................................................................................
	    result = TCL_CONVERT_MULTIBYTE;
	    break;
	}
	if (dst > dstEnd) {
	    result = TCL_CONVERT_NOSPACE;
	    break;
	}
#if TCL_UTF_MAX == 3
	src += (len = TclUtfToUniChar(src, &ch));
	if ((ch >= 0xD800) && (len < 3)) {
	    src += TclUtfToUniChar(src, &ch);
	    ch = 0xFFFD;
	}
#else
	src += TclUtfToUniChar(src, &ch);
................................................................................
	     */

	    result = TCL_CONVERT_MULTIBYTE;
	    break;
	}
	len = TclUtfToUniChar(src, &ch);

#if TCL_UTF_MAX > 3
	/*
	 * This prevents a crash condition. More evaluation is required for
	 * full support of int Tcl_UniChar. [Bug 1004065]
	 */

	if (ch & 0xffff0000) {
	    word = 0;
................................................................................
	len = TclUtfToUniChar(src, &ch);

	/*
	 * Check for illegal characters.
	 */

	if (ch > 0xff
#if TCL_UTF_MAX == 3
		|| ((ch >= 0xD800) && (len < 3))
#endif
		) {
	    if (flags & TCL_ENCODING_STOPONERROR) {
		result = TCL_CONVERT_UNKNOWN;
		break;
	    }
#if TCL_UTF_MAX == 3
	    if ((ch >= 0xD800) && (len < 3)) len = 4;
#endif
	    /*
	     * Plunge on, using '?' as a fallback character.
	     */

	    ch = (Tcl_UniChar) '?';

Changes to generic/tclExecute.c.

5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
....
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
....
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
....
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
....
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
....
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
....
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
....
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
....
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
....
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
....
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
	} else if (TclIsPureByteArray(valuePtr)) {
	    objResultPtr = Tcl_NewByteArrayObj(
		    Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1);
	} else if (valuePtr->bytes && length == valuePtr->length) {
	    objResultPtr = Tcl_NewStringObj((const char *)
		    valuePtr->bytes+index, 1);
	} else {
	    char buf[TCL_UTF_MAX] = "";
	    int ch = Tcl_GetUniChar(valuePtr, index);

	    /*
	     * This could be: Tcl_NewUnicodeObj((const Tcl_UniChar *)&ch, 1)
	     * but creating the object as a string seems to be faster in
	     * practical use.
	     */
................................................................................
		/*
		 * Force Tcl's integer division rules.
		 * TODO: examine for logic simplification
		 */

		if (((wQuotient < (Tcl_WideInt) 0)
			|| ((wQuotient == (Tcl_WideInt) 0)
			&& ((w1 < (Tcl_WideInt)0 && w2 > (Tcl_WideInt)0)
			|| (w1 > (Tcl_WideInt)0 && w2 < (Tcl_WideInt)0))))
			&& (wQuotient * w2 != w1)) {
		    wQuotient -= (Tcl_WideInt) 1;
		}
		wRemainder = w1 - w2*wQuotient;
		WIDE_RESULT(wRemainder);
	    }

................................................................................
	    return NULL;
	}
	Tcl_GetBignumFromObj(NULL, valuePtr, &big1);
	Tcl_GetBignumFromObj(NULL, value2Ptr, &big2);
	mp_init(&bigResult);
	mp_init(&bigRemainder);
	mp_div(&big1, &big2, &bigResult, &bigRemainder);
	if (!mp_iszero(&bigRemainder) && (bigRemainder.sign != big2.sign)) {
	    /*
	     * Convert to Tcl's integer division rules.
	     */

	    mp_sub_d(&bigResult, 1, &bigResult);
	    mp_add(&bigRemainder, &big2, &bigRemainder);
	}
................................................................................
    case INST_RSHIFT: {
	/*
	 * Reject negative shift argument.
	 */

	switch (type2) {
	case TCL_NUMBER_INT:
	    invalid = (*((const Tcl_WideInt *)ptr2) < (Tcl_WideInt)0);
	    break;
	case TCL_NUMBER_BIG:
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    invalid = mp_isneg(&big2);
	    mp_clear(&big2);
	    break;
	default:
	    /* Unused, here to silence compiler warning */
	    invalid = 0;
	}
	if (invalid) {
................................................................................
	    return GENERAL_ARITHMETIC_ERROR;
	}

	/*
	 * Zero shifted any number of bits is still zero.
	 */

	if ((type1==TCL_NUMBER_INT) && (*((const Tcl_WideInt *)ptr1) == (Tcl_WideInt)0)) {
	    return constants[0];
	}

	if (opcode == INST_LSHIFT) {
	    /*
	     * Large left shifts create integer overflow.
	     *
................................................................................
		 * not take us to the result of 0 or -1, but since we're using
		 * mp_div_2d to do the work, and it takes only an int
		 * argument, we draw the line there.
		 */

		switch (type1) {
		case TCL_NUMBER_INT:
		    zero = (*(const Tcl_WideInt *)ptr1 > (Tcl_WideInt)0);
		    break;
		case TCL_NUMBER_BIG:
		    Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
		    zero = (!mp_isneg(&big1));
		    mp_clear(&big1);
		    break;
		default:
		    /* Unused, here to silence compiler warning. */
		    zero = 0;
		}
		if (zero) {
................................................................................
	    /*
	     * Handle shifts within the native wide range.
	     */

	    if (type1 == TCL_NUMBER_INT) {
		w1 = *(const Tcl_WideInt *)ptr1;
		if ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideInt)) {
		    if (w1 >= (Tcl_WideInt)0) {
			return constants[0];
		    }
		    WIDE_RESULT(-1);
		}
		WIDE_RESULT(w1 >> shift);
	    }
	}
................................................................................
		return NULL;
	    }

	    negativeExponent = (w2 < 0);
	    oddExponent = (int) (w2 & (Tcl_WideInt)1);
	} else {
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    negativeExponent = mp_isneg(&big2);
	    mp_mod_2d(&big2, 1, &big2);
	    oddExponent = !mp_iszero(&big2);
	    mp_clear(&big2);
	}

	if (type1 == TCL_NUMBER_INT) {
	    w1 = *((const Tcl_WideInt *)ptr1);

	    if (negativeExponent) {
................................................................................
	case INST_SUB:
	    mp_sub(&big1, &big2, &bigResult);
	    break;
	case INST_MULT:
	    mp_mul(&big1, &big2, &bigResult);
	    break;
	case INST_DIV:
	    if (mp_iszero(&big2)) {
		mp_clear(&big1);
		mp_clear(&big2);
		mp_clear(&bigResult);
		return DIVIDED_BY_ZERO;
	    }
	    mp_init(&bigRemainder);
	    mp_div(&big1, &big2, &bigResult, &bigRemainder);
	    /* TODO: internals intrusion */
	    if (!mp_iszero(&bigRemainder)
		    && (bigRemainder.sign != big2.sign)) {
		/*
		 * Convert to Tcl's integer division rules.
		 */

		mp_sub_d(&bigResult, 1, &bigResult);
		mp_add(&bigRemainder, &big2, &bigRemainder);
................................................................................
	    if (d2 > (double)WIDE_MAX) {
		return MP_LT;
	    }
	    w2 = (Tcl_WideInt) d2;
	    goto wideCompare;
	case TCL_NUMBER_BIG:
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    if (mp_isneg(&big2)) {
		compare = MP_GT;
	    } else {
		compare = MP_LT;
	    }
	    mp_clear(&big2);
	    return compare;
	}
................................................................................
	    goto wideCompare;
	case TCL_NUMBER_BIG:
	    if (TclIsInfinite(d1)) {
		return (d1 > 0.0) ? MP_GT : MP_LT;
	    }
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    if ((d1 < (double)WIDE_MAX) && (d1 > (double)WIDE_MIN)) {
		if (mp_isneg(&big2)) {
		    compare = MP_GT;
		} else {
		    compare = MP_LT;
		}
		mp_clear(&big2);
		return compare;
	    }






|







 







|
|







 







|







 







|



|







 







|







 







|



|







 







|







 







|

|







 







|








|







 







|







 







|







5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
....
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
....
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
....
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
....
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
....
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
....
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
....
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
....
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
....
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
....
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
	} else if (TclIsPureByteArray(valuePtr)) {
	    objResultPtr = Tcl_NewByteArrayObj(
		    Tcl_GetByteArrayFromObj(valuePtr, NULL)+index, 1);
	} else if (valuePtr->bytes && length == valuePtr->length) {
	    objResultPtr = Tcl_NewStringObj((const char *)
		    valuePtr->bytes+index, 1);
	} else {
	    char buf[4] = "";
	    int ch = Tcl_GetUniChar(valuePtr, index);

	    /*
	     * This could be: Tcl_NewUnicodeObj((const Tcl_UniChar *)&ch, 1)
	     * but creating the object as a string seems to be faster in
	     * practical use.
	     */
................................................................................
		/*
		 * Force Tcl's integer division rules.
		 * TODO: examine for logic simplification
		 */

		if (((wQuotient < (Tcl_WideInt) 0)
			|| ((wQuotient == (Tcl_WideInt) 0)
			&& ((w1 < 0 && w2 > 0)
			|| (w1 > 0 && w2 < 0))))
			&& (wQuotient * w2 != w1)) {
		    wQuotient -= (Tcl_WideInt) 1;
		}
		wRemainder = w1 - w2*wQuotient;
		WIDE_RESULT(wRemainder);
	    }

................................................................................
	    return NULL;
	}
	Tcl_GetBignumFromObj(NULL, valuePtr, &big1);
	Tcl_GetBignumFromObj(NULL, value2Ptr, &big2);
	mp_init(&bigResult);
	mp_init(&bigRemainder);
	mp_div(&big1, &big2, &bigResult, &bigRemainder);
	if ((bigRemainder.used != 0) && (bigRemainder.sign != big2.sign)) {
	    /*
	     * Convert to Tcl's integer division rules.
	     */

	    mp_sub_d(&bigResult, 1, &bigResult);
	    mp_add(&bigRemainder, &big2, &bigRemainder);
	}
................................................................................
    case INST_RSHIFT: {
	/*
	 * Reject negative shift argument.
	 */

	switch (type2) {
	case TCL_NUMBER_INT:
	    invalid = (*((const Tcl_WideInt *)ptr2) < 0);
	    break;
	case TCL_NUMBER_BIG:
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    invalid = big2.sign != MP_ZPOS;
	    mp_clear(&big2);
	    break;
	default:
	    /* Unused, here to silence compiler warning */
	    invalid = 0;
	}
	if (invalid) {
................................................................................
	    return GENERAL_ARITHMETIC_ERROR;
	}

	/*
	 * Zero shifted any number of bits is still zero.
	 */

	if ((type1==TCL_NUMBER_INT) && (*((const Tcl_WideInt *)ptr1) == 0)) {
	    return constants[0];
	}

	if (opcode == INST_LSHIFT) {
	    /*
	     * Large left shifts create integer overflow.
	     *
................................................................................
		 * not take us to the result of 0 or -1, but since we're using
		 * mp_div_2d to do the work, and it takes only an int
		 * argument, we draw the line there.
		 */

		switch (type1) {
		case TCL_NUMBER_INT:
		    zero = (*(const Tcl_WideInt *)ptr1 > 0);
		    break;
		case TCL_NUMBER_BIG:
		    Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
		    zero = (big1.sign == MP_ZPOS);
		    mp_clear(&big1);
		    break;
		default:
		    /* Unused, here to silence compiler warning. */
		    zero = 0;
		}
		if (zero) {
................................................................................
	    /*
	     * Handle shifts within the native wide range.
	     */

	    if (type1 == TCL_NUMBER_INT) {
		w1 = *(const Tcl_WideInt *)ptr1;
		if ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideInt)) {
		    if (w1 >= 0) {
			return constants[0];
		    }
		    WIDE_RESULT(-1);
		}
		WIDE_RESULT(w1 >> shift);
	    }
	}
................................................................................
		return NULL;
	    }

	    negativeExponent = (w2 < 0);
	    oddExponent = (int) (w2 & (Tcl_WideInt)1);
	} else {
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    negativeExponent = big2.sign != MP_ZPOS;
	    mp_mod_2d(&big2, 1, &big2);
	    oddExponent = big2.used != 0;
	    mp_clear(&big2);
	}

	if (type1 == TCL_NUMBER_INT) {
	    w1 = *((const Tcl_WideInt *)ptr1);

	    if (negativeExponent) {
................................................................................
	case INST_SUB:
	    mp_sub(&big1, &big2, &bigResult);
	    break;
	case INST_MULT:
	    mp_mul(&big1, &big2, &bigResult);
	    break;
	case INST_DIV:
	    if (big2.used == 0) {
		mp_clear(&big1);
		mp_clear(&big2);
		mp_clear(&bigResult);
		return DIVIDED_BY_ZERO;
	    }
	    mp_init(&bigRemainder);
	    mp_div(&big1, &big2, &bigResult, &bigRemainder);
	    /* TODO: internals intrusion */
	    if ((bigRemainder.used != 0)
		    && (bigRemainder.sign != big2.sign)) {
		/*
		 * Convert to Tcl's integer division rules.
		 */

		mp_sub_d(&bigResult, 1, &bigResult);
		mp_add(&bigRemainder, &big2, &bigRemainder);
................................................................................
	    if (d2 > (double)WIDE_MAX) {
		return MP_LT;
	    }
	    w2 = (Tcl_WideInt) d2;
	    goto wideCompare;
	case TCL_NUMBER_BIG:
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    if (big2.sign != MP_ZPOS) {
		compare = MP_GT;
	    } else {
		compare = MP_LT;
	    }
	    mp_clear(&big2);
	    return compare;
	}
................................................................................
	    goto wideCompare;
	case TCL_NUMBER_BIG:
	    if (TclIsInfinite(d1)) {
		return (d1 > 0.0) ? MP_GT : MP_LT;
	    }
	    Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
	    if ((d1 < (double)WIDE_MAX) && (d1 > (double)WIDE_MIN)) {
		if (big2.sign != MP_ZPOS) {
		    compare = MP_GT;
		} else {
		    compare = MP_LT;
		}
		mp_clear(&big2);
		return compare;
	    }

Changes to generic/tclIO.c.

4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
....
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
....
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
....
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
	    if (GotFlag(statePtr, INPUT_SAW_CR)) {
		ResetFlag(statePtr, INPUT_SAW_CR);
		if ((eol < dstEnd) && (*eol == '\n')) {
		    /*
		     * Skip the raw bytes that make up the '\n'.
		     */

		    char tmp[TCL_UTF_MAX];
		    int rawRead;

		    bufPtr = gs.bufPtr;
		    Tcl_ExternalToUtf(NULL, gs.encoding, RemovePoint(bufPtr),
			    gs.rawRead, statePtr->inputEncodingFlags
				| TCL_ENCODING_NO_TERMINATE, &gs.state, tmp,
			    TCL_UTF_MAX, &rawRead, NULL, NULL);
................................................................................
		{
		    /*
		     * There are chars leading the buffer before the eof char.
		     * Adjust the dstLimit so we go back and read only those
		     * and do not encounter the eof char this time.
		     */

		    dstLimit = dstRead - 1 + TCL_UTF_MAX;
		    statePtr->flags = savedFlags;
		    statePtr->inputEncodingFlags = savedIEFlags;
		    statePtr->inputEncodingState = savedState;
		    continue;
		}
	    }

................................................................................
		/*
		 * There are chars we can read before we hit the bare CR.  Go
		 * back with a smaller dstLimit so we get them in the next
		 * pass, compute a matching srcRead, and don't end up back
		 * here in this call.
		 */

		dstLimit = dstRead - 1 + TCL_UTF_MAX;
		statePtr->flags = savedFlags;
		statePtr->inputEncodingFlags = savedIEFlags;
		statePtr->inputEncodingState = savedState;
		continue;
	    }

	    assert(dstWrote == 0);
................................................................................
	    /*
	     * We decoded only the bare CR, and we cannot read a translated
	     * char from that alone. We have to know what's next.  So why do
	     * we only have the one decoded char?
	     */

	    if (code != TCL_OK) {
		char buffer[TCL_UTF_MAX + 1];
		int read, decoded, count;

		/*
		 * Didn't get everything the buffer could offer
		 */

		statePtr->flags = savedFlags;






|







 







|







 







|







 







|







4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
....
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
....
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
....
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
	    if (GotFlag(statePtr, INPUT_SAW_CR)) {
		ResetFlag(statePtr, INPUT_SAW_CR);
		if ((eol < dstEnd) && (*eol == '\n')) {
		    /*
		     * Skip the raw bytes that make up the '\n'.
		     */

		    char tmp[4];
		    int rawRead;

		    bufPtr = gs.bufPtr;
		    Tcl_ExternalToUtf(NULL, gs.encoding, RemovePoint(bufPtr),
			    gs.rawRead, statePtr->inputEncodingFlags
				| TCL_ENCODING_NO_TERMINATE, &gs.state, tmp,
			    TCL_UTF_MAX, &rawRead, NULL, NULL);
................................................................................
		{
		    /*
		     * There are chars leading the buffer before the eof char.
		     * Adjust the dstLimit so we go back and read only those
		     * and do not encounter the eof char this time.
		     */

		    dstLimit = dstRead + (TCL_UTF_MAX - 1);
		    statePtr->flags = savedFlags;
		    statePtr->inputEncodingFlags = savedIEFlags;
		    statePtr->inputEncodingState = savedState;
		    continue;
		}
	    }

................................................................................
		/*
		 * There are chars we can read before we hit the bare CR.  Go
		 * back with a smaller dstLimit so we get them in the next
		 * pass, compute a matching srcRead, and don't end up back
		 * here in this call.
		 */

		dstLimit = dstRead + (TCL_UTF_MAX - 1);
		statePtr->flags = savedFlags;
		statePtr->inputEncodingFlags = savedIEFlags;
		statePtr->inputEncodingState = savedState;
		continue;
	    }

	    assert(dstWrote == 0);
................................................................................
	    /*
	     * We decoded only the bare CR, and we cannot read a translated
	     * char from that alone. We have to know what's next.  So why do
	     * we only have the one decoded char?
	     */

	    if (code != TCL_OK) {
		char buffer[5];
		int read, decoded, count;

		/*
		 * Didn't get everything the buffer could offer
		 */

		statePtr->flags = savedFlags;

Changes to generic/tclInt.h.

3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
....
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
MODULE_SCOPE int	TclInfoGlobalsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE int	TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE int	TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void	TclInitAlloc(void);
MODULE_SCOPE void	TclInitBignumFromLong(mp_int *, long);
MODULE_SCOPE void	TclInitBignumFromWideInt(mp_int *, Tcl_WideInt);
MODULE_SCOPE void	TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt);
MODULE_SCOPE void	TclInitDbCkalloc(void);
MODULE_SCOPE void	TclInitDoubleConversion(void);
MODULE_SCOPE void	TclInitEmbeddedConfigurationInformation(
			    Tcl_Interp *interp);
MODULE_SCOPE void	TclInitEncodingSubsystem(void);
................................................................................
			    const char *trim, int numTrim);
MODULE_SCOPE int	TclTrimRight(const char *bytes, int numBytes,
			    const char *trim, int numTrim);
MODULE_SCOPE const char*TclGetCommandTypeName(Tcl_Command command);
MODULE_SCOPE void	TclRegisterCommandTypeName(
			    Tcl_ObjCmdProc *implementationProc,
			    const char *nameStr);
#if (TCL_UTF_MAX > 4) && (defined(__CYGWIN__) || defined(_WIN32))
MODULE_SCOPE int TclUtfToUtf16(const char *src, unsigned short *chPtr);
MODULE_SCOPE char *	Tcl_Utf16ToUtfDString(const unsigned short *uniStr,
			    int uniLength, Tcl_DString *dsPtr);
MODULE_SCOPE unsigned short * Tcl_UtfToUtf16DString(const char *src,
			    int length, Tcl_DString *dsPtr);
#else
#   define TclUtfToUtf16 TclUtfToUniChar






<







 







|







3056
3057
3058
3059
3060
3061
3062

3063
3064
3065
3066
3067
3068
3069
....
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
MODULE_SCOPE int	TclInfoGlobalsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE int	TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE int	TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void	TclInitAlloc(void);

MODULE_SCOPE void	TclInitBignumFromWideInt(mp_int *, Tcl_WideInt);
MODULE_SCOPE void	TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt);
MODULE_SCOPE void	TclInitDbCkalloc(void);
MODULE_SCOPE void	TclInitDoubleConversion(void);
MODULE_SCOPE void	TclInitEmbeddedConfigurationInformation(
			    Tcl_Interp *interp);
MODULE_SCOPE void	TclInitEncodingSubsystem(void);
................................................................................
			    const char *trim, int numTrim);
MODULE_SCOPE int	TclTrimRight(const char *bytes, int numBytes,
			    const char *trim, int numTrim);
MODULE_SCOPE const char*TclGetCommandTypeName(Tcl_Command command);
MODULE_SCOPE void	TclRegisterCommandTypeName(
			    Tcl_ObjCmdProc *implementationProc,
			    const char *nameStr);
#if (TCL_UTF_MAX > 3) && (defined(__CYGWIN__) || defined(_WIN32))
MODULE_SCOPE int TclUtfToUtf16(const char *src, unsigned short *chPtr);
MODULE_SCOPE char *	Tcl_Utf16ToUtfDString(const unsigned short *uniStr,
			    int uniLength, Tcl_DString *dsPtr);
MODULE_SCOPE unsigned short * Tcl_UtfToUtf16DString(const char *src,
			    int length, Tcl_DString *dsPtr);
#else
#   define TclUtfToUtf16 TclUtfToUniChar

Changes to generic/tclMain.c.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
 * NewNativeObj is needed (which provides proper conversion from native
 * encoding to UTF-8).
 */

#if defined(UNICODE) && (TCL_UTF_MAX <= 4)
#   define NewNativeObj Tcl_NewUnicodeObj
#else /* !UNICODE || (TCL_UTF_MAX > 4) */
static inline Tcl_Obj *
NewNativeObj(
    TCHAR *string,
    int length)
{
    Tcl_DString ds;

................................................................................
    }
    Tcl_WinTCharToUtf(string, length, &ds);
#else
    Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds);
#endif
    return TclDStringToObj(&ds);
}
#endif /* !UNICODE || (TCL_UTF_MAX > 4) */

/*
 * Declarations for various library functions and variables (don't want to
 * include tclPort.h here, because people might copy this file out of the Tcl
 * source directory to make their own modified versions).
 */







|

|







 







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
 * NewNativeObj is needed (which provides proper conversion from native
 * encoding to UTF-8).
 */

#if defined(UNICODE) && (TCL_UTF_MAX == 3)
#   define NewNativeObj Tcl_NewUnicodeObj
#else /* !UNICODE || (TCL_UTF_MAX > 3) */
static inline Tcl_Obj *
NewNativeObj(
    TCHAR *string,
    int length)
{
    Tcl_DString ds;

................................................................................
    }
    Tcl_WinTCharToUtf(string, length, &ds);
#else
    Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds);
#endif
    return TclDStringToObj(&ds);
}
#endif /* !UNICODE || (TCL_UTF_MAX > 3) */

/*
 * Declarations for various library functions and variables (don't want to
 * include tclPort.h here, because people might copy this file out of the Tcl
 * source directory to make their own modified versions).
 */

Changes to generic/tclParse.c.

787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
...
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
....
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
				 * written. At most TCL_UTF_MAX bytes will be
				 * written there. */
{
    register const char *p = src+1;
    Tcl_UniChar unichar = 0;
    int result;
    int count;
    char buf[TCL_UTF_MAX] = "";

    if (numBytes == 0) {
	if (readPtr != NULL) {
	    *readPtr = 0;
	}
	return 0;
    }
................................................................................
	 * special, we shouldn't break up a correct utf-8 character. [Bug
	 * #217987] test subst-3.2
	 */

	if (Tcl_UtfCharComplete(p, numBytes - 1)) {
	    count = TclUtfToUniChar(p, &unichar) + 1;	/* +1 for '\' */
	} else {
	    char utfBytes[TCL_UTF_MAX];

	    memcpy(utfBytes, p, numBytes - 1);
	    utfBytes[numBytes - 1] = '\0';
	    count = TclUtfToUniChar(utfBytes, &unichar) + 1;
	}
	result = unichar;
	break;
................................................................................

    adjust = 0;
    result = NULL;
    for (; count>0 && code==TCL_OK ; count--, tokenPtr++) {
	Tcl_Obj *appendObj = NULL;
	const char *append = NULL;
	int appendByteLength = 0;
	char utfCharBytes[TCL_UTF_MAX] = "";

	switch (tokenPtr->type) {
	case TCL_TOKEN_TEXT:
	    append = tokenPtr->start;
	    appendByteLength = tokenPtr->size;
	    break;







|







 







|







 







|







787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
...
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
....
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
				 * written. At most TCL_UTF_MAX bytes will be
				 * written there. */
{
    register const char *p = src+1;
    Tcl_UniChar unichar = 0;
    int result;
    int count;
    char buf[4] = "";

    if (numBytes == 0) {
	if (readPtr != NULL) {
	    *readPtr = 0;
	}
	return 0;
    }
................................................................................
	 * special, we shouldn't break up a correct utf-8 character. [Bug
	 * #217987] test subst-3.2
	 */

	if (Tcl_UtfCharComplete(p, numBytes - 1)) {
	    count = TclUtfToUniChar(p, &unichar) + 1;	/* +1 for '\' */
	} else {
	    char utfBytes[5];

	    memcpy(utfBytes, p, numBytes - 1);
	    utfBytes[numBytes - 1] = '\0';
	    count = TclUtfToUniChar(utfBytes, &unichar) + 1;
	}
	result = unichar;
	break;
................................................................................

    adjust = 0;
    result = NULL;
    for (; count>0 && code==TCL_OK ; count--, tokenPtr++) {
	Tcl_Obj *appendObj = NULL;
	const char *append = NULL;
	int appendByteLength = 0;
	char utfCharBytes[4] = "";

	switch (tokenPtr->type) {
	case TCL_TOKEN_TEXT:
	    append = tokenPtr->start;
	    appendByteLength = tokenPtr->size;
	    break;

Changes to generic/tclPipe.c.

329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
	 * Make sure we start at the beginning of the file.
	 */

	if (interp != NULL) {
	    int count;
	    Tcl_Obj *objPtr;

	    Tcl_Seek(errorChan, (Tcl_WideInt)0, SEEK_SET);
	    objPtr = Tcl_NewObj();
	    count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
	    if (count < 0) {
		result = TCL_ERROR;
		Tcl_DecrRefCount(objPtr);
		Tcl_ResetResult(interp);
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(






|







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
	 * Make sure we start at the beginning of the file.
	 */

	if (interp != NULL) {
	    int count;
	    Tcl_Obj *objPtr;

	    Tcl_Seek(errorChan, 0, SEEK_SET);
	    objPtr = Tcl_NewObj();
	    count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
	    if (count < 0) {
		result = TCL_ERROR;
		Tcl_DecrRefCount(objPtr);
		Tcl_ResetResult(interp);
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(

Changes to generic/tclScan.c.

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
...
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
				 * required. */
{
    int gotXpg, gotSequential, value, i, flags;
    char *end;
    Tcl_UniChar ch = 0;
    int objIndex, xpgSize, nspace = numVars;
    int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
    char buf[TCL_UTF_MAX+1] = "";
    Tcl_Obj *errorMsg;		/* Place to build an error messages. Note that
				 * these are messy operations because we do
				 * not want to use the formatting engine;
				 * we're inside there! */

    /*
     * Initialize an array that records the number of times a variable is
................................................................................
	case 'c':
	    /*
	     * Scan a single Unicode character.
	     */

	    offset = TclUtfToUniChar(string, &sch);
	    i = (int)sch;
#if TCL_UTF_MAX <= 4
	    if ((sch >= 0xD800) && (offset < 3)) {
		offset += TclUtfToUniChar(string+offset, &sch);
		i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
	    }
#endif
	    string += offset;
	    if (!(flags & SCAN_SUPPRESS)) {
................................................................................
		}
	    } else if (flags & SCAN_BIG) {
		if (flags & SCAN_UNSIGNED) {
		    mp_int big;
		    int code = Tcl_GetBignumFromObj(interp, objPtr, &big);

		    if (code == TCL_OK) {
			if (mp_isneg(&big)) {
			    code = TCL_ERROR;
			}
			mp_clear(&big);
		    }

		    if (code == TCL_ERROR) {
			if (objs != NULL) {






|







 







|







 







|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
...
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
				 * required. */
{
    int gotXpg, gotSequential, value, i, flags;
    char *end;
    Tcl_UniChar ch = 0;
    int objIndex, xpgSize, nspace = numVars;
    int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
    char buf[5] = "";
    Tcl_Obj *errorMsg;		/* Place to build an error messages. Note that
				 * these are messy operations because we do
				 * not want to use the formatting engine;
				 * we're inside there! */

    /*
     * Initialize an array that records the number of times a variable is
................................................................................
	case 'c':
	    /*
	     * Scan a single Unicode character.
	     */

	    offset = TclUtfToUniChar(string, &sch);
	    i = (int)sch;
#if TCL_UTF_MAX == 3
	    if ((sch >= 0xD800) && (offset < 3)) {
		offset += TclUtfToUniChar(string+offset, &sch);
		i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
	    }
#endif
	    string += offset;
	    if (!(flags & SCAN_SUPPRESS)) {
................................................................................
		}
	    } else if (flags & SCAN_BIG) {
		if (flags & SCAN_UNSIGNED) {
		    mp_int big;
		    int code = Tcl_GetBignumFromObj(interp, objPtr, &big);

		    if (code == TCL_OK) {
			if (big.sign != MP_ZPOS) {
			    code = TCL_ERROR;
			}
			mp_clear(&big);
		    }

		    if (code == TCL_ERROR) {
			if (objs != NULL) {

Changes to generic/tclStrToD.c.

526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
...
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
...
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
...
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
....
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
....
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
....
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
....
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
				 * point. */
    int status = TCL_OK;	/* Status to return to caller. */
    char d = 0;			/* Last hexadecimal digit scanned; initialized
				 * to avoid a compiler warning. */
    int shift = 0;		/* Amount to shift when accumulating binary */
    int explicitOctal = 0;

#define ALL_BITS	(~(Tcl_WideUInt)0)
#define MOST_BITS	(ALL_BITS >> 1)

    /*
     * Initialize bytes to start of the object's string rep if the caller
     * didn't pass anything else.
     */

................................................................................
			 * too large shifts first.
			 */

			if ((octalSignificandWide != 0)
				&& (((size_t)shift >=
					CHAR_BIT*sizeof(Tcl_WideUInt))
				|| (octalSignificandWide >
					(~(Tcl_WideUInt)0 >> shift)))) {
			    octalSignificandOverflow = 1;
			    TclInitBignumFromWideUInt(&octalSignificandBig,
				    octalSignificandWide);
			}
		    }
		    if (!octalSignificandOverflow) {
			octalSignificandWide =
................................................................................
		     * Shifting by more bits than are in the value being
		     * shifted is at least de facto nonportable. Check for too
		     * large shifts first.
		     */

		    if (significandWide != 0 &&
			    ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
			    significandWide > (~(Tcl_WideUInt)0 >> shift))) {
			significandOverflow = 1;
			TclInitBignumFromWideUInt(&significandBig,
				significandWide);
		    }
		}
		if (!significandOverflow) {
		    significandWide = (significandWide << shift) + d;
................................................................................
		     * Shifting by more bits than are in the value being
		     * shifted is at least de facto nonportable. Check for too
		     * large shifts first.
		     */

		    if (significandWide != 0 &&
			    ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
			    significandWide > (~(Tcl_WideUInt)0 >> shift))) {
			significandOverflow = 1;
			TclInitBignumFromWideUInt(&significandBig,
				significandWide);
		    }
		}
		if (!significandOverflow) {
		    significandWide = (significandWide << shift) + 1;
................................................................................
	    /*
	     * There's no need to multiply if the multiplicand is zero.
	     */

	    *wideRepPtr = digit;
	    return 0;
	} else if (numZeros >= maxpow10_wide
		|| w > ((~(Tcl_WideUInt)0)-digit)/pow10_wide[numZeros+1]) {
	    /*
	     * Wide multiplication will overflow.  Expand the number to a
	     * bignum and fall through into the bignum case.
	     */

	    TclInitBignumFromWideUInt(bignumRepPtr, w);
	} else {
................................................................................
TclCeil(
    const mp_int *a)			/* Integer to convert. */
{
    double r = 0.0;
    mp_int b;

    mp_init(&b);
    if (mp_isneg(a)) {
	mp_neg(a, &b);
	r = -TclFloor(&b);
    } else {
	int bits = mp_count_bits(a);

	if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	    r = HUGE_VAL;
................................................................................

	    if (shift > 0) {
		mp_mul_2d(a, shift, &b);
	    } else if (shift < 0) {
		mp_int d;
		mp_init(&d);
		mp_div_2d(a, -shift, &b, &d);
		exact = mp_iszero(&d);
		mp_clear(&d);
	    } else {
		mp_copy(a, &b);
	    }
	    if (!exact) {
		mp_add_d(&b, 1, &b);
	    }
................................................................................
TclFloor(
    const mp_int *a)			/* Integer to convert. */
{
    double r = 0.0;
    mp_int b;

    mp_init(&b);
    if (mp_isneg(a)) {
	mp_neg(a, &b);
	r = -TclCeil(&b);
    } else {
	int bits = mp_count_bits(a);

	if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	    r = DBL_MAX;






|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
...
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
...
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
...
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
....
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
....
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
....
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
....
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
				 * point. */
    int status = TCL_OK;	/* Status to return to caller. */
    char d = 0;			/* Last hexadecimal digit scanned; initialized
				 * to avoid a compiler warning. */
    int shift = 0;		/* Amount to shift when accumulating binary */
    int explicitOctal = 0;

#define ALL_BITS	((Tcl_WideUInt)-1)
#define MOST_BITS	(ALL_BITS >> 1)

    /*
     * Initialize bytes to start of the object's string rep if the caller
     * didn't pass anything else.
     */

................................................................................
			 * too large shifts first.
			 */

			if ((octalSignificandWide != 0)
				&& (((size_t)shift >=
					CHAR_BIT*sizeof(Tcl_WideUInt))
				|| (octalSignificandWide >
					((Tcl_WideUInt)-1 >> shift)))) {
			    octalSignificandOverflow = 1;
			    TclInitBignumFromWideUInt(&octalSignificandBig,
				    octalSignificandWide);
			}
		    }
		    if (!octalSignificandOverflow) {
			octalSignificandWide =
................................................................................
		     * Shifting by more bits than are in the value being
		     * shifted is at least de facto nonportable. Check for too
		     * large shifts first.
		     */

		    if (significandWide != 0 &&
			    ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
			    significandWide > ((Tcl_WideUInt)-1 >> shift))) {
			significandOverflow = 1;
			TclInitBignumFromWideUInt(&significandBig,
				significandWide);
		    }
		}
		if (!significandOverflow) {
		    significandWide = (significandWide << shift) + d;
................................................................................
		     * Shifting by more bits than are in the value being
		     * shifted is at least de facto nonportable. Check for too
		     * large shifts first.
		     */

		    if (significandWide != 0 &&
			    ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
			    significandWide > ((Tcl_WideUInt)-1 >> shift))) {
			significandOverflow = 1;
			TclInitBignumFromWideUInt(&significandBig,
				significandWide);
		    }
		}
		if (!significandOverflow) {
		    significandWide = (significandWide << shift) + 1;
................................................................................
	    /*
	     * There's no need to multiply if the multiplicand is zero.
	     */

	    *wideRepPtr = digit;
	    return 0;
	} else if (numZeros >= maxpow10_wide
		|| w > ((Tcl_WideUInt)-1-digit)/pow10_wide[numZeros+1]) {
	    /*
	     * Wide multiplication will overflow.  Expand the number to a
	     * bignum and fall through into the bignum case.
	     */

	    TclInitBignumFromWideUInt(bignumRepPtr, w);
	} else {
................................................................................
TclCeil(
    const mp_int *a)			/* Integer to convert. */
{
    double r = 0.0;
    mp_int b;

    mp_init(&b);
    if (a->sign != MP_ZPOS) {
	mp_neg(a, &b);
	r = -TclFloor(&b);
    } else {
	int bits = mp_count_bits(a);

	if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	    r = HUGE_VAL;
................................................................................

	    if (shift > 0) {
		mp_mul_2d(a, shift, &b);
	    } else if (shift < 0) {
		mp_int d;
		mp_init(&d);
		mp_div_2d(a, -shift, &b, &d);
		exact = d.used == 0;
		mp_clear(&d);
	    } else {
		mp_copy(a, &b);
	    }
	    if (!exact) {
		mp_add_d(&b, 1, &b);
	    }
................................................................................
TclFloor(
    const mp_int *a)			/* Integer to convert. */
{
    double r = 0.0;
    mp_int b;

    mp_init(&b);
    if (a->sign != MP_ZPOS) {
	mp_neg(a, &b);
	r = -TclCeil(&b);
    } else {
	int bits = mp_count_bits(a);

	if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	    r = DBL_MAX;

Changes to generic/tclStringObj.c.

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
...
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
....
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
	stringPtr = GET_STRING(objPtr);
    }

    if (index >= stringPtr->numChars) {
	return -1;
    }
    ch = stringPtr->unicode[index];
#if TCL_UTF_MAX <= 4
    /* See: bug [11ae2be95dac9417] */
    if ((ch & 0xF800) == 0xD800) {
	if (ch & 0x400) {
	    if ((index > 0)
		    && ((stringPtr->unicode[index-1] & 0xFC00) == 0xD800)) {
		ch = -1; /* low surrogate preceded by high surrogate */
	    }
................................................................................
 *
 * Side effects:
 *	Converts the object to have the String internal rep.
 *
 *----------------------------------------------------------------------
 */

#if !defined(TCL_NO_DEPRECATED) && (TCL_UTF_MAX<=4)
#undef Tcl_GetUnicode
unsigned short *
Tcl_GetUnicode(
    Tcl_Obj *objPtr)		/* The object to find the unicode string
				 * for. */
{
    return Tcl_GetUtf16FromObj(objPtr, NULL);
................................................................................
    }
    if (last > stringPtr->numChars) {
	last = stringPtr->numChars;
    }
    if (last < first) {
	return Tcl_NewObj();
    }
#if TCL_UTF_MAX <= 4
    /* See: bug [11ae2be95dac9417] */
    if ((first > 0) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
	    && ((stringPtr->unicode[first-1] & 0xFC00) == 0xD800)) {
	++first;
    }
    if ((last + 1 < stringPtr->numChars)
	    && ((stringPtr->unicode[last+1] & 0xFC00) == 0xDC00)
................................................................................
		    numChars = precision;
		    Tcl_IncrRefCount(segment);
		    allocSegment = 1;
		}
	    }
	    break;
	case 'c': {
	    char buf[TCL_UTF_MAX] = "";
	    int code, length;

	    if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
		goto error;
	    }
	    length = Tcl_UniCharToUtf(code, buf);
	    if ((code >= 0xD800) && (length < 3)) {






|







 







|







 







|







 







|







564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
...
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
....
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
	stringPtr = GET_STRING(objPtr);
    }

    if (index >= stringPtr->numChars) {
	return -1;
    }
    ch = stringPtr->unicode[index];
#if TCL_UTF_MAX == 3
    /* See: bug [11ae2be95dac9417] */
    if ((ch & 0xF800) == 0xD800) {
	if (ch & 0x400) {
	    if ((index > 0)
		    && ((stringPtr->unicode[index-1] & 0xFC00) == 0xD800)) {
		ch = -1; /* low surrogate preceded by high surrogate */
	    }
................................................................................
 *
 * Side effects:
 *	Converts the object to have the String internal rep.
 *
 *----------------------------------------------------------------------
 */

#if !defined(TCL_NO_DEPRECATED) && (TCL_UTF_MAX==3)
#undef Tcl_GetUnicode
unsigned short *
Tcl_GetUnicode(
    Tcl_Obj *objPtr)		/* The object to find the unicode string
				 * for. */
{
    return Tcl_GetUtf16FromObj(objPtr, NULL);
................................................................................
    }
    if (last > stringPtr->numChars) {
	last = stringPtr->numChars;
    }
    if (last < first) {
	return Tcl_NewObj();
    }
#if TCL_UTF_MAX == 3
    /* See: bug [11ae2be95dac9417] */
    if ((first > 0) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
	    && ((stringPtr->unicode[first-1] & 0xFC00) == 0xD800)) {
	++first;
    }
    if ((last + 1 < stringPtr->numChars)
	    && ((stringPtr->unicode[last+1] & 0xFC00) == 0xDC00)
................................................................................
		    numChars = precision;
		    Tcl_IncrRefCount(segment);
		    allocSegment = 1;
		}
	    }
	    break;
	case 'c': {
	    char buf[4] = "";
	    int code, length;

	    if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
		goto error;
	    }
	    length = Tcl_UniCharToUtf(code, buf);
	    if ((code >= 0xD800) && (length < 3)) {

Changes to generic/tclStubInit.c.

53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
116
117
118
119
120
121
122
123
124





125
126
127
128
129
130
131
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
....
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
....
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
....
1637
1638
1639
1640
1641
1642
1643





1644
1645
1646
#undef Tcl_SetLongObj
#undef TclpInetNtoa
#undef TclWinGetServByName
#undef TclWinGetSockOpt
#undef TclWinSetSockOpt
#undef TclWinNToHS
#undef TclStaticPackage

#undef Tcl_BackgroundError
#define TclStaticPackage Tcl_StaticPackage
#undef Tcl_GetUnicodeFromObj
#undef Tcl_NewUnicodeObj

static void uniCodePanic() {
#if TCL_UTF_MAX <= 4
    Tcl_Panic("This extension is compiled with -DTCL_UTF_MAX=6, but Tcl is compiled with -DTCL_UTF_MAX=4");
#else
    Tcl_Panic("This extension is compiled with -DTCL_UTF_MAX=4, but Tcl is compiled with -DTCL_UTF_MAX=6");
#endif
}
#if TCL_UTF_MAX <= 4
#   define Tcl_GetUnicodeFromObj (int *(*)(Tcl_Obj *, int *)) uniCodePanic
#   define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const int *, int)) uniCodePanic
#else
#   define Tcl_GetUtf16FromObj (unsigned short *(*)(Tcl_Obj *, int *)) uniCodePanic
#   define Tcl_GetUnicode (unsigned short *(*)(Tcl_Obj *)) uniCodePanic
#   define Tcl_NewUtf16Obj (Tcl_Obj *(*)(const unsigned short *, int)) uniCodePanic
#endif
................................................................................
#   define Tcl_ListMathFuncs 0
#   define Tcl_SetIntObj 0
#   define Tcl_SetLongObj 0
#   define Tcl_NewIntObj 0
#   define Tcl_NewLongObj 0
#   define Tcl_DbNewLongObj 0
#   define Tcl_BackgroundError 0

#else





#define TclSetStartupScriptPath setStartupScriptPath
static void TclSetStartupScriptPath(Tcl_Obj *path)
{
    Tcl_SetStartupScript(path, NULL);
}
#define TclGetStartupScriptPath getStartupScriptPath
static Tcl_Obj *TclGetStartupScriptPath(void)
................................................................................
    return 2; /* VER_PLATFORM_WIN32_NT */;
}
#define TclWinResetInterfaces doNothing
#define TclWinSetInterfaces (void (*) (int)) doNothing
#endif
#   define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt
#   define TclBNInitBignumFromWideInt TclInitBignumFromWideInt
#   define TclBNInitBignumFromLong TclInitBignumFromLong
#endif /* TCL_NO_DEPRECATED */

#ifdef _WIN32
#   define TclUnixWaitForFile 0
#   define TclUnixCopyFile 0
#   define TclUnixOpenTemporaryFile 0
#   define TclpReaddir 0
................................................................................
    Tcl_UtfFindLast, /* 329 */
    Tcl_UtfNext, /* 330 */
    Tcl_UtfPrev, /* 331 */
    Tcl_UtfToExternal, /* 332 */
    Tcl_UtfToExternalDString, /* 333 */
    Tcl_UtfToLower, /* 334 */
    Tcl_UtfToTitle, /* 335 */
    Tcl_UtfToUniChar, /* 336 */
    Tcl_UtfToUpper, /* 337 */
    Tcl_WriteChars, /* 338 */
    Tcl_WriteObj, /* 339 */
    Tcl_GetString, /* 340 */
    Tcl_GetDefaultEncodingDir, /* 341 */
    Tcl_SetDefaultEncodingDir, /* 342 */
    Tcl_AlertNotifier, /* 343 */
................................................................................
    Tcl_UniCharIsAlnum, /* 345 */
    Tcl_UniCharIsAlpha, /* 346 */
    Tcl_UniCharIsDigit, /* 347 */
    Tcl_UniCharIsLower, /* 348 */
    Tcl_UniCharIsSpace, /* 349 */
    Tcl_UniCharIsUpper, /* 350 */
    Tcl_UniCharIsWordChar, /* 351 */
    Tcl_UniCharLen, /* 352 */
    Tcl_UniCharNcmp, /* 353 */
    Tcl_UniCharToUtfDString, /* 354 */
    Tcl_UtfToUniCharDString, /* 355 */
    Tcl_GetRegExpFromObj, /* 356 */
    Tcl_EvalTokens, /* 357 */
    Tcl_FreeParse, /* 358 */
    Tcl_LogCommandInfo, /* 359 */
    Tcl_ParseBraces, /* 360 */
    Tcl_ParseCommand, /* 361 */
    Tcl_ParseExpr, /* 362 */
................................................................................
    Tcl_StoreIntRep, /* 639 */
    Tcl_HasStringRep, /* 640 */
    Tcl_IncrRefCount, /* 641 */
    Tcl_DecrRefCount, /* 642 */
    Tcl_IsShared, /* 643 */
    Tcl_GetUnicodeFromObj, /* 644 */
    Tcl_NewUnicodeObj, /* 645 */





};

/* !END!: Do not edit above this line. */






>






|
|

|


|







 







<

>
>
>
>
>







 







<







 







|







 







|
|
|
|







 







>
>
>
>
>



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
...
173
174
175
176
177
178
179

180
181
182
183
184
185
186
....
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
....
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
....
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
#undef Tcl_SetLongObj
#undef TclpInetNtoa
#undef TclWinGetServByName
#undef TclWinGetSockOpt
#undef TclWinSetSockOpt
#undef TclWinNToHS
#undef TclStaticPackage
#undef TclBNInitBignumFromLong
#undef Tcl_BackgroundError
#define TclStaticPackage Tcl_StaticPackage
#undef Tcl_GetUnicodeFromObj
#undef Tcl_NewUnicodeObj

static void uniCodePanic() {
#if TCL_UTF_MAX == 3
    Tcl_Panic("This extension is compiled with -DTCL_UTF_MAX>3, but Tcl is compiled with -DTCL_UTF_MAX==3");
#else
    Tcl_Panic("This extension is compiled with -DTCL_UTF_MAX==3, but Tcl is compiled with -DTCL_UTF_MAX>3");
#endif
}
#if TCL_UTF_MAX == 3
#   define Tcl_GetUnicodeFromObj (int *(*)(Tcl_Obj *, int *)) uniCodePanic
#   define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const int *, int)) uniCodePanic
#else
#   define Tcl_GetUtf16FromObj (unsigned short *(*)(Tcl_Obj *, int *)) uniCodePanic
#   define Tcl_GetUnicode (unsigned short *(*)(Tcl_Obj *)) uniCodePanic
#   define Tcl_NewUtf16Obj (Tcl_Obj *(*)(const unsigned short *, int)) uniCodePanic
#endif
................................................................................
#   define Tcl_ListMathFuncs 0
#   define Tcl_SetIntObj 0
#   define Tcl_SetLongObj 0
#   define Tcl_NewIntObj 0
#   define Tcl_NewLongObj 0
#   define Tcl_DbNewLongObj 0
#   define Tcl_BackgroundError 0

#else
#define TclBNInitBignumFromLong initBignumFromLong
static void TclBNInitBignumFromLong(mp_int *a, long b)
{
    TclInitBignumFromWideInt(a, b);
}
#define TclSetStartupScriptPath setStartupScriptPath
static void TclSetStartupScriptPath(Tcl_Obj *path)
{
    Tcl_SetStartupScript(path, NULL);
}
#define TclGetStartupScriptPath getStartupScriptPath
static Tcl_Obj *TclGetStartupScriptPath(void)
................................................................................
    return 2; /* VER_PLATFORM_WIN32_NT */;
}
#define TclWinResetInterfaces doNothing
#define TclWinSetInterfaces (void (*) (int)) doNothing
#endif
#   define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt
#   define TclBNInitBignumFromWideInt TclInitBignumFromWideInt

#endif /* TCL_NO_DEPRECATED */

#ifdef _WIN32
#   define TclUnixWaitForFile 0
#   define TclUnixCopyFile 0
#   define TclUnixOpenTemporaryFile 0
#   define TclpReaddir 0
................................................................................
    Tcl_UtfFindLast, /* 329 */
    Tcl_UtfNext, /* 330 */
    Tcl_UtfPrev, /* 331 */
    Tcl_UtfToExternal, /* 332 */
    Tcl_UtfToExternalDString, /* 333 */
    Tcl_UtfToLower, /* 334 */
    Tcl_UtfToTitle, /* 335 */
    0, /* 336 */
    Tcl_UtfToUpper, /* 337 */
    Tcl_WriteChars, /* 338 */
    Tcl_WriteObj, /* 339 */
    Tcl_GetString, /* 340 */
    Tcl_GetDefaultEncodingDir, /* 341 */
    Tcl_SetDefaultEncodingDir, /* 342 */
    Tcl_AlertNotifier, /* 343 */
................................................................................
    Tcl_UniCharIsAlnum, /* 345 */
    Tcl_UniCharIsAlpha, /* 346 */
    Tcl_UniCharIsDigit, /* 347 */
    Tcl_UniCharIsLower, /* 348 */
    Tcl_UniCharIsSpace, /* 349 */
    Tcl_UniCharIsUpper, /* 350 */
    Tcl_UniCharIsWordChar, /* 351 */
    0, /* 352 */
    0, /* 353 */
    0, /* 354 */
    0, /* 355 */
    Tcl_GetRegExpFromObj, /* 356 */
    Tcl_EvalTokens, /* 357 */
    Tcl_FreeParse, /* 358 */
    Tcl_LogCommandInfo, /* 359 */
    Tcl_ParseBraces, /* 360 */
    Tcl_ParseCommand, /* 361 */
    Tcl_ParseExpr, /* 362 */
................................................................................
    Tcl_StoreIntRep, /* 639 */
    Tcl_HasStringRep, /* 640 */
    Tcl_IncrRefCount, /* 641 */
    Tcl_DecrRefCount, /* 642 */
    Tcl_IsShared, /* 643 */
    Tcl_GetUnicodeFromObj, /* 644 */
    Tcl_NewUnicodeObj, /* 645 */
    Tcl_UtfToUniChar, /* 646 */
    Tcl_UniCharLen, /* 647 */
    Tcl_UniCharNcmp, /* 648 */
    Tcl_UniCharToUtfDString, /* 649 */
    Tcl_UtfToUniCharDString, /* 650 */
};

/* !END!: Do not edit above this line. */

Changes to generic/tclTomMathDecls.h.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define Tcl_TomMath_InitStubs(interp,version) \
    (TclTomMathInitializeStubs((interp),(version),\
                               TCLTOMMATH_EPOCH,TCLTOMMATH_REVISION))

/* Define custom memory allocation for libtommath */

/* MODULE_SCOPE void* TclBNAlloc( size_t ); */
#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
/* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */
#define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
/* MODULE_SCOPE void  TclBNFree( void* ); */
#define TclBNFree(x) (ckfree((char*)(x)))
/* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */
/* unused - no macro */

#define XMALLOC(x) TclBNAlloc(x)
#define XFREE(x) TclBNFree(x)
#define XREALLOC(x,n) TclBNRealloc(x,n)
#define XCALLOC(n,x) TclBNCalloc(n,x)

/* Rename the global symbols in libtommath to avoid linkage conflicts */

#define KARATSUBA_MUL_CUTOFF TclBNKaratsubaMulCutoff
#define KARATSUBA_SQR_CUTOFF TclBNKaratsubaSqrCutoff
#define TOOM_MUL_CUTOFF TclBNToomMulCutoff
#define TOOM_SQR_CUTOFF TclBNToomSqrCutoff






|
|
|
|
|
|
<
<
<
<
<
<
<







26
27
28
29
30
31
32
33
34
35
36
37
38







39
40
41
42
43
44
45
#define Tcl_TomMath_InitStubs(interp,version) \
    (TclTomMathInitializeStubs((interp),(version),\
                               TCLTOMMATH_EPOCH,TCLTOMMATH_REVISION))

/* Define custom memory allocation for libtommath */

/* MODULE_SCOPE void* XMALLOC( size_t ); */
#define XMALLOC(s) ((void*)ckalloc((size_t)(s)))
/* MODULE_SCOPE void* XREALLOC( void*, size_t ); */
#define XREALLOC(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
/* MODULE_SCOPE void  XFREE( void* ); */
#define XFREE(x) (ckfree((char*)(x)))








/* Rename the global symbols in libtommath to avoid linkage conflicts */

#define KARATSUBA_MUL_CUTOFF TclBNKaratsubaMulCutoff
#define KARATSUBA_SQR_CUTOFF TclBNKaratsubaSqrCutoff
#define TOOM_MUL_CUTOFF TclBNToomMulCutoff
#define TOOM_SQR_CUTOFF TclBNToomSqrCutoff

Changes to generic/tclTomMathInterface.c.

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{
    return TCLTOMMATH_REVISION;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclInitBignumFromLong --
 *
 *	Allocate and initialize a 'bignum' from a native 'long'.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The 'bignum' is constructed.
 *
 *----------------------------------------------------------------------
 */

void
TclInitBignumFromLong(
    mp_int *a,
    long v)
{
    if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
	Tcl_Panic("initialization failure in TclInitBignumFromLong");
    }
    if (v < (long)0) {
	mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v));
	mp_neg(a, a);
    } else {
	mp_set_long_long(a, (Tcl_WideUInt)v);
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclBNInitBignumFromWideInt --
 *
 *	Allocate and initialize a 'bignum' from a Tcl_WideInt
 *
 * Results:
 *	None.
 *
 * Side effects:
................................................................................
TclInitBignumFromWideInt(
    mp_int *a,			/* Bignum to initialize */
    Tcl_WideInt v)		/* Initial value */
{
	if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
		Tcl_Panic("initialization failure in TclInitBignumFromWideInt");
	}
    if (v < (Tcl_WideInt)0) {
	mp_set_long_long(a, (Tcl_WideUInt)(-v));
	mp_neg(a, a);
    } else {
	mp_set_long_long(a, (Tcl_WideUInt)v);
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclBNInitBignumFromWideUInt --
 *
 *	Allocate and initialize a 'bignum' from a Tcl_WideUInt
 *
 * Results:
 *	None.
 *
 * Side effects:






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|







 







|










|







89
90
91
92
93
94
95
































96
97
98
99
100
101
102
103
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
    return TCLTOMMATH_REVISION;
}
 
/*
 *----------------------------------------------------------------------
 *
































 * TclInitBignumFromWideInt --
 *
 *	Allocate and initialize a 'bignum' from a Tcl_WideInt
 *
 * Results:
 *	None.
 *
 * Side effects:
................................................................................
TclInitBignumFromWideInt(
    mp_int *a,			/* Bignum to initialize */
    Tcl_WideInt v)		/* Initial value */
{
	if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
		Tcl_Panic("initialization failure in TclInitBignumFromWideInt");
	}
    if (v < 0) {
	mp_set_long_long(a, (Tcl_WideUInt)(-v));
	mp_neg(a, a);
    } else {
	mp_set_long_long(a, (Tcl_WideUInt)v);
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclInitBignumFromWideUInt --
 *
 *	Allocate and initialize a 'bignum' from a Tcl_WideUInt
 *
 * Results:
 *	None.
 *
 * Side effects:

Changes to generic/tclUniData.c.

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
....
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
....
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
....
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
    9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920,
    9920, 9920, 9920, 9920, 9920, 1344, 1344, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 9952, 1344, 1344, 9984, 1824, 10016, 10048,
    10080, 1344, 1344, 10112, 10144, 1344, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 10176, 10208, 1344, 10240, 1344, 10272, 10304,
    10336, 10368, 10400, 10432, 1344, 1344, 1344, 10464, 10496, 64, 10528,
    10560, 10592, 4736, 10624, 10656
#if TCL_UTF_MAX > 3
    ,10688, 10720, 10752, 1824, 1344, 1344, 1344, 8288, 10784, 10816, 10848,
    10880, 10912, 10944, 10976, 11008, 1824, 1824, 1824, 1824, 9280, 1344,
    11040, 11072, 1344, 11104, 11136, 11168, 11200, 1344, 11232, 1824,
    11264, 11296, 11328, 1344, 11360, 11392, 11424, 11456, 1344, 11488,
    1344, 11520, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 7776, 4704, 10272, 1824, 1824, 1824, 1824,
    11552, 11584, 11616, 11648, 4736, 11680, 1824, 11712, 11744, 11776,
................................................................................
    5, 6, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15,
    0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15,
    15, 15, 0, 0, 0, 4, 4, 7, 11, 14, 4, 4, 0, 14, 7, 7, 7, 7, 14, 14,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 14, 14, 0, 0
#if TCL_UTF_MAX > 3
    ,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 0, 0, 3, 3, 3, 0, 0, 0, 0, 18, 18, 18,
    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
................................................................................
    -2750143, -976319, -2746047, 2763650, 2762882, -2759615, -2751679,
    -2760383, -2760127, -2768575, 1859714, -9044927, -10823615, -12158,
    -10830783, -10833599, -10832575, -10830015, -10817983, -10824127,
    -10818751, 237633, -12223, -10830527, -9058239, 237698, 9949314,
    18, 17, 10305, 10370, 8769, 8834
};

#if TCL_UTF_MAX > 3
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= 0x2fa20)
#else
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0)
#endif

/*
 * The following constants are used to determine the category of a
................................................................................
#define GetDelta(info) ((info) >> 8)

/*
 * This macro extracts the information about a character from the
 * Unicode character tables.
 */

#if TCL_UTF_MAX > 3
#   define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0x1fffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]])
#else
#   define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0xffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]])
#endif






|







 







|







 







|







 







|




191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
....
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
....
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
....
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
    9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920,
    9920, 9920, 9920, 9920, 9920, 1344, 1344, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 9952, 1344, 1344, 9984, 1824, 10016, 10048,
    10080, 1344, 1344, 10112, 10144, 1344, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 10176, 10208, 1344, 10240, 1344, 10272, 10304,
    10336, 10368, 10400, 10432, 1344, 1344, 1344, 10464, 10496, 64, 10528,
    10560, 10592, 4736, 10624, 10656
#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
    ,10688, 10720, 10752, 1824, 1344, 1344, 1344, 8288, 10784, 10816, 10848,
    10880, 10912, 10944, 10976, 11008, 1824, 1824, 1824, 1824, 9280, 1344,
    11040, 11072, 1344, 11104, 11136, 11168, 11200, 1344, 11232, 1824,
    11264, 11296, 11328, 1344, 11360, 11392, 11424, 11456, 1344, 11488,
    1344, 11520, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344,
    1344, 1344, 1344, 1344, 7776, 4704, 10272, 1824, 1824, 1824, 1824,
    11552, 11584, 11616, 11648, 4736, 11680, 1824, 11712, 11744, 11776,
................................................................................
    5, 6, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15,
    0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15,
    15, 15, 0, 0, 0, 4, 4, 7, 11, 14, 4, 4, 0, 14, 7, 7, 7, 7, 14, 14,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 14, 14, 0, 0
#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
    ,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15,
    15, 15, 15, 15, 15, 15, 15, 0, 0, 3, 3, 3, 0, 0, 0, 0, 18, 18, 18,
    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
................................................................................
    -2750143, -976319, -2746047, 2763650, 2762882, -2759615, -2751679,
    -2760383, -2760127, -2768575, 1859714, -9044927, -10823615, -12158,
    -10830783, -10833599, -10832575, -10830015, -10817983, -10824127,
    -10818751, 237633, -12223, -10830527, -9058239, 237698, 9949314,
    18, 17, 10305, 10370, 8769, 8834
};

#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= 0x2fa20)
#else
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0)
#endif

/*
 * The following constants are used to determine the category of a
................................................................................
#define GetDelta(info) ((info) >> 8)

/*
 * This macro extracts the information about a character from the
 * Unicode character tables.
 */

#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
#   define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0x1fffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]])
#else
#   define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0xffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]])
#endif

Changes to generic/tclUtf.c.

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
...
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
...
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
...
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
...
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
...
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
...
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
....
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
....
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
....
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
....
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
....
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
....
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
....
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
....
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
....
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
....
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
	p += Tcl_UniCharToUtf(-1, p);
    }
    Tcl_DStringSetLength(dsPtr, oldLength + (p - string));

    return string;
}
 
#if (TCL_UTF_MAX > 4) && (defined(__CYGWIN__) || defined(_WIN32))
char *
Tcl_Utf16ToUtfDString(
    const unsigned short *uniStr,	/* Utf-16 string to convert to UTF-8. */
    int uniLength,		/* Length of Utf-16 string (must be >= 0). */
    Tcl_DString *dsPtr)		/* UTF-8 representation of string is appended
				 * to this previously initialized DString. */
{
................................................................................
	 * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
	 * Treats naked trail bytes 0x80 to 0x9F as valid characters from
	 * the cp1252 table. See: <https://en.wikipedia.org/wiki/UTF-8>
	 * Also treats \0 and other naked trail bytes 0xA0 to 0xBF as valid
	 * characters representing themselves.
	 */

#if TCL_UTF_MAX <= 4
	/* If *chPtr contains a high surrogate (produced by a previous
	 * Tcl_UtfToUniChar() call) and the next 3 bytes are UTF-8 continuation
	 * bytes, then we must produce a follow-up low surrogate. We only
	 * do that if the high surrogate matches the bits we encounter.
	 */
	if ((byte >= 0x80)
		&& (((((byte - 0x10) << 2) & 0xFC) | 0xD800) == (*chPtr & 0xFCFC))
................................................................................
	 */
    }
    else if (byte < 0xF8) {
	if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) {
	    /*
	     * Four-byte-character lead byte followed by three trail bytes.
	     */
#if TCL_UTF_MAX <= 4
	    Tcl_UniChar high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2)
		    | ((src[2] & 0x3F) >> 4)) - 0x40;
	    if (high >= 0x400) {
		/* out of range, < 0x10000 or > 0x10ffff */
	    } else {
		/* produce high surrogate, advance source pointer */
		*chPtr = 0xD800 + high;
................................................................................
	 */
    }

    *chPtr = byte;
    return 1;
}

#if (TCL_UTF_MAX > 4) && (defined(__CYGWIN__) || defined(_WIN32))
int
TclUtfToUtf16(
    const char *src,	/* The UTF-8 string. */
    unsigned short *chPtr)/* Filled with the Utf-16 representation of
				 * the UTF-8 string. */
{
    unsigned short byte;
................................................................................
    *w = '\0';
    Tcl_DStringSetLength(dsPtr,
	    oldLength + ((char *) w - (char *) wString));

    return wString;
}

#if (TCL_UTF_MAX > 4) && (defined(__CYGWIN__) || defined(_WIN32))
unsigned short *
Tcl_UtfToUtf16DString(
    const char *src,		/* UTF-8 string to convert to Unicode. */
    int length,			/* Length of UTF-8 string in bytes, or -1 for
				 * strlen(). */
    Tcl_DString *dsPtr)		/* Unicode representation of string is
				 * appended to this previously initialized
................................................................................
{
    int len, fullchar;
    Tcl_UniChar find = 0;

    while (1) {
	len = TclUtfToUniChar(src, &find);
	fullchar = find;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &find);
	    fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
	}
#endif
	if (fullchar == ch) {
	    return src;
................................................................................
    Tcl_UniChar find = 0;
    const char *last;

    last = NULL;
    while (1) {
	len = TclUtfToUniChar(src, &find);
	fullchar = find;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &find);
	    fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
	}
#endif
	if (fullchar == ch) {
	    last = src;
................................................................................
const char *
Tcl_UtfNext(
    const char *src)		/* The current location in the string. */
{
    Tcl_UniChar ch = 0;
    int len = TclUtfToUniChar(src, &ch);

#if TCL_UTF_MAX <= 4
    if ((ch >= 0xD800) && (len < 3)) {
	len += TclUtfToUniChar(src + len, &ch);
    }
#endif
    return src + len;
}
 
................................................................................
int
Tcl_UniCharAtIndex(
    register const char *src,	/* The UTF-8 string to dereference. */
    register int index)		/* The position of the desired character. */
{
    Tcl_UniChar ch = 0;
    int fullchar = 0;
#if TCL_UTF_MAX <= 4
	int len = 0;
#endif

    while (index-- >= 0) {
#if TCL_UTF_MAX <= 4
	src += (len = TclUtfToUniChar(src, &ch));
#else
	src += TclUtfToUniChar(src, &ch);
#endif
    }
    fullchar = ch;
#if TCL_UTF_MAX <= 4
    if ((ch >= 0xD800) && (len < 3)) {
	/* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
	(void)TclUtfToUniChar(src, &ch);
	fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
    }
#endif
    return fullchar;
................................................................................
 
/*
 *---------------------------------------------------------------------------
 *
 * Tcl_UtfAtIndex --
 *
 *	Returns a pointer to the specified character (not byte) position in
 *	the UTF-8 string. If TCL_UTF_MAX <= 4, characters > U+FFFF count as
 *	2 positions, but then the pointer should never be placed between
 *	the two positions.
 *
 * Results:
 *	As above.
 *
 * Side effects:
................................................................................
    Tcl_UniChar ch = 0;
    int len = 0;

    while (index-- > 0) {
	len = TclUtfToUniChar(src, &ch);
	src += len;
    }
#if TCL_UTF_MAX <= 4
    if ((ch >= 0xD800) && (len < 3)) {
	/* Index points at character following high Surrogate */
	src += TclUtfToUniChar(src, &ch);
    }
#endif
    return src;
}
................................................................................
     * Iterate over the string until we hit the terminating null.
     */

    src = dst = str;
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	upChar = ch;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    upChar = (((upChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	upChar = Tcl_UniCharToUpper(upChar);
................................................................................
     * Iterate over the string until we hit the terminating null.
     */

    src = dst = str;
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	lowChar = ch;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	lowChar = Tcl_UniCharToLower(lowChar);
................................................................................
     */

    src = dst = str;

    if (*src) {
	len = TclUtfToUniChar(src, &ch);
	titleChar = ch;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    titleChar = (((titleChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	titleChar = Tcl_UniCharToTitle(titleChar);
................................................................................
	    dst += Tcl_UniCharToUtf(titleChar, dst);
	}
	src += len;
    }
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	lowChar = ch;
#if TCL_UTF_MAX <= 4
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	/* Special exception for Georgian Asomtavruli chars, no titlecase. */
................................................................................
	 * only when both strings are of at least n chars long (no need for \0
	 * check)
	 */

	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
	 * n must be interpreted as chars, not bytes.
	 * This should be called only when both strings are of
	 * at least n chars long (no need for \0 check)
	 */
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
{
    Tcl_UniChar ch1 = 0, ch2 = 0;

    while (*cs && *ct) {
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
{
    Tcl_UniChar ch1 = 0, ch2 = 0;

    while (*cs && *ct) {
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX <= 4
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;






|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|




|






|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
...
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
...
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
...
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
...
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
...
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
...
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
....
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
....
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
....
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
....
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
....
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
....
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
....
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
....
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
....
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
....
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
	p += Tcl_UniCharToUtf(-1, p);
    }
    Tcl_DStringSetLength(dsPtr, oldLength + (p - string));

    return string;
}
 
#if (TCL_UTF_MAX > 3) && (defined(__CYGWIN__) || defined(_WIN32))
char *
Tcl_Utf16ToUtfDString(
    const unsigned short *uniStr,	/* Utf-16 string to convert to UTF-8. */
    int uniLength,		/* Length of Utf-16 string (must be >= 0). */
    Tcl_DString *dsPtr)		/* UTF-8 representation of string is appended
				 * to this previously initialized DString. */
{
................................................................................
	 * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
	 * Treats naked trail bytes 0x80 to 0x9F as valid characters from
	 * the cp1252 table. See: <https://en.wikipedia.org/wiki/UTF-8>
	 * Also treats \0 and other naked trail bytes 0xA0 to 0xBF as valid
	 * characters representing themselves.
	 */

#if TCL_UTF_MAX == 3
	/* If *chPtr contains a high surrogate (produced by a previous
	 * Tcl_UtfToUniChar() call) and the next 3 bytes are UTF-8 continuation
	 * bytes, then we must produce a follow-up low surrogate. We only
	 * do that if the high surrogate matches the bits we encounter.
	 */
	if ((byte >= 0x80)
		&& (((((byte - 0x10) << 2) & 0xFC) | 0xD800) == (*chPtr & 0xFCFC))
................................................................................
	 */
    }
    else if (byte < 0xF8) {
	if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) {
	    /*
	     * Four-byte-character lead byte followed by three trail bytes.
	     */
#if TCL_UTF_MAX == 3
	    Tcl_UniChar high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2)
		    | ((src[2] & 0x3F) >> 4)) - 0x40;
	    if (high >= 0x400) {
		/* out of range, < 0x10000 or > 0x10ffff */
	    } else {
		/* produce high surrogate, advance source pointer */
		*chPtr = 0xD800 + high;
................................................................................
	 */
    }

    *chPtr = byte;
    return 1;
}

#if (TCL_UTF_MAX > 3) && (defined(__CYGWIN__) || defined(_WIN32))
int
TclUtfToUtf16(
    const char *src,	/* The UTF-8 string. */
    unsigned short *chPtr)/* Filled with the Utf-16 representation of
				 * the UTF-8 string. */
{
    unsigned short byte;
................................................................................
    *w = '\0';
    Tcl_DStringSetLength(dsPtr,
	    oldLength + ((char *) w - (char *) wString));

    return wString;
}

#if (TCL_UTF_MAX > 3) && (defined(__CYGWIN__) || defined(_WIN32))
unsigned short *
Tcl_UtfToUtf16DString(
    const char *src,		/* UTF-8 string to convert to Unicode. */
    int length,			/* Length of UTF-8 string in bytes, or -1 for
				 * strlen(). */
    Tcl_DString *dsPtr)		/* Unicode representation of string is
				 * appended to this previously initialized
................................................................................
{
    int len, fullchar;
    Tcl_UniChar find = 0;

    while (1) {
	len = TclUtfToUniChar(src, &find);
	fullchar = find;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &find);
	    fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
	}
#endif
	if (fullchar == ch) {
	    return src;
................................................................................
    Tcl_UniChar find = 0;
    const char *last;

    last = NULL;
    while (1) {
	len = TclUtfToUniChar(src, &find);
	fullchar = find;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &find);
	    fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000;
	}
#endif
	if (fullchar == ch) {
	    last = src;
................................................................................
const char *
Tcl_UtfNext(
    const char *src)		/* The current location in the string. */
{
    Tcl_UniChar ch = 0;
    int len = TclUtfToUniChar(src, &ch);

#if TCL_UTF_MAX == 3
    if ((ch >= 0xD800) && (len < 3)) {
	len += TclUtfToUniChar(src + len, &ch);
    }
#endif
    return src + len;
}
 
................................................................................
int
Tcl_UniCharAtIndex(
    register const char *src,	/* The UTF-8 string to dereference. */
    register int index)		/* The position of the desired character. */
{
    Tcl_UniChar ch = 0;
    int fullchar = 0;
#if TCL_UTF_MAX == 3
	int len = 0;
#endif

    while (index-- >= 0) {
#if TCL_UTF_MAX == 3
	src += (len = TclUtfToUniChar(src, &ch));
#else
	src += TclUtfToUniChar(src, &ch);
#endif
    }
    fullchar = ch;
#if TCL_UTF_MAX == 3
    if ((ch >= 0xD800) && (len < 3)) {
	/* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
	(void)TclUtfToUniChar(src, &ch);
	fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
    }
#endif
    return fullchar;
................................................................................
 
/*
 *---------------------------------------------------------------------------
 *
 * Tcl_UtfAtIndex --
 *
 *	Returns a pointer to the specified character (not byte) position in
 *	the UTF-8 string. If TCL_UTF_MAX == 3, characters > U+FFFF count as
 *	2 positions, but then the pointer should never be placed between
 *	the two positions.
 *
 * Results:
 *	As above.
 *
 * Side effects:
................................................................................
    Tcl_UniChar ch = 0;
    int len = 0;

    while (index-- > 0) {
	len = TclUtfToUniChar(src, &ch);
	src += len;
    }
#if TCL_UTF_MAX == 3
    if ((ch >= 0xD800) && (len < 3)) {
	/* Index points at character following high Surrogate */
	src += TclUtfToUniChar(src, &ch);
    }
#endif
    return src;
}
................................................................................
     * Iterate over the string until we hit the terminating null.
     */

    src = dst = str;
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	upChar = ch;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    upChar = (((upChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	upChar = Tcl_UniCharToUpper(upChar);
................................................................................
     * Iterate over the string until we hit the terminating null.
     */

    src = dst = str;
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	lowChar = ch;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	lowChar = Tcl_UniCharToLower(lowChar);
................................................................................
     */

    src = dst = str;

    if (*src) {
	len = TclUtfToUniChar(src, &ch);
	titleChar = ch;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    titleChar = (((titleChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	titleChar = Tcl_UniCharToTitle(titleChar);
................................................................................
	    dst += Tcl_UniCharToUtf(titleChar, dst);
	}
	src += len;
    }
    while (*src) {
	len = TclUtfToUniChar(src, &ch);
	lowChar = ch;
#if TCL_UTF_MAX == 3
	if ((ch >= 0xD800) && (len < 3)) {
	    len += TclUtfToUniChar(src + len, &ch);
	    /* Combine surrogates */
	    lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
	}
#endif
	/* Special exception for Georgian Asomtavruli chars, no titlecase. */
................................................................................
	 * only when both strings are of at least n chars long (no need for \0
	 * check)
	 */

	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX == 3
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
	 * n must be interpreted as chars, not bytes.
	 * This should be called only when both strings are of
	 * at least n chars long (no need for \0 check)
	 */
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX == 3
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
{
    Tcl_UniChar ch1 = 0, ch2 = 0;

    while (*cs && *ct) {
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX == 3
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;
................................................................................
{
    Tcl_UniChar ch1 = 0, ch2 = 0;

    while (*cs && *ct) {
	cs += TclUtfToUniChar(cs, &ch1);
	ct += TclUtfToUniChar(ct, &ch2);
	if (ch1 != ch2) {
#if TCL_UTF_MAX == 3
	    /* Surrogates always report higher than non-surrogates */
	    if (((ch1 & 0xFC00) == 0xD800)) {
	    if ((ch2 & 0xFC00) != 0xD800) {
		return ch1;
	    }
	    } else if ((ch2 & 0xFC00) == 0xD800) {
		return -ch2;

Changes to generic/tclUtil.c.

1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
....
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
....
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
....
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
char
Tcl_Backslash(
    const char *src,		/* Points to the backslash character of a
				 * backslash sequence. */
    int *readPtr)		/* Fill in with number of characters read from
				 * src, unless NULL. */
{
    char buf[TCL_UTF_MAX] = "";
    Tcl_UniChar ch = 0;

    Tcl_UtfBackslash(src, readPtr, buf);
    TclUtfToUniChar(buf, &ch);
    return (char) ch;
}
#endif /* !TCL_NO_DEPRECATED */
................................................................................
	if (numType != TCL_NUMBER_BIG) {
	    /* Must be a double -> not a valid index */
	    goto parseError;
	}

	/* objPtr holds an integer outside the signed wide range */
	/* Truncate to the signed wide range. */
	*widePtr = mp_isneg((mp_int *)cd) ? WIDE_MIN : WIDE_MAX;
    return TCL_OK;
    }

    /* objPtr does not hold a number, check the end+/- format... */
    if (GetEndOffsetFromObj(objPtr, endValue, widePtr) == TCL_OK) {
	return TCL_OK;
    }
................................................................................

		if (numType == TCL_NUMBER_INT) {
		    /* sum holds an integer in the signed wide range */
			*widePtr = *(Tcl_WideInt *)cd;
		} else {
		    /* sum holds an integer outside the signed wide range */
		    /* Truncate to the signed wide range. */
		    if (mp_isneg((mp_int *)cd)) {
			*widePtr = WIDE_MIN;
		    } else {
			*widePtr = WIDE_MAX;
		    }
		}
		Tcl_DecrRefCount(sum);
	    }
................................................................................
	    }

	    /* Got an integer offset; pull it from where parser left it. */
	    TclGetNumberFromObj(NULL, objPtr, &cd, &t);

	    if (t == TCL_NUMBER_BIG) {
		/* Truncate to the signed wide range. */
		if (mp_isneg((mp_int *)cd)) {
		    offset = (bytes[3] == '-') ? WIDE_MAX : WIDE_MIN;
		} else {
		    offset = (bytes[3] == '-') ? WIDE_MIN : WIDE_MAX;
		}
	    } else {
		/* assert (t == TCL_NUMBER_INT); */
		offset = (*(Tcl_WideInt *)cd);






|







 







|







 







|







 







|







1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
....
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
....
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
....
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
char
Tcl_Backslash(
    const char *src,		/* Points to the backslash character of a
				 * backslash sequence. */
    int *readPtr)		/* Fill in with number of characters read from
				 * src, unless NULL. */
{
    char buf[4] = "";
    Tcl_UniChar ch = 0;

    Tcl_UtfBackslash(src, readPtr, buf);
    TclUtfToUniChar(buf, &ch);
    return (char) ch;
}
#endif /* !TCL_NO_DEPRECATED */
................................................................................
	if (numType != TCL_NUMBER_BIG) {
	    /* Must be a double -> not a valid index */
	    goto parseError;
	}

	/* objPtr holds an integer outside the signed wide range */
	/* Truncate to the signed wide range. */
	*widePtr = (((mp_int *)cd)->sign != MP_ZPOS) ? WIDE_MIN : WIDE_MAX;
    return TCL_OK;
    }

    /* objPtr does not hold a number, check the end+/- format... */
    if (GetEndOffsetFromObj(objPtr, endValue, widePtr) == TCL_OK) {
	return TCL_OK;
    }
................................................................................

		if (numType == TCL_NUMBER_INT) {
		    /* sum holds an integer in the signed wide range */
			*widePtr = *(Tcl_WideInt *)cd;
		} else {
		    /* sum holds an integer outside the signed wide range */
		    /* Truncate to the signed wide range. */
		    if (((mp_int *)cd)->sign != MP_ZPOS) {
			*widePtr = WIDE_MIN;
		    } else {
			*widePtr = WIDE_MAX;
		    }
		}
		Tcl_DecrRefCount(sum);
	    }
................................................................................
	    }

	    /* Got an integer offset; pull it from where parser left it. */
	    TclGetNumberFromObj(NULL, objPtr, &cd, &t);

	    if (t == TCL_NUMBER_BIG) {
		/* Truncate to the signed wide range. */
		if (((mp_int *)cd)->sign != MP_ZPOS) {
		    offset = (bytes[3] == '-') ? WIDE_MAX : WIDE_MIN;
		} else {
		    offset = (bytes[3] == '-') ? WIDE_MIN : WIDE_MAX;
		}
	    } else {
		/* assert (t == TCL_NUMBER_INT); */
		offset = (*(Tcl_WideInt *)cd);

Changes to tests/binary.test.

2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
    apply {{a b} {
	set one [binary format H* $a]
	return $one[binary format H* $b]
    }} ab cd
} [binary format H* abcd]

test binary-78.1 {unicode (out of BMP) to byte-array conversion, bug-[bd94500678]} -body {
    # just test for BO-segfault (high surrogate w/o advance source pointer for out of BMP char if TCL_UTF_MAX <= 4):
    binary encode hex \U0001f415
    binary scan \U0001f415 a* v; set v
    set str {}
} -result {}
 
# ----------------------------------------------------------------------
# cleanup






|







2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
    apply {{a b} {
	set one [binary format H* $a]
	return $one[binary format H* $b]
    }} ab cd
} [binary format H* abcd]

test binary-78.1 {unicode (out of BMP) to byte-array conversion, bug-[bd94500678]} -body {
    # just test for BO-segfault (high surrogate w/o advance source pointer for out of BMP char if TCL_UTF_MAX == 3):
    binary encode hex \U0001f415
    binary scan \U0001f415 a* v; set v
    set str {}
} -result {}
 
# ----------------------------------------------------------------------
# cleanup

Changes to tests/util.test.

17
18
19
20
21
22
23



24
25
26
27
28
29
30
...
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
....
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
....
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
....
4123
4124
4125
4126
4127
4128
4129
4130


4131
4132
4133
4134
4135
4136
4137
4138
testConstraint controversialNaN 1
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testdstring [llength [info commands testdstring]]
testConstraint testconcatobj [llength [info commands testconcatobj]]
testConstraint testdoubledigits [llength [info commands testdoubledigits]]
testConstraint testprint [llength [info commands testprint]]




# Big test for correct ordering of data in [expr]

proc testIEEE {} {
    variable ieeeValues
    binary scan [binary format dd -1.0 1.0] c* c
    switch -exact -- $c {
................................................................................
test util-5.50 {Tcl_StringMatch} {
    Wrapper_Tcl_StringMatch *. ""
} 0
test util-5.51 {Tcl_StringMatch} {
    Wrapper_Tcl_StringMatch "" ""
} 1

test util-6.1 {Tcl_PrintDouble - using tcl_precision} -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.4]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.2 {Tcl_PrintDouble - using tcl_precision} -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.39999999999]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.39999999999}
test util-6.3 {Tcl_PrintDouble - using tcl_precision} -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.399999999999]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.4 {Tcl_PrintDouble - using tcl_precision} -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 5
} -body {
    concat x[expr 1.123412341234]
} -cleanup {
    set tcl_precision $old_precision
} -result {x1.1234}
................................................................................
test util-6.5 {Tcl_PrintDouble - make sure there's a decimal point} {
    concat x[expr 2.0]
} {x2.0}
test util-6.6 {Tcl_PrintDouble - make sure there's a decimal point} {
    concat x[expr 3.0e98]
} {x3e+98}

test util-7.1 {TclPrecTraceProc - unset callbacks} -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 7
    set x $tcl_precision
    unset tcl_precision
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {7 7}
test util-7.2 {TclPrecTraceProc - read traces, sharing among interpreters}  -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    interp create child
    set x [child eval set tcl_precision]
    child eval {set tcl_precision 6}
    interp delete child
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {12 6}
test util-7.3 {TclPrecTraceProc - write traces, safe interpreters} -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    interp create -safe child
    set x [child eval {
	list [catch {set tcl_precision 8} msg] $msg
    }]
    interp delete child
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {{1 {can't set "tcl_precision": can't modify precision from a safe interpreter}} 12}
test util-7.4 {TclPrecTraceProc - write traces, bogus values} -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    list [catch {set tcl_precision abc} msg] $msg $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {1 {can't set "tcl_precision": improper value for precision} 12}
................................................................................
    }
    -result 0x8010000000000000
    -cleanup {
	unset x
    }
}

set saved_precision $::tcl_precision
foreach ::tcl_precision {0 12} {
    for {set e -312} {$e < -9} {incr e} {
	test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	    "expr 1.1e$e" 1.1e$e
    }
}
set tcl_precision 0
for {set e -9} {$e < -4} {incr e} {
    test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	"expr 1.1e$e" 1.1e$e
}
set tcl_precision 12
for {set e -9} {$e < -4} {incr e} {
    test util-16.1.$::tcl_precision.$e {8.4 compatible formatting of doubles} \
	"expr 1.1e$e" 1.1e[format %+03d $e]
}
foreach ::tcl_precision {0 12} {
    test util-16.1.$::tcl_precision.-4 {shortening of numbers} \
	{expr 1.1e-4} \
	0.00011
    test util-16.1.$::tcl_precision.-3 {shortening of numbers} \
................................................................................
    }
    for {set e 17} {$e < 309} {incr e} {
	test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	    "expr 1.1e$e" 1.1e+$e
    }
}
set tcl_precision 17
test util-16.1.17.-300 {8.4 compatible formatting of doubles} \
    {expr 1e-300} \
    1e-300
test util-16.1.17.-299 {8.4 compatible formatting of doubles} \
    {expr 1e-299} \
    9.9999999999999999e-300
test util-16.1.17.-298 {8.4 compatible formatting of doubles} \
    {expr 1e-298} \
    9.9999999999999991e-299
test util-16.1.17.-297 {8.4 compatible formatting of doubles} \
    {expr 1e-297} \
    1e-297
test util-16.1.17.-296 {8.4 compatible formatting of doubles} \
    {expr 1e-296} \
    1e-296
test util-16.1.17.-295 {8.4 compatible formatting of doubles} \
    {expr 1e-295} \
    1.0000000000000001e-295
test util-16.1.17.-294 {8.4 compatible formatting of doubles} \
    {expr 1e-294} \
    1e-294
test util-16.1.17.-293 {8.4 compatible formatting of doubles} \
    {expr 1e-293} \
    1.0000000000000001e-293
test util-16.1.17.-292 {8.4 compatible formatting of doubles} \
    {expr 1e-292} \
    1.0000000000000001e-292
test util-16.1.17.-291 {8.4 compatible formatting of doubles} \
    {expr 1e-291} \
    9.9999999999999996e-292
test util-16.1.17.-290 {8.4 compatible formatting of doubles} \
    {expr 1e-290} \
    1.0000000000000001e-290
test util-16.1.17.-289 {8.4 compatible formatting of doubles} \
    {expr 1e-289} \
    1e-289
test util-16.1.17.-288 {8.4 compatible formatting of doubles} \
    {expr 1e-288} \
    1.0000000000000001e-288
test util-16.1.17.-287 {8.4 compatible formatting of doubles} \
    {expr 1e-287} \
    1e-287
test util-16.1.17.-286 {8.4 compatible formatting of doubles} \
    {expr 1e-286} \
    1.0000000000000001e-286
test util-16.1.17.-285 {8.4 compatible formatting of doubles} \
    {expr 1e-285} \
    1.0000000000000001e-285
test util-16.1.17.-284 {8.4 compatible formatting of doubles} \
    {expr 1e-284} \
    1e-284
test util-16.1.17.-283 {8.4 compatible formatting of doubles} \
    {expr 1e-283} \
    9.9999999999999995e-284
test util-16.1.17.-282 {8.4 compatible formatting of doubles} \
    {expr 1e-282} \
    1e-282
test util-16.1.17.-281 {8.4 compatible formatting of doubles} \
    {expr 1e-281} \
    1e-281
test util-16.1.17.-280 {8.4 compatible formatting of doubles} \
    {expr 1e-280} \
    9.9999999999999996e-281
test util-16.1.17.-279 {8.4 compatible formatting of doubles} \
    {expr 1e-279} \
    1.0000000000000001e-279
test util-16.1.17.-278 {8.4 compatible formatting of doubles} \
    {expr 1e-278} \
    9.9999999999999994e-279
test util-16.1.17.-277 {8.4 compatible formatting of doubles} \
    {expr 1e-277} \
    9.9999999999999997e-278
test util-16.1.17.-276 {8.4 compatible formatting of doubles} \
    {expr 1e-276} \
    1.0000000000000001e-276
test util-16.1.17.-275 {8.4 compatible formatting of doubles} \
    {expr 1e-275} \
    9.9999999999999993e-276
test util-16.1.17.-274 {8.4 compatible formatting of doubles} \
    {expr 1e-274} \
    9.9999999999999997e-275
test util-16.1.17.-273 {8.4 compatible formatting of doubles} \
    {expr 1e-273} \
    1.0000000000000001e-273
test util-16.1.17.-272 {8.4 compatible formatting of doubles} \
    {expr 1e-272} \
    9.9999999999999993e-273
test util-16.1.17.-271 {8.4 compatible formatting of doubles} \
    {expr 1e-271} \
    9.9999999999999996e-272
test util-16.1.17.-270 {8.4 compatible formatting of doubles} \
    {expr 1e-270} \
    1e-270
test util-16.1.17.-269 {8.4 compatible formatting of doubles} \
    {expr 1e-269} \
    9.9999999999999996e-270
test util-16.1.17.-268 {8.4 compatible formatting of doubles} \
    {expr 1e-268} \
    9.9999999999999996e-269
test util-16.1.17.-267 {8.4 compatible formatting of doubles} \
    {expr 1e-267} \
    9.9999999999999998e-268
test util-16.1.17.-266 {8.4 compatible formatting of doubles} \
    {expr 1e-266} \
    9.9999999999999998e-267
test util-16.1.17.-265 {8.4 compatible formatting of doubles} \
    {expr 1e-265} \
    9.9999999999999998e-266
test util-16.1.17.-264 {8.4 compatible formatting of doubles} \
    {expr 1e-264} \
    1e-264
test util-16.1.17.-263 {8.4 compatible formatting of doubles} \
    {expr 1e-263} \
    1e-263
test util-16.1.17.-262 {8.4 compatible formatting of doubles} \
    {expr 1e-262} \
    1e-262
test util-16.1.17.-261 {8.4 compatible formatting of doubles} \
    {expr 1e-261} \
    9.9999999999999998e-262
test util-16.1.17.-260 {8.4 compatible formatting of doubles} \
    {expr 1e-260} \
    9.9999999999999996e-261
test util-16.1.17.-259 {8.4 compatible formatting of doubles} \
    {expr 1e-259} \
    1.0000000000000001e-259
test util-16.1.17.-258 {8.4 compatible formatting of doubles} \
    {expr 1e-258} \
    9.9999999999999995e-259
test util-16.1.17.-257 {8.4 compatible formatting of doubles} \
    {expr 1e-257} \
    9.9999999999999998e-258
test util-16.1.17.-256 {8.4 compatible formatting of doubles} \
    {expr 1e-256} \
    9.9999999999999998e-257
test util-16.1.17.-255 {8.4 compatible formatting of doubles} \
    {expr 1e-255} \
    1e-255
test util-16.1.17.-254 {8.4 compatible formatting of doubles} \
    {expr 1e-254} \
    9.9999999999999991e-255
test util-16.1.17.-253 {8.4 compatible formatting of doubles} \
    {expr 1e-253} \
    1.0000000000000001e-253
test util-16.1.17.-252 {8.4 compatible formatting of doubles} \
    {expr 1e-252} \
    9.9999999999999994e-253
test util-16.1.17.-251 {8.4 compatible formatting of doubles} \
    {expr 1e-251} \
    1e-251
test util-16.1.17.-250 {8.4 compatible formatting of doubles} \
    {expr 1e-250} \
    1.0000000000000001e-250
test util-16.1.17.-249 {8.4 compatible formatting of doubles} \
    {expr 1e-249} \
    1.0000000000000001e-249
test util-16.1.17.-248 {8.4 compatible formatting of doubles} \
    {expr 1e-248} \
    9.9999999999999998e-249
test util-16.1.17.-247 {8.4 compatible formatting of doubles} \
    {expr 1e-247} \
    1e-247
test util-16.1.17.-246 {8.4 compatible formatting of doubles} \
    {expr 1e-246} \
    9.9999999999999996e-247
test util-16.1.17.-245 {8.4 compatible formatting of doubles} \
    {expr 1e-245} \
    9.9999999999999993e-246
test util-16.1.17.-244 {8.4 compatible formatting of doubles} \
    {expr 1e-244} \
    9.9999999999999993e-245
test util-16.1.17.-243 {8.4 compatible formatting of doubles} \
    {expr 1e-243} \
    1e-243
test util-16.1.17.-242 {8.4 compatible formatting of doubles} \
    {expr 1e-242} \
    9.9999999999999997e-243
test util-16.1.17.-241 {8.4 compatible formatting of doubles} \
    {expr 1e-241} \
    9.9999999999999997e-242
test util-16.1.17.-240 {8.4 compatible formatting of doubles} \
    {expr 1e-240} \
    9.9999999999999997e-241
test util-16.1.17.-239 {8.4 compatible formatting of doubles} \
    {expr 1e-239} \
    1.0000000000000001e-239
test util-16.1.17.-238 {8.4 compatible formatting of doubles} \
    {expr 1e-238} \
    9.9999999999999999e-239
test util-16.1.17.-237 {8.4 compatible formatting of doubles} \
    {expr 1e-237} \
    9.9999999999999999e-238
test util-16.1.17.-236 {8.4 compatible formatting of doubles} \
    {expr 1e-236} \
    1e-236
test util-16.1.17.-235 {8.4 compatible formatting of doubles} \
    {expr 1e-235} \
    9.9999999999999996e-236
test util-16.1.17.-234 {8.4 compatible formatting of doubles} \
    {expr 1e-234} \
    9.9999999999999996e-235
test util-16.1.17.-233 {8.4 compatible formatting of doubles} \
    {expr 1e-233} \
    9.9999999999999996e-234
test util-16.1.17.-232 {8.4 compatible formatting of doubles} \
    {expr 1e-232} \
    1e-232
test util-16.1.17.-231 {8.4 compatible formatting of doubles} \
    {expr 1e-231} \
    9.9999999999999999e-232
test util-16.1.17.-230 {8.4 compatible formatting of doubles} \
    {expr 1e-230} \
    1e-230
test util-16.1.17.-229 {8.4 compatible formatting of doubles} \
    {expr 1e-229} \
    1.0000000000000001e-229
test util-16.1.17.-228 {8.4 compatible formatting of doubles} \
    {expr 1e-228} \
    1e-228
test util-16.1.17.-227 {8.4 compatible formatting of doubles} \
    {expr 1e-227} \
    9.9999999999999994e-228
test util-16.1.17.-226 {8.4 compatible formatting of doubles} \
    {expr 1e-226} \
    9.9999999999999992e-227
test util-16.1.17.-225 {8.4 compatible formatting of doubles} \
    {expr 1e-225} \
    9.9999999999999996e-226
test util-16.1.17.-224 {8.4 compatible formatting of doubles} \
    {expr 1e-224} \
    1e-224
test util-16.1.17.-223 {8.4 compatible formatting of doubles} \
    {expr 1e-223} \
    9.9999999999999997e-224
test util-16.1.17.-222 {8.4 compatible formatting of doubles} \
    {expr 1e-222} \
    1e-222
test util-16.1.17.-221 {8.4 compatible formatting of doubles} \
    {expr 1e-221} \
    1e-221
test util-16.1.17.-220 {8.4 compatible formatting of doubles} \
    {expr 1e-220} \
    9.9999999999999999e-221
test util-16.1.17.-219 {8.4 compatible formatting of doubles} \
    {expr 1e-219} \
    1e-219
test util-16.1.17.-218 {8.4 compatible formatting of doubles} \
    {expr 1e-218} \
    1e-218
test util-16.1.17.-217 {8.4 compatible formatting of doubles} \
    {expr 1e-217} \
    1.0000000000000001e-217
test util-16.1.17.-216 {8.4 compatible formatting of doubles} \
    {expr 1e-216} \
    1e-216
test util-16.1.17.-215 {8.4 compatible formatting of doubles} \
    {expr 1e-215} \
    1e-215
test util-16.1.17.-214 {8.4 compatible formatting of doubles} \
    {expr 1e-214} \
    9.9999999999999991e-215
test util-16.1.17.-213 {8.4 compatible formatting of doubles} \
    {expr 1e-213} \
    9.9999999999999995e-214
test util-16.1.17.-212 {8.4 compatible formatting of doubles} \
    {expr 1e-212} \
    9.9999999999999995e-213
test util-16.1.17.-211 {8.4 compatible formatting of doubles} \
    {expr 1e-211} \
    1.0000000000000001e-211
test util-16.1.17.-210 {8.4 compatible formatting of doubles} \
    {expr 1e-210} \
    1e-210
test util-16.1.17.-209 {8.4 compatible formatting of doubles} \
    {expr 1e-209} \
    1e-209
test util-16.1.17.-208 {8.4 compatible formatting of doubles} \
    {expr 1e-208} \
    1.0000000000000001e-208
test util-16.1.17.-207 {8.4 compatible formatting of doubles} \
    {expr 1e-207} \
    9.9999999999999993e-208
test util-16.1.17.-206 {8.4 compatible formatting of doubles} \
    {expr 1e-206} \
    1e-206
test util-16.1.17.-205 {8.4 compatible formatting of doubles} \
    {expr 1e-205} \
    1e-205
test util-16.1.17.-204 {8.4 compatible formatting of doubles} \
    {expr 1e-204} \
    1e-204
test util-16.1.17.-203 {8.4 compatible formatting of doubles} \
    {expr 1e-203} \
    1e-203
test util-16.1.17.-202 {8.4 compatible formatting of doubles} \
    {expr 1e-202} \
    1e-202
test util-16.1.17.-201 {8.4 compatible formatting of doubles} \
    {expr 1e-201} \
    9.9999999999999995e-202
test util-16.1.17.-200 {8.4 compatible formatting of doubles} \
    {expr 1e-200} \
    9.9999999999999998e-201
test util-16.1.17.-199 {8.4 compatible formatting of doubles} \
    {expr 1e-199} \
    9.9999999999999998e-200
test util-16.1.17.-198 {8.4 compatible formatting of doubles} \
    {expr 1e-198} \
    9.9999999999999991e-199
test util-16.1.17.-197 {8.4 compatible formatting of doubles} \
    {expr 1e-197} \
    9.9999999999999999e-198
test util-16.1.17.-196 {8.4 compatible formatting of doubles} \
    {expr 1e-196} \
    1e-196
test util-16.1.17.-195 {8.4 compatible formatting of doubles} \
    {expr 1e-195} \
    1.0000000000000001e-195
test util-16.1.17.-194 {8.4 compatible formatting of doubles} \
    {expr 1e-194} \
    1e-194
test util-16.1.17.-193 {8.4 compatible formatting of doubles} \
    {expr 1e-193} \
    1e-193
test util-16.1.17.-192 {8.4 compatible formatting of doubles} \
    {expr 1e-192} \
    1.0000000000000001e-192
test util-16.1.17.-191 {8.4 compatible formatting of doubles} \
    {expr 1e-191} \
    1e-191
test util-16.1.17.-190 {8.4 compatible formatting of doubles} \
    {expr 1e-190} \
    1e-190
test util-16.1.17.-189 {8.4 compatible formatting of doubles} \
    {expr 1e-189} \
    1.0000000000000001e-189
test util-16.1.17.-188 {8.4 compatible formatting of doubles} \
    {expr 1e-188} \
    9.9999999999999995e-189
test util-16.1.17.-187 {8.4 compatible formatting of doubles} \
    {expr 1e-187} \
    1e-187
test util-16.1.17.-186 {8.4 compatible formatting of doubles} \
    {expr 1e-186} \
    9.9999999999999991e-187
test util-16.1.17.-185 {8.4 compatible formatting of doubles} \
    {expr 1e-185} \
    9.9999999999999999e-186
test util-16.1.17.-184 {8.4 compatible formatting of doubles} \
    {expr 1e-184} \
    1.0000000000000001e-184
test util-16.1.17.-183 {8.4 compatible formatting of doubles} \
    {expr 1e-183} \
    1e-183
test util-16.1.17.-182 {8.4 compatible formatting of doubles} \
    {expr 1e-182} \
    1e-182
test util-16.1.17.-181 {8.4 compatible formatting of doubles} \
    {expr 1e-181} \
    1e-181
test util-16.1.17.-180 {8.4 compatible formatting of doubles} \
    {expr 1e-180} \
    1e-180
test util-16.1.17.-179 {8.4 compatible formatting of doubles} \
    {expr 1e-179} \
    1e-179
test util-16.1.17.-178 {8.4 compatible formatting of doubles} \
    {expr 1e-178} \
    9.9999999999999995e-179
test util-16.1.17.-177 {8.4 compatible formatting of doubles} \
    {expr 1e-177} \
    9.9999999999999995e-178
test util-16.1.17.-176 {8.4 compatible formatting of doubles} \
    {expr 1e-176} \
    1e-176
test util-16.1.17.-175 {8.4 compatible formatting of doubles} \
    {expr 1e-175} \
    1e-175
test util-16.1.17.-174 {8.4 compatible formatting of doubles} \
    {expr 1e-174} \
    1e-174
test util-16.1.17.-173 {8.4 compatible formatting of doubles} \
    {expr 1e-173} \
    1e-173
test util-16.1.17.-172 {8.4 compatible formatting of doubles} \
    {expr 1e-172} \
    1e-172
test util-16.1.17.-171 {8.4 compatible formatting of doubles} \
    {expr 1e-171} \
    9.9999999999999998e-172
test util-16.1.17.-170 {8.4 compatible formatting of doubles} \
    {expr 1e-170} \
    9.9999999999999998e-171
test util-16.1.17.-169 {8.4 compatible formatting of doubles} \
    {expr 1e-169} \
    1e-169
test util-16.1.17.-168 {8.4 compatible formatting of doubles} \
    {expr 1e-168} \
    1e-168
test util-16.1.17.-167 {8.4 compatible formatting of doubles} \
    {expr 1e-167} \
    1e-167
test util-16.1.17.-166 {8.4 compatible formatting of doubles} \
    {expr 1e-166} \
    1e-166
test util-16.1.17.-165 {8.4 compatible formatting of doubles} \
    {expr 1e-165} \
    1e-165
test util-16.1.17.-164 {8.4 compatible formatting of doubles} \
    {expr 1e-164} \
    9.9999999999999996e-165
test util-16.1.17.-163 {8.4 compatible formatting of doubles} \
    {expr 1e-163} \
    9.9999999999999992e-164
test util-16.1.17.-162 {8.4 compatible formatting of doubles} \
    {expr 1e-162} \
    9.9999999999999995e-163
test util-16.1.17.-161 {8.4 compatible formatting of doubles} \
    {expr 1e-161} \
    1e-161
test util-16.1.17.-160 {8.4 compatible formatting of doubles} \
    {expr 1e-160} \
    9.9999999999999999e-161
test util-16.1.17.-159 {8.4 compatible formatting of doubles} \
    {expr 1e-159} \
    9.9999999999999999e-160
test util-16.1.17.-158 {8.4 compatible formatting of doubles} \
    {expr 1e-158} \
    1.0000000000000001e-158
test util-16.1.17.-157 {8.4 compatible formatting of doubles} \
    {expr 1e-157} \
    9.9999999999999994e-158
test util-16.1.17.-156 {8.4 compatible formatting of doubles} \
    {expr 1e-156} \
    1e-156
test util-16.1.17.-155 {8.4 compatible formatting of doubles} \
    {expr 1e-155} \
    1e-155
test util-16.1.17.-154 {8.4 compatible formatting of doubles} \
    {expr 1e-154} \
    9.9999999999999997e-155
test util-16.1.17.-153 {8.4 compatible formatting of doubles} \
    {expr 1e-153} \
    1e-153
test util-16.1.17.-152 {8.4 compatible formatting of doubles} \
    {expr 1e-152} \
    1.0000000000000001e-152
test util-16.1.17.-151 {8.4 compatible formatting of doubles} \
    {expr 1e-151} \
    9.9999999999999994e-152
test util-16.1.17.-150 {8.4 compatible formatting of doubles} \
    {expr 1e-150} \
    1e-150
test util-16.1.17.-149 {8.4 compatible formatting of doubles} \
    {expr 1e-149} \
    9.9999999999999998e-150
test util-16.1.17.-148 {8.4 compatible formatting of doubles} \
    {expr 1e-148} \
    9.9999999999999994e-149
test util-16.1.17.-147 {8.4 compatible formatting of doubles} \
    {expr 1e-147} \
    9.9999999999999997e-148
test util-16.1.17.-146 {8.4 compatible formatting of doubles} \
    {expr 1e-146} \
    1e-146
test util-16.1.17.-145 {8.4 compatible formatting of doubles} \
    {expr 1e-145} \
    9.9999999999999991e-146
test util-16.1.17.-144 {8.4 compatible formatting of doubles} \
    {expr 1e-144} \
    9.9999999999999995e-145
test util-16.1.17.-143 {8.4 compatible formatting of doubles} \
    {expr 1e-143} \
    9.9999999999999995e-144
test util-16.1.17.-142 {8.4 compatible formatting of doubles} \
    {expr 1e-142} \
    1e-142
test util-16.1.17.-141 {8.4 compatible formatting of doubles} \
    {expr 1e-141} \
    1e-141
test util-16.1.17.-140 {8.4 compatible formatting of doubles} \
    {expr 1e-140} \
    9.9999999999999998e-141
test util-16.1.17.-139 {8.4 compatible formatting of doubles} \
    {expr 1e-139} \
    1e-139
test util-16.1.17.-138 {8.4 compatible formatting of doubles} \
    {expr 1e-138} \
    1.0000000000000001e-138
test util-16.1.17.-137 {8.4 compatible formatting of doubles} \
    {expr 1e-137} \
    9.9999999999999998e-138
test util-16.1.17.-136 {8.4 compatible formatting of doubles} \
    {expr 1e-136} \
    1e-136
test util-16.1.17.-135 {8.4 compatible formatting of doubles} \
    {expr 1e-135} \
    1e-135
test util-16.1.17.-134 {8.4 compatible formatting of doubles} \
    {expr 1e-134} \
    1e-134
test util-16.1.17.-133 {8.4 compatible formatting of doubles} \
    {expr 1e-133} \
    1.0000000000000001e-133
test util-16.1.17.-132 {8.4 compatible formatting of doubles} \
    {expr 1e-132} \
    9.9999999999999999e-133
test util-16.1.17.-131 {8.4 compatible formatting of doubles} \
    {expr 1e-131} \
    9.9999999999999999e-132
test util-16.1.17.-130 {8.4 compatible formatting of doubles} \
    {expr 1e-130} \
    1.0000000000000001e-130
test util-16.1.17.-129 {8.4 compatible formatting of doubles} \
    {expr 1e-129} \
    9.9999999999999993e-130
test util-16.1.17.-128 {8.4 compatible formatting of doubles} \
    {expr 1e-128} \
    1.0000000000000001e-128
test util-16.1.17.-127 {8.4 compatible formatting of doubles} \
    {expr 1e-127} \
    1e-127
test util-16.1.17.-126 {8.4 compatible formatting of doubles} \
    {expr 1e-126} \
    9.9999999999999995e-127
test util-16.1.17.-125 {8.4 compatible formatting of doubles} \
    {expr 1e-125} \
    1e-125
test util-16.1.17.-124 {8.4 compatible formatting of doubles} \
    {expr 1e-124} \
    9.9999999999999993e-125
test util-16.1.17.-123 {8.4 compatible formatting of doubles} \
    {expr 1e-123} \
    1.0000000000000001e-123
test util-16.1.17.-122 {8.4 compatible formatting of doubles} \
    {expr 1e-122} \
    1.0000000000000001e-122
test util-16.1.17.-121 {8.4 compatible formatting of doubles} \
    {expr 1e-121} \
    9.9999999999999998e-122
test util-16.1.17.-120 {8.4 compatible formatting of doubles} \
    {expr 1e-120} \
    9.9999999999999998e-121
test util-16.1.17.-119 {8.4 compatible formatting of doubles} \
    {expr 1e-119} \
    1e-119
test util-16.1.17.-118 {8.4 compatible formatting of doubles} \
    {expr 1e-118} \
    9.9999999999999999e-119
test util-16.1.17.-117 {8.4 compatible formatting of doubles} \
    {expr 1e-117} \
    1e-117
test util-16.1.17.-116 {8.4 compatible formatting of doubles} \
    {expr 1e-116} \
    9.9999999999999999e-117
test util-16.1.17.-115 {8.4 compatible formatting of doubles} \
    {expr 1e-115} \
    1.0000000000000001e-115
test util-16.1.17.-114 {8.4 compatible formatting of doubles} \
    {expr 1e-114} \
    1.0000000000000001e-114
test util-16.1.17.-113 {8.4 compatible formatting of doubles} \
    {expr 1e-113} \
    9.9999999999999998e-114
test util-16.1.17.-112 {8.4 compatible formatting of doubles} \
    {expr 1e-112} \
    9.9999999999999995e-113
test util-16.1.17.-111 {8.4 compatible formatting of doubles} \
    {expr 1e-111} \
    1.0000000000000001e-111
test util-16.1.17.-110 {8.4 compatible formatting of doubles} \
    {expr 1e-110} \
    1.0000000000000001e-110
test util-16.1.17.-109 {8.4 compatible formatting of doubles} \
    {expr 1e-109} \
    9.9999999999999999e-110
test util-16.1.17.-108 {8.4 compatible formatting of doubles} \
    {expr 1e-108} \
    1e-108
test util-16.1.17.-107 {8.4 compatible formatting of doubles} \
    {expr 1e-107} \
    1e-107
test util-16.1.17.-106 {8.4 compatible formatting of doubles} \
    {expr 1e-106} \
    9.9999999999999994e-107
test util-16.1.17.-105 {8.4 compatible formatting of doubles} \
    {expr 1e-105} \
    9.9999999999999997e-106
test util-16.1.17.-104 {8.4 compatible formatting of doubles} \
    {expr 1e-104} \
    9.9999999999999993e-105
test util-16.1.17.-103 {8.4 compatible formatting of doubles} \
    {expr 1e-103} \
    9.9999999999999996e-104
test util-16.1.17.-102 {8.4 compatible formatting of doubles} \
    {expr 1e-102} \
    9.9999999999999993e-103
test util-16.1.17.-101 {8.4 compatible formatting of doubles} \
    {expr 1e-101} \
    1.0000000000000001e-101
test util-16.1.17.-100 {8.4 compatible formatting of doubles} \
    {expr 1e-100} \
    1e-100
test util-16.1.17.-99 {8.4 compatible formatting of doubles} \
    {expr 1e-99} \
    1e-99
test util-16.1.17.-98 {8.4 compatible formatting of doubles} \
    {expr 1e-98} \
    9.9999999999999994e-99
test util-16.1.17.-97 {8.4 compatible formatting of doubles} \
    {expr 1e-97} \
    1e-97
test util-16.1.17.-96 {8.4 compatible formatting of doubles} \
    {expr 1e-96} \
    9.9999999999999991e-97
test util-16.1.17.-95 {8.4 compatible formatting of doubles} \
    {expr 1e-95} \
    9.9999999999999999e-96
test util-16.1.17.-94 {8.4 compatible formatting of doubles} \
    {expr 1e-94} \
    9.9999999999999996e-95
test util-16.1.17.-93 {8.4 compatible formatting of doubles} \
    {expr 1e-93} \
    9.999999999999999e-94
test util-16.1.17.-92 {8.4 compatible formatting of doubles} \
    {expr 1e-92} \
    9.9999999999999999e-93
test util-16.1.17.-91 {8.4 compatible formatting of doubles} \
    {expr 1e-91} \
    1e-91
test util-16.1.17.-90 {8.4 compatible formatting of doubles} \
    {expr 1e-90} \
    9.9999999999999999e-91
test util-16.1.17.-89 {8.4 compatible formatting of doubles} \
    {expr 1e-89} \
    1e-89
test util-16.1.17.-88 {8.4 compatible formatting of doubles} \
    {expr 1e-88} \
    9.9999999999999993e-89
test util-16.1.17.-87 {8.4 compatible formatting of doubles} \
    {expr 1e-87} \
    1e-87
test util-16.1.17.-86 {8.4 compatible formatting of doubles} \
    {expr 1e-86} \
    1.0000000000000001e-86
test util-16.1.17.-85 {8.4 compatible formatting of doubles} \
    {expr 1e-85} \
    9.9999999999999998e-86
test util-16.1.17.-84 {8.4 compatible formatting of doubles} \
    {expr 1e-84} \
    1e-84
test util-16.1.17.-83 {8.4 compatible formatting of doubles} \
    {expr 1e-83} \
    1e-83
test util-16.1.17.-82 {8.4 compatible formatting of doubles} \
    {expr 1e-82} \
    9.9999999999999996e-83
test util-16.1.17.-81 {8.4 compatible formatting of doubles} \
    {expr 1e-81} \
    9.9999999999999996e-82
test util-16.1.17.-80 {8.4 compatible formatting of doubles} \
    {expr 1e-80} \
    9.9999999999999996e-81
test util-16.1.17.-79 {8.4 compatible formatting of doubles} \
    {expr 1e-79} \
    1e-79
test util-16.1.17.-78 {8.4 compatible formatting of doubles} \
    {expr 1e-78} \
    1e-78
test util-16.1.17.-77 {8.4 compatible formatting of doubles} \
    {expr 1e-77} \
    9.9999999999999993e-78
test util-16.1.17.-76 {8.4 compatible formatting of doubles} \
    {expr 1e-76} \
    9.9999999999999993e-77
test util-16.1.17.-75 {8.4 compatible formatting of doubles} \
    {expr 1e-75} \
    9.9999999999999996e-76
test util-16.1.17.-74 {8.4 compatible formatting of doubles} \
    {expr 1e-74} \
    9.9999999999999996e-75
test util-16.1.17.-73 {8.4 compatible formatting of doubles} \
    {expr 1e-73} \
    1e-73
test util-16.1.17.-72 {8.4 compatible formatting of doubles} \
    {expr 1e-72} \
    9.9999999999999997e-73
test util-16.1.17.-71 {8.4 compatible formatting of doubles} \
    {expr 1e-71} \
    9.9999999999999992e-72
test util-16.1.17.-70 {8.4 compatible formatting of doubles} \
    {expr 1e-70} \
    1e-70
test util-16.1.17.-69 {8.4 compatible formatting of doubles} \
    {expr 1e-69} \
    9.9999999999999996e-70
test util-16.1.17.-68 {8.4 compatible formatting of doubles} \
    {expr 1e-68} \
    1.0000000000000001e-68
test util-16.1.17.-67 {8.4 compatible formatting of doubles} \
    {expr 1e-67} \
    9.9999999999999994e-68
test util-16.1.17.-66 {8.4 compatible formatting of doubles} \
    {expr 1e-66} \
    9.9999999999999998e-67
test util-16.1.17.-65 {8.4 compatible formatting of doubles} \
    {expr 1e-65} \
    9.9999999999999992e-66
test util-16.1.17.-64 {8.4 compatible formatting of doubles} \
    {expr 1e-64} \
    9.9999999999999997e-65
test util-16.1.17.-63 {8.4 compatible formatting of doubles} \
    {expr 1e-63} \
    1.0000000000000001e-63
test util-16.1.17.-62 {8.4 compatible formatting of doubles} \
    {expr 1e-62} \
    1e-62
test util-16.1.17.-61 {8.4 compatible formatting of doubles} \
    {expr 1e-61} \
    1e-61
test util-16.1.17.-60 {8.4 compatible formatting of doubles} \
    {expr 1e-60} \
    9.9999999999999997e-61
test util-16.1.17.-59 {8.4 compatible formatting of doubles} \
    {expr 1e-59} \
    1e-59
test util-16.1.17.-58 {8.4 compatible formatting of doubles} \
    {expr 1e-58} \
    1e-58
test util-16.1.17.-57 {8.4 compatible formatting of doubles} \
    {expr 1e-57} \
    9.9999999999999995e-58
test util-16.1.17.-56 {8.4 compatible formatting of doubles} \
    {expr 1e-56} \
    1e-56
test util-16.1.17.-55 {8.4 compatible formatting of doubles} \
    {expr 1e-55} \
    9.9999999999999999e-56
test util-16.1.17.-54 {8.4 compatible formatting of doubles} \
    {expr 1e-54} \
    1e-54
test util-16.1.17.-53 {8.4 compatible formatting of doubles} \
    {expr 1e-53} \
    1e-53
test util-16.1.17.-52 {8.4 compatible formatting of doubles} \
    {expr 1e-52} \
    1e-52
test util-16.1.17.-51 {8.4 compatible formatting of doubles} \
    {expr 1e-51} \
    1e-51
test util-16.1.17.-50 {8.4 compatible formatting of doubles} \
    {expr 1e-50} \
    1e-50
test util-16.1.17.-49 {8.4 compatible formatting of doubles} \
    {expr 1e-49} \
    9.9999999999999994e-50
test util-16.1.17.-48 {8.4 compatible formatting of doubles} \
    {expr 1e-48} \
    9.9999999999999997e-49
test util-16.1.17.-47 {8.4 compatible formatting of doubles} \
    {expr 1e-47} \
    9.9999999999999997e-48
test util-16.1.17.-46 {8.4 compatible formatting of doubles} \
    {expr 1e-46} \
    1e-46
test util-16.1.17.-45 {8.4 compatible formatting of doubles} \
    {expr 1e-45} \
    9.9999999999999998e-46
test util-16.1.17.-44 {8.4 compatible formatting of doubles} \
    {expr 1e-44} \
    9.9999999999999995e-45
test util-16.1.17.-43 {8.4 compatible formatting of doubles} \
    {expr 1e-43} \
    1.0000000000000001e-43
test util-16.1.17.-42 {8.4 compatible formatting of doubles} \
    {expr 1e-42} \
    1e-42
test util-16.1.17.-41 {8.4 compatible formatting of doubles} \
    {expr 1e-41} \
    1e-41
test util-16.1.17.-40 {8.4 compatible formatting of doubles} \
    {expr 1e-40} \
    9.9999999999999993e-41
test util-16.1.17.-39 {8.4 compatible formatting of doubles} \
    {expr 1e-39} \
    9.9999999999999993e-40
test util-16.1.17.-38 {8.4 compatible formatting of doubles} \
    {expr 1e-38} \
    9.9999999999999996e-39
test util-16.1.17.-37 {8.4 compatible formatting of doubles} \
    {expr 1e-37} \
    1.0000000000000001e-37
test util-16.1.17.-36 {8.4 compatible formatting of doubles} \
    {expr 1e-36} \
    9.9999999999999994e-37
test util-16.1.17.-35 {8.4 compatible formatting of doubles} \
    {expr 1e-35} \
    1e-35
test util-16.1.17.-34 {8.4 compatible formatting of doubles} \
    {expr 1e-34} \
    9.9999999999999993e-35
test util-16.1.17.-33 {8.4 compatible formatting of doubles} \
    {expr 1e-33} \
    1.0000000000000001e-33
test util-16.1.17.-32 {8.4 compatible formatting of doubles} \
    {expr 1e-32} \
    1.0000000000000001e-32
test util-16.1.17.-31 {8.4 compatible formatting of doubles} \
    {expr 1e-31} \
    1.0000000000000001e-31
test util-16.1.17.-30 {8.4 compatible formatting of doubles} \
    {expr 1e-30} \
    1.0000000000000001e-30
test util-16.1.17.-29 {8.4 compatible formatting of doubles} \
    {expr 1e-29} \
    9.9999999999999994e-30
test util-16.1.17.-28 {8.4 compatible formatting of doubles} \
    {expr 1e-28} \
    9.9999999999999997e-29
test util-16.1.17.-27 {8.4 compatible formatting of doubles} \
    {expr 1e-27} \
    1e-27
test util-16.1.17.-26 {8.4 compatible formatting of doubles} \
    {expr 1e-26} \
    1e-26
test util-16.1.17.-25 {8.4 compatible formatting of doubles} \
    {expr 1e-25} \
    1e-25
test util-16.1.17.-24 {8.4 compatible formatting of doubles} \
    {expr 1e-24} \
    9.9999999999999992e-25
test util-16.1.17.-23 {8.4 compatible formatting of doubles} \
    {expr 1e-23} \
    9.9999999999999996e-24
test util-16.1.17.-22 {8.4 compatible formatting of doubles} \
    {expr 1e-22} \
    1e-22
test util-16.1.17.-21 {8.4 compatible formatting of doubles} \
    {expr 1e-21} \
    9.9999999999999991e-22
test util-16.1.17.-20 {8.4 compatible formatting of doubles} \
    {expr 1e-20} \
    9.9999999999999995e-21
test util-16.1.17.-19 {8.4 compatible formatting of doubles} \
    {expr 1e-19} \
    9.9999999999999998e-20
test util-16.1.17.-18 {8.4 compatible formatting of doubles} \
    {expr 1e-18} \
    1.0000000000000001e-18
test util-16.1.17.-17 {8.4 compatible formatting of doubles} \
    {expr 1e-17} \
    1.0000000000000001e-17
test util-16.1.17.-16 {8.4 compatible formatting of doubles} \
    {expr 1e-16} \
    9.9999999999999998e-17
test util-16.1.17.-15 {8.4 compatible formatting of doubles} \
    {expr 1e-15} \
    1.0000000000000001e-15
test util-16.1.17.-14 {8.4 compatible formatting of doubles} \
    {expr 1e-14} \
    1e-14
test util-16.1.17.-13 {8.4 compatible formatting of doubles} \
    {expr 1e-13} \
    1e-13
test util-16.1.17.-12 {8.4 compatible formatting of doubles} \
    {expr 1e-12} \
    9.9999999999999998e-13
test util-16.1.17.-11 {8.4 compatible formatting of doubles} \
    {expr 1e-11} \
    9.9999999999999994e-12
test util-16.1.17.-10 {8.4 compatible formatting of doubles} \
    {expr 1e-10} \
    1e-10
test util-16.1.17.-9 {8.4 compatible formatting of doubles} \
    {expr 1e-9} \
    1.0000000000000001e-09
test util-16.1.17.-8 {8.4 compatible formatting of doubles} \
    {expr 1e-8} \
    1e-08
test util-16.1.17.-7 {8.4 compatible formatting of doubles} \
    {expr 1e-7} \
    9.9999999999999995e-08
test util-16.1.17.-6 {8.4 compatible formatting of doubles} \
    {expr 1e-6} \
    9.9999999999999995e-07
test util-16.1.17.-5 {8.4 compatible formatting of doubles} \
    {expr 1e-5} \
    1.0000000000000001e-05
test util-16.1.17.-4 {8.4 compatible formatting of doubles} \
    {expr 1e-4} \
    0.0001
test util-16.1.17.-3 {8.4 compatible formatting of doubles} \
    {expr 1e-3} \
    0.001
test util-16.1.17.-2 {8.4 compatible formatting of doubles} \
    {expr 1e-2} \
    0.01
test util-16.1.17.-1 {8.4 compatible formatting of doubles} \
    {expr 1e-1} \
    0.10000000000000001
test util-16.1.17.0 {8.4 compatible formatting of doubles} \
    {expr 1e0} \
    1.0
test util-16.1.17.1 {8.4 compatible formatting of doubles} \
    {expr 1e1} \
    10.0
test util-16.1.17.2 {8.4 compatible formatting of doubles} \
    {expr 1e2} \
    100.0
test util-16.1.17.3 {8.4 compatible formatting of doubles} \
    {expr 1e3} \
    1000.0
test util-16.1.17.4 {8.4 compatible formatting of doubles} \
    {expr 1e4} \
    10000.0
test util-16.1.17.5 {8.4 compatible formatting of doubles} \
    {expr 1e5} \
    100000.0
test util-16.1.17.6 {8.4 compatible formatting of doubles} \
    {expr 1e6} \
    1000000.0
test util-16.1.17.7 {8.4 compatible formatting of doubles} \
    {expr 1e7} \
    10000000.0
test util-16.1.17.8 {8.4 compatible formatting of doubles} \
    {expr 1e8} \
    100000000.0
test util-16.1.17.9 {8.4 compatible formatting of doubles} \
    {expr 1e9} \
    1000000000.0
test util-16.1.17.10 {8.4 compatible formatting of doubles} \
    {expr 1e10} \
    10000000000.0
test util-16.1.17.11 {8.4 compatible formatting of doubles} \
    {expr 1e11} \
    100000000000.0
test util-16.1.17.12 {8.4 compatible formatting of doubles} \
    {expr 1e12} \
    1000000000000.0
test util-16.1.17.13 {8.4 compatible formatting of doubles} \
    {expr 1e13} \
    10000000000000.0
test util-16.1.17.14 {8.4 compatible formatting of doubles} \
    {expr 1e14} \
    100000000000000.0
test util-16.1.17.15 {8.4 compatible formatting of doubles} \
    {expr 1e15} \
    1000000000000000.0
test util-16.1.17.16 {8.4 compatible formatting of doubles} \
    {expr 1e16} \
    10000000000000000.0
test util-16.1.17.17 {8.4 compatible formatting of doubles} \
    {expr 1e17} \
    1e+17
test util-16.1.17.18 {8.4 compatible formatting of doubles} \
    {expr 1e18} \
    1e+18
test util-16.1.17.19 {8.4 compatible formatting of doubles} \
    {expr 1e19} \
    1e+19
test util-16.1.17.20 {8.4 compatible formatting of doubles} \
    {expr 1e20} \
    1e+20
test util-16.1.17.21 {8.4 compatible formatting of doubles} \
    {expr 1e21} \
    1e+21
test util-16.1.17.22 {8.4 compatible formatting of doubles} \
    {expr 1e22} \
    1e+22
test util-16.1.17.23 {8.4 compatible formatting of doubles} \
    {expr 1e23} \
    9.9999999999999992e+22
test util-16.1.17.24 {8.4 compatible formatting of doubles} \
    {expr 1e24} \
    9.9999999999999998e+23
test util-16.1.17.25 {8.4 compatible formatting of doubles} \
    {expr 1e25} \
    1.0000000000000001e+25
test util-16.1.17.26 {8.4 compatible formatting of doubles} \
    {expr 1e26} \
    1e+26
test util-16.1.17.27 {8.4 compatible formatting of doubles} \
    {expr 1e27} \
    1e+27
test util-16.1.17.28 {8.4 compatible formatting of doubles} \
    {expr 1e28} \
    9.9999999999999996e+27
test util-16.1.17.29 {8.4 compatible formatting of doubles} \
    {expr 1e29} \
    9.9999999999999991e+28
test util-16.1.17.30 {8.4 compatible formatting of doubles} \
    {expr 1e30} \
    1e+30
test util-16.1.17.31 {8.4 compatible formatting of doubles} \
    {expr 1e31} \
    9.9999999999999996e+30
test util-16.1.17.32 {8.4 compatible formatting of doubles} \
    {expr 1e32} \
    1.0000000000000001e+32
test util-16.1.17.33 {8.4 compatible formatting of doubles} \
    {expr 1e33} \
    9.9999999999999995e+32
test util-16.1.17.34 {8.4 compatible formatting of doubles} \
    {expr 1e34} \
    9.9999999999999995e+33
test util-16.1.17.35 {8.4 compatible formatting of doubles} \
    {expr 1e35} \
    9.9999999999999997e+34
test util-16.1.17.36 {8.4 compatible formatting of doubles} \
    {expr 1e36} \
    1e+36
test util-16.1.17.37 {8.4 compatible formatting of doubles} \
    {expr 1e37} \
    9.9999999999999995e+36
test util-16.1.17.38 {8.4 compatible formatting of doubles} \
    {expr 1e38} \
    9.9999999999999998e+37
test util-16.1.17.39 {8.4 compatible formatting of doubles} \
    {expr 1e39} \
    9.9999999999999994e+38
test util-16.1.17.40 {8.4 compatible formatting of doubles} \
    {expr 1e40} \
    1e+40
test util-16.1.17.41 {8.4 compatible formatting of doubles} \
    {expr 1e41} \
    1e+41
test util-16.1.17.42 {8.4 compatible formatting of doubles} \
    {expr 1e42} \
    1e+42
test util-16.1.17.43 {8.4 compatible formatting of doubles} \
    {expr 1e43} \
    1e+43
test util-16.1.17.44 {8.4 compatible formatting of doubles} \
    {expr 1e44} \
    1.0000000000000001e+44
test util-16.1.17.45 {8.4 compatible formatting of doubles} \
    {expr 1e45} \
    9.9999999999999993e+44
test util-16.1.17.46 {8.4 compatible formatting of doubles} \
    {expr 1e46} \
    9.9999999999999999e+45
test util-16.1.17.47 {8.4 compatible formatting of doubles} \
    {expr 1e47} \
    1e+47
test util-16.1.17.48 {8.4 compatible formatting of doubles} \
    {expr 1e48} \
    1e+48
test util-16.1.17.49 {8.4 compatible formatting of doubles} \
    {expr 1e49} \
    9.9999999999999995e+48
test util-16.1.17.50 {8.4 compatible formatting of doubles} \
    {expr 1e50} \
    1.0000000000000001e+50
test util-16.1.17.51 {8.4 compatible formatting of doubles} \
    {expr 1e51} \
    9.9999999999999999e+50
test util-16.1.17.52 {8.4 compatible formatting of doubles} \
    {expr 1e52} \
    9.9999999999999999e+51
test util-16.1.17.53 {8.4 compatible formatting of doubles} \
    {expr 1e53} \
    9.9999999999999999e+52
test util-16.1.17.54 {8.4 compatible formatting of doubles} \
    {expr 1e54} \
    1.0000000000000001e+54
test util-16.1.17.55 {8.4 compatible formatting of doubles} \
    {expr 1e55} \
    1e+55
test util-16.1.17.56 {8.4 compatible formatting of doubles} \
    {expr 1e56} \
    1.0000000000000001e+56
test util-16.1.17.57 {8.4 compatible formatting of doubles} \
    {expr 1e57} \
    1e+57
test util-16.1.17.58 {8.4 compatible formatting of doubles} \
    {expr 1e58} \
    9.9999999999999994e+57
test util-16.1.17.59 {8.4 compatible formatting of doubles} \
    {expr 1e59} \
    9.9999999999999997e+58
test util-16.1.17.60 {8.4 compatible formatting of doubles} \
    {expr 1e60} \
    9.9999999999999995e+59
test util-16.1.17.61 {8.4 compatible formatting of doubles} \
    {expr 1e61} \
    9.9999999999999995e+60
test util-16.1.17.62 {8.4 compatible formatting of doubles} \
    {expr 1e62} \
    1e+62
test util-16.1.17.63 {8.4 compatible formatting of doubles} \
    {expr 1e63} \
    1.0000000000000001e+63
test util-16.1.17.64 {8.4 compatible formatting of doubles} \
    {expr 1e64} \
    1e+64
test util-16.1.17.65 {8.4 compatible formatting of doubles} \
    {expr 1e65} \
    9.9999999999999999e+64
test util-16.1.17.66 {8.4 compatible formatting of doubles} \
    {expr 1e66} \
    9.9999999999999995e+65
test util-16.1.17.67 {8.4 compatible formatting of doubles} \
    {expr 1e67} \
    9.9999999999999998e+66
test util-16.1.17.68 {8.4 compatible formatting of doubles} \
    {expr 1e68} \
    9.9999999999999995e+67
test util-16.1.17.69 {8.4 compatible formatting of doubles} \
    {expr 1e69} \
    1.0000000000000001e+69
test util-16.1.17.70 {8.4 compatible formatting of doubles} \
    {expr 1e70} \
    1.0000000000000001e+70
test util-16.1.17.71 {8.4 compatible formatting of doubles} \
    {expr 1e71} \
    1e+71
test util-16.1.17.72 {8.4 compatible formatting of doubles} \
    {expr 1e72} \
    9.9999999999999994e+71
test util-16.1.17.73 {8.4 compatible formatting of doubles} \
    {expr 1e73} \
    9.9999999999999998e+72
test util-16.1.17.74 {8.4 compatible formatting of doubles} \
    {expr 1e74} \
    9.9999999999999995e+73
test util-16.1.17.75 {8.4 compatible formatting of doubles} \
    {expr 1e75} \
    9.9999999999999993e+74
test util-16.1.17.76 {8.4 compatible formatting of doubles} \
    {expr 1e76} \
    1e+76
test util-16.1.17.77 {8.4 compatible formatting of doubles} \
    {expr 1e77} \
    9.9999999999999998e+76
test util-16.1.17.78 {8.4 compatible formatting of doubles} \
    {expr 1e78} \
    1e+78
test util-16.1.17.79 {8.4 compatible formatting of doubles} \
    {expr 1e79} \
    9.9999999999999997e+78
test util-16.1.17.80 {8.4 compatible formatting of doubles} \
    {expr 1e80} \
    1e+80
test util-16.1.17.81 {8.4 compatible formatting of doubles} \
    {expr 1e81} \
    9.9999999999999992e+80
test util-16.1.17.82 {8.4 compatible formatting of doubles} \
    {expr 1e82} \
    9.9999999999999996e+81
test util-16.1.17.83 {8.4 compatible formatting of doubles} \
    {expr 1e83} \
    1e+83
test util-16.1.17.84 {8.4 compatible formatting of doubles} \
    {expr 1e84} \
    1.0000000000000001e+84
test util-16.1.17.85 {8.4 compatible formatting of doubles} \
    {expr 1e85} \
    1e+85
test util-16.1.17.86 {8.4 compatible formatting of doubles} \
    {expr 1e86} \
    1e+86
test util-16.1.17.87 {8.4 compatible formatting of doubles} \
    {expr 1e87} \
    9.9999999999999996e+86
test util-16.1.17.88 {8.4 compatible formatting of doubles} \
    {expr 1e88} \
    9.9999999999999996e+87
test util-16.1.17.89 {8.4 compatible formatting of doubles} \
    {expr 1e89} \
    9.9999999999999999e+88
test util-16.1.17.90 {8.4 compatible formatting of doubles} \
    {expr 1e90} \
    9.9999999999999997e+89
test util-16.1.17.91 {8.4 compatible formatting of doubles} \
    {expr 1e91} \
    1.0000000000000001e+91
test util-16.1.17.92 {8.4 compatible formatting of doubles} \
    {expr 1e92} \
    1e+92
test util-16.1.17.93 {8.4 compatible formatting of doubles} \
    {expr 1e93} \
    1e+93
test util-16.1.17.94 {8.4 compatible formatting of doubles} \
    {expr 1e94} \
    1e+94
test util-16.1.17.95 {8.4 compatible formatting of doubles} \
    {expr 1e95} \
    1e+95
test util-16.1.17.96 {8.4 compatible formatting of doubles} \
    {expr 1e96} \
    1e+96
test util-16.1.17.97 {8.4 compatible formatting of doubles} \
    {expr 1e97} \
    1.0000000000000001e+97
test util-16.1.17.98 {8.4 compatible formatting of doubles} \
    {expr 1e98} \
    1e+98
test util-16.1.17.99 {8.4 compatible formatting of doubles} \
    {expr 1e99} \
    9.9999999999999997e+98
test util-16.1.17.100 {8.4 compatible formatting of doubles} \
    {expr 1e100} \
    1e+100
test util-16.1.17.101 {8.4 compatible formatting of doubles} \
    {expr 1e101} \
    9.9999999999999998e+100
test util-16.1.17.102 {8.4 compatible formatting of doubles} \
    {expr 1e102} \
    9.9999999999999998e+101
test util-16.1.17.103 {8.4 compatible formatting of doubles} \
    {expr 1e103} \
    1e+103
test util-16.1.17.104 {8.4 compatible formatting of doubles} \
    {expr 1e104} \
    1e+104
test util-16.1.17.105 {8.4 compatible formatting of doubles} \
    {expr 1e105} \
    9.9999999999999994e+104
test util-16.1.17.106 {8.4 compatible formatting of doubles} \
    {expr 1e106} \
    1.0000000000000001e+106
test util-16.1.17.107 {8.4 compatible formatting of doubles} \
    {expr 1e107} \
    9.9999999999999997e+106
test util-16.1.17.108 {8.4 compatible formatting of doubles} \
    {expr 1e108} \
    1e+108
test util-16.1.17.109 {8.4 compatible formatting of doubles} \
    {expr 1e109} \
    9.9999999999999998e+108
test util-16.1.17.110 {8.4 compatible formatting of doubles} \
    {expr 1e110} \
    1e+110
test util-16.1.17.111 {8.4 compatible formatting of doubles} \
    {expr 1e111} \
    9.9999999999999996e+110
test util-16.1.17.112 {8.4 compatible formatting of doubles} \
    {expr 1e112} \
    9.9999999999999993e+111
test util-16.1.17.113 {8.4 compatible formatting of doubles} \
    {expr 1e113} \
    1e+113
test util-16.1.17.114 {8.4 compatible formatting of doubles} \
    {expr 1e114} \
    1e+114
test util-16.1.17.115 {8.4 compatible formatting of doubles} \
    {expr 1e115} \
    1e+115
test util-16.1.17.116 {8.4 compatible formatting of doubles} \
    {expr 1e116} \
    1e+116
test util-16.1.17.117 {8.4 compatible formatting of doubles} \
    {expr 1e117} \
    1.0000000000000001e+117
test util-16.1.17.118 {8.4 compatible formatting of doubles} \
    {expr 1e118} \
    9.9999999999999997e+117
test util-16.1.17.119 {8.4 compatible formatting of doubles} \
    {expr 1e119} \
    9.9999999999999994e+118
test util-16.1.17.120 {8.4 compatible formatting of doubles} \
    {expr 1e120} \
    9.9999999999999998e+119
test util-16.1.17.121 {8.4 compatible formatting of doubles} \
    {expr 1e121} \
    1e+121
test util-16.1.17.122 {8.4 compatible formatting of doubles} \
    {expr 1e122} \
    1e+122
test util-16.1.17.123 {8.4 compatible formatting of doubles} \
    {expr 1e123} \
    9.9999999999999998e+122
test util-16.1.17.124 {8.4 compatible formatting of doubles} \
    {expr 1e124} \
    9.9999999999999995e+123
test util-16.1.17.125 {8.4 compatible formatting of doubles} \
    {expr 1e125} \
    9.9999999999999992e+124
test util-16.1.17.126 {8.4 compatible formatting of doubles} \
    {expr 1e126} \
    9.9999999999999992e+125
test util-16.1.17.127 {8.4 compatible formatting of doubles} \
    {expr 1e127} \
    9.9999999999999995e+126
test util-16.1.17.128 {8.4 compatible formatting of doubles} \
    {expr 1e128} \
    1.0000000000000001e+128
test util-16.1.17.129 {8.4 compatible formatting of doubles} \
    {expr 1e129} \
    1e+129
test util-16.1.17.130 {8.4 compatible formatting of doubles} \
    {expr 1e130} \
    1.0000000000000001e+130
test util-16.1.17.131 {8.4 compatible formatting of doubles} \
    {expr 1e131} \
    9.9999999999999991e+130
test util-16.1.17.132 {8.4 compatible formatting of doubles} \
    {expr 1e132} \
    9.9999999999999999e+131
test util-16.1.17.133 {8.4 compatible formatting of doubles} \
    {expr 1e133} \
    1e+133
test util-16.1.17.134 {8.4 compatible formatting of doubles} \
    {expr 1e134} \
    9.9999999999999992e+133
test util-16.1.17.135 {8.4 compatible formatting of doubles} \
    {expr 1e135} \
    9.9999999999999996e+134
test util-16.1.17.136 {8.4 compatible formatting of doubles} \
    {expr 1e136} \
    1.0000000000000001e+136
test util-16.1.17.137 {8.4 compatible formatting of doubles} \
    {expr 1e137} \
    1e+137
test util-16.1.17.138 {8.4 compatible formatting of doubles} \
    {expr 1e138} \
    1e+138
test util-16.1.17.139 {8.4 compatible formatting of doubles} \
    {expr 1e139} \
    1e+139
test util-16.1.17.140 {8.4 compatible formatting of doubles} \
    {expr 1e140} \
    1.0000000000000001e+140
test util-16.1.17.141 {8.4 compatible formatting of doubles} \
    {expr 1e141} \
    1e+141
test util-16.1.17.142 {8.4 compatible formatting of doubles} \
    {expr 1e142} \
    1.0000000000000001e+142
test util-16.1.17.143 {8.4 compatible formatting of doubles} \
    {expr 1e143} \
    1e+143
test util-16.1.17.144 {8.4 compatible formatting of doubles} \
    {expr 1e144} \
    1e+144
test util-16.1.17.145 {8.4 compatible formatting of doubles} \
    {expr 1e145} \
    9.9999999999999999e+144
test util-16.1.17.146 {8.4 compatible formatting of doubles} \
    {expr 1e146} \
    9.9999999999999993e+145
test util-16.1.17.147 {8.4 compatible formatting of doubles} \
    {expr 1e147} \
    9.9999999999999998e+146
test util-16.1.17.148 {8.4 compatible formatting of doubles} \
    {expr 1e148} \
    1e+148
test util-16.1.17.149 {8.4 compatible formatting of doubles} \
    {expr 1e149} \
    1e+149
test util-16.1.17.150 {8.4 compatible formatting of doubles} \
    {expr 1e150} \
    9.9999999999999998e+149
test util-16.1.17.151 {8.4 compatible formatting of doubles} \
    {expr 1e151} \
    1e+151
test util-16.1.17.152 {8.4 compatible formatting of doubles} \
    {expr 1e152} \
    1e+152
test util-16.1.17.153 {8.4 compatible formatting of doubles} \
    {expr 1e153} \
    1e+153
test util-16.1.17.154 {8.4 compatible formatting of doubles} \
    {expr 1e154} \
    1e+154
test util-16.1.17.155 {8.4 compatible formatting of doubles} \
    {expr 1e155} \
    1e+155
test util-16.1.17.156 {8.4 compatible formatting of doubles} \
    {expr 1e156} \
    9.9999999999999998e+155
test util-16.1.17.157 {8.4 compatible formatting of doubles} \
    {expr 1e157} \
    9.9999999999999998e+156
test util-16.1.17.158 {8.4 compatible formatting of doubles} \
    {expr 1e158} \
    9.9999999999999995e+157
test util-16.1.17.159 {8.4 compatible formatting of doubles} \
    {expr 1e159} \
    9.9999999999999993e+158
test util-16.1.17.160 {8.4 compatible formatting of doubles} \
    {expr 1e160} \
    1e+160
test util-16.1.17.161 {8.4 compatible formatting of doubles} \
    {expr 1e161} \
    1e+161
test util-16.1.17.162 {8.4 compatible formatting of doubles} \
    {expr 1e162} \
    9.9999999999999994e+161
test util-16.1.17.163 {8.4 compatible formatting of doubles} \
    {expr 1e163} \
    9.9999999999999994e+162
test util-16.1.17.164 {8.4 compatible formatting of doubles} \
    {expr 1e164} \
    1e+164
test util-16.1.17.165 {8.4 compatible formatting of doubles} \
    {expr 1e165} \
    9.999999999999999e+164
test util-16.1.17.166 {8.4 compatible formatting of doubles} \
    {expr 1e166} \
    9.9999999999999994e+165
test util-16.1.17.167 {8.4 compatible formatting of doubles} \
    {expr 1e167} \
    1e+167
test util-16.1.17.168 {8.4 compatible formatting of doubles} \
    {expr 1e168} \
    9.9999999999999993e+167
test util-16.1.17.169 {8.4 compatible formatting of doubles} \
    {expr 1e169} \
    9.9999999999999993e+168
test util-16.1.17.170 {8.4 compatible formatting of doubles} \
    {expr 1e170} \
    1e+170
test util-16.1.17.171 {8.4 compatible formatting of doubles} \
    {expr 1e171} \
    9.9999999999999995e+170
test util-16.1.17.172 {8.4 compatible formatting of doubles} \
    {expr 1e172} \
    1.0000000000000001e+172
test util-16.1.17.173 {8.4 compatible formatting of doubles} \
    {expr 1e173} \
    1e+173
test util-16.1.17.174 {8.4 compatible formatting of doubles} \
    {expr 1e174} \
    1.0000000000000001e+174
test util-16.1.17.175 {8.4 compatible formatting of doubles} \
    {expr 1e175} \
    9.9999999999999994e+174
test util-16.1.17.176 {8.4 compatible formatting of doubles} \
    {expr 1e176} \
    1e+176
test util-16.1.17.177 {8.4 compatible formatting of doubles} \
    {expr 1e177} \
    1e+177
test util-16.1.17.178 {8.4 compatible formatting of doubles} \
    {expr 1e178} \
    1.0000000000000001e+178
test util-16.1.17.179 {8.4 compatible formatting of doubles} \
    {expr 1e179} \
    9.9999999999999998e+178
test util-16.1.17.180 {8.4 compatible formatting of doubles} \
    {expr 1e180} \
    1e+180
test util-16.1.17.181 {8.4 compatible formatting of doubles} \
    {expr 1e181} \
    9.9999999999999992e+180
test util-16.1.17.182 {8.4 compatible formatting of doubles} \
    {expr 1e182} \
    1.0000000000000001e+182
test util-16.1.17.183 {8.4 compatible formatting of doubles} \
    {expr 1e183} \
    9.9999999999999995e+182
test util-16.1.17.184 {8.4 compatible formatting of doubles} \
    {expr 1e184} \
    1e+184
test util-16.1.17.185 {8.4 compatible formatting of doubles} \
    {expr 1e185} \
    9.9999999999999998e+184
test util-16.1.17.186 {8.4 compatible formatting of doubles} \
    {expr 1e186} \
    9.9999999999999998e+185
test util-16.1.17.187 {8.4 compatible formatting of doubles} \
    {expr 1e187} \
    9.9999999999999991e+186
test util-16.1.17.188 {8.4 compatible formatting of doubles} \
    {expr 1e188} \
    1e+188
test util-16.1.17.189 {8.4 compatible formatting of doubles} \
    {expr 1e189} \
    1e+189
test util-16.1.17.190 {8.4 compatible formatting of doubles} \
    {expr 1e190} \
    1.0000000000000001e+190
test util-16.1.17.191 {8.4 compatible formatting of doubles} \
    {expr 1e191} \
    1.0000000000000001e+191
test util-16.1.17.192 {8.4 compatible formatting of doubles} \
    {expr 1e192} \
    1e+192
test util-16.1.17.193 {8.4 compatible formatting of doubles} \
    {expr 1e193} \
    1.0000000000000001e+193
test util-16.1.17.194 {8.4 compatible formatting of doubles} \
    {expr 1e194} \
    9.9999999999999994e+193
test util-16.1.17.195 {8.4 compatible formatting of doubles} \
    {expr 1e195} \
    9.9999999999999998e+194
test util-16.1.17.196 {8.4 compatible formatting of doubles} \
    {expr 1e196} \
    9.9999999999999995e+195
test util-16.1.17.197 {8.4 compatible formatting of doubles} \
    {expr 1e197} \
    9.9999999999999995e+196
test util-16.1.17.198 {8.4 compatible formatting of doubles} \
    {expr 1e198} \
    1e+198
test util-16.1.17.199 {8.4 compatible formatting of doubles} \
    {expr 1e199} \
    1.0000000000000001e+199
test util-16.1.17.200 {8.4 compatible formatting of doubles} \
    {expr 1e200} \
    9.9999999999999997e+199
test util-16.1.17.201 {8.4 compatible formatting of doubles} \
    {expr 1e201} \
    1e+201
test util-16.1.17.202 {8.4 compatible formatting of doubles} \
    {expr 1e202} \
    9.999999999999999e+201
test util-16.1.17.203 {8.4 compatible formatting of doubles} \
    {expr 1e203} \
    9.9999999999999999e+202
test util-16.1.17.204 {8.4 compatible formatting of doubles} \
    {expr 1e204} \
    9.9999999999999999e+203
test util-16.1.17.205 {8.4 compatible formatting of doubles} \
    {expr 1e205} \
    1e+205
test util-16.1.17.206 {8.4 compatible formatting of doubles} \
    {expr 1e206} \
    1e+206
test util-16.1.17.207 {8.4 compatible formatting of doubles} \
    {expr 1e207} \
    1e+207
test util-16.1.17.208 {8.4 compatible formatting of doubles} \
    {expr 1e208} \
    9.9999999999999998e+207
test util-16.1.17.209 {8.4 compatible formatting of doubles} \
    {expr 1e209} \
    1.0000000000000001e+209
test util-16.1.17.210 {8.4 compatible formatting of doubles} \
    {expr 1e210} \
    9.9999999999999993e+209
test util-16.1.17.211 {8.4 compatible formatting of doubles} \
    {expr 1e211} \
    9.9999999999999996e+210
test util-16.1.17.212 {8.4 compatible formatting of doubles} \
    {expr 1e212} \
    9.9999999999999991e+211
test util-16.1.17.213 {8.4 compatible formatting of doubles} \
    {expr 1e213} \
    9.9999999999999998e+212
test util-16.1.17.214 {8.4 compatible formatting of doubles} \
    {expr 1e214} \
    9.9999999999999995e+213
test util-16.1.17.215 {8.4 compatible formatting of doubles} \
    {expr 1e215} \
    9.9999999999999991e+214
test util-16.1.17.216 {8.4 compatible formatting of doubles} \
    {expr 1e216} \
    1e+216
test util-16.1.17.217 {8.4 compatible formatting of doubles} \
    {expr 1e217} \
    9.9999999999999996e+216
test util-16.1.17.218 {8.4 compatible formatting of doubles} \
    {expr 1e218} \
    1.0000000000000001e+218
test util-16.1.17.219 {8.4 compatible formatting of doubles} \
    {expr 1e219} \
    9.9999999999999997e+218
test util-16.1.17.220 {8.4 compatible formatting of doubles} \
    {expr 1e220} \
    1e+220
test util-16.1.17.221 {8.4 compatible formatting of doubles} \
    {expr 1e221} \
    1e+221
test util-16.1.17.222 {8.4 compatible formatting of doubles} \
    {expr 1e222} \
    1e+222
test util-16.1.17.223 {8.4 compatible formatting of doubles} \
    {expr 1e223} \
    1e+223
test util-16.1.17.224 {8.4 compatible formatting of doubles} \
    {expr 1e224} \
    9.9999999999999997e+223
test util-16.1.17.225 {8.4 compatible formatting of doubles} \
    {expr 1e225} \
    9.9999999999999993e+224
test util-16.1.17.226 {8.4 compatible formatting of doubles} \
    {expr 1e226} \
    9.9999999999999996e+225
test util-16.1.17.227 {8.4 compatible formatting of doubles} \
    {expr 1e227} \
    1.0000000000000001e+227
test util-16.1.17.228 {8.4 compatible formatting of doubles} \
    {expr 1e228} \
    9.9999999999999992e+227
test util-16.1.17.229 {8.4 compatible formatting of doubles} \
    {expr 1e229} \
    9.9999999999999999e+228
test util-16.1.17.230 {8.4 compatible formatting of doubles} \
    {expr 1e230} \
    1.0000000000000001e+230
test util-16.1.17.231 {8.4 compatible formatting of doubles} \
    {expr 1e231} \
    1.0000000000000001e+231
test util-16.1.17.232 {8.4 compatible formatting of doubles} \
    {expr 1e232} \
    1.0000000000000001e+232
test util-16.1.17.233 {8.4 compatible formatting of doubles} \
    {expr 1e233} \
    9.9999999999999997e+232
test util-16.1.17.234 {8.4 compatible formatting of doubles} \
    {expr 1e234} \
    1e+234
test util-16.1.17.235 {8.4 compatible formatting of doubles} \
    {expr 1e235} \
    1.0000000000000001e+235
test util-16.1.17.236 {8.4 compatible formatting of doubles} \
    {expr 1e236} \
    1.0000000000000001e+236
test util-16.1.17.237 {8.4 compatible formatting of doubles} \
    {expr 1e237} \
    9.9999999999999994e+236
test util-16.1.17.238 {8.4 compatible formatting of doubles} \
    {expr 1e238} \
    1e+238
test util-16.1.17.239 {8.4 compatible formatting of doubles} \
    {expr 1e239} \
    9.9999999999999999e+238
test util-16.1.17.240 {8.4 compatible formatting of doubles} \
    {expr 1e240} \
    1e+240
test util-16.1.17.241 {8.4 compatible formatting of doubles} \
    {expr 1e241} \
    1.0000000000000001e+241
test util-16.1.17.242 {8.4 compatible formatting of doubles} \
    {expr 1e242} \
    1.0000000000000001e+242
test util-16.1.17.243 {8.4 compatible formatting of doubles} \
    {expr 1e243} \
    1.0000000000000001e+243
test util-16.1.17.244 {8.4 compatible formatting of doubles} \
    {expr 1e244} \
    1.0000000000000001e+244
test util-16.1.17.245 {8.4 compatible formatting of doubles} \
    {expr 1e245} \
    1e+245
test util-16.1.17.246 {8.4 compatible formatting of doubles} \
    {expr 1e246} \
    1.0000000000000001e+246
test util-16.1.17.247 {8.4 compatible formatting of doubles} \
    {expr 1e247} \
    9.9999999999999995e+246
test util-16.1.17.248 {8.4 compatible formatting of doubles} \
    {expr 1e248} \
    1e+248
test util-16.1.17.249 {8.4 compatible formatting of doubles} \
    {expr 1e249} \
    9.9999999999999992e+248
test util-16.1.17.250 {8.4 compatible formatting of doubles} \
    {expr 1e250} \
    9.9999999999999992e+249
test util-16.1.17.251 {8.4 compatible formatting of doubles} \
    {expr 1e251} \
    1e+251
test util-16.1.17.252 {8.4 compatible formatting of doubles} \
    {expr 1e252} \
    1.0000000000000001e+252
test util-16.1.17.253 {8.4 compatible formatting of doubles} \
    {expr 1e253} \
    9.9999999999999994e+252
test util-16.1.17.254 {8.4 compatible formatting of doubles} \
    {expr 1e254} \
    9.9999999999999994e+253
test util-16.1.17.255 {8.4 compatible formatting of doubles} \
    {expr 1e255} \
    9.9999999999999999e+254
test util-16.1.17.256 {8.4 compatible formatting of doubles} \
    {expr 1e256} \
    1e+256
test util-16.1.17.257 {8.4 compatible formatting of doubles} \
    {expr 1e257} \
    1e+257
test util-16.1.17.258 {8.4 compatible formatting of doubles} \
    {expr 1e258} \
    1.0000000000000001e+258
test util-16.1.17.259 {8.4 compatible formatting of doubles} \
    {expr 1e259} \
    9.9999999999999993e+258
test util-16.1.17.260 {8.4 compatible formatting of doubles} \
    {expr 1e260} \
    1.0000000000000001e+260
test util-16.1.17.261 {8.4 compatible formatting of doubles} \
    {expr 1e261} \
    9.9999999999999993e+260
test util-16.1.17.262 {8.4 compatible formatting of doubles} \
    {expr 1e262} \
    1e+262
test util-16.1.17.263 {8.4 compatible formatting of doubles} \
    {expr 1e263} \
    1e+263
test util-16.1.17.264 {8.4 compatible formatting of doubles} \
    {expr 1e264} \
    1e+264
test util-16.1.17.265 {8.4 compatible formatting of doubles} \
    {expr 1e265} \
    1.0000000000000001e+265
test util-16.1.17.266 {8.4 compatible formatting of doubles} \
    {expr 1e266} \
    1e+266
test util-16.1.17.267 {8.4 compatible formatting of doubles} \
    {expr 1e267} \
    9.9999999999999997e+266
test util-16.1.17.268 {8.4 compatible formatting of doubles} \
    {expr 1e268} \
    9.9999999999999997e+267
test util-16.1.17.269 {8.4 compatible formatting of doubles} \
    {expr 1e269} \
    1e+269
test util-16.1.17.270 {8.4 compatible formatting of doubles} \
    {expr 1e270} \
    1e+270
test util-16.1.17.271 {8.4 compatible formatting of doubles} \
    {expr 1e271} \
    9.9999999999999995e+270
test util-16.1.17.272 {8.4 compatible formatting of doubles} \
    {expr 1e272} \
    1.0000000000000001e+272
test util-16.1.17.273 {8.4 compatible formatting of doubles} \
    {expr 1e273} \
    9.9999999999999995e+272
test util-16.1.17.274 {8.4 compatible formatting of doubles} \
    {expr 1e274} \
    9.9999999999999992e+273
test util-16.1.17.275 {8.4 compatible formatting of doubles} \
    {expr 1e275} \
    9.9999999999999996e+274
test util-16.1.17.276 {8.4 compatible formatting of doubles} \
    {expr 1e276} \
    1.0000000000000001e+276
test util-16.1.17.277 {8.4 compatible formatting of doubles} \
    {expr 1e277} \
    1e+277
test util-16.1.17.278 {8.4 compatible formatting of doubles} \
    {expr 1e278} \
    9.9999999999999996e+277
test util-16.1.17.279 {8.4 compatible formatting of doubles} \
    {expr 1e279} \
    1.0000000000000001e+279
test util-16.1.17.280 {8.4 compatible formatting of doubles} \
    {expr 1e280} \
    1e+280
test util-16.1.17.281 {8.4 compatible formatting of doubles} \
    {expr 1e281} \
    1e+281
test util-16.1.17.282 {8.4 compatible formatting of doubles} \
    {expr 1e282} \
    1e+282
test util-16.1.17.283 {8.4 compatible formatting of doubles} \
    {expr 1e283} \
    9.9999999999999996e+282
test util-16.1.17.284 {8.4 compatible formatting of doubles} \
    {expr 1e284} \
    1.0000000000000001e+284
test util-16.1.17.285 {8.4 compatible formatting of doubles} \
    {expr 1e285} \
    9.9999999999999998e+284
test util-16.1.17.286 {8.4 compatible formatting of doubles} \
    {expr 1e286} \
    1e+286
test util-16.1.17.287 {8.4 compatible formatting of doubles} \
    {expr 1e287} \
    1.0000000000000001e+287
test util-16.1.17.288 {8.4 compatible formatting of doubles} \
    {expr 1e288} \
    1e+288
test util-16.1.17.289 {8.4 compatible formatting of doubles} \
    {expr 1e289} \
    1.0000000000000001e+289
test util-16.1.17.290 {8.4 compatible formatting of doubles} \
    {expr 1e290} \
    1.0000000000000001e+290
test util-16.1.17.291 {8.4 compatible formatting of doubles} \
    {expr 1e291} \
    9.9999999999999996e+290
test util-16.1.17.292 {8.4 compatible formatting of doubles} \
    {expr 1e292} \
    1e+292
test util-16.1.17.293 {8.4 compatible formatting of doubles} \
    {expr 1e293} \
    9.9999999999999992e+292
test util-16.1.17.294 {8.4 compatible formatting of doubles} \
    {expr 1e294} \
    1.0000000000000001e+294
test util-16.1.17.295 {8.4 compatible formatting of doubles} \
    {expr 1e295} \
    9.9999999999999998e+294
test util-16.1.17.296 {8.4 compatible formatting of doubles} \
    {expr 1e296} \
    9.9999999999999998e+295
test util-16.1.17.297 {8.4 compatible formatting of doubles} \
    {expr 1e297} \
    1e+297
test util-16.1.17.298 {8.4 compatible formatting of doubles} \
    {expr 1e298} \
    9.9999999999999996e+297
test util-16.1.17.299 {8.4 compatible formatting of doubles} \
    {expr 1e299} \
    1.0000000000000001e+299
test util-16.1.17.300 {8.4 compatible formatting of doubles} \
    {expr 1e300} \
    1.0000000000000001e+300
test util-16.1.17.301 {8.4 compatible formatting of doubles} \
    {expr 1e301} \
    1.0000000000000001e+301
test util-16.1.17.302 {8.4 compatible formatting of doubles} \
    {expr 1e302} \
    1.0000000000000001e+302
test util-16.1.17.303 {8.4 compatible formatting of doubles} \
    {expr 1e303} \
    1e+303
test util-16.1.17.304 {8.4 compatible formatting of doubles} \
    {expr 1e304} \
    9.9999999999999994e+303
test util-16.1.17.305 {8.4 compatible formatting of doubles} \
    {expr 1e305} \
    9.9999999999999994e+304
test util-16.1.17.306 {8.4 compatible formatting of doubles} \
    {expr 1e306} \
    1e+306
test util-16.1.17.307 {8.4 compatible formatting of doubles} \
    {expr 1e307} \
    9.9999999999999999e+306

test util-17.1 {bankers' rounding [Bug 3349507]} {ieeeFloatingPoint} {
    set r {}
    foreach {input} {
	0x1ffffffffffffc000
................................................................................
    testprint "%I64d %td" 65536
} {65536 65536}

test util-18.12 {Tcl_ObjPrintf} {testprint} {
    testprint "%I64d %Id" 65537
} {65537 65537}

set ::tcl_precision $saved_precision



# cleanup
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End:






>
>
>







 







|







|







|







|







 







|









|











|












|







 







<













|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
>
>








17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
...
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
....
2180
2181
2182
2183
2184
2185
2186

2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
....
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
....
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
testConstraint controversialNaN 1
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testdstring [llength [info commands testdstring]]
testConstraint testconcatobj [llength [info commands testconcatobj]]
testConstraint testdoubledigits [llength [info commands testdoubledigits]]
testConstraint testprint [llength [info commands testprint]]

testConstraint precision [expr {![catch {set saved_precision $::tcl_precision}]}]


# Big test for correct ordering of data in [expr]

proc testIEEE {} {
    variable ieeeValues
    binary scan [binary format dd -1.0 1.0] c* c
    switch -exact -- $c {
................................................................................
test util-5.50 {Tcl_StringMatch} {
    Wrapper_Tcl_StringMatch *. ""
} 0
test util-5.51 {Tcl_StringMatch} {
    Wrapper_Tcl_StringMatch "" ""
} 1

test util-6.1 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.4]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.2 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.39999999999]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.39999999999}
test util-6.3 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 12
} -body {
    concat x[expr 1.399999999999]
} -cleanup {
    set ::tcl_precision $old_precision
} -result {x1.4}
test util-6.4 {Tcl_PrintDouble - using tcl_precision} -constraints precision -setup {
    set old_precision $::tcl_precision
    set ::tcl_precision 5
} -body {
    concat x[expr 1.123412341234]
} -cleanup {
    set tcl_precision $old_precision
} -result {x1.1234}
................................................................................
test util-6.5 {Tcl_PrintDouble - make sure there's a decimal point} {
    concat x[expr 2.0]
} {x2.0}
test util-6.6 {Tcl_PrintDouble - make sure there's a decimal point} {
    concat x[expr 3.0e98]
} {x3e+98}

test util-7.1 {TclPrecTraceProc - unset callbacks} -constraints precision -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 7
    set x $tcl_precision
    unset tcl_precision
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {7 7}
test util-7.2 {TclPrecTraceProc - read traces, sharing among interpreters} -constraints precision  -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    interp create child
    set x [child eval set tcl_precision]
    child eval {set tcl_precision 6}
    interp delete child
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {12 6}
test util-7.3 {TclPrecTraceProc - write traces, safe interpreters} -constraints precision -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    interp create -safe child
    set x [child eval {
	list [catch {set tcl_precision 8} msg] $msg
    }]
    interp delete child
    list $x $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {{1 {can't set "tcl_precision": can't modify precision from a safe interpreter}} 12}
test util-7.4 {TclPrecTraceProc - write traces, bogus values} -constraints precision -setup {
    set old_precision $::tcl_precision
} -body {
    set tcl_precision 12
    list [catch {set tcl_precision abc} msg] $msg $tcl_precision
} -cleanup {
    set ::tcl_precision $old_precision
} -result {1 {can't set "tcl_precision": improper value for precision} 12}
................................................................................
    }
    -result 0x8010000000000000
    -cleanup {
	unset x
    }
}


foreach ::tcl_precision {0 12} {
    for {set e -312} {$e < -9} {incr e} {
	test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	    "expr 1.1e$e" 1.1e$e
    }
}
set tcl_precision 0
for {set e -9} {$e < -4} {incr e} {
    test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	"expr 1.1e$e" 1.1e$e
}
set tcl_precision 12
for {set e -9} {$e < -4} {incr e} {
    test util-16.1.$::tcl_precision.$e {8.4 compatible formatting of doubles} precision \
	"expr 1.1e$e" 1.1e[format %+03d $e]
}
foreach ::tcl_precision {0 12} {
    test util-16.1.$::tcl_precision.-4 {shortening of numbers} \
	{expr 1.1e-4} \
	0.00011
    test util-16.1.$::tcl_precision.-3 {shortening of numbers} \
................................................................................
    }
    for {set e 17} {$e < 309} {incr e} {
	test util-16.1.$::tcl_precision.$e {shortening of numbers} \
	    "expr 1.1e$e" 1.1e+$e
    }
}
set tcl_precision 17
test util-16.1.17.-300 {8.4 compatible formatting of doubles} precision \
    {expr 1e-300} \
    1e-300
test util-16.1.17.-299 {8.4 compatible formatting of doubles} precision \
    {expr 1e-299} \
    9.9999999999999999e-300
test util-16.1.17.-298 {8.4 compatible formatting of doubles} precision \
    {expr 1e-298} \
    9.9999999999999991e-299
test util-16.1.17.-297 {8.4 compatible formatting of doubles} precision \
    {expr 1e-297} \
    1e-297
test util-16.1.17.-296 {8.4 compatible formatting of doubles} precision \
    {expr 1e-296} \
    1e-296
test util-16.1.17.-295 {8.4 compatible formatting of doubles} precision \
    {expr 1e-295} \
    1.0000000000000001e-295
test util-16.1.17.-294 {8.4 compatible formatting of doubles} precision \
    {expr 1e-294} \
    1e-294
test util-16.1.17.-293 {8.4 compatible formatting of doubles} precision \
    {expr 1e-293} \
    1.0000000000000001e-293
test util-16.1.17.-292 {8.4 compatible formatting of doubles} precision \
    {expr 1e-292} \
    1.0000000000000001e-292
test util-16.1.17.-291 {8.4 compatible formatting of doubles} precision \
    {expr 1e-291} \
    9.9999999999999996e-292
test util-16.1.17.-290 {8.4 compatible formatting of doubles} precision \
    {expr 1e-290} \
    1.0000000000000001e-290
test util-16.1.17.-289 {8.4 compatible formatting of doubles} precision \
    {expr 1e-289} \
    1e-289
test util-16.1.17.-288 {8.4 compatible formatting of doubles} precision \
    {expr 1e-288} \
    1.0000000000000001e-288
test util-16.1.17.-287 {8.4 compatible formatting of doubles} precision \
    {expr 1e-287} \
    1e-287
test util-16.1.17.-286 {8.4 compatible formatting of doubles} precision \
    {expr 1e-286} \
    1.0000000000000001e-286
test util-16.1.17.-285 {8.4 compatible formatting of doubles} precision \
    {expr 1e-285} \
    1.0000000000000001e-285
test util-16.1.17.-284 {8.4 compatible formatting of doubles} precision \
    {expr 1e-284} \
    1e-284
test util-16.1.17.-283 {8.4 compatible formatting of doubles} precision \
    {expr 1e-283} \
    9.9999999999999995e-284
test util-16.1.17.-282 {8.4 compatible formatting of doubles} precision \
    {expr 1e-282} \
    1e-282
test util-16.1.17.-281 {8.4 compatible formatting of doubles} precision \
    {expr 1e-281} \
    1e-281
test util-16.1.17.-280 {8.4 compatible formatting of doubles} precision \
    {expr 1e-280} \
    9.9999999999999996e-281
test util-16.1.17.-279 {8.4 compatible formatting of doubles} precision \
    {expr 1e-279} \
    1.0000000000000001e-279
test util-16.1.17.-278 {8.4 compatible formatting of doubles} precision \
    {expr 1e-278} \
    9.9999999999999994e-279
test util-16.1.17.-277 {8.4 compatible formatting of doubles} precision \
    {expr 1e-277} \
    9.9999999999999997e-278
test util-16.1.17.-276 {8.4 compatible formatting of doubles} precision \
    {expr 1e-276} \
    1.0000000000000001e-276
test util-16.1.17.-275 {8.4 compatible formatting of doubles} precision \
    {expr 1e-275} \
    9.9999999999999993e-276
test util-16.1.17.-274 {8.4 compatible formatting of doubles} precision \
    {expr 1e-274} \
    9.9999999999999997e-275
test util-16.1.17.-273 {8.4 compatible formatting of doubles} precision \
    {expr 1e-273} \
    1.0000000000000001e-273
test util-16.1.17.-272 {8.4 compatible formatting of doubles} precision \
    {expr 1e-272} \
    9.9999999999999993e-273
test util-16.1.17.-271 {8.4 compatible formatting of doubles} precision \
    {expr 1e-271} \
    9.9999999999999996e-272
test util-16.1.17.-270 {8.4 compatible formatting of doubles} precision \
    {expr 1e-270} \
    1e-270
test util-16.1.17.-269 {8.4 compatible formatting of doubles} precision \
    {expr 1e-269} \
    9.9999999999999996e-270
test util-16.1.17.-268 {8.4 compatible formatting of doubles} precision \
    {expr 1e-268} \
    9.9999999999999996e-269
test util-16.1.17.-267 {8.4 compatible formatting of doubles} precision \
    {expr 1e-267} \
    9.9999999999999998e-268
test util-16.1.17.-266 {8.4 compatible formatting of doubles} precision \
    {expr 1e-266} \
    9.9999999999999998e-267
test util-16.1.17.-265 {8.4 compatible formatting of doubles} precision \
    {expr 1e-265} \
    9.9999999999999998e-266
test util-16.1.17.-264 {8.4 compatible formatting of doubles} precision \
    {expr 1e-264} \
    1e-264
test util-16.1.17.-263 {8.4 compatible formatting of doubles} precision \
    {expr 1e-263} \
    1e-263
test util-16.1.17.-262 {8.4 compatible formatting of doubles} precision \
    {expr 1e-262} \
    1e-262
test util-16.1.17.-261 {8.4 compatible formatting of doubles} precision \
    {expr 1e-261} \
    9.9999999999999998e-262
test util-16.1.17.-260 {8.4 compatible formatting of doubles} precision \
    {expr 1e-260} \
    9.9999999999999996e-261
test util-16.1.17.-259 {8.4 compatible formatting of doubles} precision \
    {expr 1e-259} \
    1.0000000000000001e-259
test util-16.1.17.-258 {8.4 compatible formatting of doubles} precision \
    {expr 1e-258} \
    9.9999999999999995e-259
test util-16.1.17.-257 {8.4 compatible formatting of doubles} precision \
    {expr 1e-257} \
    9.9999999999999998e-258
test util-16.1.17.-256 {8.4 compatible formatting of doubles} precision \
    {expr 1e-256} \
    9.9999999999999998e-257
test util-16.1.17.-255 {8.4 compatible formatting of doubles} precision \
    {expr 1e-255} \
    1e-255
test util-16.1.17.-254 {8.4 compatible formatting of doubles} precision \
    {expr 1e-254} \
    9.9999999999999991e-255
test util-16.1.17.-253 {8.4 compatible formatting of doubles} precision \
    {expr 1e-253} \
    1.0000000000000001e-253
test util-16.1.17.-252 {8.4 compatible formatting of doubles} precision \
    {expr 1e-252} \
    9.9999999999999994e-253
test util-16.1.17.-251 {8.4 compatible formatting of doubles} precision \
    {expr 1e-251} \
    1e-251
test util-16.1.17.-250 {8.4 compatible formatting of doubles} precision \
    {expr 1e-250} \
    1.0000000000000001e-250
test util-16.1.17.-249 {8.4 compatible formatting of doubles} precision \
    {expr 1e-249} \
    1.0000000000000001e-249
test util-16.1.17.-248 {8.4 compatible formatting of doubles} precision \
    {expr 1e-248} \
    9.9999999999999998e-249
test util-16.1.17.-247 {8.4 compatible formatting of doubles} precision \
    {expr 1e-247} \
    1e-247
test util-16.1.17.-246 {8.4 compatible formatting of doubles} precision \
    {expr 1e-246} \
    9.9999999999999996e-247
test util-16.1.17.-245 {8.4 compatible formatting of doubles} precision \
    {expr 1e-245} \
    9.9999999999999993e-246
test util-16.1.17.-244 {8.4 compatible formatting of doubles} precision \
    {expr 1e-244} \
    9.9999999999999993e-245
test util-16.1.17.-243 {8.4 compatible formatting of doubles} precision \
    {expr 1e-243} \
    1e-243
test util-16.1.17.-242 {8.4 compatible formatting of doubles} precision \
    {expr 1e-242} \
    9.9999999999999997e-243
test util-16.1.17.-241 {8.4 compatible formatting of doubles} precision \
    {expr 1e-241} \
    9.9999999999999997e-242
test util-16.1.17.-240 {8.4 compatible formatting of doubles} precision \
    {expr 1e-240} \
    9.9999999999999997e-241
test util-16.1.17.-239 {8.4 compatible formatting of doubles} precision \
    {expr 1e-239} \
    1.0000000000000001e-239
test util-16.1.17.-238 {8.4 compatible formatting of doubles} precision \
    {expr 1e-238} \
    9.9999999999999999e-239
test util-16.1.17.-237 {8.4 compatible formatting of doubles} precision \
    {expr 1e-237} \
    9.9999999999999999e-238
test util-16.1.17.-236 {8.4 compatible formatting of doubles} precision \
    {expr 1e-236} \
    1e-236
test util-16.1.17.-235 {8.4 compatible formatting of doubles} precision \
    {expr 1e-235} \
    9.9999999999999996e-236
test util-16.1.17.-234 {8.4 compatible formatting of doubles} precision \
    {expr 1e-234} \
    9.9999999999999996e-235
test util-16.1.17.-233 {8.4 compatible formatting of doubles} precision \
    {expr 1e-233} \
    9.9999999999999996e-234
test util-16.1.17.-232 {8.4 compatible formatting of doubles} precision \
    {expr 1e-232} \
    1e-232
test util-16.1.17.-231 {8.4 compatible formatting of doubles} precision \
    {expr 1e-231} \
    9.9999999999999999e-232
test util-16.1.17.-230 {8.4 compatible formatting of doubles} precision \
    {expr 1e-230} \
    1e-230
test util-16.1.17.-229 {8.4 compatible formatting of doubles} precision \
    {expr 1e-229} \
    1.0000000000000001e-229
test util-16.1.17.-228 {8.4 compatible formatting of doubles} precision \
    {expr 1e-228} \
    1e-228
test util-16.1.17.-227 {8.4 compatible formatting of doubles} precision \
    {expr 1e-227} \
    9.9999999999999994e-228
test util-16.1.17.-226 {8.4 compatible formatting of doubles} precision \
    {expr 1e-226} \
    9.9999999999999992e-227
test util-16.1.17.-225 {8.4 compatible formatting of doubles} precision \
    {expr 1e-225} \
    9.9999999999999996e-226
test util-16.1.17.-224 {8.4 compatible formatting of doubles} precision \
    {expr 1e-224} \
    1e-224
test util-16.1.17.-223 {8.4 compatible formatting of doubles} precision \
    {expr 1e-223} \
    9.9999999999999997e-224
test util-16.1.17.-222 {8.4 compatible formatting of doubles} precision \
    {expr 1e-222} \
    1e-222
test util-16.1.17.-221 {8.4 compatible formatting of doubles} precision \
    {expr 1e-221} \
    1e-221
test util-16.1.17.-220 {8.4 compatible formatting of doubles} precision \
    {expr 1e-220} \
    9.9999999999999999e-221
test util-16.1.17.-219 {8.4 compatible formatting of doubles} precision \
    {expr 1e-219} \
    1e-219
test util-16.1.17.-218 {8.4 compatible formatting of doubles} precision \
    {expr 1e-218} \
    1e-218
test util-16.1.17.-217 {8.4 compatible formatting of doubles} precision \
    {expr 1e-217} \
    1.0000000000000001e-217
test util-16.1.17.-216 {8.4 compatible formatting of doubles} precision \
    {expr 1e-216} \
    1e-216
test util-16.1.17.-215 {8.4 compatible formatting of doubles} precision \
    {expr 1e-215} \
    1e-215
test util-16.1.17.-214 {8.4 compatible formatting of doubles} precision \
    {expr 1e-214} \
    9.9999999999999991e-215
test util-16.1.17.-213 {8.4 compatible formatting of doubles} precision \
    {expr 1e-213} \
    9.9999999999999995e-214
test util-16.1.17.-212 {8.4 compatible formatting of doubles} precision \
    {expr 1e-212} \
    9.9999999999999995e-213
test util-16.1.17.-211 {8.4 compatible formatting of doubles} precision \
    {expr 1e-211} \
    1.0000000000000001e-211
test util-16.1.17.-210 {8.4 compatible formatting of doubles} precision \
    {expr 1e-210} \
    1e-210
test util-16.1.17.-209 {8.4 compatible formatting of doubles} precision \
    {expr 1e-209} \
    1e-209
test util-16.1.17.-208 {8.4 compatible formatting of doubles} precision \
    {expr 1e-208} \
    1.0000000000000001e-208
test util-16.1.17.-207 {8.4 compatible formatting of doubles} precision \
    {expr 1e-207} \
    9.9999999999999993e-208
test util-16.1.17.-206 {8.4 compatible formatting of doubles} precision \
    {expr 1e-206} \
    1e-206
test util-16.1.17.-205 {8.4 compatible formatting of doubles} precision \
    {expr 1e-205} \
    1e-205
test util-16.1.17.-204 {8.4 compatible formatting of doubles} precision \
    {expr 1e-204} \
    1e-204
test util-16.1.17.-203 {8.4 compatible formatting of doubles} precision \
    {expr 1e-203} \
    1e-203
test util-16.1.17.-202 {8.4 compatible formatting of doubles} precision \
    {expr 1e-202} \
    1e-202
test util-16.1.17.-201 {8.4 compatible formatting of doubles} precision \
    {expr 1e-201} \
    9.9999999999999995e-202
test util-16.1.17.-200 {8.4 compatible formatting of doubles} precision \
    {expr 1e-200} \
    9.9999999999999998e-201
test util-16.1.17.-199 {8.4 compatible formatting of doubles} precision \
    {expr 1e-199} \
    9.9999999999999998e-200
test util-16.1.17.-198 {8.4 compatible formatting of doubles} precision \
    {expr 1e-198} \
    9.9999999999999991e-199
test util-16.1.17.-197 {8.4 compatible formatting of doubles} precision \
    {expr 1e-197} \
    9.9999999999999999e-198
test util-16.1.17.-196 {8.4 compatible formatting of doubles} precision \
    {expr 1e-196} \
    1e-196
test util-16.1.17.-195 {8.4 compatible formatting of doubles} precision \
    {expr 1e-195} \
    1.0000000000000001e-195
test util-16.1.17.-194 {8.4 compatible formatting of doubles} precision \
    {expr 1e-194} \
    1e-194
test util-16.1.17.-193 {8.4 compatible formatting of doubles} precision \
    {expr 1e-193} \
    1e-193
test util-16.1.17.-192 {8.4 compatible formatting of doubles} precision \
    {expr 1e-192} \
    1.0000000000000001e-192
test util-16.1.17.-191 {8.4 compatible formatting of doubles} precision \
    {expr 1e-191} \
    1e-191
test util-16.1.17.-190 {8.4 compatible formatting of doubles} precision \
    {expr 1e-190} \
    1e-190
test util-16.1.17.-189 {8.4 compatible formatting of doubles} precision \
    {expr 1e-189} \
    1.0000000000000001e-189
test util-16.1.17.-188 {8.4 compatible formatting of doubles} precision \
    {expr 1e-188} \
    9.9999999999999995e-189
test util-16.1.17.-187 {8.4 compatible formatting of doubles} precision \
    {expr 1e-187} \
    1e-187
test util-16.1.17.-186 {8.4 compatible formatting of doubles} precision \
    {expr 1e-186} \
    9.9999999999999991e-187
test util-16.1.17.-185 {8.4 compatible formatting of doubles} precision \
    {expr 1e-185} \
    9.9999999999999999e-186
test util-16.1.17.-184 {8.4 compatible formatting of doubles} precision \
    {expr 1e-184} \
    1.0000000000000001e-184
test util-16.1.17.-183 {8.4 compatible formatting of doubles} precision \
    {expr 1e-183} \
    1e-183
test util-16.1.17.-182 {8.4 compatible formatting of doubles} precision \
    {expr 1e-182} \
    1e-182
test util-16.1.17.-181 {8.4 compatible formatting of doubles} precision \
    {expr 1e-181} \
    1e-181
test util-16.1.17.-180 {8.4 compatible formatting of doubles} precision \
    {expr 1e-180} \
    1e-180
test util-16.1.17.-179 {8.4 compatible formatting of doubles} precision \
    {expr 1e-179} \
    1e-179
test util-16.1.17.-178 {8.4 compatible formatting of doubles} precision \
    {expr 1e-178} \
    9.9999999999999995e-179
test util-16.1.17.-177 {8.4 compatible formatting of doubles} precision \
    {expr 1e-177} \
    9.9999999999999995e-178
test util-16.1.17.-176 {8.4 compatible formatting of doubles} precision \
    {expr 1e-176} \
    1e-176
test util-16.1.17.-175 {8.4 compatible formatting of doubles} precision \
    {expr 1e-175} \
    1e-175
test util-16.1.17.-174 {8.4 compatible formatting of doubles} precision \
    {expr 1e-174} \
    1e-174
test util-16.1.17.-173 {8.4 compatible formatting of doubles} precision \
    {expr 1e-173} \
    1e-173
test util-16.1.17.-172 {8.4 compatible formatting of doubles} precision \
    {expr 1e-172} \
    1e-172
test util-16.1.17.-171 {8.4 compatible formatting of doubles} precision \
    {expr 1e-171} \
    9.9999999999999998e-172
test util-16.1.17.-170 {8.4 compatible formatting of doubles} precision \
    {expr 1e-170} \
    9.9999999999999998e-171
test util-16.1.17.-169 {8.4 compatible formatting of doubles} precision \
    {expr 1e-169} \
    1e-169
test util-16.1.17.-168 {8.4 compatible formatting of doubles} precision \
    {expr 1e-168} \
    1e-168
test util-16.1.17.-167 {8.4 compatible formatting of doubles} precision \
    {expr 1e-167} \
    1e-167
test util-16.1.17.-166 {8.4 compatible formatting of doubles} precision \
    {expr 1e-166} \
    1e-166
test util-16.1.17.-165 {8.4 compatible formatting of doubles} precision \
    {expr 1e-165} \
    1e-165
test util-16.1.17.-164 {8.4 compatible formatting of doubles} precision \
    {expr 1e-164} \
    9.9999999999999996e-165
test util-16.1.17.-163 {8.4 compatible formatting of doubles} precision \
    {expr 1e-163} \
    9.9999999999999992e-164
test util-16.1.17.-162 {8.4 compatible formatting of doubles} precision \
    {expr 1e-162} \
    9.9999999999999995e-163
test util-16.1.17.-161 {8.4 compatible formatting of doubles} precision \
    {expr 1e-161} \
    1e-161
test util-16.1.17.-160 {8.4 compatible formatting of doubles} precision \
    {expr 1e-160} \
    9.9999999999999999e-161
test util-16.1.17.-159 {8.4 compatible formatting of doubles} precision \
    {expr 1e-159} \
    9.9999999999999999e-160
test util-16.1.17.-158 {8.4 compatible formatting of doubles} precision \
    {expr 1e-158} \
    1.0000000000000001e-158
test util-16.1.17.-157 {8.4 compatible formatting of doubles} precision \
    {expr 1e-157} \
    9.9999999999999994e-158
test util-16.1.17.-156 {8.4 compatible formatting of doubles} precision \
    {expr 1e-156} \
    1e-156
test util-16.1.17.-155 {8.4 compatible formatting of doubles} precision \
    {expr 1e-155} \
    1e-155
test util-16.1.17.-154 {8.4 compatible formatting of doubles} precision \
    {expr 1e-154} \
    9.9999999999999997e-155
test util-16.1.17.-153 {8.4 compatible formatting of doubles} precision \
    {expr 1e-153} \
    1e-153
test util-16.1.17.-152 {8.4 compatible formatting of doubles} precision \
    {expr 1e-152} \
    1.0000000000000001e-152
test util-16.1.17.-151 {8.4 compatible formatting of doubles} precision \
    {expr 1e-151} \
    9.9999999999999994e-152
test util-16.1.17.-150 {8.4 compatible formatting of doubles} precision \
    {expr 1e-150} \
    1e-150
test util-16.1.17.-149 {8.4 compatible formatting of doubles} precision \
    {expr 1e-149} \
    9.9999999999999998e-150
test util-16.1.17.-148 {8.4 compatible formatting of doubles} precision \
    {expr 1e-148} \
    9.9999999999999994e-149
test util-16.1.17.-147 {8.4 compatible formatting of doubles} precision \
    {expr 1e-147} \
    9.9999999999999997e-148
test util-16.1.17.-146 {8.4 compatible formatting of doubles} precision \
    {expr 1e-146} \
    1e-146
test util-16.1.17.-145 {8.4 compatible formatting of doubles} precision \
    {expr 1e-145} \
    9.9999999999999991e-146
test util-16.1.17.-144 {8.4 compatible formatting of doubles} precision \
    {expr 1e-144} \
    9.9999999999999995e-145
test util-16.1.17.-143 {8.4 compatible formatting of doubles} precision \
    {expr 1e-143} \
    9.9999999999999995e-144
test util-16.1.17.-142 {8.4 compatible formatting of doubles} precision \
    {expr 1e-142} \
    1e-142
test util-16.1.17.-141 {8.4 compatible formatting of doubles} precision \
    {expr 1e-141} \
    1e-141
test util-16.1.17.-140 {8.4 compatible formatting of doubles} precision \
    {expr 1e-140} \
    9.9999999999999998e-141
test util-16.1.17.-139 {8.4 compatible formatting of doubles} precision \
    {expr 1e-139} \
    1e-139
test util-16.1.17.-138 {8.4 compatible formatting of doubles} precision \
    {expr 1e-138} \
    1.0000000000000001e-138
test util-16.1.17.-137 {8.4 compatible formatting of doubles} precision \
    {expr 1e-137} \
    9.9999999999999998e-138
test util-16.1.17.-136 {8.4 compatible formatting of doubles} precision \
    {expr 1e-136} \
    1e-136
test util-16.1.17.-135 {8.4 compatible formatting of doubles} precision \
    {expr 1e-135} \
    1e-135
test util-16.1.17.-134 {8.4 compatible formatting of doubles} precision \
    {expr 1e-134} \
    1e-134
test util-16.1.17.-133 {8.4 compatible formatting of doubles} precision \
    {expr 1e-133} \
    1.0000000000000001e-133
test util-16.1.17.-132 {8.4 compatible formatting of doubles} precision \
    {expr 1e-132} \
    9.9999999999999999e-133
test util-16.1.17.-131 {8.4 compatible formatting of doubles} precision \
    {expr 1e-131} \
    9.9999999999999999e-132
test util-16.1.17.-130 {8.4 compatible formatting of doubles} precision \
    {expr 1e-130} \
    1.0000000000000001e-130
test util-16.1.17.-129 {8.4 compatible formatting of doubles} precision \
    {expr 1e-129} \
    9.9999999999999993e-130
test util-16.1.17.-128 {8.4 compatible formatting of doubles} precision \
    {expr 1e-128} \
    1.0000000000000001e-128
test util-16.1.17.-127 {8.4 compatible formatting of doubles} precision \
    {expr 1e-127} \
    1e-127
test util-16.1.17.-126 {8.4 compatible formatting of doubles} precision \
    {expr 1e-126} \
    9.9999999999999995e-127
test util-16.1.17.-125 {8.4 compatible formatting of doubles} precision \
    {expr 1e-125} \
    1e-125
test util-16.1.17.-124 {8.4 compatible formatting of doubles} precision \
    {expr 1e-124} \
    9.9999999999999993e-125
test util-16.1.17.-123 {8.4 compatible formatting of doubles} precision \
    {expr 1e-123} \
    1.0000000000000001e-123
test util-16.1.17.-122 {8.4 compatible formatting of doubles} precision \
    {expr 1e-122} \
    1.0000000000000001e-122
test util-16.1.17.-121 {8.4 compatible formatting of doubles} precision \
    {expr 1e-121} \
    9.9999999999999998e-122
test util-16.1.17.-120 {8.4 compatible formatting of doubles} precision \
    {expr 1e-120} \
    9.9999999999999998e-121
test util-16.1.17.-119 {8.4 compatible formatting of doubles} precision \
    {expr 1e-119} \
    1e-119
test util-16.1.17.-118 {8.4 compatible formatting of doubles} precision \
    {expr 1e-118} \
    9.9999999999999999e-119
test util-16.1.17.-117 {8.4 compatible formatting of doubles} precision \
    {expr 1e-117} \
    1e-117
test util-16.1.17.-116 {8.4 compatible formatting of doubles} precision \
    {expr 1e-116} \
    9.9999999999999999e-117
test util-16.1.17.-115 {8.4 compatible formatting of doubles} precision \
    {expr 1e-115} \
    1.0000000000000001e-115
test util-16.1.17.-114 {8.4 compatible formatting of doubles} precision \
    {expr 1e-114} \
    1.0000000000000001e-114
test util-16.1.17.-113 {8.4 compatible formatting of doubles} precision \
    {expr 1e-113} \
    9.9999999999999998e-114
test util-16.1.17.-112 {8.4 compatible formatting of doubles} precision \
    {expr 1e-112} \
    9.9999999999999995e-113
test util-16.1.17.-111 {8.4 compatible formatting of doubles} precision \
    {expr 1e-111} \
    1.0000000000000001e-111
test util-16.1.17.-110 {8.4 compatible formatting of doubles} precision \
    {expr 1e-110} \
    1.0000000000000001e-110
test util-16.1.17.-109 {8.4 compatible formatting of doubles} precision \
    {expr 1e-109} \
    9.9999999999999999e-110
test util-16.1.17.-108 {8.4 compatible formatting of doubles} precision \
    {expr 1e-108} \
    1e-108
test util-16.1.17.-107 {8.4 compatible formatting of doubles} precision \
    {expr 1e-107} \
    1e-107
test util-16.1.17.-106 {8.4 compatible formatting of doubles} precision \
    {expr 1e-106} \
    9.9999999999999994e-107
test util-16.1.17.-105 {8.4 compatible formatting of doubles} precision \
    {expr 1e-105} \
    9.9999999999999997e-106
test util-16.1.17.-104 {8.4 compatible formatting of doubles} precision \
    {expr 1e-104} \
    9.9999999999999993e-105
test util-16.1.17.-103 {8.4 compatible formatting of doubles} precision \
    {expr 1e-103} \
    9.9999999999999996e-104
test util-16.1.17.-102 {8.4 compatible formatting of doubles} precision \
    {expr 1e-102} \
    9.9999999999999993e-103
test util-16.1.17.-101 {8.4 compatible formatting of doubles} precision \
    {expr 1e-101} \
    1.0000000000000001e-101
test util-16.1.17.-100 {8.4 compatible formatting of doubles} precision \
    {expr 1e-100} \
    1e-100
test util-16.1.17.-99 {8.4 compatible formatting of doubles} precision \
    {expr 1e-99} \
    1e-99
test util-16.1.17.-98 {8.4 compatible formatting of doubles} precision \
    {expr 1e-98} \
    9.9999999999999994e-99
test util-16.1.17.-97 {8.4 compatible formatting of doubles} precision \
    {expr 1e-97} \
    1e-97
test util-16.1.17.-96 {8.4 compatible formatting of doubles} precision \
    {expr 1e-96} \
    9.9999999999999991e-97
test util-16.1.17.-95 {8.4 compatible formatting of doubles} precision \
    {expr 1e-95} \
    9.9999999999999999e-96
test util-16.1.17.-94 {8.4 compatible formatting of doubles} precision \
    {expr 1e-94} \
    9.9999999999999996e-95
test util-16.1.17.-93 {8.4 compatible formatting of doubles} precision \
    {expr 1e-93} \
    9.999999999999999e-94
test util-16.1.17.-92 {8.4 compatible formatting of doubles} precision \
    {expr 1e-92} \
    9.9999999999999999e-93
test util-16.1.17.-91 {8.4 compatible formatting of doubles} precision \
    {expr 1e-91} \
    1e-91
test util-16.1.17.-90 {8.4 compatible formatting of doubles} precision \
    {expr 1e-90} \
    9.9999999999999999e-91
test util-16.1.17.-89 {8.4 compatible formatting of doubles} precision \
    {expr 1e-89} \
    1e-89
test util-16.1.17.-88 {8.4 compatible formatting of doubles} precision \
    {expr 1e-88} \
    9.9999999999999993e-89
test util-16.1.17.-87 {8.4 compatible formatting of doubles} precision \
    {expr 1e-87} \
    1e-87
test util-16.1.17.-86 {8.4 compatible formatting of doubles} precision \
    {expr 1e-86} \
    1.0000000000000001e-86
test util-16.1.17.-85 {8.4 compatible formatting of doubles} precision \
    {expr 1e-85} \
    9.9999999999999998e-86
test util-16.1.17.-84 {8.4 compatible formatting of doubles} precision \
    {expr 1e-84} \
    1e-84
test util-16.1.17.-83 {8.4 compatible formatting of doubles} precision \
    {expr 1e-83} \
    1e-83
test util-16.1.17.-82 {8.4 compatible formatting of doubles} precision \
    {expr 1e-82} \
    9.9999999999999996e-83
test util-16.1.17.-81 {8.4 compatible formatting of doubles} precision \
    {expr 1e-81} \
    9.9999999999999996e-82
test util-16.1.17.-80 {8.4 compatible formatting of doubles} precision \
    {expr 1e-80} \
    9.9999999999999996e-81
test util-16.1.17.-79 {8.4 compatible formatting of doubles} precision \
    {expr 1e-79} \
    1e-79
test util-16.1.17.-78 {8.4 compatible formatting of doubles} precision \
    {expr 1e-78} \
    1e-78
test util-16.1.17.-77 {8.4 compatible formatting of doubles} precision \
    {expr 1e-77} \
    9.9999999999999993e-78
test util-16.1.17.-76 {8.4 compatible formatting of doubles} precision \
    {expr 1e-76} \
    9.9999999999999993e-77
test util-16.1.17.-75 {8.4 compatible formatting of doubles} precision \
    {expr 1e-75} \
    9.9999999999999996e-76
test util-16.1.17.-74 {8.4 compatible formatting of doubles} precision \
    {expr 1e-74} \
    9.9999999999999996e-75
test util-16.1.17.-73 {8.4 compatible formatting of doubles} precision \
    {expr 1e-73} \
    1e-73
test util-16.1.17.-72 {8.4 compatible formatting of doubles} precision \
    {expr 1e-72} \
    9.9999999999999997e-73
test util-16.1.17.-71 {8.4 compatible formatting of doubles} precision \
    {expr 1e-71} \
    9.9999999999999992e-72
test util-16.1.17.-70 {8.4 compatible formatting of doubles} precision \
    {expr 1e-70} \
    1e-70
test util-16.1.17.-69 {8.4 compatible formatting of doubles} precision \
    {expr 1e-69} \
    9.9999999999999996e-70
test util-16.1.17.-68 {8.4 compatible formatting of doubles} precision \
    {expr 1e-68} \
    1.0000000000000001e-68
test util-16.1.17.-67 {8.4 compatible formatting of doubles} precision \
    {expr 1e-67} \
    9.9999999999999994e-68
test util-16.1.17.-66 {8.4 compatible formatting of doubles} precision \
    {expr 1e-66} \
    9.9999999999999998e-67
test util-16.1.17.-65 {8.4 compatible formatting of doubles} precision \
    {expr 1e-65} \
    9.9999999999999992e-66
test util-16.1.17.-64 {8.4 compatible formatting of doubles} precision \
    {expr 1e-64} \
    9.9999999999999997e-65
test util-16.1.17.-63 {8.4 compatible formatting of doubles} precision \
    {expr 1e-63} \
    1.0000000000000001e-63
test util-16.1.17.-62 {8.4 compatible formatting of doubles} precision \
    {expr 1e-62} \
    1e-62
test util-16.1.17.-61 {8.4 compatible formatting of doubles} precision \
    {expr 1e-61} \
    1e-61
test util-16.1.17.-60 {8.4 compatible formatting of doubles} precision \
    {expr 1e-60} \
    9.9999999999999997e-61
test util-16.1.17.-59 {8.4 compatible formatting of doubles} precision \
    {expr 1e-59} \
    1e-59
test util-16.1.17.-58 {8.4 compatible formatting of doubles} precision \
    {expr 1e-58} \
    1e-58
test util-16.1.17.-57 {8.4 compatible formatting of doubles} precision \
    {expr 1e-57} \
    9.9999999999999995e-58
test util-16.1.17.-56 {8.4 compatible formatting of doubles} precision \
    {expr 1e-56} \
    1e-56
test util-16.1.17.-55 {8.4 compatible formatting of doubles} precision \
    {expr 1e-55} \
    9.9999999999999999e-56
test util-16.1.17.-54 {8.4 compatible formatting of doubles} precision \
    {expr 1e-54} \
    1e-54
test util-16.1.17.-53 {8.4 compatible formatting of doubles} precision \
    {expr 1e-53} \
    1e-53
test util-16.1.17.-52 {8.4 compatible formatting of doubles} precision \
    {expr 1e-52} \
    1e-52
test util-16.1.17.-51 {8.4 compatible formatting of doubles} precision \
    {expr 1e-51} \
    1e-51
test util-16.1.17.-50 {8.4 compatible formatting of doubles} precision \
    {expr 1e-50} \
    1e-50
test util-16.1.17.-49 {8.4 compatible formatting of doubles} precision \
    {expr 1e-49} \
    9.9999999999999994e-50
test util-16.1.17.-48 {8.4 compatible formatting of doubles} precision \
    {expr 1e-48} \
    9.9999999999999997e-49
test util-16.1.17.-47 {8.4 compatible formatting of doubles} precision \
    {expr 1e-47} \
    9.9999999999999997e-48
test util-16.1.17.-46 {8.4 compatible formatting of doubles} precision \
    {expr 1e-46} \
    1e-46
test util-16.1.17.-45 {8.4 compatible formatting of doubles} precision \
    {expr 1e-45} \
    9.9999999999999998e-46
test util-16.1.17.-44 {8.4 compatible formatting of doubles} precision \
    {expr 1e-44} \
    9.9999999999999995e-45
test util-16.1.17.-43 {8.4 compatible formatting of doubles} precision \
    {expr 1e-43} \
    1.0000000000000001e-43
test util-16.1.17.-42 {8.4 compatible formatting of doubles} precision \
    {expr 1e-42} \
    1e-42
test util-16.1.17.-41 {8.4 compatible formatting of doubles} precision \
    {expr 1e-41} \
    1e-41
test util-16.1.17.-40 {8.4 compatible formatting of doubles} precision \
    {expr 1e-40} \
    9.9999999999999993e-41
test util-16.1.17.-39 {8.4 compatible formatting of doubles} precision \
    {expr 1e-39} \
    9.9999999999999993e-40
test util-16.1.17.-38 {8.4 compatible formatting of doubles} precision \
    {expr 1e-38} \
    9.9999999999999996e-39
test util-16.1.17.-37 {8.4 compatible formatting of doubles} precision \
    {expr 1e-37} \
    1.0000000000000001e-37
test util-16.1.17.-36 {8.4 compatible formatting of doubles} precision \
    {expr 1e-36} \
    9.9999999999999994e-37
test util-16.1.17.-35 {8.4 compatible formatting of doubles} precision \
    {expr 1e-35} \
    1e-35
test util-16.1.17.-34 {8.4 compatible formatting of doubles} precision \
    {expr 1e-34} \
    9.9999999999999993e-35
test util-16.1.17.-33 {8.4 compatible formatting of doubles} precision \
    {expr 1e-33} \
    1.0000000000000001e-33
test util-16.1.17.-32 {8.4 compatible formatting of doubles} precision \
    {expr 1e-32} \
    1.0000000000000001e-32
test util-16.1.17.-31 {8.4 compatible formatting of doubles} precision \
    {expr 1e-31} \
    1.0000000000000001e-31
test util-16.1.17.-30 {8.4 compatible formatting of doubles} precision \
    {expr 1e-30} \
    1.0000000000000001e-30
test util-16.1.17.-29 {8.4 compatible formatting of doubles} precision \
    {expr 1e-29} \
    9.9999999999999994e-30
test util-16.1.17.-28 {8.4 compatible formatting of doubles} precision \
    {expr 1e-28} \
    9.9999999999999997e-29
test util-16.1.17.-27 {8.4 compatible formatting of doubles} precision \
    {expr 1e-27} \
    1e-27
test util-16.1.17.-26 {8.4 compatible formatting of doubles} precision \
    {expr 1e-26} \
    1e-26
test util-16.1.17.-25 {8.4 compatible formatting of doubles} precision \
    {expr 1e-25} \
    1e-25
test util-16.1.17.-24 {8.4 compatible formatting of doubles} precision \
    {expr 1e-24} \
    9.9999999999999992e-25
test util-16.1.17.-23 {8.4 compatible formatting of doubles} precision \
    {expr 1e-23} \
    9.9999999999999996e-24
test util-16.1.17.-22 {8.4 compatible formatting of doubles} precision \
    {expr 1e-22} \
    1e-22
test util-16.1.17.-21 {8.4 compatible formatting of doubles} precision \
    {expr 1e-21} \
    9.9999999999999991e-22
test util-16.1.17.-20 {8.4 compatible formatting of doubles} precision \
    {expr 1e-20} \
    9.9999999999999995e-21
test util-16.1.17.-19 {8.4 compatible formatting of doubles} precision \
    {expr 1e-19} \
    9.9999999999999998e-20
test util-16.1.17.-18 {8.4 compatible formatting of doubles} precision \
    {expr 1e-18} \
    1.0000000000000001e-18
test util-16.1.17.-17 {8.4 compatible formatting of doubles} precision \
    {expr 1e-17} \
    1.0000000000000001e-17
test util-16.1.17.-16 {8.4 compatible formatting of doubles} precision \
    {expr 1e-16} \
    9.9999999999999998e-17
test util-16.1.17.-15 {8.4 compatible formatting of doubles} precision \
    {expr 1e-15} \
    1.0000000000000001e-15
test util-16.1.17.-14 {8.4 compatible formatting of doubles} precision \
    {expr 1e-14} \
    1e-14
test util-16.1.17.-13 {8.4 compatible formatting of doubles} precision \
    {expr 1e-13} \
    1e-13
test util-16.1.17.-12 {8.4 compatible formatting of doubles} precision \
    {expr 1e-12} \
    9.9999999999999998e-13
test util-16.1.17.-11 {8.4 compatible formatting of doubles} precision \
    {expr 1e-11} \
    9.9999999999999994e-12
test util-16.1.17.-10 {8.4 compatible formatting of doubles} precision \
    {expr 1e-10} \
    1e-10
test util-16.1.17.-9 {8.4 compatible formatting of doubles} precision \
    {expr 1e-9} \
    1.0000000000000001e-09
test util-16.1.17.-8 {8.4 compatible formatting of doubles} precision \
    {expr 1e-8} \
    1e-08
test util-16.1.17.-7 {8.4 compatible formatting of doubles} precision \
    {expr 1e-7} \
    9.9999999999999995e-08
test util-16.1.17.-6 {8.4 compatible formatting of doubles} precision \
    {expr 1e-6} \
    9.9999999999999995e-07
test util-16.1.17.-5 {8.4 compatible formatting of doubles} precision \
    {expr 1e-5} \
    1.0000000000000001e-05
test util-16.1.17.-4 {8.4 compatible formatting of doubles} precision \
    {expr 1e-4} \
    0.0001
test util-16.1.17.-3 {8.4 compatible formatting of doubles} precision \
    {expr 1e-3} \
    0.001
test util-16.1.17.-2 {8.4 compatible formatting of doubles} precision \
    {expr 1e-2} \
    0.01
test util-16.1.17.-1 {8.4 compatible formatting of doubles} precision \
    {expr 1e-1} \
    0.10000000000000001
test util-16.1.17.0 {8.4 compatible formatting of doubles} precision \
    {expr 1e0} \
    1.0
test util-16.1.17.1 {8.4 compatible formatting of doubles} precision \
    {expr 1e1} \
    10.0
test util-16.1.17.2 {8.4 compatible formatting of doubles} precision \
    {expr 1e2} \
    100.0
test util-16.1.17.3 {8.4 compatible formatting of doubles} precision \
    {expr 1e3} \
    1000.0
test util-16.1.17.4 {8.4 compatible formatting of doubles} precision \
    {expr 1e4} \
    10000.0
test util-16.1.17.5 {8.4 compatible formatting of doubles} precision \
    {expr 1e5} \
    100000.0
test util-16.1.17.6 {8.4 compatible formatting of doubles} precision \
    {expr 1e6} \
    1000000.0
test util-16.1.17.7 {8.4 compatible formatting of doubles} precision \
    {expr 1e7} \
    10000000.0
test util-16.1.17.8 {8.4 compatible formatting of doubles} precision \
    {expr 1e8} \
    100000000.0
test util-16.1.17.9 {8.4 compatible formatting of doubles} precision \
    {expr 1e9} \
    1000000000.0
test util-16.1.17.10 {8.4 compatible formatting of doubles} precision \
    {expr 1e10} \
    10000000000.0
test util-16.1.17.11 {8.4 compatible formatting of doubles} precision \
    {expr 1e11} \
    100000000000.0
test util-16.1.17.12 {8.4 compatible formatting of doubles} precision \
    {expr 1e12} \
    1000000000000.0
test util-16.1.17.13 {8.4 compatible formatting of doubles} precision \
    {expr 1e13} \
    10000000000000.0
test util-16.1.17.14 {8.4 compatible formatting of doubles} precision \
    {expr 1e14} \
    100000000000000.0
test util-16.1.17.15 {8.4 compatible formatting of doubles} precision \
    {expr 1e15} \
    1000000000000000.0
test util-16.1.17.16 {8.4 compatible formatting of doubles} precision \
    {expr 1e16} \
    10000000000000000.0
test util-16.1.17.17 {8.4 compatible formatting of doubles} precision \
    {expr 1e17} \
    1e+17
test util-16.1.17.18 {8.4 compatible formatting of doubles} precision \
    {expr 1e18} \
    1e+18
test util-16.1.17.19 {8.4 compatible formatting of doubles} precision \
    {expr 1e19} \
    1e+19
test util-16.1.17.20 {8.4 compatible formatting of doubles} precision \
    {expr 1e20} \
    1e+20
test util-16.1.17.21 {8.4 compatible formatting of doubles} precision \
    {expr 1e21} \
    1e+21
test util-16.1.17.22 {8.4 compatible formatting of doubles} precision \
    {expr 1e22} \
    1e+22
test util-16.1.17.23 {8.4 compatible formatting of doubles} precision \
    {expr 1e23} \
    9.9999999999999992e+22
test util-16.1.17.24 {8.4 compatible formatting of doubles} precision \
    {expr 1e24} \
    9.9999999999999998e+23
test util-16.1.17.25 {8.4 compatible formatting of doubles} precision \
    {expr 1e25} \
    1.0000000000000001e+25
test util-16.1.17.26 {8.4 compatible formatting of doubles} precision \
    {expr 1e26} \
    1e+26
test util-16.1.17.27 {8.4 compatible formatting of doubles} precision \
    {expr 1e27} \
    1e+27
test util-16.1.17.28 {8.4 compatible formatting of doubles} precision \
    {expr 1e28} \
    9.9999999999999996e+27
test util-16.1.17.29 {8.4 compatible formatting of doubles} precision \
    {expr 1e29} \
    9.9999999999999991e+28
test util-16.1.17.30 {8.4 compatible formatting of doubles} precision \
    {expr 1e30} \
    1e+30
test util-16.1.17.31 {8.4 compatible formatting of doubles} precision \
    {expr 1e31} \
    9.9999999999999996e+30
test util-16.1.17.32 {8.4 compatible formatting of doubles} precision \
    {expr 1e32} \
    1.0000000000000001e+32
test util-16.1.17.33 {8.4 compatible formatting of doubles} precision \
    {expr 1e33} \
    9.9999999999999995e+32
test util-16.1.17.34 {8.4 compatible formatting of doubles} precision \
    {expr 1e34} \
    9.9999999999999995e+33
test util-16.1.17.35 {8.4 compatible formatting of doubles} precision \
    {expr 1e35} \
    9.9999999999999997e+34
test util-16.1.17.36 {8.4 compatible formatting of doubles} precision \
    {expr 1e36} \
    1e+36
test util-16.1.17.37 {8.4 compatible formatting of doubles} precision \
    {expr 1e37} \
    9.9999999999999995e+36
test util-16.1.17.38 {8.4 compatible formatting of doubles} precision \
    {expr 1e38} \
    9.9999999999999998e+37
test util-16.1.17.39 {8.4 compatible formatting of doubles} precision \
    {expr 1e39} \
    9.9999999999999994e+38
test util-16.1.17.40 {8.4 compatible formatting of doubles} precision \
    {expr 1e40} \
    1e+40
test util-16.1.17.41 {8.4 compatible formatting of doubles} precision \
    {expr 1e41} \
    1e+41
test util-16.1.17.42 {8.4 compatible formatting of doubles} precision \
    {expr 1e42} \
    1e+42
test util-16.1.17.43 {8.4 compatible formatting of doubles} precision \
    {expr 1e43} \
    1e+43
test util-16.1.17.44 {8.4 compatible formatting of doubles} precision \
    {expr 1e44} \
    1.0000000000000001e+44
test util-16.1.17.45 {8.4 compatible formatting of doubles} precision \
    {expr 1e45} \
    9.9999999999999993e+44
test util-16.1.17.46 {8.4 compatible formatting of doubles} precision \
    {expr 1e46} \
    9.9999999999999999e+45
test util-16.1.17.47 {8.4 compatible formatting of doubles} precision \
    {expr 1e47} \
    1e+47
test util-16.1.17.48 {8.4 compatible formatting of doubles} precision \
    {expr 1e48} \
    1e+48
test util-16.1.17.49 {8.4 compatible formatting of doubles} precision \
    {expr 1e49} \
    9.9999999999999995e+48
test util-16.1.17.50 {8.4 compatible formatting of doubles} precision \
    {expr 1e50} \
    1.0000000000000001e+50
test util-16.1.17.51 {8.4 compatible formatting of doubles} precision \
    {expr 1e51} \
    9.9999999999999999e+50
test util-16.1.17.52 {8.4 compatible formatting of doubles} precision \
    {expr 1e52} \
    9.9999999999999999e+51
test util-16.1.17.53 {8.4 compatible formatting of doubles} precision \
    {expr 1e53} \
    9.9999999999999999e+52
test util-16.1.17.54 {8.4 compatible formatting of doubles} precision \
    {expr 1e54} \
    1.0000000000000001e+54
test util-16.1.17.55 {8.4 compatible formatting of doubles} precision \
    {expr 1e55} \
    1e+55
test util-16.1.17.56 {8.4 compatible formatting of doubles} precision \
    {expr 1e56} \
    1.0000000000000001e+56
test util-16.1.17.57 {8.4 compatible formatting of doubles} precision \
    {expr 1e57} \
    1e+57
test util-16.1.17.58 {8.4 compatible formatting of doubles} precision \
    {expr 1e58} \
    9.9999999999999994e+57
test util-16.1.17.59 {8.4 compatible formatting of doubles} precision \
    {expr 1e59} \
    9.9999999999999997e+58
test util-16.1.17.60 {8.4 compatible formatting of doubles} precision \
    {expr 1e60} \
    9.9999999999999995e+59
test util-16.1.17.61 {8.4 compatible formatting of doubles} precision \
    {expr 1e61} \
    9.9999999999999995e+60
test util-16.1.17.62 {8.4 compatible formatting of doubles} precision \
    {expr 1e62} \
    1e+62
test util-16.1.17.63 {8.4 compatible formatting of doubles} precision \
    {expr 1e63} \
    1.0000000000000001e+63
test util-16.1.17.64 {8.4 compatible formatting of doubles} precision \
    {expr 1e64} \
    1e+64
test util-16.1.17.65 {8.4 compatible formatting of doubles} precision \
    {expr 1e65} \
    9.9999999999999999e+64
test util-16.1.17.66 {8.4 compatible formatting of doubles} precision \
    {expr 1e66} \
    9.9999999999999995e+65
test util-16.1.17.67 {8.4 compatible formatting of doubles} precision \
    {expr 1e67} \
    9.9999999999999998e+66
test util-16.1.17.68 {8.4 compatible formatting of doubles} precision \
    {expr 1e68} \
    9.9999999999999995e+67
test util-16.1.17.69 {8.4 compatible formatting of doubles} precision \
    {expr 1e69} \
    1.0000000000000001e+69
test util-16.1.17.70 {8.4 compatible formatting of doubles} precision \
    {expr 1e70} \
    1.0000000000000001e+70
test util-16.1.17.71 {8.4 compatible formatting of doubles} precision \
    {expr 1e71} \
    1e+71
test util-16.1.17.72 {8.4 compatible formatting of doubles} precision \
    {expr 1e72} \
    9.9999999999999994e+71
test util-16.1.17.73 {8.4 compatible formatting of doubles} precision \
    {expr 1e73} \
    9.9999999999999998e+72
test util-16.1.17.74 {8.4 compatible formatting of doubles} precision \
    {expr 1e74} \
    9.9999999999999995e+73
test util-16.1.17.75 {8.4 compatible formatting of doubles} precision \
    {expr 1e75} \
    9.9999999999999993e+74
test util-16.1.17.76 {8.4 compatible formatting of doubles} precision \
    {expr 1e76} \
    1e+76
test util-16.1.17.77 {8.4 compatible formatting of doubles} precision \
    {expr 1e77} \
    9.9999999999999998e+76
test util-16.1.17.78 {8.4 compatible formatting of doubles} precision \
    {expr 1e78} \
    1e+78
test util-16.1.17.79 {8.4 compatible formatting of doubles} precision \
    {expr 1e79} \
    9.9999999999999997e+78
test util-16.1.17.80 {8.4 compatible formatting of doubles} precision \
    {expr 1e80} \
    1e+80
test util-16.1.17.81 {8.4 compatible formatting of doubles} precision \
    {expr 1e81} \
    9.9999999999999992e+80
test util-16.1.17.82 {8.4 compatible formatting of doubles} precision \
    {expr 1e82} \
    9.9999999999999996e+81
test util-16.1.17.83 {8.4 compatible formatting of doubles} precision \
    {expr 1e83} \
    1e+83
test util-16.1.17.84 {8.4 compatible formatting of doubles} precision \
    {expr 1e84} \
    1.0000000000000001e+84
test util-16.1.17.85 {8.4 compatible formatting of doubles} precision \
    {expr 1e85} \
    1e+85
test util-16.1.17.86 {8.4 compatible formatting of doubles} precision \
    {expr 1e86} \
    1e+86
test util-16.1.17.87 {8.4 compatible formatting of doubles} precision \
    {expr 1e87} \
    9.9999999999999996e+86
test util-16.1.17.88 {8.4 compatible formatting of doubles} precision \
    {expr 1e88} \
    9.9999999999999996e+87
test util-16.1.17.89 {8.4 compatible formatting of doubles} precision \
    {expr 1e89} \
    9.9999999999999999e+88
test util-16.1.17.90 {8.4 compatible formatting of doubles} precision \
    {expr 1e90} \
    9.9999999999999997e+89
test util-16.1.17.91 {8.4 compatible formatting of doubles} precision \
    {expr 1e91} \
    1.0000000000000001e+91
test util-16.1.17.92 {8.4 compatible formatting of doubles} precision \
    {expr 1e92} \
    1e+92
test util-16.1.17.93 {8.4 compatible formatting of doubles} precision \
    {expr 1e93} \
    1e+93
test util-16.1.17.94 {8.4 compatible formatting of doubles} precision \
    {expr 1e94} \
    1e+94
test util-16.1.17.95 {8.4 compatible formatting of doubles} precision \
    {expr 1e95} \
    1e+95
test util-16.1.17.96 {8.4 compatible formatting of doubles} precision \
    {expr 1e96} \
    1e+96
test util-16.1.17.97 {8.4 compatible formatting of doubles} precision \
    {expr 1e97} \
    1.0000000000000001e+97
test util-16.1.17.98 {8.4 compatible formatting of doubles} precision \
    {expr 1e98} \
    1e+98
test util-16.1.17.99 {8.4 compatible formatting of doubles} precision \
    {expr 1e99} \
    9.9999999999999997e+98
test util-16.1.17.100 {8.4 compatible formatting of doubles} precision \
    {expr 1e100} \
    1e+100
test util-16.1.17.101 {8.4 compatible formatting of doubles} precision \
    {expr 1e101} \
    9.9999999999999998e+100
test util-16.1.17.102 {8.4 compatible formatting of doubles} precision \
    {expr 1e102} \
    9.9999999999999998e+101
test util-16.1.17.103 {8.4 compatible formatting of doubles} precision \
    {expr 1e103} \
    1e+103
test util-16.1.17.104 {8.4 compatible formatting of doubles} precision \
    {expr 1e104} \
    1e+104
test util-16.1.17.105 {8.4 compatible formatting of doubles} precision \
    {expr 1e105} \
    9.9999999999999994e+104
test util-16.1.17.106 {8.4 compatible formatting of doubles} precision \
    {expr 1e106} \
    1.0000000000000001e+106
test util-16.1.17.107 {8.4 compatible formatting of doubles} precision \
    {expr 1e107} \
    9.9999999999999997e+106
test util-16.1.17.108 {8.4 compatible formatting of doubles} precision \
    {expr 1e108} \
    1e+108
test util-16.1.17.109 {8.4 compatible formatting of doubles} precision \
    {expr 1e109} \
    9.9999999999999998e+108
test util-16.1.17.110 {8.4 compatible formatting of doubles} precision \
    {expr 1e110} \
    1e+110
test util-16.1.17.111 {8.4 compatible formatting of doubles} precision \
    {expr 1e111} \
    9.9999999999999996e+110
test util-16.1.17.112 {8.4 compatible formatting of doubles} precision \
    {expr 1e112} \
    9.9999999999999993e+111
test util-16.1.17.113 {8.4 compatible formatting of doubles} precision \
    {expr 1e113} \
    1e+113
test util-16.1.17.114 {8.4 compatible formatting of doubles} precision \
    {expr 1e114} \
    1e+114
test util-16.1.17.115 {8.4 compatible formatting of doubles} precision \
    {expr 1e115} \
    1e+115
test util-16.1.17.116 {8.4 compatible formatting of doubles} precision \
    {expr 1e116} \
    1e+116
test util-16.1.17.117 {8.4 compatible formatting of doubles} precision \
    {expr 1e117} \
    1.0000000000000001e+117
test util-16.1.17.118 {8.4 compatible formatting of doubles} precision \
    {expr 1e118} \
    9.9999999999999997e+117
test util-16.1.17.119 {8.4 compatible formatting of doubles} precision \
    {expr 1e119} \
    9.9999999999999994e+118
test util-16.1.17.120 {8.4 compatible formatting of doubles} precision \
    {expr 1e120} \
    9.9999999999999998e+119
test util-16.1.17.121 {8.4 compatible formatting of doubles} precision \
    {expr 1e121} \
    1e+121
test util-16.1.17.122 {8.4 compatible formatting of doubles} precision \
    {expr 1e122} \
    1e+122
test util-16.1.17.123 {8.4 compatible formatting of doubles} precision \
    {expr 1e123} \
    9.9999999999999998e+122
test util-16.1.17.124 {8.4 compatible formatting of doubles} precision \
    {expr 1e124} \
    9.9999999999999995e+123
test util-16.1.17.125 {8.4 compatible formatting of doubles} precision \
    {expr 1e125} \
    9.9999999999999992e+124
test util-16.1.17.126 {8.4 compatible formatting of doubles} precision \
    {expr 1e126} \
    9.9999999999999992e+125
test util-16.1.17.127 {8.4 compatible formatting of doubles} precision \
    {expr 1e127} \
    9.9999999999999995e+126
test util-16.1.17.128 {8.4 compatible formatting of doubles} precision \
    {expr 1e128} \
    1.0000000000000001e+128
test util-16.1.17.129 {8.4 compatible formatting of doubles} precision \
    {expr 1e129} \
    1e+129
test util-16.1.17.130 {8.4 compatible formatting of doubles} precision \
    {expr 1e130} \
    1.0000000000000001e+130
test util-16.1.17.131 {8.4 compatible formatting of doubles} precision \
    {expr 1e131} \
    9.9999999999999991e+130
test util-16.1.17.132 {8.4 compatible formatting of doubles} precision \
    {expr 1e132} \
    9.9999999999999999e+131
test util-16.1.17.133 {8.4 compatible formatting of doubles} precision \
    {expr 1e133} \
    1e+133
test util-16.1.17.134 {8.4 compatible formatting of doubles} precision \
    {expr 1e134} \
    9.9999999999999992e+133
test util-16.1.17.135 {8.4 compatible formatting of doubles} precision \
    {expr 1e135} \
    9.9999999999999996e+134
test util-16.1.17.136 {8.4 compatible formatting of doubles} precision \
    {expr 1e136} \
    1.0000000000000001e+136
test util-16.1.17.137 {8.4 compatible formatting of doubles} precision \
    {expr 1e137} \
    1e+137
test util-16.1.17.138 {8.4 compatible formatting of doubles} precision \
    {expr 1e138} \
    1e+138
test util-16.1.17.139 {8.4 compatible formatting of doubles} precision \
    {expr 1e139} \
    1e+139
test util-16.1.17.140 {8.4 compatible formatting of doubles} precision \
    {expr 1e140} \
    1.0000000000000001e+140
test util-16.1.17.141 {8.4 compatible formatting of doubles} precision \
    {expr 1e141} \
    1e+141
test util-16.1.17.142 {8.4 compatible formatting of doubles} precision \
    {expr 1e142} \
    1.0000000000000001e+142
test util-16.1.17.143 {8.4 compatible formatting of doubles} precision \
    {expr 1e143} \
    1e+143
test util-16.1.17.144 {8.4 compatible formatting of doubles} precision \
    {expr 1e144} \
    1e+144
test util-16.1.17.145 {8.4 compatible formatting of doubles} precision \
    {expr 1e145} \
    9.9999999999999999e+144
test util-16.1.17.146 {8.4 compatible formatting of doubles} precision \
    {expr 1e146} \
    9.9999999999999993e+145
test util-16.1.17.147 {8.4 compatible formatting of doubles} precision \
    {expr 1e147} \
    9.9999999999999998e+146
test util-16.1.17.148 {8.4 compatible formatting of doubles} precision \
    {expr 1e148} \
    1e+148
test util-16.1.17.149 {8.4 compatible formatting of doubles} precision \
    {expr 1e149} \
    1e+149
test util-16.1.17.150 {8.4 compatible formatting of doubles} precision \
    {expr 1e150} \
    9.9999999999999998e+149
test util-16.1.17.151 {8.4 compatible formatting of doubles} precision \
    {expr 1e151} \
    1e+151
test util-16.1.17.152 {8.4 compatible formatting of doubles} precision \
    {expr 1e152} \
    1e+152
test util-16.1.17.153 {8.4 compatible formatting of doubles} precision \
    {expr 1e153} \
    1e+153
test util-16.1.17.154 {8.4 compatible formatting of doubles} precision \
    {expr 1e154} \
    1e+154
test util-16.1.17.155 {8.4 compatible formatting of doubles} precision \
    {expr 1e155} \
    1e+155
test util-16.1.17.156 {8.4 compatible formatting of doubles} precision \
    {expr 1e156} \
    9.9999999999999998e+155
test util-16.1.17.157 {8.4 compatible formatting of doubles} precision \
    {expr 1e157} \
    9.9999999999999998e+156
test util-16.1.17.158 {8.4 compatible formatting of doubles} precision \
    {expr 1e158} \
    9.9999999999999995e+157
test util-16.1.17.159 {8.4 compatible formatting of doubles} precision \
    {expr 1e159} \
    9.9999999999999993e+158
test util-16.1.17.160 {8.4 compatible formatting of doubles} precision \
    {expr 1e160} \
    1e+160
test util-16.1.17.161 {8.4 compatible formatting of doubles} precision \
    {expr 1e161} \
    1e+161
test util-16.1.17.162 {8.4 compatible formatting of doubles} precision \
    {expr 1e162} \
    9.9999999999999994e+161
test util-16.1.17.163 {8.4 compatible formatting of doubles} precision \
    {expr 1e163} \
    9.9999999999999994e+162
test util-16.1.17.164 {8.4 compatible formatting of doubles} precision \
    {expr 1e164} \
    1e+164
test util-16.1.17.165 {8.4 compatible formatting of doubles} precision \
    {expr 1e165} \
    9.999999999999999e+164
test util-16.1.17.166 {8.4 compatible formatting of doubles} precision \
    {expr 1e166} \
    9.9999999999999994e+165
test util-16.1.17.167 {8.4 compatible formatting of doubles} precision \
    {expr 1e167} \
    1e+167
test util-16.1.17.168 {8.4 compatible formatting of doubles} precision \
    {expr 1e168} \
    9.9999999999999993e+167
test util-16.1.17.169 {8.4 compatible formatting of doubles} precision \
    {expr 1e169} \
    9.9999999999999993e+168
test util-16.1.17.170 {8.4 compatible formatting of doubles} precision \
    {expr 1e170} \
    1e+170
test util-16.1.17.171 {8.4 compatible formatting of doubles} precision \
    {expr 1e171} \
    9.9999999999999995e+170
test util-16.1.17.172 {8.4 compatible formatting of doubles} precision \
    {expr 1e172} \
    1.0000000000000001e+172
test util-16.1.17.173 {8.4 compatible formatting of doubles} precision \
    {expr 1e173} \
    1e+173
test util-16.1.17.174 {8.4 compatible formatting of doubles} precision \
    {expr 1e174} \
    1.0000000000000001e+174
test util-16.1.17.175 {8.4 compatible formatting of doubles} precision \
    {expr 1e175} \
    9.9999999999999994e+174
test util-16.1.17.176 {8.4 compatible formatting of doubles} precision \
    {expr 1e176} \
    1e+176
test util-16.1.17.177 {8.4 compatible formatting of doubles} precision \
    {expr 1e177} \
    1e+177
test util-16.1.17.178 {8.4 compatible formatting of doubles} precision \
    {expr 1e178} \
    1.0000000000000001e+178
test util-16.1.17.179 {8.4 compatible formatting of doubles} precision \
    {expr 1e179} \
    9.9999999999999998e+178
test util-16.1.17.180 {8.4 compatible formatting of doubles} precision \
    {expr 1e180} \
    1e+180
test util-16.1.17.181 {8.4 compatible formatting of doubles} precision \
    {expr 1e181} \
    9.9999999999999992e+180
test util-16.1.17.182 {8.4 compatible formatting of doubles} precision \
    {expr 1e182} \
    1.0000000000000001e+182
test util-16.1.17.183 {8.4 compatible formatting of doubles} precision \
    {expr 1e183} \
    9.9999999999999995e+182
test util-16.1.17.184 {8.4 compatible formatting of doubles} precision \
    {expr 1e184} \
    1e+184
test util-16.1.17.185 {8.4 compatible formatting of doubles} precision \
    {expr 1e185} \
    9.9999999999999998e+184
test util-16.1.17.186 {8.4 compatible formatting of doubles} precision \
    {expr 1e186} \
    9.9999999999999998e+185
test util-16.1.17.187 {8.4 compatible formatting of doubles} precision \
    {expr 1e187} \
    9.9999999999999991e+186
test util-16.1.17.188 {8.4 compatible formatting of doubles} precision \
    {expr 1e188} \
    1e+188
test util-16.1.17.189 {8.4 compatible formatting of doubles} precision \
    {expr 1e189} \
    1e+189
test util-16.1.17.190 {8.4 compatible formatting of doubles} precision \
    {expr 1e190} \
    1.0000000000000001e+190
test util-16.1.17.191 {8.4 compatible formatting of doubles} precision \
    {expr 1e191} \
    1.0000000000000001e+191
test util-16.1.17.192 {8.4 compatible formatting of doubles} precision \
    {expr 1e192} \
    1e+192
test util-16.1.17.193 {8.4 compatible formatting of doubles} precision \
    {expr 1e193} \
    1.0000000000000001e+193
test util-16.1.17.194 {8.4 compatible formatting of doubles} precision \
    {expr 1e194} \
    9.9999999999999994e+193
test util-16.1.17.195 {8.4 compatible formatting of doubles} precision \
    {expr 1e195} \
    9.9999999999999998e+194
test util-16.1.17.196 {8.4 compatible formatting of doubles} precision \
    {expr 1e196} \
    9.9999999999999995e+195
test util-16.1.17.197 {8.4 compatible formatting of doubles} precision \
    {expr 1e197} \
    9.9999999999999995e+196
test util-16.1.17.198 {8.4 compatible formatting of doubles} precision \
    {expr 1e198} \
    1e+198
test util-16.1.17.199 {8.4 compatible formatting of doubles} precision \
    {expr 1e199} \
    1.0000000000000001e+199
test util-16.1.17.200 {8.4 compatible formatting of doubles} precision \
    {expr 1e200} \
    9.9999999999999997e+199
test util-16.1.17.201 {8.4 compatible formatting of doubles} precision \
    {expr 1e201} \
    1e+201
test util-16.1.17.202 {8.4 compatible formatting of doubles} precision \
    {expr 1e202} \
    9.999999999999999e+201
test util-16.1.17.203 {8.4 compatible formatting of doubles} precision \
    {expr 1e203} \
    9.9999999999999999e+202
test util-16.1.17.204 {8.4 compatible formatting of doubles} precision \
    {expr 1e204} \
    9.9999999999999999e+203
test util-16.1.17.205 {8.4 compatible formatting of doubles} precision \
    {expr 1e205} \
    1e+205
test util-16.1.17.206 {8.4 compatible formatting of doubles} precision \
    {expr 1e206} \
    1e+206
test util-16.1.17.207 {8.4 compatible formatting of doubles} precision \
    {expr 1e207} \
    1e+207
test util-16.1.17.208 {8.4 compatible formatting of doubles} precision \
    {expr 1e208} \
    9.9999999999999998e+207
test util-16.1.17.209 {8.4 compatible formatting of doubles} precision \
    {expr 1e209} \
    1.0000000000000001e+209
test util-16.1.17.210 {8.4 compatible formatting of doubles} precision \
    {expr 1e210} \
    9.9999999999999993e+209
test util-16.1.17.211 {8.4 compatible formatting of doubles} precision \
    {expr 1e211} \
    9.9999999999999996e+210
test util-16.1.17.212 {8.4 compatible formatting of doubles} precision \
    {expr 1e212} \
    9.9999999999999991e+211
test util-16.1.17.213 {8.4 compatible formatting of doubles} precision \
    {expr 1e213} \
    9.9999999999999998e+212
test util-16.1.17.214 {8.4 compatible formatting of doubles} precision \
    {expr 1e214} \
    9.9999999999999995e+213
test util-16.1.17.215 {8.4 compatible formatting of doubles} precision \
    {expr 1e215} \
    9.9999999999999991e+214
test util-16.1.17.216 {8.4 compatible formatting of doubles} precision \
    {expr 1e216} \
    1e+216
test util-16.1.17.217 {8.4 compatible formatting of doubles} precision \
    {expr 1e217} \
    9.9999999999999996e+216
test util-16.1.17.218 {8.4 compatible formatting of doubles} precision \
    {expr 1e218} \
    1.0000000000000001e+218
test util-16.1.17.219 {8.4 compatible formatting of doubles} precision \
    {expr 1e219} \
    9.9999999999999997e+218
test util-16.1.17.220 {8.4 compatible formatting of doubles} precision \
    {expr 1e220} \
    1e+220
test util-16.1.17.221 {8.4 compatible formatting of doubles} precision \
    {expr 1e221} \
    1e+221
test util-16.1.17.222 {8.4 compatible formatting of doubles} precision \
    {expr 1e222} \
    1e+222
test util-16.1.17.223 {8.4 compatible formatting of doubles} precision \
    {expr 1e223} \
    1e+223
test util-16.1.17.224 {8.4 compatible formatting of doubles} precision \
    {expr 1e224} \
    9.9999999999999997e+223
test util-16.1.17.225 {8.4 compatible formatting of doubles} precision \
    {expr 1e225} \
    9.9999999999999993e+224
test util-16.1.17.226 {8.4 compatible formatting of doubles} precision \
    {expr 1e226} \
    9.9999999999999996e+225
test util-16.1.17.227 {8.4 compatible formatting of doubles} precision \
    {expr 1e227} \
    1.0000000000000001e+227
test util-16.1.17.228 {8.4 compatible formatting of doubles} precision \
    {expr 1e228} \
    9.9999999999999992e+227
test util-16.1.17.229 {8.4 compatible formatting of doubles} precision \
    {expr 1e229} \
    9.9999999999999999e+228
test util-16.1.17.230 {8.4 compatible formatting of doubles} precision \
    {expr 1e230} \
    1.0000000000000001e+230
test util-16.1.17.231 {8.4 compatible formatting of doubles} precision \
    {expr 1e231} \
    1.0000000000000001e+231
test util-16.1.17.232 {8.4 compatible formatting of doubles} precision \
    {expr 1e232} \
    1.0000000000000001e+232
test util-16.1.17.233 {8.4 compatible formatting of doubles} precision \
    {expr 1e233} \
    9.9999999999999997e+232
test util-16.1.17.234 {8.4 compatible formatting of doubles} precision \
    {expr 1e234} \
    1e+234
test util-16.1.17.235 {8.4 compatible formatting of doubles} precision \
    {expr 1e235} \
    1.0000000000000001e+235
test util-16.1.17.236 {8.4 compatible formatting of doubles} precision \
    {expr 1e236} \
    1.0000000000000001e+236
test util-16.1.17.237 {8.4 compatible formatting of doubles} precision \
    {expr 1e237} \
    9.9999999999999994e+236
test util-16.1.17.238 {8.4 compatible formatting of doubles} precision \
    {expr 1e238} \
    1e+238
test util-16.1.17.239 {8.4 compatible formatting of doubles} precision \
    {expr 1e239} \
    9.9999999999999999e+238
test util-16.1.17.240 {8.4 compatible formatting of doubles} precision \
    {expr 1e240} \
    1e+240
test util-16.1.17.241 {8.4 compatible formatting of doubles} precision \
    {expr 1e241} \
    1.0000000000000001e+241
test util-16.1.17.242 {8.4 compatible formatting of doubles} precision \
    {expr 1e242} \
    1.0000000000000001e+242
test util-16.1.17.243 {8.4 compatible formatting of doubles} precision \
    {expr 1e243} \
    1.0000000000000001e+243
test util-16.1.17.244 {8.4 compatible formatting of doubles} precision \
    {expr 1e244} \
    1.0000000000000001e+244
test util-16.1.17.245 {8.4 compatible formatting of doubles} precision \
    {expr 1e245} \
    1e+245
test util-16.1.17.246 {8.4 compatible formatting of doubles} precision \
    {expr 1e246} \
    1.0000000000000001e+246
test util-16.1.17.247 {8.4 compatible formatting of doubles} precision \
    {expr 1e247} \
    9.9999999999999995e+246
test util-16.1.17.248 {8.4 compatible formatting of doubles} precision \
    {expr 1e248} \
    1e+248
test util-16.1.17.249 {8.4 compatible formatting of doubles} precision \
    {expr 1e249} \
    9.9999999999999992e+248
test util-16.1.17.250 {8.4 compatible formatting of doubles} precision \
    {expr 1e250} \
    9.9999999999999992e+249
test util-16.1.17.251 {8.4 compatible formatting of doubles} precision \
    {expr 1e251} \
    1e+251
test util-16.1.17.252 {8.4 compatible formatting of doubles} precision \
    {expr 1e252} \
    1.0000000000000001e+252
test util-16.1.17.253 {8.4 compatible formatting of doubles} precision \
    {expr 1e253} \
    9.9999999999999994e+252
test util-16.1.17.254 {8.4 compatible formatting of doubles} precision \
    {expr 1e254} \
    9.9999999999999994e+253
test util-16.1.17.255 {8.4 compatible formatting of doubles} precision \
    {expr 1e255} \
    9.9999999999999999e+254
test util-16.1.17.256 {8.4 compatible formatting of doubles} precision \
    {expr 1e256} \
    1e+256
test util-16.1.17.257 {8.4 compatible formatting of doubles} precision \
    {expr 1e257} \
    1e+257
test util-16.1.17.258 {8.4 compatible formatting of doubles} precision \
    {expr 1e258} \
    1.0000000000000001e+258
test util-16.1.17.259 {8.4 compatible formatting of doubles} precision \
    {expr 1e259} \
    9.9999999999999993e+258
test util-16.1.17.260 {8.4 compatible formatting of doubles} precision \
    {expr 1e260} \
    1.0000000000000001e+260
test util-16.1.17.261 {8.4 compatible formatting of doubles} precision \
    {expr 1e261} \
    9.9999999999999993e+260
test util-16.1.17.262 {8.4 compatible formatting of doubles} precision \
    {expr 1e262} \
    1e+262
test util-16.1.17.263 {8.4 compatible formatting of doubles} precision \
    {expr 1e263} \
    1e+263
test util-16.1.17.264 {8.4 compatible formatting of doubles} precision \
    {expr 1e264} \
    1e+264
test util-16.1.17.265 {8.4 compatible formatting of doubles} precision \
    {expr 1e265} \
    1.0000000000000001e+265
test util-16.1.17.266 {8.4 compatible formatting of doubles} precision \
    {expr 1e266} \
    1e+266
test util-16.1.17.267 {8.4 compatible formatting of doubles} precision \
    {expr 1e267} \
    9.9999999999999997e+266
test util-16.1.17.268 {8.4 compatible formatting of doubles} precision \
    {expr 1e268} \
    9.9999999999999997e+267
test util-16.1.17.269 {8.4 compatible formatting of doubles} precision \
    {expr 1e269} \
    1e+269
test util-16.1.17.270 {8.4 compatible formatting of doubles} precision \
    {expr 1e270} \
    1e+270
test util-16.1.17.271 {8.4 compatible formatting of doubles} precision \
    {expr 1e271} \
    9.9999999999999995e+270
test util-16.1.17.272 {8.4 compatible formatting of doubles} precision \
    {expr 1e272} \
    1.0000000000000001e+272
test util-16.1.17.273 {8.4 compatible formatting of doubles} precision \
    {expr 1e273} \
    9.9999999999999995e+272
test util-16.1.17.274 {8.4 compatible formatting of doubles} precision \
    {expr 1e274} \
    9.9999999999999992e+273
test util-16.1.17.275 {8.4 compatible formatting of doubles} precision \
    {expr 1e275} \
    9.9999999999999996e+274
test util-16.1.17.276 {8.4 compatible formatting of doubles} precision \
    {expr 1e276} \
    1.0000000000000001e+276
test util-16.1.17.277 {8.4 compatible formatting of doubles} precision \
    {expr 1e277} \
    1e+277
test util-16.1.17.278 {8.4 compatible formatting of doubles} precision \
    {expr 1e278} \
    9.9999999999999996e+277
test util-16.1.17.279 {8.4 compatible formatting of doubles} precision \
    {expr 1e279} \
    1.0000000000000001e+279
test util-16.1.17.280 {8.4 compatible formatting of doubles} precision \
    {expr 1e280} \
    1e+280
test util-16.1.17.281 {8.4 compatible formatting of doubles} precision \
    {expr 1e281} \
    1e+281
test util-16.1.17.282 {8.4 compatible formatting of doubles} precision \
    {expr 1e282} \
    1e+282
test util-16.1.17.283 {8.4 compatible formatting of doubles} precision \
    {expr 1e283} \
    9.9999999999999996e+282
test util-16.1.17.284 {8.4 compatible formatting of doubles} precision \
    {expr 1e284} \
    1.0000000000000001e+284
test util-16.1.17.285 {8.4 compatible formatting of doubles} precision \
    {expr 1e285} \
    9.9999999999999998e+284
test util-16.1.17.286 {8.4 compatible formatting of doubles} precision \
    {expr 1e286} \
    1e+286
test util-16.1.17.287 {8.4 compatible formatting of doubles} precision \
    {expr 1e287} \
    1.0000000000000001e+287
test util-16.1.17.288 {8.4 compatible formatting of doubles} precision \
    {expr 1e288} \
    1e+288
test util-16.1.17.289 {8.4 compatible formatting of doubles} precision \
    {expr 1e289} \
    1.0000000000000001e+289
test util-16.1.17.290 {8.4 compatible formatting of doubles} precision \
    {expr 1e290} \
    1.0000000000000001e+290
test util-16.1.17.291 {8.4 compatible formatting of doubles} precision \
    {expr 1e291} \
    9.9999999999999996e+290
test util-16.1.17.292 {8.4 compatible formatting of doubles} precision \
    {expr 1e292} \
    1e+292
test util-16.1.17.293 {8.4 compatible formatting of doubles} precision \
    {expr 1e293} \
    9.9999999999999992e+292
test util-16.1.17.294 {8.4 compatible formatting of doubles} precision \
    {expr 1e294} \
    1.0000000000000001e+294
test util-16.1.17.295 {8.4 compatible formatting of doubles} precision \
    {expr 1e295} \
    9.9999999999999998e+294
test util-16.1.17.296 {8.4 compatible formatting of doubles} precision \
    {expr 1e296} \
    9.9999999999999998e+295
test util-16.1.17.297 {8.4 compatible formatting of doubles} precision \
    {expr 1e297} \
    1e+297
test util-16.1.17.298 {8.4 compatible formatting of doubles} precision \
    {expr 1e298} \
    9.9999999999999996e+297
test util-16.1.17.299 {8.4 compatible formatting of doubles} precision \
    {expr 1e299} \
    1.0000000000000001e+299
test util-16.1.17.300 {8.4 compatible formatting of doubles} precision \
    {expr 1e300} \
    1.0000000000000001e+300
test util-16.1.17.301 {8.4 compatible formatting of doubles} precision \
    {expr 1e301} \
    1.0000000000000001e+301
test util-16.1.17.302 {8.4 compatible formatting of doubles} precision \
    {expr 1e302} \
    1.0000000000000001e+302
test util-16.1.17.303 {8.4 compatible formatting of doubles} precision \
    {expr 1e303} \
    1e+303
test util-16.1.17.304 {8.4 compatible formatting of doubles} precision \
    {expr 1e304} \
    9.9999999999999994e+303
test util-16.1.17.305 {8.4 compatible formatting of doubles} precision \
    {expr 1e305} \
    9.9999999999999994e+304
test util-16.1.17.306 {8.4 compatible formatting of doubles} precision \
    {expr 1e306} \
    1e+306
test util-16.1.17.307 {8.4 compatible formatting of doubles} precision \
    {expr 1e307} \
    9.9999999999999999e+306

test util-17.1 {bankers' rounding [Bug 3349507]} {ieeeFloatingPoint} {
    set r {}
    foreach {input} {
	0x1ffffffffffffc000
................................................................................
    testprint "%I64d %td" 65536
} {65536 65536}

test util-18.12 {Tcl_ObjPrintf} {testprint} {
    testprint "%I64d %Id" 65537
} {65537 65537}

if {[catch {set ::tcl_precision $saved_precision}]} {
    unset ::tcl_precision 
}

# cleanup
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End:

Changes to tools/uniParse.tcl.

208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    set last [expr {[llength $pMap] - 1}]
    for {set i 0} {$i <= $last} {incr i} {
	if {$i == [expr {0x10000 >> $shift}]} {
	    set line [string trimright $line " \t,"]
	    puts $f $line
	    set lastpage [expr {[lindex $line end] >> $shift}]
	    puts stdout "lastpage: $lastpage"
	    puts $f "#if TCL_UTF_MAX > 3"
	    set line "    ,"
	}
	append line [lindex $pMap $i]
	if {$i != $last} {
	    append line ", "
	}
	if {[string length $line] > 70} {
................................................................................
    set line "    "
    set lasti [expr {[llength $pages] - 1}]
    for {set i 0} {$i <= $lasti} {incr i} {
	set page [lindex $pages $i]
	set lastj [expr {[llength $page] - 1}]
	if {$i == ($lastpage + 1)} {
	    puts $f [string trimright $line " \t,"]
	    puts $f "#if TCL_UTF_MAX > 3"
	    set line "    ,"
	}
	for {set j 0} {$j <= $lastj} {incr j} {
	    append line [lindex $page $j]
	    if {$j != $lastj || $i != $lasti} {
		append line ", "
	    }
................................................................................
	    puts $f [string trimright $line]
	    set line "    "
	}
    }
    puts $f $line
    puts -nonewline $f "};

#if TCL_UTF_MAX > 3
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= [format 0x%x $next])
#else
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0)
#endif

/*
 * The following constants are used to determine the category of a
................................................................................
#define GetDelta(info) ((info) >> 8)

/*
 * This macro extracts the information about a character from the
 * Unicode character tables.
 */

#if TCL_UTF_MAX > 3
#   define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0x1fffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
#else
#   define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0xffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
#endif
"

    close $f
}

uni::main

return






|







 







|







 







|







 







|












208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    set last [expr {[llength $pMap] - 1}]
    for {set i 0} {$i <= $last} {incr i} {
	if {$i == [expr {0x10000 >> $shift}]} {
	    set line [string trimright $line " \t,"]
	    puts $f $line
	    set lastpage [expr {[lindex $line end] >> $shift}]
	    puts stdout "lastpage: $lastpage"
	    puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6"
	    set line "    ,"
	}
	append line [lindex $pMap $i]
	if {$i != $last} {
	    append line ", "
	}
	if {[string length $line] > 70} {
................................................................................
    set line "    "
    set lasti [expr {[llength $pages] - 1}]
    for {set i 0} {$i <= $lasti} {incr i} {
	set page [lindex $pages $i]
	set lastj [expr {[llength $page] - 1}]
	if {$i == ($lastpage + 1)} {
	    puts $f [string trimright $line " \t,"]
	    puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6"
	    set line "    ,"
	}
	for {set j 0} {$j <= $lastj} {incr j} {
	    append line [lindex $page $j]
	    if {$j != $lastj || $i != $lasti} {
		append line ", "
	    }
................................................................................
	    puts $f [string trimright $line]
	    set line "    "
	}
    }
    puts $f $line
    puts -nonewline $f "};

#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= [format 0x%x $next])
#else
#   define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0)
#endif

/*
 * The following constants are used to determine the category of a
................................................................................
#define GetDelta(info) ((info) >> 8)

/*
 * This macro extracts the information about a character from the
 * Unicode character tables.
 */

#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
#   define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0x1fffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
#else
#   define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0xffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
#endif
"

    close $f
}

uni::main

return

Changes to win/tclWinSerial.c.

2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
     */

    if (len == 0) {
	Tcl_DStringAppendElement(dsPtr, "-xchar");
	Tcl_DStringStartSublist(dsPtr);
    }
    if (len==0 || (len>1 && strncmp(optionName, "-xchar", len) == 0)) {
	char buf[TCL_UTF_MAX];
	valid = 1;

	if (!GetCommState(infoPtr->handle, &dcb)) {
	    if (interp != NULL) {
		TclWinConvertError(GetLastError());
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"can't get comm state: %s", Tcl_PosixError(interp)));






|







2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
     */

    if (len == 0) {
	Tcl_DStringAppendElement(dsPtr, "-xchar");
	Tcl_DStringStartSublist(dsPtr);
    }
    if (len==0 || (len>1 && strncmp(optionName, "-xchar", len) == 0)) {
	char buf[4];
	valid = 1;

	if (!GetCommState(infoPtr->handle, &dcb)) {
	    if (interp != NULL) {
		TclWinConvertError(GetLastError());
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"can't get comm state: %s", Tcl_PosixError(interp)));