Check-in [8fcb19ead3]
Not logged in

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

Overview
Comment: * tests/string.test: * generic/tclVar.c (Tcl_SetVar2Ex): * generic/tclStringObj.c (Tcl_AppendObjToObj): * generic/tclCmdMZ.c (Tcl_StringObjCmd): optimized the string index, string length, string range, and append command in cases where the object's internal rep is a bytearray. Objects with other internal reps are converted to have the new unicode internal rep. * unix/Makefile.in: * win/Makefile.in: * win/Makefile.vc: * tests/unicode.test: * generic/tclInt.h: * generic/tclObj.c: * generic/tclUnicodeObj.c: added a new object type to store the unicode representation of a string. * generic/tclTestObj.c: added the objtype option to the testobj command. This option returns the name of the type of internal rep an object has.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8fcb19ead37123b20e22ef888f8c6c310abde293
User & Date: hershey 1999-06-08 02:59:23.000
Context
1999-06-08
18:06
added code to unset the "data" array so tests that follow can use a scalar data var w/o having to un... check-in: a916ae38b5 user: hershey tags: trunk
02:59
* tests/string.test: * generic/tclVar.c (Tcl_SetVar2Ex): * generic/tclStringObj.c (Tcl_AppendObjT... check-in: 8fcb19ead3 user: hershey tags: trunk
1999-06-05
00:18
*** empty log message *** check-in: fe3561f466 user: stanton tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.
























1
2
3
4
5
6
7
























1999-06-04    <stanton@scriptics.com>

	* win/configure.in: 
	* win/Makefile.in: Windows build now handles static/dynamic
	debug/nodebug builds and supports the standard targets using
	Cygwin user tools plus GNU make and autoconf.

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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1999-06-07  Melissa Hirschl  <hershey@matisse.scriptics.com>

	* tests/string.test: 
	* generic/tclVar.c (Tcl_SetVar2Ex):
	* generic/tclStringObj.c (Tcl_AppendObjToObj):
	* generic/tclCmdMZ.c (Tcl_StringObjCmd): optimized the string
	index, string length, string range, and append command in cases
	where the object's internal rep is a bytearray.  Objects with
	other internal reps are converted to have the new unicode internal
	rep.  

	* unix/Makefile.in: 
	* win/Makefile.in: 
	* win/Makefile.vc: 
	* tests/unicode.test: 
	* generic/tclInt.h:
	* generic/tclObj.c:
	* generic/tclUnicodeObj.c: added a new object type to store the
	unicode representation of a string.

	* generic/tclTestObj.c: added the objtype option to the testobj
	command.  This option returns the name of the type of internal rep
	an object has.

1999-06-04    <stanton@scriptics.com>

	* win/configure.in: 
	* win/Makefile.in: Windows build now handles static/dynamic
	debug/nodebug builds and supports the standard targets using
	Cygwin user tools plus GNU make and autoconf.

Changes to generic/tclCmdMZ.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclCmdMZ.c,v 1.12 1999/06/03 18:43:30 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclCompile.h"
#include "tclRegexp.h"








|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclCmdMZ.c,v 1.13 1999/06/08 02:59:23 hershey Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclCompile.h"
#include "tclRegexp.h"

1005
1006
1007
1008
1009
1010
1011


1012
1013
1014
1015
1016
1017
1018
1019




1020
1021




1022
1023
1024
1025




1026
1027


1028
1029
1030
1031

1032
1033
1034
1035


1036
1037
1038
1039
1040
1041
1042
1043
1044
		}
	    }
	    Tcl_SetIntObj(resultPtr, match);
	    break;
	}
	case STR_INDEX: {
	    int index;



	    if (objc != 4) {
	        Tcl_WrongNumArgs(interp, 2, objv, "string charIndex");
		return TCL_ERROR;
	    }
	    string1 = Tcl_GetStringFromObj(objv[2], &length1);
	    /*
	     * establish what 'end' really means




	     */
	    length2 = Tcl_NumUtfChars(string1, length1);




	    if (TclGetIntForIndex(interp, objv[3], length2 - 1,
				  &index) != TCL_OK) {
	      return TCL_ERROR;
	    }




	    /*
	     * index must be between 0 and the UTF length to be valid


	     */
	    if ((index >= 0) && (index < length2)) {
		if (length1 == length2) {
		    /* no unicode chars */

		    Tcl_SetStringObj(resultPtr, string1+index, 1);
		} else {
		    char buf[TCL_UTF_MAX];



		    length2 = Tcl_UniCharToUtf(Tcl_UniCharAtIndex(string1,
								  index), buf);
		    Tcl_SetStringObj(resultPtr, buf, length2);
		}
	    }
	    break;
	}
	case STR_IS: {
	    char *end;







>
>





|

<
>
>
>
>

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







1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020

1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046
1047

1048
1049
1050
1051
1052

1053
1054
1055
1056
1057
1058
1059
		}
	    }
	    Tcl_SetIntObj(resultPtr, match);
	    break;
	}
	case STR_INDEX: {
	    int index;
	    char buf[TCL_UTF_MAX];
	    Tcl_UniChar unichar;

	    if (objc != 4) {
	        Tcl_WrongNumArgs(interp, 2, objv, "string charIndex");
		return TCL_ERROR;
	    }

	    /*

	     * If we have a ByteArray object, avoid indexing in the
	     * Utf string since the byte array contains one byte per
	     * character.  Otherwise, use the Unicode string rep to
	     * get the index'th char.
	     */

	    if (objv[2]->typePtr == &tclByteArrayType) {

		string1 = Tcl_GetByteArrayFromObj(objv[2], &length1);

		if (TclGetIntForIndex(interp, objv[3], length1 - 1,
			&index) != TCL_OK) {
		    return TCL_ERROR;
		}
		Tcl_SetStringObj(resultPtr, &string1[index], 1);
	    } else {
		string1 = Tcl_GetStringFromObj(objv[2], &length1);
		
		/*

		 * convert to Unicode internal rep to calulate what
		 * 'end' really means.
		 */

		length2 = TclGetUnicodeLengthFromObj(objv[2]);
    
		if (TclGetIntForIndex(interp, objv[3], length2 - 1,
			&index) != TCL_OK) {

		    return TCL_ERROR;
		}
		if ((index >= 0) && (index < length2)) {
		    unichar = TclGetUniCharFromObj(objv[2], index);
		    length2 = Tcl_UniCharToUtf((int)unichar, buf);

		    Tcl_SetStringObj(resultPtr, buf, length2);
		}
	    }
	    break;
	}
	case STR_IS: {
	    char *end;
1396
1397
1398
1399
1400
1401
1402
1403

1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
	    if ((enum options) index == STR_BYTELENGTH) {
		(void) Tcl_GetStringFromObj(objv[2], &length1);
		Tcl_SetIntObj(resultPtr, length1);
	    } else {
		/*
		 * If we have a ByteArray object, avoid recomputing the
		 * string since the byte array contains one byte per
		 * character. 

		 */

		if (objv[2]->typePtr == &tclByteArrayType) {
		    (void) Tcl_GetByteArrayFromObj(objv[2], &length1);
		    Tcl_SetIntObj(resultPtr, length1);
		} else {
		    string1 = Tcl_GetStringFromObj(objv[2], &length1);
		    Tcl_SetIntObj(resultPtr, Tcl_NumUtfChars(string1,
			    length1));
		}
	    }
	    break;
	}
	case STR_MAP: {
	    int uselen, mapElemc, len, nocase = 0;
	    Tcl_Obj **mapElemv;







|
>






<
|
|







1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425

1426
1427
1428
1429
1430
1431
1432
1433
1434
	    if ((enum options) index == STR_BYTELENGTH) {
		(void) Tcl_GetStringFromObj(objv[2], &length1);
		Tcl_SetIntObj(resultPtr, length1);
	    } else {
		/*
		 * If we have a ByteArray object, avoid recomputing the
		 * string since the byte array contains one byte per
		 * character.  Otherwise, use the Unicode string rep to
		 * calculate the length.
		 */

		if (objv[2]->typePtr == &tclByteArrayType) {
		    (void) Tcl_GetByteArrayFromObj(objv[2], &length1);
		    Tcl_SetIntObj(resultPtr, length1);
		} else {

		    Tcl_SetIntObj(resultPtr,
			    TclGetUnicodeLengthFromObj(objv[2]));
		}
	    }
	    break;
	}
	case STR_MAP: {
	    int uselen, mapElemc, len, nocase = 0;
	    Tcl_Obj **mapElemv;
1546
1547
1548
1549
1550
1551
1552































1553
1554







1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570

1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
	    int first, last;

	    if (objc != 5) {
	        Tcl_WrongNumArgs(interp, 2, objv, "string first last");
		return TCL_ERROR;
	    }
































	    string1 = Tcl_GetStringFromObj(objv[2], &length1);
	    length1 = Tcl_NumUtfChars(string1, length1) - 1;







	    if (TclGetIntForIndex(interp, objv[3], length1,
		    &first) != TCL_OK) {
		return TCL_ERROR;
	    }
	    if (TclGetIntForIndex(interp, objv[4], length1,
		    &last) != TCL_OK) {
		return TCL_ERROR;
	    }
	    if (first < 0) {
		first = 0;
	    }
	    if (last >= length1) {
		last = length1;
	    }
	    if (last >= first) {
		char *start, *end;


		start = Tcl_UtfAtIndex(string1, first);
		end = Tcl_UtfAtIndex(start, last - first + 1);
	        Tcl_SetStringObj(resultPtr, start, end - start);
	    }
	    break;
	}
	case STR_REPEAT: {
	    int count;

	    if (objc != 4) {







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







1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625



1626
1627
1628
1629
1630
1631
1632
	    int first, last;

	    if (objc != 5) {
	        Tcl_WrongNumArgs(interp, 2, objv, "string first last");
		return TCL_ERROR;
	    }

	    /*
	     * If we have a ByteArray object, avoid indexing in the
	     * Utf string since the byte array contains one byte per
	     * character.  Otherwise, use the Unicode string rep to
	     * get the range.
	     */

	    if (objv[2]->typePtr == &tclByteArrayType) {

		string1 = Tcl_GetByteArrayFromObj(objv[2], &length1);

		if (TclGetIntForIndex(interp, objv[3], length1 - 1,
			&first) != TCL_OK) {
		    return TCL_ERROR;
		}
		if (TclGetIntForIndex(interp, objv[4], length1 - 1,
			&last) != TCL_OK) {
		    return TCL_ERROR;
		}
		if (first < 0) {
		    first = 0;
		}
		if (last >= length1 - 1) {
		    last = length1 - 1;
		}
		if (last >= first) {
		    int numBytes = last - first + 1;
		    resultPtr = Tcl_NewByteArrayObj(&string1[first], numBytes);
		    Tcl_SetObjResult(interp, resultPtr);
		}
	    } else {
		string1 = Tcl_GetStringFromObj(objv[2], &length1);
		
		/*
		 * Convert to Unicode internal rep to calulate length and
		 * create a result object.
		 */

		length2 = TclGetUnicodeLengthFromObj(objv[2]) - 1;
    
		if (TclGetIntForIndex(interp, objv[3], length2,
			&first) != TCL_OK) {
		    return TCL_ERROR;
		}
		if (TclGetIntForIndex(interp, objv[4], length2,
			&last) != TCL_OK) {
		    return TCL_ERROR;
		}
		if (first < 0) {
		    first = 0;
		}
		if (last >= length1 - 1) {
		    last = length1 - 1;
		}
		if (last >= first) {
		    resultPtr = TclGetRangeFromObj(objv[2], first, last);
		    Tcl_SetObjResult(interp, resultPtr);
		}



	    }
	    break;
	}
	case STR_REPEAT: {
	    int count;

	    if (objc != 4) {
Changes to generic/tclInt.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * tclInt.h --
 *
 *	Declarations of things used internally by the Tcl interpreter.
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1993-1997 Lucent Technologies.
 * Copyright (c) 1994-1998 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclInt.h,v 1.29 1999/05/13 01:50:32 stanton Exp $
 */

#ifndef _TCLINT
#define _TCLINT

/*
 * Common include files needed by most of the Tcl source files are













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * tclInt.h --
 *
 *	Declarations of things used internally by the Tcl interpreter.
 *
 * Copyright (c) 1987-1993 The Regents of the University of California.
 * Copyright (c) 1993-1997 Lucent Technologies.
 * Copyright (c) 1994-1998 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclInt.h,v 1.30 1999/06/08 02:59:24 hershey Exp $
 */

#ifndef _TCLINT
#define _TCLINT

/*
 * Common include files needed by most of the Tcl source files are
1505
1506
1507
1508
1509
1510
1511

1512
1513
1514
1515
1516
1517
1518
extern Tcl_ObjType	tclByteArrayType;
extern Tcl_ObjType	tclByteCodeType;
extern Tcl_ObjType	tclDoubleType;
extern Tcl_ObjType	tclIntType;
extern Tcl_ObjType	tclListType;
extern Tcl_ObjType	tclProcBodyType;
extern Tcl_ObjType	tclStringType;


/*
 * The head of the list of free Tcl objects, and the total number of Tcl
 * objects ever allocated and freed.
 */

extern Tcl_Obj *	tclFreeObjList;







>







1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
extern Tcl_ObjType	tclByteArrayType;
extern Tcl_ObjType	tclByteCodeType;
extern Tcl_ObjType	tclDoubleType;
extern Tcl_ObjType	tclIntType;
extern Tcl_ObjType	tclListType;
extern Tcl_ObjType	tclProcBodyType;
extern Tcl_ObjType	tclStringType;
extern Tcl_ObjType	tclUnicodeType;

/*
 * The head of the list of free Tcl objects, and the total number of Tcl
 * objects ever allocated and freed.
 */

extern Tcl_Obj *	tclFreeObjList;
1538
1539
1540
1541
1542
1543
1544



1545
1546
1547
1548
1549
1550
1551
 */

EXTERN int		TclAccess _ANSI_ARGS_((CONST char *path,
			    int mode));
EXTERN int		TclAccessDeleteProc _ANSI_ARGS_((TclAccessProc_ *proc));
EXTERN int		TclAccessInsertProc _ANSI_ARGS_((TclAccessProc_ *proc));
EXTERN void		TclAllocateFreeObjects _ANSI_ARGS_((void));



EXTERN int		TclArraySet _ANSI_ARGS_((Tcl_Interp *interp,
			    Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj));
EXTERN int		TclCleanupChildren _ANSI_ARGS_((Tcl_Interp *interp,
			    int numPids, Tcl_Pid *pidPtr,
			    Tcl_Channel errorChan));
EXTERN void		TclCleanupCommand _ANSI_ARGS_((Command *cmdPtr));
EXTERN int		TclCopyChannel _ANSI_ARGS_((Tcl_Interp *interp,







>
>
>







1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
 */

EXTERN int		TclAccess _ANSI_ARGS_((CONST char *path,
			    int mode));
EXTERN int		TclAccessDeleteProc _ANSI_ARGS_((TclAccessProc_ *proc));
EXTERN int		TclAccessInsertProc _ANSI_ARGS_((TclAccessProc_ *proc));
EXTERN void		TclAllocateFreeObjects _ANSI_ARGS_((void));
EXTERN Tcl_Obj *	TclAppendObjToUnicodeObj _ANSI_ARGS_((
	    		    register Tcl_Obj *targetObjPtr,
	    		    register Tcl_Obj *srcObjPtr));
EXTERN int		TclArraySet _ANSI_ARGS_((Tcl_Interp *interp,
			    Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj));
EXTERN int		TclCleanupChildren _ANSI_ARGS_((Tcl_Interp *interp,
			    int numPids, Tcl_Pid *pidPtr,
			    Tcl_Channel errorChan));
EXTERN void		TclCleanupCommand _ANSI_ARGS_((Command *cmdPtr));
EXTERN int		TclCopyChannel _ANSI_ARGS_((Tcl_Interp *interp,
1630
1631
1632
1633
1634
1635
1636






1637
1638
1639
1640
1641
1642
1643
			    Namespace **actualCxtPtrPtr,
			    char **simpleNamePtr));
EXTERN TclObjCmdProcType TclGetObjInterpProc _ANSI_ARGS_((void));
EXTERN int		TclGetOpenMode _ANSI_ARGS_((Tcl_Interp *interp,
			    char *string, int *seekFlagPtr));
EXTERN Tcl_Command	TclGetOriginalCommand _ANSI_ARGS_((
			    Tcl_Command command));






EXTERN int		TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
			    char *pattern, int noComplain));
EXTERN int		TclGlobalInvoke _ANSI_ARGS_((Tcl_Interp *interp,
			    int argc, char **argv, int flags));
EXTERN int		TclGuessPackageName _ANSI_ARGS_((char *fileName,
			    Tcl_DString *bufPtr));
EXTERN int		TclHideUnsafeCommands _ANSI_ARGS_((







>
>
>
>
>
>







1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
			    Namespace **actualCxtPtrPtr,
			    char **simpleNamePtr));
EXTERN TclObjCmdProcType TclGetObjInterpProc _ANSI_ARGS_((void));
EXTERN int		TclGetOpenMode _ANSI_ARGS_((Tcl_Interp *interp,
			    char *string, int *seekFlagPtr));
EXTERN Tcl_Command	TclGetOriginalCommand _ANSI_ARGS_((
			    Tcl_Command command));
EXTERN Tcl_Obj*         TclGetRangeFromObj _ANSI_ARGS_((Tcl_Obj *objPtr,
			    int first, int last));
EXTERN Tcl_UniChar      TclGetUniCharFromObj _ANSI_ARGS_((Tcl_Obj *objPtr,
			    int index));
EXTERN int		TclGetUnicodeLengthFromObj _ANSI_ARGS_((
			    Tcl_Obj *objPtr));
EXTERN int		TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
			    char *pattern, int noComplain));
EXTERN int		TclGlobalInvoke _ANSI_ARGS_((Tcl_Interp *interp,
			    int argc, char **argv, int flags));
EXTERN int		TclGuessPackageName _ANSI_ARGS_((char *fileName,
			    Tcl_DString *bufPtr));
EXTERN int		TclHideUnsafeCommands _ANSI_ARGS_((
Changes to generic/tclObj.c.
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tclObj.c --
 *
 *	This file contains Tcl object-related procedures that are used by
 * 	many Tcl commands.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.

 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclObj.c,v 1.7 1999/05/28 23:02:33 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

/*
 * Table of all object types.







>




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tclObj.c --
 *
 *	This file contains Tcl object-related procedures that are used by
 * 	many Tcl commands.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 * Copyright (c) 1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclObj.c,v 1.8 1999/06/08 02:59:25 hershey Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

/*
 * Table of all object types.
133
134
135
136
137
138
139

140
141
142
143
144
145
146
    Tcl_RegisterObjType(&tclByteArrayType);
    Tcl_RegisterObjType(&tclDoubleType);
    Tcl_RegisterObjType(&tclIntType);
    Tcl_RegisterObjType(&tclStringType);
    Tcl_RegisterObjType(&tclListType);
    Tcl_RegisterObjType(&tclByteCodeType);
    Tcl_RegisterObjType(&tclProcBodyType);


#ifdef TCL_COMPILE_STATS
    Tcl_MutexLock(&tclObjMutex);
    tclObjsAlloced = 0;
    tclObjsFreed = 0;
    Tcl_MutexUnlock(&tclObjMutex);
#endif







>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    Tcl_RegisterObjType(&tclByteArrayType);
    Tcl_RegisterObjType(&tclDoubleType);
    Tcl_RegisterObjType(&tclIntType);
    Tcl_RegisterObjType(&tclStringType);
    Tcl_RegisterObjType(&tclListType);
    Tcl_RegisterObjType(&tclByteCodeType);
    Tcl_RegisterObjType(&tclProcBodyType);
    Tcl_RegisterObjType(&tclUnicodeType);

#ifdef TCL_COMPILE_STATS
    Tcl_MutexLock(&tclObjMutex);
    tclObjsAlloced = 0;
    tclObjsFreed = 0;
    Tcl_MutexUnlock(&tclObjMutex);
#endif
Changes to generic/tclStringObj.c.
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
/* 
 * tclStringObj.c --
 *
 *	This file contains procedures that implement string operations
 *	on Tcl objects.  To do this efficiently (i.e. to allow many
 *	appends to be done to an object without constantly reallocating
 *	the space for the string representation) we overallocate the
 *	space for the string and use the internal representation to keep
 *	track of the extra space.  Objects with this internal
 *	representation are called "expandable string objects".
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.

 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclStringObj.c,v 1.6 1999/05/07 20:07:35 stanton Exp $
 */

#include "tclInt.h"

/*
 * Prototypes for procedures defined later in this file:
 */












>




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* 
 * tclStringObj.c --
 *
 *	This file contains procedures that implement string operations
 *	on Tcl objects.  To do this efficiently (i.e. to allow many
 *	appends to be done to an object without constantly reallocating
 *	the space for the string representation) we overallocate the
 *	space for the string and use the internal representation to keep
 *	track of the extra space.  Objects with this internal
 *	representation are called "expandable string objects".
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 * Copyright (c) 1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclStringObj.c,v 1.7 1999/06/08 02:59:25 hershey Exp $
 */

#include "tclInt.h"

/*
 * Prototypes for procedures defined later in this file:
 */
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
 */

void
Tcl_AppendObjToObj(objPtr, appendObjPtr)
    Tcl_Obj *objPtr;		/* Points to the object to append to. */
    Tcl_Obj *appendObjPtr;	/* Object to append. */
{
    int length;
    char *stringRep;

    stringRep = Tcl_GetStringFromObj(appendObjPtr, &length);
    Tcl_AppendToObj(objPtr, stringRep, length);
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AppendStringsToObjVA --
 *







<
<
|
<
<







379
380
381
382
383
384
385


386


387
388
389
390
391
392
393
 */

void
Tcl_AppendObjToObj(objPtr, appendObjPtr)
    Tcl_Obj *objPtr;		/* Points to the object to append to. */
    Tcl_Obj *appendObjPtr;	/* Object to append. */
{


    TclAppendObjToUnicodeObj(objPtr, appendObjPtr);


}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AppendStringsToObjVA --
 *
Changes to generic/tclTestObj.c.
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
/* 
 * tclTestObj.c --
 *
 *	This file contains C command procedures for the additional Tcl
 *	commands that are used for testing implementations of the Tcl object
 *	types. These commands are not normally included in Tcl
 *	applications; they're only used for testing.
 *
 * Copyright (c) 1995-1998 Sun Microsystems, Inc.

 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclTestObj.c,v 1.3 1999/04/16 00:46:54 stanton Exp $
 */

#include "tclInt.h"

/*
 * An array of Tcl_Obj pointers used in the commands that operate on or get
 * the values of Tcl object-valued variables. varPtr[i] is the i-th









>




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* 
 * tclTestObj.c --
 *
 *	This file contains C command procedures for the additional Tcl
 *	commands that are used for testing implementations of the Tcl object
 *	types. These commands are not normally included in Tcl
 *	applications; they're only used for testing.
 *
 * Copyright (c) 1995-1998 Sun Microsystems, Inc.
 * Copyright (c) 1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclTestObj.c,v 1.4 1999/06/08 02:59:26 hershey Exp $
 */

#include "tclInt.h"

/*
 * An array of Tcl_Obj pointers used in the commands that operate on or get
 * the values of Tcl object-valued variables. varPtr[i] is the i-th
770
771
772
773
774
775
776

















777
778
779
780
781
782
783
        }
        index = Tcl_GetString(objv[2]);
        if (GetVariableIndex(interp, index, &varIndex) != TCL_OK) {
            return TCL_ERROR;
        }
        SetVarToObj(varIndex, Tcl_NewObj());
	Tcl_SetObjResult(interp, varPtr[varIndex]);

















    } else if (strcmp(subCmd, "refcount") == 0) {
	char buf[TCL_INTEGER_SPACE];

        if (objc != 3) {
            goto wrongNumArgs;
        }
        index = Tcl_GetString(objv[2]);







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







771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
        }
        index = Tcl_GetString(objv[2]);
        if (GetVariableIndex(interp, index, &varIndex) != TCL_OK) {
            return TCL_ERROR;
        }
        SetVarToObj(varIndex, Tcl_NewObj());
	Tcl_SetObjResult(interp, varPtr[varIndex]);
    } else if (strcmp(subCmd, "objtype") == 0) {
	char *typeName;

	/*
	 * return an object containing the name of the argument's type
	 * of internal rep.  If none exists, return "none".
	 */
	
        if (objc != 3) {
            goto wrongNumArgs;
        }
	if (objv[2]->typePtr == NULL) {
	    Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
	} else {
	    typeName = objv[2]->typePtr->name;
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(typeName, -1));
	}
    } else if (strcmp(subCmd, "refcount") == 0) {
	char buf[TCL_INTEGER_SPACE];

        if (objc != 3) {
            goto wrongNumArgs;
        }
        index = Tcl_GetString(objv[2]);
806
807
808
809
810
811
812
813

814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
            Tcl_AppendToObj(Tcl_GetObjResult(interp),
                    varPtr[varIndex]->typePtr->name, -1);
        }
    } else if (strcmp(subCmd, "types") == 0) {
        if (objc != 2) {
            goto wrongNumArgs;
        }
	if (Tcl_AppendAllObjTypes(interp, Tcl_GetObjResult(interp)) != TCL_OK) {

	    return TCL_ERROR;
	}
    } else {
	Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
		"bad option \"",
		Tcl_GetString(objv[1]),
		"\": must be assign, convert, duplicate, freeallvars, ",
		"newobj, objcount, refcount, type, or types",
		(char *) NULL);
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*







|
>







|







824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
            Tcl_AppendToObj(Tcl_GetObjResult(interp),
                    varPtr[varIndex]->typePtr->name, -1);
        }
    } else if (strcmp(subCmd, "types") == 0) {
        if (objc != 2) {
            goto wrongNumArgs;
        }
	if (Tcl_AppendAllObjTypes(interp,
		Tcl_GetObjResult(interp)) != TCL_OK) {
	    return TCL_ERROR;
	}
    } else {
	Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
		"bad option \"",
		Tcl_GetString(objv[1]),
		"\": must be assign, convert, duplicate, freeallvars, ",
		"newobj, objcount, objtype, refcount, type, or types",
		(char *) NULL);
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
Added generic/tclUnicodeObj.c.






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
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
81
82
83
84
85
86
87
88
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
136
137
138
139
140
141
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
/* 
 * tclUnicodeObj.c --
 *
 *	This file contains the implementation of the Unicode internal
 *	representation of Tcl objects.
 *
 * Copyright (c) 1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnicodeObj.c,v 1.2 1999/06/08 02:59:27 hershey Exp $
 */

