Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
956ea775d3 | ||
|
|
53595aca5e |
+13
-6
@@ -25,19 +25,26 @@ interface is going to be used.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
When an extension library is going to use the C interface exposed by TclOO, it
|
||||
When an extension library is going to use the C interface exposed by TclOO,
|
||||
and it wants to remain compatible with Tcl 8.6.1 and lower, it
|
||||
should use \fBTcl_OOInitStubs\fR to initialize its access to that interface
|
||||
from within its \fI*\fB_Init\fR (or \fI*\fB_SafeInit\fR) function, passing in
|
||||
the \fIinterp\fR that was passed into that routine as context. If the result
|
||||
of calling \fBTcl_OOInitStubs\fR is NULL, the initialization failed and an
|
||||
error message will have been left in the interpreter's result. Otherwise, the
|
||||
initialization succeeded and the TclOO API may thereafter be used; the
|
||||
version of the TclOO API is returned.
|
||||
version of the TclOO API is returned. Starting with Tcl 8.6.2, you can call
|
||||
\fBTcl_InitStubs\fR in stead of \fBTcl_OOInitStubs\fR.
|
||||
.PP
|
||||
When using this function, either the C #define symbol \fBUSE_TCLOO_STUBS\fR
|
||||
should be defined and your library code linked against the Tcl stub library,
|
||||
or that #define symbol should \fInot\fR be defined and your library code
|
||||
linked against the Tcl main library directly.
|
||||
When using stubs, the C #define symbol \fBUSE_TCL_STUBS\fR should be defined
|
||||
and your library code linked against the Tcl stub library. Calling the
|
||||
\fBTcl_InitStubs\fR function is the first thing the extension should do,
|
||||
just as any other extension not using TclOO.
|
||||
.PP
|
||||
If you don't want to use stubs, you can also link to Tcl statically. Then,
|
||||
\fBUSE_TCL_STUBS\fR should not be set and calling \fBTcl_InitStubs\fR is
|
||||
optional.
|
||||
|
||||
.SH "BACKWARD COMPATIBILITY NOTE"
|
||||
.PP
|
||||
If you are linking against the Tcl 8.5 forward compatibility package for
|
||||
|
||||
+1
-1
@@ -271,7 +271,7 @@ TclOOInit(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
return Tcl_PkgProvideEx(interp, "TclOO", TCLOO_VERSION,
|
||||
return Tcl_PkgProvideEx(interp, "TclOO", TCLOO_PATCHLEVEL,
|
||||
(ClientData) &tclOOStubs);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
library tclOO
|
||||
scspec TCLOOAPI
|
||||
|
||||
######################################################################
|
||||
# Public API, exposed for general users of TclOO.
|
||||
|
||||
+4
-5
@@ -24,8 +24,8 @@
|
||||
* win/tclooConfig.sh
|
||||
*/
|
||||
|
||||
#define TCLOO_VERSION "1.0.1"
|
||||
#define TCLOO_PATCHLEVEL TCLOO_VERSION
|
||||
#define TCLOO_VERSION "1.0"
|
||||
#define TCLOO_PATCHLEVEL "1.0.1"
|
||||
|
||||
#include "tcl.h"
|
||||
|
||||
@@ -37,13 +37,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (defined(USE_TCLOO_STUBS) || defined(USE_TCL_STUBS))
|
||||
extern const char *TclOOInitializeStubs(
|
||||
Tcl_Interp *, const char *version);
|
||||
#define Tcl_OOInitStubs(interp) \
|
||||
TclOOInitializeStubs((interp), TCLOO_VERSION)
|
||||
#else
|
||||
#define Tcl_OOInitStubs(interp) (TCLOO_PATCHLEVEL)
|
||||
#ifndef USE_TCL_STUBS
|
||||
# define TclOOInitializeStubs(interp, version) (TCLOO_PATCHLEVEL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
+37
-39
@@ -5,14 +5,15 @@
|
||||
#ifndef _TCLOODECLS
|
||||
#define _TCLOODECLS
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#else
|
||||
# ifdef USE_TCL_STUBS
|
||||
# define TCL_STORAGE_CLASS
|
||||
#ifndef TCLOOAPI
|
||||
# if (defined(BUILD_tcl) || defined(BUILD_TclOO)) && !defined(BUILD_STATIC)
|
||||
# define TCLOOAPI MODULE_SCOPE
|
||||
# else
|
||||
# define TCL_STORAGE_CLASS DLLIMPORT
|
||||
# define TCLOOAPI extern
|
||||
# ifdef USE_TCL_STUBS
|
||||
# undef USE_TCLOO_STUBS
|
||||
# define USE_TCLOO_STUBS 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -23,92 +24,92 @@
|
||||
*/
|
||||
|
||||
/* 0 */
|
||||
EXTERN Tcl_Object Tcl_CopyObjectInstance(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Object Tcl_CopyObjectInstance(Tcl_Interp *interp,
|
||||
Tcl_Object sourceObject,
|
||||
const char *targetName,
|
||||
const char *targetNamespaceName);
|
||||
/* 1 */
|
||||
EXTERN Tcl_Object Tcl_GetClassAsObject(Tcl_Class clazz);
|
||||
TCLOOAPI Tcl_Object Tcl_GetClassAsObject(Tcl_Class clazz);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Class Tcl_GetObjectAsClass(Tcl_Object object);
|
||||
TCLOOAPI Tcl_Class Tcl_GetObjectAsClass(Tcl_Object object);
|
||||
/* 3 */
|
||||
EXTERN Tcl_Command Tcl_GetObjectCommand(Tcl_Object object);
|
||||
TCLOOAPI Tcl_Command Tcl_GetObjectCommand(Tcl_Object object);
|
||||
/* 4 */
|
||||
EXTERN Tcl_Object Tcl_GetObjectFromObj(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Object Tcl_GetObjectFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr);
|
||||
/* 5 */
|
||||
EXTERN Tcl_Namespace * Tcl_GetObjectNamespace(Tcl_Object object);
|
||||
TCLOOAPI Tcl_Namespace * Tcl_GetObjectNamespace(Tcl_Object object);
|
||||
/* 6 */
|
||||
EXTERN Tcl_Class Tcl_MethodDeclarerClass(Tcl_Method method);
|
||||
TCLOOAPI Tcl_Class Tcl_MethodDeclarerClass(Tcl_Method method);
|
||||
/* 7 */
|
||||
EXTERN Tcl_Object Tcl_MethodDeclarerObject(Tcl_Method method);
|
||||
TCLOOAPI Tcl_Object Tcl_MethodDeclarerObject(Tcl_Method method);
|
||||
/* 8 */
|
||||
EXTERN int Tcl_MethodIsPublic(Tcl_Method method);
|
||||
TCLOOAPI int Tcl_MethodIsPublic(Tcl_Method method);
|
||||
/* 9 */
|
||||
EXTERN int Tcl_MethodIsType(Tcl_Method method,
|
||||
TCLOOAPI int Tcl_MethodIsType(Tcl_Method method,
|
||||
const Tcl_MethodType *typePtr,
|
||||
ClientData *clientDataPtr);
|
||||
/* 10 */
|
||||
EXTERN Tcl_Obj * Tcl_MethodName(Tcl_Method method);
|
||||
TCLOOAPI Tcl_Obj * Tcl_MethodName(Tcl_Method method);
|
||||
/* 11 */
|
||||
EXTERN Tcl_Method Tcl_NewInstanceMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Method Tcl_NewInstanceMethod(Tcl_Interp *interp,
|
||||
Tcl_Object object, Tcl_Obj *nameObj,
|
||||
int isPublic, const Tcl_MethodType *typePtr,
|
||||
ClientData clientData);
|
||||
/* 12 */
|
||||
EXTERN Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
|
||||
TCLOOAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls,
|
||||
Tcl_Obj *nameObj, int isPublic,
|
||||
const Tcl_MethodType *typePtr,
|
||||
ClientData clientData);
|
||||
/* 13 */
|
||||
EXTERN Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp,
|
||||
Tcl_Class cls, const char *nameStr,
|
||||
const char *nsNameStr, int objc,
|
||||
Tcl_Obj *const *objv, int skip);
|
||||
/* 14 */
|
||||
EXTERN int Tcl_ObjectDeleted(Tcl_Object object);
|
||||
TCLOOAPI int Tcl_ObjectDeleted(Tcl_Object object);
|
||||
/* 15 */
|
||||
EXTERN int Tcl_ObjectContextIsFiltering(
|
||||
TCLOOAPI int Tcl_ObjectContextIsFiltering(
|
||||
Tcl_ObjectContext context);
|
||||
/* 16 */
|
||||
EXTERN Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context);
|
||||
TCLOOAPI Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context);
|
||||
/* 17 */
|
||||
EXTERN Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context);
|
||||
TCLOOAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context);
|
||||
/* 18 */
|
||||
EXTERN int Tcl_ObjectContextSkippedArgs(
|
||||
TCLOOAPI int Tcl_ObjectContextSkippedArgs(
|
||||
Tcl_ObjectContext context);
|
||||
/* 19 */
|
||||
EXTERN ClientData Tcl_ClassGetMetadata(Tcl_Class clazz,
|
||||
TCLOOAPI ClientData Tcl_ClassGetMetadata(Tcl_Class clazz,
|
||||
const Tcl_ObjectMetadataType *typePtr);
|
||||
/* 20 */
|
||||
EXTERN void Tcl_ClassSetMetadata(Tcl_Class clazz,
|
||||
TCLOOAPI void Tcl_ClassSetMetadata(Tcl_Class clazz,
|
||||
const Tcl_ObjectMetadataType *typePtr,
|
||||
ClientData metadata);
|
||||
/* 21 */
|
||||
EXTERN ClientData Tcl_ObjectGetMetadata(Tcl_Object object,
|
||||
TCLOOAPI ClientData Tcl_ObjectGetMetadata(Tcl_Object object,
|
||||
const Tcl_ObjectMetadataType *typePtr);
|
||||
/* 22 */
|
||||
EXTERN void Tcl_ObjectSetMetadata(Tcl_Object object,
|
||||
TCLOOAPI void Tcl_ObjectSetMetadata(Tcl_Object object,
|
||||
const Tcl_ObjectMetadataType *typePtr,
|
||||
ClientData metadata);
|
||||
/* 23 */
|
||||
EXTERN int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
|
||||
TCLOOAPI int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp,
|
||||
Tcl_ObjectContext context, int objc,
|
||||
Tcl_Obj *const *objv, int skip);
|
||||
/* 24 */
|
||||
EXTERN Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
|
||||
TCLOOAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper(
|
||||
Tcl_Object object);
|
||||
/* 25 */
|
||||
EXTERN void Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
|
||||
TCLOOAPI void Tcl_ObjectSetMethodNameMapper(Tcl_Object object,
|
||||
Tcl_ObjectMapMethodNameProc *mapMethodNameProc);
|
||||
/* 26 */
|
||||
EXTERN void Tcl_ClassSetConstructor(Tcl_Interp *interp,
|
||||
TCLOOAPI void Tcl_ClassSetConstructor(Tcl_Interp *interp,
|
||||
Tcl_Class clazz, Tcl_Method method);
|
||||
/* 27 */
|
||||
EXTERN void Tcl_ClassSetDestructor(Tcl_Interp *interp,
|
||||
TCLOOAPI void Tcl_ClassSetDestructor(Tcl_Interp *interp,
|
||||
Tcl_Class clazz, Tcl_Method method);
|
||||
/* 28 */
|
||||
EXTERN Tcl_Obj * Tcl_GetObjectName(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Obj * Tcl_GetObjectName(Tcl_Interp *interp,
|
||||
Tcl_Object object);
|
||||
|
||||
typedef struct {
|
||||
@@ -226,7 +227,4 @@ extern const TclOOStubs *tclOOStubsPtr;
|
||||
#endif /* defined(USE_TCLOO_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
#endif /* _TCLOODECLS */
|
||||
|
||||
+16
-30
@@ -5,17 +5,6 @@
|
||||
#ifndef _TCLOOINTDECLS
|
||||
#define _TCLOOINTDECLS
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#else
|
||||
# ifdef USE_TCL_STUBS
|
||||
# define TCL_STORAGE_CLASS
|
||||
# else
|
||||
# define TCL_STORAGE_CLASS DLLIMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
/*
|
||||
@@ -23,46 +12,46 @@
|
||||
*/
|
||||
|
||||
/* 0 */
|
||||
EXTERN Tcl_Object TclOOGetDefineCmdContext(Tcl_Interp *interp);
|
||||
TCLOOAPI Tcl_Object TclOOGetDefineCmdContext(Tcl_Interp *interp);
|
||||
/* 1 */
|
||||
EXTERN Tcl_Method TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Method TclOOMakeProcInstanceMethod(Tcl_Interp *interp,
|
||||
Object *oPtr, int flags, Tcl_Obj *nameObj,
|
||||
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
|
||||
const Tcl_MethodType *typePtr,
|
||||
ClientData clientData, Proc **procPtrPtr);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Method TclOOMakeProcMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Method TclOOMakeProcMethod(Tcl_Interp *interp,
|
||||
Class *clsPtr, int flags, Tcl_Obj *nameObj,
|
||||
const char *namePtr, Tcl_Obj *argsObj,
|
||||
Tcl_Obj *bodyObj,
|
||||
const Tcl_MethodType *typePtr,
|
||||
ClientData clientData, Proc **procPtrPtr);
|
||||
/* 3 */
|
||||
EXTERN Method * TclOONewProcInstanceMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Method * TclOONewProcInstanceMethod(Tcl_Interp *interp,
|
||||
Object *oPtr, int flags, Tcl_Obj *nameObj,
|
||||
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
|
||||
ProcedureMethod **pmPtrPtr);
|
||||
/* 4 */
|
||||
EXTERN Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
|
||||
TCLOOAPI Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr,
|
||||
int flags, Tcl_Obj *nameObj,
|
||||
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
|
||||
ProcedureMethod **pmPtrPtr);
|
||||
/* 5 */
|
||||
EXTERN int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
|
||||
TCLOOAPI int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *const *objv,
|
||||
int publicOnly, Class *startCls);
|
||||
/* 6 */
|
||||
EXTERN int TclOOIsReachable(Class *targetPtr, Class *startPtr);
|
||||
TCLOOAPI int TclOOIsReachable(Class *targetPtr, Class *startPtr);
|
||||
/* 7 */
|
||||
EXTERN Method * TclOONewForwardMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Method * TclOONewForwardMethod(Tcl_Interp *interp,
|
||||
Class *clsPtr, int isPublic,
|
||||
Tcl_Obj *nameObj, Tcl_Obj *prefixObj);
|
||||
/* 8 */
|
||||
EXTERN Method * TclOONewForwardInstanceMethod(Tcl_Interp *interp,
|
||||
TCLOOAPI Method * TclOONewForwardInstanceMethod(Tcl_Interp *interp,
|
||||
Object *oPtr, int isPublic, Tcl_Obj *nameObj,
|
||||
Tcl_Obj *prefixObj);
|
||||
/* 9 */
|
||||
EXTERN Tcl_Method TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Method TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
|
||||
Tcl_Object oPtr,
|
||||
TclOO_PreCallProc *preCallPtr,
|
||||
TclOO_PostCallProc *postCallPtr,
|
||||
@@ -71,7 +60,7 @@ EXTERN Tcl_Method TclOONewProcInstanceMethodEx(Tcl_Interp *interp,
|
||||
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
|
||||
int flags, void **internalTokenPtr);
|
||||
/* 10 */
|
||||
EXTERN Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
|
||||
TCLOOAPI Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
|
||||
Tcl_Class clsPtr,
|
||||
TclOO_PreCallProc *preCallPtr,
|
||||
TclOO_PostCallProc *postCallPtr,
|
||||
@@ -80,22 +69,22 @@ EXTERN Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp,
|
||||
Tcl_Obj *argsObj, Tcl_Obj *bodyObj,
|
||||
int flags, void **internalTokenPtr);
|
||||
/* 11 */
|
||||
EXTERN int TclOOInvokeObject(Tcl_Interp *interp,
|
||||
TCLOOAPI int TclOOInvokeObject(Tcl_Interp *interp,
|
||||
Tcl_Object object, Tcl_Class startCls,
|
||||
int publicPrivate, int objc,
|
||||
Tcl_Obj *const *objv);
|
||||
/* 12 */
|
||||
EXTERN void TclOOObjectSetFilters(Object *oPtr, int numFilters,
|
||||
TCLOOAPI void TclOOObjectSetFilters(Object *oPtr, int numFilters,
|
||||
Tcl_Obj *const *filters);
|
||||
/* 13 */
|
||||
EXTERN void TclOOClassSetFilters(Tcl_Interp *interp,
|
||||
TCLOOAPI void TclOOClassSetFilters(Tcl_Interp *interp,
|
||||
Class *classPtr, int numFilters,
|
||||
Tcl_Obj *const *filters);
|
||||
/* 14 */
|
||||
EXTERN void TclOOObjectSetMixins(Object *oPtr, int numMixins,
|
||||
TCLOOAPI void TclOOObjectSetMixins(Object *oPtr, int numMixins,
|
||||
Class *const *mixins);
|
||||
/* 15 */
|
||||
EXTERN void TclOOClassSetMixins(Tcl_Interp *interp,
|
||||
TCLOOAPI void TclOOClassSetMixins(Tcl_Interp *interp,
|
||||
Class *classPtr, int numMixins,
|
||||
Class *const *mixins);
|
||||
|
||||
@@ -171,7 +160,4 @@ extern const TclOOIntStubs *tclOOIntStubsPtr;
|
||||
#endif /* defined(USE_TCLOO_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
#endif /* _TCLOOINTDECLS */
|
||||
|
||||
@@ -27,6 +27,8 @@ const TclOOIntStubs *tclOOIntStubsPtr = NULL;
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#undef TclOOInitializeStubs
|
||||
|
||||
MODULE_SCOPE const char *
|
||||
TclOOInitializeStubs(
|
||||
Tcl_Interp *interp,
|
||||
|
||||
+12
-1
@@ -11,7 +11,7 @@
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclOOInt.h"
|
||||
|
||||
MODULE_SCOPE const TclStubs *tclStubsPtr;
|
||||
MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr;
|
||||
@@ -115,6 +115,17 @@ Tcl_InitStubs(
|
||||
tclIntPlatStubsPtr = NULL;
|
||||
}
|
||||
|
||||
if ((actualVersion[0] > '8')
|
||||
|| ((actualVersion[1] == '.') && (actualVersion[2] > '5'))) {
|
||||
stubsPtr->tcl_PkgRequireEx(interp,
|
||||
"TclOO", "1.0", 0, (void *)&tclOOStubsPtr);
|
||||
if (tclOOStubsPtr->hooks) {
|
||||
tclOOIntStubsPtr = tclOOStubsPtr->hooks->tclOOIntStubs;
|
||||
} else {
|
||||
tclOOIntStubsPtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return actualVersion;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user