Tcl Source Code

Check-in [4cb643b572]
Login

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

Overview
Comment:merge trunk
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | no-wideint
Files: files | file ages | folders
SHA3-256: 4cb643b572abebc38deea0aaffc3bdea8ff1729b3ad1a03126e9277d7332015f
User & Date: jan.nijtmans 2017-11-03 12:24:06.171
Context
2017-11-05
14:35
merge core-8-branch check-in: 25a6bc568f user: jan.nijtmans tags: no-wideint
2017-11-03
12:24
merge trunk check-in: 4cb643b572 user: jan.nijtmans tags: no-wideint
12:15
merge core-8-6-branch check-in: ce4b043516 user: jan.nijtmans tags: trunk
2017-11-01
12:35
Finally, get rid of tclWideIntType completely check-in: 01d55bd3e1 user: jan.nijtmans tags: no-wideint
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclInt.h.
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
 * TclNRLmapCmd and their compilations.
 */

#define TCL_EACH_KEEP_NONE  0	/* Discard iteration result like [foreach] */
#define TCL_EACH_COLLECT    1	/* Collect iteration result like [lmap] */

/*
 * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere,
 * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints.
 *
 * WARNING: these macros eval their args more than once.
 */


#define TclGetLongFromObj(interp, objPtr, longPtr) Tcl_GetLongFromObj(interp, objPtr, longPtr)
#define TclGetLongFromObjX(interp, objPtr, longPtr) \
    (((objPtr)->typePtr == &tclIntType)	\
	    ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))









