Overview
| Artifact ID: | cebb06b29dd5fcbbb37e4701485eb8a5f0c3f5d3 |
|---|---|
| Ticket: | 1865198fffffffffffffffffffffffffffffffff |
| Date: | 2008-01-07 01:29:54 |
| User: | wiede |
| Artifact Attached: | e2a6da654f8abafd85b8efb863e03112fcb7ea48 |
| Filename: | classmethodinvoke2.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 86int Tcl_InvokeClassProcedureMethod( Tcl_Interp *interp, Tcl_Obj *namePtr, /* name of the method */ Tcl_Namespace *nsPtr, /* namespace for calling method */ ProcedureMethod *pmPtr, /* method type specific data */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Arguments as actually seen. */ { 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(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, 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; }