#include <math.h>
#include "tclInt.h"
#include "tclPort.h"

/*
 * Prototypes for local procedures defined in this file:
 */

static void		DupUnicodeInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
			    Tcl_Obj *copyPtr));
static void		FreeUnicodeInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr));
static void		UpdateStringOfUnicode _ANSI_ARGS_((Tcl_Obj *objPtr));
static int		SetUnicodeFromAny _ANSI_ARGS_((Tcl_Interp *interp,
			    Tcl_Obj *objPtr));

static int		AllSingleByteChars _ANSI_ARGS_((Tcl_Obj *objPtr));
static void		TclAppendUniCharStrToObj _ANSI_ARGS_((
	    		    register Tcl_Obj *objPtr, Tcl_UniChar *unichars,
			    int numChars));
static Tcl_Obj *	TclNewUnicodeObj _ANSI_ARGS_((Tcl_UniChar *unichars,
			    int numChars));
static void		SetOptUnicodeFromAny _ANSI_ARGS_((Tcl_Obj *objPtr,
			    int numChars));

/*
 * The following object type represents a Unicode string.  A Unicode string
 * is an internationalized string.  Conceptually, a Unicode string is an
 * array of 16-bit quantities organized as a sequence of properly formed
 * UTF-8 characters.  There is a one-to-one map between Unicode and UTF
 * characters.  The Unicode ojbect is opitmized for the case where each UTF
 * char in a string is only one byte.  In this case, we store the value of
 * numChars, but we don't copy the bytes to the unicodeObj->chars.  Before
 * accessing obj->chars, check if unicodeObj->numChars == obj->length.
 */

