summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2015-03-23 13:43:37 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2015-03-23 13:43:37 (GMT)
commit2b90e3f5416c14e18289019c872d1b654778f63f (patch)
treef6f94a4407b773de5ab6811edcbc114c7c25835e /generic/tclBasic.c
parentbc0fe5c0707bdaa3ae780c3f48b106234c623e1f (diff)
downloadtcl-2b90e3f5416c14e18289019c872d1b654778f63f.zip
tcl-2b90e3f5416c14e18289019c872d1b654778f63f.tar.gz
tcl-2b90e3f5416c14e18289019c872d1b654778f63f.tar.bz2
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index e92e8e9..16e7a5d 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -8181,8 +8181,8 @@ Tcl_NRCmdSwap(
* 2. when the CallFrame is popped, it calls TclSetTailcall to store the
* callback in the proper NRCommand callback - the spot where the command
* that pushed the CallFrame is completely cleaned up
- * 3. The NRCommand schedules the tailcall callback to run immediately after
- * NRCommand returns
+ * 3. when the NRCommand callback runs, it schedules the tailcall callback
+ * to run immediately after it returns
*
* One delicate point is to properly define the NRCommand where the tailcall
* will execute. There are functions whose purpose is to help define the
@@ -8222,6 +8222,18 @@ TclPushTailcallPoint(
((Interp *) interp)->numLevels++;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclSetTailcall --
+ *
+ * Splice a tailcall command in the proper spot of the NRE callback
+ * stack, so that it runs at the right time.
+ *
+ *----------------------------------------------------------------------
+ */
+
void
TclSetTailcall(
Tcl_Interp *interp,
@@ -8246,6 +8258,23 @@ TclSetTailcall(
runPtr->data[1] = listPtr;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclNRTailcallObjCmd --
+ *
+ * Prepare the tailcall as a list and store it in the current
+ * varFrame. When the frame is later popped the tailcall will be spliced
+ * at the proper place.
+ *
+ * Results:
+ * The first NRCommand callback that is not marked to be skipped is
+ * updated so that its data[1] field contains the tailcall list.
+ *
+ *----------------------------------------------------------------------
+ */
+
int
TclNRTailcallObjCmd(
ClientData clientData,
@@ -8305,6 +8334,17 @@ TclNRTailcallObjCmd(
return TCL_RETURN;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclNRTailcallEval --
+ *
+ * This NREcallback actually causes the tailcall to be evaluated.
+ *
+ *----------------------------------------------------------------------
+ */
+
int
TclNRTailcallEval(
ClientData data[],