summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2002-12-06 23:22:57 (GMT)
committerhobbs <hobbs@noemail.net>2002-12-06 23:22:57 (GMT)
commitc1f6a1c3463dbe4215a403ad960d887a7fd21911 (patch)
tree5e8124bd90814fbe5a1f2116ec1fb5a93273caed /win
parent5183b45fff36dc6a9289895dad453da763ba0974 (diff)
downloadtcl-c1f6a1c3463dbe4215a403ad960d887a7fd21911.zip
tcl-c1f6a1c3463dbe4215a403ad960d887a7fd21911.tar.gz
tcl-c1f6a1c3463dbe4215a403ad960d887a7fd21911.tar.bz2
* 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. FossilOrigin-Name: e4ec3dc36c57ea2690faeb643e2e47eac6bc6520
Diffstat (limited to 'win')
-rw-r--r--win/tclWin32Dll.c26
-rw-r--r--win/tclWinInit.c31
2 files changed, 55 insertions, 2 deletions
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);
}
/*