Tcl_ObjType tclUnicodeType = {
    "unicode",
    FreeUnicodeInternalRep,
    DupUnicodeInternalRep,
    UpdateStringOfUnicode,
    SetUnicodeFromAny
};

/*
 * The following structure is the internal rep for a Unicode object.
 * Keeps track of how much memory has been used and how much has been
 * allocated for the Unicode to enable growing and shrinking of the
 * Unicode object with fewer mallocs.  
 */

typedef struct Unicode {
    int numChars;		/* The number of chars in the unicode
				 * string. */
    int used;			/* The number of bytes used in the unicode
				 * string. */
    int allocated;		/* The amount of space actually allocated
				 * minus 1 byte. */
    unsigned char chars[4];	/* The array of chars.  The actual size of
				 * this field depends on the 'allocated' field
				 * above. */
} Unicode;

#define UNICODE_SIZE(len)	\
		((unsigned) (sizeof(Unicode) - 4 + (len)))
#define GET_UNICODE(objPtr) \
		((Unicode *) (objPtr)->internalRep.otherValuePtr)
#define SET_UNICODE(objPtr, unicodePtr) \
		(objPtr)->internalRep.otherValuePtr = (VOID *) (unicodePtr)


/*
 *----------------------------------------------------------------------
 *
 * TclGetUnicodeLengthFromObj --
 *
 *	Get the length of the Unicode string from the Tcl object.  If
 *	the object is not already a Unicode object, an attempt will be
 *	made to convert it to one.
 *
 * Results:
 *	Pointer to unicode string representing the unicode object.
 *
 * Side effects:
 *	Frees old internal rep.  Allocates memory for new internal rep.
 *
 *----------------------------------------------------------------------
 */

