Tcl Source Code

Artifact [a529e05d1e]
Login

Artifact a529e05d1e0b452fcd32b22efb534f52d627f1a3:

Attachment "tk-stubs-modulescope.diff" to ticket [1819422fff] added by das 2008-04-03 04:41:31.
Index: generic/tk.decls
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tk.decls,v
retrieving revision 1.38
diff -u -p -r1.38 tk.decls
--- generic/tk.decls	27 Mar 2008 12:03:33 -0000	1.38
+++ generic/tk.decls	2 Apr 2008 17:02:29 -0000
@@ -1154,28 +1154,6 @@ declare 10 aqua {
 # Public functions that are not accessible via the stubs table.
 
 export {
-    CONST char *Tk_InitStubs(Tcl_Interp *interp, CONST char *version,
-	    int exact)
-}
-export {
     CONST char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, CONST char *version,
 	    int exact)
 }
-
-# Global variables that need to be exported from the tcl shared library.
-
-export {
-    TkStubs *tkStubsPtr                         (fool checkstubs)
-}
-export {
-    TkPlatStubs *tkPlatStubsPtr                 (fool checkstubs)
-}
-export {
-    TkIntStubs *tkIntStubsPtr                   (fool checkstubs)
-}
-export {
-    TkIntPlatStubs *tkIntPlatStubsPtr           (fool checkstubs)
-}
-export {
-    TkIntXlibStubs *tkIntXlibStubsPtr           (fool checkstubs)
-}
Index: generic/tkDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkDecls.h,v
retrieving revision 1.31
diff -u -p -r1.31 tkDecls.h
--- generic/tkDecls.h	1 Apr 2008 16:30:53 -0000	1.31
+++ generic/tkDecls.h	2 Apr 2008 17:02:31 -0000
@@ -1696,15 +1696,15 @@ EXTERN void		Tk_CreateOldPhotoImageForma
 #endif
 
 typedef struct TkStubHooks {
-    struct TkPlatStubs *tkPlatStubs;
-    struct TkIntStubs *tkIntStubs;
-    struct TkIntPlatStubs *tkIntPlatStubs;
-    struct TkIntXlibStubs *tkIntXlibStubs;
+    CONST struct TkPlatStubs *tkPlatStubs;
+    CONST struct TkIntStubs *tkIntStubs;
+    CONST struct TkIntPlatStubs *tkIntPlatStubs;
+    CONST struct TkIntXlibStubs *tkIntXlibStubs;
 } TkStubHooks;
 
 typedef struct TkStubs {
     int magic;
-    struct TkStubHooks *hooks;
+    CONST struct TkStubHooks *hooks;
 
     void (*tk_MainLoop) (void); /* 0 */
     XColor * (*tk_3DBorderColor) (Tk_3DBorder border); /* 1 */
@@ -1983,15 +1983,7 @@ typedef struct TkStubs {
 } TkStubs;
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern TkStubs *tkStubsPtr;
-#ifdef __cplusplus
-}
-#endif
-
+EXTERN CONST TkStubs *tkStubsPtr;
 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
