|
||||
File indexing completed on 2024-05-18 08:30:21
0001 /* 0002 * tclOO.h -- 0003 * 0004 * This file contains the public API definitions and some of the function 0005 * declarations for the object-system (NB: not Tcl_Obj, but ::oo). 0006 * 0007 * Copyright (c) 2006-2010 by Donal K. Fellows 0008 * 0009 * See the file "license.terms" for information on usage and redistribution of 0010 * this file, and for a DISCLAIMER OF ALL WARRANTIES. 0011 */ 0012 0013 #ifndef TCLOO_H_INCLUDED 0014 #define TCLOO_H_INCLUDED 0015 0016 /* 0017 * Be careful when it comes to versioning; need to make sure that the 0018 * standalone TclOO version matches. Also make sure that this matches the 0019 * version in the files: 0020 * 0021 * tests/oo.test 0022 * tests/ooNext2.test 0023 * unix/tclooConfig.sh 0024 * win/tclooConfig.sh 0025 */ 0026 0027 #define TCLOO_VERSION "1.1.0" 0028 #define TCLOO_PATCHLEVEL TCLOO_VERSION 0029 0030 #include "tcl.h" 0031 0032 /* 0033 * For C++ compilers, use extern "C" 0034 */ 0035 0036 #ifdef __cplusplus 0037 extern "C" { 0038 #endif 0039 0040 extern const char *TclOOInitializeStubs( 0041 Tcl_Interp *, const char *version); 0042 #define Tcl_OOInitStubs(interp) \ 0043 TclOOInitializeStubs((interp), TCLOO_VERSION) 0044 #ifndef USE_TCL_STUBS 0045 # define TclOOInitializeStubs(interp, version) (TCLOO_PATCHLEVEL) 0046 #endif 0047 0048 /* 0049 * These are opaque types. 0050 */ 0051 0052 typedef struct Tcl_Class_ *Tcl_Class; 0053 typedef struct Tcl_Method_ *Tcl_Method; 0054 typedef struct Tcl_Object_ *Tcl_Object; 0055 typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext; 0056 0057 /* 0058 * Public datatypes for callbacks and structures used in the TIP#257 (OO) 0059 * implementation. These are used to implement custom types of method calls 0060 * and to allow the attachment of arbitrary data to objects and classes. 0061 */ 0062 0063 typedef int (Tcl_MethodCallProc)(ClientData clientData, Tcl_Interp *interp, 0064 Tcl_ObjectContext objectContext, int objc, Tcl_Obj *const *objv); 0065 typedef void (Tcl_MethodDeleteProc)(ClientData clientData); 0066 typedef int (Tcl_CloneProc)(Tcl_Interp *interp, ClientData oldClientData, 0067 ClientData *newClientData); 0068 typedef void (Tcl_ObjectMetadataDeleteProc)(ClientData clientData); 0069 typedef int (Tcl_ObjectMapMethodNameProc)(Tcl_Interp *interp, 0070 Tcl_Object object, Tcl_Class *startClsPtr, Tcl_Obj *methodNameObj); 0071 0072 /* 0073 * The type of a method implementation. This describes how to call the method 0074 * implementation, how to delete it (when the object or class is deleted) and 0075 * how to create a clone of it (when the object or class is copied). 0076 */ 0077 0078 typedef struct { 0079 int version; /* Structure version field. Always to be equal 0080 * to TCL_OO_METHOD_VERSION_CURRENT in 0081 * declarations. */ 0082 const char *name; /* Name of this type of method, mostly for 0083 * debugging purposes. */ 0084 Tcl_MethodCallProc *callProc; 0085 /* How to invoke this method. */ 0086 Tcl_MethodDeleteProc *deleteProc; 0087 /* How to delete this method's type-specific 0088 * data, or NULL if the type-specific data 0089 * does not need deleting. */ 0090 Tcl_CloneProc *cloneProc; /* How to copy this method's type-specific 0091 * data, or NULL if the type-specific data can 0092 * be copied directly. */ 0093 } Tcl_MethodType; 0094 0095 /* 0096 * The correct value for the version field of the Tcl_MethodType structure. 0097 * This allows new versions of the structure to be introduced without breaking 0098 * binary compatability. 0099 */ 0100 0101 #define TCL_OO_METHOD_VERSION_CURRENT 1 0102 0103 /* 0104 * The type of some object (or class) metadata. This describes how to delete 0105 * the metadata (when the object or class is deleted) and how to create a 0106 * clone of it (when the object or class is copied). 0107 */ 0108 0109 typedef struct { 0110 int version; /* Structure version field. Always to be equal 0111 * to TCL_OO_METADATA_VERSION_CURRENT in 0112 * declarations. */ 0113 const char *name; 0114 Tcl_ObjectMetadataDeleteProc *deleteProc; 0115 /* How to delete the metadata. This must not 0116 * be NULL. */ 0117 Tcl_CloneProc *cloneProc; /* How to copy the metadata, or NULL if the 0118 * type-specific data can be copied 0119 * directly. */ 0120 } Tcl_ObjectMetadataType; 0121 0122 /* 0123 * The correct value for the version field of the Tcl_ObjectMetadataType 0124 * structure. This allows new versions of the structure to be introduced 0125 * without breaking binary compatability. 0126 */ 0127 0128 #define TCL_OO_METADATA_VERSION_CURRENT 1 0129 0130 /* 0131 * Include all the public API, generated from tclOO.decls. 0132 */ 0133 0134 #include "tclOODecls.h" 0135 0136 #ifdef __cplusplus 0137 } 0138 #endif 0139 #endif 0140 0141 /* 0142 * Local Variables: 0143 * mode: c 0144 * c-basic-offset: 4 0145 * fill-column: 78 0146 * End: 0147 */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.5 LXR engine. The LXR team |