annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tclOO.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /*
jpayne@69 2 * tclOO.h --
jpayne@69 3 *
jpayne@69 4 * This file contains the public API definitions and some of the function
jpayne@69 5 * declarations for the object-system (NB: not Tcl_Obj, but ::oo).
jpayne@69 6 *
jpayne@69 7 * Copyright (c) 2006-2010 by Donal K. Fellows
jpayne@69 8 *
jpayne@69 9 * See the file "license.terms" for information on usage and redistribution of
jpayne@69 10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
jpayne@69 11 */
jpayne@69 12
jpayne@69 13 #ifndef TCLOO_H_INCLUDED
jpayne@69 14 #define TCLOO_H_INCLUDED
jpayne@69 15
jpayne@69 16 /*
jpayne@69 17 * Be careful when it comes to versioning; need to make sure that the
jpayne@69 18 * standalone TclOO version matches. Also make sure that this matches the
jpayne@69 19 * version in the files:
jpayne@69 20 *
jpayne@69 21 * tests/oo.test
jpayne@69 22 * tests/ooNext2.test
jpayne@69 23 * unix/tclooConfig.sh
jpayne@69 24 * win/tclooConfig.sh
jpayne@69 25 */
jpayne@69 26
jpayne@69 27 #define TCLOO_VERSION "1.1.0"
jpayne@69 28 #define TCLOO_PATCHLEVEL TCLOO_VERSION
jpayne@69 29
jpayne@69 30 #include "tcl.h"
jpayne@69 31
jpayne@69 32 /*
jpayne@69 33 * For C++ compilers, use extern "C"
jpayne@69 34 */
jpayne@69 35
jpayne@69 36 #ifdef __cplusplus
jpayne@69 37 extern "C" {
jpayne@69 38 #endif
jpayne@69 39
jpayne@69 40 extern const char *TclOOInitializeStubs(
jpayne@69 41 Tcl_Interp *, const char *version);
jpayne@69 42 #define Tcl_OOInitStubs(interp) \
jpayne@69 43 TclOOInitializeStubs((interp), TCLOO_VERSION)
jpayne@69 44 #ifndef USE_TCL_STUBS
jpayne@69 45 # define TclOOInitializeStubs(interp, version) (TCLOO_PATCHLEVEL)
jpayne@69 46 #endif
jpayne@69 47
jpayne@69 48 /*
jpayne@69 49 * These are opaque types.
jpayne@69 50 */
jpayne@69 51
jpayne@69 52 typedef struct Tcl_Class_ *Tcl_Class;
jpayne@69 53 typedef struct Tcl_Method_ *Tcl_Method;
jpayne@69 54 typedef struct Tcl_Object_ *Tcl_Object;
jpayne@69 55 typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext;
jpayne@69 56
jpayne@69 57 /*
jpayne@69 58 * Public datatypes for callbacks and structures used in the TIP#257 (OO)
jpayne@69 59 * implementation. These are used to implement custom types of method calls
jpayne@69 60 * and to allow the attachment of arbitrary data to objects and classes.
jpayne@69 61 */
jpayne@69 62
jpayne@69 63 typedef int (Tcl_MethodCallProc)(void *clientData, Tcl_Interp *interp,
jpayne@69 64 Tcl_ObjectContext objectContext, int objc, Tcl_Obj *const *objv);
jpayne@69 65 typedef void (Tcl_MethodDeleteProc)(void *clientData);
jpayne@69 66 typedef int (Tcl_CloneProc)(Tcl_Interp *interp, void *oldClientData,
jpayne@69 67 void **newClientData);
jpayne@69 68 typedef void (Tcl_ObjectMetadataDeleteProc)(void *clientData);
jpayne@69 69 typedef int (Tcl_ObjectMapMethodNameProc)(Tcl_Interp *interp,
jpayne@69 70 Tcl_Object object, Tcl_Class *startClsPtr, Tcl_Obj *methodNameObj);
jpayne@69 71
jpayne@69 72 /*
jpayne@69 73 * The type of a method implementation. This describes how to call the method
jpayne@69 74 * implementation, how to delete it (when the object or class is deleted) and
jpayne@69 75 * how to create a clone of it (when the object or class is copied).
jpayne@69 76 */
jpayne@69 77
jpayne@69 78 typedef struct {
jpayne@69 79 int version; /* Structure version field. Always to be equal
jpayne@69 80 * to TCL_OO_METHOD_VERSION_CURRENT in
jpayne@69 81 * declarations. */
jpayne@69 82 const char *name; /* Name of this type of method, mostly for
jpayne@69 83 * debugging purposes. */
jpayne@69 84 Tcl_MethodCallProc *callProc;
jpayne@69 85 /* How to invoke this method. */
jpayne@69 86 Tcl_MethodDeleteProc *deleteProc;
jpayne@69 87 /* How to delete this method's type-specific
jpayne@69 88 * data, or NULL if the type-specific data
jpayne@69 89 * does not need deleting. */
jpayne@69 90 Tcl_CloneProc *cloneProc; /* How to copy this method's type-specific
jpayne@69 91 * data, or NULL if the type-specific data can
jpayne@69 92 * be copied directly. */
jpayne@69 93 } Tcl_MethodType;
jpayne@69 94
jpayne@69 95 /*
jpayne@69 96 * The correct value for the version field of the Tcl_MethodType structure.
jpayne@69 97 * This allows new versions of the structure to be introduced without breaking
jpayne@69 98 * binary compatibility.
jpayne@69 99 */
jpayne@69 100
jpayne@69 101 #define TCL_OO_METHOD_VERSION_CURRENT 1
jpayne@69 102
jpayne@69 103 /*
jpayne@69 104 * The type of some object (or class) metadata. This describes how to delete
jpayne@69 105 * the metadata (when the object or class is deleted) and how to create a
jpayne@69 106 * clone of it (when the object or class is copied).
jpayne@69 107 */
jpayne@69 108
jpayne@69 109 typedef struct {
jpayne@69 110 int version; /* Structure version field. Always to be equal
jpayne@69 111 * to TCL_OO_METADATA_VERSION_CURRENT in
jpayne@69 112 * declarations. */
jpayne@69 113 const char *name;
jpayne@69 114 Tcl_ObjectMetadataDeleteProc *deleteProc;
jpayne@69 115 /* How to delete the metadata. This must not
jpayne@69 116 * be NULL. */
jpayne@69 117 Tcl_CloneProc *cloneProc; /* How to copy the metadata, or NULL if the
jpayne@69 118 * type-specific data can be copied
jpayne@69 119 * directly. */
jpayne@69 120 } Tcl_ObjectMetadataType;
jpayne@69 121
jpayne@69 122 /*
jpayne@69 123 * The correct value for the version field of the Tcl_ObjectMetadataType
jpayne@69 124 * structure. This allows new versions of the structure to be introduced
jpayne@69 125 * without breaking binary compatibility.
jpayne@69 126 */
jpayne@69 127
jpayne@69 128 #define TCL_OO_METADATA_VERSION_CURRENT 1
jpayne@69 129
jpayne@69 130 /*
jpayne@69 131 * Include all the public API, generated from tclOO.decls.
jpayne@69 132 */
jpayne@69 133
jpayne@69 134 #include "tclOODecls.h"
jpayne@69 135
jpayne@69 136 #ifdef __cplusplus
jpayne@69 137 }
jpayne@69 138 #endif
jpayne@69 139 #endif
jpayne@69 140
jpayne@69 141 /*
jpayne@69 142 * Local Variables:
jpayne@69 143 * mode: c
jpayne@69 144 * c-basic-offset: 4
jpayne@69 145 * fill-column: 78
jpayne@69 146 * End:
jpayne@69 147 */