Posted to tcl by apw at Sun Sep 09 19:11:04 GMT 2007view raw
- Tcl_Method
- Tcl_NewProcMethod(
- Tcl_Interp *interp, /* The interpreter containing the object. */
- Tcl_Object oPtr, /* The object to modify. */
- TclOO_PreCallProc preCallPtr,
- TclOO_PostCallProc postCallPtr,
- Tcl_ProcErrorProc errProc,
- ClientData clientData,
- Tcl_Obj *nameObj, /* The name of the method, which must not be
- * NULL. */
- Tcl_Obj *argsObj, /* The formal argument list for the method,
- * which must not be NULL. */
- Tcl_Obj *bodyObj, /* The body of the method, which must not be
- * NULL. */
- int flags, /* Whether this is a public method. */
- ClientData *clientData2)
- {
- ProcedureMethod *pmPtr;
- Tcl_Method method;
- method = (Tcl_Method)TclOONewProcMethod(interp, (Object *)oPtr, flags,
- nameObj, argsObj, bodyObj, &pmPtr);
- pmPtr->flags = flags & USE_DECLARER_NS;
- pmPtr->preCallProc = preCallPtr;
- pmPtr->postCallProc = postCallPtr;
- pmPtr->errProc = errProc;
- pmPtr->clientData = clientData;
- if (clientData2 != NULL) {
- *clientData2 = pmPtr;
- }
- return method;
- }
- Tcl_Method
- Tcl_NewProcClassMethod(
- Tcl_Interp *interp, /* The interpreter containing the class. */
- Tcl_Class clsPtr, /* The class to modify. */
- TclOO_PreCallProc preCallPtr,
- TclOO_PostCallProc postCallPtr,
- Tcl_ProcErrorProc errProc,
- ClientData clientData,
- Tcl_Obj *nameObj, /* The name of the method, which may be NULL;
- * if so, up to caller to manage storage
- * (e.g., because it is a constructor or
- * destructor). */
- Tcl_Obj *argsObj, /* The formal argument list for the method,
- * which may be NULL; if so, it is equivalent
- * to an empty list. */
- Tcl_Obj *bodyObj, /* The body of the method, which must not be
- * NULL. */
- int flags, /* Whether this is a public method. */
- ClientData *clientData2)
- {
- ProcedureMethod *pmPtr;
- Method *method;
- method = TclOONewProcClassMethod(interp, (Class *)clsPtr, flags,
- nameObj, argsObj, bodyObj, &pmPtr);
- pmPtr->flags = flags & USE_DECLARER_NS;
- pmPtr->preCallProc = preCallPtr;
- pmPtr->postCallProc = postCallPtr;
- pmPtr->errProc = errProc;
- pmPtr->clientData = clientData;
- if (clientData2 != NULL) {
- *clientData2 = pmPtr;
- }
- return (Tcl_Method)method;
- }
- #define PUBLIC_METHOD 0x01 /* This is a public (exported) method. */
- #define PRIVATE_METHOD 0x02 /* This is a private (class's direct instances
- * only) method. */
- #define USE_DECLARER_NS 0x80
- /*
- * ----------------------------------------------------------------------
- *
- * Tcl_PublicObjectCmd, Tcl_PrivateObjectCmd --
- *
- * ----------------------------------------------------------------------
- */
- int
- Tcl_PublicObjectCmd(
- ClientData clientData,
- Tcl_Interp *interp,
- Tcl_Class clsPtr,
- int objc,
- Tcl_Obj *const *objv)
- {
- Object *oPtr = (Object *)clientData;
- int result;
- result = TclOOObjectCmdCore(oPtr, interp, objc, objv, PUBLIC_METHOD,
- &oPtr->publicContextCache, (Class *)clsPtr);
- return result;
- }
- int
- Tcl_PrivateObjectCmd(
- ClientData clientData,
- Tcl_Interp *interp,
- Tcl_Class clsPtr,
- int objc,
- Tcl_Obj *const *objv)
- {
- Object *oPtr = (Object *)clientData;
- int result;
- result = TclOOObjectCmdCore(oPtr, interp, objc, objv, PRIVATE_METHOD,
- &oPtr->publicContextCache, (Class *)clsPtr);
- return result;
- }