summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--generic/tclInt.decls8
-rw-r--r--generic/tclIntPlatDecls.h9
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--win/tclWin32Dll.c26
-rw-r--r--win/tclWinInit.c31
6 files changed, 88 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ca3f7d9..477c3e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2002-12-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tclStubInit.c: regen
+ * generic/tclIntPlatDecls.h: regen
+ * generic/tclInt.decls: added TclWinResetInterface
+
+ * win/tclWin32Dll.c (TclWinResetInterfaces):
+ * win/tclWinInit.c (TclpSetInitialEncodings, WinEncodingsCleanup):
+ add exit handler that resets the encoding information to a state
+ where we can reuse Tcl. Following these changes, it is possible
+ to reuse Tcl (following Tcl_FindExecutable or Tcl_CreateInterp)
+ following a Tcl_Finalize.
+
+ * generic/tclIOUtil.c (TclFinalizeFilesystem): reset statics to
+ their original values on finalize to allow reuse of the library.
+
2002-12-04 David Gravereaux <davygrvy@pobox.com>
* win/tclWinPipe.c: reverted back to -r1.27 due to numerous test
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 84b62f5..f2b2f99 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -12,7 +12,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.decls,v 1.57 2002/11/07 02:13:36 mdejong Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.58 2002/12/06 23:22:59 hobbs Exp $
library tcl
@@ -915,6 +915,12 @@ declare 27 win {
void TclWinFlushDirtyChannels (void)
}
+# Added in 8.4.2
+
+declare 28 win {
+ void TclWinResetInterfaces(void)
+}
+
#########################
# Unix specific internals
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index b430443..09c1226 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -9,7 +9,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.18 2002/08/06 01:49:27 das Exp $
+ * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.19 2002/12/06 23:22:59 hobbs Exp $
*/
#ifndef _TCLINTPLATDECLS
@@ -137,6 +137,8 @@ EXTERN TclPlatformType * TclWinGetPlatform _ANSI_ARGS_((void));
EXTERN void TclWinSetInterfaces _ANSI_ARGS_((int wide));
/* 27 */
EXTERN void TclWinFlushDirtyChannels _ANSI_ARGS_((void));
+/* 28 */
+EXTERN void TclWinResetInterfaces _ANSI_ARGS_((void));
#endif /* __WIN32__ */
#ifdef MAC_TCL
/* 0 */
@@ -260,6 +262,7 @@ typedef struct TclIntPlatStubs {
TclPlatformType * (*tclWinGetPlatform) _ANSI_ARGS_((void)); /* 25 */
void (*tclWinSetInterfaces) _ANSI_ARGS_((int wide)); /* 26 */
void (*tclWinFlushDirtyChannels) _ANSI_ARGS_((void)); /* 27 */
+ void (*tclWinResetInterfaces) _ANSI_ARGS_((void)); /* 28 */
#endif /* __WIN32__ */
#ifdef MAC_TCL
VOID * (*tclpSysAlloc) _ANSI_ARGS_((long size, int isBin)); /* 0 */
@@ -459,6 +462,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
#define TclWinFlushDirtyChannels \
(tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */
#endif
+#ifndef TclWinResetInterfaces
+#define TclWinResetInterfaces \
+ (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */
+#endif
#endif /* __WIN32__ */
#ifdef MAC_TCL
#ifndef TclpSysAlloc
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 2d3136a..c25f053 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.77 2002/11/07 02:13:36 mdejong Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.78 2002/12/06 23:22:59 hobbs Exp $
*/
#include "tclInt.h"
@@ -294,6 +294,7 @@ TclIntPlatStubs tclIntPlatStubs = {
TclWinGetPlatform, /* 25 */
TclWinSetInterfaces, /* 26 */
TclWinFlushDirtyChannels, /* 27 */
+ TclWinResetInterfaces, /* 28 */
#endif /* __WIN32__ */
#ifdef MAC_TCL
TclpSysAlloc, /* 0 */
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index d3a1172..506cf78 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.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: tclWin32Dll.c,v 1.17 2002/10/29 14:17:58 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.18 2002/12/06 23:22:59 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -512,6 +512,30 @@ TclWinSetInterfaces(
/*
*---------------------------------------------------------------------------
*
+ * TclWinResetInterfaces --
+ *
+ * Called during finalization to reset us to a safe state for reuse.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TclWinResetInterfaces()
+{
+ Tcl_FreeEncoding(tclWinTCharEncoding);
+ tclWinTCharEncoding = NULL;
+ tclWinProcs = &asciiProcs;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* Tcl_WinUtfToTChar, Tcl_WinTCharToUtf --
*
* Convert between UTF-8 and Unicode when running Windows NT or
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index c4782e3..bc0c980 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclWinInit.c,v 1.35 2002/02/08 02:52:55 dgp Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.36 2002/12/06 23:22:59 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -461,7 +461,34 @@ ToUtf(
*dst = '\0';
return (int) (dst - start);
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * WinEncodingsCleanup --
+ *
+ * Reset information to its original state in finalization to
+ * allow for reinitialization to be possible.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Static information reset to startup state.
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+WinEncodingsCleanup(ClientData clientData)
+{
+ TclWinResetInterfaces();
+ libraryPathEncodingFixed = 0;
+ if (binaryEncoding != NULL) {
+ Tcl_FreeEncoding(binaryEncoding);
+ binaryEncoding = NULL;
+ }
+}
/*
*---------------------------------------------------------------------------
@@ -538,6 +565,8 @@ TclpSetInitialEncodings()
encoding = "iso8859-1";
binaryEncoding = Tcl_GetEncoding(NULL, encoding);
}
+
+ Tcl_CreateExitHandler(WinEncodingsCleanup, NULL);
}
/*