Index: generic/tcl.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.decls,v
retrieving revision 1.127
diff -u -p -r1.127 tcl.decls
--- generic/tcl.decls	20 Sep 2007 18:43:28 -0000	1.127
+++ generic/tcl.decls	10 Dec 2007 15:13:16 -0000
@@ -4,13 +4,14 @@
 #	functions that are exported by the Tcl library via the stubs table.
 #	This file is used to generate the tclDecls.h, tclPlatDecls.h,
 #	tclStub.c, and tclPlatStub.c files.
-#	
 #
 # Copyright (c) 1998-1999 by Scriptics Corporation.
 # Copyright (c) 2001, 2002 by Kevin B. Kenny.  All rights reserved.
+# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+#
 # See the file "license.terms" for information on usage and redistribution
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
+#
 # RCS: @(#) $Id: tcl.decls,v 1.127 2007/09/20 18:43:28 das Exp $
 
 library tcl
@@ -32,8 +33,9 @@ declare 0 generic {
 	    CONST char* version, ClientData clientData)
 }
 declare 1 generic {
-    CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp, CONST char *name,
-	    CONST char *version, int exact, ClientData *clientDataPtr)
+    CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp,
+	    CONST char *name, CONST char *version, int exact,
+	    ClientData *clientDataPtr)
 }
 declare 2 generic {
     void Tcl_Panic(CONST char *format, ...)
@@ -69,7 +71,6 @@ declare 9 unix {
 declare 10 unix {
     void Tcl_DeleteFileHandler(int fd)
 }
-
 declare 11 generic {
     void Tcl_SetTimer(Tcl_Time *timePtr)
 }
@@ -116,7 +117,7 @@ declare 24 generic {
 	    CONST char *file, int line)
 }
 declare 25 generic {
-    Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *CONST *objv, 
+    Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *CONST *objv,
 	    CONST char *file, int line)
 }
 declare 26 generic {
@@ -354,7 +355,7 @@ declare 94 generic {
 }
 declare 95 generic {
     void Tcl_CreateMathFunc(Tcl_Interp *interp, CONST char *name,
-	    int numArgs, Tcl_ValueType *argTypes, 
+	    int numArgs, Tcl_ValueType *argTypes,
 	    Tcl_MathProc *proc, ClientData clientData)
 }
 declare 96 generic {
@@ -945,7 +946,6 @@ declare 265 generic {
 declare 266 generic {
     void Tcl_ValidateAllMemory(CONST char *file, int line)
 }
-
 declare 267 generic {
     void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList)
 }
@@ -964,16 +964,17 @@ declare 271 generic {
 	    CONST char *version, int exact)
 }
 declare 272 generic {
-    CONST84_RETURN char * Tcl_PkgPresentEx(Tcl_Interp *interp, CONST char *name,
-	    CONST char *version, int exact, ClientData *clientDataPtr)
+    CONST84_RETURN 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, CONST char *name, 
+    int Tcl_PkgProvide(Tcl_Interp *interp, CONST char *name,
 	    CONST char *version)
 }
 # TIP #268: The internally used new Require function is in slot 573.
 declare 274 generic {
-    CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, CONST char *name, 
+    CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, CONST char *name,
 	    CONST char *version, int exact)
 }
 declare 275 generic {
@@ -1137,7 +1138,7 @@ declare 316 generic {
     int Tcl_SetSystemEncoding(Tcl_Interp *interp, CONST char *name)
 }
 declare 317 generic {
-    Tcl_Obj * Tcl_SetVar2Ex(Tcl_Interp *interp, CONST char *part1, 
+    Tcl_Obj * Tcl_SetVar2Ex(Tcl_Interp *interp, CONST char *part1,
             CONST char *part2, Tcl_Obj *newValuePtr, int flags)
 }
 declare 318 generic {
@@ -1266,7 +1267,6 @@ declare 356 generic {
     Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
 	    int flags)
 }
-
 declare 357 generic {
     Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
 	    int count)
@@ -1288,7 +1288,7 @@ declare 361 generic {
 }
 declare 362 generic {
     int Tcl_ParseExpr(Tcl_Interp *interp, CONST char *start, int numBytes,
-	    Tcl_Parse *parsePtr)	 
+	    Tcl_Parse *parsePtr)
 }
 declare 363 generic {
     int Tcl_ParseQuotedString(Tcl_Interp *interp, CONST char *start,
@@ -1412,48 +1412,56 @@ declare 398 generic {
     CONST84_RETURN char * Tcl_ChannelName(CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 399 generic {
-    Tcl_ChannelTypeVersion Tcl_ChannelVersion(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_ChannelTypeVersion Tcl_ChannelVersion(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 400 generic {
-    Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc(CONST Tcl_ChannelType
-	    *chanTypePtr)
+    Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 401 generic {
-    Tcl_DriverCloseProc * Tcl_ChannelCloseProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverCloseProc * Tcl_ChannelCloseProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 402 generic {
-    Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 403 generic {
-    Tcl_DriverInputProc * Tcl_ChannelInputProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverInputProc * Tcl_ChannelInputProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 404 generic {
-    Tcl_DriverOutputProc * Tcl_ChannelOutputProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverOutputProc * Tcl_ChannelOutputProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 405 generic {
-    Tcl_DriverSeekProc * Tcl_ChannelSeekProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverSeekProc * Tcl_ChannelSeekProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 406 generic {
-    Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc(CONST Tcl_ChannelType
-	    *chanTypePtr)
+    Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 407 generic {
-    Tcl_DriverGetOptionProc * Tcl_ChannelGetOptionProc(CONST Tcl_ChannelType
-	    *chanTypePtr)
+    Tcl_DriverGetOptionProc * Tcl_ChannelGetOptionProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 408 generic {
-    Tcl_DriverWatchProc * Tcl_ChannelWatchProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverWatchProc * Tcl_ChannelWatchProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 409 generic {
-    Tcl_DriverGetHandleProc * Tcl_ChannelGetHandleProc(CONST Tcl_ChannelType
-	    *chanTypePtr)
+    Tcl_DriverGetHandleProc * Tcl_ChannelGetHandleProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 410 generic {
-    Tcl_DriverFlushProc * Tcl_ChannelFlushProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverFlushProc * Tcl_ChannelFlushProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 declare 411 generic {
-    Tcl_DriverHandlerProc * Tcl_ChannelHandlerProc(CONST Tcl_ChannelType
-	    *chanTypePtr)
+    Tcl_DriverHandlerProc * Tcl_ChannelHandlerProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 
 # Introduced in 8.4a2
@@ -1478,7 +1486,6 @@ declare 417 generic {
 declare 418 generic {
     int Tcl_IsChannelExisting(CONST char* channelName)
 }
-
 declare 419 generic {
     int Tcl_UniCharNcasecmp(CONST Tcl_UniChar *ucs, CONST Tcl_UniChar *uct,
 	    unsigned long numChars)
@@ -1487,21 +1494,17 @@ declare 420 generic {
     int Tcl_UniCharCaseMatch(CONST Tcl_UniChar *uniStr,
 	    CONST Tcl_UniChar *uniPattern, int nocase)
 }
-
 declare 421 generic {
     Tcl_HashEntry *Tcl_FindHashEntry(Tcl_HashTable *tablePtr, CONST char *key)
 }
-
 declare 422 generic {
     Tcl_HashEntry *Tcl_CreateHashEntry(Tcl_HashTable *tablePtr,
 	    CONST char *key, int *newPtr)
 }
-
 declare 423 generic {
     void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr, int keyType,
 	    Tcl_HashKeyType *typePtr)
 }
-
 declare 424 generic {
     void Tcl_InitObjHashTable(Tcl_HashTable *tablePtr)
 }
@@ -1697,14 +1700,14 @@ declare 479 generic {
 }
 declare 480 generic {
     void Tcl_FSMountsChanged(Tcl_Filesystem *fsPtr)
-}	  
+}
 # New function due to TIP#56
 declare 481 generic {
     int Tcl_EvalTokensStandard(Tcl_Interp *interp, Tcl_Token *tokenPtr,
 	    int count)
 }
 
-# New export due to TIP#73 
+# New export due to TIP#73
 declare 482 generic {
     void Tcl_GetTime(Tcl_Time* timeBuf)
 }
@@ -1976,36 +1979,37 @@ declare 551 generic {
 }
 # TIP#233 (Virtualized Time)
 declare 552 generic {
-    void Tcl_SetTimeProc (Tcl_GetTimeProc* getProc,
+    void Tcl_SetTimeProc(Tcl_GetTimeProc* getProc,
 	    Tcl_ScaleTimeProc* scaleProc,
 	    ClientData clientData)
 }
 declare 553 generic {
-    void Tcl_QueryTimeProc (Tcl_GetTimeProc** getProc,
+    void Tcl_QueryTimeProc(Tcl_GetTimeProc** getProc,
 	    Tcl_ScaleTimeProc** scaleProc,
 	    ClientData* clientData)
 }
 # TIP#218 (Driver Thread Actions) davygrvy/akupries ChannelType ver 4
 declare 554 generic {
-    Tcl_DriverThreadActionProc *Tcl_ChannelThreadActionProc(CONST Tcl_ChannelType *chanTypePtr)
+    Tcl_DriverThreadActionProc *Tcl_ChannelThreadActionProc(
+	    CONST Tcl_ChannelType *chanTypePtr)
 }
 
 # TIP#237 (Arbitrary-precision Integers) kevin kenny
 
 declare 555 generic {
-    Tcl_Obj* Tcl_NewBignumObj( mp_int* value )
+    Tcl_Obj* Tcl_NewBignumObj(mp_int* value)
 }
 declare 556 generic {
-    Tcl_Obj* Tcl_DbNewBignumObj( mp_int* value, CONST char* file, int line )
+    Tcl_Obj* Tcl_DbNewBignumObj(mp_int* value, CONST char* file, int line)
 }
 declare 557 generic {
-    void Tcl_SetBignumObj( Tcl_Obj* obj, mp_int* value )
+    void Tcl_SetBignumObj(Tcl_Obj* obj, mp_int* value)
 }
 declare 558 generic {
-    int Tcl_GetBignumFromObj( Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value )
+    int Tcl_GetBignumFromObj(Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value)
 }
 declare 559 generic {
-    int Tcl_TakeBignumFromObj( Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value )
+    int Tcl_TakeBignumFromObj(Tcl_Interp* interp, Tcl_Obj* obj, mp_int* value)
 }
 
 # TIP #208 ('chan' Command) jeffh
@@ -2020,22 +2024,22 @@ declare 561 generic {
 # TIP#219 (Tcl Channel Reflection API) akupries
 
 declare 562 generic {
-    void Tcl_SetChannelErrorInterp (Tcl_Interp* interp, Tcl_Obj* msg)
+    void Tcl_SetChannelErrorInterp(Tcl_Interp* interp, Tcl_Obj* msg)
 }
 declare 563 generic {
-    void Tcl_GetChannelErrorInterp (Tcl_Interp* interp, Tcl_Obj** msg)
+    void Tcl_GetChannelErrorInterp(Tcl_Interp* interp, Tcl_Obj** msg)
 }
 declare 564 generic {
-    void Tcl_SetChannelError (Tcl_Channel chan, Tcl_Obj* msg)
+    void Tcl_SetChannelError(Tcl_Channel chan, Tcl_Obj* msg)
 }
 declare 565 generic {
-    void Tcl_GetChannelError (Tcl_Channel chan, Tcl_Obj** msg)
+    void Tcl_GetChannelError(Tcl_Channel chan, Tcl_Obj** msg)
 }
 
 # TIP #237 (Additional conversion functions for bignum support)
 
 declare 566 generic {
-    int Tcl_InitBignumFromDouble(Tcl_Interp* interp, double initval, 
+    int Tcl_InitBignumFromDouble(Tcl_Interp* interp, double initval,
 		mp_int *toInit)
 }
 
@@ -2068,7 +2072,7 @@ declare 572 generic {
 
 # TIP#268: Extended version numbers and requirements
 declare 573 generic {
-    int Tcl_PkgRequireProc(Tcl_Interp *interp, CONST char *name, 
+    int Tcl_PkgRequireProc(Tcl_Interp *interp, CONST char *name,
 	    int objc, Tcl_Obj *CONST objv[], ClientData *clientDataPtr)
 }
 
@@ -2102,8 +2106,12 @@ declare 579 generic {
 
 interface tclPlat
 
-######################
-# Windows declarations
+################################
+# Unix specific functions
+#   (none)
+
+################################
+# Windows specific functions
 
 # Added in Tcl 8.1
 
@@ -2114,9 +2122,8 @@ declare 1 win {
     char * Tcl_WinTCharToUtf(CONST TCHAR *str, int len, Tcl_DString *dsPtr)
 }
 
-##################
-# Mac OS X declarations
-#
+################################
+# Mac OS X specific functions
 
 declare 0 macosx {
     int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
@@ -2134,27 +2141,40 @@ declare 1 macosx {
 	    char *libraryPath)
 }
 
-
 ##############################################################################
 
-# Public functions that are not accessible via the stubs table:
-# (listed here _as comments_ so that the 'checkstubs' make target does not 
-# complain about them) 
-
-# void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
-# CONST char *Tcl_InitStubs(Tcl_Interp *interp, CONST char *version, int exact)
-# CONST char *TclTomMathInitializeStubs(Tcl_Interp* interp,
-#	CONST char* version, int epoch, int revision
-# CONST char *Tcl_PkgInitStubsCheck(Tcl_Interp *interp, CONST char *version,
-#	int exact);
-
-
-# Global variables that need to be exported from the tcl shared library:
-# (listed here _as comments_ so that the 'checkstubs' make target does not 
-# complain about them, c.f. tk bug bug 1716117)
-
-# TclStubs *tclStubsPtr                 (fool checkstubs)
-# TclPlatStubs *tclPlatStubsPtr         (fool checkstubs)
-# TclIntStubs *tclIntStubsPtr           (fool checkstubs)
-# TclIntPlatStubs *tclIntPlatStubsPtr   (fool checkstubs)
-# TclTomMathStubs* tclTomMathStubsPtr   (fool checkstubs)
+# Public functions that are not accessible via the stubs table.
+
+export {
+    void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
+}
+export {
+    CONST char *Tcl_InitStubs(Tcl_Interp *interp, CONST char *version,
+	int exact)
+}
+export {
+    CONST char *TclTomMathInitializeStubs(Tcl_Interp* interp,
+	CONST char* version, int epoch, int revision
+}
+export {
+    CONST char *Tcl_PkgInitStubsCheck(Tcl_Interp *interp, CONST char *version,
+	int exact);
+}
+
+# Global variables that need to be exported from the tcl shared library.
+
+export {
+    TclStubs *tclStubsPtr                       (fool checkstubs)
+}
+export {
+    TclPlatStubs *tclPlatStubsPtr               (fool checkstubs)
+}
+export {
+    TclIntStubs *tclIntStubsPtr                 (fool checkstubs)
+}
+export {
+    TclIntPlatStubs *tclIntPlatStubsPtr         (fool checkstubs)
+}
+export {
+    TclTomMathStubs* tclTomMathStubsPtr         (fool checkstubs)
+}
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.128
diff -u -p -r1.128 tclDecls.h
--- generic/tclDecls.h	23 Feb 2007 23:02:53 -0000	1.128
+++ generic/tclDecls.h	10 Dec 2007 15:13:17 -0000
@@ -89,7 +89,7 @@ EXTERN int		Tcl_DbCkfree (char * ptr, CO
 EXTERN char *		Tcl_DbCkrealloc (char * ptr, unsigned int size, 
 				CONST char * file, int line);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_CreateFileHandler_TCL_DECLARED
 #define Tcl_CreateFileHandler_TCL_DECLARED
 /* 9 */
@@ -97,13 +97,28 @@ EXTERN void		Tcl_CreateFileHandler (int 
 				Tcl_FileProc * proc, ClientData clientData);
 #endif
 #endif /* UNIX */
-#if !defined(__WIN32__) /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_CreateFileHandler_TCL_DECLARED
+#define Tcl_CreateFileHandler_TCL_DECLARED
+/* 9 */
+EXTERN void		Tcl_CreateFileHandler (int fd, int mask, 
+				Tcl_FileProc * proc, ClientData clientData);
+#endif
+#endif /* MACOSX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_DeleteFileHandler_TCL_DECLARED
 #define Tcl_DeleteFileHandler_TCL_DECLARED
 /* 10 */
 EXTERN void		Tcl_DeleteFileHandler (int fd);
 #endif
 #endif /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_DeleteFileHandler_TCL_DECLARED
+#define Tcl_DeleteFileHandler_TCL_DECLARED
+/* 10 */
+EXTERN void		Tcl_DeleteFileHandler (int fd);
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_SetTimer_TCL_DECLARED
 #define Tcl_SetTimer_TCL_DECLARED
 /* 11 */
@@ -691,20 +706,27 @@ EXTERN void		Tcl_DeleteHashTable (Tcl_Ha
 /* 110 */
 EXTERN void		Tcl_DeleteInterp (Tcl_Interp * interp);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_DetachPids_TCL_DECLARED
 #define Tcl_DetachPids_TCL_DECLARED
 /* 111 */
 EXTERN void		Tcl_DetachPids (int numPids, Tcl_Pid * pidPtr);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef Tcl_DetachPids_TCL_DECLARED
+#define Tcl_DetachPids_TCL_DECLARED
+/* 111 */
+EXTERN void		Tcl_DetachPids (int numPids, Tcl_Pid * pidPtr);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_DetachPids_TCL_DECLARED
 #define Tcl_DetachPids_TCL_DECLARED
 /* 111 */
 EXTERN void		Tcl_DetachPids (int numPids, Tcl_Pid * pidPtr);
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 #ifndef Tcl_DeleteTimerHandler_TCL_DECLARED
 #define Tcl_DeleteTimerHandler_TCL_DECLARED
 /* 112 */
@@ -1019,7 +1041,7 @@ EXTERN CONST char *	Tcl_GetNameOfExecuta
 /* 166 */
 EXTERN Tcl_Obj *	Tcl_GetObjResult (Tcl_Interp * interp);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_GetOpenFile_TCL_DECLARED
 #define Tcl_GetOpenFile_TCL_DECLARED
 /* 167 */
@@ -1028,6 +1050,15 @@ EXTERN int		Tcl_GetOpenFile (Tcl_Interp 
 				int checkUsage, ClientData * filePtr);
 #endif
 #endif /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_GetOpenFile_TCL_DECLARED
+#define Tcl_GetOpenFile_TCL_DECLARED
+/* 167 */
+EXTERN int		Tcl_GetOpenFile (Tcl_Interp * interp, 
+				CONST char * chanID, int forWriting, 
+				int checkUsage, ClientData * filePtr);
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_GetPathType_TCL_DECLARED
 #define Tcl_GetPathType_TCL_DECLARED
 /* 168 */
@@ -1184,7 +1215,7 @@ EXTERN Tcl_Obj *	Tcl_ObjSetVar2 (Tcl_Int
 				Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, 
 				Tcl_Obj * newValuePtr, int flags);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_OpenCommandChannel_TCL_DECLARED
 #define Tcl_OpenCommandChannel_TCL_DECLARED
 /* 197 */
@@ -1192,14 +1223,22 @@ EXTERN Tcl_Channel	Tcl_OpenCommandChanne
 				int argc, CONST84 char ** argv, int flags);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef Tcl_OpenCommandChannel_TCL_DECLARED
+#define Tcl_OpenCommandChannel_TCL_DECLARED
+/* 197 */
+EXTERN Tcl_Channel	Tcl_OpenCommandChannel (Tcl_Interp * interp, 
+				int argc, CONST84 char ** argv, int flags);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_OpenCommandChannel_TCL_DECLARED
 #define Tcl_OpenCommandChannel_TCL_DECLARED
 /* 197 */
 EXTERN Tcl_Channel	Tcl_OpenCommandChannel (Tcl_Interp * interp, 
 				int argc, CONST84 char ** argv, int flags);
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 #ifndef Tcl_OpenFileChannel_TCL_DECLARED
 #define Tcl_OpenFileChannel_TCL_DECLARED
 /* 198 */
@@ -1255,20 +1294,27 @@ EXTERN void		Tcl_QueueEvent (Tcl_Event *
 EXTERN int		Tcl_Read (Tcl_Channel chan, char * bufPtr, 
 				int toRead);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_ReapDetachedProcs_TCL_DECLARED
 #define Tcl_ReapDetachedProcs_TCL_DECLARED
 /* 207 */
 EXTERN void		Tcl_ReapDetachedProcs (void);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef Tcl_ReapDetachedProcs_TCL_DECLARED
+#define Tcl_ReapDetachedProcs_TCL_DECLARED
+/* 207 */
+EXTERN void		Tcl_ReapDetachedProcs (void);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_ReapDetachedProcs_TCL_DECLARED
 #define Tcl_ReapDetachedProcs_TCL_DECLARED
 /* 207 */
 EXTERN void		Tcl_ReapDetachedProcs (void);
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 #ifndef Tcl_RecordAndEval_TCL_DECLARED
 #define Tcl_RecordAndEval_TCL_DECLARED
 /* 208 */
@@ -3475,18 +3521,24 @@ typedef struct TclStubs {
     char * (*tcl_DbCkalloc) (unsigned int size, CONST char * file, int line); /* 6 */
     int (*tcl_DbCkfree) (char * ptr, CONST char * file, int line); /* 7 */
     char * (*tcl_DbCkrealloc) (char * ptr, unsigned int size, CONST char * file, int line); /* 8 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc * proc, ClientData clientData); /* 9 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     void *reserved9;
-#endif /* __WIN32__ */
-#if !defined(__WIN32__) /* UNIX */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc * proc, ClientData clientData); /* 9 */
+#endif /* MACOSX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     void (*tcl_DeleteFileHandler) (int fd); /* 10 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     void *reserved10;
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    void (*tcl_DeleteFileHandler) (int fd); /* 10 */
+#endif /* MACOSX */
     void (*tcl_SetTimer) (Tcl_Time * timePtr); /* 11 */
     void (*tcl_Sleep) (int ms); /* 12 */
     int (*tcl_WaitForEvent) (Tcl_Time * timePtr); /* 13 */
@@ -3587,12 +3639,15 @@ typedef struct TclStubs {
     void (*tcl_DeleteHashEntry) (Tcl_HashEntry * entryPtr); /* 108 */
     void (*tcl_DeleteHashTable) (Tcl_HashTable * tablePtr); /* 109 */
     void (*tcl_DeleteInterp) (Tcl_Interp * interp); /* 110 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     void (*tcl_DetachPids) (int numPids, Tcl_Pid * pidPtr); /* 111 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     void (*tcl_DetachPids) (int numPids, Tcl_Pid * pidPtr); /* 111 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    void (*tcl_DetachPids) (int numPids, Tcl_Pid * pidPtr); /* 111 */
+#endif /* MACOSX */
     void (*tcl_DeleteTimerHandler) (Tcl_TimerToken token); /* 112 */
     void (*tcl_DeleteTrace) (Tcl_Interp * interp, Tcl_Trace trace); /* 113 */
     void (*tcl_DontCallWhenDeleted) (Tcl_Interp * interp, Tcl_InterpDeleteProc * proc, ClientData clientData); /* 114 */
@@ -3648,12 +3703,15 @@ typedef struct TclStubs {
     Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp * interp); /* 164 */
     CONST char * (*tcl_GetNameOfExecutable) (void); /* 165 */
     Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp * interp); /* 166 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     int (*tcl_GetOpenFile) (Tcl_Interp * interp, CONST char * chanID, int forWriting, int checkUsage, ClientData * filePtr); /* 167 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     void *reserved167;
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    int (*tcl_GetOpenFile) (Tcl_Interp * interp, CONST char * chanID, int forWriting, int checkUsage, ClientData * filePtr); /* 167 */
+#endif /* MACOSX */
     Tcl_PathType (*tcl_GetPathType) (CONST char * path); /* 168 */
     int (*tcl_Gets) (Tcl_Channel chan, Tcl_DString * dsPtr); /* 169 */
     int (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj * objPtr); /* 170 */
@@ -3683,12 +3741,15 @@ typedef struct TclStubs {
     void (*tcl_NotifyChannel) (Tcl_Channel channel, int mask); /* 194 */
     Tcl_Obj * (*tcl_ObjGetVar2) (Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, int flags); /* 195 */
     Tcl_Obj * (*tcl_ObjSetVar2) (Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, Tcl_Obj * newValuePtr, int flags); /* 196 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp * interp, int argc, CONST84 char ** argv, int flags); /* 197 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp * interp, int argc, CONST84 char ** argv, int flags); /* 197 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp * interp, int argc, CONST84 char ** argv, int flags); /* 197 */
+#endif /* MACOSX */
     Tcl_Channel (*tcl_OpenFileChannel) (Tcl_Interp * interp, CONST char * fileName, CONST char * modeString, int permissions); /* 198 */
     Tcl_Channel (*tcl_OpenTcpClient) (Tcl_Interp * interp, int port, CONST char * address, CONST char * myaddr, int myport, int async); /* 199 */
     Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp * interp, int port, CONST char * host, Tcl_TcpAcceptProc * acceptProc, ClientData callbackData); /* 200 */
@@ -3698,12 +3759,15 @@ typedef struct TclStubs {
     CONST84_RETURN char * (*tcl_PosixError) (Tcl_Interp * interp); /* 204 */
     void (*tcl_QueueEvent) (Tcl_Event * evPtr, Tcl_QueuePosition position); /* 205 */
     int (*tcl_Read) (Tcl_Channel chan, char * bufPtr, int toRead); /* 206 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     void (*tcl_ReapDetachedProcs) (void); /* 207 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    void (*tcl_ReapDetachedProcs) (void); /* 207 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     void (*tcl_ReapDetachedProcs) (void); /* 207 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     int (*tcl_RecordAndEval) (Tcl_Interp * interp, CONST char * cmd, int flags); /* 208 */
     int (*tcl_RecordAndEvalObj) (Tcl_Interp * interp, Tcl_Obj * cmdPtr, int flags); /* 209 */
     void (*tcl_RegisterChannel) (Tcl_Interp * interp, Tcl_Channel chan); /* 210 */
@@ -4128,18 +4192,30 @@ extern TclStubs *tclStubsPtr;
 #define Tcl_DbCkrealloc \
 	(tclStubsPtr->tcl_DbCkrealloc) /* 8 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_CreateFileHandler
 #define Tcl_CreateFileHandler \
 	(tclStubsPtr->tcl_CreateFileHandler) /* 9 */
 #endif
 #endif /* UNIX */
-#if !defined(__WIN32__) /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_CreateFileHandler
+#define Tcl_CreateFileHandler \
+	(tclStubsPtr->tcl_CreateFileHandler) /* 9 */
+#endif
+#endif /* MACOSX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_DeleteFileHandler
 #define Tcl_DeleteFileHandler \
 	(tclStubsPtr->tcl_DeleteFileHandler) /* 10 */
 #endif
 #endif /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_DeleteFileHandler
+#define Tcl_DeleteFileHandler \
+	(tclStubsPtr->tcl_DeleteFileHandler) /* 10 */
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_SetTimer
 #define Tcl_SetTimer \
 	(tclStubsPtr->tcl_SetTimer) /* 11 */
@@ -4540,18 +4616,24 @@ extern TclStubs *tclStubsPtr;
 #define Tcl_DeleteInterp \
 	(tclStubsPtr->tcl_DeleteInterp) /* 110 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_DetachPids
 #define Tcl_DetachPids \
 	(tclStubsPtr->tcl_DetachPids) /* 111 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef Tcl_DetachPids
 #define Tcl_DetachPids \
 	(tclStubsPtr->tcl_DetachPids) /* 111 */
 #endif
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_DetachPids
+#define Tcl_DetachPids \
+	(tclStubsPtr->tcl_DetachPids) /* 111 */
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_DeleteTimerHandler
 #define Tcl_DeleteTimerHandler \
 	(tclStubsPtr->tcl_DeleteTimerHandler) /* 112 */
@@ -4772,12 +4854,18 @@ extern TclStubs *tclStubsPtr;
 #define Tcl_GetObjResult \
 	(tclStubsPtr->tcl_GetObjResult) /* 166 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_GetOpenFile
 #define Tcl_GetOpenFile \
 	(tclStubsPtr->tcl_GetOpenFile) /* 167 */
 #endif
 #endif /* UNIX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_GetOpenFile
+#define Tcl_GetOpenFile \
+	(tclStubsPtr->tcl_GetOpenFile) /* 167 */
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_GetPathType
 #define Tcl_GetPathType \
 	(tclStubsPtr->tcl_GetPathType) /* 168 */
@@ -4891,18 +4979,24 @@ extern TclStubs *tclStubsPtr;
 #define Tcl_ObjSetVar2 \
 	(tclStubsPtr->tcl_ObjSetVar2) /* 196 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_OpenCommandChannel
 #define Tcl_OpenCommandChannel \
 	(tclStubsPtr->tcl_OpenCommandChannel) /* 197 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef Tcl_OpenCommandChannel
 #define Tcl_OpenCommandChannel \
 	(tclStubsPtr->tcl_OpenCommandChannel) /* 197 */
 #endif
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef Tcl_OpenCommandChannel
+#define Tcl_OpenCommandChannel \
+	(tclStubsPtr->tcl_OpenCommandChannel) /* 197 */
+#endif
+#endif /* MACOSX */
 #ifndef Tcl_OpenFileChannel
 #define Tcl_OpenFileChannel \
 	(tclStubsPtr->tcl_OpenFileChannel) /* 198 */
@@ -4939,18 +5033,24 @@ extern TclStubs *tclStubsPtr;
 #define Tcl_Read \
 	(tclStubsPtr->tcl_Read) /* 206 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef Tcl_ReapDetachedProcs
 #define Tcl_ReapDetachedProcs \
 	(tclStubsPtr->tcl_ReapDetachedProcs) /* 207 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef Tcl_ReapDetachedProcs
+#define Tcl_ReapDetachedProcs \
+	(tclStubsPtr->tcl_ReapDetachedProcs) /* 207 */
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_ReapDetachedProcs
 #define Tcl_ReapDetachedProcs \
 	(tclStubsPtr->tcl_ReapDetachedProcs) /* 207 */
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 #ifndef Tcl_RecordAndEval
 #define Tcl_RecordAndEval \
 	(tclStubsPtr->tcl_RecordAndEval) /* 208 */
Index: generic/tclInt.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.decls,v
retrieving revision 1.117
diff -u -p -r1.117 tclInt.decls
--- generic/tclInt.decls	12 Nov 2007 02:07:19 -0000	1.117
+++ generic/tclInt.decls	10 Dec 2007 15:13:22 -0000
@@ -8,10 +8,11 @@
 #
 # Copyright (c) 1998-1999 by Scriptics Corporation.
 # Copyright (c) 2001 by Kevin B. Kenny.  All rights reserved.
+# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
 #
 # See the file "license.terms" for information on usage and redistribution
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
+#
 # RCS: @(#) $Id: tclInt.decls,v 1.117 2007/11/12 02:07:19 hobbs Exp $
 
 library tcl
@@ -39,7 +40,7 @@ declare 3 generic {
     void TclAllocateFreeObjects(void)
 }
 # Replaced by TclpChdir in 8.1:
-#  declare 4 generic {   
+#  declare 4 generic {
 #      int TclChdir(Tcl_Interp *interp, char *dirName)
 #  }
 declare 5 {unix win} {
@@ -65,7 +66,7 @@ declare 9 {unix win} {
 	    TclFile *errFilePtr)
 }
 declare 10 generic {
-    int TclCreateProc(Tcl_Interp *interp, Namespace *nsPtr, 
+    int TclCreateProc(Tcl_Interp *interp, Namespace *nsPtr,
 	    CONST char *procName,
 	    Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr)
 }
@@ -223,7 +224,8 @@ declare 51 generic {
 }
 # Removed in Tcl 8.5a2
 #declare 52 generic {
-#    int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, int flags)
+#    int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv,
+#	    int flags)
 #}
 declare 53 generic {
     int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp,
@@ -318,7 +320,6 @@ declare 76 generic {
 declare 77 generic {
     void TclpGetTime(Tcl_Time *time)
 }
-
 declare 78 generic {
     int TclpGetTimeZone(unsigned long time)
 }
@@ -517,7 +518,7 @@ declare 128 generic {
 declare 129 generic {
     int Tcl_PushCallFrame(Tcl_Interp *interp, Tcl_CallFrame *framePtr,
 	    Tcl_Namespace *nsPtr, int isProcCallFrame)
-} 
+}
 declare 130 generic {
     int Tcl_RemoveInterpResolvers(Tcl_Interp *interp, CONST char *name)
 }
@@ -576,19 +577,15 @@ declare 144 generic {
 declare 145 generic {
     struct AuxDataType *TclGetAuxDataType(char *typeName)
 }
-
 declare 146 generic {
     TclHandle TclHandleCreate(VOID *ptr)
 }
-
 declare 147 generic {
     void TclHandleFree(TclHandle handle)
 }
-
 declare 148 generic {
     TclHandle TclHandlePreserve(TclHandle handle)
 }
-
 declare 149 generic {
     void TclHandleRelease(TclHandle handle)
 }
@@ -602,7 +599,6 @@ declare 151 generic {
     void TclRegExpRangeUniChar(Tcl_RegExp re, int index, int *startPtr,
 	    int *endPtr)
 }
-
 declare 152 generic {
     void TclSetLibraryPath(Tcl_Obj *pathPtr)
 }
@@ -635,7 +631,8 @@ declare 159 generic {
 }
 #declare 160 generic {
 #    int TclpMatchFilesTypes(Tcl_Interp *interp, char *separators,
-#	    Tcl_DString *dirPtr, char *pattern, char *tail, GlobTypeData *types)
+#	    Tcl_DString *dirPtr, char *pattern, char *tail,
+#	    GlobTypeData *types)
 #}
 
 # new in 8.3.2/8.4a2
@@ -671,7 +668,7 @@ declare 165 generic {
 
 # New function due to TIP #33
 declare 166 generic {
-    int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr, 
+    int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr,
 	    int index, Tcl_Obj *valuePtr)
 }
 
@@ -696,7 +693,6 @@ declare 171 generic {
             int numChars, Command *cmdPtr, int result, int traceFlags,
 	    int objc, Tcl_Obj *CONST objv[])
 }
-
 declare 172 generic {
     int TclInThreadExit(void)
 }
@@ -728,7 +724,6 @@ declare 177 generic {
     void TclVarErrMsg(Tcl_Interp *interp, CONST char *part1, CONST char *part2,
 	    CONST char *operation, CONST char *reason)
 }
-
 declare 178 generic {
     void Tcl_SetStartupScript(Tcl_Obj *pathPtr, CONST char* encodingName)
 }
@@ -804,10 +799,9 @@ declare 183 generic {
 # Added in tcl8.5a5 for compiler/executor experimentation.
 #
 declare 197 generic {
-    int TclCompEvalObj (Tcl_Interp *interp, Tcl_Obj *objPtr,
+    int TclCompEvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
 		        CONST CmdFrame* invoker, int word)
 }
-
 declare 198 generic {
     int TclObjGetFrame(Tcl_Interp *interp, Tcl_Obj *objPtr,
 	    CallFrame **framePtrPtr)
@@ -819,33 +813,33 @@ declare 198 generic {
 
 # 200-208 exported for use by the test suite [Bug 1054748]
 declare 200 generic {
-    int TclpObjRemoveDirectory (Tcl_Obj *pathPtr, int recursive,
+    int TclpObjRemoveDirectory(Tcl_Obj *pathPtr, int recursive,
 	Tcl_Obj **errorPtr)
 }
 declare 201 generic {
-    int TclpObjCopyDirectory (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr,
+    int TclpObjCopyDirectory(Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr,
 	Tcl_Obj **errorPtr)
 }
 declare 202 generic {
-    int TclpObjCreateDirectory (Tcl_Obj *pathPtr)
+    int TclpObjCreateDirectory(Tcl_Obj *pathPtr)
 }
 declare 203 generic {
-    int TclpObjDeleteFile (Tcl_Obj *pathPtr)
+    int TclpObjDeleteFile(Tcl_Obj *pathPtr)
 }
 declare 204 generic {
-    int TclpObjCopyFile (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)
+    int TclpObjCopyFile(Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)
 }
 declare 205 generic {
-    int TclpObjRenameFile (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)
+    int TclpObjRenameFile(Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)
 }
 declare 206 generic {
-    int TclpObjStat (Tcl_Obj *pathPtr, Tcl_StatBuf *buf)
+    int TclpObjStat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf)
 }
 declare 207 generic {
-    int TclpObjAccess (Tcl_Obj *pathPtr, int mode)
+    int TclpObjAccess(Tcl_Obj *pathPtr, int mode)
 }
 declare 208 generic {
-    Tcl_Channel TclpOpenFileChannel (Tcl_Interp *interp,
+    Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp,
 	    Tcl_Obj *pathPtr, int mode, int permissions)
 }
 # Made public by TIP 258
@@ -891,18 +885,16 @@ declare 225 generic {
     Tcl_Obj *TclTraceDictPath(Tcl_Interp *interp, Tcl_Obj *rootPtr,
 	    int keyc, Tcl_Obj *CONST keyv[], int flags)
 }
-
 declare 226 generic {
     int TclObjBeingDeleted(Tcl_Obj *objPtr)
 }
-
 declare 227 generic {
     void TclSetNsPath(Namespace *nsPtr, int pathLength,
             Tcl_Namespace *pathAry[])
 }
 declare 228 generic {
     int TclObjInterpProcCore(register Tcl_Interp *interp, Tcl_Obj *procNameObj,
-             int skip, ProcErrorProc errorProc) 
+             int skip, ProcErrorProc errorProc)
 }
 declare 229 generic {
     int	TclPtrMakeUpvar(Tcl_Interp *interp, Var *otherP1Ptr,
@@ -913,7 +905,6 @@ declare 230 generic {
 	    CONST char *part2, int flags, CONST char *msg,
 	    CONST int createPart1, CONST int createPart2, Var **arrayPtrPtr)
 }
-
 declare 231 generic {
     int	TclGetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
 	    Tcl_Namespace **nsPtrPtr)
@@ -930,7 +921,7 @@ declare 233 generic {
 
 # Exports for VarReform compat: Itcl, XOTcl like to peek into our varTables :(
 declare 234 generic {
-    Var *TclVarHashCreateVar(TclVarHashTable *tablePtr, const char *key, 
+    Var *TclVarHashCreateVar(TclVarHashTable *tablePtr, const char *key,
              int *newPtr)
 }
 declare 235 generic {
@@ -961,8 +952,8 @@ declare 238 generic {
 
 interface tclIntPlat
 
-############################
-# Windows specific internals
+################################
+# Windows specific functions
 
 declare 0 win {
     void TclWinConvertError(DWORD errCode)
@@ -1074,13 +1065,12 @@ declare 27 win {
 declare 28 win {
     void TclWinResetInterfaces(void)
 }
-
 declare 29 win {
     int TclWinCPUID( unsigned int index, unsigned int *regs )
 }
 
-#########################
-# Unix specific internals
+################################
+# Unix specific functions
 
 # Pipe channel functions
 
@@ -1142,25 +1132,25 @@ declare 13 unix {
 # Added in 8.5:
 
 declare 14 unix {
-    int TclUnixCopyFile (CONST char *src, CONST char *dst,
+    int TclUnixCopyFile(CONST char *src, CONST char *dst,
 	    CONST Tcl_StatBuf *statBufPtr, int dontCopyAtts)
 }
 
+################################
+# Mac OS X specific functions
+
 declare 15 macosx {
     int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex,
 	    Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)
 }
-
 declare 16 macosx {
     int TclMacOSXSetFileAttribute(Tcl_Interp *interp, int objIndex,
 	    Tcl_Obj *fileName, Tcl_Obj *attributePtr)
 }
-
 declare 17 macosx {
     int TclMacOSXCopyFileAttributes(CONST char *src, CONST char *dst,
 	    CONST Tcl_StatBuf *statBufPtr)
 }
-
 declare 18 macosx {
     int TclMacOSXMatchType(Tcl_Interp *interp, CONST char *pathName,
 	    CONST char *fileName, Tcl_StatBuf *statBufPtr,
Index: generic/tclIntDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntDecls.h,v
retrieving revision 1.108
diff -u -p -r1.108 tclIntDecls.h
--- generic/tclIntDecls.h	12 Nov 2007 02:07:19 -0000	1.108
+++ generic/tclIntDecls.h	10 Dec 2007 15:13:23 -0000
@@ -51,7 +51,7 @@
 EXTERN void		TclAllocateFreeObjects (void);
 #endif
 /* Slot 4 is reserved */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclCleanupChildren_TCL_DECLARED
 #define TclCleanupChildren_TCL_DECLARED
 /* 5 */
@@ -59,14 +59,22 @@ EXTERN int		TclCleanupChildren (Tcl_Inte
 				Tcl_Pid * pidPtr, Tcl_Channel errorChan);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef TclCleanupChildren_TCL_DECLARED
 #define TclCleanupChildren_TCL_DECLARED
 /* 5 */
 EXTERN int		TclCleanupChildren (Tcl_Interp * interp, int numPids, 
 				Tcl_Pid * pidPtr, Tcl_Channel errorChan);
 #endif
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclCleanupChildren_TCL_DECLARED
+#define TclCleanupChildren_TCL_DECLARED
+/* 5 */
+EXTERN int		TclCleanupChildren (Tcl_Interp * interp, int numPids, 
+				Tcl_Pid * pidPtr, Tcl_Channel errorChan);
+#endif
+#endif /* MACOSX */
 #ifndef TclCleanupCommand_TCL_DECLARED
 #define TclCleanupCommand_TCL_DECLARED
 /* 6 */
@@ -85,7 +93,7 @@ EXTERN int		TclCopyChannel (Tcl_Interp *
 				Tcl_Channel inChan, Tcl_Channel outChan, 
 				int toRead, Tcl_Obj * cmdPtr);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclCreatePipeline_TCL_DECLARED
 #define TclCreatePipeline_TCL_DECLARED
 /* 9 */
@@ -95,7 +103,7 @@ EXTERN int		TclCreatePipeline (Tcl_Inter
 				TclFile * errFilePtr);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef TclCreatePipeline_TCL_DECLARED
 #define TclCreatePipeline_TCL_DECLARED
 /* 9 */
@@ -104,7 +112,17 @@ EXTERN int		TclCreatePipeline (Tcl_Inter
 				TclFile * inPipePtr, TclFile * outPipePtr, 
 				TclFile * errFilePtr);
 #endif
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclCreatePipeline_TCL_DECLARED
+#define TclCreatePipeline_TCL_DECLARED
+/* 9 */
+EXTERN int		TclCreatePipeline (Tcl_Interp * interp, int argc, 
+				CONST char ** argv, Tcl_Pid ** pidArrayPtr, 
+				TclFile * inPipePtr, TclFile * outPipePtr, 
+				TclFile * errFilePtr);
+#endif
+#endif /* MACOSX */
 #ifndef TclCreateProc_TCL_DECLARED
 #define TclCreateProc_TCL_DECLARED
 /* 10 */
@@ -446,20 +464,27 @@ EXTERN int		TclSockGetPort (Tcl_Interp *
 				CONST char * str, CONST char * proto, 
 				int * portPtr);
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclSockMinimumBuffers_TCL_DECLARED
 #define TclSockMinimumBuffers_TCL_DECLARED
 /* 104 */
 EXTERN int		TclSockMinimumBuffers (int sock, int size);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef TclSockMinimumBuffers_TCL_DECLARED
+#define TclSockMinimumBuffers_TCL_DECLARED
+/* 104 */
+EXTERN int		TclSockMinimumBuffers (int sock, int size);
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef TclSockMinimumBuffers_TCL_DECLARED
 #define TclSockMinimumBuffers_TCL_DECLARED
 /* 104 */
 EXTERN int		TclSockMinimumBuffers (int sock, int size);
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 /* Slot 105 is reserved */
 /* Slot 106 is reserved */
 /* Slot 107 is reserved */
@@ -1081,21 +1106,27 @@ typedef struct TclIntStubs {
     void *reserved2;
     void (*tclAllocateFreeObjects) (void); /* 3 */
     void *reserved4;
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     int (*tclCleanupChildren) (Tcl_Interp * interp, int numPids, Tcl_Pid * pidPtr, Tcl_Channel errorChan); /* 5 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    int (*tclCleanupChildren) (Tcl_Interp * interp, int numPids, Tcl_Pid * pidPtr, Tcl_Channel errorChan); /* 5 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     int (*tclCleanupChildren) (Tcl_Interp * interp, int numPids, Tcl_Pid * pidPtr, Tcl_Channel errorChan); /* 5 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     void (*tclCleanupCommand) (Command * cmdPtr); /* 6 */
     int (*tclCopyAndCollapse) (int count, CONST char * src, char * dst); /* 7 */
     int (*tclCopyChannel) (Tcl_Interp * interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj * cmdPtr); /* 8 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     int (*tclCreatePipeline) (Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr); /* 9 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     int (*tclCreatePipeline) (Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr); /* 9 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    int (*tclCreatePipeline) (Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr); /* 9 */
+#endif /* MACOSX */
     int (*tclCreateProc) (Tcl_Interp * interp, Namespace * nsPtr, CONST char * procName, Tcl_Obj * argsPtr, Tcl_Obj * bodyPtr, Proc ** procPtrPtr); /* 10 */
     void (*tclDeleteCompiledLocalVars) (Interp * iPtr, CallFrame * framePtr); /* 11 */
     void (*tclDeleteVars) (Interp * iPtr, TclVarHashTable * tablePtr); /* 12 */
@@ -1190,12 +1221,15 @@ typedef struct TclIntStubs {
     char * (*tclSetPreInitScript) (char * string); /* 101 */
     void (*tclSetupEnv) (Tcl_Interp * interp); /* 102 */
     int (*tclSockGetPort) (Tcl_Interp * interp, CONST char * str, CONST char * proto, int * portPtr); /* 103 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     int (*tclSockMinimumBuffers) (int sock, int size); /* 104 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    int (*tclSockMinimumBuffers) (int sock, int size); /* 104 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     int (*tclSockMinimumBuffers) (int sock, int size); /* 104 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     void *reserved105;
     void *reserved106;
     void *reserved107;
@@ -1354,18 +1388,24 @@ extern TclIntStubs *tclIntStubsPtr;
 	(tclIntStubsPtr->tclAllocateFreeObjects) /* 3 */
 #endif
 /* Slot 4 is reserved */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclCleanupChildren
 #define TclCleanupChildren \
 	(tclIntStubsPtr->tclCleanupChildren) /* 5 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef TclCleanupChildren
+#define TclCleanupChildren \
+	(tclIntStubsPtr->tclCleanupChildren) /* 5 */
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef TclCleanupChildren
 #define TclCleanupChildren \
 	(tclIntStubsPtr->tclCleanupChildren) /* 5 */
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 #ifndef TclCleanupCommand
 #define TclCleanupCommand \
 	(tclIntStubsPtr->tclCleanupCommand) /* 6 */
@@ -1378,18 +1418,24 @@ extern TclIntStubs *tclIntStubsPtr;
 #define TclCopyChannel \
 	(tclIntStubsPtr->tclCopyChannel) /* 8 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclCreatePipeline
 #define TclCreatePipeline \
 	(tclIntStubsPtr->tclCreatePipeline) /* 9 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef TclCreatePipeline
 #define TclCreatePipeline \
 	(tclIntStubsPtr->tclCreatePipeline) /* 9 */
 #endif
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclCreatePipeline
+#define TclCreatePipeline \
+	(tclIntStubsPtr->tclCreatePipeline) /* 9 */
+#endif
+#endif /* MACOSX */
 #ifndef TclCreateProc
 #define TclCreateProc \
 	(tclIntStubsPtr->tclCreateProc) /* 10 */
@@ -1637,18 +1683,24 @@ extern TclIntStubs *tclIntStubsPtr;
 #define TclSockGetPort \
 	(tclIntStubsPtr->tclSockGetPort) /* 103 */
 #endif
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclSockMinimumBuffers
 #define TclSockMinimumBuffers \
 	(tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+#ifndef TclSockMinimumBuffers
+#define TclSockMinimumBuffers \
+	(tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */
+#endif
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef TclSockMinimumBuffers
 #define TclSockMinimumBuffers \
 	(tclIntStubsPtr->tclSockMinimumBuffers) /* 104 */
 #endif
-#endif /* __WIN32__ */
+#endif /* MACOSX */
 /* Slot 105 is reserved */
 /* Slot 106 is reserved */
 /* Slot 107 is reserved */
Index: generic/tclIntPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIntPlatDecls.h,v
retrieving revision 1.30
diff -u -p -r1.30 tclIntPlatDecls.h
--- generic/tclIntPlatDecls.h	15 Nov 2006 14:58:27 -0000	1.30
+++ generic/tclIntPlatDecls.h	10 Dec 2007 15:13:23 -0000
@@ -38,7 +38,7 @@
  * Exported function declarations:
  */
 
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclGetAndDetachPids_TCL_DECLARED
 #define TclGetAndDetachPids_TCL_DECLARED
 /* 0 */
@@ -120,7 +120,7 @@ EXTERN int		TclUnixCopyFile (CONST char 
 				int dontCopyAtts);
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef TclWinConvertError_TCL_DECLARED
 #define TclWinConvertError_TCL_DECLARED
 /* 0 */
@@ -257,8 +257,88 @@ EXTERN void		TclWinResetInterfaces (void
 /* 29 */
 EXTERN int		TclWinCPUID (unsigned int index, unsigned int * regs);
 #endif
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclGetAndDetachPids_TCL_DECLARED
+#define TclGetAndDetachPids_TCL_DECLARED
+/* 0 */
+EXTERN void		TclGetAndDetachPids (Tcl_Interp * interp, 
+				Tcl_Channel chan);
+#endif
+#ifndef TclpCloseFile_TCL_DECLARED
+#define TclpCloseFile_TCL_DECLARED
+/* 1 */
+EXTERN int		TclpCloseFile (TclFile file);
+#endif
+#ifndef TclpCreateCommandChannel_TCL_DECLARED
+#define TclpCreateCommandChannel_TCL_DECLARED
+/* 2 */
+EXTERN Tcl_Channel	TclpCreateCommandChannel (TclFile readFile, 
+				TclFile writeFile, TclFile errorFile, 
+				int numPids, Tcl_Pid * pidPtr);
+#endif
+#ifndef TclpCreatePipe_TCL_DECLARED
+#define TclpCreatePipe_TCL_DECLARED
+/* 3 */
+EXTERN int		TclpCreatePipe (TclFile * readPipe, 
+				TclFile * writePipe);
+#endif
+#ifndef TclpCreateProcess_TCL_DECLARED
+#define TclpCreateProcess_TCL_DECLARED
+/* 4 */
+EXTERN int		TclpCreateProcess (Tcl_Interp * interp, int argc, 
+				CONST char ** argv, TclFile inputFile, 
+				TclFile outputFile, TclFile errorFile, 
+				Tcl_Pid * pidPtr);
+#endif
+/* Slot 5 is reserved */
+#ifndef TclpMakeFile_TCL_DECLARED
+#define TclpMakeFile_TCL_DECLARED
+/* 6 */
+EXTERN TclFile		TclpMakeFile (Tcl_Channel channel, int direction);
+#endif
+#ifndef TclpOpenFile_TCL_DECLARED
+#define TclpOpenFile_TCL_DECLARED
+/* 7 */
+EXTERN TclFile		TclpOpenFile (CONST char * fname, int mode);
+#endif
+#ifndef TclUnixWaitForFile_TCL_DECLARED
+#define TclUnixWaitForFile_TCL_DECLARED
+/* 8 */
+EXTERN int		TclUnixWaitForFile (int fd, int mask, int timeout);
+#endif
+#ifndef TclpCreateTempFile_TCL_DECLARED
+#define TclpCreateTempFile_TCL_DECLARED
+/* 9 */
+EXTERN TclFile		TclpCreateTempFile (CONST char * contents);
+#endif
+#ifndef TclpReaddir_TCL_DECLARED
+#define TclpReaddir_TCL_DECLARED
+/* 10 */
+EXTERN Tcl_DirEntry *	TclpReaddir (DIR * dir);
+#endif
+#ifndef TclpLocaltime_unix_TCL_DECLARED
+#define TclpLocaltime_unix_TCL_DECLARED
+/* 11 */
+EXTERN struct tm *	TclpLocaltime_unix (CONST time_t * clock);
+#endif
+#ifndef TclpGmtime_unix_TCL_DECLARED
+#define TclpGmtime_unix_TCL_DECLARED
+/* 12 */
+EXTERN struct tm *	TclpGmtime_unix (CONST time_t * clock);
+#endif
+#ifndef TclpInetNtoa_TCL_DECLARED
+#define TclpInetNtoa_TCL_DECLARED
+/* 13 */
+EXTERN char *		TclpInetNtoa (struct in_addr addr);
+#endif
+#ifndef TclUnixCopyFile_TCL_DECLARED
+#define TclUnixCopyFile_TCL_DECLARED
+/* 14 */
+EXTERN int		TclUnixCopyFile (CONST char * src, CONST char * dst, 
+				CONST Tcl_StatBuf * statBufPtr, 
+				int dontCopyAtts);
+#endif
 #ifndef TclMacOSXGetFileAttribute_TCL_DECLARED
 #define TclMacOSXGetFileAttribute_TCL_DECLARED
 /* 15 */
@@ -288,13 +368,13 @@ EXTERN int		TclMacOSXMatchType (Tcl_Inte
 				Tcl_StatBuf * statBufPtr, 
 				Tcl_GlobTypeData * types);
 #endif
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 
 typedef struct TclIntPlatStubs {
     int magic;
     struct TclIntPlatStubHooks *hooks;
 
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     void (*tclGetAndDetachPids) (Tcl_Interp * interp, Tcl_Channel chan); /* 0 */
     int (*tclpCloseFile) (TclFile file); /* 1 */
     Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr); /* 2 */
@@ -311,7 +391,7 @@ typedef struct TclIntPlatStubs {
     char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
     int (*tclUnixCopyFile) (CONST char * src, CONST char * dst, CONST Tcl_StatBuf * statBufPtr, int dontCopyAtts); /* 14 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     void (*tclWinConvertError) (DWORD errCode); /* 0 */
     void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */
     struct servent * (*tclWinGetServByName) (CONST char * nm, CONST char * proto); /* 2 */
@@ -342,13 +422,28 @@ typedef struct TclIntPlatStubs {
     void (*tclWinFlushDirtyChannels) (void); /* 27 */
     void (*tclWinResetInterfaces) (void); /* 28 */
     int (*tclWinCPUID) (unsigned int index, unsigned int * regs); /* 29 */
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    void (*tclGetAndDetachPids) (Tcl_Interp * interp, Tcl_Channel chan); /* 0 */
+    int (*tclpCloseFile) (TclFile file); /* 1 */
+    Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr); /* 2 */
+    int (*tclpCreatePipe) (TclFile * readPipe, TclFile * writePipe); /* 3 */
+    int (*tclpCreateProcess) (Tcl_Interp * interp, int argc, CONST char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr); /* 4 */
+    void *reserved5;
+    TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
+    TclFile (*tclpOpenFile) (CONST char * fname, int mode); /* 7 */
+    int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
+    TclFile (*tclpCreateTempFile) (CONST char * contents); /* 9 */
+    Tcl_DirEntry * (*tclpReaddir) (DIR * dir); /* 10 */
+    struct tm * (*tclpLocaltime_unix) (CONST time_t * clock); /* 11 */
+    struct tm * (*tclpGmtime_unix) (CONST time_t * clock); /* 12 */
+    char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+    int (*tclUnixCopyFile) (CONST char * src, CONST char * dst, CONST Tcl_StatBuf * statBufPtr, int dontCopyAtts); /* 14 */
     int (*tclMacOSXGetFileAttribute) (Tcl_Interp * interp, int objIndex, Tcl_Obj * fileName, Tcl_Obj ** attributePtrPtr); /* 15 */
     int (*tclMacOSXSetFileAttribute) (Tcl_Interp * interp, int objIndex, Tcl_Obj * fileName, Tcl_Obj * attributePtr); /* 16 */
     int (*tclMacOSXCopyFileAttributes) (CONST char * src, CONST char * dst, CONST Tcl_StatBuf * statBufPtr); /* 17 */
     int (*tclMacOSXMatchType) (Tcl_Interp * interp, CONST char * pathName, CONST char * fileName, Tcl_StatBuf * statBufPtr, Tcl_GlobTypeData * types); /* 18 */
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 } TclIntPlatStubs;
 
 #ifdef __cplusplus
@@ -365,7 +460,7 @@ extern TclIntPlatStubs *tclIntPlatStubsP
  * Inline function declarations:
  */
 
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
 #ifndef TclGetAndDetachPids
 #define TclGetAndDetachPids \
 	(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
@@ -424,7 +519,7 @@ extern TclIntPlatStubs *tclIntPlatStubsP
 	(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
 #endif
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef TclWinConvertError
 #define TclWinConvertError \
 	(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
@@ -527,8 +622,65 @@ extern TclIntPlatStubs *tclIntPlatStubsP
 #define TclWinCPUID \
 	(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
 #endif
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#ifndef TclGetAndDetachPids
+#define TclGetAndDetachPids \
+	(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
+#endif
+#ifndef TclpCloseFile
+#define TclpCloseFile \
+	(tclIntPlatStubsPtr->tclpCloseFile) /* 1 */
+#endif
+#ifndef TclpCreateCommandChannel
+#define TclpCreateCommandChannel \
+	(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
+#endif
+#ifndef TclpCreatePipe
+#define TclpCreatePipe \
+	(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
+#endif
+#ifndef TclpCreateProcess
+#define TclpCreateProcess \
+	(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
+#endif
+/* Slot 5 is reserved */
+#ifndef TclpMakeFile
+#define TclpMakeFile \
+	(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
+#endif
+#ifndef TclpOpenFile
+#define TclpOpenFile \
+	(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
+#endif
+#ifndef TclUnixWaitForFile
+#define TclUnixWaitForFile \
+	(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
+#endif
+#ifndef TclpCreateTempFile
+#define TclpCreateTempFile \
+	(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
+#endif
+#ifndef TclpReaddir
+#define TclpReaddir \
+	(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
+#endif
+#ifndef TclpLocaltime_unix
+#define TclpLocaltime_unix \
+	(tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
+#endif
+#ifndef TclpGmtime_unix
+#define TclpGmtime_unix \
+	(tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
+#endif
+#ifndef TclpInetNtoa
+#define TclpInetNtoa \
+	(tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+#endif
+#ifndef TclUnixCopyFile
+#define TclUnixCopyFile \
+	(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
+#endif
 #ifndef TclMacOSXGetFileAttribute
 #define TclMacOSXGetFileAttribute \
 	(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
@@ -545,7 +697,7 @@ extern TclIntPlatStubs *tclIntPlatStubsP
 #define TclMacOSXMatchType \
 	(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
 #endif
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 
 #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
 
Index: generic/tclPlatDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPlatDecls.h,v
retrieving revision 1.25
diff -u -p -r1.25 tclPlatDecls.h
--- generic/tclPlatDecls.h	15 Nov 2006 14:58:27 -0000	1.25
+++ generic/tclPlatDecls.h	10 Dec 2007 15:13:23 -0000
@@ -47,7 +47,7 @@
  * Exported function declarations:
  */
 
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef Tcl_WinUtfToTChar_TCL_DECLARED
 #define Tcl_WinUtfToTChar_TCL_DECLARED
 /* 0 */
@@ -60,8 +60,8 @@ EXTERN TCHAR *		Tcl_WinUtfToTChar (CONST
 EXTERN char *		Tcl_WinTCharToUtf (CONST TCHAR * str, int len, 
 				Tcl_DString * dsPtr);
 #endif
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_MacOSXOpenBundleResources_TCL_DECLARED
 #define Tcl_MacOSXOpenBundleResources_TCL_DECLARED
 /* 0 */
@@ -78,20 +78,20 @@ EXTERN int		Tcl_MacOSXOpenVersionedBundl
 				int hasResourceFile, int maxPathLen, 
 				char * libraryPath);
 #endif
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 
 typedef struct TclPlatStubs {
     int magic;
     struct TclPlatStubHooks *hooks;
 
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     TCHAR * (*tcl_WinUtfToTChar) (CONST char * str, int len, Tcl_DString * dsPtr); /* 0 */
     char * (*tcl_WinTCharToUtf) (CONST TCHAR * str, int len, Tcl_DString * dsPtr); /* 1 */
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp * interp, CONST char * bundleName, int hasResourceFile, int maxPathLen, char * libraryPath); /* 0 */
     int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp * interp, CONST char * bundleName, CONST char * bundleVersion, int hasResourceFile, int maxPathLen, char * libraryPath); /* 1 */
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 } TclPlatStubs;
 
 #ifdef __cplusplus
@@ -108,7 +108,7 @@ extern TclPlatStubs *tclPlatStubsPtr;
  * Inline function declarations:
  */
 
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
 #ifndef Tcl_WinUtfToTChar
 #define Tcl_WinUtfToTChar \
 	(tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */
@@ -117,8 +117,8 @@ extern TclPlatStubs *tclPlatStubsPtr;
 #define Tcl_WinTCharToUtf \
 	(tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */
 #endif
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
 #ifndef Tcl_MacOSXOpenBundleResources
 #define Tcl_MacOSXOpenBundleResources \
 	(tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */
@@ -127,7 +127,7 @@ extern TclPlatStubs *tclPlatStubsPtr;
 #define Tcl_MacOSXOpenVersionedBundleResources \
 	(tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */
 #endif
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 
 #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
 
Index: generic/tclStubInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStubInit.c,v
retrieving revision 1.146
diff -u -p -r1.146 tclStubInit.c
--- generic/tclStubInit.c	12 Nov 2007 02:07:20 -0000	1.146
+++ generic/tclStubInit.c	10 Dec 2007 15:13:23 -0000
@@ -79,21 +79,27 @@ TclIntStubs tclIntStubs = {
     NULL, /* 2 */
     TclAllocateFreeObjects, /* 3 */
     NULL, /* 4 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     TclCleanupChildren, /* 5 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     TclCleanupChildren, /* 5 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    TclCleanupChildren, /* 5 */
+#endif /* MACOSX */
     TclCleanupCommand, /* 6 */
     TclCopyAndCollapse, /* 7 */
     TclCopyChannel, /* 8 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     TclCreatePipeline, /* 9 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    TclCreatePipeline, /* 9 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     TclCreatePipeline, /* 9 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     TclCreateProc, /* 10 */
     TclDeleteCompiledLocalVars, /* 11 */
     TclDeleteVars, /* 12 */
@@ -188,12 +194,15 @@ TclIntStubs tclIntStubs = {
     TclSetPreInitScript, /* 101 */
     TclSetupEnv, /* 102 */
     TclSockGetPort, /* 103 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     TclSockMinimumBuffers, /* 104 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    TclSockMinimumBuffers, /* 104 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     TclSockMinimumBuffers, /* 104 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     NULL, /* 105 */
     NULL, /* 106 */
     NULL, /* 107 */
@@ -333,7 +342,7 @@ TclIntStubs tclIntStubs = {
 TclIntPlatStubs tclIntPlatStubs = {
     TCL_STUB_MAGIC,
     NULL,
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     TclGetAndDetachPids, /* 0 */
     TclpCloseFile, /* 1 */
     TclpCreateCommandChannel, /* 2 */
@@ -350,7 +359,7 @@ TclIntPlatStubs tclIntPlatStubs = {
     TclpInetNtoa, /* 13 */
     TclUnixCopyFile, /* 14 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     TclWinConvertError, /* 0 */
     TclWinConvertWSAError, /* 1 */
     TclWinGetServByName, /* 2 */
@@ -381,26 +390,41 @@ TclIntPlatStubs tclIntPlatStubs = {
     TclWinFlushDirtyChannels, /* 27 */
     TclWinResetInterfaces, /* 28 */
     TclWinCPUID, /* 29 */
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    TclGetAndDetachPids, /* 0 */
+    TclpCloseFile, /* 1 */
+    TclpCreateCommandChannel, /* 2 */
+    TclpCreatePipe, /* 3 */
+    TclpCreateProcess, /* 4 */
+    NULL, /* 5 */
+    TclpMakeFile, /* 6 */
+    TclpOpenFile, /* 7 */
+    TclUnixWaitForFile, /* 8 */
+    TclpCreateTempFile, /* 9 */
+    TclpReaddir, /* 10 */
+    TclpLocaltime_unix, /* 11 */
+    TclpGmtime_unix, /* 12 */
+    TclpInetNtoa, /* 13 */
+    TclUnixCopyFile, /* 14 */
     TclMacOSXGetFileAttribute, /* 15 */
     TclMacOSXSetFileAttribute, /* 16 */
     TclMacOSXCopyFileAttributes, /* 17 */
     TclMacOSXMatchType, /* 18 */
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 };
 
 TclPlatStubs tclPlatStubs = {
     TCL_STUB_MAGIC,
     NULL,
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     Tcl_WinUtfToTChar, /* 0 */
     Tcl_WinTCharToUtf, /* 1 */
-#endif /* __WIN32__ */
-#ifdef MAC_OSX_TCL
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     Tcl_MacOSXOpenBundleResources, /* 0 */
     Tcl_MacOSXOpenVersionedBundleResources, /* 1 */
-#endif /* MAC_OSX_TCL */
+#endif /* MACOSX */
 };
 
 TclTomMathStubs tclTomMathStubs = {
@@ -487,18 +511,24 @@ TclStubs tclStubs = {
     Tcl_DbCkalloc, /* 6 */
     Tcl_DbCkfree, /* 7 */
     Tcl_DbCkrealloc, /* 8 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_CreateFileHandler, /* 9 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     NULL, /* 9 */
-#endif /* __WIN32__ */
-#if !defined(__WIN32__) /* UNIX */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    Tcl_CreateFileHandler, /* 9 */
+#endif /* MACOSX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_DeleteFileHandler, /* 10 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     NULL, /* 10 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    Tcl_DeleteFileHandler, /* 10 */
+#endif /* MACOSX */
     Tcl_SetTimer, /* 11 */
     Tcl_Sleep, /* 12 */
     Tcl_WaitForEvent, /* 13 */
@@ -599,12 +629,15 @@ TclStubs tclStubs = {
     Tcl_DeleteHashEntry, /* 108 */
     Tcl_DeleteHashTable, /* 109 */
     Tcl_DeleteInterp, /* 110 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_DetachPids, /* 111 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    Tcl_DetachPids, /* 111 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     Tcl_DetachPids, /* 111 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     Tcl_DeleteTimerHandler, /* 112 */
     Tcl_DeleteTrace, /* 113 */
     Tcl_DontCallWhenDeleted, /* 114 */
@@ -660,12 +693,15 @@ TclStubs tclStubs = {
     Tcl_GetMaster, /* 164 */
     Tcl_GetNameOfExecutable, /* 165 */
     Tcl_GetObjResult, /* 166 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_GetOpenFile, /* 167 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
     NULL, /* 167 */
-#endif /* __WIN32__ */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+    Tcl_GetOpenFile, /* 167 */
+#endif /* MACOSX */
     Tcl_GetPathType, /* 168 */
     Tcl_Gets, /* 169 */
     Tcl_GetsObj, /* 170 */
@@ -695,12 +731,15 @@ TclStubs tclStubs = {
     Tcl_NotifyChannel, /* 194 */
     Tcl_ObjGetVar2, /* 195 */
     Tcl_ObjSetVar2, /* 196 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_OpenCommandChannel, /* 197 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    Tcl_OpenCommandChannel, /* 197 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     Tcl_OpenCommandChannel, /* 197 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     Tcl_OpenFileChannel, /* 198 */
     Tcl_OpenTcpClient, /* 199 */
     Tcl_OpenTcpServer, /* 200 */
@@ -710,12 +749,15 @@ TclStubs tclStubs = {
     Tcl_PosixError, /* 204 */
     Tcl_QueueEvent, /* 205 */
     Tcl_Read, /* 206 */
-#if !defined(__WIN32__) /* UNIX */
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
     Tcl_ReapDetachedProcs, /* 207 */
 #endif /* UNIX */
-#ifdef __WIN32__
+#ifdef __WIN32__ /* WIN */
+    Tcl_ReapDetachedProcs, /* 207 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
     Tcl_ReapDetachedProcs, /* 207 */
-#endif /* __WIN32__ */
+#endif /* MACOSX */
     Tcl_RecordAndEval, /* 208 */
     Tcl_RecordAndEvalObj, /* 209 */
     Tcl_RegisterChannel, /* 210 */
Index: generic/tclTomMath.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTomMath.decls,v
retrieving revision 1.1
diff -u -p -r1.1 tclTomMath.decls
--- generic/tclTomMath.decls	13 Dec 2005 22:43:18 -0000	1.1
+++ generic/tclTomMath.decls	10 Dec 2007 15:13:23 -0000
@@ -161,7 +161,8 @@ declare 44 generic {
     int TclBN_mp_to_unsigned_bin(mp_int* a, unsigned char* b)
 }
 declare 45 generic {
-    int TclBN_mp_to_unsigned_bin_n(mp_int* a, unsigned char* b, unsigned long* outlen)
+    int TclBN_mp_to_unsigned_bin_n(mp_int* a, unsigned char* b,
+	    unsigned long* outlen)
 }
 declare 46 generic {
     int TclBN_mp_toradix_n(mp_int* a, char* str, int radix, int maxlen)
Index: tools/genStubs.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/genStubs.tcl,v
retrieving revision 1.20
diff -u -p -r1.20 genStubs.tcl
--- tools/genStubs.tcl	23 Feb 2007 23:02:54 -0000	1.20
+++ tools/genStubs.tcl	10 Dec 2007 15:13:28 -0000
@@ -1,16 +1,18 @@
 # genStubs.tcl --
 #
 #	This script generates a set of stub files for a given
-#	interface.  
-#	
+#	interface.
+#
 #
 # Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+#
 # See the file "license.terms" for information on usage and redistribution
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
+#
 # RCS: @(#) $Id: genStubs.tcl,v 1.20 2007/02/23 23:02:54 nijtmans Exp $
 
-package require Tcl 8
+package require Tcl 8.4
 
 namespace eval genStubs {
     # libraryName --
@@ -161,6 +163,30 @@ proc genStubs::declare {args} {
     return
 }
 
+# genStubs::export --
+#
+#	This function is used in the declarations file to declare a symbol
+#	that is exported from the library but is not in the stubs table.
+#
+# Arguments:
+#	decl		The C function declaration, or {} for an undefined
+#			entry.
+#
+# Results:
+#	None.
+
+proc genStubs::export {args} {
+    variable stubs
+    variable curName
+
+    if {[llength $args] != 1} {
+	puts stderr "wrong # args: export $args"
+    }
+    lassign $args decl
+
+    return
+}
+
 # genStubs::rewriteFile --
 #
 #	This function replaces the machine generated portion of the
@@ -215,25 +241,51 @@ proc genStubs::rewriteFile {file text} {
 # Results:
 #	Returns the original text inside an appropriate #ifdef.
 
-proc genStubs::addPlatformGuard {plat text} {
+proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} {
+    set text ""
     switch $plat {
 	win {
-	    return "#ifdef __WIN32__\n${text}#endif /* __WIN32__ */\n"
+	    append text "#ifdef __WIN32__ /* WIN */\n${iftxt}"
+	    if {$eltxt ne ""} {
+		append text "#else /* WIN */\n${eltxt}"
+	    }
+	    append text "#endif /* WIN */\n"
 	}
 	unix {
-	    return "#if !defined(__WIN32__) /* UNIX */\n${text}#endif /* UNIX */\n"
-	}		    
+	    append text "#if !defined(__WIN32__) && !defined(MAC_OSX_TCL)\
+		    /* UNIX */\n${iftxt}"
+	    if {$eltxt ne ""} {
+		append text "#else /* UNIX */\n${eltxt}"
+	    }
+	    append text "#endif /* UNIX */\n"
+	}
 	macosx {
-	    return "#ifdef MAC_OSX_TCL\n${text}#endif /* MAC_OSX_TCL */\n"
+	    append text "#ifdef MAC_OSX_TCL /* MACOSX */\n${iftxt}"
+	    if {$eltxt ne ""} {
+		append text "#else /* MACOSX */\n${eltxt}"
+	    }
+	    append text "#endif /* MACOSX */\n"
 	}
 	aqua {
-	    return "#ifdef MAC_OSX_TK\n${text}#endif /* MAC_OSX_TK */\n"
+	    append text "#ifdef MAC_OSX_TK /* AQUA */\n${iftxt}"
+	    if {$eltxt ne ""} {
+		append text "#else /* AQUA */\n${eltxt}"
+	    }
+	    append text "#endif /* AQUA */\n"
 	}
 	x11 {
-	    return "#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */\n${text}#endif /* X11 */\n"
+	    append text "#if !(defined(__WIN32__) || defined(MAC_OSX_TK))\
+		    /* X11 */\n${iftxt}"
+	    if {$eltxt ne ""} {
+		append text "#else /* X11 */\n${eltxt}"
+	    }
+	    append text "#endif /* X11 */\n"
+	}
+	default {
+	    append text "${iftxt}${eltxt}"
 	}
     }
-    return "$text"
+    return $text
 }
 
 # genStubs::emitSlots --
@@ -416,9 +468,7 @@ proc genStubs::makeDecl {name decl index
 	    append line ")"
 	}
     }
-    append text $line
-    
-    append text ";"
+    append text $line ";"
     format "#ifndef %s_TCL_DECLARED\n#define %s_TCL_DECLARED\n%s\n#endif\n" \
 	    $fname $fname $text
 }
@@ -475,7 +525,7 @@ proc genStubs::makeStub {name decl index
     set arg1 [lindex $args 0]
 
     if {![string compare $arg1 "TCL_VARARGS"]} {
-	lassign [lindex $args 1] type argName 
+	lassign [lindex $args 1] type argName
 	append text " ($type$argName, ...)\n\{\n"
 	append text "    " $type " var;\n    va_list argList;\n"
 	if {[string compare $rtype "void"]} {
@@ -566,7 +616,7 @@ proc genStubs::makeSlot {name decl index
 	    append text ")"
 	}
     }
-    
+
     append text "; /* $index */\n"
     return $text
 }
@@ -632,110 +682,227 @@ proc genStubs::forAllStubs {name slotPro
 	    set emit 0
 	    if {[info exists stubs($name,generic,$i)]} {
 		if {[llength $slots] > 1} {
-		    puts stderr "platform entry duplicates generic entry: $i"
+		    puts stderr "conflicting generic and platform entries:\
+			    $name $i"
 		}
 		append text [$slotProc $name $stubs($name,generic,$i) $i]
 		set emit 1
 	    } elseif {[llength $slots] > 0} {
-		foreach plat {unix win} {
-		    if {[info exists stubs($name,$plat,$i)]} {
-			append text [addPlatformGuard $plat \
-				[$slotProc $name $stubs($name,$plat,$i) $i]]
-			set emit 1
+		array set slot {unix 0 x11 0 win 0 macosx 0 aqua 0}
+		foreach s $slots {
+		    set slot([lindex [split $s ,] 1]) 1
+		}
+		# "aqua", "macosx" and "x11" are special cases:
+		# "macosx" implies "unix", "aqua" implies "macosx" and "x11"
+		# implies "unix", so we need to be careful not to emit
+		# duplicate stubs entries:
+		if {($slot(unix) && $slot(macosx)) || (
+			($slot(unix) || $slot(macosx)) &&
+			($slot(x11)  || $slot(aqua)))} {
+		    puts stderr "conflicting platform entries: $name $i"
+		}
+		## unix ##
+		set temp {}
+		set plat unix
+		if {!$slot(aqua) && !$slot(x11)} {
+		    if {$slot($plat)} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
 		    } elseif {$onAll} {
-			append text [eval {addPlatformGuard $plat} $skipString]
-			set emit 1
+			eval {append temp} $skipString
 		    }
 		}
-                #
-                # "aqua" and "macosx" and "x11" are special cases, 
-                # since "macosx" always implies "unix" and "aqua", 
-                # "macosx", so we need to be careful not to 
-                # emit duplicate stubs entries for the two.
-                #
-		if {[info exists stubs($name,aqua,$i)]
-                        && ![info exists stubs($name,macosx,$i)]
-                        && ![info exists stubs($name,unix,$i)]} {
-		    append text [addPlatformGuard aqua \
-			    [$slotProc $name $stubs($name,aqua,$i) $i]]
+		if {$temp ne ""} {
+		    append text [addPlatformGuard $plat $temp]
 		    set emit 1
 		}
-		if {[info exists stubs($name,macosx,$i)]
-                        && ![info exists stubs($name,unix,$i)]} {
-		    append text [addPlatformGuard macosx \
-			    [$slotProc $name $stubs($name,macosx,$i) $i]]
+		## x11 ##
+		set temp {}
+		set plat x11
+		if {!$slot(unix) && !$slot(macosx)} {
+		    if {$slot($plat)} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		    } elseif {$onAll} {
+			eval {append temp} $skipString
+		    }
+		}
+		if {$temp ne ""} {
+		    append text [addPlatformGuard $plat $temp]
 		    set emit 1
 		}
-		if {[info exists stubs($name,x11,$i)]
-                        && ![info exists stubs($name,unix,$i)]} {
-		    append text [addPlatformGuard x11 \
-			    [$slotProc $name $stubs($name,x11,$i) $i]]
+		## win ##
+		set temp {}
+		set plat win
+		if {$slot($plat)} {
+		    append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		} elseif {$onAll} {
+		    eval {append temp} $skipString
+		}
+		if {$temp ne ""} {
+		    append text [addPlatformGuard $plat $temp]
+		    set emit 1
+		}
+		## macosx ##
+		set temp {}
+		set plat macosx
+		if {!$slot(aqua) && !$slot(x11)} {
+		    if {$slot($plat)} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		    } elseif {$slot(unix)} {
+			append temp [$slotProc $name $stubs($name,unix,$i) $i]
+		    } elseif {$onAll} {
+			eval {append temp} $skipString
+		    }
+		}
+		if {$temp ne ""} {
+		    append text [addPlatformGuard $plat $temp]
+		    set emit 1
+		}
+		## aqua ##
+		set temp {}
+		set plat aqua
+		if {!$slot(unix) && !$slot(macosx)} {
+		    if {[string range $skipString 1 2] ne "/*"} {
+			# genStubs.tcl previously had a bug here causing it to
+			# erroneously generate both a unix entry and an aqua
+			# entry for a given stubs table slot. To preserve
+			# backwards compatibility, generate a dummy stubs entry
+			# before every aqua entry (note that this breaks the
+			# correspondence between emitted entry number and
+			# actual position of the entry in the stubs table, e.g.
+			# TkIntStubs entry 113 for aqua is in fact at position
+			# 114 in the table, entry 114 at position 116 etc).
+			eval {append temp} $skipString
+			set temp "[string range $temp 0 end-1] /*\
+				Dummy entry for stubs table backwards\
+				compatibility */\n"
+		    }
+		    if {$slot($plat)} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		    } elseif {$onAll} {
+			eval {append temp} $skipString
+		    }
+		}
+		if {$temp ne ""} {
+		    append text [addPlatformGuard $plat $temp]
 		    set emit 1
 		}
 	    }
-	    if {$emit == 0} {
+	    if {!$emit} {
 		eval {append text} $skipString
 	    }
 	}
-	
     } else {
 	# Emit separate stubs blocks per platform
-	foreach plat {unix win} {
-	    if {[info exists stubs($name,$plat,lastNum)]} {
-		set lastNum $stubs($name,$plat,lastNum)
-		set temp {}
-		for {set i 0} {$i <= $lastNum} {incr i} {
-		    if {![info exists stubs($name,$plat,$i)]} {
-			eval {append temp} $skipString
-		    } else {
-			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
-		    }
+	array set block {unix 0 x11 0 win 0 macosx 0 aqua 0}
+	foreach s [array names stubs $name,*,lastNum] {
+	    set block([lindex [split $s ,] 1]) 1
+	}
+	## unix ##
+	if {$block(unix) && !$block(x11)} {
+	    set temp {}
+	    set plat unix
+	    set lastNum $stubs($name,$plat,lastNum)
+	    for {set i 0} {$i <= $lastNum} {incr i} {
+		if {[info exists stubs($name,$plat,$i)]} {
+		    append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		} else {
+		    eval {append temp} $skipString
 		}
-		append text [addPlatformGuard $plat $temp]
 	    }
+	    append text [addPlatformGuard $plat $temp]
 	}
-	if {[info exists stubs($name,unix,lastNum)]} {
-	    set afterUnixNum [expr $stubs($name,unix,lastNum) + 1]
-	} else {
-	    set afterUnixNum 0
+	## win ##
+	if {$block(win)} {
+	    set temp {}
+	    set plat win
+	    set lastNum $stubs($name,$plat,lastNum)
+	    for {set i 0} {$i <= $lastNum} {incr i} {
+		if {[info exists stubs($name,$plat,$i)]} {
+		    append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+		} else {
+		    eval {append temp} $skipString
+		}
+	    }
+	    append text [addPlatformGuard $plat $temp]
 	}
-	if {[info exists stubs($name,aqua,lastNum)]} {
-	    set lastNum $stubs($name,aqua,lastNum)
+	## macosx ##
+	if {$block(macosx) && !$block(aqua) && !$block(x11)} {
 	    set temp {}
-	    # Again, make sure you don't duplicate entries for macosx & unix & aqua.
-	    for {set i $afterUnixNum} {$i <= $lastNum} {incr i} {
-		if {![info exists stubs($name,macosx,$i)]} {
-		    if {![info exists stubs($name,aqua,$i)]} {
-			eval {append temp} $skipString
-		    } else {
-			append temp [$slotProc $name $stubs($name,aqua,$i) $i]
+	    set lastNum -1
+	    foreach plat {unix macosx} {
+		if {$block($plat)} {
+		    set lastNum [expr {$lastNum > $stubs($name,$plat,lastNum)
+			    ? $lastNum : $stubs($name,$plat,lastNum)}]
+		}
+	    }
+	    for {set i 0} {$i <= $lastNum} {incr i} {
+		set emit 0
+		foreach plat {unix macosx} {
+		    if {[info exists stubs($name,$plat,$i)]} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+			set emit 1
+			break
 		    }
 		}
+		if {!$emit} {
+		    eval {append temp} $skipString
+		}
 	    }
-	    append text [addPlatformGuard aqua $temp]
+	    append text [addPlatformGuard macosx $temp]
 	}
-	if {[info exists stubs($name,macosx,lastNum)]} {
-	    set lastNum $stubs($name,macosx,lastNum)
+	## aqua ##
+	if {$block(aqua)} {
 	    set temp {}
-	    # Again, make sure you don't duplicate entries for macosx & unix.
-	    for {set i $afterUnixNum} {$i <= $lastNum} {incr i} {
-		if {![info exists stubs($name,macosx,$i)]} {
+	    set lastNum -1
+	    foreach plat {unix macosx aqua} {
+		if {$block($plat)} {
+		    set lastNum [expr {$lastNum > $stubs($name,$plat,lastNum)
+			    ? $lastNum : $stubs($name,$plat,lastNum)}]
+		}
+	    }
+	    for {set i 0} {$i <= $lastNum} {incr i} {
+		set emit 0
+		foreach plat {unix macosx aqua} {
+		    if {[info exists stubs($name,$plat,$i)]} {
+			append temp [$slotProc $name $stubs($name,$plat,$i) $i]
+			set emit 1
+			break
+		    }
+		}
+		if {!$emit} {
 		    eval {append temp} $skipString
-		} else {
-		    append temp [$slotProc $name $stubs($name,macosx,$i) $i]
 		}
 	    }
-	    append text [addPlatformGuard macosx $temp]
+	    append text [addPlatformGuard aqua $temp]
 	}
-	if {[info exists stubs($name,x11,lastNum)]} {
-	    set lastNum $stubs($name,x11,lastNum)
+	## x11 ##
+	if {$block(x11)} {
 	    set temp {}
-	    # Again, make sure you don't duplicate entries for x11 & unix.
-	    for {set i $afterUnixNum} {$i <= $lastNum} {incr i} {
-		if {![info exists stubs($name,x11,$i)]} {
+	    set lastNum -1
+	    foreach plat {unix macosx x11} {
+		if {$block($plat)} {
+		    set lastNum [expr {$lastNum > $stubs($name,$plat,lastNum)
+			    ? $lastNum : $stubs($name,$plat,lastNum)}]
+		}
+	    }
+	    for {set i 0} {$i <= $lastNum} {incr i} {
+		set emit 0
+		foreach plat {unix macosx x11} {
+		    if {[info exists stubs($name,$plat,$i)]} {
+			if {$plat ne "macosx"} {
+			    append temp [$slotProc $name \
+				    $stubs($name,$plat,$i) $i]
+			} else {
+			    eval {set etxt} $skipString
+			    append temp [addPlatformGuard $plat [$slotProc \
+				    $name $stubs($name,$plat,$i) $i] $etxt]
+			}
+			set emit 1
+			break
+		    }
+		}
+		if {!$emit} {
 		    eval {append temp} $skipString
-		} else {
-		    append temp [$slotProc $name $stubs($name,x11,$i) $i]
 		}
 	    }
 	    append text [addPlatformGuard x11 $temp]
@@ -780,12 +947,14 @@ proc genStubs::emitMacros {name textVar}
     upvar $textVar text
 
     set upName [string toupper $libraryName]
-    append text "\n#if defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS)\n"
+    append text "\n#if defined(USE_${upName}_STUBS) &&\
+	    !defined(USE_${upName}_STUB_PROCS)\n"
     append text "\n/*\n * Inline function declarations:\n */\n\n"
-    
+
     forAllStubs $name makeMacro 0 text
 
-    append text "\n#endif /* defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS) */\n"
+    append text "\n#endif /* defined(USE_${upName}_STUBS) &&\
+	    !defined(USE_${upName}_STUB_PROCS) */\n"
     return
 }
 
@@ -854,7 +1023,7 @@ proc genStubs::emitStubs {name} {
     forAllStubs $name makeStub 0 text
 
     rewriteFile [file join $outDir ${name}Stubs.c] $text
-    return    
+    return
 }
 
 # genStubs::emitInit --
@@ -877,7 +1046,7 @@ proc genStubs::emitInit {name textVar} {
     append capName [string range $name 1 end]
 
     if {[info exists hooks($name)]} {
- 	append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
+	append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
 	set sep "    "
 	foreach sub $hooks($name) {
 	    append text $sep "&${sub}Stubs"
@@ -892,7 +1061,7 @@ proc genStubs::emitInit {name textVar} {
     } else {
 	append text "    NULL,\n"
     }
-    
+
     forAllStubs $name makeInit 1 text {"    NULL, /* $i */\n"}
 
     append text "\};\n"
@@ -984,14 +1153,13 @@ proc genStubs::init {} {
 #	Returns any values that were not assigned to variables.
 
 if {[string length [namespace which lassign]] == 0} {
-proc lassign {valueList args} {
-  if {[llength $args] == 0} {
-      error "wrong # args: lassign list varname ?varname..?"
-  }
-
-  uplevel [list foreach $args $valueList {break}]
-  return [lrange $valueList [llength $args] end]
-}
+    proc lassign {valueList args} {
+	if {[llength $args] == 0} {
+	    error "wrong # args: lassign list varname ?varname..?"
+	}
+	uplevel [list foreach $args $valueList {break}]
+	return [lrange $valueList [llength $args] end]
+    }
 }
- 
+
 genStubs::init
