Subject: Put back Tcl[GS]etStartupScript(Path|FileName) in private stub table, so extensions using this (like Tk 8.4) will continue to work in all Tcl 8.x versions. Extensions using this still cannot be compiled against Tcl 8.6 headers.

From: "jan.nijtmans" <[email-masked]>
Date: Mon, 21 Jan 2013 13:51:11 +0000

---
 ChangeLog             |  7 +++++++
 generic/tclInt.decls  | 32 ++++++++++++++++----------------
 generic/tclIntDecls.h | 36 ++++++++++++++++++++++++------------
 generic/tclStubInit.c | 33 +++++++++++++++++++++++++++++----
 4 files changed, 76 insertions(+), 32 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f62d6ea..1532676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-21  Jan Nijtmans  <[email-masked]>
+
+	* generic/tclInt.decls: Put back Tcl[GS]etStartupScript(Path|FileName)
+	in private stub table, so extensions using this (like Tk 8.4) will
+	continue to work in all Tcl 8.x versions. Extensions using this
+	still cannot be compiled against Tcl 8.6 headers.
+
 2013-01-18  Jan Nijtmans  <[email-masked]>
 
 	* generic/tclPort.h: [Bug 3598300]: unix: tcl.h does not include
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 58dab42..f0e907f 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -626,14 +626,14 @@ declare 156 {
 declare 157 {
     Var *TclVarTraceExists(Tcl_Interp *interp, const char *varName)
 }
-# REMOVED - use public Tcl_SetStartupScript()
-#declare 158 {
-#    void TclSetStartupScriptFileName(const char *filename)
-#}
-# REMOVED - use public Tcl_GetStartupScript()
-#declare 159 {
-#    const char *TclGetStartupScriptFileName(void)
-#}
+# REMOVED (except from stub table) - use public Tcl_SetStartupScript()
+declare 158 {
+    void TclSetStartupScriptFileName(const char *filename)
+}
+# REMOVED (except from stub table) - use public Tcl_GetStartupScript()
+declare 159 {
+    const char *TclGetStartupScriptFileName(void)
+}
 #declare 160 {
 #    int TclpMatchFilesTypes(Tcl_Interp *interp, char *separators,
 #	    Tcl_DString *dirPtr, char *pattern, char *tail,
@@ -678,14 +678,14 @@ declare 166 {
 }
 
 # VFS-aware versions of Tcl*StartupScriptFileName (158 and 159 above)
-# REMOVED - use public Tcl_SetStartupScript()
-#declare 167 {
-#    void TclSetStartupScriptPath(Tcl_Obj *pathPtr)
-#}
-# REMOVED - use public Tcl_GetStartupScript()
-#declare 168 {
-#    Tcl_Obj *TclGetStartupScriptPath(void)
-#}
+# REMOVED (except from stub table) - use public Tcl_SetStartupScript()
+declare 167 {
+    void TclSetStartupScriptPath(Tcl_Obj *pathPtr)
+}
+# REMOVED (except from stub table) - use public Tcl_GetStartupScript()
+declare 168 {
+    Tcl_Obj *TclGetStartupScriptPath(void)
+}
 # variant of Tcl_UtfNCmp that takes n as bytes, not chars
 declare 169 {
     int TclpUtfNcmp2(const char *s1, const char *s2, unsigned long n)
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 092225e..cf88e5f 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -396,8 +396,10 @@ EXTERN void		TclRegError(Tcl_Interp *interp, const char *msg,
 /* 157 */
 EXTERN Var *		TclVarTraceExists(Tcl_Interp *interp,
 				const char *varName);
-/* Slot 158 is reserved */
-/* Slot 159 is reserved */
+/* 158 */
+EXTERN void		TclSetStartupScriptFileName(const char *filename);
+/* 159 */
+EXTERN const char *	TclGetStartupScriptFileName(void);
 /* Slot 160 is reserved */
 /* 161 */
 EXTERN int		TclChannelTransform(Tcl_Interp *interp,
@@ -415,8 +417,10 @@ EXTERN void		TclpSetInitialEncodings(void);
 EXTERN int		TclListObjSetElement(Tcl_Interp *interp,
 				Tcl_Obj *listPtr, int index,
 				Tcl_Obj *valuePtr);
-/* Slot 167 is reserved */
-/* Slot 168 is reserved */
+/* 167 */
+EXTERN void		TclSetStartupScriptPath(Tcl_Obj *pathPtr);
+/* 168 */
+EXTERN Tcl_Obj *	TclGetStartupScriptPath(void);
 /* 169 */
 EXTERN int		TclpUtfNcmp2(const char *s1, const char *s2,
 				unsigned long n);
@@ -769,8 +773,8 @@ typedef struct TclIntStubs {
     void (*reserved155)(void);
     void (*tclRegError) (Tcl_Interp *interp, const char *msg, int status); /* 156 */
     Var * (*tclVarTraceExists) (Tcl_Interp *interp, const char *varName); /* 157 */
-    void (*reserved158)(void);
-    void (*reserved159)(void);
+    void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */
+    const char * (*tclGetStartupScriptFileName) (void); /* 159 */
     void (*reserved160)(void);
     int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */
     void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */
@@ -778,8 +782,8 @@ typedef struct TclIntStubs {
     void (*tclExpandCodeArray) (void *envPtr); /* 164 */
     void (*tclpSetInitialEncodings) (void); /* 165 */
     int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */
-    void (*reserved167)(void);
-    void (*reserved168)(void);
+    void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */
+    Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */
     int (*tclpUtfNcmp2) (const char *s1, const char *s2, unsigned long n); /* 169 */
     int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */
     int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */
@@ -1135,8 +1139,10 @@ extern const TclIntStubs *tclIntStubsPtr;
 	(tclIntStubsPtr->tclRegError) /* 156 */
 #define TclVarTraceExists \
 	(tclIntStubsPtr->tclVarTraceExists) /* 157 */
-/* Slot 158 is reserved */
-/* Slot 159 is reserved */
+#define TclSetStartupScriptFileName \
+	(tclIntStubsPtr->tclSetStartupScriptFileName) /* 158 */
+#define TclGetStartupScriptFileName \
+	(tclIntStubsPtr->tclGetStartupScriptFileName) /* 159 */
 /* Slot 160 is reserved */
 #define TclChannelTransform \
 	(tclIntStubsPtr->tclChannelTransform) /* 161 */
@@ -1150,8 +1156,10 @@ extern const TclIntStubs *tclIntStubsPtr;
 	(tclIntStubsPtr->tclpSetInitialEncodings) /* 165 */
 #define TclListObjSetElement \
 	(tclIntStubsPtr->tclListObjSetElement) /* 166 */
-/* Slot 167 is reserved */
-/* Slot 168 is reserved */
+#define TclSetStartupScriptPath \
+	(tclIntStubsPtr->tclSetStartupScriptPath) /* 167 */
+#define TclGetStartupScriptPath \
+	(tclIntStubsPtr->tclGetStartupScriptPath) /* 168 */
 #define TclpUtfNcmp2 \
 	(tclIntStubsPtr->tclpUtfNcmp2) /* 169 */
 #define TclCheckInterpTraces \
@@ -1297,6 +1305,10 @@ extern const TclIntStubs *tclIntStubsPtr;
 #undef TCL_STORAGE_CLASS
 #define TCL_STORAGE_CLASS DLLIMPORT
 
+#undef TclGetStartupScriptFileName
+#undef TclSetStartupScriptFileName
+#undef TclGetStartupScriptPath
+#undef TclSetStartupScriptPath
 #undef TclBackgroundException
 
 #if defined(USE_TCL_STUBS) && defined(TCL_NO_DEPRECATED)
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 1d1fe15..1dbdc09 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -54,6 +54,31 @@ static int TclSockMinimumBuffersOld(int sock, int size)
 }
 #endif
 
+#define TclSetStartupScriptPath setStartupScriptPath
+static void TclSetStartupScriptPath(Tcl_Obj *path)
+{
+    Tcl_SetStartupScript(path, NULL);
+}
+#define TclGetStartupScriptPath getStartupScriptPath
+static Tcl_Obj *TclGetStartupScriptPath(void)
+{
+    return Tcl_GetStartupScript(NULL);
+}
+#define TclSetStartupScriptFileName setStartupScriptFileName
+static void TclSetStartupScriptFileName(
+    const char *fileName)
+{
+    Tcl_SetStartupScript(Tcl_NewStringObj(fileName,-1), NULL);
+}
+#define TclGetStartupScriptFileName getStartupScriptFileName
+static const char *TclGetStartupScriptFileName(void)
+{
+    Tcl_Obj *path = Tcl_GetStartupScript(NULL);
+    if (path == NULL) {
+	return NULL;
+    }
+    return Tcl_GetStringFromObj(path, NULL);
+}
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 #undef TclWinNToHS
@@ -348,8 +373,8 @@ static const TclIntStubs tclIntStubs = {
     0, /* 155 */
     TclRegError, /* 156 */
     TclVarTraceExists, /* 157 */
-    0, /* 158 */
-    0, /* 159 */
+    TclSetStartupScriptFileName, /* 158 */
+    TclGetStartupScriptFileName, /* 159 */
     0, /* 160 */
     TclChannelTransform, /* 161 */
     TclChannelEventScriptInvoker, /* 162 */
@@ -357,8 +382,8 @@ static const TclIntStubs tclIntStubs = {
     TclExpandCodeArray, /* 164 */
     TclpSetInitialEncodings, /* 165 */
     TclListObjSetElement, /* 166 */
-    0, /* 167 */
-    0, /* 168 */
+    TclSetStartupScriptPath, /* 167 */
+    TclGetStartupScriptPath, /* 168 */
     TclpUtfNcmp2, /* 169 */
     TclCheckInterpTraces, /* 170 */
     TclCheckExecutionTraces, /* 171 */
-- 
cgit v0.12