Index: generic/xotcl.c =================================================================== diff -u -r26a70d9d268d8d827ec0ed631549fa6c5217d832 -rfa7bc22b99d66e75f67999d3b153d38f024c1be7 --- generic/xotcl.c (.../xotcl.c) (revision 26a70d9d268d8d827ec0ed631549fa6c5217d832) +++ generic/xotcl.c (.../xotcl.c) (revision fa7bc22b99d66e75f67999d3b153d38f024c1be7) @@ -2400,22 +2400,6 @@ return NULL; } -XOTclCallStackContent * -XOTclCallStackFindActiveFrame(Tcl_Interp *interp, int offset) { - XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; - register XOTclCallStackContent *csc; - - /* search for first active frame and set tcl frame pointers */ - for (csc=cs->top-offset; csc > cs->content; csc --) { - if (!(csc->frameType & XOTCL_CSC_TYPE_INACTIVE)) { - /* we found the highest active frame */ - return csc; - } - } - /* we could not find an active frame; called from toplevel? */ - return NULL; -} - static void CallStackUseActiveFrames(Tcl_Interp *interp, callFrameContext *ctx) { XOTclCallStackContent *active, *top = RUNTIME_STATE(interp)->cs.top; Index: generic/xotclInt.h =================================================================== diff -u -r26a70d9d268d8d827ec0ed631549fa6c5217d832 -rfa7bc22b99d66e75f67999d3b153d38f024c1be7 --- generic/xotclInt.h (.../xotclInt.h) (revision 26a70d9d268d8d827ec0ed631549fa6c5217d832) +++ generic/xotclInt.h (.../xotclInt.h) (revision fa7bc22b99d66e75f67999d3b153d38f024c1be7) @@ -770,10 +770,6 @@ XOTclObjDispatch(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -XOTclCallStackContent * -XOTclCallStackFindActiveFrame(Tcl_Interp *interp, int offset); - - /* functions from xotclUtil.c */ char *XOTcl_ltoa(char *buf, long i, int *len); char *XOTclStringIncr(XOTclStringIncrStruct *iss); Index: generic/xotclStack.c =================================================================== diff -u -r26a70d9d268d8d827ec0ed631549fa6c5217d832 -rfa7bc22b99d66e75f67999d3b153d38f024c1be7 --- generic/xotclStack.c (.../xotclStack.c) (revision 26a70d9d268d8d827ec0ed631549fa6c5217d832) +++ generic/xotclStack.c (.../xotclStack.c) (revision fa7bc22b99d66e75f67999d3b153d38f024c1be7) @@ -65,6 +65,24 @@ return NULL; } +XOTclCallStackContent * +XOTclCallStackFindActiveFrame(Tcl_Interp *interp, int offset) { + XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; + register XOTclCallStackContent *csc; + + /* search for first active frame and set tcl frame pointers */ + for (csc=cs->top-offset; csc > cs->content; csc --) { + if (!(csc->frameType & XOTCL_CSC_TYPE_INACTIVE)) { + /* we found the highest active frame */ + return csc; + } + } + /* we could not find an active frame; called from toplevel? */ + return NULL; +} + + + static void CallStackClearCmdReferences(Tcl_Interp *interp, Tcl_Command cmd) { XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; Index: generic/xotclStack85.c =================================================================== diff -u -r26a70d9d268d8d827ec0ed631549fa6c5217d832 -rfa7bc22b99d66e75f67999d3b153d38f024c1be7 --- generic/xotclStack85.c (.../xotclStack85.c) (revision 26a70d9d268d8d827ec0ed631549fa6c5217d832) +++ generic/xotclStack85.c (.../xotclStack85.c) (revision fa7bc22b99d66e75f67999d3b153d38f024c1be7) @@ -97,6 +97,27 @@ return NULL; } +XOTclCallStackContent * +XOTclCallStackFindActiveFrame(Tcl_Interp *interp, int offset) { + register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); + + /* skip #offset frames */ + for (; offset>0 && varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr), offset--); + + /* search for first active frame and set tcl frame pointers */ + for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_XOTCL_METHOD|FRAME_IS_XOTCL_CMETHOD)) { + XOTclCallStackContent *csc = (XOTclCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); + if (!(csc->frameType & XOTCL_CSC_TYPE_INACTIVE)) { + /* we found the highest active frame */ + return csc; + } + } + } + /* we could not find an active frame; called from toplevel? */ + return NULL; +} + static void CallStackClearCmdReferences(Tcl_Interp *interp, Tcl_Command cmd) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp);