From c15ddd7ee91e72940a679b63fe643f1a21b4b006 Mon Sep 17 00:00:00 2001 From: das Date: Sat, 31 May 2008 23:35:27 +0000 Subject: * generic/tclOOStubLib.c: ensure use of tcl stubs; include in * unix/Makefile.in: stub lib; disable broken tclOO genstubs * generic/tclOO.c: make tclOO stubs tables 'static const' * generic/tclOODecls.h: and stub table pointers MODULE_SCOPE * generic/tclOOIntDecls.h: (change generated files manually * generic/tclOOStubInit.c: pending genstubs support for tclOO). * generic/tclOOStubLib.c: * generic/tclOO.c: fix warnings for 'int<->ptr conversion' * generic/tclOOCall.c: and 'signed vs unsigned comparison'. * generic/tclOOMethod.c: --- ChangeLog | 26 ++++++++++++++++++++++++++ generic/tclOO.c | 11 ++++++----- generic/tclOOCall.c | 26 +++++++++++++------------- generic/tclOODecls.h | 12 +++--------- generic/tclOOIntDecls.h | 16 +++++----------- generic/tclOOMethod.c | 4 ++-- generic/tclOOStubInit.c | 12 ++++++++---- generic/tclOOStubLib.c | 25 +++++++++++++++++++------ unix/Makefile.in | 8 +++++--- 9 files changed, 87 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0395762..011864d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2008-06-01 Daniel Steffen + + * generic/tclOOStubLib.c: ensure use of tcl stubs; include in + * unix/Makefile.in: stub lib; disable broken tclOO genstubs + + * generic/tclOO.c: make tclOO stubs tables 'static const' + * generic/tclOODecls.h: and stub table pointers MODULE_SCOPE + * generic/tclOOIntDecls.h: (change generated files manually + * generic/tclOOStubInit.c: pending genstubs support for tclOO). + * generic/tclOOStubLib.c: + + * generic/tclOO.c: fix warnings for 'int<->ptr conversion' + * generic/tclOOCall.c: and 'signed vs unsigned comparison'. + * generic/tclOOMethod.c: + + * tests/msgcat.test: fix for ::tcl::mac::locale with @modifier. + + * tools/tsdPerf.tcl: use [info sharedlibextension] + + * unix/tclConfig.h.in: autoheader-2.59 + + * macosx/Tcl.xcodeproj/project.pbxproj: add new tclOO files; add debug + * macosx/README: targets with corefoundation + disabled and with gcov; update + to Xcode 3.1. + 2008-05-31 Donal K. Fellows * generic/tclOO.c (InitFoundation): Correct reference counting for 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; diff --git a/unix/Makefile.in b/unix/Makefile.in index 25a067c..1db3616 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.234 2008/05/31 11:42:21 dkf Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.235 2008/05/31 23:35:28 das Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -317,7 +317,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o \ bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o -STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS} +STUB_LIB_OBJS = tclStubLib.o tclOOStubLib.o ${COMPAT_OBJS} UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ tclUnixFile.o tclUnixPipe.o tclUnixSock.o \ @@ -1574,7 +1574,9 @@ $(GENERIC_DIR)/tclOOStubInit.c: $(GENERIC_DIR)/tclOO.decls genstubs: $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \ $(GENERIC_DIR)/tcl.decls $(GENERIC_DIR)/tclInt.decls \ - $(GENERIC_DIR)/tclTomMath.decls $(GENERIC_DIR)/tclOO.decls + $(GENERIC_DIR)/tclTomMath.decls +# disabled awaiting genStubs.tcl support: +#$(GENERIC_DIR)/tclOO.decls # # Target to check that all exported functions have an entry in the stubs -- cgit v0.12