Index: generic/tkIntDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkIntDecls.h,v
retrieving revision 1.32
diff -u -p -r1.32 tkIntDecls.h
--- generic/tkIntDecls.h	1 Apr 2008 16:30:53 -0000	1.32
+++ generic/tkIntDecls.h	2 Apr 2008 17:02:31 -0000
@@ -961,7 +961,7 @@ EXTERN int		TkpTesttextCmd (ClientData d
 
 typedef struct TkIntStubs {
     int magic;
-    struct TkIntStubHooks *hooks;
+    CONST struct TkIntStubHooks *hooks;
 
     TkWindow * (*tkAllocWindow) (TkDisplay * dispPtr, int screenNum, TkWindow * parentPtr); /* 0 */
     void (*tkBezierPoints) (double control[], int numSteps, double * coordPtr); /* 1 */
@@ -1223,15 +1223,7 @@ typedef struct TkIntStubs {
 } TkIntStubs;
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern TkIntStubs *tkIntStubsPtr;
-#ifdef __cplusplus
-}
-#endif
-
+EXTERN CONST TkIntStubs *tkIntStubsPtr;
 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
Index: generic/tkIntPlatDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkIntPlatDecls.h,v
retrieving revision 1.30
diff -u -p -r1.30 tkIntPlatDecls.h
--- generic/tkIntPlatDecls.h	1 Apr 2008 16:30:53 -0000	1.30
+++ generic/tkIntPlatDecls.h	2 Apr 2008 17:02:32 -0000
@@ -556,7 +556,7 @@ EXTERN int		TkpTestsendCmd (ClientData c
 
 typedef struct TkIntPlatStubs {
     int magic;
-    struct TkIntPlatStubHooks *hooks;
+    CONST struct TkIntPlatStubHooks *hooks;
 
 #ifdef __WIN32__ /* WIN */
     char * (*tkAlignImageData) (XImage * image, int alignment, int bitOrder); /* 0 */
@@ -671,15 +671,7 @@ typedef struct TkIntPlatStubs {
 } TkIntPlatStubs;
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern TkIntPlatStubs *tkIntPlatStubsPtr;
-#ifdef __cplusplus
-}
-#endif
-
+EXTERN CONST TkIntPlatStubs *tkIntPlatStubsPtr;
 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
Index: generic/tkIntXlibDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkIntXlibDecls.h,v
retrieving revision 1.24
diff -u -p -r1.24 tkIntXlibDecls.h
--- generic/tkIntXlibDecls.h	1 Apr 2008 16:30:53 -0000	1.24
+++ generic/tkIntXlibDecls.h	2 Apr 2008 17:02:33 -0000
@@ -1212,7 +1212,7 @@ EXTERN int		XSync (Display * display, Bo
 
 typedef struct TkIntXlibStubs {
     int magic;
-    struct TkIntXlibStubHooks *hooks;
+    CONST struct TkIntXlibStubHooks *hooks;
 
 #ifdef __WIN32__ /* WIN */
     void (*xSetDashes) (Display * display, GC gc, int dash_offset, _Xconst char * dash_list, int n); /* 0 */
@@ -1420,15 +1420,7 @@ typedef struct TkIntXlibStubs {
 } TkIntXlibStubs;
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern TkIntXlibStubs *tkIntXlibStubsPtr;
-#ifdef __cplusplus
-}
-#endif
-
+EXTERN CONST TkIntXlibStubs *tkIntXlibStubsPtr;
 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
Index: generic/tkPlatDecls.h
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkPlatDecls.h,v
retrieving revision 1.16
diff -u -p -r1.16 tkPlatDecls.h
--- generic/tkPlatDecls.h	1 Apr 2008 16:30:54 -0000	1.16
+++ generic/tkPlatDecls.h	2 Apr 2008 17:02:33 -0000
@@ -131,7 +131,7 @@ EXTERN int		Tk_MacOSXIsAppInFront (void)
 
 typedef struct TkPlatStubs {
     int magic;
-    struct TkPlatStubHooks *hooks;
+    CONST struct TkPlatStubHooks *hooks;
 
 #ifdef __WIN32__ /* WIN */
     Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */
@@ -157,15 +157,7 @@ typedef struct TkPlatStubs {
 } TkPlatStubs;
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern TkPlatStubs *tkPlatStubsPtr;
-#ifdef __cplusplus
-}
-#endif
-
+EXTERN CONST TkPlatStubs *tkPlatStubsPtr;
 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
 
 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
Index: generic/tkStubInit.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkStubInit.c,v
retrieving revision 1.60
diff -u -p -r1.60 tkStubInit.c
--- generic/tkStubInit.c	13 Dec 2007 15:24:16 -0000	1.60
+++ generic/tkStubInit.c	2 Apr 2008 17:02:33 -0000
@@ -666,7 +666,7 @@ TkPlatStubs tkPlatStubs = {
 #endif /* AQUA */
 };
 
-static TkStubHooks tkStubHooks = {
+static const TkStubHooks tkStubHooks = {
     &tkPlatStubs,
     &tkIntStubs,
     &tkIntPlatStubs,
Index: generic/tkStubLib.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkStubLib.c,v
retrieving revision 1.23
diff -u -p -r1.23 tkStubLib.c
--- generic/tkStubLib.c	2 Apr 2008 04:06:38 -0000	1.23
+++ generic/tkStubLib.c	2 Apr 2008 17:02:33 -0000
@@ -20,7 +20,9 @@
  * including the rest of the stub functions.
  */
 
+#undef USE_TCL_STUBS
 #define USE_TCL_STUBS
+
 #define USE_TK_STUBS
 
 #include "tkInt.h"
@@ -41,11 +43,17 @@
 #include "tkPlatDecls.h"
 #include "tkIntXlibDecls.h"
 
-TkStubs *tkStubsPtr = NULL;
-TkPlatStubs *tkPlatStubsPtr = NULL;
-TkIntStubs *tkIntStubsPtr = NULL;
-TkIntPlatStubs *tkIntPlatStubsPtr = NULL;
-TkIntXlibStubs *tkIntXlibStubsPtr = NULL;
+MODULE_SCOPE const TkStubs *tkStubsPtr;
+MODULE_SCOPE const TkPlatStubs *tkPlatStubsPtr;
+MODULE_SCOPE const TkIntStubs *tkIntStubsPtr;
+MODULE_SCOPE const TkIntPlatStubs *tkIntPlatStubsPtr;
+MODULE_SCOPE const TkIntXlibStubs *tkIntXlibStubsPtr;
+
+const TkStubs *tkStubsPtr = NULL;
+const TkPlatStubs *tkPlatStubsPtr = NULL;
+const TkIntStubs *tkIntStubsPtr = NULL;
+const TkIntPlatStubs *tkIntPlatStubsPtr = NULL;
+const TkIntXlibStubs *tkIntXlibStubsPtr = NULL;
 
 /*
  * Use our own isdigit to avoid linking to libc on windows
@@ -74,14 +82,14 @@ static int isDigit(const int c)
  *----------------------------------------------------------------------
  */
 
-CONST char *
+MODULE_SCOPE CONST char *
 Tk_InitStubs(
     Tcl_Interp *interp,
     CONST char *version,
     int exact)
 {
     CONST char *actualVersion;
-    TkStubs **stubsPtrPtr = &tkStubsPtr;	/* squelch warning */
+    const TkStubs **stubsPtrPtr = &tkStubsPtr;	/* squelch warning */
 
     actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0,
 	    (ClientData *) stubsPtrPtr);
Index: generic/ttk/ttkStubLib.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/ttk/ttkStubLib.c,v
retrieving revision 1.5
diff -u -p -r1.5 ttkStubLib.c
--- generic/ttk/ttkStubLib.c	27 Mar 2008 12:04:02 -0000	1.5
+++ generic/ttk/ttkStubLib.c	2 Apr 2008 17:02:33 -0000
@@ -8,10 +8,8 @@
  * contains no references to any of the tcl stub functions.
  */
 
-#ifndef USE_TCL_STUBS
+#undef USE_TCL_STUBS
 #define USE_TCL_STUBS
-#endif
-#undef USE_TCL_STUB_PROCS
 
 #include "tk.h"
 
Index: unix/configure
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/configure,v
retrieving revision 1.176
diff -u -p -r1.176 configure
--- unix/configure	1 Apr 2008 21:43:42 -0000	1.176
+++ unix/configure	2 Apr 2008 17:02:36 -0000
@@ -10764,7 +10764,7 @@ echo "${ECHO_T}static library" >&6
     fi
 
     TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk '{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}'`"
-    TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[^_] > $$f && echo $$f)'
+    TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE}'
     echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
     TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
     EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/configure.in,v
retrieving revision 1.154
diff -u -p -r1.154 configure.in
--- unix/configure.in	1 Apr 2008 16:30:55 -0000	1.154
+++ unix/configure.in	2 Apr 2008 17:02:36 -0000
@@ -567,7 +567,7 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
 if test "`uname -s`" = "Darwin" ; then
     SC_ENABLE_FRAMEWORK
     TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`"
-    TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] > $$f && echo $$f)'
+    TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE}'
     echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
     TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
     EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'