summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2008-04-16 14:49:28 (GMT)
committerdas <das>2008-04-16 14:49:28 (GMT)
commitafd0f9b3f6990bb1d44b22b117df3fbb4a535a85 (patch)
tree9f4d763e4feec43980c4ccc9d7e151d0af7b0c91
parentf2cc98583dc54f92e54639280c862772682ad3ab (diff)
downloadtcl-afd0f9b3f6990bb1d44b22b117df3fbb4a535a85.zip
tcl-afd0f9b3f6990bb1d44b22b117df3fbb4a535a85.tar.gz
tcl-afd0f9b3f6990bb1d44b22b117df3fbb4a535a85.tar.bz2
* generic/tclInt.h: make stubs tables 'static const' and
* generic/tclStubInit.c: export only module-scope pointers to * generic/tclStubLib.c: the main stubs tables (for package * tools/genStubs.tcl: initialization). [Patch 1938497] * generic/tclBasic.c (Tcl_CreateInterp): * generic/tclTomMathInterface.c (TclTommath_Init):
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclBasic.c9
-rw-r--r--generic/tclInt.h5
-rw-r--r--generic/tclStubInit.c29
-rw-r--r--generic/tclStubLib.c4
-rw-r--r--generic/tclTomMathInterface.c6
-rw-r--r--tools/genStubs.tcl4
7 files changed, 39 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b2270f..baf04cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-04-16 Daniel Steffen <das@users.sourceforge.net>
+ * generic/tclInt.h: make stubs tables 'static const' and
+ * generic/tclStubInit.c: export only module-scope pointers to
+ * generic/tclStubLib.c: the main stubs tables (for package
+ * tools/genStubs.tcl: initialization). [Patch 1938497]
+ * generic/tclBasic.c (Tcl_CreateInterp):
+ * generic/tclTomMathInterface.c (TclTommath_Init):
+
* generic/tclInt.h: revise Tcl_SetNotifier() to use a
* generic/tclNotify.c: module-scope hooks table instead of
* generic/tclStubInit.c: runtime stubs-table modification;
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 87b251f..8e46a77 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.296 2008/04/01 16:23:40 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.297 2008/04/16 14:49:28 das Exp $
*/
#include "tclInt.h"
@@ -98,7 +98,7 @@ static int DTraceObjCmd(ClientData dummy, Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
#endif
-extern TclStubs tclStubs;
+MODULE_SCOPE const TclStubs * const tclConstStubsPtr;
/*
* The following structure define the commands in the Tcl core.
@@ -582,7 +582,7 @@ Tcl_CreateInterp(void)
* Initialise the stub table pointer.
*/
- iPtr->stubTable = &tclStubs;
+ iPtr->stubTable = tclConstStubsPtr;
/*
* Initialize the ensemble error message rewriting support.
@@ -808,7 +808,8 @@ Tcl_CreateInterp(void)
* TIP #268: Full patchlevel instead of just major.minor
*/
- Tcl_PkgProvideEx(interp, "Tcl", TCL_PATCH_LEVEL, &tclStubs);
+ Tcl_PkgProvideEx(interp, "Tcl", TCL_PATCH_LEVEL,
+ (ClientData) tclConstStubsPtr);
if (TclTommath_Init(interp) != TCL_OK) {
Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp)));
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 7af390d..f2a125b 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.364 2008/04/16 14:29:25 das Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.365 2008/04/16 14:49:29 das Exp $
*/
#ifndef _TCLINT
@@ -1605,7 +1605,8 @@ typedef struct Interp {
int errorLine; /* When TCL_ERROR is returned, this gives the
* line number in the command where the error
* occurred (1 means first line). */
- struct TclStubs *stubTable; /* Pointer to the exported Tcl stub table. On
+ const struct TclStubs *stubTable;
+ /* Pointer to the exported Tcl stub table. On
* previous versions of Tcl this is a pointer
* to the objResultPtr or a pointer to a
* buckets array in a hash table. We therefore
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index f3b87e1..463eb55 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.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: tclStubInit.c,v 1.152 2008/04/16 14:29:26 das Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.153 2008/04/16 14:49:29 das Exp $
*/
#include "tclInt.h"
@@ -34,12 +34,6 @@
#undef Tcl_FindHashEntry
#undef Tcl_CreateHashEntry
-MODULE_SCOPE TclIntStubs tclIntStubs;
-MODULE_SCOPE TclIntPlatStubs tclIntPlatStubs;
-MODULE_SCOPE TclPlatStubs tclPlatStubs;
-MODULE_SCOPE TclStubs tclStubs;
-MODULE_SCOPE TclTomMathStubs tclTomMathStubs;
-
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -48,7 +42,7 @@ MODULE_SCOPE TclTomMathStubs tclTomMathStubs;
/* !BEGIN!: Do not edit below this line. */
-TclIntStubs tclIntStubs = {
+static const TclIntStubs tclIntStubs = {
TCL_STUB_MAGIC,
NULL,
NULL, /* 0 */
@@ -314,7 +308,7 @@ TclIntStubs tclIntStubs = {
TclBackgroundException, /* 236 */
};
-TclIntPlatStubs tclIntPlatStubs = {
+static const TclIntPlatStubs tclIntPlatStubs = {
TCL_STUB_MAGIC,
NULL,
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
@@ -389,7 +383,7 @@ TclIntPlatStubs tclIntPlatStubs = {
#endif /* MACOSX */
};
-TclPlatStubs tclPlatStubs = {
+static const TclPlatStubs tclPlatStubs = {
TCL_STUB_MAGIC,
NULL,
#ifdef __WIN32__ /* WIN */
@@ -402,7 +396,7 @@ TclPlatStubs tclPlatStubs = {
#endif /* MACOSX */
};
-TclTomMathStubs tclTomMathStubs = {
+static const TclTomMathStubs tclTomMathStubs = {
TCL_STUB_MAGIC,
NULL,
TclBN_epoch, /* 0 */
@@ -474,7 +468,7 @@ static const TclStubHooks tclStubHooks = {
&tclIntPlatStubs
};
-TclStubs tclStubs = {
+static const TclStubs tclStubs = {
TCL_STUB_MAGIC,
&tclStubHooks,
Tcl_PkgProvideEx, /* 0 */
@@ -1108,3 +1102,14 @@ TclStubs tclStubs = {
};
/* !END!: Do not edit above this line. */
+
+/*
+ * Module-scope pointers to the main static stubs tables, used for package
+ * initialization via Tcl_PkgProvideEx().
+ */
+
+MODULE_SCOPE const TclStubs * const tclConstStubsPtr;
+MODULE_SCOPE const TclTomMathStubs * const tclTomMathConstStubsPtr;
+
+const TclStubs * const tclConstStubsPtr = &tclStubs;
+const TclTomMathStubs * const tclTomMathConstStubsPtr = &tclTomMathStubs;
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index a724a09..81e82d7 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubLib.c,v 1.24 2008/04/02 21:29:05 das Exp $
+ * RCS: @(#) $Id: tclStubLib.c,v 1.25 2008/04/16 14:49:29 das Exp $
*/
/*
@@ -36,7 +36,7 @@ const TclIntStubs *tclIntStubsPtr = NULL;
const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
const TclTomMathStubs* tclTomMathStubsPtr = NULL;
-static TclStubs *
+static const TclStubs *
HasStubSupport(
Tcl_Interp *interp)
{
diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c
index 6e52245..ddd5908 100644
--- a/generic/tclTomMathInterface.c
+++ b/generic/tclTomMathInterface.c
@@ -11,14 +11,14 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTomMathInterface.c,v 1.10 2007/12/13 15:23:20 dgp Exp $
+ * RCS: @(#) $Id: tclTomMathInterface.c,v 1.11 2008/04/16 14:49:29 das Exp $
*/
#include "tclInt.h"
#include "tommath.h"
#include <limits.h>
-extern TclTomMathStubs tclTomMathStubs;
+MODULE_SCOPE const TclTomMathStubs * const tclTomMathConstStubsPtr;
/*
*----------------------------------------------------------------------
@@ -45,7 +45,7 @@ TclTommath_Init(
/* TIP #268: Full patchlevel instead of just major.minor */
if (Tcl_PkgProvideEx(interp, "tcl::tommath", TCL_PATCH_LEVEL,
- (ClientData)&tclTomMathStubs) != TCL_OK) {
+ (ClientData) tclTomMathConstStubsPtr) != TCL_OK) {
return TCL_ERROR;
}
return TCL_OK;
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index ab5ebbc..ec70115 100644
--- a/tools/genStubs.tcl
+++ b/tools/genStubs.tcl
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: genStubs.tcl,v 1.25 2008/04/08 14:52:45 das Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.26 2008/04/16 14:49:29 das Exp $
package require Tcl 8.4
@@ -1056,7 +1056,7 @@ proc genStubs::emitInit {name textVar} {
}
append text "\n\};\n"
}
- append text "\n${capName}Stubs ${name}Stubs = \{\n"
+ append text "\nstatic const ${capName}Stubs ${name}Stubs = \{\n"
append text " TCL_STUB_MAGIC,\n"
if {[info exists hooks($name)]} {
append text " &${name}StubHooks,\n"