diff options
author | mig <mig> | 2013-01-07 03:51:48 (GMT) |
---|---|---|
committer | mig <mig> | 2013-01-07 03:51:48 (GMT) |
commit | e82e2ca61ca3d82c33ef64b6ff754c704df94318 (patch) | |
tree | 7c369e7bd38502816e6429f61b6a171df4b23cd3 | |
parent | 1173ed18bf1993f83cbe65d6701ca0a767effc96 (diff) | |
download | tcl-e82e2ca61ca3d82c33ef64b6ff754c704df94318.zip tcl-e82e2ca61ca3d82c33ef64b6ff754c704df94318.tar.gz tcl-e82e2ca61ca3d82c33ef64b6ff754c704df94318.tar.bz2 |
more abstraction
-rw-r--r-- | generic/tclBasic.c | 55 | ||||
-rw-r--r-- | generic/tclInt.h | 2 |
2 files changed, 21 insertions, 36 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index eed5d65..b4b903f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -166,8 +166,6 @@ static Tcl_ObjCmdProc NRCoroInjectObjCmd; static inline void SpliceDeferred(Tcl_Interp *interp); - - MODULE_SCOPE const TclStubs tclStubs; /* @@ -8278,21 +8276,6 @@ Tcl_NRCmdSwap( * FIXME NRE! */ -#if NRE_STACK_DEBUG -void -TclSpliceCallbacks( - Tcl_Interp *interp, - struct NRE_callback *topPtr) -{ - NRE_callback *bottomPtr = topPtr; - - while (bottomPtr->nextPtr) { - bottomPtr = bottomPtr->nextPtr; - } - bottomPtr->nextPtr = TOP_CB(interp); - TOP_CB(interp) = topPtr; -} - void TclDeferCallback( Tcl_Interp *interp, @@ -8300,33 +8283,37 @@ TclDeferCallback( ClientData data0, ClientData data1, ClientData data2, ClientData data3) { - NRE_callback *callbackPtr; + Interp *iPtr = (Interp *) interp; - ALLOC_CB((interp), (callbackPtr)); - - callbackPtr->procPtr = postProcPtr; - callbackPtr->data[0] = data0; - callbackPtr->data[1] = data1; - callbackPtr->data[2] = data2; - callbackPtr->data[3] = data3; - - callbackPtr->nextPtr = ((Interp *)interp)->deferredCallbacks; - ((Interp *)interp)->deferredCallbacks = callbackPtr; + TclNRAddCallback(interp, postProcPtr, data0, data1, + data2, data3); + if (!iPtr->deferredCallbacks) { + iPtr->deferredCallbacks = TOP_CB(interp); + } } -#else -TODO!! -#endif +#if NRE_STACK_DEBUG static void SpliceDeferred( Tcl_Interp *interp) { - if (((Interp *)interp)->deferredCallbacks) { - TclSpliceCallbacks(interp, ((Interp *)interp)->deferredCallbacks); - ((Interp *)interp)->deferredCallbacks = NULL; + Interp *iPtr = (Interp *) interp; + NRE_callback *bottomPtr = iPtr->deferredCallbacks; + NRE_callback *topPtr; + + if (bottomPtr) { + POP_CB(interp, topPtr); + + topPtr->nextPtr = bottomPtr->nextPtr; + bottomPtr->nextPtr = topPtr; + iPtr->deferredCallbacks = NULL; } } +#else +TODO!! +#endif + void TclSetTailcall( Tcl_Interp *interp, diff --git a/generic/tclInt.h b/generic/tclInt.h index 16d61d4..5dfc143 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2806,8 +2806,6 @@ MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldmObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldToObjCmd; MODULE_SCOPE void TclSetTailcall(Tcl_Interp *interp, Tcl_Obj *tailcallPtr); -MODULE_SCOPE void TclSpliceCallbacks(Tcl_Interp *interp, - struct NRE_callback *topPtr); MODULE_SCOPE void TclDeferCallback(Tcl_Interp *interp, Tcl_NRPostProc postProcPtr, ClientData data0, ClientData data1, |