#if 0
#define TclGetIntFromObj(interp, objPtr, intPtr) \
    (((objPtr)->typePtr == &tclIntType)	\


	    ? ((*(intPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
    (((objPtr)->typePtr == &tclIntType)	\


	    ? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
#else
#define TclGetIntFromObj(interp, objPtr, intPtr) \
    Tcl_GetIntFromObj((interp), (objPtr), (intPtr))
#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr)	\
    TclGetIntForIndex(interp, objPtr, ignore, idxPtr)
#endif

/*
 * Macro used to save a function call for common uses of
 * Tcl_GetWideIntFromObj(). The ANSI C "prototype" is:
 *
 * MODULE_SCOPE int TclGetWideIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
 *			Tcl_WideInt *wideIntPtr);







|
|




>
|
<



>
>
>
>
>
>
>
>

<

|
>
>



|
>
>


<
<
<
<
<
<







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
 * TclNRLmapCmd and their compilations.
 */

#define TCL_EACH_KEEP_NONE  0	/* Discard iteration result like [foreach] */
#define TCL_EACH_COLLECT    1	/* Collect iteration result like [lmap] */

/*
 * Macros providing a faster path to integers: Tcl_GetLongFromObj,
 * Tcl_GetIntFromObj and TclGetIntForIndex.
 *
 * WARNING: these macros eval their args more than once.
 */

#if (LONG_MAX == LLONG_MAX)
#define TclGetLongFromObj(interp, objPtr, longPtr) \

    (((objPtr)->typePtr == &tclIntType)	\
	    ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
#else
#define TclGetLongFromObj(interp, objPtr, longPtr) \
    (((objPtr)->typePtr == &tclIntType \
	    && (objPtr)->internalRep.wideValue >= -(Tcl_WideInt)(ULONG_MAX) \
	    && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(ULONG_MAX))	\
	    ? ((*(longPtr) = (long)(objPtr)->internalRep.wideValue), TCL_OK) \
	    : Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
#endif


#define TclGetIntFromObj(interp, objPtr, intPtr) \
    (((objPtr)->typePtr == &tclIntType \
	    && (objPtr)->internalRep.wideValue >= -(Tcl_WideInt)(UINT_MAX) \
	    && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(UINT_MAX))	\
	    ? ((*(intPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
    (((objPtr)->typePtr == &tclIntType \
	    && (objPtr)->internalRep.wideValue >= INT_MIN \
	    && (objPtr)->internalRep.wideValue <= INT_MAX)	\
	    ? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \
	    : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))







/*
 * Macro used to save a function call for common uses of
 * Tcl_GetWideIntFromObj(). The ANSI C "prototype" is:
 *
 * MODULE_SCOPE int TclGetWideIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
 *			Tcl_WideInt *wideIntPtr);
Changes to generic/tclOO.c.
1002
1003
1004
1005
1006
1007
1008

1009





1010




1011
1012
1013
1014
1015
1016
1017
	FOREACH(instancePtr, clsPtr->instances) {
	    int j;
	    if (instancePtr->selfCls == clsPtr) {
		instancePtr->flags |= CLASS_GONE;
	    }
	    for(j=0 ; j<instancePtr->mixins.num ; j++) {
		Class *mixin = instancePtr->mixins.list[j];

		if (mixin == clsPtr) {





		    instancePtr->mixins.list[j] = NULL;




		}
	    }
	    if (instancePtr != NULL && !IsRoot(instancePtr)) {
		AddRef(instancePtr);
	    }
	}
    }







>

>
>
>
>
>
|
>
>
>
>







1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
	FOREACH(instancePtr, clsPtr->instances) {
	    int j;
	    if (instancePtr->selfCls == clsPtr) {
		instancePtr->flags |= CLASS_GONE;
	    }
	    for(j=0 ; j<instancePtr->mixins.num ; j++) {
		Class *mixin = instancePtr->mixins.list[j];
		Class *nextMixin = NULL;
		if (mixin == clsPtr) {
		    if (j < instancePtr->mixins.num - 1) {
			nextMixin = instancePtr->mixins.list[j+1];
		    }
		    if (j == 0) {
			instancePtr->mixins.num = 0;
			instancePtr->mixins.list = NULL;
		    } else {
			instancePtr->mixins.list[j-1] = nextMixin;
		    }
		    instancePtr->mixins.num -= 1;
		}
	    }
	    if (instancePtr != NULL && !IsRoot(instancePtr)) {
		AddRef(instancePtr);
	    }
	}
    }
1177
1178
1179
1180
1181
1182
1183
1184

1185
1186
1187
1188
1189
1190
1191
     * point into freed memory, allowing crashes.
     */

    if (oPtr->command) {
	if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) {
	    /*
	     * Namespace deletion must have been triggered by a trace on command
	     * deletion , meaning that 

	     */
	    deleteAlreadyInProgress = 1;
	}

	Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
    }
    if (oPtr->myCommand) {







|
>







1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
     * point into freed memory, allowing crashes.
     */

    if (oPtr->command) {
	if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) {
	    /*
	     * Namespace deletion must have been triggered by a trace on command
	     * deletion , meaning that ObjectRenamedTrace() is eventually going
	     * to be called .
	     */
	    deleteAlreadyInProgress = 1;
	}

	Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
    }
    if (oPtr->myCommand) {
Changes to tests/oo.test.
1487
1488
1489
1490
1491
1492
1493


















1494
1495
1496
1497
1498
1499
1500

    trace add command obj1 delete {apply {{name1 name2 action} {
	set namespace [info object namespace $name1]
	namespace delete $namespace
    }}}

    rename obj1 {}


















    # No segmentation fault
    return done
} done

test oo-12.1 {OO: filters} {
    oo::class create Aclass
    Aclass create Aobject







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







1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518

    trace add command obj1 delete {apply {{name1 name2 action} {
	set namespace [info object namespace $name1]
	namespace delete $namespace
    }}}

    rename obj1 {}
    # No segmentation fault
    return done
} done

test oo-11.6 {
    OO: cleanup ReleaseClassContents() where class is mixed into one of its
    instances
} {
    oo::class create obj1
    ::oo::define obj1 {self mixin [self]}

    ::oo::copy obj1 obj2
    ::oo::objdefine obj2 {mixin [self]}

    ::oo::copy obj2 obj3
    trace add command obj3 delete [list obj3 dying]
    rename obj2 {}

    # No segmentation fault
    return done
} done

test oo-12.1 {OO: filters} {
    oo::class create Aclass
    Aclass create Aobject