Index: TODO =================================================================== diff -u -rf11e5a918162c70d84cbf672776c2b47687304f6 -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 --- TODO (.../TODO) (revision f11e5a918162c70d84cbf672776c2b47687304f6) +++ TODO (.../TODO) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) @@ -1555,6 +1555,12 @@ - removed NXSH and XOWISH from Makefile.in +- used Tcl_ObjCmdProc in prototypes +- allow CMETHOD to be target of calling-object/calling-level +- added NSF_CSC_CALL_IS_TRANSPARENT to handle proc aliases transparently +- access self in NsfProcAliasMethod() from tcl->object; + + TODO: - extend coro regression test Index: generic/nsf.c =================================================================== diff -u -r39b3afac5fee73db5fadf53f7c25f00a650d11e9 -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 --- generic/nsf.c (.../nsf.c) (revision 39b3afac5fee73db5fadf53f7c25f00a650d11e9) +++ generic/nsf.c (.../nsf.c) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) @@ -165,10 +165,11 @@ * Function prototypes */ -/* prototypes for method defintions */ -static int NsfForwardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -static int NsfObjscopedMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -static int NsfSetterMethod(ClientData clientData, Tcl_Interp *interp, int objc,Tcl_Obj *CONST objv[]); +/* Prototypes for method definitions */ +static Tcl_ObjCmdProc NsfForwardMethod; +static Tcl_ObjCmdProc NsfObjscopedMethod; +static Tcl_ObjCmdProc NsfSetterMethod; +static Tcl_ObjCmdProc NsfProcAliasMethod; /* prototypes for methods called directly when CallDirectly() returns NULL */ static int NsfCAllocMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *nameObj); @@ -6264,6 +6265,11 @@ TclCmdClientData *tcd = (TclCmdClientData *)cp; tcd->object = object; assert((CmdIsProc(cmd) == 0)); + } else if (proc == NsfProcAliasMethod) { + TclCmdClientData *tcd = (TclCmdClientData *)cp; + tcd->object = object; + assert((CmdIsProc(cmd) == 0)); + cscPtr->flags |= NSF_CSC_CALL_IS_TRANSPARENT; } else if (cp == (ClientData)NSF_CMD_NONLEAF_METHOD) { cp = clientData; assert((CmdIsProc(cmd) == 0)); @@ -10252,9 +10258,11 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { AliasCmdClientData *tcd = (AliasCmdClientData *)clientData; - NsfObject *self = GetSelfObj(interp); + NsfObject *self = tcd->object; CONST char *methodName = ObjStr(objv[0]); + assert(tcd->object==GetSelfObj(interp)); + if (self == NULL) { return NsfVarErrMsg(interp, "no object active for alias '", Tcl_GetCommandName(interp, tcd->aliasCmd), Index: generic/nsfInt.h =================================================================== diff -u -rb19a6e9aa168b386cf12ae0f66998c7a2a9ce495 -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 --- generic/nsfInt.h (.../nsfInt.h) (revision b19a6e9aa168b386cf12ae0f66998c7a2a9ce495) +++ generic/nsfInt.h (.../nsfInt.h) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) @@ -632,8 +632,9 @@ #define NSF_CSC_MIXIN_STACK_PUSHED 0x0200 #define NSF_CSC_FILTER_STACK_PUSHED 0x0400 #define NSF_CSC_UNKNOWN 0x0800 +#define NSF_CSC_CALL_IS_TRANSPARENT 0x1000 #define NSF_CSC_OBJECT_ACTIVATED 0x2000 -#define NSF_CSC_COPY_FLAGS (NSF_CSC_MIXIN_STACK_PUSHED|NSF_CSC_FILTER_STACK_PUSHED|NSF_CSC_IMMEDIATE) +#define NSF_CSC_COPY_FLAGS (NSF_CSC_MIXIN_STACK_PUSHED|NSF_CSC_FILTER_STACK_PUSHED|NSF_CSC_IMMEDIATE|NSF_CSC_CALL_IS_TRANSPARENT) /* flags for call method */ #define NSF_CM_NO_UNKNOWN 1 Index: generic/nsfShadow.c =================================================================== diff -u -rb19a6e9aa168b386cf12ae0f66998c7a2a9ce495 -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 --- generic/nsfShadow.c (.../nsfShadow.c) (revision b19a6e9aa168b386cf12ae0f66998c7a2a9ce495) +++ generic/nsfShadow.c (.../nsfShadow.c) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) @@ -124,19 +124,17 @@ Tcl_GetIntFromObj(interp, objv[1], &level); /* todo: coroutine level messing is missing */ - topLevel = framePtr == NULL ? 0 : framePtr->level; + topLevel = (framePtr == NULL) ? 0 : framePtr->level; if (level > 0) { level -= topLevel; } - while (++level <= 0) { + while (++level <= 0 && varFramePtr) { framePtr = framePtr->nextPtr; varFramePtr = varFramePtr->callerPtr; } - if (varFramePtr == 0) { - fprintf(stderr, "*********** varFramePtr is NULL\n"); - } + frameFlags = varFramePtr ? Tcl_CallFrame_isProcCallFrame(varFramePtr) : 0; /*fprintf(stderr, " ... frame %p varFramePtr %p frameFlags %.6x\n", framePtr, varFramePtr, frameFlags); Tcl85showStack(interp);*/ Index: generic/nsfStack.c =================================================================== diff -u -rd137fce76cdcb71cb10ea76a24e480923124d12c -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 --- generic/nsfStack.c (.../nsfStack.c) (revision d137fce76cdcb71cb10ea76a24e480923124d12c) +++ generic/nsfStack.c (.../nsfStack.c) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) @@ -200,9 +200,10 @@ int lvl = Tcl_CallFrame_level(varFramePtr); for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { - if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & FRAME_IS_NSF_METHOD) { + if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); - if ((cscPtr->flags & NSF_CSC_CALL_IS_NEXT) || (cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) { + if ((cscPtr->flags & (NSF_CSC_CALL_IS_NEXT|NSF_CSC_CALL_IS_ENSEMBLE|NSF_CSC_CALL_IS_TRANSPARENT)) + || (cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) { continue; } if (offset) {