int
TclGetUnicodeLengthFromObj(objPtr)
    Tcl_Obj *objPtr;		/* The Unicode object. */
{
    int length;
    Unicode *unicodePtr;
    
    SetUnicodeFromAny(NULL, objPtr);
    unicodePtr = GET_UNICODE(objPtr);

    length = unicodePtr->numChars;
    return length;
}

/*
 *----------------------------------------------------------------------
 *
 * TclGetUniCharFromObj --
 *
 *	Get the index'th Unicode character from the Unicode object.  If
 *	the object is not already a Unicode object, an attempt will be
 *	made to convert it to one.  The index is assumed to be in the
 *	appropriate range.
 *
 * Results:
 *	Returns the index'th Unicode character in the Object.
 *
 * Side effects:
 *	Fills unichar with the index'th Unicode character.
 *
 *----------------------------------------------------------------------
 */

Tcl_UniChar
TclGetUniCharFromObj(objPtr, index)
    Tcl_Obj *objPtr;		/* The Unicode object. */
    int index;			/* Get the index'th character. */
{
    Tcl_UniChar *unicharPtr, unichar;
    Unicode *unicodePtr;
    int length;
    
    SetUnicodeFromAny(NULL, objPtr);
    unicodePtr = GET_UNICODE(objPtr);
    length = objPtr->length;
    
    if (AllSingleByteChars(objPtr)) {
	int length;
	char *str;

	/*
	 * All of the characters in the Utf string are 1 byte chars,
	 * so we don't store the unicode char.  We get the Utf string
	 * and convert the index'th byte to a Unicode character.
	 */
	
	str = Tcl_GetStringFromObj(objPtr, &length);
	Tcl_UtfToUniChar(&str[index], &unichar);	
    } else {
	unicharPtr = (Tcl_UniChar *)unicodePtr->chars;
	unichar = unicharPtr[index];
    }
    return unichar;
}

/*
 *----------------------------------------------------------------------
 *
 * TclGetRangeFromObj --
 *
 *	Create a Tcl Object that contains the chars between first and
 *	last of the object indicated by "objPtr".  If the object is not
 *	already a Unicode object, an attempt will be made to convert it
 *	to one.  The first and last indices are assumed to be in the
 *	appropriate range.
 *
 * Results:
 *	Returns a new Tcl Object of either "string" or "unicode" type,
 *	containing the range of chars.
 *
 * Side effects:
 *	Changes the internal rep of "objPtr" to unicode.
 *
 *----------------------------------------------------------------------
 */

