Index: doc/index.html =================================================================== diff -u -r548ea60d4d51c8713263f9a75fe75f5b1428c8cf -ra15fb82a6c951540fdf1555473ca9a6fcae7c84c --- doc/index.html (.../index.html) (revision 548ea60d4d51c8713263f9a75fe75f5b1428c8cf) +++ doc/index.html (.../index.html) (revision a15fb82a6c951540fdf1555473ca9a6fcae7c84c) @@ -23,7 +23,7 @@

Index: generic/xotcl.c =================================================================== diff -u -r6e8ab92e4ce5ced6bad29179bb7c5669389c601e -ra15fb82a6c951540fdf1555473ca9a6fcae7c84c --- generic/xotcl.c (.../xotcl.c) (revision 6e8ab92e4ce5ced6bad29179bb7c5669389c601e) +++ generic/xotcl.c (.../xotcl.c) (revision a15fb82a6c951540fdf1555473ca9a6fcae7c84c) @@ -78,6 +78,7 @@ int XOTclObjWrongArgs(Tcl_Interp *interp, CONST char *msg, Tcl_Obj *cmdName, Tcl_Obj *methodObj, CONST char *arglist); static int XOTclDeprecatedCmd(Tcl_Interp *interp, CONST char *what, CONST char *oldCmd, CONST char *newCmd); +static void FilterComputeDefined(Tcl_Interp *interp, XOTclObject *object); /* methods called directly when CanInvokeDirectly() allows it */ static int XOTclCAllocMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *nameObj); @@ -1359,6 +1360,38 @@ return success; } +static Tcl_Obj *InvokeMethodObj(Tcl_Interp *interp, XOTclObject *object, int methodIdx) { + /* we can call a c-implemented method directly, when + a) the program does not contain a method with the appropriate name, and + b) filters are not active on the object + */ + Tcl_Obj *methodObj = XOTclGlobalObjects[methodIdx]; + + if (methodObj) { + + if (!(object->flags & XOTCL_FILTER_ORDER_VALID)) { + FilterComputeDefined(interp, object); + } + + if (((RUNTIME_STATE(interp)->overloadedMethods & 1<flags & XOTCL_FILTER_ORDER_DEFINED_AND_VALID) != XOTCL_FILTER_ORDER_DEFINED_AND_VALID)) { + /*fprintf(stderr, "object %s not overloaded %d filter not active %d flags %.6x \n", + objectName(object), + ((RUNTIME_STATE(interp)->overloadedMethods & 1<flags & XOTCL_FILTER_ORDER_DEFINED_AND_VALID) != XOTCL_FILTER_ORDER_DEFINED_AND_VALID), + object->flags);*/ + methodObj = NULL; + } + } + +#if 0 + fprintf(stderr, "InvokeMethodObj object %s returns %s\n", + objectName(object), methodObj ? ObjStr(methodObj) : "(null)"); +#endif + + return methodObj; +} + static int callDestroyMethod(Tcl_Interp *interp, XOTclObject *object, int flags) { int result; @@ -8296,10 +8329,10 @@ */ static int doObjInitialization(Tcl_Interp *interp, XOTclObject *object, int objc, Tcl_Obj *CONST objv[]) { + Tcl_Obj *methodObj, *savedObjResult = Tcl_GetObjResult(interp); /* save the result */ int result; - Tcl_Obj *savedObjResult = Tcl_GetObjResult(interp); /* save the result */ - INCR_REF_COUNT(savedObjResult); + INCR_REF_COUNT(savedObjResult); /* * clear INIT_CALLED flag */ @@ -8308,16 +8341,18 @@ /* * call configure methods (starting with '-') */ - if (CanInvokeDirectly(interp, object, XOTE_CONFIGURE)) { + methodObj = InvokeMethodObj(interp, object, XOTE_CONFIGURE); + if (methodObj) { + result = callMethod((ClientData) object, interp, + methodObj, objc, objv+2, 0); + } else { ALLOC_ON_STACK(Tcl_Obj*, objc, tov); memcpy(tov+1, objv+2, sizeof(Tcl_Obj *)*(objc-1)); tov[0] = XOTclGlobalObjects[XOTE_CONFIGURE]; result = XOTclOConfigureMethod(interp, object, objc-1, tov); FREE_ON_STACK(tov); - } else { - result = callMethod((ClientData) object, interp, - XOTclGlobalObjects[XOTE_CONFIGURE], objc, objv+2, 0); } + if (result != TCL_OK) { goto objinitexit; } @@ -11131,6 +11166,7 @@ Tcl_GetErrorLine(interp), ObjStr(Tcl_GetObjResult(interp))); } + RUNTIME_STATE(interp)->doFilters = 0; destroyObjectSystems(interp); XOTclClassListFree(RUNTIME_STATE(interp)->rootClasses); Index: generic/xotclStack85.c =================================================================== diff -u -rcba6f4b7f64936e10a49fbdbb0d579815e0074da -ra15fb82a6c951540fdf1555473ca9a6fcae7c84c --- generic/xotclStack85.c (.../xotclStack85.c) (revision cba6f4b7f64936e10a49fbdbb0d579815e0074da) +++ generic/xotclStack85.c (.../xotclStack85.c) (revision a15fb82a6c951540fdf1555473ca9a6fcae7c84c) @@ -349,6 +349,7 @@ * callframe */ static void CallStackPopAll(Tcl_Interp *interp) { + /*tcl85showStack(interp);*/ while (1) { Tcl_CallFrame *framePtr = Tcl_Interp_framePtr(interp); @@ -358,7 +359,7 @@ if (Tcl_CallFrame_level(framePtr) == 0) break; frameFlags = Tcl_CallFrame_isProcCallFrame(framePtr); - /*fprintf(stderr, "... popping %p frameflags %.6x\n", framePtr, frameFlags);*/ + /*fprintf(stderr, "--- popping %p frameflags %.6x\n", framePtr, frameFlags);*/ if (frameFlags & (FRAME_IS_XOTCL_METHOD|FRAME_IS_XOTCL_CMETHOD)) { /* free the call stack content; we need this just for decr activation count */