summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclOO.c11
-rw-r--r--generic/tclOOCall.c26
-rw-r--r--generic/tclOODecls.h12
-rw-r--r--generic/tclOOIntDecls.h16
-rw-r--r--generic/tclOOMethod.c4
-rw-r--r--generic/tclOOStubInit.c12
-rw-r--r--generic/tclOOStubLib.c25
7 files changed, 56 insertions, 50 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 73b1034..ef939e8 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOO.c,v 1.5 2008/05/31 22:29:45 dkf Exp $
+ * RCS: @(#) $Id: tclOO.c,v 1.6 2008/05/31 23:35:27 das Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -118,7 +118,7 @@ static char initScript[] =
/* "tcl_findLibrary tcloo $oo::version $oo::version" */
/* " tcloo.tcl OO_LIBRARY oo::library;"; */
-extern struct TclOOStubAPI tclOOStubAPI;
+MODULE_SCOPE const struct TclOOStubAPI * const tclOOStubAPIPtr;
/*
* Convenience macro for getting the foundation from an interpreter.
@@ -163,7 +163,8 @@ TclOOInit(
return TCL_ERROR;
}
- return Tcl_PkgProvideEx(interp, "TclOO", TCLOO_VERSION, &tclOOStubAPI);
+ return Tcl_PkgProvideEx(interp, "TclOO", TCLOO_VERSION,
+ (ClientData) tclOOStubAPIPtr);
}
/*
@@ -246,14 +247,14 @@ InitFoundation(
Tcl_DStringAppend(&buffer, "::oo::define::", 14);
Tcl_DStringAppend(&buffer, defineCmds[i].name, -1);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
- defineCmds[i].objProc, (void *) defineCmds[i].flag, NULL);
+ defineCmds[i].objProc, INT2PTR(defineCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
}
for (i=0 ; objdefCmds[i].name ; i++) {
Tcl_DStringAppend(&buffer, "::oo::objdefine::", 17);
Tcl_DStringAppend(&buffer, objdefCmds[i].name, -1);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
- objdefCmds[i].objProc, (void *) objdefCmds[i].flag, NULL);
+ objdefCmds[i].objProc, INT2PTR(objdefCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
}
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index 551a3fd..8a4024d 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOCall.c,v 1.4 2008/05/31 11:42:17 dkf Exp $
+ * RCS: @(#) $Id: tclOOCall.c,v 1.5 2008/05/31 23:35:27 das Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -359,7 +359,7 @@ TclOOGetSortedMethodList(
isWantedIn = ((!(flags & PUBLIC_METHOD)
|| mPtr->flags & PUBLIC_METHOD) ? IN_LIST : 0);
isWantedIn |= (mPtr->typePtr == NULL ? NO_IMPLEMENTATION : 0);
- Tcl_SetHashValue(hPtr, (void *) isWantedIn);
+ Tcl_SetHashValue(hPtr, INT2PTR(isWantedIn));
}
}
}
@@ -379,12 +379,12 @@ TclOOGetSortedMethodList(
if (mPtr->typePtr == NULL) {
isWantedIn |= NO_IMPLEMENTATION;
}
- Tcl_SetHashValue(hPtr, (void *) isWantedIn);
+ Tcl_SetHashValue(hPtr, INT2PTR(isWantedIn));
} else if (mPtr->typePtr != NULL) {
- isWantedIn = (int) Tcl_GetHashValue(hPtr);
+ isWantedIn = PTR2INT(Tcl_GetHashValue(hPtr));
if (isWantedIn & NO_IMPLEMENTATION) {
isWantedIn &= ~NO_IMPLEMENTATION;
- Tcl_SetHashValue(hPtr, (void *) isWantedIn);
+ Tcl_SetHashValue(hPtr, INT2PTR(isWantedIn));
}
}
}
@@ -418,8 +418,8 @@ TclOOGetSortedMethodList(
strings = (const char **) ckalloc(sizeof(char *) * names.numEntries);
FOREACH_HASH(namePtr, isWanted, &names) {
- if (!(flags & PUBLIC_METHOD) || (((int)isWanted) & IN_LIST)) {
- if (((int)isWanted) & NO_IMPLEMENTATION) {
+ if (!(flags & PUBLIC_METHOD) || (PTR2INT(isWanted) & IN_LIST)) {
+ if (PTR2INT(isWanted) & NO_IMPLEMENTATION) {
continue;
}
strings[i++] = TclGetString(namePtr);
@@ -479,8 +479,8 @@ TclOOGetSortedClassMethodList(
strings = (const char **) ckalloc(sizeof(char *) * names.numEntries);
FOREACH_HASH(namePtr, isWanted, &names) {
- if (!(flags & PUBLIC_METHOD) || (((int)isWanted) & IN_LIST)) {
- if (((int)isWanted) & NO_IMPLEMENTATION) {
+ if (!(flags & PUBLIC_METHOD) || (PTR2INT(isWanted) & IN_LIST)) {
+ if (PTR2INT(isWanted) & NO_IMPLEMENTATION) {
continue;
}
strings[i++] = TclGetString(namePtr);
@@ -567,13 +567,13 @@ AddClassMethodNames(
int isWanted = (!(flags & PUBLIC_METHOD)
|| (mPtr->flags & PUBLIC_METHOD)) ? IN_LIST : 0;
- Tcl_SetHashValue(hPtr, (void *) isWanted);
- } else if ((((int)Tcl_GetHashValue(hPtr)) & NO_IMPLEMENTATION)
+ Tcl_SetHashValue(hPtr, INT2PTR(isWanted));
+ } else if ((PTR2INT(Tcl_GetHashValue(hPtr)) & NO_IMPLEMENTATION)
&& mPtr->typePtr != NULL) {
- int isWanted = (int) Tcl_GetHashValue(hPtr);
+ int isWanted = PTR2INT(Tcl_GetHashValue(hPtr));
isWanted &= ~NO_IMPLEMENTATION;
- Tcl_SetHashValue(hPtr, (void *) isWanted);
+ Tcl_SetHashValue(hPtr, INT2PTR(isWanted));
}
}
diff --git a/generic/tclOODecls.h b/generic/tclOODecls.h
index d67333b..17e140c 100644
--- a/generic/tclOODecls.h
+++ b/generic/tclOODecls.h
@@ -1,5 +1,5 @@
/*
- * $Id: tclOODecls.h,v 1.1 2008/05/31 11:42:18 dkf Exp $
+ * $Id: tclOODecls.h,v 1.2 2008/05/31 23:35:27 das Exp $
*
* This file is (mostly) automatically generated from tclOO.decls.
*/
@@ -118,7 +118,7 @@ typedef struct TclOOStubs {
int magic;
int epoch;
int revision;
- struct TclOOStubHooks *hooks;
+ CONST struct TclOOStubHooks *hooks;
Tcl_Object (*tcl_CopyObjectInstance) (Tcl_Interp * interp, Tcl_Object sourceObject, const char * targetName, const char * targetNamespaceName); /* 0 */
Tcl_Object (*tcl_GetClassAsObject) (Tcl_Class clazz); /* 1 */
@@ -150,13 +150,7 @@ typedef struct TclOOStubs {
void (*tcl_ClassSetDestructor) (Tcl_Interp * interp, Tcl_Class clazz, Tcl_Method method); /* 27 */
} TclOOStubs;
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern const TclOOStubs *tclOOStubsPtr;
-#ifdef __cplusplus
-}
-#endif
+extern CONST TclOOStubs *tclOOStubsPtr;
#if defined(USE_TCLOO_STUBS)
diff --git a/generic/tclOOIntDecls.h b/generic/tclOOIntDecls.h
index e39b457..f0a94dc 100644
--- a/generic/tclOOIntDecls.h
+++ b/generic/tclOOIntDecls.h
@@ -1,5 +1,5 @@
/*
- * $Id: tclOOIntDecls.h,v 1.1 2008/05/31 11:42:18 dkf Exp $
+ * $Id: tclOOIntDecls.h,v 1.2 2008/05/31 23:35:27 das Exp $
*
* This file is (mostly) automatically generated from tclOO.decls.
*/
@@ -100,7 +100,7 @@ typedef struct TclOOIntStubs {
int magic;
int epoch;
int revision;
- struct TclOOIntStubHooks *hooks;
+ CONST struct TclOOIntStubHooks *hooks;
Tcl_Object (*tclOOGetDefineCmdContext) (Tcl_Interp * interp); /* 0 */
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); /* 1 */
@@ -120,13 +120,7 @@ typedef struct TclOOIntStubs {
void (*tclOOClassSetMixins) (Tcl_Interp * interp, Class * classPtr, int numMixins, Class *const * mixins); /* 15 */
} TclOOIntStubs;
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern const TclOOIntStubs *tclOOIntStubsPtr;
-#ifdef __cplusplus
-}
-#endif
+extern CONST TclOOIntStubs *tclOOIntStubsPtr;
#if defined(USE_TCLOO_STUBS)
@@ -204,6 +198,6 @@ extern const TclOOIntStubs *tclOOIntStubsPtr;
/* !END!: Do not edit above this line. */
struct TclOOStubAPI {
- TclOOStubs *stubsPtr;
- TclOOIntStubs *intStubsPtr;
+ CONST TclOOStubs *stubsPtr;
+ CONST TclOOIntStubs *intStubsPtr;
};
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index 21e0869..9d53d6a 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOMethod.c,v 1.2 2008/05/31 22:29:46 dkf Exp $
+ * RCS: @(#) $Id: tclOOMethod.c,v 1.3 2008/05/31 23:35:27 das Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -915,7 +915,7 @@ ConstructorErrorHandler(
const char *objectName, *kindName;
int objectNameLen;
- if (interp->errorLine == 0xDEADBEEF) {
+ if (interp->errorLine == (int) 0xDEADBEEF) {
/*
* Horrible hack to deal with certain constructors that must not add
* information to the error trace.
diff --git a/generic/tclOOStubInit.c b/generic/tclOOStubInit.c
index b49dc12..7c7a3cc 100644
--- a/generic/tclOOStubInit.c
+++ b/generic/tclOOStubInit.c
@@ -1,5 +1,5 @@
/*
- * $Id: tclOOStubInit.c,v 1.1 2008/05/31 11:42:19 dkf Exp $
+ * $Id: tclOOStubInit.c,v 1.2 2008/05/31 23:35:27 das Exp $
*
* This file is (mostly) automatically generated from tclOO.decls.
* It is compiled and linked in with the tclOO package proper.
@@ -13,7 +13,7 @@
/* !BEGIN!: Do not edit below this line. */
-TclOOStubs tclOOStubs = {
+static const TclOOStubs tclOOStubs = {
TCL_STUB_MAGIC,
TCLOO_STUBS_EPOCH,
TCLOO_STUBS_REVISION,
@@ -48,7 +48,7 @@ TclOOStubs tclOOStubs = {
Tcl_ClassSetDestructor, /* 27 */
};
-TclOOIntStubs tclOOIntStubs = {
+static const TclOOIntStubs tclOOIntStubs = {
TCL_STUB_MAGIC,
TCLOOINT_STUBS_EPOCH,
TCLOOINT_STUBS_REVISION,
@@ -73,7 +73,11 @@ TclOOIntStubs tclOOIntStubs = {
/* !END!: Do not edit above this line. */
-struct TclOOStubAPI tclOOStubAPI = {
+static const struct TclOOStubAPI tclOOStubAPI = {
&tclOOStubs,
&tclOOIntStubs
};
+
+MODULE_SCOPE const struct TclOOStubAPI * const tclOOStubAPIPtr;
+const struct TclOOStubAPI * const tclOOStubAPIPtr = &tclOOStubAPI;
+
diff --git a/generic/tclOOStubLib.c b/generic/tclOOStubLib.c
index 6988638..fe3b6be 100644
--- a/generic/tclOOStubLib.c
+++ b/generic/tclOOStubLib.c
@@ -1,8 +1,16 @@
/*
- * $Id: tclOOStubLib.c,v 1.1 2008/05/31 11:42:19 dkf Exp $
+ * $Id: tclOOStubLib.c,v 1.2 2008/05/31 23:35:28 das Exp $
* ORIGINAL SOURCE: tk/generic/tkStubLib.c, version 1.9 2004/03/17
*/
+/*
+ * We need to ensure that we use the tcl stub macros so that this file
+ * contains no references to any of the tcl stub functions.
+ */
+
+#undef USE_TCL_STUBS
+#define USE_TCL_STUBS
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -12,8 +20,11 @@
#include "tclOO.h"
#include "tclOOInt.h"
-const TclOOStubs *tclOOStubsPtr;
-const TclOOIntStubs *tclOOIntStubsPtr;
+MODULE_SCOPE const TclOOStubs *tclOOStubsPtr;
+MODULE_SCOPE const TclOOIntStubs *tclOOIntStubsPtr;
+
+const TclOOStubs *tclOOStubsPtr = NULL;
+const TclOOIntStubs *tclOOIntStubsPtr = NULL;
/*
*----------------------------------------------------------------------
@@ -29,9 +40,11 @@ const TclOOIntStubs *tclOOIntStubsPtr;
* Side effects:
* Sets the stub table pointer.
*
+ *----------------------------------------------------------------------
*/
-const char *TclOOInitializeStubs(
+MODULE_SCOPE const char *
+TclOOInitializeStubs(
Tcl_Interp *interp, const char *version, int epoch, int revision)
{
int exact = 0;
@@ -48,8 +61,8 @@ const char *TclOOInitializeStubs(
"package not present or incomplete", NULL);
return NULL;
} else {
- TclOOStubs *stubsPtr = stubsAPIPtr->stubsPtr;
- TclOOIntStubs *intStubsPtr = stubsAPIPtr->intStubsPtr;
+ const TclOOStubs * const stubsPtr = stubsAPIPtr->stubsPtr;
+ const TclOOIntStubs * const intStubsPtr = stubsAPIPtr->intStubsPtr;
if (!actualVersion) {
return NULL;