Tcl_Obj*
TclGetRangeFromObj(objPtr, first, last)
   
 Tcl_Obj *objPtr;		/* The Tcl object to find the range of. */
    int first;			/* First index of the range. */
    int last;			/* Last index of the range. */
{
    Tcl_Obj *newObjPtr;		/* The Tcl object to find the range of. */
    Tcl_UniChar *unicharPtr;
    Unicode *unicodePtr;
    int length;
    
    SetUnicodeFromAny(NULL, objPtr);
    unicodePtr = GET_UNICODE(objPtr);
    length = objPtr->length;
    
    if (unicodePtr->numChars != length) {
	unicharPtr = (Tcl_UniChar *)unicodePtr->chars;
	newObjPtr = TclNewUnicodeObj(&unicharPtr[first], last-first+1);
    } else {
	int length;
	char *str;

	/*
	 * All of the characters in the Utf string are 1 byte chars,
	 * so we don't store the unicode char.  Create a new string
	 * object containing the specified range of chars.
	 */
	
	str = Tcl_GetStringFromObj(objPtr, &length);
	newObjPtr = Tcl_NewStringObj(&str[first], last-first+1);	
    }
    return newObjPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * TclAppendObjToUnicodeObj --
 *
 *	This procedure appends the contest of "srcObjPtr" to the Unicode
 *	object "destPtr".
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	If srcObjPtr doesn't have an internal rep, then it is given a
 *	Unicode internal rep.
 *
 *----------------------------------------------------------------------
 */

Tcl_Obj *
TclAppendObjToUnicodeObj(targetObjPtr, srcObjPtr)
    register Tcl_Obj *targetObjPtr;	/* Points to the object to
					 * append to. */
    register Tcl_Obj *srcObjPtr;	/* Points to the object to
					 * append from. */
{
    int numBytes, numChars;
    Tcl_Obj *resultObjPtr;
    char *utfSrcStr;
    Tcl_UniChar *unicharSrcStr;
    Unicode *unicodePtr;
    Tcl_DString dsPtr;
    
    /*
     * Duplicate the target if it is shared.
     * Change the result's internal rep to Unicode object.
     */
    
    if (Tcl_IsShared(targetObjPtr)) {
	resultObjPtr = Tcl_DuplicateObj(targetObjPtr);
    } else {
	resultObjPtr = targetObjPtr;
    }
    SetUnicodeFromAny(NULL, resultObjPtr);

    /*
     * Case where target chars are 1 byte long:
     * If src obj is of "string" or null type, then convert it to "unicode"
     * type.  Src objs of other types (such as int) are left in tact to keep
     * them from shimmering between types.  If the src obj is a unichar obj,
     * and all src chars are also 1 byte long, the src string is appended to
     * the target "unicode" obj, and the target obj maintains its "optimized"
     * status.
     */

    if (AllSingleByteChars(resultObjPtr)) {

	int length;
	char *stringRep;

	if (srcObjPtr->typePtr == &tclStringType
		|| srcObjPtr->typePtr == NULL) {
	    SetUnicodeFromAny(NULL, srcObjPtr);
	}

	stringRep = Tcl_GetStringFromObj(srcObjPtr, &length);
	Tcl_AppendToObj(resultObjPtr, stringRep, length);

	if ((srcObjPtr->typePtr == &tclUnicodeType)
		&& (AllSingleByteChars(srcObjPtr))) {
	    SetOptUnicodeFromAny(resultObjPtr, resultObjPtr->length);
	}
	return resultObjPtr;
    }

    /*
     * Extract a unicode string from "unicode" or "string" type objects.
     * Extract the utf string from non-unicode objects, and convert the
     * utf string to unichar string locally.
     * If the src obj is a "string" obj, convert it to "unicode" type.
     * Src objs of other types (such as int) are left in tact to keep
     * them from shimmering between types.
     */

    Tcl_DStringInit(&dsPtr);
    if (srcObjPtr->typePtr == &tclStringType || srcObjPtr->typePtr == NULL) {
	SetUnicodeFromAny(NULL, srcObjPtr);
    }
    if (srcObjPtr->typePtr == &tclUnicodeType) {
	if (AllSingleByteChars(srcObjPtr)) {

	    unicodePtr = GET_UNICODE(srcObjPtr);
	    numChars = unicodePtr->numChars;

	    utfSrcStr = Tcl_GetStringFromObj(srcObjPtr, &numBytes);
	    unicharSrcStr = (Tcl_UniChar *)Tcl_UtfToUniCharDString(utfSrcStr,
		    numBytes, &dsPtr);
	} else {
	    unicodePtr = GET_UNICODE(srcObjPtr);
	    numChars = unicodePtr->numChars;
	    unicharSrcStr = (Tcl_UniChar *)unicodePtr->chars;
	}
    } else {
	utfSrcStr = Tcl_GetStringFromObj(srcObjPtr, &numBytes);
	numChars = Tcl_NumUtfChars(utfSrcStr, numBytes);
	unicharSrcStr = (Tcl_UniChar *)Tcl_UtfToUniCharDString(utfSrcStr,
		numBytes, &dsPtr);
    }
    if (numChars == 0) {
	return resultObjPtr;
    }

    /*
     * Append the unichar src string to the result object.
     */

    TclAppendUniCharStrToObj(resultObjPtr, unicharSrcStr, numChars);
    Tcl_DStringFree(&dsPtr);
    return resultObjPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * TclAppendUniCharStrToObj --
 *
 *	This procedure appends the contents of "srcObjPtr" to the
 *	Unicode object "objPtr".
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	If srcObjPtr doesn't have an internal rep, then it is given a
 *	Unicode internal rep.
 *
 *----------------------------------------------------------------------
 */

void
TclAppendUniCharStrToObj(objPtr, unichars, numNewChars)
    register Tcl_Obj *objPtr;	/* Points to the object to append to. */
    Tcl_UniChar *unichars;	/* The unicode string to append to the
			         * object. */
    int numNewChars;		/* Number of chars in "unichars". */
{
    Unicode *unicodePtr;
    int usedBytes, numNewBytes, totalNumBytes, totalNumChars;

    /*
     * Invalidate the StringRep.
     */

    Tcl_InvalidateStringRep(objPtr);

    unicodePtr = GET_UNICODE(objPtr);
    
    usedBytes = unicodePtr->used;
    totalNumChars = numNewChars + unicodePtr->numChars;
    totalNumBytes = totalNumChars * sizeof(Tcl_UniChar);
    numNewBytes = numNewChars * sizeof(Tcl_UniChar);
    
    if (unicodePtr->allocated < totalNumBytes) {
	int allocatedBytes = totalNumBytes * 2;
    
	/*
	 * There isn't currently enough space in the Unicode
	 * representation so allocate additional space.  In fact,
	 * overallocate so that there is room for future growth without
	 * having to reallocate again.
	 */

	unicodePtr = (Unicode *) ckrealloc(unicodePtr,
		UNICODE_SIZE(allocatedBytes));
	memcpy((VOID *) (unicodePtr->chars + usedBytes),
		(VOID *) unichars, (size_t) numNewBytes);

	unicodePtr->allocated = allocatedBytes;	
	unicodePtr = SET_UNICODE(objPtr, unicodePtr);
    }
    
    memcpy((VOID *) (unicodePtr->chars + usedBytes),
	    (VOID *) unichars, (size_t) numNewBytes);
    unicodePtr->used = totalNumBytes;
    unicodePtr->numChars = totalNumChars;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclNewUnicodeObj --
 *
 *	This procedure is creates a new Unicode object and initializes
 *	it from the given Utf String.  If the Utf String is the same size
 *	as the Unicode string, don't duplicate the data.
 *
 * Results:
 *	The newly created object is returned.  This object will have no
 *	initial string representation.  The returned object has a ref count
 *	of 0.
 *
 * Side effects:
 *	Memory allocated for new object and copy of Unicode argument.
 *
 *---------------------------------------------------------------------------
 */

Tcl_Obj *
TclNewUnicodeObj(unichars, numChars)
    Tcl_UniChar *unichars;	/* The unicode string used to initialize
				 * the new object. */
    int numChars;		/* Number of characters in the unicode
				 * string. */
{
    Tcl_Obj *objPtr;
    Unicode *unicodePtr;
    int numBytes;

    numBytes = numChars * sizeof(Tcl_UniChar);
    
    TclNewObj(objPtr);
    objPtr->bytes = NULL;
    objPtr->typePtr = &tclUnicodeType;

    unicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(numBytes));
    unicodePtr->used = numBytes;
    unicodePtr->numChars = numChars;
    unicodePtr->allocated = numBytes;
    memcpy((VOID *) unicodePtr->chars, (VOID *) unichars, (size_t) numBytes);
    SET_UNICODE(objPtr, unicodePtr);
    return objPtr;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclAllSingleByteChars --
 *
 *	Initialize the internal representation of a Unicode Tcl_Obj
 *	to a copy of the internal representation of an existing Unicode
 *	object. 
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Allocates memory.
 *
 *---------------------------------------------------------------------------
 */

static int
AllSingleByteChars(objPtr)
    Tcl_Obj *objPtr;		/* Object whose char lengths to check. */
{
    Unicode *unicodePtr;
    int numBytes, numChars;

    unicodePtr = GET_UNICODE(objPtr);
    numChars = unicodePtr->numChars;
    numBytes = objPtr->length;

    if (numChars == numBytes) {
	return 1;
    } else {
	return 0;
    }
}

/*
 *---------------------------------------------------------------------------
 *
 * DupUnicodeInternalRep --
 *
 *	Initialize the internal representation of a Unicode Tcl_Obj
 *	to a copy of the internal representation of an existing Unicode
 *	object. 
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Allocates memory.
 *
 *---------------------------------------------------------------------------
 */

static void
DupUnicodeInternalRep(srcPtr, copyPtr)
    Tcl_Obj *srcPtr;		/* Object with internal rep to copy. */
    Tcl_Obj *copyPtr;		/* Object with internal rep to set. */
{
    Unicode *srcUnicodePtr = GET_UNICODE(srcPtr);
    Unicode *copyUnicodePtr; /*GET_UNICODE(copyPtr);*/
    
    /*
     * If the src obj is a string of 1-byte Utf chars, then copy the
     * string rep of the source object and create an "empty" Unicode
     * internal rep for the new object.  Otherwise, copy Unicode
     * internal rep, and invalidate the string rep of the new object.
     */
    
    if (AllSingleByteChars(srcPtr)) {
	copyUnicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(4));
    } else {
	int used = srcUnicodePtr->used;
	int allocated = srcUnicodePtr->allocated;
	Tcl_UniChar *unichars;

	unichars = (Tcl_UniChar *)srcUnicodePtr->chars;

	copyUnicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(allocated));

	copyUnicodePtr->used = used;	
	copyUnicodePtr->allocated = allocated;
	memcpy((VOID *) copyUnicodePtr->chars,
		(VOID *) srcUnicodePtr->chars, (size_t) used);
    }
    copyUnicodePtr->numChars = srcUnicodePtr->numChars;
    SET_UNICODE(copyPtr, copyUnicodePtr);
}

/*
 *---------------------------------------------------------------------------
 *
 * TclSetUnicodeObj --
 *
 *	Modify an object to be a Unicode object and to have the specified
 *	unicode string as its value.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The object's old string rep and internal rep is freed.
 *	Memory allocated for copy of unicode argument.
 *
 *----------------------------------------------------------------------
 */

void
TclSetUnicodeObj(objPtr, chars, length)
    Tcl_Obj *objPtr;		/* Object to initialize as a Unicode obj. */
    unsigned char *chars;	/* The unicode string to use as the new
				 * value. */
    int length;			/* Length of the unicode string, which must
				 * be >= 0. */
{
    Tcl_ObjType *typePtr;
    Unicode *unicodePtr;

    if (Tcl_IsShared(objPtr)) {
	panic("TclSetUnicodeObj called with shared object");
    }
    typePtr = objPtr->typePtr;
    if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
	(*typePtr->freeIntRepProc)(objPtr);
    }
    Tcl_InvalidateStringRep(objPtr);

    unicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(length));
    unicodePtr->used = length;
    unicodePtr->allocated = length;
    memcpy((VOID *) unicodePtr->chars, (VOID *) chars, (size_t) length);

    objPtr->typePtr = &tclUnicodeType;
    SET_UNICODE(objPtr, unicodePtr);
}

