--- tcl8.2-8.2.3.orig/unix/tclAppInit.c
+++ tcl8.2-8.2.3/unix/tclAppInit.c
@@ -21,27 +21,36 @@
  * Sun shared libraries to be used for Tcl.
  */
 
-extern int matherr();
+EXTERN int matherr();
 int *tclDummyMathPtr = (int *) matherr;
 
 
 #ifdef TCL_TEST
 
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
 #include "tclInt.h"
 
-extern int		Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+#ifdef	__cplusplus
+}
+#endif
+
+extern int		Proctest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Proctest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Objtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Tclptest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #ifdef TCL_THREADS
-extern int		TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Threadtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #endif
 
 #endif /* TCL_TEST */
 
 #ifdef TCL_XT_TEST
 extern void		XtToolkitInitialize _ANSI_ARGS_((void));
-extern int		Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Xttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #endif
 
 /*
@@ -62,9 +71,14 @@
  */
 
 int
+#ifdef _USING_PROTOTYPES_
+main (int    argc,		/* Number of command-line arguments. */
+     char **argv)		/* Values of command-line arguments. */
+#else
 main(argc, argv)
     int argc;			/* Number of command-line arguments. */
     char **argv;		/* Values of command-line arguments. */
+#endif
 {
 #ifdef TCL_TEST
     /*
@@ -76,10 +90,6 @@
 
 #endif
 
-#ifdef TCL_XT_TEST
-    XtToolkitInitialize();
-#endif
-
     Tcl_Main(argc, argv, Tcl_AppInit);
     return 0;			/* Needed only to prevent compiler warning. */
 }
@@ -104,8 +114,12 @@
  */
 
 int
+#ifdef _USING_PROTOTYPES_
+Tcl_AppInit (Tcl_Interp *interp)/* Interpreter for application. */
+#else
 Tcl_AppInit(interp)
     Tcl_Interp *interp;		/* Interpreter for application. */
+#endif
 {
     if (Tcl_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
@@ -113,28 +127,39 @@
 
 #ifdef TCL_TEST
 #ifdef TCL_XT_TEST
-     if (Tclxttest_Init(interp) == TCL_ERROR) {
-	 return TCL_ERROR;
-     }
+    if (Xttest_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Xttest", Xttest_Init,
+	    (Tcl_PackageInitProc *) NULL);
 #endif
     if (Tcltest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
     Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
             (Tcl_PackageInitProc *) NULL);
-    if (TclObjTest_Init(interp) == TCL_ERROR) {
+    if (Objtest_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Objtest", Objtest_Init,
+            (Tcl_PackageInitProc *) NULL);
+    if (Tclptest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
+    Tcl_StaticPackage(interp, "Tclptest", Tclptest_Init,
+            (Tcl_PackageInitProc *) NULL);
 #ifdef TCL_THREADS
-    if (TclThread_Init(interp) == TCL_ERROR) {
+    if (Threadtest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
+    Tcl_StaticPackage(interp, "Threadtest", Threadtest_Init,
+            (Tcl_PackageInitProc *) NULL);
 #endif
-    if (Procbodytest_Init(interp) == TCL_ERROR) {
+    if (Proctest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
-    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
-            Procbodytest_SafeInit);
+    Tcl_StaticPackage(interp, "Proctest", Proctest_Init,
+            Proctest_SafeInit);
 #endif /* TCL_TEST */
 
     /*
--- tcl8.2-8.2.3.orig/unix/tclLoadAix.c
+++ tcl8.2-8.2.3/unix/tclLoadAix.c
@@ -17,7 +17,7 @@
  *	for any results of using the software, alterations are clearly marked
  *	as such, and this notice is not modified.
  *
- * RCS: @(#) $Id: tclLoadAix.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadAix.c,v 1.2 1998/09/14 18:40:16 stanton Exp $
  *
  * Note:  this file has been altered from the original in a few
  * ways in order to work properly with Tcl.
@@ -48,28 +48,28 @@
 
 typedef struct {
 	char		*name;		/* the symbols's name */
-	void		*addr;		/* its relocated virtual address */
+	VOID		*addr;		/* its relocated virtual address */
 } Export, *ExportPtr;
 
 /*
- * xlC uses the following structure to list its constructors and
- * destructors. This is gleaned from the output of munch.
+ * To be able to intialize, a library may provide a dl_info structure
+ * that contains functions to be called to initialize and terminate.
  */
-typedef struct {
-	void (*init)(void);		/* call static constructors */
-	void (*term)(void);		/* call static destructors */
-} Cdtor, *CdtorPtr;
+struct dl_info {
+	void (*init) _ANSI_ARGS_((void));
+	void (*fini) _ANSI_ARGS_((void));
+};
 
 /*
- * The void * handle returned from dlopen is actually a ModulePtr.
+ * The VOID * handle returned from dlopen is actually a ModulePtr.
  */
 typedef struct Module {
 	struct Module	*next;
 	char		*name;		/* module name for refcounting */
 	int		refCnt;		/* the number of references */
-	void		*entry;		/* entry point from load */
+	VOID		*entry;		/* entry point from load */
 	struct dl_info	*info;		/* optional init/terminate functions */
-	CdtorPtr	cdtors;		/* optional C++ constructors */
+	struct dl_info	*cdtors;	/* optional C++ constructors */
 	int		nExports;	/* the number of exports found */
 	ExportPtr	exports;	/* the array of exports */
 } Module, *ModulePtr;
@@ -87,15 +87,18 @@
 static char errbuf[BUFSIZ];
 static int errvalid;
 
-static void caterr(char *);
-static int readExports(ModulePtr);
-static void terminate(void);
-static void *findMain(void);
-
-VOID *dlopen(const char *path, int mode)
+static void caterr _ANSI_ARGS_((char *));
+static int readExports _ANSI_ARGS_((ModulePtr));
+static void terminate _ANSI_ARGS_((void));
+static VOID *findMain _ANSI_ARGS_((void));
+
+VOID *
+dlopen(path, mode)
+    const char *path;
+    int mode;
 {
 	register ModulePtr mp;
-	static void *mainModule;
+	static VOID *mainModule;
 
 	/*
 	 * Upon the first call register a terminate handler that will
@@ -127,7 +130,7 @@
 	 * load should be declared load(const char *...). Thus we
 	 * cast the path to a normal char *. Ugly.
 	 */
-	if ((mp->entry = (void *)load((char *)path, L_NOAUTODEFER, NULL)) == NULL) {
+	if ((mp->entry = (VOID *)load((char *)path, L_NOAUTODEFER, NULL)) == NULL) {
 		free(mp->name);
 		free(mp);
 		errvalid++;
@@ -193,7 +196,7 @@
 	 * If the shared object was compiled using xlC we will need
 	 * to call static constructors (and later on dlclose destructors).
 	 */
-	if (mp->cdtors = (CdtorPtr)dlsym(mp, "__cdtors")) {
+	if (mp->cdtors = (struct dl_info *) dlsym(mp, "__cdtors")) {
 		while (mp->cdtors->init) {
 			(*mp->cdtors->init)();
 			mp->cdtors++;
@@ -207,13 +210,15 @@
  * Attempt to decipher an AIX loader error message and append it
  * to our static error message buffer.
  */
-static void caterr(char *s)
+static void
+caterr(s)
+    char *s;
 {
 	register char *p = s;
 
 	while (*p >= '0' && *p <= '9')
 		p++;
-	switch(atoi(s)) {		/* INTL: "C", UTF safe. */
+	switch(atoi(s)) {
 	case L_ERROR_TOOMANY:
 		strcat(errbuf, "to many errors");
 		break;
@@ -234,7 +239,7 @@
 		strcat(errbuf, p);
 		break;
 	case L_ERROR_ERRNO:
-		strcat(errbuf, strerror(atoi(++p)));	/* INTL: "C", UTF safe. */
+		strcat(errbuf, strerror(atoi(++p)));
 		break;
 	default:
 		strcat(errbuf, s);
@@ -242,7 +247,10 @@
 	}
 }
 
-VOID *dlsym(void *handle, const char *symbol)
+VOID *
+dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
 {
 	register ModulePtr mp = (ModulePtr)handle;
 	register ExportPtr ep;
@@ -261,7 +269,8 @@
 	return NULL;
 }
 
-char *dlerror(void)
+char *
+dlerror()
 {
 	if (errvalid) {
 		errvalid = 0;
@@ -270,7 +279,9 @@
 	return NULL;
 }
 
-int dlclose(void *handle)
+int
+dlclose(handle)
+    VOID *handle;
 {
 	register ModulePtr mp = (ModulePtr)handle;
 	int result;
@@ -281,8 +292,8 @@
 	if (mp->info && mp->info->fini)
 		(*mp->info->fini)();
 	if (mp->cdtors)
-		while (mp->cdtors->term) {
-			(*mp->cdtors->term)();
+		while (mp->cdtors->fini) {
+			(*mp->cdtors->fini)();
 			mp->cdtors++;
 		}
 	result = unload(mp->entry);
@@ -312,7 +323,8 @@
 	return result;
 }
 
-static void terminate(void)
+static void
+terminate()
 {
 	while (modList)
 		dlclose(modList);
@@ -321,7 +333,9 @@
 /*
  * Build the export table from the XCOFF .loader section.
  */
-static int readExports(ModulePtr mp)
+static int
+readExports(mp)
+    ModulePtr mp;
 {
 	LDFILE *ldp = NULL;
 	SCNHDR sh, shdata;
@@ -491,7 +505,7 @@
 		}
 		ep->name = malloc((unsigned) (strlen(symname) + 1));
 		strcpy(ep->name, symname);
-		ep->addr = (void *)((unsigned long)mp->entry +
+		ep->addr = (VOID *)((unsigned long)mp->entry +
 					ls->l_value - shdata.s_vaddr);
 		ep++;
 	}
@@ -505,13 +519,14 @@
  * Find the main modules entry point. This is used as export pointer
  * for loadbind() to be able to resolve references to the main part.
  */
-static void * findMain(void)
+static VOID *
+findMain()
 {
 	struct ld_info *lp;
 	char *buf;
 	int size = 4*1024;
 	int i;
-	void *ret;
+	VOID *ret;
 
 	if ((buf = malloc(size)) == NULL) {
 		errvalid++;
--- tcl8.2-8.2.3.orig/unix/tclLoadAout.c
+++ tcl8.2-8.2.3/unix/tclLoadAout.c
@@ -14,11 +14,13 @@
  * and Design Engineering (MADE) Initiative through ARPA contract
  * F33615-94-C-4400.
  *
- * RCS: @(#) $Id: tclLoadAout.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadAout.c,v 1.2 1998/09/14 18:40:16 stanton Exp $
  */
 
 #include "tclInt.h"
+#include "tclPort.h"
 #include <fcntl.h>
+#include "../compat/dlfcn.h"
 #ifdef HAVE_EXEC_AOUT_H
 #   include <sys/exec_aout.h>
 #endif
@@ -81,33 +83,65 @@
 static char * SymbolTableFile = NULL;
 
 /*
- * Type of the dictionary function that begins each load module.
+ * Prototypes for procedures referenced only in this file:
  */
 
-typedef Tcl_PackageInitProc * (* DictFn) _ANSI_ARGS_ ((char * symbol));
+static VOID * LoadDictionary _ANSI_ARGS_((char *symbol));
+static int FindLibraries _ANSI_ARGS_((CONST char *fileName, Tcl_DString *buf));
+static void UnlinkSymbolTable _ANSI_ARGS_((void));
+static void Seterror _ANSI_ARGS_((char *message));
 
 /*
- * Prototypes for procedures referenced only in this file:
+ *----------------------------------------------------------------------
+ *
+ * LoadDictionary --
+ *
+ * Search for functions in Tcl library.
+ *
+ * Results:
+ *	addres of symbol, or NULL if it cannot be found.
+ *	Currently, only the Tcl_Init() function can be found.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
  */
 
-static int FindLibraries _ANSI_ARGS_((Tcl_Interp * interp, char * fileName,
-				      Tcl_DString * buf));
-static void UnlinkSymbolTable _ANSI_ARGS_((void));
+static struct {
+  char * name;
+  int (*value) _ANSI_ARGS_((Tcl_Interp *));
+} dictionary[] = {
+  { "Tcl_Init", Tcl_Init },
+  0, 0 
+};
+
+static VOID *
+LoadDictionary (symbol)
+    char * symbol;
+{
+    int i;
+    for (i = 0; dictionary[i] . name != 0; ++i) {
+      if (!strcmp (symbol, dictionary[i] . name)) {
+	return (VOID *) dictionary[i].value;
+      }
+    }
+    return (VOID *) NULL;
+}
+
+static char *errorMessage = NULL;
+
 
 /*
  *----------------------------------------------------------------------
  *
- * TclpLoadFile --
+ * dlopen --
  *
- *	Dynamically loads a binary code file into memory and returns
- *	the addresses of two procedures within that file, if they
- *	are defined.
+ *	Dynamically loads a binary code file into memory.
  *
  * Results:
- *	A standard Tcl completion code.  If an error occurs, an error
- *	message is left in the interp's result.  *proc1Ptr and *proc2Ptr
- *	are filled in with the addresses of the symbols given by
- *	*sym1 and *sym2, or NULL if those symbols can't be found.
+ *	A handle which can be used in later calls to dlsym(),
+ *	or NULL when the attempt fails.
  *
  * Side effects:
  *	New code suddenly appears in memory.
@@ -135,19 +169,10 @@
  *----------------------------------------------------------------------
  */
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code (UTF-8). */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+VOID *
+dlopen(path, flags)
+    CONST char *path;
+    int flags;
 {
   char * inputSymbolTable;	/* Name of the file containing the 
 				 * symbol table from the last link. */
@@ -157,30 +182,68 @@
   char relocatedFileName [L_tmpnam];
 				/* Name of the file holding the relocated */
 				/* text of the module */
-  int relocatedFd;		/* File descriptor of the file holding
+  int relocatedFd = -1;		/* File descriptor of the file holding
 				 * relocated text */
   struct exec relocatedHead;	/* Header of the relocated text */
   unsigned long relocatedSize;	/* Size of the relocated text */
   char * startAddress;		/* Starting address of the module */
-  DictFn dictionary;		/* Dictionary function in the load module */
   int status;			/* Status return from Tcl_ calls */
-  char * p;
+  char *p;
+  CONST char *r, *pkgGuess;
+  Tcl_Interp *interp = NULL;
+  Tcl_DString fullPath;
+
+  if (path == (char *) NULL) {
+    return (VOID *) LoadDictionary;
+  }
+
+  errno = 0;
+  if (errorMessage) {
+    ckfree(errorMessage);
+    errorMessage = NULL;
+  }
 
-  *clientDataPtr = NULL;
-  
   /* Find the file that contains the symbols for the run-time link. */
 
   if (SymbolTableFile != NULL) {
     inputSymbolTable = SymbolTableFile;
   } else if (tclExecutableName == NULL) {
-    Tcl_SetResult (interp, "can't find the tclsh executable", TCL_STATIC);
-    return TCL_ERROR;
+    Seterror("can't find the tclsh executable");
+    goto error;
   } else {
     inputSymbolTable = tclExecutableName;
   }
 
   /* Construct the `ld' command that builds the relocated module */
 
+  interp = Tcl_CreateInterp();
+
+  Tcl_DStringInit (&fullPath);
+  if (Tcl_GetPathType(path) == TCL_PATH_RELATIVE) {
+	p = getenv("LD_LIBRARY_PATH");
+	while (p) {
+	    if ((q = strchr(p,':')) == NULL) {
+		q = p; while(*q) q++;
+	    }
+	    if (p == q) break;
+	    Tcl_DStringAppend(&fullPath, p, q-p);
+	    Tcl_DStringAppend(&fullPath, "/", 1);
+	    Tcl_DStringAppend(&fullPath, path, -1);
+	    if (access(Tcl_DStringValue(&fullPath), F_OK) != -1) {
+		break;
+	    }
+	    Tcl_DStringSetLength(&fullPath, 0);
+	    p = q; if (*p) p++;
+	}
+	if (!q && (access(path, F_OK) == -1)) {
+	    Tcl_DStringAppend(&fullPath, LIB_RUNTIME_DIR, -1);
+	    Tcl_DStringAppend(&fullPath, "/", 1);
+	    Tcl_DStringAppend(&fullPath, path, -1);
+	}
+  }
+  if (*Tcl_DStringValue(&fullPath) == 0) {
+    Tcl_DStringAppend(&fullPath, path, -1);
+  }
   tmpnam (relocatedFileName);
   Tcl_DStringInit (&linkCommandBuf);
   Tcl_DStringAppend (&linkCommandBuf, "exec ld -o ", -1);
@@ -189,16 +252,58 @@
   Tcl_DStringAppend (&linkCommandBuf, " -G 0 ", -1);
 #endif
   Tcl_DStringAppend (&linkCommandBuf, " -u TclLoadDictionary_", -1);
-  TclGuessPackageName(fileName, &linkCommandBuf);
+  if (pkgGuess = strrchr(path,'/')) {
+    pkgGuess++;
+  } else {
+    pkgGuess = path;
+  }
+  if (!strncmp(pkgGuess,"lib",3)) {
+    pkgGuess+=3;
+  }
+  for (r = pkgGuess; (*r) && (*r != '.'); r++) {
+    /* Empty loop body. */
+  }
+  if ((r>pkgGuess+3) && !strncmp(r-3,"_G0.",4)) {
+    r-=3;
+  }
+  while ((r-- > pkgGuess) && isdigit(UCHAR(*r))) {
+    /* Empty loop body. */
+  }
+  r++;
+  Tcl_DStringAppend(&linkCommandBuf,(char *) pkgGuess, r-pkgGuess);
+
+  p = Tcl_DStringValue(&linkCommandBuf);
+  p += strlen(p) - (r-pkgGuess);
+
+  if (islower(UCHAR(*p))) {
+    *p = (char) toupper(UCHAR(*p));
+  }
+  while (*(p++)) {
+    if (isupper(UCHAR(*p))) {
+	*p = (char) tolower(UCHAR(*p));
+    }
+  }
   Tcl_DStringAppend (&linkCommandBuf, " -A ", -1);
   Tcl_DStringAppend (&linkCommandBuf, inputSymbolTable, -1);
   Tcl_DStringAppend (&linkCommandBuf, " -N -T XXXXXXXX ", -1);
-  Tcl_DStringAppend (&linkCommandBuf, fileName, -1);
+  Tcl_DStringAppend (&linkCommandBuf, Tcl_DStringValue(&fullPath), -1);
+  p = getenv("LD_LIBRARY_PATH");
+  while (p) {
+    if ((q = strchr(p,':')) == NULL) {
+      q = p; while(*q) q++;
+    }
+    if (p == q) break;
+    Tcl_DStringAppend(&linkCommandBuf, " -L", 3);
+    Tcl_DStringAppend(&linkCommandBuf, p, q-p);
+    p = q; if (*p) p++;
+  }
   Tcl_DStringAppend (&linkCommandBuf, " ", -1);
-  if (FindLibraries (interp, fileName, &linkCommandBuf) != TCL_OK) {
+  if (FindLibraries (Tcl_DStringValue(&fullPath), &linkCommandBuf) != TCL_OK) {
     Tcl_DStringFree (&linkCommandBuf);
-    return TCL_ERROR;
+    Tcl_DStringFree (&fullPath);
+    goto error;
   }
+  Tcl_DStringFree (&fullPath);
   linkCommand = Tcl_DStringValue (&linkCommandBuf);
 
   /* Determine the starting address, and plug it into the command */
@@ -215,7 +320,9 @@
   status = Tcl_Eval (interp, linkCommand);
   Tcl_DStringFree (&linkCommandBuf);
   if (status != 0) {
-    return TCL_ERROR;
+    Seterror(interp->result);
+    errno = 0;
+    goto error;
   }
 
   /* Open the linker's result file and read the header */
@@ -232,16 +339,14 @@
   /* Check the magic number */
 
   if (relocatedHead.a_magic != OMAGIC) {
-    Tcl_AppendResult (interp, "bad magic number in intermediate file \"",
-		      relocatedFileName, "\"", (char *) NULL);
+    Seterror("bad magic number in intermediate file");
     goto failure;
   }
 
   /* Make sure that memory allocation is still consistent */
 
   if ((unsigned long) sbrk (0) > (unsigned long) startAddress) {
-    Tcl_SetResult (interp, "can't load, memory allocation is inconsistent.",
-		   TCL_STATIC);
+    Seterror("can't load, memory allocation is inconsistent");
     goto failure;
   }
 
@@ -250,7 +355,7 @@
   relocatedSize = relocatedHead.a_text + relocatedHead.a_data
     + relocatedHead.a_bss;
   if (relocatedSize > TCL_LOADMAX) {
-    Tcl_SetResult (interp, "module too big to load", TCL_STATIC);
+    Seterror("module too big to load");
     goto failure;
   }
 
@@ -277,12 +382,10 @@
   if (read (relocatedFd, startAddress, relocatedSize) < relocatedSize) {
     brk (startAddress);
   ioError:
-    Tcl_AppendResult (interp, "error on intermediate file \"",
-		      relocatedFileName, "\": ", Tcl_PosixError (interp),
-		      (char *) NULL);
+    Seterror("error on intermediate file: ");
   failure:
     (void) unlink (relocatedFileName);
-    return TCL_ERROR;
+    goto error;
   }
 
   /* Close the intermediate file. */
@@ -290,24 +393,132 @@
   (void) close (relocatedFd);
 
   /* Arrange things so that intermediate symbol tables eventually get
-   * deleted. */
+   * deleted. If the flag RTLD_GLOBAL is not set, just keep the
+   * old file. */
 
-  if (SymbolTableFile != NULL) {
-    UnlinkSymbolTable ();
+  if (flags & RTLD_GLOBAL) {
+    if (SymbolTableFile != NULL) {
+      UnlinkSymbolTable ();
+    } else {
+      atexit (UnlinkSymbolTable);
+    }
+    SymbolTableFile = ckalloc (strlen (relocatedFileName) + 1);
+    strcpy (SymbolTableFile, relocatedFileName);
   } else {
-    atexit (UnlinkSymbolTable);
+    (void) unlink (relocatedFileName);
   }
-  SymbolTableFile = ckalloc (strlen (relocatedFileName) + 1);
-  strcpy (SymbolTableFile, relocatedFileName);
-  
-  /* Look up the entry points in the load module's dictionary. */
+  return (VOID *) startAddress;
 
-  dictionary = (DictFn) startAddress;
-  *proc1Ptr = dictionary (sym1);
-  *proc2Ptr = dictionary (sym2);
+error:
+  if (relocatedFd>=0) {
+	close (relocatedFd);
+  }
+  if (interp) {
+    Tcl_DeleteInterp(interp);
+  }
+  return NULL;
+}
 
-  return TCL_OK;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlsym --
+ *
+ *	This function returns the address of a
+ *	symbol, give the handle returned by dlopen().
+ *
+ * Results:
+ *	Returns the address of the symbol in the dll.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+VOID *dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
+{
+    if ((handle != NULL) && (symbol != NULL)) {
+	return ((VOID * (*) _ANSI_ARGS_((CONST char *))) handle) (symbol);
+    } else {
+	return (VOID *) NULL;
+    }
 }
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlerror --
+ *
+ *	This function returns a string describing the error which
+ *	occurred in dlopen().
+ *
+ * Results:
+ *	Returns an error message.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+dlerror()
+{
+    char *err, *msg;
+
+    if (errorMessage && errno) {
+	err = Tcl_ErrnoMsg(errno);
+	msg = ckalloc(strlen(errorMessage)+strlen(err)+1);
+	strcpy(msg, errorMessage);
+	strcat(msg, err);
+	ckfree(errorMessage);
+	errorMessage = msg;
+    }
+    return errorMessage;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlclose --
+ *
+ *	Just a dummy function, only for compatibility. There is no
+ *	way to remove dll's from memory.
+ *
+ * Results:
+ *	Always returns 0 (= O.K.)
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+dlclose(handle)
+    VOID *handle;
+{
+    return 0;
+}
+
+static void
+Seterror(message)
+    char *message;
+{
+    if (errorMessage) {
+	ckfree(errorMessage);
+    }
+    errorMessage = ckalloc(strlen(message)+1);
+    strcpy(errorMessage, message);
+    return;
+}
+
 
 /*
  *------------------------------------------------------------------------
@@ -318,33 +529,25 @@
  *
  * Results:
  *	A standard Tcl completion code.  If an error occurs,
- *	an error message is left in the interp's result.  The -l and -L
- *	flags are concatenated onto the dynamic string `buf'.
+ *	an error message is left in interp->result.  The -l and -L flags
+ *	are concatenated onto the dynamic string `buf'.
  *
  *------------------------------------------------------------------------
  */
 
 static int
-FindLibraries (interp, fileName, buf)
-     Tcl_Interp * interp;	/* Used for error reporting */
-     char * fileName;		/* Name of the load module */
+FindLibraries (fileName, buf)
+     CONST char * fileName;	/* Name of the load module */
      Tcl_DString * buf;		/* Buffer where the -l an -L flags */
 {
   FILE * f;			/* The load module */
-  int c;			/* Byte from the load module */
+  int c = EOF;			/* Byte from the load module */
   char * p;
-  Tcl_DString ds;
-  CONST char *native;
 
   /* Open the load module */
 
-  native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
-  f = fopen(native, "rb");				/* INTL: Native. */
-  Tcl_DStringFree(&ds);
-  
-  if (f == NULL) {
-    Tcl_AppendResult (interp, "couldn't open \"", fileName, "\": ",
-		      Tcl_PosixError (interp), (char *) NULL);
+  if ((f = fopen (fileName, "rb")) == NULL) {
+    Seterror("");
     return TCL_ERROR;
   }
 
@@ -363,13 +566,11 @@
     }
   }
 
-  /* No library list -- this must be an ill-formed module */
+  /* No library list -- assume no dependancies */
 
   if (c == EOF) {
-    Tcl_AppendResult (interp, "File \"", fileName,
-		      "\" is not a Tcl load module.", (char *) NULL);
     (void) fclose (f);
-    return TCL_ERROR;
+    return TCL_OK;
   }
 
   /* Accumulate the library list */
@@ -381,8 +582,7 @@
   (void) fclose (f);
 
   if (c == EOF) {
-    Tcl_AppendResult (interp, "Library directory in \"", fileName,
-		      "\" ends prematurely.", (char *) NULL);
+    Seterror("Library directory ends prematurely");
     return TCL_ERROR;
   }
 
@@ -413,95 +613,4 @@
   (void) unlink (SymbolTableFile);
   ckfree (SymbolTableFile);
   SymbolTableFile = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Does nothing.  Can anything be done?
- *
- *----------------------------------------------------------------------
- */
-
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
-{
-    char *p, *q, *r;
-    int srcOff, dstOff;
-
-    if (q = strrchr(fileName,'/')) {
-	q++;
-    } else {
-	q = fileName;
-    }
-    if (!strncmp(q,"lib",3)) {
-	q+=3;
-    }
-    p = q;
-    while ((*p) && (*p != '.') && ((*p<'0') || (*p>'9'))) {
-	p++;
-    }
-    if ((p>q+2) && !strncmp(p-2,"_G0.",4)) {
-	p-=2;
-    }
-    if (p<q) {
-	return 0;
-    }
-
-    Tcl_DStringAppend(bufPtr,q, p-q);
-
-    r = Tcl_DStringValue(bufPtr);
-    r += strlen(r) - (p-q);
-
-    /*
-     * Capitalize the string and then recompute the length.
-     */
-
-    Tcl_UtfToTitle(r);
-    Tcl_DStringSetLength(bufPtr, strlen(Tcl_DStringValue(bufPtr)));
-
-    return 1;
 }
--- tcl8.2-8.2.3.orig/unix/tclLoadDl.c
+++ tcl8.2-8.2.3/unix/tclLoadDl.c
@@ -59,7 +59,7 @@
 int
 TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
     Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
+    CONST char *fileName;	/* Name of the file containing the desired
 				 * code. */
     char *sym1, *sym2;		/* Names of two procedures to look up in
 				 * the file's symbol table. */
@@ -174,7 +174,7 @@
 
 int
 TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
+    CONST char *fileName;	/* Name of file containing package (already
 				 * translated to local form if needed). */
     Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
 				 * package name to this if possible. */
--- tcl8.2-8.2.3.orig/unix/tclLoadDld.c
+++ tcl8.2-8.2.3/unix/tclLoadDld.c
@@ -7,63 +7,45 @@
  *	dld-3.2.7.  This file probably isn't needed anymore, since it
  *	makes more sense to use "dl_open" etc.
  *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1995 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclLoadDld.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadDld.c,v 1.2 1998/09/14 18:40:16 stanton Exp $
  */
 
 #include "tclInt.h"
 #include "dld.h"
+#include "../compat/dlfcn.h"
 
-/*
- * In some systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined
- * and this argument to dlopen must always be 1.
- */
-
-#ifndef RTLD_NOW
-#   define RTLD_NOW 1
-#endif
 
 /*
  *----------------------------------------------------------------------
  *
- * TclpLoadFile --
+ * dlopen --
  *
- *	Dynamically loads a binary code file into memory and returns
- *	the addresses of two procedures within that file, if they
- *	are defined.
+ *	This function is an implementation of dlopen() using
+ *	the dld library.
  *
  * Results:
- *	A standard Tcl completion code.  If an error occurs, an error
- *	message is left in the interp's result.  *proc1Ptr and *proc2Ptr
- *	are filled in with the addresses of the symbols given by
- *	*sym1 and *sym2, or NULL if those symbols can't be found.
+ *	Returns the handle of the newly loaded library, or NULL on
+ *	failure.
  *
  * Side effects:
- *	New code suddenly appears in memory.
+ *	Loads the specified library into the process.
  *
  *----------------------------------------------------------------------
  */
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code. */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+static int returnCode = 0;
+
+VOID *
+dlopen(path, mode)
+    CONST char *path;
+    int mode;
 {
     static int firstTime = 1;
-    int returnCode;
 
     /*
      *  The dld package needs to know the pathname to the tcl binary.
@@ -72,91 +54,40 @@
 
     if (firstTime) {
 	if (tclExecutableName == NULL) {
-	    Tcl_SetResult(interp,
-		    "don't know name of application binary file, so can't initialize dynamic loader",
-		    TCL_STATIC);
-	    return TCL_ERROR;
+	    return (VOID *) NULL;
 	}
 	returnCode = dld_init(tclExecutableName);
 	if (returnCode != 0) {
-	    Tcl_AppendResult(interp,
-		    "initialization failed for dynamic loader: ",
-		    dld_strerror(returnCode), (char *) NULL);
-	    return TCL_ERROR;
+	    return (VOID *) NULL;
 	}
 	firstTime = 0;
     }
 
-    if ((returnCode = dld_link(fileName)) != 0) {
-	Tcl_AppendResult(interp, "couldn't load file \"", fileName,
-	    "\": ", dld_strerror(returnCode), (char *) NULL);
-	return TCL_ERROR;
+    if ((path != NULL) && (returnCode = dld_link(path)) != 0) {
+	return (VOID *) NULL;
     }
-    *proc1Ptr = (Tcl_PackageInitProc *) dld_get_func(sym1);
-    *proc2Ptr = (Tcl_PackageInitProc *) dld_get_func(sym2);
-    *clientDataPtr = strcpy(
-	    (char *) ckalloc((unsigned) (strlen(fileName) + 1)), fileName);
-    return TCL_OK;
+    return (VOID *) 1;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Code removed from memory.
- *
- *----------------------------------------------------------------------
- */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
+VOID *
+dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
 {
-    char *fileName;
+    return (VOID *) dld_get_func(symbol);
+}
 
-    handle = (char *) clientData;
-    dld_unlink_by_file(handle, 0);
-    ckfree(handle);
+char *
+dlerror()
+{
+    if (tclExecutableName == NULL) {
+	return "don't know name of application binary file, so can't initialize dynamic loader";
+    }
+    return dld_strerror(returnCode);
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
 int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
-{
+dlclose(handle)
+    VOID *handle;
     return 0;
 }
--- tcl8.2-8.2.3.orig/unix/tclLoadNext.c
+++ tcl8.2-8.2.3/unix/tclLoadNext.c
@@ -1,142 +1,61 @@
 /* 
  * tclLoadNext.c --
  *
- *	This procedure provides a version of the TclLoadFile that
- *	works with NeXTs rld_* dynamic loading.  This file provided
- *	by Pedja Bogdanovich.
+ *	This file implements the dlopen and dlsym APIs under the
+ *	Next operating system, to enable the Tcl "load" command to
+ *	work.
  *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1995 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclLoadNext.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadNext.c,v 1.2 1998/09/14 18:40:17 stanton Exp $
  */
-
 #include "tclInt.h"
+#include "tclPort.h"
+#include "../compat/dlfcn.h"
 #include <mach-o/rld.h>
 #include <streams/streams.h>
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpLoadFile --
- *
- *	Dynamically loads a binary code file into memory and returns
- *	the addresses of two procedures within that file, if they
- *	are defined.
- *
- * Results:
- *	A standard Tcl completion code.  If an error occurs, an error
- *	message is left in the interp's result.  *proc1Ptr and *proc2Ptr
- *	are filled in with the addresses of the symbols given by
- *	*sym1 and *sym2, or NULL if those symbols can't be found.
- *
- * Side effects:
- *	New code suddenly appears in memory.
- *
- *----------------------------------------------------------------------
- */
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code. */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+static char *errorMsg = (char *) NULL;
+
+VOID *dlopen(path, mode)
+    CONST char *path;
+    int mode;
 {
   struct mach_header *header;
-  char *data;
   int len, maxlen;
+  char *data;
   char *files[]={fileName,NULL};
   NXStream *errorStream=NXOpenMemory(0,0,NX_READWRITE);
 
+  if (!errorMsg) {
+    ckfree(errorMsg);
+    errorMsg = (char *) NULL;
+  }
+
   if(!rld_load(errorStream,&header,files,NULL)) {
     NXGetMemoryBuffer(errorStream,&data,&len,&maxlen);
-    Tcl_AppendResult(interp,"couldn't load file \"",fileName,"\": ",data,NULL);
+    errorMsg = ckalloc(strlen(data)+1);
+    strcpy(errorMsg, data);
     NXCloseMemory(errorStream,NX_FREEBUFFER);
-    return TCL_ERROR;
+    return (VOID *) NULL;
   }
   NXCloseMemory(errorStream,NX_FREEBUFFER);
-
-  *proc1Ptr=NULL;
-  if(sym1) {
-    char sym[strlen(sym1)+2];
-    sym[0]='_'; sym[1]=0; strcat(sym,sym1);
-    rld_lookup(NULL,sym,(unsigned long *)proc1Ptr);
-  }
-
-  *proc2Ptr=NULL;
-  if(sym2) {
-    char sym[strlen(sym2)+2];
-    sym[0]='_'; sym[1]=0; strcat(sym,sym2);
-    rld_lookup(NULL,sym,(unsigned long *)proc2Ptr);
-  }
-  *clientDataPtr = NULL;
-
-  return TCL_OK;
+  return (VOID *) 1;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Does nothing.  Can anything be done?
- *
- *----------------------------------------------------------------------
- */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
-{
+VOID *dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
+{   VOID *procPtr = (VOID *) NULL;
+
+    rld_lookup(NULL,symbol,(unsigned long *)procPtr);
+    return procPtr;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
-int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
+char *dlerror()
 {
-    return 0;
+    return errorMsg;
 }
--- tcl8.2-8.2.3.orig/unix/tclLoadOSF.c
+++ tcl8.2-8.2.3/unix/tclLoadOSF.c
@@ -26,65 +26,35 @@
  *
  *	John Robert LoVerso <loverso@freebsd.osf.org>
  *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1995 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclLoadOSF.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadOSF.c,v 1.2 1998/09/14 18:40:17 stanton Exp $
  */
 
 #include "tclInt.h"
-#include <sys/types.h>
+#include "tclPort.h"
 #include <loader.h>
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpLoadFile --
- *
- *	Dynamically loads a binary code file into memory and returns
- *	the addresses of two procedures within that file, if they
- *	are defined.
- *
- * Results:
- *	A standard Tcl completion code.  If an error occurs, an error
- *	message is left in the interp's result.  *proc1Ptr and *proc2Ptr
- *	are filled in with the addresses of the symbols given by
- *	*sym1 and *sym2, or NULL if those symbols can't be found.
- *
- * Side effects:
- *	New code suddenly appears in memory.
- *
- *----------------------------------------------------------------------
- */
+#include "../compat/dlfcn.h"
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code. */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+VOID *dlopen(path, mode)
+    CONST char *path;
+    int mode;
 {
     ldr_module_t lm;
-    char *pkg;
+    VOID *handle;
 
-    lm = (Tcl_PackageInitProc *) load(fileName, LDR_NOFLAGS);
+    if (!path) {
+	return (VOID *) NULL;
+    }
+
+    lm = (ldr_module_t) load(fileName, LDR_NOFLAGS);
     if (lm == LDR_NULL_MODULE) {
-	Tcl_AppendResult(interp, "couldn't load file \"", fileName,
-	    "\": ", Tcl_PosixError (interp), (char *) NULL);
-	return TCL_ERROR;
+	return (VOID *) NULL;
     }
 
-    *clientDataPtr = NULL;
-    
     /*
      * My convention is to use a [OSF loader] package name the same as shlib,
      * since the idiots never implemented ldr_lookup() and it is otherwise
@@ -93,68 +63,23 @@
      * I build loadable modules with a makefile rule like 
      *		ld ... -export $@: -o $@ $(OBJS)
      */
-    if ((pkg = strrchr(fileName, '/')) == NULL)
-	pkg = fileName;
-    else
-	pkg++;
-    *proc1Ptr = ldr_lookup_package(pkg, sym1);
-    *proc2Ptr = ldr_lookup_package(pkg, sym2);
-    return TCL_OK;
+
+    if ((handle = (VOID *) strrchr(path, '/')) == (VOID *) NULL)
+	handle = (VOID *) path;
+    } else {
+	((char *) handle)++;
+    }
+    return handle;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Does nothing.  Can anything be done?
- *
- *----------------------------------------------------------------------
- */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
+VOID *dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
 {
+    return (VOID *) ldr_lookup_package((char *) handle, symbol);
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
-int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
+char *dlerror()
 {
-    return 0;
+    return Tcl_ErrnoMsg(errno);
 }
--- tcl8.2-8.2.3.orig/unix/tclLoadShl.c
+++ tcl8.2-8.2.3/unix/tclLoadShl.c
@@ -5,12 +5,12 @@
  *	with the "shl_load" and "shl_findsym" library procedures for
  *	dynamic loading (e.g. for HP machines).
  *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1996 Sun Microsystems, Inc.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclLoadShl.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadShl.c,v 1.2 1998/09/14 18:40:17 stanton Exp $
  */
 
 #include <dl.h>
@@ -24,151 +24,56 @@
 #endif
 
 #include "tcl.h"
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpLoadFile --
- *
- *	Dynamically loads a binary code file into memory and returns
- *	the addresses of two procedures within that file, if they
- *	are defined.
- *
- * Results:
- *	A standard Tcl completion code.  If an error occurs, an error
- *	message is left in the interp's result.  *proc1Ptr and *proc2Ptr
- *	are filled in with the addresses of the symbols given by
- *	*sym1 and *sym2, or NULL if those symbols can't be found.
- *
- * Side effects:
- *	New code suddenly appears in memory.
- *
- *----------------------------------------------------------------------
- */
+#include "../compat/dlfcn.h"
+#include <errno.h>
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code. */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+#ifndef DYNAMIC_PATH
+#    define DYNAMIC_PATH 0
+#endif
+
+VOID *
+dlopen(path, mode)
+    CONST char *path;
+    int mode;
 {
-    shl_t handle;
-    Tcl_DString newName;
+    int flags, length;
 
-    /*
-     * The flags below used to be BIND_IMMEDIATE; they were changed at
-     * the suggestion of Wolfgang Kechel (wolfgang@prs.de): "This
-     * enables verbosity for missing symbols when loading a shared lib
-     * and allows to load libtk8.0.sl into tclsh8.0 without problems.
-     * In general, this delays resolving symbols until they are actually
-     * needed.  Shared libs do no longer need all libraries linked in
-     * when they are build."
-     */
-
-    handle = shl_load(fileName, BIND_DEFERRED|BIND_VERBOSE, 0L);
-    if (handle == NULL) {
-	Tcl_AppendResult(interp, "couldn't load file \"", fileName,
-		"\": ", Tcl_PosixError(interp), (char *) NULL);
-	return TCL_ERROR;
+    if (path == (char *) NULL) {
+	return (VOID *) PROG_HANDLE;
     }
-    *clientDataPtr = (ClientData) handle;
-
-    /*
-     * Some versions of the HP system software still use "_" at the
-     * beginning of exported symbols while others don't;  try both
-     * forms of each name.
-     */
-
-    if (shl_findsym(&handle, sym1, (short) TYPE_PROCEDURE, (void *) proc1Ptr)
-	    != 0) {
-	Tcl_DStringInit(&newName);
-	Tcl_DStringAppend(&newName, "_", 1);
-	Tcl_DStringAppend(&newName, sym1, -1);
-	if (shl_findsym(&handle, Tcl_DStringValue(&newName),
-		(short) TYPE_PROCEDURE, (void *) proc1Ptr) != 0) {
-	    *proc1Ptr = NULL;
-	}
-	Tcl_DStringFree(&newName);
+    flags = ((mode & RTLD_NOW) ? BIND_IMMEDIATE : BIND_DEFERRED) |
+	    DYNAMIC_PATH;
+#ifdef BIND_VERBOSE
+    length = strlen(path);
+    if ((length > 2) && !(strcmp(path+length-3,".sl"))) {
+	flags |= BIND_VERBOSE;
     }
-    if (shl_findsym(&handle, sym2, (short) TYPE_PROCEDURE, (void *) proc2Ptr)
-	    != 0) {
-	Tcl_DStringInit(&newName);
-	Tcl_DStringAppend(&newName, "_", 1);
-	Tcl_DStringAppend(&newName, sym2, -1);
-	if (shl_findsym(&handle, Tcl_DStringValue(&newName),
-		(short) TYPE_PROCEDURE, (void *) proc2Ptr) != 0) {
-	    *proc2Ptr = NULL;
-	}
-	Tcl_DStringFree(&newName);
+#endif
+    return (VOID *) shl_load(path, flags, 0L);
+}
+
+VOID *
+dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
+{   VOID *address;
+
+    if (shl_findsym((shl_t *)&handle, symbol,
+	    (short) TYPE_UNDEFINED, &address) != 0) {
+	address = NULL;
     }
-    return TCL_OK;
+    return address;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Code removed from memory.
- *
- *----------------------------------------------------------------------
- */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
+char *
+dlerror()
 {
-    shl_t handle;
-
-    handle = (shl_t) clientData;
-    shl_unload(handle);
+    return Tcl_ErrnoMsg(errno);
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
 int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
+dlclose(handle)
+    VOID *handle;
 {
-    return 0;
+    return shl_unload((shl_t) handle);
 }
--- tcl8.2-8.2.3.orig/unix/tclUnixChan.c
+++ tcl8.2-8.2.3/unix/tclUnixChan.c
@@ -169,11 +169,11 @@
  */
 
 static TcpState *	CreateSocket _ANSI_ARGS_((Tcl_Interp *interp,
-			    int port, char *host, int server,
-			    char *myaddr, int myport, int async));
+			    int port, CONST char *host, int server,
+			    CONST char *myaddr, int myport, int async));
 static int		CreateSocketAddress _ANSI_ARGS_(
 			    (struct sockaddr_in *sockaddrPtr,
-			    char *host, int port));
+			    CONST char *host, int port));
 static int		FileBlockModeProc _ANSI_ARGS_((
     			    ClientData instanceData, int mode));
 static int		FileCloseProc _ANSI_ARGS_((ClientData instanceData,
@@ -1240,8 +1240,8 @@
 TclpOpenFileChannel(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;			/* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;			/* Name of file to open. */
-    char *modeString;			/* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;			/* If the open involves creating a
                                          * file, with what modes to create
@@ -1940,11 +1940,11 @@
 CreateSocket(interp, port, host, server, myaddr, myport, async)
     Tcl_Interp *interp;		/* For error reporting; can be NULL. */
     int port;			/* Port number to open. */
-    char *host;			/* Name of host on which to open port.
+    CONST char *host;		/* Name of host on which to open port.
 				 * NULL implies INADDR_ANY */
     int server;			/* 1 if socket should be a server socket,
 				 * else 0 for a client socket. */
-    char *myaddr;		/* Optional client-side address */
+    CONST char *myaddr;		/* Optional client-side address */
     int myport;			/* Optional client-side port */
     int async;			/* If nonzero and creating a client socket,
                                  * attempt to do an async connect. Otherwise
@@ -2101,7 +2101,7 @@
 static int
 CreateSocketAddress(sockaddrPtr, host, port)
     struct sockaddr_in *sockaddrPtr;	/* Socket address */
-    char *host;				/* Host.  NULL implies INADDR_ANY */
+    CONST char *host;			/* Host.  NULL implies INADDR_ANY */
     int port;				/* Port number */
 {
     struct hostent *hostent;		/* Host database entry */
@@ -2179,8 +2179,8 @@
 Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
     Tcl_Interp *interp;			/* For error reporting; can be NULL. */
     int port;				/* Port number to open. */
-    char *host;				/* Host on which to open port. */
-    char *myaddr;			/* Client-side address */
+    CONST char *host;			/* Host on which to open port. */
+    CONST char *myaddr;			/* Client-side address */
     int myport;				/* Client-side port */
     int async;				/* If nonzero, attempt to do an
                                          * asynchronous connect. Otherwise
@@ -2276,7 +2276,7 @@
     Tcl_Interp *interp;			/* For error reporting - may be
                                          * NULL. */
     int port;				/* Port number to open. */
-    char *myHost;			/* Name of local host. */
+    CONST char *myHost;			/* Name of local host. */
     Tcl_TcpAcceptProc *acceptProc;	/* Callback for accepting connections
                                          * from new clients. */
     ClientData acceptProcData;		/* Data for the callback. */
@@ -2443,8 +2443,10 @@
      * Set up the normal channel options for stdio handles.
      */
 
-    Tcl_SetChannelOption(NULL, channel, "-translation", "auto");
-    Tcl_SetChannelOption(NULL, channel, "-buffering", bufMode);
+    if (channel != (Tcl_Channel)NULL) {
+	Tcl_SetChannelOption(NULL, channel, "-translation", "auto");
+	Tcl_SetChannelOption(NULL, channel, "-buffering", bufMode);
+    }
     return channel;
 }
 
@@ -2473,7 +2475,7 @@
 int
 Tcl_GetOpenFile(interp, string, forWriting, checkUsage, filePtr)
     Tcl_Interp *interp;		/* Interpreter in which to find file. */
-    char *string;		/* String that identifies file. */
+    CONST char *string;		/* String that identifies file. */
     int forWriting;		/* 1 means the file is going to be used
 				 * for writing, 0 means for reading. */
     int checkUsage;		/* 1 means verify that the file was opened
--- tcl8.2-8.2.3.orig/unix/tclUnixEvent.c
+++ tcl8.2-8.2.3/unix/tclUnixEvent.c
@@ -13,6 +13,9 @@
 
 #include "tclInt.h"
 #include "tclPort.h"
+
+extern TclStubs tclStubs;
+
 
 /*
  *----------------------------------------------------------------------
@@ -36,6 +39,11 @@
 {
     struct timeval delay;
     Tcl_Time before, after;
+
+    if (tclStubs.tcl_Sleep != Tcl_Sleep) {
+	tclStubs.tcl_Sleep(ms);
+	return;
+    }
 
     /*
      * The only trick here is that select appears to return early
--- tcl8.2-8.2.3.orig/unix/tclUnixFCmd.c
+++ tcl8.2-8.2.3/unix/tclUnixFCmd.c
@@ -1187,7 +1187,7 @@
 	return TCL_ERROR;
     }
 
-    sprintf(returnString, "%0#5lo", (statBuf.st_mode & 0x00007FFF));
+    sprintf(returnString, "%0#5lo", (unsigned long) (statBuf.st_mode & 0x00007FFF));
 
     *attributePtrPtr = Tcl_NewStringObj(returnString, -1);
     
--- tcl8.2-8.2.3.orig/unix/tclUnixFile.c
+++ tcl8.2-8.2.3/unix/tclUnixFile.c
@@ -176,7 +176,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclpMatchFiles --
+ * TclpMatchFilesTypes --
  *
  *	This routine is used by the globbing code to search a
  *	directory for all files which match a given pattern.
@@ -195,13 +195,16 @@
  */
 
 int
-TclpMatchFiles(interp, separators, dirPtr, pattern, tail)
-    Tcl_Interp *interp;		/* Interpreter to receive results. */
-    char *separators;		/* Path separators to pass to TclDoGlob. */
-    Tcl_DString *dirPtr;	/* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
-    char *tail;			/* Pointer to end of pattern. Must not
-				 * refer to a static string. */
+TclpMatchFilesTypes(
+    Tcl_Interp *interp,		/* Interpreter to receive results. */
+    char *separators,		/* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,	/* Contains path to directory to search. */
+    char *pattern,		/* Pattern to match against. */
+    char *tail,			/* Pointer to end of pattern.  Tail must
+				 * point to a location in pattern and must
+				 * not be static.*/
+    GlobTypeData *types)	/* Object containing list of acceptable types.
+				 * May be NULL. */
 {
     char *native, *dirName, *patternEnd = tail;
     char savedChar = 0;		/* lint. */
@@ -211,6 +214,10 @@
     int matchHidden;
     int result = TCL_OK;
     int baseLength = Tcl_DStringLength(dirPtr);
+    Tcl_Obj *resultPtr;
+
+    /* Until we actually handle types, we do this to avoid warnings */
+    types = NULL;     
 
     /*
      * Make sure that the directory part of the name really is a
@@ -289,6 +296,7 @@
     savedChar = *patternEnd;
     *patternEnd = '\0';
 
+    resultPtr = Tcl_GetObjResult(interp);
     while (1) {
 	char *utf;
 	struct dirent *entryPtr;
@@ -319,11 +327,12 @@
 	    Tcl_DStringSetLength(dirPtr, baseLength);
 	    Tcl_DStringAppend(dirPtr, utf, -1);
 	    if (tail == NULL) {
-		Tcl_AppendElement(interp, Tcl_DStringValue(dirPtr));
+		Tcl_ListObjAppendElement(interp, resultPtr, 
+					 Tcl_NewStringObj(Tcl_DStringValue(dirPtr),Tcl_DStringLength(dirPtr)));
 	    } else if ((TclpStat(Tcl_DStringValue(dirPtr), &statBuf) == 0)
 		    && S_ISDIR(statBuf.st_mode)) {
 		Tcl_DStringAppend(dirPtr, "/", 1);
-		result = TclDoGlob(interp, separators, dirPtr, tail);
+		result = TclDoGlob(interp, separators, dirPtr, tail, types);
 		if (result != TCL_OK) {
 		    Tcl_DStringFree(&ds);
 		    break;
@@ -336,6 +345,25 @@
 
     closedir(d);
     return result;
+}
+
+/* 
+ * TclpMatchFiles --
+ * 
+ * This function is now obsolete.  Call the above function 
+ * 'TclpMatchFilesTypes' instead.
+ */
+int
+TclpMatchFiles(
+    Tcl_Interp *interp,		/* Interpreter to receive results. */
+    char *separators,		/* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,	/* Contains path to directory to search. */
+    char *pattern,		/* Pattern to match against. */
+    char *tail)			/* Pointer to end of pattern.  Tail must
+				 * point to a location in pattern and must
+				 * not be static.*/
+{
+    return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL);
 }
 
 /*
--- tcl8.2-8.2.3.orig/unix/tclUnixInit.c
+++ tcl8.2-8.2.3/unix/tclUnixInit.c
@@ -342,6 +342,44 @@
     TclSetLibraryPath(pathPtr);    
     Tcl_DStringFree(&buffer);
 }
+
+
+static Tcl_Obj *startupLocale = NULL;
+static Tcl_Obj *startupEncoding = NULL;
+
+void
+TclpGetStartupLocaleEncoding(encodingPtr, localePtr)
+     Tcl_Obj **encodingPtr;
+     Tcl_Obj **localePtr;
+{
+    if (encodingPtr != NULL) {
+	*encodingPtr = startupEncoding;
+    }
+    if (localePtr != NULL) {
+	*localePtr = startupLocale;
+    }
+}
+
+static void	SetStartupLocaleEncoding _ANSI_ARGS_((char *encoding, char *locale));
+void
+SetStartupLocaleEncoding(encoding, locale)
+     char *encoding;
+     char *locale;
+{
+    if (!startupLocale) {
+	if (encoding == NULL || encoding[0] == '\0') {
+	    Tcl_Panic("what's up?? can't get initial encoding??");
+	}
+	if (locale == NULL || locale[0] == '\0') {
+	    locale = "C";
+	}
+	startupEncoding = Tcl_NewStringObj(encoding,-1);
+	Tcl_IncrRefCount(startupEncoding);
+	startupLocale = Tcl_NewStringObj(locale,-1);
+	Tcl_IncrRefCount(startupLocale);
+    }
+}
+
 
 /*
  *---------------------------------------------------------------------------
@@ -411,13 +449,13 @@
 		}
 	    }
 	    if (*p != '\0') {
-		Tcl_DString ds;
 		Tcl_DStringInit(&ds);
 		Tcl_DStringAppend(&ds, p, -1);
 
 		encoding = Tcl_DStringValue(&ds);
 		Tcl_UtfToLower(Tcl_DStringValue(&ds));
 		if (Tcl_SetSystemEncoding(NULL, encoding) == TCL_OK) {
+		    SetStartupLocaleEncoding((char *)encoding, langEnv);
 		    Tcl_DStringFree(&ds);
 		    goto resetPath;
 		}
@@ -432,19 +470,23 @@
 
     Tcl_SetSystemEncoding(NULL, encoding);
 
+    SetStartupLocaleEncoding((char *)encoding, langEnv);
+
     /*
-     * Initialize the C library's locale subsystem.  This is required
-     * for input methods to work properly on X11. Note that we need to
-     * retore the initial "C" locale so that Tcl can parse numbers
-     * properly.  The side effect of setting the default locale should be to
-     * load any locale specific modules that are needed by X.
+     * Hey, Belows are helpful for X11 XIM, NOT!!!!
+     * If setlocale(LC_ALL, "") are once called, NOT reset to "C"
+     * BECAUSE OF X11 uses locale sensitive libc routines such as:
+     *		mblen()
+     *		mbstowcs()
+     *		wcstombs()
+     * Calling setlocale() with proper locale is of course needed,
+     * futhermore, keeping the proper locale setting is ALSO needed
+     * for proper XIM operation. If not, in the worst case, Tk dumps
+     * core.
+     *
+     * So Scott, Don't call setlocale() here.
+     *		m-hirano
      */
- 
-    Tcl_DStringInit(&ds);
-    Tcl_DStringAppend(&ds, setlocale(LC_ALL, NULL), -1);
-    setlocale(LC_ALL, "");
-    setlocale(LC_ALL, Tcl_DStringValue(&ds));
-    Tcl_DStringFree(&ds);
 
     /*
      * In case the initial locale is not "C", ensure that the numeric
@@ -536,6 +578,8 @@
     int unameOK;
     char *user;
     Tcl_DString ds;
+    Tcl_Obj *encoding;
+    Tcl_Obj *locale;
 
     Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, TCL_GLOBAL_ONLY);
     Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY);
@@ -593,9 +637,16 @@
 	    user = "";
 	}
     }
-    Tcl_SetVar2(interp, "tcl_platform", "user", user, TCL_GLOBAL_ONLY);
     Tcl_DStringFree(&ds);
 
+    Tcl_SetVar2(interp, "tcl_platform", "user", user, TCL_GLOBAL_ONLY);
+    TclpGetStartupLocaleEncoding(&encoding, &locale);
+    if (encoding) {
+	Tcl_SetVar2Ex(interp, "tcl_platform", "encoding", encoding, TCL_GLOBAL_ONLY);
+    }
+    if (locale) {
+	Tcl_SetVar2Ex(interp, "tcl_platform", "locale", locale, TCL_GLOBAL_ONLY);
+    }
 }
 
 /*
--- tcl8.2-8.2.3.orig/unix/tclUnixPipe.c
+++ tcl8.2-8.2.3/unix/tclUnixPipe.c
@@ -182,16 +182,18 @@
 TclpCreateTempFile(contents)
     CONST char *contents;	/* String to write into temp file, or NULL. */
 {
-    char fileName[L_tmpnam];
+    char *fileName;
     int fd;
 
-    tmpnam(fileName);					/* INTL: Native. */
-    fd = open(fileName, O_RDWR|O_CREAT|O_TRUNC, 0666);	/* INTL: Native. */
+    fileName = tempnam(NULL, "tcl");			/* INTL: Native. */
+    fd = open(fileName, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0666);	/* INTL: Native. */
     if (fd == -1) {
+        free(fileName);
 	return NULL;
     }
     fcntl(fd, F_SETFD, FD_CLOEXEC);
     unlink(fileName);					/* INTL: Native. */
+    free(fileName);
 
     if (contents != NULL) {
 	if (write(fd, contents, strlen(contents)) == -1) {
--- tcl8.2-8.2.3.orig/unix/tclUnixTest.c
+++ tcl8.2-8.2.3/unix/tclUnixTest.c
@@ -37,6 +37,10 @@
  * exercised by the "testfilehandler" command.
  */
 
+#ifdef __cplusplus
+#   define dummy /* */
+#endif
+
 typedef struct Pipe {
     TclFile readFile;		/* File handle for reading from the
 				 * pipe.  NULL means pipe doesn't exist yet. */
@@ -78,11 +82,12 @@
 static int		TestsetdefencdirCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
 int			TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
+int			Tclptest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 static int		TestalarmCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
 static int		TestgotsigCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
-static void 		AlarmHandler _ANSI_ARGS_(());
+static void 		AlarmHandler _ANSI_ARGS_((int));
 
 /*
  *----------------------------------------------------------------------
@@ -102,9 +107,49 @@
  */
 
 int
+#ifdef _USING_PROTOTYPES_
+TclplatformtestInit (
+    Tcl_Interp *interp)		/* Interpreter to add commands to. */
+#else
 TclplatformtestInit(interp)
     Tcl_Interp *interp;		/* Interpreter to add commands to. */
+#endif
 {
+    return Tclptest_Init(interp);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tclptest_Init --
+ *
+ *	Defines commands that test platform specific functionality for
+ *	Unix platforms.
+ *
+ * Results:
+ *	A standard Tcl result.
+ *
+ * Side effects:
+ *	Defines new commands.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+#ifdef _USING_PROTOTYPES_
+Tclptest_Init (
+    Tcl_Interp *interp)		/* Interpreter to add commands to. */
+#else
+Tclptest_Init(interp)
+    Tcl_Interp *interp;		/* Interpreter to add commands to. */
+#endif
+{
+    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+	return TCL_ERROR;
+    }
+    if (Tcl_PkgProvide(interp, "Tclptest", TCL_VERSION) != TCL_OK) {
+        return TCL_ERROR;
+    }
     Tcl_CreateCommand(interp, "testfilehandler", TestfilehandlerCmd,
             (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
     Tcl_CreateCommand(interp, "testfilewait", TestfilewaitCmd,
@@ -143,11 +188,19 @@
  */
 
 static int
-TestfilehandlerCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestfilehandlerCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestfilehandlerCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Pipe *pipePtr;
     int i, mask, timeout;
@@ -337,10 +390,18 @@
     return TCL_OK;
 }
 
-static void TestFileHandlerProc(clientData, mask)
+static void
+#ifdef _USING_PROTOTYPES_
+TestFileHandlerProc (
+    ClientData clientData,	/* Points to a Pipe structure. */
+    int mask)			/* Indicates which events happened:
+				 * TCL_READABLE or TCL_WRITABLE. */
+#else
+TestFileHandlerProc(clientData, mask)
     ClientData clientData;	/* Points to a Pipe structure. */
     int mask;			/* Indicates which events happened:
 				 * TCL_READABLE or TCL_WRITABLE. */
+#endif
 {
     Pipe *pipePtr = (Pipe *) clientData;
 
@@ -370,11 +431,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestfilewaitCmd (
+    ClientData clientData,		/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestfilewaitCmd(clientData, interp, argc, argv)
     ClientData clientData;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int mask, result, timeout;
     Tcl_Channel channel;
@@ -439,11 +508,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestfindexecutableCmd (
+    ClientData clientData,		/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestfindexecutableCmd(clientData, interp, argc, argv)
     ClientData clientData;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     char *oldName;
     char *oldNativeName;
@@ -493,11 +570,19 @@
  */
 
 static int
-TestgetopenfileCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestgetopenfileCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestgetopenfileCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     ClientData filePtr;
 
@@ -619,11 +704,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestalarmCmd (
+    ClientData clientData,		/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestalarmCmd(clientData, interp, argc, argv)
     ClientData clientData;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
 #ifdef SA_RESTART
     unsigned int sec;
@@ -675,7 +768,13 @@
  */
 
 static void
-AlarmHandler()
+#ifdef _USING_PROTOTYPES_
+AlarmHandler(
+    int dummy)
+#else
+AlarmHandler(dummy)
+    int dummy;
+#endif
 {
     gotsig = "1";
 }
@@ -696,11 +795,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestgotsigCmd(
+    ClientData clientData,		/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestgotsigCmd(clientData, interp, argc, argv)
     ClientData clientData;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_AppendResult(interp, gotsig, (char *) NULL);
     gotsig = "0";
--- tcl8.2-8.2.3.orig/unix/tclXtNotify.c
+++ tcl8.2-8.2.3/unix/tclXtNotify.c
@@ -205,6 +205,11 @@
     notifier.waitForEventProc = WaitForEvent;
     Tcl_SetNotifier(&notifier);
 
+    Tcl_CreateFileHandler = CreateFileHandler;
+    Tcl_DeleteFileHandler = DeleteFileHandler;
+    Tcl_SetTimer = SetTimer;
+    Tcl_WaitForEvent = WaitForEvent;
+
     /*
      * DO NOT create the application context yet; doing so would prevent
      * external applications from setting it for us to their own ones.
--- tcl8.2-8.2.3.orig/unix/tclXtTest.c
+++ tcl8.2-8.2.3/unix/tclXtTest.c
@@ -16,13 +16,15 @@
 
 static int	TesteventloopCmd _ANSI_ARGS_((ClientData clientData,
 		    Tcl_Interp *interp, int argc, char **argv));
-extern void	InitNotifier _ANSI_ARGS_((void));
+EXTERN void	InitNotifier _ANSI_ARGS_((void));
+EXTERN int	Xttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+EXTERN int	Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 
 
 /*
  *----------------------------------------------------------------------
  *
- * Tclxttest_Init --
+ * Xttest_Init, Tclxttest_Init --
  *
  *	This procedure performs application-specific initialization.
  *	Most applications, especially those that incorporate additional
@@ -37,11 +39,17 @@
  *
  *----------------------------------------------------------------------
  */
-
 int
 Tclxttest_Init(interp)
     Tcl_Interp *interp;		/* Interpreter for application. */
 {
+    return Xttest_Init(interp);
+}
+
+int
+Xttest_Init(interp)
+    Tcl_Interp *interp;		/* Interpreter for application. */
+{
     if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
 	return TCL_ERROR;
     }
@@ -51,6 +59,7 @@
             (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
+
 
 /*
  *----------------------------------------------------------------------
--- tcl8.2-8.2.3.orig/unix/tclUnixPort.h
+++ tcl8.2-8.2.3/unix/tclUnixPort.h
@@ -467,13 +467,7 @@
 
 #define TclpExit		exit
 
-#ifdef TclpStat
-#undef TclpStat
-#endif
-
 EXTERN int		TclpLstat _ANSI_ARGS_((CONST char *path, 
-			    struct stat *buf));
-EXTERN int		TclpStat _ANSI_ARGS_((CONST char *path, 
 			    struct stat *buf));
 
 /*
--- tcl8.2-8.2.3.orig/unix/Makefile.in
+++ tcl8.2-8.2.3/unix/Makefile.in
@@ -115,7 +115,7 @@
 #GENERIC_FLAGS = -DTCL_GENERIC_ONLY
 UNIX_OBJS = tclMtherr.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \
 	tclUnixFile.o tclUnixPipe.o tclUnixSock.o \
-	tclUnixTime.o tclUnixInit.o tclUnixThrd.o 
+	tclUnixTime.o tclUnixInit.o tclUnixThrd.o tclLoadDl.o
 #UNIX_OBJS =
 NOTIFY_OBJS = tclUnixNotfy.o
 #NOTIFY_OBJS =
@@ -198,7 +198,7 @@
 # modify any of this stuff by hand.
 #----------------------------------------------------------------
 
-COMPAT_OBJS =		@LIBOBJS@
+COMPAT_OBJS =		@LIBOBJS@ @DL_OBJS@
 
 AC_FLAGS =		@EXTRA_CFLAGS@ @DEFS@
 RANLIB =		@RANLIB@
@@ -256,7 +256,7 @@
 	tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \
 	tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o \
 	tclIOCmd.o tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o \
-	tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \
+	tclLiteral.o tclLoad.o tclStdMain.o tclNamesp.o tclNotify.o \
 	tclObj.o tclPanic.o tclParse.o tclParseExpr.o tclPipe.o \
 	tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o tclRegexp.o \
 	tclResolve.o tclResult.o tclScan.o tclStringObj.o tclThread.o \
@@ -264,7 +264,7 @@
 
 STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS}
 
-OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} @DL_OBJS@
+OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS}
 
 TCL_DECLS = \
 	$(GENERIC_DIR)/tcl.decls \
@@ -318,7 +318,8 @@
 	$(GENERIC_DIR)/tclListObj.c \
 	$(GENERIC_DIR)/tclLiteral.c \
 	$(GENERIC_DIR)/tclLoad.c \
-	$(GENERIC_DIR)/tclMain.c \
+	$(GENERIC_DIR)/tclLoadDl.c \
+	$(GENERIC_DIR)/tclStdMain.c \
 	$(GENERIC_DIR)/tclNamesp.c \
 	$(GENERIC_DIR)/tclNotify.c \
 	$(GENERIC_DIR)/tclObj.c \
@@ -368,8 +369,6 @@
 DL_SRCS = \
 	$(UNIX_DIR)/tclLoadAix.c \
 	$(UNIX_DIR)/tclLoadAout.c \
-	$(UNIX_DIR)/tclLoadDl.c \
-	$(UNIX_DIR)/tclLoadDl2.c \
 	$(UNIX_DIR)/tclLoadDld.c \
 	$(GENERIC_DIR)/tclLoadNone.c \
 	$(UNIX_DIR)/tclLoadOSF.c \
@@ -803,8 +802,8 @@
 tclLoadShl.o: $(UNIX_DIR)/tclLoadShl.c
 	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclLoadShl.c
 
-tclMain.o: $(GENERIC_DIR)/tclMain.c
-	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclMain.c
+tclStdMain.o: $(GENERIC_DIR)/tclStdMain.c
+	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStdMain.c
 
 tclMtherr.o: $(UNIX_DIR)/tclMtherr.c
 	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclMtherr.c
@@ -924,7 +923,7 @@
 # the Xt based notifier can modify them to suit their own installation.
 
 xttest:  ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} \
-	@DL_OBJS@ ${BUILD_DLTEST}
+	${BUILD_DLTEST}
 	${CC} ${XTTEST_OBJS} ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} \
 		@DL_OBJS@ @TCL_BUILD_LIB_SPEC@ ${LIBS} \
 		@TCL_LD_SEARCH_FLAGS@ -L/usr/openwin/lib -lXt -o xttest
--- tcl8.2-8.2.3.orig/unix/configure
+++ tcl8.2-8.2.3/unix/configure
@@ -20,9 +20,9 @@
 ac_help="$ac_help
   --disable-load          disallow dynamic loading and "load" command"
 ac_help="$ac_help
-  --enable-symbols        build with debugging symbols [--disable-symbols]"
+  --enable-symbols        build with debugging symbols [--enable-symbols]"
 ac_help="$ac_help
-  --enable-shared         build and link with shared libraries [--enable-shared]"
+  --disable-shared        build and link without shared libraries [--disable-shared]"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -4652,7 +4652,7 @@
     ECHO_VERSION='`echo ${VERSION}`'
     TCL_LIB_VERSIONS_OK=ok
     CFLAGS_DEBUG=-g
-    CFLAGS_OPTIMIZE=-O
+    CFLAGS_OPTIMIZE=-O2
     TCL_NEEDS_EXP_FILE=0
     TCL_BUILD_EXP_FILE=""
     TCL_EXP_FILE=""
@@ -4663,7 +4663,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -4675,7 +4675,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    LIBOBJS="$LIBOBJS tclLoadAix.o"
 	    DL_LIBS="-lld"
 	    LDFLAGS=""
@@ -4688,7 +4688,7 @@
 	    SHLIB_LD="shlicc -r"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -4698,7 +4698,7 @@
 	    SHLIB_LD="cc -shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-export-dynamic"
 	    LD_SEARCH_FLAGS=""
@@ -4708,7 +4708,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -4782,7 +4782,7 @@
 	    SHLIB_LD="ld -n32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
@@ -4806,7 +4806,7 @@
 	    SHLIB_LD="ld -32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -4824,10 +4824,10 @@
 
 	    if test "$have_dl" = yes; then
 		SHLIB_LD="${CC} -shared"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS="-ldl"
 		LDFLAGS="-rdynamic"
-		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+		#LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    else
 		ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dld.h""... $ac_c" 1>&6
@@ -4877,7 +4877,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -4887,7 +4887,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -4927,7 +4927,7 @@
 		SHLIB_LD="ld -Bshareable -x"
 		SHLIB_LD_LIBS=""
 		SHLIB_SUFFIX=".so"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS=""
 		LDFLAGS=""
 		LD_SEARCH_FLAGS=""
@@ -4960,7 +4960,7 @@
 	    SHLIB_LD="ld -Bshareable -x"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -5000,7 +5000,7 @@
 	    SHLIB_LD="ld -shared"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -5011,7 +5011,7 @@
 	    SHLIB_LD='ld -shared -expect_unresolved "*"'
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -5034,7 +5034,7 @@
 	    SHLIB_LD="ld -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS="-belf -Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -5044,7 +5044,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -5054,7 +5054,7 @@
 	    SHLIB_LD="ld"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -5077,7 +5077,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -5108,7 +5108,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
 		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -5131,7 +5131,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
 	    # that don't grok the -Bexport option.  Test that it does.
@@ -5326,7 +5326,7 @@
 	DL_OBJS=""
     fi
 
-    if test "x$DL_OBJS" != "x" ; then
+    if test "x$SHLIB_LD" != "x" ; then
 	BUILD_DLTEST="\$(DLTEST_TARGETS)"
     else
 	echo "Can't figure out how to do dynamic loading or shared libraries"
@@ -5368,7 +5368,7 @@
     fi
 
     if test "$SHARED_LIB_SUFFIX" = "" ; then
-	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}.1'
     fi
     if test "$UNSHARED_LIB_SUFFIX" = "" ; then
 	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
@@ -5391,13 +5391,13 @@
 fi
 
     if test "$tcl_ok" = "yes"; then
-	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
-	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
+	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
 	DBGX=g
 	echo "$ac_t""yes" 1>&6
     else
-	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
-	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
+	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
 	DBGX=""
 	echo "$ac_t""no" 1>&6
     fi
@@ -5594,7 +5594,7 @@
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
 	MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
     else
-	MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
+	MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS} -Wl,-soname,${TCL_LIB_FILE}"
 	RANLIB=":"
     fi
 else
@@ -5633,7 +5633,7 @@
     else
         TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
     fi
-    TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
+    TCL_BUILD_LIB_SPEC="`pwd`/${TCL_LIB_FILE}"
     TCL_LIB_SPEC="-L${exec_prefix}/lib ${TCL_LIB_FLAG}"
 else
     TCL_BUILD_EXP_FILE="lib.exp"
@@ -5661,7 +5661,7 @@
 if test "$prefix" != "$exec_prefix"; then
     TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib"
 else
-    TCL_PACKAGE_PATH="${prefix}/lib"
+    TCL_PACKAGE_PATH="/usr/local/lib ${prefix}/lib"
 fi
 
 #--------------------------------------------------------------------
--- tcl8.2-8.2.3.orig/unix/configure.in
+++ tcl8.2-8.2.3/unix/configure.in
@@ -483,7 +483,7 @@
     if test "x$DL_OBJS" = "xtclLoadAout.o"; then
 	MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
     else
-	MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
+	MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS} -Wl,-soname,${TCL_LIB_FILE}"
 	RANLIB=":"
     fi
 else
@@ -522,7 +522,7 @@
     else
         TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
     fi
-    TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
+    TCL_BUILD_LIB_SPEC="`pwd`/${TCL_LIB_FILE}"
     TCL_LIB_SPEC="-L${exec_prefix}/lib ${TCL_LIB_FLAG}"
 else
     TCL_BUILD_EXP_FILE="lib.exp"
@@ -550,7 +550,7 @@
 if test "$prefix" != "$exec_prefix"; then
     TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib"
 else
-    TCL_PACKAGE_PATH="${prefix}/lib"
+    TCL_PACKAGE_PATH="/usr/local/lib ${prefix}/lib"
 fi
 
 #--------------------------------------------------------------------
--- tcl8.2-8.2.3.orig/unix/aclocal.m4
+++ tcl8.2-8.2.3/unix/aclocal.m4
@@ -308,7 +308,7 @@
 AC_DEFUN(SC_ENABLE_SHARED, [
     AC_MSG_CHECKING([how to build libraries])
     AC_ARG_ENABLE(shared,
-	[  --enable-shared         build and link with shared libraries [--enable-shared]],
+	[  --disable-shared        build and link without shared libraries [--disable-shared]],
 	[tcl_ok=$enableval], [tcl_ok=yes])
 
     if test "${enable_shared+set}" = set; then
@@ -406,15 +406,15 @@
 
 AC_DEFUN(SC_ENABLE_SYMBOLS, [
     AC_MSG_CHECKING([for build with symbols])
-    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--disable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
+    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--enable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
     if test "$tcl_ok" = "yes"; then
-	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
-	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
+	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
 	DBGX=g
 	AC_MSG_RESULT([yes])
     else
-	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
-	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
+	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
 	DBGX=""
 	AC_MSG_RESULT([no])
     fi
@@ -558,7 +558,7 @@
     ECHO_VERSION='`echo ${VERSION}`'
     TCL_LIB_VERSIONS_OK=ok
     CFLAGS_DEBUG=-g
-    CFLAGS_OPTIMIZE=-O
+    CFLAGS_OPTIMIZE=-O2
     TCL_NEEDS_EXP_FILE=0
     TCL_BUILD_EXP_FILE=""
     TCL_EXP_FILE=""
@@ -569,7 +569,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -581,7 +581,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    LIBOBJS="$LIBOBJS tclLoadAix.o"
 	    DL_LIBS="-lld"
 	    LDFLAGS=""
@@ -594,7 +594,7 @@
 	    SHLIB_LD="shlicc -r"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -604,7 +604,7 @@
 	    SHLIB_LD="cc -shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-export-dynamic"
 	    LD_SEARCH_FLAGS=""
@@ -614,7 +614,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -648,7 +648,7 @@
 	    SHLIB_LD="ld -n32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
@@ -672,7 +672,7 @@
 	    SHLIB_LD="ld -32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -690,10 +690,10 @@
 
 	    if test "$have_dl" = yes; then
 		SHLIB_LD="${CC} -shared"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS="-ldl"
 		LDFLAGS="-rdynamic"
-		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+		#LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    else
 		AC_CHECK_HEADER(dld.h, [
 		    SHLIB_LD="ld -shared"
@@ -711,7 +711,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -721,7 +721,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -733,7 +733,7 @@
 		SHLIB_LD="ld -Bshareable -x"
 		SHLIB_LD_LIBS=""
 		SHLIB_SUFFIX=".so"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS=""
 		LDFLAGS=""
 		LD_SEARCH_FLAGS=""
@@ -761,7 +761,7 @@
 	    SHLIB_LD="ld -Bshareable -x"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -798,7 +798,7 @@
 	    SHLIB_LD="ld -shared"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -809,7 +809,7 @@
 	    SHLIB_LD='ld -shared -expect_unresolved "*"'
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -832,7 +832,7 @@
 	    SHLIB_LD="ld -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS="-belf -Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -842,7 +842,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -852,7 +852,7 @@
 	    SHLIB_LD="ld"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -875,7 +875,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -906,7 +906,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
 		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -929,7 +929,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
 	    # that don't grok the -Bexport option.  Test that it does.
@@ -1037,7 +1037,7 @@
 	DL_OBJS=""
     fi
 
-    if test "x$DL_OBJS" != "x" ; then
+    if test "x$SHLIB_LD" != "x" ; then
 	BUILD_DLTEST="\$(DLTEST_TARGETS)"
     else
 	echo "Can't figure out how to do dynamic loading or shared libraries"
@@ -1079,7 +1079,7 @@
     fi
 
     if test "$SHARED_LIB_SUFFIX" = "" ; then
-	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}.1'
     fi
     if test "$UNSHARED_LIB_SUFFIX" = "" ; then
 	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
--- tcl8.2-8.2.3.orig/unix/tclConfig.sh.in
+++ tcl8.2-8.2.3/unix/tclConfig.sh.in
@@ -20,6 +20,15 @@
 # C compiler to use for compilation.
 TCL_CC='@CC@'
 
+# C++ compiler to use for compilation.
+TCL_CXX='@CXX@'
+
+# C flags to use for compilation.
+TCL_CFLAGS='@CFLAGS@'
+
+# C++ flags to use for compilation.
+TCL_CXXFLAGS='@CXXFLAGS@'
+
 # -D flags for use with the C compiler.
 TCL_DEFS='@DEFS@'
 
@@ -50,6 +59,13 @@
 # VERSION.  On most UNIX systems this is ${VERSION}.exp.
 TCL_EXPORT_FILE_SUFFIX='@CFG_TCL_EXPORT_FILE_SUFFIX@'
 
+# Flag to indicate whether shared libraries need export files.
+TCL_NEEDS_EXP_FILE=@TCL_NEEDS_EXP_FILE@
+# String that can be evaluated to generate the part of the export file
+# name that comes after the "libxxx" (includes version number, if any,
+# extension, and anything else needed).  May depend on the variables
+# VERSION.  On most UNIX systems this is ${VERSION}.exp.
+TCL_EXPORT_FILE_SUFFIX='@CFG_TCL_EXPORT_FILE_SUFFIX@'
 # Additional libraries to use when linking Tcl.
 TCL_LIBS='@DL_LIBS@ @LIBS@ @MATH_LIBS@'
 
@@ -64,6 +80,9 @@
 # Flags to pass to cc when compiling the components of a shared library:
 TCL_SHLIB_CFLAGS='@SHLIB_CFLAGS@'
 
+# Flags to pass to cc when compiling the components of a shared library:
+TCL_SHLIB_CXXFLAGS='@SHLIB_CXXFLAGS@'
+
 # Flags to pass to cc to get warning messages
 TCL_CFLAGS_WARNING='@CFLAGS_WARNING@'
 
@@ -110,7 +129,7 @@
 
 # String to pass to linker to pick up the Tcl library from its
 # build directory.
-TCL_BUILD_LIB_SPEC='@TCL_BUILD_LIB_SPEC@'
+TCL_BUILD_LIB_SPEC='@TCL_LIB_SPEC@'
 
 # String to pass to linker to pick up the Tcl library from its
 # installed directory.
@@ -141,7 +160,7 @@
 # different place than the directory containing the source files, this
 # points to the location of the sources, not the location where Tcl was
 # compiled.
-TCL_SRC_DIR='@TCL_SRC_DIR@'
+TCL_SRC_DIR='@prefix@/include/tcl@TCL_VERSION@'
 
 # List of standard directories in which to look for packages during
 # "package require" commands.  Contains the "prefix" directory plus also
@@ -159,14 +178,14 @@
 
 # String to pass to linker to pick up the Tcl stub library from its
 # build directory.
-TCL_BUILD_STUB_LIB_SPEC='@TCL_BUILD_STUB_LIB_SPEC@'
+TCL_BUILD_STUB_LIB_SPEC='@TCL_STUB_LIB_SPEC@'
 
 # String to pass to linker to pick up the Tcl stub library from its
 # installed directory.
 TCL_STUB_LIB_SPEC='@TCL_STUB_LIB_SPEC@'
 
 # Path to the Tcl stub library in the build directory.
-TCL_BUILD_STUB_LIB_PATH='@TCL_BUILD_STUB_LIB_PATH@'
+TCL_BUILD_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@'
 
 # Path to the Tcl stub library in the install directory.
 TCL_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@'
--- tcl8.2-8.2.3.orig/unix/tcl.m4
+++ tcl8.2-8.2.3/unix/tcl.m4
@@ -308,7 +308,7 @@
 AC_DEFUN(SC_ENABLE_SHARED, [
     AC_MSG_CHECKING([how to build libraries])
     AC_ARG_ENABLE(shared,
-	[  --enable-shared         build and link with shared libraries [--enable-shared]],
+	[  --disable-shared        build and link without shared libraries [--disable-shared]],
 	[tcl_ok=$enableval], [tcl_ok=yes])
 
     if test "${enable_shared+set}" = set; then
@@ -406,15 +406,15 @@
 
 AC_DEFUN(SC_ENABLE_SYMBOLS, [
     AC_MSG_CHECKING([for build with symbols])
-    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--disable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
+    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--enable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
     if test "$tcl_ok" = "yes"; then
-	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
-	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
+	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
 	DBGX=g
 	AC_MSG_RESULT([yes])
     else
-	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
-	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
+	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
 	DBGX=""
 	AC_MSG_RESULT([no])
     fi
@@ -558,7 +558,7 @@
     ECHO_VERSION='`echo ${VERSION}`'
     TCL_LIB_VERSIONS_OK=ok
     CFLAGS_DEBUG=-g
-    CFLAGS_OPTIMIZE=-O
+    CFLAGS_OPTIMIZE=-O2
     TCL_NEEDS_EXP_FILE=0
     TCL_BUILD_EXP_FILE=""
     TCL_EXP_FILE=""
@@ -569,7 +569,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -581,7 +581,7 @@
 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    LIBOBJS="$LIBOBJS tclLoadAix.o"
 	    DL_LIBS="-lld"
 	    LDFLAGS=""
@@ -594,7 +594,7 @@
 	    SHLIB_LD="shlicc -r"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -604,7 +604,7 @@
 	    SHLIB_LD="cc -shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-export-dynamic"
 	    LD_SEARCH_FLAGS=""
@@ -614,7 +614,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -648,7 +648,7 @@
 	    SHLIB_LD="ld -n32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
@@ -672,7 +672,7 @@
 	    SHLIB_LD="ld -32 -shared -rdata_shared"
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -690,10 +690,10 @@
 
 	    if test "$have_dl" = yes; then
 		SHLIB_LD="${CC} -shared"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS="-ldl"
 		LDFLAGS="-rdynamic"
-		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+		#LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 	    else
 		AC_CHECK_HEADER(dld.h, [
 		    SHLIB_LD="ld -shared"
@@ -711,7 +711,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -721,7 +721,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS="-Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -733,7 +733,7 @@
 		SHLIB_LD="ld -Bshareable -x"
 		SHLIB_LD_LIBS=""
 		SHLIB_SUFFIX=".so"
-		DL_OBJS="tclLoadDl.o"
+		DL_OBJS=""
 		DL_LIBS=""
 		LDFLAGS=""
 		LD_SEARCH_FLAGS=""
@@ -761,7 +761,7 @@
 	    SHLIB_LD="ld -Bshareable -x"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -798,7 +798,7 @@
 	    SHLIB_LD="ld -shared"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -809,7 +809,7 @@
 	    SHLIB_LD='ld -shared -expect_unresolved "*"'
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -832,7 +832,7 @@
 	    SHLIB_LD="ld -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS=""
 	    LDFLAGS="-belf -Wl,-Bexport"
 	    LD_SEARCH_FLAGS=""
@@ -842,7 +842,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS=""
@@ -852,7 +852,7 @@
 	    SHLIB_LD="ld"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
@@ -875,7 +875,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    LDFLAGS=""
 	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -906,7 +906,7 @@
 
 	    SHLIB_LD_LIBS='${LIBS}'
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
 		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
@@ -929,7 +929,7 @@
 	    SHLIB_LD="cc -G"
 	    SHLIB_LD_LIBS=""
 	    SHLIB_SUFFIX=".so"
-	    DL_OBJS="tclLoadDl.o"
+	    DL_OBJS=""
 	    DL_LIBS="-ldl"
 	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
 	    # that don't grok the -Bexport option.  Test that it does.
@@ -1037,7 +1037,7 @@
 	DL_OBJS=""
     fi
 
-    if test "x$DL_OBJS" != "x" ; then
+    if test "x$SHLIB_LD" != "x" ; then
 	BUILD_DLTEST="\$(DLTEST_TARGETS)"
     else
 	echo "Can't figure out how to do dynamic loading or shared libraries"
@@ -1079,7 +1079,7 @@
     fi
 
     if test "$SHARED_LIB_SUFFIX" = "" ; then
-	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}.1'
     fi
     if test "$UNSHARED_LIB_SUFFIX" = "" ; then
 	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
--- tcl8.2-8.2.3.orig/unix/mkLinks
+++ tcl8.2-8.2.3/unix/mkLinks
@@ -20,6 +20,12 @@
     exit 1
 fi
 
+ln () {
+    t=${1%.[3n]}
+    s=${2%.[3n]}
+    /bin/ln -sf ${t}.3tcl ${s}.3tcl
+}
+
 cd $1
 echo foo > xyzzyTestingAVeryLongFileName.foo
 x=`echo xyzzyTe*`
@@ -320,6 +326,10 @@
     rm -f Tcl_ExposeCommand.3
     ln CrtSlave.3 Tcl_ExposeCommand.3
 fi
+if test -r MainLoop.3; then
+    rm -f Tcl_MainLoop.3
+    ln MainLoop.3 Tcl_MainLoop.3
+fi
 if test -r CrtSlave.3; then
     rm -f Tcl_HideCommand.3
     ln CrtSlave.3 Tcl_HideCommand.3
@@ -1163,6 +1173,10 @@
 if test -r SplitPath.3; then
     rm -f Tcl_SplitPath.3
     ln SplitPath.3 Tcl_SplitPath.3
+fi
+if test -r StaticFile.3; then
+    rm -f Tcl_StaticFile.3
+    ln StaticFile.3 Tcl_StaticFile.3
 fi
 if test -r SplitPath.3; then
     rm -f Tcl_JoinPath.3
--- tcl8.2-8.2.3.orig/unix/dltest/pkga.c
+++ tcl8.2-8.2.3/unix/dltest/pkga.c
@@ -17,15 +17,15 @@
  * Prototypes for procedures defined later in this file:
  */
 
-static int	Pkga_EqCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
-static int	Pkga_QuoteCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
+static int	Pkga_EqObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int	Pkga_QuoteObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkga_EqCmd --
+ * Pkga_EqObjCmd --
  *
  *	This procedure is invoked to process the "pkga_eq" Tcl command.
  *	It expects two arguments and returns 1 if they are the same,
@@ -41,30 +41,28 @@
  */
 
 static int
-Pkga_EqCmd(dummy, interp, argc, argv)
+Pkga_EqObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
-    if (argc != 3) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-		" string1 string2\"", (char *) NULL);
+    int result;
+
+    if (objc != 3) {
+	Tcl_WrongNumArgs(interp, 1, objv,  "string1 string2");
 	return TCL_ERROR;
     }
 
-    if (strcmp(argv[1], argv[2]) == 0) {
-	interp->result = "1";
-    } else {
-	interp->result = "0";
-    }
+    result = !strcmp(Tcl_GetString(objv[1]), Tcl_GetString(objv[2]));
+    Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
     return TCL_OK;
 }
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkga_quoteCmd --
+ * Pkga_quoteObjCmd --
  *
  *	This procedure is invoked to process the "pkga_quote" Tcl command.
  *	It expects one argument, which it returns as result.
@@ -79,18 +77,17 @@
  */
 
 static int
-Pkga_QuoteCmd(dummy, interp, argc, argv)
+Pkga_QuoteObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument strings. */
 {
-    if (argc != 2) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-		" value\"", (char *) NULL);
+    if (objc != 2) {
+	Tcl_WrongNumArgs(interp, 1, objv, "value");
 	return TCL_ERROR;
     }
-    strcpy(interp->result, argv[1]);
+    Tcl_SetObjResult(interp, objv[1]);
     return TCL_OK;
 }
 
@@ -118,16 +115,16 @@
 {
     int code;
 
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
     code = Tcl_PkgProvide(interp, "Pkga", "1.0");
     if (code != TCL_OK) {
 	return code;
     }
-    Tcl_CreateCommand(interp, "pkga_eq", Pkga_EqCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkga_eq", Pkga_EqObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
-    Tcl_CreateCommand(interp, "pkga_quote", Pkga_QuoteCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkga_quote", Pkga_QuoteObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
--- tcl8.2-8.2.3.orig/unix/dltest/pkgb.c
+++ tcl8.2-8.2.3/unix/dltest/pkgb.c
@@ -18,15 +18,15 @@
  * Prototypes for procedures defined later in this file:
  */
 
-static int	Pkgb_SubCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
-static int	Pkgb_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
+static int	Pkgb_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int	Pkgb_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkgb_SubCmd --
+ * Pkgb_SubObjCmd --
  *
  *	This procedure is invoked to process the "pkgb_sub" Tcl command.
  *	It expects two arguments and returns their difference.
@@ -41,31 +41,30 @@
  */
 
 static int
-Pkgb_SubCmd(dummy, interp, argc, argv)
+Pkgb_SubObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
     int first, second;
 
-    if (argc != 3) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-		" num num\"", (char *) NULL);
+    if (objc != 3) {
+	Tcl_WrongNumArgs(interp, 1, objv, "num num");
 	return TCL_ERROR;
     }
-    if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
-	    || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
+    if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+	    || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
 	return TCL_ERROR;
     }
-    sprintf(interp->result, "%d", first - second);
+    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
     return TCL_OK;
 }
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkgb_UnsafeCmd --
+ * Pkgb_UnsafeObjCmd --
  *
  *	This procedure is invoked to process the "pkgb_unsafe" Tcl command.
  *	It just returns a constant string.
@@ -80,13 +79,13 @@
  */
 
 static int
-Pkgb_UnsafeCmd(dummy, interp, argc, argv)
+Pkgb_UnsafeObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
-    interp->result = "unsafe command invoked";
+    Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
     return TCL_OK;
 }
 
@@ -114,16 +113,16 @@
 {
     int code;
 
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
     code = Tcl_PkgProvide(interp, "Pkgb", "2.3");
     if (code != TCL_OK) {
 	return code;
     }
-    Tcl_CreateCommand(interp, "pkgb_sub", Pkgb_SubCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgb_sub", Pkgb_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
-    Tcl_CreateCommand(interp, "pkgb_unsafe", Pkgb_UnsafeCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgb_unsafe", Pkgb_UnsafeObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
@@ -150,10 +149,16 @@
     Tcl_Interp *interp;		/* Interpreter in which the package is
 				 * to be made available. */
 {
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    int code;
+
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
-    Tcl_CreateCommand(interp, "pkgb_sub", Pkgb_SubCmd, (ClientData) 0,
+    code = Tcl_PkgProvide(interp, "Pkgb", "2.3");
+    if (code != TCL_OK) {
+	return code;
+    }
+    Tcl_CreateObjCommand(interp, "pkgb_sub", Pkgb_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
--- tcl8.2-8.2.3.orig/unix/dltest/pkgc.c
+++ tcl8.2-8.2.3/unix/dltest/pkgc.c
@@ -18,15 +18,15 @@
  * Prototypes for procedures defined later in this file:
  */
 
-static int	Pkgc_SubCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
-static int	Pkgc_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
+static int	Pkgc_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int	Pkgc_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkgc_SubCmd --
+ * Pkgc_SubObjCmd --
  *
  *	This procedure is invoked to process the "pkgc_sub" Tcl command.
  *	It expects two arguments and returns their difference.
@@ -41,24 +41,23 @@
  */
 
 static int
-Pkgc_SubCmd(dummy, interp, argc, argv)
+Pkgc_SubObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
     int first, second;
 
-    if (argc != 3) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-		" num num\"", (char *) NULL);
+    if (objc != 3) {
+	Tcl_WrongNumArgs(interp, 1, objv, "num num");
 	return TCL_ERROR;
     }
-    if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
-	    || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
+    if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+	    || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
 	return TCL_ERROR;
     }
-    sprintf(interp->result, "%d", first - second);
+    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
     return TCL_OK;
 }
 
@@ -80,13 +79,13 @@
  */
 
 static int
-Pkgc_UnsafeCmd(dummy, interp, argc, argv)
+Pkgc_UnsafeObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
-    interp->result = "unsafe command invoked";
+    Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
     return TCL_OK;
 }
 
@@ -114,16 +113,16 @@
 {
     int code;
 
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
     code = Tcl_PkgProvide(interp, "Pkgc", "1.7.2");
     if (code != TCL_OK) {
 	return code;
     }
-    Tcl_CreateCommand(interp, "pkgc_sub", Pkgc_SubCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgc_sub", Pkgc_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
-    Tcl_CreateCommand(interp, "pkgc_unsafe", Pkgc_UnsafeCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgc_unsafe", Pkgc_UnsafeObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
@@ -150,10 +149,16 @@
     Tcl_Interp *interp;		/* Interpreter in which the package is
 				 * to be made available. */
 {
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    int code;
+
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
-    Tcl_CreateCommand(interp, "pkgc_sub", Pkgc_SubCmd, (ClientData) 0,
+    code = Tcl_PkgProvide(interp, "Pkgc", "1.7.2");
+    if (code != TCL_OK) {
+	return code;
+    }
+    Tcl_CreateObjCommand(interp, "pkgc_sub", Pkgc_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
--- tcl8.2-8.2.3.orig/unix/dltest/pkgd.c
+++ tcl8.2-8.2.3/unix/dltest/pkgd.c
@@ -19,15 +19,15 @@
  * Prototypes for procedures defined later in this file:
  */
 
-static int	Pkgd_SubCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
-static int	Pkgd_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
+static int	Pkgd_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int	Pkgd_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+		    Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
 
 /*
  *----------------------------------------------------------------------
  *
- * Pkgd_SubCmd --
+ * Pkgd_SubObjCmd --
  *
  *	This procedure is invoked to process the "pkgd_sub" Tcl command.
  *	It expects two arguments and returns their difference.
@@ -42,24 +42,23 @@
  */
 
 static int
-Pkgd_SubCmd(dummy, interp, argc, argv)
+Pkgd_SubObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
     int first, second;
 
-    if (argc != 3) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-		" num num\"", (char *) NULL);
+    if (objc != 3) {
+	Tcl_WrongNumArgs(interp, 1, objv, "num num");
 	return TCL_ERROR;
     }
-    if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
-	    || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
+    if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+	    || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
 	return TCL_ERROR;
     }
-    sprintf(interp->result, "%d", first - second);
+    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
     return TCL_OK;
 }
 
@@ -81,13 +80,13 @@
  */
 
 static int
-Pkgd_UnsafeCmd(dummy, interp, argc, argv)
+Pkgd_UnsafeObjCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int objc;				/* Number of arguments. */
+    Tcl_Obj * CONST objv[];		/* Argument objects. */
 {
-    interp->result = "unsafe command invoked";
+    Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
     return TCL_OK;
 }
 
@@ -115,16 +114,16 @@
 {
     int code;
 
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
     code = Tcl_PkgProvide(interp, "Pkgd", "7.3");
     if (code != TCL_OK) {
 	return code;
     }
-    Tcl_CreateCommand(interp, "pkgd_sub", Pkgd_SubCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgd_sub", Pkgd_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
-    Tcl_CreateCommand(interp, "pkgd_unsafe", Pkgd_UnsafeCmd, (ClientData) 0,
+    Tcl_CreateObjCommand(interp, "pkgd_unsafe", Pkgd_UnsafeObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
@@ -151,10 +150,16 @@
     Tcl_Interp *interp;		/* Interpreter in which the package is
 				 * to be made available. */
 {
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    int code;
+
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
-    Tcl_CreateCommand(interp, "pkgd_sub", Pkgd_SubCmd, (ClientData) 0,
+    code = Tcl_PkgProvide(interp, "Pkgd", "7.3");
+    if (code != TCL_OK) {
+	return code;
+    }
+    Tcl_CreateObjCommand(interp, "pkgd_sub", Pkgd_SubObjCmd, (ClientData) 0,
 	    (Tcl_CmdDeleteProc *) NULL);
     return TCL_OK;
 }
--- tcl8.2-8.2.3.orig/unix/dltest/pkge.c
+++ tcl8.2-8.2.3/unix/dltest/pkge.c
@@ -15,14 +15,6 @@
 
 #include "tcl.h"
 
-/*
- * Prototypes for procedures defined later in this file:
- */
-
-static int	Pkgd_SubCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
-static int	Pkgd_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
-		    Tcl_Interp *interp, int argc, char **argv));
 
 /*
  *----------------------------------------------------------------------
@@ -47,7 +39,7 @@
 				 * to be made available. */
 {
     static char script[] = "if 44 {open non_existent}";
-    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
+    if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
 	return TCL_ERROR;
     }
     return Tcl_Eval(interp, script);
--- tcl8.2-8.2.3.orig/unix/dltest/Makefile.in
+++ tcl8.2-8.2.3/unix/dltest/Makefile.in
@@ -18,6 +18,13 @@
 CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic -DTCL_MEM_DEBUG \
 	${SHLIB_CFLAGS} -DUSE_TCL_STUBS ${AC_FLAGS}
 
+pkgIndex.tcl:	../tclsh pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX}
+	PATH=.:${PATH}; export PATH; \
+	LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH; \
+	SHLIB_PATH=`pwd`:${SHLIB_PATH}; export SHLIB_PATH; \
+	TCL_LIBRARY=${TOP_DIR}/library; export TCL_LIBRARY; \
+	( echo "pkg_mkIndex . pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgd${SHLIB_SUFFIX}" ) | ../tclsh
+
 all: pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX}
 
 pkga${SHLIB_SUFFIX}: $(SRC_DIR)/pkga.c
--- tcl8.2-8.2.3.orig/unix/mkinstalldirs
+++ tcl8.2-8.2.3/unix/mkinstalldirs
@@ -0,0 +1,32 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do 
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp" 1>&2
+        mkdir "$pathcomp" || errstatus=$?
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
--- tcl8.2-8.2.3.orig/generic/tclAlloc.c
+++ tcl8.2-8.2.3/generic/tclAlloc.c
@@ -29,7 +29,7 @@
 #   define RCHECK
 #endif
 
-typedef unsigned long caddr_t;
+typedef char *caddr_t;
 
 /*
  * The overhead on a block is at least 8 bytes.  When free, this space
--- tcl8.2-8.2.3.orig/generic/tclBasic.c
+++ tcl8.2-8.2.3/generic/tclBasic.c
@@ -462,7 +462,7 @@
 	    builtinFuncPtr++) {
 	Tcl_CreateMathFunc((Tcl_Interp *) iPtr, builtinFuncPtr->name,
 		builtinFuncPtr->numArgs, builtinFuncPtr->argTypes,
-		(Tcl_MathProc *) NULL, (ClientData) 0);
+		(Tcl_MathProc *) NULL, (ClientData) builtinFuncPtr->clientData);
 	hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable,
 		builtinFuncPtr->name);
 	if (hPtr == NULL) {
@@ -470,6 +470,9 @@
 	    return NULL;
 	}
 	mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr);
+	if (builtinFuncPtr->clientData != ((ClientData)-1)) {
+	    mathFuncPtr->builtinFuncIndex = i;
+	}
 	mathFuncPtr->builtinFuncIndex = i;
 	i++;
     }
@@ -548,10 +551,12 @@
 
     Tcl_PkgProvideEx(interp, "Tcl", TCL_VERSION, (ClientData) &tclStubs);
     
+#ifndef __WIN32__
 #ifdef Tcl_InitStubs
 #undef Tcl_InitStubs
 #endif
     Tcl_InitStubs(interp, TCL_VERSION, 1);
+#endif
 
     return interp;
 }
@@ -715,7 +720,7 @@
 void
 Tcl_SetAssocData(interp, name, proc, clientData)
     Tcl_Interp *interp;		/* Interpreter to associate with. */
-    char *name;			/* Name for association. */
+    CONST char *name;		/* Name for association. */
     Tcl_InterpDeleteProc *proc;	/* Proc to call when interpreter is
                                  * about to be deleted. */
     ClientData clientData;	/* One-word value to pass to proc. */
@@ -761,7 +766,7 @@
 void
 Tcl_DeleteAssocData(interp, name)
     Tcl_Interp *interp;			/* Interpreter to associate with. */
-    char *name;				/* Name of association. */
+    CONST char *name;			/* Name of association. */
 {
     Interp *iPtr = (Interp *) interp;
     AssocData *dPtr;
@@ -803,7 +808,7 @@
 ClientData
 Tcl_GetAssocData(interp, name, procPtr)
     Tcl_Interp *interp;			/* Interpreter associated with. */
-    char *name;				/* Name of association. */
+    CONST char *name;			/* Name of association. */
     Tcl_InterpDeleteProc **procPtr;	/* Pointer to place to store address
 					 * of current deletion callback. */
 {
@@ -1098,8 +1103,8 @@
 int
 Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
     Tcl_Interp *interp;		/* Interpreter in which to hide command. */
-    char *cmdName;		/* Name of command to hide. */
-    char *hiddenCmdToken;	/* Token name of the to-be-hidden command. */
+    CONST char *cmdName;	/* Name of command to hide. */
+    CONST char *hiddenCmdToken;	/* Token name of the to-be-hidden command. */
 {
     Interp *iPtr = (Interp *) interp;
     Tcl_Command cmd;
@@ -1261,8 +1266,8 @@
 Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
     Tcl_Interp *interp;		/* Interpreter in which to make command
                                  * callable. */
-    char *hiddenCmdToken;	/* Name of hidden command. */
-    char *cmdName;		/* Name of to-be-exposed command. */
+    CONST char *hiddenCmdToken;	/* Name of hidden command. */
+    CONST char *cmdName;	/* Name of to-be-exposed command. */
 {
     Interp *iPtr = (Interp *) interp;
     Command *cmdPtr;
@@ -1415,7 +1420,7 @@
 Tcl_CreateCommand(interp, cmdName, proc, clientData, deleteProc)
     Tcl_Interp *interp;		/* Token for command interpreter returned by
 				 * a previous call to Tcl_CreateInterp. */
-    char *cmdName;		/* Name of command. If it contains namespace
+    CONST char *cmdName;	/* Name of command. If it contains namespace
 				 * qualifiers, the new command is put in the
 				 * specified namespace; otherwise it is put
 				 * in the global namespace. */
@@ -1430,7 +1435,7 @@
     Namespace *nsPtr, *dummy1, *dummy2;
     Command *cmdPtr, *refCmdPtr;
     Tcl_HashEntry *hPtr;
-    char *tail;
+    CONST char *tail;
     int new;
     ImportedCmdData *dataPtr;
 
@@ -1559,7 +1564,7 @@
 Tcl_CreateObjCommand(interp, cmdName, proc, clientData, deleteProc)
     Tcl_Interp *interp;		/* Token for command interpreter (returned
 				 * by previous call to Tcl_CreateInterp). */
-    char *cmdName;		/* Name of command. If it contains namespace
+    CONST char *cmdName;	/* Name of command. If it contains namespace
 				 * qualifiers, the new command is put in the
 				 * specified namespace; otherwise it is put
 				 * in the global namespace. */
@@ -1576,7 +1581,7 @@
     Namespace *nsPtr, *dummy1, *dummy2;
     Command *cmdPtr, *refCmdPtr;
     Tcl_HashEntry *hPtr;
-    char *tail;
+    CONST char *tail;
     int new;
     ImportedCmdData *dataPtr;
 
@@ -1882,11 +1887,11 @@
 int
 TclRenameCommand(interp, oldName, newName)
     Tcl_Interp *interp;                 /* Current interpreter. */
-    char *oldName;                      /* Existing command name. */
-    char *newName;                      /* New command name. */
+    CONST char *oldName;		/* Existing command name. */
+    CONST char *newName;		/* New command name. */
 {
     Interp *iPtr = (Interp *) interp;
-    char *newTail;
+    CONST char *newTail;
     Namespace *cmdNsPtr, *newNsPtr, *dummy1, *dummy2;
     Tcl_Command cmd;
     Command *cmdPtr;
@@ -2024,7 +2029,7 @@
 Tcl_SetCommandInfo(interp, cmdName, infoPtr)
     Tcl_Interp *interp;			/* Interpreter in which to look
 					 * for command. */
-    char *cmdName;			/* Name of desired command. */
+    CONST char *cmdName;		/* Name of desired command. */
     Tcl_CmdInfo *infoPtr;		/* Where to store information about
 					 * command. */
 {
@@ -2079,7 +2084,7 @@
 Tcl_GetCommandInfo(interp, cmdName, infoPtr)
     Tcl_Interp *interp;			/* Interpreter in which to look
 					 * for command. */
-    char *cmdName;			/* Name of desired command. */
+    CONST char *cmdName;		/* Name of desired command. */
     Tcl_CmdInfo *infoPtr;		/* Where to store information about
 					 * command. */
 {
@@ -2225,7 +2230,7 @@
 Tcl_DeleteCommand(interp, cmdName)
     Tcl_Interp *interp;		/* Token for command interpreter (returned
 				 * by a previous Tcl_CreateInterp call). */
-    char *cmdName;		/* Name of command to remove. */
+    CONST char *cmdName;	/* Name of command to remove. */
 {
     Tcl_Command cmd;
 
@@ -2238,7 +2243,8 @@
     if (cmd == (Tcl_Command) NULL) {
 	return -1;
     }
-    return Tcl_DeleteCommandFromToken(interp, cmd);
+    Tcl_DeleteCommandFromToken(interp, cmd);
+    return 0;
 }
 
 /*
@@ -2248,11 +2254,12 @@
  *
  *	Removes the given command from the given interpreter. This procedure
  *	resembles Tcl_DeleteCommand, but takes a Tcl_Command token instead
- *	of a command name for efficiency.
+ *	of a command name for efficiency.  Because it works with a command
+ *	token rather than a command name, this procedure can be used to
+ *	remove both "normal" and "hidden" commands.
  *
  * Results:
- *	0 is returned if the command was deleted successfully.
- *	-1 is returned if there didn't exist a command by that name.
+ *	None.
  *
  * Side effects:
  *	The command specified by "cmd" will no longer be recognized as a
@@ -2290,7 +2297,7 @@
 
         Tcl_DeleteHashEntry(cmdPtr->hPtr);
 	cmdPtr->hPtr = NULL;
-	return 0;
+	return TCL_OK;
     }
 
     /*
@@ -2369,7 +2376,7 @@
      */
     
     TclCleanupCommand(cmdPtr);
-    return 0;
+    return TCL_OK;
 }
 
 /*
@@ -2431,7 +2438,7 @@
 Tcl_CreateMathFunc(interp, name, numArgs, argTypes, proc, clientData)
     Tcl_Interp *interp;			/* Interpreter in which function is
 					 * to be available. */
-    char *name;				/* Name of function (e.g. "sin"). */
+    CONST char *name;			/* Name of function (e.g. "sin"). */
     int numArgs;			/* Nnumber of arguments required by
 					 * function. */
     Tcl_ValueType *argTypes;		/* Array of types acceptable for
@@ -2877,7 +2884,7 @@
 Tcl_ExprLong(interp, string, ptr)
     Tcl_Interp *interp;		/* Context in which to evaluate the
 				 * expression. */
-    char *string;		/* Expression to evaluate. */
+    CONST char *string;		/* Expression to evaluate. */
     long *ptr;			/* Where to store result. */
 {
     register Tcl_Obj *exprPtr;
@@ -2928,7 +2935,7 @@
 Tcl_ExprDouble(interp, string, ptr)
     Tcl_Interp *interp;		/* Context in which to evaluate the
 				 * expression. */
-    char *string;		/* Expression to evaluate. */
+    CONST char *string;		/* Expression to evaluate. */
     double *ptr;		/* Where to store result. */
 {
     register Tcl_Obj *exprPtr;
@@ -2979,7 +2986,7 @@
 Tcl_ExprBoolean(interp, string, ptr)
     Tcl_Interp *interp;		/* Context in which to evaluate the
 			         * expression. */
-    char *string;		/* Expression to evaluate. */
+    CONST char *string;		/* Expression to evaluate. */
     int *ptr;			/* Where to store 0/1 result. */
 {
     register Tcl_Obj *exprPtr;
@@ -3148,7 +3155,7 @@
 TclInvoke(interp, argc, argv, flags)
     Tcl_Interp *interp;		/* Where to invoke the command. */
     int argc;			/* Count of args. */
-    register char **argv;	/* The arg strings; argv[0] is the name of
+    register char *argv[];	/* The arg strings; argv[0] is the name of
                                  * the command to invoke. */
     int flags;			/* Combination of flags controlling the
 				 * call: TCL_INVOKE_HIDDEN and
@@ -3500,7 +3507,7 @@
 Tcl_ExprString(interp, string)
     Tcl_Interp *interp;		/* Context in which to evaluate the
 				 * expression. */
-    char *string;		/* Expression to evaluate. */
+    CONST char *string;		/* Expression to evaluate. */
 {
     register Tcl_Obj *exprPtr;
     Tcl_Obj *resultPtr;
@@ -3912,6 +3919,8 @@
  *
  *----------------------------------------------------------------------
  */
+
+#undef Tcl_AddErrorInfo
 
 void
 Tcl_AddErrorInfo(interp, message)
--- tcl8.2-8.2.3.orig/generic/tclBinary.c
+++ tcl8.2-8.2.3/generic/tclBinary.c
@@ -125,7 +125,7 @@
 
 Tcl_Obj *
 Tcl_NewByteArrayObj(bytes, length)
-    unsigned char *bytes;	/* The array of bytes used to initialize
+    CONST unsigned char *bytes;	/* The array of bytes used to initialize
 				 * the new object. */
     int length;			/* Length of the array of bytes, which must
 				 * be >= 0. */
@@ -137,7 +137,7 @@
 
 Tcl_Obj *
 Tcl_NewByteArrayObj(bytes, length)
-    unsigned char *bytes;	/* The array of bytes used to initialize
+    CONST unsigned char *bytes;	/* The array of bytes used to initialize
 				 * the new object. */
     int length;			/* Length of the array of bytes, which must
 				 * be >= 0. */
@@ -180,11 +180,11 @@
 
 Tcl_Obj *
 Tcl_DbNewByteArrayObj(bytes, length, file, line)
-    unsigned char *bytes;	/* The array of bytes used to initialize
+    CONST unsigned char *bytes;	/* The array of bytes used to initialize
 				 * the new object. */
     int length;			/* Length of the array of bytes, which must
 				 * be >= 0. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -200,11 +200,11 @@
 
 Tcl_Obj *
 Tcl_DbNewByteArrayObj(bytes, length, file, line)
-    unsigned char *bytes;	/* The array of bytes used to initialize
+    CONST unsigned char *bytes;	/* The array of bytes used to initialize
 				 * the new object. */
     int length;			/* Length of the array of bytes, which must
 				 * be >= 0. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -234,7 +234,7 @@
 void
 Tcl_SetByteArrayObj(objPtr, bytes, length)
     Tcl_Obj *objPtr;		/* Object to initialize as a ByteArray. */
-    unsigned char *bytes;	/* The array of bytes to use as the new
+    CONST unsigned char *bytes;	/* The array of bytes to use as the new
 				 * value. */
     int length;			/* Length of the array of bytes, which must
 				 * be >= 0. */
--- tcl8.2-8.2.3.orig/generic/tclCkalloc.c
+++ tcl8.2-8.2.3/generic/tclCkalloc.c
@@ -54,7 +54,7 @@
     struct mem_header *blink;
     MemTag *tagPtr;		/* Tag from "memory tag" command;  may be
 				 * NULL. */
-    char *file;
+    CONST char *file;
     long length;
     int line;
     unsigned char low_guard[LOW_GUARD_SIZE];
@@ -131,7 +131,7 @@
 static int		MemoryCmd _ANSI_ARGS_((ClientData clientData,
 			    Tcl_Interp *interp, int argc, char **argv));
 static void		ValidateMemory _ANSI_ARGS_((
-			    struct mem_header *memHeaderP, char *file,
+			    struct mem_header *memHeaderP, CONST char *file,
 			    int line, int nukeGuards));
 
 /*
@@ -190,7 +190,7 @@
 static void
 ValidateMemory(memHeaderP, file, line, nukeGuards)
     struct mem_header *memHeaderP;
-    char              *file;
+    CONST char         *file;
     int                line;
     int                nukeGuards;
 {
@@ -259,7 +259,7 @@
  */
 void
 Tcl_ValidateAllMemory (file, line)
-    char  *file;
+    CONST char  *file;
     int    line;
 {
     struct mem_header *memScanP;
@@ -287,7 +287,7 @@
  */
 int
 Tcl_DumpActiveMemory (fileName)
-    char *fileName;
+    CONST char *fileName;
 {
     FILE              *fileP;
     struct mem_header *memScanP;
@@ -341,7 +341,7 @@
 char *
 Tcl_DbCkalloc(size, file, line)
     unsigned int size;
-    char        *file;
+    CONST char  *file;
     int          line;
 {
     struct mem_header *result;
@@ -445,7 +445,7 @@
 int
 Tcl_DbCkfree(ptr, file, line)
     char *ptr;
-    char *file;
+    CONST char *file;
     int   line;
 {
     struct mem_header *memp;
@@ -521,7 +521,7 @@
 Tcl_DbCkrealloc(ptr, size, file, line)
     char *ptr;
     unsigned int size;
-    char *file;
+    CONST char *file;
     int line;
 {
     char *new;
@@ -829,7 +829,7 @@
 char *
 Tcl_DbCkalloc(size, file, line)
     unsigned int size;
-    char        *file;
+    CONST char  *file;
     int          line;
 {
     char *result;
@@ -873,7 +873,7 @@
 Tcl_DbCkrealloc(ptr, size, file, line)
     char *ptr;
     unsigned int size;
-    char *file;
+    CONST char *file;
     int line;
 {
     char *result;
@@ -908,7 +908,7 @@
 int
 Tcl_DbCkfree(ptr, file, line)
     char *ptr;
-    char *file;
+    CONST char *file;
     int   line;
 {
     TclpFree(ptr);
@@ -924,6 +924,11 @@
  *
  *----------------------------------------------------------------------
  */
+
+#undef Tcl_InitMemory
+#undef Tcl_DumpActiveMemory
+#undef Tcl_ValidateAllMemory
+
 	/* ARGSUSED */
 void
 Tcl_InitMemory(interp)
@@ -933,14 +938,14 @@
 
 int
 Tcl_DumpActiveMemory(fileName)
-    char *fileName;
+    CONST char *fileName;
 {
     return TCL_OK;
 }
 
 void
 Tcl_ValidateAllMemory(file, line)
-    char  *file;
+    CONST char  *file;
     int    line;
 {
 }
--- tcl8.2-8.2.3.orig/generic/tclCmdAH.c
+++ tcl8.2-8.2.3/generic/tclCmdAH.c
@@ -904,7 +904,8 @@
 	    return CheckAccess(interp, objv[2], F_OK);
 	}
 	case FILE_EXTENSION: {
-	    char *fileName, *extension;
+	    char *fileName;
+	    CONST char *extension;
 	    if (objc != 3) {
 	    	goto only3Args;
 	    }
@@ -1114,7 +1115,8 @@
 	}
 	case FILE_ROOTNAME: {
 	    int length;
-	    char *fileName, *extension;
+	    char *fileName;
+	    CONST char *extension;
 	    
 	    if (objc != 3) {
 		goto only3Args;
@@ -2187,7 +2189,18 @@
 	    }
 	    switch (whichValue) {
 		case DOUBLE_VALUE: {
+#ifdef __WIN32__
+		    char *p;
+#endif
 		    sprintf(dst, newFormat, doubleValue); /* INTL: user locale. */
+#ifdef __WIN32__
+		    p = strchr(dst,'e');
+		    if (p && p[2] == '0' && strlen(p) == 5) {
+			p[2] = p[3];
+			p[3] = p[4];
+			p[4] = 0;
+		    }
+#endif
 		    break;
 		}
 		case INT_VALUE: {
--- tcl8.2-8.2.3.orig/generic/tclCmdIL.c
+++ tcl8.2-8.2.3/generic/tclCmdIL.c
@@ -76,7 +76,7 @@
  */
 
 static void		AppendLocals _ANSI_ARGS_((Tcl_Interp *interp,
-			    Tcl_Obj *listPtr, char *pattern,
+			    Tcl_Obj *listPtr, CONST char *pattern,
 			    int includeLinks));
 static int		DictionaryCompare _ANSI_ARGS_((char *left,
 			    char *right));
@@ -654,7 +654,8 @@
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
-    char *cmdName, *pattern, *simplePattern;
+    char *cmdName, *pattern;
+    CONST char *simplePattern;
     register Tcl_HashEntry *entryPtr;
     Tcl_HashSearch search;
     Namespace *nsPtr;
@@ -1276,7 +1277,7 @@
 AppendLocals(interp, listPtr, pattern, includeLinks)
     Tcl_Interp *interp;		/* Current interpreter. */
     Tcl_Obj *listPtr;		/* List object to append names to. */
-    char *pattern;		/* Pattern to match against. */
+    CONST char *pattern;	/* Pattern to match against. */
     int includeLinks;		/* 1 if upvars should be included, else 0. */
 {
     Interp *iPtr = (Interp *) interp;
@@ -1488,7 +1489,7 @@
     }
     Tcl_SetObjResult(interp, listPtr);
     return TCL_OK;
-}
+}  
 
 /*
  *----------------------------------------------------------------------
@@ -1644,7 +1645,8 @@
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
     Interp *iPtr = (Interp *) interp;
-    char *varName, *pattern, *simplePattern;
+    char *varName, *pattern;
+    CONST char *simplePattern;
     register Tcl_HashEntry *entryPtr;
     Tcl_HashSearch search;
     Var *varPtr;
@@ -2781,7 +2783,7 @@
 	objPtr2 = objPtr;
     }
     if (infoPtr->sortMode == SORTMODE_ASCII) {
-	order = strcmp(Tcl_GetString(objPtr1), Tcl_GetString(objPtr2));
+	order = strcoll(Tcl_GetString(objPtr1), Tcl_GetString(objPtr2));
     } else if (infoPtr->sortMode == SORTMODE_DICTIONARY) {
 	order = DictionaryCompare(
 		Tcl_GetString(objPtr1),	Tcl_GetString(objPtr2));
--- tcl8.2-8.2.3.orig/generic/tclCompExpr.c
+++ tcl8.2-8.2.3/generic/tclCompExpr.c
@@ -946,6 +946,13 @@
 	goto done;
     }
     mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr);
+    if (mathFuncPtr->clientData == ((ClientData) -1)) {
+	Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+		"math function \"", funcName,
+		"\" not implemented for this system", (char *) NULL);
+	code = TCL_ERROR;
+	goto done;
+    }
 
     /*
      * If not a builtin function, push an object with the function's name.
--- tcl8.2-8.2.3.orig/generic/tclEncoding.c
+++ tcl8.2-8.2.3/generic/tclEncoding.c
@@ -585,7 +585,7 @@
 	    strcpy(globArgString, "*.enc");
 	    if ((Tcl_Chdir(string) == 0)
 		    && (Tcl_Chdir("encoding") == 0)
-		    && (TclGlob(interp, globArgString, 0) == TCL_OK)) {
+		    && (TclGlob(interp, globArgString, NULL, 0, NULL) == TCL_OK)) {
 		objc2 = 0;
 
 		Tcl_ListObjGetElements(NULL, Tcl_GetObjResult(interp), &objc2,
--- tcl8.2-8.2.3.orig/generic/tclFileName.c
+++ tcl8.2-8.2.3/generic/tclFileName.c
@@ -54,6 +54,16 @@
 TclPlatformType tclPlatform = TCL_PLATFORM_UNIX;
 
 /*
+ * The "globParameters" argument of the globbing functions is an 
+ * or'ed combination of the following values:
+ */
+
+#define GLOBMODE_NO_COMPLAIN      1
+#define GLOBMODE_JOIN             2
+#define GLOBMODE_DIR              4
+#define GLOBMODE_DIR_ONLY         8
+
+/*
  * Prototypes for local procedures defined in this file:
  */
 
@@ -222,7 +232,7 @@
 
 Tcl_PathType
 Tcl_GetPathType(path)
-    char *path;
+    CONST char *path;
 {
     ThreadSpecificData *tsdPtr;
     Tcl_PathType type = TCL_PATH_ABSOLUTE;
@@ -960,7 +970,7 @@
 Tcl_TranslateFileName(interp, name, bufferPtr)
     Tcl_Interp *interp;		/* Interpreter in which to store error
 				 * message (if necessary). */
-    char *name;			/* File name, which may begin with "~" (to
+    CONST char *name;		/* File name, which may begin with "~" (to
 				 * indicate current user's home directory) or
 				 * "~<user>" (to indicate any user's home
 				 * directory). */
@@ -978,7 +988,7 @@
 	char **argv;
 	Tcl_DString temp;
 
-	Tcl_SplitPath(name, &argc, &argv);
+	Tcl_SplitPath(name, &argc, (char ***) &argv);
 	
 	/*
 	 * Strip the trailing ':' off of a Mac path before passing the user
@@ -998,12 +1008,12 @@
 	    return NULL;
 	}
 	Tcl_DStringInit(bufferPtr);
-	Tcl_JoinPath(argc, argv, bufferPtr);
+	Tcl_JoinPath(argc, (char **) argv, bufferPtr);
 	Tcl_DStringFree(&temp);
 	ckfree((char*)argv);
     } else {
 	Tcl_DStringInit(bufferPtr);
-	Tcl_JoinPath(1, &name, bufferPtr);
+	Tcl_JoinPath(1, (char **) &name, bufferPtr);
     }
 
     /*
@@ -1039,11 +1049,11 @@
  *----------------------------------------------------------------------
  */
 
-char *
+CONST char *
 TclGetExtension(name)
-    char *name;			/* File name to parse. */
+    CONST char *name;		/* File name to parse. */
 {
-    char *p, *lastSep;
+    CONST char *p, *lastSep;
 
     /*
      * First find the last directory separator.
@@ -1173,56 +1183,272 @@
     int objc;				/* Number of arguments. */
     Tcl_Obj *CONST objv[];		/* Argument objects. */
 {
-    int index, i, noComplain, skip, length;
-    char *string;
-    static char *options[] = {"-nocomplain", "--", NULL};
-    enum options {GLOB_NOCOMPLAIN, GLOB_LAST};
-
-    noComplain = 0;
-    for (skip = 1; skip < objc; skip++) {
-	string = Tcl_GetString(objv[skip]);
-	if (string[0] != '-') {
-	    break;
-	}
-	if (Tcl_GetIndexFromObj(interp, objv[skip], options, "switch",
-		TCL_EXACT, &index) != TCL_OK) {
-	    return TCL_ERROR;
+    int index, i, globFlags, pathlength, length, join, dir, result;
+    char *string, *pathOrDir, *separators;
+    Tcl_Obj *typePtr, *resultPtr, *look;
+    Tcl_DString prefix, directory;
+    static char *options[] = {"-dir", "-join", "-nocomplain", 
+      "-path", "-types", "--", NULL};
+    enum options {GLOB_DIR, GLOB_JOIN, GLOB_NOCOMPLAIN, 
+      GLOB_PATH, GLOB_TYPE, GLOB_LAST};
+    enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1};
+    GlobTypeData *globTypes = NULL;
+    
+    globFlags = 0;
+    join = 0;
+    dir = PATH_NONE;
+    pathOrDir = NULL;
+    typePtr = NULL;
+    resultPtr = Tcl_GetObjResult(interp);
+    for (i = 1; i < objc; i++) {
+	if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index)
+		!= TCL_OK) {
+	    string = Tcl_GetStringFromObj(objv[i],&length);
+	    if(string[0] == '-') {
+		/* It looks like the command contains an option so signal an error */
+		return TCL_ERROR;
+	    } else {
+		/* This clearly isn't an option; assume it's the first glob pattern */
+		/* We must clear the error */
+		Tcl_ResetResult(interp);
+		break;
+	    }
 	}
-	if (index == GLOB_NOCOMPLAIN) {
-	    noComplain = 1;
-	} else {
-	    skip++;
-	    break;
+	switch (index) {
+	    case GLOB_NOCOMPLAIN:			/* -nocomplain */
+	        globFlags |= GLOBMODE_NO_COMPLAIN;
+		break;
+	    case GLOB_DIR:			/* -dir */
+		if (i == (objc-1)) {
+		    Tcl_AppendToObj(resultPtr,
+			    "\"-dir\" option must be followed by a directory",
+			    -1);
+		    return TCL_ERROR;
+		}
+		if(dir != -1) {
+		    Tcl_AppendToObj(resultPtr,
+			    "\"-dir\" option is not compatible with \"-path\"",
+			    -1);
+		    return TCL_ERROR;
+		}
+		dir = PATH_DIR;
+		globFlags |= GLOBMODE_DIR;
+		pathOrDir = Tcl_GetStringFromObj(objv[i+1],&pathlength);
+		i++;
+		break;
+	    case GLOB_PATH:			/* -path */
+	        if (i == (objc-1)) {
+		    Tcl_AppendToObj(resultPtr,
+			    "\"-path\" option must be followed by a path",
+			    -1);
+		    return TCL_ERROR;
+		}
+		if(dir != -1) {
+		    Tcl_AppendToObj(resultPtr,
+			    "\"-path\" option is not compatible with \"-dir\"",
+			    -1);
+		    return TCL_ERROR;
+		}
+		dir = PATH_GENERAL;
+		pathOrDir = Tcl_GetStringFromObj(objv[i+1],&pathlength);
+		i++;
+		break;
+	    case GLOB_JOIN:			/* -join */
+		join = 1;
+		break;
+	    case GLOB_TYPE:			/* -type */
+	        if (i == (objc-1)) {
+		    Tcl_AppendToObj(resultPtr,
+			    "\"-types\" option must be followed by a list of types",
+			    -1);
+		    return TCL_ERROR;
+		}
+		typePtr = objv[i+1];
+		if (Tcl_ListObjLength(interp,typePtr,&length) != TCL_OK) {
+		    return TCL_ERROR;
+		}
+		i++;
+		break;
+	    case GLOB_LAST:			/* -- */
+	        i++;
+		goto endOfForLoop;
+		break;
 	}
     }
-    if (skip >= objc) {
+    endOfForLoop:
+    if (objc - i < 1) {
         Tcl_WrongNumArgs(interp, 1, objv, "?switches? name ?name ...?");
 	return TCL_ERROR;
     }
 
-    for (i = skip; i < objc; i++) {
-	string = Tcl_GetString(objv[i]);
-	if (TclGlob(interp, string, noComplain) != TCL_OK) {
-	    return TCL_ERROR;
+    separators = NULL;		/* lint. */
+    switch (tclPlatform) {
+	case TCL_PLATFORM_UNIX:
+	    separators = "/";
+	    break;
+	case TCL_PLATFORM_WINDOWS:
+	    separators = "/\\:";
+	    break;
+	case TCL_PLATFORM_MAC:
+	    separators = (pathOrDir != NULL && (strchr(pathOrDir, ':') == NULL))
+		? "/" : ":";
+	    break;
+    }
+    if (dir == PATH_GENERAL) {
+	char *last;
+
+	/*
+	 * Find the last path separator in the path
+	 */
+	last = pathOrDir + pathlength;
+	for (; last != pathOrDir; last--) {
+	    if (strchr(separators, *(last-1)) != NULL) {
+		break;
+	    }
+	}
+	if(last == pathOrDir + pathlength) {
+	    /* It's really a directory */
+	    dir = 1;
+	} else {
+	    Tcl_DString pref;
+	    char *search, *find;
+	    Tcl_DStringInit(&pref);
+	    Tcl_DStringInit(&directory);
+	    if(last == pathOrDir) {
+		/* The whole thing is a prefix */
+		Tcl_DStringAppend(&pref,pathOrDir,-1);
+		pathOrDir = NULL;
+	    } else {
+		/* Have to split off the end */
+		Tcl_DStringAppend(&pref,last,pathOrDir+pathlength-last);
+		Tcl_DStringAppend(&directory,pathOrDir,last-pathOrDir-1);
+		pathOrDir = Tcl_DStringValue(&directory);
+	    }
+	    /* Need to quote 'prefix' */
+	    Tcl_DStringInit(&prefix);
+	    search = Tcl_DStringValue(&pref);
+	    while((find = (strpbrk(search, "\\[]*?{}"))) != NULL) {
+	        Tcl_DStringAppend(&prefix,search,find-search);
+	        Tcl_DStringAppend(&prefix,"\\",1);
+	        Tcl_DStringAppend(&prefix,find,1);
+	        search = find+1;
+	        if(*search == '\0') {
+	            break;
+	        }
+	    }
+	    if(*search != '\0') {
+		Tcl_DStringAppend(&prefix,search,-1);
+	    }
+	    Tcl_DStringFree(&pref);
 	}
     }
-    if (noComplain == 0) {
-	Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length);
-	if (length == 0) {
-	    char *sep = "";
 
-	    Tcl_AppendResult(interp, "no files matched glob pattern",
-		    (objc == 2) ? " \"" : "s \"", (char *) NULL);
-	    for (i = skip; i < objc; i++) {
+    if(typePtr != NULL) {
+	/* 
+	 * The rest of the possible type arguments 
+	 * are currently ignored.
+	 */
+	while(--length >= 0) {
+	    Tcl_ListObjIndex(interp,typePtr,length,&look);
+	    if(!strcmp("d",Tcl_GetString(look))) {
+		globFlags |= GLOBMODE_DIR_ONLY;
+	    }
+	}
+    }
+
+    /* 
+     * Now we perform the actual glob below.  This may involve joining
+     * together the pattern arguments, dealing with particular file types
+     * etc.  We use a 'goto' to ensure we free any memory allocated along
+     * the way.
+     */
+    objc -= i;
+    objv += i;
+    /* 
+     * We re-retrieve this, in case it was changed in 
+     * the Tcl_ResetResult above 
+     */
+    resultPtr = Tcl_GetObjResult(interp);
+    result = TCL_OK;
+    if(join) {
+	if(dir != PATH_GENERAL) {
+	    Tcl_DStringInit(&prefix);
+	}
+	for (i = 0; i < objc; i++) {
+	    string = Tcl_GetStringFromObj(objv[i],&length);
+	    Tcl_DStringAppend(&prefix,string,length);
+	    if (i != objc -1) {
+		Tcl_DStringAppend(&prefix,separators,1);
+	    }
+	}
+	if(globFlags & GLOBMODE_DIR_ONLY) {
+	    Tcl_DStringAppend(&prefix,separators,1);
+	}
+	if (TclGlob(interp, Tcl_DStringValue(&prefix), pathOrDir, globFlags, globTypes) != TCL_OK) {
+	    result = TCL_ERROR;
+	    goto endOfGlob;
+	}
+    } else {
+	if ((dir == PATH_GENERAL) || (globFlags & GLOBMODE_DIR_ONLY)) {
+	    Tcl_DString str;
+	    for (i = 0; i < objc; i++) {
+		Tcl_DStringInit(&str);
+		if(dir == PATH_GENERAL) {
+		    Tcl_DStringAppend(&str,Tcl_DStringValue(&prefix),Tcl_DStringLength(&prefix));
+		}
+		string = Tcl_GetStringFromObj(objv[i],&length);
+		Tcl_DStringAppend(&str,string,length);
+		if(globFlags & GLOBMODE_DIR_ONLY) {
+		    Tcl_DStringAppend(&str,separators,1);
+		}
+		if (TclGlob(interp, Tcl_DStringValue(&str), pathOrDir, globFlags, globTypes) != TCL_OK) {
+		    result = TCL_ERROR;
+		    Tcl_DStringFree(&str);
+		    goto endOfGlob;
+		}
+	    }
+	    Tcl_DStringFree(&str);
+	} else {
+	    for (i = 0; i < objc; i++) {
 		string = Tcl_GetString(objv[i]);
-		Tcl_AppendResult(interp, sep, string, (char *) NULL);
-		sep = " ";
+		if (TclGlob(interp, string, pathOrDir, globFlags, globTypes) != TCL_OK) {
+		    result = TCL_ERROR;
+		    goto endOfGlob;
+		}
+	    }
+	}
+    }
+    if ((globFlags & GLOBMODE_NO_COMPLAIN) == 0) {
+	if(Tcl_ListObjLength(interp, Tcl_GetObjResult(interp), &length) != TCL_OK) {
+	    /* This should never happen.  Maybe we should be more dramatic */
+	    result = TCL_ERROR;
+	    goto endOfGlob;
+	}
+	if (length == 0) {
+	    Tcl_AppendResult(interp, "no files matched glob pattern",
+		    (join || (objc == 1)) ? " \"" : "s \"", (char *) NULL);
+	    if(join) {
+		Tcl_AppendResult(interp,Tcl_DStringValue(&prefix), (char *) NULL);
+	    } else {
+		char *sep = "";
+		for (i = 0; i < objc; i++) {
+		    string = Tcl_GetString(objv[i]);
+		    Tcl_AppendResult(interp, sep, string, (char *) NULL);
+		    sep = " ";
+		}
 	    }
 	    Tcl_AppendResult(interp, "\"", (char *) NULL);
-	    return TCL_ERROR;
+	    result = TCL_ERROR;
 	}
     }
-    return TCL_OK;
+  endOfGlob:
+    if(join || (dir == PATH_GENERAL)) {
+	Tcl_DStringFree(&prefix);
+	if(dir == PATH_GENERAL) {
+	    Tcl_DStringFree(&directory);
+	}
+    }
+    return result;
 }
 
 /*
@@ -1249,16 +1475,19 @@
 
 	/* ARGSUSED */
 int
-TclGlob(interp, pattern, noComplain)
+TclGlob(interp, pattern, unquotedPrefix, globFlags, types)
     Tcl_Interp *interp;		/* Interpreter for returning error message
 				 * or appending list of matching file names. */
     char *pattern;		/* Glob pattern to match. Must not refer
 				 * to a static string. */
-    int noComplain;		/* Flag to turn off storing error messages
-				 * in interp. */
+    char *unquotedPrefix;	/* Prefix to glob pattern, if non-null, which
+                             	 * is considered literally.  May be static. */
+    int globFlags;		/* Stores or'ed combination of flags */
+    GlobTypeData *types;	/* Struct containing acceptable types.
+				 * May be NULL. */
 {
     char *separators;
-    char *head, *tail;
+    char *head, *tail, *start;
     char c;
     int result;
     Tcl_DString buffer;
@@ -1278,19 +1507,22 @@
     }
 
     Tcl_DStringInit(&buffer);
+    if(unquotedPrefix != NULL) {
+	start = unquotedPrefix;
+    } else {
+	start = pattern;
+    }
 
     /*
      * Perform tilde substitution, if needed.
      */
 
-    if (pattern[0] == '~') {
-	char *p;
-
+    if (start[0] == '~') {
+	
 	/*
 	 * Find the first path separator after the tilde.
 	 */
-
-	for (tail = pattern; *tail != '\0'; tail++) {
+	for (tail = start; *tail != '\0'; tail++) {
 	    if (*tail == '\\') {
 		if (strchr(separators, tail[1]) != NULL) {
 		    break;
@@ -1307,20 +1539,29 @@
 	
 	c = *tail;
 	*tail = '\0';
-	p = strpbrk(pattern+1, "\\[]*?{}");
-	if (p == NULL) {
-	    head = DoTildeSubst(interp, pattern+1, &buffer);
+	/*
+	 * I don't think we need to worry about special characters in
+	 * the user name anymore (Vince Darley, June 1999), since the
+	 * new code is designed to handle special chars.
+	 */
+	#ifndef NOT_NEEDED_ANYMORE
+	head = DoTildeSubst(interp, start+1, &buffer);
+	#else
+	
+	if (strpbrk(start+1, "\\[]*?{}") == NULL) {
+	    head = DoTildeSubst(interp, start+1, &buffer);
 	} else {
-	    if (!noComplain) {
+	    if (!(globFlags & GLOBMODE_NO_COMPLAIN)) {
 		Tcl_ResetResult(interp);
 		Tcl_AppendResult(interp, "globbing characters not ",
 			"supported in user names", (char *) NULL);
 	    }
 	    head = NULL;
 	}
+	#endif
 	*tail = c;
 	if (head == NULL) {
-	    if (noComplain) {
+	    if (globFlags & GLOBMODE_NO_COMPLAIN) {
 		/*
 		 * We should in fact pass down the nocomplain flag 
 		 * or save the interp result or use another mechanism
@@ -1338,14 +1579,33 @@
 	if (head != Tcl_DStringValue(&buffer)) {
 	    Tcl_DStringAppend(&buffer, head, -1);
 	}
+	if(unquotedPrefix != NULL) {
+	    Tcl_DStringAppend(&buffer, tail, -1);
+	    tail = pattern;
+	}
     } else {
 	tail = pattern;
+	if(unquotedPrefix != NULL) {
+	    Tcl_DStringAppend(&buffer,unquotedPrefix,-1);
+	}
+    }
+    /* 
+     * If the prefix is a directory, make sure it ends in a directory
+     * separator.
+     */
+    if(unquotedPrefix != NULL) {
+	if (globFlags & GLOBMODE_DIR) {
+	    c = Tcl_DStringValue(&buffer)[Tcl_DStringLength(&buffer)-1];
+	    if (strchr(separators, c) == NULL) {
+		Tcl_DStringAppend(&buffer,separators,1);
+	    }
+	}
     }
 
-    result = TclDoGlob(interp, separators, &buffer, tail);
+    result = TclDoGlob(interp, separators, &buffer, tail, types);
     Tcl_DStringFree(&buffer);
     if (result != TCL_OK) {
-	if (noComplain) {
+	if (globFlags & GLOBMODE_NO_COMPLAIN) {
 	    Tcl_ResetResult(interp);
 	    return TCL_OK;
 	}
@@ -1413,7 +1673,11 @@
  *	This recursive procedure forms the heart of the globbing
  *	code.  It performs a depth-first traversal of the tree
  *	given by the path name to be globbed.  The directory and
- *	remainder are assumed to be native format paths.
+ *	remainder are assumed to be native format paths.  The prefix 
+ *	contained in 'headPtr' is not used as a glob pattern, simply
+ *	as a path specifier, so it can contain unquoted glob-sensitive
+ *	characters (if the directories to which it points contain
+ *	such strange characters).
  *
  * Results:
  *	The return value is a standard Tcl result indicating whether
@@ -1429,7 +1693,7 @@
  */
 
 int
-TclDoGlob(interp, separators, headPtr, tail)
+TclDoGlob(interp, separators, headPtr, tail, types)
     Tcl_Interp *interp;		/* Interpreter to use for error reporting
 				 * (e.g. unmatched brace). */
     char *separators;		/* String containing separator characters
@@ -1438,11 +1702,14 @@
     Tcl_DString *headPtr;	/* Completely expanded prefix. */
     char *tail;			/* The unexpanded remainder of the path.
 				 * Must not be a pointer to a static string. */
+    GlobTypeData *types;	/* List object containing list of acceptable types.
+				 * May be NULL. */
 {
     int baseLength, quoted, count;
     int result = TCL_OK;
     char *name, *p, *openBrace, *closeBrace, *firstSpecialChar, savedChar;
     char lastChar = 0;
+    
     int length = Tcl_DStringLength(headPtr);
 
     if (length > 0) {
@@ -1470,7 +1737,6 @@
      * for multiple separators, since they are special in Mac-style
      * paths.
      */
-
     switch (tclPlatform) {
 	case TCL_PLATFORM_MAC:
 	    if (*separators == '/') {
@@ -1594,7 +1860,7 @@
 	    Tcl_DStringAppend(&newName, element, p-element);
 	    Tcl_DStringAppend(&newName, closeBrace+1, -1);
 	    result = TclDoGlob(interp, separators,
-		    headPtr, Tcl_DStringValue(&newName));
+		    headPtr, Tcl_DStringValue(&newName), NULL);
 	    if (result != TCL_OK) {
 		break;
 	    }
@@ -1636,11 +1902,11 @@
 	 * are more characters to be processed.
 	 */
 
-	return TclpMatchFiles(interp, separators, headPtr, tail, p);
+	return TclpMatchFilesTypes(interp, separators, headPtr, tail, p, NULL);
     }
     Tcl_DStringAppend(headPtr, tail, p-tail);
     if (*p != '\0') {
-	return TclDoGlob(interp, separators, headPtr, p);
+	return TclDoGlob(interp, separators, headPtr, p, NULL);
     }
 
     /*
@@ -1657,9 +1923,11 @@
 	    name = Tcl_DStringValue(headPtr);
 	    if (TclpAccess(name, F_OK) == 0) {
 		if ((name[1] != '\0') && (strchr(name+1, ':') == NULL)) {
-		    Tcl_AppendElement(interp, name + 1);
+		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+					     Tcl_NewStringObj(name + 1,-1));
 		} else {
-		    Tcl_AppendElement(interp, name);
+		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+					     Tcl_NewStringObj(name,-1));
 		}
 	    }
 	    break;
@@ -1696,7 +1964,8 @@
 		}
 	    }
 	    if (exists) {
-		Tcl_AppendElement(interp, name);
+		Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+					 Tcl_NewStringObj(name,-1));
 	    }
 	    break;
 	}
@@ -1710,7 +1979,8 @@
 	    }
 	    name = Tcl_DStringValue(headPtr);
 	    if (TclpAccess(name, F_OK) == 0) {
-		Tcl_AppendElement(interp, name);
+		Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), 
+					 Tcl_NewStringObj(name,-1));
 	    }
 	    break;
 	}
--- tcl8.2-8.2.3.orig/generic/tclGet.c
+++ tcl8.2-8.2.3/generic/tclGet.c
@@ -40,11 +40,11 @@
 int
 Tcl_GetInt(interp, string, intPtr)
     Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
-    char *string;		/* String containing a (possibly signed)
+    CONST char *string;		/* String containing a (possibly signed)
 				 * integer in a form acceptable to strtol. */
     int *intPtr;		/* Place to store converted result. */
 {
-    char *end, *p;
+    CONST char *end, *p;
     long i;
 
     /*
@@ -59,12 +59,12 @@
     }
     if (*p == '-') {
 	p++;
-	i = -((long)strtoul(p, &end, 0)); /* INTL: Tcl source. */
+	i = -((long)strtoul(p, (char **) &end, 0)); /* INTL: Tcl source. */
     } else if (*p == '+') {
 	p++;
-	i = strtoul(p, &end, 0); /* INTL: Tcl source. */
+	i = strtoul(p, (char **) &end, 0); /* INTL: Tcl source. */
     } else {
-	i = strtoul(p, &end, 0); /* INTL: Tcl source. */
+	i = strtoul(p, (char **) &end, 0); /* INTL: Tcl source. */
     }
     if (end == p) {
 	badInteger:
@@ -126,12 +126,12 @@
 TclGetLong(interp, string, longPtr)
     Tcl_Interp *interp;		/* Interpreter used for error reporting
 				 * if not NULL. */
-    char *string;		/* String containing a (possibly signed)
+    CONST char *string;		/* String containing a (possibly signed)
 				 * long integer in a form acceptable to
 				 * strtoul. */
     long *longPtr;		/* Place to store converted long result. */
 {
-    char *end, *p;
+    CONST char *end, *p;
     long i;
 
     /*
@@ -145,12 +145,12 @@
     }
     if (*p == '-') {
 	p++;
-	i = -(int)strtoul(p, &end, 0); /* INTL: Tcl source. */
+	i = -(int)strtoul(p, (char **) &end, 0); /* INTL: Tcl source. */
     } else if (*p == '+') {
 	p++;
-	i = strtoul(p, &end, 0); /* INTL: Tcl source. */
+	i = strtoul(p, (char **) &end, 0); /* INTL: Tcl source. */
     } else {
-	i = strtoul(p, &end, 0); /* INTL: Tcl source. */
+	i = strtoul(p, (char **) &end, 0); /* INTL: Tcl source. */
     }
     if (end == p) {
 	badInteger:
@@ -202,7 +202,7 @@
 int
 Tcl_GetDouble(interp, string, doublePtr)
     Tcl_Interp *interp;		/* Interpreter used for error reporting. */
-    char *string;		/* String containing a floating-point number
+    CONST char *string;		/* String containing a floating-point number
 				 * in a form acceptable to strtod. */
     double *doublePtr;		/* Place to store converted result. */
 {
@@ -259,7 +259,7 @@
 int
 Tcl_GetBoolean(interp, string, boolPtr)
     Tcl_Interp *interp;		/* Interpreter used for error reporting. */
-    char *string;		/* String containing a boolean number
+    CONST char *string;		/* String containing a boolean number
 				 * specified either as 1/0 or true/false or
 				 * yes/no. */
     int *boolPtr;		/* Place to store converted result, which
--- tcl8.2-8.2.3.orig/generic/tclIO.c
+++ tcl8.2-8.2.3/generic/tclIO.c
@@ -438,7 +438,7 @@
     			    Channel *chanPtr));
 static int		DoRead _ANSI_ARGS_((Channel *chanPtr, char *srcPtr,
 			    int slen));
-static int		DoWrite _ANSI_ARGS_((Channel *chanPtr, char *src,
+static int		DoWrite _ANSI_ARGS_((Channel *chanPtr, CONST char *src,
 			    int srcLen));
 static int		FilterInputBytes _ANSI_ARGS_((Channel *chanPtr,
 			    GetsState *statePtr));
@@ -1178,7 +1178,7 @@
 Tcl_GetChannel(interp, chanName, modePtr)
     Tcl_Interp *interp;		/* Interpreter in which to find or create
                                  * the channel. */
-    char *chanName;		/* The name of the channel. */
+    CONST char *chanName;	/* The name of the channel. */
     int *modePtr;		/* Where to store the mode in which the
                                  * channel was opened? Will contain an ORed
                                  * combination of TCL_READABLE and
@@ -1187,7 +1187,7 @@
     Channel *chanPtr;		/* The actual channel. */
     Tcl_HashTable *hTblPtr;	/* Hash table of channels. */
     Tcl_HashEntry *hPtr;	/* Search variable. */
-    char *name;			/* Translated name. */
+    CONST char *name;		/* Translated name. */
 
     /*
      * Substitute "stdin", etc.  Note that even though we immediately
@@ -1249,7 +1249,7 @@
 Tcl_Channel
 Tcl_CreateChannel(typePtr, chanName, instanceData, mask)
     Tcl_ChannelType *typePtr;	/* The channel type record. */
-    char *chanName;		/* Name of channel to record. */
+    CONST char *chanName;	/* Name of channel to record. */
     ClientData instanceData;	/* Instance specific data. */
     int mask;			/* TCL_READABLE & TCL_WRITABLE to indicate
                                  * if the channel is readable, writable. */
@@ -2745,7 +2745,7 @@
 int
 Tcl_Write(chan, src, srcLen)
     Tcl_Channel chan;			/* The channel to buffer output for. */
-    char *src;				/* Data to queue in output buffer. */
+    CONST char *src;			/* Data to queue in output buffer. */
     int srcLen;				/* Length of data in bytes, or < 0 for
 					 * strlen(). */
 {
@@ -4651,7 +4651,7 @@
 int
 Tcl_Ungets(chan, str, len, atEnd)
     Tcl_Channel chan;		/* The channel for which to add the input. */
-    char *str;			/* The input itself. */
+    CONST char *str;		/* The input itself. */
     int len;			/* The length of the input. */
     int atEnd;			/* If non-zero, add at end of queue; otherwise
                                  * add at head of queue. */    
@@ -5455,8 +5455,8 @@
 int
 Tcl_BadChannelOption(interp, optionName, optionList)
     Tcl_Interp *interp;			/* Current interpreter. (can be NULL)*/
-    char *optionName;			/* 'bad option' name */
-    char *optionList;			/* Specific options list to append 
+    CONST char *optionName;		/* 'bad option' name */
+    CONST char *optionList;		/* Specific options list to append 
 					 * to the standard generic options.
 					 * can be NULL for generic options 
 					 * only.
@@ -5518,7 +5518,7 @@
 Tcl_GetChannelOption(interp, chan, optionName, dsPtr)
     Tcl_Interp *interp;		/* For error reporting - can be NULL. */
     Tcl_Channel chan;		/* Channel on which to get option. */
-    char *optionName;		/* Option to get. */
+    CONST char *optionName;	/* Option to get. */
     Tcl_DString *dsPtr;		/* Where to store value(s). */
 {
     size_t len;			/* Length of optionName string. */
@@ -5620,8 +5620,10 @@
         if (len == 0) {
             Tcl_DStringAppendElement(dsPtr, "-eofchar");
         }
-        if (((flags & (TCL_READABLE|TCL_WRITABLE)) ==
-                (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) {
+        if ((len == 0) &&
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) == 0 ||
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) ==
+		(TCL_READABLE|TCL_WRITABLE)))) {
             Tcl_DStringStartSublist(dsPtr);
         }
         if (flags & TCL_READABLE) {
@@ -5644,8 +5646,10 @@
                 Tcl_DStringAppendElement(dsPtr, buf);
             }
         }
-        if (((flags & (TCL_READABLE|TCL_WRITABLE)) ==
-                (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) {
+        if ((len == 0) &&
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) == 0 ||
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) ==
+		(TCL_READABLE|TCL_WRITABLE)))) {
             Tcl_DStringEndSublist(dsPtr);
         }
         if (len > 0) {
@@ -5658,8 +5662,10 @@
         if (len == 0) {
             Tcl_DStringAppendElement(dsPtr, "-translation");
         }
-        if (((flags & (TCL_READABLE|TCL_WRITABLE)) ==
-                (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) {
+        if ((len == 0) &&
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) == 0 ||
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) ==
+		(TCL_READABLE|TCL_WRITABLE)))) {
             Tcl_DStringStartSublist(dsPtr);
         }
         if (flags & TCL_READABLE) {
@@ -5684,8 +5690,10 @@
                 Tcl_DStringAppendElement(dsPtr, "lf");
             }
         }
-        if (((flags & (TCL_READABLE|TCL_WRITABLE)) ==
-                (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) {
+        if ((len == 0) &&
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) == 0 ||
+	        ((flags & (TCL_READABLE|TCL_WRITABLE)) ==
+		(TCL_READABLE|TCL_WRITABLE)))) {
             Tcl_DStringEndSublist(dsPtr);
         }
         if (len > 0) {
@@ -5699,7 +5707,7 @@
 	 */
 
         return (chanPtr->typePtr->getOptionProc) (chanPtr->instanceData,
-		  interp, optionName, dsPtr);
+		  interp, (char *) optionName, dsPtr);
     } else {
 	/*
 	 * no driver specific options case.
@@ -5733,8 +5741,8 @@
 Tcl_SetChannelOption(interp, chan, optionName, newValue)
     Tcl_Interp *interp;		/* For error reporting - can be NULL. */
     Tcl_Channel chan;		/* Channel on which to set mode. */
-    char *optionName;		/* Which option to set? */
-    char *newValue;		/* New value for option. */
+    CONST char *optionName;	/* Which option to set? */
+    CONST char *newValue;	/* New value for option. */
 {
     int newMode;		/* New (numeric) mode to sert. */
     Channel *chanPtr;		/* The real IO channel. */
@@ -5974,7 +5982,7 @@
         return TCL_OK;
     } else if (chanPtr->typePtr->setOptionProc != NULL) {
         return (*chanPtr->typePtr->setOptionProc)(chanPtr->instanceData,
-                interp, optionName, newValue);
+                interp, (char *) optionName, (char *) newValue);
     } else {
 	return Tcl_BadChannelOption(interp, optionName, (char *) NULL);
     }
@@ -7892,13 +7900,13 @@
 static int
 DoWrite(chanPtr, src, srcLen)
     Channel *chanPtr;			/* The channel to buffer output for. */
-    char *src;				/* Data to write. */
+    CONST char *src;			/* Data to write. */
     int srcLen;				/* Number of bytes to write. */
 {
     ChannelBuffer *outBufPtr;		/* Current output buffer. */
     int foundNewline;			/* Did we find a newline in output? */
     char *dPtr;
-    char *sPtr;				/* Search variables for newline. */
+    CONST char *sPtr;			/* Search variables for newline. */
     int crsent;				/* In CRLF eol translation mode,
                                          * remember the fact that a CR was
                                          * output to the channel without
--- tcl8.2-8.2.3.orig/generic/tclIOUtil.c
+++ tcl8.2-8.2.3/generic/tclIOUtil.c
@@ -107,7 +107,7 @@
 TclGetOpenMode(interp, string, seekFlagPtr)
     Tcl_Interp *interp;			/* Interpreter to use for error
 					 * reporting - may be NULL. */
-    char *string;			/* Mode string, e.g. "r+" or
+    CONST char *string;			/* Mode string, e.g. "r+" or
 					 * "RDONLY CREAT". */
     int *seekFlagPtr;			/* Set this to 1 if the caller
                                          * should seek to EOF during the
@@ -273,12 +273,12 @@
 int
 Tcl_EvalFile(interp, fileName)
     Tcl_Interp *interp;		/* Interpreter in which to process file. */
-    char *fileName;		/* Name of file to process.  Tilde-substitution
+    CONST char *fileName;	/* Name of file to process.  Tilde-substitution
 				 * will be performed on this name. */
 {
     int result, length;
     struct stat statBuf;
-    char *oldScriptFile;
+    CONST char *oldScriptFile;
     Interp *iPtr;
     Tcl_DString nameString;
     char *name, *string;
@@ -306,6 +306,7 @@
 		"\": ", Tcl_PosixError(interp), (char *) NULL);
 	goto end;
     }
+    Tcl_SetChannelOption(interp, chan, "-eofchar", "\32");
     if (Tcl_ReadChars(chan, objPtr, -1, 0) < 0) {
         Tcl_Close(interp, chan);
 	Tcl_AppendResult(interp, "couldn't read file \"", fileName,
@@ -534,8 +535,8 @@
 Tcl_OpenFileChannel(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;                 /* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;                     /* Name of file to open. */
-    char *modeString;                   /* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;                    /* If the open involves creating a
                                          * file, with what modes to create
@@ -553,8 +554,8 @@
     Tcl_MutexLock(&hookMutex);
     openFileChannelProcPtr = openFileChannelProcList;
     while ((retVal == NULL) && (openFileChannelProcPtr != NULL)) {
-	retVal = (*openFileChannelProcPtr->proc)(interp, fileName,
-		modeString, permissions);
+	retVal = (*openFileChannelProcPtr->proc)(interp, (char *) fileName,
+		(char *) modeString, permissions);
 	openFileChannelProcPtr = openFileChannelProcPtr->nextPtr;
     }
     Tcl_MutexUnlock(&hookMutex);
--- tcl8.2-8.2.3.orig/generic/tclIndexObj.c
+++ tcl8.2-8.2.3/generic/tclIndexObj.c
@@ -76,7 +76,7 @@
     char **tablePtr;		/* Array of strings to compare against the
 				 * value of objPtr; last entry must be NULL
 				 * and there must not be duplicate entries. */
-    char *msg;			/* Identifying word to use in error messages. */
+    CONST char *msg;		/* Identifying word to use in error messages. */
     int flags;			/* 0 or TCL_EXACT */
     int *indexPtr;		/* Place to store resulting integer index. */
 {
@@ -137,7 +137,7 @@
 				 * etc. The last entry must be NULL
 				 * and there must not be duplicate entries. */
     int offset;			/* The number of bytes between entries */
-    char *msg;			/* Identifying word to use in error messages. */
+    CONST char *msg;		/* Identifying word to use in error messages. */
     int flags;			/* 0 or TCL_EXACT */
     int *indexPtr;		/* Place to store resulting integer index. */
 {
@@ -304,7 +304,7 @@
     Tcl_Obj *CONST objv[];		/* Initial argument objects, which
 					 * should be included in the error
 					 * message. */
-    char *message;			/* Error message to print after the
+    CONST char *message;		/* Error message to print after the
 					 * leading objects in objv. The
 					 * message may be NULL. */
 {
--- tcl8.2-8.2.3.orig/generic/tclInterp.c
+++ tcl8.2-8.2.3/generic/tclInterp.c
@@ -808,9 +808,9 @@
 int
 Tcl_CreateAlias(slaveInterp, slaveCmd, targetInterp, targetCmd, argc, argv)
     Tcl_Interp *slaveInterp;	/* Interpreter for source command. */
-    char *slaveCmd;		/* Command to install in slave. */
+    CONST char *slaveCmd;	/* Command to install in slave. */
     Tcl_Interp *targetInterp;	/* Interpreter for target command. */
-    char *targetCmd;		/* Name of target command. */
+    CONST char *targetCmd;	/* Name of target command. */
     int argc;			/* How many additional arguments? */
     char **argv;		/* These are the additional args. */
 {
@@ -863,9 +863,9 @@
 int
 Tcl_CreateAliasObj(slaveInterp, slaveCmd, targetInterp, targetCmd, objc, objv)
     Tcl_Interp *slaveInterp;	/* Interpreter for source command. */
-    char *slaveCmd;		/* Command to install in slave. */
+    CONST char *slaveCmd;	/* Command to install in slave. */
     Tcl_Interp *targetInterp;	/* Interpreter for target command. */
-    char *targetCmd;		/* Name of target command. */
+    CONST char *targetCmd;	/* Name of target command. */
     int objc;			/* How many additional arguments? */
     Tcl_Obj *CONST objv[];	/* Argument vector. */
 {
@@ -906,7 +906,7 @@
 Tcl_GetAlias(interp, aliasName, targetInterpPtr, targetNamePtr, argcPtr,
         argvPtr)
     Tcl_Interp *interp;			/* Interp to start search from. */
-    char *aliasName;			/* Name of alias to find. */
+    CONST char *aliasName;		/* Name of alias to find. */
     Tcl_Interp **targetInterpPtr;	/* (Return) target interpreter. */
     char **targetNamePtr;		/* (Return) name of target command. */
     int *argcPtr;			/* (Return) count of addnl args. */
@@ -966,7 +966,7 @@
 Tcl_GetAliasObj(interp, aliasName, targetInterpPtr, targetNamePtr, objcPtr,
         objvPtr)
     Tcl_Interp *interp;			/* Interp to start search from. */
-    char *aliasName;			/* Name of alias to find. */
+    CONST char *aliasName;		/* Name of alias to find. */
     Tcl_Interp **targetInterpPtr;	/* (Return) target interpreter. */
     char **targetNamePtr;		/* (Return) name of target command. */
     int *objcPtr;			/* (Return) count of addnl args. */
@@ -1512,7 +1512,7 @@
 Tcl_Interp *
 Tcl_CreateSlave(interp, slavePath, isSafe)
     Tcl_Interp *interp;		/* Interpreter to start search at. */
-    char *slavePath;		/* Name of slave to create. */
+    CONST char *slavePath;	/* Name of slave to create. */
     int isSafe;			/* Should new slave be "safe" ? */
 {
     Tcl_Obj *pathPtr;
@@ -1545,7 +1545,7 @@
 Tcl_Interp *
 Tcl_GetSlave(interp, slavePath)
     Tcl_Interp *interp;		/* Interpreter to start search from. */
-    char *slavePath;		/* Path of slave to find. */
+    CONST char *slavePath;	/* Path of slave to find. */
 {
     Tcl_Obj *pathPtr;
     Tcl_Interp *slaveInterp;
--- tcl8.2-8.2.3.orig/generic/tclListObj.c
+++ tcl8.2-8.2.3/generic/tclListObj.c
@@ -147,7 +147,7 @@
 Tcl_DbNewListObj(objc, objv, file, line)
     int objc;			/* Count of objects referenced by objv. */
     Tcl_Obj *CONST objv[];	/* An array of pointers to Tcl objects. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -186,7 +186,7 @@
 Tcl_DbNewListObj(objc, objv, file, line)
     int objc;			/* Count of objects referenced by objv. */
     Tcl_Obj *CONST objv[];	/* An array of pointers to Tcl objects. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
--- tcl8.2-8.2.3.orig/generic/tclLoad.c
+++ tcl8.2-8.2.3/generic/tclLoad.c
@@ -389,7 +389,10 @@
      * target interpreter.
      */
 
-    if (code == TCL_OK) {
+    if (code != TCL_ERROR) {
+
+	code = TCL_OK;
+
 	/*
 	 * Refetch ipFirstPtr: loading the package may have introduced
 	 * additional static packages at the head of the linked list!
@@ -439,7 +442,7 @@
 					 * package has already been loaded
 					 * into the given interpreter by
 					 * calling the appropriate init proc. */
-    char *pkgName;			/* Name of package (must be properly
+    CONST char *pkgName;		/* Name of package (must be properly
 					 * capitalized: first letter upper
 					 * case, others lower case). */
     Tcl_PackageInitProc *initProc;	/* Procedure to call to incorporate
@@ -524,7 +527,7 @@
 TclGetLoadedPackages(interp, targetName)
     Tcl_Interp *interp;		/* Interpreter in which to return
 				 * information or error message. */
-    char *targetName;		/* Name of target interpreter or NULL.
+    CONST char *targetName;	/* Name of target interpreter or NULL.
 				 * If NULL, return info about all interps;
 				 * otherwise, just return info about this
 				 * interpreter. */
--- tcl8.2-8.2.3.orig/generic/tclLoadNone.c
+++ tcl8.2-8.2.3/generic/tclLoadNone.c
@@ -14,99 +14,49 @@
  */
 
 #include "tclInt.h"
+#include "../compat/dlfcn.h"
+
 
 /*
  *----------------------------------------------------------------------
  *
- * TclpLoadFile --
+ * dlopen  --
+ * dlsym   --
+ * dlerror --
+ * dlclose --
  *
- *	This procedure is called to carry out dynamic loading of binary
- *	code;  it is intended for use only on systems that don't support
- *	dynamic loading (it returns an error).
+ *	Dummy functions, in case our system doesn't support
+ *	dynamic loading.
  *
  * Results:
- *	The result is TCL_ERROR, and an error message is left in
- *	the interp's result.
+ *	NULL for dlopen() and dlsym(). Error for other functions.
  *
  * Side effects:
- *	None.
+ *	None
  *
  *----------------------------------------------------------------------
  */
 
-int
-TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
-    Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
-				 * code. */
-    char *sym1, *sym2;		/* Names of two procedures to look up in
-				 * the file's symbol table. */
-    Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
-				/* Where to return the addresses corresponding
-				 * to sym1 and sym2. */
-    ClientData *clientDataPtr;	/* Filled with token for dynamically loaded
-				 * file which will be passed back to 
-				 * TclpUnloadFile() to unload the file. */
+VOID *dlopen(path, mode)
+    CONST char *path;
+    int mode;
 {
-    Tcl_SetResult(interp,
-	    "dynamic loading is not currently available on this system",
-	    TCL_STATIC);
-    return TCL_ERROR;
+    return (VOID *) NULL;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclGuessPackageName --
- *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
- *
- * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
-int
-TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
+VOID *dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
 {
-    return 0;
+    return (VOID *) NULL;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * TclpUnloadFile --
- *
- *    This procedure is called to carry out dynamic unloading of binary
- *    code;  it is intended for use only on systems that don't support
- *    dynamic loading (it does nothing).
- *
- * Results:
- *    None.
- *
- * Side effects:
- *    None.
- *
- *----------------------------------------------------------------------
- */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;    /* ClientData returned by a previous call
-			       * to TclpLoadFile().  The clientData is 
-			       * a token that represents the loaded 
-			       * file. */
+char *dlerror() {
+    return "dynamic loading is not currently available on this system";
+}
+  
+int dlclose(handle)
+    VOID *handle;
 {
+    return -1;
 }
--- tcl8.2-8.2.3.orig/generic/tclNamesp.c
+++ tcl8.2-8.2.3/generic/tclNamesp.c
@@ -427,7 +427,7 @@
     Tcl_Interp *interp;             /* Interpreter in which a new namespace
 				     * is being created. Also used for
 				     * error reporting. */
-    char *name;                     /* Name for the new namespace. May be a
+    CONST char *name;		    /* Name for the new namespace. May be a
 				     * qualified name with names of ancestor
 				     * namespaces separated by "::"s. */
     ClientData clientData;	    /* One-word value to store with
@@ -442,7 +442,7 @@
     register Namespace *nsPtr, *ancestorPtr;
     Namespace *parentPtr, *dummy1Ptr, *dummy2Ptr;
     Namespace *globalNsPtr = iPtr->globalNsPtr;
-    char *simpleName;
+    CONST char *simpleName;
     Tcl_HashEntry *entryPtr;
     Tcl_DString buffer1, buffer2;
     int newEntry;
@@ -896,7 +896,7 @@
     Tcl_Namespace *namespacePtr; /* Points to the namespace from which 
 				  * commands are to be exported. NULL for
                                   * the current namespace. */
-    char *pattern;               /* String pattern indicating which commands
+    CONST char *pattern;         /* String pattern indicating which commands
                                   * to export. This pattern may not include
 				  * any namespace qualifiers; only commands
 				  * in the specified namespace may be
@@ -910,7 +910,8 @@
 #define INIT_EXPORT_PATTERNS 5    
     Namespace *nsPtr, *exportNsPtr, *dummyPtr;
     Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
-    char *simplePattern, *patternCpy;
+    CONST char *simplePattern;
+    char *patternCpy;
     int neededElems, len, i;
 
     /*
@@ -1083,7 +1084,7 @@
     Tcl_Namespace *namespacePtr; /* Points to the namespace into which the
 				  * commands are to be imported. NULL for
                                   * the current namespace. */
-    char *pattern;               /* String pattern indicating which commands
+    CONST char *pattern;	 /* String pattern indicating which commands
                                   * to import. This pattern should be
 				  * qualified by the name of the namespace
 				  * from which to import the command(s). */
@@ -1095,7 +1096,7 @@
     Interp *iPtr = (Interp *) interp;
     Namespace *nsPtr, *importNsPtr, *dummyPtr;
     Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
-    char *simplePattern, *cmdName;
+    CONST char *simplePattern, *cmdName;
     register Tcl_HashEntry *hPtr;
     Tcl_HashSearch search;
     Command *cmdPtr, *realCmdPtr;
@@ -1263,6 +1264,7 @@
                         (ClientData) dataPtr, DeleteImportedCmd);
 		dataPtr->realCmdPtr = cmdPtr;
 		dataPtr->selfPtr = (Command *) importedCmd;
+		dataPtr->selfPtr->compileProc = cmdPtr->compileProc;
 
 		/*
 		 * Create an ImportRef structure describing this new import
@@ -1314,14 +1316,14 @@
     Tcl_Namespace *namespacePtr; /* Points to the namespace from which
 				  * previously imported commands should be
 				  * removed. NULL for current namespace. */
-    char *pattern;		 /* String pattern indicating which imported
+    CONST char *pattern;	 /* String pattern indicating which imported
 				  * commands to remove. This pattern should
 				  * be qualified by the name of the
 				  * namespace from which the command(s) were
 				  * imported. */
 {
     Namespace *nsPtr, *importNsPtr, *dummyPtr, *actualCtxPtr;
-    char *simplePattern, *cmdName;
+    CONST char *simplePattern, *cmdName;
     register Tcl_HashEntry *hPtr;
     Tcl_HashSearch search;
     Command *cmdPtr;
@@ -1591,7 +1593,7 @@
 	nsPtrPtr, altNsPtrPtr, actualCxtPtrPtr, simpleNamePtr)
     Tcl_Interp *interp;		 /* Interpreter in which to find the
 				  * namespace containing qualName. */
-    register char *qualName;	 /* A namespace-qualified name of an
+    register CONST char *qualName; /* A namespace-qualified name of an
 				  * command, variable, or namespace. */
     Namespace *cxtNsPtr;	 /* The namespace in which to start the
 				  * search for qualName's namespace. If NULL
@@ -1623,7 +1625,7 @@
 				  * the :: namespace if TCL_GLOBAL_ONLY was
 				  * specified, or the current namespace if
 				  * cxtNsPtr was NULL. */
-    char **simpleNamePtr;	 /* Address where procedure stores the
+    CONST char **simpleNamePtr;	 /* Address where procedure stores the
 				  * simple name at end of the qualName, or
 				  * NULL if qualName is "::" or the flag
 				  * FIND_ONLY_NS was specified. */
@@ -1632,8 +1634,8 @@
     Namespace *nsPtr = cxtNsPtr;
     Namespace *altNsPtr;
     Namespace *globalNsPtr = iPtr->globalNsPtr;
-    register char *start, *end;
-    char *nsName;
+    register CONST char *start, *end;
+    CONST char *nsName;
     Tcl_HashEntry *entryPtr;
     Tcl_DString buffer;
     int len;
@@ -1856,7 +1858,7 @@
 Tcl_FindNamespace(interp, name, contextNsPtr, flags)
     Tcl_Interp *interp;		 /* The interpreter in which to find the
 				  * namespace. */
-    char *name;			 /* Namespace name. If it starts with "::",
+    CONST char *name;		 /* Namespace name. If it starts with "::",
 				  * will be looked up in global namespace.
 				  * Else, looked up first in contextNsPtr
 				  * (current namespace if contextNsPtr is
@@ -1871,7 +1873,7 @@
 				  * TCL_LEAVE_ERR_MSG flags. */
 {
     Namespace *nsPtr, *dummy1Ptr, *dummy2Ptr;
-    char *dummy;
+    CONST char *dummy;
 
     /*
      * Find the namespace(s) that contain the specified namespace name.
@@ -1915,7 +1917,7 @@
 Tcl_FindCommand(interp, name, contextNsPtr, flags)
     Tcl_Interp *interp;         /* The interpreter in which to find the
 				  * command and to report errors. */
-    char *name;		         /* Command's name. If it starts with "::",
+    CONST char *name;		 /* Command's name. If it starts with "::",
 				  * will be looked up in global namespace.
 				  * Else, looked up first in contextNsPtr
 				  * (current namespace if contextNsPtr is
@@ -1938,7 +1940,7 @@
 
     ResolverScheme *resPtr;
     Namespace *nsPtr[2], *cxtNsPtr;
-    char *simpleName;
+    CONST char *simpleName;
     register Tcl_HashEntry *entryPtr;
     register Command *cmdPtr;
     register int search;
@@ -1966,7 +1968,7 @@
         resPtr = iPtr->resolverPtr;
 
         if (cxtNsPtr->cmdResProc) {
-            result = (*cxtNsPtr->cmdResProc)(interp, name,
+            result = (*cxtNsPtr->cmdResProc)(interp, (char *) name,
                 (Tcl_Namespace *) cxtNsPtr, flags, &cmd);
         } else {
             result = TCL_CONTINUE;
@@ -1974,7 +1976,7 @@
 
         while (result == TCL_CONTINUE && resPtr) {
             if (resPtr->cmdResProc) {
-                result = (*resPtr->cmdResProc)(interp, name,
+                result = (*resPtr->cmdResProc)(interp, (char *) name,
                     (Tcl_Namespace *) cxtNsPtr, flags, &cmd);
             }
             resPtr = resPtr->nextPtr;
@@ -2069,7 +2071,7 @@
     Interp *iPtr = (Interp*)interp;
     ResolverScheme *resPtr;
     Namespace *nsPtr[2], *cxtNsPtr;
-    char *simpleName;
+    CONST char *simpleName;
     Tcl_HashEntry *entryPtr;
     Var *varPtr;
     register int search;
@@ -3755,7 +3757,7 @@
     register Tcl_Obj *objPtr;	/* The object to convert. */
 {
     register Tcl_ObjType *oldTypePtr = objPtr->typePtr;
-    char *name, *dummy;
+    CONST char *name, *dummy;
     Namespace *nsPtr, *dummy1Ptr, *dummy2Ptr;
     register ResolvedNsName *resNamePtr;
 
--- tcl8.2-8.2.3.orig/generic/tclObj.c
+++ tcl8.2-8.2.3/generic/tclObj.c
@@ -306,7 +306,7 @@
 
 Tcl_ObjType *
 Tcl_GetObjType(typeName)
-    char *typeName;		/* Name of Tcl object type to look up. */
+    CONST char *typeName;	/* Name of Tcl object type to look up. */
 {
     register Tcl_HashEntry *hPtr;
     Tcl_ObjType *typePtr;
@@ -458,7 +458,7 @@
 
 Tcl_Obj *
 Tcl_DbNewObj(file, line)
-    register char *file;	/* The name of the source file calling this
+    register CONST char *file;	/* The name of the source file calling this
 				 * procedure; used for debugging. */
     register int line;		/* Line number in the source file; used
 				 * for debugging. */
@@ -488,7 +488,7 @@
 
 Tcl_Obj *
 Tcl_DbNewObj(file, line)
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -691,6 +691,8 @@
  *----------------------------------------------------------------------
  */
 
+#undef Tcl_GetString
+
 char *
 Tcl_GetString(objPtr)
     register Tcl_Obj *objPtr;	/* Object whose string rep byte pointer
@@ -869,7 +871,7 @@
 Tcl_Obj *
 Tcl_DbNewBooleanObj(boolValue, file, line)
     register int boolValue;	/* Boolean used to initialize new object. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -889,7 +891,7 @@
 Tcl_Obj *
 Tcl_DbNewBooleanObj(boolValue, file, line)
     register int boolValue;	/* Boolean used to initialize new object. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -1227,7 +1229,7 @@
 Tcl_Obj *
 Tcl_DbNewDoubleObj(dblValue, file, line)
     register double dblValue;	/* Double used to initialize the object. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -1247,7 +1249,7 @@
 Tcl_Obj *
 Tcl_DbNewDoubleObj(dblValue, file, line)
     register double dblValue;	/* Double used to initialize the object. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -1604,7 +1606,7 @@
 	}
     }
     l = objPtr->internalRep.longValue;
-    if (((long)((int)l)) == l) {
+    if (l <= UINT_MAX) {
 	*intPtr = (int)objPtr->internalRep.longValue;
 	return TCL_OK;
     }
@@ -1879,7 +1881,7 @@
 Tcl_DbNewLongObj(longValue, file, line)
     register long longValue;	/* Long integer used to initialize the
 				 * new object. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -1992,7 +1994,7 @@
 Tcl_DbIncrRefCount(objPtr, file, line)
     register Tcl_Obj *objPtr;	/* The object we are registering a
 				 * reference to. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -2032,7 +2034,7 @@
 Tcl_DbDecrRefCount(objPtr, file, line)
     register Tcl_Obj *objPtr;	/* The object we are releasing a reference
 				 * to. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -2073,7 +2075,7 @@
 int
 Tcl_DbIsShared(objPtr, file, line)
     register Tcl_Obj *objPtr;	/* The object to test for being shared. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
--- tcl8.2-8.2.3.orig/generic/tclPanic.c
+++ tcl8.2-8.2.3/generic/tclPanic.c
@@ -22,7 +22,7 @@
  * specific panic procedure.
  */
 
-void (*panicProc) _ANSI_ARGS_(TCL_VARARGS(char *,format)) = NULL;
+void (*panicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *,format)) = NULL;
 
 /*
  *----------------------------------------------------------------------
@@ -42,7 +42,7 @@
 
 void
 Tcl_SetPanicProc(proc)
-    void (*proc) _ANSI_ARGS_(TCL_VARARGS(char *,format));
+    void (*proc) _ANSI_ARGS_(TCL_VARARGS(CONST char *,format));
 {
     panicProc = proc;
 }
@@ -65,7 +65,7 @@
 
 void
 Tcl_PanicVA (format, argList)
-    char *format;		/* Format string, suitable for passing to
+    CONST char *format;		/* Format string, suitable for passing to
 				 * fprintf. */
     va_list argList;		/* Variable argument list. */
 {
@@ -97,7 +97,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * panic --
+ * Tcl_Panic, panic --
  *
  *	Print an error message and kill the process.
  *
@@ -110,14 +110,27 @@
  *----------------------------------------------------------------------
  */
 
+#undef panic
+
 	/* VARARGS ARGSUSED */
 void
-panic TCL_VARARGS_DEF(char *,arg1)
+panic TCL_VARARGS_DEF(CONST char *,arg1)
+{
+    va_list argList;
+    CONST char *format;
+
+    format = TCL_VARARGS_START(CONST char *,arg1,argList);
+    Tcl_PanicVA(format, argList);
+    va_end (argList);
+}
+
+void
+Tcl_Panic TCL_VARARGS_DEF(CONST char *,arg1)
 {
     va_list argList;
-    char *format;
+    CONST char *format;
 
-    format = TCL_VARARGS_START(char *,arg1,argList);
+    format = TCL_VARARGS_START(CONST char *,arg1,argList);
     Tcl_PanicVA(format, argList);
     va_end (argList);
 }
--- tcl8.2-8.2.3.orig/generic/tclParse.c
+++ tcl8.2-8.2.3/generic/tclParse.c
@@ -180,7 +180,7 @@
 static int		ParseTokens _ANSI_ARGS_((char *src, int mask,
 			    Tcl_Parse *parsePtr));
 static int		EvalObjv _ANSI_ARGS_((Tcl_Interp *interp, int objc,
-			    Tcl_Obj *CONST objv[], char *command, int length,
+			    Tcl_Obj *CONST objv[], CONST char *command, int length,
 			    int flags));
 
 /*
@@ -780,7 +780,7 @@
     int objc;			/* Number of words in command. */
     Tcl_Obj *CONST objv[];	/* An array of pointers to objects that are
 				 * the words that make up the command. */
-    char *command;		/* Points to the beginning of the string
+    CONST char *command;	/* Points to the beginning of the string
 				 * representation of the command; this
 				 * is used for traces.  If the string
 				 * representation of the command is
@@ -881,7 +881,7 @@
      */
 
     argv = NULL;
-    commandCopy = command;
+    commandCopy = (char *) command;
 
     for (tracePtr = iPtr->tracePtr; tracePtr != NULL; tracePtr = nextPtr) {
 	nextPtr = tracePtr->nextPtr;
@@ -1316,7 +1316,7 @@
 				 * supported. */
 {
     Interp *iPtr = (Interp *) interp;
-    char *p, *next;
+    CONST char *p, *next;
     Tcl_Parse parse;
 #define NUM_STATIC_OBJS 20
     Tcl_Obj *staticObjArray[NUM_STATIC_OBJS], **objv;
@@ -1358,7 +1358,7 @@
     }
     iPtr->evalFlags = 0;
     do {
-	if (Tcl_ParseCommand(interp, p, bytesLeft, nested, &parse)
+	if (Tcl_ParseCommand(interp, (char *) p, bytesLeft, nested, &parse)
 	        != TCL_OK) {
 	    code = TCL_ERROR;
 	    goto error;
@@ -1449,7 +1449,7 @@
 	    
 	    commandLength -= 1;
 	}
-	Tcl_LogCommandInfo(interp, script, parse.commandStart, commandLength);
+	Tcl_LogCommandInfo(interp, (char *) script, parse.commandStart, commandLength);
     }
     
     for (i = 0; i < objectsUsed; i++) {
--- tcl8.2-8.2.3.orig/generic/tclPipe.c
+++ tcl8.2-8.2.3/generic/tclPipe.c
@@ -39,8 +39,9 @@
  */
 
 static TclFile	FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp,
-	            char *spec, int atOk, char *arg, char *nextArg, 
-		    int flags, int *skipPtr, int *closePtr, int *releasePtr));
+	            CONST char *spec, int atOk, CONST char *arg,
+		    CONST char *nextArg, int flags, int *skipPtr,
+		    int *closePtr, int *releasePtr));
 
 /*
  *----------------------------------------------------------------------
@@ -67,14 +68,14 @@
 FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
 	releasePtr)
     Tcl_Interp *interp;		/* Intepreter to use for error reporting. */
-    char *spec;			/* Points to character just after
+    CONST char *spec;		/* Points to character just after
 				 * redirection character. */
-    char *arg;			/* Pointer to entire argument containing 
+    CONST char *arg;		/* Pointer to entire argument containing 
 				 * spec:  used for error reporting. */
     int atOK;			/* Non-zero means that '@' notation can be 
 				 * used to specify a channel, zero means that
 				 * it isn't. */
-    char *nextArg;		/* Next argument in argc/argv array, if needed 
+    CONST char *nextArg;	/* Next argument in argc/argv array, if needed 
 				 * for file name or channel name.  May be 
 				 * NULL. */
     int flags;			/* Flags to use for opening file or to 
@@ -439,7 +440,7 @@
 	outPipePtr, errFilePtr)
     Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
     int argc;			/* Number of entries in argv. */
-    char **argv;		/* Array of strings describing commands in
+    char *argv[];		/* Array of strings describing commands in
 				 * pipeline plus I/O redirection with <,
 				 * <<,  >, etc.  Argv[argc] must be NULL. */
     Tcl_Pid **pidArrayPtr;	/* Word at *pidArrayPtr gets filled in with
@@ -476,7 +477,7 @@
 				 * at *pidPtr right now. */
     int cmdCount;		/* Count of number of distinct commands
 				 * found in argc/argv. */
-    char *inputLiteral = NULL;	/* If non-null, then this points to a
+    CONST char *inputLiteral = NULL; /* If non-null, then this points to a
 				 * string containing input data (specified
 				 * via <<) to be piped to the first process
 				 * in the pipeline. */
@@ -498,7 +499,7 @@
     int errorClose = 0;		/* If non-zero, then errorFile should be 
     				 * closed when cleaning up. */
     int errorRelease = 0;
-    char *p;
+    CONST char *p;
     int skip, lastBar, lastArg, i, j, atOK, flags, errorToOutput;
     Tcl_DString execBuffer;
     TclFile pipeIn;
@@ -992,7 +993,7 @@
     Tcl_Interp *interp;		/* Interpreter for error reporting. Can
                                  * NOT be NULL. */
     int argc;			/* How many arguments. */
-    char **argv;		/* Array of arguments for command pipe. */
+    char *argv[];		/* Array of arguments for command pipe. */
     int flags;			/* Or'ed combination of TCL_STDIN, TCL_STDOUT,
 				 * TCL_STDERR, and TCL_ENFORCE_MODE. */
 {
--- tcl8.2-8.2.3.orig/generic/tclPkg.c
+++ tcl8.2-8.2.3/generic/tclPkg.c
@@ -51,11 +51,11 @@
  */
 
 static int		CheckVersion _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *string));
-static int		ComparePkgVersions _ANSI_ARGS_((char *v1, char *v2,
-			    int *satPtr));
+			    CONST char *string));
+static int		ComparePkgVersions _ANSI_ARGS_((CONST char *v1,
+			    CONST char *v2, int *satPtr));
 static Package *	FindPackage _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *name));
+			    CONST char *name));
 
 /*
  *----------------------------------------------------------------------
@@ -84,8 +84,8 @@
 Tcl_PkgProvide(interp, name, version)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of package. */
-    char *version;		/* Version string for package. */
+    CONST char *name;		/* Name of package. */
+    CONST char *version;	/* Version string for package. */
 {
     return Tcl_PkgProvideEx(interp, name, version, (ClientData) NULL);
 }
@@ -94,8 +94,8 @@
 Tcl_PkgProvideEx(interp, name, version, clientData)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of package. */
-    char *version;		/* Version string for package. */
+    CONST char *name;		/* Name of package. */
+    CONST char *version;	/* Version string for package. */
     ClientData clientData;      /* clientdata for this package (normally
                                  * used for C callback function table) */
 {
@@ -152,8 +152,8 @@
 Tcl_PkgRequire(interp, name, version, exact)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of desired package. */
-    char *version;		/* Version string for desired version;
+    CONST char *name;		/* Name of desired package. */
+    CONST char *version;	/* Version string for desired version;
 				 * NULL means use the latest version
 				 * available. */
     int exact;			/* Non-zero means that only the particular
@@ -167,8 +167,8 @@
 Tcl_PkgRequireEx(interp, name, version, exact, clientDataPtr)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of desired package. */
-    char *version;		/* Version string for desired version;
+    CONST char *name;		/* Name of desired package. */
+    CONST char *version;	/* Version string for desired version;
 				 * NULL means use the latest version
 				 * available. */
     int exact;			/* Non-zero means that only the particular
@@ -354,8 +354,8 @@
 Tcl_PkgPresent(interp, name, version, exact)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of desired package. */
-    char *version;		/* Version string for desired version;
+    CONST char *name;		/* Name of desired package. */
+    CONST char *version;	/* Version string for desired version;
 				 * NULL means use the latest version
 				 * available. */
     int exact;			/* Non-zero means that only the particular
@@ -369,8 +369,8 @@
 Tcl_PkgPresentEx(interp, name, version, exact, clientDataPtr)
     Tcl_Interp *interp;		/* Interpreter in which package is now
 				 * available. */
-    char *name;			/* Name of desired package. */
-    char *version;		/* Version string for desired version;
+    CONST char *name;		/* Name of desired package. */
+    CONST char *version;	/* Version string for desired version;
 				 * NULL means use the latest version
 				 * available. */
     int exact;			/* Non-zero means that only the particular
@@ -776,7 +776,7 @@
 static Package *
 FindPackage(interp, name)
     Tcl_Interp *interp;		/* Interpreter to use for package lookup. */
-    char *name;			/* Name of package to fine. */
+    CONST char *name;		/* Name of package to find. */
 {
     Interp *iPtr = (Interp *) interp;
     Tcl_HashEntry *hPtr;
@@ -866,11 +866,11 @@
 static int
 CheckVersion(interp, string)
     Tcl_Interp *interp;		/* Used for error reporting. */
-    char *string;		/* Supposedly a version number, which is
+    CONST char *string;		/* Supposedly a version number, which is
 				 * groups of decimal digits separated
 				 * by dots. */
 {
-    char *p = string;
+    CONST char *p = string;
     char prevChar;
 
     if (!isdigit(UCHAR(*p))) {	/* INTL: digit */
@@ -915,7 +915,7 @@
 
 static int
 ComparePkgVersions(v1, v2, satPtr)
-    char *v1, *v2;		/* Versions strings, of form 2.1.3 (any
+    CONST char *v1, *v2;	/* Versions strings, of form 2.1.3 (any
 				 * number of version numbers). */
     int *satPtr;		/* If non-null, the word pointed to is
 				 * filled in with a 0/1 value.  1 means
--- tcl8.2-8.2.3.orig/generic/tclPosixStr.c
+++ tcl8.2-8.2.3/generic/tclPosixStr.c
@@ -986,7 +986,7 @@
 #ifdef SIGPROF
 	case SIGPROF: return "SIGPROF";
 #endif
-#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
+#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
 	case SIGPWR: return "SIGPWR";
 #endif
 #ifdef SIGQUIT
@@ -1118,7 +1118,7 @@
 #ifdef SIGPROF
 	case SIGPROF: return "profiling alarm";
 #endif
-#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
+#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
 	case SIGPWR: return "power-fail restart";
 #endif
 #ifdef SIGQUIT
--- tcl8.2-8.2.3.orig/generic/tclProc.c
+++ tcl8.2-8.2.3/generic/tclProc.c
@@ -67,7 +67,7 @@
 {
     register Interp *iPtr = (Interp *) interp;
     Proc *procPtr;
-    char *fullName, *procName;
+    CONST char *fullName, *procName;
     Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
     Tcl_Command cmd;
     Tcl_DString ds;
@@ -175,7 +175,7 @@
 TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr)
     Tcl_Interp *interp;         /* interpreter containing proc */
     Namespace *nsPtr;           /* namespace containing this proc */
-    char *procName;             /* unqualified name of this proc */
+    CONST char *procName;       /* unqualified name of this proc */
     Tcl_Obj *argsPtr;           /* description of arguments */
     Tcl_Obj *bodyPtr;           /* command body */
     Proc **procPtrPtr;          /* returns:  pointer to proc data */
@@ -321,7 +321,7 @@
         p = fieldValues[0];
         while (*p != '\0') {
             if (*p == '(') {
-                char *q = p;
+                CONST char *q = p;
                 do {
 		    q++;
 		} while (*q != '\0');
@@ -482,7 +482,7 @@
 int
 TclGetFrame(interp, string, framePtrPtr)
     Tcl_Interp *interp;		/* Interpreter in which to find frame. */
-    char *string;		/* String describing frame. */
+    CONST char *string;		/* String describing frame. */
     CallFrame **framePtrPtr;	/* Store pointer to frame here (or NULL
 				 * if global frame indicated). */
 {
--- tcl8.2-8.2.3.orig/generic/tclResolve.c
+++ tcl8.2-8.2.3/generic/tclResolve.c
@@ -63,7 +63,7 @@
 
     Tcl_Interp *interp;			/* Interpreter whose name resolution
 					 * rules are being modified. */
-    char *name;				/* Name of this resolution scheme. */
+    CONST char *name;			/* Name of this resolution scheme. */
     Tcl_ResolveCmdProc *cmdProc;	/* New procedure for command
 					 * resolution */
     Tcl_ResolveVarProc *varProc;	/* Procedure for variable resolution
@@ -142,7 +142,7 @@
 
     Tcl_Interp *interp;			/* Interpreter whose name resolution
 					 * rules are being queried. */
-    char *name;                         /* Look for a scheme with this name. */
+    CONST char *name;			/* Look for a scheme with this name. */
     Tcl_ResolverInfo *resInfoPtr;	/* Returns pointers to the procedures,
 					 * if found */
 {
@@ -194,7 +194,7 @@
 
     Tcl_Interp *interp;			/* Interpreter whose name resolution
 					 * rules are being modified. */
-    char *name;                         /* Name of the scheme to be removed. */
+    CONST char *name;			/* Name of the scheme to be removed. */
 {
     Interp *iPtr = (Interp*)interp;
     ResolverScheme **prevPtrPtr, *resPtr;
--- tcl8.2-8.2.3.orig/generic/tclStringObj.c
+++ tcl8.2-8.2.3/generic/tclStringObj.c
@@ -212,7 +212,7 @@
 				 * when initializing the new object. If 
 				 * negative, use bytes up to the first
 				 * NULL byte. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -237,7 +237,7 @@
 				 * when initializing the new object. If 
 				 * negative, use bytes up to the first
 				 * NULL byte. */
-    char *file;			/* The name of the source file calling this
+    CONST char *file;		/* The name of the source file calling this
 				 * procedure; used for debugging. */
     int line;			/* Line number in the source file; used
 				 * for debugging. */
@@ -579,7 +579,7 @@
 void
 Tcl_SetStringObj(objPtr, bytes, length)
     register Tcl_Obj *objPtr;	/* Object whose internal rep to init. */
-    char *bytes;		/* Points to the first of the length bytes
+    CONST char *bytes;		/* Points to the first of the length bytes
 				 * used to initialize the object. */
     register int length;	/* The number of bytes to copy from "bytes"
 				 * when initializing the object. If 
--- tcl8.2-8.2.3.orig/generic/tclStubInit.c
+++ tcl8.2-8.2.3/generic/tclStubInit.c
@@ -233,6 +233,7 @@
     TclTestChannelEventCmd, /* 155 */
     TclRegError, /* 156 */
     TclVarTraceExists, /* 157 */
+    TclpMatchFilesTypes, /* 158 */
 };
 
 TclIntPlatStubs tclIntPlatStubs = {
@@ -312,6 +313,9 @@
 TclPlatStubs tclPlatStubs = {
     TCL_STUB_MAGIC,
     NULL,
+#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+    TclpGetStartupLocaleEncoding, /* 0 */
+#endif /* UNIX */
 #ifdef __WIN32__
     Tcl_WinUtfToTChar, /* 0 */
     Tcl_WinTCharToUtf, /* 1 */
@@ -558,7 +562,7 @@
     Tcl_IsSafe, /* 185 */
     Tcl_JoinPath, /* 186 */
     Tcl_LinkVar, /* 187 */
-    NULL, /* 188 */
+    Tcl_MainLoop, /* 188 */
     Tcl_MakeFileChannel, /* 189 */
     Tcl_MakeSafe, /* 190 */
     Tcl_MakeTcpClientChannel, /* 191 */
@@ -678,7 +682,7 @@
     Tcl_StackChannel, /* 281 */
     Tcl_UnstackChannel, /* 282 */
     Tcl_GetStackedChannel, /* 283 */
-    NULL, /* 284 */
+    Tcl_SetMainLoop, /* 284 */
     NULL, /* 285 */
     Tcl_AppendObjToObj, /* 286 */
     Tcl_CreateEncoding, /* 287 */
--- tcl8.2-8.2.3.orig/generic/tclStubLib.c
+++ tcl8.2-8.2.3/generic/tclStubLib.c
@@ -13,50 +13,14 @@
  * RCS: @(#) $Id: tclStubLib.c,v 1.4 1999/05/25 01:00:27 stanton Exp $
  */
 
-/*
- * We need to ensure that we use the stub macros so that this file contains
- * no references to any of the stub functions.  This will make it possible
- * to build an extension that references Tcl_InitStubs but doesn't end up
- * including the rest of the stub functions.
- */
-
-#ifndef USE_TCL_STUBS
-#define USE_TCL_STUBS
-#endif
-#undef USE_TCL_STUB_PROCS
-
 #include "tclInt.h"
 #include "tclPort.h"
 
-/*
- * Ensure that Tcl_InitStubs is built as an exported symbol.  The other stub
- * functions should be built as non-exported symbols.
- */
-
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
-
-TclStubs *tclStubsPtr;
-TclPlatStubs *tclPlatStubsPtr;
-TclIntStubs *tclIntStubsPtr;
-TclIntPlatStubs *tclIntPlatStubsPtr;
-
-static TclStubs *	HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));
-
-static TclStubs *
-HasStubSupport (interp)
-    Tcl_Interp *interp;
-{
-    Interp *iPtr = (Interp *) interp;
+TclStubs *tclStubsPtr = (TclStubs *) NULL;
+TclPlatStubs *tclPlatStubsPtr = (TclPlatStubs *) NULL;
+TclIntStubs *tclIntStubsPtr = (TclIntStubs *) NULL;
+TclIntPlatStubs *tclIntPlatStubsPtr = (TclIntPlatStubs *) NULL;
 
-    if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
-	return iPtr->stubTable;
-    }
-    interp->result = "This interpreter does not support stubs-enabled extensions.";
-    interp->freeProc = TCL_STATIC;
-
-    return NULL;
-}
 
 /*
  *----------------------------------------------------------------------
@@ -80,38 +44,33 @@
 #undef Tcl_InitStubs
 #endif
 
+#undef Tcl_InitStubs
+
 char *
 Tcl_InitStubs (interp, version, exact)
     Tcl_Interp *interp;
     char *version;
     int exact;
 {
+    Interp *iPtr = (Interp *) interp;
     char *actualVersion;
-    TclStubs *tmp;
-    
-    if (!tclStubsPtr) {
-	tclStubsPtr = HasStubSupport(interp);
-	if (!tclStubsPtr) {
-            return NULL;
-        }
+
+    if (!iPtr->stubTable || (iPtr->stubTable->magic != TCL_STUB_MAGIC)) {
+	interp->result = "This interpreter does not support stubs-enabled extensions.";
+	interp->freeProc = TCL_STATIC;
+	return NULL;
     }
+    tclStubsPtr = iPtr->stubTable;
 
-    actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact,
-	    (ClientData *) &tmp);
+    actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, exact,
+	    (ClientData *) NULL);
     if (actualVersion == NULL) {
 	tclStubsPtr = NULL;
 	return NULL;
     }
 
-    if (tclStubsPtr->hooks) {
-	tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
-	tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
-	tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
-    } else {
-	tclPlatStubsPtr = NULL;
-	tclIntStubsPtr = NULL;
-	tclIntPlatStubsPtr = NULL;
-    }
-    
+    tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
+    tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
+    tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
     return actualVersion;
 }
--- tcl8.2-8.2.3.orig/generic/tclTest.c
+++ tcl8.2-8.2.3/generic/tclTest.c
@@ -18,11 +18,23 @@
 
 #define TCL_TEST
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "tcl.h"
+#include "tclRegexp.h"
 #include "tclInt.h"
 #include "tclPort.h"
-#include "tclRegexp.h"
 #include <locale.h>
 
+#ifdef __cplusplus
+}
+#define dummy /* */
+#define dummy2 /* */
+#define dummy3 /* */
+#endif
+
 /*
  * Declare external functions used in Windows tests.
  */
@@ -97,7 +109,6 @@
  * Forward declarations for procedures defined later in this file:
  */
 
-int			Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 static int		AsyncHandlerProc _ANSI_ARGS_((ClientData clientData,
 			    Tcl_Interp *interp, int code));
 static void		CleanupTestSetassocdataTests _ANSI_ARGS_((
@@ -223,11 +234,11 @@
 			    Tcl_Interp *interp, Tcl_Value *args,
 			    Tcl_Value *resultPtr));
 static Tcl_Channel	TestOpenFileChannelProc1 _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *filename, char *modeString, int permissions));
+			    CONST char *filename, CONST char *modeString, int permissions));
 static Tcl_Channel	TestOpenFileChannelProc2 _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *filename, char *modeString, int permissions));
+			    CONST char *filename, CONST char *modeString, int permissions));
 static Tcl_Channel	TestOpenFileChannelProc3 _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *filename, char *modeString, int permissions));
+			    CONST char *filename, CONST char *modeString, int permissions));
 static int		TestpanicCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
 static int		TestparserObjCmd _ANSI_ARGS_((ClientData dummy,
@@ -283,8 +294,15 @@
  * into the library:
  */
 
+#ifndef NO_PLATFORM_TEST
+
 extern int		TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
 extern int		TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
+
+#endif
+
+EXTERN int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+
 
 /*
  *----------------------------------------------------------------------
@@ -306,11 +324,19 @@
  */
 
 int
+#ifdef _USING_PROTOTYPES_
+Tcltest_Init (
+    Tcl_Interp *interp)		/* Interpreter for application. */
+#else
 Tcltest_Init(interp)
     Tcl_Interp *interp;		/* Interpreter for application. */
+#endif
 {
     Tcl_ValueType t3ArgTypes[2];
-	
+
+    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+	return TCL_ERROR;
+    }
     if (Tcl_PkgProvide(interp, "Tcltest", TCL_VERSION) == TCL_ERROR) {
         return TCL_ERROR;
     }
@@ -430,17 +456,19 @@
     Tcl_CreateMathFunc(interp, "T3", 2, t3ArgTypes, TestMathFunc2,
 	    (ClientData) 0);
 
+#ifdef NO_PLATFORM_TEST
+    return TCL_OK;
+#else
 #ifdef TCL_THREADS
     if (TclThread_Init(interp) != TCL_OK) {
 	return TCL_ERROR;
     }
 #endif
-
     /*
      * And finally add any platform specific test commands.
      */
-    
     return TclplatformtestInit(interp);
+#endif
 }
 
 /*
@@ -462,11 +490,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestasyncCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestasyncCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     TestAsyncHandler *asyncPtr, *prevPtr;
     int id, code;
@@ -552,11 +588,19 @@
 }
 
 static int
+#ifdef _USING_PROTOTYPES_
+AsyncHandlerProc (
+    ClientData clientData,	/* Pointer to TestAsyncHandler structure. */
+    Tcl_Interp *interp,		/* Interpreter in which command was
+				 * executed, or NULL. */
+    int code)			/* Current return code from command. */
+#else
 AsyncHandlerProc(clientData, interp, code)
     ClientData clientData;	/* Pointer to TestAsyncHandler structure. */
     Tcl_Interp *interp;		/* Interpreter in which command was
 				 * executed, or NULL. */
     int code;			/* Current return code from command. */
+#endif
 {
     TestAsyncHandler *asyncPtr = (TestAsyncHandler *) clientData;
     char *listArgv[4];
@@ -593,11 +637,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestcmdinfoCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestcmdinfoCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_CmdInfo info;
 
@@ -666,11 +718,19 @@
 
 	/*ARGSUSED*/
 static int
-CmdProc1(clientData, interp, argc, argv)
+#ifdef _USING_PROTOTYPES_
+CmdProc1 (
+    ClientData clientData,		/* String to return. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int dummy,				/* Not used. */
+    char **dummy2)			/* Not used. */
+#else
+CmdProc1(clientData, interp, dummy, dummy2)
     ClientData clientData;		/* String to return. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int dummy;				/* Not used. */
+    char **dummy2;			/* Not used. */
+#endif
 {
     Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData,
 	    (char *) NULL);
@@ -679,11 +739,19 @@
 
 	/*ARGSUSED*/
 static int
-CmdProc2(clientData, interp, argc, argv)
+#ifdef _USING_PROTOTYPES_
+CmdProc2 (
+    ClientData clientData,		/* String to return. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int dummy,				/* Not used. */
+    char **dummy2)			/* Not used. */
+#else
+CmdProc2(clientData, interp, dummy, dummy2)
     ClientData clientData;		/* String to return. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int dummy;				/* Not used. */
+    char **dummy2;			/* Not used. */
+#endif
 {
     Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData,
 	    (char *) NULL);
@@ -691,8 +759,13 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+CmdDelProc1 (
+    ClientData clientData)		/* String to save. */
+#else
 CmdDelProc1(clientData)
     ClientData clientData;		/* String to save. */
+#endif
 {
     Tcl_DStringInit(&delString);
     Tcl_DStringAppend(&delString, "CmdDelProc1 ", -1);
@@ -700,8 +773,13 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+CmdDelProc2 (
+    ClientData clientData)		/* String to save. */
+#else
 CmdDelProc2(clientData)
     ClientData clientData;		/* String to save. */
+#endif
 {
     Tcl_DStringInit(&delString);
     Tcl_DStringAppend(&delString, "CmdDelProc2 ", -1);
@@ -728,11 +806,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestcmdtokenCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestcmdtokenCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_Command token;
     long int l;
@@ -792,11 +878,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestcmdtraceCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestcmdtraceCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_DString buffer;
     int result;
@@ -838,6 +932,21 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+CmdTraceProc (
+    ClientData clientData,	/* Pointer to buffer in which the
+				 * command and arguments are appended.
+				 * Accumulates test result. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int level,			/* Current trace level. */
+    char *command,		/* The command being traced (after
+				 * substitutions). */
+    Tcl_CmdProc *cmdProc,	/* Points to command's command procedure. */
+    ClientData cmdClientData,	/* Client data associated with command
+				 * procedure. */
+    int argc,			/* Number of arguments. */
+    char **argv)		/* Argument strings. */
+#else
 CmdTraceProc(clientData, interp, level, command, cmdProc, cmdClientData,
         argc, argv)
     ClientData clientData;	/* Pointer to buffer in which the
@@ -852,6 +961,7 @@
 				 * procedure. */
     int argc;			/* Number of arguments. */
     char **argv;		/* Argument strings. */
+#endif
 {
     Tcl_DString *bufPtr = (Tcl_DString *) clientData;
     int i;
@@ -866,6 +976,19 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+CmdTraceDeleteProc (
+    ClientData clientData,	/* Unused. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int level,			/* Current trace level. */
+    char *command,		/* The command being traced (after
+				 * substitutions). */
+    Tcl_CmdProc *cmdProc,	/* Points to command's command procedure. */
+    ClientData cmdClientData,	/* Client data associated with command
+				 * procedure. */
+    int argc,			/* Number of arguments. */
+    char **argv)		/* Argument strings. */
+#else
 CmdTraceDeleteProc(clientData, interp, level, command, cmdProc,
 	cmdClientData, argc, argv)
     ClientData clientData;	/* Unused. */
@@ -878,6 +1001,7 @@
 				 * procedure. */
     int argc;			/* Number of arguments. */
     char **argv;		/* Argument strings. */
+#endif
 {
     /*
      * Remove ourselves to test whether calling Tcl_DeleteTrace within
@@ -910,11 +1034,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestcreatecommandCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestcreatecommandCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     if (argc != 2) {
 	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
@@ -943,11 +1075,19 @@
 }
 
 static int
+#ifdef _USING_PROTOTYPES_
+CreatedCommandProc (
+    ClientData clientData,		/* String to return. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 CreatedCommandProc(clientData, interp, argc, argv)
     ClientData clientData;		/* String to return. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_CmdInfo info;
     int found;
@@ -965,11 +1105,19 @@
 }
 
 static int
+#ifdef _USING_PROTOTYPES_
+CreatedCommandProc2 (
+    ClientData clientData,		/* String to return. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 CreatedCommandProc2(clientData, interp, argc, argv)
     ClientData clientData;		/* String to return. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_CmdInfo info;
     int found;
@@ -1004,11 +1152,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestdcallCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestdcallCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int i, id;
 
@@ -1036,10 +1192,17 @@
  */
 
 static void
+#ifdef _USING_PROTOTYPES_
+DelCallbackProc (
+    ClientData clientData,		/* Numerical value to append to
+					 * delString. */
+    Tcl_Interp *interp)			/* Interpreter being deleted. */
+#else
 DelCallbackProc(clientData, interp)
     ClientData clientData;		/* Numerical value to append to
 					 * delString. */
     Tcl_Interp *interp;			/* Interpreter being deleted. */
+#endif
 {
     int id = (int) clientData;
     char buffer[TCL_INTEGER_SPACE];
@@ -1070,11 +1233,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestdelCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestdelCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     DelCmd *dPtr;
     Tcl_Interp *slave;
@@ -1100,11 +1271,19 @@
 }
 
 static int
-DelCmdProc(clientData, interp, argc, argv)
+#ifdef _USING_PROTOTYPES_
+DelCmdProc (
+    ClientData clientData,		/* String result to return. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int dummy,				/* Number of arguments. */
+    char **dummy2)			/* Argument strings. */
+#else
+DelCmdProc(clientData, interp, dummy, dummy2)
     ClientData clientData;		/* String result to return. */
     Tcl_Interp *interp;			/* Current interpreter. */
-    int argc;				/* Number of arguments. */
-    char **argv;			/* Argument strings. */
+    int dummy;				/* Number of arguments. */
+    char **dummy2;			/* Argument strings. */
+#endif
 {
     DelCmd *dPtr = (DelCmd *) clientData;
 
@@ -1115,8 +1294,13 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+DelDeleteProc (
+    ClientData clientData)		/* String command to evaluate. */
+#else
 DelDeleteProc(clientData)
     ClientData clientData;		/* String command to evaluate. */
+#endif
 {
     DelCmd *dPtr = (DelCmd *) clientData;
 
@@ -1145,11 +1329,19 @@
  */
 
 static int
-TestdelassocdataCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestdelassocdataCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestdelassocdataCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     if (argc != 2) {
         Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
@@ -1179,11 +1371,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestdstringCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestdstringCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int count;
 
@@ -1283,8 +1483,14 @@
  * Tcl_DStringGetResult handles freeProc's other than free.
  */
 
-static void SpecialFree(blockPtr)
+static void
+#ifdef _USING_PROTOTYPES_
+SpecialFree(
+    char *blockPtr)			/* Block to free. */
+#else
+SpecialFree(blockPtr)
     char *blockPtr;			/* Block to free. */
+#endif
 {
     ckfree(blockPtr - 4);
 }
@@ -1586,11 +1792,19 @@
  */
 
 static int
-TestexithandlerCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestexithandlerCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestexithandlerCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int value;
 
@@ -1617,8 +1831,13 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+ExitProcOdd (
+    ClientData clientData)		/* Integer value to print. */
+#else
 ExitProcOdd(clientData)
     ClientData clientData;		/* Integer value to print. */
+#endif
 {
     char buf[16 + TCL_INTEGER_SPACE];
 
@@ -1627,8 +1846,13 @@
 }
 
 static void
+#ifdef _USING_PROTOTYPES_
+ExitProcEven (
+    ClientData clientData)		/* Integer value to print. */
+#else
 ExitProcEven(clientData)
     ClientData clientData;		/* Integer value to print. */
+#endif
 {
     char buf[16 + TCL_INTEGER_SPACE];
 
@@ -1654,11 +1878,19 @@
  */
 
 static int
-TestexprlongCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestexprlongCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestexprlongCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     long exprResult;
     char buf[4 + TCL_INTEGER_SPACE];
@@ -1691,11 +1923,19 @@
  */
 
 static int
-TestexprstringCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestexprstringCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestexprstringCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     if (argc != 2) {
         Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
@@ -1723,11 +1963,19 @@
  */
 
 static int
-TestgetassocdataCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestgetassocdataCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestgetassocdataCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     char *res;
     
@@ -1761,11 +2009,19 @@
  */
 
 static int
-TestgetplatformCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestgetplatformCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestgetplatformCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     static char *platformStrings[] = { "unix", "mac", "windows" };
     TclPlatformType *platform;
@@ -1806,11 +2062,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestinterpdeleteCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestinterpdeleteCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_Interp *slaveToDelete;
 
@@ -1852,11 +2116,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestlinkCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestlinkCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     static int intVar = 43;
     static int boolVar = 4;
@@ -2085,11 +2357,19 @@
 
 	/* ARGSUSED */
 static int
-TestMathFunc(clientData, interp, args, resultPtr)
+#ifdef _USING_PROTOTYPES_
+TestMathFunc (
+    ClientData clientData,		/* Integer value to return. */
+    Tcl_Interp *dummy,			/* Not used. */
+    Tcl_Value *dummy2,			/* Not used. */
+    Tcl_Value *resultPtr)		/* Where to store result. */
+#else
+TestMathFunc(clientData, dummy, dummy2, resultPtr)
     ClientData clientData;		/* Integer value to return. */
-    Tcl_Interp *interp;			/* Not used. */
-    Tcl_Value *args;			/* Not used. */
+    Tcl_Interp *dummy;			/* Not used. */
+    Tcl_Value *dummy2;			/* Not used. */
     Tcl_Value *resultPtr;		/* Where to store result. */
+#endif
 {
     resultPtr->type = TCL_INT;
     resultPtr->intValue = (int) clientData;
@@ -2115,6 +2395,15 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestMathFunc2 (
+    ClientData clientData,		/* Integer value to return. */
+    Tcl_Interp *interp,			/* Used to report errors. */
+    Tcl_Value *args,			/* Points to an array of two
+					 * Tcl_Values for the two
+					 * arguments. */
+    Tcl_Value *resultPtr)		/* Where to store result. */
+#else
 TestMathFunc2(clientData, interp, args, resultPtr)
     ClientData clientData;		/* Integer value to return. */
     Tcl_Interp *interp;			/* Used to report errors. */
@@ -2122,6 +2411,7 @@
 					 * Tcl_Value structs for the 
 					 * two arguments. */
     Tcl_Value *resultPtr;		/* Where to store the result. */
+#endif
 {
     int result = TCL_OK;
     
@@ -2189,9 +2479,15 @@
  */
 	/* ARGSUSED */
 static void
-CleanupTestSetassocdataTests(clientData, interp)
+#ifdef _USING_PROTOTYPES_
+CleanupTestSetassocdataTests (
+    ClientData clientData,		/* Data to be released. */
+    Tcl_Interp *dummy)			/* Not used. */
+#else
+CleanupTestSetassocdataTests(clientData, dummy)
     ClientData clientData;		/* Data to be released. */
-    Tcl_Interp *interp;			/* Interpreter being deleted. */
+    Tcl_Interp *dummy;			/* Not used. */
+#endif
 {
     ckfree((char *) clientData);
 }
@@ -2849,11 +3145,19 @@
  */
 
 static int
-TestsetassocdataCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestsetassocdataCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestsetassocdataCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     char *buf;
     char *oldData;
@@ -2865,7 +3169,7 @@
         return TCL_ERROR;
     }
 
-    buf = ckalloc((unsigned) strlen(argv[2]) + 1);
+    buf = (char *) ckalloc((unsigned) strlen(argv[2]) + 1);
     strcpy(buf, argv[2]);
 
     /*
@@ -2902,11 +3206,19 @@
  */
 
 static int
-TestsetplatformCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestsetplatformCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestsetplatformCmd(dummy, interp, argc, argv)
+    ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     size_t length;
     TclPlatformType *platform;
@@ -2957,11 +3269,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestsetrecursionlimitCmd (
+    ClientData dummy,		/* Not used. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int objc,			/* Number of arguments. */
+    Tcl_Obj *CONST objv[])	/* The argument objects. */
+#else
 TestsetrecursionlimitCmd(dummy, interp, objc, objv)
     ClientData dummy;		/* Not used. */
     Tcl_Interp *interp;		/* Current interpreter. */
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* The argument objects. */
+#endif
 {
     int     value;
 
@@ -2998,11 +3318,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TeststaticpkgCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TeststaticpkgCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int safe, loaded;
 
@@ -3017,15 +3345,21 @@
     if (Tcl_GetInt(interp, argv[3], &loaded) != TCL_OK) {
 	return TCL_ERROR;
     }
-    Tcl_StaticPackage((loaded) ? interp : NULL, argv[1], StaticInitProc,
-	    (safe) ? StaticInitProc : NULL);
+    Tcl_StaticPackage((loaded) ? interp : (Tcl_Interp *) NULL, argv[1], StaticInitProc,
+	    (safe) ? StaticInitProc : (Tcl_PackageInitProc *) NULL);
     return TCL_OK;
 }
 
 static int
+#ifdef _USING_PROTOTYPES_
+StaticInitProc (
+    Tcl_Interp *interp)			/* Interpreter in which package
+					 * is supposedly being loaded. */
+#else
 StaticInitProc(interp)
     Tcl_Interp *interp;			/* Interpreter in which package
 					 * is supposedly being loaded. */
+#endif
 {
     Tcl_SetVar(interp, "x", "loaded", TCL_GLOBAL_ONLY);
     return TCL_OK;
@@ -3049,11 +3383,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TesttranslatefilenameCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TesttranslatefilenameCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     Tcl_DString buffer;
     char *result;
@@ -3091,11 +3433,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestupvarCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestupvarCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int flags = 0;
     
@@ -3145,11 +3495,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestsetobjerrorcodeCmd (
+    ClientData dummy,		/* Not used. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int objc,			/* Number of arguments. */
+    Tcl_Obj *CONST objv[])	/* Argument strings. */
+#else
 TestsetobjerrorcodeCmd(dummy, interp, objc, objv)
     ClientData dummy;		/* Not used. */
     Tcl_Interp *interp;		/* Current interpreter. */
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* The argument objects. */
+#endif
 {
     Tcl_Obj *listObjPtr;
 
@@ -3183,11 +3541,19 @@
 
 	/* ARGSUSED */
 static int
-TestfeventCmd(clientData, interp, argc, argv)
-    ClientData clientData;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+TestfeventCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
+TestfeventCmd(dummy, interp, argc, argv)
+    ClientData dummy;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     static Tcl_Interp *interp2 = NULL;
     int code;
@@ -3255,11 +3621,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestpanicCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *dummy2,			/* Not used. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestpanicCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
-    Tcl_Interp *interp;			/* Current interpreter. */
+    Tcl_Interp *dummy2;			/* Not used. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     char *argString;
     
@@ -3295,11 +3669,19 @@
  */
  
 static int
+#ifdef _USING_PROTOTYPES_
+TestchmodCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestchmodCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int i, mode;
     char *rest;
@@ -3334,11 +3716,19 @@
 }
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestfileCmd (
+    ClientData dummy,			/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestfileCmd(dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     int force, i, j, result;
     Tcl_DString error, name[2];
@@ -3419,11 +3809,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestgetvarfullnameCmd (
+    ClientData dummy,		/* Not used. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int objc,			/* Number of arguments. */
+    Tcl_Obj *CONST objv[])	/* The argument objects. */
+#else
 TestgetvarfullnameCmd(dummy, interp, objc, objv)
     ClientData dummy;		/* Not used. */
     Tcl_Interp *interp;		/* Current interpreter. */
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* The argument objects. */
+#endif
 {
     char *name, *arg;
     int flags = 0;
@@ -3499,11 +3897,19 @@
  */
 
 static int
-GetTimesCmd(unused, interp, argc, argv)
-    ClientData unused;		/* Unused. */
+#ifdef _USING_PROTOTYPES_
+GetTimesCmd (
+    ClientData dummy,		/* Unused. */
+    Tcl_Interp *interp,		/* The current interpreter. */
+    int dummy2,			/* The number of arguments. */
+    char **dummy3)		/* The argument strings. */
+#else
+GetTimesCmd(dummy, interp, dummy2, dummy3)
+    ClientData dummy;		/* Unused. */
     Tcl_Interp *interp;		/* The current interpreter. */
-    int argc;			/* The number of arguments. */
-    char **argv;		/* The argument strings. */
+    int dummy2;			/* The number of arguments. */
+    char **dummy3;		/* The argument strings. */
+#endif
 {
     Interp *iPtr = (Interp *) interp;
     int i, n;
@@ -3679,11 +4085,19 @@
  */
 
 static int
-NoopCmd(unused, interp, argc, argv)
-    ClientData unused;		/* Unused. */
+#ifdef _USING_PROTOTYPES_
+NoopCmd (
+    ClientData dummy,		/* Unused. */
+    Tcl_Interp *interp,		/* The current interpreter. */
+    int dummy2,			/* The number of arguments. */
+    char **dummy3)		/* The argument strings. */
+#else
+NoopCmd(dummy, interp, dummy2, dummy3)
+    ClientData dummy;		/* Unused. */
     Tcl_Interp *interp;		/* The current interpreter. */
-    int argc;			/* The number of arguments. */
-    char **argv;		/* The argument strings. */
+    int dummy2;			/* The number of arguments. */
+    char **dummy3;		/* The argument strings. */
+#endif
 {
     return TCL_OK;
 }
@@ -3706,11 +4120,19 @@
  */
 
 static int
-NoopObjCmd(unused, interp, objc, objv)
-    ClientData unused;		/* Not used. */
+#ifdef _USING_PROTOTYPES_
+NoopObjCmd (
+    ClientData dummy,		/* Not used. */
+    Tcl_Interp *interp,		/* Current interpreter. */
+    int objc,			/* Number of arguments. */
+    Tcl_Obj *CONST objv[])	/* The argument objects. */
+#else
+NoopObjCmd(dummy, interp, objc, objv)
+    ClientData dummy;		/* Not used. */
     Tcl_Interp *interp;		/* Current interpreter. */
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* The argument objects. */
+#endif
 {
     return TCL_OK;
 }
@@ -3734,11 +4156,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
 TestsetCmd(data, interp, argc, argv)
     ClientData data;			/* Additional flags for Get/SetVar2. */
     register Tcl_Interp *interp;	/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#else
+TestsetCmd(data, interp, argc, argv)
+    ClientData data;			/* Additional flags for Get/SetVar2. */
+    register Tcl_Interp *interp;	/* Current interpreter. */
+    int argc;				/* Number of arguments. */
+    char **argv;			/* Argument strings. */
+#endif
 {
     int flags = (int) data;
     char *value;
@@ -3786,11 +4216,19 @@
 
 	/* ARGSUSED */
 static int
+#ifdef _USING_PROTOTYPES_
+TestsaveresultCmd (
+    ClientData dummy,			/* Not used. */
+    register Tcl_Interp *interp,	/* Current interpreter. */
+    int objc,			/* Number of arguments. */
+    Tcl_Obj *CONST objv[])	/* The argument objects. */
+#else
 TestsaveresultCmd(dummy, interp, objc, objv)
     ClientData dummy;			/* Not used. */
     register Tcl_Interp *interp;	/* Current interpreter. */
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* The argument objects. */
+#endif
 {
     int discard, result, index;
     Tcl_SavedResult state;
@@ -3892,8 +4330,13 @@
  */
 
 static void
+#ifdef _USING_PROTOTYPES_
+TestsaveresultFree (
+    char *blockPtr)
+#else
 TestsaveresultFree(blockPtr)
     char *blockPtr;
+#endif
 {
     freeCount++;
 }
@@ -3916,11 +4359,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TeststatprocCmd (
+    ClientData dummy,			/* Not used. */
+    register Tcl_Interp *interp,	/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TeststatprocCmd (dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     register Tcl_Interp *interp;	/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     TclStatProc_ *proc;
     int retVal;
@@ -3978,9 +4429,15 @@
  */
  
 static int
+#ifdef _USING_PROTOTYPES_
+TestStatProc1 (
+    CONST char *path,
+    struct stat *buf)
+#else
 TestStatProc1(path, buf)
     CONST char *path;
     struct stat *buf;
+#endif
 {
     buf->st_size = 1234;
     return ((strstr(path, "testStat1%.fil") == NULL) ? -1 : 0);
@@ -3988,9 +4445,15 @@
 
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestStatProc2 (
+    CONST char *path,
+    struct stat *buf)
+#else
 TestStatProc2(path, buf)
     CONST char *path;
     struct stat *buf;
+#endif
 {
     buf->st_size = 2345;
     return ((strstr(path, "testStat2%.fil") == NULL) ? -1 : 0);
@@ -3998,9 +4461,15 @@
 
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestStatProc3 (
+    CONST char *path,
+    struct stat *buf)
+#else
 TestStatProc3(path, buf)
     CONST char *path;
     struct stat *buf;
+#endif
 {
     buf->st_size = 3456;
     return ((strstr(path, "testStat3%.fil") == NULL) ? -1 : 0);
@@ -4024,11 +4493,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestaccessprocCmd (
+    ClientData dummy,			/* Not used. */
+    register Tcl_Interp *interp,	/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestaccessprocCmd (dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     register Tcl_Interp *interp;	/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     TclAccessProc_ *proc;
     int retVal;
@@ -4082,27 +4559,45 @@
 
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestAccessProc1 (
+    CONST char *path,
+    int mode)
+#else
 TestAccessProc1(path, mode)
     CONST char *path;
     int mode;
+#endif
 {
     return ((strstr(path, "testAccess1%.fil") == NULL) ? -1 : 0);
 }
 
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestAccessProc2 (
+    CONST char *path,
+    int mode)
+#else
 TestAccessProc2(path, mode)
     CONST char *path;
     int mode;
+#endif
 {
     return ((strstr(path, "testAccess2%.fil") == NULL) ? -1 : 0);
 }
 
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestAccessProc3 (
+    CONST char *path,
+    int mode)
+#else
 TestAccessProc3(path, mode)
     CONST char *path;
     int mode;
+#endif
 {
     return ((strstr(path, "testAccess3%.fil") == NULL) ? -1 : 0);
 }
@@ -4125,11 +4620,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TestopenfilechannelprocCmd (
+    ClientData dummy,			/* Not used. */
+    register Tcl_Interp *interp,	/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TestopenfilechannelprocCmd (dummy, interp, argc, argv)
     ClientData dummy;			/* Not used. */
     register Tcl_Interp *interp;	/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     TclOpenFileChannelProc_ *proc;
     int retVal;
@@ -4185,15 +4688,27 @@
 
 
 static Tcl_Channel
+#ifdef _USING_PROTOTYPES_
+TestOpenFileChannelProc1 (
+    Tcl_Interp *interp,                 /* Interpreter for error reporting;
+                                         * can be NULL. */
+    CONST char *fileName,		/* Name of file to open. */
+    CONST char *modeString,		/* A list of POSIX open modes or
+                                         * a string such as "rw". */
+    int permissions)                    /* If the open involves creating a
+                                         * file, with what modes to create
+                                         * it? */
+#else
 TestOpenFileChannelProc1(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;                 /* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;                     /* Name of file to open. */
-    char *modeString;                   /* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;                    /* If the open involves creating a
                                          * file, with what modes to create
                                          * it? */
+#endif
 {
     if (!strcmp("testOpenFileChannel1%.fil", fileName)) {
 	return (TclpOpenFileChannel(interp, "__testOpenFileChannel1%__.fil",
@@ -4205,15 +4720,27 @@
 
 
 static Tcl_Channel
+#ifdef _USING_PROTOTYPES_
+TestOpenFileChannelProc2 (
+    Tcl_Interp *interp,                 /* Interpreter for error reporting;
+                                         * can be NULL. */
+    CONST char *fileName,		/* Name of file to open. */
+    CONST char *modeString,		/* A list of POSIX open modes or
+                                         * a string such as "rw". */
+    int permissions)                    /* If the open involves creating a
+                                         * file, with what modes to create
+                                         * it? */
+#else
 TestOpenFileChannelProc2(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;                 /* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;                     /* Name of file to open. */
-    char *modeString;                   /* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;                    /* If the open involves creating a
                                          * file, with what modes to create
                                          * it? */
+#endif
 {
     if (!strcmp("testOpenFileChannel2%.fil", fileName)) {
 	return (TclpOpenFileChannel(interp, "__testOpenFileChannel2%__.fil",
@@ -4225,15 +4752,27 @@
 
 
 static Tcl_Channel
+#ifdef _USING_PROTOTYPES_
+TestOpenFileChannelProc3 (
+    Tcl_Interp *interp,                 /* Interpreter for error reporting;
+                                         * can be NULL. */
+    CONST char *fileName,		/* Name of file to open. */
+    CONST char *modeString,		/* A list of POSIX open modes or
+                                         * a string such as "rw". */
+    int permissions)                    /* If the open involves creating a
+                                         * file, with what modes to create
+                                         * it? */
+#else
 TestOpenFileChannelProc3(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;                 /* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;                     /* Name of file to open. */
-    char *modeString;                   /* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;                    /* If the open involves creating a
                                          * file, with what modes to create
                                          * it? */
+#endif
 {
     if (!strcmp("testOpenFileChannel3%.fil", fileName)) {
 	return (TclpOpenFileChannel(interp, "__testOpenFileChannel3%__.fil",
--- tcl8.2-8.2.3.orig/generic/tclTestObj.c
+++ tcl8.2-8.2.3/generic/tclTestObj.c
@@ -15,9 +15,27 @@
  * RCS: @(#) $Id: tclTestObj.c,v 1.6 1999/06/15 22:06:17 hershey Exp $
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "tclInt.h"
 
 /*
+ * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+ * Objtest_Init declaration is in the source file itself, which is only
+ * accessed when we are building a library.
+ */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
+
+#ifdef __cplusplus
+}
+#define dummy /* */
+#endif
+
+/*
  * An array of Tcl_Obj pointers used in the commands that operate on or get
  * the values of Tcl object-valued variables. varPtr[i] is the i-th
  * variable's Tcl_Obj *.
@@ -36,7 +54,8 @@
 			    char *string, int *indexPtr));
 static void		SetVarToObj _ANSI_ARGS_((int varIndex,
 			    Tcl_Obj *objPtr));
-int			TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+EXTERN int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+EXTERN int		Objtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 static int		TestbooleanobjCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int objc,
 			    Tcl_Obj *CONST objv[]));
@@ -89,8 +108,16 @@
 TclObjTest_Init(interp)
     Tcl_Interp *interp;
 {
+    return Objtest_Init(interp);
+}
+
+int
+Objtest_Init(interp)
+    Tcl_Interp *interp;
+{
     register int i;
     
+    Tcl_InitStubs(interp, TCL_VERSION, 0);
     for (i = 0;  i < NUMBER_OF_OBJECT_VARS;  i++) {
         varPtr[i] = NULL;
     }
@@ -109,7 +136,7 @@
 	    (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
     Tcl_CreateObjCommand(interp, "teststringobj", TeststringobjCmd,
 	    (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
-    return TCL_OK;
+    return Tcl_PkgProvide(interp, "Objtest", TCL_VERSION);
 }
 
 /*
--- tcl8.2-8.2.3.orig/generic/tclTestProcBodyObj.c
+++ tcl8.2-8.2.3/generic/tclTestProcBodyObj.c
@@ -13,13 +13,31 @@
  * RCS: @(#) $Id: tclTestProcBodyObj.c,v 1.2 1998/11/10 06:54:44 jingham Exp $
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "tclInt.h"
 
 /*
+ * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+ * Test_Init declaration is in the source file itself, which is only
+ * accessed when we are building a library.
+ */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
+
+#ifdef __cplusplus
+}
+#define dummy /* */
+#endif
+
+/*
  * name and version of this package
  */
 
-static char packageName[] = "procbodytest";
+static char packageName[] = "Proctest";
 static char packageVersion[] = "1.0";
 
 /*
@@ -27,6 +45,7 @@
  */
 
 static char procCommand[] = "proc";
+static Tcl_ObjCmdProc* procProc = NULL;
 
 /*
  * this struct describes an entry in the table of command names and command
@@ -52,6 +71,8 @@
 			char *namespace, CONST CmdTable *cmdTablePtr));
 int             Procbodytest_Init _ANSI_ARGS_((Tcl_Interp * interp));
 int             Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp * interp));
+int             Proctest_Init _ANSI_ARGS_((Tcl_Interp * interp));
+int             Proctest_SafeInit _ANSI_ARGS_((Tcl_Interp * interp));
 
 /*
  * List of commands to create when the package is loaded; must go after the
@@ -75,9 +96,33 @@
 /*
  *----------------------------------------------------------------------
  *
+ * Proctest_Init --
+ *
+ *  This procedure initializes the "Proctest" package.
+ *
+ * Results:
+ *  A standard Tcl result.
+ *
+ * Side effects:
+ *  None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Proctest_Init(interp)
+    Tcl_Interp *interp;		/* the Tcl interpreter for which the package
+                                 * is initialized */
+{
+    return ProcBodyTestInitInternal(interp, 0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
  * Procbodytest_Init --
  *
- *  This procedure initializes the "procbodytest" package.
+ *  This procedure initializes the "Proctest" package.
  *
  * Results:
  *  A standard Tcl result.
@@ -101,7 +146,7 @@
  *
  * Procbodytest_SafeInit --
  *
- *  This procedure initializes the "procbodytest" package.
+ *  This procedure initializes the "Proctest" package.
  *
  * Results:
  *  A standard Tcl result.
@@ -119,6 +164,29 @@
 {
     return ProcBodyTestInitInternal(interp, 1);
 }
+/*
+ *----------------------------------------------------------------------
+ *
+ * Proctest_SafeInit --
+ *
+ *  This procedure initializes the "Proctest" package.
+ *
+ * Results:
+ *  A standard Tcl result.
+ *
+ * Side effects:
+ *  None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Proctest_SafeInit(interp)
+    Tcl_Interp *interp;		/* the Tcl interpreter for which the package
+                                 * is initialized */
+{
+    return ProcBodyTestInitInternal(interp, 1);
+}
 
 /*
  *----------------------------------------------------------------------
@@ -145,6 +213,15 @@
 {
     char buf[128];
 
+    if (!procProc) {
+	Tcl_CmdInfo info;
+	if (!Tcl_GetCommandInfo(interp, "::proc", &info)
+		|| (!info.isNativeObjectProc)) {
+	    return TCL_ERROR;
+	}
+	procProc = info.objProc;
+    }
+
     if (cmdTablePtr->exportIt) {
         sprintf(buf, "namespace eval %s { namespace export %s }",
                 namespace, cmdTablePtr->cmdName);
@@ -182,6 +259,9 @@
     int isSafe;			/* 1 if this is a safe interpreter */
 {
     CONST CmdTable *cmdTablePtr;
+    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+	return TCL_ERROR;
+    }
 
     cmdTablePtr = (isSafe) ? &safeCommands[0] : &commands[0];
     for ( ; cmdTablePtr->cmdName ; cmdTablePtr++) {
@@ -239,6 +319,7 @@
     Proc *procPtr = (Proc *) NULL;
     Tcl_Obj *bodyObjPtr;
     Tcl_Obj *myobjv[5];
+    Tcl_CmdInfo info;
     int result;
     
     if (objc != 4) {
@@ -312,7 +393,7 @@
     myobjv[3] = bodyObjPtr;
     myobjv[4] = (Tcl_Obj *) NULL;
 
-    result = Tcl_ProcObjCmd((ClientData) NULL, interp, objc, myobjv);
+    result = procProc((ClientData) NULL, interp, objc, myobjv);
     Tcl_DecrRefCount(bodyObjPtr);
 
     return result;
--- tcl8.2-8.2.3.orig/generic/tclThreadTest.c
+++ tcl8.2-8.2.3/generic/tclThreadTest.c
@@ -115,6 +115,7 @@
 #define TCL_STORAGE_CLASS DLLEXPORT
 
 EXTERN int	TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
+EXTERN int	Thread_Init _ANSI_ARGS_((Tcl_Interp *interp));
 EXTERN int	Tcl_ThreadObjCmd _ANSI_ARGS_((ClientData clientData,
 	Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
 EXTERN int	TclCreateThread _ANSI_ARGS_((Tcl_Interp *interp,
@@ -144,7 +145,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclThread_Init --
+ * TclThread_Init, Thread_Init --
  *
  *	Initialize the test thread command.
  *
@@ -156,12 +157,18 @@
  *
  *----------------------------------------------------------------------
  */
-
 int
 TclThread_Init(interp)
     Tcl_Interp *interp; /* The current Tcl interpreter */
 {
-    
+    return Thread_Init(interp);
+}
+
+int
+Thread_Init(interp)
+    Tcl_Interp *interp; /* The current Tcl interpreter */
+{
+    Tcl_InitStubs(interp, TCL_VERSION, 0);
     Tcl_CreateObjCommand(interp,"testthread", Tcl_ThreadObjCmd, 
 	    (ClientData)NULL ,NULL);
     if (Tcl_PkgProvide(interp, "Thread", "1.0" ) != TCL_OK) {
@@ -424,7 +431,7 @@
 
     tsdPtr->interp = Tcl_CreateInterp();
     result = Tcl_Init(tsdPtr->interp);
-    result = TclThread_Init(tsdPtr->interp);
+    result = Threadtest_Init(tsdPtr->interp);
 
     /*
      * Update the list of threads.
--- tcl8.2-8.2.3.orig/generic/tclUtil.c
+++ tcl8.2-8.2.3/generic/tclUtil.c
@@ -2135,13 +2135,13 @@
 
 int
 TclLooksLikeInt(bytes, length)
-    register char *bytes;	/* Points to first byte of the string. */
+    register CONST char *bytes;	/* Points to first byte of the string. */
     int length;			/* Number of bytes in the string. If < 0
 				 * bytes up to the first null byte are
 				 * considered (if they may appear in an 
 				 * integer). */
 {
-    register char *p, *end;
+    register CONST char *p, *end;
 
     if (length < 0) {
 	length = (bytes? strlen(bytes) : 0);
--- tcl8.2-8.2.3.orig/generic/tclVar.c
+++ tcl8.2-8.2.3/generic/tclVar.c
@@ -54,8 +54,8 @@
 static ArraySearch *	ParseSearchId _ANSI_ARGS_((Tcl_Interp *interp,
 			    Var *varPtr, char *varName, char *string));
 static void		VarErrMsg _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *part1, char *part2, char *operation,
-			    char *reason));
+			    char *part1, char *part2, CONST char *operation,
+			    CONST char *reason));
 
 /*
  *----------------------------------------------------------------------
@@ -104,7 +104,7 @@
     char *part2;		/* Name of element within array, or NULL. */
     int flags;			/* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
 				 * and TCL_LEAVE_ERR_MSG bits matter. */
-    char *msg;			/* Verb to use in error messages, e.g.
+    CONST char *msg;		/* Verb to use in error messages, e.g.
 				 * "read" or "set". Only needed if
 				 * TCL_LEAVE_ERR_MSG is set in flags. */
     int createPart1;		/* If 1, create hash table entry for part 1
@@ -243,7 +243,7 @@
 	    || (varFramePtr == NULL)
 	    || !varFramePtr->isProcCallFrame
 	    || (strstr(part1, "::") != NULL)) {
-	char *tail;
+	CONST char *tail;
 	
 	/*
 	 * Don't pass TCL_LEAVE_ERR_MSG, we may yet create the variable,
@@ -1016,7 +1016,7 @@
     Tcl_Interp *interp;		/* Command interpreter in which varName is
 				 * to be looked up. */
     char *varName;		/* Name of a variable in interp. */
-    char *newValue;		/* New value for varName. */
+    CONST char *newValue;	/* New value for varName. */
     int flags;			/* Various flags that tell how to set value:
 				 * any of TCL_GLOBAL_ONLY,
 				 * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE,
@@ -1061,7 +1061,7 @@
                                  * an array. */
     char *part2;                /* Name of an element within an array, or
 				 * NULL. */
-    char *newValue;             /* New value for variable. */
+    CONST char *newValue;	/* New value for variable. */
     int flags;                  /* Various flags that tell how to set value:
 				 * any of TCL_GLOBAL_ONLY,
 				 * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE,
@@ -1670,6 +1670,25 @@
     }
 
     /*
+     * If the variable is in a hashtable and its hPtr field is NULL, then we
+     * may have an upvar to an array element where the array was deleted
+     * or an upvar to a namespace variable whose namespace was deleted.
+     * Generate an error (allowing the variable to be reset would screw up
+     * our storage allocation and is meaningless anyway).
+     */
+
+    if ((arrayPtr->flags & VAR_IN_HASHTABLE) && (arrayPtr->hPtr == NULL)) {
+	if (leaveErrorMsg) {
+	    if (TclIsVarArrayElement(arrayPtr)) {
+		VarErrMsg(interp, arrayName, elem, "set", danglingElement);
+	    } else {
+		VarErrMsg(interp, arrayName, elem, "set", danglingVar);
+	    }
+	}
+	goto errorReturn;
+    }
+
+    /*
      * Make sure we're dealing with an array.
      */
 
@@ -3328,7 +3347,7 @@
     CallFrame *savedFramePtr = NULL;  /* Init. to avoid compiler warning. */
     Tcl_HashTable *tablePtr;
     Namespace *nsPtr, *altNsPtr, *dummyNsPtr;
-    char *tail;
+    CONST char *tail;
     int new;
 
     /*
@@ -3585,7 +3604,7 @@
 Tcl_UpVar2(interp, frameName, part1, part2, localName, flags)
     Tcl_Interp *interp;		/* Interpreter containing variables.  Used
 				 * for error messages too. */
-    char *frameName;		/* Name of the frame containing the source
+    CONST char *frameName;	/* Name of the frame containing the source
 				 * variable, such as "1" or "#0". */
     char *part1, *part2;	/* Two parts of source variable name to
 				 * link to. */
@@ -4663,9 +4682,9 @@
 VarErrMsg(interp, part1, part2, operation, reason)
     Tcl_Interp *interp;         /* Interpreter in which to record message. */
     char *part1, *part2;        /* Variable's two-part name. */
-    char *operation;            /* String describing operation that failed,
+    CONST char *operation;            /* String describing operation that failed,
                                  * e.g. "read", "set", or "unset". */
-    char *reason;               /* String describing why operation failed. */
+    CONST char *reason;               /* String describing why operation failed. */
 {
     Tcl_ResetResult(interp);
     Tcl_AppendResult(interp, "can't ", operation, " \"", part1,
--- tcl8.2-8.2.3.orig/generic/tcl.h
+++ tcl8.2-8.2.3/generic/tcl.h
@@ -59,7 +59,7 @@
 #define TCL_RELEASE_SERIAL  3
 
 #define TCL_VERSION	    "8.2"
-#define TCL_PATCH_LEVEL	    "8.2.3"
+#define TCL_PATCH_LEVEL	    "8.2.3+"
 
 /*
  * The following definitions set up the proper options for Windows
@@ -178,6 +178,10 @@
 #include <stdio.h>
 #endif
 
+#ifdef __STDC__
+#include <stddef.h>
+#endif /* __STDC__ */
+
 /*
  * Definitions that allow Tcl functions with variable numbers of
  * arguments to be used with either varargs.h or stdarg.h.  TCL_VARARGS
@@ -466,6 +470,43 @@
 #define TCL_BREAK	3
 #define TCL_CONTINUE	4
 
+/*
+ * The following definitions are the error codes returned by the conversion
+ * routines:
+ *
+ * TCL_OK:			All characters were converted.
+ *
+ * TCL_CONVERT_NOSPACE:		The output buffer would not have been large
+ *				enough for all of the converted data; as many
+ *				characters as could fit were converted though.
+ *
+ * TCL_CONVERT_MULTIBYTE:	The last few bytes in the source string were
+ *				the beginning of a multibyte sequence, but
+ *				more bytes were needed to complete this
+ *				sequence.  A subsequent call to the conversion
+ *				routine should pass the beginning of this
+ *				unconverted sequence plus additional bytes
+ *				from the source stream to properly convert
+ *				the formerly split-up multibyte sequence.
+ *
+ * TCL_CONVERT_SYNTAX:		The source stream contained an invalid
+ *				character sequence.  This may occur if the
+ *				input stream has been damaged or if the input
+ *				encoding method was misidentified.  This error
+ *				is reported only if TCL_ENCODING_STOPONERROR
+ *				was specified.
+ * 
+ * TCL_CONVERT_UNKNOWN:		The source string contained a character
+ *				that could not be represented in the target
+ *				encoding.  This error is reported only if
+ *				TCL_ENCODING_STOPONERROR was specified.
+ */
+
+#define TCL_CONVERT_MULTIBYTE		-1
+#define TCL_CONVERT_SYNTAX		-2
+#define TCL_CONVERT_UNKNOWN		-3
+#define TCL_CONVERT_NOSPACE		-4
+
 #define TCL_RESULT_SIZE 200
 
 /*
@@ -531,7 +572,7 @@
 typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
 	Tcl_Interp *interp, int objc, struct Tcl_Obj *CONST objv[]));
 typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
-typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(char *, format));
+typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
 typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
         Tcl_Channel chan, char *address, int port));
 typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
@@ -543,6 +584,7 @@
 typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask,
 	Tcl_FileProc *proc, ClientData clientData));
 typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd));
+typedef int (Tcl_MainLoopProc) _ANSI_ARGS_((void));
 
 /*
  * The following structure represents a type of object, which is a
@@ -815,6 +857,14 @@
 #define TCL_INTEGER_SPACE	24
 
 /*
+ * Definition for a number of bytes of buffer space sufficient to hold the
+ * string representation of an integer in base 10 (assuming the existence
+ * of 64-bit integers).
+ */
+
+#define TCL_INTEGER_SPACE	24
+
+/*
  * Flag that may be passed to Tcl_ConvertElement to force it not to
  * output braces (careful!  if you change this flag be sure to change
  * the definitions at the front of tclUtil.c).
@@ -1067,6 +1117,12 @@
 #define TCL_READABLE	(1<<1)
 #define TCL_WRITABLE	(1<<2)
 #define TCL_EXCEPTION	(1<<3)
+#define TCL_ACTIVE	0
+
+typedef struct Tcl_StaticFile {
+    CONST char *name;
+    char **content;
+} Tcl_StaticFile;
 
 /*
  * Flag values to pass to Tcl_OpenCommandChannel to indicate the
@@ -1164,6 +1220,15 @@
 } Tcl_EolTranslation;
 
 /*
+ * Definitions for different byteorders.
+ */
+
+typedef int Tcl_ByteOrder;
+
+#define TCL_BIGENDIAN 0
+#define TCL_SMALLENDIAN 1
+
+/*
  * struct Tcl_ChannelType:
  *
  * One such structure exists for each type (kind) of channel.
@@ -1558,6 +1623,8 @@
 #define Tcl_TildeSubst Tcl_TranslateFileName
 #define panic Tcl_Panic
 #define panicVA Tcl_PanicVA
+#define Tcl_ReplaceChannel	Tcl_StackChannel
+#define Tcl_UndoReplaceChannel	Tcl_UnstackChannel
 
 /*
  * The following constant is used to test for older versions of Tcl
--- tcl8.2-8.2.3.orig/generic/tclCompile.h
+++ tcl8.2-8.2.3/generic/tclCompile.h
@@ -558,8 +558,17 @@
 #define BUILTIN_FUNC_RAND		22
 #define BUILTIN_FUNC_ROUND		23
 #define BUILTIN_FUNC_SRAND		24
+#define BUILTIN_FUNC_ERF		25
+#define BUILTIN_FUNC_ERFC		26
+#define BUILTIN_FUNC_LGAMMA		27
+#define BUILTIN_FUNC_J0			28
+#define BUILTIN_FUNC_J1			29
+#define BUILTIN_FUNC_JN			30
+#define BUILTIN_FUNC_Y0			31
+#define BUILTIN_FUNC_Y1			32
+#define BUILTIN_FUNC_YN			33
 
-#define LAST_BUILTIN_FUNC        	24
+#define LAST_BUILTIN_FUNC        	33
 
 /*
  * Table describing the built-in math functions. Entries in this table are
--- tcl8.2-8.2.3.orig/generic/tclDecls.h
+++ tcl8.2-8.2.3/generic/tclDecls.h
@@ -28,14 +28,14 @@
 
 /* 0 */
 EXTERN int		Tcl_PkgProvideEx _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version, 
+				CONST char * name, CONST char * version, 
 				ClientData clientData));
 /* 1 */
 EXTERN char *		Tcl_PkgRequireEx _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version, int exact, 
-				ClientData * clientDataPtr));
+				CONST char * name, CONST char * version, 
+				int exact, ClientData * clientDataPtr));
 /* 2 */
-EXTERN void		Tcl_Panic _ANSI_ARGS_(TCL_VARARGS(char *,format));
+EXTERN void		Tcl_Panic _ANSI_ARGS_(TCL_VARARGS(CONST char *,format));
 /* 3 */
 EXTERN char *		Tcl_Alloc _ANSI_ARGS_((unsigned int size));
 /* 4 */
@@ -45,13 +45,14 @@
 				unsigned int size));
 /* 6 */
 EXTERN char *		Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 7 */
-EXTERN int		Tcl_DbCkfree _ANSI_ARGS_((char * ptr, char * file, 
-				int line));
+EXTERN int		Tcl_DbCkfree _ANSI_ARGS_((char * ptr, 
+				CONST char * file, int line));
 /* 8 */
 EXTERN char *		Tcl_DbCkrealloc _ANSI_ARGS_((char * ptr, 
-				unsigned int size, char * file, int line));
+				unsigned int size, CONST char * file, 
+				int line));
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
 /* 9 */
 EXTERN void		Tcl_CreateFileHandler _ANSI_ARGS_((int fd, int mask, 
@@ -83,41 +84,43 @@
 				Tcl_Obj * objPtr, Tcl_ObjType * typePtr));
 /* 19 */
 EXTERN void		Tcl_DbDecrRefCount _ANSI_ARGS_((Tcl_Obj * objPtr, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 20 */
 EXTERN void		Tcl_DbIncrRefCount _ANSI_ARGS_((Tcl_Obj * objPtr, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 21 */
 EXTERN int		Tcl_DbIsShared _ANSI_ARGS_((Tcl_Obj * objPtr, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 22 */
 EXTERN Tcl_Obj *	Tcl_DbNewBooleanObj _ANSI_ARGS_((int boolValue, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 23 */
 EXTERN Tcl_Obj *	Tcl_DbNewByteArrayObj _ANSI_ARGS_((
-				unsigned char * bytes, int length, 
-				char * file, int line));
+				CONST unsigned char * bytes, int length, 
+				CONST char * file, int line));
 /* 24 */
 EXTERN Tcl_Obj *	Tcl_DbNewDoubleObj _ANSI_ARGS_((double doubleValue, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 25 */
 EXTERN Tcl_Obj *	Tcl_DbNewListObj _ANSI_ARGS_((int objc, 
-				Tcl_Obj *CONST objv[], char * file, int line));
+				Tcl_Obj *CONST objv[], CONST char * file, 
+				int line));
 /* 26 */
 EXTERN Tcl_Obj *	Tcl_DbNewLongObj _ANSI_ARGS_((long longValue, 
-				char * file, int line));
+				CONST char * file, int line));
 /* 27 */
-EXTERN Tcl_Obj *	Tcl_DbNewObj _ANSI_ARGS_((char * file, int line));
+EXTERN Tcl_Obj *	Tcl_DbNewObj _ANSI_ARGS_((CONST char * file, 
+				int line));
 /* 28 */
 EXTERN Tcl_Obj *	Tcl_DbNewStringObj _ANSI_ARGS_((CONST char * bytes, 
-				int length, char * file, int line));
+				int length, CONST char * file, int line));
 /* 29 */
 EXTERN Tcl_Obj *	Tcl_DuplicateObj _ANSI_ARGS_((Tcl_Obj * objPtr));
 /* 30 */
 EXTERN void		TclFreeObj _ANSI_ARGS_((Tcl_Obj * objPtr));
 /* 31 */
 EXTERN int		Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, int * boolPtr));
+				CONST char * str, int * boolPtr));
 /* 32 */
 EXTERN int		Tcl_GetBooleanFromObj _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * objPtr, 
@@ -127,7 +130,7 @@
 				Tcl_Obj * objPtr, int * lengthPtr));
 /* 34 */
 EXTERN int		Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, double * doublePtr));
+				CONST char * str, double * doublePtr));
 /* 35 */
 EXTERN int		Tcl_GetDoubleFromObj _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * objPtr, 
@@ -135,10 +138,10 @@
 /* 36 */
 EXTERN int		Tcl_GetIndexFromObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, char ** tablePtr, 
-				char * msg, int flags, int * indexPtr));
+				CONST char * msg, int flags, int * indexPtr));
 /* 37 */
 EXTERN int		Tcl_GetInt _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, int * intPtr));
+				CONST char * str, int * intPtr));
 /* 38 */
 EXTERN int		Tcl_GetIntFromObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, int * intPtr));
@@ -146,7 +149,7 @@
 EXTERN int		Tcl_GetLongFromObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, long * longPtr));
 /* 40 */
-EXTERN Tcl_ObjType *	Tcl_GetObjType _ANSI_ARGS_((char * typeName));
+EXTERN Tcl_ObjType *	Tcl_GetObjType _ANSI_ARGS_((CONST char * typeName));
 /* 41 */
 EXTERN char *		Tcl_GetStringFromObj _ANSI_ARGS_((Tcl_Obj * objPtr, 
 				int * lengthPtr));
@@ -180,7 +183,7 @@
 EXTERN Tcl_Obj *	Tcl_NewBooleanObj _ANSI_ARGS_((int boolValue));
 /* 50 */
 EXTERN Tcl_Obj *	Tcl_NewByteArrayObj _ANSI_ARGS_((
-				unsigned char * bytes, int length));
+				CONST unsigned char * bytes, int length));
 /* 51 */
 EXTERN Tcl_Obj *	Tcl_NewDoubleObj _ANSI_ARGS_((double doubleValue));
 /* 52 */
@@ -203,7 +206,7 @@
 				int length));
 /* 59 */
 EXTERN void		Tcl_SetByteArrayObj _ANSI_ARGS_((Tcl_Obj * objPtr, 
-				unsigned char * bytes, int length));
+				CONST unsigned char * bytes, int length));
 /* 60 */
 EXTERN void		Tcl_SetDoubleObj _ANSI_ARGS_((Tcl_Obj * objPtr, 
 				double doubleValue));
@@ -221,7 +224,7 @@
 				int length));
 /* 65 */
 EXTERN void		Tcl_SetStringObj _ANSI_ARGS_((Tcl_Obj * objPtr, 
-				char * bytes, int length));
+				CONST char * bytes, int length));
 /* 66 */
 EXTERN void		Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp * interp, 
 				CONST char * message));
@@ -254,8 +257,8 @@
 				int * readPtr));
 /* 78 */
 EXTERN int		Tcl_BadChannelOption _ANSI_ARGS_((
-				Tcl_Interp * interp, char * optionName, 
-				char * optionList));
+				Tcl_Interp * interp, CONST char * optionName, 
+				CONST char * optionList));
 /* 79 */
 EXTERN void		Tcl_CallWhenDeleted _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_InterpDeleteProc * proc, 
@@ -280,16 +283,18 @@
 				int flags));
 /* 86 */
 EXTERN int		Tcl_CreateAlias _ANSI_ARGS_((Tcl_Interp * slave, 
-				char * slaveCmd, Tcl_Interp * target, 
-				char * targetCmd, int argc, char ** argv));
+				CONST char * slaveCmd, Tcl_Interp * target, 
+				CONST char * targetCmd, int argc, 
+				char ** argv));
 /* 87 */
 EXTERN int		Tcl_CreateAliasObj _ANSI_ARGS_((Tcl_Interp * slave, 
-				char * slaveCmd, Tcl_Interp * target, 
-				char * targetCmd, int objc, 
+				CONST char * slaveCmd, Tcl_Interp * target, 
+				CONST char * targetCmd, int objc, 
 				Tcl_Obj *CONST objv[]));
 /* 88 */
 EXTERN Tcl_Channel	Tcl_CreateChannel _ANSI_ARGS_((
-				Tcl_ChannelType * typePtr, char * chanName, 
+				Tcl_ChannelType * typePtr, 
+				CONST char * chanName, 
 				ClientData instanceData, int mask));
 /* 89 */
 EXTERN void		Tcl_CreateChannelHandler _ANSI_ARGS_((
@@ -301,7 +306,7 @@
 				Tcl_CloseProc * proc, ClientData clientData));
 /* 91 */
 EXTERN Tcl_Command	Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * cmdName, Tcl_CmdProc * proc, 
+				CONST char * cmdName, Tcl_CmdProc * proc, 
 				ClientData clientData, 
 				Tcl_CmdDeleteProc * deleteProc));
 /* 92 */
@@ -316,17 +321,17 @@
 EXTERN Tcl_Interp *	Tcl_CreateInterp _ANSI_ARGS_((void));
 /* 95 */
 EXTERN void		Tcl_CreateMathFunc _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, int numArgs, 
+				CONST char * name, int numArgs, 
 				Tcl_ValueType * argTypes, 
 				Tcl_MathProc * proc, ClientData clientData));
 /* 96 */
 EXTERN Tcl_Command	Tcl_CreateObjCommand _ANSI_ARGS_((
-				Tcl_Interp * interp, char * cmdName, 
+				Tcl_Interp * interp, CONST char * cmdName, 
 				Tcl_ObjCmdProc * proc, ClientData clientData, 
 				Tcl_CmdDeleteProc * deleteProc));
 /* 97 */
 EXTERN Tcl_Interp *	Tcl_CreateSlave _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * slaveName, int isSafe));
+				CONST char * slaveName, int isSafe));
 /* 98 */
 EXTERN Tcl_TimerToken	Tcl_CreateTimerHandler _ANSI_ARGS_((int milliseconds, 
 				Tcl_TimerProc * proc, ClientData clientData));
@@ -336,7 +341,7 @@
 				ClientData clientData));
 /* 100 */
 EXTERN void		Tcl_DeleteAssocData _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name));
+				CONST char * name));
 /* 101 */
 EXTERN void		Tcl_DeleteChannelHandler _ANSI_ARGS_((
 				Tcl_Channel chan, Tcl_ChannelProc * proc, 
@@ -346,7 +351,7 @@
 				Tcl_CloseProc * proc, ClientData clientData));
 /* 103 */
 EXTERN int		Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * cmdName));
+				CONST char * cmdName));
 /* 104 */
 EXTERN int		Tcl_DeleteCommandFromToken _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Command command));
@@ -401,7 +406,7 @@
 				CONST char * str, int length));
 /* 118 */
 EXTERN char *		Tcl_DStringAppendElement _ANSI_ARGS_((
-				Tcl_DString * dsPtr, CONST char * string));
+				Tcl_DString * dsPtr, CONST char * str));
 /* 119 */
 EXTERN void		Tcl_DStringEndSublist _ANSI_ARGS_((
 				Tcl_DString * dsPtr));
@@ -432,7 +437,7 @@
 				char * string));
 /* 130 */
 EXTERN int		Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * fileName));
+				CONST char * fileName));
 /* 131 */
 EXTERN int		Tcl_EvalObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr));
@@ -444,22 +449,23 @@
 EXTERN void		Tcl_Exit _ANSI_ARGS_((int status));
 /* 134 */
 EXTERN int		Tcl_ExposeCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * hiddenCmdToken, char * cmdName));
+				CONST char * hiddenCmdToken, 
+				CONST char * cmdName));
 /* 135 */
 EXTERN int		Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, int * ptr));
+				CONST char * str, int * ptr));
 /* 136 */
 EXTERN int		Tcl_ExprBooleanObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, int * ptr));
 /* 137 */
 EXTERN int		Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, double * ptr));
+				CONST char * str, double * ptr));
 /* 138 */
 EXTERN int		Tcl_ExprDoubleObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, double * ptr));
 /* 139 */
 EXTERN int		Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, long * ptr));
+				CONST char * str, long * ptr));
 /* 140 */
 EXTERN int		Tcl_ExprLongObj _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Obj * objPtr, long * ptr));
@@ -468,7 +474,7 @@
 				Tcl_Obj * objPtr, Tcl_Obj ** resultPtrPtr));
 /* 142 */
 EXTERN int		Tcl_ExprString _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * string));
+				CONST char * string));
 /* 143 */
 EXTERN void		Tcl_Finalize _ANSI_ARGS_((void));
 /* 144 */
@@ -483,22 +489,23 @@
 EXTERN void		Tcl_FreeResult _ANSI_ARGS_((Tcl_Interp * interp));
 /* 148 */
 EXTERN int		Tcl_GetAlias _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * slaveCmd, 
+				CONST char * slaveCmd, 
 				Tcl_Interp ** targetInterpPtr, 
 				char ** targetCmdPtr, int * argcPtr, 
 				char *** argvPtr));
 /* 149 */
 EXTERN int		Tcl_GetAliasObj _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * slaveCmd, 
+				CONST char * slaveCmd, 
 				Tcl_Interp ** targetInterpPtr, 
 				char ** targetCmdPtr, int * objcPtr, 
 				Tcl_Obj *** objv));
 /* 150 */
 EXTERN ClientData	Tcl_GetAssocData _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, Tcl_InterpDeleteProc ** procPtr));
+				CONST char * name, 
+				Tcl_InterpDeleteProc ** procPtr));
 /* 151 */
 EXTERN Tcl_Channel	Tcl_GetChannel _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * chanName, int * modePtr));
+				CONST char * chanName, int * modePtr));
 /* 152 */
 EXTERN int		Tcl_GetChannelBufferSize _ANSI_ARGS_((
 				Tcl_Channel chan));
@@ -515,12 +522,12 @@
 /* 157 */
 EXTERN int		Tcl_GetChannelOption _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Channel chan, 
-				char * optionName, Tcl_DString * dsPtr));
+				CONST char * optionName, Tcl_DString * dsPtr));
 /* 158 */
 EXTERN Tcl_ChannelType * Tcl_GetChannelType _ANSI_ARGS_((Tcl_Channel chan));
 /* 159 */
 EXTERN int		Tcl_GetCommandInfo _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * cmdName, Tcl_CmdInfo * infoPtr));
+				CONST char * cmdName, Tcl_CmdInfo * infoPtr));
 /* 160 */
 EXTERN char *		Tcl_GetCommandName _ANSI_ARGS_((Tcl_Interp * interp, 
 				Tcl_Command command));
@@ -541,11 +548,11 @@
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
 /* 167 */
 EXTERN int		Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, int write, int checkUsage, 
+				CONST char * str, int write, int checkUsage, 
 				ClientData * filePtr));
 #endif /* UNIX */
 /* 168 */
-EXTERN Tcl_PathType	Tcl_GetPathType _ANSI_ARGS_((char * path));
+EXTERN Tcl_PathType	Tcl_GetPathType _ANSI_ARGS_((CONST char * path));
 /* 169 */
 EXTERN int		Tcl_Gets _ANSI_ARGS_((Tcl_Channel chan, 
 				Tcl_DString * dsPtr));
@@ -556,7 +563,7 @@
 EXTERN int		Tcl_GetServiceMode _ANSI_ARGS_((void));
 /* 172 */
 EXTERN Tcl_Interp *	Tcl_GetSlave _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * slaveName));
+				CONST char * slaveName));
 /* 173 */
 EXTERN Tcl_Channel	Tcl_GetStdChannel _ANSI_ARGS_((int type));
 /* 174 */
@@ -575,7 +582,8 @@
 				Tcl_Obj * objPtr));
 /* 179 */
 EXTERN int		Tcl_HideCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * cmdName, char * hiddenCmdToken));
+				CONST char * cmdName, 
+				CONST char * hiddenCmdToken));
 /* 180 */
 EXTERN int		Tcl_Init _ANSI_ARGS_((Tcl_Interp * interp));
 /* 181 */
@@ -595,7 +603,8 @@
 /* 187 */
 EXTERN int		Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * varName, char * addr, int type));
-/* Slot 188 is reserved */
+/* 188 */
+EXTERN void		Tcl_MainLoop _ANSI_ARGS_((void));
 /* 189 */
 EXTERN Tcl_Channel	Tcl_MakeFileChannel _ANSI_ARGS_((ClientData handle, 
 				int mode));
@@ -634,15 +643,15 @@
 #endif /* __WIN32__ */
 /* 198 */
 EXTERN Tcl_Channel	Tcl_OpenFileChannel _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * fileName, char * modeString, 
-				int permissions));
+				CONST char * fileName, 
+				CONST char * modeString, int permissions));
 /* 199 */
 EXTERN Tcl_Channel	Tcl_OpenTcpClient _ANSI_ARGS_((Tcl_Interp * interp, 
-				int port, char * address, char * myaddr, 
-				int myport, int async));
+				int port, CONST char * address, 
+				CONST char * myaddr, int myport, int async));
 /* 200 */
 EXTERN Tcl_Channel	Tcl_OpenTcpServer _ANSI_ARGS_((Tcl_Interp * interp, 
-				int port, char * host, 
+				int port, CONST char * host, 
 				Tcl_TcpAcceptProc * acceptProc, 
 				ClientData callbackData));
 /* 201 */
@@ -713,7 +722,8 @@
 EXTERN int		Tcl_ServiceEvent _ANSI_ARGS_((int flags));
 /* 223 */
 EXTERN void		Tcl_SetAssocData _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, Tcl_InterpDeleteProc * proc, 
+				CONST char * name, 
+				Tcl_InterpDeleteProc * proc, 
 				ClientData clientData));
 /* 224 */
 EXTERN void		Tcl_SetChannelBufferSize _ANSI_ARGS_((
@@ -721,10 +731,11 @@
 /* 225 */
 EXTERN int		Tcl_SetChannelOption _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Channel chan, 
-				char * optionName, char * newValue));
+				CONST char * optionName, 
+				CONST char * newValue));
 /* 226 */
 EXTERN int		Tcl_SetCommandInfo _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * cmdName, Tcl_CmdInfo * infoPtr));
+				CONST char * cmdName, Tcl_CmdInfo * infoPtr));
 /* 227 */
 EXTERN void		Tcl_SetErrno _ANSI_ARGS_((int err));
 /* 228 */
@@ -753,11 +764,12 @@
 				int type));
 /* 237 */
 EXTERN char *		Tcl_SetVar _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * varName, char * newValue, int flags));
+				char * varName, CONST char * newValue, 
+				int flags));
 /* 238 */
 EXTERN char *		Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * part1, char * part2, char * newValue, 
-				int flags));
+				char * part1, char * part2, 
+				CONST char * newValue, int flags));
 /* 239 */
 EXTERN char *		Tcl_SignalId _ANSI_ARGS_((int sig));
 /* 240 */
@@ -773,7 +785,7 @@
 				int * argcPtr, char *** argvPtr));
 /* 244 */
 EXTERN void		Tcl_StaticPackage _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * pkgName, 
+				CONST char * pkgName, 
 				Tcl_PackageInitProc * initProc, 
 				Tcl_PackageInitProc * safeInitProc));
 /* 245 */
@@ -793,11 +805,11 @@
 				ClientData clientData));
 /* 249 */
 EXTERN char *		Tcl_TranslateFileName _ANSI_ARGS_((
-				Tcl_Interp * interp, char * name, 
+				Tcl_Interp * interp, CONST char * name, 
 				Tcl_DString * bufferPtr));
 /* 250 */
-EXTERN int		Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, char * str, 
-				int len, int atHead));
+EXTERN int		Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, 
+				CONST char * str, int len, int atHead));
 /* 251 */
 EXTERN void		Tcl_UnlinkVar _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * varName));
@@ -829,8 +841,8 @@
 				char * localName, int flags));
 /* 259 */
 EXTERN int		Tcl_UpVar2 _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * frameName, char * part1, char * part2, 
-				char * localName, int flags));
+				CONST char * frameName, char * part1, 
+				char * part2, char * localName, int flags));
 /* 260 */
 EXTERN int		Tcl_VarEval _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp));
 /* 261 */
@@ -844,16 +856,17 @@
 				Tcl_VarTraceProc * procPtr, 
 				ClientData prevClientData));
 /* 263 */
-EXTERN int		Tcl_Write _ANSI_ARGS_((Tcl_Channel chan, char * s, 
-				int slen));
+EXTERN int		Tcl_Write _ANSI_ARGS_((Tcl_Channel chan, 
+				CONST char * s, int slen));
 /* 264 */
 EXTERN void		Tcl_WrongNumArgs _ANSI_ARGS_((Tcl_Interp * interp, 
 				int objc, Tcl_Obj *CONST objv[], 
-				char * message));
+				CONST char * message));
 /* 265 */
-EXTERN int		Tcl_DumpActiveMemory _ANSI_ARGS_((char * fileName));
+EXTERN int		Tcl_DumpActiveMemory _ANSI_ARGS_((
+				CONST char * fileName));
 /* 266 */
-EXTERN void		Tcl_ValidateAllMemory _ANSI_ARGS_((char * file, 
+EXTERN void		Tcl_ValidateAllMemory _ANSI_ARGS_((CONST char * file, 
 				int line));
 /* 267 */
 EXTERN void		Tcl_AppendResultVA _ANSI_ARGS_((Tcl_Interp * interp, 
@@ -868,17 +881,19 @@
 				char * str, char ** termPtr));
 /* 271 */
 EXTERN char *		Tcl_PkgPresent _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version, int exact));
+				CONST char * name, CONST char * version, 
+				int exact));
 /* 272 */
 EXTERN char *		Tcl_PkgPresentEx _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version, int exact, 
-				ClientData * clientDataPtr));
+				CONST char * name, CONST char * version, 
+				int exact, ClientData * clientDataPtr));
 /* 273 */
 EXTERN int		Tcl_PkgProvide _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version));
+				CONST char * name, CONST char * version));
 /* 274 */
 EXTERN char *		Tcl_PkgRequire _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, char * version, int exact));
+				CONST char * name, CONST char * version, 
+				int exact));
 /* 275 */
 EXTERN void		Tcl_SetErrorCodeVA _ANSI_ARGS_((Tcl_Interp * interp, 
 				va_list argList));
@@ -890,12 +905,12 @@
 				int options));
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
 /* 278 */
-EXTERN void		Tcl_PanicVA _ANSI_ARGS_((char * format, 
+EXTERN void		Tcl_PanicVA _ANSI_ARGS_((CONST char * format, 
 				va_list argList));
 #endif /* UNIX */
 #ifdef __WIN32__
 /* 278 */
-EXTERN void		Tcl_PanicVA _ANSI_ARGS_((char * format, 
+EXTERN void		Tcl_PanicVA _ANSI_ARGS_((CONST char * format, 
 				va_list argList));
 #endif /* __WIN32__ */
 /* 279 */
@@ -913,7 +928,8 @@
 				Tcl_Channel chan));
 /* 283 */
 EXTERN Tcl_Channel	Tcl_GetStackedChannel _ANSI_ARGS_((Tcl_Channel chan));
-/* Slot 284 is reserved */
+/* 284 */
+EXTERN void		Tcl_SetMainLoop _ANSI_ARGS_((Tcl_MainLoopProc * proc));
 /* Slot 285 is reserved */
 /* 286 */
 EXTERN void		Tcl_AppendObjToObj _ANSI_ARGS_((Tcl_Obj * objPtr, 
@@ -973,8 +989,8 @@
 /* 304 */
 EXTERN int		Tcl_GetIndexFromObjStruct _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * objPtr, 
-				char ** tablePtr, int offset, char * msg, 
-				int flags, int * indexPtr));
+				char ** tablePtr, int offset, 
+				CONST char * msg, int flags, int * indexPtr));
 /* 305 */
 EXTERN VOID *		Tcl_GetThreadData _ANSI_ARGS_((
 				Tcl_ThreadDataKey * keyPtr, int size));
@@ -1223,15 +1239,15 @@
     int magic;
     struct TclStubHooks *hooks;
 
-    int (*tcl_PkgProvideEx) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version, ClientData clientData)); /* 0 */
-    char * (*tcl_PkgRequireEx) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version, int exact, ClientData * clientDataPtr)); /* 1 */
-    void (*tcl_Panic) _ANSI_ARGS_(TCL_VARARGS(char *,format)); /* 2 */
+    int (*tcl_PkgProvideEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, ClientData clientData)); /* 0 */
+    char * (*tcl_PkgRequireEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact, ClientData * clientDataPtr)); /* 1 */
+    void (*tcl_Panic) _ANSI_ARGS_(TCL_VARARGS(CONST char *,format)); /* 2 */
     char * (*tcl_Alloc) _ANSI_ARGS_((unsigned int size)); /* 3 */
     void (*tcl_Free) _ANSI_ARGS_((char * ptr)); /* 4 */
     char * (*tcl_Realloc) _ANSI_ARGS_((char * ptr, unsigned int size)); /* 5 */
-    char * (*tcl_DbCkalloc) _ANSI_ARGS_((unsigned int size, char * file, int line)); /* 6 */
-    int (*tcl_DbCkfree) _ANSI_ARGS_((char * ptr, char * file, int line)); /* 7 */
-    char * (*tcl_DbCkrealloc) _ANSI_ARGS_((char * ptr, unsigned int size, char * file, int line)); /* 8 */
+    char * (*tcl_DbCkalloc) _ANSI_ARGS_((unsigned int size, CONST char * file, int line)); /* 6 */
+    int (*tcl_DbCkfree) _ANSI_ARGS_((char * ptr, CONST char * file, int line)); /* 7 */
+    char * (*tcl_DbCkrealloc) _ANSI_ARGS_((char * ptr, unsigned int size, CONST char * file, int line)); /* 8 */
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
     void (*tcl_CreateFileHandler) _ANSI_ARGS_((int fd, int mask, Tcl_FileProc * proc, ClientData clientData)); /* 9 */
 #endif /* UNIX */
@@ -1258,28 +1274,28 @@
     void (*tcl_AppendToObj) _ANSI_ARGS_((Tcl_Obj * objPtr, char * bytes, int length)); /* 16 */
     Tcl_Obj * (*tcl_ConcatObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[])); /* 17 */
     int (*tcl_ConvertToType) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_ObjType * typePtr)); /* 18 */
-    void (*tcl_DbDecrRefCount) _ANSI_ARGS_((Tcl_Obj * objPtr, char * file, int line)); /* 19 */
-    void (*tcl_DbIncrRefCount) _ANSI_ARGS_((Tcl_Obj * objPtr, char * file, int line)); /* 20 */
-    int (*tcl_DbIsShared) _ANSI_ARGS_((Tcl_Obj * objPtr, char * file, int line)); /* 21 */
-    Tcl_Obj * (*tcl_DbNewBooleanObj) _ANSI_ARGS_((int boolValue, char * file, int line)); /* 22 */
-    Tcl_Obj * (*tcl_DbNewByteArrayObj) _ANSI_ARGS_((unsigned char * bytes, int length, char * file, int line)); /* 23 */
-    Tcl_Obj * (*tcl_DbNewDoubleObj) _ANSI_ARGS_((double doubleValue, char * file, int line)); /* 24 */
-    Tcl_Obj * (*tcl_DbNewListObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[], char * file, int line)); /* 25 */
-    Tcl_Obj * (*tcl_DbNewLongObj) _ANSI_ARGS_((long longValue, char * file, int line)); /* 26 */
-    Tcl_Obj * (*tcl_DbNewObj) _ANSI_ARGS_((char * file, int line)); /* 27 */
-    Tcl_Obj * (*tcl_DbNewStringObj) _ANSI_ARGS_((CONST char * bytes, int length, char * file, int line)); /* 28 */
+    void (*tcl_DbDecrRefCount) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST char * file, int line)); /* 19 */
+    void (*tcl_DbIncrRefCount) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST char * file, int line)); /* 20 */
+    int (*tcl_DbIsShared) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST char * file, int line)); /* 21 */
+    Tcl_Obj * (*tcl_DbNewBooleanObj) _ANSI_ARGS_((int boolValue, CONST char * file, int line)); /* 22 */
+    Tcl_Obj * (*tcl_DbNewByteArrayObj) _ANSI_ARGS_((CONST unsigned char * bytes, int length, CONST char * file, int line)); /* 23 */
+    Tcl_Obj * (*tcl_DbNewDoubleObj) _ANSI_ARGS_((double doubleValue, CONST char * file, int line)); /* 24 */
+    Tcl_Obj * (*tcl_DbNewListObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[], CONST char * file, int line)); /* 25 */
+    Tcl_Obj * (*tcl_DbNewLongObj) _ANSI_ARGS_((long longValue, CONST char * file, int line)); /* 26 */
+    Tcl_Obj * (*tcl_DbNewObj) _ANSI_ARGS_((CONST char * file, int line)); /* 27 */
+    Tcl_Obj * (*tcl_DbNewStringObj) _ANSI_ARGS_((CONST char * bytes, int length, CONST char * file, int line)); /* 28 */
     Tcl_Obj * (*tcl_DuplicateObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 29 */
     void (*tclFreeObj) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 30 */
-    int (*tcl_GetBoolean) _ANSI_ARGS_((Tcl_Interp * interp, char * str, int * boolPtr)); /* 31 */
+    int (*tcl_GetBoolean) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * boolPtr)); /* 31 */
     int (*tcl_GetBooleanFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * boolPtr)); /* 32 */
     unsigned char * (*tcl_GetByteArrayFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int * lengthPtr)); /* 33 */
-    int (*tcl_GetDouble) _ANSI_ARGS_((Tcl_Interp * interp, char * str, double * doublePtr)); /* 34 */
+    int (*tcl_GetDouble) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, double * doublePtr)); /* 34 */
     int (*tcl_GetDoubleFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * doublePtr)); /* 35 */
-    int (*tcl_GetIndexFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char ** tablePtr, char * msg, int flags, int * indexPtr)); /* 36 */
-    int (*tcl_GetInt) _ANSI_ARGS_((Tcl_Interp * interp, char * str, int * intPtr)); /* 37 */
+    int (*tcl_GetIndexFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char ** tablePtr, CONST char * msg, int flags, int * indexPtr)); /* 36 */
+    int (*tcl_GetInt) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * intPtr)); /* 37 */
     int (*tcl_GetIntFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * intPtr)); /* 38 */
     int (*tcl_GetLongFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * longPtr)); /* 39 */
-    Tcl_ObjType * (*tcl_GetObjType) _ANSI_ARGS_((char * typeName)); /* 40 */
+    Tcl_ObjType * (*tcl_GetObjType) _ANSI_ARGS_((CONST char * typeName)); /* 40 */
     char * (*tcl_GetStringFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int * lengthPtr)); /* 41 */
     void (*tcl_InvalidateStringRep) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 42 */
     int (*tcl_ListObjAppendList) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * listPtr, Tcl_Obj * elemListPtr)); /* 43 */
@@ -1289,7 +1305,7 @@
     int (*tcl_ListObjLength) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * listPtr, int * intPtr)); /* 47 */
     int (*tcl_ListObjReplace) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * listPtr, int first, int count, int objc, Tcl_Obj *CONST objv[])); /* 48 */
     Tcl_Obj * (*tcl_NewBooleanObj) _ANSI_ARGS_((int boolValue)); /* 49 */
-    Tcl_Obj * (*tcl_NewByteArrayObj) _ANSI_ARGS_((unsigned char * bytes, int length)); /* 50 */
+    Tcl_Obj * (*tcl_NewByteArrayObj) _ANSI_ARGS_((CONST unsigned char * bytes, int length)); /* 50 */
     Tcl_Obj * (*tcl_NewDoubleObj) _ANSI_ARGS_((double doubleValue)); /* 51 */
     Tcl_Obj * (*tcl_NewIntObj) _ANSI_ARGS_((int intValue)); /* 52 */
     Tcl_Obj * (*tcl_NewListObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[])); /* 53 */
@@ -1298,13 +1314,13 @@
     Tcl_Obj * (*tcl_NewStringObj) _ANSI_ARGS_((CONST char * bytes, int length)); /* 56 */
     void (*tcl_SetBooleanObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int boolValue)); /* 57 */
     unsigned char * (*tcl_SetByteArrayLength) _ANSI_ARGS_((Tcl_Obj * objPtr, int length)); /* 58 */
-    void (*tcl_SetByteArrayObj) _ANSI_ARGS_((Tcl_Obj * objPtr, unsigned char * bytes, int length)); /* 59 */
+    void (*tcl_SetByteArrayObj) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST unsigned char * bytes, int length)); /* 59 */
     void (*tcl_SetDoubleObj) _ANSI_ARGS_((Tcl_Obj * objPtr, double doubleValue)); /* 60 */
     void (*tcl_SetIntObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int intValue)); /* 61 */
     void (*tcl_SetListObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int objc, Tcl_Obj *CONST objv[])); /* 62 */
     void (*tcl_SetLongObj) _ANSI_ARGS_((Tcl_Obj * objPtr, long longValue)); /* 63 */
     void (*tcl_SetObjLength) _ANSI_ARGS_((Tcl_Obj * objPtr, int length)); /* 64 */
-    void (*tcl_SetStringObj) _ANSI_ARGS_((Tcl_Obj * objPtr, char * bytes, int length)); /* 65 */
+    void (*tcl_SetStringObj) _ANSI_ARGS_((Tcl_Obj * objPtr, CONST char * bytes, int length)); /* 65 */
     void (*tcl_AddErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message)); /* 66 */
     void (*tcl_AddObjErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message, int length)); /* 67 */
     void (*tcl_AllowExceptions) _ANSI_ARGS_((Tcl_Interp * interp)); /* 68 */
@@ -1317,7 +1333,7 @@
     int (*tcl_AsyncReady) _ANSI_ARGS_((void)); /* 75 */
     void (*tcl_BackgroundError) _ANSI_ARGS_((Tcl_Interp * interp)); /* 76 */
     char (*tcl_Backslash) _ANSI_ARGS_((CONST char * src, int * readPtr)); /* 77 */
-    int (*tcl_BadChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, char * optionName, char * optionList)); /* 78 */
+    int (*tcl_BadChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * optionName, CONST char * optionList)); /* 78 */
     void (*tcl_CallWhenDeleted) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 79 */
     void (*tcl_CancelIdleCall) _ANSI_ARGS_((Tcl_IdleProc * idleProc, ClientData clientData)); /* 80 */
     int (*tcl_Close) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 81 */
@@ -1325,24 +1341,24 @@
     char * (*tcl_Concat) _ANSI_ARGS_((int argc, char ** argv)); /* 83 */
     int (*tcl_ConvertElement) _ANSI_ARGS_((CONST char * src, char * dst, int flags)); /* 84 */
     int (*tcl_ConvertCountedElement) _ANSI_ARGS_((CONST char * src, int length, char * dst, int flags)); /* 85 */
-    int (*tcl_CreateAlias) _ANSI_ARGS_((Tcl_Interp * slave, char * slaveCmd, Tcl_Interp * target, char * targetCmd, int argc, char ** argv)); /* 86 */
-    int (*tcl_CreateAliasObj) _ANSI_ARGS_((Tcl_Interp * slave, char * slaveCmd, Tcl_Interp * target, char * targetCmd, int objc, Tcl_Obj *CONST objv[])); /* 87 */
-    Tcl_Channel (*tcl_CreateChannel) _ANSI_ARGS_((Tcl_ChannelType * typePtr, char * chanName, ClientData instanceData, int mask)); /* 88 */
+    int (*tcl_CreateAlias) _ANSI_ARGS_((Tcl_Interp * slave, CONST char * slaveCmd, Tcl_Interp * target, CONST char * targetCmd, int argc, char ** argv)); /* 86 */
+    int (*tcl_CreateAliasObj) _ANSI_ARGS_((Tcl_Interp * slave, CONST char * slaveCmd, Tcl_Interp * target, CONST char * targetCmd, int objc, Tcl_Obj *CONST objv[])); /* 87 */
+    Tcl_Channel (*tcl_CreateChannel) _ANSI_ARGS_((Tcl_ChannelType * typePtr, CONST char * chanName, ClientData instanceData, int mask)); /* 88 */
     void (*tcl_CreateChannelHandler) _ANSI_ARGS_((Tcl_Channel chan, int mask, Tcl_ChannelProc * proc, ClientData clientData)); /* 89 */
     void (*tcl_CreateCloseHandler) _ANSI_ARGS_((Tcl_Channel chan, Tcl_CloseProc * proc, ClientData clientData)); /* 90 */
-    Tcl_Command (*tcl_CreateCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName, Tcl_CmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 91 */
+    Tcl_Command (*tcl_CreateCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 91 */
     void (*tcl_CreateEventSource) _ANSI_ARGS_((Tcl_EventSetupProc * setupProc, Tcl_EventCheckProc * checkProc, ClientData clientData)); /* 92 */
     void (*tcl_CreateExitHandler) _ANSI_ARGS_((Tcl_ExitProc * proc, ClientData clientData)); /* 93 */
     Tcl_Interp * (*tcl_CreateInterp) _ANSI_ARGS_((void)); /* 94 */
-    void (*tcl_CreateMathFunc) _ANSI_ARGS_((Tcl_Interp * interp, char * name, int numArgs, Tcl_ValueType * argTypes, Tcl_MathProc * proc, ClientData clientData)); /* 95 */
-    Tcl_Command (*tcl_CreateObjCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName, Tcl_ObjCmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 96 */
-    Tcl_Interp * (*tcl_CreateSlave) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveName, int isSafe)); /* 97 */
+    void (*tcl_CreateMathFunc) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, int numArgs, Tcl_ValueType * argTypes, Tcl_MathProc * proc, ClientData clientData)); /* 95 */
+    Tcl_Command (*tcl_CreateObjCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_ObjCmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 96 */
+    Tcl_Interp * (*tcl_CreateSlave) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveName, int isSafe)); /* 97 */
     Tcl_TimerToken (*tcl_CreateTimerHandler) _ANSI_ARGS_((int milliseconds, Tcl_TimerProc * proc, ClientData clientData)); /* 98 */
     Tcl_Trace (*tcl_CreateTrace) _ANSI_ARGS_((Tcl_Interp * interp, int level, Tcl_CmdTraceProc * proc, ClientData clientData)); /* 99 */
-    void (*tcl_DeleteAssocData) _ANSI_ARGS_((Tcl_Interp * interp, char * name)); /* 100 */
+    void (*tcl_DeleteAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 100 */
     void (*tcl_DeleteChannelHandler) _ANSI_ARGS_((Tcl_Channel chan, Tcl_ChannelProc * proc, ClientData clientData)); /* 101 */
     void (*tcl_DeleteCloseHandler) _ANSI_ARGS_((Tcl_Channel chan, Tcl_CloseProc * proc, ClientData clientData)); /* 102 */
-    int (*tcl_DeleteCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName)); /* 103 */
+    int (*tcl_DeleteCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName)); /* 103 */
     int (*tcl_DeleteCommandFromToken) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command command)); /* 104 */
     void (*tcl_DeleteEvents) _ANSI_ARGS_((Tcl_EventDeleteProc * proc, ClientData clientData)); /* 105 */
     void (*tcl_DeleteEventSource) _ANSI_ARGS_((Tcl_EventSetupProc * setupProc, Tcl_EventCheckProc * checkProc, ClientData clientData)); /* 106 */
@@ -1365,7 +1381,7 @@
     int (*tcl_DoOneEvent) _ANSI_ARGS_((int flags)); /* 115 */
     void (*tcl_DoWhenIdle) _ANSI_ARGS_((Tcl_IdleProc * proc, ClientData clientData)); /* 116 */
     char * (*tcl_DStringAppend) _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * str, int length)); /* 117 */
-    char * (*tcl_DStringAppendElement) _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * string)); /* 118 */
+    char * (*tcl_DStringAppendElement) _ANSI_ARGS_((Tcl_DString * dsPtr, CONST char * str)); /* 118 */
     void (*tcl_DStringEndSublist) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 119 */
     void (*tcl_DStringFree) _ANSI_ARGS_((Tcl_DString * dsPtr)); /* 120 */
     void (*tcl_DStringGetResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * dsPtr)); /* 121 */
@@ -1377,36 +1393,36 @@
     char * (*tcl_ErrnoId) _ANSI_ARGS_((void)); /* 127 */
     char * (*tcl_ErrnoMsg) _ANSI_ARGS_((int err)); /* 128 */
     int (*tcl_Eval) _ANSI_ARGS_((Tcl_Interp * interp, char * string)); /* 129 */
-    int (*tcl_EvalFile) _ANSI_ARGS_((Tcl_Interp * interp, char * fileName)); /* 130 */
+    int (*tcl_EvalFile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName)); /* 130 */
     int (*tcl_EvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 131 */
     void (*tcl_EventuallyFree) _ANSI_ARGS_((ClientData clientData, Tcl_FreeProc * freeProc)); /* 132 */
     void (*tcl_Exit) _ANSI_ARGS_((int status)); /* 133 */
-    int (*tcl_ExposeCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * hiddenCmdToken, char * cmdName)); /* 134 */
-    int (*tcl_ExprBoolean) _ANSI_ARGS_((Tcl_Interp * interp, char * str, int * ptr)); /* 135 */
+    int (*tcl_ExposeCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * hiddenCmdToken, CONST char * cmdName)); /* 134 */
+    int (*tcl_ExprBoolean) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * ptr)); /* 135 */
     int (*tcl_ExprBooleanObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * ptr)); /* 136 */
-    int (*tcl_ExprDouble) _ANSI_ARGS_((Tcl_Interp * interp, char * str, double * ptr)); /* 137 */
+    int (*tcl_ExprDouble) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, double * ptr)); /* 137 */
     int (*tcl_ExprDoubleObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * ptr)); /* 138 */
-    int (*tcl_ExprLong) _ANSI_ARGS_((Tcl_Interp * interp, char * str, long * ptr)); /* 139 */
+    int (*tcl_ExprLong) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, long * ptr)); /* 139 */
     int (*tcl_ExprLongObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * ptr)); /* 140 */
     int (*tcl_ExprObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_Obj ** resultPtrPtr)); /* 141 */
-    int (*tcl_ExprString) _ANSI_ARGS_((Tcl_Interp * interp, char * string)); /* 142 */
+    int (*tcl_ExprString) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * string)); /* 142 */
     void (*tcl_Finalize) _ANSI_ARGS_((void)); /* 143 */
     void (*tcl_FindExecutable) _ANSI_ARGS_((CONST char * argv0)); /* 144 */
     Tcl_HashEntry * (*tcl_FirstHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, Tcl_HashSearch * searchPtr)); /* 145 */
     int (*tcl_Flush) _ANSI_ARGS_((Tcl_Channel chan)); /* 146 */
     void (*tcl_FreeResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 147 */
-    int (*tcl_GetAlias) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * argcPtr, char *** argvPtr)); /* 148 */
-    int (*tcl_GetAliasObj) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * objcPtr, Tcl_Obj *** objv)); /* 149 */
-    ClientData (*tcl_GetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_InterpDeleteProc ** procPtr)); /* 150 */
-    Tcl_Channel (*tcl_GetChannel) _ANSI_ARGS_((Tcl_Interp * interp, char * chanName, int * modePtr)); /* 151 */
+    int (*tcl_GetAlias) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * argcPtr, char *** argvPtr)); /* 148 */
+    int (*tcl_GetAliasObj) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * objcPtr, Tcl_Obj *** objv)); /* 149 */
+    ClientData (*tcl_GetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc ** procPtr)); /* 150 */
+    Tcl_Channel (*tcl_GetChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * chanName, int * modePtr)); /* 151 */
     int (*tcl_GetChannelBufferSize) _ANSI_ARGS_((Tcl_Channel chan)); /* 152 */
     int (*tcl_GetChannelHandle) _ANSI_ARGS_((Tcl_Channel chan, int direction, ClientData * handlePtr)); /* 153 */
     ClientData (*tcl_GetChannelInstanceData) _ANSI_ARGS_((Tcl_Channel chan)); /* 154 */
     int (*tcl_GetChannelMode) _ANSI_ARGS_((Tcl_Channel chan)); /* 155 */
     char * (*tcl_GetChannelName) _ANSI_ARGS_((Tcl_Channel chan)); /* 156 */
-    int (*tcl_GetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, char * optionName, Tcl_DString * dsPtr)); /* 157 */
+    int (*tcl_GetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, Tcl_DString * dsPtr)); /* 157 */
     Tcl_ChannelType * (*tcl_GetChannelType) _ANSI_ARGS_((Tcl_Channel chan)); /* 158 */
-    int (*tcl_GetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName, Tcl_CmdInfo * infoPtr)); /* 159 */
+    int (*tcl_GetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdInfo * infoPtr)); /* 159 */
     char * (*tcl_GetCommandName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command command)); /* 160 */
     int (*tcl_GetErrno) _ANSI_ARGS_((void)); /* 161 */
     char * (*tcl_GetHostName) _ANSI_ARGS_((void)); /* 162 */
@@ -1415,7 +1431,7 @@
     CONST char * (*tcl_GetNameOfExecutable) _ANSI_ARGS_((void)); /* 165 */
     Tcl_Obj * (*tcl_GetObjResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 166 */
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
-    int (*tcl_GetOpenFile) _ANSI_ARGS_((Tcl_Interp * interp, char * str, int write, int checkUsage, ClientData * filePtr)); /* 167 */
+    int (*tcl_GetOpenFile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int write, int checkUsage, ClientData * filePtr)); /* 167 */
 #endif /* UNIX */
 #ifdef __WIN32__
     void *reserved167;
@@ -1423,18 +1439,18 @@
 #ifdef MAC_TCL
     void *reserved167;
 #endif /* MAC_TCL */
-    Tcl_PathType (*tcl_GetPathType) _ANSI_ARGS_((char * path)); /* 168 */
+    Tcl_PathType (*tcl_GetPathType) _ANSI_ARGS_((CONST char * path)); /* 168 */
     int (*tcl_Gets) _ANSI_ARGS_((Tcl_Channel chan, Tcl_DString * dsPtr)); /* 169 */
     int (*tcl_GetsObj) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj * objPtr)); /* 170 */
     int (*tcl_GetServiceMode) _ANSI_ARGS_((void)); /* 171 */
-    Tcl_Interp * (*tcl_GetSlave) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveName)); /* 172 */
+    Tcl_Interp * (*tcl_GetSlave) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveName)); /* 172 */
     Tcl_Channel (*tcl_GetStdChannel) _ANSI_ARGS_((int type)); /* 173 */
     char * (*tcl_GetStringResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 174 */
     char * (*tcl_GetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 175 */
     char * (*tcl_GetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 176 */
     int (*tcl_GlobalEval) _ANSI_ARGS_((Tcl_Interp * interp, char * command)); /* 177 */
     int (*tcl_GlobalEvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 178 */
-    int (*tcl_HideCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName, char * hiddenCmdToken)); /* 179 */
+    int (*tcl_HideCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, CONST char * hiddenCmdToken)); /* 179 */
     int (*tcl_Init) _ANSI_ARGS_((Tcl_Interp * interp)); /* 180 */
     void (*tcl_InitHashTable) _ANSI_ARGS_((Tcl_HashTable * tablePtr, int keyType)); /* 181 */
     int (*tcl_InputBlocked) _ANSI_ARGS_((Tcl_Channel chan)); /* 182 */
@@ -1443,7 +1459,7 @@
     int (*tcl_IsSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 185 */
     char * (*tcl_JoinPath) _ANSI_ARGS_((int argc, char ** argv, Tcl_DString * resultPtr)); /* 186 */
     int (*tcl_LinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * addr, int type)); /* 187 */
-    void *reserved188;
+    void (*tcl_MainLoop) _ANSI_ARGS_((void)); /* 188 */
     Tcl_Channel (*tcl_MakeFileChannel) _ANSI_ARGS_((ClientData handle, int mode)); /* 189 */
     int (*tcl_MakeSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 190 */
     Tcl_Channel (*tcl_MakeTcpClientChannel) _ANSI_ARGS_((ClientData tcpSocket)); /* 191 */
@@ -1461,9 +1477,9 @@
 #ifdef MAC_TCL
     void *reserved197;
 #endif /* MAC_TCL */
-    Tcl_Channel (*tcl_OpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, char * fileName, char * modeString, int permissions)); /* 198 */
-    Tcl_Channel (*tcl_OpenTcpClient) _ANSI_ARGS_((Tcl_Interp * interp, int port, char * address, char * myaddr, int myport, int async)); /* 199 */
-    Tcl_Channel (*tcl_OpenTcpServer) _ANSI_ARGS_((Tcl_Interp * interp, int port, char * host, Tcl_TcpAcceptProc * acceptProc, ClientData callbackData)); /* 200 */
+    Tcl_Channel (*tcl_OpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName, CONST char * modeString, int permissions)); /* 198 */
+    Tcl_Channel (*tcl_OpenTcpClient) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * address, CONST char * myaddr, int myport, int async)); /* 199 */
+    Tcl_Channel (*tcl_OpenTcpServer) _ANSI_ARGS_((Tcl_Interp * interp, int port, CONST char * host, Tcl_TcpAcceptProc * acceptProc, ClientData callbackData)); /* 200 */
     void (*tcl_Preserve) _ANSI_ARGS_((ClientData data)); /* 201 */
     void (*tcl_PrintDouble) _ANSI_ARGS_((Tcl_Interp * interp, double value, char * dst)); /* 202 */
     int (*tcl_PutEnv) _ANSI_ARGS_((CONST char * string)); /* 203 */
@@ -1494,10 +1510,10 @@
     int (*tcl_Seek) _ANSI_ARGS_((Tcl_Channel chan, int offset, int mode)); /* 220 */
     int (*tcl_ServiceAll) _ANSI_ARGS_((void)); /* 221 */
     int (*tcl_ServiceEvent) _ANSI_ARGS_((int flags)); /* 222 */
-    void (*tcl_SetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 223 */
+    void (*tcl_SetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 223 */
     void (*tcl_SetChannelBufferSize) _ANSI_ARGS_((Tcl_Channel chan, int sz)); /* 224 */
-    int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, char * optionName, char * newValue)); /* 225 */
-    int (*tcl_SetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * cmdName, Tcl_CmdInfo * infoPtr)); /* 226 */
+    int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue)); /* 225 */
+    int (*tcl_SetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdInfo * infoPtr)); /* 226 */
     void (*tcl_SetErrno) _ANSI_ARGS_((int err)); /* 227 */
     void (*tcl_SetErrorCode) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 228 */
     void (*tcl_SetMaxBlockTime) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 229 */
@@ -1508,20 +1524,20 @@
     void (*tcl_SetObjErrorCode) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * errorObjPtr)); /* 234 */
     void (*tcl_SetObjResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * resultObjPtr)); /* 235 */
     void (*tcl_SetStdChannel) _ANSI_ARGS_((Tcl_Channel channel, int type)); /* 236 */
-    char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * newValue, int flags)); /* 237 */
-    char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, char * newValue, int flags)); /* 238 */
+    char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, CONST char * newValue, int flags)); /* 237 */
+    char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, CONST char * newValue, int flags)); /* 238 */
     char * (*tcl_SignalId) _ANSI_ARGS_((int sig)); /* 239 */
     char * (*tcl_SignalMsg) _ANSI_ARGS_((int sig)); /* 240 */
     void (*tcl_SourceRCFile) _ANSI_ARGS_((Tcl_Interp * interp)); /* 241 */
     int (*tcl_SplitList) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, char *** argvPtr)); /* 242 */
     void (*tcl_SplitPath) _ANSI_ARGS_((CONST char * path, int * argcPtr, char *** argvPtr)); /* 243 */
-    void (*tcl_StaticPackage) _ANSI_ARGS_((Tcl_Interp * interp, char * pkgName, Tcl_PackageInitProc * initProc, Tcl_PackageInitProc * safeInitProc)); /* 244 */
+    void (*tcl_StaticPackage) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pkgName, Tcl_PackageInitProc * initProc, Tcl_PackageInitProc * safeInitProc)); /* 244 */
     int (*tcl_StringMatch) _ANSI_ARGS_((CONST char * str, CONST char * pattern)); /* 245 */
     int (*tcl_Tell) _ANSI_ARGS_((Tcl_Channel chan)); /* 246 */
     int (*tcl_TraceVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 247 */
     int (*tcl_TraceVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 248 */
-    char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_DString * bufferPtr)); /* 249 */
-    int (*tcl_Ungets) _ANSI_ARGS_((Tcl_Channel chan, char * str, int len, int atHead)); /* 250 */
+    char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_DString * bufferPtr)); /* 249 */
+    int (*tcl_Ungets) _ANSI_ARGS_((Tcl_Channel chan, CONST char * str, int len, int atHead)); /* 250 */
     void (*tcl_UnlinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName)); /* 251 */
     int (*tcl_UnregisterChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 252 */
     int (*tcl_UnsetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 253 */
@@ -1530,30 +1546,30 @@
     void (*tcl_UntraceVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 256 */
     void (*tcl_UpdateLinkedVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName)); /* 257 */
     int (*tcl_UpVar) _ANSI_ARGS_((Tcl_Interp * interp, char * frameName, char * varName, char * localName, int flags)); /* 258 */
-    int (*tcl_UpVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * frameName, char * part1, char * part2, char * localName, int flags)); /* 259 */
+    int (*tcl_UpVar2) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * frameName, char * part1, char * part2, char * localName, int flags)); /* 259 */
     int (*tcl_VarEval) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 260 */
     ClientData (*tcl_VarTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 261 */
     ClientData (*tcl_VarTraceInfo2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 262 */
-    int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, char * s, int slen)); /* 263 */
-    void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], char * message)); /* 264 */
-    int (*tcl_DumpActiveMemory) _ANSI_ARGS_((char * fileName)); /* 265 */
-    void (*tcl_ValidateAllMemory) _ANSI_ARGS_((char * file, int line)); /* 266 */
+    int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, CONST char * s, int slen)); /* 263 */
+    void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], CONST char * message)); /* 264 */
+    int (*tcl_DumpActiveMemory) _ANSI_ARGS_((CONST char * fileName)); /* 265 */
+    void (*tcl_ValidateAllMemory) _ANSI_ARGS_((CONST char * file, int line)); /* 266 */
     void (*tcl_AppendResultVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 267 */
     void (*tcl_AppendStringsToObjVA) _ANSI_ARGS_((Tcl_Obj * objPtr, va_list argList)); /* 268 */
     char * (*tcl_HashStats) _ANSI_ARGS_((Tcl_HashTable * tablePtr)); /* 269 */
     char * (*tcl_ParseVar) _ANSI_ARGS_((Tcl_Interp * interp, char * str, char ** termPtr)); /* 270 */
-    char * (*tcl_PkgPresent) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version, int exact)); /* 271 */
-    char * (*tcl_PkgPresentEx) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version, int exact, ClientData * clientDataPtr)); /* 272 */
-    int (*tcl_PkgProvide) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version)); /* 273 */
-    char * (*tcl_PkgRequire) _ANSI_ARGS_((Tcl_Interp * interp, char * name, char * version, int exact)); /* 274 */
+    char * (*tcl_PkgPresent) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact)); /* 271 */
+    char * (*tcl_PkgPresentEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact, ClientData * clientDataPtr)); /* 272 */
+    int (*tcl_PkgProvide) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version)); /* 273 */
+    char * (*tcl_PkgRequire) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact)); /* 274 */
     void (*tcl_SetErrorCodeVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 275 */
     int (*tcl_VarEvalVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 276 */
     Tcl_Pid (*tcl_WaitPid) _ANSI_ARGS_((Tcl_Pid pid, int * statPtr, int options)); /* 277 */
 #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
-    void (*tcl_PanicVA) _ANSI_ARGS_((char * format, va_list argList)); /* 278 */
+    void (*tcl_PanicVA) _ANSI_ARGS_((CONST char * format, va_list argList)); /* 278 */
 #endif /* UNIX */
 #ifdef __WIN32__
-    void (*tcl_PanicVA) _ANSI_ARGS_((char * format, va_list argList)); /* 278 */
+    void (*tcl_PanicVA) _ANSI_ARGS_((CONST char * format, va_list argList)); /* 278 */
 #endif /* __WIN32__ */
 #ifdef MAC_TCL
     void *reserved278;
@@ -1563,7 +1579,7 @@
     Tcl_Channel (*tcl_StackChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_ChannelType * typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan)); /* 281 */
     void (*tcl_UnstackChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 282 */
     Tcl_Channel (*tcl_GetStackedChannel) _ANSI_ARGS_((Tcl_Channel chan)); /* 283 */
-    void *reserved284;
+    void (*tcl_SetMainLoop) _ANSI_ARGS_((Tcl_MainLoopProc * proc)); /* 284 */
     void *reserved285;
     void (*tcl_AppendObjToObj) _ANSI_ARGS_((Tcl_Obj * objPtr, Tcl_Obj * appendObjPtr)); /* 286 */
     Tcl_Encoding (*tcl_CreateEncoding) _ANSI_ARGS_((Tcl_EncodingType * typePtr)); /* 287 */
@@ -1583,7 +1599,7 @@
     Tcl_Encoding (*tcl_GetEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 301 */
     char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */
     void (*tcl_GetEncodingNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 303 */
-    int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char ** tablePtr, int offset, char * msg, int flags, int * indexPtr)); /* 304 */
+    int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char ** tablePtr, int offset, CONST char * msg, int flags, int * indexPtr)); /* 304 */
     VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */
     Tcl_Obj * (*tcl_GetVar2Ex) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 306 */
     ClientData (*tcl_InitNotifier) _ANSI_ARGS_((void)); /* 307 */
@@ -2450,7 +2466,10 @@
 #define Tcl_LinkVar \
 	(tclStubsPtr->tcl_LinkVar) /* 187 */
 #endif
-/* Slot 188 is reserved */
+#ifndef Tcl_MainLoop
+#define Tcl_MainLoop \
+	(tclStubsPtr->tcl_MainLoop) /* 188 */
+#endif
 #ifndef Tcl_MakeFileChannel
 #define Tcl_MakeFileChannel \
 	(tclStubsPtr->tcl_MakeFileChannel) /* 189 */
@@ -2855,7 +2874,10 @@
 #define Tcl_GetStackedChannel \
 	(tclStubsPtr->tcl_GetStackedChannel) /* 283 */
 #endif
-/* Slot 284 is reserved */
+#ifndef Tcl_SetMainLoop
+#define Tcl_SetMainLoop \
+	(tclStubsPtr->tcl_SetMainLoop) /* 284 */
+#endif
 /* Slot 285 is reserved */
 #ifndef Tcl_AppendObjToObj
 #define Tcl_AppendObjToObj \
--- tcl8.2-8.2.3.orig/generic/tclInt.h
+++ tcl8.2-8.2.3/generic/tclInt.h
@@ -1229,7 +1229,7 @@
 				 * are added/removed by calling
 				 * Tcl_AddInterpResolvers and
 				 * Tcl_RemoveInterpResolver. */
-    char *scriptFile;		/* NULL means there is no nested source
+    CONST char *scriptFile;	/* NULL means there is no nested source
 				 * command active;  otherwise this points to
 				 * the name of the file being sourced (it's
 				 * not malloc-ed:  it points to an argument
@@ -1466,7 +1466,7 @@
 typedef int (TclStatProc_) _ANSI_ARGS_((CONST char *path, struct stat *buf));
 typedef int (TclAccessProc_) _ANSI_ARGS_((CONST char *path, int mode));
 typedef Tcl_Channel (TclOpenFileChannelProc_) _ANSI_ARGS_((Tcl_Interp *interp,
-	char *fileName, char *modeString,
+	CONST char *fileName, CONST char *modeString,
 	int permissions));
 
 typedef int (*TclCmdProcType) _ANSI_ARGS_((ClientData clientData,
@@ -1480,6 +1480,24 @@
 
 typedef struct TclpTime_t_ *TclpTime_t;
 
+/* 
+ * The following structure is used to pass glob type data amongst
+ * the various glob routines and TclpMatchFilesTypes.  Currently
+ * most of the fields are ignored.  However they will be used in
+ * a future release to implement glob's ability to find files
+ * of particular types/permissions/etc only.
+ */
+typedef struct GlobTypeData {
+    /* Corresponds to bcdpfls as in 'find -t' */
+    int type;
+    /* Corresponds to file permissions */
+    int perm;
+    /* List of mac types */
+    Tcl_Obj* macTypes;
+    /* List of win types */
+    Tcl_Obj* winTypes;
+} GlobTypeData;
+
 /*
  *----------------------------------------------------------------
  * Variables shared among Tcl modules but not used by the outside world.
@@ -1555,11 +1573,11 @@
  * TclCreatePipeline unofficially exported for use by BLT.
  */
 EXTERN int		TclCreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
-			    int argc, char **argv, Tcl_Pid **pidArrayPtr,
-			    TclFile *inPipePtr, TclFile *outPipePtr,
-			    TclFile *errFilePtr));
+			    int argc, char *argv[],
+			    Tcl_Pid **pidArrayPtr, TclFile *inPipePtr,
+			    TclFile *outPipePtr, TclFile *errFilePtr));
 EXTERN int		TclCreateProc _ANSI_ARGS_((Tcl_Interp *interp,
-			    Namespace *nsPtr, char *procName,
+			    Namespace *nsPtr, CONST char *procName,
 			    Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr,
 			    Proc **procPtrPtr));
 EXTERN void		TclDeleteCompiledLocalVars _ANSI_ARGS_((
@@ -1568,7 +1586,7 @@
 			    Tcl_HashTable *tablePtr));
 EXTERN int		TclDoGlob _ANSI_ARGS_((Tcl_Interp *interp,
 			    char *separators, Tcl_DString *headPtr,
-			    char *tail));
+			    char *tail, GlobTypeData *types));
 EXTERN void		TclDumpMemoryInfo _ANSI_ARGS_((FILE *outFile));
 EXTERN void		TclExpandTokenArray _ANSI_ARGS_((
 			    Tcl_Parse *parsePtr));
@@ -1610,34 +1628,35 @@
 EXTERN Tcl_Obj *	TclGetElementOfIndexedArray _ANSI_ARGS_((
 			    Tcl_Interp *interp, int localIndex,
 			    Tcl_Obj *elemPtr, int leaveErrorMsg));
-EXTERN char *		TclGetExtension _ANSI_ARGS_((char *name));
+EXTERN CONST char *	TclGetExtension _ANSI_ARGS_((CONST char *name));
 EXTERN int		TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *string, CallFrame **framePtrPtr));
+			    CONST char *string, CallFrame **framePtrPtr));
 EXTERN TclCmdProcType	TclGetInterpProc _ANSI_ARGS_((void));
 EXTERN int		TclGetIntForIndex _ANSI_ARGS_((Tcl_Interp *interp,
 			    Tcl_Obj *objPtr, int endValue, int *indexPtr));
 EXTERN Tcl_Obj *	TclGetIndexedScalar _ANSI_ARGS_((Tcl_Interp *interp,
 			    int localIndex, int leaveErrorMsg));
 EXTERN int		TclGetLong _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *string, long *longPtr));
+			    CONST char *string, long *longPtr));
 EXTERN int		TclGetLoadedPackages _ANSI_ARGS_((
-			    Tcl_Interp *interp, char *targetName));
+			    Tcl_Interp *interp, CONST char *targetName));
 EXTERN int		TclGetNamespaceForQualName _ANSI_ARGS_((
-			    Tcl_Interp *interp, char *qualName,
+			    Tcl_Interp *interp, CONST char *qualName,
 			    Namespace *cxtNsPtr, int flags,
 			    Namespace **nsPtrPtr, Namespace **altNsPtrPtr,
 			    Namespace **actualCxtPtrPtr,
-			    char **simpleNamePtr));
+			    CONST char **simpleNamePtr));
 EXTERN TclObjCmdProcType TclGetObjInterpProc _ANSI_ARGS_((void));
 EXTERN int		TclGetOpenMode _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *string, int *seekFlagPtr));
+			    CONST char *string, int *seekFlagPtr));
 EXTERN Tcl_Command	TclGetOriginalCommand _ANSI_ARGS_((
 			    Tcl_Command command));
 EXTERN int		TclGlob _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *pattern, int noComplain));
+			    char *pattern, char *unquotedPrefix, 
+				int globFlags, GlobTypeData* types));
 EXTERN int		TclGlobalInvoke _ANSI_ARGS_((Tcl_Interp *interp,
 			    int argc, char **argv, int flags));
-EXTERN int		TclGuessPackageName _ANSI_ARGS_((char *fileName,
+EXTERN int		TclGuessPackageName _ANSI_ARGS_((CONST char *fileName,
 			    Tcl_DString *bufPtr));
 EXTERN int		TclHideUnsafeCommands _ANSI_ARGS_((
 			    Tcl_Interp *interp));
@@ -1674,7 +1693,7 @@
 			    int len));
 EXTERN Proc *		TclIsProc _ANSI_ARGS_((Command *cmdPtr));
 EXTERN Var *		TclLookupVar _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *part1, char *part2, int flags, char *msg,
+			    char *part1, char *part2, int flags, CONST char *msg,
 			    int createPart1, int createPart2,
 			    Var **arrayPtrPtr));
 EXTERN int		TclMathInProgress _ANSI_ARGS_((void));
@@ -1734,7 +1753,7 @@
 			    char *separators, Tcl_DString *dirPtr,
 			    char *pattern, char *tail));
 EXTERN Tcl_Channel	TclpOpenFileChannel _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *fileName, char *modeString,
+			    CONST char *fileName, CONST char *modeString,
 			    int permissions));
 EXTERN char *		TclpReadlink _ANSI_ARGS_((CONST char *fileName,
 			    Tcl_DString *linkPtr));
@@ -1777,7 +1796,7 @@
 EXTERN void		TclRememberDataKey _ANSI_ARGS_((Tcl_ThreadDataKey *mutex));
 EXTERN void		TclRememberMutex _ANSI_ARGS_((Tcl_Mutex *mutex));
 EXTERN int		TclRenameCommand _ANSI_ARGS_((Tcl_Interp *interp,
-			    char *oldName, char *newName)) ;
+			    CONST char *oldName, CONST char *newName)) ;
 EXTERN void		TclResetShadowedCmdRefs _ANSI_ARGS_((
 			    Tcl_Interp *interp, Command *newCmdPtr));
 EXTERN int		TclServiceIdle _ANSI_ARGS_((void));
@@ -2122,7 +2141,7 @@
  * this macro is:
  *
  * EXTERN void	TclInitStringRep _ANSI_ARGS_((Tcl_Obj *objPtr,
- *		    char *bytePtr, int len));
+ *		    CONST char *bytePtr, int len));
  *----------------------------------------------------------------
  */
 
--- tcl8.2-8.2.3.orig/generic/tclIntDecls.h
+++ tcl8.2-8.2.3/generic/tclIntDecls.h
@@ -77,7 +77,7 @@
 #endif /* __WIN32__ */
 /* 10 */
 EXTERN int		TclCreateProc _ANSI_ARGS_((Tcl_Interp * interp, 
-				Namespace * nsPtr, char * procName, 
+				Namespace * nsPtr, CONST char * procName, 
 				Tcl_Obj * argsPtr, Tcl_Obj * bodyPtr, 
 				Proc ** procPtrPtr));
 /* 11 */
@@ -89,7 +89,7 @@
 /* 13 */
 EXTERN int		TclDoGlob _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * separators, Tcl_DString * headPtr, 
-				char * tail));
+				char * tail, GlobTypeData * types));
 /* 14 */
 EXTERN void		TclDumpMemoryInfo _ANSI_ARGS_((FILE * outFile));
 /* Slot 15 is reserved */
@@ -136,10 +136,10 @@
 				Tcl_Obj * elemPtr, int leaveErrorMsg));
 /* Slot 30 is reserved */
 /* 31 */
-EXTERN char *		TclGetExtension _ANSI_ARGS_((char * name));
+EXTERN CONST char *	TclGetExtension _ANSI_ARGS_((CONST char * name));
 /* 32 */
 EXTERN int		TclGetFrame _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, CallFrame ** framePtrPtr));
+				CONST char * str, CallFrame ** framePtrPtr));
 /* 33 */
 EXTERN TclCmdProcType	TclGetInterpProc _ANSI_ARGS_((void));
 /* 34 */
@@ -151,23 +151,23 @@
 				int localIndex, int leaveErrorMsg));
 /* 36 */
 EXTERN int		TclGetLong _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, long * longPtr));
+				CONST char * str, long * longPtr));
 /* 37 */
 EXTERN int		TclGetLoadedPackages _ANSI_ARGS_((
-				Tcl_Interp * interp, char * targetName));
+				Tcl_Interp * interp, CONST char * targetName));
 /* 38 */
 EXTERN int		TclGetNamespaceForQualName _ANSI_ARGS_((
-				Tcl_Interp * interp, char * qualName, 
+				Tcl_Interp * interp, CONST char * qualName, 
 				Namespace * cxtNsPtr, int flags, 
 				Namespace ** nsPtrPtr, 
 				Namespace ** altNsPtrPtr, 
 				Namespace ** actualCxtPtrPtr, 
-				char ** simpleNamePtr));
+				CONST char ** simpleNamePtr));
 /* 39 */
 EXTERN TclObjCmdProcType TclGetObjInterpProc _ANSI_ARGS_((void));
 /* 40 */
 EXTERN int		TclGetOpenMode _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * str, int * seekFlagPtr));
+				CONST char * str, int * seekFlagPtr));
 /* 41 */
 EXTERN Tcl_Command	TclGetOriginalCommand _ANSI_ARGS_((
 				Tcl_Command command));
@@ -178,8 +178,8 @@
 EXTERN int		TclGlobalInvoke _ANSI_ARGS_((Tcl_Interp * interp, 
 				int argc, char ** argv, int flags));
 /* 44 */
-EXTERN int		TclGuessPackageName _ANSI_ARGS_((char * fileName, 
-				Tcl_DString * bufPtr));
+EXTERN int		TclGuessPackageName _ANSI_ARGS_((
+				CONST char * fileName, Tcl_DString * bufPtr));
 /* 45 */
 EXTERN int		TclHideUnsafeCommands _ANSI_ARGS_((
 				Tcl_Interp * interp));
@@ -221,8 +221,8 @@
 /* 58 */
 EXTERN Var *		TclLookupVar _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * part1, char * part2, int flags, 
-				char * msg, int createPart1, int createPart2, 
-				Var ** arrayPtrPtr));
+				CONST char * msg, int createPart1, 
+				int createPart2, Var ** arrayPtrPtr));
 /* 59 */
 EXTERN int		TclpMatchFiles _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * separators, Tcl_DString * dirPtr, 
@@ -277,8 +277,8 @@
 EXTERN int		TclpListVolumes _ANSI_ARGS_((Tcl_Interp * interp));
 /* 80 */
 EXTERN Tcl_Channel	TclpOpenFileChannel _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * fileName, char * modeString, 
-				int permissions));
+				CONST char * fileName, 
+				CONST char * modeString, int permissions));
 /* 81 */
 EXTERN char *		TclpRealloc _ANSI_ARGS_((char * ptr, 
 				unsigned int size));
@@ -317,7 +317,7 @@
 				struct stat * buf));
 /* 96 */
 EXTERN int		TclRenameCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * oldName, char * newName));
+				CONST char * oldName, CONST char * newName));
 /* 97 */
 EXTERN void		TclResetShadowedCmdRefs _ANSI_ARGS_((
 				Tcl_Interp * interp, Command * newCmdPtr));
@@ -369,7 +369,7 @@
 /* Slot 110 is reserved */
 /* 111 */
 EXTERN void		Tcl_AddInterpResolvers _ANSI_ARGS_((
-				Tcl_Interp * interp, char * name, 
+				Tcl_Interp * interp, CONST char * name, 
 				Tcl_ResolveCmdProc * cmdProc, 
 				Tcl_ResolveVarProc * varProc, 
 				Tcl_ResolveCompiledVarProc * compiledVarProc));
@@ -379,26 +379,26 @@
 				Tcl_Obj * objPtr));
 /* 113 */
 EXTERN Tcl_Namespace *	Tcl_CreateNamespace _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, ClientData clientData, 
+				CONST char * name, ClientData clientData, 
 				Tcl_NamespaceDeleteProc * deleteProc));
 /* 114 */
 EXTERN void		Tcl_DeleteNamespace _ANSI_ARGS_((
 				Tcl_Namespace * nsPtr));
 /* 115 */
 EXTERN int		Tcl_Export _ANSI_ARGS_((Tcl_Interp * interp, 
-				Tcl_Namespace * nsPtr, char * pattern, 
+				Tcl_Namespace * nsPtr, CONST char * pattern, 
 				int resetListFirst));
 /* 116 */
 EXTERN Tcl_Command	Tcl_FindCommand _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, Tcl_Namespace * contextNsPtr, 
-				int flags));
+				CONST char * name, 
+				Tcl_Namespace * contextNsPtr, int flags));
 /* 117 */
 EXTERN Tcl_Namespace *	Tcl_FindNamespace _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * name, Tcl_Namespace * contextNsPtr, 
-				int flags));
+				CONST char * name, 
+				Tcl_Namespace * contextNsPtr, int flags));
 /* 118 */
 EXTERN int		Tcl_GetInterpResolvers _ANSI_ARGS_((
-				Tcl_Interp * interp, char * name, 
+				Tcl_Interp * interp, CONST char * name, 
 				Tcl_ResolverInfo * resInfo));
 /* 119 */
 EXTERN int		Tcl_GetNamespaceResolvers _ANSI_ARGS_((
@@ -410,7 +410,7 @@
 				Tcl_Namespace * contextNsPtr, int flags));
 /* 121 */
 EXTERN int		Tcl_ForgetImport _ANSI_ARGS_((Tcl_Interp * interp, 
-				Tcl_Namespace * nsPtr, char * pattern));
+				Tcl_Namespace * nsPtr, CONST char * pattern));
 /* 122 */
 EXTERN Tcl_Command	Tcl_GetCommandFromObj _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * objPtr));
@@ -430,7 +430,7 @@
 				Tcl_Obj * objPtr));
 /* 127 */
 EXTERN int		Tcl_Import _ANSI_ARGS_((Tcl_Interp * interp, 
-				Tcl_Namespace * nsPtr, char * pattern, 
+				Tcl_Namespace * nsPtr, CONST char * pattern, 
 				int allowOverwrite));
 /* 128 */
 EXTERN void		Tcl_PopCallFrame _ANSI_ARGS_((Tcl_Interp* interp));
@@ -440,7 +440,7 @@
 				Tcl_Namespace * nsPtr, int isProcCallFrame));
 /* 130 */
 EXTERN int		Tcl_RemoveInterpResolvers _ANSI_ARGS_((
-				Tcl_Interp * interp, char * name));
+				Tcl_Interp * interp, CONST char * name));
 /* 131 */
 EXTERN void		Tcl_SetNamespaceResolvers _ANSI_ARGS_((
 				Tcl_Namespace * namespacePtr, 
@@ -464,12 +464,12 @@
 				Tcl_DString * valuePtr));
 /* 139 */
 EXTERN int		TclpLoadFile _ANSI_ARGS_((Tcl_Interp * interp, 
-				char * fileName, char * sym1, char * sym2, 
-				Tcl_PackageInitProc ** proc1Ptr, 
+				CONST char * fileName, char * sym1, 
+				char * sym2, Tcl_PackageInitProc ** proc1Ptr, 
 				Tcl_PackageInitProc ** proc2Ptr, 
 				ClientData * clientDataPtr));
 /* 140 */
-EXTERN int		TclLooksLikeInt _ANSI_ARGS_((char * bytes, 
+EXTERN int		TclLooksLikeInt _ANSI_ARGS_((CONST char * bytes, 
 				int length));
 /* 141 */
 EXTERN char *		TclpGetCwd _ANSI_ARGS_((Tcl_Interp * interp, 
@@ -519,6 +519,11 @@
 /* 157 */
 EXTERN Var *		TclVarTraceExists _ANSI_ARGS_((Tcl_Interp * interp, 
 				char * varName));
+/* 158 */
+EXTERN int		TclpMatchFilesTypes _ANSI_ARGS_((Tcl_Interp * interp, 
+				char * separators, Tcl_DString * dirPtr, 
+				char * pattern, char * tail, 
+				GlobTypeData * types));
 
 typedef struct TclIntStubs {
     int magic;
@@ -550,10 +555,10 @@
 #ifdef MAC_TCL
     void *reserved9;
 #endif /* MAC_TCL */
-    int (*tclCreateProc) _ANSI_ARGS_((Tcl_Interp * interp, Namespace * nsPtr, char * procName, Tcl_Obj * argsPtr, Tcl_Obj * bodyPtr, Proc ** procPtrPtr)); /* 10 */
+    int (*tclCreateProc) _ANSI_ARGS_((Tcl_Interp * interp, Namespace * nsPtr, CONST char * procName, Tcl_Obj * argsPtr, Tcl_Obj * bodyPtr, Proc ** procPtrPtr)); /* 10 */
     void (*tclDeleteCompiledLocalVars) _ANSI_ARGS_((Interp * iPtr, CallFrame * framePtr)); /* 11 */
     void (*tclDeleteVars) _ANSI_ARGS_((Interp * iPtr, Tcl_HashTable * tablePtr)); /* 12 */
-    int (*tclDoGlob) _ANSI_ARGS_((Tcl_Interp * interp, char * separators, Tcl_DString * headPtr, char * tail)); /* 13 */
+    int (*tclDoGlob) _ANSI_ARGS_((Tcl_Interp * interp, char * separators, Tcl_DString * headPtr, char * tail, GlobTypeData * types)); /* 13 */
     void (*tclDumpMemoryInfo) _ANSI_ARGS_((FILE * outFile)); /* 14 */
     void *reserved15;
     void (*tclExprFloatError) _ANSI_ARGS_((Tcl_Interp * interp, double value)); /* 16 */
@@ -571,20 +576,20 @@
     Tcl_Channel (*tclpGetDefaultStdChannel) _ANSI_ARGS_((int type)); /* 28 */
     Tcl_Obj * (*tclGetElementOfIndexedArray) _ANSI_ARGS_((Tcl_Interp * interp, int localIndex, Tcl_Obj * elemPtr, int leaveErrorMsg)); /* 29 */
     void *reserved30;
-    char * (*tclGetExtension) _ANSI_ARGS_((char * name)); /* 31 */
-    int (*tclGetFrame) _ANSI_ARGS_((Tcl_Interp * interp, char * str, CallFrame ** framePtrPtr)); /* 32 */
+    CONST char * (*tclGetExtension) _ANSI_ARGS_((CONST char * name)); /* 31 */
+    int (*tclGetFrame) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, CallFrame ** framePtrPtr)); /* 32 */
     TclCmdProcType (*tclGetInterpProc) _ANSI_ARGS_((void)); /* 33 */
     int (*tclGetIntForIndex) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int endValue, int * indexPtr)); /* 34 */
     Tcl_Obj * (*tclGetIndexedScalar) _ANSI_ARGS_((Tcl_Interp * interp, int localIndex, int leaveErrorMsg)); /* 35 */
-    int (*tclGetLong) _ANSI_ARGS_((Tcl_Interp * interp, char * str, long * longPtr)); /* 36 */
-    int (*tclGetLoadedPackages) _ANSI_ARGS_((Tcl_Interp * interp, char * targetName)); /* 37 */
-    int (*tclGetNamespaceForQualName) _ANSI_ARGS_((Tcl_Interp * interp, char * qualName, Namespace * cxtNsPtr, int flags, Namespace ** nsPtrPtr, Namespace ** altNsPtrPtr, Namespace ** actualCxtPtrPtr, char ** simpleNamePtr)); /* 38 */
+    int (*tclGetLong) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, long * longPtr)); /* 36 */
+    int (*tclGetLoadedPackages) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * targetName)); /* 37 */
+    int (*tclGetNamespaceForQualName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * qualName, Namespace * cxtNsPtr, int flags, Namespace ** nsPtrPtr, Namespace ** altNsPtrPtr, Namespace ** actualCxtPtrPtr, CONST char ** simpleNamePtr)); /* 38 */
     TclObjCmdProcType (*tclGetObjInterpProc) _ANSI_ARGS_((void)); /* 39 */
-    int (*tclGetOpenMode) _ANSI_ARGS_((Tcl_Interp * interp, char * str, int * seekFlagPtr)); /* 40 */
+    int (*tclGetOpenMode) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * seekFlagPtr)); /* 40 */
     Tcl_Command (*tclGetOriginalCommand) _ANSI_ARGS_((Tcl_Command command)); /* 41 */
     char * (*tclpGetUserHome) _ANSI_ARGS_((CONST char * name, Tcl_DString * bufferPtr)); /* 42 */
     int (*tclGlobalInvoke) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, int flags)); /* 43 */
-    int (*tclGuessPackageName) _ANSI_ARGS_((char * fileName, Tcl_DString * bufPtr)); /* 44 */
+    int (*tclGuessPackageName) _ANSI_ARGS_((CONST char * fileName, Tcl_DString * bufPtr)); /* 44 */
     int (*tclHideUnsafeCommands) _ANSI_ARGS_((Tcl_Interp * interp)); /* 45 */
     int (*tclInExit) _ANSI_ARGS_((void)); /* 46 */
     Tcl_Obj * (*tclIncrElementOfIndexedArray) _ANSI_ARGS_((Tcl_Interp * interp, int localIndex, Tcl_Obj * elemPtr, long incrAmount)); /* 47 */
@@ -598,7 +603,7 @@
     Proc * (*tclIsProc) _ANSI_ARGS_((Command * cmdPtr)); /* 55 */
     void *reserved56;
     void *reserved57;
-    Var * (*tclLookupVar) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, char * msg, int createPart1, int createPart2, Var ** arrayPtrPtr)); /* 58 */
+    Var * (*tclLookupVar) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, CONST char * msg, int createPart1, int createPart2, Var ** arrayPtrPtr)); /* 58 */
     int (*tclpMatchFiles) _ANSI_ARGS_((Tcl_Interp * interp, char * separators, Tcl_DString * dirPtr, char * pattern, char * tail)); /* 59 */
     int (*tclNeedSpace) _ANSI_ARGS_((char * start, char * end)); /* 60 */
     Tcl_Obj * (*tclNewProcBodyObj) _ANSI_ARGS_((Proc * procPtr)); /* 61 */
@@ -620,7 +625,7 @@
     void (*tclpGetTime) _ANSI_ARGS_((Tcl_Time * time)); /* 77 */
     int (*tclpGetTimeZone) _ANSI_ARGS_((unsigned long time)); /* 78 */
     int (*tclpListVolumes) _ANSI_ARGS_((Tcl_Interp * interp)); /* 79 */
-    Tcl_Channel (*tclpOpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, char * fileName, char * modeString, int permissions)); /* 80 */
+    Tcl_Channel (*tclpOpenFileChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName, CONST char * modeString, int permissions)); /* 80 */
     char * (*tclpRealloc) _ANSI_ARGS_((char * ptr, unsigned int size)); /* 81 */
     int (*tclpRemoveDirectory) _ANSI_ARGS_((CONST char * path, int recursive, Tcl_DString * errorPtr)); /* 82 */
     int (*tclpRenameFile) _ANSI_ARGS_((CONST char * source, CONST char * dest)); /* 83 */
@@ -636,7 +641,7 @@
     void (*tclProcDeleteProc) _ANSI_ARGS_((ClientData clientData)); /* 93 */
     int (*tclProcInterpProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, int argc, char ** argv)); /* 94 */
     int (*tclpStat) _ANSI_ARGS_((CONST char * path, struct stat * buf)); /* 95 */
-    int (*tclRenameCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * oldName, char * newName)); /* 96 */
+    int (*tclRenameCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * oldName, CONST char * newName)); /* 96 */
     void (*tclResetShadowedCmdRefs) _ANSI_ARGS_((Tcl_Interp * interp, Command * newCmdPtr)); /* 97 */
     int (*tclServiceIdle) _ANSI_ARGS_((void)); /* 98 */
     Tcl_Obj * (*tclSetElementOfIndexedArray) _ANSI_ARGS_((Tcl_Interp * interp, int localIndex, Tcl_Obj * elemPtr, Tcl_Obj * objPtr, int leaveErrorMsg)); /* 99 */
@@ -667,26 +672,26 @@
     void (*tclTeardownNamespace) _ANSI_ARGS_((Namespace * nsPtr)); /* 108 */
     int (*tclUpdateReturnInfo) _ANSI_ARGS_((Interp * iPtr)); /* 109 */
     void *reserved110;
-    void (*tcl_AddInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_ResolveCmdProc * cmdProc, Tcl_ResolveVarProc * varProc, Tcl_ResolveCompiledVarProc * compiledVarProc)); /* 111 */
+    void (*tcl_AddInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_ResolveCmdProc * cmdProc, Tcl_ResolveVarProc * varProc, Tcl_ResolveCompiledVarProc * compiledVarProc)); /* 111 */
     int (*tcl_AppendExportList) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, Tcl_Obj * objPtr)); /* 112 */
-    Tcl_Namespace * (*tcl_CreateNamespace) _ANSI_ARGS_((Tcl_Interp * interp, char * name, ClientData clientData, Tcl_NamespaceDeleteProc * deleteProc)); /* 113 */
+    Tcl_Namespace * (*tcl_CreateNamespace) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, ClientData clientData, Tcl_NamespaceDeleteProc * deleteProc)); /* 113 */
     void (*tcl_DeleteNamespace) _ANSI_ARGS_((Tcl_Namespace * nsPtr)); /* 114 */
-    int (*tcl_Export) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, char * pattern, int resetListFirst)); /* 115 */
-    Tcl_Command (*tcl_FindCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_Namespace * contextNsPtr, int flags)); /* 116 */
-    Tcl_Namespace * (*tcl_FindNamespace) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_Namespace * contextNsPtr, int flags)); /* 117 */
-    int (*tcl_GetInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_ResolverInfo * resInfo)); /* 118 */
+    int (*tcl_Export) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, CONST char * pattern, int resetListFirst)); /* 115 */
+    Tcl_Command (*tcl_FindCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_Namespace * contextNsPtr, int flags)); /* 116 */
+    Tcl_Namespace * (*tcl_FindNamespace) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_Namespace * contextNsPtr, int flags)); /* 117 */
+    int (*tcl_GetInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_ResolverInfo * resInfo)); /* 118 */
     int (*tcl_GetNamespaceResolvers) _ANSI_ARGS_((Tcl_Namespace * namespacePtr, Tcl_ResolverInfo * resInfo)); /* 119 */
     Tcl_Var (*tcl_FindNamespaceVar) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_Namespace * contextNsPtr, int flags)); /* 120 */
-    int (*tcl_ForgetImport) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, char * pattern)); /* 121 */
+    int (*tcl_ForgetImport) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, CONST char * pattern)); /* 121 */
     Tcl_Command (*tcl_GetCommandFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 122 */
     void (*tcl_GetCommandFullName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command command, Tcl_Obj * objPtr)); /* 123 */
     Tcl_Namespace * (*tcl_GetCurrentNamespace) _ANSI_ARGS_((Tcl_Interp * interp)); /* 124 */
     Tcl_Namespace * (*tcl_GetGlobalNamespace) _ANSI_ARGS_((Tcl_Interp * interp)); /* 125 */
     void (*tcl_GetVariableFullName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Var variable, Tcl_Obj * objPtr)); /* 126 */
-    int (*tcl_Import) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, char * pattern, int allowOverwrite)); /* 127 */
+    int (*tcl_Import) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Namespace * nsPtr, CONST char * pattern, int allowOverwrite)); /* 127 */
     void (*tcl_PopCallFrame) _ANSI_ARGS_((Tcl_Interp* interp)); /* 128 */
     int (*tcl_PushCallFrame) _ANSI_ARGS_((Tcl_Interp* interp, Tcl_CallFrame * framePtr, Tcl_Namespace * nsPtr, int isProcCallFrame)); /* 129 */
-    int (*tcl_RemoveInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, char * name)); /* 130 */
+    int (*tcl_RemoveInterpResolvers) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 130 */
     void (*tcl_SetNamespaceResolvers) _ANSI_ARGS_((Tcl_Namespace * namespacePtr, Tcl_ResolveCmdProc * cmdProc, Tcl_ResolveVarProc * varProc, Tcl_ResolveCompiledVarProc * compiledVarProc)); /* 131 */
     int (*tclpHasSockets) _ANSI_ARGS_((Tcl_Interp * interp)); /* 132 */
     struct tm * (*tclpGetDate) _ANSI_ARGS_((TclpTime_t time, int useGMT)); /* 133 */
@@ -695,8 +700,8 @@
     void *reserved136;
     int (*tclpChdir) _ANSI_ARGS_((CONST char * dirName)); /* 137 */
     char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */
-    int (*tclpLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, char * fileName, char * sym1, char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, ClientData * clientDataPtr)); /* 139 */
-    int (*tclLooksLikeInt) _ANSI_ARGS_((char * bytes, int length)); /* 140 */
+    int (*tclpLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * fileName, char * sym1, char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, ClientData * clientDataPtr)); /* 139 */
+    int (*tclLooksLikeInt) _ANSI_ARGS_((CONST char * bytes, int length)); /* 140 */
     char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */
     int (*tclSetByteCodeFromAny) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CompileHookProc * hookProc, ClientData clientData)); /* 142 */
     int (*tclAddLiteralObj) _ANSI_ARGS_((struct CompileEnv * envPtr, Tcl_Obj * objPtr, LiteralEntry ** litPtrPtr)); /* 143 */
@@ -714,6 +719,7 @@
     int (*tclTestChannelEventCmd) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, int argc, char ** argv)); /* 155 */
     void (*tclRegError) _ANSI_ARGS_((Tcl_Interp * interp, char * msg, int status)); /* 156 */
     Var * (*tclVarTraceExists) _ANSI_ARGS_((Tcl_Interp * interp, char * varName)); /* 157 */
+    int (*tclpMatchFilesTypes) _ANSI_ARGS_((Tcl_Interp * interp, char * separators, Tcl_DString * dirPtr, char * pattern, char * tail, GlobTypeData * types)); /* 158 */
 } TclIntStubs;
 
 #ifdef __cplusplus
@@ -1354,6 +1360,10 @@
 #ifndef TclVarTraceExists
 #define TclVarTraceExists \
 	(tclIntStubsPtr->tclVarTraceExists) /* 157 */
+#endif
+#ifndef TclpMatchFilesTypes
+#define TclpMatchFilesTypes \
+	(tclIntStubsPtr->tclpMatchFilesTypes) /* 158 */
 #endif
 
 #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
--- tcl8.2-8.2.3.orig/generic/tclPlatDecls.h
+++ tcl8.2-8.2.3/generic/tclPlatDecls.h
@@ -18,6 +18,11 @@
  * Exported function declarations:
  */
 
+#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+/* 0 */
+EXTERN void		TclpGetStartupLocaleEncoding _ANSI_ARGS_((
+				Tcl_Obj ** encodingPtr, Tcl_Obj ** localePtr));
+#endif /* UNIX */
 #ifdef __WIN32__
 /* 0 */
 EXTERN TCHAR *		Tcl_WinUtfToTChar _ANSI_ARGS_((CONST char * str, 
@@ -63,6 +68,9 @@
     int magic;
     struct TclPlatStubHooks *hooks;
 
+#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+    void (*tclpGetStartupLocaleEncoding) _ANSI_ARGS_((Tcl_Obj ** encodingPtr, Tcl_Obj ** localePtr)); /* 0 */
+#endif /* UNIX */
 #ifdef __WIN32__
     TCHAR * (*tcl_WinUtfToTChar) _ANSI_ARGS_((CONST char * str, int len, Tcl_DString * dsPtr)); /* 0 */
     char * (*tcl_WinTCharToUtf) _ANSI_ARGS_((CONST TCHAR * str, int len, Tcl_DString * dsPtr)); /* 1 */
@@ -94,6 +102,12 @@
  * Inline function declarations:
  */
 
+#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */
+#ifndef TclpGetStartupLocaleEncoding
+#define TclpGetStartupLocaleEncoding \
+	(tclPlatStubsPtr->tclpGetStartupLocaleEncoding) /* 0 */
+#endif
+#endif /* UNIX */
 #ifdef __WIN32__
 #ifndef Tcl_WinUtfToTChar
 #define Tcl_WinUtfToTChar \
--- tcl8.2-8.2.3.orig/generic/tcl.decls
+++ tcl8.2-8.2.3/generic/tcl.decls
@@ -27,15 +27,15 @@
 # to preserve backwards compatibility.
 
 declare 0 generic {
-    int Tcl_PkgProvideEx(Tcl_Interp *interp, char *name, char *version, \
+    int Tcl_PkgProvideEx(Tcl_Interp *interp, CONST char *name, CONST char *version, \
 	    ClientData clientData)
 }
 declare 1 generic {
-    char * Tcl_PkgRequireEx(Tcl_Interp *interp, char *name, char *version, \
+    char * Tcl_PkgRequireEx(Tcl_Interp *interp, CONST char *name, CONST char *version, \
 	    int exact, ClientData *clientDataPtr)
 }
 declare 2 generic {
-    void Tcl_Panic(char *format, ...)
+    void Tcl_Panic(CONST char *format, ...)
 }
 declare 3 generic {
     char * Tcl_Alloc(unsigned int size)
@@ -47,13 +47,13 @@
     char * Tcl_Realloc(char *ptr, unsigned int size)
 }
 declare 6 generic {
-    char * Tcl_DbCkalloc(unsigned int size, char *file, int line)
+    char * Tcl_DbCkalloc(unsigned int size, CONST char *file, int line)
 }
 declare 7 generic {
-    int Tcl_DbCkfree(char *ptr, char *file, int line)
+    int Tcl_DbCkfree(char *ptr, CONST char *file, int line)
 }
 declare 8 generic {
-    char * Tcl_DbCkrealloc(char *ptr, unsigned int size, char *file, int line)
+    char * Tcl_DbCkrealloc(char *ptr, unsigned int size, CONST char *file, int line)
 }
 
 # Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix,
@@ -94,37 +94,37 @@
 	    Tcl_ObjType *typePtr)
 }
 declare 19 generic {
-    void Tcl_DbDecrRefCount(Tcl_Obj *objPtr, char *file, int line)
+    void Tcl_DbDecrRefCount(Tcl_Obj *objPtr, CONST char *file, int line)
 }
 declare 20 generic {
-    void Tcl_DbIncrRefCount(Tcl_Obj *objPtr, char *file, int line)
+    void Tcl_DbIncrRefCount(Tcl_Obj *objPtr, CONST char *file, int line)
 }
 declare 21 generic {
-    int Tcl_DbIsShared(Tcl_Obj *objPtr, char *file, int line)
+    int Tcl_DbIsShared(Tcl_Obj *objPtr, CONST char *file, int line)
 }
 declare 22 generic {
-    Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, char *file, int line)
+    Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, CONST char *file, int line)
 }
 declare 23 generic {
-    Tcl_Obj * Tcl_DbNewByteArrayObj(unsigned char *bytes, int length, \
-	    char *file, int line)
+    Tcl_Obj * Tcl_DbNewByteArrayObj(CONST unsigned char *bytes, int length, \
+	    CONST char *file, int line)
 }
 declare 24 generic {
-    Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue, char *file, int line)
+    Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue, CONST char *file, int line)
 }
 declare 25 generic {
-    Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *CONST objv[], char *file, \
+    Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *CONST objv[], CONST char *file, \
 	    int line)
 }
 declare 26 generic {
-    Tcl_Obj * Tcl_DbNewLongObj(long longValue, char *file, int line)
+    Tcl_Obj * Tcl_DbNewLongObj(long longValue, CONST char *file, int line)
 }
 declare 27 generic {
-    Tcl_Obj * Tcl_DbNewObj(char *file, int line)
+    Tcl_Obj * Tcl_DbNewObj(CONST char *file, int line)
 }
 declare 28 generic {
     Tcl_Obj * Tcl_DbNewStringObj(CONST char *bytes, int length, \
-	    char *file, int line)
+	    CONST char *file, int line)
 }
 declare 29 generic {
     Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr)
@@ -133,7 +133,7 @@
     void TclFreeObj(Tcl_Obj *objPtr)
 }
 declare 31 generic {
-    int Tcl_GetBoolean(Tcl_Interp *interp, char *str, int *boolPtr)
+    int Tcl_GetBoolean(Tcl_Interp *interp, CONST char *str, int *boolPtr)
 }
 declare 32 generic {
     int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, \
@@ -143,7 +143,7 @@
     unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr)
 }
 declare 34 generic {
-    int Tcl_GetDouble(Tcl_Interp *interp, char *str, double *doublePtr)
+    int Tcl_GetDouble(Tcl_Interp *interp, CONST char *str, double *doublePtr)
 }
 declare 35 generic {
     int Tcl_GetDoubleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, \
@@ -151,10 +151,10 @@
 }
 declare 36 generic {
     int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, \
-	    char **tablePtr, char *msg, int flags, int *indexPtr)
+	    char **tablePtr, CONST char *msg, int flags, int *indexPtr)
 }
 declare 37 generic {
-    int Tcl_GetInt(Tcl_Interp *interp, char *str, int *intPtr)
+    int Tcl_GetInt(Tcl_Interp *interp, CONST char *str, int *intPtr)
 }
 declare 38 generic {
     int Tcl_GetIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr)
@@ -163,7 +163,7 @@
     int Tcl_GetLongFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr)
 }
 declare 40 generic {
-    Tcl_ObjType * Tcl_GetObjType(char *typeName)
+    Tcl_ObjType * Tcl_GetObjType(CONST char *typeName)
 }
 declare 41 generic {
     char * Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr)
@@ -198,7 +198,7 @@
     Tcl_Obj * Tcl_NewBooleanObj(int boolValue)
 }
 declare 50 generic {
-    Tcl_Obj * Tcl_NewByteArrayObj(unsigned char *bytes, int length)
+    Tcl_Obj * Tcl_NewByteArrayObj(CONST unsigned char *bytes, int length)
 }
 declare 51 generic {
     Tcl_Obj * Tcl_NewDoubleObj(double doubleValue)
@@ -225,7 +225,7 @@
     unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length)
 }
 declare 59 generic {
-    void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, unsigned char *bytes, int length)
+    void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, CONST unsigned char *bytes, int length)
 }
 declare 60 generic {
     void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue)
@@ -243,7 +243,7 @@
     void Tcl_SetObjLength(Tcl_Obj *objPtr, int length)
 }
 declare 65 generic {
-    void Tcl_SetStringObj(Tcl_Obj *objPtr, char *bytes, int length)
+    void Tcl_SetStringObj(Tcl_Obj *objPtr, CONST char *bytes, int length)
 }
 declare 66 generic {
     void Tcl_AddErrorInfo(Tcl_Interp *interp, CONST char *message)
@@ -284,8 +284,8 @@
     char Tcl_Backslash(CONST char *src, int *readPtr)
 }
 declare 78 generic {
-    int Tcl_BadChannelOption(Tcl_Interp *interp, char *optionName, \
-	    char *optionList)
+    int Tcl_BadChannelOption(Tcl_Interp *interp, CONST char *optionName, \
+	    CONST char *optionList)
 }
 declare 79 generic {
     void Tcl_CallWhenDeleted(Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, \
@@ -311,16 +311,16 @@
 	    int flags)
 }
 declare 86 generic {
-    int Tcl_CreateAlias(Tcl_Interp *slave, char *slaveCmd, \
-	    Tcl_Interp *target, char *targetCmd, int argc, char **argv)
+    int Tcl_CreateAlias(Tcl_Interp *slave, CONST char *slaveCmd, \
+	    Tcl_Interp *target, CONST char *targetCmd, int argc, char **argv)
 }
 declare 87 generic {
-    int Tcl_CreateAliasObj(Tcl_Interp *slave, char *slaveCmd, \
-	    Tcl_Interp *target, char *targetCmd, int objc, \
+    int Tcl_CreateAliasObj(Tcl_Interp *slave, CONST char *slaveCmd, \
+	    Tcl_Interp *target, CONST char *targetCmd, int objc, \
 	    Tcl_Obj *CONST objv[])
 }
 declare 88 generic {
-    Tcl_Channel Tcl_CreateChannel(Tcl_ChannelType *typePtr, char *chanName, \
+    Tcl_Channel Tcl_CreateChannel(Tcl_ChannelType *typePtr, CONST char *chanName, \
 	    ClientData instanceData, int mask)
 }
 declare 89 generic {
@@ -332,7 +332,7 @@
 	    ClientData clientData)
 }
 declare 91 generic {
-    Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, char *cmdName, \
+    Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, CONST char *cmdName, \
 	    Tcl_CmdProc *proc, ClientData clientData, \
 	    Tcl_CmdDeleteProc *deleteProc)
 }
@@ -347,16 +347,16 @@
     Tcl_Interp * Tcl_CreateInterp(void)
 }
 declare 95 generic {
-    void Tcl_CreateMathFunc(Tcl_Interp *interp, char *name, int numArgs, \
+    void Tcl_CreateMathFunc(Tcl_Interp *interp, CONST char *name, int numArgs, \
 	    Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData)
 }
 declare 96 generic {
-    Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp, char *cmdName, \
+    Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp, CONST char *cmdName, \
 	    Tcl_ObjCmdProc *proc, ClientData clientData, \
 	    Tcl_CmdDeleteProc *deleteProc)
 }
 declare 97 generic {
-    Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp, char *slaveName, \
+    Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp, CONST char *slaveName, \
 	    int isSafe)
 }
 declare 98 generic {
@@ -368,7 +368,7 @@
 	    Tcl_CmdTraceProc *proc, ClientData clientData)
 }
 declare 100 generic {
-    void Tcl_DeleteAssocData(Tcl_Interp *interp, char *name)
+    void Tcl_DeleteAssocData(Tcl_Interp *interp, CONST char *name)
 }
 declare 101 generic {
     void Tcl_DeleteChannelHandler(Tcl_Channel chan, Tcl_ChannelProc *proc, \
@@ -379,7 +379,7 @@
 	    ClientData clientData)
 }
 declare 103 generic {
-    int Tcl_DeleteCommand(Tcl_Interp *interp, char *cmdName)
+    int Tcl_DeleteCommand(Tcl_Interp *interp, CONST char *cmdName)
 }
 declare 104 generic {
     int Tcl_DeleteCommandFromToken(Tcl_Interp *interp, Tcl_Command command)
@@ -426,7 +426,7 @@
     char * Tcl_DStringAppend(Tcl_DString *dsPtr, CONST char *str, int length)
 }
 declare 118 generic {
-    char * Tcl_DStringAppendElement(Tcl_DString *dsPtr, CONST char *string)
+    char * Tcl_DStringAppendElement(Tcl_DString *dsPtr, CONST char *str)
 }
 declare 119 generic {
     void Tcl_DStringEndSublist(Tcl_DString *dsPtr)
@@ -462,7 +462,7 @@
     int Tcl_Eval(Tcl_Interp *interp, char *string)
 }
 declare 130 generic {
-    int Tcl_EvalFile(Tcl_Interp *interp, char *fileName)
+    int Tcl_EvalFile(Tcl_Interp *interp, CONST char *fileName)
 }
 declare 131 generic {
     int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
@@ -474,23 +474,23 @@
     void Tcl_Exit(int status)
 }
 declare 134 generic {
-    int Tcl_ExposeCommand(Tcl_Interp *interp, char *hiddenCmdToken, \
-	    char *cmdName)
+    int Tcl_ExposeCommand(Tcl_Interp *interp, CONST char *hiddenCmdToken, \
+	    CONST char *cmdName)
 }
 declare 135 generic {
-    int Tcl_ExprBoolean(Tcl_Interp *interp, char *str, int *ptr)
+    int Tcl_ExprBoolean(Tcl_Interp *interp, CONST char *str, int *ptr)
 }
 declare 136 generic {
     int Tcl_ExprBooleanObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *ptr)
 }
 declare 137 generic {
-    int Tcl_ExprDouble(Tcl_Interp *interp, char *str, double *ptr)
+    int Tcl_ExprDouble(Tcl_Interp *interp, CONST char *str, double *ptr)
 }
 declare 138 generic {
     int Tcl_ExprDoubleObj(Tcl_Interp *interp, Tcl_Obj *objPtr, double *ptr)
 }
 declare 139 generic {
-    int Tcl_ExprLong(Tcl_Interp *interp, char *str, long *ptr)
+    int Tcl_ExprLong(Tcl_Interp *interp, CONST char *str, long *ptr)
 }
 declare 140 generic {
     int Tcl_ExprLongObj(Tcl_Interp *interp, Tcl_Obj *objPtr, long *ptr)
@@ -500,7 +500,7 @@
 	    Tcl_Obj **resultPtrPtr)
 }
 declare 142 generic {
-    int Tcl_ExprString(Tcl_Interp *interp, char *string)
+    int Tcl_ExprString(Tcl_Interp *interp, CONST char *string)
 }
 declare 143 generic {
     void Tcl_Finalize(void)
@@ -519,21 +519,21 @@
     void Tcl_FreeResult(Tcl_Interp *interp)
 }
 declare 148 generic {
-    int Tcl_GetAlias(Tcl_Interp *interp, char *slaveCmd, \
+    int Tcl_GetAlias(Tcl_Interp *interp, CONST char *slaveCmd, \
 	    Tcl_Interp **targetInterpPtr, char **targetCmdPtr, int *argcPtr, \
 	    char ***argvPtr)
 }
 declare 149 generic {
-    int Tcl_GetAliasObj(Tcl_Interp *interp, char *slaveCmd, \
+    int Tcl_GetAliasObj(Tcl_Interp *interp, CONST char *slaveCmd, \
 	    Tcl_Interp **targetInterpPtr, char **targetCmdPtr, int *objcPtr, \
 	    Tcl_Obj ***objv)
 }
 declare 150 generic {
-    ClientData Tcl_GetAssocData(Tcl_Interp *interp, char *name, \
+    ClientData Tcl_GetAssocData(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_InterpDeleteProc **procPtr)
 }
 declare 151 generic {
-    Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, char *chanName, \
+    Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, CONST char *chanName, \
 	    int *modePtr)
 }
 declare 152 generic {
@@ -554,13 +554,13 @@
 }
 declare 157 generic {
     int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, \
-	    char *optionName, Tcl_DString *dsPtr)
+	    CONST char *optionName, Tcl_DString *dsPtr)
 }
 declare 158 generic {
     Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan)
 }
 declare 159 generic {
-    int Tcl_GetCommandInfo(Tcl_Interp *interp, char *cmdName, \
+    int Tcl_GetCommandInfo(Tcl_Interp *interp, CONST char *cmdName, \
 	    Tcl_CmdInfo *infoPtr)
 }
 declare 160 generic {
@@ -589,12 +589,12 @@
 # generic interface, so we inlcude it here for compatibility reasons.
 
 declare 167 unix {
-    int Tcl_GetOpenFile(Tcl_Interp *interp, char *str, int write, \
+    int Tcl_GetOpenFile(Tcl_Interp *interp, CONST char *str, int write, \
 	    int checkUsage, ClientData *filePtr)
 }
 
 declare 168 generic {
-    Tcl_PathType Tcl_GetPathType(char *path)
+    Tcl_PathType Tcl_GetPathType(CONST char *path)
 }
 declare 169 generic {
     int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
@@ -606,7 +606,7 @@
     int Tcl_GetServiceMode(void)
 }
 declare 172 generic {
-    Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp, char *slaveName)
+    Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp, CONST char *slaveName)
 }
 declare 173 generic {
     Tcl_Channel Tcl_GetStdChannel(int type)
@@ -627,8 +627,8 @@
     int Tcl_GlobalEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
 }
 declare 179 generic {
-    int Tcl_HideCommand(Tcl_Interp *interp, char *cmdName, \
-	    char *hiddenCmdToken)
+    int Tcl_HideCommand(Tcl_Interp *interp, CONST char *cmdName, \
+	    CONST char *hiddenCmdToken)
 }
 declare 180 generic {
     int Tcl_Init(Tcl_Interp *interp)
@@ -654,12 +654,9 @@
 declare 187 generic {
     int Tcl_LinkVar(Tcl_Interp *interp, char *varName, char *addr, int type)
 }
-
-# This slot is reserved for use by the plus patch:
-#  declare 188 generic {
-#      Tcl_MainLoop
-#  }
-
+declare 188 generic {
+    void Tcl_MainLoop(void)
+}
 declare 189 generic {
     Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode)
 }
@@ -691,15 +688,15 @@
 	    char **argv, int flags)
 }
 declare 198 generic {
-    Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, char *fileName, \
-	    char *modeString, int permissions)
+    Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, CONST char *fileName, \
+	    CONST char *modeString, int permissions)
 }
 declare 199 generic {
     Tcl_Channel Tcl_OpenTcpClient(Tcl_Interp *interp, int port, \
-	    char *address, char *myaddr, int myport, int async)
+	    CONST char *address, CONST char *myaddr, int myport, int async)
 }
 declare 200 generic {
-    Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, char *host, \
+    Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, CONST char *host, \
 	    Tcl_TcpAcceptProc *acceptProc, ClientData callbackData)
 }
 declare 201 generic {
@@ -771,7 +768,7 @@
     int Tcl_ServiceEvent(int flags)
 }
 declare 223 generic {
-    void Tcl_SetAssocData(Tcl_Interp *interp, char *name, \
+    void Tcl_SetAssocData(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_InterpDeleteProc *proc, ClientData clientData)
 }
 declare 224 generic {
@@ -779,10 +776,10 @@
 }
 declare 225 generic {
     int Tcl_SetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, \
-	    char *optionName, char *newValue)
+	    CONST char *optionName, CONST char *newValue)
 }
 declare 226 generic {
-    int Tcl_SetCommandInfo(Tcl_Interp *interp, char *cmdName, \
+    int Tcl_SetCommandInfo(Tcl_Interp *interp, CONST char *cmdName, \
 	    Tcl_CmdInfo *infoPtr)
 }
 declare 227 generic {
@@ -817,12 +814,12 @@
     void Tcl_SetStdChannel(Tcl_Channel channel, int type)
 }
 declare 237 generic {
-    char * Tcl_SetVar(Tcl_Interp *interp, char *varName, char *newValue, \
+    char * Tcl_SetVar(Tcl_Interp *interp, char *varName, CONST char *newValue, \
 	    int flags)
 }
 declare 238 generic {
     char * Tcl_SetVar2(Tcl_Interp *interp, char *part1, char *part2, \
-	    char *newValue, int flags)
+	    CONST char *newValue, int flags)
 }
 declare 239 generic {
     char * Tcl_SignalId(int sig)
@@ -841,7 +838,7 @@
     void Tcl_SplitPath(CONST char *path, int *argcPtr, char ***argvPtr)
 }
 declare 244 generic {
-    void Tcl_StaticPackage(Tcl_Interp *interp, char *pkgName, \
+    void Tcl_StaticPackage(Tcl_Interp *interp, CONST char *pkgName, \
 	    Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
 }
 declare 245 generic {
@@ -859,11 +856,11 @@
 	    int flags, Tcl_VarTraceProc *proc, ClientData clientData)
 }
 declare 249 generic {
-    char * Tcl_TranslateFileName(Tcl_Interp *interp, char *name, \
+    char * Tcl_TranslateFileName(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_DString *bufferPtr)
 }
 declare 250 generic {
-    int Tcl_Ungets(Tcl_Channel chan, char *str, int len, int atHead)
+    int Tcl_Ungets(Tcl_Channel chan, CONST char *str, int len, int atHead)
 }
 declare 251 generic {
     void Tcl_UnlinkVar(Tcl_Interp *interp, char *varName)
@@ -893,7 +890,7 @@
 	    char *localName, int flags)
 }
 declare 259 generic {
-    int Tcl_UpVar2(Tcl_Interp *interp, char *frameName, char *part1, \
+    int Tcl_UpVar2(Tcl_Interp *interp, CONST char *frameName, char *part1, \
 	    char *part2, char *localName, int flags)
 }
 declare 260 generic {
@@ -909,17 +906,17 @@
 	    ClientData prevClientData)
 }
 declare 263 generic {
-    int Tcl_Write(Tcl_Channel chan, char *s, int slen)
+    int Tcl_Write(Tcl_Channel chan, CONST char *s, int slen)
 }
 declare 264 generic {
     void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, \
-	    Tcl_Obj *CONST objv[], char *message)
+	    Tcl_Obj *CONST objv[], CONST char *message)
 }
 declare 265 generic {
-    int Tcl_DumpActiveMemory(char *fileName)
+    int Tcl_DumpActiveMemory(CONST char *fileName)
 }
 declare 266 generic {
-    void Tcl_ValidateAllMemory(char *file, int line)
+    void Tcl_ValidateAllMemory(CONST char *file, int line)
 }
 declare 267 generic {
     void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
@@ -934,18 +931,18 @@
     char * Tcl_ParseVar(Tcl_Interp *interp, char *str, char **termPtr)
 }
 declare 271 generic {
-    char * Tcl_PkgPresent(Tcl_Interp *interp, char *name, char *version, \
+    char * Tcl_PkgPresent(Tcl_Interp *interp, CONST char *name, CONST char *version, \
 	    int exact)
 }
 declare 272 generic {
-    char * Tcl_PkgPresentEx(Tcl_Interp *interp, char *name, char *version, \
+    char * Tcl_PkgPresentEx(Tcl_Interp *interp, CONST char *name, CONST char *version, \
 	    int exact, ClientData *clientDataPtr)
 }
 declare 273 generic {
-    int Tcl_PkgProvide(Tcl_Interp *interp, char *name, char *version)
+    int Tcl_PkgProvide(Tcl_Interp *interp, CONST char *name, CONST char *version)
 }
 declare 274 generic {
-    char * Tcl_PkgRequire(Tcl_Interp *interp, char *name, char *version, \
+    char * Tcl_PkgRequire(Tcl_Interp *interp, CONST char *name, CONST char *version, \
 	    int exact)
 }
 declare 275 generic {
@@ -958,7 +955,7 @@
     Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options)
 }
 declare 278 {unix win} {
-    void Tcl_PanicVA(char *format, va_list argList)
+    void Tcl_PanicVA(CONST char *format, va_list argList)
 }
 declare 279 generic {
     void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type)
@@ -972,7 +969,7 @@
 #
 # C-Level API for (un)stacking of channels. This allows the introduction
 # of filtering channels with relatively little changes to the core.
-# This patch was created in cooperation with Jan Nijtmans <nijtmans@wxs.nl>
+# This patch was created in cooperation with Jan Nijtmans <j.nijtmans@chello.nl>
 # and is therefore part of his plus-patches too.
 #
 # It would have been possible to place the following definitions according
@@ -992,9 +989,11 @@
 declare 283 generic {
     Tcl_Channel Tcl_GetStackedChannel(Tcl_Channel chan)
 }
+declare 284 generic {
+    void Tcl_SetMainLoop(Tcl_MainLoopProc *proc)
+}
+
 # Reserved for future use (8.0.x vs. 8.1)
-#  declare 284 generic {
-#  }
 #  declare 285 generic {
 #  }
 
@@ -1062,7 +1061,7 @@
 }
 declare 304 generic {
     int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr, \
-	    char **tablePtr, int offset, char *msg, int flags, int *indexPtr)
+	    char **tablePtr, int offset, CONST char *msg, int flags, int *indexPtr)
 }
 declare 305 generic {
     VOID * Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, int size)
@@ -1349,6 +1348,15 @@
 # only available on the designated platform.
 
 interface tclPlat
+
+######################
+# UNIX declarations
+
+# Added in Tcl 8.1
+
+declare 0 unix {
+    void TclpGetStartupLocaleEncoding(Tcl_Obj **encodingPtr, Tcl_Obj **localePtr)
+}
 
 ######################
 # Windows declarations
--- tcl8.2-8.2.3.orig/generic/tclInt.decls
+++ tcl8.2-8.2.3/generic/tclInt.decls
@@ -62,7 +62,7 @@
 	    TclFile *errFilePtr)
 }
 declare 10 generic {
-    int TclCreateProc(Tcl_Interp *interp, Namespace *nsPtr, char *procName, \
+    int TclCreateProc(Tcl_Interp *interp, Namespace *nsPtr, CONST char *procName, \
 	    Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr)
 }
 declare 11 generic {
@@ -73,7 +73,7 @@
 }
 declare 13 generic {
     int TclDoGlob(Tcl_Interp *interp, char *separators, \
-	    Tcl_DString *headPtr, char *tail)
+	    Tcl_DString *headPtr, char *tail, GlobTypeData *types)
 }
 declare 14 generic {
     void TclDumpMemoryInfo(FILE *outFile)
@@ -134,10 +134,10 @@
 #      char * TclGetEnv(CONST char *name)
 #  }
 declare 31 generic {
-    char * TclGetExtension(char *name)
+    CONST char * TclGetExtension(CONST char *name)
 }
 declare 32 generic {
-    int TclGetFrame(Tcl_Interp *interp, char *str, CallFrame **framePtrPtr)
+    int TclGetFrame(Tcl_Interp *interp, CONST char *str, CallFrame **framePtrPtr)
 }
 declare 33 generic {
     TclCmdProcType TclGetInterpProc(void)
@@ -151,22 +151,22 @@
 	    int leaveErrorMsg)
 }
 declare 36 generic {
-    int TclGetLong(Tcl_Interp *interp, char *str, long *longPtr)
+    int TclGetLong(Tcl_Interp *interp, CONST char *str, long *longPtr)
 }
 declare 37 generic {
-    int TclGetLoadedPackages(Tcl_Interp *interp, char *targetName)
+    int TclGetLoadedPackages(Tcl_Interp *interp, CONST char *targetName)
 }
 declare 38 generic {
-    int TclGetNamespaceForQualName(Tcl_Interp *interp, char *qualName, \
+    int TclGetNamespaceForQualName(Tcl_Interp *interp, CONST char *qualName, \
 	    Namespace *cxtNsPtr, int flags, Namespace **nsPtrPtr, \
 	    Namespace **altNsPtrPtr, Namespace **actualCxtPtrPtr, \
-	    char **simpleNamePtr)
+	    CONST char **simpleNamePtr)
 }
 declare 39 generic {
     TclObjCmdProcType TclGetObjInterpProc(void)
 }
 declare 40 generic {
-    int TclGetOpenMode(Tcl_Interp *interp, char *str, int *seekFlagPtr)
+    int TclGetOpenMode(Tcl_Interp *interp, CONST char *str, int *seekFlagPtr)
 }
 declare 41 generic {
     Tcl_Command TclGetOriginalCommand(Tcl_Command command)
@@ -178,7 +178,7 @@
     int TclGlobalInvoke(Tcl_Interp *interp, int argc, char **argv, int flags)
 }
 declare 44 generic {
-    int TclGuessPackageName(char *fileName, Tcl_DString *bufPtr)
+    int TclGuessPackageName(CONST char *fileName, Tcl_DString *bufPtr)
 }
 declare 45 generic {
     int TclHideUnsafeCommands(Tcl_Interp *interp)
@@ -231,7 +231,7 @@
 #  }
 declare 58 generic {
     Var * TclLookupVar(Tcl_Interp *interp, char *part1, char *part2, \
-	    int flags, char *msg, int createPart1, int createPart2, \
+	    int flags, CONST char *msg, int createPart1, int createPart2, \
 	    Var **arrayPtrPtr)
 }
 declare 59 generic {
@@ -303,8 +303,8 @@
     int TclpListVolumes(Tcl_Interp *interp)
 }
 declare 80 generic {
-    Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp, char *fileName, \
-	    char *modeString, int permissions)
+    Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp, CONST char *fileName, \
+	    CONST char *modeString, int permissions)
 }
 declare 81 generic {
     char * TclpRealloc(char *ptr, unsigned int size)
@@ -363,7 +363,7 @@
     int TclpStat(CONST char *path, struct stat *buf)
 }
 declare 96 generic {
-    int TclRenameCommand(Tcl_Interp *interp, char *oldName, char *newName)
+    int TclRenameCommand(Tcl_Interp *interp, CONST char *oldName, CONST char *newName)
 }
 declare 97 generic {
     void TclResetShadowedCmdRefs(Tcl_Interp *interp, Command *newCmdPtr)
@@ -416,7 +416,7 @@
 # defined here instead of in tcl.decls since they are not stable yet.
 
 declare 111 generic {
-    void Tcl_AddInterpResolvers(Tcl_Interp *interp, char *name, \
+    void Tcl_AddInterpResolvers(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, \
 	    Tcl_ResolveCompiledVarProc *compiledVarProc)
 }
@@ -425,26 +425,26 @@
 	    Tcl_Obj *objPtr)
 }
 declare 113 generic {
-    Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp, char *name, \
+    Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp, CONST char *name, \
 	    ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)
 }
 declare 114 generic {
     void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr)
 }
 declare 115 generic {
-    int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr, char *pattern, \
+    int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr, CONST char *pattern, \
 	    int resetListFirst)
 }
 declare 116 generic {
-    Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, char *name, \
+    Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_Namespace *contextNsPtr, int flags)
 }
 declare 117 generic {
-    Tcl_Namespace * Tcl_FindNamespace(Tcl_Interp *interp, char *name, \
+    Tcl_Namespace * Tcl_FindNamespace(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_Namespace *contextNsPtr, int flags)
 }
 declare 118 generic {
-    int Tcl_GetInterpResolvers(Tcl_Interp *interp, char *name, \
+    int Tcl_GetInterpResolvers(Tcl_Interp *interp, CONST char *name, \
 	    Tcl_ResolverInfo *resInfo)
 }
 declare 119 generic {
@@ -457,7 +457,7 @@
 }
 declare 121 generic {
     int Tcl_ForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, \
-	    char *pattern)
+	    CONST char *pattern)
 }
 declare 122 generic {
     Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
@@ -478,7 +478,7 @@
 }
 declare 127 generic {
     int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr, \
-	    char *pattern, int allowOverwrite)
+	    CONST char *pattern, int allowOverwrite)
 }
 declare 128 generic {
     void Tcl_PopCallFrame(Tcl_Interp* interp)
@@ -488,7 +488,7 @@
 	    Tcl_Namespace *nsPtr, int isProcCallFrame)
 } 
 declare 130 generic {
-    int Tcl_RemoveInterpResolvers(Tcl_Interp *interp, char *name)
+    int Tcl_RemoveInterpResolvers(Tcl_Interp *interp, CONST char *name)
 }
 declare 131 generic {
     void Tcl_SetNamespaceResolvers(Tcl_Namespace *namespacePtr, \
@@ -518,12 +518,12 @@
     char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr)
 }
 declare 139 generic {
-    int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1, \
+    int TclpLoadFile(Tcl_Interp *interp, CONST char *fileName, char *sym1, \
 	    char *sym2, Tcl_PackageInitProc **proc1Ptr, \
 	    Tcl_PackageInitProc **proc2Ptr, ClientData *clientDataPtr)
 }
 declare 140 generic {
-    int TclLooksLikeInt(char *bytes, int length)
+    int TclLooksLikeInt(CONST char *bytes, int length)
 }
 declare 141 generic {
     char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
@@ -591,6 +591,10 @@
 }
 declare 157 generic {
     Var * TclVarTraceExists (Tcl_Interp *interp, char *varName)
+}
+declare 158 generic {
+    int TclpMatchFilesTypes(Tcl_Interp *interp, char *separators, \
+	    Tcl_DString *dirPtr, char *pattern, char *tail, GlobTypeData *types)
 }
 
 ##############################################################################
--- tcl8.2-8.2.3.orig/generic/tclStdMain.c
+++ tcl8.2-8.2.3/generic/tclStdMain.c
@@ -0,0 +1,503 @@
+/* 
+ * tclUnixMain.c --
+ *
+ *	This file contains a generic main program for Tcl-based applications.
+ *	It can be used as-is for many applications, just by supplying a
+ *	different appInitProc procedure for each specific application.
+ *	Or, it can be used as a template for creating new main programs
+ *	for Tk applications.
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id: tkMain.c,v 1.2 1998/09/14 18:23:14 stanton Exp $
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <tcl.h>
+#include <tclInt.h>
+#ifdef NO_STDLIB_H
+#   include "../compat/stdlib.h"
+#else
+#   include <stdlib.h>
+#endif
+
+extern TclStubs tclStubs;
+
+/*
+ * Declarations for various library procedures and variables (don't want
+ * to include tkInt.h or tkPort.h here, because people might copy this
+ * file out of the Tk source directory to make their own modified versions).
+ * Note: don't declare "exit" here even though a declaration is really
+ * needed, because it will conflict with a declaration elsewhere on
+ * some systems.
+ */
+
+extern int		isatty _ANSI_ARGS_((int fd));
+
+/*
+ * Global variables used by the main program:
+ */
+
+static Tcl_Interp *interp;	/* Interpreter for this application. */
+static Tcl_DString command;	/* Used to assemble lines of terminal input
+				 * into Tcl commands. */
+static Tcl_DString line;	/* Used to read the next line from the
+                                 * terminal input. */
+static int tty;			/* Non-zero means standard input is a
+				 * terminal-like device.  Zero means it's
+				 * a file. -1 means there is no stdin.*/
+#ifdef TCL_MEM_DEBUG
+static char dumpFile[100];	/* Records where to dump memory allocation
+				 * information. */
+static int quitFlag = 0;	/* 1 means "checkmem" command was called,
+				 * so the application should quit and dump
+				 * memory allocation information. */
+#endif
+
+/*
+ * Forward declarations for procedures defined later in this file.
+ */
+
+static void		Prompt _ANSI_ARGS_((Tcl_Interp *interp, int partial));
+static void		StdinProc _ANSI_ARGS_((ClientData clientData,
+			    int mask));
+#ifdef TCL_MEM_DEBUG
+static int		CheckmemCmd _ANSI_ARGS_((ClientData clientData,
+			    Tcl_Interp *interp, int argc, char *argv[]));
+#endif
+static int		StdinMainLoopProc _ANSI_ARGS_((void));
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_Main --
+ *
+ *	Main program for Tclsh and most other Tcl-based applications.
+ *
+ * Results:
+ *	None. This procedure never returns (it exits the process when
+ *	it's done.
+ *
+ * Side effects:
+ *	This procedure initializes the Tcl world and then starts
+ *	interpreting commands;  almost anything could happen, depending
+ *	on the script being interpreted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tcl_Main(argc, argv, appInitProc)
+    int argc;				/* Number of arguments. */
+    char **argv;			/* Array of argument strings. */
+    Tcl_AppInitProc *appInitProc;	/* Application-specific initialization
+					 * procedure to call after most
+					 * initialization but before starting
+					 * to execute commands. */
+{
+    char *args, *fileName;
+    char buf[20];
+    int exitCode = 0;
+    Tcl_Channel inChannel, outChannel, errChannel;
+    Tcl_DString argString;
+
+    Tcl_FindExecutable(argv[0]);
+    interp = Tcl_CreateInterp();
+#ifdef TCL_MEM_DEBUG
+    Tcl_InitMemory(interp);
+    Tcl_CreateCommand(interp, "checkmem", CheckmemCmd, (ClientData) 0,
+	    (Tcl_CmdDeleteProc *) NULL);
+#endif
+
+    /*
+     * Make command-line arguments available in the Tcl variables "argc"
+     * and "argv".  If the first argument doesn't start with a "-" then
+     * strip it off and use it as the name of a script file to process.
+     */
+
+    fileName = NULL;
+    if ((argc > 1) && (argv[1][0] != '-')) {
+	fileName = argv[1];
+	argc--;
+	argv++;
+    }
+    args = Tcl_Merge(argc-1, argv+1);
+    Tcl_ExternalToUtfDString(NULL, args, -1, &argString);
+    Tcl_SetVar(interp, "argv", Tcl_DStringValue(&argString), TCL_GLOBAL_ONLY);
+    Tcl_DStringFree(&argString);
+    ckfree(args);
+    sprintf(buf, "%d", argc-1);
+
+    if (fileName == NULL) {
+	Tcl_ExternalToUtfDString(NULL, argv[0], -1, &argString);
+    } else {
+	fileName = Tcl_ExternalToUtfDString(NULL, fileName, -1, &argString);
+    }
+    Tcl_SetVar(interp, "argc", buf, TCL_GLOBAL_ONLY);
+    Tcl_SetVar(interp, "argv0", Tcl_DStringValue(&argString), TCL_GLOBAL_ONLY);
+
+    /*
+     * Set the "tcl_interactive" variable.
+     */
+
+    tty = isatty(0);
+    Tcl_SetMainLoop(StdinMainLoopProc);
+    Tcl_SetVar(interp, "tcl_interactive",
+	    ((fileName == NULL) && tty) ? "1" : "0", TCL_GLOBAL_ONLY);
+
+    /*
+     * Invoke application-specific initialization.
+     */
+
+    if ((*appInitProc)(interp) != TCL_OK) {
+	errChannel = Tcl_GetStdChannel(TCL_STDERR);
+	if (errChannel) {
+	    Tcl_Write(errChannel,
+		    "application-specific initialization failed: ", -1);
+	    Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);
+	    Tcl_Write(errChannel, "\n", 1);
+	}
+    }
+
+    /*
+     * Invoke the script specified on the command line, if any.
+     */
+
+    if (fileName != NULL) {
+	exitCode = Tcl_EvalFile(interp, fileName);
+	if (exitCode != TCL_OK) {
+	    errChannel = Tcl_GetStdChannel(TCL_STDERR);
+	    if (errChannel) {
+		/*
+		 * The following statement guarantees that the errorInfo
+		 * variable is set properly.
+		 */
+
+		Tcl_AddErrorInfo(interp, "");
+		Tcl_Write(errChannel,
+			Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1);
+		Tcl_Write(errChannel, "\n", 1);
+	    }
+	}
+	tty = -1;
+    } else {
+
+	/*
+	 * Evaluate the .rc file, if one has been specified.
+	 */
+
+	Tcl_SourceRCFile(interp);
+
+	/*
+	 * Establish a channel handler for stdin.
+	 */
+
+	inChannel = Tcl_GetStdChannel(TCL_STDIN);
+	if (inChannel) {
+	    Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc,
+		    (ClientData) inChannel);
+	}
+	if (tty) {
+	    Prompt(interp, 0);
+	}
+    }
+    Tcl_DStringFree(&argString);
+
+    outChannel = Tcl_GetStdChannel(TCL_STDOUT);
+    if (outChannel) {
+	Tcl_Flush(outChannel);
+    }
+    Tcl_DStringInit(&command);
+    Tcl_DStringInit(&line);
+    Tcl_ResetResult(interp);
+
+    /*
+     * Loop infinitely, waiting for commands to execute.  When the
+     * console closes, Tcl_MainLoop returns and we exit.
+     */
+
+    if (!exitCode) {
+	Tcl_MainLoop();
+    }
+    sprintf(buf, "exit %d", exitCode);
+    Tcl_Eval(interp, buf);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StdinProc --
+ *
+ *	This procedure is invoked by the event dispatcher whenever
+ *	standard input becomes readable.  It grabs the next line of
+ *	input characters, adds them to a command being assembled, and
+ *	executes the command if it's complete.
+ *
+ * Results:
+ *	None.
+ *
+ * Side effects:
+ *	Could be almost arbitrary, depending on the command that's
+ *	typed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+    /* ARGSUSED */
+static void
+StdinProc(clientData, mask)
+    ClientData clientData;		/* Not used. */
+    int mask;				/* Not used. */
+{
+    static int gotPartial = 0;
+    char *cmd;
+    int code, count;
+    Tcl_Channel chan = (Tcl_Channel) clientData;
+
+    count = Tcl_Gets(chan, &line);
+
+    if (count < 0) {
+	if (!gotPartial) {
+	    Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan);
+	    tty = -1;
+	    return;
+	} 
+    }
+
+    (void) Tcl_DStringAppend(&command, Tcl_DStringValue(&line), -1);
+    cmd = Tcl_DStringAppend(&command, "\n", -1);
+    Tcl_DStringFree(&line);
+    if (!Tcl_CommandComplete(cmd)) {
+        gotPartial = 1;
+        goto prompt;
+    }
+    gotPartial = 0;
+
+    /*
+     * Disable the stdin channel handler while evaluating the command;
+     * otherwise if the command re-enters the event loop we might
+     * process commands from stdin before the current command is
+     * finished.  Among other things, this will trash the text of the
+     * command being evaluated.
+     */
+
+    Tcl_CreateChannelHandler(chan, 0, StdinProc, (ClientData) chan);
+    code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL);
+    
+    chan = Tcl_GetStdChannel(TCL_STDIN);
+    if (chan) {
+	Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc,
+		(ClientData) chan);
+    }
+    Tcl_DStringFree(&command);
+    if (*Tcl_GetStringResult(interp) != 0) {
+	if ((code != TCL_OK) || (tty)) {
+	    /*
+	     * The statement below used to call "printf", but that resulted
+	     * in core dumps under Solaris 2.3 if the result was very long.
+             *
+             * NOTE: This probably will not work under Windows either.
+	     */
+
+	    puts(Tcl_GetStringResult(interp));
+	}
+    }
+
+    /*
+     * Output a prompt.
+     */
+
+    prompt:
+    if (tty) {
+	Prompt(interp, gotPartial);
+    }
+    Tcl_ResetResult(interp);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CheckmemCmd --
+ *
+ *	This is the command procedure for the "checkmem" command, which
+ *	causes the application to exit after printing information about
+ *	memory usage to the file passed to this command as its first
+ *	argument.
+ *
+ * Results:
+ *	Returns a standard Tcl completion code.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+#ifdef TCL_MEM_DEBUG
+
+	/* ARGSUSED */
+static int
+CheckmemCmd(clientData, interp, argc, argv)
+    ClientData clientData;		/* Not used. */
+    Tcl_Interp *interp;			/* Interpreter for evaluation. */
+    int argc;				/* Number of arguments. */
+    char *argv[];			/* String values of arguments. */
+{
+    extern char *tclMemDumpFileName;
+    if (argc != 2) {
+	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+		" fileName\"", (char *) NULL);
+	return TCL_ERROR;
+    }
+    strcpy(dumpFile, argv[1]);
+    tclMemDumpFileName = dumpFile;
+    quitFlag = 1;
+    return TCL_OK;
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Prompt --
+ *
+ *	Issue a prompt on standard output, or invoke a script
+ *	to issue the prompt.
+ *
+ * Results:
+ *	None.
+ *
+ * Side effects:
+ *	A prompt gets output, and a Tcl script may be evaluated
+ *	in interp.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+Prompt(interp, partial)
+    Tcl_Interp *interp;			/* Interpreter to use for prompting. */
+    int partial;			/* Non-zero means there already
+					 * exists a partial command, so use
+					 * the secondary prompt. */
+{
+    char *promptCmd;
+    int code;
+    Tcl_Channel outChannel, errChannel;
+
+    promptCmd = Tcl_GetVar(interp,
+	partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY);
+    if (promptCmd == NULL) {
+defaultPrompt:
+	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
+	if (!partial) {
+
+            /*
+             * We must check that outChannel is a real channel - it
+             * is possible that someone has transferred stdout out of
+             * this interpreter with "interp transfer".
+             */
+
+            if (outChannel != (Tcl_Channel) NULL) {
+                Tcl_Write(outChannel, "% ", 2);
+            }
+	}
+    } else {
+	code = Tcl_Eval(interp, promptCmd);
+	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
+	if (code != TCL_OK) {
+	    Tcl_AddErrorInfo(interp,
+		    "\n    (script that generates prompt)");
+            /*
+             * We must check that errChannel is a real channel - it
+             * is possible that someone has transferred stderr out of
+             * this interpreter with "interp transfer".
+             */
+            
+	    errChannel = Tcl_GetChannel(interp, "stderr", NULL);
+            if (errChannel != (Tcl_Channel) NULL) {
+                Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);
+                Tcl_Write(errChannel, "\n", 1);
+            }
+	    goto defaultPrompt;
+	} else if (*Tcl_GetStringResult(interp) && outChannel) {
+	    Tcl_Write(outChannel, Tcl_GetStringResult(interp),
+		    strlen(Tcl_GetStringResult(interp)));
+	}
+    }
+    if (outChannel != (Tcl_Channel) NULL) {
+        Tcl_Flush(outChannel);
+    }
+}
+
+/*
+ *---------------------------------------------------------------
+ *
+ * Tcl_SetMainLoopProc --
+ *
+ *	Set check function used by Tcl_MainLoop.
+ *
+ * Results:
+ *	None.
+ *
+ * Side effects:
+ *	None
+ *
+ *---------------------------------------------------------------
+ */
+
+static Tcl_MainLoopProc *proc = NULL;
+
+int
+StdinMainLoopProc()
+{
+    return (tty != -1);
+}
+
+void
+Tcl_SetMainLoop(Tcl_MainLoopProc *p)
+{
+    proc = p;
+}
+
+
+/*
+ *---------------------------------------------------------------
+ *
+ * Tcl_MainLoop --
+ *
+ *	Repeatedly invoke Tcl_DoOneEvent(), until there is nothing
+ *	more to do.
+ *
+ * Results:
+ *	None.
+ *
+ * Side effects:
+ *	Arbitrary; depends on handlers for events.
+ *
+ *---------------------------------------------------------------
+ */
+
+void
+Tcl_MainLoop()
+{
+    int result = 0;
+    do {
+	if (proc) {
+	    result = proc();
+	}
+#ifdef TCL_MEM_DEBUG
+	if (quitFlag) {
+	    Tcl_DeleteInterp(interp);
+	    Tcl_Exit(0);
+	}
+#endif
+    } while (result && Tcl_DoOneEvent(0));
+    proc = NULL;
+}
--- tcl8.2-8.2.3.orig/changes
+++ tcl8.2-8.2.3/changes
@@ -4579,7 +4579,7 @@
 ignored later. 
 
 7/30/99 (bug fix) Added functions to stub table, patch provided by Jan
-Njitmans. [Bug: 2445] (hobbs)
+Nijtmans. [Bug: 2445] (hobbs)
 
 8/1/99  (bug fix) Changed Windows socket driver to terminate threads
 by sending a message to the window rather than calling
@@ -4710,3 +4710,495 @@
 cases (different causes).
 
 --- Released 8.2.3, December 16, 1999 --- See ChangeLog for details ---
+
+The following changes are for the '+'-version,
+written by:	Jan Nijtmans
+		CMG (Computer Management Group) Arnhem B.V.
+		email: j.nijtmans@chello.nl (private)
+		       jan.nijtmans@cmg.nl (work)
+		url:  http://purl.oclc.org/net/nijtmans/
+
+6/26/95 (new feature) Added support for creating standalone support.
+	Now the library has a function Tcl_InitStandAlone() which is
+	a repacement for Tcl_Init(). The difference is that using this
+	new function makes any application independant from the tcl
+	library, because it will be compiled into the binary executable.
+
+6/26/95 (new feature) Changed configure and Makefile for creating
+	a shared library for Tcl7.4. Has been tested successfully
+	for Sun (SunOS-4 and Solaris), HP, SGI, AIX and OSF/1,
+	but is easlily extensible for other systems.
+
+7/3/95  Updated for the official release of Tcl7.4
+
+7/18/95 Some changes to tclAppInit.c, such that it can be
+	compiled with c++.
+	    make tclsh++		c++ version of tclsh
+
+8/28/95	Updated to autoconf-2.4
+
+9/20/95 Updated all for Tcl7.4p2.
+
+10/5/95 Improved above interface for multiple interpreters.
+
+10/6/95 Patched tclExpr.c, to solve a DOMAIN error when using
+	shared libraries on some systems (SunOS-4, HP-UX)
+
+11/21/95 Changed tests to used the loadable extension tcltest${SHLIB_SUFFIX}
+
+12/1/95 Updated everything for Tcl7.4p3
+
+12/6/95 Added some mathematical functions that are in many math
+	libraries (at least HP-UX, SunOS-4, Solaris, Irix and Ultrix):
+	erf(), erfc(), lgamma(), j0(), j1(), jn(), y0(), y1() and yn().
+
+12/12/95 Changed suffix for position independant objects to "..o", to
+	 assure that all linkers accept and recognize it.
+
+1/5/96	Supply both TclTest_Init() and Tcltest_Init() for
+	compatibility with tclX7.4a
+
+2/6/96  Update everything for Tcl7.5b1
+
+2/6/96  Rewrite Main-loop such that Tk is dynamically loadable.
+
+2/13/96 Adapt dynamical loading for c++ loadable libraries
+
+2/19/96 Adapted tclLoadDl.c such that the current path is checked first
+	when trying to load the dynamic library.
+
+2/19/96 Adapted tclLoadAout.c such that the directories in the environment
+	variable LD_LIBRARY_PATH and the patch /usr/lib and /lib are
+	searched too.
+
+2/20/96 Adapted tclTest.c such that it behaves as a separate package,
+	and can be compiled with any C++-compiler too.
+
+2/21/96 Corrected tclsh.standalone for multiple interpreters. Until
+	now it only was standalone as long as only a single interpreter
+	was used.
+
+2/26/96 Updated everything for Tcl7.5b2
+
+2/27/96 Added C++-support for OSF loadable modules.
+
+2/28/96 Changed PWD to BUILD_DIR, thereby removing problems if the
+	tcl build directory is a symbolic link
+
+3/7/96  Renamed tclsh to tclsh7.5 in build directory too. Supply a
+	link to the original name for compatibility.
+
+3/7/96  Adapt tests to load tcltest.so by the "package require" command
+
+3/8/96  Added pkgIndex.tcl for build and dltest directories. These are
+	constructed by the configure script (so without the need for
+	the actual libraries). But the Makefiles also contain rules
+	to construct these by the pkg_mkIndex command.
+
+3/11/96 Fixed rejects for new b3 release.
+
+3/13/96 Adapt tclPkgSetup to accept full-path filenames. Adapt
+	pkg_mkIndex not to put an error-message when a file cannot
+	be loaded or sourced. This is needed to create a pkgIndex.tcl
+	file for Tk.
+
+3/14/96 Adapted tclLoadShl.c to use emulation of dlopen, dlsym and dlerror.
+	this makes it possible to search for symbols in shared libraries
+	by other extensions.
+
+3/18/96 Added generation of TCL_ERROR in the Tcl_WaitForEvent() functions
+	of the mac and win ports.
+
+3/22/96 Initialize firstFileHandlerPtr to NULL
+
+4/8/96  Added small namespace facility (namesp.tcl), and added the "tcl"
+	command.
+
+4/10/96 Removed tclUnixMain.c, and instead create patch for tclMain.c
+	which does the same. Also changed the mechanism such that
+	it should work for Windows and Mac too (hopefully).
+
+4/22/96 Adapted everything for final Tcl7.5
+
+4/25/96 Removed some tests for versions numbers in the Makefile. These are no
+	longer necessary because the version number is now always either with
+	or without dots, but never missing.
+
+5/1/96	Adapted Makefile such that incremental linking in shared libraries
+	is only used for a.out loadable libraries. For other systems it
+	doesn't give any benefit, and for SunOS-4 it even goes wrong.
+
+5/10/96 Added "package require" commands to "hello.tcl"
+
+5/15/96 Added workaround for "-o" bug in UnixWare compiler
+
+5/20/96 Update to use autoconf 2.10
+
+5/22/96 Added dummy reference to "fabs" in tclMtherr.c. This should
+	make Tk dymanically loadable on systems that don't have a
+	shared math library.
+
+5/24/96 Added separate tests for the presence of shared math and c
+	libraries. Removed "AIX_TCL_LIB_SPEC", because that should
+	be handled correctly by @SHLIB_LD_LIBS@ now. Let's hope
+	this works for all systems.
+
+5/30/96 Better support for Mac and Windows ports.
+
+6/4/96  Changed ldAout.tcl and tclLoadAout.c such that a.out dynamical
+	libraries are more forgiving in respect to the extension. Suffixes
+	like ".so", or even ".so.x.y" or "..o.x.y" are now accepted too
+
+6/4/96  Adapted tclTest.c, tclUnixTest.c and pkga.c .. pkge.c such that
+	no warnings about unused arguments are given by some C++ compilers.
+
+8/6/96  Updated everything for Tcl7.5p1
+
+8/7/96  Corrected bug in pkg_mkindex proc for Ultrix. Also, extended
+	this procedure such that it can make index files for packages
+	that depend on other packeges; not only for Tk.
+
+8/8/96  Added function Tcl_FindPackageHandle(). Needed to make libitk2.1.so
+	dynamically loadable in some circumstances on SunOS4.
+
+8/9/96  Adapted pkgIndex.tcl files to work for directories containing
+	spaces too.
+
+8/12/96 Fixed a few event tests for working together with tclsh.static.
+
+8/22/96 Removed erf(), erfc() and lgamma() functions for Windows and Mac
+	ports.
+
+8/26/96 Changed activeFlag in tclMacNotify.c into tclActiveFlag (Oops....)
+
+8/27/96 Improved standalone handling such that now all scripts can be
+	re-loaded. So, now auto_reset works in tclsh.standalone too.
+
+8/28/96 Use mkinstalldir script for creating directory hierarchies.
+
+9/2/96  Adapted everyting for  Tcl7.6b1.
+
+9/2/96  Added support for tkcon (by Jeffrey Hobbs). If tkcon.tcl is
+	present in the Tcl script directory, it will be used as the
+	console for tclsh. If the initialization is not possible
+	(e.g. because Tk is not compiled yet) the old console is
+	used (which doesn't work yet on Mac and Windows)
+
+20/9/96 Added dlsym() emulation for all platforms.
+
+30/9/96 Added option "-with-x", which links X11 with tclsh7.6. This
+	might be usefull if you don't have a shared X11 library.
+
+1/10/96 Upgrade to tkcon version 0.64, expanded with a limited set
+	of safe-tk such that it runs in the Netscape plugin too.
+
+10/23/96 Adapted everyting for final Tcl7.6 release.
+
+10/28/96 Added TclGuessPackageName for Ultrix, to assure that the
+	 possible "_G0" part of the filename is not taken as
+	 belonging to the package name.
+
+10/29/96 Added flag DYNAMIC_PATH to shl_load() function for HP-UX.
+	 That makes it more likely that loading dynamical libraries
+	 will succeed.
+
+10/30/96 Small bug fix in win/tclWinSock.c (reported by Jim Barton
+	 in comp.lang.tcl)
+
+10/31/96 Fixed two small bugs, reported by Frederic Bonnet. One has
+	 to do with an invalid  TEST_SUFFIX="${.a}", which of
+	 course should be   TEST_SUFFIX=".a" in the configure scripts.
+	 The other one is an ill-treatment of tclLoadNone.c when
+	 the system is not on the list of supported systems.
+
+11/1/96  Just a few cleanups to eliminate gcc warnings when -Wall
+	 is used.
+
+11/4/96  Fixed small bug in "update idletask"
+
+11/6/96  Small bug-fix in tclLoadAix.c
+
+11/13/96 Upgrade to TkCon 0.67
+
+11/14/96 Upgrade to TkCon 0.68
+
+11/15/96 Removed event fixes from Mac and Windows ports. They seem
+	 to ruin the console. Pity but true.
+
+11/20/96 A few adaptations for the Mac (Thanks to Vince Darley)
+
+11/22/96 Upgrade to TkCon 0.70
+
+11/26/96 Add some more undefined symbols to tclsh when the shared
+	 c-library is missing for some system. Without this,
+	 libtclx7.6.0.so is not dynamically loadable.
+
+11/29/96 Upgrade to autoconf-2.12
+
+12/2/96  Implemented dlclose() for Windows
+
+12/2/96  Added gcc's __builtin functions.
+
+12/3/96  Added reference to signgam in tclExpr.c. Needed when
+	 using the shared math lib in combination with the
+	 shared AIX tcl7.6 library.
+
+12/5/96  Removed Itcl namespaces: Itcl2.2 is about to be released
+	 now, so better keep this separate.
+
+12/5/96  New C functions Tcl_ReplaceChannel() and
+	 Tcl_UndoReplacechannel() needed for the Trf package. Also
+	 a new tcl-command "unstack" to undo the replacement of a
+	 channel in Tcl-code. These functions are written by
+	 Andreas Kupries.
+
+12/10/96 Renamed internal index data from "tclIndex" to "tcl:tclIndex",
+	 for more consistance with Itcl2.2.
+
+12/10/96 Added the "info resource" command.
+
+12/11/96 Bug-fix in Tcl_Main, which prevented additional packages to
+	 be initialized in combination with the tkCon console.
+
+12/11/96 Small bug-fix for Ultrix: Guess of package name went wrong
+	 if the file name ended with _G0.a and if the package name
+	 was only a single character.
+
+12/13/96 Ultrix doesn't accept the "-h" option for test. This error
+	 is ignored now.
+
+12/20/96 Added possibility to turn off TkCon by setting the
+	 variable NoTkCon in .tclshrc.
+
+1/8/97   Adapted everyting for Tcl 8.0a1
+
+1/13/97  Upgrade to TkCon 0.71
+
+1/13/97  Made restricted "open" function available to safe interpreters.
+
+1/17/97  No longer create links from the /unix/libtk8* to the
+	 /<build-dir>/libtk8* files. Just too dangerous in case
+	 these directories are the same and the system doesn't
+	 recognize "test -h".
+
+1/23/97  Changed syntax for $tcl_prompt1 and $tcl_prompt2 variables
+	 to return a prompt string in stead of writing it to stdout
+	 directory. The old syntax is still supported as well.
+	 After a suggestion from Dan Ellis <dpwe@icsi.berkeley.edu>.
+
+1/27/97  Adapted everything for Tcl 8.0a2
+
+1/28/97  Added functions for controlling byte ordering for channels.
+	 Contributed by Andreas Kupries <a.kupries@westend.COM>.
+
+1/29/97  Moved tcl.h installation from "make install-libraries"
+	 to "make install-binaries". Just more logical.
+
+2/3/97   Added check in tclUnixMain.c whether stdin channel changes
+	 during command evaluation. Suggested by Dean Hinshaw.
+
+2/11/97  A few fixes in test suite. Now it runs with Tkcon as well.
+
+2/20/97  Modified ldAout.tcl such that it is more forgiving to
+	 functions starting with '_'. The C++ adaptation is no
+	 longer done by ldAout.tcl (at compile-time), but by
+	 tclLoad.c (at run-time).
+	 
+3/10/97	 Modified tclLoadAout.c to use the environment variable
+	 LD_LIBRARY_PATH in the same way as other systems do it.
+
+3/14/97  Changed Tcl_Init() such that it always returns TCL_ERROR
+	 or TCL_OK. Previously used to return TCL_BREAK;
+
+5/22/97  Added standalone support for Windows (VC++ only). Thanks
+	 to John Wehle <john@feith.com> and Andreas Kupries for
+	 fixing this. Hopefully everything works now.
+
+7/2/97   Adapt everything for Tcl8.0b1
+
+7/3/97   Upgrade to tkcon version 1.0.2
+
+7/5/97   Adapt everything for Tcl8.0b2
+
+7/12/97  Upgrade to tkcon version 1.0.3. Adapted it to use the new
+	 Menu functions, so it looks better on Windows and Mac.
+
+8/11/97  Adapt everything for Tcl 8.0.
+
+8/25/97  Added bug-fixes from Jeffrey Hobb's archive.
+
+8/26/97  Many bug-fixes in makefile.vc.
+
+8/28/97  Completed Standalone support for Windows port. Now it has
+	 the same functionality as the original UNIX implementation.
+
+8/31/97  Added support for opt0.1 package in standalone executables.
+
+9/4/97   A few bug fixes, as reported by John Lilleyman
+	 <jml@cbr.dit.csiro.au>
+
+9/7/97   Modified makefile.bc for standalone executables.
+
+9/17/97  More fixes for makefile.bc allowing standalone support. With
+	 assistance from Scott Plitsche <SPlischke@aol.com> and
+	 Steve Blinkhorn <steve@prd.co.uk>.
+
+10/3/97  Renamed Tclotest.so to Objtest.so and Tclptest.so to Unixtest.so.
+	 pkgIndex.tcl is now produced by makefile in stead of configure.
+
+11/11/97 Adapted everything for Tcl8.0p1
+
+11/12/97 Upgrade to TkCon 1.1
+
+11/18/97 Added TCLX_REQUIRED_PATCHES and TCLPLUGIN_REQUIRED_PATCHES.
+
+11/19/97 A few small bug-fixes for Windows.
+
+11/20/97 Bug fix for Solaris 2.4 strtod() defined twice.
+
+11/26/97 Upgraded everything for Tcl8.0p2
+
+11/26/97 Removed TCLX_REQUIRED_PATCHES and TCLPLUGIN_REQUIRED_PATCHES.
+	 Will no longer be necessary for TclX8.0.2 and Tclplugin 2.0.5beta
+	 (hopefully).
+
+11/29/97 Disabled dynamical loading in tcl80sa.lib: It doesn't work
+	 anyway because extensions always depend on tcl80.dll which
+	 is no longer available. Even when tcl80.dll is available,
+	 all global variables will have two copies: One in the
+	 standalone executable and one in tcl80.dll. This easily
+	 results in a crash. :-(
+
+12/7/97  Fixed compile errors in tclTest.c and tclObjTest.c, for
+	 non-ANSI compilers. Thanks to Anke Selig
+         <Anke.Selig@oi42.kwu.siemens.de> for reporting this bug.
+
+12/9/97  Fixed socket test 7.3
+
+12/14/97 Undid changes in tclWinSock.c: those changes where merely
+         meant to test the new interface in tclLoadWin.c, but it
+         broke socket handling in standalone executables.
+         Problem reported by M'hamed Boubkari <bo@xs4all.nl>
+
+12/20/97 Solved problem for AIX, which resulted in unknown "-u"
+         options for the linker.
+
+12/27/97 Added some suggestions from Viktor Dukhovni <viktor@nyc.deshaw.com>
+         (posted 12/24/97 on comp.lang.tcl)
+
+1/2/98   Changed reference to opt 0.1 package to opt 0.2. This made
+	 some tests to fail. Reported by Daniel Cotey <danielc@minc.COM>
+
+1/11/98  A few fixes for Windows and Mac, regarding compilation with
+	 BC 4.52/5.02 supplied by  Adam Karpierz <karpierz@inter.intertele.pl>
+	 Thanks very much.
+
+3/4/98   (bug fix) Included Martin Andrews' fixes, making everything
+	 compile with Borland 5.0.
+
+5/18/98  Changed "worldaccess.nl" into "wxs.nl", due to the migration
+         of worldaccess to a new domain.
+
+6/16/98  Removed event-changes; it didn't work completely with
+         Tcl/Tk 8.0 anyway, so it's better not to leave traces,
+	 in order to assure maximum compatibility with the official
+	 Tcl/Tk distribution.
+
+6/20/98  Added "const" back into many function prototypes.
+
+7/19/98  (bug-fix) Too early call of the FreeLibrary() function in
+         tclLoadWin.c, resulted in crash when an application using
+         dynamic extensions in Windows exits.
+
+8/6/98   Upgrade everything for Tcl8.0.3 final (Brent Welch)
+
+8/24/98  Created new patch-files from Brent's plus-distribution,
+         so his additional fixes/enhancements are official now.
+
+9/5/98   Changed name of standalone library and executable for
+         windows to "tcl80s.lib" resp. "tclsh80s.exe", for
+         compatibility with tclPro.
+
+9/12/98  Added changes suggested by Mumit Khan
+         <khan@xraylith.wisc.edu> for mingw32.
+         Makefile.gnu not added yet.
+
+11/22/98 Upgrade everything for Tcl8.0.4 final.
+
+12/4/98  Added Makefile.gnu providing support for
+	 Mingw32/cygwin32 compiler. (only tested
+	 with september 9 version of mingw32)
+
+12/28/98 Massive modification to Makefile.gnu for
+	 CYGWIN-B20.1, using the new "-mno-cygwin"
+	 option. This allows the creation of dll's
+	 and executables which are independant from
+	 "cygwinb1.dll"; Very important for standalone
+	 executables.
+
+3/20/99  Adapted everything for 8.1b2
+
+5/8/99   Adaped everything for 8.1
+
+5/10/99  Added TK_PATCHES. From now on, the Tk plus-patch
+	 will be included in the Tcl plus-patch, such
+	 that they can be distributed together as one file.
+
+5/11/99  Added TCLX_PATCHES, a first shot at Stub-implementation
+	 for TclX 8.1.0. Not yet complete.
+
+5/30/99  Added Hirano Motonori's internationalization patches.
+
+5/30/99  Renamed tclUnixMain.c to tclStdMain.c, and adapted it
+         such that it is usable for Windows as well.
+
+6/20/99  Fixed Tk for running the Tk thread tests.
+
+7/3/99   Added new BLT_PATCHES and TCLX_PATCHES, meant for Blt 2.4i
+	 and TCLX 8.1.1
+
+7/25/99  Updated everything to Tcl8.2b1
+
+7/25/99  Upgrade to autoconf 2.13.
+
+7/31/99  Added functions from tkText.h to the stub table. This makes
+	 tkText.o compilable as a loadable library (at last).
+
+9/2/99   Updated everything to Tcl8.2.0
+
+9/2/99   Let "package require Tcl" return "8.2.0" in stead of just "8.2"
+
+9/2/99   Added two fixes from Matt Newman
+
+9/24/99  Changed "PASCAL FAR" to WINAPI in tclWinSock.c
+
+10/5/99  Removed exclamation marks from tclLoadNone.c
+         Left over from file diff.
+
+10/6/99  Adapted everything for 8.2.1
+
+10/7/99  Modified BLT_PATCHES for 2.4j
+
+10/9/99  Modified TclpGetStartupEncoding() to use Tcl_Obj's in stead
+	 of strings.
+
+10/9/99  Added the variables $tclplatform(encoding) and
+	 $tclplatform(locale) (unix-only)
+
+11/6/99  Fixed the XIM handling (international fonts on UNIX).
+	 Bug report and fix by David Engel <dlengel@home.com>
+
+11/6/99  Made plus-patched Tk compilable with standard Tcl,
+	 by making all additional function references
+	 stub-indirect.
+
+11/8/99  Fixed Expect problem: Because Expect calls Tk_ParseArgv()
+	 or TkCreateFrame() first, Tcl's stub table doesn't get the
+	 chance to be initialized. Solution: call Tcl_InitStubs()
+	 in those functions. Problem reported by David Engel
+	 <dlengel@home.com>.
+
+11/14/99 Further solution for Expedt-problem: Initialize Tk's
+	 stub table as well in TkCreateFrame().
+
+----------------- Released 8.2.1+, 11/14/99 -----------------------
--- tcl8.2-8.2.3.orig/library/init.tcl
+++ tcl8.2-8.2.3/library/init.tcl
@@ -13,10 +13,10 @@
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #
 
-if {[info commands package] == ""} {
+if {![string compare [info commands package] {}]} {
     error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
 }
-package require -exact Tcl 8.2
+package require Tcl 8.2
 
 # Compute the auto path to use in this interpreter.
 # The values on the path come from several locations:
@@ -70,7 +70,7 @@
   
 # Windows specific end of initialization
 
-if {(![interp issafe]) && ($tcl_platform(platform) == "windows")} {
+if {(![interp issafe]) && [string equal windows $tcl_platform(platform)]} {
     namespace eval tcl {
 	proc envTraceProc {lo n1 n2 op} {
 	    set x $::env($n2)
@@ -80,7 +80,7 @@
     }
     foreach p [array names env] {
 	set u [string toupper $p]
-	if {$u != $p} {
+	if {[string compare $u $p]} {
 	    switch -- $u {
 		COMSPEC -
 		PATH {
@@ -100,7 +100,7 @@
 	unset u
     }
     if {![info exists env(COMSPEC)]} {
-	if {$tcl_platform(os) == {Windows NT}} {
+	if {[string equal {Windows NT} $tcl_platform(os)]} {
 	    set env(COMSPEC) cmd.exe
 	} else {
 	    set env(COMSPEC) command.com
@@ -114,20 +114,21 @@
 
 # Conditionalize for presence of exec.
 
-if {[info commands exec] == ""} {
+if {[string equal {} [info commands exec]]} {
 
     # Some machines, such as the Macintosh, do not have exec. Also, on all
     # platforms, safe interpreters do not have exec.
 
     set auto_noexec 1
 }
+
 set errorCode ""
 set errorInfo ""
 
 # Define a log command (which can be overwitten to log errors
 # differently, specially when stderr is not available)
 
-if {[info commands tclLog] == ""} {
+if {[string equal {} [info commands tclLog]]} {
     proc tclLog {string} {
 	catch {puts stderr $string}
     }
@@ -166,7 +167,7 @@
     if {[regexp "^namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} {
         set arglist [lrange $args 1 end]
 	set ret [catch {uplevel $cmd $arglist} result]
-        if {$ret == 0} {
+        if {!$ret} {
             return $result
         } else {
 	    return -code $ret -errorcode $errorCode $result
@@ -190,7 +191,7 @@
 	set unknown_pending($name) pending;
 	set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg]
 	unset unknown_pending($name);
-	if {$ret != 0} {
+	if {$ret} {
 	    return -code $ret -errorcode $errorCode \
 		"error while autoloading \"$name\": $msg"
 	}
@@ -217,7 +218,7 @@
 	}
     }
 
-    if {([info level] == 1) && ([info script] == "") \
+    if {([info level] == 1) && [string equal {} [info script]] \
 	    && [info exists tcl_interactive] && $tcl_interactive} {
 	if {![info exists auto_noexec]} {
 	    set new [auto_execok $name]
@@ -225,7 +226,7 @@
 		set errorCode $savedErrorCode
 		set errorInfo $savedErrorInfo
 		set redir ""
-		if {[info commands console] == ""} {
+		if {[string equal {} [info commands console]]} {
 		    set redir ">&@stdout <@stdin"
 		}
 		return [uplevel exec $redir $new [lrange $args 1 end]]
@@ -233,7 +234,7 @@
 	}
 	set errorCode $savedErrorCode
 	set errorInfo $savedErrorInfo
-	if {$name == "!!"} {
+	if {[string equal !! $name]} {
 	    set newcmd [history event]
 	} elseif {[regexp {^!(.+)$} $name dummy event]} {
 	    set newcmd [history event $event]
@@ -248,18 +249,18 @@
 	}
 
 	set ret [catch {set cmds [info commands $name*]} msg]
-	if {[string compare $name "::"] == 0} {
+	if {[string equal :: $name]} {
 	    set name ""
 	}
-	if {$ret != 0} {
+	if {$ret} {
 	    return -code $ret -errorcode $errorCode \
 		"error in unknown while checking if \"$name\" is a unique command abbreviation: $msg"
 	}
 	if {[llength $cmds] == 1} {
 	    return [uplevel [lreplace $args 0 0 $cmds]]
 	}
-	if {[llength $cmds] != 0} {
-	    if {$name == ""} {
+	if {[llength $cmds]} {
+	    if {[string equal {} $name]} {
 		return -code error "empty command name \"\""
 	    } else {
 		return -code error \
@@ -285,7 +286,7 @@
 proc auto_load {cmd {namespace {}}} {
     global auto_index auto_oldpath auto_path
 
-    if {[string length $namespace] == 0} {
+    if {![string length $namespace]} {
 	set namespace [uplevel {namespace current}]
     }
     set nameList [auto_qualify $cmd $namespace]
@@ -295,7 +296,7 @@
     foreach name $nameList {
 	if {[info exists auto_index($name)]} {
 	    uplevel #0 $auto_index($name)
-	    return [expr {[info commands $name] != ""}]
+	    return [string compare [info commands $name] {}]
 	}
     }
     if {![info exists auto_path]} {
@@ -309,7 +310,7 @@
     foreach name $nameList {
 	if {[info exists auto_index($name)]} {
 	    uplevel #0 $auto_index($name)
-	    if {[info commands $name] != ""} {
+	    if {[string compare [info commands $name] {}]} {
 		return 1
 	    }
 	}
@@ -330,7 +331,7 @@
     global auto_index auto_oldpath auto_path errorInfo errorCode
 
     if {[info exists auto_oldpath]} {
-	if {$auto_oldpath == $auto_path} {
+	if {[string equal $auto_oldpath $auto_path]} {
 	    return 0
 	}
     }
@@ -350,12 +351,12 @@
 	} else {
 	    set error [catch {
 		set id [gets $f]
-		if {$id == "# Tcl autoload index file, version 2.0"} {
+		if {[string equal $id {# Tcl autoload index file, version 2.0}]} {
 		    eval [read $f]
-		} elseif {$id == \
-		    "# Tcl autoload index file: each line identifies a Tcl"} {
+		} elseif {[string equal $id \
+		    {# Tcl autoload index file: each line identifies a Tcl}]} {
 		    while {[gets $f line] >= 0} {
-			if {([string index $line 0] == "#")
+			if {[string equal [string index $line 0] #]
 				|| ([llength $line] != 2)} {
 			    continue
 			}
@@ -368,7 +369,7 @@
 		      "[file join $dir tclIndex] isn't a proper Tcl index file"
 		}
 	    } msg]
-	    if {$f != ""} {
+	    if {[string compare $f {}]} {
 		close $f
 	    }
 	    if {$error} {
@@ -420,8 +421,8 @@
     # Potentially returning 2 elements to try  :
     # (if the current namespace is not the global one)
 
-    if {$n == 0} {
-	if {[string compare $namespace ::] == 0} {
+    if {!$n} {
+	if {[string equal :: $namespace]} {
 	    # ( nocolons , :: ) -> nocolons
 	    return [list $cmd]
 	} else {
@@ -429,7 +430,7 @@
 	    return [list ${namespace}::$cmd $cmd]
 	}
     } else {
-	if {[string compare $namespace ::] == 0} {
+	if {[string equal :: $namespace]} {
 	    #  ( foo::bar , :: ) -> ::foo::bar
 	    return [list ::$cmd]
 	} else {
@@ -460,7 +461,7 @@
 
     foreach pattern $patternList {
         foreach name [array names auto_index] {
-            if {[string match $pattern $name] && "" == [info commands $name]} {
+            if {[string match $pattern $name] && [string equal {} [info commands $name]]} {
                 uplevel #0 $auto_index($name)
             }
         }
@@ -514,7 +515,7 @@
 	set windir $env(WINDIR) 
     }
     if {[info exists windir]} {
-	if {$tcl_platform(os) == "Windows NT"} {
+	if {[string equal {Windows NT} $tcl_platform(os)]} {
 	    append path "$windir/system32;"
 	}
 	append path "$windir/system;$windir;"
@@ -557,7 +558,7 @@
 	return $auto_execs($name)
     }
     foreach dir [split $env(PATH) :] {
-	if {$dir == ""} {
+	if {[string equal {} $dir]} {
 	    set dir .
 	}
 	set file [file join $dir $name]
--- tcl8.2-8.2.3.orig/library/ldAout.tcl
+++ tcl8.2-8.2.3/library/ldAout.tcl
@@ -160,12 +160,9 @@
 
   set f [open $nmCommand r]
   while {[gets $f l] >= 0} {
-    if {[regexp {T[ 	]*_?([A-Z][a-z0-9_]*_(Safe)?Init(__FP10Tcl_Interp)?)$} $l trash symbol]} {
-      if {![regexp {_?([A-Z][a-z0-9_]*_(Safe)?Init)} $symbol trash s]} {
-	set s $symbol
-      }
+    if {[regexp {[0-9A-Fa-f]+ T[ 	]*([a-zA-Z0-9_]*)} $l trash symbol]} {
       append entryProtos {extern int } $symbol { (); } \n
-      append entryPoints {  } \{ { "} $s {", } $symbol { } \} , \n
+      append entryPoints {  } \{ { "} $symbol {", } $symbol { } \} , \n
     }
   }
   close $f
--- tcl8.2-8.2.3.orig/library/package.tcl
+++ tcl8.2-8.2.3/library/package.tcl
@@ -379,9 +379,11 @@
 # files -		List of files that constitute the package.  Each
 #			element is a sub-list with three elements.  The first
 #			is the name of a file relative to $dir, the second is
-#			"load" or "source", indicating whether the file is a
-#			loadable binary or a script to source, and the third
-#			is a list of commands defined by this file.
+#			the command to execute when loading the package, and
+#			the third is a list of commands defined by this file.
+#			If the second argument matches "*load", the package
+#			name is appended to the command as well, allowing the
+#			"load" command to be used directly here.
 
 proc tclPkgSetup {dir pkg version files} {
     global auto_index
@@ -391,10 +393,10 @@
 	set f [lindex $fileInfo 0]
 	set type [lindex $fileInfo 1]
 	foreach cmd [lindex $fileInfo 2] {
-	    if {$type == "load"} {
-		set auto_index($cmd) [list load [file join $dir $f] $pkg]
+	    if {[string match *load $type]} {
+		set auto_index($cmd) [list $type [file join $dir $f] $pkg]
 	    } else {
-		set auto_index($cmd) [list source [file join $dir $f]]
+		set auto_index($cmd) [list $type [file join $dir $f]]
 	    } 
 	}
     }
--- tcl8.2-8.2.3.orig/library/safe.tcl
+++ tcl8.2-8.2.3/library/safe.tcl
@@ -742,6 +742,7 @@
 	# Allow only "source filename"
 	# (and not mac specific -rsrc for instance - see comment in ::init
 	# for current rationale)
+
 	if {$argc != 1} {
 	    set msg "wrong # args: should be \"source fileName\""
 	    Log $slave "$msg ($args)";
--- tcl8.2-8.2.3.orig/library/http1.0/http.tcl
+++ tcl8.2-8.2.3/library/http1.0/http.tcl
@@ -22,7 +22,7 @@
     global http
     set options [lsort [array names http -*]]
     set usage [join $options ", "]
-    if {[llength $args] == 0} {
+    if {![llength $args]} {
 	set result {}
 	foreach name $options {
 	    lappend result $name $http($name)
@@ -52,7 +52,7 @@
  proc httpFinish { token {errormsg ""} } {
     upvar #0 $token state
     global errorInfo errorCode
-    if {[string length $errormsg] != 0} {
+    if {[string length $errormsg]} {
 	set state(error) [list $errormsg $errorInfo $errorCode]
 	set state(status) error
     }
@@ -60,7 +60,7 @@
     catch {after cancel $state(after)}
     if {[info exists state(-command)]} {
 	if {[catch {eval $state(-command) {$token}} err]} {
-	    if {[string length $errormsg] == 0} {
+	    if {![string length $errormsg]} {
 		set state(error) [list $err $errorInfo $errorCode]
 		set state(status) error
 	    }
@@ -122,13 +122,13 @@
 	    x proto host y port srvurl]} {
 	error "Unsupported URL: $url"
     }
-    if {[string length $port] == 0} {
+    if {![string length $port]} {
 	set port 80
     }
-    if {[string length $srvurl] == 0} {
+    if {![string length $srvurl]} {
 	set srvurl /
     }
-    if {[string length $proto] == 0} {
+    if {![string length $proto]} {
 	set url http://$url
     }
     set state(url) $url
@@ -217,9 +217,9 @@
 	httpEof $token
 	return
     }
-    if {$state(state) == "header"} {
+    if {![string compare $state(state) header]} {
 	set n [gets $s line]
-	if {$n == 0} {
+	if {!$n} {
 	    set state(state) body
 	    if {![regexp -nocase ^text $state(type)]} {
 		# Turn off conversions for non-text data
@@ -254,11 +254,11 @@
 	    } else {
 		set block [read $s $state(-blocksize)]
 		set n [string length $block]
-		if {$n >= 0} {
+		if {$n > 0} {
 		    append state(body) $block
 		}
 	    }
-	    if {$n >= 0} {
+	    if {$n > 0} {
 		incr state(currentsize) $n
 	    }
 	} err]} {
@@ -286,7 +286,7 @@
     if {[info exists state(-progress)]} {
 	eval $state(-progress) {$token $state(totalsize) $state(currentsize)}
     }
-    if {([string length $error] != 0)} {
+    if {[string length $error]} {
 	httpFinish $token $error
     } elseif {[eof $s]} {
 	httpEof $token
@@ -296,7 +296,7 @@
 }
  proc httpEof {token} {
     upvar #0 $token state
-    if {$state(state) == "header"} {
+    if {![string compare $state(state) header]} {
 	# Premature eof
 	set state(status) eof
     } else {
@@ -307,7 +307,7 @@
 }
 proc http_wait {token} {
     upvar #0 $token state
-    if {![info exists state(status)] || [string length $state(status)] == 0} {
+    if {![info exists state(status)] || ![string length $state(status)]} {
 	vwait $token\(status)
     }
     if {[info exists state(error)]} {
@@ -326,7 +326,7 @@
     set sep ""
     foreach i $args {
 	append result  $sep [httpMapReply $i]
-	if {$sep != "="} {
+	if {[string compare $sep =]} {
 	    set sep =
 	} else {
 	    set sep &
--- tcl8.2-8.2.3.orig/library/opt0.4/optparse.tcl
+++ tcl8.2-8.2.3/library/opt0.4/optparse.tcl
@@ -75,10 +75,10 @@
 # You've been warned... Here it is...
 
     # Array storing the parsed descriptions
-    variable OptDesc;
-    array set OptDesc {};
+    variable OptDesc
+    array set OptDesc {}
     # Next potentially free key id (numeric)
-    variable OptDescN 0;
+    variable OptDescN 0
 
 # Inside algorithm/mechanism description:
 # (not for the faint hearted ;-)
@@ -148,55 +148,55 @@
 # Parse a given description and saves it here under the given key
 # generate a unused keyid if not given
 #
-proc ::tcl::OptKeyRegister {desc {key ""}} {
-    variable OptDesc;
-    variable OptDescN;
-    if {[string compare $key ""] == 0} {
+proc ::tcl::OptKeyRegister {desc {key {}}} {
+    variable OptDesc
+    variable OptDescN
+    if {![string compare $key {}]} {
         # in case a key given to us as a parameter was a number
         while {[info exists OptDesc($OptDescN)]} {incr OptDescN}
-        set key $OptDescN;
-        incr OptDescN;
+        set key $OptDescN
+        incr OptDescN
     }
     # program counter
-    set program [list [list "P" 1]];
+    set program [list [list "P" 1]]
 
     # are we processing flags (which makes a single program step)
-    set inflags 0;
+    set inflags 0
 
-    set state {};
+    set state {}
 
     # flag used to detect that we just have a single (flags set) subprogram.
-    set empty 1;
+    set empty 1
 
     foreach item $desc {
-	if {$state == "args"} {
+	if {![string compare $state args]} {
 	    # more items after 'args'...
-	    return -code error "'args' special argument must be the last one";
+	    return -code error {'args' special argument must be the last one}
 	}
-        set res [OptNormalizeOne $item];
-        set state [Lfirst $res];
+        set res [OptNormalizeOne $item]
+        set state [Lfirst $res]
         if {$inflags} {
-            if {$state == "flags"} {
+            if {![string compare $state flags]} {
 		# add to 'subprogram'
-                lappend flagsprg $res;
+                lappend flagsprg $res
             } else {
                 # put in the flags
                 # structure for flag programs items is a list of
                 # {subprgcounter {prg flag 1} {prg flag 2} {...}}
-                lappend program $flagsprg;
+                lappend program $flagsprg
                 # put the other regular stuff
-                lappend program $res;
-		set inflags 0;
-		set empty 0;
+                lappend program $res
+		set inflags 0
+		set empty 0
             }
         } else {
-           if {$state == "flags"} {
-               set inflags 1;
+           if {![string compare $state flags]} {
+               set inflags 1
                # sub program counter + first sub program
-               set flagsprg [list [list "P" 1] $res];
+               set flagsprg [list [list "P" 1] $res]
            } else {
-               lappend program $res;
-               set empty 0;
+               lappend program $res
+               set empty 0
            }
        }
    }
@@ -204,32 +204,32 @@
        if {$empty} {
 	   # We just have the subprogram, optimize and remove
 	   # unneeded level:
-	   set program $flagsprg;
+	   set program $flagsprg
        } else {
-	   lappend program $flagsprg;
+	   lappend program $flagsprg
        }
    }
 
-   set OptDesc($key) $program;
+   set OptDesc($key) $program
 
-   return $key;
+   return $key
 }
 
 #
 # Free the storage for that given key
 #
 proc ::tcl::OptKeyDelete {key} {
-    variable OptDesc;
-    unset OptDesc($key);
+    variable OptDesc
+    unset OptDesc($key)
 }
 
     # Get the parsed description stored under the given key.
     proc OptKeyGetDesc {descKey} {
-        variable OptDesc;
+        variable OptDesc
         if {![info exists OptDesc($descKey)]} {
-            return -code error "Unknown option description key \"$descKey\"";
+            return -code error "Unknown option description key \"$descKey\""
         }
-        set OptDesc($descKey);
+        set OptDesc($descKey)
     }
 
 # Parse entry point for ppl who don't want to register with a key,
@@ -238,10 +238,10 @@
 #   as it is way faster or simply OptProc which does it all)
 # Assign a temporary key, call OptKeyParse and then free the storage
 proc ::tcl::OptParse {desc arglist} {
-    set tempkey [OptKeyRegister $desc];
-    set ret [catch {uplevel [list ::tcl::OptKeyParse $tempkey $arglist]} res];
-    OptKeyDelete $tempkey;
-    return -code $ret $res;
+    set tempkey [OptKeyRegister $desc]
+    set ret [catch {uplevel [list ::tcl::OptKeyParse $tempkey $arglist]} res]
+    OptKeyDelete $tempkey
+    return -code $ret $res
 }
 
 # Helper function, replacement for proc that both
@@ -252,23 +252,23 @@
 # (the other will be sets to their default value)
 # into local variable named "Args".
 proc ::tcl::OptProc {name desc body} {
-    set namespace [uplevel namespace current];
-    if {   ([string match $name "::*"]) 
-        || ([string compare $namespace "::"]==0)} {
+    set namespace [uplevel namespace current]
+    if {[string match $name ::*]
+        || ![string compare $namespace ::]} {
         # absolute name or global namespace, name is the key
-        set key $name;
+        set key $name
     } else {
         # we are relative to some non top level namespace:
-        set key "${namespace}::${name}";
+        set key "${namespace}::${name}"
     }
-    OptKeyRegister $desc $key;
-    uplevel [list proc $name args "set Args \[::tcl::OptKeyParse $key \$args\]\n$body"];
-    return $key;
+    OptKeyRegister $desc $key
+    uplevel [list proc $name args "set Args \[::tcl::OptKeyParse $key \$args\]\n$body"]
+    return $key
 }
 # Check that a argument has been given
 # assumes that "OptProc" has been used as it will check in "Args" list
 proc ::tcl::OptProcArgGiven {argname} {
-    upvar Args alist;
+    upvar Args alist
     expr {[lsearch $alist $argname] >=0}
 }
 
@@ -277,7 +277,7 @@
 
     # Return the instruction word/list of a given step/(sub)program
     proc OptInstr {lst} {
-	Lfirst $lst;
+	Lfirst $lst
     }
     # Is a (sub) program or a plain instruction ?
     proc OptIsPrg {lst} {
@@ -293,56 +293,56 @@
     }
     # Current program counter (2nd word of first word)
     proc OptSetPrgCounter {lstName newValue} {
-	upvar $lstName lst;
-	set lst [lreplace $lst 0 0 [concat "P" $newValue]];
+	upvar $lstName lst
+	set lst [lreplace $lst 0 0 [concat "P" $newValue]]
     }
     # returns a list of currently selected items.
     proc OptSelection {lst} {
-	set res {};
+	set res {}
 	foreach idx [lrange [Lfirst $lst] 1 end] {
-	    lappend res [Lget $lst $idx];
+	    lappend res [Lget $lst $idx]
 	}
-	return $res;
+	return $res
     }
 
     # Advance to next description
     proc OptNextDesc {descName} {
-        uplevel [list Lvarincr $descName {0 1}];
+        uplevel [list Lvarincr $descName {0 1}]
     }
 
     # Get the current description, eventually descend
     proc OptCurDesc {descriptions} {
-        lindex $descriptions [OptGetPrgCounter $descriptions];
+        lindex $descriptions [OptGetPrgCounter $descriptions]
     }
     # get the current description, eventually descend
     # through sub programs as needed.
     proc OptCurDescFinal {descriptions} {
-        set item [OptCurDesc $descriptions];
+        set item [OptCurDesc $descriptions]
 	# Descend untill we get the actual item and not a sub program
         while {[OptIsPrg $item]} {
-            set item [OptCurDesc $item];
+            set item [OptCurDesc $item]
         }
-	return $item;
+	return $item
     }
     # Current final instruction adress
     proc OptCurAddr {descriptions {start {}}} {
-	set adress [OptGetPrgCounter $descriptions];
-	lappend start $adress;
-	set item [lindex $descriptions $adress];
+	set adress [OptGetPrgCounter $descriptions]
+	lappend start $adress
+	set item [lindex $descriptions $adress]
 	if {[OptIsPrg $item]} {
-	    return [OptCurAddr $item $start];
+	    return [OptCurAddr $item $start]
 	} else {
-	    return $start;
+	    return $start
 	}
     }
     # Set the value field of the current instruction
     proc OptCurSetValue {descriptionsName value} {
 	upvar $descriptionsName descriptions
 	# get the current item full adress
-        set adress [OptCurAddr $descriptions];
+        set adress [OptCurAddr $descriptions]
 	# use the 3th field of the item  (see OptValue / OptNewInst)
 	lappend adress 2
-	Lvarset descriptions $adress [list 1 $value];
+	Lvarset descriptions $adress [list 1 $value]
 	#                                  ^hasBeenSet flag
     }
 
@@ -353,7 +353,7 @@
     
     # current state
     proc OptCurState {descriptions} {
-        OptState [OptCurDesc $descriptions];
+        OptState [OptCurDesc $descriptions]
     }
 
     #######
@@ -361,11 +361,11 @@
 
     # Returns the argument that has to be processed now
     proc OptCurrentArg {lst} {
-        Lfirst $lst;
+        Lfirst $lst
     }
     # Advance to next argument
     proc OptNextArg {argsName} {
-        uplevel [list Lvarpop1 $argsName];
+        uplevel [list Lvarpop1 $argsName]
     }
     #######
 
@@ -377,77 +377,77 @@
     # eventually eat all the arguments.
     proc OptDoAll {descriptionsName argumentsName} {
 	upvar $descriptionsName descriptions
-	upvar $argumentsName arguments;
-#	puts "entered DoAll";
+	upvar $argumentsName arguments
+#	puts "entered DoAll"
 	# Nb: the places where "state" can be set are tricky to figure
 	#     because DoOne sets the state to flagsValue and return -continue
 	#     when needed...
-	set state [OptCurState $descriptions];
+	set state [OptCurState $descriptions]
 	# We'll exit the loop in "OptDoOne" or when state is empty.
         while 1 {
-	    set curitem [OptCurDesc $descriptions];
+	    set curitem [OptCurDesc $descriptions]
 	    # Do subprograms if needed, call ourselves on the sub branch
 	    while {[OptIsPrg $curitem]} {
 		OptDoAll curitem arguments
-#		puts "done DoAll sub";
-		# Insert back the results in current tree;
+#		puts "done DoAll sub"
+		# Insert back the results in current tree
 		Lvarset1nc descriptions [OptGetPrgCounter $descriptions]\
-			$curitem;
-		OptNextDesc descriptions;
-		set curitem [OptCurDesc $descriptions];
-                set state [OptCurState $descriptions];
+			$curitem
+		OptNextDesc descriptions
+		set curitem [OptCurDesc $descriptions]
+                set state [OptCurState $descriptions]
 	    }
-#           puts "state = \"$state\" - arguments=($arguments)";
+#           puts "state = \"$state\" - arguments=($arguments)"
 	    if {[Lempty $state]} {
 		# Nothing left to do, we are done in this branch:
-		break;
+		break
 	    }
 	    # The following statement can make us terminate/continue
 	    # as it use return -code {break, continue, return and error}
 	    # codes
-            OptDoOne descriptions state arguments;
+            OptDoOne descriptions state arguments
 	    # If we are here, no special return code where issued,
 	    # we'll step to next instruction :
-#           puts "new state  = \"$state\"";
-	    OptNextDesc descriptions;
-	    set state [OptCurState $descriptions];
+#           puts "new state  = \"$state\""
+	    OptNextDesc descriptions
+	    set state [OptCurState $descriptions]
         }
     }
 
     # Process one step for the state machine,
     # eventually consuming the current argument.
     proc OptDoOne {descriptionsName stateName argumentsName} {
-        upvar $argumentsName arguments;
-        upvar $descriptionsName descriptions;
-	upvar $stateName state;
+        upvar $argumentsName arguments
+        upvar $descriptionsName descriptions
+	upvar $stateName state
 
 	# the special state/instruction "args" eats all
 	# the remaining args (if any)
-	if {($state == "args")} {
+	if {![string compare $state args]} {
 	    if {![Lempty $arguments]} {
 		# If there is no additional arguments, leave the default value
 		# in.
-		OptCurSetValue descriptions $arguments;
-		set arguments {};
+		OptCurSetValue descriptions $arguments
+		set arguments {}
 	    }
 #            puts "breaking out ('args' state: consuming every reminding args)"
-	    return -code break;
+	    return -code break
 	}
 
 	if {[Lempty $arguments]} {
-	    if {$state == "flags"} {
+	    if {![string compare $state flags]} {
 		# no argument and no flags : we're done
-#                puts "returning to previous (sub)prg (no more args)";
-		return -code return;
-	    } elseif {$state == "optValue"} {
+#                puts "returning to previous (sub)prg (no more args)"
+		return -code return
+	    } elseif {![string compare $state optValue]} {
 		set state next; # not used, for debug only
 		# go to next state
-		return ;
+		return
 	    } else {
-		return -code error [OptMissingValue $descriptions];
+		return -code error [OptMissingValue $descriptions]
 	    }
 	} else {
-	    set arg [OptCurrentArg $arguments];
+	    set arg [OptCurrentArg $arguments]
 	}
 
         switch $state {
@@ -457,62 +457,62 @@
                 # Still a flag ?
                 if {![OptIsFlag $arg]} {
                     # don't consume the argument, return to previous prg
-                    return -code return;
+                    return -code return
                 }
                 # consume the flag
-                OptNextArg arguments;
-                if {[string compare "--" $arg] == 0} {
+                OptNextArg arguments
+                if {![string compare "--" $arg]} {
                     # return from 'flags' state
-                    return -code return;
+                    return -code return
                 }
 
-                set hits [OptHits descriptions $arg];
+                set hits [OptHits descriptions $arg]
                 if {$hits > 1} {
                     return -code error [OptAmbigous $descriptions $arg]
-                } elseif {$hits == 0} {
+                } elseif {!$hits} {
                     return -code error [OptFlagUsage $descriptions $arg]
                 }
-		set item [OptCurDesc $descriptions];
+		set item [OptCurDesc $descriptions]
                 if {[OptNeedValue $item]} {
 		    # we need a value, next state is
-		    set state flagValue;
+		    set state flagValue
                 } else {
-                    OptCurSetValue descriptions 1;
+                    OptCurSetValue descriptions 1
                 }
 		# continue
-		return -code continue;
+		return -code continue
             }
 	    flagValue -
 	    value {
-		set item [OptCurDesc $descriptions];
+		set item [OptCurDesc $descriptions]
                 # Test the values against their required type
 		if {[catch {OptCheckType $arg\
 			[OptType $item] [OptTypeArgs $item]} val]} {
 		    return -code error [OptBadValue $item $arg $val]
 		}
                 # consume the value
-                OptNextArg arguments;
+                OptNextArg arguments
 		# set the value
-		OptCurSetValue descriptions $val;
+		OptCurSetValue descriptions $val
 		# go to next state
-		if {$state == "flagValue"} {
+		if {![string compare $state flagValue]} {
 		    set state flags
-		    return -code continue;
+		    return -code continue
 		} else {
 		    set state next; # not used, for debug only
 		    return ; # will go on next step
 		}
 	    }
 	    optValue {
-		set item [OptCurDesc $descriptions];
+		set item [OptCurDesc $descriptions]
                 # Test the values against their required type
 		if {![catch {OptCheckType $arg\
 			[OptType $item] [OptTypeArgs $item]} val]} {
 		    # right type, so :
 		    # consume the value
-		    OptNextArg arguments;
+		    OptNextArg arguments
 		    # set the value
-		    OptCurSetValue descriptions $val;
+		    OptCurSetValue descriptions $val
 		}
 		# go to next state
 		set state next; # not used, for debug only
@@ -523,39 +523,39 @@
 	# state as been entered !
 	return -code error "Bug! unknown state in DoOne \"$state\"\
 		(prg counter [OptGetPrgCounter $descriptions]:\
-			[OptCurDesc $descriptions])";
+			[OptCurDesc $descriptions])"
     }
 
 # Parse the options given the key to previously registered description
 # and arguments list
 proc ::tcl::OptKeyParse {descKey arglist} {
 
-    set desc [OptKeyGetDesc $descKey];
+    set desc [OptKeyGetDesc $descKey]
 
     # make sure -help always give usage
-    if {[string compare "-help" [string tolower $arglist]] == 0} {
-	return -code error [OptError "Usage information:" $desc 1];
+    if {![string compare [string tolower $arglist] -help]} {
+	return -code error [OptError "Usage information:" $desc 1]
     }
 
-    OptDoAll desc arglist;
+    OptDoAll desc arglist
 
     if {![Lempty $arglist]} {
-	return -code error [OptTooManyArgs $desc $arglist];
+	return -code error [OptTooManyArgs $desc $arglist]
     }
     
     # Analyse the result
     # Walk through the tree:
-    OptTreeVars $desc "#[expr {[info level]-1}]" ;
+    OptTreeVars $desc "#[expr {[info level]-1}]"
 }
 
     # determine string length for nice tabulated output
     proc OptTreeVars {desc level {vnamesLst {}}} {
 	foreach item $desc {
-	    if {[OptIsCounter $item]} continue;
+	    if {[OptIsCounter $item]} continue
 	    if {[OptIsPrg $item]} {
-		set vnamesLst [OptTreeVars $item $level $vnamesLst];
+		set vnamesLst [OptTreeVars $item $level $vnamesLst]
 	    } else {
-		set vname [OptVarName $item];
+		set vname [OptVarName $item]
 		upvar $level $vname var
 		if {[OptHasBeenSet $item]} {
 #		    puts "adding $vname"
@@ -563,10 +563,10 @@
 		    # it is more usefull, for instance you can check that
 		    # no flags at all was given with expr
 		    # {![string match "*-*" $Args]}
-		    lappend vnamesLst [OptName $item];
-		    set var [OptValue $item];
+		    lappend vnamesLst [OptName $item]
+		    set var [OptValue $item]
 		} else {
-		    set var [OptDefaultValue $item];
+		    set var [OptDefaultValue $item]
 		}
 	    }
 	}
@@ -578,7 +578,7 @@
 # and emit an error if arg is not of the correct type
 # otherwise returns the canonical value of that arg (ie 0/1 for booleans)
 proc ::tcl::OptCheckType {arg type {typeArgs ""}} {
-#    puts "checking '$arg' against '$type' ($typeArgs)";
+#    puts "checking '$arg' against '$type' ($typeArgs)"
 
     # only types "any", "choice", and numbers can have leading "-"
 
@@ -587,7 +587,7 @@
             if {![regexp {^(-+)?[0-9]+$} $arg]} {
                 error "not an integer"
             }
-	    return $arg;
+	    return $arg
         }
         float {
             return [expr {double($arg)}]
@@ -595,12 +595,12 @@
 	script -
         list {
 	    # if llength fail : malformed list
-            if {[llength $arg]==0} {
+            if {![llength $arg]} {
 		if {[OptIsFlag $arg]} {
 		    error "no values with leading -"
 		}
 	    }
-	    return $arg;
+	    return $arg
         }
         boolean {
 	    if {![regexp -nocase {^(true|false|0|1)$} $arg]} {
@@ -617,10 +617,10 @@
             if {[lsearch -exact $typeArgs $arg] < 0} {
                 error "invalid choice"
             }
-	    return $arg;
+	    return $arg
         }
 	any {
-	    return $arg;
+	    return $arg
 	}
 	string -
 	default {
@@ -630,7 +630,7 @@
 	    return $arg
         }
     }
-    return neverReached;
+    return neverReached
 }
 
     # internal utilities
@@ -638,36 +638,36 @@
     # returns the number of flags matching the given arg
     # sets the (local) prg counter to the list of matches
     proc OptHits {descName arg} {
-        upvar $descName desc;
+        upvar $descName desc
         set hits 0
         set hitems {}
-	set i 1;
+	set i 1
 
-	set larg [string tolower $arg];
-	set len  [string length $larg];
-	set last [expr {$len-1}];
+	set larg [string tolower $arg]
+	set len  [string length $larg]
+	set last [expr {$len-1}]
 
         foreach item [lrange $desc 1 end] {
             set flag [OptName $item]
 	    # lets try to match case insensitively
 	    # (string length ought to be cheap)
-	    set lflag [string tolower $flag];
+	    set lflag [string tolower $flag]
 	    if {$len == [string length $lflag]} {
-		if {[string compare $larg $lflag]==0} {
+		if {![string compare $larg $lflag]} {
 		    # Exact match case
-		    OptSetPrgCounter desc $i;
-		    return 1;
+		    OptSetPrgCounter desc $i
+		    return 1
 		}
 	    } else {
-		if {[string compare $larg [string range $lflag 0 $last]]==0} {
-		    lappend hitems $i;
-		    incr hits;
+		if {![string compare $larg [string range $lflag 0 $last]]} {
+		    lappend hitems $i
+		    incr hits
 		}
             }
-	    incr i;
+	    incr i
         }
 	if {$hits} {
-	    OptSetPrgCounter desc $hitems;
+	    OptSetPrgCounter desc $hitems
 	}
         return $hits
     }
@@ -675,31 +675,31 @@
     # Extract fields from the list structure:
 
     proc OptName {item} {
-        lindex $item 1;
+        lindex $item 1
     }
     # 
     proc OptHasBeenSet {item} {
-	Lget $item {2 0};
+	Lget $item {2 0}
     }
     # 
     proc OptValue {item} {
-	Lget $item {2 1};
+	Lget $item {2 1}
     }
 
     proc OptIsFlag {name} {
-        string match "-*" $name;
+        string match "-*" $name
     }
     proc OptIsOpt {name} {
-        string match {\?*} $name;
+        string match {\?*} $name
     }
     proc OptVarName {item} {
-        set name [OptName $item];
+        set name [OptName $item]
         if {[OptIsFlag $name]} {
-            return [string range $name 1 end];
+            return [string range $name 1 end]
         } elseif {[OptIsOpt $name]} {
-	    return [string trim $name "?"];
+	    return [string trim $name "?"]
 	} else {
-            return $name;
+            return $name
         }
     }
     proc OptType {item} {
@@ -736,13 +736,13 @@
     proc OptOptUsage {item {what ""}} {
         return -code error "invalid description format$what: $item\n\
                 should be a list of {varname|-flagname ?-type? ?defaultvalue?\
-                ?helpstring?}";
+                ?helpstring?}"
     }
 
 
     # Generate a canonical form single instruction
     proc OptNewInst {state varname type typeArgs help} {
-	list $state $varname [list 0 {}] $type $typeArgs $help;
+	list $state $varname [list 0 {}] $type $typeArgs $help
 	#                          ^  ^
 	#                          |  |
 	#               hasBeenSet=+  +=currentValue
@@ -750,18 +750,18 @@
 
     # Translate one item to canonical form
     proc OptNormalizeOne {item} {
-        set lg [Lassign $item varname arg1 arg2 arg3];
-#       puts "called optnormalizeone '$item' v=($varname), lg=$lg";
-        set isflag [OptIsFlag $varname];
-	set isopt  [OptIsOpt  $varname];
+        set lg [Lassign $item varname arg1 arg2 arg3]
+#       puts "called optnormalizeone '$item' v=($varname), lg=$lg"
+        set isflag [OptIsFlag $varname]
+	set isopt  [OptIsOpt  $varname]
         if {$isflag} {
-            set state "flags";
+            set state "flags"
         } elseif {$isopt} {
-	    set state "optValue";
+	    set state "optValue"
 	} elseif {[string compare $varname "args"]} {
-	    set state "value";
+	    set state "value"
 	} else {
-	    set state "args";
+	    set state "args"
 	}
 
 	# apply 'smart' 'fuzzy' logic to try to make
@@ -771,16 +771,16 @@
         switch $lg {
             1 {
                 if {$isflag} {
-                    return [OptNewInst $state $varname boolflag false ""];
+                    return [OptNewInst $state $varname boolflag false {}]
                 } else {
-                    return [OptNewInst $state $varname any "" ""];
+                    return [OptNewInst $state $varname any {} {}]
                 }
             }
             2 {
                 # varname default
                 # varname help
                 set type [OptGuessType $arg1]
-                if {[string compare $type "string"] == 0} {
+                if {![string compare $type string]} {
                     if {$isflag} {
 			set type boolflag
 			set def false
@@ -793,7 +793,7 @@
                     set help ""
                     set def $arg1
                 }
-                return [OptNewInst $state $varname $type $def $help];
+                return [OptNewInst $state $varname $type $def $help]
             }
             3 {
                 # varname type value
@@ -803,10 +803,10 @@
 		    # flags/optValue as they are optional, need a "value",
 		    # on the contrary, for a variable (non optional),
 	            # default value is pointless, 'cept for choices :
-		    if {$isflag || $isopt || ($type == "choice")} {
-			return [OptNewInst $state $varname $type $arg2 ""];
+		    if {$isflag || $isopt || ![string compare $type choice]} {
+			return [OptNewInst $state $varname $type $arg2 ""]
 		    } else {
-			return [OptNewInst $state $varname $type "" $arg2];
+			return [OptNewInst $state $varname $type "" $arg2]
 		    }
                 } else {
                     return [OptNewInst $state $varname\
@@ -815,13 +815,13 @@
             }
             4 {
                 if {[regexp {^-(.+)$} $arg1 x type]} {
-		    return [OptNewInst $state $varname $type $arg2 $arg3];
+		    return [OptNewInst $state $varname $type $arg2 $arg3]
                 } else {
-                    return -code error [OptOptUsage $item];
+                    return -code error [OptOptUsage $item]
                 }
             }
             default {
-                return -code error [OptOptUsage $item];
+                return -code error [OptOptUsage $item]
             }
         }
     }
@@ -846,7 +846,7 @@
         OptError "ambigous option \"$arg\", choose from:" [OptSelection $desc]
     }
     proc OptFlagUsage {desc arg} {
-        OptError "bad flag \"$arg\", must be one of" $desc;
+        OptError "bad flag \"$arg\", must be one of" $desc
     }
     proc OptTooManyArgs {desc arguments} {
         OptError "too many arguments (unexpected argument(s): $arguments),\
@@ -855,47 +855,47 @@
     }
     proc OptParamType {item} {
 	if {[OptIsFlag $item]} {
-	    return "flag";
+	    return flag
 	} else {
-	    return "parameter";
+	    return parameter
 	}
     }
     proc OptBadValue {item arg {err {}}} {
-#       puts "bad val err = \"$err\"";
+#       puts "bad val err = \"$err\""
         OptError "bad value \"$arg\" for [OptParamType $item]"\
 		[list $item]
     }
     proc OptMissingValue {descriptions} {
-#        set item [OptCurDescFinal $descriptions];
-        set item [OptCurDesc $descriptions];
+#        set item [OptCurDescFinal $descriptions]
+        set item [OptCurDesc $descriptions]
         OptError "no value given for [OptParamType $item] \"[OptName $item]\"\
 		(use -help for full usage) :"\
 		[list $item]
     }
 
 proc ::tcl::OptKeyError {prefix descKey {header 0}} {
-    OptError $prefix [OptKeyGetDesc $descKey] $header;
+    OptError $prefix [OptKeyGetDesc $descKey] $header
 }
 
     # determine string length for nice tabulated output
     proc OptLengths {desc nlName tlName dlName} {
-	upvar $nlName nl;
-	upvar $tlName tl;
-	upvar $dlName dl;
+	upvar $nlName nl
+	upvar $tlName tl
+	upvar $dlName dl
 	foreach item $desc {
-	    if {[OptIsCounter $item]} continue;
+	    if {[OptIsCounter $item]} continue
 	    if {[OptIsPrg $item]} {
 		OptLengths $item nl tl dl
 	    } else {
 		SetMax nl [string length [OptName $item]]
 		SetMax tl [string length [OptType $item]]
-		set dv [OptTypeArgs $item];
-		if {[OptState $item] != "header"} {
-		    set dv "($dv)";
+		set dv [OptTypeArgs $item]
+		if {[string compare [OptState $item] header]} {
+		    set dv "($dv)"
 		}
-		set l [string length $dv];
+		set l [string length $dv]
 		# limit the space allocated to potentially big "choices"
-		if {([OptType $item] != "choice") || ($l<=12)} {
+		if {[string compare [OptType $item] choice] || ($l<=12)} {
 		    SetMax dl $l
 		} else {
 		    if {![info exists dl]} {
@@ -907,22 +907,22 @@
     }
     # output the tree
     proc OptTree {desc nl tl dl} {
-	set res "";
+	set res ""
 	foreach item $desc {
-	    if {[OptIsCounter $item]} continue;
+	    if {[OptIsCounter $item]} continue
 	    if {[OptIsPrg $item]} {
-		append res [OptTree $item $nl $tl $dl];
+		append res [OptTree $item $nl $tl $dl]
 	    } else {
-		set dv [OptTypeArgs $item];
-		if {[OptState $item] != "header"} {
-		    set dv "($dv)";
+		set dv [OptTypeArgs $item]
+		if {[string compare [OptState $item] header]} {
+		    set dv "($dv)"
 		}
 		append res [format "\n    %-*s %-*s %-*s %s" \
 			$nl [OptName $item] $tl [OptType $item] \
 			$dl $dv [OptHelp $item]]
 	    }
 	}
-	return $res;
+	return $res
     }
 
 # Give nice usage string
@@ -930,8 +930,8 @@
     # determine length
     if {$header} {
 	# add faked instruction
-	set h [list [OptNewInst header Var/FlagName Type Value Help]];
-	lappend h   [OptNewInst header ------------ ---- ----- ----];
+	set h [list [OptNewInst header Var/FlagName Type Value Help]]
+	lappend h   [OptNewInst header ------------ ---- ----- ----]
 	lappend h   [OptNewInst header {( -help} "" "" {gives this help )}]
 	set desc [concat $h $desc]
     }
@@ -954,15 +954,15 @@
 
 # Is that list empty ?
 proc ::tcl::Lempty {list} {
-    expr {[llength $list]==0}
+    expr {![llength $list]}
 }
 
 # Gets the value of one leaf of a lists tree
 proc ::tcl::Lget {list indexLst} {
     if {[llength $indexLst] <= 1} {
-        return [lindex $list $indexLst];
+        return [lindex $list $indexLst]
     }
-    Lget [lindex $list [Lfirst $indexLst]] [Lrest $indexLst];
+    Lget [lindex $list [Lfirst $indexLst]] [Lrest $indexLst]
 }
 # Sets the value of one leaf of a lists tree
 # (we use the version that does not create the elements because
@@ -973,66 +973,66 @@
 #  it should be {a} and [listp a] should be 0 while [listp {a b}] would be 1
 #  and [listp "a b"] maybe 0. listp does not exist either...)
 proc ::tcl::Lvarset {listName indexLst newValue} {
-    upvar $listName list;
+    upvar $listName list
     if {[llength $indexLst] <= 1} {
-        Lvarset1nc list $indexLst $newValue;
+        Lvarset1nc list $indexLst $newValue
     } else {
-        set idx [Lfirst $indexLst];
-        set targetList [lindex $list $idx];
+        set idx [Lfirst $indexLst]
+        set targetList [lindex $list $idx]
         # reduce refcount on targetList (not really usefull now,
 	# could be with optimizing compiler)
-#        Lvarset1 list $idx {};
+#        Lvarset1 list $idx {}
         # recursively replace in targetList
-        Lvarset targetList [Lrest $indexLst] $newValue;
+        Lvarset targetList [Lrest $indexLst] $newValue
         # put updated sub list back in the tree
-        Lvarset1nc list $idx $targetList;
+        Lvarset1nc list $idx $targetList
     }
 }
 # Set one cell to a value, eventually create all the needed elements
 # (on level-1 of lists)
 variable emptyList {}
 proc ::tcl::Lvarset1 {listName index newValue} {
-    upvar $listName list;
+    upvar $listName list
     if {$index < 0} {return -code error "invalid negative index"}
-    set lg [llength $list];
+    set lg [llength $list]
     if {$index >= $lg} {
-        variable emptyList;
+        variable emptyList
         for {set i $lg} {$i<$index} {incr i} {
-            lappend list $emptyList;
+            lappend list $emptyList
         }
-        lappend list $newValue;
+        lappend list $newValue
     } else {
-        set list [lreplace $list $index $index $newValue];
+        set list [lreplace $list $index $index $newValue]
     }
 }
 # same as Lvarset1 but no bound checking / creation
 proc ::tcl::Lvarset1nc {listName index newValue} {
-    upvar $listName list;
-    set list [lreplace $list $index $index $newValue];
+    upvar $listName list
+    set list [lreplace $list $index $index $newValue]
 }
 # Increments the value of one leaf of a lists tree
 # (which must exists)
 proc ::tcl::Lvarincr {listName indexLst {howMuch 1}} {
-    upvar $listName list;
+    upvar $listName list
     if {[llength $indexLst] <= 1} {
-        Lvarincr1 list $indexLst $howMuch;
+        Lvarincr1 list $indexLst $howMuch
     } else {
-        set idx [Lfirst $indexLst];
-        set targetList [lindex $list $idx];
+        set idx [Lfirst $indexLst]
+        set targetList [lindex $list $idx]
         # reduce refcount on targetList
-        Lvarset1nc list $idx {};
+        Lvarset1nc list $idx {}
         # recursively replace in targetList
-        Lvarincr targetList [Lrest $indexLst] $howMuch;
+        Lvarincr targetList [Lrest $indexLst] $howMuch
         # put updated sub list back in the tree
-        Lvarset1nc list $idx $targetList;
+        Lvarset1nc list $idx $targetList
     }
 }
 # Increments the value of one cell of a list
 proc ::tcl::Lvarincr1 {listName index {howMuch 1}} {
-    upvar $listName list;
-    set newValue [expr {[lindex $list $index]+$howMuch}];
-    set list [lreplace $list $index $index $newValue];
-    return $newValue;
+    upvar $listName list
+    set newValue [expr {[lindex $list $index]+$howMuch}]
+    set list [lreplace $list $index $index $newValue]
+    return $newValue
 }
 # Returns the first element of a list
 proc ::tcl::Lfirst {list} {
@@ -1045,28 +1045,28 @@
 # Removes the first element of a list
 # and returns the new list value
 proc ::tcl::Lvarpop1 {listName} {
-    upvar $listName list;
-    set list [lrange $list 1 end];
+    upvar $listName list
+    set list [lrange $list 1 end]
 }
 # Same but returns the removed element
 # (Like the tclX version)
 proc ::tcl::Lvarpop {listName} {
-    upvar $listName list;
-    set el [Lfirst $list];
-    set list [lrange $list 1 end];
-    return $el;
+    upvar $listName list
+    set el [Lfirst $list]
+    set list [lrange $list 1 end]
+    return $el
 }
 # Assign list elements to variables and return the length of the list
 proc ::tcl::Lassign {list args} {
     # faster than direct blown foreach (which does not byte compile)
-    set i 0;
-    set lg [llength $list];
+    set i 0
+    set lg [llength $list]
     foreach vname $args {
         if {$i>=$lg} break
-        uplevel [list set $vname [lindex $list $i]];
-        incr i;
+        uplevel [list set $vname [lindex $list $i]]
+        incr i
     }
-    return $lg;
+    return $lg
 }
 
 # Misc utilities
--- tcl8.2-8.2.3.orig/doc/glob.n
+++ tcl8.2-8.2.3/doc/glob.n
@@ -27,9 +27,35 @@
 they are treated as switches.  The following switches are
 currently supported:
 .TP 15
+\fB\-dir\fR \fIdirectory\fR
+Search for files which match the given patterns, but starting in the 
+given directory.  This allows
+easy searching of directories whose name contains glob-sensitive
+characters (such as ``?[{*'') without the need to quote such
+characters explicitly.
+.TP 15
+\fB\-join\fR
+The remaining pattern arguments are treated as a single pattern
+obtained by joining the arguments with directory separators.
+.TP 15
 \fB\-nocomplain\fR
 Allows an empty list to be returned without error;  without this
 switch an error is returned if the result list would be empty.
+.TP 15
+\fB\-path\fR \fIpath prefix\fR
+Search for files with the given path prefix, the remainder of whose
+names match the given patterns.  This allows
+easy searching for files with names similar to a given file,
+even when that file's name contains contains glob-sensitive
+characters (such as ``?[{*'').  
+.TP 15
+\fB\-types\fR \fIlist of types\fR
+Only list files or directories of one of the types listed.  Currently only
+type 'd' is supported, which lists only directories (hence avoiding the
+need to specify a platform specific separator char), but in the future,
+more types (possibly platform specific) will be supported: e.g. on
+MacOS types such as 'TEXT', 'APPL' will be supported.  Unrecognised
+types are ignored by glob.
 .TP 15
 \fB\-\|\-\fR
 Marks the end of switches.  The argument following this one will
--- tcl8.2-8.2.3.orig/doc/tclsh.1
+++ tcl8.2-8.2.3/doc/tclsh.1
@@ -108,8 +108,9 @@
 command with ``\fB% \fR''.  You can change the prompt by setting the
 variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
 \fBtcl_prompt1\fR exists then it must consist of a Tcl script
-to output a prompt;  instead of outputting a prompt \fBtclsh\fR
-will evaluate the script in \fBtcl_prompt1\fR.
+to return a prompt; instead of outputting a prompt \fBtclsh\fR
+will evaluate the script in \fBtcl_prompt1\fR and write the
+result of the evaluation to stdout.
 The variable \fBtcl_prompt2\fR is used in a similar way when
 a newline is typed but the current command isn't yet complete;
 if \fBtcl_prompt2\fR isn't set then no prompt is output for
--- tcl8.2-8.2.3.orig/doc/MainLoop.3
+++ tcl8.2-8.2.3/doc/MainLoop.3
@@ -0,0 +1,33 @@
+'\"
+'\" Copyright (c) 1990-1992 The Regents of the University of California.
+'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\" 
+'\" SCCS: @(#) MainLoop.3 1.3 96/03/26 18:15:01
+'\" 
+.so man.macros
+.TH Tcl_MainLoop 3 "" Tcl "Tcl Library Procedures"
+.BS
+.SH NAME
+Tcl_MainLoop \- loop for events until there is no more work to do.
+.SH SYNOPSIS
+.nf
+\fB#include <tcl.h>\fR
+.sp
+\fBTcl_MainLoop\fR()
+.BE
+
+.SH DESCRIPTION
+.PP
+\fBTcl_MainLoop\fR is a procedure that loops repeatedly calling
+\fBTcl_DoOneEvent\fR.  It returns only when there is no work to
+be done any more (i.e. no main windows exist anymore).  Any
+application that consists entirely of callbacks invoked via
+\fBTcl_DoOneEvent\fR only has to call \fBTcl_MainLoop\fR after
+initialization. The notifier will take care that the application
+exits automatically when there is nothing to be done any more.
+
+.SH KEYWORDS
+application, event, main loop
--- tcl8.2-8.2.3.orig/compat/dlfcn.h
+++ tcl8.2-8.2.3/compat/dlfcn.h
@@ -44,15 +44,6 @@
 #define RTLD_NOW	2	/* immediate function call binding */
 #define RTLD_GLOBAL	0x100	/* allow symbols to be global */
 
-/*
- * To be able to intialize, a library may provide a dl_info structure
- * that contains functions to be called to initialize and terminate.
- */
-struct dl_info {
-	void (*init) _ANSI_ARGS_((void));
-	void (*fini) _ANSI_ARGS_((void));
-};
-
 VOID *dlopen _ANSI_ARGS_((const char *path, int mode));
 VOID *dlsym _ANSI_ARGS_((void *handle, const char *symbol));
 char *dlerror _ANSI_ARGS_((void));
--- tcl8.2-8.2.3.orig/tests/assocd.test
+++ tcl8.2-8.2.3/tests/assocd.test
@@ -18,6 +18,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testsetassocdata
 if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} {
     puts "This application hasn't been compiled with the tests for assocData,"
     puts "therefore I am skipping all of these tests."
--- tcl8.2-8.2.3.orig/tests/async.test
+++ tcl8.2-8.2.3/tests/async.test
@@ -18,6 +18,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testasync
 if {[info commands testasync] == {}} {
     puts "This application hasn't been compiled with the \"testasync\""
     puts "command, so I can't test Tcl_AsyncCreate et al."
--- tcl8.2-8.2.3.orig/tests/cmdInfo.test
+++ tcl8.2-8.2.3/tests/cmdInfo.test
@@ -20,6 +20,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testcmdinfo
 if {[info commands testcmdinfo] == {}} {
     puts "This application hasn't been compiled with the \"testcmdinfo\""
     puts "command, so I can't test Tcl_GetCommandInfo etc."
--- tcl8.2-8.2.3.orig/tests/dcall.test
+++ tcl8.2-8.2.3/tests/dcall.test
@@ -18,6 +18,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testdcall
 if {[info commands testdcall] == {}} {
     puts "This application hasn't been compiled with the \"testdcall\""
     puts "command, so I can't test Tcl_CallWhenDeleted."
--- tcl8.2-8.2.3.orig/tests/dstring.test
+++ tcl8.2-8.2.3/tests/dstring.test
@@ -18,6 +18,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testdstring
 if {[info commands testdstring] == {}} {
     puts "This application hasn't been compiled with the \"testdstring\""
     puts "command, so I can't test Tcl_DStringAppend et al."
--- tcl8.2-8.2.3.orig/tests/event.test
+++ tcl8.2-8.2.3/tests/event.test
@@ -11,6 +11,7 @@
 #
 # RCS: @(#) $Id: event.test,v 1.8.4.1 1999/09/22 04:12:56 hobbs Exp $
 
+auto_load ::testexithandler
 if {[lsearch [namespace children] ::tcltest] == -1} {
     package require tcltest
     namespace import ::tcltest::*
@@ -289,7 +290,9 @@
 
 test event-8.1 {Tcl_CreateExitHandler procedure} {stdio testexithandler} {
     set child [open |[list [info nameofexecutable]] r+]
-    puts $child "testexithandler create 41; testexithandler create 4"
+    puts $child "lappend auto_path [file dirname [info nameofexecutable]]"
+    puts $child "package require Tcltest [info tclversion]"
+    puts $child "::testexithandler create 41; testexithandler create 4"
     puts $child "testexithandler create 6; exit"
     flush $child
     set result [read $child]
@@ -302,7 +305,9 @@
 
 test event-9.1 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} {
     set child [open |[list [info nameofexecutable]] r+]
-    puts $child "testexithandler create 41; testexithandler create 4"
+    puts $child "lappend auto_path [file dirname [info nameofexecutable]]"
+    puts $child "package require Tcltest [info tclversion]"
+    puts $child "::testexithandler create 41; testexithandler create 4"
     puts $child "testexithandler create 6; testexithandler delete 41"
     puts $child "testexithandler create 16; exit"
     flush $child
@@ -315,7 +320,9 @@
 }
 test event-9.2 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} {
     set child [open |[list [info nameofexecutable]] r+]
-    puts $child "testexithandler create 41; testexithandler create 4"
+    puts $child "lappend auto_path [file dirname [info nameofexecutable]]"
+    puts $child "package require Tcltest [info tclversion]"
+    puts $child "::testexithandler create 41; testexithandler create 4"
     puts $child "testexithandler create 6; testexithandler delete 4"
     puts $child "testexithandler create 16; exit"
     flush $child
@@ -328,7 +335,9 @@
 }
 test event-9.3 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} {
     set child [open |[list [info nameofexecutable]] r+]
-    puts $child "testexithandler create 41; testexithandler create 4"
+    puts $child "lappend auto_path [file dirname [info nameofexecutable]]"
+    puts $child "package require Tcltest [info tclversion]"
+    puts $child "::testexithandler create 41; testexithandler create 4"
     puts $child "testexithandler create 6; testexithandler delete 6"
     puts $child "testexithandler create 16; exit"
     flush $child
@@ -341,7 +350,9 @@
 }
 test event-9.4 {Tcl_DeleteExitHandler procedure} {stdio testexithandler} {
     set child [open |[list [info nameofexecutable]] r+]
-    puts $child "testexithandler create 41; testexithandler delete 41"
+    puts $child "lappend auto_path [file dirname [info nameofexecutable]]"
+    puts $child "package require Tcltest [info tclversion]"
+    puts $child "::testexithandler create 41; testexithandler delete 41"
     puts $child "testexithandler create 16; exit"
     flush $child
     set result [read $child]
--- tcl8.2-8.2.3.orig/tests/exec.test
+++ tcl8.2-8.2.3/tests/exec.test
@@ -565,6 +565,7 @@
 	catch {exec [info nameofexecutable] echo foobar &}
 	exec [info nameofexecutable] sleep 2
 	close $f
+	exit
     }
     close $f
     catch {exec $::tcltest::tcltest script} result
--- tcl8.2-8.2.3.orig/tests/expr-old.test
+++ tcl8.2-8.2.3/tests/expr-old.test
@@ -20,6 +20,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testexprstring
 if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
     set gotT1 0
     puts "This application hasn't been compiled with the \"T1\" and"
--- tcl8.2-8.2.3.orig/tests/expr.test
+++ tcl8.2-8.2.3/tests/expr.test
@@ -17,6 +17,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::noop
 if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} {
     set gotT1 0
     puts "This application hasn't been compiled with the \"T1\" and"
--- tcl8.2-8.2.3.orig/tests/fileName.test
+++ tcl8.2-8.2.3/tests/fileName.test
@@ -17,6 +17,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testsetplatform
 if {[info commands testsetplatform] == {}} {
     puts "This application hasn't been compiled with the \"testsetplatform\""
     puts "command, so I can't test the filename conversion procedures."
@@ -1048,10 +1049,10 @@
 } {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
 test filename-11.2 {Tcl_GlobCmd} {
     list [catch {glob -gorp} msg] $msg
-} {1 {bad switch "-gorp": must be -nocomplain or --}}
+} {1 {bad option "-gorp": must be -dir, -join, -nocomplain, -path, -types, or --}}
 test filename-11.3 {Tcl_GlobCmd} {
     list [catch {glob -nocomplai} msg] $msg
-} {1 {bad switch "-nocomplai": must be -nocomplain or --}}
+} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
 test filename-11.4 {Tcl_GlobCmd} {
     list [catch {glob -nocomplain} msg] $msg
 } {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
@@ -1063,14 +1064,14 @@
 } {1 {user "xyqrszzz" doesn't exist}}
 test filename-11.7 {Tcl_GlobCmd} {
     list [catch {glob -- -nocomplain} msg] $msg
-} {1 {no files matched glob patterns "-nocomplain"}}
+} {1 {no files matched glob pattern "-nocomplain"}}
 test filename-11.8 {Tcl_GlobCmd} {
     list [catch {glob -nocomplain -- -nocomplain} msg] $msg
 } {0 {}}
 test filename-11.9 {Tcl_GlobCmd} {
     testsetplatform unix
     list [catch {glob ~\\xyqrszzz/bar} msg] $msg
-} {1 {globbing characters not supported in user names}}
+} {1 {user "\xyqrszzz" doesn't exist}}
 test filename-11.10 {Tcl_GlobCmd} {
     testsetplatform unix
     list [catch {glob -nocomplain ~\\xyqrszzz/bar} msg] $msg
@@ -1120,6 +1121,85 @@
 test filename-11.16 {Tcl_GlobCmd} {
     list [catch {glob globTest} msg] $msg
 } {0 globTest}
+
+set globname "globTest"
+set horribleglobname "glob\[\{Test"
+regexp {Z(.)Z} [file join Z Z] dummy separator
+unset dummy
+
+test filename-11.17 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -dir $globname *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.18 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -path $globname/ *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.19 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -join -path [string range $globname 0 5] * *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.20 {Tcl_GlobCmd} {
+    list [catch {glob -type d -dir $globname *} msg] $msg
+} [list 0 [list [file join $globname a1]$separator\
+ [file join $globname a2]$separator\
+ [file join $globname a3]$separator]]
+test filename-11.21 {Tcl_GlobCmd} {
+    list [catch {glob -type d -path $globname *} msg] $msg
+} [list 0 [list $globname$separator]]
+
+file rename globTest $horribleglobname
+set globname $horribleglobname
+
+test filename-11.22 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -dir $globname *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.23 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -path $globname/ *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.24 {Tcl_GlobCmd} {
+    list [catch {lsort [glob -join -path [string range $globname 0 5] * *]} msg] $msg
+} [list 0 [list [file join $globname a1] [file join $globname a2]\
+ [file join $globname a3]\
+ [file join $globname "weird name.c"]\
+ [file join $globname x,z1.c]\
+ [file join $globname x1.c]\
+ [file join $globname y1.c] [file join $globname z1.c]]]
+test filename-11.25 {Tcl_GlobCmd} {
+    list [catch {glob -type d -dir $globname *} msg] $msg
+} [list 0 [list [file join $globname a1]$separator\
+ [file join $globname a2]$separator\
+ [file join $globname a3]$separator]]
+test filename-11.26 {Tcl_GlobCmd} {
+    list [catch {glob -type d -path $globname *} msg] $msg
+} [list 0 [list $globname$separator]]
+
+file rename $horribleglobname globTest
+unset globname
+unset horribleglobname
+unset separator
 
 test filename-12.1 {simple globbing} {unixOrPc} {
     list [catch {glob {}} msg] $msg
--- tcl8.2-8.2.3.orig/tests/indexObj.test
+++ tcl8.2-8.2.3/tests/indexObj.test
@@ -15,6 +15,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testindexobj
 if {[info commands testindexobj] == {}} {
     puts "This application hasn't been compiled with the \"testindexobj\""
     puts "command, so I can't test Tcl_GetIndexFromObj etc."
--- tcl8.2-8.2.3.orig/tests/info.test
+++ tcl8.2-8.2.3/tests/info.test
@@ -506,6 +506,7 @@
     list [catch {info s} msg] $msg
 } {1 {ambiguous option "s": must be args, body, cmdcount, commands, complete, default, exists, globals, hostname, level, library, loaded, locals, nameofexecutable, patchlevel, procs, script, sharedlibextension, tclversion, or vars}}
 
+
 # cleanup
 catch {namespace delete test_ns_info1 test_ns_info2}
 ::tcltest::cleanupTests
--- tcl8.2-8.2.3.orig/tests/interp.test
+++ tcl8.2-8.2.3/tests/interp.test
@@ -2246,6 +2246,11 @@
 #    list [catch {interp invokehidden {} foo} msg] $msg;
 #} {1 {invalid hidden command name "foo"}}
 
+test interp-30.1 {Core dump with deletion of aliases inside namespaces} {
+    set i [interp create]
+    $i alias ns::cmd list
+    $i alias ns::cmd {}
+} {}
 
 test interp-28.1 {getting fooled by slave's namespace ?} {
     set i [interp create -safe];
--- tcl8.2-8.2.3.orig/tests/io.test
+++ tcl8.2-8.2.3/tests/io.test
@@ -19,6 +19,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testchannel
 if {"[info commands testchannel]" != "testchannel"} {
     puts "Skipping io tests. This application does not seem to have the"
     puts "testchannel command that is needed to run these tests."
@@ -1622,6 +1623,7 @@
 	close $f
 	close $f2
 	close $f3
+	exit
     }
     close $f
     set result [exec $::tcltest::tcltest test1]
@@ -1650,6 +1652,7 @@
 	close $f
 	close $f2
 	close $f3
+	exit
     }
     close $f
     set result [exec $::tcltest::tcltest test1]
@@ -2052,6 +2055,7 @@
 	    puts -nonewline $f [read stdin 1024]
 	}
 	close $f
+	exit
     }
     close $f
     set x 01234567890123456789012345678901
@@ -2170,8 +2174,10 @@
     removeFile script
     set f [open script w]
     puts $f {
+	package require Tcltest
 	close stdin
-	puts [testchannel open]
+	puts [::testchannel open]
+	exit
     }
     close $f
     set f [open "|[list $::tcltest::tcltest script]" r]
@@ -2315,6 +2321,7 @@
 	for {set x 0} {$x < 10} {incr x} {
 	    puts [gets $f1]
 	}
+	exit
     }
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r]
@@ -2338,6 +2345,7 @@
     puts $f1 {
 	puts [gets stdin]
 	puts [gets stdin]
+	exit
     }
     close $f1
     set y ok
@@ -2462,6 +2470,7 @@
     puts $f1 {set x [read stdin 6]}
     puts $f1 {set cnt [string length $x]}
     puts $f1 {puts "read $cnt characters"}
+    puts $f1 {exit}
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
     puts $f1 hello
@@ -2481,6 +2490,7 @@
 	gets stdin
 	puts bye
 	flush stdout
+	exit
     }
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
@@ -2501,6 +2511,7 @@
 	puts hello
 	gets stdin
 	puts bye
+	exit
     }
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
@@ -2615,6 +2626,8 @@
     puts $f {  flush $f}
     puts $f "}"
     puts $f {close $f}
+    puts $f {exit}
+    puts $f {exit}
     close $f
     set x 01234567890123456789012345678901
     for {set i 0} {$i < 11} {incr i} {
@@ -2684,6 +2697,7 @@
 	puts $f hello
 	puts $f bye
 	puts $f strange
+	exit
     }
     close $f
     exec $::tcltest::tcltest script
@@ -3886,6 +3900,7 @@
     removeFile pipe
     set f1 [open pipe w]
     puts $f1 {puts [gets stdin]}
+    puts $f1 {exit}
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
     puts $f1 hello
@@ -3899,6 +3914,7 @@
     set f1 [open pipe w]
     puts $f1 {puts [gets stdin]}
     puts $f1 {puts [gets stdin]}
+    puts $f1 {exit}
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
     puts $f1 hello
@@ -4396,6 +4412,8 @@
     set f1 [open pipe w]
     puts $f1 {gets stdin}
     puts $f1 {puts hello}
+    puts $f1 {exit}
+    puts $f1 {exit}
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
     puts $f1 hello
@@ -4650,6 +4668,7 @@
     lappend x [fblocked $f1]
     lappend x [gets $f1]
     lappend x [fblocked $f1]
+    puts $f1 {exit}
     close $f1
     set x
 } {{} 1 hello 0 {} 1}
@@ -4911,6 +4930,7 @@
 	after 100
 	puts hi
 	gets stdin
+	exit
     }
     close $f1
     set x ""
@@ -6421,6 +6441,7 @@
 	fconfigure \$f1 -translation lf
 	puts \[read \$f1 100\]
 	close \$f1
+	exit
     "
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
@@ -6479,6 +6500,7 @@
 	fconfigure $f -translation lf
 	puts $f "done"
 	close $f
+	exit
     }
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
@@ -6512,6 +6534,7 @@
 	fconfigure $f -translation lf
 	puts $f "done"
 	close $f
+	exit
     }
     close $f1
     set f1 [open "|[list $::tcltest::tcltest pipe]" r+]
--- tcl8.2-8.2.3.orig/tests/link.test
+++ tcl8.2-8.2.3/tests/link.test
@@ -18,6 +18,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testlink
 if {[info commands testlink] == {}} {
     puts "This application hasn't been compiled with the \"testlink\""
     puts "command, so I can't test Tcl_LinkVar et al."
--- tcl8.2-8.2.3.orig/tests/lsearch.test
+++ tcl8.2-8.2.3/tests/lsearch.test
@@ -92,15 +92,3 @@
 # cleanup
 ::tcltest::cleanupTests
 return
-
-
-
-
-
-
-
-
-
-
-
-
--- tcl8.2-8.2.3.orig/tests/platform.test
+++ tcl8.2-8.2.3/tests/platform.test
@@ -23,7 +23,7 @@
     set result [i eval {lsort [array names tcl_platform]}]
     interp delete i
     set result
-} {byteOrder machine os osVersion platform user}
+} {byteOrder encoding locale machine os osVersion platform user}
 
 # cleanup
 ::tcltest::cleanupTests
--- tcl8.2-8.2.3.orig/tests/proc.test
+++ tcl8.2-8.2.3/tests/proc.test
@@ -166,8 +166,8 @@
 catch {rename {} ""}
 catch {unset msg}
 
-if {[catch {package require procbodytest}]} {
-    puts "This application couldn't load the \"procbodytest\" package, so I"
+if {[catch {package require Proctest}]} {
+    puts "This application couldn't load the \"Proctest\" package, so I"
     puts "can't test creation of procs whose bodies have type \"procbody\"."
     ::tcltest::cleanupTests
     return
@@ -177,7 +177,7 @@
 catch {rename t ""}
 
 # Note that the test require that procedures whose body is used to create
-# procbody objects must be executed before the procbodytest::proc command
+# procbody objects must be executed before the Proctest::proc command
 # is executed, so that the Proc struct is populated correctly (CompiledLocals
 # are added at compile time).
 
@@ -185,7 +185,7 @@
     catch {
 	proc p x {return "$x:$x"}
 	set rv [p P]
-	procbodytest::proc t x p
+	Proctest::proc t x p
 	lappend rv [t T]
 	set rv
     } result
@@ -201,7 +201,7 @@
 	    return "$x:$y"
 	}
 	set rv [p P]
-	procbodytest::proc t x p
+	Proctest::proc t x p
 	lappend rv [t T]
 	set rv
     } result
@@ -217,7 +217,7 @@
 	    return "$x:$y"
 	}
 	set rv [p P]
-	procbodytest::proc t {x x1 x2} p
+	Proctest::proc t {x x1 x2} p
 	lappend rv [t T]
 	set rv
     } result
@@ -234,7 +234,7 @@
 	    return "$v:$w"
 	}
 	set rv [p P Q R]
-	procbodytest::proc t {x x1 z} p
+	Proctest::proc t {x x1 z} p
 	lappend rv [t S T U]
 	set rv
     } result
@@ -251,7 +251,7 @@
 	    return "$v:$w"
 	}
 	set rv [p P Q R]
-	procbodytest::proc t {x y z} p
+	Proctest::proc t {x y z} p
 	lappend rv [t S T U]
 	set rv
     } result
@@ -268,7 +268,7 @@
 	    return "$v:$w"
 	}
 	set rv [p P Q R]
-	procbodytest::proc t {x y {z Z}} p
+	Proctest::proc t {x y {z Z}} p
 	lappend rv [t S T U]
 	set rv
     } result
@@ -285,7 +285,7 @@
 	    return "$v:$w"
 	}
 	set rv [p P Q R]
-	procbodytest::proc t {x y {z ZZ}} p
+	Proctest::proc t {x y {z ZZ}} p
 	lappend rv [t S T U]
 	set rv
     } result
--- tcl8.2-8.2.3.orig/tests/safe.test
+++ tcl8.2-8.2.3/tests/safe.test
@@ -17,6 +17,7 @@
     namespace import ::tcltest::*
 }
 
+auto_load ::testsetassocdata
 foreach i [interp slaves] {
   interp delete $i
 }
@@ -185,7 +186,7 @@
 	set r [lreplace $r $threaded $threaded]
     }
     set r
-} {byteOrder platform}
+} {byteOrder encoding locale platform}
 
 # more test should be added to check that hostname, nameofexecutable,
 # aren't leaking infos, but they still do...
--- tcl8.2-8.2.3.orig/tests/socket.test
+++ tcl8.2-8.2.3/tests/socket.test
@@ -824,7 +824,7 @@
     close $s
     update
     llength $l
-} 12
+} 14
 test socket-7.4 {testing socket specific options} {socket} {
     set s [socket -server accept 2823]
     proc accept {s a p} {
--- tcl8.2-8.2.3.orig/tests/source.test
+++ tcl8.2-8.2.3/tests/source.test
@@ -179,6 +179,12 @@
     source source.file
     string length $x
 } 5
+test source-6.2 {source skips everything after Ctrl-Z} {
+    set x {}
+    makeFile [list set x ab\32c] source.file
+    source source.file
+    string length $x
+} 2
 
 # cleanup
 catch {::tcltest::removeFile source.file}
--- tcl8.2-8.2.3.orig/tests/string.test
+++ tcl8.2-8.2.3/tests/string.test
@@ -87,7 +87,7 @@
 test string-2.17 {string compare -nocase with length} {
     string compare -nocase -length 3 abcde Abxyz
 } -1
-test string-2.18 {string compare -nocase with length <= 0} {
+test string-2.18 nonPortable {string compare -nocase with length <= 0} {
     string compare -nocase -length -1 abcde AbCdEf
 } -1
 test string-2.19 {string compare -nocase with excessive length} {
--- tcl8.2-8.2.3.orig/tests/unixFile.test
+++ tcl8.2-8.2.3/tests/unixFile.test
@@ -16,7 +16,8 @@
     namespace import ::tcltest::*
 }
 
-if {[info commands testobj] == {}} {
+auto_load ::testfindexecutable
+if {[info commands testfindexecutable] == {}} {
     puts "This application hasn't been compiled with the \"testfindexecutable\""
     puts "command, so I can't test the Tcl_FindExecutable function"
     ::tcltest::cleanupTests
--- tcl8.2-8.2.3.orig/win/configure
+++ tcl8.2-8.2.3/win/configure
@@ -1020,16 +1020,50 @@
     # set various compiler flags depending on whether we are using gcc or cl
     
     if test "${GCC}" = "yes" ; then
-	CFLAGS_DEBUG=-g
-	CFLAGS_OPTIMIZE=-O
-	CFLAGS_WARNING="-Wall -Wconversion"
-	LDFLAGS_DEBUG=-g
-	LDFLAGS_OPTIMIZE=-O
-	PATHTYPE=-u
+	SHLIB_LD="dllwrap"
+	SHLIB_LD_LIBS="-luser32 -ladvapi32"
+	LIBS="user32.lib advapi32.lib"
+	AR="ar cf"
+	RC="winres"
+	MAKE_LIB="\${AR} \$@"
+	MAKE_EXE="\${CC} -Fe\$@"
+	
+	if test "${SHARED_BUILD}" = "0" ; then
+	    # static
+            echo "$ac_t""using static flags" 1>&6
+	    runtime=-MT
+	    MAKE_DLL="echo "
+	    LIBSUFFIX="s\${DBGX}.a"
+	    LIBRARIES="\${STATIC_LIBRARIES}"
+	    EXESUFFIX="s\${DBGX}.exe"
+	    DLLSUFFIX=""
+	else
+	    # dynamic
+            echo "$ac_t""using shared flags" 1>&6
+	    runtime=-MD
+	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\$@"
+	    LIBSUFFIX="\${DBGX}.a"
+	    DLLSUFFIX="\${DBGX}.dll"
+	    EXESUFFIX="\${DBGX}.exe"
+	    LIBRARIES="\${SHARED_LIBRARIES}"
+	fi
+
+	EXTRA_CFLAGS="-YX"
+	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
+	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
+	CFLAGS_WARNING="-W3"
+	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
+	LDFLAGS_OPTIMIZE="-release"
+	PATHTYPE=-w
 	
 	# Specify the CC output file names based on the target name
-	CC_OBJNAME="-o \$@"
-	CC_EXENAME="-o \$@"
+	CC_OBJNAME="-Fo\$@"
+	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\$@')\""
+
+	# Specify linker flags depending on the type of app being 
+	# built -- Console vs. Window.
+	LDFLAGS_CONSOLE="-subsystem:console"
+	LDFLAGS_WINDOW="-subsystem:windows"
     else
 	SHLIB_LD="link -dll -nologo"
 	SHLIB_LD_LIBS="user32.lib advapi32.lib"
@@ -1088,7 +1122,7 @@
 
 
     echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:1092: checking for build with symbols" >&5
+echo "configure:1126: checking for build with symbols" >&5
     # Check whether --enable-symbols or --disable-symbols was given.
 if test "${enable_symbols+set}" = set; then
   enableval="$enable_symbols"
--- tcl8.2-8.2.3.orig/win/tcl.m4
+++ tcl8.2-8.2.3/win/tcl.m4
@@ -346,16 +346,50 @@
     # set various compiler flags depending on whether we are using gcc or cl
     
     if test "${GCC}" = "yes" ; then
-	CFLAGS_DEBUG=-g
-	CFLAGS_OPTIMIZE=-O
-	CFLAGS_WARNING="-Wall -Wconversion"
-	LDFLAGS_DEBUG=-g
-	LDFLAGS_OPTIMIZE=-O
-	PATHTYPE=-u
+	SHLIB_LD="dllwrap"
+	SHLIB_LD_LIBS="-luser32 -ladvapi32"
+	LIBS="user32.lib advapi32.lib"
+	AR="ar cf"
+	RC="winres"
+	MAKE_LIB="\${AR} \[$]@"
+	MAKE_EXE="\${CC} -Fe\[$]@"
+	
+	if test "${SHARED_BUILD}" = "0" ; then
+	    # static
+            AC_MSG_RESULT([using static flags])
+	    runtime=-MT
+	    MAKE_DLL="echo "
+	    LIBSUFFIX="s\${DBGX}.a"
+	    LIBRARIES="\${STATIC_LIBRARIES}"
+	    EXESUFFIX="s\${DBGX}.exe"
+	    DLLSUFFIX=""
+	else
+	    # dynamic
+            AC_MSG_RESULT([using shared flags])
+	    runtime=-MD
+	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\[$]@"
+	    LIBSUFFIX="\${DBGX}.a"
+	    DLLSUFFIX="\${DBGX}.dll"
+	    EXESUFFIX="\${DBGX}.exe"
+	    LIBRARIES="\${SHARED_LIBRARIES}"
+	fi
+
+	EXTRA_CFLAGS="-YX"
+	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
+	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
+	CFLAGS_WARNING="-W3"
+	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
+	LDFLAGS_OPTIMIZE="-release"
+	PATHTYPE=-w
 	
 	# Specify the CC output file names based on the target name
-	CC_OBJNAME="-o \[$]@"
-	CC_EXENAME="-o \[$]@"
+	CC_OBJNAME="-Fo\[$]@"
+	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\[$]@')\""
+
+	# Specify linker flags depending on the type of app being 
+	# built -- Console vs. Window.
+	LDFLAGS_CONSOLE="-subsystem:console"
+	LDFLAGS_WINDOW="-subsystem:windows"
     else
 	SHLIB_LD="link -dll -nologo"
 	SHLIB_LD_LIBS="user32.lib advapi32.lib"
--- tcl8.2-8.2.3.orig/win/aclocal.m4
+++ tcl8.2-8.2.3/win/aclocal.m4
@@ -346,16 +346,50 @@
     # set various compiler flags depending on whether we are using gcc or cl
     
     if test "${GCC}" = "yes" ; then
-	CFLAGS_DEBUG=-g
-	CFLAGS_OPTIMIZE=-O
-	CFLAGS_WARNING="-Wall -Wconversion"
-	LDFLAGS_DEBUG=-g
-	LDFLAGS_OPTIMIZE=-O
-	PATHTYPE=-u
+	SHLIB_LD="dllwrap"
+	SHLIB_LD_LIBS="-luser32 -ladvapi32"
+	LIBS="user32.lib advapi32.lib"
+	AR="ar cf"
+	RC="winres"
+	MAKE_LIB="\${AR} \[$]@"
+	MAKE_EXE="\${CC} -Fe\[$]@"
+	
+	if test "${SHARED_BUILD}" = "0" ; then
+	    # static
+            AC_MSG_RESULT([using static flags])
+	    runtime=-MT
+	    MAKE_DLL="echo "
+	    LIBSUFFIX="s\${DBGX}.a"
+	    LIBRARIES="\${STATIC_LIBRARIES}"
+	    EXESUFFIX="s\${DBGX}.exe"
+	    DLLSUFFIX=""
+	else
+	    # dynamic
+            AC_MSG_RESULT([using shared flags])
+	    runtime=-MD
+	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\[$]@"
+	    LIBSUFFIX="\${DBGX}.a"
+	    DLLSUFFIX="\${DBGX}.dll"
+	    EXESUFFIX="\${DBGX}.exe"
+	    LIBRARIES="\${SHARED_LIBRARIES}"
+	fi
+
+	EXTRA_CFLAGS="-YX"
+	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
+	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
+	CFLAGS_WARNING="-W3"
+	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
+	LDFLAGS_OPTIMIZE="-release"
+	PATHTYPE=-w
 	
 	# Specify the CC output file names based on the target name
-	CC_OBJNAME="-o \[$]@"
-	CC_EXENAME="-o \[$]@"
+	CC_OBJNAME="-Fo\[$]@"
+	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\[$]@')\""
+
+	# Specify linker flags depending on the type of app being 
+	# built -- Console vs. Window.
+	LDFLAGS_CONSOLE="-subsystem:console"
+	LDFLAGS_WINDOW="-subsystem:windows"
     else
 	SHLIB_LD="link -dll -nologo"
 	SHLIB_LD_LIBS="user32.lib advapi32.lib"
--- tcl8.2-8.2.3.orig/win/tclAppInit.c
+++ tcl8.2-8.2.3/win/tclAppInit.c
@@ -19,12 +19,12 @@
 #include <locale.h>
 
 #ifdef TCL_TEST
-extern int		Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Proctest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Proctest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
 extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		ObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #ifdef TCL_THREADS
-extern int		TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Threadtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #endif
 #endif /* TCL_TEST */
 
@@ -49,9 +49,14 @@
  */
 
 int
+#ifdef _USING_PROTOTYPES_
+main (int    argc,		/* Number of command-line arguments. */
+     char **argv)		/* Values of command-line arguments. */
+#else
 main(argc, argv)
     int argc;			/* Number of command-line arguments. */
     char **argv;		/* Values of command-line arguments. */
+#endif
 {
     /*
      * Set up the default locale to be standard "C" locale so parsing
@@ -99,19 +104,28 @@
     }
     Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
             (Tcl_PackageInitProc *) NULL);
-    if (TclObjTest_Init(interp) == TCL_ERROR) {
+    if (Objtest_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Objtest", Objtest_Init,
+            (Tcl_PackageInitProc *) NULL);
+    if (Wintest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
+    Tcl_StaticPackage(interp, "Wintest", Wintest_Init,
+	    (Tcl_PackageInitProc *) NULL);
 #ifdef TCL_THREADS
-    if (TclThread_Init(interp) == TCL_ERROR) {
+    if (Thread_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
+    Tcl_StaticPackage(interp, "Threadtest", Threadtest_Init,
+            Threadtest_SafeInit);
 #endif
-    if (Procbodytest_Init(interp) == TCL_ERROR) {
+    if (Proctest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
-    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
-            Procbodytest_SafeInit);
+    Tcl_StaticPackage(interp, "Proctest", Proctest_Init,
+            Proctest_SafeInit);
 #endif /* TCL_TEST */
 
     /*
--- tcl8.2-8.2.3.orig/win/tclWin32Dll.c
+++ tcl8.2-8.2.3/win/tclWin32Dll.c
@@ -120,98 +120,6 @@
 
 TclWinProcs *tclWinProcs;
 static Tcl_Encoding tclWinTCharEncoding;
-
-/*
- * The following declaration is for the VC++ DLL entry point.
- */
-
-BOOL APIENTRY		DllMain(HINSTANCE hInst, DWORD reason, 
-				LPVOID reserved);
-
-
-#ifdef __WIN32__
-#ifndef STATIC_BUILD
-
-
-/*
- *----------------------------------------------------------------------
- *
- * DllEntryPoint --
- *
- *	This wrapper function is used by Borland to invoke the
- *	initialization code for Tcl.  It simply calls the DllMain
- *	routine.
- *
- * Results:
- *	See DllMain.
- *
- * Side effects:
- *	See DllMain.
- *
- *----------------------------------------------------------------------
- */
-
-BOOL APIENTRY
-DllEntryPoint(hInst, reason, reserved)
-    HINSTANCE hInst;		/* Library instance handle. */
-    DWORD reason;		/* Reason this function is being called. */
-    LPVOID reserved;		/* Not used. */
-{
-    return DllMain(hInst, reason, reserved);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DllMain --
- *
- *	This routine is called by the VC++ C run time library init
- *	code, or the DllEntryPoint routine.  It is responsible for
- *	initializing various dynamically loaded libraries.
- *
- * Results:
- *	TRUE on sucess, FALSE on failure.
- *
- * Side effects:
- *	Establishes 32-to-16 bit thunk and initializes sockets library.
- *
- *----------------------------------------------------------------------
- */
-BOOL APIENTRY
-DllMain(hInst, reason, reserved)
-    HINSTANCE hInst;		/* Library instance handle. */
-    DWORD reason;		/* Reason this function is being called. */
-    LPVOID reserved;		/* Not used. */
-{
-    switch (reason) {
-    case DLL_PROCESS_ATTACH:
-	if (hInstance != NULL) {
-	    /*
-	     * Prevents DLL from being loaded multiple times under Win32s,
-	     * since all copies of the DLL share the same data segment and
-	     * Tcl isn't set up to handle that.  Under NT or 95, each time 
-	     * the DLL is loaded, it gets its own private copy of the data 
-	     * segment.
-	     */
-
-	    return FALSE;
-	}
-
-	TclWinInit(hInst);
-	return TRUE;
-
-    case DLL_PROCESS_DETACH:
-	if (hInst == hInstance) {
-	    Tcl_Finalize();
-	}
-	break;
-    }
-
-    return TRUE; 
-}
-
-#endif /* !STATIC_BUILD */
-#endif /* __WIN32__ */
 
 /*
  *----------------------------------------------------------------------
--- tcl8.2-8.2.3.orig/win/tclWinChan.c
+++ tcl8.2-8.2.3/win/tclWinChan.c
@@ -652,8 +652,8 @@
 TclpOpenFileChannel(interp, fileName, modeString, permissions)
     Tcl_Interp *interp;			/* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName;			/* Name of file to open. */
-    char *modeString;			/* A list of POSIX open modes or
+    CONST char *fileName;		/* Name of file to open. */
+    CONST char *modeString;		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions;			/* If the open involves creating a
                                          * file, with what modes to create
@@ -762,7 +762,7 @@
 	}
         TclWinConvertError(err);
 	if (interp != (Tcl_Interp *) NULL) {
-            Tcl_AppendResult(interp, "couldn't open \"", fileName, "\": ",
+            Tcl_AppendResult(interp, "couldn't open \"", fileName, "\": ",
 			     Tcl_PosixError(interp), (char *) NULL);
         }
         Tcl_DStringFree(&buffer);
--- tcl8.2-8.2.3.orig/win/tclWinDde.c
+++ tcl8.2-8.2.3/win/tclWinDde.c
@@ -916,6 +916,7 @@
 	    }
 	    firstArg = 2;
 	    break;
+
 	case DDE_REQUEST:
 	    if (objc != 5) {
 		Tcl_WrongNumArgs(interp, 1, objv, 
--- tcl8.2-8.2.3.orig/win/tclWinFCmd.c
+++ tcl8.2-8.2.3/win/tclWinFCmd.c
@@ -195,11 +195,15 @@
      * char block device.
      */
 
+#ifndef __GNUC__
     __try {
+#endif
 	if ((*tclWinProcs->moveFileProc)(nativeSrc, nativeDst) != FALSE) {
 	    return TCL_OK;
 	}
+#ifndef __GNUC__
     } __except (-1) {}
+#endif
 
     TclWinConvertError(GetLastError());
 
@@ -484,11 +488,15 @@
      * block device.
      */
 
+#ifndef __GNUC__
     __try {
+#endif
 	if ((*tclWinProcs->copyFileProc)(nativeSrc, nativeDst, 0) != FALSE) {
 	    return TCL_OK;
 	}
+#ifndef __GNUC__
     } __except (-1) {}
+#endif
 
     TclWinConvertError(GetLastError());
     if (Tcl_GetErrno() == EBADF) {
--- tcl8.2-8.2.3.orig/win/tclWinFile.c
+++ tcl8.2-8.2.3/win/tclWinFile.c
@@ -16,7 +16,9 @@
 
 #include "tclWinInt.h"
 #include <sys/stat.h>
+#ifndef __GNUC__
 #include <shlobj.h>
+#endif
 #include <lmaccess.h>		/* For TclpGetUserHome(). */
 
 static time_t		ToCTime(FILETIME fileTime);
@@ -89,7 +91,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclpMatchFiles --
+ * TclpMatchFilesTypes --
  *
  *	This routine is used by the globbing code to search a
  *	directory for all files which match a given pattern.
@@ -107,14 +109,16 @@
  *---------------------------------------------------------------------- */
 
 int
-TclpMatchFiles(interp, separators, dirPtr, pattern, tail)
-    Tcl_Interp *interp;		/* Interpreter to receive results. */
-    char *separators;		/* Directory separators to pass to TclDoGlob. */
-    Tcl_DString *dirPtr;	/* Contains path to directory to search. */
-    char *pattern;		/* Pattern to match against. */
-    char *tail;			/* Pointer to end of pattern.  Tail must
-				 * point to a location in pattern. Must not
-				 * point to a static string. */
+TclpMatchFilesTypes(
+    Tcl_Interp *interp,		/* Interpreter to receive results. */
+    char *separators,		/* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,	/* Contains path to directory to search. */
+    char *pattern,		/* Pattern to match against. */
+    char *tail,			/* Pointer to end of pattern.  Tail must
+				 * point to a location in pattern and must
+				 * not be static.*/
+    GlobTypeData *types)	/* Object containing list of acceptable types.
+				 * May be NULL. */
 {
     char drivePat[] = "?:\\";
     const char *message;
@@ -128,6 +132,10 @@
     BOOL found;
     Tcl_DString ds;
     TCHAR *nativeName;
+    Tcl_Obj *resultPtr;
+
+    /* Until we actually handle types, we do this to avoid warnings */
+    types = NULL;     
 
     /*
      * Convert the path to normalized form since some interfaces only
@@ -270,6 +278,7 @@
      * Now iterate over all of the files in the directory.
      */
 
+    resultPtr = Tcl_GetObjResult(interp);
     for (found = 1; found != 0; 
 	    found = (*tclWinProcs->findNextFileProc)(handle, &data)) {
 	TCHAR *nativeMatchResult;
@@ -321,7 +330,8 @@
 	Tcl_DStringFree(&ds);
 
 	if (tail == NULL) {
-	    Tcl_AppendElement(interp, Tcl_DStringValue(dirPtr));
+            Tcl_ListObjAppendElement(interp, resultPtr, 
+				     Tcl_NewStringObj(Tcl_DStringValue(dirPtr),Tcl_DStringLength(dirPtr)));
 	} else {
 	    nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(dirPtr), 
 		    Tcl_DStringLength(dirPtr), &ds);
@@ -330,7 +340,7 @@
 
 	    if (attr & FILE_ATTRIBUTE_DIRECTORY) {
 		Tcl_DStringAppend(dirPtr, "/", 1);
-		result = TclDoGlob(interp, separators, dirPtr, tail);
+		result = TclDoGlob(interp, separators, dirPtr, tail, types);
 		if (result != TCL_OK) {
 		    break;
 		}
@@ -352,6 +362,25 @@
     Tcl_AppendResult(interp, message, Tcl_DStringValue(dirPtr), "\": ", 
 	    Tcl_PosixError(interp), (char *) NULL);
     return TCL_ERROR;
+}
+
+/* 
+ * TclpMatchFiles --
+ * 
+ * This function is now obsolete.  Call the above function 
+ * 'TclpMatchFilesTypes' instead.
+ */
+int
+TclpMatchFiles(
+    Tcl_Interp *interp,		/* Interpreter to receive results. */
+    char *separators,		/* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,	/* Contains path to directory to search. */
+    char *pattern,		/* Pattern to match against. */
+    char *tail)			/* Pointer to end of pattern.  Tail must
+				 * point to a location in pattern and must
+				 * not be static.*/
+{
+    return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL);
 }
 
 /*
--- tcl8.2-8.2.3.orig/win/tclWinInit.c
+++ tcl8.2-8.2.3/win/tclWinInit.c
@@ -139,7 +139,7 @@
 
     mainThreadId = GetCurrentThreadId();
 
-#ifdef STATIC_BUILD
+#if defined(STATIC_BUILD) && !defined(NO_STATIC_INIT)
     /*
      * If we are in a statically linked executable, then we need to
      * explicitly initialize the Windows function tables here since
--- tcl8.2-8.2.3.orig/win/tclWinLoad.c
+++ tcl8.2-8.2.3/win/tclWinLoad.c
@@ -38,7 +38,7 @@
 int
 TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
     Tcl_Interp *interp;		/* Used for error reporting. */
-    char *fileName;		/* Name of the file containing the desired
+    CONST char *fileName;	/* Name of the file containing the desired
 				 * code. */
     char *sym1, *sym2;		/* Names of two procedures to look up in
 				 * the file's symbol table. */
@@ -142,7 +142,7 @@
 
 int
 TclGuessPackageName(fileName, bufPtr)
-    char *fileName;		/* Name of file containing package (already
+    CONST char *fileName;	/* Name of file containing package (already
 				 * translated to local form if needed). */
     Tcl_DString *bufPtr;	/* Initialized empty dstring.  Append
 				 * package name to this if possible. */
--- tcl8.2-8.2.3.orig/win/tclWinSock.c
+++ tcl8.2-8.2.3/win/tclWinSock.c
@@ -35,44 +35,44 @@
 
 static struct {
     HINSTANCE hInstance;	/* Handle to WinSock library. */
-    SOCKET (PASCAL FAR *accept)(SOCKET s, struct sockaddr FAR *addr,
+    SOCKET (WINAPI *accept)(SOCKET s, struct sockaddr FAR *addr,
 	    int FAR *addrlen);
-    int (PASCAL FAR *bind)(SOCKET s, const struct sockaddr FAR *addr,
+    int (WINAPI *bind)(SOCKET s, const struct sockaddr FAR *addr,
 	    int namelen);
-    int (PASCAL FAR *closesocket)(SOCKET s);
-    int (PASCAL FAR *connect)(SOCKET s, const struct sockaddr FAR *name,
+    int (WINAPI *closesocket)(SOCKET s);
+    int (WINAPI *connect)(SOCKET s, const struct sockaddr FAR *name,
 	    int namelen);
-    int (PASCAL FAR *ioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
-    int (PASCAL FAR *getsockopt)(SOCKET s, int level, int optname,
+    int (WINAPI *ioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
+    int (WINAPI *getsockopt)(SOCKET s, int level, int optname,
 	    char FAR * optval, int FAR *optlen);
-    u_short (PASCAL FAR *htons)(u_short hostshort);
-    unsigned long (PASCAL FAR *inet_addr)(const char FAR * cp);
-    char FAR * (PASCAL FAR *inet_ntoa)(struct in_addr in);
-    int (PASCAL FAR *listen)(SOCKET s, int backlog);
-    u_short (PASCAL FAR *ntohs)(u_short netshort);
-    int (PASCAL FAR *recv)(SOCKET s, char FAR * buf, int len, int flags);
-    int (PASCAL FAR *select)(int nfds, fd_set FAR * readfds,
+    u_short (WINAPI *htons)(u_short hostshort);
+    unsigned long (WINAPI *inet_addr)(const char FAR * cp);
+    char FAR * (WINAPI *inet_ntoa)(struct in_addr in);
+    int (WINAPI *listen)(SOCKET s, int backlog);
+    u_short (WINAPI *ntohs)(u_short netshort);
+    int (WINAPI *recv)(SOCKET s, char FAR * buf, int len, int flags);
+    int (WINAPI *select)(int nfds, fd_set FAR * readfds,
 	    fd_set FAR * writefds, fd_set FAR * exceptfds,
 	    const struct timeval FAR * tiemout);
-    int (PASCAL FAR *send)(SOCKET s, const char FAR * buf, int len, int flags);
-    int (PASCAL FAR *setsockopt)(SOCKET s, int level, int optname,
+    int (WINAPI *send)(SOCKET s, const char FAR * buf, int len, int flags);
+    int (WINAPI *setsockopt)(SOCKET s, int level, int optname,
 	    const char FAR * optval, int optlen);
-    int (PASCAL FAR *shutdown)(SOCKET s, int how);
-    SOCKET (PASCAL FAR *socket)(int af, int type, int protocol);
-    struct hostent FAR * (PASCAL FAR *gethostbyname)(const char FAR * name);
-    struct hostent FAR * (PASCAL FAR *gethostbyaddr)(const char FAR *addr,
+    int (WINAPI *shutdown)(SOCKET s, int how);
+    SOCKET (WINAPI *socket)(int af, int type, int protocol);
+    struct hostent FAR * (WINAPI *gethostbyname)(const char FAR * name);
+    struct hostent FAR * (WINAPI *gethostbyaddr)(const char FAR *addr,
             int addrlen, int addrtype);
-    int (PASCAL FAR *gethostname)(char FAR * name, int namelen);
-    int (PASCAL FAR *getpeername)(SOCKET sock, struct sockaddr FAR *name,
+    int (WINAPI *gethostname)(char FAR * name, int namelen);
+    int (WINAPI *getpeername)(SOCKET sock, struct sockaddr FAR *name,
             int FAR *namelen);
-    struct servent FAR * (PASCAL FAR *getservbyname)(const char FAR * name,
+    struct servent FAR * (WINAPI *getservbyname)(const char FAR * name,
 	    const char FAR * proto);
-    int (PASCAL FAR *getsockname)(SOCKET sock, struct sockaddr FAR *name,
+    int (WINAPI *getsockname)(SOCKET sock, struct sockaddr FAR *name,
             int FAR *namelen);
-    int (PASCAL FAR *WSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
-    int (PASCAL FAR *WSACleanup)(void);
-    int (PASCAL FAR *WSAGetLastError)(void);
-    int (PASCAL FAR *WSAAsyncSelect)(SOCKET s, HWND hWnd, u_int wMsg,
+    int (WINAPI *WSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
+    int (WINAPI *WSACleanup)(void);
+    int (WINAPI *WSAGetLastError)(void);
+    int (WINAPI *WSAAsyncSelect)(SOCKET s, HWND hWnd, u_int wMsg,
 	    long lEvent);
 } winSock;
 
@@ -183,7 +183,7 @@
 static int		SocketEventProc _ANSI_ARGS_((Tcl_Event *evPtr,
 			    int flags));
 static void		SocketExitHandler _ANSI_ARGS_((ClientData clientData));
-static LRESULT CALLBACK	SocketProc _ANSI_ARGS_((HWND hwnd, UINT message,
+static LRESULT WINAPI	SocketProc _ANSI_ARGS_((HWND hwnd, UINT message,
 			    WPARAM wParam, LPARAM lParam));
 static void		SocketSetupProc _ANSI_ARGS_((ClientData clientData,
 			    int flags));
@@ -298,72 +298,72 @@
 	    return;
 	}
     
-	winSock.accept = (SOCKET (PASCAL FAR *)(SOCKET s,
+	winSock.accept = (SOCKET (WINAPI *)(SOCKET s,
 		struct sockaddr FAR *addr, int FAR *addrlen))
 	    GetProcAddress(winSock.hInstance, "accept");
-	winSock.bind = (int (PASCAL FAR *)(SOCKET s,
+	winSock.bind = (int (WINAPI *)(SOCKET s,
 		const struct sockaddr FAR *addr, int namelen))
 	    GetProcAddress(winSock.hInstance, "bind");
-	winSock.closesocket = (int (PASCAL FAR *)(SOCKET s))
+	winSock.closesocket = (int (WINAPI *)(SOCKET s))
 	    GetProcAddress(winSock.hInstance, "closesocket");
-	winSock.connect = (int (PASCAL FAR *)(SOCKET s,
+	winSock.connect = (int (WINAPI *)(SOCKET s,
 		const struct sockaddr FAR *name, int namelen))
 	    GetProcAddress(winSock.hInstance, "connect");
-	winSock.ioctlsocket = (int (PASCAL FAR *)(SOCKET s, long cmd,
+	winSock.ioctlsocket = (int (WINAPI *)(SOCKET s, long cmd,
 		u_long FAR *argp))
 	    GetProcAddress(winSock.hInstance, "ioctlsocket");
-	winSock.getsockopt = (int (PASCAL FAR *)(SOCKET s,
+	winSock.getsockopt = (int (WINAPI *)(SOCKET s,
 		int level, int optname, char FAR * optval, int FAR *optlen))
 	    GetProcAddress(winSock.hInstance, "getsockopt");
-	winSock.htons = (u_short (PASCAL FAR *)(u_short hostshort))
+	winSock.htons = (u_short (WINAPI *)(u_short hostshort))
 	    GetProcAddress(winSock.hInstance, "htons");
-	winSock.inet_addr = (unsigned long (PASCAL FAR *)(const char FAR *cp))
+	winSock.inet_addr = (unsigned long (WINAPI *)(const char FAR *cp))
 	    GetProcAddress(winSock.hInstance, "inet_addr");
-	winSock.inet_ntoa = (char FAR * (PASCAL FAR *)(struct in_addr in))
+	winSock.inet_ntoa = (char FAR * (WINAPI *)(struct in_addr in))
 	    GetProcAddress(winSock.hInstance, "inet_ntoa");
-	winSock.listen = (int (PASCAL FAR *)(SOCKET s, int backlog))
+	winSock.listen = (int (WINAPI *)(SOCKET s, int backlog))
 	    GetProcAddress(winSock.hInstance, "listen");
-	winSock.ntohs = (u_short (PASCAL FAR *)(u_short netshort))
+	winSock.ntohs = (u_short (WINAPI *)(u_short netshort))
 	    GetProcAddress(winSock.hInstance, "ntohs");
-	winSock.recv = (int (PASCAL FAR *)(SOCKET s, char FAR * buf,
+	winSock.recv = (int (WINAPI *)(SOCKET s, char FAR * buf,
 		int len, int flags)) GetProcAddress(winSock.hInstance, "recv");
-	winSock.select = (int (PASCAL FAR *)(int nfds, fd_set FAR * readfds,
+	winSock.select = (int (WINAPI *)(int nfds, fd_set FAR * readfds,
 		fd_set FAR * writefds, fd_set FAR * exceptfds,
 		const struct timeval FAR * tiemout))
 	    GetProcAddress(winSock.hInstance, "select");
-	winSock.send = (int (PASCAL FAR *)(SOCKET s, const char FAR * buf,
+	winSock.send = (int (WINAPI *)(SOCKET s, const char FAR * buf,
 		int len, int flags)) GetProcAddress(winSock.hInstance, "send");
-	winSock.setsockopt = (int (PASCAL FAR *)(SOCKET s, int level,
+	winSock.setsockopt = (int (WINAPI *)(SOCKET s, int level,
 		int optname, const char FAR * optval, int optlen))
 	    GetProcAddress(winSock.hInstance, "setsockopt");
-	winSock.shutdown = (int (PASCAL FAR *)(SOCKET s, int how))
+	winSock.shutdown = (int (WINAPI *)(SOCKET s, int how))
 	    GetProcAddress(winSock.hInstance, "shutdown");
-	winSock.socket = (SOCKET (PASCAL FAR *)(int af, int type,
+	winSock.socket = (SOCKET (WINAPI *)(int af, int type,
 		int protocol)) GetProcAddress(winSock.hInstance, "socket");
-	winSock.gethostbyaddr = (struct hostent FAR * (PASCAL FAR *)
+	winSock.gethostbyaddr = (struct hostent FAR * (WINAPI *)
 		(const char FAR *addr, int addrlen, int addrtype))
 	    GetProcAddress(winSock.hInstance, "gethostbyaddr");
-	winSock.gethostbyname = (struct hostent FAR * (PASCAL FAR *)
+	winSock.gethostbyname = (struct hostent FAR * (WINAPI *)
 		(const char FAR *name))
 	    GetProcAddress(winSock.hInstance, "gethostbyname");
-	winSock.gethostname = (int (PASCAL FAR *)(char FAR * name,
+	winSock.gethostname = (int (WINAPI *)(char FAR * name,
 		int namelen)) GetProcAddress(winSock.hInstance, "gethostname");
-	winSock.getpeername = (int (PASCAL FAR *)(SOCKET sock,
+	winSock.getpeername = (int (WINAPI *)(SOCKET sock,
 		struct sockaddr FAR *name, int FAR *namelen))
 	    GetProcAddress(winSock.hInstance, "getpeername");
-	winSock.getservbyname = (struct servent FAR * (PASCAL FAR *)
+	winSock.getservbyname = (struct servent FAR * (WINAPI *)
 		(const char FAR * name, const char FAR * proto))
 	    GetProcAddress(winSock.hInstance, "getservbyname");
-	winSock.getsockname = (int (PASCAL FAR *)(SOCKET sock,
+	winSock.getsockname = (int (WINAPI *)(SOCKET sock,
 		struct sockaddr FAR *name, int FAR *namelen))
 	    GetProcAddress(winSock.hInstance, "getsockname");
-	winSock.WSAStartup = (int (PASCAL FAR *)(WORD wVersionRequired,
+	winSock.WSAStartup = (int (WINAPI *)(WORD wVersionRequired,
 		LPWSADATA lpWSAData)) GetProcAddress(winSock.hInstance, "WSAStartup");
-	winSock.WSACleanup = (int (PASCAL FAR *)(void))
+	winSock.WSACleanup = (int (WINAPI *)(void))
 	    GetProcAddress(winSock.hInstance, "WSACleanup");
-	winSock.WSAGetLastError = (int (PASCAL FAR *)(void))
+	winSock.WSAGetLastError = (int (WINAPI *)(void))
 	    GetProcAddress(winSock.hInstance, "WSAGetLastError");
-	winSock.WSAAsyncSelect = (int (PASCAL FAR *)(SOCKET s, HWND hWnd,
+	winSock.WSAAsyncSelect = (int (WINAPI *)(SOCKET s, HWND hWnd,
 		u_int wMsg, long lEvent))
 	    GetProcAddress(winSock.hInstance, "WSAAsyncSelect");
     
@@ -1372,8 +1372,8 @@
 Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
     Tcl_Interp *interp;			/* For error reporting; can be NULL. */
     int port;				/* Port number to open. */
-    char *host;				/* Host on which to open port. */
-    char *myaddr;			/* Client-side address */
+    CONST char *host;			/* Host on which to open port. */
+    CONST char *myaddr;			/* Client-side address */
     int myport;				/* Client-side port */
     int async;				/* If nonzero, should connect
                                          * client socket asynchronously. */
@@ -1488,7 +1488,7 @@
     Tcl_Interp *interp;			/* For error reporting - may be
                                          * NULL. */
     int port;				/* Port number to open. */
-    char *host;				/* Name of local host. */
+    CONST char *host;			/* Name of local host. */
     Tcl_TcpAcceptProc *acceptProc;	/* Callback for accepting connections
                                          * from new clients. */
     ClientData acceptProcData;		/* Data for the callback. */
@@ -2197,7 +2197,7 @@
  *----------------------------------------------------------------------
  */
 
-static LRESULT CALLBACK
+static LRESULT WINAPI
 SocketProc(hwnd, message, wParam, lParam)
     HWND hwnd;
     UINT message;
--- tcl8.2-8.2.3.orig/win/tclWinTest.c
+++ tcl8.2-8.2.3/win/tclWinTest.c
@@ -14,8 +14,18 @@
 #include "tclWinInt.h"
 
 /*
+ * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+ * Wintest_Init declaration is in the source file itself, which is only
+ * accessed when we are building a library.
+ */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
+
+/*
  * Forward declarations of procedures defined later in this file:
  */
+EXTERN int		Wintest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 int			TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
 static int		TesteventloopCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
@@ -23,10 +33,10 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclplatformtestInit --
+ * Wintest_Init --
  *
  *	Defines commands that test platform specific functionality for
- *	Unix platforms.
+ *	Windows platforms.
  *
  * Results:
  *	A standard Tcl result.
@@ -38,9 +48,20 @@
  */
 
 int
-TclplatformtestInit(interp)
+#ifdef _USING_PROTOTYPES_
+Wintest_Init(
+    Tcl_Interp *interp)		/* Interpreter to add commands to. */
+#else
+Wintest_Init(interp)
     Tcl_Interp *interp;		/* Interpreter to add commands to. */
+#endif
 {
+    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+	return TCL_ERROR;
+    }
+    if (Tcl_PkgProvide(interp, "Wintest", TCL_VERSION) != TCL_OK) {
+        return TCL_ERROR;
+    }
     /*
      * Add commands for platform specific tests for Windows here.
      */
@@ -53,6 +74,35 @@
 /*
  *----------------------------------------------------------------------
  *
+ * Tclplatformtest_Init --
+ *
+ *	Defines commands that test platform specific functionality for
+ *	Windows platforms.
+ *
+ * Results:
+ *	A standard Tcl result.
+ *
+ * Side effects:
+ *	Defines new commands.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+#ifdef _USING_PROTOTYPES_
+TclplatformtestInit (
+    Tcl_Interp *interp)		/* Interpreter to add commands to. */
+#else
+TclplatformtestInit(interp)
+    Tcl_Interp *interp;		/* Interpreter to add commands to. */
+#endif
+{
+    return Wintest_Init(interp);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
  * TesteventloopCmd --
  *
  *	This procedure implements the "testeventloop" command. It is
@@ -69,11 +119,19 @@
  */
 
 static int
+#ifdef _USING_PROTOTYPES_
+TesteventloopCmd (
+    ClientData clientData,		/* Not used. */
+    Tcl_Interp *interp,			/* Current interpreter. */
+    int argc,				/* Number of arguments. */
+    char **argv)			/* Argument strings. */
+#else
 TesteventloopCmd(clientData, interp, argc, argv)
     ClientData clientData;		/* Not used. */
     Tcl_Interp *interp;			/* Current interpreter. */
     int argc;				/* Number of arguments. */
     char **argv;			/* Argument strings. */
+#endif
 {
     static int *framePtr = NULL; /* Pointer to integer on stack frame of
 				  * innermost invocation of the "wait"
--- tcl8.2-8.2.3.orig/win/tclWinPort.h
+++ tcl8.2-8.2.3/win/tclWinPort.h
@@ -65,7 +65,7 @@
 
 #include <tchar.h>
 #include <time.h>
-#include <winsock2.h>
+#include <winsock.h>
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -334,7 +334,7 @@
  * EDEADLK as the same value, which confuses Tcl_ErrnoId().
  */
 
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__GNUC__)
 #    define environ _environ
 #    define hypot _hypot
 #    define exception _exception
--- tcl8.2-8.2.3.orig/win/makefile.vc
+++ tcl8.2-8.2.3/win/makefile.vc
@@ -1,4 +1,4 @@
-# Visual C++ 2.x and 4.0 makefile
+# Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile
 #
 # See the file "license.terms" for information on usage and redistribution
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -35,9 +35,14 @@
 #
 
 ROOT		= ..
-TOOLS32		= c:\program files\devstudio\vc
+#TOOLS32	= c:\msdev						# VC++ 2.x,4.x
+#TOOLS32_rc	= c:\msdev
+TOOLS32		= c:\program files\devstudio\vc				# VC++ 5.x
 TOOLS32_rc	= c:\program files\devstudio\sharedide
-TOOLS16		= c:\msvc
+#TOOLS32 	= c:\program files\microsoft visual studio\vc98		# VC++ 6.x
+#TOOLS32_rc	= c:\program files\microsoft visual studio\common\msdev98
+TOOLS16		= c:\msvcx
+GNUTOOLS	= c:\cygwin\b20\bin
 
 INSTALLDIR	= c:\program files\Tcl
 
@@ -45,10 +50,36 @@
 MACHINE	= IX86
 
 # Uncomment the following line to compile with thread support
-#THREADDEFINES = -DTCL_THREADS=1
+THREADDEFINES = -DTCL_THREADS=1
 
-# Set NODEBUG to 0 to compile with symbols
-NODEBUG = 1
+!IF "$(CFG)" == ""
+CFG=tcl82plus - Win32 Release
+!MESSAGE No configuration specified. Defaulting to tcl82plus - Win32 Release.
+!ENDIF
+
+# If the configuration is not one we know, die with a nice error message.
+
+!IF "$(CFG)" != "tcl82plus - Win32 Release" && \
+	"$(CFG)" != "tcl82plus - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "makefile.vc" CFG="tcl82plus - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "tcl82plus - Win32 Release" (based on "Win32 (x86) DLL")
+!MESSAGE "tcl82plus - Win32 Debug" (based on "Win32 (x86) DLL")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(CFG)" == "tcl82plus - Win32 Release"
+NODEBUG=1
+!ELSE
+NODEBUG=0
+!ENDIF
 
 # The following defines can be used to control the amount of debugging
 # code that is added to the compilation.
@@ -72,6 +103,11 @@
 DOTVERSION = 8.2
 VERSION = 82
 
+INST_BIN = $(DESTDIR)\bin
+INST_INCLUDE = $(DESTDIR)\include
+INST_LIB = $(DESTDIR)\lib
+INST_RUNTIME = $(INST_LIB)\tcl$(DOTVERSION)
+
 BINROOT		= .
 !IF "$(NODEBUG)" == "1"
 TMPDIRNAME	= Release
@@ -85,12 +121,24 @@
 OUTDIR		= $(TMPDIR)
 
 TCLLIB		= $(OUTDIR)\$(NAMEPREFIX)$(VERSION)$(DBGX).lib
+TCLLIBS		= $(OUTDIR)\$(NAMEPREFIX)$(VERSION)s$(DBGX).lib
 TCLDLLNAME	= $(NAMEPREFIX)$(VERSION)$(DBGX).dll
 TCLDLL		= $(OUTDIR)\$(TCLDLLNAME)
+TCLARCHIVENAME  = lib$(NAMEPREFIX)$(VERSION)$(DBGX).a
+TCLARCHIVE      = $(OUTDIR)\$(TCLARCHIVENAME)
 
 TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION)$(DBGX).lib
 TCLSTUBLIB	= $(OUTDIR)\$(TCLSTUBLIBNAME)
 
+TESTDLLNAME	= $(NAMEPREFIX)test.dll
+TESTDLL		= $(OUTDIR)\$(TESTDLLNAME)
+OBJTESTDLLNAME	= objtest$(DBGX).dll
+OBJTESTDLL	= $(OUTDIR)\$(OBJTESTDLLNAME)
+TCLPTESTDLLNAME	= tclptest$(DBGX).dll
+TCLPTESTDLL	= $(OUTDIR)\$(TCLPTESTDLLNAME)
+PROCTESTDLLNAME	= proctest$(DBGX).dll
+PROCTESTDLL	= $(OUTDIR)\$(PROCTESTDLLNAME)
+
 TCLPLUGINLIB	= $(OUTDIR)\$(NAMEPREFIX)$(VERSION)p$(DBGX).lib
 TCLPLUGINDLLNAME= $(NAMEPREFIX)$(VERSION)p$(DBGX).dll
 TCLPLUGINDLL	= $(OUTDIR)\$(TCLPLUGINDLLNAME)
@@ -103,7 +151,6 @@
 TCLREGDLL	= $(OUTDIR)\$(TCLREGDLLNAME)
 TCLDDEDLLNAME	= $(NAMEPREFIX)dde$(VERSION)$(DBGX).dll
 TCLDDEDLL	= $(OUTDIR)\$(TCLDDEDLLNAME)
-TCLTEST		= $(OUTDIR)\$(NAMEPREFIX)test.exe
 DUMPEXTS	= $(TMPDIR)\dumpexts.exe
 CAT16		= $(TMPDIR)\cat16.exe
 CAT32		= $(TMPDIR)\cat32.exe
@@ -119,14 +166,6 @@
 TCLSHOBJS = \
 	$(TMPDIR)\tclAppInit.obj
 
-TCLTESTOBJS = \
-	$(TMPDIR)\tclTest.obj \
-	$(TMPDIR)\tclTestObj.obj \
-	$(TMPDIR)\tclTestProcBodyObj.obj \
-	$(TMPDIR)\tclThreadTest.obj \
-	$(TMPDIR)\tclWinTest.obj \
-	$(TMPDIR)\testMain.obj
-
 TCLOBJS = \
 	$(TMPDIR)\regcomp.obj \
 	$(TMPDIR)\regexec.obj \
@@ -165,7 +204,8 @@
 	$(TMPDIR)\tclLiteral.obj \
 	$(TMPDIR)\tclListObj.obj \
 	$(TMPDIR)\tclLoad.obj \
-	$(TMPDIR)\tclMain.obj \
+	$(TMPDIR)\tclLoadWin.obj \
+	$(TMPDIR)\tclStdMain.obj \
 	$(TMPDIR)\tclNamesp.obj \
 	$(TMPDIR)\tclNotify.obj \
 	$(TMPDIR)\tclObj.obj \
@@ -183,7 +223,6 @@
 	$(TMPDIR)\tclScan.obj \
 	$(TMPDIR)\tclStringObj.obj \
 	$(TMPDIR)\tclStubInit.obj \
-	$(TMPDIR)\tclStubLib.obj \
 	$(TMPDIR)\tclThread.obj \
 	$(TMPDIR)\tclTimer.obj \
 	$(TMPDIR)\tclUtf.obj \
@@ -198,14 +237,21 @@
 	$(TMPDIR)\tclWinFile.obj \
 	$(TMPDIR)\tclWinInit.obj \
 	$(TMPDIR)\tclWinLoad.obj \
+	$(TMPDIR)\tclWinPipe.obj \
 	$(TMPDIR)\tclWinMtherr.obj \
 	$(TMPDIR)\tclWinNotify.obj \
-	$(TMPDIR)\tclWinPipe.obj \
 	$(TMPDIR)\tclWinSock.obj \
 	$(TMPDIR)\tclWinThrd.obj \
-	$(TMPDIR)\tclWinTime.obj 
+	$(TMPDIR)\tclWinTty.obj \
+	$(TMPDIR)\tclWinTime.obj
 
 TCLSTUBOBJS = $(TMPDIR)\tclStubLib.obj \
+	$(TMPDIR)\tclWinTty.obj \
+	$(TMPDIR)\tclLoadWinStub.obj
+
+TCLDLLOBJS = \
+	$(TCLOBJS) \
+	$(TMPDIR)\tclWinEntry.obj
 
 cc32		= "$(TOOLS32)\bin\cl.exe"
 link32		= "$(TOOLS32)\bin\link.exe"
@@ -220,6 +266,7 @@
 
 WINDIR		= $(ROOT)\win
 GENERICDIR	= $(ROOT)\generic
+LIBDIR		= $(ROOT)\library
 
 TCL_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR)
 TCL_DEFINES	= -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
@@ -227,7 +274,7 @@
 TCL_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
 			$(TCL_INCLUDES) $(TCL_DEFINES)
 CON_CFLAGS	= $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
-DOS_CFLAGS	= $(cdebug) $(cflags) $(include16) -AL 
+DOS_CFLAGS	= $(cflags) $(include16) -AL 
 DLL16_CFLAGS	= $(cdebug) $(cflags) $(include16) -ALw
 
 ######################################################################
@@ -315,15 +362,19 @@
 # Project specific targets
 ######################################################################
 
-release:    setup $(TCLSH) dlls
+release:    setup $(TCLSH) $(TCLLIB) $(TCLSTUBLIB) $(TCLARCHIVE) dlls
 dlls:	    setup $(TCL16DLL) $(TCLPIPEDLL) $(TCLREGDLL) $(TCLDDEDLL)
-all:	    setup $(TCLSH) dlls $(CAT16) $(CAT32) 
-tcltest:    setup $(TCLTEST) dlls $(CAT16) $(CAT32)
+all:	    release $(CAT16) $(CAT32) 
+tcltest:    setup $(TCLSH) dlls $(CAT16) $(CAT32) $(TESTDLL) \
+		$(OBJTESTDLL) $(TCLPTESTDLL) $(PROCTESTDLL) $(OUTDIR)\pkgIndex.tcl
 plugin:	    setup $(TCLPLUGINDLL) $(TCLSHP)
 install:    install-binaries install-libraries
-test:	    setup $(TCLTEST) dlls $(CAT16) $(CAT32)
+test:	    setup tcltest $(CAT16) $(CAT32)
 	set TCL_LIBRARY=$(ROOT)/library
-	$(TCLTEST) $(ROOT)/tests/all.tcl
+	$(TCLSH) $(ROOT)/tests/all.tcl
+
+$(OUTDIR)\pkgIndex.tcl:	pkgIndex.reg pkgIndex.dde
+    copy pkgIndex.reg+pkgIndex.dde $@
 
 setup:
 	@$(MKDIR) $(TMPDIR)
@@ -335,13 +386,24 @@
 	$(link32) $(ldebug) $(conlflags) $(guilibs) -out:$@ \
 		$(TMPDIR)\winDumpExts.obj 
 
+$(TCLARCHIVE): $(TCLDLL) $(TMPDIR)\tclgnu.def
+	set PATH=$(GNUTOOLS)
+	if exist $(GNUTOOLS)\dlltool.exe dlltool --as=as --dllname $(TCLDLLNAME) \
+	  --def $(TMPDIR)/tclgnu.def --output-lib $(OUTDIR)/$(TCLARCHIVENAME)
+
+$(TCLLIBS): $(TCLOBJS)
+      @del $(TCLLIBS)
+        $(lib32) -out:$(TCLLIBS) @<<
+$(TCLOBJS)
+<<
+
 $(TCLLIB): $(TCLDLL)
 
-$(TCLDLL): $(TCLOBJS) $(TMPDIR)\tcl.def $(TMPDIR)\tcl.res
+$(TCLDLL): $(TCLDLLOBJS) $(TMPDIR)\tcl.def $(TMPDIR)\tcl.res
 	set LIB="$(TOOLS32)\lib"
 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tcl.def \
 		-out:$@ $(TMPDIR)\tcl.res $(guilibsdll) @<<
-$(TCLOBJS)
+$(TCLDLLOBJS)
 <<
 
 $(TCLSTUBLIB): $(TCLSTUBOBJS)
@@ -349,11 +411,11 @@
 
 $(TCLPLUGINLIB): $(TCLPLUGINDLL)
 
-$(TCLPLUGINDLL): $(TCLOBJS) $(TMPDIR)\plugin.def $(TMPDIR)\tcl.res
+$(TCLPLUGINDLL): $(TCLDLLOBJS) $(TMPDIR)\plugin.def $(TMPDIR)\tcl.res
 	set LIB="$(TOOLS32)\lib"
 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\plugin.def \
 		-out:$@ $(TMPDIR)\tcl.res $(guilibsdll) @<<
-$(TCLOBJS)
+$(TCLDLLOBJS)
 <<
 
 $(TCLSH): $(TCLSHOBJS) $(TCLLIB) $(TMPDIR)\tclsh.res
@@ -366,11 +428,6 @@
 	$(link32) $(ldebug) $(conlflags) $(TMPDIR)\tclsh.res -stack:2300000 \
 		-out:$@ $(conlibsdll) $(TCLPLUGINLIB) $(TCLSHOBJS) 
 
-$(TCLTEST): $(TCLTESTOBJS) $(TCLLIB) $(TMPDIR)\tclsh.res
-	set LIB="$(TOOLS32)\lib"
-	$(link32) $(ldebug) $(conlflags) $(TMPDIR)\tclsh.res -stack:2300000 \
-		 -out:$@ $(conlibsdll) $(TCLLIB) $(TCLTESTOBJS)
-
 $(TCL16DLL):  $(WINDIR)\tcl16.rc $(WINDIR)\tclWin16.c
 	if exist $(cc16) $(cc16) @<<
 $(DLL16_CFLAGS) -Fo$(TMPDIR)\ $(WINDIR)\tclWin16.c
@@ -409,6 +466,26 @@
 	$(link32) $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)\tclWinReg.obj \
 		$(conlibsdll) $(TCLSTUBLIB)
 
+$(TESTDLL): $(TMPDIR)\tclTest.obj $(TCLSTUBLIB)
+	set LIB="$(TOOLS32)\lib"
+	$(link32) $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)\tclTest.obj \
+		$(conlibsdll) $(TCLSTUBLIB)
+
+$(OBJTESTDLL): $(TMPDIR)\tclTestObj.obj $(TCLSTUBLIB)
+	set LIB="$(TOOLS32)\lib"
+	$(link32) $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)\tclTestObj.obj \
+		$(conlibsdll) $(TCLSTUBLIB)
+
+$(TCLPTESTDLL): $(TMPDIR)\tclWinTest.obj $(TCLSTUBLIB)
+	set LIB="$(TOOLS32)\lib"
+	$(link32) $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)\tclWinTest.obj \
+		$(conlibsdll) $(TCLSTUBLIB)
+
+$(PROCTESTDLL): $(TMPDIR)\tclTestProcBodyObj.obj $(TCLSTUBLIB)
+	set LIB="$(TOOLS32)\lib"
+	$(link32) $(ldebug) $(dlllflags) -out:$@ $(TMPDIR)\tclTestProcBodyObj.obj \
+		$(conlibsdll) $(TCLSTUBLIB)
+
 $(CAT32): $(WINDIR)\cat.c
 	$(cc32) $(CON_CFLAGS) -Fo$(TMPDIR)\ $?
 	set LIB="$(TOOLS32)\lib"
@@ -420,19 +497,53 @@
 	if exist $(cc16) $(link16) /NOLOGO /ONERROR:NOEXE /NOI /STACK:16384 \
 		$(TMPDIR)\cat.obj,$@,nul,llibce.lib,nul
 
-$(TMPDIR)\tcl.def: $(DUMPEXTS) $(TCLOBJS)
+$(TMPDIR)\tcl.def: $(DUMPEXTS) $(TCLDLLOBJS)
 	$(DUMPEXTS) -o $@ $(TCLDLLNAME) @<<
-$(TCLOBJS)
+$(TCLDLLOBJS)
 <<
 
-$(TMPDIR)\plugin.def: $(DUMPEXTS) $(TCLOBJS)
+$(TMPDIR)\plugin.def: $(DUMPEXTS) $(TCLDLLOBJS)
 	$(DUMPEXTS) -o $@ $(TCLPLUGINDLLNAME) @<<
-$(TCLOBJS)
+$(TCLDLLOBJS)
+<<
+
+$(TMPDIR)\tclgnu.def: $(DUMPEXTS) $(TCLDLLOBJS)
+	$(DUMPEXTS) -o $@ -g $(TCLDLLNAME) @<<
+$(TCLDLLOBJS)
+<<
+
+$(TMPDIR)\tclreg.def: $(DUMPEXTS) $(TMPDIR)\tclWinReg.obj
+	$(DUMPEXTS) -o $@ $(TCLREGDLLNAME) @<<
+$(TMPDIR)\tclWinReg.obj
+<<
+
+$(TMPDIR)\tcltest.def: $(DUMPEXTS) $(TMPDIR)\tclTest.obj
+	$(DUMPEXTS) -o $@ $(TESTDLLNAME) @<<
+$(TMPDIR)\tclTest.obj
+<<
+
+$(TMPDIR)\objtest.def: $(DUMPEXTS) $(TMPDIR)\tclTestObj.obj
+	$(DUMPEXTS) -o $@ $(OBJTESTDLLNAME) @<<
+$(TMPDIR)\tclTestObj.obj
+<<
+
+$(TMPDIR)\proctest.def: $(DUMPEXTS) $(TMPDIR)\tclTestProcBodyObj.obj
+	$(DUMPEXTS) -o $@ $(PROCTESTDLLNAME) @<<
+$(TMPDIR)\tclTestProcBodyObj.obj
+<<
+
+$(TMPDIR)\tclptest.def: $(DUMPEXTS) $(TMPDIR)\tclWinTest.obj
+	$(DUMPEXTS) -o $@ $(TCLPTESTDLLNAME) @<<
+$(TMPDIR)\tclWinTest.obj
 <<
 
 install-binaries: $(TCLSH)
-	$(MKDIR) "$(BIN_INSTALL_DIR)"
-	$(MKDIR) "$(LIB_INSTALL_DIR)"
+	-@$(MKDIR) "$(BIN_INSTALL_DIR)"
+	-@$(MKDIR) "$(LIB_INSTALL_DIR)"
+	-@$(MKDIR) "$(INCLUDE_INSTALL_DIR)"
+	@echo installing header files
+	-@copy "$(GENERICDIR)\tcl.h"         "$(INCLUDE_INSTALL_DIR)"
+	-@copy "$(GENERICDIR)\tclDecls.h"    "$(INCLUDE_INSTALL_DIR)"
 	@echo installing $(TCLDLLNAME)
 	@copy "$(TCLDLL)" "$(BIN_INSTALL_DIR)"
 	@copy "$(TCLLIB)" "$(LIB_INSTALL_DIR)"
@@ -466,17 +577,15 @@
 	@echo installing $(TCLDDEDLLNAME)
 	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\dde1.1"
 	-@copy "$(TCLDDEDLL)" "$(SCRIPT_INSTALL_DIR)\dde1.1"
-	-@copy "$(ROOT)\library\dde1.1\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\dde1.1"
+	-@copy "pkgIndex.dde" "$(SCRIPT_INSTALL_DIR)\dde1.1\pkgIndex.tcl"
 	@echo installing $(TCLREGDLLNAME)
 	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\reg1.0"
 	-@copy "$(TCLREGDLL)" "$(SCRIPT_INSTALL_DIR)\reg1.0"
-	-@copy "$(ROOT)\library\reg1.0\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\reg1.0"
+	-@copy "pkgIndex.reg""$(SCRIPT_INSTALL_DIR)\reg1.0\pkgIndex.tcl"
 	@echo installing encoding files
 	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\encoding"
 	-@copy "$(ROOT)\library\encoding\*.enc" "$(SCRIPT_INSTALL_DIR)\encoding"
 	@echo installing library files
-	-@copy "$(GENERICDIR)\tcl.h"         "$(INCLUDE_INSTALL_DIR)"
-	-@copy "$(GENERICDIR)\tclDecls.h"    "$(INCLUDE_INSTALL_DIR)"
 	-@copy "$(ROOT)\library\history.tcl" "$(SCRIPT_INSTALL_DIR)"
 	-@copy "$(ROOT)\library\init.tcl"    "$(SCRIPT_INSTALL_DIR)"
 	-@copy "$(ROOT)\library\ldAout.tcl"  "$(SCRIPT_INSTALL_DIR)"
@@ -500,22 +609,25 @@
 #
 
 $(TMPDIR)\tclWinInit.obj: $(WINDIR)\tclWinInit.c
-	$(cc32) -DBUILD_tcl $(TCL_CFLAGS) $(EXTFLAGS) -Fo$(TMPDIR)\ $?
+	$(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD $(EXTFLAGS) -Fo$(TMPDIR)\ $?
 
 $(TMPDIR)\testMain.obj: $(WINDIR)\tclAppInit.c
-	$(cc32) $(TCL_CFLAGS) -DTCL_TEST -Fo$(TMPDIR)\testMain.obj $?
+	$(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -DTCL_TEST -Fo$(TMPDIR)\testMain.obj $?
 
 $(TMPDIR)\tclTest.obj: $(GENERICDIR)\tclTest.c
-	$(cc32) $(TCL_CFLAGS) -Fo$@ $?
+	$(cc32) $(TCL_CFLAGS) -DUSE_TCL_STUBS -DNO_PLATFORM_TEST -Fo$@ $?
 
 $(TMPDIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c
-	$(cc32) $(TCL_CFLAGS) -Fo$@ $?
+	$(cc32) $(TCL_CFLAGS) -DUSE_TCL_STUBS -Fo$@ $?
+
+$(TMPDIR)\tclTestProcBodyObj.obj: $(GENERICDIR)\tclTestProcBodyObj.c
+	$(cc32) $(TCL_CFLAGS) -DUSE_TCL_STUBS -Fo$@ $?
 
 $(TMPDIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
-	$(cc32) $(TCL_CFLAGS) -Fo$@ $?
+	$(cc32) $(TCL_CFLAGS) -DUSE_TCL_STUBS -Fo$@ $?
 
 $(TMPDIR)\tclAppInit.obj : $(WINDIR)\tclAppInit.c
-	$(cc32) $(TCL_CFLAGS) -Fo$@ $?
+	$(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$@ $?
 
 # The following objects should be built using the stub interfaces
 
@@ -531,6 +643,8 @@
 $(TMPDIR)\tclStubLib.obj : $(GENERICDIR)\tclStubLib.c
 	$(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$@ $?
 
+$(TMPDIR)\tclLoadWinStub.obj : $(WINDIR)\tclLoadWin.c
+	$(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -DUSE_TCL_STUBS -Fo$@ $?
 
 # Dedependency rules
 
@@ -558,13 +672,13 @@
 #
 
 {$(WINDIR)}.c{$(TMPDIR)}.obj:
-    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMPDIR)\ $<
+    $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
 
 {$(GENERICDIR)}.c{$(TMPDIR)}.obj:
-    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMPDIR)\ $<
+    $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
 
 {$(ROOT)\compat}.c{$(TMPDIR)}.obj:
-    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMPDIR)\ $<
+    $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
 
 {$(WINDIR)}.rc{$(TMPDIR)}.res:
 	$(rc32) -fo $@ -r -i $(GENERICDIR) -i $(WINDIR) -D__WIN32__ \
@@ -581,5 +695,5 @@
 	-@$(RM) $(TMPDIR)\*.res
 	-@$(RM) $(TMPDIR)\*.def
 	-@$(RM) $(TMPDIR)\*.exe
-	-@$(RMDIR) $(OUTDIR)
-	-@$(RMDIR) $(TMPDIR)
+	-@rmd $(OUTDIR)
+	-@rmd $(TMPDIR)
--- tcl8.2-8.2.3.orig/win/Makefile.gnu
+++ tcl8.2-8.2.3/win/Makefile.gnu
@@ -0,0 +1,663 @@
+# Generated automatically from Makefile.in by configure.
+# Copyright (c) 1995-1996 Sun Microsystems, Inc.
+
+# This file is CYGNUS LOCAL.  It is a copy of makefile.vc from the
+# standard tcl distribution, modified to work with cygwin32 and an
+# autoconf configure script.  I have chosen to minimize the number of
+# changes, so the comments continue to refer to Visual C++ and the
+# like.  This should make it easier to merge in a new version if that
+# is necessary.
+
+prefix = /usr/local
+exec_prefix = /usr/local
+VPATH = .:./../generic:./../compat
+srcdir = .
+
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+
+CC = gcc
+CFLAGS = -O2 -DSTATIC_BUILD -DTCL_THREADS -mno-cygwin -DHAVE_TM_ZONE
+NM = nm
+AR = ar
+AS = as
+LD = ld
+DLLTOOL = dlltool
+WINDRES = windres
+DLLWRAP = dllwrap -mno-cygwin
+
+DLL_LDFLAGS = -mwindows -Wl,-e,_DllMain@12 
+DLL_LDLIBS = 
+
+# Current Tcl version;  used in various names.
+
+DIRVERSION = 8.2
+
+# The following definition can be set to non-null for special systems
+# like AFS with replication.  It allows the pathnames used for installation
+# to be different than those used for actually reference files at
+# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
+# when installing files.
+INSTALL_ROOT =
+
+# Directory from which applications will reference the library of Tcl
+# scripts (note: you can set the TCL_LIBRARY environment variable at
+# run-time to override this value):
+TCL_LIBRARY =	${prefix}/lib/tcl$(DIRVERSION)
+
+# Path name to use when installing library scripts:
+SCRIPT_INSTALL_DIR =	$(INSTALL_ROOT)$(TCL_LIBRARY)
+
+# Directory in which to install libtcl.so or libtcl.a:
+LIB_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/lib
+
+# Directory in which to install the program tclsh:
+BIN_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/bin
+
+# Directory in which to install the include file tcl.h:
+INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)${prefix}/include
+
+#
+# Visual C++ 2.x and 4.0 makefile
+#
+# Does not depend on the presence of any environment variables in
+# order to compile tcl; all needed information is derived from 
+# location of the compiler directories.
+
+#
+# Project directories
+#
+# ROOT    = top of source tree
+#
+# TMPDIR  = location where .o files should be stored during build
+#
+# TOOLS32 = location of VC++ 32-bit development tools. Note that the
+#	    VC++ 2.0 header files are broken, so you need to use the
+#	    ones that come with the developer network CD's, or later
+#	    versions of VC++.
+#
+# TOOLS16 = location of VC++ 1.5 16-bit tools, needed to build thunking
+#	    library.  This information is optional; if the 16-bit compiler
+#	    is not available, then the 16-bit code will not be built.  
+#	    Tcl will still run without the 16-bit code, but...
+#		A. Under Windows 3.X you will any calls to the exec command
+#	           will return an error.
+#		B. A 16-bit program to test the behavior of the exec
+#		   command under NT and 95 will not be built.
+#
+
+ROOT		= $(srcdir)/..
+TMPDIR		= .
+TOOLS32		= c:\msdev
+TOOLS16		= c:\msvc
+
+# Set this to the appropriate value of /MACHINE: for your platform
+MACHINE	= IX86
+
+# Comment the following line to compile with symbols
+NODEBUG=1
+
+# uncomment one of the following lines to compile with TCL_MEM_DEBUG, 
+# TCL_MEM_DEBUG, or TCL_COMPILE_DEBUG
+#DEBUGDEFINES	= -DTCL_MEM_DEBUG
+#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG
+#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_STATS
+#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
+
+######################################################################
+# Do not modify below this line
+######################################################################
+
+NAMEPREFIX = tcl
+STUBPREFIX = $(NAMEPREFIX)stub
+DOTVERSION = 8.2
+VERSION = 82
+
+BINROOT		= .
+TMPDIRNAME	= .
+DBGX		=
+
+TMPDIR		= $(BINROOT)/$(TMPDIRNAME)
+OUTDIRNAME	= $(TMPDIRNAME)
+OUTDIR		= $(TMPDIR)
+
+TCLLIB		= $(OUTDIR)/lib$(NAMEPREFIX)$(VERSION)$(DBGX).a
+TCLLIBSA	= $(OUTDIR)/lib$(NAMEPREFIX)$(VERSION)$(DBGX)s.a
+TCLDLLNAME	= $(NAMEPREFIX)$(VERSION)$(DBGX).dll
+TCLDLL		= $(OUTDIR)/$(TCLDLLNAME)
+TCLSTUBLIBNAME	= lib$(STUBPREFIX)$(VERSION)$(DBGX).a
+TCLSTUBLIB	= $(OUTDIR)/$(TCLSTUBLIBNAME)
+TESTDLLNAME	= $(NAMEPREFIX)test.dll
+TESTDLL		= $(OUTDIR)/$(TESTDLLNAME)
+OBJTESTDLLNAME	= objtest$(DBGX).dll
+OBJTESTDLL	= $(OUTDIR)/$(OBJTESTDLLNAME)
+TCLPTESTDLLNAME	= tclptest$(DBGX).dll
+TCLPTESTDLL	= $(OUTDIR)/$(TCLPTESTDLLNAME)
+PROCTESTDLLNAME	= proctest$(DBGX).dll
+PROCTESTDLL	= $(OUTDIR)/$(PROCTESTDLLNAME)
+TCLPLUGINLIB	= $(OUTDIR)/lib$(NAMEPREFIX)$(VERSION)p$(DBGX).a
+TCLPLUGINDLLNAME= $(NAMEPREFIX)$(VERSION)p$(DBGX).dll
+TCLPLUGINDLL	= $(OUTDIR)/$(TCLPLUGINDLLNAME)
+TCL16DLL	= #$(OUTDIR)/$(NAMEPREFIX)16$(VERSION)$(DBGX).dll
+TCLSH		= $(OUTDIR)/$(NAMEPREFIX)sh$(VERSION)$(DBGX).exe
+TCLSHP		= $(OUTDIR)/$(NAMEPREFIX)shp$(VERSION)$(DBGX).exe
+TCLPIPEDLLNAME	= $(NAMEPREFIX)pip$(VERSION)$(DBGX).dll
+TCLPIPEDLL	= $(OUTDIR)/$(TCLPIPEDLLNAME)
+TCLREGDLLNAME	= $(NAMEPREFIX)reg$(VERSION)$(DBGX).dll
+TCLREGDLL	= $(OUTDIR)/$(TCLREGDLLNAME)
+TCLDDEDLLNAME	= $(NAMEPREFIX)dde$(VERSION)$(DBGX).dll
+TCLDDEDLL	= $(OUTDIR)/$(TCLDDEDLLNAME)
+TCLTEST		= $(OUTDIR)/$(NAMEPREFIX)test.exe
+DUMPEXTS	= #$(TMPDIR)/dumpexts.exe
+CAT16		= #$(TMPDIR)/cat16.exe
+CAT32		= $(TMPDIR)/cat32.exe
+
+TCLSHOBJS = \
+	$(TMPDIR)/tclAppInit.o
+
+TCLTESTOBJS = \
+	$(TMPDIR)/tclTest.o \
+	$(TMPDIR)/tclTestObj.o \
+	$(TMPDIR)/tclWinTest.o \
+	$(TMPDIR)/testMain.o
+
+TCLOBJS = \
+	$(TMPDIR)/regcomp.o \
+	$(TMPDIR)/regexec.o \
+	$(TMPDIR)/regfree.o \
+	$(TMPDIR)/regerror.o \
+	$(TMPDIR)/strftime.o \
+	$(TMPDIR)/tclAlloc.o \
+	$(TMPDIR)/tclAsync.o \
+	$(TMPDIR)/tclBasic.o \
+	$(TMPDIR)/tclBinary.o \
+	$(TMPDIR)/tclCkalloc.o \
+	$(TMPDIR)/tclClock.o \
+	$(TMPDIR)/tclCmdAH.o \
+	$(TMPDIR)/tclCmdIL.o \
+	$(TMPDIR)/tclCmdMZ.o \
+	$(TMPDIR)/tclCompCmds.o \
+	$(TMPDIR)/tclCompExpr.o \
+	$(TMPDIR)/tclCompile.o \
+	$(TMPDIR)/tclDate.o \
+	$(TMPDIR)/tclEncoding.o \
+	$(TMPDIR)/tclEnv.o \
+	$(TMPDIR)/tclEvent.o \
+	$(TMPDIR)/tclExecute.o \
+	$(TMPDIR)/tclFCmd.o \
+	$(TMPDIR)/tclFileName.o \
+	$(TMPDIR)/tclGet.o \
+	$(TMPDIR)/tclHash.o \
+	$(TMPDIR)/tclHistory.o \
+	$(TMPDIR)/tclIndexObj.o \
+	$(TMPDIR)/tclInterp.o \
+	$(TMPDIR)/tclIO.o \
+	$(TMPDIR)/tclIOCmd.o \
+	$(TMPDIR)/tclIOSock.o \
+	$(TMPDIR)/tclIOUtil.o \
+	$(TMPDIR)/tclLink.o \
+	$(TMPDIR)/tclLiteral.o \
+	$(TMPDIR)/tclListObj.o \
+	$(TMPDIR)/tclLoad.o \
+	$(TMPDIR)/tclLoadWin.o \
+	$(TMPDIR)/tclStdMain.o \
+	$(TMPDIR)/tclNamesp.o \
+	$(TMPDIR)/tclNotify.o \
+	$(TMPDIR)/tclObj.o \
+	$(TMPDIR)/tclPanic.o \
+	$(TMPDIR)/tclParse.o \
+	$(TMPDIR)/tclParseExpr.o \
+	$(TMPDIR)/tclPipe.o \
+	$(TMPDIR)/tclPkg.o \
+	$(TMPDIR)/tclPosixStr.o \
+	$(TMPDIR)/tclPreserve.o \
+	$(TMPDIR)/tclProc.o \
+	$(TMPDIR)/tclRegexp.o \
+	$(TMPDIR)/tclResolve.o \
+	$(TMPDIR)/tclResult.o \
+	$(TMPDIR)/tclScan.o \
+	$(TMPDIR)/tclStringObj.o \
+	$(TMPDIR)/tclStubInit.o \
+	$(TMPDIR)/tclThread.o \
+	$(TMPDIR)/tclTimer.o \
+	$(TMPDIR)/tclUtf.o \
+	$(TMPDIR)/tclUtil.o \
+	$(TMPDIR)/tclVar.o \
+	$(TMPDIR)/tclWin32Dll.o \
+	$(TMPDIR)/tclWinChan.o \
+	$(TMPDIR)/tclWinConsole.o \
+	$(TMPDIR)/tclWinSerial.o \
+	$(TMPDIR)/tclWinError.o \
+	$(TMPDIR)/tclWinFCmd.o \
+	$(TMPDIR)/tclWinFile.o \
+	$(TMPDIR)/tclWinLoad.o \
+	$(TMPDIR)/tclWinPipe.o \
+	$(TMPDIR)/tclWinMtherr.o \
+	$(TMPDIR)/tclWinNotify.o \
+	$(TMPDIR)/tclWinSock.o \
+	$(TMPDIR)/tclWinThrd.o \
+	$(TMPDIR)/tclWinTty.o \
+	$(TMPDIR)/tclWinTime.o
+
+TCLSTUBOBJS = $(TMPDIR)/tclStubLib.o \
+	$(TMPDIR)/tclWinTty.o \
+	$(TMPDIR)/tclLoadWinStub.o
+
+TCLLIBOBJS = \
+	$(TCLOBJS) \
+	$(TMPDIR)/tclWinEntry.o \
+	$(TMPDIR)/tclWinInit.o
+
+TCLDLLOBJS = \
+	$(TCLOBJS) \
+	$(TMPDIR)/tclWinEntry.o \
+	$(TMPDIR)/tclWinDllInit.o \
+
+cc32		= $(TOOLS32)\bin\cl.exe
+link32		= $(TOOLS32)\bin\link.exe
+rc32		= $(TOOLS32)\bin\rc.exe
+include32	= -I$(TOOLS32)\include
+
+cc16		= $(TOOLS16)\bin\cl.exe
+link16		= $(TOOLS16)\bin\link.exe
+rc16		= $(TOOLS16)\bin\rc.exe
+include16	= -I$(TOOLS16)\include
+
+WINDIR          = $(ROOT)/win
+GENERICDIR	= $(ROOT)/generic
+LIBDIR		= $(ROOT)/library
+
+TCL_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR)
+TCL_DEFINES	= -D__WIN32__ $(DEBUGDEFINES)
+
+TCL_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) \
+			$(TCL_INCLUDES) $(TCL_DEFINES) $(CFLAGS)
+CON_CFLAGS	= $(cdebug) $(cflags) $(cvars) -DCONSOLE
+DOS_CFLAGS	= $(cdebug) $(cflags) $(include16) -AL 
+DLL16_CFLAGS	= $(cdebug) $(cflags) $(include16) -ALw
+
+linkdebug =
+conlflags = -Wl,--subsystem,console -mwindows
+conlibsdll =
+
+######################################################################
+# Link flags
+######################################################################
+
+#!IFDEF NODEBUG
+#ldebug = /RELEASE
+#!ELSE
+#ldebug = -debug:full -debugtype:cv
+#!ENDIF
+
+# declarations common to all linker options
+lcommon = /NODEFAULTLIB /RELEASE /NOLOGO
+
+# declarations for use on Intel i386, i486, and Pentium systems
+#!IF "$(MACHINE)" == "IX86"
+#DLLENTRY = @12
+#lflags   = $(lcommon) -align:0x1000 /MACHINE:$(MACHINE)
+#!ELSE
+#lflags   = $(lcommon) /MACHINE:$(MACHINE)
+#!ENDIF
+
+conlflags = -Wl,--subsystem,console -mwindows
+guilflags = -mwindows
+dlllflags =
+
+#!IF "$(MACHINE)" == "PPC"
+#libc = libc.lib
+#libcdll = crtdll.lib
+#!ELSE
+#libc = libc.lib oldnames.lib
+#libcdll = msvcrt.lib oldnames.lib
+#!ENDIF
+
+baselibs   = -lkernel32 $(optlibs) -ladvapi32 -luser32
+winlibs    = $(baselibs) -lgdi32 -lcomdlg32 -lwinspool
+
+guilibs	   = $(libc) $(winlibs)
+conlibs	   = $(libc) $(baselibs)
+guilibsdll = $(libcdll) $(winlibs)
+conlibsdll = $(libcdll) $(baselibs)
+
+######################################################################
+# Compile flags
+######################################################################
+
+#!IFDEF NODEBUG
+#cdebug = -Ox
+#!ELSE
+#cdebug = -Z7 -Od -WX
+#!ENDIF
+
+# declarations common to all compiler options
+ccommon = -c -W3 -nologo -YX -Dtry=__try -Dexcept=__except
+
+#!IF "$(MACHINE)" == "IX86"
+#cflags = $(ccommon) -D_X86_=1
+#!ELSE
+#!IF "$(MACHINE)" == "MIPS"
+#cflags = $(ccommon) -D_MIPS_=1
+#!ELSE
+#!IF "$(MACHINE)" == "PPC"
+#cflags = $(ccommon) -D_PPC_=1
+#!ELSE
+#!IF "$(MACHINE)" == "ALPHA"
+#cflags = $(ccommon) -D_ALPHA_=1
+#!ENDIF
+#!ENDIF
+#!ENDIF
+#!ENDIF
+
+cvars      = -DWIN32 -D_WIN32
+cvarsmt    = $(cvars) -D_MT
+cvarsdll   = $(cvarsmt)
+
+######################################################################
+# Project specific targets
+######################################################################
+
+release:    setup $(TCLSH) $(TCLLIBSA) $(TCLSTUBLIB) dlls
+dlls:	    setup $(TCL16DLL) $(TCLPIPEDLL) $(TCLREGDLL) $(TCLDDEDLL)
+all:	    release $(CAT16) $(CAT32) 
+tcltest:    setup $(TCLSH) dlls $(CAT16) $(CAT32) $(TESTDLL) \
+		$(OBJTESTDLL) $(TCLPTESTDLL) $(PROCTESTDLL) $(OUTDIR)/pkgIndex.tcl
+plugin:	    setup $(TCLPLUGINDLL) $(TCLSHP)
+install:    install-binaries install-libraries
+test:	    tcltest
+		$(TCLSH) $(ROOT)/tests/all.tcl
+
+setup:
+#	-@mkdir $(TMPDIRNAME)
+#	-@mkdir $(OUTDIRNAME)
+
+install-binaries: $(TCLDLL) $(TCLLIB) $(TCLSH) $(TCLPIPEDLL)
+	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
+	    do \
+	    if [ ! -d $$i ] ; then \
+		echo "Making directory $$i"; \
+		mkdir $$i; \
+		chmod 755 $$i; \
+		else true; \
+		fi; \
+	    done;
+	@echo "Installing $(TCLLIB)"
+	@$(INSTALL_DATA) $(TCLLIB) $(LIB_INSTALL_DIR)/$(TCLLIB)
+	@chmod 555 $(LIB_INSTALL_DIR)/$(TCLLIB)
+	@echo "Installing tclsh"
+	@$(INSTALL_PROGRAM) $(TCLSH) $(BIN_INSTALL_DIR)/$(TCLSH)
+	@echo "Installing tclConfig.sh"
+	@$(INSTALL_DATA) ../unix/tclConfig.sh $(LIB_INSTALL_DIR)/tclConfig.sh
+
+install-libraries:
+	@echo "Installing DLL"
+	@$(INSTALL_DATA) $(TCLDLL) $(BIN_INSTALL_DIR)/$(TCLDLL)
+	@$(INSTALL_DATA) $(TCLPIPEDLL) $(BIN_INSTALL_DIR)/$(TCLPIPEDLL)
+	@for i in $(INSTALL_ROOT)${prefix}/lib $(INCLUDE_INSTALL_DIR) \
+		$(SCRIPT_INSTALL_DIR) ; \
+	    do \
+	    if [ ! -d $$i ] ; then \
+		echo "Making directory $$i"; \
+		mkdir $$i; \
+		chmod 755 $$i; \
+		else true; \
+		fi; \
+	    done;
+	@for i in http2.0 http1.0 opt0.4 reg1.0 dde1.0 ; \
+	    do \
+	    if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
+		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
+		mkdir $(SCRIPT_INSTALL_DIR)/$$i; \
+		chmod 755 $(SCRIPT_INSTALL_DIR)/$$i; \
+		else true; \
+		fi; \
+	    done;
+	@$(INSTALL_DATA) $(TCLREGDLL) $(SCRIPT_INSTALL_DIR)/reg1.0/$(TCLREGDLL)
+	@$(INSTALL_DATA) pkgIndex.reg $(SCRIPT_INSTALL_DIR)/reg1.0/pkgIndex.tcl
+	@$(INSTALL_DATA) $(TCLDDEDLL) $(SCRIPT_INSTALL_DIR)/dde1.0/$(TCLDDEDLL)
+	@$(INSTALL_DATA) pkgIndex.dde $(SCRIPT_INSTALL_DIR)/dde1.0/pkgIndex.tcl
+	@echo "Installing tcl.h"
+	@$(INSTALL_DATA) $(GENERICDIR)/tcl.h $(INCLUDE_INSTALL_DIR)/tcl.h
+	@for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(WINDIR)/tclAppInit.c; \
+	    do \
+	    echo "Installing $$i"; \
+	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+	    done;
+	@for i in http2.0 http1.0 opt0.4 ; \
+	    do \
+	    for j in $(ROOT)/library/$$i/*.tcl ; \
+		do \
+		echo "Installing $$j"; \
+		$(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/$$i; \
+		done; \
+	    done;
+
+install-minimal:
+	@echo "Installing DLL"
+	@$(INSTALL_DATA) $(TCLDLL) $(BIN_INSTALL_DIR)/$(TCLDLL)
+	@$(INSTALL_DATA) $(TCLPIPEDLL) $(BIN_INSTALL_DIR)/$(TCLPIPEDLL)
+	@for i in $(INSTALL_ROOT)${prefix}/lib $(SCRIPT_INSTALL_DIR) ; \
+	    do \
+	    if [ ! -d $$i ] ; then \
+		echo "Making directory $$i"; \
+		mkdir $$i; \
+		chmod 755 $$i; \
+		else true; \
+		fi; \
+	    done;
+	@for i in http2.0 http1.0 opt0.4 reg1.0 dde1.0; \
+	    do \
+	    if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
+		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
+		mkdir $(SCRIPT_INSTALL_DIR)/$$i; \
+		chmod 755 $(SCRIPT_INSTALL_DIR)/$$i; \
+		else true; \
+		fi; \
+	    done;
+	@for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex; \
+	    do \
+	    echo "Installing $$i"; \
+	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+	    done;
+	@for i in http2.0 http1.0 opt0.4 ; \
+	    do \
+	    for j in $(ROOT)/library/$$i/*.tcl ; \
+		do \
+		echo "Installing $$j"; \
+		$(INSTALL_DATA) $$j $(SCRIPT_INSTALL_DIR)/$$i; \
+		done; \
+	    done;
+	@$(INSTALL_DATA) $(TCLREGDLL) $(SCRIPT_INSTALL_DIR)/reg1.0/$(TCLREGDLL)
+	@$(INSTALL_DATA) pkgIndex.reg $(SCRIPT_INSTALL_DIR)/reg1.0/pkgIndex.tcl
+	@$(INSTALL_DATA) $(TCLDDEDLL) $(SCRIPT_INSTALL_DIR)/dde1.0/$(TCLDDEDLL)
+	@$(INSTALL_DATA) pkgIndex.dde $(SCRIPT_INSTALL_DIR)/dde1.0/pkgIndex.tcl
+
+# $(DUMPEXTS): $(WINDIR)/winDumpExts.c
+# 	$(CC) -c $(CON_CFLAGS) $?
+# 	$(CC) $(linkdebug) $(conlflags) -o $@ $(TMPDIR)/winDumpExts.o $(guilibs)
+
+$(TCLDLL): $(TCLDLLOBJS) tclres.o $(TMPDIR)/tcl.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $(TCLDLL) \
+	    --def $(TMPDIR)/tcl.def $(TCLDLLOBJS) tclres.o \
+	    $(DLL_LDLIBS)
+
+$(TCLLIB): $(TMPDIR)/tcl.def $(TCLDLL)
+	$(DLLTOOL) --as=$(AS) --dllname $(TCLDLLNAME) \
+	  --def $(TMPDIR)/tcl.def --output-lib $(TCLLIB)
+
+$(TCLSTUBLIB): $(TCLSTUBOBJS)
+	$(AR) cr $(TCLSTUBLIB) $(TCLSTUBOBJS)
+
+$(TCLLIBSA): $(TCLLIBOBJS)
+	$(AR) cr $(TCLLIBSA) $(TCLLIBOBJS)
+
+$(TCLPLUGINLIB): $(TMPDIR)/plugin.def
+	$(DLLTOOL) --as=$(AS) --dllname $(TCLPLUGINDLL) \
+	  --def $(TMPDIR)/plugin.def --output-lib $(TCLPLUGINLIB)
+
+$(TCLPLUGINDLL): $(TCLLIBOBJS) $(TMPDIR)/plugin.def tclres.o
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $(TCLPLUGINDLL) \
+	  --def $(TMPDIR)/plugin.def $(TCLLIBOBJS) \
+	  tclres.o $(DLL_LDLIBS)
+
+$(TCLSH): $(TCLSHOBJS) tclshres.o $(TCLLIB)
+	$(CC) -mno-cygwin $(linkdebug) $(conlflags) -Wl,--stack=0x2300000 \
+		-o $@ $(conlibsdll) $(TCLSHOBJS) tclshres.o $(TCLLIB)
+	strip $(TCLSH)
+
+$(TCLTEST): $(TCLTESTOBJS) tclshres.o $(TCLLIB)
+	$(CC) $(linkdebug) $(conlflags) -Wl,--stack=0x2300000 \
+		 -o $@ $(conlibsdll) $(TCLTESTOBJS) tclshres.o $(TCLLIB)
+
+$(OUTDIR)/pkgIndex.tcl:	$(TCLSH) Tcltest.dll Objtest.dll Tclptest.dll
+	( echo "pkg_mkIndex . Tcltest.dll Objtest.dll Tclptest.dll" ) | tclsh81
+	echo "package ifneeded Proctest 1.0 [list load [file join [set dir] Proctest${SHLIB_SUFFIX}] Proctest]" >>pkgIndex.tcl
+
+# $(TCL16DLL):  $(WINDIR)\tcl16.rc $(WINDIR)\tclWin16.c
+# 	if exist $(cc16) $(cc16) @<<
+# $(DLL16_CFLAGS) -Fo$(TMPDIR)\ $(WINDIR)\tclWin16.c
+# <<                         
+# 	@copy << $(TMPDIR)\tclWin16.def > nul
+# LIBRARY $(@B);dll
+# EXETYPE WINDOWS
+# CODE PRELOAD MOVEABLE DISCARDABLE
+# DATA PRELOAD MOVEABLE SINGLE
+# HEAPSIZE 1024 
+# EXPORTS
+# 	WEP @1 RESIDENTNAME
+# 	UTPROC @2 
+# << 
+# 	if exist $(cc16) $(link16) /NOLOGO /ONERROR:NOEXE /NOE @<<
+# $(TMPDIR)\tclWin16.obj
+# $@
+# nul
+# $(TOOLS16)\lib\ ldllcew oldnames libw toolhelp
+# $(TMPDIR)\tclWin16.def
+# <<
+# 	if exist $(cc16) $(rc16) -i $(GENERICDIR) $(TCL_DEFINES) $(WINDIR)\tcl16.rc $@
+
+$(TCLPIPEDLL): $(WINDIR)/stub16.c
+	$(CC) -mno-cygwin -c $(CON_CFLAGS) $(WINDIR)/stub16.c
+	$(CC) -mno-cygwin $(linkdebug) $(conlflags) -o $@ $(TMPDIR)/stub16.o $(guilibs)
+
+$(TMPDIR)/tclWinReg.o: $(TMPDIR)/tclWinReg.c
+	$(CC) -c $(TCL_CFLAGS) -DUSE_TCL_STUBS $(TMPDIR)/tclWinReg.c
+
+$(TMPDIR)/tclWinDde.o: $(TMPDIR)/tclWinDde.c
+	$(CC) -c $(TCL_CFLAGS) -DUSE_TCL_STUBS $(TMPDIR)/tclWinDde.c
+
+$(TMPDIR)/tclTest.o: $(GENERICDIR)/tclTest.c
+	$(CC) -c $(TCL_CFLAGS) -DNO_PLATFORM_TEST -DUSE_TCL_STUBS $(GENERICDIR)/tclTest.c
+
+$(TMPDIR)/tclTestObj.o: $(GENERICDIR)/tclTestObj.c
+	$(CC) -c $(TCL_CFLAGS) -DUSE_TCL_STUBS $(GENERICDIR)/tclTestObj.c
+
+$(TMPDIR)/tclWinTest.o: $(TMPDIR)/tclWinTest.c
+	$(CC) -c $(TCL_CFLAGS) -DUSE_TCL_STUBS $(TMPDIR)/tclWinTest.c
+
+$(TMPDIR)/tclTestProcBodyObj.o: $(GENERICDIR)/tclTestProcBodyObj.c
+	$(CC) -c $(TCL_CFLAGS) -DUSE_TCL_STUBS $(GENERICDIR)/tclTestProcBodyObj.c
+
+$(TMPDIR)/tclLoadWinStub.o: $(TMPDIR)/tclLoadWin.c
+	$(CC) -c $(TCL_CFLAGS) -o $@ -DUSE_TCL_STUBS $(TMPDIR)/tclLoadWin.c
+
+$(TCLREGDLL): $(TMPDIR)/tclWinReg.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/tclreg.def
+	echo Registry_Init >> $(TMPDIR)/tclreg.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/tclreg.def $(TMPDIR)/tclWinReg.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -rf $(TMPDIRNAME)/tclreg.def
+
+$(TCLDDEDLL): $(TMPDIR)/tclWinDde.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/tcldde.def
+	echo Dde_Init >> $(TMPDIR)/tcldde.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/tcldde.def $(TMPDIR)/tclWinDde.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -rf $(TMPDIRNAME)/tcldde.def
+
+$(TESTDLL): $(TMPDIR)/tclTest.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/tcltest.def
+	echo Tcltest_Init >> $(TMPDIR)/tcltest.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/tcltest.def $(TMPDIR)/tclTest.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -f $(TMPDIRNAME)/tcltest.def
+
+$(OBJTESTDLL): $(TMPDIR)/tclTestObj.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/objtest.def
+	echo Objtest_Init >> $(TMPDIR)/objtest.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/objtest.def $(TMPDIR)/tclTestObj.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -f $(TMPDIRNAME)/objtest.def
+
+$(TCLPTESTDLL): $(TMPDIR)/tclWinTest.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/tclptest.def
+	echo Tclptest_Init >> $(TMPDIR)/tclptest.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/tclptest.def $(TMPDIR)/tclWinTest.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -f $(TMPDIRNAME)/tclptest.def
+
+$(PROCTESTDLL): $(TMPDIR)/tclTestProcBodyObj.o $(TMPDIR)/tclDllEntry.o $(TCLSTUBLIB)
+	echo EXPORTS > $(TMPDIR)/proctest.def
+	echo Proctest_Init >> $(TMPDIR)/proctest.def
+	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
+	  --def $(TMPDIR)/proctest.def $(TMPDIR)/tclTestProcBodyObj.o $(TMPDIR)/tclDllEntry.o \
+	  $(TCLSTUBLIB)
+	rm -f $(TMPDIRNAME)/proctest.def
+
+$(CAT32): $(WINDIR)/cat.c
+	$(CC) -mno-cygwin -c $(CON_CFLAGS) $?
+	$(CC) -mno-cygwin $(conlflags) -o $@ -Wl,-stack,16384 $(TMPDIR)/cat.o $(conlibs)
+
+# $(CAT16): $(WINDIR)\cat.c
+# 	if exist $(cc16) $(cc16) $(DOS_CFLAGS) -Fo$(TMPDIR)\ $?
+# 	set LIB=$(TOOLS16)\lib
+# 	if exist $(cc16) $(link16) /NOLOGO /ONERROR:NOEXE /NOI /STACK:16384 \
+# 		$(TMPDIR)\cat.obj,$@,nul,llibce.lib,nul
+
+$(TMPDIR)/tcl.def: $(DUMPEXTS) $(TCLDLLOBJS)
+	$(DLLTOOL) --export-all --exclude-symbols DllMain@12 \
+		--add-stdcall-alias --output-def $@ $(TCLDLLOBJS)
+
+#
+# Special case object file targets
+#
+
+$(TMPDIR)/testMain.o: $(WINDIR)/tclAppInit.c
+	$(CC) -c -o $@ $(TCL_CFLAGS) -DTCL_TEST $?
+
+#
+# Implicit rules
+#
+
+
+.c.o:
+	$(CC) -c $(TCL_CFLAGS) $<
+
+tclres.o: $(srcdir)/tcl.rc
+	$(WINDRES) --include $(GENERICDIR) --include $(WINDIR) \
+	  --define __WIN32__ --define VS_VERSION_INFO=1 \
+	  $(srcdir)/tcl.rc tclres.o
+
+tclWinDllInit.o: $(srcdir)/tclWinInit.c
+	$(CC) -c -o $@ $(TCL_CFLAGS) -DNO_STATIC_INIT $<
+
+tclshres.o: $(srcdir)/tclsh.rc
+	$(WINDRES) --include $(GENERICDIR) --include $(WINDIR) \
+	  --define __WIN32__ --define VS_VERSION_INFO=1 \
+	  $(srcdir)/tclsh.rc tclshres.o
+
+#{$(WINDIR)}.rc{$(TMPDIR)}.res:
+#	$(rc32) -fo $@ -r -i $(GENERICDIR) -i $(WINDIR) -D__WIN32__ \
+#		$(TCL_DEFINES) $<
+
+clean:
+	rm -f *.exp *.a *.dll *.exe $(TMPDIR)/*.o *.res *.def
+	rm -f tcl.base tclreg.base tclplugin.base
+
--- tcl8.2-8.2.3.orig/win/pkgIndex.dde
+++ tcl8.2-8.2.3/win/pkgIndex.dde
@@ -0,0 +1 @@
+package ifneeded dde 1.1 [list tclPkgSetup $dir dde 1.1 {{tcldde82.dll load dde}}]
--- tcl8.2-8.2.3.orig/win/pkgIndex.reg
+++ tcl8.2-8.2.3/win/pkgIndex.reg
@@ -0,0 +1 @@
+package ifneeded registry 1.0 [list tclPkgSetup $dir registry 1.0 {{tclreg82.dll load registry}}]
--- tcl8.2-8.2.3.orig/win/tcl82plus.dsp
+++ tcl8.2-8.2.3/win/tcl82plus.dsp
@@ -0,0 +1,80 @@
+# Microsoft Developer Studio Project File - Name="tcl82plus" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=tcl82plus - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "tcl82plus.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "tcl82plus.mak" CFG="tcl82plus - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "tcl82plus - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "tcl82plus - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF  "$(CFG)" == "tcl82plus - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f makefile.vc"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "Release\tclsh82.exe"
+# PROP BASE Bsc_Name "Release\tclsh82.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f makefile.vc CFG="tcl82plus - Win32 Release""
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Release\tclsh82.exe"
+# PROP Bsc_Name "Release\tclsh82.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF  "$(CFG)" == "tcl82plus - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f makefile.vc"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "Debug\tclsh82.exe"
+# PROP BASE Bsc_Name "Debug\tclsh82.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f makefile.vc CFG="tcl82plus - Win32 Debug""
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Debug\tclsh82.exe"
+# PROP Bsc_Name "Debug\tclsh82.bsc"
+# PROP Target_Dir ""
+
+!ENDIF 
+
+# Begin Target
+
+# Name "tcl82plus - Win32 Release"
+# Name "tcl82plus - Win32 Debug"
+
+!IF  "$(CFG)" == "tcl82plus - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "tcl82plus - Win32 Debug"
+
+!ENDIF 
+
+# End Target
+# End Project
--- tcl8.2-8.2.3.orig/win/tclDllEntry.c
+++ tcl8.2-8.2.3/win/tclDllEntry.c
@@ -0,0 +1,38 @@
+/* 
+ * tclDllEntry.c --
+ *
+ *    This procedure provides the entry point for the dll
+ *
+ */
+
+#include <windows.h>
+
+#if defined(_MSC_VER) || defined(__GNUC__)
+#define DllEntryPoint DllMain
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DllEntryPoint --
+ *
+ *	This routine is called by gcc, VC++ Borland to invoke the
+ *	initialization code for Tcl.
+ *
+ * Results:
+ *	TRUE.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+BOOL APIENTRY
+DllEntryPoint (
+    HINSTANCE hInst,		/* Library instance handle. */
+    DWORD reason,		/* Reason this function is being called. */
+    LPVOID reserved)		/* Not used. */
+{
+    return TRUE; 
+}
--- tcl8.2-8.2.3.orig/win/tclLoadWin.c
+++ tcl8.2-8.2.3/win/tclLoadWin.c
@@ -0,0 +1,192 @@
+/* 
+ * tclLoadWin.c --
+ *
+ *	This procedure provides a version of dlopen() that
+ *	works with the Windows "LoadLibrary" and "GetProcAddress"
+ *	API for dynamic loading.
+ *
+ */
+
+#include <stdlib.h>
+#include "../compat/dlfcn.h"
+#include "tclWinInt.h"
+
+typedef struct LibraryList {
+    HINSTANCE handle;
+    struct LibraryList *nextPtr;
+} LibraryList;
+
+static LibraryList *libraryList = (LibraryList *) NULL;	/* List of currently loaded DLL's.  */
+
+/*
+ * Declarations for functions that are only used in this file.
+ */
+
+static void 		UnloadLibraries _ANSI_ARGS_((void));
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlopen --
+ *
+ *	This function is an alternative for the functions
+ *	TclWinLoadLibrary and TclWinGetTclInstance.  It is
+ *	responsible for adding library handles to the library list so
+ *	the libraries can be freed when tcl.dll is unloaded.
+ *
+ * Results:
+ *	Returns the handle of the newly loaded library, or NULL on
+ *	failure. If path is NULL, the global library instance handle
+ *	is returned.
+ *
+ * Side effects:
+ *	Loads the specified library into the process.
+ *
+ *----------------------------------------------------------------------
+ */
+
+VOID *dlopen(path, mode)
+    CONST char *path;
+    int mode;
+{
+    VOID *handle;
+    LibraryList *ptr;
+
+    handle = (VOID *) LoadLibrary(path);
+    if (handle != NULL) {
+	ptr = (LibraryList*) ckalloc(sizeof(LibraryList));
+	ptr->handle = (HINSTANCE) handle;
+	ptr->nextPtr = libraryList;
+	if (!libraryList) {
+	    atexit(UnloadLibraries);
+	}
+	libraryList = ptr;
+    }
+    return handle;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlclose --
+ *
+ *	This function is an alternative for the function
+ *	FreeLibrary.  It is responsible for removing library
+ *	handles from the library list and remove the dll
+ *	from memory.
+ *
+ * Results:
+ *	-1 on error, 0 on success.
+ *
+ * Side effects:
+ *	Removes the specified library from the process.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+dlclose(handle)
+    VOID *handle;
+{
+    LibraryList *ptr, *prevPtr;
+
+    ptr = libraryList; prevPtr = NULL;
+    while (ptr != NULL) {
+	if (ptr->handle == (HINSTANCE) handle) {
+	    FreeLibrary((HINSTANCE) handle);
+	    if (prevPtr) {
+		prevPtr->nextPtr = ptr->nextPtr;
+	    } else {
+		libraryList = ptr->nextPtr;
+	    }
+	    ckfree((char *) ptr);
+	    return 0;
+	}
+	prevPtr = ptr;
+	ptr = ptr->nextPtr;
+    }
+    return -1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlsym --
+ *
+ *	This function is an alternative for the system function
+ *	GetProcAddress. It returns the address of a
+ *	symbol, give the handle returned by dlopen().
+ *
+ * Results:
+ *	Returns the address of the symbol in the dll.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+VOID *dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
+{
+    return (VOID *) GetProcAddress((HINSTANCE) handle, symbol);
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlerror --
+ *
+ *	This function returns a string describing the error which
+ *	occurred in dlopen().
+ *
+ * Results:
+ *	Returns an error message.
+ *
+ * Side effects:
+ *	errno is set.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+dlerror()
+{
+    TclWinConvertError(GetLastError());
+    return Tcl_ErrnoMsg(Tcl_GetErrno());
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UnloadLibraries --
+ *
+ *	Frees any dynamically allocated libraries loaded by Tcl.
+ *
+ * Results:
+ *	None.
+ *
+ * Side effects:
+ *	Frees the libraries on the library list as well as the list.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UnloadLibraries()
+{
+    LibraryList *ptr;
+    LibraryList *list = libraryList;
+
+    while (list != NULL) {
+	FreeLibrary(list->handle);
+	ptr = list->nextPtr;
+	ckfree((char *) list);
+	list = ptr;
+    }
+    libraryList = (LibraryList *) NULL;
+}
--- tcl8.2-8.2.3.orig/win/tclWinEntry.c
+++ tcl8.2-8.2.3/win/tclWinEntry.c
@@ -0,0 +1,61 @@
+/*
+ *	tclWinEntry.c
+ */
+
+#include <tclWinInt.h>
+
+#if defined(_MSC_VER) || defined(__GNUC__)
+#define DllEntryPoint DllMain
+#endif
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DllEntryPoint --
+ *
+ *	This routine is called by Borland to invoke the
+ *	initialization code for the library.
+ *      VC++, gcc en egcs rename it to DllMain.
+ *
+ * Results:
+ *	TRUE.
+ *
+ * Side effects:
+ *	See DllMain.
+ *
+ *----------------------------------------------------------------------
+ */
+
+BOOL APIENTRY
+DllEntryPoint(
+    HINSTANCE hInst,		/* Library instance handle. */
+    DWORD reason,		/* Reason this function is being called. */
+    LPVOID reserved)		/* Not used. */
+{
+    switch (reason) {
+    case DLL_PROCESS_ATTACH:
+	if (TclWinGetTclInstance() != NULL) {
+	    /*
+	     * Prevents DLL from being loaded multiple times under Win32s,
+	     * since all copies of the DLL share the same data segment and
+	     * Tcl isn't set up to handle that.  Under NT or 95, each time 
+	     * the DLL is loaded, it gets its own private copy of the data 
+	     * segment.
+	     */
+
+	    return FALSE;
+	}
+
+	TclWinInit(hInst);
+	return TRUE;
+
+    case DLL_PROCESS_DETACH:
+	if (hInst == TclWinGetTclInstance()) {
+	    Tcl_Finalize();
+	}
+	break;
+    }
+
+    return TRUE; 
+}
--- tcl8.2-8.2.3.orig/win/tclWinTty.c
+++ tcl8.2-8.2.3/win/tclWinTty.c
@@ -0,0 +1,47 @@
+/* 
+ * tclWinIsatty.c --
+ *
+ *	Emulation of isatty() function. This code is derived from
+ *      tkMain.c from the corresponding Tk distribution.
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ */
+
+
+#include <windows.h>
+#include "tcl.h"
+
+int isatty(fd)
+    int fd;
+{
+    HANDLE handle;
+
+    if (fd != 0) {
+	/* This code is only designed to handle stdin. */
+	return 0;
+    }
+
+    handle = GetStdHandle(STD_INPUT_HANDLE);
+
+    if ((handle == INVALID_HANDLE_VALUE) || (handle == 0) 
+	     || (GetFileType(handle) == FILE_TYPE_UNKNOWN)) {
+	/*
+	 * If it's a bad or closed handle, then we don't have a console.
+	 */
+
+	return 0;
+    } else if (GetFileType(handle) == FILE_TYPE_CHAR) {
+	/*
+	 * A character file handle is a tty by definition.
+	 */
+
+	return 1;
+    } else {
+	return 0;
+    }
+}
--- tcl8.2-8.2.3.orig/mac/tclMacAppInit.c
+++ tcl8.2-8.2.3/mac/tclMacAppInit.c
@@ -26,10 +26,11 @@
 #endif
 
 #ifdef TCL_TEST
-extern int		Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
-extern int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Proctest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Proctest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Objtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int		Mactest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 #endif /* TCL_TEST */
 
 /*
@@ -97,6 +98,13 @@
 Tcl_AppInit(
     Tcl_Interp *interp)		/* Interpreter for application. */
 {
+#ifdef TCL_TEST
+    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
+            (Tcl_PackageInitProc *) NULL);
+    Tcl_StaticPackage(interp, "Tclptest", Tclptest_Init,
+            (Tcl_PackageInitProc *) NULL);
+#endif /* TCL_TEST */
+
     if (Tcl_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
@@ -107,14 +115,21 @@
     }
     Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
             (Tcl_PackageInitProc *) NULL);
-    if (TclObjTest_Init(interp) == TCL_ERROR) {
+    if (ObjTest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
-    if (Procbodytest_Init(interp) == TCL_ERROR) {
+    Tcl_StaticPackage(interp, "Objtest", Objtest_Init,
+            (Tcl_PackageInitProc *) NULL);
+    if (Mactest_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Mactest", Mactest_Init,
+            (Tcl_PackageInitProc *) NULL);
+    if (Proctest_Init(interp) == TCL_ERROR) {
 	return TCL_ERROR;
     }
-    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
-            Procbodytest_SafeInit);
+    Tcl_StaticPackage(interp, "Proctest", Proctest_Init,
+            Proctest_SafeInit);
 #endif /* TCL_TEST */
 
     /*
--- tcl8.2-8.2.3.orig/mac/tclMacChan.c
+++ tcl8.2-8.2.3/mac/tclMacChan.c
@@ -753,8 +753,8 @@
 TclpOpenFileChannel(
     Tcl_Interp *interp,			/* Interpreter for error reporting;
                                          * can be NULL. */
-    char *fileName,			/* Name of file to open. */
-    char *modeString,			/* A list of POSIX open modes or
+    CONST char *fileName,		/* Name of file to open. */
+    CONST char *modeString,		/* A list of POSIX open modes or
                                          * a string such as "rw". */
     int permissions)			/* If the open involves creating a
                                          * file, with what modes to create
--- tcl8.2-8.2.3.orig/mac/tclMacFile.c
+++ tcl8.2-8.2.3/mac/tclMacFile.c
@@ -102,7 +102,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclpMatchFiles --
+ * TclpMatchFilesTypes --
  *
  *	This routine is used by the globbing code to search a
  *	directory for all files which match a given pattern.
@@ -120,14 +120,16 @@
  *---------------------------------------------------------------------- */
 
 int
-TclpMatchFiles(
+TclpMatchFilesTypes(
     Tcl_Interp *interp,		/* Interpreter to receive results. */
     char *separators,		/* Directory separators to pass to TclDoGlob. */
     Tcl_DString *dirPtr,	/* Contains path to directory to search. */
     char *pattern,		/* Pattern to match against. */
-    char *tail)			/* Pointer to end of pattern.  Tail must
+    char *tail,			/* Pointer to end of pattern.  Tail must
 				 * point to a location in pattern and must
 				 * not be static.*/
+    GlobTypeData *types)	/* Object containing list of acceptable types.
+				 * May be NULL. */
 {
     char *patternEnd = tail;
     char savedChar;
@@ -141,6 +143,10 @@
     short itemIndex;
     Str255 fileName;
     Tcl_DString fileString;    
+    Tcl_Obj *resultPtr;
+
+    /* Until we actually handle types, we do this to avoid warnings */
+    types = NULL;     
 
     /*
      * Make sure that the directory part of the name really is a
@@ -184,6 +190,7 @@
     savedChar = *patternEnd;
     *patternEnd = '\0';
 
+    resultPtr = Tcl_GetObjResult(interp);
     while (1) {
 	pb.hFileInfo.ioFDirIndex = itemIndex;
 	pb.hFileInfo.ioDirID = dirID;
@@ -207,13 +214,15 @@
 	    if (tail == NULL) {
 		if ((dirPtr->length > 1) &&
 			(strchr(dirPtr->string+1, ':') == NULL)) {
-		    Tcl_AppendElement(interp, dirPtr->string+1);
+		    Tcl_ListObjAppendElement(interp, resultPtr, 
+					     Tcl_NewStringObj(Tcl_DStringValue(dirPtr)+1,Tcl_DStringLength(dirPtr)-1));
 		} else {
-		    Tcl_AppendElement(interp, dirPtr->string);
+		    Tcl_ListObjAppendElement(interp, resultPtr, 
+					     Tcl_NewStringObj(Tcl_DStringValue(dirPtr),Tcl_DStringLength(dirPtr)));
 		}
 	    } else if ((pb.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
 		Tcl_DStringAppend(dirPtr, ":", 1);
-		result = TclDoGlob(interp, separators, dirPtr, tail);
+		result = TclDoGlob(interp, separators, dirPtr, tail, types);
 		if (result != TCL_OK) {
 		    Tcl_DStringFree(&fileString);
 		    break;
@@ -227,6 +236,25 @@
     *patternEnd = savedChar;
 
     return result;
+}
+
+/* 
+ * TclpMatchFiles --
+ * 
+ * This function is now obsolete.  Call the above function 
+ * 'TclpMatchFilesTypes' instead.
+ */
+int
+TclpMatchFiles(
+    Tcl_Interp *interp,		/* Interpreter to receive results. */
+    char *separators,		/* Directory separators to pass to TclDoGlob. */
+    Tcl_DString *dirPtr,	/* Contains path to directory to search. */
+    char *pattern,		/* Pattern to match against. */
+    char *tail)			/* Pointer to end of pattern.  Tail must
+				 * point to a location in pattern and must
+				 * not be static.*/
+{
+    return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL);
 }
 
 /*
--- tcl8.2-8.2.3.orig/mac/tclMacLoad.c
+++ tcl8.2-8.2.3/mac/tclMacLoad.c
@@ -31,6 +31,7 @@
 #include "tclPort.h"
 #include "tclInt.h"
 #include "tclMacInt.h"
+#include "::compat:dlfcn.h"
 
 #if GENERATINGPOWERPC
     #define OUR_ARCH_TYPE kPowerPCCFragArch
@@ -111,36 +112,88 @@
 				 * file which will be passed back to 
 				 * TclpUnloadFile() to unload the file. */
 {
+    VOID *handle = NULL;
+
+    handle = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL);
+    if (handle == NULL) {
+	Tcl_AppendResult(interp, "couldn't load file \"", fileName,
+		"\": ", dlerror(), (char *) NULL);
+	return TCL_ERROR;
+    }
+    *proc1Ptr = (Tcl_PackageInitProc *) dlsym(handle, (char *) sym1);
+    *proc2Ptr = (Tcl_PackageInitProc *) dlsym(handle, (char *) sym2);
+    *clientDataPtr = (ClientData) handle;
+    return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlopen --
+ *
+ *	This function is an implementation of dlopen() for the Mac.
+ *
+ * Results:
+ *	Returns the handle of the newly loaded library, or NULL on
+ *	failure.
+ *
+ * Side effects:
+ *	Loads the specified library into the process.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Str255 errName;
+
+VOID *
+dlopen(path, mode)
+    CONST char *path;
+    int mode;
+{
     CFragConnectionID connID;
     Ptr dummy;
     OSErr err;
-    CFragSymbolClass symClass;
     FSSpec fileSpec;
     short fragFileRef, saveFileRef;
     Handle fragResource;
     UInt32 offset = 0;
     UInt32 length = kCFragGoesToEOF;
     char packageName[255];
-    Str255 errName;
-    Tcl_DString ds;
-    char *native;
+    CONST char* pkgGuess;
+    char* p;
     
     /*
      * First thing we must do is infer the package name from the sym1
      * variable.  This is kind of dumb since the caller actually knows
      * this value, it just doesn't give it to us.
      */
-    strcpy(packageName, sym1);
-    Tcl_UtfToLower(packageName);
-    *(Tcl_UtfAtIndex(packageName, Tcl_NumUtfChars(packageName, -1) - 5)) = 0;
-    
-    native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
-    err = FSpLocationFromPath(strlen(native), native, &fileSpec);
-    Tcl_DStringFree(&ds);
+
+    if ((pkgGuess = strrchr(path,':')) != NULL) {
+      pkgGuess++;
+    } else {
+      pkgGuess = path;
+    }
+    if (!strncmp(pkgGuess,"lib",3)) {
+      pkgGuess+=3;
+    }
+    strcpy(packageName,pkgGuess);
+    p = packageName;
+    if ((*p) && islower(UCHAR(*p++))) {
+      packageName[0] = (char) toupper(UCHAR(packageName[0]));
+    }
+    while (isalpha(UCHAR(*p)) || (*p == '_')) {
+      if (isupper(UCHAR(*p))) {
+        *p = (char) tolower(UCHAR(*p));
+      }
+      p++;
+    }
+    *p = 0;
+
+    err = FSpLocationFromPath(strlen(path), (char *) path, &fileSpec);
     
     if (err != noErr) {
-	Tcl_SetResult(interp, "could not locate shared library", TCL_STATIC);
-	return TCL_ERROR;
+	strcpy((char *) errName, "file not found");
+	return (VOID *) NULL;
     }
     
     /*
@@ -199,86 +252,124 @@
 	    kLoadCFrag, &connID, &dummy, errName);
     if (err != fragNoErr) {
 	p2cstr(errName);
-	Tcl_AppendResult(interp, "couldn't load file \"", fileName,
-	    "\": ", errName, (char *) NULL);
-	return TCL_ERROR;
+	return (VOID *) NULL;
     }
-    
+    return (VOID *) connID;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclGuessPackageName --
+ *
+ *	If the "load" command is invoked without providing a package
+ *	name, this procedure is invoked to try to figure it out.
+ *
+ * Results:
+ *	Always returns 0 to indicate that we couldn't figure out a
+ *	package name;  generic code will then try to guess the package
+ *	from the file name.  A return value of 1 would have meant that
+ *	we figured out the package name and put it in bufPtr.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclGuessPackageName(
+    char *fileName,		/* Name of file containing package (already
+				 * translated to local form if needed). */
+    Tcl_DString *bufPtr)	/* Initialized empty dstring.  Append
+				 * package name to this if possible. */
+{
+    return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * dlsym --
+ *
+ *	This function is an alternative for the system function
+ *	GetProcAddress. It returns the address of a
+ *	symbol, give the handle returned by dlopen().
+ *
+ * Results:
+ *	Returns the address of the symbol in the dll.
+ *
+ * Side effects:
+ *	None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+VOID *
+dlsym(handle, symbol)
+    VOID *handle;
+    CONST char *symbol;
+{
+    VOID *procPtr;
+    char sym1[255];
+    OSErr err;
+    SymClass symClass;
+
+    strcpy(sym1, symbol);
     c2pstr(sym1);
-    err = FindSymbol(connID, (StringPtr) sym1, (Ptr *) proc1Ptr, &symClass);
-    p2cstr((StringPtr) sym1);
-    if (err != fragNoErr || symClass == kDataCFragSymbol) {
-	Tcl_SetResult(interp,
-		"could not find Initialization routine in library",
-		TCL_STATIC);
-	return TCL_ERROR;
-    }
 
-    c2pstr(sym2);
-    err = FindSymbol(connID, (StringPtr) sym2, (Ptr *) proc2Ptr, &symClass);
-    p2cstr((StringPtr) sym2);
+    err = FindSymbol((ConnectionID) handle, (StringPtr) sym1,
+	    (Ptr *) &procPtr, &symClass);
     if (err != fragNoErr || symClass == kDataCFragSymbol) {
-	*proc2Ptr = NULL;
+	procPtr = (VOID *) NULL;
     }
-    
-    *clientDataPtr = (ClientData) connID;
-    
-    return TCL_OK;
+    return procPtr;
 }
 
 /*
  *----------------------------------------------------------------------
  *
- * TclpUnloadFile --
+ * dlerror --
  *
- *	Unloads a dynamically loaded binary code file from memory.
- *	Code pointers in the formerly loaded file are no longer valid
- *	after calling this function.
+ *	This function returns a string describing the error which
+ *	occurred in dlopen().
  *
  * Results:
- *	None.
+ *	Returns an error message.
  *
  * Side effects:
- *	Does nothing.  Can anything be done?
+ *	None.
  *
  *----------------------------------------------------------------------
  */
 
-void
-TclpUnloadFile(clientData)
-    ClientData clientData;	/* ClientData returned by a previous call
-				 * to TclpLoadFile().  The clientData is 
-				 * a token that represents the loaded 
-				 * file. */
+char *
+dlerror()
 {
+    return (char *) errName;
 }
+
 
 /*
  *----------------------------------------------------------------------
  *
- * TclGuessPackageName --
+ * dlclose --
  *
- *	If the "load" command is invoked without providing a package
- *	name, this procedure is invoked to try to figure it out.
+ *	Not implemented yet.
  *
  * Results:
- *	Always returns 0 to indicate that we couldn't figure out a
- *	package name;  generic code will then try to guess the package
- *	from the file name.  A return value of 1 would have meant that
- *	we figured out the package name and put it in bufPtr.
+ *	Always returns 0 (= O.K.)
  *
  * Side effects:
- *	None.
+ *	None
  *
  *----------------------------------------------------------------------
  */
 
 int
-TclGuessPackageName(
-    char *fileName,		/* Name of file containing package (already
-				 * translated to local form if needed). */
-    Tcl_DString *bufPtr)	/* Initialized empty dstring.  Append
-				 * package name to this if possible. */
+dlclose(handle)
+    VOID *handle;
 {
     return 0;
 }
+
--- tcl8.2-8.2.3.orig/mac/tclMacTest.c
+++ tcl8.2-8.2.3/mac/tclMacTest.c
@@ -29,6 +29,7 @@
  */
 
 int			TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
+int			Mactest_Init _ANSI_ARGS_((Tcl_Interp *interp));
 static int		DebuggerCmd _ANSI_ARGS_((ClientData dummy,
 			    Tcl_Interp *interp, int argc, char **argv));
 static int		WriteTextResource _ANSI_ARGS_((ClientData dummy,
@@ -38,7 +39,7 @@
 /*
  *----------------------------------------------------------------------
  *
- * TclplatformtestInit --
+ * Mactest_Init --
  *
  *	Defines commands that test platform specific functionality for
  *	Unix platforms.
@@ -53,9 +54,16 @@
  */
 
 int
-TclplatformtestInit(
+Mactest_Init (
     Tcl_Interp *interp)		/* Interpreter to add commands to. */
 {
+    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
+	return TCL_ERROR;
+    }
+    if (Tcl_PkgProvide(interp, "Mactest", TCL_VERSION) != TCL_OK) {
+        return TCL_ERROR;
+    }
+
     /*
      * Add commands for platform specific tests on MacOS here.
      */
@@ -68,6 +76,29 @@
     return TCL_OK;
 }
 
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclplatformtestInit --
+ *
+ *	Defines commands that test platform specific functionality for
+ *	Mac platforms.
+ *
+ * Results:
+ *	A standard Tcl result.
+ *
+ * Side effects:
+ *	Defines new commands.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclplatformtestInit (
+    Tcl_Interp *interp)		/* Interpreter to add commands to. */
+{
+    return Mactest_Init(interp);
+}
 /*
  *----------------------------------------------------------------------
  *
--- tcl8.2-8.2.3.orig/mac/tclMacShLib.exp
+++ tcl8.2-8.2.3/mac/tclMacShLib.exp
@@ -418,6 +418,7 @@
 Tcl_DbNewObj
 Tcl_DbNewStringObj
 Tcl_DeleteAssocData
+Tcl_DefineStaticFile
 Tcl_DeleteChannelHandler
 Tcl_DeleteCloseHandler
 Tcl_DeleteCommand
@@ -511,6 +512,7 @@
 Tcl_GetPathType
 Tcl_GetServiceMode
 Tcl_GetSlave
+Tcl_GetStaticFile
 Tcl_GetStdChannel
 Tcl_GetStringFromObj
 Tcl_GetStringResult
@@ -603,6 +605,7 @@
 Tcl_ReadObjCmd
 Tcl_Realloc
 Tcl_RecordAndEval
+Tcl_ReplaceChannel
 Tcl_RegExpCompile
 Tcl_RegExpExec
 Tcl_RegExpMatch
@@ -669,6 +672,7 @@
 Tcl_TraceVar
 Tcl_TraceVar2
 Tcl_TranslateFileName
+Tcl_UndoReplaceChannel
 Tcl_Ungets
 Tcl_UnlinkVar
 Tcl_UnregisterChannel
@@ -765,6 +769,9 @@
 cuserid
 difftime
 div
+dlerror
+dlopen
+dlsym
 environ
 errno
 exec
--- tcl8.2-8.2.3.orig/mac/pkgIndex.tcl
+++ tcl8.2-8.2.3/mac/pkgIndex.tcl
@@ -0,0 +1,14 @@
+# Tcl package index file, version 1.0
+
+package ifneeded Objtest 8.0 [list tclPkgSetup $dir Objtest 8.0 \
+    {{Objtest.shlb load {testbooleanobj testdoubleobj testindexobj testintobj
+    testobj teststringobj}}}]
+package ifneeded Mactest 8.0 [list tclPkgSetup $dir Mactest 8.0 \
+    {{Tclptest.shlb load {debugger testWriteTextResource}}}]
+package ifneeded Tcltest 8.0 [list tclPkgSetup $dir Tcltest 8.0 \
+    {{Tcltest.shlb load {gettimes noop testasync testchannel testchannelevent
+    testchmod testcmdinfo testcmdtoken testdcall testdel testdelassocdata
+    testdstring testexithandler testexprlong testexprstring testfevent testfhandle
+    testfile testfilewait testgetassocdata testgetplatform testinterpdelete
+    testlink testmodal testpanic testsetassocdata testsetplatform teststaticpkg
+    testtranslatefilename testupvar testwordend}}}]
--- tcl8.2-8.2.3.orig/debian/rules
+++ tcl8.2-8.2.3/debian/rules
@@ -0,0 +1,137 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# This version is for a hypothetical package that builds an
+# architecture-dependant package, as well as an architecture-independent
+# package.
+
+# Uncomment this to turn on verbose mode. 
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=2
+
+v = 8.2
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add here commands to compile the package.
+	cd unix && \
+	  ./configure --prefix=/usr --enable-shared && \
+	  $(MAKE) CFLAGS="-g -O2 -D_REENTRANT"
+	# Build the static library.
+	cd unix && \
+	  ar cr libtcl$(v).a *.o && \
+	  ar d libtcl$(v).a tclAppInit.o && \
+	  ranlib libtcl$(v).a
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp install-stamp
+
+	# Add here commands to clean up after the build process.
+	-cd unix && $(MAKE) clean
+	-cd unix && $(MAKE) distclean
+
+	dh_clean tests/pkg/pkga.so unix/config.log
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp.
+	cd unix && \
+	  make INSTALL_ROOT=`pwd`/../debian/tmp \
+	    MAN_INSTALL_DIR=`pwd`/../debian/tmp/usr/share/man \
+	    MANN_INSTALL_DIR=`pwd`/../debian/tmp/usr/share/man/man3 install
+	# Fix up the libraries.
+	cp unix/libtcl$(v).a debian/tmp/usr/lib
+	ln -sf libtcl$(v).so.1 debian/tmp/usr/lib/libtcl$(v).so
+	# Fix up the include files.
+	install -d debian/tmp/usr/include/tcl$(v)/generic
+	cp generic/*.h debian/tmp/usr/include/tcl$(v)/generic
+	install -d debian/tmp/usr/include/tcl$(v)/unix
+	cp unix/*.h debian/tmp/usr/include/tcl$(v)/unix
+	install -d debian/tmp/usr/share/aclocal
+	cp unix/aclocal.m4 debian/tmp/usr/share/aclocal/tcl$(v).m4
+	# Fix up the manpages.
+	cd debian/tmp/usr/share/man/man1 && \
+	  mv tclsh.1 tclsh$(v).1
+	cd debian/tmp/usr/share/man/man3 && \
+	  for f in *.[3n] ; do \
+	    mv $$f $${f/.[3n]/.3tcl} ; \
+	  done
+
+	dh_movefiles
+	touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+	#dh_testversion ge 2.0
+	#dh_testdir -i
+	#dh_testroot -i
+	#dh_installdocs -i
+	#rm -rf debian/tcl$(v)-doc/usr/share/doc/tcl$(v)-doc
+	#ln -sf tcl$(v) debian/tcl$(v)-doc/usr/share/doc/tcl$(v)-doc
+	##dh_installexamples -i
+	##dh_installmenu -i
+	##dh_installemacsen -i
+	##dh_installpam -i
+	##dh_installinit -i
+	##dh_installcron -i
+	##dh_installmanpages -i
+	##dh_undocumented
+	##dh_installchangelogs -i
+	##dh_link -i
+	#dh_compress -i
+	#dh_fixperms -i
+	### You may want to make some executables suid here.
+	##dh_suidregister -i
+	#dh_installdeb -i
+	#dh_gencontrol -i
+	#dh_md5sums -i
+	#dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testversion ge 2.0
+	dh_testdir -a
+	dh_testroot -a
+	dh_installdocs -a
+	rm -rf debian/tcl$(v)-dev/usr/share/doc/tcl$(v)-dev
+	ln -sf tcl$(v) debian/tcl$(v)-dev/usr/share/doc/tcl$(v)-dev
+	#dh_installexamples -a
+	dh_installmenu -a
+	#dh_installemacsen -a
+	#dh_installpam -a
+	#dh_installinit -a
+	#dh_installcron -a
+	#dh_installmanpages -a
+	#dh_undocumented
+	#dh_installchangelogs -a
+	dh_installchangelogs -ptcl$(v) -k changes
+	dh_strip -a
+	#dh_link -a
+	dh_compress -a
+	dh_fixperms -a
+	# You may want to make some executables suid here.
+	#dh_suidregister -a
+	dh_installdeb -a
+	dh_makeshlibs -a -V 'tcl$(v) (>= 8.2.2)'
+	dh_shlibdeps -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+source diff:
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- tcl8.2-8.2.3.orig/debian/changelog
+++ tcl8.2-8.2.3/debian/changelog
@@ -0,0 +1,77 @@
+tcl8.2 (8.2.3-2) frozen unstable; urgency=low
+
+  * Fixed sparc build problem (Bug#59434)
+
+ -- David Engel <david@debian.org>  Thu,  9 Mar 2000 21:37:44 -0600
+
+tcl8.2 (8.2.3-1) unstable; urgency=low
+
+  * New upstream version.
+  * Added /usr/share/aclocal/tcl8.2.m4 to ease building extensions.
+
+ -- David Engel <david@debian.org>  Mon,  3 Jan 2000 20:30:56 -0600
+
+tcl8.2 (8.2.2-1) unstable; urgency=low
+
+  * New upstream version.
+  * New upstream plus patch.
+
+ -- David Engel <david@debian.org>  Mon, 15 Nov 1999 11:17:54 -0600
+
+tcl8.2 (8.2.1-5) unstable; urgency=low
+
+  * Applied the plus patch (supercedes the XIM patch).
+  * Removed use of -rpath.
+
+ -- David Engel <david@debian.org>  Sat, 30 Oct 1999 13:56:16 -0500
+
+tcl8.2 (8.2.1-4) unstable; urgency=low
+
+  * Fixed another XIM problem.
+
+ -- David Engel <david@debian.org>  Mon, 25 Oct 1999 19:52:15 -0500
+
+tcl8.2 (8.2.1-3) unstable; urgency=low
+
+  * Fixed XIM encoding support (Bug#47441, Bug#47448).
+
+ -- David Engel <david@debian.org>  Tue, 19 Oct 1999 20:46:40 -0500
+
+tcl8.2 (8.2.1-2) unstable; urgency=low
+
+  * Added zh_TW.Big5 locale support.
+
+ -- David Engel <david@debian.org>  Mon, 11 Oct 1999 10:49:48 -0500
+
+tcl8.2 (8.2.1-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- David Engel <david@debian.org>  Mon,  4 Oct 1999 17:00:06 -0500
+
+tcl8.2 (8.2.0-3) unstable; urgency=low
+
+  * FHS changes.
+  * Applied XIM patch (Bug#44580).
+
+ -- David Engel <david@debian.org>  Mon,  4 Oct 1999 11:04:04 -0500
+
+tcl8.2 (8.2.0-2) unstable; urgency=low
+
+  * Removed -doc and multiple -dev package support.
+
+ -- David Engel <david@debian.org>  Mon, 23 Aug 1999 10:38:51 -0500
+
+tcl8.2 (8.2.0-1) unstable; urgency=low
+
+  * Initial packaging.
+  * Added Suggests: tclreadline.
+  * Added a Debian menu item.
+  * Allow multiple tcl*-dev packages to be installed.
+
+ -- David Engel <david@debian.org>  Sat, 21 Aug 1999 14:35:44 -0500
+
+Local variables:
+mode: debian-changelog
+add-log-mailing-address: "david@debian.org"
+End:
--- tcl8.2-8.2.3.orig/debian/tcl8.2-dev.files
+++ tcl8.2-8.2.3/debian/tcl8.2-dev.files
@@ -0,0 +1,6 @@
+usr/include
+usr/lib/*.a
+usr/lib/*.so
+usr/lib/*.sh
+usr/share/man/man3
+usr/share/aclocal
--- tcl8.2-8.2.3.orig/debian/control
+++ tcl8.2-8.2.3/debian/control
@@ -0,0 +1,29 @@
+Source: tcl8.2
+Section: libs
+Priority: optional
+Maintainer: David Engel <david@debian.org>
+Standards-Version: 2.4.0.0
+
+Package: tcl8.2-dev
+Section: devel
+Priority: optional
+Architecture: any
+Depends: libc6-dev, tcl8.2 (=${Source-Version})
+Conflicts: tcl, tcl-dev, tcl-doc
+Replaces: tcl8.2-doc
+Provides: tcl-dev, tcl-doc
+Description: The Tool Command Language (TCL) v8.2 - Development Files.
+ TCL is a powerful, easy to use, interpreted scripting language.
+
+Package: tcl8.2
+Section: libs
+Priority: optional
+Architecture: any
+Depends: ${shlibs:Depends}
+Conflicts: tcl, tcl74 (<=7.4p3-2)
+Replaces: tcl8.2-doc
+Provides: tclsh
+Suggests: tclreadline
+Description: The Tool Command Language (TCL) v8.2 - Run-Time Files.
+ TCL is a powerful, easy to use, interpreted scripting language.
+
--- tcl8.2-8.2.3.orig/debian/tcl8.2-dev.preinst
+++ tcl8.2-8.2.3/debian/tcl8.2-dev.preinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if [ -L /usr/lib/tclConfig.sh ] ; then
+	update-alternatives --remove tclConfig.sh /usr/lib/tcl8.2/tclConfig.sh
+fi
+
+#DEBHELPER#
--- tcl8.2-8.2.3.orig/debian/tcl8.2.files
+++ tcl8.2-8.2.3/debian/tcl8.2.files
@@ -0,0 +1,4 @@
+usr/bin
+usr/lib/tcl[0-9]*
+usr/lib/*.so.*
+usr/share/man/man1
--- tcl8.2-8.2.3.orig/debian/tcl8.2.prerm
+++ tcl8.2-8.2.3/debian/tcl8.2.prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if [ $1 != "upgrade" ] ; then
+	update-alternatives --remove tclsh /usr/bin/tclsh8.2
+fi
+
+#DEBHELPER#
--- tcl8.2-8.2.3.orig/debian/patches/sparc
+++ tcl8.2-8.2.3/debian/patches/sparc
@@ -0,0 +1,89 @@
+From david  Thu Mar  2 10:20:04 2000
+Return-Path: <owner@bugs.debian.org>
+Received: from mail
+	by localhost with POP3 (fetchmail-5.2.3)
+	for david@localhost (single-drop); Thu, 02 Mar 2000 10:20:04 -0600 (CST)
+Received: from h8.mail.home.com ([24.0.95.50]) by lh2.rdc2.tx.home.com
+          (InterMail v4.01.01.00 201-229-111) with ESMTP
+          id <20000302161810.NQYN10089.lh2.rdc2.tx.home.com@h8.mail.home.com>
+          for <dlengel@mail.grlnd1.tx.home.com>;
+          Thu, 2 Mar 2000 08:18:10 -0800
+Received: from mx5-rwc.mail.home.com (mx5-rwc.mail.home.com [24.0.95.34])
+	by h8.mail.home.com (8.9.3/8.9.0) with ESMTP id IAA08435
+	for <dlengel@home.com>; Thu, 2 Mar 2000 08:18:09 -0800 (PST)
+Received: from master.debian.org (master.debian.org [216.234.231.5])
+	by mx5-rwc.mail.home.com (8.9.1/8.9.1) with SMTP id IAA01363
+	for <dlengel@home.com>; Thu, 2 Mar 2000 08:18:09 -0800 (PST)
+Received: (qmail 16076 invoked by uid 834); 2 Mar 2000 16:18:03 -0000
+Delivered-To: david@debian.org
+Received: (qmail 16069 invoked by uid 1227); 2 Mar 2000 16:18:03 -0000
+Subject: Bug#59434: tcl8.2: failes to build on sparc
+Reply-To: Ben Collins <bcollins@debian.org>, 59434@bugs.debian.org
+Resent-From: Ben Collins <bcollins@debian.org>
+Orignal-Sender: Ben Collins <bmc@visi.net>
+Resent-To: debian-bugs-dist@lists.debian.org
+Resent-CC: David Engel <david@debian.org>
+Resent-Date: Thu, 02 Mar 2000 16:18:02 GMT
+Resent-Message-ID: <handler.59434.B.95201338012913@bugs.debian.org>
+Resent-Sender: owner@bugs.debian.org
+X-Debian-PR-Message: report 59434
+X-Debian-PR-Package: tcl8.2
+X-Loop: owner@bugs.debian.org
+Received: via spool by bugs@bugs.debian.org id=B.95201338012913
+          (code B ref -1); Thu, 02 Mar 2000 16:18:02 GMT
+Date: Thu, 2 Mar 2000 10:58:17 -0500
+From: Ben Collins <bcollins@debian.org>
+To: submit@bugs.debian.org
+Message-ID: <20000302105817.B226@visi.net>
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary="6c2NcOVqGQ03X4Wi"
+User-Agent: Mutt/1.0.1i
+Sender: Ben Collins <bmc@visi.net>
+Status: RO
+Content-Length: 1364
+Lines: 43
+
+
+--6c2NcOVqGQ03X4Wi
+Content-Type: text/plain; charset=us-ascii
+
+Package: tcl8.2
+Severity: important
+
+The provided patch allows tcl8.2 to build on sparc.
+
+Ben
+
+-- 
+ -----------=======-=-======-=========-----------=====------------=-=------
+/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
+`     bcollins@debian.org  --  bcollins@openldap.org  --  bmc@visi.net     '
+ `---=========------=======-------------=-=-----=-===-======-------=--=---'
+
+--6c2NcOVqGQ03X4Wi
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: attachment; filename="tcl8.2.diff"
+
+--- generic/tclPosixStr.c~	Thu Mar  2 09:02:48 2000
++++ generic/tclPosixStr.c	Thu Mar  2 09:06:22 2000
+@@ -986,7 +986,7 @@
+ #ifdef SIGPROF
+ 	case SIGPROF: return "SIGPROF";
+ #endif
+-#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
++#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
+ 	case SIGPWR: return "SIGPWR";
+ #endif
+ #ifdef SIGQUIT
+@@ -1118,7 +1118,7 @@
+ #ifdef SIGPROF
+ 	case SIGPROF: return "profiling alarm";
+ #endif
+-#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
++#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
+ 	case SIGPWR: return "power-fail restart";
+ #endif
+ #ifdef SIGQUIT
+
+--6c2NcOVqGQ03X4Wi--
+
--- tcl8.2-8.2.3.orig/debian/patches/plus
+++ tcl8.2-8.2.3/debian/patches/plus
@@ -0,0 +1,34096 @@
+
+tcl8.2.2plus.patch -   11/14/1999
+
+This patch file updates from Tcl 8.2.2 to Tcl 8.2.2+. It should be applied
+by running the "patch" program in the top-level directory of a clean
+Tcl 8.2.2 release, using the command "patch -p0 <tcl8.2.2plus.patch"
+
+If you are using Solaris, don't be surprised if the patch utility does not
+work. This is a known problem. Better install GNU patch version 2.1 or later.
+
+Prereq: "8.2.2"
+*** generic/tcl.h.orig	Sat Oct 30 13:05:57 1999
+--- generic/tcl.h	Sun Nov 14 18:50:43 1999
+***************
+*** 59,65 ****
+  #define TCL_RELEASE_SERIAL  2
+  
+  #define TCL_VERSION	    "8.2"
+! #define TCL_PATCH_LEVEL	    "8.2.2"
+  
+  /*
+   * The following definitions set up the proper options for Windows
+--- 59,65 ----
+  #define TCL_RELEASE_SERIAL  2
+  
+  #define TCL_VERSION	    "8.2"
+! #define TCL_PATCH_LEVEL	    "8.2.2+"
+  
+  /*
+   * The following definitions set up the proper options for Windows
+***************
+*** 178,183 ****
+--- 178,187 ----
+  #include <stdio.h>
+  #endif
+  
++ #ifdef __STDC__
++ #include <stddef.h>
++ #endif /* __STDC__ */
++ 
+  /*
+   * Definitions that allow Tcl functions with variable numbers of
+   * arguments to be used with either varargs.h or stdarg.h.  TCL_VARARGS
+***************
+*** 466,471 ****
+--- 470,512 ----
+  #define TCL_BREAK	3
+  #define TCL_CONTINUE	4
+  
++ /*
++  * The following definitions are the error codes returned by the conversion
++  * routines:
++  *
++  * TCL_OK:			All characters were converted.
++  *
++  * TCL_CONVERT_NOSPACE:		The output buffer would not have been large
++  *				enough for all of the converted data; as many
++  *				characters as could fit were converted though.
++  *
++  * TCL_CONVERT_MULTIBYTE:	The last few bytes in the source string were
++  *				the beginning of a multibyte sequence, but
++  *				more bytes were needed to complete this
++  *				sequence.  A subsequent call to the conversion
++  *				routine should pass the beginning of this
++  *				unconverted sequence plus additional bytes
++  *				from the source stream to properly convert
++  *				the formerly split-up multibyte sequence.
++  *
++  * TCL_CONVERT_SYNTAX:		The source stream contained an invalid
++  *				character sequence.  This may occur if the
++  *				input stream has been damaged or if the input
++  *				encoding method was misidentified.  This error
++  *				is reported only if TCL_ENCODING_STOPONERROR
++  *				was specified.
++  * 
++  * TCL_CONVERT_UNKNOWN:		The source string contained a character
++  *				that could not be represented in the target
++  *				encoding.  This error is reported only if
++  *				TCL_ENCODING_STOPONERROR was specified.
++  */
++ 
++ #define TCL_CONVERT_MULTIBYTE		-1
++ #define TCL_CONVERT_SYNTAX		-2
++ #define TCL_CONVERT_UNKNOWN		-3
++ #define TCL_CONVERT_NOSPACE		-4
++ 
+  #define TCL_RESULT_SIZE 200
+  
+  /*
+***************
+*** 531,537 ****
+  typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
+  	Tcl_Interp *interp, int objc, struct Tcl_Obj *CONST objv[]));
+  typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
+! typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(char *, format));
+  typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
+          Tcl_Channel chan, char *address, int port));
+  typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
+--- 572,578 ----
+  typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
+  	Tcl_Interp *interp, int objc, struct Tcl_Obj *CONST objv[]));
+  typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
+! typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
+  typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
+          Tcl_Channel chan, char *address, int port));
+  typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
+***************
+*** 543,548 ****
+--- 584,590 ----
+  typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask,
+  	Tcl_FileProc *proc, ClientData clientData));
+  typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd));
++ typedef int (Tcl_MainLoopProc) _ANSI_ARGS_((void));
+  
+  /*
+   * The following structure represents a type of object, which is a
+***************
+*** 815,820 ****
+--- 857,870 ----
+  #define TCL_INTEGER_SPACE	24
+  
+  /*
++  * Definition for a number of bytes of buffer space sufficient to hold the
++  * string representation of an integer in base 10 (assuming the existence
++  * of 64-bit integers).
++  */
++ 
++ #define TCL_INTEGER_SPACE	24
++ 
++ /*
+   * Flag that may be passed to Tcl_ConvertElement to force it not to
+   * output braces (careful!  if you change this flag be sure to change
+   * the definitions at the front of tclUtil.c).
+***************
+*** 1067,1072 ****
+--- 1117,1128 ----
+  #define TCL_READABLE	(1<<1)
+  #define TCL_WRITABLE	(1<<2)
+  #define TCL_EXCEPTION	(1<<3)
++ #define TCL_ACTIVE	0
++ 
++ typedef struct Tcl_StaticFile {
++     CONST char *name;
++     char **content;
++ } Tcl_StaticFile;
+  
+  /*
+   * Flag values to pass to Tcl_OpenCommandChannel to indicate the
+***************
+*** 1164,1169 ****
+--- 1220,1234 ----
+  } Tcl_EolTranslation;
+  
+  /*
++  * Definitions for different byteorders.
++  */
++ 
++ typedef int Tcl_ByteOrder;
++ 
++ #define TCL_BIGENDIAN 0
++ #define TCL_SMALLENDIAN 1
++ 
++ /*
+   * struct Tcl_ChannelType:
+   *
+   * One such structure exists for each type (kind) of channel.
+***************
+*** 1558,1563 ****
+--- 1623,1630 ----
+  #define Tcl_TildeSubst Tcl_TranslateFileName
+  #define panic Tcl_Panic
+  #define panicVA Tcl_PanicVA
++ #define Tcl_ReplaceChannel	Tcl_StackChannel
++ #define Tcl_UndoReplaceChannel	Tcl_UnstackChannel
+  
+  /*
+   * The following constant is used to test for older versions of Tcl
+*** BLT_PATCHES.orig	Sun Nov 14 18:54:51 1999
+--- BLT_PATCHES	Sun Nov 14 18:50:43 1999
+***************
+*** 0 ****
+--- 1,115 ----
++ Here are a few patches to improve Stubs support for BLT2.4j. It
++ is far from complete yet, and a few more manual modifications
++ to the Makefile should be made to make it 100% functional.
++ 
++                                        Jan Nijtmans
++ 
++ *** src/bltCanvEps.c.orig	Sat Aug 28 17:42:19 1999
++ --- src/bltCanvEps.c	Thu Oct  7 21:32:59 1999
++ ***************
++ *** 118,124 ****
++   
++   static Tk_CustomOption tagsOption =
++   {
++ !     Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData)NULL
++   };
++   
++   extern Tk_CustomOption bltDistanceOption;
++ --- 118,124 ----
++   
++   static Tk_CustomOption tagsOption =
++   {
++ !     (Tk_OptionParseProc *) NULL, (Tk_OptionPrintProc *) NULL, (ClientData)NULL
++   };
++   
++   extern Tk_CustomOption bltDistanceOption;
++ ***************
++ *** 1623,1628 ****
++ --- 1623,1630 ----
++   				 * collect font information;  0 means
++   				 * final Postscript is being created. */
++   {
++ +     tagsOption.parseProc = Tk_CanvasTagsParseProc;
++ +     tagsOption.printProc = Tk_CanvasTagsPrintProc;
++       EpsItem *epsPtr = (EpsItem *)itemPtr;
++       Tcl_DString dString;
++       Printable printable;
++ *** src/bltInit.c.orig	Wed Sep 22 22:32:04 1999
++ --- src/bltInit.c	Thu Oct  7 21:38:10 1999
++ ***************
++ *** 27,32 ****
++ --- 27,42 ----
++   
++   #include <bltInt.h>
++   
++ + #ifndef USE_TCL_STUBS
++ + #undef Tcl_InitStubs
++ + #define Tcl_InitStubs(a,b,c) Tcl_PkgRequire(a,"Tcl",TCL_VERSION,1)
++ + #endif
++ + 
++ + #ifndef USE_TK_STUBS
++ + #undef Tk_InitStubs
++ + #define Tk_InitStubs(a,b,c) Tcl_PkgRequire(a,"Tk",TCL_VERSION,1)
++ + #endif
++ + 
++   #ifdef __STDC__
++   static Tcl_MathProc MinMathProc, MaxMathProc;
++   #endif
++ ***************
++ *** 250,256 ****
++   {
++       Tcl_DString ds;
++       char *value;
++ -     int exact = TRUE;
++   #ifdef WIN32
++       HKEY key;
++       DWORD result;
++ --- 260,265 ----
++ ***************
++ *** 263,269 ****
++        * Check that the version of Tk we've loaded is the same that BLT was
++        * compiled and linked against.
++        */
++ !     if (Tcl_PkgRequire(interp, "Tk", TK_VERSION, exact) == NULL) {
++   	return TCL_ERROR;
++       }
++       /* Set the version variable. We'll use it in the following script. */
++ --- 272,281 ----
++        * Check that the version of Tk we've loaded is the same that BLT was
++        * compiled and linked against.
++        */
++ !     if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
++ ! 	return TCL_ERROR;
++ !     }
++ !     if (Tk_InitStubs(interp, "8.0", 0) == NULL) {
++   	return TCL_ERROR;
++       }
++       /* Set the version variable. We'll use it in the following script. */
++ *** src/bltUnixMain.c.orig	Sat Aug 28 17:43:04 1999
++ --- src/bltUnixMain.c	Thu Oct  7 21:33:00 1999
++ ***************
++ *** 45,50 ****
++ --- 45,53 ----
++    * software.
++    */
++   
++ + #undef USE_TCL_STUBS
++ + #undef USE_TK_STUBS
++ + 
++   #include <tcl.h>
++   #include <tk.h>
++   
++ *** src/bltWinMain.c.orig	Sat Aug 28 17:43:10 1999
++ --- src/bltWinMain.c	Thu Oct  7 21:33:00 1999
++ ***************
++ *** 11,16 ****
++ --- 11,19 ----
++    * SCCS: @(#) winMain.c 1.37 98/01/20 22:47:06
++    */
++   
++ + #undef USE_TCL_STUBS
++ + #undef USE_TK_STUBS
++ + 
++   #include "bltInt.h"
++   #include <locale.h>
++   
+*** README.PLUS.orig	Sun Nov 14 18:54:51 1999
+--- README.PLUS	Sun Nov 14 18:50:43 1999
+***************
+*** 0 ****
+--- 1,69 ----
++ About the "plus"-patch for Tcl8.2.1
++ 
++ LICENCE TERMS
++ 
++ The plus-patches are distributed under the same terms
++ as Tcl/Tk. Read the file "licence.terms" for more information.
++ 
++ ======================================================================
++ This patch contains the following enhancements:
++ 
++ Shared library support
++ 
++ If the option "--enable-shared" is given to the configure script both the
++ static and shared libraries are created. Also in all directories where
++ shared libraries are a pkgIndex.tcl file is created which contains
++ references to all functions in these shared libraries.
++ 
++ Because of the existance of pkgIndex.tcl files, the "package require"
++ command is enough to load the shared libraries into tclsh. For example:
++ 
++ 	>tclsh8.2
++ 	%package require Tk
++ 
++ This single command is enough to load libtk8.2.so  dynamically. The main
++ window "." will appear and all tk commands are available. For some systems
++ (e.g. SunOS4) this will not yet work in all situations, but usually the
++ cause of such a failure is because of your system doesn't have a shared
++ X11 library. The "package require Tk" has the side effect that at the
++ end of the script automatically an implicit "tkwait window ." will be
++ added. So, the application will continue to process events as long as
++ the main window exists.
++ 
++ C++-support
++ 
++ The following files are changed such that they now can be compiled by
++ any C or C++ compiler (both K&R and ANSI).
++ 
++ Tcl
++      tclAppInit.c
++      tclTest.c
++      tclUnixTest.c
++      pkga.c
++      pkgb.c
++      pkgc.c
++      pkgd.c
++      pkge.c
++      pkgf.c
++ 
++ Tk
++      tkAppInit.c
++      tkTest.c
++      tkSquare.c
++ 
++ Loadable extensions
++ 
++ If shared libraries are enabled, the executables tcltest and tktest are no
++ longer created for testing purposes. In stead, loadable libraries Tcltest.so,
++ Objtest.so, Proctest.so, Tclptest.so, Tktest.so, Tkptest.so and Tksquare.so are
++ created which only contain the additional test functions. These loadable
++ libraries will be used to test tclsh and wish.
++ 
++ ----------------------------------------------------------------------------
++  The "plus"-patch is implemented by:
++ 
++      Jan Nijtmans
++      CMG (Computer Management Group) Arnhem B.V.
++      email: j.nijtmans@chello.nl (private)
++             jan.nijtmans@cmg.nl (work)
++      url:   http://purl.oclc.org/net/nijtmans/
+*** TCLX_PATCHES.orig	Sun Nov 14 18:54:51 1999
+--- TCLX_PATCHES	Sun Nov 14 18:50:43 1999
+***************
+*** 0 ****
+--- 1,294 ----
++          TCLX_PATCHES
++ 
++ These patches to TclX8.1.1 form the beginning of Stubs-support
++ for TclX. Implemented are:
++ - Some fixes in the use of Tcl_InitStubs().
++ - libtclx8.1.1.so is now compiled with -DUSE_TCL_STUBS
++   and linked with the stub library.
++ - A few other fixes, such as header-file ordering in tclXfilescan.c
++   and a (char *) cast. Those two fixes are necessary only in
++   combination with the 8.1.1 plus-patch, and have no
++   other side-effects.
++ 
++ Still missing:
++ - TclX should export its own stub-table, and provide its
++   own stub-library (libtclxstub8.1.1.a) to be picked up by
++   libtkx8.1.1.so
++ - libtkx8.1.1.so should be linked with libtclstub8.1.a,
++   libtclxstub8.1.1.a and libtkstub8.1.a
++ 
++ This partial implementation is sufficient for me at this
++ moment. Later it will be implemented further.
++ 
++                      Jan Nijtmans     j.nijtmans@chello.nl
++ 
++ ==========================================================
++ *** unix/Common.mk.in.orig	Sat Jun 26 06:40:12 1999
++ --- unix/Common.mk.in	Sun Jun 27 10:35:06 1999
++ ***************
++ *** 91,97 ****
++   TCL_DEFS             = @TCL_DEFS@
++   TCL_LIBS             = @TCL_LIBS@
++   TCL_EXEC_PREFIX      = @TCL_EXEC_PREFIX@
++ ! TCL_SHLIB_CFLAGS     = @TCL_SHLIB_CFLAGS@
++   TCL_LD_FLAGS         = @TCL_LD_FLAGS@
++   TCL_DL_LIBS          = @TCL_DL_LIBS@
++   TCL_SHLIB_LD         = @TCL_SHLIB_LD@
++ --- 91,97 ----
++   TCL_DEFS             = @TCL_DEFS@
++   TCL_LIBS             = @TCL_LIBS@
++   TCL_EXEC_PREFIX      = @TCL_EXEC_PREFIX@
++ ! TCL_SHLIB_CFLAGS     = @TCL_SHLIB_CFLAGS@ -DUSE_TCL_STUBS
++   TCL_LD_FLAGS         = @TCL_LD_FLAGS@
++   TCL_DL_LIBS          = @TCL_DL_LIBS@
++   TCL_SHLIB_LD         = @TCL_SHLIB_LD@
++ *** unix/configure.orig	Sun Jun 27 12:13:56 1999
++ --- unix/configure	Sun Jun 27 12:17:40 1999
++ ***************
++ *** 4796,4801 ****
++ --- 4796,4803 ----
++   s%@TCL_EXTRA_CFLAGS@%$TCL_EXTRA_CFLAGS%g
++   s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
++   s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
++ + s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
++ + s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
++   s%@TK_VERSION@%$TK_VERSION%g
++   s%@TK_DEFS@%$TK_DEFS%g
++   s%@TK_LIBS@%$TK_LIBS%g
++ ***************
++ *** 4806,4811 ****
++ --- 4808,4815 ----
++   s%@TKX_DBGX@%$TKX_DBGX%g
++   s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
++   s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
++ + s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
++ + s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
++   s%@CC@%$CC%g
++   s%@SYSCFLAGS@%$SYSCFLAGS%g
++   s%@RANLIB@%$RANLIB%g
++ *** unix/configure.in.orig	Sun Jun 27 12:02:08 1999
++ --- unix/configure.in	Sun Jun 27 12:05:19 1999
++ ***************
++ *** 203,208 ****
++ --- 203,210 ----
++   AC_SUBST(TCL_EXTRA_CFLAGS)
++   AC_SUBST(TCL_BUILD_LIB_SPEC)
++   AC_SUBST(TCL_LIB_SPEC)
++ + AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
++ + AC_SUBST(TCL_STUB_LIB_SPEC)
++   
++   AC_SUBST(TK_VERSION)
++   AC_SUBST(TK_DEFS)
++ ***************
++ *** 214,219 ****
++ --- 216,223 ----
++   AC_SUBST(TKX_DBGX)
++   AC_SUBST(TK_BUILD_LIB_SPEC)
++   AC_SUBST(TK_LIB_SPEC)
++ + AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
++ + AC_SUBST(TK_STUB_LIB_SPEC)
++   
++   #------------------------------------------------------------------------------
++   # Check for various programs used during the build.  If the CC environment
++ ***************
++ *** 471,520 ****
++       fi
++   done
++   AC_SUBST(SHARED_LIBS)
++ - 
++ - #------------------------------------------------------------------------------
++ - # Check for Plus patch being installed. Does libtcl.a contains a definition of
++ - # Tcl_InitStandAlone() and does Tk contain Tk_InitStandAlone.
++ - #------------------------------------------------------------------------------
++ - AC_MSG_CHECKING([standalone support of Tcl (Plus patch)])
++ - if test -f "${TCL_BUILD}/unix/${TCL_STLIB_NAME}"; then
++ -     x=`nm -p "${TCL_BUILD}/unix/${TCL_STLIB_NAME}" |grep 'Tcl_InitStandAlone'`
++ -     if test "x$x" != "x"; then
++ -         # Build variables already set
++ - 	AC_MSG_RESULT([yes])
++ -         AC_DEFINE(HAVE_TCL_STANDALONE)
++ -     else
++ - 	AC_MSG_RESULT([no])
++ - 	TCLX_BUILD_STANDALONE=""
++ - 	TCLX_BUILD_DUMMY_STANDALONE=""
++ -     fi
++ - else
++ -     AC_MSG_RESULT([no])
++ -     TCLX_BUILD_STANDALONE=""
++ -     TCLX_BUILD_DUMMY_STANDALONE=""
++ - fi
++ - AC_SUBST(TCLX_BUILD_STANDALONE)
++ - AC_SUBST(TCLX_BUILD_DUMMY_STANDALONE)
++ - 
++ - AC_MSG_CHECKING([standalone support of Tk (Plus patch)])
++ - if test "${TKX_BUILD}" = "YES" -a -f "${TK_BUILD}/unix/${TK_STLIB_NAME}"; then
++ -     x=`nm -p "${TK_BUILD}/unix/${TK_STLIB_NAME}" |grep 'Tk_InitStandAlone'`
++ -     if test "x$x" != "x"; then
++ -         # Build variables already set
++ - 	AC_MSG_RESULT([yes])
++ -         AC_DEFINE(HAVE_TK_STANDALONE)
++ -     else
++ - 	AC_MSG_RESULT([no])
++ - 	TKX_BUILD_STANDALONE=""
++ - 	TKX_BUILD_DUMMY_STANDALONE=""
++ -     fi
++ - else
++ -     AC_MSG_RESULT([no])
++ -     TKX_BUILD_STANDALONE=""
++ -     TKX_BUILD_DUMMY_STANDALONE=""
++ - fi
++ - AC_SUBST(TKX_BUILD_STANDALONE)
++ - AC_SUBST(TKX_BUILD_DUMMY_STANDALONE)
++   
++   #------------------------------------------------------------------------------
++   # Determine the search path argument for the installed TclX libraries. 
++ --- 475,480 ----
++ *** tcl/generic/tclExtend.h.orig	Sun Jun 27 11:00:21 1999
++ --- tcl/generic/tclExtend.h	Sun Jun 27 11:01:06 1999
++ ***************
++ *** 128,136 ****
++   			       int         exact));
++   
++   EXTERN int
++ - Tclx_InitStandAlone _ANSI_ARGS_((Tcl_Interp *interp));
++ - 
++ - EXTERN int
++   Tclxcmd_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   
++   EXTERN int
++ --- 128,133 ----
++ ***************
++ *** 305,313 ****
++   
++   EXTERN int
++   Tkx_Init _ANSI_ARGS_((Tcl_Interp  *interp));
++ - 
++ - EXTERN int
++ - Tkx_InitStandAlone _ANSI_ARGS_((Tcl_Interp *interp));
++   
++   EXTERN int
++   Tkx_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
++ --- 302,307 ----
++ *** tcl/generic/tclXfilescan.c.orig	Sat Jun 26 06:39:55 1999
++ --- tcl/generic/tclXfilescan.c	Sun Jun 27 10:35:07 1999
++ ***************
++ *** 17,24 ****
++    *-----------------------------------------------------------------------------
++    */
++   
++ ! #include "tclExtdInt.h"
++   #include "tclRegexp.h"
++   
++   /*
++    * A scan context describes a collection of match patterns and commands,
++ --- 17,25 ----
++    *-----------------------------------------------------------------------------
++    */
++   
++ ! #include "tcl.h"
++   #include "tclRegexp.h"
++ + #include "tclExtdInt.h"
++   
++   /*
++    * A scan context describes a collection of match patterns and commands,
++ *** tcl/generic/tclXinit.c.orig	Sat Jun 26 06:39:55 1999
++ --- tcl/generic/tclXinit.c	Sun Jun 27 10:40:38 1999
++ ***************
++ *** 354,361 ****
++   Tclx_Init (interp)
++       Tcl_Interp *interp;
++   {
++ !     if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
++ ! 	abort();
++       }
++   
++       if (InitSetup (interp) == TCL_ERROR)
++ --- 354,361 ----
++   Tclx_Init (interp)
++       Tcl_Interp *interp;
++   {
++ !     if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
++ ! 	return TCL_ERROR;
++       }
++   
++       if (InitSetup (interp) == TCL_ERROR)
++ *** tcl/generic/tclXlib.c.orig	Sat Jun 26 06:39:55 1999
++ --- tcl/generic/tclXlib.c	Sun Jun 27 10:35:07 1999
++ ***************
++ *** 207,213 ****
++           goto posixError;
++       channel = NULL;
++   
++ !     oldScriptFile = iPtr->scriptFile;
++       iPtr->scriptFile = fileName;
++       result = Tcl_GlobalEval (interp, cmdBuf.string);
++       iPtr->scriptFile = oldScriptFile;
++ --- 207,213 ----
++           goto posixError;
++       channel = NULL;
++   
++ !     oldScriptFile = (char *) iPtr->scriptFile;
++       iPtr->scriptFile = fileName;
++       result = Tcl_GlobalEval (interp, cmdBuf.string);
++       iPtr->scriptFile = oldScriptFile;
++ *** tcl/unix/Makefile.in.orig	Sun Jun 27 12:21:20 1999
++ --- tcl/unix/Makefile.in	Sun Jun 27 12:22:04 1999
++ ***************
++ *** 34,40 ****
++   
++   LD_SWITCHES = ${LDFLAGS} ${TCL_LD_FLAGS} ${XLDFLAGS} ${XCFLAGS} ${CFLAGS}
++   
++ ! LIBS = ${TCLX_LD_SEARCH_FLAGS} @SHARED_LIBS@
++   
++   ALL_LIBS = ${TCLX_BUILD_LIB_SPEC} ${TCL_LIB} ${TCLX_LIBS} ${TCL_LIBS} \
++   	   ${XLDLIBS} ${TCLX_CC_SEARCH_FLAGS}
++ --- 34,40 ----
++   
++   LD_SWITCHES = ${LDFLAGS} ${TCL_LD_FLAGS} ${XLDFLAGS} ${XCFLAGS} ${CFLAGS}
++   
++ ! LIBS = ${TCLX_LD_SEARCH_FLAGS} ${TCL_BUILD_STUB_LIB_SPEC} @SHARED_LIBS@
++   
++   ALL_LIBS = ${TCLX_BUILD_LIB_SPEC} ${TCL_LIB} ${TCLX_LIBS} ${TCL_LIBS} \
++   	   ${XLDLIBS} ${TCLX_CC_SEARCH_FLAGS}
++ *** tk/generic/tkXinit.c.orig	Sat Jun 26 06:40:07 1999
++ --- tk/generic/tkXinit.c	Sun Jun 27 10:47:52 1999
++ ***************
++ *** 36,42 ****
++   InitSetup (interp)
++       Tcl_Interp  *interp;
++   {
++ !     if (Tcl_PkgRequire (interp, "Tk", TK_VERSION, 1) == NULL) {
++    	return TCL_ERROR;
++       }
++       if (Tcl_PkgRequire (interp, "Tclx", TCLX_VERSION, 1) == NULL) {
++ --- 36,45 ----
++   InitSetup (interp)
++       Tcl_Interp  *interp;
++   {
++ !     if (Tcl_InitStubs (interp, TCL_VERSION, 0) == NULL) {
++ !       return TCL_ERROR;
++ !     }
++ !     if (Tk_InitStubs (interp, TK_VERSION, 0) == NULL) {
++    	return TCL_ERROR;
++       }
++       if (Tcl_PkgRequire (interp, "Tclx", TCLX_VERSION, 1) == NULL) {
++ ***************
++ *** 60,76 ****
++   int Tkx_Init (interp)
++       Tcl_Interp *interp;
++   {
++ -     /* 
++ -      * Initialize the stubs before making any calls to Tcl or Tk APIs.
++ -      */
++ - 
++ -     if (Tcl_InitStubs(interp, "8.0", 0) == NULL) {
++ - 	abort();
++ -     }
++ -     if (Tk_InitStubs(interp, "8.0", 0) == NULL) {
++ - 	abort();
++ -     }
++ - 
++       if (InitSetup(interp) != TCL_OK) {
++   	goto errorExit;
++       }
++ --- 63,68 ----
+*** TK_PATCHES.orig	Sun Nov 14 18:54:51 1999
+--- TK_PATCHES	Sun Nov 14 18:50:43 1999
+***************
+*** 0 ****
+--- 1,9367 ----
++ 
++ TK_PATCHES -   11/14/1999
++ 
++ This patch file updates from Tk 8.2.2 to Tk 8.2.2+. It should be applied
++ by running the "patch" program in the top-level directory of a clean
++ Tk 8.2.2 release, using the command "patch -p0 <TK_PATCHES"
++ 
++ If you are using Solaris, don't be surprised if the patch utility does not
++ work. This is a known problem. Better install GNU patch version 2.1 or later.
++ 
++ Prereq: "8.2.2"
++ *** generic/tk.h.orig	Sat Oct 30 11:35:56 1999
++ --- generic/tk.h	Sun Nov 14 16:26:58 1999
++ ***************
++ *** 49,55 ****
++   #define TK_RELEASE_SERIAL  2
++   
++   #define TK_VERSION "8.2"
++ ! #define TK_PATCH_LEVEL "8.2.2"
++   
++   /*
++    * The following definitions set up the proper options for Macintosh
++ --- 49,55 ----
++   #define TK_RELEASE_SERIAL  2
++   
++   #define TK_VERSION "8.2"
++ ! #define TK_PATCH_LEVEL "8.2.2+"
++   
++   /*
++    * The following definitions set up the proper options for Macintosh
++ ***************
++ *** 96,101 ****
++ --- 96,104 ----
++   
++   #ifdef XNQueryInputStyle
++   #define TK_USE_INPUT_METHODS
++ + #ifdef I18N_IMPROVE
++ + #include <X11/Xlocale.h>
++ + #endif /* I18N_IMPROVE */
++   #endif
++   
++   /*
++ ***************
++ *** 1167,1181 ****
++   #define Tk_Main(argc, argv, proc) \
++       Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
++   
++ - char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
++ - 
++ - #ifndef USE_TK_STUBS
++ - 
++ - #define Tk_InitStubs(interp, version, exact) \
++ -     Tcl_PkgRequire(interp, "Tk", version, exact)
++ - 
++ - #endif
++ - 
++   
++   /*
++    *--------------------------------------------------------------
++ --- 1170,1175 ----
++ ***************
++ *** 1208,1213 ****
++ --- 1202,1225 ----
++    */
++   
++   #include "tkDecls.h"
++ + 
++ + /*
++ +  * Convenience declaration of Tk_InitStubs.
++ +  * This function is not *implemented* by the tcl library, so the storage
++ +  * class is neither DLLEXPORT nor DLLIMPORT
++ +  */
++ + 
++ + #undef TCL_STORAGE_CLASS
++ + #define TCL_STORAGE_CLASS
++ + 
++ + EXTERN char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
++ + 
++ + #ifndef USE_TK_STUBS
++ + 
++ + #define Tk_InitStubs(interp, version, exact) \
++ +     Tcl_PkgRequire(interp, "Tk", version, exact)
++ + 
++ + #endif
++   
++   /*
++    * Tcl commands exported by Tk:
++ *** pluspatch.orig	Sun Nov 14 17:31:19 1999
++ --- pluspatch	Sun Nov 14 16:26:58 1999
++ ***************
++ *** 0 ****
++ --- 1,60 ----
++ + #!/bin/sh
++ + # The next line restarts using tclsh8.2 \
++ + exec tclsh8.2 $0 ${1+"$@"}
++ + 
++ + set dirs ". ./unix ./library ./generic ./tests ./doc ./mac ./win ./win/rc"
++ + set package "+"
++ + set version "8.2.2"
++ + set date [clock format [clock seconds] -format {%m/%d/%Y}]
++ + 
++ + #
++ + # This is a tcl-script that will search a list of directories
++ + # for ".orig"-files. For all of these it will make a "diff",
++ + # and create a patch-file.
++ + #
++ + #	Written by:	Jan Nijtmans
++ + #			CMG (Computer Managemeng Group) Arnhem B.V.
++ + #			email: j.nijtmans@chello.nl (private)
++ + #			       jan.nijtmans@cmg.nl (work)
++ + #			url:   http://purl.oclc.org/net/nijtmans/
++ + 
++ + set patchlevel ""
++ + set dfiles ""
++ + 
++ + set file [open pluspatch.orig w]
++ + close $file
++ + 
++ + foreach dir $dirs {
++ +     set files [eval exec ls $dir]
++ +     foreach file $files {
++ + 	if {[regexp ".*\.orig" $file]} {
++ + 	    set file $dir/[string range $file 0 [expr [string length $file]-6]]
++ + 	    if {$file=="$dir/tk.h"} {
++ + 		set patchlevel $file.diff
++ + 	    } else {
++ + 		lappend dfiles $file.diff
++ + 	    }
++ + 	    set file [string range $file 2 [string length $file]]
++ + 	    puts stdout "creating $file.diff"
++ + 	    catch "exec diff -c $file.orig $file >$file.diff"
++ + 	}
++ +     }
++ + }
++ + 
++ + puts stdout "creating TK_PATCHES"
++ + set file [open TK_PATCHES w]
++ + puts $file "
++ + TK_PATCHES -   $date
++ + 
++ + This patch file updates from Tk ${version} to Tk ${version}${package}. It should be applied
++ + by running the \"patch\" program in the top-level directory of a clean
++ + Tk ${version} release, using the command \"patch -p0 <TK_PATCHES\"
++ + 
++ + If you are using Solaris, don't be surprised if the patch utility does not
++ + work. This is a known problem. Better install GNU patch version 2.1 or later.
++ + 
++ + Prereq: \"${version}\"
++ + [eval exec cat $patchlevel $dfiles]"
++ + close $file
++ + 
++ + file delete pluspatch.diff pluspatch.orig
++ *** unix/Makefile.in.orig	Thu Nov  4 03:38:44 1999
++ --- unix/Makefile.in	Sun Nov 14 16:26:58 1999
++ ***************
++ *** 83,88 ****
++ --- 83,89 ----
++   
++   # The linker flags needed to link in the Tcl library (ex: -ltcl8.2)
++   TCL_LIB_FLAG =		@TCL_LIB_FLAG@
++ + TCL_STUB_LIB_FLAG =	@TCL_STUB_LIB_FLAG@
++   
++   # Libraries built with optimization switches have this additional extension
++   TK_DBGX =		@TK_DBGX@
++ ***************
++ *** 182,187 ****
++ --- 183,189 ----
++   
++   #TCL_LIB_SPEC = @TCL_BUILD_LIB_SPEC@
++   TCL_LIB_SPEC = @TCL_LIB_SPEC@
++ + TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
++   TK_EXP_FILE = @TK_EXP_FILE@
++   TK_BUILD_EXP_FILE = @TK_BUILD_EXP_FILE@
++   
++ ***************
++ *** 211,217 ****
++   # modify any of this stuff by hand.
++   #----------------------------------------------------------------
++   
++ ! AC_FLAGS =		@EXTRA_CFLAGS@ @DEFS@
++   RANLIB =		@RANLIB@
++   SRC_DIR =		@srcdir@/..
++   TOP_DIR =		@srcdir@/..
++ --- 213,220 ----
++   # modify any of this stuff by hand.
++   #----------------------------------------------------------------
++   
++ ! AC_FLAGS =		@EXTRA_CFLAGS@ @DEFS@ @X11_IMAKE_FLAGS@ \
++ ! 	-DI18N_IMPROVE @CPPFLAGS@
++   RANLIB =		@RANLIB@
++   SRC_DIR =		@srcdir@/..
++   TOP_DIR =		@srcdir@/..
++ ***************
++ *** 268,274 ****
++   	tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
++   	tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
++   	tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
++ ! 	tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o
++   
++   STUB_LIB_OBJS = tkStubLib.o
++   
++ --- 271,278 ----
++   	tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
++   	tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
++   	tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
++ ! 	tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o \
++ ! 	tkUnixIm.o
++   
++   STUB_LIB_OBJS = tkStubLib.o
++   
++ ***************
++ *** 330,335 ****
++ --- 334,340 ----
++   	$(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \
++   	$(UNIX_DIR)/tkUnixFocus.c \
++   	$(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \
++ + 	$(UNIX_DIR)/tkUnixIm.c \
++   	$(UNIX_DIR)/tkUnixKey.c \
++   	$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
++   	$(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \
++ ***************
++ *** 441,446 ****
++ --- 446,453 ----
++   	@$(INSTALL_DATA) $(TK_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
++   	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TK_LIB_FILE))
++   	@chmod 555 $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
++ + 	@echo "Installing pkgIndex.tcl"
++ + 	@tclsh$(VERSION) pkgInstall.tcl $(LIB_INSTALL_DIR)
++   	@echo "Installing wish"
++   	@$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
++   	@echo "Installing tkConfig.sh"
++ ***************
++ *** 568,573 ****
++ --- 575,592 ----
++   	rm -f Makefile config.status config.cache config.log tkConfig.sh \
++   		$(PACKAGE).* prototype
++   
++ + patchclean:	modeclean
++ + 	@for i in .. ../generic ../doc ../unix ../mac ../win \
++ + 		../library ../win/rc ../tests ;do \
++ + 	    echo "removing $$i/*.orig and $$i/*.diff"; \
++ + 	    rm -f $$i/*.orig $$i/*.diff; \
++ + 	done;
++ + 	rm -f ../*patch*
++ + 
++ + modeclean:
++ + 	chmod u-w ../changes ../library/*.tcl ../tests/*.test
++ + 	chmod u-w ../doc/*.n ../generic/*.c ../win/rc/*.rc
++ + 
++   depend:
++   	makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
++   
++ ***************
++ *** 711,717 ****
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkScrollbar.c
++   
++   tkSquare.o: $(GENERIC_DIR)/tkSquare.c
++ ! 	$(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkSquare.c
++   
++   tkCanvas.o: $(GENERIC_DIR)/tkCanvas.c
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCanvas.c
++ --- 730,736 ----
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkScrollbar.c
++   
++   tkSquare.o: $(GENERIC_DIR)/tkSquare.c
++ ! 	$(CC) -c $(CC_SWITCHES) -DUSE_TK_STUBS $(GENERIC_DIR)/tkSquare.c
++   
++   tkCanvas.o: $(GENERIC_DIR)/tkCanvas.c
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCanvas.c
++ ***************
++ *** 765,771 ****
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
++   
++   tkTest.o: $(GENERIC_DIR)/tkTest.c
++ ! 	$(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkTest.c
++   
++   tkText.o: $(GENERIC_DIR)/tkText.c
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c
++ --- 784,790 ----
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
++   
++   tkTest.o: $(GENERIC_DIR)/tkTest.c
++ ! 	$(CC) -c $(CC_SWITCHES) -DUSE_TK_STUBS $(GENERIC_DIR)/tkTest.c
++   
++   tkText.o: $(GENERIC_DIR)/tkText.c
++   	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c
++ ***************
++ *** 832,837 ****
++ --- 851,859 ----
++   
++   tkUnixFont.o: $(UNIX_DIR)/tkUnixFont.c
++   	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixFont.c
++ + 
++ + tkUnixIm.o: $(UNIX_DIR)/tkUnixIm.c
++ + 	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixIm.c
++   
++   tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
++   	$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
++ *** unix/aclocal.m4.orig	Sun Nov 14 16:26:58 1999
++ --- unix/aclocal.m4	Sun Nov 14 16:26:58 1999
++ ***************
++ *** 0 ****
++ --- 1,1697 ----
++ + #------------------------------------------------------------------------
++ + # SC_PATH_TCLCONFIG --
++ + #
++ + #	Locate the tclConfig.sh file and perform a sanity check on
++ + #	the Tcl compile flags
++ + #
++ + # Arguments:
++ + #	none
++ + #
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--with-tcl=...
++ + #
++ + #	Defines the following vars:
++ + #		TCL_BIN_DIR	Full path to the directory containing
++ + #				the tclConfig.sh file
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_PATH_TCLCONFIG, [
++ +     #
++ +     # Ok, lets find the tcl configuration
++ +     # First, look for one uninstalled.
++ +     # the alternative search directory is invoked by --with-tcl
++ +     #
++ + 
++ +     if test x"${no_tcl}" = x ; then
++ + 	# we reset no_tcl in case something fails here
++ + 	no_tcl=true
++ + 	AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
++ + 	AC_MSG_CHECKING([for Tcl configuration])
++ + 	AC_CACHE_VAL(ac_cv_c_tclconfig,[
++ + 
++ + 	    # First check to see if --with-tclconfig was specified.
++ + 	    if test x"${with_tclconfig}" != x ; then
++ + 		if test -f "${with_tclconfig}/tclConfig.sh" ; then
++ + 		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
++ + 		else
++ + 		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
++ + 		fi
++ + 	    fi
++ + 
++ + 	    # then check for a private Tcl installation
++ + 	    if test x"${ac_cv_c_tclconfig}" = x ; then
++ + 		for i in \
++ + 			../tcl \
++ + 			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
++ + 			../../tcl \
++ + 			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
++ + 			../../../tcl \
++ + 			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
++ + 		    if test -f "$i/unix/tclConfig.sh" ; then
++ + 			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
++ + 			break
++ + 		    fi
++ + 		done
++ + 	    fi
++ + 
++ + 	    # check in a few common install locations
++ + 	    if test x"${ac_cv_c_tclconfig}" = x ; then
++ + 		for i in `ls -d ${prefix}/lib 2>/dev/null` \
++ + 			`ls -d /usr/local/lib 2>/dev/null` ; do
++ + 		    if test -f "$i/tclConfig.sh" ; then
++ + 			ac_cv_c_tclconfig=`(cd $i; pwd)`
++ + 			break
++ + 		    fi
++ + 		done
++ + 	    fi
++ + 
++ + 	    # check in a few other private locations
++ + 	    if test x"${ac_cv_c_tcliconfig}" = x ; then
++ + 		for i in \
++ + 			${srcdir}/../tcl \
++ + 			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
++ + 		    if test -f "$i/unix/tclConfig.sh" ; then
++ + 		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
++ + 		    break
++ + 		fi
++ + 		done
++ + 	    fi
++ + 	])
++ + 
++ + 	if test x"${ac_cv_c_tclconfig}" = x ; then
++ + 	    TCL_BIN_DIR="# no Tcl configs found"
++ + 	    AC_MSG_WARN(Can't find Tcl configuration definitions)
++ + 	    exit 0
++ + 	else
++ + 	    no_tcl=
++ + 	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
++ + 	    AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
++ + 	fi
++ +     fi
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_PATH_TKCONFIG --
++ + #
++ + #	Locate the tkConfig.sh file
++ + #
++ + # Arguments:
++ + #	none
++ + #
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--with-tk=...
++ + #
++ + #	Defines the following vars:
++ + #		TK_BIN_DIR	Full path to the directory containing
++ + #				the tkConfig.sh file
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_PATH_TKCONFIG, [
++ +     #
++ +     # Ok, lets find the tk configuration
++ +     # First, look for one uninstalled.
++ +     # the alternative search directory is invoked by --with-tk
++ +     #
++ + 
++ +     if test x"${no_tk}" = x ; then
++ + 	# we reset no_tk in case something fails here
++ + 	no_tk=true
++ + 	AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
++ + 	AC_MSG_CHECKING([for Tk configuration])
++ + 	AC_CACHE_VAL(ac_cv_c_tkconfig,[
++ + 
++ + 	    # First check to see if --with-tkconfig was specified.
++ + 	    if test x"${with_tkconfig}" != x ; then
++ + 		if test -f "${with_tkconfig}/tkConfig.sh" ; then
++ + 		    ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
++ + 		else
++ + 		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
++ + 		fi
++ + 	    fi
++ + 
++ + 	    # then check for a private Tk library
++ + 	    if test x"${ac_cv_c_tkconfig}" = x ; then
++ + 		for i in \
++ + 			../tk \
++ + 			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
++ + 			../../tk \
++ + 			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
++ + 			../../../tk \
++ + 			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
++ + 		    if test -f "$i/unix/tkConfig.sh" ; then
++ + 			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
++ + 			break
++ + 		    fi
++ + 		done
++ + 	    fi
++ + 	    # check in a few common install locations
++ + 	    if test x"${ac_cv_c_tkconfig}" = x ; then
++ + 		for i in `ls -d ${prefix}/lib 2>/dev/null` \
++ + 			`ls -d /usr/local/lib 2>/dev/null` ; do
++ + 		    if test -f "$i/tkConfig.sh" ; then
++ + 			ac_cv_c_tkconfig=`(cd $i; pwd)`
++ + 			break
++ + 		    fi
++ + 		done
++ + 	    fi
++ + 	    # check in a few other private locations
++ + 	    if test x"${ac_cv_c_tkconfig}" = x ; then
++ + 		for i in \
++ + 			${srcdir}/../tk \
++ + 			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
++ + 		    if test -f "$i/unix/tkConfig.sh" ; then
++ + 			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
++ + 			break
++ + 		    fi
++ + 		done
++ + 	    fi
++ + 	])
++ + 	if test x"${ac_cv_c_tkconfig}" = x ; then
++ + 	    TK_BIN_DIR="# no Tk configs found"
++ + 	    AC_MSG_WARN(Can't find Tk configuration definitions)
++ + 	    exit 0
++ + 	else
++ + 	    no_tk=
++ + 	    TK_BIN_DIR=${ac_cv_c_tkconfig}
++ + 	    AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
++ + 	fi
++ +     fi
++ + 
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_LOAD_TCLCONFIG --
++ + #
++ + #	Load the tclConfig.sh file
++ + #
++ + # Arguments:
++ + #	
++ + #	Requires the following vars to be set:
++ + #		TCL_BIN_DIR
++ + #
++ + # Results:
++ + #
++ + #	Subst the following vars:
++ + #		TCL_BIN_DIR
++ + #		TCL_SRC_DIR
++ + #		TCL_LIB_FILE
++ + #
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_LOAD_TCLCONFIG, [
++ +     AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
++ + 
++ +     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
++ +         AC_MSG_RESULT([loading])
++ + 	. $TCL_BIN_DIR/tclConfig.sh
++ +     else
++ +         AC_MSG_RESULT([file not found])
++ +     fi
++ + 
++ +     #
++ +     # The eval is required to do the TCL_DBGX substitution in the
++ +     # TCL_LIB_FILE variable
++ +     #
++ + 
++ +     eval TCL_LIB_FILE=${TCL_LIB_FILE}
++ +     eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
++ + 
++ +     AC_SUBST(TCL_BIN_DIR)
++ +     AC_SUBST(TCL_SRC_DIR)
++ +     AC_SUBST(TCL_LIB_FILE)
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_LOAD_TKCONFIG --
++ + #
++ + #	Load the tkConfig.sh file
++ + #
++ + # Arguments:
++ + #	
++ + #	Requires the following vars to be set:
++ + #		TK_BIN_DIR
++ + #
++ + # Results:
++ + #
++ + #	Sets the following vars that should be in tkConfig.sh:
++ + #		TK_BIN_DIR
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_LOAD_TKCONFIG, [
++ +     AC_MSG_CHECKING([for existence of $TCLCONFIG])
++ + 
++ +     if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
++ +         AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
++ + 	. $TK_BIN_DIR/tkConfig.sh
++ +     else
++ +         AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
++ +     fi
++ + 
++ +     AC_SUBST(TK_BIN_DIR)
++ +     AC_SUBST(TK_SRC_DIR)
++ +     AC_SUBST(TK_LIB_FILE)
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_ENABLE_GCC --
++ + #
++ + #	Allows the use of GCC if available
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--enable-gcc
++ + #
++ + #	Sets the following vars:
++ + #		CC	Command to use for the compiler
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_ENABLE_GCC, [
++ +     AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available [--disable-gcc]],
++ + 	[ok=$enableval], [ok=no])
++ +     if test "$ok" = "yes"; then
++ + 	CC=gcc
++ + 	AC_PROG_CC
++ +     else
++ + 	CC=${CC-cc}
++ +     fi
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_ENABLE_SHARED --
++ + #
++ + #	Allows the building of shared libraries
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--enable-shared=yes|no
++ + #
++ + #	Defines the following vars:
++ + #		STATIC_BUILD	Used for building import/export libraries
++ + #				on Windows.
++ + #
++ + #	Sets the following vars:
++ + #		SHARED_BUILD	Value of 1 or 0
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_ENABLE_SHARED, [
++ +     AC_MSG_CHECKING([how to build libraries])
++ +     AC_ARG_ENABLE(shared,
++ + 	[  --disable-shared        build and link without shared libraries [--disable-shared]],
++ + 	[tcl_ok=$enableval], [tcl_ok=yes])
++ + 
++ +     if test "${enable_shared+set}" = set; then
++ + 	enableval="$enable_shared"
++ + 	tcl_ok=$enableval
++ +     else
++ + 	tcl_ok=yes
++ +     fi
++ + 
++ +     if test "$tcl_ok" = "yes" ; then
++ + 	AC_MSG_RESULT([shared])
++ + 	SHARED_BUILD=1
++ +     else
++ + 	AC_MSG_RESULT([static])
++ + 	SHARED_BUILD=0
++ + 	AC_DEFINE(STATIC_BUILD)
++ +     fi
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_ENABLE_THREADS --
++ + #
++ + #	Specify if thread support should be enabled
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--enable-threads
++ + #
++ + #	Sets the following vars:
++ + #		THREADS_LIBS	Thread library(s)
++ + #
++ + #	Defines the following vars:
++ + #		TCL_THREADS
++ + #		_REENTRANT
++ + #
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_ENABLE_THREADS, [
++ +     AC_MSG_CHECKING(for building with threads)
++ +     AC_ARG_ENABLE(threads, [  --enable-threads        build with threads],
++ + 	[tcl_ok=$enableval], [tcl_ok=no])
++ + 
++ +     if test "$tcl_ok" = "yes"; then
++ + 	AC_MSG_RESULT(yes)
++ + 	TCL_THREADS=1
++ + 	AC_DEFINE(TCL_THREADS)
++ + 	AC_DEFINE(_REENTRANT)
++ + 
++ + 	AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
++ + 	if test "$tcl_ok" = "yes"; then
++ + 	    # The space is needed
++ + 	    THREADS_LIBS=" -lpthread"
++ + 	else
++ + 	    TCL_THREADS=0
++ + 	    AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
++ + 	fi
++ +     else
++ + 	TCL_THREADS=0
++ + 	AC_MSG_RESULT(no (default))
++ +     fi
++ + 
++ + ])
++ + 
++ + #------------------------------------------------------------------------
++ + # SC_ENABLE_SYMBOLS --
++ + #
++ + #	Specify if debugging symbols should be used
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + #	Requires the following vars to be set:
++ + #		CFLAGS_DEBUG
++ + #		CFLAGS_OPTIMIZE
++ + #		LDFLAGS_DEBUG
++ + #		LDFLAGS_OPTIMIZE
++ + #	
++ + # Results:
++ + #
++ + #	Adds the following arguments to configure:
++ + #		--enable-symbols
++ + #
++ + #	Defines the following vars:
++ + #		CFLAGS_DEFAULT	Sets to CFLAGS_DEBUG if true
++ + #				Sets to CFLAGS_OPTIMIZE if false
++ + #		LDFLAGS_DEFAULT	Sets to LDFLAGS_DEBUG if true
++ + #				Sets to LDFLAGS_OPTIMIZE if false
++ + #		DBGX		Debug library extension
++ + #
++ + #------------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_ENABLE_SYMBOLS, [
++ +     AC_MSG_CHECKING([for build with symbols])
++ +     AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--enable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
++ +     if test "$tcl_ok" = "yes"; then
++ + 	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
++ + 	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
++ + 	DBGX=g
++ + 	AC_MSG_RESULT([yes])
++ +     else
++ + 	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
++ + 	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
++ + 	DBGX=""
++ + 	AC_MSG_RESULT([no])
++ +     fi
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_CONFIG_CFLAGS
++ + #
++ + #	Try to determine the proper flags to pass to the compiler
++ + #	for building shared libraries and other such nonsense.
++ + #
++ + # Arguments:
++ + #	none
++ + #
++ + # Results:
++ + #
++ + #	Defines the following vars:
++ + #
++ + #       DL_OBJS -       Name of the object file that implements dynamic
++ + #                       loading for Tcl on this system.
++ + #       DL_LIBS -       Library file(s) to include in tclsh and other base
++ + #                       applications in order for the "load" command to work.
++ + #       LDFLAGS -      Flags to pass to the compiler when linking object
++ + #                       files into an executable application binary such
++ + #                       as tclsh.
++ + #       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
++ + #                       that tell the run-time dynamic linker where to look
++ + #                       for shared libraries such as libtcl.so.  Depends on
++ + #                       the variable LIB_RUNTIME_DIR in the Makefile.
++ + #       MAKE_LIB -      Command to execute to build the Tcl library;
++ + #                       differs depending on whether or not Tcl is being
++ + #                       compiled as a shared library.
++ + #       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
++ + #                       of a shared library (may request position-independent
++ + #                       code, among other things).
++ + #       SHLIB_LD -      Base command to use for combining object files
++ + #                       into a shared library.
++ + #       SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
++ + #                       creating shared libraries.  This symbol typically
++ + #                       goes at the end of the "ld" commands that build
++ + #                       shared libraries. The value of the symbol is
++ + #                       "${LIBS}" if all of the dependent libraries should
++ + #                       be specified when creating a shared library.  If
++ + #                       dependent libraries should not be specified (as on
++ + #                       SunOS 4.x, where they cause the link to fail, or in
++ + #                       general if Tcl and Tk aren't themselves shared
++ + #                       libraries), then this symbol has an empty string
++ + #                       as its value.
++ + #       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
++ + #                       extensions.  An empty string means we don't know how
++ + #                       to use shared libraries on this platform.
++ + #       TCL_LIB_FILE -  Name of the file that contains the Tcl library, such
++ + #                       as libtcl7.8.so or libtcl7.8.a.
++ + #       TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
++ + #                       in the shared library name, using the $VERSION variable
++ + #                       to put the version in the right place.  This is used
++ + #                       by platforms that need non-standard library names.
++ + #                       Examples:  ${VERSION}.so.1.1 on NetBSD, since it needs
++ + #                       to have a version after the .so, and ${VERSION}.a
++ + #                       on AIX, since the Tcl shared library needs to have
++ + #                       a .a extension whereas shared objects for loadable
++ + #                       extensions have a .so extension.  Defaults to
++ + #                       ${VERSION}${SHLIB_SUFFIX}.
++ + #       TCL_NEEDS_EXP_FILE -
++ + #                       1 means that an export file is needed to link to a
++ + #                       shared library.
++ + #       TCL_EXP_FILE -  The name of the installed export / import file which
++ + #                       should be used to link to the Tcl shared library.
++ + #                       Empty if Tcl is unshared.
++ + #       TCL_BUILD_EXP_FILE -
++ + #                       The name of the built export / import file which
++ + #                       should be used to link to the Tcl shared library.
++ + #                       Empty if Tcl is unshared.
++ + #	CFLAGS_DEBUG -
++ + #			Flags used when running the compiler in debug mode
++ + #	CFLAGS_OPTIMIZE -
++ + #			Flags used when running the compiler in optimize mode
++ + #
++ + #	EXTRA_CFLAGS
++ + #
++ + #	Subst's the following vars:
++ + #		DL_LIBS
++ + #		CFLAGS_DEBUG
++ + #		CFLAGS_OPTIMIZE
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_CONFIG_CFLAGS, [
++ + 
++ +     # Step 0: Enable 64 bit support?
++ + 
++ +     AC_MSG_CHECKING([if 64bit support is enabled])
++ +     AC_ARG_ENABLE(64bit,[  --enable-64bit          enable 64bit support],,enableval="no")
++ + 
++ +     if test "$enableval" = "yes"; then
++ + 	AC_MSG_RESULT(Will compile with 64bit support)
++ + 	do64bit=yes
++ +     else
++ + 	do64bit=no
++ +     fi
++ +     AC_MSG_RESULT($do64bit)
++ +  
++ +     # Step 1: set the variable "system" to hold the name and version number
++ +     # for the system.  This can usually be done via the "uname" command, but
++ +     # there are a few systems, like Next, where this doesn't work.
++ + 
++ +     AC_MSG_CHECKING([system version (for dynamic loading)])
++ +     if test -f /usr/lib/NextStep/software_version; then
++ + 	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
++ +     else
++ + 	system=`uname -s`-`uname -r`
++ + 	if test "$?" -ne 0 ; then
++ + 	    AC_MSG_RESULT([unknown (can't find uname command)])
++ + 	    system=unknown
++ + 	else
++ + 	    # Special check for weird MP-RAS system (uname returns weird
++ + 	    # results, and the version is kept in special file).
++ + 	
++ + 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
++ + 		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
++ + 	    fi
++ + 	    if test "`uname -s`" = "AIX" ; then
++ + 		system=AIX-`uname -v`.`uname -r`
++ + 	    fi
++ + 	    AC_MSG_RESULT($system)
++ + 	fi
++ +     fi
++ + 
++ +     # Step 2: check for existence of -ldl library.  This is needed because
++ +     # Linux can use either -ldl or -ldld for dynamic loading.
++ + 
++ +     AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
++ + 
++ +     # Step 3: set configuration options based on system name and version.
++ + 
++ +     do64bit_ok=no
++ +     fullSrcDir=`cd $srcdir; pwd`
++ +     EXTRA_CFLAGS=""
++ +     TCL_EXPORT_FILE_SUFFIX=""
++ +     UNSHARED_LIB_SUFFIX=""
++ +     TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
++ +     ECHO_VERSION='`echo ${VERSION}`'
++ +     TCL_LIB_VERSIONS_OK=ok
++ +     CFLAGS_DEBUG=-g
++ +     CFLAGS_OPTIMIZE=-O
++ +     TCL_NEEDS_EXP_FILE=0
++ +     TCL_BUILD_EXP_FILE=""
++ +     TCL_EXP_FILE=""
++ +     case $system in
++ + 	AIX-4.[[2-9]])
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 	    TCL_NEEDS_EXP_FILE=1
++ + 	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
++ + 	    ;;
++ + 	AIX-*)
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    LIBOBJS="$LIBOBJS tclLoadAix.o"
++ + 	    DL_LIBS="-lld"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 	    TCL_NEEDS_EXP_FILE=1
++ + 	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
++ + 	    ;;
++ + 	BSD/OS-2.1*|BSD/OS-3*)
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="shlicc -r"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	BSD/OS-4.*)
++ + 	    SHLIB_CFLAGS="-export-dynamic -fPIC"
++ + 	    SHLIB_LD="cc -shared"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS="-export-dynamic"
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	dgux*)
++ + 	    SHLIB_CFLAGS="-K PIC"
++ + 	    SHLIB_LD="cc -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
++ + 	    SHLIB_SUFFIX=".sl"
++ + 	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
++ + 	    if test "$tcl_ok" = yes; then
++ + 		SHLIB_CFLAGS="+z"
++ + 		SHLIB_LD="ld -b"
++ + 		SHLIB_LD_LIBS=""
++ + 		DL_OBJS="tclLoadShl.o"
++ + 		DL_LIBS="-ldld"
++ + 		LDFLAGS="-Wl,-E"
++ + 		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
++ + 	    fi
++ + 	    ;;
++ + 	IRIX-4.*)
++ + 	    SHLIB_CFLAGS="-G 0"
++ + 	    SHLIB_SUFFIX=".a"
++ + 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    DL_OBJS="tclLoadAout.o"
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS="-Wl,-D,08000000"
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 	    SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
++ + 	    ;;
++ + 	IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="ld -n32 -shared -rdata_shared"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ + 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++ + 		EXTRA_CFLAGS="-mabi=n32"
++ + 		LDFLAGS="-mabi=n32"
++ + 	    else
++ + 		case $system in
++ + 		    IRIX-6.3)
++ + 			# Use to build 6.2 compatible binaries on 6.3.
++ + 			EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
++ + 			;;
++ + 		    *)
++ + 			EXTRA_CFLAGS="-n32"
++ + 			;;
++ + 		esac
++ + 		LDFLAGS="-n32"
++ + 	    fi
++ + 	    ;;
++ + 	IRIX64-6.*)
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="ld -32 -shared -rdata_shared"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ + 	    ;;
++ + 	Linux*)
++ + 	    SHLIB_CFLAGS="-fPIC"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 
++ + 	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings 
++ + 	    # when you inline the string and math operations.  Turn this off to
++ + 	    # get rid of the warnings.
++ + 
++ + 	    CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
++ + 
++ + 	    if test "$have_dl" = yes; then
++ + 		SHLIB_LD="${CC} -shared"
++ + 		DL_OBJS=""
++ + 		DL_LIBS="-ldl"
++ + 		LDFLAGS="-rdynamic"
++ + 		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ + 	    else
++ + 		AC_CHECK_HEADER(dld.h, [
++ + 		    SHLIB_LD="ld -shared"
++ + 		    DL_OBJS="tclLoadDld.o"
++ + 		    DL_LIBS="-ldld"
++ + 		    LDFLAGS=""
++ + 		    LD_SEARCH_FLAGS=""])
++ + 	    fi
++ + 	    if test "`uname -m`" = "alpha" ; then
++ + 		EXTRA_CFLAGS="-mieee"
++ + 	    fi
++ + 	    ;;
++ + 	MP-RAS-02*)
++ + 	    SHLIB_CFLAGS="-K PIC"
++ + 	    SHLIB_LD="cc -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	MP-RAS-*)
++ + 	    SHLIB_CFLAGS="-K PIC"
++ + 	    SHLIB_LD="cc -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS="-Wl,-Bexport"
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	NetBSD-*|FreeBSD-[[12]].*|OpenBSD-*)
++ + 	    # Not available on all versions:  check for include file.
++ + 	    AC_CHECK_HEADER(dlfcn.h, [
++ + 		SHLIB_CFLAGS="-fpic"
++ + 		SHLIB_LD="ld -Bshareable -x"
++ + 		SHLIB_LD_LIBS=""
++ + 		SHLIB_SUFFIX=".so"
++ + 		DL_OBJS=""
++ + 		DL_LIBS=""
++ + 		LDFLAGS=""
++ + 		LD_SEARCH_FLAGS=""
++ + 		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
++ + 	    ], [
++ + 		SHLIB_CFLAGS=""
++ + 		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
++ + 		SHLIB_LD_LIBS='${LIBS}'
++ + 		SHLIB_SUFFIX=".a"
++ + 		DL_OBJS="tclLoadAout.o"
++ + 		DL_LIBS=""
++ + 		LDFLAGS=""
++ + 		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
++ + 	    ])
++ + 
++ + 	    # FreeBSD doesn't handle version numbers with dots.
++ + 
++ + 	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
++ + 	    TCL_LIB_VERSIONS_OK=nodots
++ + 	    ;;
++ + 	FreeBSD-*)
++ + 	    # FreeBSD 3.* and greater have ELF.
++ + 	    SHLIB_CFLAGS="-fpic"
++ + 	    SHLIB_LD="ld -Bshareable -x"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	NEXTSTEP-*)
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD="cc -nostdlib -r"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS="tclLoadNext.o"
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	OS/390-*)
++ + 	    CFLAGS_OPTIMIZE=""      # Optimizer is buggy
++ + 	    AC_DEFINE(_OE_SOCKETS)  # needed in sys/socket.h
++ + 	    ;;      
++ + 	OSF1-1.0|OSF1-1.1|OSF1-1.2)
++ + 	    # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
++ + 	    SHLIB_CFLAGS=""
++ + 	    # Hack: make package name same as library name
++ + 	    SHLIB_LD='ld -R -export $@:'
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS="tclLoadOSF.o"
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	OSF1-1.*)
++ + 	    # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
++ + 	    SHLIB_CFLAGS="-fpic"
++ + 	    SHLIB_LD="ld -shared"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	OSF1-V*)
++ + 	    # Digital OSF/1
++ + 	    SHLIB_CFLAGS=""
++ + 	    SHLIB_LD='ld -shared -expect_unresolved "*"'
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ + 	    ;;
++ + 	RISCos-*)
++ + 	    SHLIB_CFLAGS="-G 0"
++ + 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".a"
++ + 	    DL_OBJS="tclLoadAout.o"
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS="-Wl,-D,08000000"
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 	    ;;
++ + 	SCO_SV-3.2*)
++ + 	    # Note, dlopen is available only on SCO 3.2.5 and greater.  However,
++ + 	    # this test works, since "uname -s" was non-standard in 3.2.4 and
++ + 	    # below.
++ + 	    SHLIB_CFLAGS="-Kpic -belf"
++ + 	    SHLIB_LD="ld -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS="-belf -Wl,-Bexport"
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	SINIX*5.4*)
++ + 	    SHLIB_CFLAGS="-K PIC"
++ + 	    SHLIB_LD="cc -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ + 	SunOS-4*)
++ + 	    SHLIB_CFLAGS="-PIC"
++ + 	    SHLIB_LD="ld"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 
++ + 	    # SunOS can't handle version numbers with dots in them in library
++ + 	    # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
++ + 	    # requires an extra version number at the end of .so file names.
++ + 	    # So, the library has to have a name like libtcl75.so.1.0
++ + 
++ + 	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
++ + 	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
++ + 	    TCL_LIB_VERSIONS_OK=nodots
++ + 	    ;;
++ + 	SunOS-5.[[0-6]]*)
++ + 	    SHLIB_CFLAGS="-KPIC"
++ + 	    SHLIB_LD="/usr/ccs/bin/ld -G -z text"
++ + 
++ + 	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
++ + 	    # symbols when dynamically loaded into tclsh.
++ + 
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    LDFLAGS=""
++ + 	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ + 	    ;;
++ + 	SunOS-5*)
++ + 	    SHLIB_CFLAGS="-KPIC"
++ + 	    SHLIB_LD="/usr/ccs/bin/ld -G -z text"
++ + 	    LDFLAGS=""
++ +     
++ + 	    do64bit_ok=no
++ + 	    if test "$do64bit" = "yes" ; then
++ + 	    arch=`isainfo`
++ + 	    if test "$arch" = "sparcv9 sparc" ; then
++ + 		if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then
++ + 		do64bit_ok=yes
++ + 		EXTRA_CFLAGS="-xarch=v9"
++ + 		LDFLAGS="-xarch=v9"
++ + 		else 
++ + 		AC_MSG_WARN("64bit mode not supported using GCC on $system")
++ + 		fi
++ + 	    else
++ + 		AC_MSG_WARN("64bit mode only supported sparcv9 system")
++ + 	    fi
++ + 	    fi
++ + 	    
++ + 	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
++ + 	    # symbols when dynamically loaded into tclsh.
++ + 
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++ + 		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ + 	    else
++ + 		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
++ + 	    fi
++ + 	    ;;
++ + 	ULTRIX-4.*)
++ + 	    SHLIB_CFLAGS="-G 0"
++ + 	    SHLIB_SUFFIX=".a"
++ + 	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
++ + 	    SHLIB_LD_LIBS='${LIBS}'
++ + 	    DL_OBJS="tclLoadAout.o"
++ + 	    DL_LIBS=""
++ + 	    LDFLAGS="-Wl,-D,08000000"
++ + 	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ + 	    ;;
++ + 	UNIX_SV* | UnixWare-5*)
++ + 	    SHLIB_CFLAGS="-KPIC"
++ + 	    SHLIB_LD="cc -G"
++ + 	    SHLIB_LD_LIBS=""
++ + 	    SHLIB_SUFFIX=".so"
++ + 	    DL_OBJS=""
++ + 	    DL_LIBS="-ldl"
++ + 	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
++ + 	    # that don't grok the -Bexport option.  Test that it does.
++ + 	    hold_ldflags=$LDFLAGS
++ + 	    AC_MSG_CHECKING(for ld accepts -Bexport flag)
++ + 	    LDFLAGS="${LDFLAGS} -Wl,-Bexport"
++ + 	    AC_TRY_LINK(, [int i;], found=yes, found=no)
++ + 	    LDFLAGS=$hold_ldflags
++ + 	    AC_MSG_RESULT($found)
++ + 	    if test $found = yes; then
++ + 	    LDFLAGS="-Wl,-Bexport"
++ + 	    else
++ + 	    LDFLAGS=""
++ + 	    fi
++ + 	    LD_SEARCH_FLAGS=""
++ + 	    ;;
++ +     esac
++ + 
++ +     if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
++ +     AC_MSG_WARN("64bit support being disabled -- not supported on this platform")
++ +     fi
++ + 
++ +     # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
++ +     # Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
++ +     # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
++ +     # to determine which of several header files defines the a.out file
++ +     # format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
++ +     # support only a file format that is more or less version-7-compatible. 
++ +     # In particular,
++ +     #	- a.out files must begin with `struct exec'.
++ +     #	- the N_TXTOFF on the `struct exec' must compute the seek address
++ +     #	  of the text segment
++ +     #	- The `struct exec' must contain a_magic, a_text, a_data, a_bss
++ +     #	  and a_entry fields.
++ +     # The following compilation should succeed if and only if either sys/exec.h
++ +     # or a.out.h is usable for the purpose.
++ +     #
++ +     # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
++ +     # `struct exec' includes a second header that contains information that
++ +     # duplicates the v7 fields that are needed.
++ + 
++ +     if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
++ + 	AC_MSG_CHECKING(sys/exec.h)
++ + 	AC_TRY_COMPILE([#include <sys/exec.h>],[
++ + 	    struct exec foo;
++ + 	    unsigned long seek;
++ + 	    int flag;
++ + #if defined(__mips) || defined(mips)
++ + 	    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
++ + #else
++ + 	    seek = N_TXTOFF (foo);
++ + #endif
++ + 	    flag = (foo.a_magic == OMAGIC);
++ + 	    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
++ +     ], tcl_ok=usable, tcl_ok=unusable)
++ + 	AC_MSG_RESULT($tcl_ok)
++ + 	if test $tcl_ok = usable; then
++ + 	    AC_DEFINE(USE_SYS_EXEC_H)
++ + 	else
++ + 	    AC_MSG_CHECKING(a.out.h)
++ + 	    AC_TRY_COMPILE([#include <a.out.h>],[
++ + 		struct exec foo;
++ + 		unsigned long seek;
++ + 		int flag;
++ + #if defined(__mips) || defined(mips)
++ + 		seek = N_TXTOFF (foo.ex_f, foo.ex_o);
++ + #else
++ + 		seek = N_TXTOFF (foo);
++ + #endif
++ + 		flag = (foo.a_magic == OMAGIC);
++ + 		return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
++ + 	    ], tcl_ok=usable, tcl_ok=unusable)
++ + 	    AC_MSG_RESULT($tcl_ok)
++ + 	    if test $tcl_ok = usable; then
++ + 		AC_DEFINE(USE_A_OUT_H)
++ + 	    else
++ + 		AC_MSG_CHECKING(sys/exec_aout.h)
++ + 		AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
++ + 		    struct exec foo;
++ + 		    unsigned long seek;
++ + 		    int flag;
++ + #if defined(__mips) || defined(mips)
++ + 		    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
++ + #else
++ + 		    seek = N_TXTOFF (foo);
++ + #endif
++ + 		    flag = (foo.a_midmag == OMAGIC);
++ + 		    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
++ + 		], tcl_ok=usable, tcl_ok=unusable)
++ + 		AC_MSG_RESULT($tcl_ok)
++ + 		if test $tcl_ok = usable; then
++ + 		    AC_DEFINE(USE_SYS_EXEC_AOUT_H)
++ + 		else
++ + 		    DL_OBJS=""
++ + 		fi
++ + 	    fi
++ + 	fi
++ +     fi
++ + 
++ +     # Step 5: disable dynamic loading if requested via a command-line switch.
++ + 
++ +     AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
++ + 	[tcl_ok=$enableval], [tcl_ok=yes])
++ +     if test "$tcl_ok" = "no"; then
++ + 	DL_OBJS=""
++ +     fi
++ + 
++ +     if test "x$SHLIB_LD" != "x" ; then
++ + 	BUILD_DLTEST="\$(DLTEST_TARGETS)"
++ +     else
++ + 	echo "Can't figure out how to do dynamic loading or shared libraries"
++ + 	echo "on this system."
++ + 	SHLIB_CFLAGS=""
++ + 	SHLIB_LD=""
++ + 	SHLIB_SUFFIX=""
++ + 	DL_OBJS="tclLoadNone.o"
++ + 	DL_LIBS=""
++ + 	LDFLAGS=""
++ + 	LD_SEARCH_FLAGS=""
++ + 	BUILD_DLTEST=""
++ +     fi
++ + 
++ +     # If we're running gcc, then change the C flags for compiling shared
++ +     # libraries to the right flags for gcc, instead of those for the
++ +     # standard manufacturer compiler.
++ + 
++ +     if test "$DL_OBJS" != "tclLoadNone.o" ; then
++ + 	if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++ + 	    case $system in
++ + 		AIX-*)
++ + 		    ;;
++ + 		BSD/OS*)
++ + 		    ;;
++ + 		IRIX*)
++ + 		    ;;
++ + 		NetBSD-*|FreeBSD-*|OpenBSD-*)
++ + 		    ;;
++ + 		RISCos-*)
++ + 		    ;;
++ + 		ULTRIX-4.*)
++ + 		    ;;
++ + 		*)
++ + 		    SHLIB_CFLAGS="-fPIC"
++ + 		    ;;
++ + 	    esac
++ + 	fi
++ +     fi
++ + 
++ +     if test "$SHARED_LIB_SUFFIX" = "" ; then
++ + 	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
++ +     fi
++ +     if test "$UNSHARED_LIB_SUFFIX" = "" ; then
++ + 	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
++ +     fi
++ + 
++ +     AC_SUBST(DL_LIBS)
++ +     AC_SUBST(CFLAGS_DEBUG)
++ +     AC_SUBST(CFLAGS_OPTIMIZE)
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_SERIAL_PORT
++ + #
++ + #	Determine which interface to use to talk to the serial port.
++ + #	Note that #include lines must begin in leftmost column for
++ + #	some compilers to recognize them as preprocessor directives.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Defines only one of the following vars:
++ + #		USE_TERMIOS
++ + #		USE_TERMIO
++ + #		USE_SGTTY
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_SERIAL_PORT, [
++ +     AC_MSG_CHECKING([termios vs. termio vs. sgtty])
++ + 
++ +     AC_TRY_RUN([
++ + #include <termios.h>
++ + 
++ + main()
++ + {
++ +     struct termios t;
++ +     if (tcgetattr(0, &t) == 0) {
++ + 	cfsetospeed(&t, 0);
++ + 	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
++ + 	return 0;
++ +     }
++ +     return 1;
++ + }], tk_ok=termios, tk_ok=no, tk_ok=no)
++ + 
++ +     if test $tk_ok = termios; then
++ + 	AC_DEFINE(USE_TERMIOS)
++ +     else
++ + 	AC_TRY_RUN([
++ + #include <termio.h>
++ + 
++ + main()
++ + {
++ +     struct termio t;
++ +     if (ioctl(0, TCGETA, &t) == 0) {
++ + 	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
++ + 	return 0;
++ +     }
++ +     return 1;
++ +     }], tk_ok=termio, tk_ok=no, tk_ok=no)
++ + 
++ +     if test $tk_ok = termio; then
++ + 	AC_DEFINE(USE_TERMIO)
++ +     else
++ + 	AC_TRY_RUN([
++ + #include <sgtty.h>
++ + 
++ + main()
++ + {
++ +     struct sgttyb t;
++ +     if (ioctl(0, TIOCGETP, &t) == 0) {
++ + 	t.sg_ospeed = 0;
++ + 	t.sg_flags |= ODDP | EVENP | RAW;
++ + 	return 0;
++ +     }
++ +     return 1;
++ + }], tk_ok=sgtty, tk_ok=none, tk_ok=none)
++ +     if test $tk_ok = sgtty; then
++ + 	AC_DEFINE(USE_SGTTY)
++ +     fi
++ +     fi
++ +     fi
++ +     AC_MSG_RESULT($tk_ok)
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_MISSING_POSIX_HEADERS
++ + #
++ + #	Supply substitutes for missing POSIX header files.  Special
++ + #	notes:
++ + #	    - stdlib.h doesn't define strtol, strtoul, or
++ + #	      strtod insome versions of SunOS
++ + #	    - some versions of string.h don't declare procedures such
++ + #	      as strstr
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Defines some of the following vars:
++ + #		NO_DIRENT_H
++ + #		NO_ERRNO_H
++ + #		NO_VALUES_H
++ + #		NO_LIMITS_H
++ + #		NO_STDLIB_H
++ + #		NO_STRING_H
++ + #		NO_SYS_WAIT_H
++ + #		NO_DLFCN_H
++ + #		HAVE_UNISTD_H
++ + #		HAVE_SYS_PARAM_H
++ + #
++ + #		HAVE_STRING_H ?
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
++ + 
++ +     AC_MSG_CHECKING(dirent.h)
++ +     AC_TRY_LINK([#include <sys/types.h>
++ + #include <dirent.h>], [
++ + #ifndef _POSIX_SOURCE
++ + #   ifdef __Lynx__
++ + 	/*
++ + 	 * Generate compilation error to make the test fail:  Lynx headers
++ + 	 * are only valid if really in the POSIX environment.
++ + 	 */
++ + 
++ + 	missing_procedure();
++ + #   endif
++ + #endif
++ + DIR *d;
++ + struct dirent *entryPtr;
++ + char *p;
++ + d = opendir("foobar");
++ + entryPtr = readdir(d);
++ + p = entryPtr->d_name;
++ + closedir(d);
++ + ], tcl_ok=yes, tcl_ok=no)
++ + 
++ +     if test $tcl_ok = no; then
++ + 	AC_DEFINE(NO_DIRENT_H)
++ +     fi
++ + 
++ +     AC_MSG_RESULT($tcl_ok)
++ +     AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
++ +     AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
++ +     AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H))
++ +     AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
++ +     AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
++ +     AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
++ +     AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
++ +     AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
++ +     if test $tcl_ok = 0; then
++ + 	AC_DEFINE(NO_STDLIB_H)
++ +     fi
++ +     AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
++ +     AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
++ +     AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
++ + 
++ +     # See also memmove check below for a place where NO_STRING_H can be
++ +     # set and why.
++ + 
++ +     if test $tcl_ok = 0; then
++ + 	AC_DEFINE(NO_STRING_H)
++ +     fi
++ + 
++ +     AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
++ +     AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H))
++ + 
++ +     # OS/390 lacks sys/param.h (and doesn't need it, by chance).
++ + 
++ +     AC_HAVE_HEADERS(unistd.h sys/param.h)
++ + 
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_PATH_X
++ + #
++ + #	Locate the X11 header files and the X11 library archive.  Try
++ + #	the ac_path_x macro first, but if it doesn't find the X stuff
++ + #	(e.g. because there's no xmkmf program) then check through
++ + #	a list of possible directories.  Under some conditions the
++ + #	autoconf macro will return an include directory that contains
++ + #	no include files, so double-check its result just to be safe.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Sets the the following vars:
++ + #		XINCLUDES
++ + #		XLIBSW
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_PATH_X, [
++ +     AC_PATH_X
++ +     not_really_there=""
++ +     if test "$no_x" = ""; then
++ + 	if test "$x_includes" = ""; then
++ + 	    AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
++ + 	else
++ + 	    if test ! -r $x_includes/X11/Intrinsic.h; then
++ + 		not_really_there="yes"
++ + 	    fi
++ + 	fi
++ +     fi
++ +     if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
++ + 	AC_MSG_CHECKING(for X11 header files)
++ + 	XINCLUDES="# no special path needed"
++ + 	AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
++ + 	if test "$XINCLUDES" = nope; then
++ + 	    dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
++ + 	    for i in $dirs ; do
++ + 		if test -r $i/X11/Intrinsic.h; then
++ + 		    AC_MSG_RESULT($i)
++ + 		    XINCLUDES=" -I$i"
++ + 		    break
++ + 		fi
++ + 	    done
++ + 	fi
++ +     else
++ + 	if test "$x_includes" != ""; then
++ + 	    XINCLUDES=-I$x_includes
++ + 	else
++ + 	    XINCLUDES="# no special path needed"
++ + 	fi
++ +     fi
++ +     if test "$XINCLUDES" = nope; then
++ + 	AC_MSG_RESULT(couldn't find any!)
++ + 	XINCLUDES="# no include files found"
++ +     fi
++ + 
++ +     if test "$no_x" = yes; then
++ + 	AC_MSG_CHECKING(for X11 libraries)
++ + 	XLIBSW=nope
++ + 	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
++ + 	for i in $dirs ; do
++ + 	    if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
++ + 		AC_MSG_RESULT($i)
++ + 		XLIBSW="-L$i -lX11"
++ + 		x_libraries="$i"
++ + 		break
++ + 	    fi
++ + 	done
++ +     else
++ + 	if test "$x_libraries" = ""; then
++ + 	    XLIBSW=-lX11
++ + 	else
++ + 	    XLIBSW="-L$x_libraries -lX11"
++ + 	fi
++ +     fi
++ +     if test "$XLIBSW" = nope ; then
++ + 	AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
++ +     fi
++ +     if test "$XLIBSW" = nope ; then
++ + 	AC_MSG_RESULT(couldn't find any!  Using -lX11.)
++ + 	XLIBSW=-lX11
++ +     fi
++ + ])
++ + #--------------------------------------------------------------------
++ + # SC_BLOCKING_STYLE
++ + #
++ + #	The statements below check for systems where POSIX-style
++ + #	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
++ + #	On these systems (mostly older ones), use the old BSD-style
++ + #	FIONBIO approach instead.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Defines some of the following vars:
++ + #		HAVE_SYS_IOCTL_H
++ + #		HAVE_SYS_FILIO_H
++ + #		USE_FIONBIO
++ + #		O_NONBLOCK
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_BLOCKING_STYLE, [
++ +     AC_CHECK_HEADERS(sys/ioctl.h)
++ +     AC_CHECK_HEADERS(sys/filio.h)
++ +     AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
++ +     if test -f /usr/lib/NextStep/software_version; then
++ + 	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
++ +     else
++ + 	system=`uname -s`-`uname -r`
++ + 	if test "$?" -ne 0 ; then
++ + 	    system=unknown
++ + 	else
++ + 	    # Special check for weird MP-RAS system (uname returns weird
++ + 	    # results, and the version is kept in special file).
++ + 	
++ + 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
++ + 		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
++ + 	    fi
++ + 	    if test "`uname -s`" = "AIX" ; then
++ + 		system=AIX-`uname -v`.`uname -r`
++ + 	    fi
++ + 	fi
++ +     fi
++ +     case $system in
++ + 	# There used to be code here to use FIONBIO under AIX.  However, it
++ + 	# was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
++ + 	# using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
++ + 	# code (JO, 5/31/97).
++ + 
++ + 	OSF*)
++ + 	    AC_DEFINE(USE_FIONBIO)
++ + 	    AC_MSG_RESULT(FIONBIO)
++ + 	    ;;
++ + 	SunOS-4*)
++ + 	    AC_DEFINE(USE_FIONBIO)
++ + 	    AC_MSG_RESULT(FIONBIO)
++ + 	    ;;
++ + 	ULTRIX-4.*)
++ + 	    AC_DEFINE(USE_FIONBIO)
++ + 	    AC_MSG_RESULT(FIONBIO)
++ + 	    ;;
++ + 	*)
++ + 	    AC_MSG_RESULT(O_NONBLOCK)
++ + 	    ;;
++ +     esac
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_HAVE_VFORK
++ + #
++ + #	Check to see whether the system provides a vfork kernel call.
++ + #	If not, then use fork instead.  Also, check for a problem with
++ + #	vforks and signals that can cause core dumps if a vforked child
++ + #	resets a signal handler.  If the problem exists, then use fork
++ + #	instead of vfork.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Defines some of the following vars:
++ + #		vfork (=fork)
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_HAVE_VFORK, [
++ +     AC_TYPE_SIGNAL()
++ +     AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0)
++ +     if test "$tcl_ok" = 1; then
++ + 	AC_MSG_CHECKING([vfork/signal bug]);
++ + 	AC_TRY_RUN([
++ + #include <stdio.h>
++ + #include <signal.h>
++ + #include <sys/wait.h>
++ + int gotSignal = 0;
++ + sigProc(sig)
++ +     int sig;
++ + {
++ +     gotSignal = 1;
++ + }
++ + main()
++ + {
++ +     int pid, sts;
++ +     (void) signal(SIGCHLD, sigProc);
++ +     pid = vfork();
++ +     if (pid <  0) {
++ + 	exit(1);
++ +     } else if (pid == 0) {
++ + 	(void) signal(SIGCHLD, SIG_DFL);
++ + 	_exit(0);
++ +     } else {
++ + 	(void) wait(&sts);
++ +     }
++ +     exit((gotSignal) ? 0 : 1);
++ + }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
++ + 
++ + 	if test "$tcl_ok" = 1; then
++ + 	    AC_MSG_RESULT(ok)
++ + 	else
++ + 	    AC_MSG_RESULT([buggy, using fork instead])
++ + 	fi
++ +     fi
++ +     rm -f core
++ +     if test "$tcl_ok" = 0; then
++ + 	AC_DEFINE(vfork, fork)
++ +     fi
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_TIME_HANLDER
++ + #
++ + #	Checks how the system deals with time.h, what time structures
++ + #	are used on the system, and what fields the structures have.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Defines some of the following vars:
++ + #		USE_DELTA_FOR_TZ
++ + #		HAVE_TM_GMTOFF
++ + #		HAVE_TM_TZADJ
++ + #		HAVE_TIMEZONE_VAR
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_TIME_HANDLER, [
++ +     AC_CHECK_HEADERS(sys/time.h)
++ +     AC_HEADER_TIME
++ +     AC_STRUCT_TIMEZONE
++ + 
++ +     AC_MSG_CHECKING([tm_tzadj in struct tm])
++ +     AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
++ + 	    [AC_DEFINE(HAVE_TM_TZADJ)
++ + 	    AC_MSG_RESULT(yes)],
++ + 	    AC_MSG_RESULT(no))
++ + 
++ +     AC_MSG_CHECKING([tm_gmtoff in struct tm])
++ +     AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
++ + 	    [AC_DEFINE(HAVE_TM_GMTOFF)
++ + 	    AC_MSG_RESULT(yes)],
++ + 	    AC_MSG_RESULT(no))
++ + 
++ +     #
++ +     # Its important to include time.h in this check, as some systems
++ +     # (like convex) have timezone functions, etc.
++ +     #
++ +     have_timezone=no
++ +     AC_MSG_CHECKING([long timezone variable])
++ +     AC_TRY_COMPILE([#include <time.h>],
++ + 	    [extern long timezone;
++ + 	    timezone += 1;
++ + 	    exit (0);],
++ + 	    [have_timezone=yes
++ + 	    AC_DEFINE(HAVE_TIMEZONE_VAR)
++ + 	    AC_MSG_RESULT(yes)],
++ + 	    AC_MSG_RESULT(no))
++ + 
++ +     #
++ +     # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
++ +     #
++ +     if test "$have_timezone" = no; then
++ +     AC_MSG_CHECKING([time_t timezone variable])
++ +     AC_TRY_COMPILE([#include <time.h>],
++ + 	    [extern time_t timezone;
++ + 	    timezone += 1;
++ + 	    exit (0);],
++ + 	    [AC_DEFINE(HAVE_TIMEZONE_VAR)
++ + 	    AC_MSG_RESULT(yes)],
++ + 	    AC_MSG_RESULT(no))
++ +     fi
++ + 
++ +     #
++ +     # AIX does not have a timezone field in struct tm. When the AIX bsd
++ +     # library is used, the timezone global and the gettimeofday methods are
++ +     # to be avoided for timezone deduction instead, we deduce the timezone
++ +     # by comparing the localtime result on a known GMT value.
++ +     #
++ + 
++ +     if test "`uname -s`" = "AIX" ; then
++ + 	AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
++ + 	if test $libbsd = yes; then
++ + 	    AC_DEFINE(USE_DELTA_FOR_TZ)
++ + 	fi
++ +     fi
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_BUGGY_STRTOD
++ + #
++ + #	Under Solaris 2.4, strtod returns the wrong value for the
++ + #	terminating character under some conditions.  Check for this
++ + #	and if the problem exists use a substitute procedure
++ + #	"fixstrtod" (provided by Tcl) that corrects the error.
++ + #
++ + # Arguments:
++ + #	none
++ + #	
++ + # Results:
++ + #
++ + #	Might defines some of the following vars:
++ + #		strtod (=fixstrtod)
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_BUGGY_STRTOD, [
++ +     AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
++ +     if test "$tk_strtod" = 1; then
++ + 	AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
++ + 	AC_TRY_RUN([
++ + 	    extern double strtod();
++ + 	    int main()
++ + 	    {
++ + 		char *string = "NaN";
++ + 		char *term;
++ + 		strtod(string, &term);
++ + 		if ((term != string) && (term[-1] == 0)) {
++ + 		    exit(1);
++ + 		}
++ + 		exit(0);
++ + 	    }], tk_ok=1, tk_ok=0, tk_ok=0)
++ + 	if test "$tk_ok" = 1; then
++ + 	    AC_MSG_RESULT(ok)
++ + 	else
++ + 	    AC_MSG_RESULT(buggy)
++ + 	    AC_DEFINE(strtod, fixstrtod)
++ + 	fi
++ +     fi
++ + ])
++ + 
++ + #--------------------------------------------------------------------
++ + # SC_TCL_LINK_LIBS
++ + #
++ + #	Search for the libraries needed to link the Tcl shell.
++ + #	Things like the math library (-lm) and socket stuff (-lsocket vs.
++ + #	-lnsl) are dealt with here.
++ + #
++ + # Arguments:
++ + #	Requires the following vars to be set in the Makefile:
++ + #		DL_LIBS
++ + #		LIBS
++ + #		MATH_LIBS
++ + #	
++ + # Results:
++ + #
++ + #	Subst's the following var:
++ + #		TCL_LIBS
++ + #		MATH_LIBS
++ + #
++ + #	Might append to the following vars:
++ + #		LIBS
++ + #
++ + #	Might define the following vars:
++ + #		HAVE_NET_ERRNO_H
++ + #
++ + #--------------------------------------------------------------------
++ + 
++ + AC_DEFUN(SC_TCL_LINK_LIBS, [
++ +     #--------------------------------------------------------------------
++ +     # On a few very rare systems, all of the libm.a stuff is
++ +     # already in libc.a.  Set compiler flags accordingly.
++ +     # Also, Linux requires the "ieee" library for math to work
++ +     # right (and it must appear before "-lm").
++ +     #--------------------------------------------------------------------
++ + 
++ +     AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
++ +     AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
++ + 
++ +     #--------------------------------------------------------------------
++ +     # On AIX systems, libbsd.a has to be linked in to support
++ +     # non-blocking file IO.  This library has to be linked in after
++ +     # the MATH_LIBS or it breaks the pow() function.  The way to
++ +     # insure proper sequencing, is to add it to the tail of MATH_LIBS.
++ +     # This library also supplies gettimeofday.
++ +     #--------------------------------------------------------------------
++ + 
++ +     libbsd=no
++ +     if test "`uname -s`" = "AIX" ; then
++ + 	AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
++ + 	if test $libbsd = yes; then
++ + 	    MATH_LIBS="$MATH_LIBS -lbsd"
++ + 	fi
++ +     fi
++ + 
++ + 
++ +     #--------------------------------------------------------------------
++ +     # Interactive UNIX requires -linet instead of -lsocket, plus it
++ +     # needs net/errno.h to define the socket-related error codes.
++ +     #--------------------------------------------------------------------
++ + 
++ +     AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
++ +     AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
++ + 
++ +     #--------------------------------------------------------------------
++ +     #	Check for the existence of the -lsocket and -lnsl libraries.
++ +     #	The order here is important, so that they end up in the right
++ +     #	order in the command line generated by make.  Here are some
++ +     #	special considerations:
++ +     #	1. Use "connect" and "accept" to check for -lsocket, and
++ +     #	   "gethostbyname" to check for -lnsl.
++ +     #	2. Use each function name only once:  can't redo a check because
++ +     #	   autoconf caches the results of the last check and won't redo it.
++ +     #	3. Use -lnsl and -lsocket only if they supply procedures that
++ +     #	   aren't already present in the normal libraries.  This is because
++ +     #	   IRIX 5.2 has libraries, but they aren't needed and they're
++ +     #	   bogus:  they goof up name resolution if used.
++ +     #	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
++ +     #	   To get around this problem, check for both libraries together
++ +     #	   if -lsocket doesn't work by itself.
++ +     #--------------------------------------------------------------------
++ + 
++ +     tcl_checkBoth=0
++ +     AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
++ +     if test "$tcl_checkSocket" = 1; then
++ + 	AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1)
++ +     fi
++ +     if test "$tcl_checkBoth" = 1; then
++ + 	tk_oldLibs=$LIBS
++ + 	LIBS="$LIBS -lsocket -lnsl"
++ + 	AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
++ +     fi
++ +     AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main,
++ + 	    [LIBS="$LIBS -lnsl"]))
++ +     
++ +     # Don't perform the eval of the libraries here because DL_LIBS
++ +     # won't be set until we call SC_CONFIG_CFLAGS
++ + 
++ +     TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
++ +     AC_SUBST(TCL_LIBS)
++ +     AC_SUBST(MATH_LIBS)
++ + ])
++ *** unix/configure.in.orig	Thu Nov  4 03:38:44 1999
++ --- unix/configure.in	Sun Nov 14 16:26:58 1999
++ ***************
++ *** 40,46 ****
++   #------------------------------------------------------------------------
++   
++   if test "${GCC}" = "yes" ; then
++ !     CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
++   else
++       CFLAGS_WARNING=""
++   fi
++ --- 40,46 ----
++   #------------------------------------------------------------------------
++   
++   if test "${GCC}" = "yes" ; then
++ !     CFLAGS_WARNING="-Wall -Wno-implicit-int"
++   else
++       CFLAGS_WARNING=""
++   fi
++ ***************
++ *** 333,338 ****
++ --- 333,339 ----
++   
++   SC_ENABLE_SHARED
++   
++ + TK_SHARED_BUILD=${SHARED_BUILD}
++   eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
++   eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
++   
++ ***************
++ *** 342,352 ****
++   if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
++       TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
++       TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
++ !     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
++       RANLIB=":"
++   
++ ! #    TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
++ !     TCL_STUB_FLAGS=""
++   else
++       TK_SHLIB_CFLAGS=""
++       TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
++ --- 343,352 ----
++   if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
++       TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
++       TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
++ !     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) \${TCL_STUB_LIB_SPEC} \${LIBS}"
++       RANLIB=":"
++   
++ !     TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
++   else
++       TK_SHLIB_CFLAGS=""
++       TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
++ ***************
++ *** 381,386 ****
++ --- 381,493 ----
++   fi
++   
++   #--------------------------------------------------------------------
++ + #	Checking X lib for i18n related things.
++ + #--------------------------------------------------------------------
++ + 
++ + X11_IMAKE_FLAGS=""
++ + tk_oldCflags=$CFLAGS
++ + tk_oldLibs=$LIBS
++ + CFLAGS="$CFLAGS $XINCLUDES"
++ + LIBS="$XLIBSW $LIBS"
++ + 
++ + AC_MSG_CHECKING([XRegisterIMInstantiateCallback])
++ + AC_TRY_LINK([
++ + #include <X11/Xlib.h>
++ + ], [
++ + XRegisterIMInstantiateCallback(0, 0, 0, 0, 0, 0);
++ + ], [
++ + AC_MSG_RESULT(yes)
++ + X11_IMAKE_FLAGS="-DHAVE_XIMREGINSTCB"
++ + ], [
++ + AC_MSG_RESULT(no)
++ + ])
++ + 
++ + AC_MSG_CHECKING([XIDProc])
++ + AC_TRY_COMPILE([
++ + #include <X11/Xlib.h>
++ + ], [
++ + XIDProc *a;
++ + ], [
++ + AC_MSG_RESULT(yes)
++ + ], [
++ + AC_MSG_RESULT(no)
++ + X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS -DNO_XIDPROC"
++ + ])
++ + 
++ + HAVE_XMKMF=""
++ + AC_PATH_PROG(HAVE_XMKMF, xmkmf, "", /usr/X11R6/bin /usr/X11R5/bin /usr/local/X11R6/bin /usr/local/X11R5/bin /usr/openwin/bin /usr/X11/bin /usr/X386/bin /usr/sww/bin /usr/unsupported/bin)
++ + if test "X$HAVE_XMKMF" != "X"; then
++ +     IMAKE_FLAGS=""
++ +     if test -d ImakeCheck; then
++ +         rm -rf ImakeCheck
++ +     fi
++ +     mkdir ImakeCheck
++ +     cat << EOF > ImakeCheck/Imakefile
++ + SRCS = dummy.c
++ + OBJS = dummy.o
++ + 
++ + ComplexProgramTarget(dummy)
++ + EOF
++ +     cat << EOF > ImakeCheck/dummy.c
++ + static int justAnInt = 0;
++ + EOF
++ +     (cd ./ImakeCheck; rm -f Makefile Makefile.*; eval $HAVE_XMKMF) > /dev/null 2>&1
++ +     for i in `(cd ./ImakeCheck; make -n dummy.o)`
++ +     do
++ +         case $i in -D*) IMAKE_FLAGS="$IMAKE_FLAGS $i";; esac
++ +     done
++ +     if test "X$IMAKE_FLAGS" != "X"; then
++ +         AC_MSG_RESULT(Add these flags for proper compile: $IMAKE_FLAGS)
++ +         X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS $IMAKE_FLAGS"
++ +     fi
++ +     rm -rf ImakeCheck
++ + fi
++ + 
++ + # At last check FreeBSD and have -lxpg4.
++ + AC_MSG_CHECKING([system version (for additional locale library)])
++ + if test -f /usr/lib/NextStep/software_version; then
++ +     system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
++ + else
++ +     system=`uname -s`-`uname -r`
++ +     if test "$?" -ne 0 ; then
++ +         system=unknown
++ +     else
++ +         # Special check for weird MP-RAS system (uname returns weird
++ +         # results, and the version is kept in special file).
++ +     
++ +         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
++ +             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
++ +         fi
++ +         if test "`uname -s`" = "AIX" ; then
++ +             system=AIX-`uname -v`.`uname -r`
++ +         fi
++ +     fi
++ + fi
++ + 
++ + case $system in
++ +     FreeBSD-*)
++ + 	LIBS="$XLIBSW -lxpg4 $tk_oldLibs"
++ + 	CFLAGS="$CFLAGS $X11_IMAKE_FLAGS"
++ + 	AC_TRY_COMPILE([
++ + #include <locale.h>
++ + ], [
++ + (void)setlocale(LC_ALL, "");
++ + ], [
++ + AC_MSG_RESULT(use xpg4 library.)
++ + XLIBSW="$XLIBSW -lxpg4"
++ + ], [
++ + AC_MSG_RESULT(no need other libraries.)
++ + ])
++ + 	;;
++ +     *)
++ + 	AC_MSG_RESULT(No additional library is needed.)
++ + 	;;
++ + esac
++ + 
++ + CFLAGS=$tk_oldCflags
++ + LIBS=$tk_oldLibs
++ + 
++ + #--------------------------------------------------------------------
++   # The statements below define various symbols relating to creating
++   # the stub'd version of the Tk library
++   #
++ ***************
++ *** 410,415 ****
++ --- 517,523 ----
++   AC_SUBST(STUB_LIB_FILE)
++   
++   AC_SUBST(TK_STUB_LIB_FILE)
++ + AC_SUBST(TCL_STUB_LIB_FLAG)
++   AC_SUBST(TK_STUB_LIB_FLAG)
++   AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
++   AC_SUBST(TK_STUB_LIB_SPEC)
++ ***************
++ *** 444,452 ****
++   AC_SUBST(SHLIB_VERSION)
++   AC_SUBST(TCL_BIN_DIR)
++   AC_SUBST(TCL_LIB_SPEC)
++   AC_SUBST(TCL_LIB_FLAG)
++ ! #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
++ ! #AC_SUBST(TCL_BUILD_LIB_SPEC)
++   AC_SUBST(TCL_DBGX)
++   AC_SUBST(TCL_LIB_FLAG)
++   AC_SUBST(TCL_SRC_DIR)
++ --- 552,561 ----
++   AC_SUBST(SHLIB_VERSION)
++   AC_SUBST(TCL_BIN_DIR)
++   AC_SUBST(TCL_LIB_SPEC)
++ + AC_SUBST(TCL_STUB_LIB_SPEC)
++   AC_SUBST(TCL_LIB_FLAG)
++ ! AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
++ ! AC_SUBST(TCL_BUILD_LIB_SPEC)
++   AC_SUBST(TCL_DBGX)
++   AC_SUBST(TCL_LIB_FLAG)
++   AC_SUBST(TCL_SRC_DIR)
++ ***************
++ *** 454,459 ****
++ --- 563,569 ----
++   AC_SUBST(TK_BUILD_LIB_SPEC)
++   AC_SUBST(TK_CC_SEARCH_FLAGS)
++   AC_SUBST(TK_LD_SEARCH_FLAGS)
++ + AC_SUBST(TK_SHARED_LIB_FILE)
++   AC_SUBST(TK_LIB_FILE)
++   AC_SUBST(TK_LIB_FLAG)
++   AC_SUBST(TK_LIB_SPEC)
++ ***************
++ *** 465,469 ****
++   AC_SUBST(XINCLUDES)
++   AC_SUBST(XLIBSW)
++   AC_SUBST(TK_SHARED_BUILD)
++ ! 
++ ! AC_OUTPUT(Makefile tkConfig.sh)
++ --- 575,579 ----
++   AC_SUBST(XINCLUDES)
++   AC_SUBST(XLIBSW)
++   AC_SUBST(TK_SHARED_BUILD)
++ ! AC_SUBST(X11_IMAKE_FLAGS)
++ ! AC_OUTPUT(Makefile tkConfig.sh pkgIndex.tcl)
++ *** unix/configure.orig	Thu Nov  4 03:38:44 1999
++ --- unix/configure	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 22,32 ****
++   ac_help="$ac_help
++     --disable-load          disallow dynamic loading and "load" command"
++   ac_help="$ac_help
++ !   --enable-symbols        build with debugging symbols [--disable-symbols]"
++   ac_help="$ac_help
++     --with-x                use the X Window System"
++   ac_help="$ac_help
++ !   --enable-shared         build and link with shared libraries [--enable-shared]"
++   
++   # Initialize some variables set by options.
++   # The variables have the same names as the options, with
++ --- 22,32 ----
++   ac_help="$ac_help
++     --disable-load          disallow dynamic loading and "load" command"
++   ac_help="$ac_help
++ !   --enable-symbols        build with debugging symbols [--enable-symbols]"
++   ac_help="$ac_help
++     --with-x                use the X Window System"
++   ac_help="$ac_help
++ !   --disable-shared        build and link without shared libraries [--disable-shared]"
++   
++   # Initialize some variables set by options.
++   # The variables have the same names as the options, with
++ ***************
++ *** 1256,1262 ****
++   #------------------------------------------------------------------------
++   
++   if test "${GCC}" = "yes" ; then
++ !     CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
++   else
++       CFLAGS_WARNING=""
++   fi
++ --- 1256,1262 ----
++   #------------------------------------------------------------------------
++   
++   if test "${GCC}" = "yes" ; then
++ !     CFLAGS_WARNING="-Wall -Wno-implicit-int"
++   else
++       CFLAGS_WARNING=""
++   fi
++ ***************
++ *** 1524,1534 ****
++       case $system in
++   	AIX-4.[2-9])
++   	    SHLIB_CFLAGS=""
++ ! 	    SHLIB_LD=$TCL_SHLIB_LD
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++ ! 	    DL_LIBS="-ldl ${TCL_BUILD_LIB_SPEC}"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++   	    TCL_NEEDS_EXP_FILE=1
++ --- 1524,1534 ----
++       case $system in
++   	AIX-4.[2-9])
++   	    SHLIB_CFLAGS=""
++ ! 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++ ! 	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++   	    TCL_NEEDS_EXP_FILE=1
++ ***************
++ *** 1536,1547 ****
++   	    ;;
++   	AIX-*)
++   	    SHLIB_CFLAGS=""
++ ! 	    SHLIB_LD=$TCL_SHLIB_LD
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    LIBOBJS="$LIBOBJS tclLoadAix.o"
++ ! 	    DL_LIBS="-lld ${TCL_BUILD_LIB_SPEC}"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++   	    TCL_NEEDS_EXP_FILE=1
++ --- 1536,1547 ----
++   	    ;;
++   	AIX-*)
++   	    SHLIB_CFLAGS=""
++ ! 	    SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    LIBOBJS="$LIBOBJS tclLoadAix.o"
++ ! 	    DL_LIBS="-lld"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++   	    TCL_NEEDS_EXP_FILE=1
++ ***************
++ *** 1552,1558 ****
++   	    SHLIB_LD="shlicc -r"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1552,1558 ----
++   	    SHLIB_LD="shlicc -r"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1562,1568 ****
++   	    SHLIB_LD="cc -shared"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS="-export-dynamic"
++   	    LD_SEARCH_FLAGS=""
++ --- 1562,1568 ----
++   	    SHLIB_LD="cc -shared"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS="-export-dynamic"
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1572,1578 ****
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1572,1578 ----
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1644,1652 ****
++   	IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
++   	    SHLIB_CFLAGS=""
++   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
++ ! 	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++   	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++ --- 1644,1652 ----
++   	IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
++   	    SHLIB_CFLAGS=""
++   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
++ ! 	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++   	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++ ***************
++ *** 1670,1676 ****
++   	    SHLIB_LD="ld -32 -shared -rdata_shared"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ --- 1670,1676 ----
++   	    SHLIB_LD="ld -32 -shared -rdata_shared"
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1688,1694 ****
++   
++   	    if test "$have_dl" = yes; then
++   		SHLIB_LD="${CC} -shared"
++ ! 		DL_OBJS="tclLoadDl.o"
++   		DL_LIBS="-ldl"
++   		LDFLAGS="-rdynamic"
++   		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ --- 1688,1694 ----
++   
++   	    if test "$have_dl" = yes; then
++   		SHLIB_LD="${CC} -shared"
++ ! 		DL_OBJS=""
++   		DL_LIBS="-ldl"
++   		LDFLAGS="-rdynamic"
++   		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1741,1747 ****
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1741,1747 ----
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1751,1762 ****
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS="-Wl,-Bexport"
++   	    LD_SEARCH_FLAGS=""
++   	    ;;
++ ! 	NetBSD-*|FreeBSD-[1-2].*|OpenBSD-*)
++   	    # Not available on all versions:  check for include file.
++   	    ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
++   echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
++ --- 1751,1762 ----
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS="-Wl,-Bexport"
++   	    LD_SEARCH_FLAGS=""
++   	    ;;
++ ! 	NetBSD-*|FreeBSD-[12].*|OpenBSD-*)
++   	    # Not available on all versions:  check for include file.
++   	    ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
++   echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
++ ***************
++ *** 1791,1797 ****
++   		SHLIB_LD="ld -Bshareable -x"
++   		SHLIB_LD_LIBS=""
++   		SHLIB_SUFFIX=".so"
++ ! 		DL_OBJS="tclLoadDl.o"
++   		DL_LIBS=""
++   		LDFLAGS=""
++   		LD_SEARCH_FLAGS=""
++ --- 1791,1797 ----
++   		SHLIB_LD="ld -Bshareable -x"
++   		SHLIB_LD_LIBS=""
++   		SHLIB_SUFFIX=".so"
++ ! 		DL_OBJS=""
++   		DL_LIBS=""
++   		LDFLAGS=""
++   		LD_SEARCH_FLAGS=""
++ ***************
++ *** 1824,1830 ****
++   	    SHLIB_LD="ld -Bshareable -x"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1824,1830 ----
++   	    SHLIB_LD="ld -Bshareable -x"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1864,1870 ****
++   	    SHLIB_LD="ld -shared"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1864,1870 ----
++   	    SHLIB_LD="ld -shared"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1875,1881 ****
++   	    SHLIB_LD='ld -shared -expect_unresolved "*"'
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ --- 1875,1881 ----
++   	    SHLIB_LD='ld -shared -expect_unresolved "*"'
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1898,1904 ****
++   	    SHLIB_LD="ld -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS=""
++   	    LDFLAGS="-belf -Wl,-Bexport"
++   	    LD_SEARCH_FLAGS=""
++ --- 1898,1904 ----
++   	    SHLIB_LD="ld -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS=""
++   	    LDFLAGS="-belf -Wl,-Bexport"
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1908,1914 ****
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ --- 1908,1914 ----
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS=""
++ ***************
++ *** 1918,1924 ****
++   	    SHLIB_LD="ld"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ --- 1918,1924 ----
++   	    SHLIB_LD="ld"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1941,1947 ****
++   
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ --- 1941,1947 ----
++   
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    LDFLAGS=""
++   	    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1972,1978 ****
++   
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++   		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ --- 1972,1978 ----
++   
++   	    SHLIB_LD_LIBS='${LIBS}'
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
++   		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
++ ***************
++ *** 1995,2001 ****
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS="tclLoadDl.o"
++   	    DL_LIBS="-ldl"
++   	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
++   	    # that don't grok the -Bexport option.  Test that it does.
++ --- 1995,2001 ----
++   	    SHLIB_LD="cc -G"
++   	    SHLIB_LD_LIBS=""
++   	    SHLIB_SUFFIX=".so"
++ ! 	    DL_OBJS=""
++   	    DL_LIBS="-ldl"
++   	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
++   	    # that don't grok the -Bexport option.  Test that it does.
++ ***************
++ *** 2190,2196 ****
++   	DL_OBJS=""
++       fi
++   
++ !     if test "x$DL_OBJS" != "x" ; then
++   	BUILD_DLTEST="\$(DLTEST_TARGETS)"
++       else
++   	echo "Can't figure out how to do dynamic loading or shared libraries"
++ --- 2190,2196 ----
++   	DL_OBJS=""
++       fi
++   
++ !     if test "x$SHLIB_LD" != "x" ; then
++   	BUILD_DLTEST="\$(DLTEST_TARGETS)"
++       else
++   	echo "Can't figure out how to do dynamic loading or shared libraries"
++ ***************
++ *** 2255,2267 ****
++   fi
++   
++       if test "$tcl_ok" = "yes"; then
++ ! 	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
++ ! 	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
++   	DBGX=g
++   	echo "$ac_t""yes" 1>&6
++       else
++ ! 	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
++ ! 	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
++   	DBGX=""
++   	echo "$ac_t""no" 1>&6
++       fi
++ --- 2255,2267 ----
++   fi
++   
++       if test "$tcl_ok" = "yes"; then
++ ! 	CFLAGS_DEFAULT='${CFLAGS_DEBUG}'
++ ! 	LDFLAGS_DEFAULT='${LDFLAGS_DEBUG}'
++   	DBGX=g
++   	echo "$ac_t""yes" 1>&6
++       else
++ ! 	CFLAGS_DEFAULT='${CFLAGS_OPTIMIZE}'
++ ! 	LDFLAGS_DEFAULT='${LDFLAGS_OPTIMIZE}'
++   	DBGX=""
++   	echo "$ac_t""no" 1>&6
++       fi
++ ***************
++ *** 3958,3963 ****
++ --- 3958,3964 ----
++       fi
++   
++   
++ + TK_SHARED_BUILD=${SHARED_BUILD}
++   eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
++   eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
++   
++ ***************
++ *** 3967,3977 ****
++   if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
++       TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
++       TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
++ !     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
++       RANLIB=":"
++   
++ ! #    TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
++ !     TCL_STUB_FLAGS=""
++   else
++       TK_SHLIB_CFLAGS=""
++       TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
++ --- 3968,3977 ----
++   if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
++       TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
++       TK_LIB_FILE=libtk${TK_SHARED_LIB_SUFFIX}
++ !     MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) \${TCL_STUB_LIB_SPEC} \${LIBS}"
++       RANLIB=":"
++   
++ !     TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
++   else
++       TK_SHLIB_CFLAGS=""
++       TK_LIB_FILE=libtk${TK_UNSHARED_LIB_SUFFIX}
++ ***************
++ *** 4006,4011 ****
++ --- 4006,4207 ----
++   fi
++   
++   #--------------------------------------------------------------------
++ + #	Checking X lib for i18n related things.
++ + #--------------------------------------------------------------------
++ + 
++ + X11_IMAKE_FLAGS=""
++ + tk_oldCflags=$CFLAGS
++ + tk_oldLibs=$LIBS
++ + CFLAGS="$CFLAGS $XINCLUDES"
++ + LIBS="$XLIBSW $LIBS"
++ + 
++ + echo $ac_n "checking XRegisterIMInstantiateCallback""... $ac_c" 1>&6
++ + echo "configure:4020: checking XRegisterIMInstantiateCallback" >&5
++ + cat > conftest.$ac_ext <<EOF
++ + #line 4022 "configure"
++ + #include "confdefs.h"
++ + 
++ + #include <X11/Xlib.h>
++ + 
++ + int main() {
++ + 
++ + XRegisterIMInstantiateCallback(0, 0, 0, 0, 0, 0);
++ + 
++ + ; return 0; }
++ + EOF
++ + if { (eval echo configure:4033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""yes" 1>&6
++ + X11_IMAKE_FLAGS="-DHAVE_XIMREGINSTCB"
++ + 
++ + else
++ +   echo "configure: failed program was:" >&5
++ +   cat conftest.$ac_ext >&5
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""no" 1>&6
++ + 
++ + fi
++ + rm -f conftest*
++ + 
++ + echo $ac_n "checking XIDProc""... $ac_c" 1>&6
++ + echo "configure:4050: checking XIDProc" >&5
++ + cat > conftest.$ac_ext <<EOF
++ + #line 4052 "configure"
++ + #include "confdefs.h"
++ + 
++ + #include <X11/Xlib.h>
++ + 
++ + int main() {
++ + 
++ + XIDProc *a;
++ + 
++ + ; return 0; }
++ + EOF
++ + if { (eval echo configure:4063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""yes" 1>&6
++ + 
++ + else
++ +   echo "configure: failed program was:" >&5
++ +   cat conftest.$ac_ext >&5
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""no" 1>&6
++ + X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS -DNO_XIDPROC"
++ + 
++ + fi
++ + rm -f conftest*
++ + 
++ + HAVE_XMKMF=""
++ + # Extract the first word of "xmkmf", so it can be a program name with args.
++ + set dummy xmkmf; ac_word=$2
++ + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
++ + echo "configure:4083: checking for $ac_word" >&5
++ + if eval "test \"`echo '$''{'ac_cv_path_HAVE_XMKMF'+set}'`\" = set"; then
++ +   echo $ac_n "(cached) $ac_c" 1>&6
++ + else
++ +   case "$HAVE_XMKMF" in
++ +   /*)
++ +   ac_cv_path_HAVE_XMKMF="$HAVE_XMKMF" # Let the user override the test with a path.
++ +   ;;
++ +   ?:/*)			 
++ +   ac_cv_path_HAVE_XMKMF="$HAVE_XMKMF" # Let the user override the test with a dos path.
++ +   ;;
++ +   *)
++ +   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
++ +   ac_dummy="/usr/X11R6/bin /usr/X11R5/bin /usr/local/X11R6/bin /usr/local/X11R5/bin /usr/openwin/bin /usr/X11/bin /usr/X386/bin /usr/sww/bin /usr/unsupported/bin"
++ +   for ac_dir in $ac_dummy; do 
++ +     test -z "$ac_dir" && ac_dir=.
++ +     if test -f $ac_dir/$ac_word; then
++ +       ac_cv_path_HAVE_XMKMF="$ac_dir/$ac_word"
++ +       break
++ +     fi
++ +   done
++ +   IFS="$ac_save_ifs"
++ +   test -z "$ac_cv_path_HAVE_XMKMF" && ac_cv_path_HAVE_XMKMF=""""
++ +   ;;
++ + esac
++ + fi
++ + HAVE_XMKMF="$ac_cv_path_HAVE_XMKMF"
++ + if test -n "$HAVE_XMKMF"; then
++ +   echo "$ac_t""$HAVE_XMKMF" 1>&6
++ + else
++ +   echo "$ac_t""no" 1>&6
++ + fi
++ + 
++ + if test "X$HAVE_XMKMF" != "X"; then
++ +     IMAKE_FLAGS=""
++ +     if test -d ImakeCheck; then
++ +         rm -rf ImakeCheck
++ +     fi
++ +     mkdir ImakeCheck
++ +     cat << EOF > ImakeCheck/Imakefile
++ + SRCS = dummy.c
++ + OBJS = dummy.o
++ + 
++ + ComplexProgramTarget(dummy)
++ + EOF
++ +     cat << EOF > ImakeCheck/dummy.c
++ + static int justAnInt = 0;
++ + EOF
++ +     (cd ./ImakeCheck; rm -f Makefile Makefile.*; eval $HAVE_XMKMF) > /dev/null 2>&1
++ +     for i in `(cd ./ImakeCheck; make -n dummy.o)`
++ +     do
++ +         case $i in -D*) IMAKE_FLAGS="$IMAKE_FLAGS $i";; esac
++ +     done
++ +     if test "X$IMAKE_FLAGS" != "X"; then
++ +         echo "$ac_t""Add these flags for proper compile: $IMAKE_FLAGS" 1>&6
++ +         X11_IMAKE_FLAGS="$X11_IMAKE_FLAGS $IMAKE_FLAGS"
++ +     fi
++ +     rm -rf ImakeCheck
++ + fi
++ + 
++ + # At last check FreeBSD and have -lxpg4.
++ + echo $ac_n "checking system version (for additional locale library)""... $ac_c" 1>&6
++ + echo "configure:4145: checking system version (for additional locale library)" >&5
++ + if test -f /usr/lib/NextStep/software_version; then
++ +     system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
++ + else
++ +     system=`uname -s`-`uname -r`
++ +     if test "$?" -ne 0 ; then
++ +         system=unknown
++ +     else
++ +         # Special check for weird MP-RAS system (uname returns weird
++ +         # results, and the version is kept in special file).
++ +     
++ +         if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
++ +             system=MP-RAS-`awk '{print $3}' /etc/.relid'`
++ +         fi
++ +         if test "`uname -s`" = "AIX" ; then
++ +             system=AIX-`uname -v`.`uname -r`
++ +         fi
++ +     fi
++ + fi
++ + 
++ + case $system in
++ +     FreeBSD-*)
++ + 	LIBS="$XLIBSW -lxpg4 $tk_oldLibs"
++ + 	CFLAGS="$CFLAGS $X11_IMAKE_FLAGS"
++ + 	cat > conftest.$ac_ext <<EOF
++ + #line 4170 "configure"
++ + #include "confdefs.h"
++ + 
++ + #include <locale.h>
++ + 
++ + int main() {
++ + 
++ + (void)setlocale(LC_ALL, "");
++ + 
++ + ; return 0; }
++ + EOF
++ + if { (eval echo configure:4181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""use xpg4 library." 1>&6
++ + XLIBSW="$XLIBSW -lxpg4"
++ + 
++ + else
++ +   echo "configure: failed program was:" >&5
++ +   cat conftest.$ac_ext >&5
++ +   rm -rf conftest*
++ +   
++ + echo "$ac_t""no need other libraries." 1>&6
++ + 
++ + fi
++ + rm -f conftest*
++ + 	;;
++ +     *)
++ + 	echo "$ac_t""No additional library is needed." 1>&6
++ + 	;;
++ + esac
++ + 
++ + CFLAGS=$tk_oldCflags
++ + LIBS=$tk_oldLibs
++ + 
++ + #--------------------------------------------------------------------
++   # The statements below define various symbols relating to creating
++   # the stub'd version of the Tk library
++   #
++ ***************
++ *** 4045,4050 ****
++ --- 4241,4247 ----
++   
++   
++   
++ + 
++   eval "TK_LIB_FILE=${TK_LIB_FILE}"
++   
++   
++ ***************
++ *** 4070,4077 ****
++   
++   
++   
++ ! #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
++ ! #AC_SUBST(TCL_BUILD_LIB_SPEC)
++   
++   
++   
++ --- 4267,4276 ----
++   
++   
++   
++ ! 
++ ! 
++ ! 
++ ! 
++   
++   
++   
++ ***************
++ *** 4203,4209 ****
++   
++   ac_given_srcdir=$srcdir
++   
++ ! trap 'rm -fr `echo "Makefile tkConfig.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
++   EOF
++   cat >> $CONFIG_STATUS <<EOF
++   
++ --- 4402,4408 ----
++   
++   ac_given_srcdir=$srcdir
++   
++ ! trap 'rm -fr `echo "Makefile tkConfig.sh pkgIndex.tcl" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
++   EOF
++   cat >> $CONFIG_STATUS <<EOF
++   
++ ***************
++ *** 4244,4251 ****
++ --- 4443,4452 ----
++   s%@DL_LIBS@%$DL_LIBS%g
++   s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
++   s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
++ + s%@HAVE_XMKMF@%$HAVE_XMKMF%g
++   s%@STUB_LIB_FILE@%$STUB_LIB_FILE%g
++   s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
++ + s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
++   s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
++   s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
++   s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
++ ***************
++ *** 4270,4281 ****
++ --- 4471,4486 ----
++   s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
++   s%@SHLIB_VERSION@%$SHLIB_VERSION%g
++   s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
++ + s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
++   s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
++ + s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
++ + s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
++   s%@TCL_DBGX@%$TCL_DBGX%g
++   s%@TCL_VERSION@%$TCL_VERSION%g
++   s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
++   s%@TK_CC_SEARCH_FLAGS@%$TK_CC_SEARCH_FLAGS%g
++   s%@TK_LD_SEARCH_FLAGS@%$TK_LD_SEARCH_FLAGS%g
++ + s%@TK_SHARED_LIB_FILE@%$TK_SHARED_LIB_FILE%g
++   s%@TK_LIB_FILE@%$TK_LIB_FILE%g
++   s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
++   s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
++ ***************
++ *** 4287,4292 ****
++ --- 4492,4498 ----
++   s%@XINCLUDES@%$XINCLUDES%g
++   s%@XLIBSW@%$XLIBSW%g
++   s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
++ + s%@X11_IMAKE_FLAGS@%$X11_IMAKE_FLAGS%g
++   
++   CEOF
++   EOF
++ ***************
++ *** 4328,4334 ****
++   
++   cat >> $CONFIG_STATUS <<EOF
++   
++ ! CONFIG_FILES=\${CONFIG_FILES-"Makefile tkConfig.sh"}
++   EOF
++   cat >> $CONFIG_STATUS <<\EOF
++   for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
++ --- 4534,4540 ----
++   
++   cat >> $CONFIG_STATUS <<EOF
++   
++ ! CONFIG_FILES=\${CONFIG_FILES-"Makefile tkConfig.sh pkgIndex.tcl"}
++   EOF
++   cat >> $CONFIG_STATUS <<\EOF
++   for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
++ *** unix/mkinstalldirs.orig	Sun Nov 14 16:26:59 1999
++ --- unix/mkinstalldirs	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 0 ****
++ --- 1,32 ----
++ + #! /bin/sh
++ + # mkinstalldirs --- make directory hierarchy
++ + # Author: Noah Friedman <friedman@prep.ai.mit.edu>
++ + # Created: 1993-05-16
++ + # Last modified: 1994-03-25
++ + # Public domain
++ + 
++ + errstatus=0
++ + 
++ + for file in ${1+"$@"} ; do 
++ +    set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
++ +    shift
++ + 
++ +    pathcomp=
++ +    for d in ${1+"$@"} ; do
++ +      pathcomp="$pathcomp$d"
++ +      case "$pathcomp" in
++ +        -* ) pathcomp=./$pathcomp ;;
++ +      esac
++ + 
++ +      if test ! -d "$pathcomp"; then
++ +         echo "mkdir $pathcomp" 1>&2
++ +         mkdir "$pathcomp" || errstatus=$?
++ +      fi
++ + 
++ +      pathcomp="$pathcomp/"
++ +    done
++ + done
++ + 
++ + exit $errstatus
++ + 
++ + # mkinstalldirs ends here
++ *** unix/pkgIndex.tcl.in.orig	Sun Nov 14 16:26:59 1999
++ --- unix/pkgIndex.tcl.in	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 0 ****
++ --- 1,7 ----
++ + # Tcl package index file, version 1.0
++ + 
++ + package ifneeded Tk @TK_VERSION@ [list load [file join $dir @TK_LIB_FILE@] Tk]
++ + package ifneeded Tksquare @TK_VERSION@ [list tclPkgSetup $dir Tksquare @TK_VERSION@\
++ +     [list [list Tksquare[info sharedlibextension] load square]]]
++ + package ifneeded Tktest @TK_VERSION@ [list tclPkgSetup $dir Tktest @TK_VERSION@\
++ +     [list [list Tktest[info sharedlibextension] load {testclipboard testcbind testdeleteapps testembed testmakeexist testmenubar testmetrics testprop testsend}]]]
++ *** unix/pkgInstall.tcl.orig	Sun Nov 14 16:26:59 1999
++ --- unix/pkgInstall.tcl	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 0 ****
++ --- 1,74 ----
++ + #!/bin/sh
++ + # The next line restarts using tclsh8.2 \
++ + exec tclsh8.2 $0 ${1+"$@"}
++ + 
++ + #
++ + # pkgInstall.tcl
++ + #
++ + # script to install a pkgIndex.tcl file
++ + # into <exec-prefix>/lib
++ + #
++ + # Written by:	Jan Nijtmans
++ + #		CMG (Computer Management Group) Arnhem B.V.
++ + #		email: j.nijtmans@chello.nl (private)
++ + #		       jan.nijtmans@cmg.nl (work)
++ + #		url:   http://purl.oclc.org/net/nijtmans/
++ + 
++ + if {[llength $argv] != 1} {
++ +     puts stderr "usage: pkgInstall.tcl <prefix>"
++ +     exit 1
++ + }
++ + 
++ + set dir [lindex $argv 0]
++ + set header ""
++ + 
++ + set f [open pkgIndex.tcl r]
++ + set line [gets $f]
++ + while {![regexp "package ifneeded " $line] && ![eof $f]} {
++ +     append header "${line}\n"
++ +     set line [gets $f]
++ + }
++ + set pkgIndex "${line}\n"
++ + while {![info complete $pkgIndex] && ![eof $f]} {
++ +     set line [gets $f]
++ +     append pkgIndex "${line}\n"
++ + }
++ + close $f
++ + regexp {package ifneeded ([A-Z][a-z_]+) ([0-9\.]+) } $pkgIndex \
++ + 		trash Pkgname version
++ + set separator "if \{\[package vcompare \[info tclversion\] $tcl_version\] < 0\} return\n"
++ + 
++ + if {![catch {set f [open [file join $dir pkgIndex.tcl] r]}]} {
++ +     set line {}
++ +     while {![string match "*package ifneeded*" $line] &&
++ + 	    ![string match "if*" $line] && ![eof $f]} {
++ + 	set line [gets $f]
++ +     }
++ +     while {![eof $f]} {
++ + 	set chunk "${line}\n"
++ + 	while {![info complete $chunk] && ![eof $f]} {
++ + 	    set line [gets $f]
++ + 	    append chunk "${line}\n"
++ + 	}
++ + 	if [string match "*package ifneeded*" $chunk] {
++ + 	    if {![string match "package ifneeded $Pkgname $version *" $chunk]} {
++ + 		append header $chunk
++ + 	    }
++ + 	} elseif [string match "if*" $chunk] {
++ + 	    regsub -all "\\\$tcl_version" $chunk "\[info tclversion\]" chunk
++ + 	    if {[string equal "if \{\[package vcompare \[info tclversion\] $tcl_version\] < 0\} return\n" $chunk]} {
++ + 		set separator ""
++ + 	    }
++ + 	    append header $chunk
++ + 	}
++ + 	set line [gets $f]
++ +     }
++ +     close $f
++ + }
++ + 
++ + set f [open [file join $dir pkgIndex.tcl] w]
++ + puts -nonewline $f $header
++ + puts -nonewline $f $separator
++ + puts -nonewline $f $pkgIndex
++ + flush $f
++ + close $f
++ *** unix/tkAppInit.c.orig	Fri Apr 16 03:51:45 1999
++ --- unix/tkAppInit.c	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 13,20 ****
++ --- 13,24 ----
++    * RCS: @(#) $Id: tkAppInit.c,v 1.4 1999/04/16 01:51:45 stanton Exp $
++    */
++   
++ + #undef TCL_USE_STUBS
++ + 
++   #include "tk.h"
++ + #ifndef I18N_IMPROVE
++   #include "locale.h"
++ + #endif /* !I18N_IMPROVE */
++   
++   /*
++    * The following variable is a special hack that is needed in order for
++ *** unix/tkConfig.sh.in.orig	Thu Nov  4 03:38:44 1999
++ --- unix/tkConfig.sh.in	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 20,26 ****
++   TK_PATCH_LEVEL='@TK_PATCH_LEVEL@'
++   
++   # -D flags for use with the C compiler.
++ ! TK_DEFS='@DEFS@'
++   
++   # Flag, 1: we built a shared lib, 0 we didn't
++   TK_SHARED_BUILD=@TK_SHARED_BUILD@
++ --- 20,26 ----
++   TK_PATCH_LEVEL='@TK_PATCH_LEVEL@'
++   
++   # -D flags for use with the C compiler.
++ ! TK_DEFS='@DEFS@ @X11_IMAKE_FLAGS@ -DI18N_IMPROVE'
++   
++   # Flag, 1: we built a shared lib, 0 we didn't
++   TK_SHARED_BUILD=@TK_SHARED_BUILD@
++ *** unix/tkUnixEvent.c.orig	Fri Apr 16 03:51:46 1999
++ --- unix/tkUnixEvent.c	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 161,167 ****
++           (void) XSync(dispPtr->display, False);
++           (void) XCloseDisplay(dispPtr->display);
++       }
++ !     
++       ckfree((char *) dispPtr);
++   }
++   
++ --- 161,172 ----
++           (void) XSync(dispPtr->display, False);
++           (void) XCloseDisplay(dispPtr->display);
++       }
++ ! #ifdef I18N_IMPROVE
++ !     if (displayPtr->imEncoding != NULL) {
++ ! 	Tcl_FreeEncoding(displayPtr->imEncoding);
++ !     }
++ ! #endif /* I18N_IMPROVE */    
++ ! 
++       ckfree((char *) dispPtr);
++   }
++   
++ ***************
++ *** 246,251 ****
++ --- 251,268 ----
++   
++       while (numFound > 0) {
++   	XNextEvent(display, &event);
++ + #ifdef I18N_IMPROVE
++ + 	/*
++ + 	 * To avoid Tk freezing by IM server's protocol bugs,
++ + 	 * Re-check queued event after an event is filterd.
++ + 	 *
++ + 	 *	m-hirano
++ + 	 */
++ + 	if (XFilterEvent(&event, None) == True) {
++ + 	    numFound = XEventsQueued(display, QueuedAlready);
++ + 	    continue;
++ + 	}
++ + #endif /* I18N_IMPROVE */
++   	Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
++   	numFound--;
++       }
++ *** unix/tkUnixIm.c.orig	Sun Nov 14 16:26:59 1999
++ --- unix/tkUnixIm.c	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 0 ****
++ --- 1,255 ----
++ + /* 
++ +  * tkUnixIm.c --
++ +  *
++ +  *      This file contains modules to implement the XIM protocol session.
++ +  *	This is the shrinked version of tkXIM.c, worte for tk8.0jp.
++ +  *
++ +  *	Author:	m-hirano@sra.co.jp
++ +  *
++ +  * Copyright 1999 Software Research Associates, Inc.
++ +  *
++ +  * Permission to use, copy, modify, and distribute this software and its
++ +  * documentation for any purpose and without fee is hereby granted, provided
++ +  * that the above copyright notice appear in all copies and that both that
++ +  * copyright notice and this permission notice appear in supporting
++ +  * documentation, and that the name of Software Research Associates not be
++ +  * used in advertising or publicity pertaining to distribution of the
++ +  * software without specific, written prior permission.  Software Research
++ +  * Associates makes no representations about the suitability of this software
++ +  * for any purpose.  It is provided "as is" without express or implied
++ +  * warranty.
++ +  */
++ + 
++ + #if 0
++ + static char rcsid[] = "$Header: /home/m-hirano/cvsroot/tcltk/tk8.1/unix/tkUnixIm.c,v 1.1 1999/05/10 00:39:16 m-hirano Exp $";
++ + #endif
++ + 
++ + #include "tkPort.h"
++ + #include "tkInt.h"
++ + 
++ + #ifdef TK_USE_INPUT_METHODS
++ + #ifdef I18N_IMPROVE
++ + 
++ + static void		TkpIMGenericHandler _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));
++ + static TkWindow *	GetToplevel _ANSI_ARGS_((TkWindow *winPtr));
++ + static void		TkpCreateIMGenericHandler _ANSI_ARGS_((Tk_Window tkwin));
++ + static void		TkpDeleteIMGenericHandler _ANSI_ARGS_((Tk_Window tkwin));
++ + 
++ + static TkWindow *
++ + GetToplevel(winPtr)
++ +      TkWindow *winPtr;
++ + {
++ +     while (!(winPtr->flags & TK_TOP_LEVEL)) {
++ + 	winPtr = winPtr->parentPtr;
++ + 	if (winPtr == NULL) {
++ + 	    return NULL;
++ + 	}
++ +     }
++ +     return winPtr;
++ + }
++ + 
++ + 
++ + static void
++ + TkpIMGenericHandler(clientData, eventPtr)
++ +      ClientData clientData;
++ +      XEvent *eventPtr;
++ + {
++ +     Tk_Window tkwin = (Tk_Window)clientData;
++ +     TkWindow *winPtr = (TkWindow *)clientData;
++ +     
++ +     if (eventPtr->xany.window != Tk_WindowId(tkwin) ||
++ + 	winPtr->inputContext == NULL ||
++ + 	!(winPtr->flags & TK_CHECKED_IC)) {
++ + 	/*
++ + 	 * Why ME ???
++ + 	 */
++ + 	return;
++ +     }
++ + 
++ +     /*
++ +      * Well, should I care about Enter/Leave ?
++ +      */
++ + 
++ +     switch (eventPtr->type) {
++ +         case KeyPress:
++ +         case FocusIn: {
++ + 	    Window root, child;
++ + 	    int rootX, rootY;
++ + 	    int wX, wY;
++ + 	    unsigned int mask;
++ + 
++ + 	    /*
++ + 	     * Care about case mouse pointer is not on winPtr->window.
++ + 	     * In such a case, IM server can't fetch any events from Tk.
++ + 	     */
++ + 
++ + 	    if (XQueryPointer(winPtr->display,
++ + 			      RootWindow(winPtr->display, winPtr->screenNum),
++ + 			      &root, &child, &rootX, &rootY, &wX, &wY, &mask) == True) {
++ + 		TkWindow *pWin = (TkWindow *)Tk_CoordsToWindow(rootX, rootY,
++ + 							       (Tk_Window)winPtr);
++ + 		if (pWin != NULL && (pWin->window != winPtr->window)) {
++ + #if 0
++ + 		    /*
++ + 		     * Code belows are what I REALLY want to do. But,
++ + 		     * in XIMPreeditPosition mode, IM server use the
++ + 		     * focus window as key event source window and as
++ + 		     * PreeditArea window by X11 specification. I want
++ + 		     * IM server to use this focus window ONLY as key
++ + 		     * event source. Means:
++ + 		     *
++ + 		     * 	o PreeditArea and PreeditPosition take place
++ + 		     * 	  within client window (winPtr->window).
++ + 		     *	o KeyPress event source is the window in which
++ + 		     *	  mouse pointer is (pWin->window).
++ + 		     */
++ + 
++ + 		    if (XSetICValues(winPtr->inputContext, XNFocusWindow,
++ + 				     pWin->window, NULL) != NULL) {
++ + 			fprintf(stderr, "debugIC: can't set IC focus to pointer window 0x%08x\n",
++ + 				pWin->window);
++ + 		    } else {
++ + 			fprintf(stderr, "debugIC: set IC focus to pointer window 0x%08x\n",
++ + 				pWin->window);
++ + 		    }
++ + #endif
++ + 		    /*
++ + 		     * Check pWin and winPtr are in same toplevel.
++ + 		     * If they are NOT, don't change focus. 
++ + 		     */
++ + 		    TkWindow *pTop = GetToplevel(pWin);
++ + 		    TkWindow *wTop = GetToplevel(winPtr);
++ + 		    if (pTop == wTop) {
++ + 			TkpChangeFocus(winPtr, 1);
++ + 		    }
++ + 		}
++ + 	    }
++ + 	    /*
++ + 	     * Get current focused window.
++ + 	     */
++ + 	    if (winPtr->dispPtr->lastFocusedIC != winPtr->inputContext) {
++ + 		winPtr->dispPtr->lastFocusedIC = winPtr->inputContext;
++ + 		XSetICFocus(winPtr->inputContext);
++ + 	    }
++ + 	    break;
++ + 	}
++ + 
++ +         case FocusOut: {
++ + 	    winPtr->dispPtr->lastFocusedIC = None;
++ + 	    XUnsetICFocus(winPtr->inputContext);
++ + 	    break;
++ + 	}
++ + 
++ + 	case DestroyNotify: {
++ + 	    winPtr->dispPtr->lastFocusedIC = NULL;
++ + 	    XUnsetICFocus(winPtr->inputContext);
++ + 	    TkpDeleteIMGenericHandler(tkwin);
++ + 	    break;
++ + 	}
++ +     }
++ + }
++ + 
++ + 
++ + static void
++ + TkpCreateIMGenericHandler(tkwin)
++ +      Tk_Window tkwin;
++ + {
++ +     Tk_CreateEventHandler(tkwin, FocusChangeMask|StructureNotifyMask|KeyPressMask
++ + #if 0
++ + 			  EnterWindowMask|LeaveWindowMask,
++ + #else
++ + 			  ,
++ + #endif
++ + 			  (Tk_EventProc *)TkpIMGenericHandler,
++ + 			  (ClientData)tkwin);
++ + }
++ + 
++ + 
++ + static void
++ + TkpDeleteIMGenericHandler(tkwin)
++ +      Tk_Window tkwin;
++ + {
++ +     Tk_DeleteEventHandler(tkwin, FocusChangeMask|StructureNotifyMask|KeyPressMask
++ + #if 0
++ + 			  EnterWindowMask|LeaveWindowMask,
++ + #else
++ + 			  ,
++ + #endif
++ + 			  (Tk_EventProc *)TkpIMGenericHandler,
++ + 			  (ClientData)tkwin);
++ + }
++ + 
++ + 
++ + XIC
++ + TkpCreateIC(winPtr)
++ +      TkWindow *winPtr;
++ + {
++ +     if (winPtr->dispPtr->inputMethod != NULL &&
++ + 	!(winPtr->flags & TK_CHECKED_IC)) {
++ + 	winPtr->inputContext =
++ + 		XCreateIC(winPtr->dispPtr->inputMethod,
++ + 			  XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
++ + 			  XNClientWindow, winPtr->window,
++ + 			  XNFocusWindow, winPtr->window,
++ + 			  NULL);
++ + 	if (winPtr->inputContext != NULL) {
++ + 	    TkpCreateIMGenericHandler((Tk_Window)winPtr);
++ + 	}
++ +     }
++ +     winPtr->flags |= TK_CHECKED_IC;
++ +     return winPtr->inputContext;
++ + }
++ + 
++ + 
++ + void
++ + TkpDestroyIC(winPtr, needDestroy)
++ +      TkWindow *winPtr;
++ +      int needDestroy;
++ + {
++ +     TkpDeleteIMGenericHandler((Tk_Window)winPtr);
++ +     if (winPtr->inputContext == winPtr->dispPtr->lastFocusedIC) {
++ + 	winPtr->dispPtr->lastFocusedIC = None;
++ +     }
++ +     if (needDestroy == 1 &&
++ + 	winPtr->inputContext != NULL) {
++ + 	XDestroyIC(winPtr->inputContext);
++ +     }
++ +     winPtr->flags &= ~(TK_CHECKED_IC);
++ +     winPtr->inputContext = NULL;
++ + }
++ + 
++ + 
++ + int
++ + Tk_ImconfigureObjCmd(clientData, interp, objc, objv)
++ +      ClientData clientData;	/* Main window associated with
++ + 				 * interpreter. */
++ +      Tcl_Interp *interp;	/* Current interpreter. */
++ +      int objc;			/* Number of arguments. */
++ +      Tcl_Obj *CONST objv[];	/* Argument objects. */
++ + {
++ +     Tk_Window tkwin = (Tk_Window)clientData;
++ +     Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);
++ + 
++ +     if (objc < 2) {
++ + 	Tcl_WrongNumArgs(interp, 1, objv, "path ?option? ?arg? ...");
++ + 	return TCL_ERROR;
++ +     }
++ + 
++ +     tkwin = Tk_NameToWindow(interp, Tcl_GetStringFromObj(objv[1], NULL), tkwin);
++ +     if (tkwin == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++ + 
++ +     if (((TkWindow *)tkwin)->dispPtr->inputMethod == NULL) {
++ + 	Tcl_AppendStringsToObj(resultPtr, "No IM server is available.", NULL);
++ + 	return TCL_ERROR;
++ +     }
++ + 
++ +     Tcl_AppendStringsToObj(resultPtr,
++ + 			  (TkpCreateIC((TkWindow *)tkwin) != NULL) ? "1" : "0",
++ + 			  NULL);
++ +     return TCL_OK;
++ + }
++ + 
++ + #endif /* I18N_IMPROVE */
++ + #endif /* TK_USE_INPUT_METHODS */
++ *** unix/tkUnixInit.c.orig	Fri Apr 16 03:51:46 1999
++ --- unix/tkUnixInit.c	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 104,111 ****
++   
++   void
++   TkpDisplayWarning(msg, title)
++ !     char *msg;			/* Message to be displayed. */
++ !     char *title;		/* Title of warning. */
++   {
++       Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
++       if (errChannel) {
++ --- 104,111 ----
++   
++   void
++   TkpDisplayWarning(msg, title)
++ !     CONST char *msg;		/* Message to be displayed. */
++ !     CONST char *title;		/* Title of warning. */
++   {
++       Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
++       if (errChannel) {
++ *** unix/tkUnixInt.h.orig	Fri Apr 16 03:51:46 1999
++ --- unix/tkUnixInt.h	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 24,29 ****
++ --- 24,32 ----
++    * Prototypes for procedures that are referenced in files other
++    * than the ones they're defined in.
++    */
++ + 
++ + #include "tclPlatDecls.h"
++ + 
++   #include "tkIntPlatDecls.h"
++   
++   #endif /* _TKUNIXINT */
++ *** unix/tkUnixKey.c.orig	Fri Apr 16 03:51:46 1999
++ --- unix/tkUnixKey.c	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 83,89 ****
++ --- 83,94 ----
++   #endif /* TK_USE_INPUT_METHODS */
++       Tcl_DStringSetLength(&buf, len);
++   
++ + #if defined(I18N_IMPROVE) && defined(TK_USE_INPUT_METHODS)
++ +     Tcl_ExternalToUtfDString(winPtr->dispPtr->imEncoding,
++ + 			     Tcl_DStringValue(&buf), len, dsPtr);
++ + #else
++       Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
++ + #endif /* I18N_IMPROVE && TK_USE_INPUT_METHODS */
++       Tcl_DStringFree(&buf);
++   
++       return Tcl_DStringValue(dsPtr);
++ *** library/bgerror.tcl.orig	Fri Apr 16 03:51:25 1999
++ --- library/bgerror.tcl	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 42,48 ****
++   
++       # Ok the application's tkerror either failed or was not found
++       # we use the default dialog then :
++ !     if {$tcl_platform(platform) == "macintosh"} {
++   	set ok Ok
++       } else {
++   	set ok OK
++ --- 42,48 ----
++   
++       # Ok the application's tkerror either failed or was not found
++       # we use the default dialog then :
++ !     if {![string compare $tcl_platform(platform) macintosh]} {
++   	set ok Ok
++       } else {
++   	set ok OK
++ *** library/entry.tcl.orig	Sat Oct 30 11:36:08 1999
++ --- library/entry.tcl	Sun Nov 14 16:26:59 1999
++ ***************
++ *** 214,219 ****
++ --- 214,226 ----
++       }
++   }
++   
++ + # input method configuration binding (unix only)
++ + if {![string compare $tcl_platform(platform) "unix"]} {
++ +     if {[string compare [info commands imconfigure] {}]} {
++ + 	bind Entry <FocusIn> {catch {imconfigure %W}}
++ +     }
++ + }
++ + 
++   # Additional emacs-like bindings:
++   
++   bind Entry <Control-a> {
++ *** library/scrlbar.tcl.orig	Sat Oct 30 11:36:09 1999
++ --- library/scrlbar.tcl	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 227,233 ****
++       if {[llength $tkPriv(initValues)] == 2} {
++   	set tkPriv(initPos) $iv0
++       } else {
++ ! 	if {$iv0 == 0} {
++   	    set tkPriv(initPos) 0.0
++   	} else {
++   	    set tkPriv(initPos) [expr {(double([lindex $tkPriv(initValues) 2])) \
++ --- 227,233 ----
++       if {[llength $tkPriv(initValues)] == 2} {
++   	set tkPriv(initPos) $iv0
++       } else {
++ ! 	if {!$iv0} {
++   	    set tkPriv(initPos) 0.0
++   	} else {
++   	    set tkPriv(initPos) [expr {(double([lindex $tkPriv(initValues) 2])) \
++ *** library/text.tcl.orig	Fri Apr 16 03:51:27 1999
++ --- library/text.tcl	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 377,390 ****
++   	%W delete [tkTextPrevPos %W insert tcl_startOfPreviousWord] insert
++       }
++   }
++ ! 
++ ! # Macintosh only bindings:
++ ! 
++ ! # if text black & highlight black -> text white, other text the same
++ ! if {![string compare $tcl_platform(platform) "macintosh"]} {
++   bind Text <FocusIn> {
++ !     %W tag configure sel -borderwidth 0
++ !     %W configure -selectbackground systemHighlight -selectforeground systemHighlightText
++   }
++   bind Text <FocusOut> {
++       %W tag configure sel -borderwidth 1
++ --- 377,395 ----
++   	%W delete [tkTextPrevPos %W insert tcl_startOfPreviousWord] insert
++       }
++   }
++ ! switch $tcl_platform(platform) {
++ !   "unix" {
++ !     # input method configuration binding
++ !     if {[string compare [info commands imconfigure] {}]} {
++ ! 	bind Text <FocusIn> {catch {imconfigure %W}}
++ !     }
++ !   }
++ !   "macintosh" {
++ !   # if text black & highlight black -> text white, other text the same
++   bind Text <FocusIn> {
++ ! 	%W tag configure sel -borderwidth 0
++ ! 	%W configure -selectbackground systemHighlight \
++ ! 		-selectforeground systemHighlightText
++   }
++   bind Text <FocusOut> {
++       %W tag configure sel -borderwidth 1
++ ***************
++ *** 416,421 ****
++ --- 421,427 ----
++   }
++   
++   # End of Mac only bindings
++ +  }
++   }
++   
++   # A few additional bindings of my own.
++ ***************
++ *** 791,801 ****
++   
++       set i [$w index insert]
++       scan $i "%d.%d" line char
++ !     if {[string compare $tkPriv(prevPos) $i] != 0} {
++   	set tkPriv(char) $char
++       }
++       set new [$w index [expr {$line + $n}].$tkPriv(char)]
++ !     if {[$w compare $new == end] || [$w compare $new == "insert linestart"]} {
++   	set new $i
++       }
++       set tkPriv(prevPos) $new
++ --- 797,807 ----
++   
++       set i [$w index insert]
++       scan $i "%d.%d" line char
++ !     if {[string compare $tkPriv(prevPos) $i]} {
++   	set tkPriv(char) $char
++       }
++       set new [$w index [expr {$line + $n}].$tkPriv(char)]
++ !     if {[$w compare $new == end] || [$w compare $new == {insert linestart}]} {
++   	set new $i
++       }
++       set tkPriv(prevPos) $new
++ *** library/tk.tcl.orig	Fri Aug 13 04:58:17 1999
++ --- library/tk.tcl	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 14,21 ****
++   
++   # Insist on running with compatible versions of Tcl and Tk.
++   
++ ! package require -exact Tk 8.2
++ ! package require -exact Tcl 8.2
++   
++   # Add Tk's directory to the end of the auto-load search path, if it
++   # isn't already on the path:
++ --- 14,21 ----
++   
++   # Insist on running with compatible versions of Tcl and Tk.
++   
++ ! package require Tcl 8.2
++ ! package require Tk 8.2
++   
++   # Add Tk's directory to the end of the auto-load search path, if it
++   # isn't already on the path:
++ *** generic/tkArgv.c.orig	Fri Apr 16 03:51:10 1999
++ --- generic/tkArgv.c	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 91,96 ****
++ --- 91,100 ----
++       size_t length;		/* Number of characters in current argument. */
++       int i;
++   
++ +     if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++ + 
++       if (flags & TK_ARGV_DONT_SKIP_FIRST_ARG) {
++   	srcIndex = dstIndex = 0;
++   	argc = *argcPtr;
++ *** generic/tkConsole.c.orig	Fri Jul 30 04:09:25 1999
++ --- generic/tkConsole.c	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 321,327 ****
++   #ifdef MAC_TCL
++       static char initCmd[] = "source -rsrc {Console}";
++   #else
++ !     static char initCmd[] = "source $tk_library/console.tcl";
++   #endif
++       
++       consoleInterp = Tcl_CreateInterp();
++ --- 321,327 ----
++   #ifdef MAC_TCL
++       static char initCmd[] = "source -rsrc {Console}";
++   #else
++ !     static char initCmd[] = "if [catch {::wrap::source lib/tk$tk_version/console}] {source [file join $tk_library console.tcl]}";
++   #endif
++       
++       consoleInterp = Tcl_CreateInterp();
++ *** generic/tkEvent.c.orig	Fri Aug 13 19:52:12 1999
++ --- generic/tkEvent.c	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 14,23 ****
++ --- 14,40 ----
++    * RCS: @(#) $Id: tkEvent.c,v 1.5 1999/08/13 17:52:12 redman Exp $
++    */
++   
++ + #define reserved188 tcl_MainLoop
++ + #define reserved284 tcl_SetMainLoop
++ + 
++   #include "tkPort.h"
++   #include "tkInt.h"
++   #include <signal.h>
++   
++ + #ifndef USE_TCL_STUBS
++ + extern TclStubs tclStubs;
++ + #define tclStubsPtr (&tclStubs)
++ + #endif
++ + 
++ + /*
++ +  * Make sure that Tcl_MainLoop always references the stub pointer, not
++ +  * the real function.
++ +  */
++ + #undef Tcl_MainLoop
++ + #define Tcl_MainLoop ((void (*) _ANSI_ARGS_((void))) ((tclStubsPtr)->tcl_MainLoop))
++ + #undef Tcl_SetMainLoop
++ + #define Tcl_SetMainLoop ((void (*) _ANSI_ARGS_((VOID *))) ((tclStubsPtr)->tcl_SetMainLoop))
++ + 
++   /*
++    * There's a potential problem if a handler is deleted while it's
++    * current (i.e. its procedure is executing), since Tk_HandleEvent
++ ***************
++ *** 636,641 ****
++ --- 653,670 ----
++       }
++   
++   #ifdef TK_USE_INPUT_METHODS
++ + #ifdef I18N_IMPROVE
++ +       /*
++ +        * No need to create an input context for each and every window.
++ +        *
++ +        * Futhermore, XFilterEvent() should be called just after the
++ +        * event is fetched, since some IM server have protocol bugs that
++ +        * causes Tk freezing, so events EXCEPT THE INPUT METHODS THINGS
++ +        * should only be queued into Tcl event queue.
++ +        *
++ +        *		m-hirano
++ +        */
++ + #else
++       /*
++        * Pass the event to the input method(s), if there are any, and
++        * discard the event if the input method(s) insist.  Create the
++ ***************
++ *** 656,661 ****
++ --- 685,691 ----
++       if (XFilterEvent(eventPtr, None)) {
++           goto done;
++       }
++ + #endif /* I18N_IMPROVE */
++   #endif /* TK_USE_INPUT_METHODS */
++   
++       /*
++ ***************
++ *** 909,914 ****
++ --- 939,955 ----
++   	}
++       }
++   
++ + #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
++ +     if (eventPtr->type == KeyPress && eventPtr->xkey.keycode == 0) {
++ +         /*
++ +          * No doubt this is a composed message from IM server.
++ +          * Tk can handle KeyPress event with zero keycode value 
++ +          * if state of the event is zero.
++ +          */
++ +         eventPtr->xkey.state = 0;
++ +     }
++ + #endif /* TK_USE_INPUT_METHODS && I18N_IMPROVE */
++ + 
++       if ((dispPtr->delayedMotionPtr != NULL) && (position == TCL_QUEUE_TAIL)) {
++   	if ((eventPtr->type == MotionNotify) && (eventPtr->xmotion.window
++   		== dispPtr->delayedMotionPtr->event.xmotion.window)) {
++ ***************
++ *** 1095,1103 ****
++ --- 1136,1154 ----
++    *--------------------------------------------------------------
++    */
++   
++ + #ifndef USE_TCL_STUBS
++ + extern TclStubs tclStubs;
++ + #   define Tcl_MainLoop tclStubs.tcl_MainLoop
++ + #endif
++ + 
++   void
++   Tk_MainLoop()
++   {
++ +     if (Tcl_MainLoop) {
++ + 	Tcl_SetMainLoop(Tk_GetNumMainWindows);
++ + 	Tcl_MainLoop();
++ + 	return;
++ +     }
++       while (Tk_GetNumMainWindows() > 0) {
++   	Tcl_DoOneEvent(0);
++       }
++ *** generic/tkFrame.c.orig	Tue Aug 10 07:06:01 1999
++ --- generic/tkFrame.c	Sun Nov 14 16:32:27 1999
++ ***************
++ *** 238,243 ****
++ --- 238,244 ----
++    *
++    *--------------------------------------------------------------
++    */
++ + extern TkStubs tkStubs;
++   
++   int
++   TkCreateFrame(clientData, interp, argc, argv, toplevel, appName)
++ ***************
++ *** 261,264 ****
++ --- 262,269 ----
++       unsigned int mask;
++       Colormap colormap;
++       Visual *visual;
++ +     if ((Tcl_InitStubs(interp, "8.1", 0) == NULL) ||
++ + 	    (Tcl_PkgProvideEx(interp, "Tk", TK_VERSION, (ClientData) &tkStubs) != TCL_OK)) {
++ + 	return TCL_ERROR;
++ +     }
++   
++ *** generic/tkImgPhoto.c.orig	Thu Jul  1 02:39:44 1999
++ --- generic/tkImgPhoto.c	Sun Nov 14 16:27:00 1999
++ ***************
++ *** 20,27 ****
++ --- 20,32 ----
++   
++   #include "tkInt.h"
++   #include "tkPort.h"
++ + #ifdef MAC_TCL
++   #include "tclMath.h"
++ + #else
++ + #include <math.h>
++ + #endif
++   #include <ctype.h>
++ + #include <string.h>
++   
++   #ifdef __WIN32__
++   #include "tkWinInt.h"
++ *** generic/tkInt.decls.orig	Tue Aug 10 18:58:37 1999
++ --- generic/tkInt.decls	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 287,293 ****
++   }
++   
++   declare 58 generic {
++ !     void TkpDisplayWarning (char *msg, char *title)
++   }
++   
++   declare 59 generic {
++ --- 287,293 ----
++   }
++   
++   declare 58 generic {
++ !     void TkpDisplayWarning (CONST char *msg, CONST char *title)
++   }
++   
++   declare 59 generic {
++ ***************
++ *** 619,624 ****
++ --- 619,653 ----
++       void TkSetFocusWin (TkWindow *winPtr, int force) 
++   }
++   
++ + declare 137 generic {
++ +     int  TkTextGetIndex (Tcl_Interp *interp, struct TkText *textPtr, \
++ + 	    char *string, struct TkTextIndex *indexPtr)
++ + }
++ + 
++ + declare 138 generic {
++ +     void  TkTextIndexBackBytes (CONST struct TkTextIndex *srcPtr, \
++ + 	    int count, struct TkTextIndex *dstPtr)
++ + }
++ + 
++ + declare 139 generic {
++ +     void  TkTextIndexForwBytes (CONST struct TkTextIndex *srcPtr, \
++ + 	    int count, struct TkTextIndex *dstPtr)
++ + }
++ + 
++ + declare 140 generic {
++ +     struct TkTextIndex *  TkTextMakeByteIndex (struct TkTextBTree_ *tree, \
++ + 	    int lineIndex, int byteIndex, struct TkTextIndex *indexPtr)
++ + }
++ + 
++ + declare 141 generic {
++ +     void  TkTextPrintIndex (CONST struct TkTextIndex *indexPtr, char *string)
++ + }
++ + 
++ + declare 142 generic {
++ +     struct TkTextSegment * TkTextSetMark (struct TkText *textPtr, char *name, \
++ + 			    struct TkTextIndex *indexPtr)
++ + }
++ + 
++   ##############################################################################
++   
++   # Define the platform specific internal Tcl interface. These functions are
++ ***************
++ *** 661,666 ****
++ --- 690,699 ----
++       void TkUnixSetMenubar (Tk_Window tkwin, Tk_Window menubar)
++   }
++   	
++ + declare 8 unix {
++ +     int TkpTestembedCmd (ClientData clientdata, Tcl_Interp *interp, \
++ + 	    int argc, char **argv)
++ + }
++   
++   
++   ############################
++ ***************
++ *** 806,811 ****
++ --- 839,849 ----
++       int TkWinGetPlatformId(void)
++   }
++   
++ + declare 34 win {
++ +     int TkpTestembedCmd (ClientData clietdata, Tcl_Interp *interp, \
++ + 	    int argc, char **argv)
++ + }
++ + 
++   ########################
++   # Mac specific functions
++   
++ ***************
++ *** 1032,1037 ****
++ --- 1070,1079 ----
++       MacDrawable * TkMacGetHostToplevel  (TkWindow *winPtr)
++   }
++   
++ + declare 65 mac {
++ +     int TkpTestembedCmd (ClientData clietdata, Tcl_Interp *interp, \
++ + 	    int argc, char **argv)
++ + }
++   
++   ##############################################################################
++   
++ *** generic/tkInt.h.orig	Thu Jun 17 21:58:00 1999
++ --- generic/tkInt.h	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 482,487 ****
++ --- 482,500 ----
++   
++   #ifdef TK_USE_INPUT_METHODS
++       XIM inputMethod;		/* Input method for this display */
++ + #ifdef I18N_IMPROVE
++ +     Tcl_Encoding imEncoding;	/* Tcl encoding when the first Tcl
++ + 				 * interp was created.
++ + 				 * For encoding conversion from
++ + 				 * XmbLookupString() to UTF.
++ + 				 */
++ +     XIC lastFocusedIC;		/* The last focused input context on
++ + 				 * the display.
++ + 				 */
++ + #ifdef XNDestroyCallback
++ +     XIMCallback destroyCallback;
++ + #endif /* XNDestroyCallback */
++ + #endif /* I18N_IMPROVE */
++   #endif /* TK_USE_INPUT_METHODS */
++       Tcl_HashTable winTable;	/* Maps from X window ids to TkWindow ptrs. */
++   
++ ***************
++ *** 985,993 ****
++   EXTERN int		Tk_WmCmd _ANSI_ARGS_((ClientData clientData,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   
++ - void	TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
++ - 			    int devId, char *buffer, long size));
++ - 
++   EXTERN void		TkEventInit _ANSI_ARGS_((void));
++   
++   EXTERN int		TkCreateMenuCmd _ANSI_ARGS_((Tcl_Interp *interp));
++ --- 998,1003 ----
++ ***************
++ *** 1002,1007 ****
++ --- 1012,1032 ----
++    */
++   EXTERN int		TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
++   			    Tcl_Interp *interp, int argc, char **argv));
++ + 
++ + #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
++ + EXTERN XIC		TkpCreateIC _ANSI_ARGS_((TkWindow *winPtr));
++ + EXTERN void		TkpDestroyIC _ANSI_ARGS_((TkWindow *winPtr, int needDestroy));
++ + EXTERN int		Tk_ImconfigureObjCmd _ANSI_ARGS_((ClientData clientData,
++ + 			    Tcl_Interp *interp, int objc,
++ + 			    Tcl_Obj *CONST objv[]));
++ + #endif
++ + 
++ + # undef TCL_STORAGE_CLASS
++ + # define TCL_STORAGE_CLASS
++ + 
++ + EXTERN int	TkConsoleInit _ANSI_ARGS_((Tcl_Interp *interp));
++ + EXTERN void	TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
++ + 			    int devId, char *buffer, long size));
++   
++   # undef TCL_STORAGE_CLASS
++   # define TCL_STORAGE_CLASS DLLIMPORT
++ *** generic/tkIntDecls.h.orig	Tue Aug 10 18:58:37 1999
++ --- generic/tkIntDecls.h	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 22,27 ****
++ --- 22,31 ----
++   #define TCL_STORAGE_CLASS DLLEXPORT
++   #endif
++   
++ + struct TkText;
++ + struct TkTextIndex;
++ + struct TkTextBTree_;
++ + 
++   /*
++    * WARNING: This file is automatically generated by the tools/genStubs.tcl
++    * script.  Any modifications to the function declarations below should be made
++ ***************
++ *** 214,221 ****
++   EXTERN void		TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr, 
++   				int force));
++   /* 58 */
++ ! EXTERN void		TkpDisplayWarning _ANSI_ARGS_((char * msg, 
++ ! 				char * title));
++   /* 59 */
++   EXTERN void		TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp, 
++   				Tcl_DString * name));
++ --- 218,225 ----
++   EXTERN void		TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr, 
++   				int force));
++   /* 58 */
++ ! EXTERN void		TkpDisplayWarning _ANSI_ARGS_((CONST char * msg, 
++ ! 				CONST char * title));
++   /* 59 */
++   EXTERN void		TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp, 
++   				Tcl_DString * name));
++ ***************
++ *** 506,511 ****
++ --- 510,539 ----
++   /* 136 */
++   EXTERN void		TkSetFocusWin _ANSI_ARGS_((TkWindow * winPtr, 
++   				int force));
++ + /* 137 */
++ + EXTERN int		TkTextGetIndex _ANSI_ARGS_((Tcl_Interp * interp, 
++ + 				struct TkText * textPtr, char * string, 
++ + 				struct TkTextIndex * indexPtr));
++ + /* 138 */
++ + EXTERN void		TkTextIndexBackBytes _ANSI_ARGS_((
++ + 				CONST struct TkTextIndex * srcPtr, int count, 
++ + 				struct TkTextIndex * dstPtr));
++ + /* 139 */
++ + EXTERN void		TkTextIndexForwBytes _ANSI_ARGS_((
++ + 				CONST struct TkTextIndex * srcPtr, int count, 
++ + 				struct TkTextIndex * dstPtr));
++ + /* 140 */
++ + EXTERN struct TkTextIndex * TkTextMakeByteIndex _ANSI_ARGS_((
++ + 				struct TkTextBTree_ * tree, int lineIndex, 
++ + 				int byteIndex, struct TkTextIndex * indexPtr));
++ + /* 141 */
++ + EXTERN void		TkTextPrintIndex _ANSI_ARGS_((
++ + 				CONST struct TkTextIndex * indexPtr, 
++ + 				char * string));
++ + /* 142 */
++ + EXTERN struct TkTextSegment * TkTextSetMark _ANSI_ARGS_((
++ + 				struct TkText * textPtr, char * name, 
++ + 				struct TkTextIndex * indexPtr));
++   
++   typedef struct TkIntStubs {
++       int magic;
++ ***************
++ *** 569,575 ****
++       int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
++       void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
++       void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
++ !     void (*tkpDisplayWarning) _ANSI_ARGS_((char * msg, char * title)); /* 58 */
++       void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
++       TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
++       TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
++ --- 597,603 ----
++       int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
++       void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
++       void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
++ !     void (*tkpDisplayWarning) _ANSI_ARGS_((CONST char * msg, CONST char * title)); /* 58 */
++       void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
++       TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
++       TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
++ ***************
++ *** 808,813 ****
++ --- 836,847 ----
++   #endif /* MAC_TCL */
++       void (*tkpDrawHighlightBorder) _ANSI_ARGS_((Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable)); /* 135 */
++       void (*tkSetFocusWin) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 136 */
++ +     int (*tkTextGetIndex) _ANSI_ARGS_((Tcl_Interp * interp, struct TkText * textPtr, char * string, struct TkTextIndex * indexPtr)); /* 137 */
++ +     void (*tkTextIndexBackBytes) _ANSI_ARGS_((CONST struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr)); /* 138 */
++ +     void (*tkTextIndexForwBytes) _ANSI_ARGS_((CONST struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr)); /* 139 */
++ +     struct TkTextIndex * (*tkTextMakeByteIndex) _ANSI_ARGS_((struct TkTextBTree_ * tree, int lineIndex, int byteIndex, struct TkTextIndex * indexPtr)); /* 140 */
++ +     void (*tkTextPrintIndex) _ANSI_ARGS_((CONST struct TkTextIndex * indexPtr, char * string)); /* 141 */
++ +     struct TkTextSegment * (*tkTextSetMark) _ANSI_ARGS_((struct TkText * textPtr, char * name, struct TkTextIndex * indexPtr)); /* 142 */
++   } TkIntStubs;
++   
++   #ifdef __cplusplus
++ ***************
++ *** 1447,1452 ****
++ --- 1481,1510 ----
++   #ifndef TkSetFocusWin
++   #define TkSetFocusWin \
++   	(tkIntStubsPtr->tkSetFocusWin) /* 136 */
++ + #endif
++ + #ifndef TkTextGetIndex
++ + #define TkTextGetIndex \
++ + 	(tkIntStubsPtr->tkTextGetIndex) /* 137 */
++ + #endif
++ + #ifndef TkTextIndexBackBytes
++ + #define TkTextIndexBackBytes \
++ + 	(tkIntStubsPtr->tkTextIndexBackBytes) /* 138 */
++ + #endif
++ + #ifndef TkTextIndexForwBytes
++ + #define TkTextIndexForwBytes \
++ + 	(tkIntStubsPtr->tkTextIndexForwBytes) /* 139 */
++ + #endif
++ + #ifndef TkTextMakeByteIndex
++ + #define TkTextMakeByteIndex \
++ + 	(tkIntStubsPtr->tkTextMakeByteIndex) /* 140 */
++ + #endif
++ + #ifndef TkTextPrintIndex
++ + #define TkTextPrintIndex \
++ + 	(tkIntStubsPtr->tkTextPrintIndex) /* 141 */
++ + #endif
++ + #ifndef TkTextSetMark
++ + #define TkTextSetMark \
++ + 	(tkIntStubsPtr->tkTextSetMark) /* 142 */
++   #endif
++   
++   #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
++ *** generic/tkIntPlatDecls.h.orig	Tue May 25 03:31:06 1999
++ --- generic/tkIntPlatDecls.h	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 52,57 ****
++ --- 52,60 ----
++   /* 7 */
++   EXTERN void		TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, 
++   				Tk_Window menubar));
++ + /* 8 */
++ + EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clientdata, 
++ + 				Tcl_Interp * interp, int argc, char ** argv));
++   #endif /* UNIX */
++   #ifdef __WIN32__
++   /* 0 */
++ ***************
++ *** 142,147 ****
++ --- 145,153 ----
++   				char * className));
++   /* 33 */
++   EXTERN int		TkWinGetPlatformId _ANSI_ARGS_((void));
++ + /* 34 */
++ + EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clietdata, 
++ + 				Tcl_Interp * interp, int argc, char ** argv));
++   #endif /* __WIN32__ */
++   #ifdef MAC_TCL
++   /* 0 */
++ ***************
++ *** 290,295 ****
++ --- 296,304 ----
++   EXTERN MacDrawable *	TkMacContainerId _ANSI_ARGS_((TkWindow * winPtr));
++   /* 64 */
++   EXTERN MacDrawable *	TkMacGetHostToplevel _ANSI_ARGS_((TkWindow * winPtr));
++ + /* 65 */
++ + EXTERN int		TkpTestembedCmd _ANSI_ARGS_((ClientData clietdata, 
++ + 				Tcl_Interp * interp, int argc, char ** argv));
++   #endif /* MAC_TCL */
++   
++   typedef struct TkIntPlatStubs {
++ ***************
++ *** 305,310 ****
++ --- 314,320 ----
++       Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 5 */
++       int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 6 */
++       void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 7 */
++ +     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clientdata, Tcl_Interp * interp, int argc, char ** argv)); /* 8 */
++   #endif /* UNIX */
++   #ifdef __WIN32__
++       char * (*tkAlignImageData) _ANSI_ARGS_((XImage * image, int alignment, int bitOrder)); /* 0 */
++ ***************
++ *** 341,346 ****
++ --- 351,357 ----
++       void (*tkWinDialogDebug) _ANSI_ARGS_((int debug)); /* 31 */
++       Tcl_Obj * (*tkWinGetMenuSystemDefault) _ANSI_ARGS_((Tk_Window tkwin, char * dbName, char * className)); /* 32 */
++       int (*tkWinGetPlatformId) _ANSI_ARGS_((void)); /* 33 */
++ +     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clietdata, Tcl_Interp * interp, int argc, char ** argv)); /* 34 */
++   #endif /* __WIN32__ */
++   #ifdef MAC_TCL
++       void (*tkGenerateActivateEvents) _ANSI_ARGS_((TkWindow * winPtr, int active)); /* 0 */
++ ***************
++ *** 408,413 ****
++ --- 419,425 ----
++       Tk_Window (*tk_TopCoordsToWindow) _ANSI_ARGS_((Tk_Window tkwin, int rootX, int rootY, int * newX, int * newY)); /* 62 */
++       MacDrawable * (*tkMacContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 63 */
++       MacDrawable * (*tkMacGetHostToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 64 */
++ +     int (*tkpTestembedCmd) _ANSI_ARGS_((ClientData clietdata, Tcl_Interp * interp, int argc, char ** argv)); /* 65 */
++   #endif /* MAC_TCL */
++   } TkIntPlatStubs;
++   
++ ***************
++ *** 458,463 ****
++ --- 470,479 ----
++   #define TkUnixSetMenubar \
++   	(tkIntPlatStubsPtr->tkUnixSetMenubar) /* 7 */
++   #endif
++ + #ifndef TkpTestembedCmd
++ + #define TkpTestembedCmd \
++ + 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 8 */
++ + #endif
++   #endif /* UNIX */
++   #ifdef __WIN32__
++   #ifndef TkAlignImageData
++ ***************
++ *** 593,598 ****
++ --- 609,618 ----
++   #define TkWinGetPlatformId \
++   	(tkIntPlatStubsPtr->tkWinGetPlatformId) /* 33 */
++   #endif
++ + #ifndef TkpTestembedCmd
++ + #define TkpTestembedCmd \
++ + 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 34 */
++ + #endif
++   #endif /* __WIN32__ */
++   #ifdef MAC_TCL
++   #ifndef TkGenerateActivateEvents
++ ***************
++ *** 824,829 ****
++ --- 844,853 ----
++   #ifndef TkMacGetHostToplevel
++   #define TkMacGetHostToplevel \
++   	(tkIntPlatStubsPtr->tkMacGetHostToplevel) /* 64 */
++ + #endif
++ + #ifndef TkpTestembedCmd
++ + #define TkpTestembedCmd \
++ + 	(tkIntPlatStubsPtr->tkpTestembedCmd) /* 65 */
++   #endif
++   #endif /* MAC_TCL */
++   
++ *** generic/tkMain.c.orig	Wed Apr 28 20:18:06 1999
++ --- generic/tkMain.c	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 57,64 ****
++   extern int		isatty _ANSI_ARGS_((int fd));
++   extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
++   #endif
++ ! extern void		TkpDisplayWarning _ANSI_ARGS_((char *msg,
++ ! 			    char *title));
++   
++   /*
++    * Forward declarations for procedures defined later in this file.
++ --- 57,64 ----
++   extern int		isatty _ANSI_ARGS_((int fd));
++   extern char *		strrchr _ANSI_ARGS_((CONST char *string, int c));
++   #endif
++ ! extern void		TkpDisplayWarning _ANSI_ARGS_((CONST char *msg,
++ ! 			    CONST char *title));
++   
++   /*
++    * Forward declarations for procedures defined later in this file.
++ ***************
++ *** 407,412 ****
++ --- 407,413 ----
++   	partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY);
++       if (promptCmd == NULL) {
++   defaultPrompt:
++ + 	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
++   	if (!partial) {
++   
++               /*
++ ***************
++ *** 415,427 ****
++                * this interpreter with "interp transfer".
++                */
++   
++ - 	    outChannel = Tcl_GetChannel(interp, "stdout", NULL);
++               if (outChannel != (Tcl_Channel) NULL) {
++                   Tcl_WriteChars(outChannel, "% ", 2);
++               }
++   	}
++       } else {
++   	code = Tcl_Eval(interp, promptCmd);
++   	if (code != TCL_OK) {
++   	    Tcl_AddErrorInfo(interp,
++   		    "\n    (script that generates prompt)");
++ --- 416,428 ----
++                * this interpreter with "interp transfer".
++                */
++   
++               if (outChannel != (Tcl_Channel) NULL) {
++                   Tcl_WriteChars(outChannel, "% ", 2);
++               }
++   	}
++       } else {
++   	code = Tcl_Eval(interp, promptCmd);
++ + 	outChannel = Tcl_GetChannel(interp, "stdout", NULL);
++   	if (code != TCL_OK) {
++   	    Tcl_AddErrorInfo(interp,
++   		    "\n    (script that generates prompt)");
++ ***************
++ *** 437,442 ****
++ --- 438,445 ----
++                   Tcl_WriteChars(errChannel, "\n", 1);
++               }
++   	    goto defaultPrompt;
++ + 	} else if (*Tcl_GetStringResult(interp) && outChannel) {
++ + 	    Tcl_Write(outChannel, Tcl_GetStringResult(interp), -1);
++   	}
++       }
++       outChannel = Tcl_GetChannel(interp, "stdout", NULL);
++ *** generic/tkScale.c.orig	Wed Apr 21 23:53:27 1999
++ --- generic/tkScale.c	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 24,30 ****
++ --- 24,34 ----
++   #include "tkPort.h"
++   #include "default.h"
++   #include "tkInt.h"
++ + #ifdef MAC_TCL
++   #include "tclMath.h"
++ + #else
++ + #include <math.h>
++ + #endif
++   #include "tkScale.h"
++   
++   /*
++ *** generic/tkSquare.c.orig	Fri Apr 16 03:51:22 1999
++ --- generic/tkSquare.c	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 15,25 ****
++ --- 15,42 ----
++    * RCS: @(#) $Id: tkSquare.c,v 1.3 1999/04/16 01:51:22 stanton Exp $
++    */
++   
++ + #ifdef __cplusplus
++ + extern "C" {
++ + #endif
++ + 
++   #include "tkPort.h"
++   #define __NO_OLD_CONFIG
++   #include "tk.h"
++   #include "tkInt.h"
++   
++ + #ifdef __cplusplus
++ + }
++ + #endif
++ + 
++ + /*
++ +  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
++ +  * Tksquare_Init declaration is in the source file itself, which is only
++ +  * accessed when we are building a library.
++ +  */
++ + 
++ + #undef TCL_STORAGE_CLASS
++ + #define TCL_STORAGE_CLASS DLLEXPORT
++ + 
++   /*
++    * A data structure of the following type is kept for each square
++    * widget managed by this file:
++ ***************
++ *** 107,112 ****
++ --- 124,178 ----
++   static int		SquareWidgetCmd _ANSI_ARGS_((ClientData clientData,
++   			    Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
++   
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * Tksquare_Init --
++ +  *
++ +  *	This procedure performs intialization for the Tk square
++ +  *	exension.
++ +  *
++ +  * Results:
++ +  *	Returns a standard Tcl completion code, and leaves an error
++ +  *	message in interp->result if an error occurs.
++ +  *
++ +  * Side effects:
++ +  *	Creates several test commands.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + EXTERN Tksquare_Init _ANSI_ARGS_((Tcl_Interp *interp));
++ + 
++ + int
++ + #ifdef _USING_PROTOTYPES_
++ + Tksquare_Init (
++ +     Tcl_Interp *interp)		/* Interpreter for application. */
++ + #else
++ + Tksquare_Init(interp)
++ +     Tcl_Interp *interp;		/* Interpreter for application. */
++ + #endif
++ + {
++ +     /*
++ +      * Create the square command.
++ +      */
++ + 
++ +     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++ +     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++ +     if (Tcl_PkgProvide(interp, "Tksquare", TK_VERSION) != TCL_OK) {
++ + 	return TCL_ERROR;
++ +     }
++ + 
++ +     Tcl_CreateObjCommand(interp, "square", SquareObjCmd,
++ + 	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
++ + 
++ +     return TCL_OK;
++ + }
++ + 
++   /*
++    *--------------------------------------------------------------
++    *
++ *** generic/tkStubInit.c.orig	Tue Aug 10 18:58:38 1999
++ --- generic/tkStubInit.c	Sun Nov 14 16:27:01 1999
++ ***************
++ *** 339,344 ****
++ --- 339,350 ----
++   #endif /* MAC_TCL */
++       TkpDrawHighlightBorder, /* 135 */
++       TkSetFocusWin, /* 136 */
++ +     TkTextGetIndex, /* 137 */
++ +     TkTextIndexBackBytes, /* 138 */
++ +     TkTextIndexForwBytes, /* 139 */
++ +     TkTextMakeByteIndex, /* 140 */
++ +     TkTextPrintIndex, /* 141 */
++ +     TkTextSetMark, /* 142 */
++   };
++   
++   TkIntPlatStubs tkIntPlatStubs = {
++ ***************
++ *** 353,358 ****
++ --- 359,365 ----
++       TkUnixContainerId, /* 5 */
++       TkUnixDoOneXEvent, /* 6 */
++       TkUnixSetMenubar, /* 7 */
++ +     TkpTestembedCmd, /* 8 */
++   #endif /* UNIX */
++   #ifdef __WIN32__
++       TkAlignImageData, /* 0 */
++ ***************
++ *** 389,394 ****
++ --- 396,402 ----
++       TkWinDialogDebug, /* 31 */
++       TkWinGetMenuSystemDefault, /* 32 */
++       TkWinGetPlatformId, /* 33 */
++ +     TkpTestembedCmd, /* 34 */
++   #endif /* __WIN32__ */
++   #ifdef MAC_TCL
++       TkGenerateActivateEvents, /* 0 */
++ ***************
++ *** 456,461 ****
++ --- 464,470 ----
++       Tk_TopCoordsToWindow, /* 62 */
++       TkMacContainerId, /* 63 */
++       TkMacGetHostToplevel, /* 64 */
++ +     TkpTestembedCmd, /* 65 */
++   #endif /* MAC_TCL */
++   };
++   
++ *** generic/tkTest.c.orig	Wed Jun 16 22:11:29 1999
++ --- generic/tkTest.c	Sun Nov 14 16:27:02 1999
++ ***************
++ *** 15,27 ****
++    *
++    * RCS: @(#) $Id: tkTest.c,v 1.6 1999/06/16 20:11:29 surles Exp $
++    */
++ ! 
++   #include "tkInt.h"
++   #include "tkPort.h"
++ - #include "tkText.h"
++   
++   #ifdef __WIN32__
++   #include "tkWinInt.h"
++   #endif
++   
++   #ifdef MAC_TCL
++ --- 15,28 ----
++    *
++    * RCS: @(#) $Id: tkTest.c,v 1.6 1999/06/16 20:11:29 surles Exp $
++    */
++ ! #include "tk.h"
++ ! #include "tkText.h"
++   #include "tkInt.h"
++   #include "tkPort.h"
++   
++   #ifdef __WIN32__
++   #include "tkWinInt.h"
++ + #include "tkScrollbar.h"
++   #endif
++   
++   #ifdef MAC_TCL
++ ***************
++ *** 33,38 ****
++ --- 34,56 ----
++   #endif
++   
++   /*
++ +  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
++ +  * Tktest_Init declaration is in the source file itself, which is only
++ +  * accessed when we are building a library.
++ +  */
++ + 
++ + #undef TCL_STORAGE_CLASS
++ + #define TCL_STORAGE_CLASS DLLEXPORT
++ + 
++ + #ifdef __cplusplus
++ + }
++ + #define dummy  /* */
++ + #define dummy2 /* */
++ + #define dummy3 /* */
++ + #define dummy4 /* */
++ + #endif
++ + 
++ + /*
++    * The following data structure represents the master for a test
++    * image:
++    */
++ ***************
++ *** 97,116 ****
++       struct NewApp *nextPtr;	/* Next in list of new interpreters. */
++   } NewApp;
++   
++ ! static NewApp *newAppPtr = NULL;
++   				/* First in list of all new interpreters. */
++   
++ - /*
++ -  * Declaration for the square widget's class command procedure:
++ -  */
++ - 
++ - extern int SquareObjCmd _ANSI_ARGS_((ClientData clientData,
++ - 	Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
++   
++   typedef struct CBinding {
++       Tcl_Interp *interp;
++       char *command;
++ !     char *delete;
++   } CBinding;
++   
++   /*
++ --- 115,128 ----
++       struct NewApp *nextPtr;	/* Next in list of new interpreters. */
++   } NewApp;
++   
++ ! static NewApp *newAppPtr = (NewApp *) NULL;
++   				/* First in list of all new interpreters. */
++   
++   
++   typedef struct CBinding {
++       Tcl_Interp *interp;
++       char *command;
++ !     char *del;
++   } CBinding;
++   
++   /*
++ ***************
++ *** 147,153 ****
++   			    Tcl_Interp *interp, XEvent *eventPtr,
++   			    Tk_Window tkwin, KeySym keySym));
++   static void		CBindingFreeProc _ANSI_ARGS_((ClientData clientData));
++ ! int			Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   static int		ImageCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TestcbindCmd _ANSI_ARGS_((ClientData dummy,
++ --- 159,165 ----
++   			    Tcl_Interp *interp, XEvent *eventPtr,
++   			    Tk_Window tkwin, KeySym keySym));
++   static void		CBindingFreeProc _ANSI_ARGS_((ClientData clientData));
++ ! EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   static int		ImageCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TestcbindCmd _ANSI_ARGS_((ClientData dummy,
++ ***************
++ *** 165,171 ****
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj * CONST objv[]));
++   static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj *CONST objv[]));
++ --- 177,184 ----
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj * CONST objv[]));
++   static int		TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int objc,
++ ! 			    Tcl_Obj * CONST objv[]));
++   static int		TestfontObjCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj *CONST objv[]));
++ ***************
++ *** 181,194 ****
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj * CONST objv[]));
++   static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   #if !(defined(__WIN32__) || defined(MAC_TCL))
++   static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int argc, char **argv));
++   #endif
++   static void		TrivialCmdDeletedProc _ANSI_ARGS_((
++   			    ClientData clientData));
++ --- 194,209 ----
++   			    Tcl_Interp *interp, int objc,
++   			    Tcl_Obj * CONST objv[]));
++   static int		TestpropCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int objc,
++ ! 			    Tcl_Obj * CONST objv[]));
++   static int		TestsendCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   static int		TesttextCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++   #if !(defined(__WIN32__) || defined(MAC_TCL))
++   static int		TestwrapperCmd _ANSI_ARGS_((ClientData dummy,
++ ! 			    Tcl_Interp *interp, int objc,
++ ! 			    Tcl_Obj * CONST objv[]));
++   #endif
++   static void		TrivialCmdDeletedProc _ANSI_ARGS_((
++   			    ClientData clientData));
++ ***************
++ *** 202,213 ****
++    * External (platform specific) initialization routine:
++    */
++   
++ - extern int		TkplatformtestInit _ANSI_ARGS_((
++ - 			    Tcl_Interp *interp));
++ - extern int              TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
++ - 
++   #if !(defined(__WIN32__) && defined(MAC_TCL))
++   #define TkplatformtestInit(x) TCL_OK
++   #endif
++   
++   /*
++ --- 217,227 ----
++    * External (platform specific) initialization routine:
++    */
++   
++   #if !(defined(__WIN32__) && defined(MAC_TCL))
++   #define TkplatformtestInit(x) TCL_OK
++ + #else
++ + extern int		TkplatformtestInit _ANSI_ARGS_((
++ + 			    Tcl_Interp *interp));
++   #endif
++   
++   /*
++ ***************
++ *** 229,236 ****
++ --- 243,255 ----
++    */
++   
++   int
++ + #ifdef _USING_PROTOTYPES_
++ + Tktest_Init (
++ +     Tcl_Interp *interp)		/* Interpreter for application. */
++ + #else
++   Tktest_Init(interp)
++       Tcl_Interp *interp;		/* Interpreter for application. */
++ + #endif
++   {
++       static int initialized = 0;
++   
++ ***************
++ *** 238,249 ****
++        * Create additional commands for testing Tk.
++        */
++   
++       if (Tcl_PkgProvide(interp, "Tktest", TK_VERSION) == TCL_ERROR) {
++           return TCL_ERROR;
++       }
++   
++ -     Tcl_CreateObjCommand(interp, "square", SquareObjCmd,
++ - 	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testcbind", TestcbindCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
++ --- 257,272 ----
++        * Create additional commands for testing Tk.
++        */
++   
++ +     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++ +     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
++ + 	return TCL_ERROR;
++ +     }
++       if (Tcl_PkgProvide(interp, "Tktest", TK_VERSION) == TCL_ERROR) {
++           return TCL_ERROR;
++       }
++   
++       Tcl_CreateCommand(interp, "testcbind", TestcbindCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
++ ***************
++ *** 254,260 ****
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++ !     Tcl_CreateCommand(interp, "testdeleteapps", TestdeleteappsCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testembed", TkpTestembedCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++ --- 277,283 ----
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++ !     Tcl_CreateObjCommand(interp, "testdeleteapps", TestdeleteappsCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testembed", TkpTestembedCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++ ***************
++ *** 270,291 ****
++       Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #endif
++ !     Tcl_CreateCommand(interp, "testprop", TestpropCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testsend", TestsendCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testtext", TesttextCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #if !(defined(__WIN32__) || defined(MAC_TCL))
++ !     Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #endif
++ - 
++ - #ifdef TCL_THREADS
++ -     if (TclThread_Init(interp) != TCL_OK) {
++ - 	return TCL_ERROR;
++ -     }
++ - #endif
++       
++       /*
++        * Create test image type.
++ --- 293,308 ----
++       Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #endif
++ !     Tcl_CreateObjCommand(interp, "testprop", TestpropCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testsend", TestsendCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testtext", TesttextCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #if !(defined(__WIN32__) || defined(MAC_TCL))
++ !     Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++   #endif
++       
++       /*
++        * Create test image type.
++ ***************
++ *** 321,331 ****
++ --- 338,356 ----
++    */
++   
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestcbindCmd (
++ +     ClientData clientData,		/* Main window for application. */
++ +     Tcl_Interp *interp,			/* Current interpreter. */
++ +     int argc,				/* Number of arguments. */
++ +     char **argv)			/* Argument strings. */
++ + #else
++   TestcbindCmd(clientData, interp, argc, argv)
++       ClientData clientData;		/* Main window for application. */
++       Tcl_Interp *interp;			/* Current interpreter. */
++       int argc;				/* Number of arguments. */
++       char **argv;			/* Argument strings. */
++ + #endif
++   {
++       TkWindow *winPtr;
++       Tk_Window tkwin;
++ ***************
++ *** 362,370 ****
++       cbindPtr->command =
++   	    strcpy((char *) ckalloc(strlen(argv[3]) + 1), argv[3]);
++       if (argc == 4) {
++ ! 	cbindPtr->delete = NULL;
++       } else {
++ ! 	cbindPtr->delete =
++   		strcpy((char *) ckalloc(strlen(argv[4]) + 1), argv[4]);
++       }
++   
++ --- 387,395 ----
++       cbindPtr->command =
++   	    strcpy((char *) ckalloc(strlen(argv[3]) + 1), argv[3]);
++       if (argc == 4) {
++ ! 	cbindPtr->del = NULL;
++       } else {
++ ! 	cbindPtr->del =
++   		strcpy((char *) ckalloc(strlen(argv[4]) + 1), argv[4]);
++       }
++   
++ ***************
++ *** 372,379 ****
++   	    object, argv[2], CBindingEvalProc, CBindingFreeProc,
++   	    (ClientData) cbindPtr) == 0) {
++   	ckfree((char *) cbindPtr->command);
++ ! 	if (cbindPtr->delete != NULL) {
++ ! 	    ckfree((char *) cbindPtr->delete);
++   	}
++   	ckfree((char *) cbindPtr);
++   	return TCL_ERROR;
++ --- 397,404 ----
++   	    object, argv[2], CBindingEvalProc, CBindingFreeProc,
++   	    (ClientData) cbindPtr) == 0) {
++   	ckfree((char *) cbindPtr->command);
++ ! 	if (cbindPtr->del != NULL) {
++ ! 	    ckfree((char *) cbindPtr->del);
++   	}
++   	ckfree((char *) cbindPtr);
++   	return TCL_ERROR;
++ ***************
++ *** 382,393 ****
++   }
++   
++   static int
++ ! CBindingEvalProc(clientData, interp, eventPtr, tkwin, keySym)
++       ClientData clientData;
++       Tcl_Interp *interp;
++ !     XEvent *eventPtr;
++ !     Tk_Window tkwin;
++ !     KeySym keySym;
++   {
++       CBinding *cbindPtr;
++   
++ --- 407,427 ----
++   }
++   
++   static int
++ ! #ifdef _USING_PROTOTYPES_
++ ! CBindingEvalProc (
++ !     ClientData clientData,
++ !     Tcl_Interp *interp,
++ !     XEvent *dummy,
++ !     Tk_Window dummy2,
++ !     KeySym dummy3)
++ ! #else
++ ! CBindingEvalProc(clientData, interp, dummy, dummy2, dummy3)
++       ClientData clientData;
++       Tcl_Interp *interp;
++ !     XEvent *dummy;
++ !     Tk_Window dummy2;
++ !     KeySym dummy3;
++ ! #endif
++   {
++       CBinding *cbindPtr;
++   
++ ***************
++ *** 397,410 ****
++   }
++   
++   static void
++   CBindingFreeProc(clientData)
++       ClientData clientData;
++   {
++       CBinding *cbindPtr = (CBinding *) clientData;
++       
++ !     if (cbindPtr->delete != NULL) {
++ ! 	Tcl_GlobalEval(cbindPtr->interp, cbindPtr->delete);
++ ! 	ckfree((char *) cbindPtr->delete);
++       }
++       ckfree((char *) cbindPtr->command);
++       ckfree((char *) cbindPtr);
++ --- 431,449 ----
++   }
++   
++   static void
++ + #ifdef _USING_PROTOTYPES_
++ + CBindingFreeProc (
++ +     ClientData clientData)
++ + #else
++   CBindingFreeProc(clientData)
++       ClientData clientData;
++ + #endif
++   {
++       CBinding *cbindPtr = (CBinding *) clientData;
++       
++ !     if (cbindPtr->del != NULL) {
++ ! 	Tcl_GlobalEval(cbindPtr->interp, cbindPtr->del);
++ ! 	ckfree((char *) cbindPtr->del);
++       }
++       ckfree((char *) cbindPtr->command);
++       ckfree((char *) cbindPtr);
++ ***************
++ *** 429,439 ****
++ --- 468,486 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestbitmapObjCmd (
++ +     ClientData clientData,	/* Main window for application. */
++ +     Tcl_Interp *interp,		/* Current interpreter. */
++ +     int objc,			/* Number of arguments. */
++ +     Tcl_Obj *CONST objv[])	/* Argument objects. */
++ + #else
++   TestbitmapObjCmd(clientData, interp, objc, objv)
++       ClientData clientData;	/* Main window for application. */
++       Tcl_Interp *interp;		/* Current interpreter. */
++       int objc;			/* Number of arguments. */
++       Tcl_Obj *CONST objv[];	/* Argument objects. */
++ + #endif
++   {
++   
++       if (objc < 2) {
++ ***************
++ *** 464,474 ****
++ --- 511,529 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestborderObjCmd (
++ +     ClientData clientData,	/* Main window for application. */
++ +     Tcl_Interp *interp,		/* Current interpreter. */
++ +     int objc,			/* Number of arguments. */
++ +     Tcl_Obj *CONST objv[])	/* Argument objects. */
++ + #else
++   TestborderObjCmd(clientData, interp, objc, objv)
++       ClientData clientData;	/* Main window for application. */
++       Tcl_Interp *interp;		/* Current interpreter. */
++       int objc;			/* Number of arguments. */
++       Tcl_Obj *CONST objv[];	/* Argument objects. */
++ + #endif
++   {
++   
++       if (objc < 2) {
++ ***************
++ *** 499,509 ****
++ --- 554,572 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestcolorObjCmd (
++ +     ClientData clientData,	/* Main window for application. */
++ +     Tcl_Interp *interp,		/* Current interpreter. */
++ +     int objc,			/* Number of arguments. */
++ +     Tcl_Obj *CONST objv[])	/* Argument objects. */
++ + #else
++   TestcolorObjCmd(clientData, interp, objc, objv)
++       ClientData clientData;	/* Main window for application. */
++       Tcl_Interp *interp;		/* Current interpreter. */
++       int objc;			/* Number of arguments. */
++       Tcl_Obj *CONST objv[];	/* Argument objects. */
++ + #endif
++   {
++   
++       if (objc < 2) {
++ ***************
++ *** 534,544 ****
++ --- 597,615 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestcursorObjCmd (
++ +     ClientData clientData,	/* Main window for application. */
++ +     Tcl_Interp *interp,		/* Current interpreter. */
++ +     int objc,			/* Number of arguments. */
++ +     Tcl_Obj *CONST objv[])	/* Argument objects. */
++ + #else
++   TestcursorObjCmd(clientData, interp, objc, objv)
++       ClientData clientData;	/* Main window for application. */
++       Tcl_Interp *interp;		/* Current interpreter. */
++       int objc;			/* Number of arguments. */
++       Tcl_Obj *CONST objv[];	/* Argument objects. */
++ + #endif
++   {
++   
++       if (objc < 2) {
++ ***************
++ *** 570,580 ****
++   
++   	/* ARGSUSED */
++   static int
++ ! TestdeleteappsCmd(clientData, interp, argc, argv)
++ !     ClientData clientData;		/* Main window for application. */
++ !     Tcl_Interp *interp;			/* Current interpreter. */
++ !     int argc;				/* Number of arguments. */
++ !     char **argv;			/* Argument strings. */
++   {
++       NewApp *nextPtr;
++   
++ --- 641,659 ----
++   
++   	/* ARGSUSED */
++   static int
++ ! #ifdef _USING_PROTOTYPES_
++ ! TestdeleteappsCmd (
++ !     ClientData dummy,			/* Main window for application. */
++ !     Tcl_Interp *dummy2,			/* Current interpreter. */
++ !     int dummy3,				/* Number of arguments. */
++ !     Tcl_Obj *CONST dummy4[])		/* Argument strings. */
++ ! #else
++ ! TestdeleteappsCmd(dummy, dummy2, dummy3, dummy4)
++ !     ClientData dummy;			/* Main window for application. */
++ !     Tcl_Interp *dummy2;			/* Current interpreter. */
++ !     int dummy3;				/* Number of arguments. */
++ !     Tcl_Obj *CONST *dummy4[];		/* Argument strings. */
++ ! #endif
++   {
++       NewApp *nextPtr;
++   
++ ***************
++ *** 1579,1585 ****
++   	if (strcmp(argv[i], "-variable") != 0) {
++   	    Tcl_AppendResult(interp, "bad option name \"", argv[i],
++   		    "\"", (char *) NULL);
++ - 	    return TCL_ERROR;
++   	}
++   	if ((i+1) == argc) {
++   	    Tcl_AppendResult(interp, "no value given for \"", argv[i],
++ --- 1658,1663 ----
++ ***************
++ *** 1660,1665 ****
++ --- 1738,1745 ----
++   		"\": must be changed", (char *) NULL);
++   	return TCL_ERROR;
++       }
++ +     Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
++ + 	    timPtr->height);
++       return TCL_OK;
++   }
++   
++ ***************
++ *** 1682,1691 ****
++ --- 1762,1778 ----
++    */
++   
++   static ClientData
++ + #ifdef _USING_PROTOTYPES_
++ + ImageGet (
++ +     Tk_Window tkwin,		/* Token for window in which image will
++ + 				 * be used. */
++ +     ClientData clientData)	/* Pointer to TImageMaster for image. */
++ + #else
++   ImageGet(tkwin, clientData)
++       Tk_Window tkwin;		/* Token for window in which image will
++   				 * be used. */
++       ClientData clientData;	/* Pointer to TImageMaster for image. */
++ + #endif
++   {
++       TImageMaster *timPtr = (TImageMaster *) clientData;
++       TImageInstance *instPtr;
++ ***************
++ *** 1723,1728 ****
++ --- 1810,1826 ----
++    */
++   
++   static void
++ + #ifdef _USING_PROTOTYPES_
++ + ImageDisplay (
++ +     ClientData clientData,	/* Pointer to TImageInstance for image. */
++ +     Display *display,		/* Display to use for drawing. */
++ +     Drawable drawable,		/* Where to redraw image. */
++ +     int imageX, int imageY,	/* Origin of area to redraw, relative to
++ + 				 * origin of image. */
++ +     int width, int height,	/* Dimensions of area to redraw. */
++ +     int drawableX,		/* Coordinates in drawable corresponding to */
++ +     int drawableY)		/* imageX and imageY. */
++ + #else
++   ImageDisplay(clientData, display, drawable, imageX, imageY, width, height,
++   	drawableX, drawableY)
++       ClientData clientData;	/* Pointer to TImageInstance for image. */
++ ***************
++ *** 1733,1738 ****
++ --- 1831,1837 ----
++       int width, height;		/* Dimensions of area to redraw. */
++       int drawableX, drawableY;	/* Coordinates in drawable corresponding to
++   				 * imageX and imageY. */
++ + #endif
++   {
++       TImageInstance *instPtr = (TImageInstance *) clientData;
++       char buffer[200 + TCL_INTEGER_SPACE * 6];
++ ***************
++ *** 1775,1783 ****
++ --- 1874,1888 ----
++    */
++   
++   static void
++ + #ifdef _USING_PROTOTYPES_
++ + ImageFree (
++ +     ClientData clientData,	/* Pointer to TImageInstance for instance. */
++ +     Display *display)		/* Display where image was to be drawn. */
++ + #else
++   ImageFree(clientData, display)
++       ClientData clientData;	/* Pointer to TImageInstance for instance. */
++       Display *display;		/* Display where image was to be drawn. */
++ + #endif
++   {
++       TImageInstance *instPtr = (TImageInstance *) clientData;
++       char buffer[200];
++ ***************
++ *** 1808,1817 ****
++ --- 1913,1929 ----
++    */
++   
++   static void
++ + #ifdef _USING_PROTOTYPES_
++ + ImageDelete (
++ +     ClientData clientData)	/* Pointer to TImageMaster for image.  When
++ + 				 * this procedure is called, no more
++ + 				 * instances exist. */
++ + #else
++   ImageDelete(clientData)
++       ClientData clientData;	/* Pointer to TImageMaster for image.  When
++   				 * this procedure is called, no more
++   				 * instances exist. */
++ + #endif
++   {
++       TImageMaster *timPtr = (TImageMaster *) clientData;
++       char buffer[100];
++ ***************
++ *** 2040,2050 ****
++   
++   	/* ARGSUSED */
++   static int
++   TestpropCmd(clientData, interp, argc, argv)
++       ClientData clientData;		/* Main window for application. */
++       Tcl_Interp *interp;			/* Current interpreter. */
++       int argc;				/* Number of arguments. */
++ !     char **argv;			/* Argument strings. */
++   {
++       Tk_Window mainWin = (Tk_Window) clientData;
++       int result, actualFormat;
++ --- 2152,2170 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestpropCmd (
++ +     ClientData clientData,		/* Main window for application. */
++ +     Tcl_Interp *interp,			/* Current interpreter. */
++ +     int argc,				/* Number of arguments. */
++ +     Tcl_Obj *CONST argv[])		/* Argument objects. */
++ + #else
++   TestpropCmd(clientData, interp, argc, argv)
++       ClientData clientData;		/* Main window for application. */
++       Tcl_Interp *interp;			/* Current interpreter. */
++       int argc;				/* Number of arguments. */
++ !     Tcl_Obj *CONST argv[];		/* Argument objects. */
++ ! #endif
++   {
++       Tk_Window mainWin = (Tk_Window) clientData;
++       int result, actualFormat;
++ ***************
++ *** 2055,2067 ****
++       char buffer[30];
++   
++       if (argc != 3) {
++ ! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", argv[0],
++   		" window property\"", (char *) NULL);
++   	return TCL_ERROR;
++       }
++   
++ !     w = strtoul(argv[1], &end, 0);
++ !     propName = Tk_InternAtom(mainWin, argv[2]);
++       property = NULL;
++       result = XGetWindowProperty(Tk_Display(mainWin),
++   	    w, propName, 0, 100000, False, AnyPropertyType,
++ --- 2175,2187 ----
++       char buffer[30];
++   
++       if (argc != 3) {
++ ! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", Tcl_GetString(argv[0]),
++   		" window property\"", (char *) NULL);
++   	return TCL_ERROR;
++       }
++   
++ !     w = strtoul(Tcl_GetString(argv[1]), &end, 0);
++ !     propName = Tk_InternAtom(mainWin, Tcl_GetString(argv[2]));
++       property = NULL;
++       result = XGetWindowProperty(Tk_Display(mainWin),
++   	    w, propName, 0, 100000, False, AnyPropertyType,
++ ***************
++ *** 2307,2329 ****
++   
++   	/* ARGSUSED */
++   static int
++   TestwrapperCmd(clientData, interp, argc, argv)
++       ClientData clientData;		/* Main window for application. */
++       Tcl_Interp *interp;			/* Current interpreter. */
++       int argc;				/* Number of arguments. */
++ !     char **argv;			/* Argument strings. */
++   {
++       TkWindow *winPtr, *wrapperPtr;
++       Tk_Window tkwin;
++   
++       if (argc != 2) {
++ ! 	Tcl_AppendResult(interp, "wrong # args;  must be \"", argv[0],
++ ! 		" window\"", (char *) NULL);
++   	return TCL_ERROR;
++       }
++       
++       tkwin = (Tk_Window) clientData;
++ !     winPtr = (TkWindow *) Tk_NameToWindow(interp, argv[1], tkwin);
++       if (winPtr == NULL) {
++   	return TCL_ERROR;
++       }
++ --- 2427,2456 ----
++   
++   	/* ARGSUSED */
++   static int
++ + #ifdef _USING_PROTOTYPES_
++ + TestwrapperCmd (
++ +     ClientData clientData,		/* Main window for application. */
++ +     Tcl_Interp *interp,			/* Current interpreter. */
++ +     int argc,				/* Number of arguments. */
++ +     Tcl_Obj *CONST argv[])		/* Argument objects. */
++ + #else
++   TestwrapperCmd(clientData, interp, argc, argv)
++       ClientData clientData;		/* Main window for application. */
++       Tcl_Interp *interp;			/* Current interpreter. */
++       int argc;				/* Number of arguments. */
++ !     Tcl_Obj *CONST argv[];		/* Argument strings. */
++ ! #endif
++   {
++       TkWindow *winPtr, *wrapperPtr;
++       Tk_Window tkwin;
++   
++       if (argc != 2) {
++ ! 	Tcl_WrongNumArgs(interp, 1, argv, "window");
++   	return TCL_ERROR;
++       }
++       
++       tkwin = (Tk_Window) clientData;
++ !     winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetStringFromObj(argv[1], NULL), tkwin);
++       if (winPtr == NULL) {
++   	return TCL_ERROR;
++       }
++ *** generic/tkText.h.orig	Thu Jun 17 21:58:00 1999
++ --- generic/tkText.h	Sun Nov 14 16:27:02 1999
++ ***************
++ *** 30,36 ****
++    * file:
++    */
++   
++ ! typedef struct TkTextBTree *TkTextBTree;
++   
++   /*
++    * The data structure below defines a single line of text (from newline
++ --- 30,36 ----
++    * file:
++    */
++   
++ ! typedef struct TkTextBTree_ *TkTextBTree;
++   
++   /*
++    * The data structure below defines a single line of text (from newline
++ *** generic/tkWindow.c.orig	Wed Apr 21 23:53:28 1999
++ --- generic/tkWindow.c	Sun Nov 14 16:27:02 1999
++ ***************
++ *** 15,27 ****
++ --- 15,43 ----
++    * RCS: @(#) $Id: tkWindow.c,v 1.8 1999/04/21 21:53:28 rjohnson Exp $
++    */
++   
++ + #define reserved284 tcl_SetMainLoop
++ + 
++   #include "tkPort.h"
++   #include "tkInt.h"
++   
++   #if !defined(__WIN32__) && !defined(MAC_TCL)
++   #include "tkUnixInt.h"
++   #endif
++ + #if defined(__WIN32__)
++ + #include "tkWinInt.h"
++ + #endif
++   
++ + #ifndef USE_TCL_STUBS
++ + extern TclStubs tclStubs;
++ + #define tclStubsPtr (&tclStubs)
++ + #endif
++ + 
++ + /*
++ +  * Make sure that Tcl_SetMainLoop always references the stub pointer, not
++ +  * the real function.
++ +  */
++ + #undef Tcl_SetMainLoop
++ + #define Tcl_SetMainLoop ((void (*) _ANSI_ARGS_((VOID *))) ((tclStubsPtr)->tcl_SetMainLoop))
++   
++   typedef struct ThreadSpecificData {
++       int numMainWindows;    /* Count of numver of main windows currently
++ ***************
++ *** 155,160 ****
++ --- 171,179 ----
++   #ifdef MAC_TCL
++       {"unsupported1",	TkUnsupported1Cmd,	NULL,			1, 1},
++   #endif
++ + #if defined(TK_USE_INPUT_METHODS) && defined(I18N_IMPROVE)
++ +     {"imconfigure",	NULL,			Tk_ImconfigureObjCmd,	1, 1},
++ + #endif /* TK_USE_INPUT_METHODS && I18N_IMPROVE */
++       {(char *) NULL,	(int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, char **))) NULL, NULL, 0}
++   };
++   
++ ***************
++ *** 209,214 ****
++ --- 228,242 ----
++   			    char *name));
++   static void		OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
++   static void		UnlinkWindow _ANSI_ARGS_((TkWindow *winPtr));
++ + #ifdef TK_USE_INPUT_METHODS
++ + #ifdef I18N_IMPROVE
++ + static int		CanInitiateIm _ANSI_ARGS_((Tcl_Obj *locale));
++ + static void		IMInstantiateCallback _ANSI_ARGS_ ((Display *display,
++ + 				XPointer clientData, XPointer callData));
++ + static void		IMDestroyCallback _ANSI_ARGS_ ((XIM im, XPointer clientData, 
++ + 				XPointer callData));
++ + #endif /* I18N_IMPROVE */
++ + #endif /* TK_USE_INPUT_METHODS */
++   
++   /*
++    *----------------------------------------------------------------------
++ ***************
++ *** 1269,1275 ****
++       TkBindDeadWindow(winPtr);
++   #ifdef TK_USE_INPUT_METHODS
++       if (winPtr->inputContext != NULL) {
++ ! 	XDestroyIC(winPtr->inputContext);
++       }
++   #endif /* TK_USE_INPUT_METHODS */
++       if (winPtr->tagPtr != NULL) {
++ --- 1297,1307 ----
++       TkBindDeadWindow(winPtr);
++   #ifdef TK_USE_INPUT_METHODS
++       if (winPtr->inputContext != NULL) {
++ ! #ifdef I18N_IMPROVE
++ ! 	TkpDestroyIC(winPtr, 1);
++ ! #else
++ !   	XDestroyIC(winPtr->inputContext);
++ ! #endif /* I18N_IMPROVE */
++       }
++   #endif /* TK_USE_INPUT_METHODS */
++       if (winPtr->tagPtr != NULL) {
++ ***************
++ *** 2422,2427 ****
++ --- 2454,2617 ----
++   {
++       return ((TkWindow *) tkwin)->mainPtr->strictMotif;
++   }
++ + #ifdef TK_USE_INPUT_METHODS
++ + #ifdef I18N_IMPROVE
++ + 
++ + static int
++ + CanInitiateIm(loc)
++ +      Tcl_Obj *loc;
++ + {
++ +     static int inited = 0;
++ +     static int ret = 0;
++ +     char *locale = Tcl_GetString(loc);
++ + 
++ +     if (inited == 0) {
++ + 	char *curSpec = setlocale(LC_ALL, NULL);
++ + 
++ + 	inited = 1;
++ + 
++ + 	if (strcmp(locale, "C") == 0 ||
++ + 	    strcmp(locale, "POSIX") == 0) {
++ + 	    goto Checked;
++ + 	}
++ + 
++ + 	/*
++ + 	 * Ok I know, everyone of core Tcl/Tk developer hates this.
++ + 	 * believe it or not, it must be needed to call
++ + 	 * setlocale(3)/_Xsetlocale() VERY HERE. This is what the X
++ + 	 * input method wants.
++ + 	 * Note that X11's i18n implementation should be ONLY governed
++ + 	 * by LC_CTYPE. This is clearly/explicitly specified in X11
++ + 	 * documente Chapter 13. Thus, If there are some X11
++ + 	 * implementation that need using LC_ALL to initialize i18n
++ + 	 * subsystem, I won't care about such a X library.
++ + 	 * But, we are still on edge of darkside. ctype(3) routines
++ + 	 * are governed by LC_CTYPE.... Need to create "Locale
++ + 	 * independent ctype libraries" for Tcl/Tk...
++ + 	 *
++ + 	 *	m-hirano
++ + 	 */
++ + 
++ + 	/*
++ + 	 * OK, First of all, setting WHOLE locale to "C".
++ + 	 */
++ + 	(void)setlocale(LC_ALL, "C");
++ + 	if (setlocale(LC_CTYPE, locale) == NULL) {
++ + 	    /*
++ + 	     * Reset to old locale.
++ + 	     */
++ + 	    if (setlocale(LC_ALL, curSpec) == NULL) {
++ + 		(void)setlocale(LC_ALL, "C");
++ + 	    }
++ + 	    goto Checked;
++ + 	} else {
++ + 	    /*
++ + 	     * For insurance, reset LC_NUMERIC to "C" for Tcl numeric parsing.
++ + 	     */
++ + 	    (void)setlocale(LC_NUMERIC, "C");
++ + 	}
++ + 	if (XSupportsLocale() != True) {
++ + 	    goto Checked;
++ + 	}
++ + 
++ + 	ret = True;
++ + 	/*
++ + 	 * At last, Setting the locale modifiers.
++ + 	 */
++ + 	(void)XSetLocaleModifiers("");
++ +     }
++ + 
++ +     Checked:
++ +     return ret;
++ + }
++ + 
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * IMInstantiateCallback
++ +  *
++ +  *	Whenever IM server become available, this function will be called.
++ +  *
++ +  * Results:
++ +  *	OpenIM() is called.
++ +  *
++ +  * Side effects:
++ +  *	None.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + void
++ + IMInstantiateCallback(display, clientData, callData)
++ +      Display *display;
++ +      XPointer clientData;
++ +      XPointer callData;
++ + {
++ +     TkDisplay *dispPtr = (TkDisplay *)clientData;
++ + 
++ +     if (display == dispPtr->display &&
++ + 	dispPtr->inputMethod == NULL) {
++ + 	OpenIM(dispPtr);
++ +     }
++ + }
++ + 
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * IMDestroyCallback
++ +  *
++ +  *	Whenever IM server stops the service, this function will be called.
++ +  *
++ +  * Results:
++ +  *	the XIM opened before is marked as unusable.
++ +  *
++ +  * Side effects:
++ +  *	XIC using this XIM will be useless.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + void
++ + IMDestroyCallback(im, clientData, callData)
++ +      XIM im;
++ +      XPointer clientData;
++ +      XPointer callData;
++ + {
++ +     TkDisplay *dispPtr = (TkDisplay *)clientData;
++ +     if (im == dispPtr->inputMethod) {
++ + 	Tcl_HashTable winTable = dispPtr->winTable;
++ + 	Tcl_HashEntry *entry = NULL;
++ + 	Tcl_HashSearch search;
++ + 	TkWindow *winPtr;
++ + 
++ + 	/*
++ + 	 * We must not call XCloseIM() or XDestroyIC().
++ + 	 * because the XIM and XIC are destroyed by Xlib 
++ + 	 * automatically.
++ + 	 */
++ + 	for (entry = Tcl_FirstHashEntry(&winTable, &search); entry != NULL;
++ + 	     entry = Tcl_NextHashEntry(&search)) {
++ + 	    winPtr = (TkWindow *)Tcl_GetHashValue(entry);
++ + 	    if (winPtr->dispPtr->display == dispPtr->display &&
++ + 		winPtr->dispPtr->inputMethod == im &&
++ + 		winPtr->inputContext != NULL) {
++ + 		TkpDestroyIC(winPtr, 0);
++ + 	    }
++ + 	}
++ + 	dispPtr->inputMethod = NULL;
++ + 	dispPtr->lastFocusedIC = NULL;
++ + #ifdef HAVE_XIMREGINSTCB
++ + #ifdef NO_XIDPROC
++ + 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
++ + 				       (XIMProc)IMInstantiateCallback, (XPointer *)dispPtr);
++ + #else
++ + 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
++ + 				       (XIDProc)IMInstantiateCallback, (XPointer)dispPtr);
++ + #endif /* NO_XIDPROC */
++ + #endif /* HAVE_XIMREGINSTCB */
++ +     }
++ + }
++ + #endif /* I18N_IMPROVE */
++ + #endif /* TK_USE_INPUT_METHODS */
++   
++   /* 
++    *--------------------------------------------------------------
++ ***************
++ *** 2452,2459 ****
++ --- 2642,2683 ----
++       unsigned short i;
++       XIMStyles *stylePtr;
++   
++ + #ifdef I18N_IMPROVE
++ +     int styleFound = 0;
++ +     Tcl_Obj *imLocale = NULL;
++ +     Tcl_Obj *imEncoding = NULL;
++ + 
++ +     dispPtr->inputMethod = NULL;
++ +     dispPtr->imEncoding = NULL;
++ +     dispPtr->lastFocusedIC = NULL;
++ + 
++ + #ifdef TCL_ACTIVE
++ +     TclpGetStartupLocaleEncoding(&imEncoding, &imLocale);
++ + #endif
++ +     if (imEncoding == NULL || imLocale == NULL) {
++ + 	return;
++ +     }
++ +     if (CanInitiateIm(imLocale) == False) {
++ + 	return;
++ +     }
++ + #endif /* I18N_IMPROVE */
++       dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
++       if (dispPtr->inputMethod == NULL) {
++ + #ifdef I18N_IMPROVE
++ + #ifdef HAVE_XIMREGINSTCB
++ + 	/*
++ + 	 * Maybe no IM server is available rite now.
++ + 	 * Try to register instatntiate callback.
++ + 	 */
++ + #ifdef NO_XIDPROC
++ + 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
++ + 				       (XIMProc)IMInstantiateCallback, (XPointer *)dispPtr);
++ + #else
++ + 	XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
++ + 				       (XIDProc)IMInstantiateCallback, (XPointer)dispPtr);
++ + #endif /* NO_XIDPROC */
++ + #endif /* HAVE_XIMREGINSTCB */
++ + #endif /* I18N_IMPROVE */
++   	return;
++       }
++   
++ ***************
++ *** 2464,2474 ****
++       for (i = 0; i < stylePtr->count_styles; i++) {
++   	if (stylePtr->supported_styles[i]
++   		== (XIMPreeditNothing|XIMStatusNothing)) {
++ ! 	    XFree(stylePtr);
++ ! 	    return;
++   	}
++       }
++       XFree(stylePtr);
++   
++       error:
++   
++ --- 2688,2717 ----
++       for (i = 0; i < stylePtr->count_styles; i++) {
++   	if (stylePtr->supported_styles[i]
++   		== (XIMPreeditNothing|XIMStatusNothing)) {
++ ! #ifdef I18N_IMPROVE
++ ! 	    styleFound = 1;
++ ! #else
++ !   	    XFree(stylePtr);
++ !   	    return;
++ ! #endif /* I18N_IMPROVE */
++   	}
++       }
++       XFree(stylePtr);
++ + #ifdef I18N_IMPROVE
++ +     if (styleFound == 1) {
++ + 	/*
++ + 	 * Create a Tcl_Encoding for XmbLookupString() conversion.
++ + 	 */
++ + 	dispPtr->imEncoding = Tcl_GetEncoding(NULL, Tcl_GetString(imEncoding));
++ + #ifdef XNDestroyCallback
++ + 	dispPtr->destroyCallback.client_data = (XPointer)dispPtr;
++ + 	dispPtr->destroyCallback.callback = (XIMProc)IMDestroyCallback;
++ + 	(void)XSetIMValues(dispPtr->inputMethod,
++ + 			   XNDestroyCallback, &(dispPtr->destroyCallback), NULL);
++ + #endif /* XNDestroyCallback */	
++ + 	return;
++ +     }
++ + #endif /* I18N_IMPROVE */
++   
++       error:
++   
++ ***************
++ *** 2709,2714 ****
++ --- 2952,2967 ----
++       Tcl_DString class;
++       ThreadSpecificData *tsdPtr;
++       
++ + #if defined(__WIN32__) && defined(STATIC_BUILD) && !defined(NO_STATIC_INIT)
++ +     /*
++ +      * If we are in a statically linked executable, then we need to
++ +      * explicitly initialize the Windows function tables here since
++ +      * DllMain() will not be invoked.
++ +      */
++ + 
++ +     TkWinXInit(GetModuleHandle(NULL));
++ + #endif
++ + 
++       /*
++        * Ensure that we are getting the matching version of Tcl.  This is
++        * really only an issue when Tk is loaded dynamically.
++ ***************
++ *** 2935,2941 ****
++       }
++       Tcl_MutexUnlock(&windowMutex);
++   
++ !     if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1) == NULL) {
++   	code = TCL_ERROR;
++   	goto done;
++       }
++ --- 3188,3194 ----
++       }
++       Tcl_MutexUnlock(&windowMutex);
++   
++ !     if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
++   	code = TCL_ERROR;
++   	goto done;
++       }
++ ***************
++ *** 2949,2959 ****
++ --- 3202,3214 ----
++   	goto done;
++       }
++   
++ + #ifndef __WIN32__
++   #ifdef Tk_InitStubs
++   #undef Tk_InitStubs
++   #endif
++   
++       Tk_InitStubs(interp, TK_VERSION, 1);
++ + #endif
++   
++       /*
++        * Invoke platform-specific initialization.
++ ***************
++ *** 2961,2969 ****
++ --- 3216,3231 ----
++   
++       code = TkpInit(interp);
++   
++ +     if (Tcl_SetMainLoop) {
++ + 	Tcl_SetMainLoop(Tk_GetNumMainWindows);
++ +     }
++ + 
++       done:
++       if (argv != NULL) {
++   	ckfree((char *) argv);
++ +     }
++ +     if (code != TCL_ERROR) {
++ + 	code = TCL_OK;
++       }
++       return code;
++   }
++ *** tests/bind.test.orig	Thu Jul  8 20:22:22 1999
++ --- tests/bind.test	Sun Nov 14 16:27:02 1999
++ ***************
++ *** 214,220 ****
++       .b.c bind foo
++   } {}
++   
++ ! 
++   if {[string compare testcbind [info commands testcbind]] != 0} {
++       puts "This application hasn't been compiled with the testcbind command,"
++       puts "therefore I am skipping all of these tests."
++ --- 214,220 ----
++       .b.c bind foo
++   } {}
++   
++ ! auto_load ::testcbind
++   if {[string compare testcbind [info commands testcbind]] != 0} {
++       puts "This application hasn't been compiled with the testcbind command,"
++       puts "therefore I am skipping all of these tests."
++ *** tests/button.test.orig	Fri Apr 16 03:51:34 1999
++ --- tests/button.test	Sun Nov 14 16:27:02 1999
++ ***************
++ *** 13,18 ****
++ --- 13,19 ----
++       source [file join [pwd] [file dirname [info script]] defs.tcl]
++   }
++   
++ + auto_load ::testsend
++   if {[lsearch [image types] test] < 0} {
++       puts "This application hasn't been compiled with the \"test\""
++       puts "image, so I can't run this test.  Are you sure you're using"
++ *** tests/defs.tcl.orig	Sat Jun 19 02:59:01 1999
++ --- tests/defs.tcl	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 18,28 ****
++   if {[info exists tk_version]} {
++       tk appname tktest
++       wm title . tktest
++   } else {
++   
++       # Ensure that we have a minimal auto_path so we don't pick up extra junk.
++   
++ !     set auto_path [list [info library]]
++   }
++   
++   # create the "tcltest" namespace for all testing variables and procedures
++ --- 18,46 ----
++   if {[info exists tk_version]} {
++       tk appname tktest
++       wm title . tktest
++ +     catch {package require -exact Tktest $tk_version}
++   } else {
++   
++       # Ensure that we have a minimal auto_path so we don't pick up extra junk.
++   
++ !     set auto_path [list [info library] [file dirname [info nameofexecutable]]]
++ ! }
++ ! 
++ ! # Error-messages are not neccary if the Tcltest, Objtest
++ ! # or Proctest packages are not present. Many tests can
++ ! # still run, so it is not reasonable to stop for that.
++ ! 
++ ! catch {package require -exact Tcltest [info tclversion]}
++ ! catch {package require -exact Objtest [info tclversion]}
++ ! catch {package require Proctest 1.0}
++ ! if {$tcl_platform(platform) == "unix"} {
++ !     catch {package require -exact Unixtest [info tclversion]}
++ ! }
++ ! if {$tcl_platform(platform) == "macintosh"} {
++ !     catch {package require -exact Mactest [info tclversion]}
++ ! }
++ ! if {$tcl_platform(platform) == "windows"} {
++ !     catch {package require -exact Wintest [info tclversion]}
++   }
++   
++   # create the "tcltest" namespace for all testing variables and procedures
++ *** tests/entry.test.orig	Fri Apr 16 03:51:37 1999
++ --- tests/entry.test	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 12,17 ****
++ --- 12,18 ----
++       source [file join [pwd] [file dirname [info script]] defs.tcl]
++   }
++   
++ + auto_load testsend
++   if {[lsearch [image types] test] < 0} {
++       puts "This application hasn't been compiled with the \"test\""
++       puts "image, so I can't run this test.  Are you sure you're using"
++ *** tests/image.test.orig	Fri Apr 16 03:51:38 1999
++ --- tests/image.test	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 13,18 ****
++ --- 13,19 ----
++       source [file join [pwd] [file dirname [info script]] defs.tcl]
++   }
++   
++ + auto_load testsend
++   if {[lsearch [image types] test] < 0} {
++       puts "This application hasn't been compiled with the \"test\" image"
++       puts "type, so I can't run this test.  Are you sure you're using"
++ *** tests/menu.test.orig	Fri Apr 16 03:51:39 1999
++ --- tests/menu.test	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 11,16 ****
++ --- 11,17 ----
++       source [file join [pwd] [file dirname [info script]] defs.tcl]
++   }
++   
++ + auto_load testcbind
++   if {[lsearch [image types] test] < 0} {
++       puts "This application hasn't been compiled with the \"test\" image"
++       puts "type, so I can't run this test.  Are you sure you're using"
++ ***************
++ *** 218,224 ****
++   .m1 add separator
++   .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
++   .m1 add radiobutton -label "radiobutton" -variable radio
++ ! image create photo image1 -file [file join $tk_library demos images earth.gif]
++   
++   foreach configTest {
++       {-activebackground 
++ --- 219,225 ----
++   .m1 add separator
++   .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
++   .m1 add radiobutton -label "radiobutton" -variable radio
++ ! image create photo image1 -file [file join .. library demos images earth.gif]
++   
++   foreach configTest {
++       {-activebackground 
++ ***************
++ *** 1351,1357 ****
++   test menu-8.2 {DestroyMenuEntry} {
++       catch {image delete image1a}
++       catch {destroy .m1}
++ !     image create photo image1a -file [file join $tk_library demos images earth.gif]
++       menu .m1
++       .m1 add command -image image1a
++       list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
++ --- 1352,1358 ----
++   test menu-8.2 {DestroyMenuEntry} {
++       catch {image delete image1a}
++       catch {destroy .m1}
++ !     image create photo image1a -file [file join [pwd] .. library demos images earth.gif]
++       menu .m1
++       .m1 add command -image image1a
++       list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
++ ***************
++ *** 1605,1611 ****
++       catch {image delete image1}
++       catch {image delete image2}
++       image create test image1
++ !     image create photo image2 -file [file join $tk_library demos images earth.gif]
++       menu .m1
++       .m1 add command -image image1
++       list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
++ --- 1606,1612 ----
++       catch {image delete image1}
++       catch {image delete image2}
++       image create test image1
++ !     image create photo image2 -file [file join [pwd] .. library demos images earth.gif]
++       menu .m1
++       .m1 add command -image image1
++       list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
++ ***************
++ *** 1614,1620 ****
++       catch {destroy .m1}
++       catch {image delete image1}
++       catch {image delete image2}
++ !     image create photo image1 -file [file join $tk_library demos images earth.gif]
++       image create test image2
++       menu .m1
++       .m1 add checkbutton -image image1
++ --- 1615,1621 ----
++       catch {destroy .m1}
++       catch {image delete image1}
++       catch {image delete image2}
++ !     image create photo image1 -file [file join [pwd] .. library demos images earth.gif]
++       image create test image2
++       menu .m1
++       .m1 add checkbutton -image image1
++ ***************
++ *** 1625,1631 ****
++       catch {image delete image1}
++       catch {image delete image2}
++       catch {image delete image3}
++ !     image create photo image1 -file [file join $tk_library demos images earth.gif]
++       image create test image2
++       image create test image3
++       menu .m1
++ --- 1626,1632 ----
++       catch {image delete image1}
++       catch {image delete image2}
++       catch {image delete image3}
++ !     image create photo image1 -file [file join [pwd] .. library demos images earth.gif]
++       image create test image2
++       image create test image3
++       menu .m1
++ *** tests/unixEmbed.test.orig	Wed Apr 21 23:53:30 1999
++ --- tests/unixEmbed.test	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 115,120 ****
++ --- 115,121 ----
++       dobg {
++   	eval destroy [winfo child .]
++   	toplevel .t -use $w
++ + 	package require Tktest
++   	list [testembed] [expr [lindex [lindex [testembed all] 0] 0] - $w]
++       }
++   } {{{XXX {} {} .t}} 0}
++ ***************
++ *** 129,134 ****
++ --- 130,136 ----
++   	eval destroy [winfo child .]
++   	toplevel .t1 -use $w1
++   	toplevel .t2 -use $w2
++ + 	package require Tktest
++   	testembed
++       }
++   } {{XXX {} {} .t2} {XXX {} {} .t1}}
++ ***************
++ *** 155,160 ****
++ --- 157,163 ----
++       dobg {
++   	eval destroy [winfo child .]
++   	toplevel .t1 -use $w1
++ + 	package require Tktest
++   	testembed
++       }
++       destroy .f1
++ ***************
++ *** 173,178 ****
++ --- 176,182 ----
++       dobg {
++   	eval destroy [winfo child .]
++   	toplevel .t1 -use $w1
++ + 	package require Tktest
++   	testembed
++   	destroy .t1
++   	testembed
++ ***************
++ *** 593,598 ****
++ --- 597,603 ----
++   	eval destroy [winfo child .]
++   	toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken
++   	set x {}
++ + 	package require Tktest
++   	lappend x [testembed]
++   	destroy .t1
++   	lappend x [testembed]
++ *** doc/wish.1.orig	Mon Sep 14 20:23:01 1998
++ --- doc/wish.1	Sun Nov 14 16:27:03 1999
++ ***************
++ *** 175,182 ****
++   command with ``\fB% \fR''.  You can change the prompt by setting the
++   variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
++   \fBtcl_prompt1\fR exists then it must consist of a Tcl script
++ ! to output a prompt;  instead of outputting a prompt \fBwish\fR
++ ! will evaluate the script in \fBtcl_prompt1\fR.
++   The variable \fBtcl_prompt2\fR is used in a similar way when
++   a newline is typed but the current command isn't yet complete;
++   if \fBtcl_prompt2\fR isn't set then no prompt is output for
++ --- 175,183 ----
++   command with ``\fB% \fR''.  You can change the prompt by setting the
++   variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
++   \fBtcl_prompt1\fR exists then it must consist of a Tcl script
++ ! to return a prompt; instead of outputting a prompt \fBtclsh\fR
++ ! will evaluate the script in \fBtcl_prompt1\fR and write the
++ ! result of the evaluation to stdout.
++   The variable \fBtcl_prompt2\fR is used in a similar way when
++   a newline is typed but the current command isn't yet complete;
++   if \fBtcl_prompt2\fR isn't set then no prompt is output for
++ *** mac/pkgIndex.tcl.orig	Sun Nov 14 16:27:04 1999
++ --- mac/pkgIndex.tcl	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,5 ----
++ + # Tcl package index file, version 1.0
++ + 
++ + package ifneeded Tk 8.0 [list load [file join $dir libtk8.0[info sharedlibextension]] Tk]
++ + package ifneeded Tksquare 8.0 [list tclPkgSetup $dir Tksquare 8.0 [list [list Tksquare[info sharedlibextension] load square]]]
++ + package ifneeded Tktest 8.0 [list tclPkgSetup $dir Tktest 8.0 [list [list Tktest[info sharedlibextension] load {testcbind testdeleteapps testembed testmakeexist testmenubar testprop testsend testwrapper}]]]
++ *** mac/tkMacAppInit.c.orig	Wed Jun 16 07:33:58 1999
++ --- mac/tkMacAppInit.c	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 12,17 ****
++ --- 12,19 ----
++    * RCS: @(#) $Id: tkMacAppInit.c,v 1.11 1999/06/16 05:33:58 jingham Exp $
++    */
++   
++ + #undef TCL_USE_STUBS
++ + 
++   #include <Gestalt.h>
++   #include <ToolUtils.h>
++   #include <Fonts.h>
++ *** mac/tkMacInit.c.orig	Fri Apr 16 03:51:31 1999
++ --- mac/tkMacInit.c	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 32,37 ****
++ --- 32,170 ----
++   QDGlobalsPtr tcl_macQdPtr = NULL;
++   
++   /*
++ +  * Default directory in which to look for libraries:
++ +  */
++ + 
++ + #ifndef TK_LIBRARY
++ + #define TK_LIBRARY "."
++ + #endif
++ + 
++ + static char defaultLibraryDir[200] = TK_LIBRARY;
++ + 
++ + /*
++ +  * The following string is the startup script executed in new
++ +  * interpreters.  It looks on disk in several different directories
++ +  * for a script "tk.tcl" that is compatible with this version
++ +  * of Tk.  The tk.tcl script does all of the real work of
++ +  * initialization.
++ +  */
++ + 
++ + static char initScript[] =
++ + "proc tkInit {} {\n\
++ +     global tk_library tk_version tk_patchLevel env\n\
++ +     set errors \"\"\n\
++ +     rename tkInit {}\n\
++ +     set dirs {}\n\
++ +     if [info exists env(TK_LIBRARY)] {\n\
++ + 	lappend dirs $env(TK_LIBRARY)\n\
++ +     }\n\
++ +     lappend dirs $tk_library\n\
++ +     set tk_library {}\n\
++ +     if ![catch {uplevel #0 source -rsrc tk}] {\n\
++ + 	uplevel #0 {\n\
++ +     	    source -rsrc button\n\
++ +     	    source -rsrc entry\n\
++ +     	    source -rsrc listbox\n\
++ +     	    source -rsrc menu\n\
++ +     	    source -rsrc scale\n\
++ +     	    source -rsrc scrollbar\n\
++ +     	    source -rsrc text\n\
++ +     	    source -rsrc dialog\n\
++ +     	    source -rsrc focus\n\
++ +     	    source -rsrc optionMenu\n\
++ +     	    source -rsrc palette\n\
++ +     	    source -rsrc tearoff\n\
++ +     	    source -rsrc tkerror\n\
++ +     	    source -rsrc comdlg\n\
++ +     	    source -rsrc msgbox\n\\n\
++ + 	}\n\
++ + 	return\n\
++ +     }\n\
++ +     lappend dirs [file join [file dirname [info library]] tk$tk_version]\n\
++ +     set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
++ +     lappend dirs [file join $parentDir lib tk$tk_version]\n\
++ +     if {![regexp {.*[ab][12345]} $tk_patchLevel version]} {\n\
++ + 	set version $tk_version\n\
++ +     }\n\
++ +     lappend dirs [file join [file dirname $parentDir] tk$version library]\n\
++ +     lappend dirs [file join $parentDir library]\n\
++ +     foreach i $dirs {\n\
++ + 	set tk_library $i\n\
++ + 	if ![catch {uplevel #0 source [list [file join $i tk.tcl]]}] {\n\
++ + 	    return\n\
++ + 	} else {\n\
++ + 	    append errors \"[file join $i tk.tcl]: $msg\n$errorInfo\n\"\n\
++ + 	}\n\
++ +     }\n\
++ +     set tk_library {}\n\
++ +     set msg \"Can't find a usable tk.tcl in the following directories: \n\"\n\
++ +     append msg \"    $dirs\n\"\n\
++ +     append msg \"This probably means that Tk wasn't installed properly.\n\"\n\
++ +     error $msg\n\
++ + }\n\
++ + tkInit";
++ + 
++ + /*
++ +  * The following script is used to initialize Tk in a safe interpreter.
++ +  */
++ + 
++ + static char safeInitScript[] =
++ + "proc tkInit {} {\n\
++ +     global tk_library tk_version tk_patchLevel env\n\
++ +     set errors \"\"\n\
++ +     rename tkInit {}\n\
++ +     set dirs {}\n\
++ +     if [info exists env(TK_LIBRARY)] {\n\
++ + 	lappend dirs $env(TK_LIBRARY)\n\
++ +     }\n\
++ +     lappend dirs $tk_library\n\
++ +     set tk_library {}\n\
++ +     if ![catch {uplevel #0 source -rsrc tk}] {\n\
++ + 	uplevel #0 {\n\
++ +     	    source -rsrc button\n\
++ +     	    source -rsrc entry\n\
++ +     	    source -rsrc listbox\n\
++ +     	    source -rsrc menu\n\
++ +     	    source -rsrc scale\n\
++ +     	    source -rsrc scrollbar\n\
++ +     	    source -rsrc text\n\
++ +     	    source -rsrc dialog\n\
++ +     	    source -rsrc focus\n\
++ +     	    source -rsrc optionMenu\n\
++ +     	    source -rsrc palette\n\
++ +     	    source -rsrc tearoff\n\
++ +     	    source -rsrc tkerror\n\
++ +     	    source -rsrc comdlg\n\
++ +     	    source -rsrc msgbox\n\\n\
++ + 	}\n\
++ + 	return\n\
++ +     }\n\
++ +     lappend dirs [file join [file dirname [info library]] tk$tk_version]\n\
++ +     set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
++ +     lappend dirs [file join $parentDir lib tk$tk_version]\n\
++ +     if {![regexp {.*[ab][1-9]} $tk_patchLevel version]} {\n\
++ + 	set version $tk_version\n\
++ +     }\n\
++ +     lappend dirs [file join [file dirname [file dirname [info library]]] tk$version library]\n\
++ +     foreach i $dirs {\n\
++ + 	set tk_library $i\n\
++ + 	if ![catch {uplevel #0 source [list [file join $i tk.tcl]]}] {\n\
++ + 	    return\n\
++ + 	} else {\n\
++ + 	    append errors \"[file join $i tk.tcl]: $msg\n$errorInfo\n\"\n\
++ + 	}\n\
++ +     }\n\
++ +     set tk_library {}\n\
++ +     set msg \"Can't find a usable tk.tcl in the following directories: \n\"\n\
++ +     append msg \"    $dirs\n\n\"\n\
++ +     append msg \"$errors\n\n\"\n\
++ +     append msg \"This probably means that Tk wasn't installed properly.\n\"\n\
++ +     error $msg\n\
++ + }\n\
++ + tkInit";
++ + 
++ + 
++ + /*
++    *----------------------------------------------------------------------
++    *
++    * TkpInit --
++ ***************
++ *** 58,102 ****
++       Tcl_DString path;
++       int result;
++   
++ -     /*
++ -      * The following does not work with
++ -      * safe interps because file exists is restricted.
++ -      * to be fixed using [interp issafe] like in Unix & Windows.
++ -      */
++ -     static char initCmd[] =
++ - 	"if [file exists $tk_library:tk.tcl] {\n\
++ - 	    source $tk_library:tk.tcl\n\
++ - 	    source $tk_library:button.tcl\n\
++ - 	    source $tk_library:entry.tcl\n\
++ - 	    source $tk_library:listbox.tcl\n\
++ - 	    source $tk_library:menu.tcl\n\
++ - 	    source $tk_library:scale.tcl\n\
++ - 	    source $tk_library:scrlbar.tcl\n\
++ - 	    source $tk_library:text.tcl\n\
++ - 	    source $tk_library:comdlg.tcl\n\
++ - 	    source $tk_library:msgbox.tcl\n\
++ - 	} else {\n\
++ - 	    set msg \"can't find tk resource or $tk_library:tk.tcl;\"\n\
++ - 	    append msg \" perhaps you need to\\ninstall Tk or set your \"\n\
++ - 	    append msg \"TK_LIBRARY environment variable?\"\n\
++ - 	    error $msg\n\
++ - 	}";
++ - 
++       Tcl_DStringInit(&path);
++   
++       /*
++        * The tk_library path can be found in several places.  Here is the order
++        * in which the are searched.
++        *		1) the variable may already exist
++ !      *		2) env array
++ !      *		3) System Folder:Extensions:Tool Command Language:
++        */
++ !      
++       libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
++       if (libDir == NULL) {
++ - 	libDir = Tcl_GetVar2(interp, "env", "TK_LIBRARY", TCL_GLOBAL_ONLY);
++ -     }
++ -     if (libDir == NULL) {
++   	tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY);
++   	if (tempPath != NULL) {
++   	    Tcl_DString libPath;
++ --- 191,208 ----
++       Tcl_DString path;
++       int result;
++   
++       Tcl_DStringInit(&path);
++   
++       /*
++        * The tk_library path can be found in several places.  Here is the order
++        * in which the are searched.
++        *		1) the variable may already exist
++ !      *		2) System Folder:Extensions:Tool Command Language:
++ !      *		3) env array
++        */
++ ! 
++       libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
++       if (libDir == NULL) {
++   	tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY);
++   	if (tempPath != NULL) {
++   	    Tcl_DString libPath;
++ ***************
++ *** 112,118 ****
++   	}
++       }
++       if (libDir == NULL) {
++ ! 	libDir = "no library";
++       }
++   
++       /*
++ --- 218,224 ----
++   	}
++       }
++       if (libDir == NULL) {
++ ! 	libDir = "";
++       }
++   
++       /*
++ ***************
++ *** 121,151 ****
++       Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
++       Tcl_DStringFree(&path);
++   
++ !     /*
++ !      * Source the needed Tk libraries from the resource
++ !      * fork of the application.
++ !      */
++ !     result = Tcl_MacEvalResource(interp, "tk", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "button", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "entry", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "listbox", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "menu", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "scale", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "scrollbar", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "text", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "dialog", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "focus", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "optionMenu", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "palette", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "tearoff", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "tkerror", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "comdlg", 0, NULL);
++ !     result |= Tcl_MacEvalResource(interp, "msgbox", 0, NULL);
++ ! 
++ !     if (result != TCL_OK) {
++ ! 	result = Tcl_Eval(interp, initCmd);
++       }
++ !     return result;
++   }
++   
++   /*
++ --- 227,236 ----
++       Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
++       Tcl_DStringFree(&path);
++   
++ !     if (doSafe) {
++ ! 	return Tcl_Eval(interp, safeInitScript);
++       }
++ !     return Tcl_Eval(interp, initScript);
++   }
++   
++   /*
++ *** mac/tkMacPort.h.orig	Sun Aug  1 23:25:23 1999
++ --- mac/tkMacPort.h	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 70,78 ****
++    * in any other header file.
++    */
++   
++ - #ifndef panic	/* In a stubs-aware setting, this could confuse the #define */
++ - extern void 		panic  _ANSI_ARGS_(TCL_VARARGS(char *, string));
++ - #endif
++   extern int		strcasecmp _ANSI_ARGS_((CONST char *s1,
++   			    CONST char *s2));
++   extern int		strncasecmp _ANSI_ARGS_((CONST char *s1,
++ --- 70,75 ----
++ *** mac/tkMacTest.c.orig	Fri Apr 16 03:51:32 1999
++ --- mac/tkMacTest.c	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 19,24 ****
++ --- 19,25 ----
++    * Forward declarations of procedures defined later in this file:
++    */
++   
++ + int			Tkptest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   int			TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
++   static int		DebuggerCmd _ANSI_ARGS_((ClientData dummy,
++   			    Tcl_Interp *interp, int argc, char **argv));
++ ***************
++ *** 42,47 ****
++ --- 43,71 ----
++   
++   int
++   TkplatformtestInit(
++ +     Tcl_Interp *interp)		/* Interpreter to add commands to. */
++ + {
++ +     return Tkptest_Init(interp);
++ + }
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * Tkptest_Init --
++ +  *
++ +  *	Defines commands that test platform specific functionality for
++ +  *	Macintosh platforms.
++ +  *
++ +  * Results:
++ +  *	A standard Tcl result.
++ +  *
++ +  * Side effects:
++ +  *	Defines new commands.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + int
++ + Tkptest_Init(
++       Tcl_Interp *interp)		/* Interpreter to add commands to. */
++   {
++       /*
++ *** win/Makefile.gnu.orig	Sun Nov 14 16:27:04 1999
++ --- win/Makefile.gnu	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,609 ----
++ + # Generated automatically from Makefile.in by configure.
++ + # Visual C++ 2.x and 4.0 makefile
++ + #
++ + # See the file "license.terms" for information on usage and redistribution
++ + # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
++ + # 
++ + # Copyright (c) 1995-1996 Sun Microsystems, Inc.
++ + # SCCS: @(#) makefile.vc 1.63 97/08/13 13:33:32
++ + 
++ + # Does not depend on the presence of any environment variables in
++ + # order to compile tcl; all needed information is derived from 
++ + # location of the compiler directories.
++ + 
++ + # This file is CYGNUS LOCAL.  It is a copy of makefile.vc from the
++ + # standard tk distribution, modified to work with cygwin32 and an
++ + # autoconf configure script.  I have chosen to minimize the number of
++ + # changes, so the comments continue to refer to Visual C++ and the
++ + # like.  This should make it easier to merge in a new version if that
++ + # is necessary.
++ + 
++ + prefix = /usr/local
++ + exec_prefix = /usr/local
++ + VPATH = .:./../xlib:./../generic:./../unix:./../win/rc
++ + srcdir = .
++ + 
++ + INSTALL = /usr/bin/install -c
++ + INSTALL_PROGRAM = ${INSTALL}
++ + INSTALL_DATA = ${INSTALL} -m 644
++ + 
++ + CC = gcc
++ + CFLAGS = -O2 -DSTATIC_BUILD -mno-cygwin
++ + NM = nm
++ + AS = as
++ + LD = ld
++ + DLLTOOL = dlltool
++ + DLLWRAP = dllwrap -mno-cygwin
++ + WINDRES = windres
++ + 
++ + DLL_LDFLAGS = -mwindows -Wl,-e,_DllMain@12
++ + DLL_LDLIBS =
++ + 
++ + # Current Tk version;  used in various names.
++ + 
++ + DIRVERSION = 8.2
++ + 
++ + # The following definition can be set to non-null for special systems
++ + # like AFS with replication.  It allows the pathnames used for installation
++ + # to be different than those used for actually reference files at
++ + # run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
++ + # when installing files.
++ + INSTALL_ROOT =
++ + 
++ + # Directory from which applications will reference the library of Tcl
++ + # scripts (note: you can set the TK_LIBRARY environment variable at
++ + # run-time to override the compiled-in location):
++ + TK_LIBRARY =		${prefix}/lib/tk$(DIRVERSION)
++ + 
++ + # Path name to use when installing library scripts:
++ + SCRIPT_INSTALL_DIR =	$(INSTALL_ROOT)$(TK_LIBRARY)
++ + 
++ + # Directory in which to install the .a or .so binary for the Tk library:
++ + LIB_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/lib
++ + 
++ + # Directory in which to install the program wish:
++ + BIN_INSTALL_DIR =	$(INSTALL_ROOT)${exec_prefix}/bin
++ + 
++ + # Directory in which to install the include file tk.h:
++ + INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)${prefix}/include
++ + 
++ + # Directory in which to install the X11 header files.  These files are
++ + # not machine independent, so they should not go in includedir.
++ + X11_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)/usr/local/i386-mingw32/include/X11
++ + 
++ + DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
++ + 
++ + #
++ + # Project directories
++ + #
++ + # ROOT    = top of source tree
++ + #
++ + # TMPDIR  = location where .obj files should be stored during build
++ + #
++ + # TOOLS32 = location of VC++ 32-bit development tools. Note that the
++ + #	    VC++ 2.0 header files are broken, so you need to use the
++ + #	    ones that come with the developer network CD's, or later
++ + #	    versions of VC++.
++ + #
++ + # TCLDIR = location of top of Tcl source heirarchy
++ + #
++ + 
++ + ROOT	= $(srcdir)/..
++ + TMPDIR	= .
++ + TOOLS32	= c:\msdev
++ + TCLDIR	= $(srcdir)/../../tcl8.2.2
++ + 
++ + # Set this to the appropriate value of /MACHINE: for your platform
++ + MACHINE	= IX86
++ + 
++ + # Comment the following line to compile with symbols
++ + NODEBUG=1
++ + 
++ + # uncomment the following two lines to compile with TCL_MEM_DEBUG
++ + #DEBUGDEFINES	=-DTCL_MEM_DEBUG
++ + 
++ + ######################################################################
++ + # Do not modify below this line
++ + ######################################################################
++ + 
++ + TCLNAMEPREFIX = tcl
++ + TKNAMEPREFIX = tk
++ + WISHNAMEPREFIX = wish
++ + VERSION = 82
++ + DOTVERSION = 8.2
++ + 
++ + TCLSTUBPREFIX = $(TCLNAMEPREFIX)stub
++ + TKSTUBPREFIX  = $(TKNAMEPREFIX)stub
++ + 
++ + TCLLIB = lib$(TCLNAMEPREFIX)$(VERSION).a
++ + TCLSTUBLIB = lib$(TCLSTUBPREFIX)$(VERSION).a
++ + TCLLIBSA = lib$(TCLNAMEPREFIX)$(VERSION)s.a
++ + TCLPLUGINDLL = $(TCLNAMEPREFIX)$(VERSION)p.dll
++ + TCLPLUGINLIB = lib$(TCLNAMEPREFIX)$(VERSION)p.a
++ + TKDLL = $(TKNAMEPREFIX)$(VERSION).dll
++ + TKLIB = lib$(TKNAMEPREFIX)$(VERSION).a
++ + TKLIBSA = lib$(TKNAMEPREFIX)$(VERSION)s.a
++ + TKPLUGINDLL = $(TKNAMEPREFIX)$(VERSION)p.dll
++ + TKPLUGINLIB = lib$(TKNAMEPREFIX)$(VERSION)p.a
++ + TKSTUBLIB = lib$(TKSTUBPREFIX)$(VERSION).a
++ + TESTDLLNAME	= $(TKNAMEPREFIX)test$(DBGX).dll
++ + TESTDLL		= $(OUTDIR)/$(TESTDLLNAME)
++ + PTESTDLLNAME	= $(TKNAMEPREFIX)ptest$(DBGX).dll
++ + PTESTDLL	= $(OUTDIR)/$(PTESTDLLNAME)
++ + SQUAREDLLNAME	= $(TKNAMEPREFIX)square$(DBGX).dll
++ + SQUAREDLL	= $(OUTDIR)/$(SQUAREDLLNAME)
++ + 
++ + WISH = wish$(VERSION).exe
++ + WISHSA = wish$(VERSION)s.exe
++ + WISHP = wishp$(VERSION).exe
++ + TKTEST = tktest.exe
++ + DUMPEXTS = $(TMPDIR)\dumpexts.exe
++ + 
++ + WISHOBJS = \
++ + 	$(TMPDIR)/winMain.o
++ + 
++ + WISHSAOBJS = \
++ + 	$(TMPDIR)/winMainSA.o
++ + 
++ + 
++ + TKTESTOBJS = \
++ + 	$(TMPDIR)/tkTest.o \
++ + 	$(TMPDIR)/tkSquare.o \
++ + 	$(TMPDIR)/testMain.o
++ + 
++ + XLIBOBJS = \
++ + 	$(TMPDIR)/xcolors.o \
++ + 	$(TMPDIR)/xdraw.o \
++ + 	$(TMPDIR)/xgc.o \
++ + 	$(TMPDIR)/ximage.o \
++ + 	$(TMPDIR)/xutil.o
++ + 
++ + TKOBJS = \
++ + 	$(TMPDIR)/tkConsole.o \
++ + 	$(TMPDIR)/tkMain.o \
++ + 	$(TMPDIR)/tkUnixMenubu.o \
++ + 	$(TMPDIR)/tkUnixScale.o \
++ + 	$(XLIBOBJS) \
++ + 	$(TMPDIR)/tkWin3d.o \
++ + 	$(TMPDIR)/tkWinButton.o \
++ + 	$(TMPDIR)/tkWinClipboard.o \
++ + 	$(TMPDIR)/tkWinColor.o \
++ + 	$(TMPDIR)/tkWinConfig.o \
++ + 	$(TMPDIR)/tkWinCursor.o \
++ + 	$(TMPDIR)/tkWinDialog.o \
++ + 	$(TMPDIR)/tkWinDraw.o \
++ + 	$(TMPDIR)/tkWinEmbed.o \
++ + 	$(TMPDIR)/tkWinFont.o \
++ + 	$(TMPDIR)/tkWinImage.o \
++ + 	$(TMPDIR)/tkWinInit.o \
++ + 	$(TMPDIR)/tkWinKey.o \
++ + 	$(TMPDIR)/tkWinMenu.o \
++ + 	$(TMPDIR)/tkWinPixmap.o \
++ + 	$(TMPDIR)/tkWinPointer.o \
++ + 	$(TMPDIR)/tkWinRegion.o \
++ + 	$(TMPDIR)/tkWinScrlbr.o \
++ + 	$(TMPDIR)/tkWinSend.o \
++ + 	$(TMPDIR)/tkWinWindow.o \
++ + 	$(TMPDIR)/tkWinWm.o \
++ + 	$(TMPDIR)/tkWinX.o \
++ + 	$(TMPDIR)/stubs.o \
++ + 	$(TMPDIR)/tk3d.o \
++ + 	$(TMPDIR)/tkArgv.o \
++ + 	$(TMPDIR)/tkAtom.o \
++ + 	$(TMPDIR)/tkBind.o \
++ + 	$(TMPDIR)/tkBitmap.o \
++ + 	$(TMPDIR)/tkButton.o \
++ + 	$(TMPDIR)/tkCanvArc.o \
++ + 	$(TMPDIR)/tkCanvBmap.o \
++ + 	$(TMPDIR)/tkCanvImg.o \
++ + 	$(TMPDIR)/tkCanvLine.o \
++ + 	$(TMPDIR)/tkCanvPoly.o \
++ + 	$(TMPDIR)/tkCanvPs.o \
++ + 	$(TMPDIR)/tkCanvText.o \
++ + 	$(TMPDIR)/tkCanvUtil.o \
++ + 	$(TMPDIR)/tkCanvWind.o \
++ + 	$(TMPDIR)/tkCanvas.o \
++ + 	$(TMPDIR)/tkClipboard.o \
++ + 	$(TMPDIR)/tkCmds.o \
++ + 	$(TMPDIR)/tkColor.o \
++ + 	$(TMPDIR)/tkConfig.o \
++ + 	$(TMPDIR)/tkCursor.o \
++ + 	$(TMPDIR)/tkEntry.o \
++ + 	$(TMPDIR)/tkError.o \
++ + 	$(TMPDIR)/tkEvent.o \
++ + 	$(TMPDIR)/tkFileFilter.o \
++ + 	$(TMPDIR)/tkFocus.o \
++ + 	$(TMPDIR)/tkFont.o \
++ + 	$(TMPDIR)/tkFrame.o \
++ + 	$(TMPDIR)/tkGC.o \
++ + 	$(TMPDIR)/tkGeometry.o \
++ + 	$(TMPDIR)/tkGet.o \
++ + 	$(TMPDIR)/tkGrab.o \
++ + 	$(TMPDIR)/tkGrid.o \
++ + 	$(TMPDIR)/tkImage.o \
++ + 	$(TMPDIR)/tkImgBmap.o \
++ + 	$(TMPDIR)/tkImgGIF.o \
++ + 	$(TMPDIR)/tkImgPPM.o \
++ + 	$(TMPDIR)/tkImgPhoto.o \
++ + 	$(TMPDIR)/tkImgUtil.o \
++ + 	$(TMPDIR)/tkListbox.o \
++ + 	$(TMPDIR)/tkMacWinMenu.o \
++ + 	$(TMPDIR)/tkMenu.o \
++ + 	$(TMPDIR)/tkMenubutton.o \
++ + 	$(TMPDIR)/tkMenuDraw.o \
++ + 	$(TMPDIR)/tkMessage.o \
++ + 	$(TMPDIR)/tkObj.o \
++ + 	$(TMPDIR)/tkOldConfig.o \
++ + 	$(TMPDIR)/tkOption.o \
++ + 	$(TMPDIR)/tkPack.o \
++ + 	$(TMPDIR)/tkPlace.o \
++ + 	$(TMPDIR)/tkPointer.o \
++ + 	$(TMPDIR)/tkRectOval.o \
++ + 	$(TMPDIR)/tkScale.o \
++ + 	$(TMPDIR)/tkScrollbar.o \
++ + 	$(TMPDIR)/tkSelect.o \
++ + 	$(TMPDIR)/tkText.o \
++ + 	$(TMPDIR)/tkTextBTree.o \
++ + 	$(TMPDIR)/tkTextDisp.o \
++ + 	$(TMPDIR)/tkTextImage.o \
++ + 	$(TMPDIR)/tkTextIndex.o \
++ + 	$(TMPDIR)/tkTextMark.o \
++ + 	$(TMPDIR)/tkTextTag.o \
++ + 	$(TMPDIR)/tkTextWind.o \
++ + 	$(TMPDIR)/tkTrig.o \
++ + 	$(TMPDIR)/tkUtil.o \
++ + 	$(TMPDIR)/tkVisual.o \
++ + 	$(TMPDIR)/tkStubInit.o \
++ + 	$(TMPDIR)/tkWindow.o
++ + 
++ + TKDLLOBJS = \
++ + 	$(TKOBJS) \
++ + 	$(TMPDIR)/tkWin32Dll.o
++ + 
++ + TKSTUBOBJS = $(TMPDIR)/tkStubLib.o
++ + 
++ + cc32		= $(TOOLS32)\bin\cl.exe
++ + link32		= $(TOOLS32)\bin\link.exe
++ + rc32		= $(TOOLS32)\bin\rc.exe
++ + include32	= -I$(TOOLS32)\include
++ + 
++ + WINDIR          = $(ROOT)/win
++ + OUTDIR		= .
++ + GENERICDIR	= $(ROOT)/generic
++ + LIBDIR		= $(ROOT)/library
++ + XLIBDIR		= $(ROOT)/xlib
++ + BITMAPDIR	= $(ROOT)/bitmaps
++ + TCLLIBDIR       = ../../tcl8.2.2/win
++ + RCDIR		= $(WINDIR)/rc
++ + 
++ + TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
++ + 			-I$(TCLDIR)/generic
++ + TK_DEFINES	= $(DEBUGDEFINES)
++ + 
++ + TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
++ + 			$(TK_INCLUDES) $(TK_DEFINES) $(CFLAGS)
++ + 
++ + ######################################################################
++ + # Link flags
++ + ######################################################################
++ + 
++ + #!IFDEF NODEBUG
++ + #ldebug = /RELEASE
++ + #!ELSE
++ + #ldebug = -debug:full -debugtype:cv
++ + #!ENDIF
++ + 
++ + # declarations common to all linker options
++ + lcommon = /NODEFAULTLIB /RELEASE /NOLOGO
++ + 
++ + # declarations for use on Intel i386, i486, and Pentium systems
++ + #!IF "$(MACHINE)" == "IX86"
++ + #DLLENTRY = @12
++ + #lflags   = $(lcommon) -align:0x1000 /MACHINE:$(MACHINE)
++ + #!ELSE
++ + #lflags   = $(lcommon) /MACHINE:$(MACHINE)
++ + #!ENDIF
++ + 
++ + conlflags = $(lflags) -Wl,--subsystem,console -mwindows
++ + guilflags = $(lflags) -mwindows
++ + dlllflags = $(lflags)
++ + 
++ + #!IF "$(MACHINE)" == "PPC"
++ + #libc = libc.lib
++ + #libcdll = crtdll.lib
++ + #!ELSE
++ + #libc = libc.lib oldnames.lib
++ + #libcdll = msvcrt.lib oldnames.lib
++ + #!ENDIF
++ + 
++ + baselibs   = -lkernel32 $(optlibs) -ladvapi32
++ + winlibs    = $(baselibs) -luser32 -lgdi32 -lcomdlg32 -lwinspool
++ + guilibs	   = $(libc) $(winlibs)
++ + 
++ + guilibsdll = $(libcdll) $(winlibs)
++ + 
++ + ######################################################################
++ + # Compile flags
++ + ######################################################################
++ + 
++ + #!IFDEF NODEBUG
++ + #cdebug = -Ox
++ + #!ELSE
++ + #cdebug = -Z7 -Od -WX
++ + #!ENDIF
++ + 
++ + # declarations common to all compiler options
++ + #ccommon = -c -W3 -nologo -YX
++ + 
++ + #!IF "$(MACHINE)" == "IX86"
++ + #cflags = $(ccommon) -D_X86_=1
++ + #!ELSE
++ + #!IF "$(MACHINE)" == "MIPS"
++ + #cflags = $(ccommon) -D_MIPS_=1
++ + #!ELSE
++ + #!IF "$(MACHINE)" == "PPC"
++ + #cflags = $(ccommon) -D_PPC_=1
++ + #!ELSE
++ + #!IF "$(MACHINE)" == "ALPHA"
++ + #cflags = $(ccommon) -D_ALPHA_=1
++ + #!ENDIF
++ + #!ENDIF
++ + #!ENDIF
++ + #!ENDIF
++ + 
++ + cvars      = -DWIN32 -D_WIN32 -D__WIN32__
++ + cvarsmt    = $(cvars) -D_MT
++ + cvarsdll   = $(cvarsmt) -D_DLL
++ + 
++ + CON_CFLAGS	= $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
++ + 
++ + ######################################################################
++ + # Project specific targets
++ + ######################################################################
++ + 
++ + all:    $(WISH) $(TKLIBSA) $(TKSTUBLIB)
++ + tktest:	$(WISH) $(TESTDLL) $(PTESTDLL) $(SQUAREDLL)
++ + 
++ + install: install-binaries install-libraries install-demos
++ + 
++ + install-binaries: $(TKDLL) $(TKLIB) $(WISH)
++ + 	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
++ + 	    do \
++ + 	    if [ ! -d $$i ] ; then \
++ + 		echo "Making directory $$i"; \
++ + 		mkdir $$i; \
++ + 		chmod 755 $$i; \
++ + 		else true; \
++ + 		fi; \
++ + 	    done;
++ + 	@echo "Installing $(TKLIB)"
++ + 	@$(INSTALL_DATA) $(TKLIB) $(LIB_INSTALL_DIR)/$(TKLIB)
++ + 	@chmod 555 $(LIB_INSTALL_DIR)/$(TKLIB)
++ + 	@echo "Installing wish"
++ + 	@$(INSTALL_PROGRAM) $(WISH) $(BIN_INSTALL_DIR)/$(WISH)
++ + 	@echo "Installing tkConfig.sh"
++ + 	@$(INSTALL_DATA) ../unix/tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
++ + 
++ + install-libraries:
++ + 	@echo "Installing DLL"
++ + 	@$(INSTALL_DATA) $(TKDLL) $(BIN_INSTALL_DIR)/$(TKDLL)
++ + 	@for i in $(INSTALL_ROOT)${prefix}/lib $(INCLUDE_INSTALL_DIR) \
++ + 		$(SCRIPT_INSTALL_DIR) $(INSTALL_ROOT)/usr/local \
++ + 		$(INSTALL_ROOT)/usr/local/i386-mingw32 \
++ + 		$(INSTALL_ROOT)/usr/local/i386-mingw32/include \
++ + 		$(X11_INCLUDE_INSTALL_DIR) ; \
++ + 	    do \
++ + 	    if [ ! -d $$i ] ; then \
++ + 		echo "Making directory $$i"; \
++ + 		mkdir $$i; \
++ + 		chmod 755 $$i; \
++ + 		else true; \
++ + 		fi; \
++ + 	    done;
++ + 	@echo "Installing tk.h"
++ + 	@$(INSTALL_DATA) $(GENERICDIR)/tk.h $(INCLUDE_INSTALL_DIR)/tk.h
++ + 	for i in $(XLIBDIR)/X11/*.h; \
++ + 	    do \
++ + 	    echo "Installing $$i"; \
++ + 	    $(INSTALL_DATA) $$i $(X11_INCLUDE_INSTALL_DIR); \
++ + 	    done;
++ + 	for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(ROOT)/library/prolog.ps $(ROOT)/unix/tkAppInit.c; \
++ + 	    do \
++ + 	    echo "Installing $$i"; \
++ + 	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
++ + 	    done;
++ + 
++ + install-minimal:
++ + 	@echo "Installing DLL"
++ + 	@$(INSTALL_DATA) $(TKDLL) $(BIN_INSTALL_DIR)/$(TKDLL)
++ + 	@for i in $(INSTALL_ROOT)${prefix}/lib $(SCRIPT_INSTALL_DIR) ; \
++ + 	    do \
++ + 	    if [ ! -d $$i ] ; then \
++ + 		echo "Making directory $$i"; \
++ + 		mkdir $$i; \
++ + 		chmod 755 $$i; \
++ + 		else true; \
++ + 		fi; \
++ + 	    done;
++ + 	for i in $(ROOT)/library/*.tcl $(ROOT)/library/tclIndex $(ROOT)/library/prolog.ps; \
++ + 	    do \
++ + 	    echo "Installing $$i"; \
++ + 	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
++ + 	    done;
++ + 
++ + install-demos:
++ + 	@for i in $(INSTALL_ROOT)${prefix}/lib $(SCRIPT_INSTALL_DIR) \
++ + 		$(SCRIPT_INSTALL_DIR)/demos \
++ + 		$(SCRIPT_INSTALL_DIR)/demos/images ; \
++ + 	    do \
++ + 	    if [ ! -d $$i ] ; then \
++ + 		echo "Making directory $$i"; \
++ + 		mkdir $$i; \
++ + 		chmod 755 $$i; \
++ + 		else true; \
++ + 		fi; \
++ + 	    done;
++ + 	@for i in $(ROOT)/library/demos/*; \
++ + 	    do \
++ + 	    if [ -f $$i ] ; then \
++ + 		echo "Installing $$i"; \
++ + 		sed -e '3 s|exec wish|exec $(WISH)|' \
++ + 			$$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
++ + 	    fi; \
++ + 	    done;
++ + 	@for i in $(DEMOPROGS); \
++ + 	    do \
++ + 	    chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
++ + 	    done;
++ + 	@for i in $(ROOT)/library/demos/images/*; \
++ + 	    do \
++ + 	    if [ -f $$i ] ; then \
++ + 		echo "Installing $$i"; \
++ + 		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
++ + 		fi; \
++ + 	    done;
++ + 
++ + $(TKLIBSA): $(TKOBJS) $(TKSTUBOBJS)
++ + 	$(AR) cr $(TKLIBSA) $(TKOBJS) $(TKSTUBOBJS)
++ + 
++ + $(TKSTUBLIB): $(TKSTUBOBJS)
++ + 	$(AR) cr $(TKSTUBLIB) $(TKSTUBOBJS)
++ + 
++ + $(TKDLL): $(TKDLLOBJS) tkres.o tk.def
++ + 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ $(TKDLLOBJS) \
++ + 	  --def tk.def tkres.o \
++ + 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(DLL_LDLIBS)
++ + 
++ + $(TKLIB): $(TMPDIR)/tk.def $(TKDLL)
++ + 	$(DLLTOOL) --as=$(AS) --dllname $(TKDLL) --def $(TMPDIR)/tk.def \
++ + 	  --output-lib $(TKLIB)
++ + 
++ + $(TKPLUGINLIB): $(TMPDIR)/plugin.def
++ + 	$(DLLTOOL) --as=$(AS) --dllname $(TKPLUGINDLL) \
++ + 	  --def $(TMPDIR)/plugin.def --output-lib $(TKPLUGINLIB)
++ + 
++ + $(TKPLUGINDLL): $(TKOBJS) tkres.o $(TMPDIR)/plugin.def
++ + 	$(DLLWRAP) $(DLL_LDFLAGS) -o $(TKPLUGINDLL) \
++ + 	  --def plugin.def $(TKOBJS) tkres.o \
++ + 	  $(TCLDIR)/$(TCLSTUBLIB) $(DLL_LDLIBS)
++ + 
++ + 
++ + $(TESTDLL):	$(TMPDIR)/tkTest.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
++ + 	echo EXPORTS > $(TMPDIR)/tktest.def
++ + 	echo Tktest_Init >> $(TMPDIR)/tktest.def
++ + 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
++ + 	  --def $(TMPDIR)/tktest.def $(TMPDIR)/tkTest.o $(TMPDIR)/tclDllEntry.o \
++ + 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
++ + 	rm -f $(TMPDIRNAME)/tktest.def
++ + 
++ + $(PTESTDLL):	$(TMPDIR)/tkWinTest.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
++ + 	echo EXPORTS > $(TMPDIR)/tkptest.def
++ + 	echo Tkptest_Init >> $(TMPDIR)/tkptest.def
++ + 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
++ + 	  --def $(TMPDIR)/tkptest.def $(TMPDIR)/tkWinTest.o $(TMPDIR)/tclDllEntry.o \
++ + 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
++ + 	rm -f $(TMPDIRNAME)/tkptest.def
++ + 
++ + $(SQUAREDLL):	$(TMPDIR)/tkSquare.o $(TMPDIR)/tclDllEntry.o $(OUTDIR)/$(TKSTUBLIB)
++ + 	echo EXPORTS > $(TMPDIR)/square.def
++ + 	echo Tksquare_Init >> $(TMPDIR)/square.def
++ + 	$(DLLWRAP) -s $(DLL_LDFLAGS) -o $@ \
++ + 	  --def $(TMPDIR)/square.def $(TMPDIR)/tkSquare.o $(TMPDIR)/tclDllEntry.o \
++ + 	  $(TCLLIBDIR)/$(TCLSTUBLIB) $(OUTDIR)/$(TKSTUBLIB)
++ + 	rm -f $(TMPDIRNAME)/square.def
++ + 
++ + 
++ + 
++ + $(WISH): $(WISHOBJS) wishres.o $(TKLIB)
++ + 	$(CC) -mno-cygwin $(ldebug) $(guilflags) $(WISHOBJS) wishres.o -o $@ \
++ + 		$(TKLIB) $(TCLLIBDIR)/$(TCLLIB) $(guilibsdll)
++ + 	strip $(WISH)
++ + 
++ + $(WISHP): $(WISHOBJS) $(TKPLUGINLIB) wishres.o
++ + 	$(CC) -mno-cygwin $(ldebug) $(guilflags) $(WISHOBJS) wishres.o -o $@ \
++ + 		$(TKPLUGINLIB) $(TCLLIBDIR)/$(TCLPLUGINLIB) $(guilibsdll)
++ + 
++ + tk.def: $(TKDLLOBJS)
++ + 	$(DLLTOOL) --export-all --exclude-symbols DllMain@12 --output-def $@ $(TKDLLOBJS)
++ + 
++ + plugin.def: $(TKDLLOBJS)
++ + 	$(DLLTOOL) --export-all --exclude-symbols DllMain@12 --output-def $@ $(TKDLLOBJS)
++ + 
++ + $(DUMPEXTS): $(TCLDIR)\win\winDumpExts.c
++ + 	$(cc32) $(CON_CFLAGS) -Fo$(TMPDIR)\ $?
++ + 	set LIB=$(TOOLS32)\lib
++ + 	$(link32) $(ldebug) $(conlflags) $(guilibs) -out:$@ \
++ + 		$(TMPDIR)\winDumpExts.obj 
++ + 
++ + $(TMPDIR)/tkTest.o: $(GENERICDIR)/tkTest.c
++ + 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS -DNO_PLATFORM_TEST $(GENERICDIR)/tkTest.c
++ + 
++ + $(TMPDIR)/tkSquare.o: $(GENERICDIR)/tkSquare.c
++ + 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS $(GENERICDIR)/tkSquare.c
++ + 
++ + $(TMPDIR)/tkWinTest.o: $(WINDIR)/tkWinTest.c
++ + 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS -DUSE_TK_STUBS $(WINDIR)/tkWinTest.c
++ + 
++ + $(TMPDIR)/winMain.o: $(TMPDIR)/winMain.c
++ + 	$(CC) -c $(TK_CFLAGS) $(TMPDIR)/winMain.c
++ + 
++ + 
++ + #
++ + # Implicit rules
++ + #
++ + 
++ + .c.o:
++ + 	$(CC) -c $(TK_CFLAGS) -DUSE_TCL_STUBS $<
++ + 
++ + tkres.o: $(ROOT)/win/rc/tk.rc
++ + 	$(WINDRES) --include $(ROOT)/win/rc --include $(ROOT)/generic --include $(TCLDIR)/generic \
++ + 	  --define VS_VERSION_INFO=1 $(ROOT)/win/rc/tk.rc tkres.o
++ + 
++ + wishres.o: $(ROOT)/win/rc/wish.rc
++ + 	$(WINDRES) --include $(ROOT)/win/rc --include $(ROOT)/generic --include $(TCLDIR)/generic \
++ + 	  --define VS_VERSION_INFO=1 $(ROOT)/win/rc/wish.rc wishres.o
++ + 
++ + #{$(ROOT)\win\rc}.rc{$(TMPDIR)}.res:
++ + #	$(rc32) -fo $@ -r -i $(ROOT)\generic $<
++ + 
++ + clean:
++ + 	rm -f *.exp *.a *.dll *.exe $(TMPDIR)/*.o *.res *.def
++ + 	rm -f tk.base tkplugin.base
++ + 
++ + # dependencies
++ + 
++ + $(TMPDIR)/tk.res: \
++ +     $(RCDIR)/buttons.bmp \
++ +     $(RCDIR)/cursor*.cur \
++ +     $(RCDIR)/tk.ico
++ + 
++ + $(GENERICDIR)/default.h: $(WINDIR)/tkWinDefault.h
++ + $(GENERICDIR)/tkButton.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkCanvas.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkEntry.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkFrame.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkListbox.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkMenu.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkMenubutton.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkMessage.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkScale.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkScrollbar.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkText.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/default.h
++ + $(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/default.h
++ + 
++ + $(GENERICDIR)/tkText.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextBTree.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextImage.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextMark.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/tkText.h
++ + $(GENERICDIR)/tkTextWind.c: $(GENERICDIR)/tkText.h
++ + 
++ + $(GENERICDIR)/tkMacWinMenu.c: $(GENERICDIR)/tkMenu.h
++ + $(GENERICDIR)/tkMenu.c: $(GENERICDIR)/tkMenu.h
++ + $(GENERICDIR)/tkMenuDraw.c: $(GENERICDIR)/tkMenu.h
++ + $(WINDIR)/tkWinMenu.c: $(GENERICDIR)/tkMenu.h
++ + 
++ *** win/aclocal.m4.orig	Thu Nov  4 03:38:50 1999
++ --- win/aclocal.m4	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 346,366 ****
++       # set various compiler flags depending on whether we are using gcc or cl
++       
++       if test "${GCC}" = "yes" ; then
++ ! 	CFLAGS_DEBUG=-g
++ ! 	CFLAGS_OPTIMIZE=-O
++ ! 	CFLAGS_WARNING="-Wall -Wconversion"
++ ! 	LDFLAGS_DEBUG=-g
++ ! 	LDFLAGS_OPTIMIZE=-O
++ ! 	PATHTYPE=-u
++   	
++   	# Specify the CC output file names based on the target name
++ ! 	CC_OBJNAME="-o \[$]@"
++ ! 	CC_EXENAME="-o \[$]@"
++       else
++   	SHLIB_LD="link -dll -nologo"
++   	SHLIB_LD_LIBS="user32.lib advapi32.lib"
++   	LIBS="user32.lib advapi32.lib"
++   	AR="lib -nologo"
++   	RC="rc"
++   	MAKE_LIB="\${AR} -out:\[$]@"
++   	MAKE_EXE="\${CC} -Fe\[$]@"
++ --- 346,401 ----
++       # set various compiler flags depending on whether we are using gcc or cl
++       
++       if test "${GCC}" = "yes" ; then
++ ! 	SHLIB_LD="dllwrap"
++ ! 	SHLIB_LD_LIBS="-luser32 -ladvapi32"
++ ! 	LIBS="user32.lib advapi32.lib"
++ ! 	AR="ar cf"
++ ! 	RC="winres"
++ ! 	MAKE_LIB="\${AR} \[$]@"
++ ! 	MAKE_EXE="\${CC} -Fe\[$]@"
++ ! 	
++ ! 	if test "${SHARED_BUILD}" = "0" ; then
++ ! 	    # static
++ !             AC_MSG_RESULT([using static flags])
++ ! 	    runtime=-MT
++ ! 	    MAKE_DLL="echo "
++ ! 	    LIBSUFFIX="s\${DBGX}.a"
++ ! 	    LIBRARIES="\${STATIC_LIBRARIES}"
++ ! 	    EXESUFFIX="s\${DBGX}.exe"
++ ! 	    DLLSUFFIX=""
++ ! 	else
++ ! 	    # dynamic
++ !             AC_MSG_RESULT([using shared flags])
++ ! 	    runtime=-MD
++ ! 	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\[$]@"
++ ! 	    LIBSUFFIX="\${DBGX}.a"
++ ! 	    DLLSUFFIX="\${DBGX}.dll"
++ ! 	    EXESUFFIX="\${DBGX}.exe"
++ ! 	    LIBRARIES="\${SHARED_LIBRARIES}"
++ ! 	fi
++ ! 
++ ! 	EXTRA_CFLAGS="-YX"
++ ! 	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
++ ! 	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
++ ! 	CFLAGS_WARNING="-W3"
++ ! 	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
++ ! 	LDFLAGS_OPTIMIZE="-release"
++ ! 	PATHTYPE=-w
++   	
++   	# Specify the CC output file names based on the target name
++ ! 	CC_OBJNAME="-Fo\[$]@"
++ ! 	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\[$]@')\""
++ ! 
++ ! 	# Specify linker flags depending on the type of app being 
++ ! 	# built -- Console vs. Window.
++ ! 	LDFLAGS_CONSOLE="-subsystem:console"
++ ! 	LDFLAGS_WINDOW="-subsystem:windows"
++       else
++   	SHLIB_LD="link -dll -nologo"
++   	SHLIB_LD_LIBS="user32.lib advapi32.lib"
++   	LIBS="user32.lib advapi32.lib"
++   	AR="lib -nologo"
++ + 	STLIB_LD="lib -nologo"
++   	RC="rc"
++   	MAKE_LIB="\${AR} -out:\[$]@"
++   	MAKE_EXE="\${CC} -Fe\[$]@"
++ *** win/configure.orig	Thu Nov  4 03:38:50 1999
++ --- win/configure	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 1022,1042 ****
++       # set various compiler flags depending on whether we are using gcc or cl
++       
++       if test "${GCC}" = "yes" ; then
++ ! 	CFLAGS_DEBUG=-g
++ ! 	CFLAGS_OPTIMIZE=-O
++ ! 	CFLAGS_WARNING="-Wall -Wconversion"
++ ! 	LDFLAGS_DEBUG=-g
++ ! 	LDFLAGS_OPTIMIZE=-O
++ ! 	PATHTYPE=-u
++   	
++   	# Specify the CC output file names based on the target name
++ ! 	CC_OBJNAME="-o \$@"
++ ! 	CC_EXENAME="-o \$@"
++       else
++   	SHLIB_LD="link -dll -nologo"
++   	SHLIB_LD_LIBS="user32.lib advapi32.lib"
++   	LIBS="user32.lib advapi32.lib"
++   	AR="lib -nologo"
++   	RC="rc"
++   	MAKE_LIB="\${AR} -out:\$@"
++   	MAKE_EXE="\${CC} -Fe\$@"
++ --- 1022,1077 ----
++       # set various compiler flags depending on whether we are using gcc or cl
++       
++       if test "${GCC}" = "yes" ; then
++ ! 	SHLIB_LD="dllwrap"
++ ! 	SHLIB_LD_LIBS="-luser32 -ladvapi32"
++ ! 	LIBS="user32.lib advapi32.lib"
++ ! 	AR="ar cf"
++ ! 	RC="winres"
++ ! 	MAKE_LIB="\${AR} \$@"
++ ! 	MAKE_EXE="\${CC} -Fe\$@"
++ ! 	
++ ! 	if test "${SHARED_BUILD}" = "0" ; then
++ ! 	    # static
++ !             echo "$ac_t""using static flags" 1>&6
++ ! 	    runtime=-MT
++ ! 	    MAKE_DLL="echo "
++ ! 	    LIBSUFFIX="s\${DBGX}.a"
++ ! 	    LIBRARIES="\${STATIC_LIBRARIES}"
++ ! 	    EXESUFFIX="s\${DBGX}.exe"
++ ! 	    DLLSUFFIX=""
++ ! 	else
++ ! 	    # dynamic
++ !             echo "$ac_t""using shared flags" 1>&6
++ ! 	    runtime=-MD
++ ! 	    MAKE_DLL="\${SHLIB_LD} \${SHLIB_LD_LIBS} \$(LDFLAGS) -out:\$@"
++ ! 	    LIBSUFFIX="\${DBGX}.a"
++ ! 	    DLLSUFFIX="\${DBGX}.dll"
++ ! 	    EXESUFFIX="\${DBGX}.exe"
++ ! 	    LIBRARIES="\${SHARED_LIBRARIES}"
++ ! 	fi
++ ! 
++ ! 	EXTRA_CFLAGS="-YX"
++ ! 	CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
++ ! 	CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
++ ! 	CFLAGS_WARNING="-W3"
++ ! 	LDFLAGS_DEBUG="-debug:full -debugtype:cv"
++ ! 	LDFLAGS_OPTIMIZE="-release"
++ ! 	PATHTYPE=-w
++   	
++   	# Specify the CC output file names based on the target name
++ ! 	CC_OBJNAME="-Fo\$@"
++ ! 	CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\$@')\""
++ ! 
++ ! 	# Specify linker flags depending on the type of app being 
++ ! 	# built -- Console vs. Window.
++ ! 	LDFLAGS_CONSOLE="-subsystem:console"
++ ! 	LDFLAGS_WINDOW="-subsystem:windows"
++       else
++   	SHLIB_LD="link -dll -nologo"
++   	SHLIB_LD_LIBS="user32.lib advapi32.lib"
++   	LIBS="user32.lib advapi32.lib"
++   	AR="lib -nologo"
++ + 	STLIB_LD="lib -nologo"
++   	RC="rc"
++   	MAKE_LIB="\${AR} -out:\$@"
++   	MAKE_EXE="\${CC} -Fe\$@"
++ ***************
++ *** 1089,1095 ****
++   
++   
++       echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
++ ! echo "configure:1093: checking for build with symbols" >&5
++       # Check whether --enable-symbols or --disable-symbols was given.
++   if test "${enable_symbols+set}" = set; then
++     enableval="$enable_symbols"
++ --- 1124,1130 ----
++   
++   
++       echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
++ ! echo "configure:1128: checking for build with symbols" >&5
++       # Check whether --enable-symbols or --disable-symbols was given.
++   if test "${enable_symbols+set}" = set; then
++     enableval="$enable_symbols"
++ ***************
++ *** 1122,1128 ****
++   
++   
++       echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6
++ ! echo "configure:1126: checking the location of tclConfig.sh" >&5
++   
++       if test -d ../../tcl8.2$TK_PATCH_LEVEL/win;  then
++   	TCL_BIN_DIR_DEFAULT=../../tcl8.2$TK_PATCH_LEVEL/win
++ --- 1157,1163 ----
++   
++   
++       echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6
++ ! echo "configure:1161: checking the location of tclConfig.sh" >&5
++   
++       if test -d ../../tcl8.2$TK_PATCH_LEVEL/win;  then
++   	TCL_BIN_DIR_DEFAULT=../../tcl8.2$TK_PATCH_LEVEL/win
++ ***************
++ *** 1148,1154 ****
++   
++   
++       echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
++ ! echo "configure:1152: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
++   
++       if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
++           echo "$ac_t""loading" 1>&6
++ --- 1183,1189 ----
++   
++   
++       echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
++ ! echo "configure:1187: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
++   
++       if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
++           echo "$ac_t""loading" 1>&6
++ *** win/makefile.vc.orig	Sat Jul 31 04:31:57 1999
++ --- win/makefile.vc	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 1,4 ****
++ ! # Visual C++ 2.x and 4.0 makefile
++   #
++   # See the file "license.terms" for information on usage and redistribution
++   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
++ --- 1,4 ----
++ ! # Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile
++   #
++   # See the file "license.terms" for information on usage and redistribution
++   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
++ ***************
++ *** 24,45 ****
++   #
++   # TCLDIR = location of top of Tcl source heirarchy
++   #
++   
++   ROOT		= ..
++ ! TOOLS32		= c:\program files\devstudio\vc
++   TOOLS32_rc	= c:\program files\devstudio\sharedide
++ ! TCLDIR		= ..\..\tcl8.2
++   INSTALLDIR      = c:\program files\tcl
++   
++   # Set this to the appropriate value of /MACHINE: for your platform
++   MACHINE	= IX86
++   
++   # Uncomment the following line to compile with thread support
++ ! #THREADDEFINES = -DTCL_THREADS=1
++   
++   # Set NODEBUG to 0 to compile with symbols
++   NODEBUG = 1
++   
++   # uncomment the following two lines to compile with TCL_MEM_DEBUG
++   #DEBUGDEFINES	=-DTCL_MEM_DEBUG
++   
++ --- 24,56 ----
++   #
++   # TCLDIR = location of top of Tcl source heirarchy
++   #
++ + # INSTALLDIR = where the install- targets should copy the binaries and
++ + #           support files
++ + #
++   
++   ROOT		= ..
++ ! #TOOLS32 	= c:\msdev                                                 # VC++ 2.x,4.x
++ ! #TOOLS32_rc	= c:\msdev
++ ! TOOLS32		= c:\program files\devstudio\vc                            # VC++ 5.x
++   TOOLS32_rc	= c:\program files\devstudio\sharedide
++ ! #TOOLS32 	= c:\program files\microsoft visual studio\vc98            # VC++ 6.x
++ ! #TOOLS32_rc	= c:\program files\microsoft visual studio\common\msdev98
++ ! TCLDIR		= ..\..\tcl8.2.2
++   INSTALLDIR      = c:\program files\tcl
++   
++   # Set this to the appropriate value of /MACHINE: for your platform
++   MACHINE	= IX86
++   
++   # Uncomment the following line to compile with thread support
++ ! THREADDEFINES = -DTCL_THREADS=1
++   
++   # Set NODEBUG to 0 to compile with symbols
++   NODEBUG = 1
++   
++ + # Set NOSTATIC to 0 to compile as static libraries
++ + NOSTATIC = 1
++ + 
++ + 
++   # uncomment the following two lines to compile with TCL_MEM_DEBUG
++   #DEBUGDEFINES	=-DTCL_MEM_DEBUG
++   
++ ***************
++ *** 58,69 ****
++   
++   
++   BINROOT		= .
++   !IF "$(NODEBUG)" == "1"
++ ! TMPDIRNAME	= Release
++ ! DBGX		=
++   !ELSE
++ ! TMPDIRNAME	= Debug
++ ! DBGX		= d
++   !ENDIF
++   TMPDIR		= $(BINROOT)\$(TMPDIRNAME)
++   OUTDIRNAME	= $(TMPDIRNAME)
++ --- 69,85 ----
++   
++   
++   BINROOT		= .
++ + !IF "$(NOSTATIC)" == "1"
++ + S		=
++ + !ELSE
++ + S		= s
++ + !ENDIF
++   !IF "$(NODEBUG)" == "1"
++ ! TMPDIRNAME	= Release$(S)
++ ! DBGX		= $(S)
++   !ELSE
++ ! TMPDIRNAME	= Debug$(S)
++ ! DBGX		= $(S)d
++   !ENDIF
++   TMPDIR		= $(BINROOT)\$(TMPDIRNAME)
++   OUTDIRNAME	= $(TMPDIRNAME)
++ ***************
++ *** 75,80 ****
++ --- 91,103 ----
++   TKDLLNAME	= $(TKNAMEPREFIX)$(VERSION)$(DBGX).dll
++   TKDLL 		= $(OUTDIR)\$(TKDLLNAME)
++   TKLIB 		= $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)$(DBGX).lib
++ + TKLIBS 		= $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)s$(DBGX).lib
++ + TESTDLLNAME	= $(TKNAMEPREFIX)test.dll
++ + TESTDLL 	= $(OUTDIR)\$(TESTDLLNAME)
++ + TKPTESTDLLNAME	= $(TKNAMEPREFIX)ptest.dll
++ + TKPTESTDLL 	= $(OUTDIR)\$(TKPTESTDLLNAME)
++ + SQUAREDLLNAME	= $(TKNAMEPREFIX)square.dll
++ + SQUAREDLL	= $(OUTDIR)\$(SQUAREDLLNAME)
++   TKSTUBLIBNAME	= $(TKSTUBPREFIX)$(VERSION)$(DBGX).lib
++   TKSTUBLIB	= $(OUTDIR)\$(TKSTUBLIBNAME)
++   TKPLUGINDLLNAME	= $(TKNAMEPREFIX)$(VERSION)p$(DBG).dll
++ ***************
++ *** 92,101 ****
++ --- 115,129 ----
++   INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include
++   LIB_INSTALL_DIR = $(INSTALLDIR)\lib
++   SCRIPT_INSTALL_DIR = $(LIB_INSTALL_DIR)\tk$(DOTVERSION)
++ + X11_INCLUDE_INSTALL_DIR = $(INCLUDE_INSTALL_DIR)\X11
++ + DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
++   
++   WISHOBJS = \
++   	$(TMPDIR)\winMain.obj
++   
++ + WISHSAOBJS = \
++ + 	$(TMPDIR)\winMainSA.obj
++ + 
++   TKTESTOBJS = \
++   	$(TMPDIR)\tkTest.obj \
++   	$(TMPDIR)\tkSquare.obj \
++ ***************
++ *** 111,121 ****
++   
++   TKOBJS = \
++   	$(TMPDIR)\tkConsole.obj \
++   	$(TMPDIR)\tkUnixMenubu.obj \
++   	$(TMPDIR)\tkUnixScale.obj \
++   	$(XLIBOBJS) \
++   	$(TMPDIR)\tkWin3d.obj \
++ - 	$(TMPDIR)\tkWin32Dll.obj \
++   	$(TMPDIR)\tkWinButton.obj \
++   	$(TMPDIR)\tkWinClipboard.obj \
++   	$(TMPDIR)\tkWinColor.obj \
++ --- 139,149 ----
++   
++   TKOBJS = \
++   	$(TMPDIR)\tkConsole.obj \
++ + 	$(TMPDIR)\tkMain.obj \
++   	$(TMPDIR)\tkUnixMenubu.obj \
++   	$(TMPDIR)\tkUnixScale.obj \
++   	$(XLIBOBJS) \
++   	$(TMPDIR)\tkWin3d.obj \
++   	$(TMPDIR)\tkWinButton.obj \
++   	$(TMPDIR)\tkWinClipboard.obj \
++   	$(TMPDIR)\tkWinColor.obj \
++ ***************
++ *** 180,186 ****
++   	$(TMPDIR)\tkImgUtil.obj \
++   	$(TMPDIR)\tkListbox.obj \
++   	$(TMPDIR)\tkMacWinMenu.obj \
++ - 	$(TMPDIR)\tkMain.obj \
++   	$(TMPDIR)\tkMenu.obj \
++   	$(TMPDIR)\tkMenubutton.obj \
++   	$(TMPDIR)\tkMenuDraw.obj \
++ --- 208,213 ----
++ ***************
++ *** 210,216 ****
++   	$(TMPDIR)\tkStubLib.obj \
++   	$(TMPDIR)\tkWindow.obj
++   
++ ! TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj \
++   
++   
++   cc32		= "$(TOOLS32)\bin\cl.exe"
++ --- 237,247 ----
++   	$(TMPDIR)\tkStubLib.obj \
++   	$(TMPDIR)\tkWindow.obj
++   
++ ! TKDLLOBJS = \
++ ! 	$(TKOBJS) \
++ ! 	$(TMPDIR)\tkWin32Dll.obj
++ ! 
++ ! TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj
++   
++   
++   cc32		= "$(TOOLS32)\bin\cl.exe"
++ ***************
++ *** 221,237 ****
++   
++   WINDIR          = $(ROOT)\win
++   GENERICDIR	= $(ROOT)\generic
++   XLIBDIR		= $(ROOT)\xlib
++   BITMAPDIR	= $(ROOT)\bitmaps
++   TCLLIBDIR       = $(TCLDIR)\win\$(OUTDIRNAME)
++   RCDIR		= $(WINDIR)\rc
++   
++   TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
++   			-I$(TCLDIR)\generic
++   TK_DEFINES	= -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
++   
++   TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
++ ! 			$(TK_INCLUDES) $(TK_DEFINES) -DUSE_TCL_STUBS
++   
++   WISH_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
++   			$(TK_INCLUDES) $(TK_DEFINES)
++ --- 252,275 ----
++   
++   WINDIR          = $(ROOT)\win
++   GENERICDIR	= $(ROOT)\generic
++ + LIBDIR		= $(ROOT)\library
++   XLIBDIR		= $(ROOT)\xlib
++   BITMAPDIR	= $(ROOT)\bitmaps
++   TCLLIBDIR       = $(TCLDIR)\win\$(OUTDIRNAME)
++   RCDIR		= $(WINDIR)\rc
++   
++ + !IF "$(NOSTATIC)" == "1"
++ + cstatic = -DUSE_TCL_STUBS
++ + !ELSE
++ + cstatic =
++ + !ENDIF
++ + 
++   TK_INCLUDES	= -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
++   			-I$(TCLDIR)\generic
++   TK_DEFINES	= -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES)
++   
++   TK_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
++ ! 			$(TK_INCLUDES) $(TK_DEFINES) $(cstatic)
++   
++   WISH_CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
++   			$(TK_INCLUDES) $(TK_DEFINES)
++ ***************
++ *** 280,292 ****
++   ######################################################################
++   
++   !IF "$(NODEBUG)" == "1"
++ ! !IF "$(MACHINE)" == "ALPHA"
++ ! # MSVC on Alpha doesn't understand -Ot
++ ! cdebug = -O2i -Gs -GD
++ ! !ELSE
++ ! # NOTE: Due to a bug in MSVC, we cannot use -O2 here or Tk starts to misbehave.
++ ! cdebug = -Oti -Gs -GD
++ ! !ENDIF
++   !ELSE
++   cdebug = -Z7 -Od -WX
++   !ENDIF
++ --- 318,324 ----
++   ######################################################################
++   
++   !IF "$(NODEBUG)" == "1"
++ ! cdebug = -Ox -Oy- -GD
++   !ELSE
++   cdebug = -Z7 -Od -WX
++   !ENDIF
++ ***************
++ *** 326,332 ****
++   # Project specific targets
++   ######################################################################
++   
++ ! all:    setup $(WISH) $(CAT32)
++   install: install-binaries install-libraries
++   plugin:	setup $(TKPLUGINDLL) $(WISHP)
++   tktest: setup $(TKTEST) $(CAT32)
++ --- 358,364 ----
++   # Project specific targets
++   ######################################################################
++   
++ ! all:    setup $(WISH) $(TKLIBS) $(CAT32)
++   install: install-binaries install-libraries
++   plugin:	setup $(TKPLUGINDLL) $(WISHP)
++   tktest: setup $(TKTEST) $(CAT32)
++ ***************
++ *** 355,362 ****
++ --- 387,396 ----
++   	@mkd "$(BIN_INSTALL_DIR)"
++   	copy $(TKDLL) "$(BIN_INSTALL_DIR)"
++   	copy $(WISH) "$(BIN_INSTALL_DIR)"
++ + 	-copy $(WISHSA) "$(BIN_INSTALL_DIR)"
++   	@mkd "$(LIB_INSTALL_DIR)"
++   	copy $(TKLIB) "$(LIB_INSTALL_DIR)"
++ + 	copy $(TKLIBS) "$(LIB_INSTALL_DIR)"
++   
++   install-libraries:
++   	@mkd "$(INCLUDE_INSTALL_DIR)"
++ ***************
++ *** 379,390 ****
++   $(TKSTUBLIB): $(TKSTUBOBJS)
++           $(lib32) /out:$@ $(TKSTUBOBJS)
++   
++ ! $(TKDLL): $(TKOBJS) $(TMPDIR)\tk.res $(TMPDIR)\tk.def
++   	set LIB=$(TOOLS32)\lib
++          $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \
++   		-out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLSTUBLIB) \
++   		$(guilibsdll) @<<
++ ! 			$(TKOBJS)
++   <<
++   
++   $(TKPLUGINLIB): $(TKPLUGINDLL)
++ --- 413,430 ----
++   $(TKSTUBLIB): $(TKSTUBOBJS)
++           $(lib32) /out:$@ $(TKSTUBOBJS)
++   
++ ! $(TKDLL): $(TKDLLOBJS) $(TMPDIR)\tk.res $(TMPDIR)\tk.def
++   	set LIB=$(TOOLS32)\lib
++          $(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tk.def \
++   		-out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLSTUBLIB) \
++   		$(guilibsdll) @<<
++ ! 			$(TKDLLOBJS)
++ ! <<
++ ! 
++ ! $(TKLIBS): $(TKOBJS)
++ !       @del $(TKLIBS)
++ !         $(lib32) -out:$(TKLIBS) @<<
++ !                $(TKOBJS)
++   <<
++   
++   $(TKPLUGINLIB): $(TKPLUGINDLL)
++ ***************
++ *** 413,428 ****
++   		$(guilibsdll) $(TCLLIBDIR)\$(TCLPLUGINLIB) \
++   		$(TKPLUGINLIB) $(WISHOBJS) 
++   
++ ! $(TKTEST): $(TKTESTOBJS) $(TKLIB) $(TMPDIR)\wish.res
++   	set LIB=$(TOOLS32)\lib
++ ! 	$(link32) $(ldebug) $(guilflags) $(TMPDIR)\wish.res -out:$@ \
++ ! 		$(guilibsdll) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB) $(TKTESTOBJS)
++   
++   $(TMPDIR)\tk.def: $(DUMPEXTS) $(TKOBJS)
++   	$(DUMPEXTS) -o $@ $(TKDLLNAME) @<<
++   		$(TKOBJS)
++   <<
++   
++   $(TMPDIR)\plugin.def: $(DUMPEXTS) $(TKOBJS)
++   	$(DUMPEXTS) -o $@ $(TKPLUGINDLLNAME) @<<
++   		$(TKOBJS)
++ --- 453,503 ----
++   		$(guilibsdll) $(TCLLIBDIR)\$(TCLPLUGINLIB) \
++   		$(TKPLUGINLIB) $(WISHOBJS) 
++   
++ ! $(TESTDLL): $(TMPDIR)\tkTest.obj $(TMPDIR)\tkWinDllEntry.obj $(TKLIB) $(TCLLIBDIR)\$(TCLLIB) $(TMPDIR)\tktest.def
++   	set LIB=$(TOOLS32)\lib
++ ! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tktest.def \
++ ! 		-out:$@ $(TKLIB) $(TCLLIBDIR)\$(TCLLIB) \
++ ! 		$(guilibsdll) @<<
++ ! 			$(TMPDIR)\tkTest.obj $(TMPDIR)\tkWinDllEntry.obj
++ ! <<
++ ! 
++ ! $(TKPTESTDLL): $(TMPDIR)\tkWinTest.obj $(TMPDIR)\tkWinDllEntry.obj $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) $(TMPDIR)\tkptest.def
++ ! 	set LIB=$(TOOLS32)\lib
++ ! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tkptest.def \
++ ! 		-out:$@ $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) \
++ ! 		$(guilibsdll) @<<
++ ! 			$(TMPDIR)\tkWinTest.obj $(TMPDIR)\tkWinDllEntry.obj
++ ! <<
++ ! 
++ ! $(SQUAREDLL): $(TMPDIR)\tkSquare.obj $(TMPDIR)\tkWinDllEntry.obj $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) $(TMPDIR)\tksquare.def
++ ! 	set LIB=$(TOOLS32)\lib
++ ! 	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\tksquare.def \
++ ! 		-out:$@ $(TKSTUBLIB) $(TCLLIBDIR)\$(TCLSTUBLIB) \
++ ! 		$(guilibsdll) @<<
++ ! 			$(TMPDIR)\tkSquare.obj $(TMPDIR)\tkWinDllEntry.obj
++ ! <<
++ ! 
++   
++   $(TMPDIR)\tk.def: $(DUMPEXTS) $(TKOBJS)
++   	$(DUMPEXTS) -o $@ $(TKDLLNAME) @<<
++   		$(TKOBJS)
++   <<
++   
++ + $(TMPDIR)\tktest.def: $(DUMPEXTS) $(TMPDIR)\tkTest.obj
++ + 	$(DUMPEXTS) -o $@ $(TESTDLLNAME) @<<
++ + 		$(TMPDIR)\tkTest.obj
++ + <<
++ + 
++ + $(TMPDIR)\tkptest.def: $(DUMPEXTS) $(TMPDIR)\tkWinTest.obj
++ + 	$(DUMPEXTS) -o $@ $(TESTDLLNAME) @<<
++ + 		$(TMPDIR)\tkWinTest.obj
++ + <<
++ + 
++ + $(TMPDIR)\tksquare.def: $(DUMPEXTS) $(TMPDIR)\tkSquare.obj
++ + 	$(DUMPEXTS) -o $@ $(SQUAREDLLNAME) @<<
++ + 		$(TMPDIR)\tkSquare.obj
++ + <<
++ + 
++   $(TMPDIR)\plugin.def: $(DUMPEXTS) $(TKOBJS)
++   	$(DUMPEXTS) -o $@ $(TKPLUGINDLLNAME) @<<
++   		$(TKOBJS)
++ ***************
++ *** 451,464 ****
++   # Special case object file targets
++   #
++   
++ - $(TMPDIR)\testMain.obj: $(ROOT)\win\winMain.c
++ - 	$(cc32) $(WISH_CFLAGS) -DTK_TEST -Fo$@ $?
++ - 
++   $(TMPDIR)\tkTest.obj: $(ROOT)\generic\tkTest.c
++ ! 	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
++   
++   $(TMPDIR)\tkSquare.obj: $(ROOT)\generic\tkSquare.c
++ ! 	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
++   
++   $(TMPDIR)\winMain.obj: $(ROOT)\win\winMain.c
++   	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
++ --- 526,539 ----
++   # Special case object file targets
++   #
++   
++   $(TMPDIR)\tkTest.obj: $(ROOT)\generic\tkTest.c
++ ! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
++ ! 
++ ! $(TMPDIR)\tkWinTest.obj: $(ROOT)\win\tkWinTest.c
++ ! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
++   
++   $(TMPDIR)\tkSquare.obj: $(ROOT)\generic\tkSquare.c
++ ! 	$(cc32) $(TK_CFLAGS) -DUSE_TK_STUBS -Fo$@ $?
++   
++   $(TMPDIR)\winMain.obj: $(ROOT)\win\winMain.c
++   	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
++ ***************
++ *** 471,486 ****
++   #
++   
++   {$(XLIBDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
++   
++   {$(GENERICDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
++   
++   {$(WINDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
++   
++   {$(ROOT)\unix}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -Fo$(TMPDIR)\ $<
++   
++   {$(RCDIR)}.rc{$(TMPDIR)}.res:
++   	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TOOLS32)\include" \
++ --- 546,561 ----
++   #
++   
++   {$(XLIBDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
++   
++   {$(GENERICDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
++   
++   {$(WINDIR)}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
++   
++   {$(ROOT)\unix}.c{$(TMPDIR)}.obj:
++ ! 	$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -Fo$(TMPDIR)\ $<
++   
++   {$(RCDIR)}.rc{$(TMPDIR)}.res:
++   	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TOOLS32)\include" \
++ *** win/pkgIndex.tk.orig	Sun Nov 14 16:27:04 1999
++ --- win/pkgIndex.tk	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,5 ----
++ + # Tcl package index file, version 1.0
++ + 
++ + if {[package vcompare [info tclversion] 8.1] < 0} return
++ + 
++ + package ifneeded Tk 8.1 [list load tk81.dll Tk]
++ *** win/pkgIndex.win.orig	Sun Nov 14 16:27:04 1999
++ --- win/pkgIndex.win	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,7 ----
++ + # Tcl package index file, version 1.0
++ + 
++ + package ifneeded Tk 8.0 [list load [file join $dir tk80.dll] Tk]
++ + package ifneeded Tksquare 8.0 [list tclPkgSetup $dir Tksquare 8.0\
++ +     {{Tksquare.dll load square}}]
++ + package ifneeded Tktest 8.0 [list tclPkgSetup $dir Tktest 8.0\
++ +     {{Tktest.dll load {testclipboard testcbind testdeleteapps testembed testmakeexist testmenubar testmetrics testprop testsend}}}]
++ *** win/tcl82plus.wse.orig	Sun Nov 14 16:27:04 1999
++ --- win/tcl82plus.wse	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,1089 ----
++ + Document Type: WSE
++ + item: Global
++ +   Version=6.0
++ +   Flags=00010100
++ +   Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ +   Japanese Font Name=MS Gothic
++ +   Japanese Font Size=10
++ +   Progress Bar DLL=%_WISE_%\Progress\WIZ%_EXE_OS_TYPE_%.DLL
++ +   Start Gradient=0 0 255
++ +   End Gradient=0 0 0
++ +   Windows Flags=00000100000000010010110000011000
++ +   Log Pathname=%MAINDIR%\INSTALL.LOG
++ +   Message Font=MS Sans Serif
++ +   Font Size=8
++ +   Disk Filename=SETUP
++ +   Patch Flags=0000000000000001
++ +   Patch Threshold=85
++ +   Patch Memory=4000
++ +   FTP Cluster Size=20
++ +   Per-User Version ID=1
++ +   Dialogs Version=6
++ +   Variable Name1=_SYS_
++ +   Variable Default1=C:\WINNT\System32
++ +   Variable Flags1=00001000
++ +   Variable Name2=_WISE_
++ +   Variable Default2=C:\Program Files\Wise
++ +   Variable Flags2=00001000
++ +   Variable Name3=_ODBC16_
++ +   Variable Default3=C:\WINNT\System32
++ +   Variable Flags3=00001000
++ +   Variable Name4=_ODBC32_
++ +   Variable Default4=C:\PROGRA~1\Wise\Runtime\ODBC30
++ +   Variable Flags4=00001000
++ + end
++ + item: Open/Close INSTALL.LOG
++ +   Flags=00000001
++ + end
++ + item: Check if File/Dir Exists
++ +   Pathname=%SYS32%
++ +   Flags=10000100
++ + end
++ + item: Set Variable
++ +   Variable=SYS32
++ +   Value=%WIN%
++ + end
++ + item: End Block
++ + end
++ + item: Set Variable
++ +   Variable=APPTITLE
++ +   Value=Tcl/Tk 8.2.2 for Windows
++ +   Flags=10000000
++ + end
++ + item: Set Variable
++ +   Variable=GROUP
++ +   Value=Tcl
++ +   Flags=10000000
++ + end
++ + item: Set Variable
++ +   Variable=DISABLED
++ +   Value=!
++ + end
++ + item: Set Variable
++ +   Variable=MAINDIR
++ +   Value=Tcl
++ +   Flags=10000000
++ + end
++ + item: Check Configuration
++ +   Flags=10111011
++ + end
++ + item: Get Registry Key Value
++ +   Variable=COMMON
++ +   Key=SOFTWARE\Microsoft\Windows\CurrentVersion
++ +   Default=C:\Program Files\Common Files
++ +   Value Name=CommonFilesDir
++ +   Flags=00000100
++ + end
++ + item: Get Registry Key Value
++ +   Variable=PROGRAM_FILES
++ +   Key=SOFTWARE\Microsoft\Windows\CurrentVersion
++ +   Default=C:\Program Files
++ +   Value Name=ProgramFilesDir
++ +   Flags=00000100
++ + end
++ + item: Set Variable
++ +   Variable=MAINDIR
++ +   Value=%PROGRAM_FILES%\%MAINDIR%
++ +   Flags=00001100
++ + end
++ + item: Set Variable
++ +   Variable=EXPLORER
++ +   Value=1
++ + end
++ + item: Else Statement
++ + end
++ + item: Set Variable
++ +   Variable=MAINDIR
++ +   Value=C:\%MAINDIR%
++ +   Flags=00001100
++ + end
++ + item: End Block
++ + end
++ + item: Set Variable
++ +   Variable=BACKUP
++ +   Value=%MAINDIR%\BACKUP
++ +   Flags=10000000
++ + end
++ + item: Set Variable
++ +   Variable=DOBACKUP
++ +   Value=B
++ +   Flags=10000000
++ + end
++ + item: Set Variable
++ +   Variable=COMPONENTS
++ +   Value=AC
++ +   Flags=10000000
++ + end
++ + item: Set Variable
++ +   Variable=BRANDING
++ +   Value=0
++ + end
++ + item: If/While Statement
++ +   Variable=BRANDING
++ +   Value=1
++ + end
++ + item: Read INI Value
++ +   Variable=NAME
++ +   Pathname=%INST%\CUSTDATA.INI
++ +   Section=Registration
++ +   Item=Name
++ + end
++ + item: Read INI Value
++ +   Variable=COMPANY
++ +   Pathname=%INST%\CUSTDATA.INI
++ +   Section=Registration
++ +   Item=Company
++ + end
++ + item: If/While Statement
++ +   Variable=NAME
++ + end
++ + item: Set Variable
++ +   Variable=DOBRAND
++ +   Value=1
++ + end
++ + item: End Block
++ + end
++ + item: End Block
++ + end
++ + item: Display Graphic
++ +   Pathname=..\..\..\Tclplus.bmp
++ +   X Position=16384
++ +   Y Position=16384
++ +   Flags=0000000000000010
++ + end
++ + item: Wizard Block
++ +   Direction Variable=DIRECTION
++ +   Display Variable=DISPLAY
++ +   Bitmap Pathname=%_WISE_%\DIALOGS\TEMPLATE\WIZARD.BMP
++ +   X Position=9
++ +   Y Position=10
++ +   Filler Color=8421440
++ +   Dialog=Select Program Manager Group
++ +   Dialog=Select Backup Directory
++ +   Dialog=Display Registration Information
++ +   Dialog=Get Registration Information
++ +   Variable=EXPLORER
++ +   Variable=DOBACKUP
++ +   Variable=DOBRAND
++ +   Variable=DOBRAND
++ +   Value=1
++ +   Value=A
++ +   Value=1
++ +   Value=1
++ +   Compare=0
++ +   Compare=1
++ +   Compare=0
++ +   Compare=1
++ +   Flags=00000011
++ + end
++ + item: Custom Dialog Set
++ +   Name=Welcome
++ +   Display Variable=DISPLAY
++ +   item: Dialog
++ +     Title=Welcome
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=172 185 214 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Next >
++ +     end
++ +     item: Push Button
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=83 8 121 33
++ +       Action=2
++ +       Enabled Color=00000000000000001111111111111111
++ +       Create Flags=01010000000000000000000000001011
++ +       Pathname=%_WISE_%\dialogs\template\install.grf
++ +     end
++ +     item: Static
++ +       Rectangle=121 10 258 44
++ +       Enabled Color=00000000000000001111111111111111
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=Welcome to %APPTITLE% Setup program. This program will install %APPTITLE% (with plus-, dash-, Img-, and elide- patch) on your computer.
++ +     end
++ +     item: Static
++ +       Rectangle=90 45 260 175
++ +       Enabled Color=00000000000000001111111111111111
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=It is strongly recommended that you exit all Windows programs before running this Setup Program.
++ +       Text=
++ +       Text=Click Cancel to quit Setup and close any programs you have running.  Click Next to continue with the Setup program.
++ +       Text=
++ +       Text=This software is provided 'as-is', without any express or implied warranty.  In no event will the author(s) be held liable for any damages arising from the use of this software.
++ +       Text=
++ +       Text=Permission is granted to anyone to use this software for any purpose, including commercial applications, and redistribute it freely.
++ +     end
++ +   end
++ + end
++ + item: Custom Dialog Set
++ +   Name=Select Destination Directory
++ +   Display Variable=DISPLAY
++ +   item: Dialog
++ +     Title=Choose Destination Location
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=172 185 214 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Next >
++ +     end
++ +     item: Push Button
++ +       Rectangle=130 185 172 199
++ +       Variable=DIRECTION
++ +       Value=B
++ +       Create Flags=01010000000000010000000000000000
++ +       Flags=0000000000000001
++ +       Text=< &Back
++ +     end
++ +     item: Push Button
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=90 10 260 122
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=Setup will install %APPTITLE% in the following folder.
++ +       Text=
++ +       Text=To install into a different folder, click Browse, and select another folder. 
++ +       Text=
++ +       Text=You can choose not to install %APPTITLE% by clicking Cancel to exit Setup.
++ +     end
++ +     item: Static
++ +       Rectangle=90 134 260 162
++ +       Action=1
++ +       Create Flags=01010000000000000000000000000111
++ +       Text=Destination Folder
++ +     end
++ +     item: Push Button
++ +       Rectangle=213 143 255 157
++ +       Variable=MAINDIR_SAVE
++ +       Value=%MAINDIR%
++ +       Destination Dialog=1
++ +       Action=2
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=B&rowse...
++ +     end
++ +     item: Static
++ +       Rectangle=95 146 211 157
++ +       Destination Dialog=2
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=%MAINDIR%
++ +     end
++ +   end
++ +   item: Dialog
++ +     Title=Select Destination Directory
++ +     Width=221
++ +     Height=173
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Listbox
++ +       Rectangle=5 2 160 149
++ +       Variable=MAINDIR
++ +       Create Flags=01010000100000010000000101000000
++ +       Flags=0000110000100010
++ +       Text=%MAINDIR%
++ +     end
++ +     item: Push Button
++ +       Rectangle=167 6 212 21
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=OK
++ +     end
++ +     item: Push Button
++ +       Rectangle=167 25 212 40
++ +       Variable=MAINDIR
++ +       Value=%MAINDIR_SAVE%
++ +       Create Flags=01010000000000010000000000000000
++ +       Flags=0000000000000001
++ +       Text=Cancel
++ +     end
++ +   end
++ + end
++ + item: Custom Dialog Set
++ +   Name=Select Components
++ +   Display Variable=DISPLAY
++ +   Flags=00000001
++ +   item: Dialog
++ +     Title=Select Components 
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=172 185 214 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Next >
++ +     end
++ +     item: Push Button
++ +       Rectangle=130 185 172 199
++ +       Variable=DIRECTION
++ +       Value=B
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=< &Back
++ +     end
++ +     item: Push Button
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=205 156 253 166
++ +       Variable=COMPONENTS
++ +       Value=MAINDIR
++ +       Create Flags=01010000000000000000000000000010
++ +     end
++ +     item: Static
++ +       Rectangle=205 148 253 157
++ +       Variable=COMPONENTS
++ +       Create Flags=01010000000000000000000000000010
++ +     end
++ +     item: Static
++ +       Rectangle=95 147 184 158
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=Disk Space Required:
++ +     end
++ +     item: Static
++ +       Rectangle=95 157 190 167
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=Disk Space Remaining:
++ +     end
++ +     item: Static
++ +       Rectangle=90 138 264 168
++ +       Action=1
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=90 8 260 41
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=In the options list below, select the checkboxes for the options that you would like to have installed.  The disk space fields reflect the requirements of the options you have selected.
++ +     end
++ +     item: Listbox
++ +       Rectangle=90 42 263 133
++ +       Variable=COMPONENTS
++ +       Create Flags=01010000101000010000000101010001
++ +       Flags=0000010001000111
++ +       Text=Windows Help
++ +       Text=Demos
++ +       Text=Development headers & stub libraries
++ +       Text=Development libraries (VC++ 5.0, no stubs)
++ +       Text=Development libraries (gcc-2.95, no stubs)
++ +       Text=
++ +       Text French=Windows Help
++ +       Text French=Demos
++ +       Text French=Development headers & stub libraries
++ +       Text French=Development libraries (VC++ 5.0, no stubs)
++ +       Text French=Static libraries (VC++ 5.0, no stubs)
++ +       Text French=
++ +       Text German=Windows Help
++ +       Text German=Demos
++ +       Text German=Development headers & stub libraries
++ +       Text German=Development libraries (VC++ 5.0, no stubs)
++ +       Text German=Static libraries (VC++ 5.0, no stubs)
++ +       Text German=
++ +       Text Spanish=Windows Help
++ +       Text Spanish=Demos
++ +       Text Spanish=Development headers & stub libraries
++ +       Text Spanish=Development libraries (VC++ 5.0, no stubs)
++ +       Text Spanish=Static libraries (VC++ 5.0, no stubs)
++ +       Text Spanish=
++ +       Text Italian=Windows Help
++ +       Text Italian=Demos
++ +       Text Italian=Development headers & stub libraries
++ +       Text Italian=Development libraries (VC++ 5.0, no stubs)
++ +       Text Italian=Static libraries (VC++ 5.0, no stubs)
++ +       Text Italian=
++ +     end
++ +   end
++ + end
++ + item: Custom Dialog Set
++ +   Name=Select Program Manager Group
++ +   Display Variable=DISPLAY
++ +   item: Dialog
++ +     Title=Select Program Manager Group
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=172 185 214 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Next >
++ +     end
++ +     item: Push Button
++ +       Rectangle=130 185 172 199
++ +       Variable=DIRECTION
++ +       Value=B
++ +       Create Flags=01010000000000010000000000000000
++ +       Flags=0000000000000001
++ +       Text=< &Back
++ +     end
++ +     item: Push Button
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=90 10 260 38
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=Enter the name of the Program Manager group to add %APPTITLE% icons to:
++ +     end
++ +     item: Combobox
++ +       Rectangle=90 42 260 148
++ +       Variable=GROUP
++ +       Create Flags=01010000001000010000001100000001
++ +       Flags=0000000000000001
++ +       Text=%GROUP%
++ +       Text=
++ +     end
++ +   end
++ + end
++ + item: Custom Dialog Set
++ +   Name=Start Installation
++ +   Display Variable=DISPLAY
++ +   item: Dialog
++ +     Title=Start Installation
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=172 185 214 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Next >
++ +     end
++ +     item: Push Button
++ +       Rectangle=130 185 172 199
++ +       Variable=DIRECTION
++ +       Value=B
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=< &Back
++ +     end
++ +     item: Push Button
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=90 10 260 70
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=You are now ready to install %APPTITLE%.
++ +       Text=
++ +       Text=Press the Next button to begin the installation or the Back button to reenter the installation information.
++ +     end
++ +   end
++ + end
++ + item: If/While Statement
++ +   Variable=DISPLAY
++ +   Value=Select Destination Directory
++ + end
++ + item: Set Variable
++ +   Variable=BACKUP
++ +   Value=%MAINDIR%\BACKUP
++ + end
++ + item: End Block
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=DOBACKUP
++ +   Value=A
++ + end
++ + item: Set Variable
++ +   Variable=BACKUPDIR
++ +   Value=%BACKUP%
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=BRANDING
++ +   Value=1
++ + end
++ + item: If/While Statement
++ +   Variable=DOBRAND
++ +   Value=1
++ + end
++ + item: Edit INI File
++ +   Pathname=%INST%\CUSTDATA.INI
++ +   Settings=[Registration]
++ +   Settings=NAME=%NAME%
++ +   Settings=COMPANY=%COMPANY%
++ +   Settings=
++ + end
++ + item: End Block
++ + end
++ + item: End Block
++ + end
++ + item: Open/Close INSTALL.LOG
++ + end
++ + item: Include Script
++ +   Pathname=C:\Program Files\Wise\INCLUDE\Uninstal.WSE
++ + end
++ + item: Check Disk Space
++ +   Component=COMPONENTS
++ + end
++ + item: Install File
++ +   Source=c:\Winnt\system32\Msvcrt.dll
++ +   Destination=%SYS32%\MSVCRT.DLL
++ +   Flags=0000001010000011
++ + end
++ + item: If/While Statement
++ +   Variable=COMPONENTS
++ +   Value=A
++ +   Flags=00001010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\doc\Tcl82.hlp
++ +   Destination=%MAINDIR%\doc\tcl82.hlp
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\doc\Tcl82.cnt
++ +   Destination=%MAINDIR%\doc\tcl82.cnt
++ +   Flags=0000000010000010
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=COMPONENTS
++ +   Value=B
++ +   Flags=00001010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\*.tcl
++ +   Destination=%MAINDIR%\lib\tk8.2\demos
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\browse
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\browse.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\hello
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\hello.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\images\*
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\images
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\ixset
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\ixset.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\license.terms
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\license.terms
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\Readme
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\Readme
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\rmt
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\rmt.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\rolodex
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\rolodex.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\square
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\square.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\tclIndex
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\tclIndex
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\tcolor
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\tcolor.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\timer
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\timer.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\demos\widget
++ +   Destination=%MAINDIR%\lib\tk8.2\demos\widget.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=COMPONENTS
++ +   Value=C
++ +   Flags=00001010
++ + end
++ + item: Install File
++ +   Source=..\generic\tk.h
++ +   Destination=%MAINDIR%\include\tk.h
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\generic\tcl.h
++ +   Destination=%MAINDIR%\include\tcl.h
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tclstub82.lib
++ +   Destination=%MAINDIR%\lib\tclstub82.lib
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\win\Release\tkstub82.lib
++ +   Destination=%MAINDIR%\lib\tkstub82.lib
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\libtclstub82.a
++ +   Destination=%MAINDIR%\lib\libtclstub82.a
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=libtkstub82.a
++ +   Destination=%MAINDIR%\lib\libtkstub82.a
++ +   Flags=0000000010000010
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=COMPONENTS
++ +   Value=D
++ +   Flags=00001010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tcl82.lib
++ +   Destination=%MAINDIR%\lib\tcl82.lib
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\win\Release\tk82.lib
++ +   Destination=%MAINDIR%\lib\tk82.lib
++ +   Flags=0000000010000010
++ + end
++ + item: End Block
++ + end
++ + item: If/While Statement
++ +   Variable=COMPONENTS
++ +   Value=E
++ +   Flags=00001010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\libtcl82.a
++ +   Destination=%MAINDIR%\lib\libtcl82.a
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\win\libtk82.a
++ +   Destination=%MAINDIR%\lib\libtk82.a
++ +   Flags=0000000010000010
++ + end
++ + item: End Block
++ + end
++ + item: Install File
++ +   Source=..\win\Release\tk82.dll
++ +   Destination=%MAINDIR%\bin\TK82.DLL
++ +   Flags=0000000010000010
++ + end
++ + remarked item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\Tcl1682.dll
++ +   Destination=%MAINDIR%\bin\TCL1682.DLL
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\win\Release\wish82.exe
++ +   Destination=%MAINDIR%\bin\wish82.exe
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tclsh82.exe
++ +   Destination=%MAINDIR%\bin\tclsh82.exe
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tclpip82.dll
++ +   Destination=%MAINDIR%\bin\TCLPIP82.DLL
++ +   Flags=0000001010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tcl82.dll
++ +   Destination=%MAINDIR%\bin\TCL82.DLL
++ +   Flags=0000001010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\*.tcl
++ +   Destination=%MAINDIR%\lib\tcl8.2
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\http1.0\*.tcl
++ +   Destination=%MAINDIR%\lib\tcl8.2\http1.0
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\http2.1\*.tcl
++ +   Destination=%MAINDIR%\lib\tcl8.2\http2.1
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\msgcat1.0\*
++ +   Destination=%MAINDIR%\lib\tcl8.2\msgcat1.0
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\tcltest1.0\*.tcl
++ +   Destination=%MAINDIR%\lib\tcl8.2\tcltest1.0
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\encoding\*
++ +   Destination=%MAINDIR%\lib\tcl8.2\encoding
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\tclIndex
++ +   Destination=%MAINDIR%\lib\tcl8.2\tclIndex
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\license.terms
++ +   Destination=%MAINDIR%\lib\tcl8.2\license.terms
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\library\opt0.4\*.tcl
++ +   Destination=%MAINDIR%\lib\tcl8.2\opt0.4
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tclreg82.dll
++ +   Destination=%MAINDIR%\lib\tcl8.2\reg1.0\tclreg82.dll
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\pkgIndex.reg
++ +   Destination=%MAINDIR%\lib\tcl8.2\reg1.0\pkgIndex.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\Release\tcldde82.dll
++ +   Destination=%MAINDIR%\lib\tcl8.2\dde1.1\tcldde82.dll
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\..\tcl8.2.2\win\pkgIndex.dde
++ +   Destination=%MAINDIR%\lib\tcl8.2\dde1.1\pkgIndex.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\*.tcl
++ +   Destination=%MAINDIR%\lib\tk8.2
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=pkgIndex.tk
++ +   Destination=%MAINDIR%\lib\tk8.2\pkgIndex.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\focus.tcl
++ +   Destination=%MAINDIR%\lib\tk8.2\focus.tcl
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\images\*
++ +   Destination=%MAINDIR%\lib\tk8.2\images
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\license.terms
++ +   Destination=%MAINDIR%\lib\tk8.2\license.terms
++ +   Flags=0000000010000010
++ + end
++ + item: Install File
++ +   Source=..\library\tclIndex
++ +   Destination=%MAINDIR%\lib\tk8.2\tclIndex
++ +   Flags=0000000010000010
++ + end
++ + item: Set Variable
++ +   Variable=COMMON
++ +   Value=%COMMON%
++ +   Flags=00010100
++ + end
++ + item: Set Variable
++ +   Variable=MAINDIR
++ +   Value=%MAINDIR%
++ +   Flags=00010100
++ + end
++ + item: Check Configuration
++ +   Flags=10111011
++ + end
++ + item: Get Registry Key Value
++ +   Variable=STARTUPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%WIN%\Start Menu\Programs\StartUp
++ +   Value Name=StartUp
++ +   Flags=00000010
++ + end
++ + item: Get Registry Key Value
++ +   Variable=DESKTOPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%WIN%\Desktop
++ +   Value Name=Desktop
++ +   Flags=00000010
++ + end
++ + item: Get Registry Key Value
++ +   Variable=STARTMENUDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%WIN%\Start Menu
++ +   Value Name=Start Menu
++ +   Flags=00000010
++ + end
++ + item: Get Registry Key Value
++ +   Variable=GROUPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%WIN%\Start Menu\Programs
++ +   Value Name=Programs
++ +   Flags=00000010
++ + end
++ + item: Get Registry Key Value
++ +   Variable=CSTARTUPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%STARTUPDIR%
++ +   Value Name=Common Startup
++ +   Flags=00000100
++ + end
++ + item: Get Registry Key Value
++ +   Variable=CDESKTOPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%DESKTOPDIR%
++ +   Value Name=Common Desktop
++ +   Flags=00000100
++ + end
++ + item: Get Registry Key Value
++ +   Variable=CSTARTMENUDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%STARTMENUDIR%
++ +   Value Name=Common Start Menu
++ +   Flags=00000100
++ + end
++ + item: Get Registry Key Value
++ +   Variable=CGROUPDIR
++ +   Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
++ +   Default=%GROUPDIR%
++ +   Value Name=Common Programs
++ +   Flags=00000100
++ + end
++ + item: Set Variable
++ +   Variable=CGROUP_SAVE
++ +   Value=%GROUP%
++ + end
++ + item: Set Variable
++ +   Variable=GROUP
++ +   Value=%GROUPDIR%\%GROUP%
++ + end
++ + item: Create Shortcut
++ +   Source=%MAINDIR%\bin\wish82.exe
++ +   Destination=%GROUP%\Wish.lnk
++ +   Icon Number=0
++ + end
++ + item: Create Shortcut
++ +   Source=%MAINDIR%\bin\tclsh82.exe
++ +   Destination=%GROUP%\Tclsh.lnk
++ +   Icon Number=0
++ + end
++ + item: Create Shortcut
++ +   Source=%MAINDIR%\doc\tcl82.hlp
++ +   Destination=%GROUP%\Tcl Help.lnk
++ +   Icon Number=0
++ +   Key Type=1536
++ +   Flags=00000001
++ + end
++ + item: Create Shortcut
++ +   Source=%MAINDIR%\lib\tk8.2\demos\widget.tcl
++ +   Destination=%GROUP%\Demos\Widget Tour.lnk
++ +   Icon Number=0
++ +   Key Type=1536
++ +   Flags=00000001
++ + end
++ + item: Else Statement
++ + end
++ + item: Add ProgMan Icon
++ +   Group=%GROUP%
++ +   Icon Name=Wish
++ +   Command Line=%MAINDIR%\bin\wish82.exe
++ +   Flags=01000000
++ + end
++ + item: Add ProgMan Icon
++ +   Group=%GROUP%
++ +   Icon Name=Tclsh
++ +   Command Line=%MAINDIR%\bin\tclsh82.exe
++ +   Flags=01000000
++ + end
++ + item: Add ProgMan Icon
++ +   Group=%GROUP%
++ +   Icon Name=Tcl Help
++ +   Command Line=%MAINDIR%\doc\tcl82.hlp
++ +   Flags=01000000
++ + end
++ + item: Add ProgMan Icon
++ +   Group=%GROUP%
++ +   Icon Name=Widget Tour
++ +   Command Line=%MAINDIR%\lib\tk8.2\demos\widget.tcl
++ +   Flags=01000000
++ + end
++ + item: End Block
++ + end
++ + item: Self-Register OCXs/DLLs
++ +   Description=Updating System Configuration, Please Wait...
++ + end
++ + item: Edit Registry
++ +   Total Keys=7
++ +   item: Key
++ +     Key=Software\Scriptics\Tcl\8.2
++ +     New Value=%MAINDIR%
++ +     Value Name=Root
++ +     Root=2
++ +   end
++ +   item: Key
++ +     Key=TclScript\DefaultIcon
++ +     New Value=%MAINDIR%\bin\tk82.dll,0
++ +     New Value=
++ +   end
++ +   item: Key
++ +     Key=.tcl
++ +     New Value=TclScript
++ +   end
++ +   item: Key
++ +     Key=TclScript
++ +     New Value=TclScript
++ +   end
++ +   item: Key
++ +     Key=TclScript\shell\open\command
++ +     New Value=%MAINDIR%\bin\wish82.exe "%%1"
++ +   end
++ +   item: Key
++ +     Key=TclScript\shell\edit
++ +     New Value=&Edit
++ +   end
++ +   item: Key
++ +     Key=TclScript\shell\edit\command
++ +     New Value=notepad "%%1"
++ +   end
++ + end
++ + item: Custom Dialog Set
++ +   Name=Finished
++ +   Display Variable=DISPLAY
++ +   item: Dialog
++ +     Title=Installation Complete
++ +     Width=280
++ +     Height=224
++ +     Font Name=Helv
++ +     Font Size=8
++ +     item: Push Button
++ +       Rectangle=170 185 212 199
++ +       Variable=DIRECTION
++ +       Value=N
++ +       Create Flags=01010000000000010000000000000001
++ +       Text=&Finish >
++ +     end
++ +     item: Push Button
++ +       Control Name=CANCEL
++ +       Rectangle=222 185 264 199
++ +       Action=3
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=Cancel
++ +     end
++ +     item: Static
++ +       Rectangle=9 177 263 178
++ +       Action=3
++ +       Create Flags=01010000000000000000000000000111
++ +     end
++ +     item: Static
++ +       Rectangle=90 10 260 63
++ +       Enabled Color=00000000000000001111111111111111
++ +       Create Flags=01010000000000000000000000000000
++ +       Text=%APPTITLE% has been successfully installed.
++ +       Text=
++ +       Text=
++ +       Text=Press the Finish button to exit this installation.
++ +       Text=
++ +     end
++ +     item: Push Button
++ +       Control Name=BACK
++ +       Rectangle=128 185 170 199
++ +       Variable=DIRECTION
++ +       Value=B
++ +       Create Flags=01010000000000010000000000000000
++ +       Text=< &Back
++ +     end
++ +     item: Set Control Attribute
++ +       Control Name=BACK
++ +       Operation=1
++ +     end
++ +     item: Set Control Attribute
++ +       Control Name=CANCEL
++ +       Operation=1
++ +     end
++ +   end
++ + end
++ *** win/tk82plus.dsp.orig	Sun Nov 14 16:27:04 1999
++ --- win/tk82plus.dsp	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,80 ----
++ + # Microsoft Developer Studio Project File - Name="tk82plus" - Package Owner=<4>
++ + # Microsoft Developer Studio Generated Build File, Format Version 5.00
++ + # ** DO NOT EDIT **
++ + 
++ + # TARGTYPE "Win32 (x86) External Target" 0x0106
++ + 
++ + CFG=tk82plus - Win32 Debug
++ + !MESSAGE This is not a valid makefile. To build this project using NMAKE,
++ + !MESSAGE use the Export Makefile command and run
++ + !MESSAGE 
++ + !MESSAGE NMAKE /f "tk82plus.mak".
++ + !MESSAGE 
++ + !MESSAGE You can specify a configuration when running NMAKE
++ + !MESSAGE by defining the macro CFG on the command line. For example:
++ + !MESSAGE 
++ + !MESSAGE NMAKE /f "tk82plus.mak" CFG="tk82plus - Win32 Debug"
++ + !MESSAGE 
++ + !MESSAGE Possible choices for configuration are:
++ + !MESSAGE 
++ + !MESSAGE "tk82plus - Win32 Release" (based on "Win32 (x86) External Target")
++ + !MESSAGE "tk82plus - Win32 Debug" (based on "Win32 (x86) External Target")
++ + !MESSAGE 
++ + 
++ + # Begin Project
++ + # PROP Scc_ProjName ""
++ + # PROP Scc_LocalPath ""
++ + 
++ + !IF  "$(CFG)" == "tk82plus - Win32 Release"
++ + 
++ + # PROP BASE Use_Debug_Libraries 0
++ + # PROP BASE Output_Dir "Release"
++ + # PROP BASE Intermediate_Dir "Release"
++ + # PROP BASE Cmd_Line "NMAKE /f makefile.vc"
++ + # PROP BASE Rebuild_Opt "/a"
++ + # PROP BASE Target_File "wish82.exe"
++ + # PROP BASE Bsc_Name "wish82.bsc"
++ + # PROP BASE Target_Dir ""
++ + # PROP Use_Debug_Libraries 0
++ + # PROP Output_Dir "Release"
++ + # PROP Intermediate_Dir "Release"
++ + # PROP Cmd_Line "NMAKE /f makefile.vc all"
++ + # PROP Rebuild_Opt "/a"
++ + # PROP Target_File "wish82.exe"
++ + # PROP Bsc_Name "wish82.bsc"
++ + # PROP Target_Dir ""
++ + 
++ + !ELSEIF  "$(CFG)" == "tk82plus - Win32 Debug"
++ + 
++ + # PROP BASE Use_Debug_Libraries 1
++ + # PROP BASE Output_Dir "Debug"
++ + # PROP BASE Intermediate_Dir "Debug"
++ + # PROP BASE Cmd_Line "NMAKE /f makefile.vc"
++ + # PROP BASE Rebuild_Opt "/a"
++ + # PROP BASE Target_File "wish82.exe"
++ + # PROP BASE Bsc_Name "wish82.bsc"
++ + # PROP BASE Target_Dir ""
++ + # PROP Use_Debug_Libraries 1
++ + # PROP Output_Dir "Debug"
++ + # PROP Intermediate_Dir "Debug"
++ + # PROP Cmd_Line "NMAKE /f makefile.vc all"
++ + # PROP Rebuild_Opt "/a"
++ + # PROP Target_File "wish82.exe"
++ + # PROP Bsc_Name "wish82.bsc"
++ + # PROP Target_Dir ""
++ + 
++ + !ENDIF 
++ + 
++ + # Begin Target
++ + 
++ + # Name "tk82plus - Win32 Release"
++ + # Name "tk82plus - Win32 Debug"
++ + 
++ + !IF  "$(CFG)" == "tk82plus - Win32 Release"
++ + 
++ + !ELSEIF  "$(CFG)" == "tk82plus - Win32 Debug"
++ + 
++ + !ENDIF 
++ + 
++ + # End Target
++ + # End Project
++ *** win/tkWin32Dll.c.orig	Fri Apr 16 03:51:48 1999
++ --- win/tkWin32Dll.c	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 13,26 ****
++   
++   #include "tkWinInt.h"
++   
++ ! static int tkPlatformId;
++   
++ - /*
++ -  * The following declaration is for the VC++ DLL entry point.
++ -  */
++ - 
++ - BOOL APIENTRY		DllMain _ANSI_ARGS_((HINSTANCE hInst,
++ - 			    DWORD reason, LPVOID reserved));
++   
++   /*
++    *----------------------------------------------------------------------
++ --- 13,22 ----
++   
++   #include "tkWinInt.h"
++   
++ ! #if defined(_MSC_VER) || defined(__GNUC__)
++ ! #define DllEntryPoint DllMain
++ ! #endif
++   
++   
++   /*
++    *----------------------------------------------------------------------
++ ***************
++ *** 32,63 ****
++    *	routine.
++    *
++    * Results:
++ !  *	See DllMain.
++ !  *
++ !  * Side effects:
++ !  *	See DllMain.
++ !  *
++ !  *----------------------------------------------------------------------
++ !  */
++ ! 
++ ! BOOL APIENTRY
++ ! DllEntryPoint(hInst, reason, reserved)
++ !     HINSTANCE hInst;		/* Library instance handle. */
++ !     DWORD reason;		/* Reason this function is being called. */
++ !     LPVOID reserved;		/* Not used. */
++ ! {
++ !     return DllMain(hInst, reason, reserved);
++ ! }
++ ! 
++ ! /*
++ !  *----------------------------------------------------------------------
++ !  *
++ !  * DllMain --
++ !  *
++ !  *	DLL entry point.
++ !  *
++ !  * Results:
++ !  *	TRUE on sucess, FALSE on failure.
++    *
++    * Side effects:
++    *	None.
++ --- 28,34 ----
++    *	routine.
++    *
++    * Results:
++ !  *	TRUE on success, FALSE otherwise.
++    *
++    * Side effects:
++    *	None.
++ ***************
++ *** 66,77 ****
++    */
++   
++   BOOL APIENTRY
++ ! DllMain(hInstance, reason, reserved)
++ !     HINSTANCE hInstance;
++ !     DWORD reason;
++ !     LPVOID reserved;
++   {
++ -     OSVERSIONINFO os;
++   
++       /*
++        * If we are attaching to the DLL from a new process, tell Tk about
++ --- 37,47 ----
++    */
++   
++   BOOL APIENTRY
++ ! DllEntryPoint (
++ !     HINSTANCE hInstance,	/* Library instance handle. */
++ !     DWORD reason,		/* Reason this function is being called. */
++ !     LPVOID reserved)		/* Not used. */
++   {
++   
++       /*
++        * If we are attaching to the DLL from a new process, tell Tk about
++ ***************
++ *** 80,119 ****
++        */
++       
++       if (reason == DLL_PROCESS_ATTACH) {
++ - 	os.dwOSVersionInfoSize = sizeof(os);
++ - 	GetVersionEx(&os);
++ - 	tkPlatformId = os.dwPlatformId;
++ - 
++           TkWinXInit(hInstance);
++       } else if (reason == DLL_PROCESS_DETACH) {
++           TkWinXCleanup(hInstance);
++       }
++       return(TRUE);
++   }
++ - 
++ - /*
++ -  *----------------------------------------------------------------------
++ -  *
++ -  * TkWinGetPlatformId --
++ -  *
++ -  *	Determines whether running under NT, 95, or Win32s, to allow 
++ -  *	runtime conditional code.
++ -  *
++ -  * Results:
++ -  *	The return value is one of:
++ -  *	    VER_PLATFORM_WIN32s		Win32s on Windows 3.1. 
++ -  *	    VER_PLATFORM_WIN32_WINDOWS	Win32 on Windows 95.
++ -  *	    VER_PLATFORM_WIN32_NT	Win32 on Windows NT
++ -  *
++ -  * Side effects:
++ -  *	None.
++ -  *
++ -  *----------------------------------------------------------------------
++ -  */
++ - 
++ - int		
++ - TkWinGetPlatformId()
++ - {
++ -     return tkPlatformId;
++ - }
++ - 
++ --- 50,58 ----
++ *** win/tkWinDllEntry.c.orig	Sun Nov 14 16:27:04 1999
++ --- win/tkWinDllEntry.c	Sun Nov 14 16:27:04 1999
++ ***************
++ *** 0 ****
++ --- 1,37 ----
++ + /*
++ +  *	tkWinDllEntry.c
++ +  */
++ + 
++ + #include <windows.h>
++ + 
++ + #if defined(_MSC_VER) || defined(__GNUC__)
++ + #define DllEntryPoint DllMain
++ + #endif
++ + 
++ + 
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * DllEntryPoint --
++ +  *
++ +  *	This routine is called by gcc, VC++ Borland to invoke the
++ +  *	initialization code for Tcl.  It simply calls the DllMain
++ +  *	routine.
++ +  *
++ +  * Results:
++ +  *	TRUE.
++ +  *
++ +  * Side effects:
++ +  *	None.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + BOOL APIENTRY
++ + DllEntryPoint (
++ +     HINSTANCE hInst,		/* Library instance handle. */
++ +     DWORD reason,		/* Reason this function is being called. */
++ +     LPVOID reserved)		/* Not used. */
++ + {
++ +     return TRUE;
++ + }
++ *** win/tkWinFont.c.orig	Fri Apr 16 03:51:51 1999
++ --- win/tkWinFont.c	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 2202,2214 ****
++       USHORT **endCountPtr,	/* Filled with malloced pointer to 
++   				 * character range information. */
++       int *symbolPtr)
++ !  {
++ !     int n, i, swapped, offset, cbData, segCount;
++       DWORD cmapKey;
++       USHORT *startCount, *endCount;
++       CMAPTABLE cmapTable;
++       ENCODINGTABLE encTable;
++       SUBTABLE subTable;
++       char *s;
++   
++       segCount = 0;
++ --- 2202,2215 ----
++       USHORT **endCountPtr,	/* Filled with malloced pointer to 
++   				 * character range information. */
++       int *symbolPtr)
++ ! {
++ !     int n, i, swapped, offset, cbData, segCount, charSet;
++       DWORD cmapKey;
++       USHORT *startCount, *endCount;
++       CMAPTABLE cmapTable;
++       ENCODINGTABLE encTable;
++       SUBTABLE subTable;
++ +     TEXTMETRIC tm;
++       char *s;
++   
++       segCount = 0;
++ ***************
++ *** 2305,2310 ****
++ --- 2306,2323 ----
++   		}
++   	    }
++   	}
++ +     } else if (GetTextMetrics(hdc, &tm)) {
++ +         charSet = tm.tmCharSet;
++ +         if (charSet == ANSI_CHARSET) {
++ +             segCount = 2;
++ +             cbData = segCount * sizeof(USHORT);
++ +             startCount = (USHORT *) ckalloc(cbData);
++ +             endCount = (USHORT *) ckalloc(cbData);
++ +             startCount[0] = 0x0020;
++ +             endCount[0] = 0x007f;
++ +             startCount[1] = 0x00a0;
++ +             endCount[1] = 0x00ff;
++ +         }
++       }
++       SelectObject(hdc, hFont);
++   
++ *** win/tkWinInit.c.orig	Fri Apr 16 03:51:52 1999
++ --- win/tkWinInit.c	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 113,120 ****
++   
++   void
++   TkpDisplayWarning(msg, title)
++ !     char *msg;			/* Message to be displayed. */
++ !     char *title;		/* Title of warning. */
++   {
++       MessageBox(NULL, msg, title, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
++   	    | MB_SETFOREGROUND | MB_TOPMOST);
++ --- 113,120 ----
++   
++   void
++   TkpDisplayWarning(msg, title)
++ !     CONST char *msg;		/* Message to be displayed. */
++ !     CONST char *title;		/* Title of warning. */
++   {
++       MessageBox(NULL, msg, title, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
++   	    | MB_SETFOREGROUND | MB_TOPMOST);
++ *** win/tkWinInt.h.orig	Fri Apr 16 03:51:52 1999
++ --- win/tkWinInt.h	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 41,48 ****
++   #define WS_EX_TOOLWINDOW	0x00000080L 
++   #endif
++   
++ - typedef struct TkFontAttributes TkFontAttributes;
++ - 
++   /*
++    * The TkWinDCState is used to save the state of a device context
++    * so that it can be restored later.
++ --- 41,46 ----
++ *** win/tkWinPort.h.orig	Thu Jul 22 23:51:25 1999
++ --- win/tkWinPort.h	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 48,55 ****
++ --- 48,57 ----
++   #    define hypot _hypot
++   #endif /* _MSC_VER */
++   
++ + #ifndef __GNUC__
++   #define strncasecmp strnicmp
++   #define strcasecmp stricmp
++ + #endif
++   
++   #define NBBY 8
++   
++ *** win/tkWinTest.c.orig	Fri Apr 16 03:51:53 1999
++ --- win/tkWinTest.c	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 17,25 ****
++ --- 17,34 ----
++   HWND tkWinCurrentDialog;
++    
++   /*
++ +  * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
++ +  * Tkptest_Init declaration is in the source file itself, which is only
++ +  * accessed when we are building a library.
++ +  */
++ + 
++ + #undef TCL_STORAGE_CLASS
++ + #define TCL_STORAGE_CLASS DLLEXPORT
++ + /*
++    * Forward declarations of procedures defined later in this file:
++    */
++   
++ + EXTERN int		Tkptest_Init(Tcl_Interp *interp);
++   int			TkplatformtestInit(Tcl_Interp *interp);
++   static int		TestclipboardCmd(ClientData clientData,
++   			    Tcl_Interp *interp, int argc, char **argv);
++ ***************
++ *** 48,57 ****
++   TkplatformtestInit(
++       Tcl_Interp *interp)		/* Interpreter to add commands to. */
++   {
++       /*
++        * Add commands for platform specific tests on MacOS here.
++        */
++ !     
++       Tcl_CreateCommand(interp, "testclipboard", TestclipboardCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
++ --- 57,94 ----
++   TkplatformtestInit(
++       Tcl_Interp *interp)		/* Interpreter to add commands to. */
++   {
++ +     return Tkptest_Init(interp);
++ + }
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * Tkptest_Init --
++ +  *
++ +  *	Defines commands that test platform specific functionality for
++ +  *	Unix platforms.
++ +  *
++ +  * Results:
++ +  *	A standard Tcl result.
++ +  *
++ +  * Side effects:
++ +  *	Defines new commands.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + int
++ + Tkptest_Init(
++ +     Tcl_Interp *interp)		/* Interpreter to add commands to. */
++ + {
++       /*
++        * Add commands for platform specific tests on MacOS here.
++        */
++ !     if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
++ ! 	return TCL_ERROR;
++ !     }
++ !     if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
++ ! 	return TCL_ERROR;
++ !     }
++       Tcl_CreateCommand(interp, "testclipboard", TestclipboardCmd,
++   	    (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
++       Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
++ *** win/tkWinX.c.orig	Fri Jul  9 04:10:07 1999
++ --- win/tkWinX.c	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 19,31 ****
++    * The zmouse.h file includes the definition for WM_MOUSEWHEEL.
++    */
++   
++ ! #include <zmouse.h>
++   
++   /*
++    * Definitions of extern variables supplied by this file.
++    */
++   
++   int tkpIsWin32s = -1;
++   
++   /*
++    * Declarations of static variables used in this file.
++ --- 19,32 ----
++    * The zmouse.h file includes the definition for WM_MOUSEWHEEL.
++    */
++   
++ ! #define WM_MOUSEWHEEL (WM_MOUSELAST+1)
++   
++   /*
++    * Definitions of extern variables supplied by this file.
++    */
++   
++   int tkpIsWin32s = -1;
++ + static int tkPlatformId;
++   
++   /*
++    * Declarations of static variables used in this file.
++ ***************
++ *** 142,148 ****
++   
++       info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
++       GetVersionEx(&info);
++ !     tkpIsWin32s = (info.dwPlatformId == VER_PLATFORM_WIN32s);
++   
++       if (childClassInitialized != 0) {
++   	return;
++ --- 143,150 ----
++   
++       info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
++       GetVersionEx(&info);
++ !     tkPlatformId = info.dwPlatformId;
++ !     tkpIsWin32s = (tkPlatformId == VER_PLATFORM_WIN32s);
++   
++       if (childClassInitialized != 0) {
++   	return;
++ ***************
++ *** 1128,1132 ****
++   unsigned long
++   TkpGetMS()
++   {
++ !     return GetCurrentTime();
++   }
++ --- 1130,1161 ----
++   unsigned long
++   TkpGetMS()
++   {
++ !     return GetTickCount();
++   }
++ + 
++ + /*
++ +  *----------------------------------------------------------------------
++ +  *
++ +  * TkWinGetPlatformId --
++ +  *
++ +  *	Determines whether running under NT, 95, or Win32s, to allow 
++ +  *	runtime conditional code.
++ +  *
++ +  * Results:
++ +  *	The return value is one of:
++ +  *	    VER_PLATFORM_WIN32s		Win32s on Windows 3.1. 
++ +  *	    VER_PLATFORM_WIN32_WINDOWS	Win32 on Windows 95.
++ +  *	    VER_PLATFORM_WIN32_NT	Win32 on Windows NT
++ +  *
++ +  * Side effects:
++ +  *	None.
++ +  *
++ +  *----------------------------------------------------------------------
++ +  */
++ + 
++ + int		
++ + TkWinGetPlatformId()
++ + {
++ +     return tkPlatformId;
++ + }
++ + 
++ *** win/winMain.c.orig	Wed Nov  3 01:43:09 1999
++ --- win/winMain.c	Sun Nov 14 16:27:05 1999
++ ***************
++ *** 12,17 ****
++ --- 12,19 ----
++    * RCS: @(#) $Id: winMain.c,v 1.7.6.1 1999/11/03 00:43:09 hobbs Exp $
++    */
++   
++ + #undef TCL_USE_STUBS
++ + 
++   #include <tk.h>
++   #define WIN32_LEAN_AND_MEAN
++   #include <windows.h>
++ ***************
++ *** 32,45 ****
++    */
++   
++   static void		setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr));
++ ! static void		WishPanic _ANSI_ARGS_(TCL_VARARGS(char *,format));
++   
++   #ifdef TK_TEST
++   extern int		Tktest_Init(Tcl_Interp *interp);
++   #endif /* TK_TEST */
++   
++   #ifdef TCL_TEST
++ ! extern int		TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   #endif /* TCL_TEST */
++   
++ --- 34,47 ----
++    */
++   
++   static void		setargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr));
++ ! static void		WishPanic _ANSI_ARGS_(TCL_VARARGS(CONST char *,format));
++   
++   #ifdef TK_TEST
++   extern int		Tktest_Init(Tcl_Interp *interp);
++   #endif /* TK_TEST */
++   
++   #ifdef TCL_TEST
++ ! extern int		Objtest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
++   #endif /* TCL_TEST */
++   
++ ***************
++ *** 154,162 ****
++       }
++       Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
++               (Tcl_PackageInitProc *) NULL);
++ !     if (TclObjTest_Init(interp) == TCL_ERROR) {
++   	return TCL_ERROR;
++       }
++   #endif /* TCL_TEST */
++   
++   #ifdef TK_TEST
++ --- 156,166 ----
++       }
++       Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
++               (Tcl_PackageInitProc *) NULL);
++ !     if (Objtest_Init(interp) == TCL_ERROR) {
++   	return TCL_ERROR;
++       }
++ +     Tcl_StaticPackage(interp, "Objtest", Objtest_Init,
++ +             (Tcl_PackageInitProc *) NULL);
++   #endif /* TCL_TEST */
++   
++   #ifdef TK_TEST
++ ***************
++ *** 196,208 ****
++    */
++   
++   void
++ ! WishPanic TCL_VARARGS_DEF(char *,arg1)
++   {
++       va_list argList;
++       char buf[1024];
++ !     char *format;
++ !     
++ !     format = TCL_VARARGS_START(char *,arg1,argList);
++       vsprintf(buf, format, argList);
++   
++       MessageBeep(MB_ICONEXCLAMATION);
++ --- 200,212 ----
++    */
++   
++   void
++ ! WishPanic TCL_VARARGS_DEF(CONST char *,arg1)
++   {
++       va_list argList;
++       char buf[1024];
++ !     CONST char *format;
++ ! 
++ !     format = TCL_VARARGS_START(CONST char *,arg1,argList);
++       vsprintf(buf, format, argList);
++   
++       MessageBeep(MB_ICONEXCLAMATION);
+*** changes.orig	Wed Nov  3 01:42:07 1999
+--- changes	Sun Nov 14 18:50:44 1999
+***************
+*** 4579,4585 ****
+  ignored later. 
+  
+  7/30/99 (bug fix) Added functions to stub table, patch provided by Jan
+! Njitmans. [Bug: 2445] (hobbs)
+  
+  8/1/99  (bug fix) Changed Windows socket driver to terminate threads
+  by sending a message to the window rather than calling
+--- 4579,4585 ----
+  ignored later. 
+  
+  7/30/99 (bug fix) Added functions to stub table, patch provided by Jan
+! Nijtmans. [Bug: 2445] (hobbs)
+  
+  8/1/99  (bug fix) Changed Windows socket driver to terminate threads
+  by sending a message to the window rather than calling
+***************
+*** 4683,4685 ****
+--- 4683,5177 ----
+  10/30/99 (bug fix) fixes for mac UTF filename handling (ingham)
+  
+  --- Released 8.2.2, November 04, 1999 --- See ChangeLog for details ---
++ 
++ The following changes are for the '+'-version,
++ written by:	Jan Nijtmans
++ 		CMG (Computer Management Group) Arnhem B.V.
++ 		email: j.nijtmans@chello.nl (private)
++ 		       jan.nijtmans@cmg.nl (work)
++ 		url:  http://purl.oclc.org/net/nijtmans/
++ 
++ 6/26/95 (new feature) Added support for creating standalone support.
++ 	Now the library has a function Tcl_InitStandAlone() which is
++ 	a repacement for Tcl_Init(). The difference is that using this
++ 	new function makes any application independant from the tcl
++ 	library, because it will be compiled into the binary executable.
++ 
++ 6/26/95 (new feature) Changed configure and Makefile for creating
++ 	a shared library for Tcl7.4. Has been tested successfully
++ 	for Sun (SunOS-4 and Solaris), HP, SGI, AIX and OSF/1,
++ 	but is easlily extensible for other systems.
++ 
++ 7/3/95  Updated for the official release of Tcl7.4
++ 
++ 7/18/95 Some changes to tclAppInit.c, such that it can be
++ 	compiled with c++.
++ 	    make tclsh++		c++ version of tclsh
++ 
++ 8/28/95	Updated to autoconf-2.4
++ 
++ 9/20/95 Updated all for Tcl7.4p2.
++ 
++ 10/5/95 Improved above interface for multiple interpreters.
++ 
++ 10/6/95 Patched tclExpr.c, to solve a DOMAIN error when using
++ 	shared libraries on some systems (SunOS-4, HP-UX)
++ 
++ 11/21/95 Changed tests to used the loadable extension tcltest${SHLIB_SUFFIX}
++ 
++ 12/1/95 Updated everything for Tcl7.4p3
++ 
++ 12/6/95 Added some mathematical functions that are in many math
++ 	libraries (at least HP-UX, SunOS-4, Solaris, Irix and Ultrix):
++ 	erf(), erfc(), lgamma(), j0(), j1(), jn(), y0(), y1() and yn().
++ 
++ 12/12/95 Changed suffix for position independant objects to "..o", to
++ 	 assure that all linkers accept and recognize it.
++ 
++ 1/5/96	Supply both TclTest_Init() and Tcltest_Init() for
++ 	compatibility with tclX7.4a
++ 
++ 2/6/96  Update everything for Tcl7.5b1
++ 
++ 2/6/96  Rewrite Main-loop such that Tk is dynamically loadable.
++ 
++ 2/13/96 Adapt dynamical loading for c++ loadable libraries
++ 
++ 2/19/96 Adapted tclLoadDl.c such that the current path is checked first
++ 	when trying to load the dynamic library.
++ 
++ 2/19/96 Adapted tclLoadAout.c such that the directories in the environment
++ 	variable LD_LIBRARY_PATH and the patch /usr/lib and /lib are
++ 	searched too.
++ 
++ 2/20/96 Adapted tclTest.c such that it behaves as a separate package,
++ 	and can be compiled with any C++-compiler too.
++ 
++ 2/21/96 Corrected tclsh.standalone for multiple interpreters. Until
++ 	now it only was standalone as long as only a single interpreter
++ 	was used.
++ 
++ 2/26/96 Updated everything for Tcl7.5b2
++ 
++ 2/27/96 Added C++-support for OSF loadable modules.
++ 
++ 2/28/96 Changed PWD to BUILD_DIR, thereby removing problems if the
++ 	tcl build directory is a symbolic link
++ 
++ 3/7/96  Renamed tclsh to tclsh7.5 in build directory too. Supply a
++ 	link to the original name for compatibility.
++ 
++ 3/7/96  Adapt tests to load tcltest.so by the "package require" command
++ 
++ 3/8/96  Added pkgIndex.tcl for build and dltest directories. These are
++ 	constructed by the configure script (so without the need for
++ 	the actual libraries). But the Makefiles also contain rules
++ 	to construct these by the pkg_mkIndex command.
++ 
++ 3/11/96 Fixed rejects for new b3 release.
++ 
++ 3/13/96 Adapt tclPkgSetup to accept full-path filenames. Adapt
++ 	pkg_mkIndex not to put an error-message when a file cannot
++ 	be loaded or sourced. This is needed to create a pkgIndex.tcl
++ 	file for Tk.
++ 
++ 3/14/96 Adapted tclLoadShl.c to use emulation of dlopen, dlsym and dlerror.
++ 	this makes it possible to search for symbols in shared libraries
++ 	by other extensions.
++ 
++ 3/18/96 Added generation of TCL_ERROR in the Tcl_WaitForEvent() functions
++ 	of the mac and win ports.
++ 
++ 3/22/96 Initialize firstFileHandlerPtr to NULL
++ 
++ 4/8/96  Added small namespace facility (namesp.tcl), and added the "tcl"
++ 	command.
++ 
++ 4/10/96 Removed tclUnixMain.c, and instead create patch for tclMain.c
++ 	which does the same. Also changed the mechanism such that
++ 	it should work for Windows and Mac too (hopefully).
++ 
++ 4/22/96 Adapted everything for final Tcl7.5
++ 
++ 4/25/96 Removed some tests for versions numbers in the Makefile. These are no
++ 	longer necessary because the version number is now always either with
++ 	or without dots, but never missing.
++ 
++ 5/1/96	Adapted Makefile such that incremental linking in shared libraries
++ 	is only used for a.out loadable libraries. For other systems it
++ 	doesn't give any benefit, and for SunOS-4 it even goes wrong.
++ 
++ 5/10/96 Added "package require" commands to "hello.tcl"
++ 
++ 5/15/96 Added workaround for "-o" bug in UnixWare compiler
++ 
++ 5/20/96 Update to use autoconf 2.10
++ 
++ 5/22/96 Added dummy reference to "fabs" in tclMtherr.c. This should
++ 	make Tk dymanically loadable on systems that don't have a
++ 	shared math library.
++ 
++ 5/24/96 Added separate tests for the presence of shared math and c
++ 	libraries. Removed "AIX_TCL_LIB_SPEC", because that should
++ 	be handled correctly by @SHLIB_LD_LIBS@ now. Let's hope
++ 	this works for all systems.
++ 
++ 5/30/96 Better support for Mac and Windows ports.
++ 
++ 6/4/96  Changed ldAout.tcl and tclLoadAout.c such that a.out dynamical
++ 	libraries are more forgiving in respect to the extension. Suffixes
++ 	like ".so", or even ".so.x.y" or "..o.x.y" are now accepted too
++ 
++ 6/4/96  Adapted tclTest.c, tclUnixTest.c and pkga.c .. pkge.c such that
++ 	no warnings about unused arguments are given by some C++ compilers.
++ 
++ 8/6/96  Updated everything for Tcl7.5p1
++ 
++ 8/7/96  Corrected bug in pkg_mkindex proc for Ultrix. Also, extended
++ 	this procedure such that it can make index files for packages
++ 	that depend on other packeges; not only for Tk.
++ 
++ 8/8/96  Added function Tcl_FindPackageHandle(). Needed to make libitk2.1.so
++ 	dynamically loadable in some circumstances on SunOS4.
++ 
++ 8/9/96  Adapted pkgIndex.tcl files to work for directories containing
++ 	spaces too.
++ 
++ 8/12/96 Fixed a few event tests for working together with tclsh.static.
++ 
++ 8/22/96 Removed erf(), erfc() and lgamma() functions for Windows and Mac
++ 	ports.
++ 
++ 8/26/96 Changed activeFlag in tclMacNotify.c into tclActiveFlag (Oops....)
++ 
++ 8/27/96 Improved standalone handling such that now all scripts can be
++ 	re-loaded. So, now auto_reset works in tclsh.standalone too.
++ 
++ 8/28/96 Use mkinstalldir script for creating directory hierarchies.
++ 
++ 9/2/96  Adapted everyting for  Tcl7.6b1.
++ 
++ 9/2/96  Added support for tkcon (by Jeffrey Hobbs). If tkcon.tcl is
++ 	present in the Tcl script directory, it will be used as the
++ 	console for tclsh. If the initialization is not possible
++ 	(e.g. because Tk is not compiled yet) the old console is
++ 	used (which doesn't work yet on Mac and Windows)
++ 
++ 20/9/96 Added dlsym() emulation for all platforms.
++ 
++ 30/9/96 Added option "-with-x", which links X11 with tclsh7.6. This
++ 	might be usefull if you don't have a shared X11 library.
++ 
++ 1/10/96 Upgrade to tkcon version 0.64, expanded with a limited set
++ 	of safe-tk such that it runs in the Netscape plugin too.
++ 
++ 10/23/96 Adapted everyting for final Tcl7.6 release.
++ 
++ 10/28/96 Added TclGuessPackageName for Ultrix, to assure that the
++ 	 possible "_G0" part of the filename is not taken as
++ 	 belonging to the package name.
++ 
++ 10/29/96 Added flag DYNAMIC_PATH to shl_load() function for HP-UX.
++ 	 That makes it more likely that loading dynamical libraries
++ 	 will succeed.
++ 
++ 10/30/96 Small bug fix in win/tclWinSock.c (reported by Jim Barton
++ 	 in comp.lang.tcl)
++ 
++ 10/31/96 Fixed two small bugs, reported by Frederic Bonnet. One has
++ 	 to do with an invalid  TEST_SUFFIX="${.a}", which of
++ 	 course should be   TEST_SUFFIX=".a" in the configure scripts.
++ 	 The other one is an ill-treatment of tclLoadNone.c when
++ 	 the system is not on the list of supported systems.
++ 
++ 11/1/96  Just a few cleanups to eliminate gcc warnings when -Wall
++ 	 is used.
++ 
++ 11/4/96  Fixed small bug in "update idletask"
++ 
++ 11/6/96  Small bug-fix in tclLoadAix.c
++ 
++ 11/13/96 Upgrade to TkCon 0.67
++ 
++ 11/14/96 Upgrade to TkCon 0.68
++ 
++ 11/15/96 Removed event fixes from Mac and Windows ports. They seem
++ 	 to ruin the console. Pity but true.
++ 
++ 11/20/96 A few adaptations for the Mac (Thanks to Vince Darley)
++ 
++ 11/22/96 Upgrade to TkCon 0.70
++ 
++ 11/26/96 Add some more undefined symbols to tclsh when the shared
++ 	 c-library is missing for some system. Without this,
++ 	 libtclx7.6.0.so is not dynamically loadable.
++ 
++ 11/29/96 Upgrade to autoconf-2.12
++ 
++ 12/2/96  Implemented dlclose() for Windows
++ 
++ 12/2/96  Added gcc's __builtin functions.
++ 
++ 12/3/96  Added reference to signgam in tclExpr.c. Needed when
++ 	 using the shared math lib in combination with the
++ 	 shared AIX tcl7.6 library.
++ 
++ 12/5/96  Removed Itcl namespaces: Itcl2.2 is about to be released
++ 	 now,