summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 55014ec..b511d07 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -4309,14 +4309,6 @@ TclNREvalObjv(
}
}
-void
-TclPushTailcallPoint(
- Tcl_Interp *interp)
-{
- TclNRAddCallback(interp, NRCommand, NULL, NULL, NULL, NULL);
- ((Interp *) interp)->numLevels++;
-}
-
int
TclNRRunCallbacks(
Tcl_Interp *interp,
@@ -4633,7 +4625,7 @@ TEOV_NotFound(
savedNsPtr = varFramePtr->nsPtr;
varFramePtr->nsPtr = lookupNsPtr;
}
- TclDeferCallbacks(interp, 1);
+ TclSkipTailcall(interp);
TclNRAddCallback(interp, TEOV_NotFoundCallback, INT2PTR(handlerObjc),
newObjv, savedNsPtr, NULL);
return TclNREvalObjv(interp, newObjc, newObjv, TCL_EVAL_NOERR, NULL);
@@ -6020,7 +6012,7 @@ TclNREvalObjEx(
iPtr->cmdFramePtr = eoFramePtr;
}
- TclDeferCallbacks(interp, 0);
+ TclMarkTailcall(interp);
TclNRAddCallback(interp, TEOEx_ListCallback, listPtr, eoFramePtr,
NULL, NULL);
@@ -8278,22 +8270,37 @@ Tcl_NRCmdSwap(
*/
void
-TclDeferCallbacks(
- Tcl_Interp *interp,
- int skipTailcalls)
+TclMarkTailcall(
+ Tcl_Interp *interp)
{
Interp *iPtr = (Interp *) interp;
if (iPtr->deferredCallbacks == NULL) {
- TclNRAddCallback(interp, NRCommand, NULL, INT2PTR(skipTailcalls != 0),
+ TclNRAddCallback(interp, NRCommand, NULL, NULL,
NULL, NULL);
iPtr->deferredCallbacks = TOP_CB(interp);
- } else if (skipTailcalls) {
- iPtr->deferredCallbacks->data[1] = INT2PTR(skipTailcalls != 0);
}
}
void
+TclSkipTailcall(
+ Tcl_Interp *interp)
+{
+ Interp *iPtr = (Interp *) interp;
+
+ TclMarkTailcall(interp);
+ iPtr->deferredCallbacks->data[1] = INT2PTR(1);
+}
+
+void
+TclPushTailcallPoint(
+ Tcl_Interp *interp)
+{
+ TclNRAddCallback(interp, NRCommand, NULL, NULL, NULL, NULL);
+ ((Interp *) interp)->numLevels++;
+}
+
+void
TclSetTailcall(
Tcl_Interp *interp,
Tcl_Obj *listPtr)
@@ -8410,7 +8417,7 @@ TclNRTailcallEval(
* Perform the tailcall
*/
- TclDeferCallbacks(interp, 0);
+ TclMarkTailcall(interp);
TclNRAddCallback(interp, TailcallCleanup, listPtr, NULL, NULL,NULL);
iPtr->lookupNsPtr = (Namespace *) nsPtr;
return TclNREvalObjv(interp, objc-1, objv+1, 0, NULL);