/*
 *---------------------------------------------------------------------------
 *
 * UpdateStringOfUnicode --
 *
 *	Update the string representation for a Unicode data object.
 *	Note: This procedure does not invalidate an existing old string rep
 *	so storage will be lost if this has not already been done. 
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The object's string is set to a valid string that results from
 *	the Unicode-to-string conversion.
 *
 *	The object becomes a string object -- the internal rep is
 *	discarded and the typePtr becomes NULL.
 *
 *---------------------------------------------------------------------------
 */

static void
UpdateStringOfUnicode(objPtr)
    Tcl_Obj *objPtr;		/* Unicode object whose string rep to
				 * update. */
{
    int i, length, size;
    Tcl_UniChar *src;
    char dummy[TCL_UTF_MAX];
    char *dst;
    Unicode *unicodePtr;

    unicodePtr = GET_UNICODE(objPtr);
    src = (Tcl_UniChar *) unicodePtr->chars;
    length = unicodePtr->used;

    /*
     * How much space will string rep need?
     */
     
    size = 0;
    for (i = 0; i < unicodePtr->numChars; i++) {
	size += Tcl_UniCharToUtf((int) src[i], dummy);
    }

    dst = (char *) ckalloc((unsigned) (size + 1));
    objPtr->bytes = dst;
    objPtr->length = size;

    for (i = 0; i < unicodePtr->numChars; i++) {
	dst += Tcl_UniCharToUtf(src[i], dst);
    }
    *dst = '\0';
}

/*
 *---------------------------------------------------------------------------
 *
 * SetOptUnicodeFromAny --
 *
 *	Generate the Unicode internal rep from the string rep.
 *
 * Results:
 *	The return value is always TCL_OK.
 *
 * Side effects:
 *	A Unicode object is stored as the internal rep of objPtr.  The Unicode
 * ojbect is opitmized for the case where each UTF char in a string is only
 * one byte.  In this case, we store the value of numChars, but we don't copy
 * the bytes to the unicodeObj->chars.  Before accessing obj->chars, check if
 * all chars are 1 byte long.
 *
 *---------------------------------------------------------------------------
 */

static void
SetOptUnicodeFromAny(objPtr, numChars)
    Tcl_Obj *objPtr;		/* The object to convert to type Unicode. */
    int numChars;
{
    Tcl_ObjType *typePtr;
    Unicode *unicodePtr;
    
    unicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(4));
    unicodePtr->numChars = numChars;

    typePtr = objPtr->typePtr;
    if ((typePtr != NULL) && (typePtr->freeIntRepProc) != NULL) {
	(*typePtr->freeIntRepProc)(objPtr);
    }
    objPtr->typePtr = &tclUnicodeType;
    SET_UNICODE(objPtr, unicodePtr);
}

/*
 *---------------------------------------------------------------------------
 *
 * SetUnicodeFromAny --
 *
 *	Generate the Unicode internal rep from the string rep.
 *
 * Results:
 *	The return value is always TCL_OK.
 *
 * Side effects:
 *	A Unicode object is stored as the internal rep of objPtr.  The Unicode
 * ojbect is opitmized for the case where each UTF char in a string is only
 * one byte.  In this case, we store the value of numChars, but we don't copy
 * the bytes to the unicodeObj->chars.  Before accessing obj->chars, check if
 * all chars are 1 byte long.
 *
 *---------------------------------------------------------------------------
 */

