diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2006-10-20 14:04:00 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2006-10-20 14:04:00 (GMT) |
commit | 667340e02adf467adc84a317f84580be29dc5c71 (patch) | |
tree | 87fbdfd7e8dccb4c52676aa6746ada3820599088 /generic/tcl.h | |
parent | e2b1c1973457dd38516163bd35af69fd75d9ec0f (diff) | |
download | tcl-667340e02adf467adc84a317f84580be29dc5c71.zip tcl-667340e02adf467adc84a317f84580be29dc5c71.tar.gz tcl-667340e02adf467adc84a317f84580be29dc5c71.tar.bz2 |
Consolidated TIP#257 patch applied to HEAD to allow for experimentation by
other developers
Diffstat (limited to 'generic/tcl.h')
-rw-r--r-- | generic/tcl.h | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index bc89666..2c95f26 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.217 2006/10/05 21:24:39 hobbs Exp $ + * RCS: @(#) $Id: tcl.h,v 1.218 2006/10/20 14:04:00 dkf Exp $ */ #ifndef _TCL @@ -501,6 +501,7 @@ typedef struct Tcl_Interp { typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; typedef struct Tcl_Channel_ *Tcl_Channel; typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion; +typedef struct Tcl_Class_ *Tcl_Class; typedef struct Tcl_Command_ *Tcl_Command; typedef struct Tcl_Condition_ *Tcl_Condition; typedef struct Tcl_Dict_ *Tcl_Dict; @@ -509,7 +510,10 @@ typedef struct Tcl_Encoding_ *Tcl_Encoding; typedef struct Tcl_Event Tcl_Event; typedef struct Tcl_InterpState_ *Tcl_InterpState; typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle; +typedef struct Tcl_Method_ *Tcl_Method; typedef struct Tcl_Mutex_ *Tcl_Mutex; +typedef struct Tcl_Object_ *Tcl_Object; +typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext; typedef struct Tcl_Pid_ *Tcl_Pid; typedef struct Tcl_RegExp_ *Tcl_RegExp; typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey; @@ -953,6 +957,8 @@ typedef struct Tcl_CallFrame { char *dummy8; int dummy9; char* dummy10; + void* dummy11; + /*int dummy12;*/ } Tcl_CallFrame; /* @@ -2351,6 +2357,81 @@ typedef unsigned long mp_digit; #define MP_DIGIT_DECLARED #endif +/* + * Public datatypes for callbacks and structures used in the TIP#257 (OO) + * implementation. These are used to implement custom types of method calls + * and to allow the attachment of arbitrary data to objects and classes. + */ + +typedef int (*Tcl_MethodCallProc)_ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_ObjectContext objectContext, int objc, + Tcl_Obj *const *objv)); +typedef void (*Tcl_MethodDeleteProc)_ANSI_ARGS_((ClientData clientData)); +typedef int (*Tcl_MethodCloneProc)_ANSI_ARGS_((ClientData oldClientData, + ClientData *newClientData)); +typedef void (*Tcl_ObjectMetadataDeleteProc)_ANSI_ARGS_(( + ClientData clientData)); +typedef ClientData (*Tcl_ObjectMetadataCloneProc)_ANSI_ARGS_(( + ClientData clientData)); + +/* + * The type of a method implementation. This describes how to call the method + * implementation, how to delete it (when the object or class is deleted) and + * how to create a clone of it (when the object or class is copied). + */ + +typedef struct { + int version; /* Structure version field. Always to be equal + * to TCL_OO_METHOD_VERSION_CURRENT in + * declarations. */ + const char *name; /* Name of this type of method, mostly for + * debugging purposes. */ + Tcl_MethodCallProc callProc;/* How to invoke this method. */ + Tcl_MethodDeleteProc deleteProc; + /* How to delete this method's type-specific + * data, or NULL if the type-specific data + * does not need deleting. */ + Tcl_MethodCloneProc cloneProc; + /* How to copy this method's type-specific + * data, or NULL if the type-specific data can + * be copied directly. */ +} Tcl_MethodType; + +/* + * The correct value for the version field of the Tcl_MethodType structure. + * This allows new versions of the structure to be introduced without breaking + * binary compatability. + */ + +#define TCL_OO_METHOD_VERSION_CURRENT 1 + +/* + * The type of some object (or class) metadata. This describes how to delete + * the metadata (when the object or class is deleted) and how to create a + * clone of it (when the object or class is copied). + */ + +typedef struct { + int version; /* Structure version field. Always to be equal + * to TCL_OO_METADATA_VERSION_CURRENT in + * declarations. */ + const char *name; + Tcl_ObjectMetadataDeleteProc deleteProc; + /* How to delete the metadata. This must not + * be NULL. */ + Tcl_ObjectMetadataCloneProc cloneProc; + /* How to clone the metadata. If NULL, the + * metadata will not be copied. */ +} Tcl_ObjectMetadataType; + +/* + * The correct value for the version field of the Tcl_ObjectMetadataType + * structure. This allows new versions of the structure to be introduced + * without breaking binary compatability. + */ + +#define TCL_OO_METHOD_VERSION_CURRENT 1 + #ifndef TCL_NO_DEPRECATED /* * Deprecated Tcl functions: |