Overview
| Artifact ID: | 951b27bb14c44e672c176b90891306d5dfda44a2 |
|---|---|
| Ticket: | 1865198fffffffffffffffffffffffffffffffff |
| Date: | 2008-01-07 00:27:02 |
| User: | wiede |
| Artifact Attached: | bf106b2f5bf8a3a5746d9b614c60989c35a0bad2 |
| Filename: | classmethodinvoke.c |
| Description: | prototype implementation of the function |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87int Tcl_InvokeClassProcedureMethod( ClientData clientData, /* Pointer to some per-method context. */ Tcl_Interp *interp, int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Arguments as actually seen. */ { Method *mPtr = clientData; Tcl_Namespace *nsPtr = mPtr->declaringClassPtr->thisPtr->namespacePtr; ProcedureMethod *pmPtr = mPtr->clientData; Proc *procPtr = pmPtr->procPtr; int flags = FRAME_IS_METHOD; CallFrame frame; CallFrame *framePtr = &frame; CallFrame **framePtrPtr1 = &framePtr; Tcl_CallFrame **framePtrPtr = (Tcl_CallFrame **)framePtrPtr1; Command cmd; int result; memset(&cmd, 0, sizeof(Command)); cmd.nsPtr = (Namespace *) nsPtr; cmd.clientData = NULL; pmPtr->procPtr->cmdPtr = &cmd; result = TclProcCompileProc(interp, pmPtr->procPtr, pmPtr->procPtr->bodyPtr, (Namespace *) nsPtr, "body of method", Tcl_GetString(mPtr->namePtr)); if (result != TCL_OK) { return result; } /* * Make the stack frame and fill it out with information about this call. * This operation may fail. */ flags |= FRAME_IS_PROC; result = TclPushStackFrame(interp, framePtrPtr, nsPtr, flags); if (result != TCL_OK) { return result; } framePtr->clientData = NULL; framePtr->objc = objc; framePtr->objv = objv; framePtr->procPtr = procPtr; /* * Give the pre-call callback a chance to do some setup and, possibly, * veto the call. */ if (pmPtr->preCallProc != NULL) { int isFinished; result = pmPtr->preCallProc(pmPtr->clientData, interp, NULL, (Tcl_CallFrame *) framePtr, &isFinished); if (isFinished || result != TCL_OK) { Tcl_PopCallFrame(interp); TclStackFree(interp, framePtr); goto done; } } /* * Now invoke the body of the method. Note that we need to take special * action when doing unknown processing to ensure that the missing method * name is passed as an argument. */ result = TclObjInterpProcCore(interp, mPtr->namePtr, 1, pmPtr->errProc); /* * Give the post-call callback a chance to do some cleanup. Note that at * this point the call frame itself is invalid; it's already been popped. */ if (pmPtr->postCallProc) { result = pmPtr->postCallProc(pmPtr->clientData, interp, NULL, nsPtr, result); } done: return result; }