static int
SetUnicodeFromAny(interp, objPtr)
    Tcl_Interp *interp;		/* Not used. */
    Tcl_Obj *objPtr;		/* The object to convert to type Unicode. */
{
    Tcl_ObjType *typePtr;
    int numBytes, numChars;
    char *src, *srcEnd;
    Unicode *unicodePtr;
    unsigned char *dst;
    
    typePtr = objPtr->typePtr;
    if (typePtr != &tclUnicodeType) {
	src = Tcl_GetStringFromObj(objPtr, &numBytes);

	numChars = Tcl_NumUtfChars(src, numBytes);
	if (numChars == numBytes) {
	    SetOptUnicodeFromAny(objPtr, numChars);
	} else {
	    unicodePtr = (Unicode *) ckalloc(UNICODE_SIZE(numChars
		    * sizeof(Tcl_UniChar)));
	    srcEnd = src + numBytes;
	
	    for (dst = unicodePtr->chars; src < srcEnd;
		 dst += sizeof(Tcl_UniChar)) {
		src += Tcl_UtfToUniChar(src, (Tcl_UniChar *) dst);
	    }

	    unicodePtr->used = numChars * sizeof(Tcl_UniChar);
	    unicodePtr->numChars = numChars;
	    unicodePtr->allocated = numChars * sizeof(Tcl_UniChar);	

	    if ((typePtr != NULL) && (typePtr->freeIntRepProc) != NULL) {
		(*typePtr->freeIntRepProc)(objPtr);
	    }
	    objPtr->typePtr = &tclUnicodeType;
	    SET_UNICODE(objPtr, unicodePtr);
	}
    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * FreeUnicodeInternalRep --
 *
 *	Deallocate the storage associated with a Unicode data object's
 *	internal representation.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Frees memory. 
 *
 *----------------------------------------------------------------------
 */

static void
FreeUnicodeInternalRep(objPtr)
    Tcl_Obj *objPtr;		/* Object with internal rep to free. */
{
    ckfree((char *) GET_UNICODE(objPtr));
}
Changes to generic/tclVar.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * Copyright (c) 1987-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclVar.c,v 1.8 1999/04/16 00:46:55 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

/*
 * The strings below are used to indicate what went wrong when a







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * Copyright (c) 1987-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclVar.c,v 1.9 1999/06/08 02:59:27 hershey Exp $
 */

#include "tclInt.h"
#include "tclPort.h"

/*
 * The strings below are used to indicate what went wrong when a
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
	    } else {
		if (Tcl_IsShared(oldValuePtr)) {   /* append to copy */
		    varPtr->value.objPtr = Tcl_DuplicateObj(oldValuePtr);
		    TclDecrRefCount(oldValuePtr);
		    oldValuePtr = varPtr->value.objPtr;
		    Tcl_IncrRefCount(oldValuePtr); /* since var is ref */
		}
		Tcl_AppendToObj(oldValuePtr, bytes, length);
	    }
	}
    } else {
	if (flags & TCL_LIST_ELEMENT) {	       /* set var to list element */
	    int neededBytes, listFlags;

	    /*







|







1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
	    } else {
		if (Tcl_IsShared(oldValuePtr)) {   /* append to copy */
		    varPtr->value.objPtr = Tcl_DuplicateObj(oldValuePtr);
		    TclDecrRefCount(oldValuePtr);
		    oldValuePtr = varPtr->value.objPtr;
		    Tcl_IncrRefCount(oldValuePtr); /* since var is ref */
		}
		Tcl_AppendObjToObj(oldValuePtr, newValuePtr);
	    }
	}
    } else {
	if (flags & TCL_LIST_ELEMENT) {	       /* set var to list element */
	    int neededBytes, listFlags;

	    /*
Changes to tests/string.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18





19
20
21
22
23
24
25
# Commands covered:  string
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: string.test,v 1.11 1999/06/03 18:43:30 stanton Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}






test string-1.1 {error conditions} {
    list [catch {string gorp a b} msg] $msg
} {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
test string-1.2 {error conditions} {
    list [catch {string} msg] $msg
} {1 {wrong # args: should be "string option arg ?arg ...?"}}













|




>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Commands covered:  string
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: string.test,v 1.12 1999/06/08 02:59:28 hershey Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

# Some tests require the testobj command

set ::tcltest::testConfig(testobj) \
	[expr {[info commands testobj] != {}}]

test string-1.1 {error conditions} {
    list [catch {string gorp a b} msg] $msg
} {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
test string-1.2 {error conditions} {
    list [catch {string} msg] $msg
} {1 {wrong # args: should be "string option arg ?arg ...?"}}
222
223
224
225
226
227
228












229
230
231
232
233
234
235
} d
test string-5.11 {string index, unicode} {
    string index abc\u7266d 3
} \u7266
test string-5.12 {string index, unicode over char length, under byte length} {
    string index \334\374\334\374 6
} {}













test string-6.1 {string is, too few args} {
    list [catch {string is} msg] $msg
} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
test string-6.2 {string is, too few args} {
    list [catch {string is alpha} msg] $msg
} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}







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







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
} d
test string-5.11 {string index, unicode} {
    string index abc\u7266d 3
} \u7266
test string-5.12 {string index, unicode over char length, under byte length} {
    string index \334\374\334\374 6
} {}
test string-5.13 {string index, bytearray object} {
    string index [binary format a5 fuz] 0
} f
test string-5.14 {string index, bytearray object} {
    string index [binary format I* {0x50515253 0x52}] 3
} S
test string-5.15 {string index, bytearray object} {
    set b [binary format I* {0x50515253 0x52}]
    set i1 [string index $b end-6]
    set i2 [string index $b 1]
    string compare $i1 $i2
} 0

test string-6.1 {string is, too few args} {
    list [catch {string is} msg] $msg
} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
test string-6.2 {string is, too few args} {
    list [catch {string is alpha} msg] $msg
} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
581
582
583
584
585
586
587






588
589
590
591
592
593
594
} 15
test string-9.4 {string length} {
    string le ""
} 0
test string-9.5 {string length, unicode} {
    string le "abcd\u7266"
} 5







test string-10.1 {string map, too few args} {
    list [catch {string map} msg] $msg
} {1 {wrong # args: should be "string map ?-nocase? charMap string"}}
test string-10.2 {string map, bad args} {
    list [catch {string map {a b} abba oops} msg] $msg
} {1 {bad option "a b": must be -nocase}}







>
>
>
>
>
>







598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
} 15
test string-9.4 {string length} {
    string le ""
} 0
test string-9.5 {string length, unicode} {
    string le "abcd\u7266"
} 5
test string-9.6 {string length, bytearray object} {
    string length [binary format a5 foo]
} 5
test string-9.7 {string length, bytearray object} {
    string length [binary format I* {0x50515253 0x52}]
} 8

test string-10.1 {string map, too few args} {
    list [catch {string map} msg] $msg
} {1 {wrong # args: should be "string map ?-nocase? charMap string"}}
test string-10.2 {string map, bad args} {
    list [catch {string map {a b} abba oops} msg] $msg
} {1 {bad option "a b": must be -nocase}}
794
795
796
797
798
799
800






801
802
803
804
805
806
807
} {}
test string-12.17 {string range, unicode} {
    string range ab\u7266cdefghijklmnop 5 5
} e
test string-12.18 {string range, unicode} {
    string range ab\u7266cdefghijklmnop 2 3
} \u7266c







test string-13.1 {string repeat} {
    list [catch {string repeat} msg] $msg
} {1 {wrong # args: should be "string repeat string count"}}
test string-13.2 {string repeat} {
    list [catch {string repeat abc 10 oops} msg] $msg
} {1 {wrong # args: should be "string repeat string count"}}







>
>
>
>
>
>







817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
} {}
test string-12.17 {string range, unicode} {
    string range ab\u7266cdefghijklmnop 5 5
} e
test string-12.18 {string range, unicode} {
    string range ab\u7266cdefghijklmnop 2 3
} \u7266c
test string-12.19 {string range, bytearray object} {
    set b [binary format I* {0x50515253 0x52}]
    set r1 [string range $b 1 end-1]
    set r2 [string range $b 1 6]
    string compare $r1 $r2
} 0

test string-13.1 {string repeat} {
    list [catch {string repeat} msg] $msg
} {1 {wrong # args: should be "string repeat string count"}}
test string-13.2 {string repeat} {
    list [catch {string repeat abc 10 oops} msg] $msg
} {1 {wrong # args: should be "string repeat string count"}}
Added tests/unicode.test.
























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
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
81
82
83
84
85
86
87
88
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
136
137
138
139
140
141
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# This file tests the tclUnicode.c file. 
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: unicode.test,v 1.2 1999/06/08 02:59:30 hershey Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

# Some tests require the testobj command

set ::tcltest::testConfig(testobj) \
	[expr {[info commands testobj] != {}}]

test unicode-1.1 {TclGetUniCharFromObj with byte-size chars} {
    string index "abcdefghi" 0
} "a"
test unicode-1.2 {TclGetUniCharFromObj with byte-size chars} {
    string index "abcdefghi" 3
} "d"
test unicode-1.3 {TclGetUniCharFromObj with byte-size chars} {
    string index "abcdefghi" end
} "i"
test unicode-1.4 {TclGetUniCharFromObj with mixed width chars} {
    string index "ïa¿b®c®¿dï" 0
} "ï"
test unicode-1.5 {TclGetUniCharFromObj} {
    string index "ïa¿b®c®¿dï" 4
} "®"
test unicode-1.6 {TclGetUniCharFromObj} {
    string index "ïa¿b®cï¿d®" end
} "®"

test unicode-2.1 {TclGetUnicodeLengthFromObj with byte-size chars} {
    string length "" 
} 0
test unicode-2.2 {TclGetUnicodeLengthFromObj with byte-size chars} {
    string length "a"
} 1
test unicode-2.3 {TclGetUnicodeLengthFromObj with byte-size chars} {
    string length "abcdef"
} 6
test unicode-2.4 {TclGetUnicodeLengthFromObj with mixed width chars} {
    string length "®" 
} 1
test unicode-2.5 {TclGetUnicodeLengthFromObj with mixed width chars} {
    string length "○○" 
} 6
test unicode-2.6 {TclGetUnicodeLengthFromObj with mixed width chars} {
    string length "ïa¿b®cï¿d®" 
} 10

test unicode-3.1 {TclGetRangeFromObj with all byte-size chars} {testobj} {
    set x "abcdef"
    list [testobj objtype $x] [set y [string range $x 1 end-1]] \
	    [testobj objtype $x] [testobj objtype $y]
} {none bcde unicode none}

test unicode-3.2 {TclGetRangeFromObj with some mixed width chars} {testobj} {
    set x "abcïïdef"
    list [testobj objtype $x] [set y [string range $x 1 end-1]] \
	    [testobj objtype $x] [testobj objtype $y]
} {none bcïïde unicode unicode}

test unicode-4.1 {UpdateStringOfUnicode} {testobj} {
    set x 2345
    list [string index $x end] [testobj objtype $x] [incr x] \
	    [testobj objtype $x]
} {5 unicode 2346 int}

test unicode-5.1 {SetUnicodeFromAny called with non-unicode obj} {testobj} {
    set x 2345
    list [incr x] [testobj objtype $x] [string index $x end] \
	    [testobj objtype $x]
} {2346 int 6 unicode}

test unicode-5.2 {SetUnicodeFromAny called with unicode obj} {testobj} {
    set x "abcdef"
    list [string length $x] [testobj objtype $x] \
	    [string length $x] [testobj objtype $x]
} {6 unicode 6 unicode}

test unicode-6.1 {DupUnicodeInternalRep, mixed width chars} {testobj} {
    set x abcï¿®ghi
    string length $x
    set y $x
    list [testobj objtype $x] [testobj objtype $y] [append x "®¿ï"] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode unicode abcï¿®ghi®¿ï abcï¿®ghi unicode unicode}

test unicode-6.2 {DupUnicodeInternalRep, mixed width chars} {testobj} {
    set x abcï¿®ghi
    set y $x
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x "®¿ï"] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode unicode abcï¿®ghi®¿ï abcï¿®ghi unicode unicode}

test unicode-6.3 {DupUnicodeInternalRep, all byte-size chars} {testobj} {
    set x abcdefghi
    string length $x
    set y $x
    list [testobj objtype $x] [testobj objtype $y] [append x jkl] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode unicode abcdefghijkl abcdefghi unicode unicode}

test unicode-6.4 {DupUnicodeInternalRep, all byte-size chars} {testobj} {
    set x abcdefghi
    set y $x
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x jkl] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode unicode abcdefghijkl abcdefghi unicode unicode}

test unicode-7.1 {TclAppendObjToUnicodeObj, mixed src & dest} {testobj} {
    set x abcï¿®ghi
    set y ®¿ï
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode none abcï¿®ghi®¿ï ®¿ï unicode unicode}

test unicode-7.2 {TclAppendObjToUnicodeObj, mixed src & dest} {testobj} {
    set x abcï¿®ghi
    string length $x
    list [testobj objtype $x] [append x $x] [testobj objtype $x] \
	    [append x $x] [testobj objtype $x]
} {unicode abcï¿®ghiabcï¿®ghi unicode\
abcï¿®ghiabcï¿®ghiabcï¿®ghiabcï¿®ghi\
unicode}

test unicode-7.3 {TclAppendObjToUnicodeObj, mixed src & 1-byte dest} {testobj} {
    set x abcdefghi
    set y ®¿ï
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode none abcdefghi®¿ï ®¿ï string unicode}

test unicode-7.4 {TclAppendObjToUnicodeObj, 1-byte src & dest} {testobj} {
    set x abcdefghi
    set y jkl
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode none abcdefghijkl jkl unicode unicode}

test unicode-7.5 {TclAppendObjToUnicodeObj, 1-byte src & dest} {testobj} {
    set x abcdefghi
    string length $x
    list [testobj objtype $x] [append x $x] [testobj objtype $x] \
	    [append x $x] [testobj objtype $x]
} {unicode abcdefghiabcdefghi unicode abcdefghiabcdefghiabcdefghiabcdefghi\
unicode}

test unicode-7.6 {TclAppendObjToUnicodeObj, 1-byte src & mixed dest} {testobj} {
    set x abcï¿®ghi
    set y jkl
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode none abcï¿®ghijkl jkl unicode unicode}

test unicode-7.7 {TclAppendObjToUnicodeObj, integer src & dest} {testobj} {
    set x [expr {4 * 5}]
    set y [expr {4 + 5}]
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [testobj objtype $x] [append x $y] [testobj objtype $x] \
	    [testobj objtype $y]
} {int int 209 string 2099 string int}

test unicode-7.8 {TclAppendObjToUnicodeObj, integer src & dest} {testobj} {
    set x [expr {4 * 5}]
    list [testobj objtype $x] [append x $x] [testobj objtype $x] \
	    [append x $x] [testobj objtype $x]
} {int 2020 string 20202020 unicode}

test unicode-7.9 {TclAppendObjToUnicodeObj, integer src & 1-byte dest} {testobj} {
    set x abcdefghi
    set y [expr {4 + 5}]
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode int abcdefghi9 9 string int}

test unicode-7.10 {TclAppendObjToUnicodeObj, integer src & mixed dest} {testobj} {
    set x abcï¿®ghi
    set y [expr {4 + 5}]
    string length $x
    list [testobj objtype $x] [testobj objtype $y] [append x $y] \
	    [set y] [testobj objtype $x] [testobj objtype $y]
} {unicode int abcï¿®ghi9 9 unicode int}

# cleanup
::tcltest::cleanupTests
return
Changes to unix/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.27 1999/06/02 22:05:55 surles Exp $

# Current Tcl version;  used in various names.

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.28 1999/06/08 02:59:30 hershey Exp $

# Current Tcl version;  used in various names.

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
266
267
268
269
270
271
272
273

274
275
276
277
278
279
280
	tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \
	tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o \
	tclIOCmd.o tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o \
	tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \
	tclObj.o tclPanic.o tclParse.o tclParseExpr.o tclPipe.o \
	tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o tclRegexp.o \
	tclResolve.o tclResult.o tclScan.o tclStringObj.o tclThread.o \
	tclStubInit.o tclStubLib.o tclTimer.o tclUtf.o tclUtil.o tclVar.o


STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS}

OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} @DL_OBJS@

TCL_DECLS = \
	$(GENERIC_DIR)/tcl.decls \







|
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
	tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \
	tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o \
	tclIOCmd.o tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o \
	tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \
	tclObj.o tclPanic.o tclParse.o tclParseExpr.o tclPipe.o \
	tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o tclRegexp.o \
	tclResolve.o tclResult.o tclScan.o tclStringObj.o tclThread.o \
	tclStubInit.o tclStubLib.o tclTimer.o tclUnicodeObj.o tclUtf.o \
	tclUtil.o tclVar.o

STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS}

OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} @DL_OBJS@

TCL_DECLS = \
	$(GENERIC_DIR)/tcl.decls \
347
348
349
350
351
352
353

354
355
356
357
358
359
360
	$(GENERIC_DIR)/tclStubLib.c \
	$(GENERIC_DIR)/tclStringObj.c \
	$(GENERIC_DIR)/tclTest.c \
	$(GENERIC_DIR)/tclTestObj.c \
	$(GENERIC_DIR)/tclTestProcBodyObj.c \
	$(GENERIC_DIR)/tclThread.c \
	$(GENERIC_DIR)/tclTimer.c \

	$(GENERIC_DIR)/tclUtil.c \
	$(GENERIC_DIR)/tclVar.c

STUB_SRCS = \
	$(GENERIC_DIR)/tclStubLib.c

UNIX_HDRS = \







>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	$(GENERIC_DIR)/tclStubLib.c \
	$(GENERIC_DIR)/tclStringObj.c \
	$(GENERIC_DIR)/tclTest.c \
	$(GENERIC_DIR)/tclTestObj.c \
	$(GENERIC_DIR)/tclTestProcBodyObj.c \
	$(GENERIC_DIR)/tclThread.c \
	$(GENERIC_DIR)/tclTimer.c \
	$(GENERIC_DIR)/tclUnicodeObj.c \
	$(GENERIC_DIR)/tclUtil.c \
	$(GENERIC_DIR)/tclVar.c

STUB_SRCS = \
	$(GENERIC_DIR)/tclStubLib.c

UNIX_HDRS = \
885
886
887
888
889
890
891



892
893
894
895
896
897
898

tclThread.o: $(GENERIC_DIR)/tclThread.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThread.c

tclThreadTest.o: $(GENERIC_DIR)/tclThreadTest.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadTest.c




tclUnixChan.o: $(UNIX_DIR)/tclUnixChan.c
	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixChan.c

tclUnixEvent.o: $(UNIX_DIR)/tclUnixEvent.c
	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixEvent.c

tclUnixFCmd.o: $(UNIX_DIR)/tclUnixFCmd.c







>
>
>







887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903

tclThread.o: $(GENERIC_DIR)/tclThread.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThread.c

tclThreadTest.o: $(GENERIC_DIR)/tclThreadTest.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadTest.c

tclUnicodeObj.o: $(GENERIC_DIR)/tclUnicodeObj.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclUnicodeObj.c

tclUnixChan.o: $(UNIX_DIR)/tclUnixChan.c
	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixChan.c

tclUnixEvent.o: $(UNIX_DIR)/tclUnixEvent.c
	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclUnixEvent.c

tclUnixFCmd.o: $(UNIX_DIR)/tclUnixFCmd.c
Changes to win/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.3 1999/06/05 00:18:12 stanton Exp $

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.4 1999/06/08 02:59:31 hershey Exp $

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
205
206
207
208
209
210
211

212
213
214
215
216
217
218
	tclResult.$(OBJEXT) \
	tclScan.$(OBJEXT) \
	tclStringObj.$(OBJEXT) \
	tclStubInit.$(OBJEXT) \
	tclStubLib.$(OBJEXT) \
	tclThread.$(OBJEXT) \
	tclTimer.$(OBJEXT) \

	tclUtf.$(OBJEXT) \
	tclUtil.$(OBJEXT) \
	tclVar.$(OBJEXT)

WIN_OBJS = \
	tclWin32Dll.$(OBJEXT) \
	tclWinChan.$(OBJEXT) \







>







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
	tclResult.$(OBJEXT) \
	tclScan.$(OBJEXT) \
	tclStringObj.$(OBJEXT) \
	tclStubInit.$(OBJEXT) \
	tclStubLib.$(OBJEXT) \
	tclThread.$(OBJEXT) \
	tclTimer.$(OBJEXT) \
	tclUnicodeObj.$(OBJEXT) \
	tclUtf.$(OBJEXT) \
	tclUtil.$(OBJEXT) \
	tclVar.$(OBJEXT)

WIN_OBJS = \
	tclWin32Dll.$(OBJEXT) \
	tclWinChan.$(OBJEXT) \
Changes to win/makefile.vc.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Visual C++ 2.x and 4.0 makefile
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# RCS: @(#) $Id: makefile.vc,v 1.34 1999/05/07 23:40:37 stanton Exp $

# Does not depend on the presence of any environment variables in
# order to compile tcl; all needed information is derived from 
# location of the compiler directories.

#
# Project directories








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Visual C++ 2.x and 4.0 makefile
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# RCS: @(#) $Id: makefile.vc,v 1.35 1999/06/08 02:59:31 hershey Exp $

# Does not depend on the presence of any environment variables in
# order to compile tcl; all needed information is derived from 
# location of the compiler directories.

#
# Project directories
182
183
184
185
186
187
188

189
190
191
192
193
194
195
	$(TMPDIR)\tclResult.obj \
	$(TMPDIR)\tclScan.obj \
	$(TMPDIR)\tclStringObj.obj \
	$(TMPDIR)\tclStubInit.obj \
	$(TMPDIR)\tclStubLib.obj \
	$(TMPDIR)\tclThread.obj \
	$(TMPDIR)\tclTimer.obj \

	$(TMPDIR)\tclUtf.obj \
	$(TMPDIR)\tclUtil.obj \
	$(TMPDIR)\tclVar.obj \
	$(TMPDIR)\tclWin32Dll.obj \
	$(TMPDIR)\tclWinChan.obj \
	$(TMPDIR)\tclWinConsole.obj \
	$(TMPDIR)\tclWinSerial.obj \







>







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
	$(TMPDIR)\tclResult.obj \
	$(TMPDIR)\tclScan.obj \
	$(TMPDIR)\tclStringObj.obj \
	$(TMPDIR)\tclStubInit.obj \
	$(TMPDIR)\tclStubLib.obj \
	$(TMPDIR)\tclThread.obj \
	$(TMPDIR)\tclTimer.obj \
	$(TMPDIR)\tclUnicodeObj.obj \
	$(TMPDIR)\tclUtf.obj \
	$(TMPDIR)\tclUtil.obj \
	$(TMPDIR)\tclVar.obj \
	$(TMPDIR)\tclWin32Dll.obj \
	$(TMPDIR)\tclWinChan.obj \
	$(TMPDIR)\tclWinConsole.obj \
	$(TMPDIR)\tclWinSerial.obj \