summaryrefslogtreecommitdiffstats
path: root/doc/Method.3
diff options
context:
space:
mode:
Diffstat (limited to 'doc/Method.3')
-rw-r--r--doc/Method.364
1 files changed, 32 insertions, 32 deletions
diff --git a/doc/Method.3 b/doc/Method.3
index 341dcac..550b64a 100644
--- a/doc/Method.3
+++ b/doc/Method.3
@@ -4,14 +4,12 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: Method.3,v 1.1 2008/05/31 11:42:06 dkf Exp $
-'\"
-.so man.macros
.TH Tcl_Method 3 0.1 TclOO "TclOO Library Functions"
+.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
+Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts
.SH SYNOPSIS
.nf
\fB#include <tclOO.h>\fR
@@ -24,9 +22,9 @@ Tcl_Method
\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, isPublic,
methodTypePtr, clientData\fR)
.sp
-\fBTcl_ClassSetConstructor\fR(\fIclass, method\fR)
+\fBTcl_ClassSetConstructor\fR(\fIinterp, class, method\fR)
.sp
-\fBTcl_ClassSetDestructor\fR(\fIclass, method\fR)
+\fBTcl_ClassSetDestructor\fR(\fIinterp, class, method\fR)
.sp
Tcl_Class
\fBTcl_MethodDeclarerClass\fR(\fImethod\fR)
@@ -113,8 +111,9 @@ assigning the per-method \fIclientData\fR to the variable pointed to by
\fIclientDataPtr\fR if (that is non-NULL) if the type is matched.
.SS "METHOD CREATION"
.PP
-Methods are created by \fBTcl_NewMethod\fR and \fBTcl_NewClassMethod\fR, which
-create a method attached to an object or a class respectively. In both cases,
+Methods are created by \fBTcl_NewMethod\fR and \fBTcl_NewInstanceMethod\fR,
+which
+create a method attached to a class or an object respectively. In both cases,
the \fInameObj\fR argument gives the name of the method to create, the
\fIisPublic\fR argument states whether the method should be exported
initially, the \fImethodTypePtr\fR argument describes the implementation of
@@ -122,7 +121,7 @@ the method (see the \fBMETHOD TYPES\fR section below) and the \fIclientData\fR
argument gives some implementation-specific data that is passed on to the
implementation of the method when it is called.
.PP
-When the \fInameObj\fR argument to \fBTcl_NewClassMethod\fR is NULL, an
+When the \fInameObj\fR argument to \fBTcl_NewMethod\fR is NULL, an
unnamed method is created, which is used for constructors and destructors.
Constructors should be installed into their class using the
\fBTcl_ClassSetConstructor\fR function, and destructors (which must not
@@ -130,7 +129,7 @@ require any arguments) should be installed into their class using the
\fBTcl_ClassSetDestructor\fR function. Unnamed methods should not be used for
any other purpose, and named methods should not be used as either constructors
or destructors. Also note that a NULL \fImethodTypePtr\fR is used to provide
-internal signalling, and should not be used in client code.
+internal signaling, and should not be used in client code.
.SS "METHOD CALL CONTEXTS"
.PP
When a method is called, a method-call context reference is passed in as one
@@ -162,19 +161,20 @@ The types of methods are described by a pointer to a Tcl_MethodType structure,
which is defined as:
.PP
.CS
- typedef const struct {
- int \fIversion\fR;
- const char *\fIname\fR;
- Tcl_MethodCallProc \fIcallProc\fR;
- Tcl_MethodDeleteProc \fIdeleteProc\fR;
- Tcl_CloneProc \fIcloneProc\fR;
- } \fBTcl_MethodType\fR;
+typedef struct {
+ int \fIversion\fR;
+ const char *\fIname\fR;
+ Tcl_MethodCallProc *\fIcallProc\fR;
+ Tcl_MethodDeleteProc *\fIdeleteProc\fR;
+ Tcl_CloneProc *\fIcloneProc\fR;
+} \fBTcl_MethodType\fR;
.CE
.PP
The \fIversion\fR field allows for future expansion of the structure, and
should always be declared equal to TCL_OO_METHOD_VERSION_CURRENT. The
-\fIname\fR field provides a human-readable name for the type, and is reserved
-for debugging.
+\fIname\fR field provides a human-readable name for the type, and is the value
+that is exposed via the \fBinfo class methodtype\fR and
+\fBinfo object methodtype\fR Tcl commands.
.PP
The \fIcallProc\fR field gives a function that is called when the method is
invoked; it must never be NULL.
@@ -192,12 +192,12 @@ that the \fIclientData\fR can just be copied directly.
Functions matching this signature are called when the method is invoked.
.PP
.CS
- typedef int (*\fBTcl_MethodCallProc\fR) (
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tcl_ObjectContext \fIobjectContext\fR,
- int \fIobjc\fR,
- Tcl_Obj *const *\fIobjv\fR);
+typedef int \fBTcl_MethodCallProc\fR(
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_ObjectContext \fIobjectContext\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const *\fIobjv\fR);
.CE
.PP
The \fIclientData\fR argument to a Tcl_MethodCallProc is the value that was
@@ -213,23 +213,23 @@ Functions matching this signature are used when a method is deleted, whether
through a new method being created or because the object or class is deleted.
.PP
.CS
- typedef void (*\fBTcl_MethodDeleteProc\fR) (
- ClientData \fIclientData\fR);
+typedef void \fBTcl_MethodDeleteProc\fR(
+ ClientData \fIclientData\fR);
.CE
.PP
The \fIclientData\fR argument to a Tcl_MethodDeleteProc will be the same as
the value passed to the \fIclientData\fR argument to \fBTcl_NewMethod\fR or
-\fBTcl_NewClassMethod\fR when the method was created.
+\fBTcl_NewInstanceMethod\fR when the method was created.
.SS "TCL_CLONEPROC FUNCTION SIGNATURE"
.PP
Functions matching this signature are used to copy a method when the object or
class is copied using \fBTcl_CopyObjectInstance\fR (or \fBoo::copy\fR).
.PP
.CS
- typedef int (*\fBTcl_CloneProc\fR) (
- Tcl_Interp *\fIinterp\fR,
- ClientData \fIoldClientData\fR,
- ClientData *\fInewClientDataPtr\fR);
+typedef int \fBTcl_CloneProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ ClientData \fIoldClientData\fR,
+ ClientData *\fInewClientDataPtr\fR);
.CE
.PP
The \fIinterp\fR argument gives a place to write an error message when the