codekingpro/portable-devtools
114k
1/*2 * tclOO.h --3 *4 * This file contains the public API definitions and some of the function5 * declarations for the object-system (NB: not Tcl_Obj, but ::oo).6 *7 * Copyright (c) 2006-2010 by Donal K. Fellows8 *9 * See the file "license.terms" for information on usage and redistribution of10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.11 */12 13#ifndef TCLOO_H_INCLUDED14#define TCLOO_H_INCLUDED15 16/*17 * Be careful when it comes to versioning; need to make sure that the18 * standalone TclOO version matches. Also make sure that this matches the19 * version in the files:20 *21 * tests/oo.test22 * tests/ooNext2.test23 * unix/tclooConfig.sh24 * win/tclooConfig.sh25 */26 27#define TCLOO_VERSION "1.1.0"28#define TCLOO_PATCHLEVEL TCLOO_VERSION29 30#include "tcl.h"31 32/*33 * For C++ compilers, use extern "C"34 */35 36#ifdef __cplusplus37extern "C" {38#endif39 40extern const char *TclOOInitializeStubs(41 Tcl_Interp *, const char *version);42#define Tcl_OOInitStubs(interp) \43 TclOOInitializeStubs((interp), TCLOO_VERSION)44#ifndef USE_TCL_STUBS45# define TclOOInitializeStubs(interp, version) (TCLOO_PATCHLEVEL)46#endif47 48/*49 * These are opaque types.50 */51 52typedef struct Tcl_Class_ *Tcl_Class;53typedef struct Tcl_Method_ *Tcl_Method;54typedef struct Tcl_Object_ *Tcl_Object;55typedef struct Tcl_ObjectContext_ *Tcl_ObjectContext;5657/*58 * Public datatypes for callbacks and structures used in the TIP#257 (OO)59 * implementation. These are used to implement custom types of method calls60 * and to allow the attachment of arbitrary data to objects and classes.61 */62 63typedef int (Tcl_MethodCallProc)(void *clientData, Tcl_Interp *interp,64 Tcl_ObjectContext objectContext, int objc, Tcl_Obj *const *objv);65typedef void (Tcl_MethodDeleteProc)(void *clientData);66typedef int (Tcl_CloneProc)(Tcl_Interp *interp, void *oldClientData,67 void **newClientData);68typedef void (Tcl_ObjectMetadataDeleteProc)(void *clientData);69typedef int (Tcl_ObjectMapMethodNameProc)(Tcl_Interp *interp,70 Tcl_Object object, Tcl_Class *startClsPtr, Tcl_Obj *methodNameObj);7172/*73 * The type of a method implementation. This describes how to call the method74 * implementation, how to delete it (when the object or class is deleted) and75 * how to create a clone of it (when the object or class is copied).76 */77 78typedef struct {79 int version; /* Structure version field. Always to be equal80 * to TCL_OO_METHOD_VERSION_CURRENT in81 * declarations. */82 const char *name; /* Name of this type of method, mostly for83 * debugging purposes. */84 Tcl_MethodCallProc *callProc;85 /* How to invoke this method. */86 Tcl_MethodDeleteProc *deleteProc;87 /* How to delete this method's type-specific88 * data, or NULL if the type-specific data89 * does not need deleting. */90 Tcl_CloneProc *cloneProc; /* How to copy this method's type-specific91 * data, or NULL if the type-specific data can92 * 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 breaking98 * binary compatibility.99 */100 101#define TCL_OO_METHOD_VERSION_CURRENT 1102103/*104 * The type of some object (or class) metadata. This describes how to delete105 * the metadata (when the object or class is deleted) and how to create a106 * clone of it (when the object or class is copied).107 */108 109typedef struct {110 int version; /* Structure version field. Always to be equal111 * to TCL_OO_METADATA_VERSION_CURRENT in112 * declarations. */113 const char *name;114 Tcl_ObjectMetadataDeleteProc *deleteProc;115 /* How to delete the metadata. This must not116 * be NULL. */117 Tcl_CloneProc *cloneProc; /* How to copy the metadata, or NULL if the118 * type-specific data can be copied119 * directly. */120} Tcl_ObjectMetadataType;121 122/*123 * The correct value for the version field of the Tcl_ObjectMetadataType124 * structure. This allows new versions of the structure to be introduced125 * without breaking binary compatibility.126 */127 128#define TCL_OO_METADATA_VERSION_CURRENT 1129130/*131 * Include all the public API, generated from tclOO.decls.132 */133 134#include "tclOODecls.h"135 136#ifdef __cplusplus137}138#endif139#endif140141/*142 * Local Variables:143 * mode: c144 * c-basic-offset: 4145 * fill-column: 78146 * End:147 */148 