summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2024-06-17 16:47:44 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2024-06-17 16:47:44 (GMT)
commitf61cd2bb370bc99b4275bab89cf670b72e3970a9 (patch)
treea3ff0c13ed61cbd5edde1e9bc1bee6fb7c563709
parenta2aedee1d3d13af60fac5bff60bb3521d6254141 (diff)
downloadtcl-f61cd2bb370bc99b4275bab89cf670b72e3970a9.zip
tcl-f61cd2bb370bc99b4275bab89cf670b72e3970a9.tar.gz
tcl-f61cd2bb370bc99b4275bab89cf670b72e3970a9.tar.bz2
Remove tcl::unsupported::inject
-rw-r--r--generic/tclBasic.c58
-rw-r--r--tests/coroutine.test43
2 files changed, 2 insertions, 99 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index dfed030..98a0579 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -237,7 +237,6 @@ static Tcl_NRPostProc TEOV_RunLeaveTraces;
static Tcl_NRPostProc EvalObjvCore;
static Tcl_NRPostProc Dispatch;
-static Tcl_ObjCmdProc NRInjectObjCmd;
static Tcl_NRPostProc NRPostInvoke;
static Tcl_ObjCmdProc CoroTypeObjCmd;
static Tcl_ObjCmdProc TclNRCoroInjectObjCmd;
@@ -1196,8 +1195,6 @@ Tcl_CreateInterp(void)
cmdPtr->compileProc = &TclCompileAssembleCmd;
/* Coroutine monkeybusiness */
- Tcl_NRCreateCommand(interp, "::tcl::unsupported::inject", NULL,
- NRInjectObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tcl::unsupported::corotype",
CoroTypeObjCmd, NULL, NULL);
@@ -9658,61 +9655,6 @@ InjectHandlerPostCall(
return result;
}
-/*
- *----------------------------------------------------------------------
- *
- * NRInjectObjCmd --
- *
- * Implementation of [::tcl::unsupported::inject] command.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-NRInjectObjCmd(
- TCL_UNUSED(void *),
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *const objv[])
-{
- CoroutineData *corPtr;
- ExecEnv *savedEEPtr = iPtr->execEnvPtr;
-
- /*
- * Usage more or less like tailcall:
- * inject coroName cmd ?arg1 arg2 ...?
- */
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "coroName cmd ?arg1 arg2 ...?");
- return TCL_ERROR;
- }
-
- corPtr = GetCoroutineFromObj(interp, objv[1],
- "can only inject a command into a coroutine");
- if (!corPtr) {
- return TCL_ERROR;
- }
- if (!COR_IS_SUSPENDED(corPtr)) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can only inject a command into a suspended coroutine", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ACTIVE", (char *)NULL);
- return TCL_ERROR;
- }
-
- /*
- * Add the callback to the coro's execEnv, so that it is the first thing
- * to happen when the coro is resumed.
- */
-
- iPtr->execEnvPtr = corPtr->eePtr;
- TclNRAddCallback(interp, TclNREvalList, Tcl_NewListObj(objc - 2, objv + 2),
- NULL, NULL, NULL);
- iPtr->execEnvPtr = savedEEPtr;
-
- return TCL_OK;
-}
-
int
TclNRInterpCoroutine(
void *clientData,
diff --git a/tests/coroutine.test b/tests/coroutine.test
index c3023f7..e51d655 100644
--- a/tests/coroutine.test
+++ b/tests/coroutine.test
@@ -825,45 +825,6 @@ test coroutine-7.14 {
return [list $done0 $done1]
} -result {failure failure}
-
-test coroutine-8.0.0 {coro inject executed} -body {
- coroutine demo apply {{} { foreach i {1 2} yield }}
- demo
- set ::result none
- tcl::unsupported::inject demo set ::result inject-executed
- demo
- set ::result
-} -result {inject-executed}
-test coroutine-8.0.1 {coro inject after error} -body {
- coroutine demo apply {{} { foreach i {1 2} yield; error test }}
- demo
- set ::result none
- tcl::unsupported::inject demo set ::result inject-executed
- lappend ::result [catch {demo} err] $err
-} -result {inject-executed 1 test}
-test coroutine-8.1.1 {coro inject, ticket 42202ba1e5ff566e} -body {
- interp create child
- child eval {
- coroutine demo apply {{} { while {1} yield }}
- demo
- tcl::unsupported::inject demo set ::result inject-executed
- }
- interp delete child
-} -result {}
-test coroutine-8.1.2 {coro inject with result, ticket 42202ba1e5ff566e} -body {
- interp create child
- child eval {
- coroutine demo apply {{} { while {1} yield }}
- demo
- tcl::unsupported::inject demo set ::result inject-executed
- }
- child eval demo
- set result [child eval {set ::result}]
-
- interp delete child
- set result
-} -result {inject-executed}
-
test coroutine-9.1 {coroprobe with yield} -body {
coroutine demo apply {{} { foreach i {1 2} yield }}
list [coroprobe demo set i] [demo] [coroprobe demo set i] [demo]
@@ -1037,7 +998,7 @@ test coroutine-12.1 {coroutine general introspection} -setup {
$i eval {
# Make the introspection code
namespace path tcl::unsupported
- proc probe {type var} {
+ proc probe {var type args} {
upvar 1 $var v
set f [info frame]
incr f -1
@@ -1049,7 +1010,7 @@ test coroutine-12.1 {coroutine general introspection} -setup {
}
}
proc pokecoro {c var} {
- inject $c probe [corotype $c] $var
+ coroinject $c probe $var
$c
}