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