diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-22 12:44:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-05-22 12:44:36 (GMT) |
commit | 0db5ef521489368fde7298d7d4179aa01e9fcc01 (patch) | |
tree | 547f1279c0ce411de4125eaac91a118af4215da5 | |
parent | a6a7e5ca7699ad328ed645c207aaba8b69e32a53 (diff) | |
parent | 6f812b4ccb74d0aebe4bbf520bd6710fa82cf549 (diff) | |
download | tcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.zip tcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.tar.gz tcl-0db5ef521489368fde7298d7d4179aa01e9fcc01.tar.bz2 |
Revert most of [fcc5957e59], since when we let cygwin share the win32 stub table this is no longer necessary
implement TclpInetNtoa for win32
Let cygwin share stub table with win32
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tcl.decls | 8 | ||||
-rw-r--r-- | generic/tclDecls.h | 24 | ||||
-rw-r--r-- | generic/tclInt.decls | 145 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 822 | ||||
-rw-r--r-- | generic/tclStubInit.c | 197 | ||||
-rw-r--r-- | tools/genStubs.tcl | 73 | ||||
-rw-r--r-- | win/Makefile.in | 14 | ||||
-rw-r--r-- | win/tclWinSock.c | 28 |
9 files changed, 500 insertions, 820 deletions
@@ -1,3 +1,12 @@ +2012-05-22 Jan Nijtmans <nijtmans@users.sf.net> + + * tools/genStubs.tcl: Let cygwin share stub table with win32 + * win/Makefile.in: Don't hardcode dde and reg dll version numbers + * win/tclWinSock.c: implement TclpInetNtoa for win32 + * generic/tclInt.decls: Revert most of [fcc5957e59], since when + we let cygwin share the win32 stub table this is no longer necessary + * generic/tcl*Decls.h: re-generated + 2012-05-21 Don Porter <dgp@users.sourceforge.net> * generic/tclFileName.c: When using Tcl_SetObjLength() calls to grow diff --git a/generic/tcl.decls b/generic/tcl.decls index e41a54b..256701d 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2154,6 +2154,14 @@ 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) } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 2c5838d..703030d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -86,7 +86,7 @@ EXTERN void Tcl_DbCkfree(char *ptr, CONST char *file, int line); EXTERN char * Tcl_DbCkrealloc(char *ptr, unsigned int size, CONST char *file, int line); #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_CreateFileHandler_TCL_DECLARED #define Tcl_CreateFileHandler_TCL_DECLARED /* 9 */ @@ -102,7 +102,7 @@ EXTERN void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc, ClientData clientData); #endif #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_DeleteFileHandler_TCL_DECLARED #define Tcl_DeleteFileHandler_TCL_DECLARED /* 10 */ @@ -1013,7 +1013,7 @@ EXTERN CONST char * Tcl_GetNameOfExecutable(void); /* 166 */ EXTERN Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp); #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_GetOpenFile_TCL_DECLARED #define Tcl_GetOpenFile_TCL_DECLARED /* 167 */ @@ -3428,19 +3428,19 @@ typedef struct TclStubs { char * (*tcl_DbCkalloc) (unsigned int size, CONST char *file, int line); /* 6 */ void (*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__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ VOID *reserved9; #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 */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ void (*tcl_DeleteFileHandler) (int fd); /* 10 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ VOID *reserved10; #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -3602,10 +3602,10 @@ 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__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ int (*tcl_GetOpenFile) (Tcl_Interp *interp, CONST char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ VOID *reserved167; #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -4075,7 +4075,7 @@ extern TclStubs *tclStubsPtr; #define Tcl_DbCkrealloc \ (tclStubsPtr->tcl_DbCkrealloc) /* 8 */ #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_CreateFileHandler #define Tcl_CreateFileHandler \ (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ @@ -4087,7 +4087,7 @@ extern TclStubs *tclStubsPtr; (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ #endif #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_DeleteFileHandler #define Tcl_DeleteFileHandler \ (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ @@ -4723,7 +4723,7 @@ extern TclStubs *tclStubsPtr; #define Tcl_GetObjResult \ (tclStubsPtr->tcl_GetObjResult) /* 166 */ #endif -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ #ifndef Tcl_GetOpenFile #define Tcl_GetOpenFile \ (tclStubsPtr->tcl_GetOpenFile) /* 167 */ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 6dd7033..75d3c3c 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -126,8 +126,8 @@ declare 25 { # } # Removed in 8.5 #declare 27 { -# int TclGetDate(char *p, Tcl_WideInt now, long zone, -# Tcl_WideInt *timePtr) +# int TclGetDate(char *p, unsigned long now, long zone, +# unsigned long *timePtr) #} declare 28 { Tcl_Channel TclpGetDefaultStdChannel(int type) @@ -187,7 +187,7 @@ declare 42 { } # Removed in Tcl 8.5a2 #declare 43 { -# int TclGlobalInvoke(Tcl_Interp *interp, int argc, const char **argv, +# int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) #} declare 44 { @@ -222,7 +222,7 @@ declare 51 { } # Removed in Tcl 8.5a2 #declare 52 { -# int TclInvoke(Tcl_Interp *interp, int argc, const char **argv, +# int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) #} declare 53 { @@ -421,9 +421,6 @@ declare 103 { declare 104 { int TclSockMinimumBuffersOld(int sock, int size) } -declare 110 { - int TclSockMinimumBuffers(void *sock, int size) -} # Replaced by Tcl_FSStat in 8.4: #declare 105 { # int TclStat(const char *path, Tcl_StatBuf *buf) @@ -440,6 +437,9 @@ declare 108 { declare 109 { int TclUpdateReturnInfo(Interp *iPtr) } +declare 110 { + int TclSockMinimumBuffers(void *sock, int size) +} # Removed in 8.1: # declare 110 { # char *TclWordEnd(char *start, char *lastChar, int nested, int *semiPtr) @@ -732,6 +732,16 @@ declare 179 { Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr) } +# REMOVED +# Allocate lists without copying arrays +# declare 180 { +# Tcl_Obj *TclNewListObjDirect(int objc, Tcl_Obj **objv) +# } +#declare 181 { +# Tcl_Obj *TclDbNewListObjDirect(int objc, Tcl_Obj **objv, +# const char *file, int line) +#} + # TclpGmtime and TclpLocaltime promoted to the generic interface from unix declare 182 { @@ -963,12 +973,16 @@ declare 3 win { declare 4 win { HINSTANCE TclWinGetTclInstance(void) } +# new for 8.4.20+/8.5.12+ Cygwin only +declare 5 win { + int TclUnixWaitForFile(int fd, int mask, int timeout) +} # Removed in 8.1: # declare 5 win { # HINSTANCE TclWinLoadLibrary(char *name) # } declare 6 win { - u_short TclWinNToHS(u_short ns) + unsigned short TclWinNToHS(unsigned short ns) } declare 7 win { int TclWinSetSockOpt(SOCKET s, int level, int optname, @@ -980,6 +994,10 @@ declare 8 win { declare 9 win { int TclWinGetPlatformId(void) } +# new for 8.4.20+/8.5.12+ Cygwin only +declare 10 win { + Tcl_DirEntry *TclpReaddir(DIR *dir) +} # Removed in 8.3.1 (for Win32s only) #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) @@ -1001,9 +1019,9 @@ declare 14 win { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } declare 15 win { - int TclpCreateProcess(Tcl_Interp *interp, int argc, const char **argv, - TclFile inputFile, TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr) + int TclpCreateProcess(Tcl_Interp *interp, int argc, + const char **argv, TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr) } # Signature changed in 8.1: # declare 16 win { @@ -1021,7 +1039,10 @@ declare 19 win { declare 20 win { void TclWinAddProcess(HANDLE hProcess, DWORD id) } - +# new for 8.4.20+/8.5.12+ +declare 21 win { + char *TclpInetNtoa(struct in_addr addr) +} # removed permanently for 8.4 #declare 21 win { # void TclpAsyncMark(Tcl_AsyncHandler async) @@ -1065,51 +1086,42 @@ declare 29 win { # Pipe channel functions -# On non-cygwin, this is actually a reference to TclGetAndDetachPids declare 0 unix { - void TclWinConvertError(unsigned int errCode) + void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) } -# On non-cygwin, this is actually a reference to TclpCloseFile declare 1 unix { - void TclWinConvertWSAError(unsigned int errCode) + int TclpCloseFile(TclFile file) } -# On non-cygwin, this is actually a reference to TclpCreateCommandChannel declare 2 unix { - struct servent *TclWinGetServByName(const char *nm, const char *proto) + Tcl_Channel TclpCreateCommandChannel(TclFile readFile, + TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) } -# On non-cygwin, this is actually a reference to TclpCreatePipe declare 3 unix { - int TclWinGetSockOpt(void *s, int level, int optname, - char *optval, int *optlen) + int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } -# On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { - void *TclWinGetTclInstance(void) + int TclpCreateProcess(Tcl_Interp *interp, int argc, + const char **argv, TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr) } # Signature changed in 8.1: # declare 5 unix { # TclFile TclpCreateTempFile(char *contents, Tcl_DString *namePtr) # } - -# On non-cygwin, this is actually a reference to TclpMakeFile declare 6 unix { - unsigned short TclWinNToHS(unsigned short ns) + TclFile TclpMakeFile(Tcl_Channel channel, int direction) } -# On non-cygwin, this is actually a reference to TclpOpenFile declare 7 unix { - int TclWinSetSockOpt(void *s, int level, int optname, - const char *optval, int optlen) + TclFile TclpOpenFile(const char *fname, int mode) } -# On non-cygwin, this is actually a reference to TclUnixWaitForFile declare 8 unix { - int TclpGetPid(Tcl_Pid pid) + int TclUnixWaitForFile(int fd, int mask, int timeout) } # Added in 8.1: -# On non-cygwin, this is actually a reference to TclpCreateTempFile declare 9 unix { - int TclWinGetPlatformId(void) + TclFile TclpCreateTempFile(const char *contents) } # Added in 8.4: @@ -1119,18 +1131,14 @@ declare 10 unix { } # Slots 11 and 12 are forwarders for functions that were promoted to # generic Stubs -# On cygwin, this is actually a reference to TclGetAndDetachPids declare 11 unix { - struct tm *TclpLocaltime_unix(const time_t *clock) + struct tm *TclpLocaltime_unix(TclpTime_t_CONST clock) } -# On cygwin, this is actually a reference to TclpCloseFile declare 12 unix { - struct tm *TclpGmtime_unix(const time_t *clock) + struct tm *TclpGmtime_unix(TclpTime_t_CONST clock) } -# On cygwin, this is a reference to TclpCreateCommandChannel -# Otherwise, this is a reference to TclpInetNtoa declare 13 unix { - void TclIntPlatReserved13(void) + char *TclpInetNtoa(struct in_addr addr) } # Added in 8.5: @@ -1143,8 +1151,7 @@ declare 14 unix { ################################ # Mac OS X specific functions -#On cygwin, TclpCreateProcess is here -declare 15 {unix macosx} { +declare 15 macosx { int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr) } @@ -1156,67 +1163,17 @@ declare 17 macosx { int TclMacOSXCopyFileAttributes(const char *src, const char *dst, const Tcl_StatBuf *statBufPtr) } -#On cygwin, TclpMakeFile is here -declare 18 {unix macosx} { +declare 18 macosx { int TclMacOSXMatchType(Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types) } -#On cygwin, TclpOpenFile is here -declare 19 {unix macosx} { +declare 19 macosx { void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode) } -declare 20 unix { - void TclWinAddProcess(void *hProcess, unsigned int id) -} -declare 22 unix { - TclFile TclpCreateTempFile(const char *contents) -} -declare 24 unix { - char *TclWinNoBackslash(char *path) -} -declare 26 unix { - void TclWinSetInterfaces(int wide) -} -declare 27 unix { - void TclWinFlushDirtyChannels(void) -} -declare 28 unix { - void TclWinResetInterfaces(void) -} declare 29 unix { int TclWinCPUID(unsigned int index, unsigned int *regs) } -declare 30 unix { - void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) -} -declare 31 unix { - int TclpCloseFile(TclFile file) -} -declare 32 unix { - Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) -} -declare 33 unix { - int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) -} -declare 34 unix { - int TclpCreateProcess(Tcl_Interp *interp, - int argc, const char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr) -} -declare 35 unix { - char *TclpInetNtoa(struct in_addr addr) -} -declare 36 unix { - TclFile TclpMakeFile(Tcl_Channel channel, int direction) -} -declare 37 unix { - TclFile TclpOpenFile(const char *fname, int mode) -} -declare 38 unix { - int TclUnixWaitForFile(int fd, int mask, int timeout) -} # Local Variables: # mode: tcl diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 60501c9..447a736 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -13,6 +13,11 @@ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS +#ifdef __WIN32__ +# define Tcl_DirEntry void +# define DIR void +#endif + #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl # define TCL_STORAGE_CLASS DLLEXPORT @@ -36,55 +41,58 @@ * Exported function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclWinConvertError_TCL_DECLARED -#define TclWinConvertError_TCL_DECLARED +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) /* UNIX */ +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError(unsigned int errCode); +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); #endif -#ifndef TclWinConvertWSAError_TCL_DECLARED -#define TclWinConvertWSAError_TCL_DECLARED +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError(unsigned int errCode); +EXTERN int TclpCloseFile(TclFile file); #endif -#ifndef TclWinGetServByName_TCL_DECLARED -#define TclWinGetServByName_TCL_DECLARED +#ifndef TclpCreateCommandChannel_TCL_DECLARED +#define TclpCreateCommandChannel_TCL_DECLARED /* 2 */ -EXTERN struct servent * TclWinGetServByName(CONST char *nm, - CONST char *proto); +EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, + TclFile writeFile, TclFile errorFile, + int numPids, Tcl_Pid *pidPtr); #endif -#ifndef TclWinGetSockOpt_TCL_DECLARED -#define TclWinGetSockOpt_TCL_DECLARED +#ifndef TclpCreatePipe_TCL_DECLARED +#define TclpCreatePipe_TCL_DECLARED /* 3 */ -EXTERN int TclWinGetSockOpt(VOID *s, int level, int optname, - char *optval, int *optlen); +EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclWinGetTclInstance_TCL_DECLARED -#define TclWinGetTclInstance_TCL_DECLARED +#ifndef TclpCreateProcess_TCL_DECLARED +#define TclpCreateProcess_TCL_DECLARED /* 4 */ -EXTERN VOID * TclWinGetTclInstance(void); +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 TclWinNToHS_TCL_DECLARED -#define TclWinNToHS_TCL_DECLARED +#ifndef TclpMakeFile_TCL_DECLARED +#define TclpMakeFile_TCL_DECLARED /* 6 */ -EXTERN unsigned short TclWinNToHS(unsigned short ns); +EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); #endif -#ifndef TclWinSetSockOpt_TCL_DECLARED -#define TclWinSetSockOpt_TCL_DECLARED +#ifndef TclpOpenFile_TCL_DECLARED +#define TclpOpenFile_TCL_DECLARED /* 7 */ -EXTERN int TclWinSetSockOpt(VOID *s, int level, int optname, - CONST char *optval, int optlen); +EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); #endif -#ifndef TclpGetPid_TCL_DECLARED -#define TclpGetPid_TCL_DECLARED +#ifndef TclUnixWaitForFile_TCL_DECLARED +#define TclUnixWaitForFile_TCL_DECLARED /* 8 */ -EXTERN int TclpGetPid(Tcl_Pid pid); +EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); #endif -#ifndef TclWinGetPlatformId_TCL_DECLARED -#define TclWinGetPlatformId_TCL_DECLARED +#ifndef TclpCreateTempFile_TCL_DECLARED +#define TclpCreateTempFile_TCL_DECLARED /* 9 */ -EXTERN int TclWinGetPlatformId(void); +EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif #ifndef TclpReaddir_TCL_DECLARED #define TclpReaddir_TCL_DECLARED @@ -94,17 +102,17 @@ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); #ifndef TclpLocaltime_unix_TCL_DECLARED #define TclpLocaltime_unix_TCL_DECLARED /* 11 */ -EXTERN struct tm * TclpLocaltime_unix(CONST time_t *clock); +EXTERN struct tm * TclpLocaltime_unix(TclpTime_t_CONST clock); #endif #ifndef TclpGmtime_unix_TCL_DECLARED #define TclpGmtime_unix_TCL_DECLARED /* 12 */ -EXTERN struct tm * TclpGmtime_unix(CONST time_t *clock); +EXTERN struct tm * TclpGmtime_unix(TclpTime_t_CONST clock); #endif -#ifndef TclIntPlatReserved13_TCL_DECLARED -#define TclIntPlatReserved13_TCL_DECLARED +#ifndef TclpInetNtoa_TCL_DECLARED +#define TclpInetNtoa_TCL_DECLARED /* 13 */ -EXTERN void TclIntPlatReserved13(void); +EXTERN char * TclpInetNtoa(struct in_addr addr); #endif #ifndef TclUnixCopyFile_TCL_DECLARED #define TclUnixCopyFile_TCL_DECLARED @@ -113,120 +121,27 @@ 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 */ -EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp, - int objIndex, Tcl_Obj *fileName, - Tcl_Obj **attributePtrPtr); -#endif +/* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ -#ifndef TclMacOSXMatchType_TCL_DECLARED -#define TclMacOSXMatchType_TCL_DECLARED -/* 18 */ -EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, - CONST char *pathName, CONST char *fileName, - Tcl_StatBuf *statBufPtr, - Tcl_GlobTypeData *types); -#endif -#ifndef TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED -#define TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED -/* 19 */ -EXTERN void TclMacOSXNotifierAddRunLoopMode( - CONST VOID *runLoopMode); -#endif -#ifndef TclWinAddProcess_TCL_DECLARED -#define TclWinAddProcess_TCL_DECLARED -/* 20 */ -EXTERN void TclWinAddProcess(VOID *hProcess, unsigned int id); -#endif +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile_TCL_DECLARED -#define TclpCreateTempFile_TCL_DECLARED -/* 22 */ -EXTERN TclFile TclpCreateTempFile(CONST char *contents); -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash_TCL_DECLARED -#define TclWinNoBackslash_TCL_DECLARED -/* 24 */ -EXTERN char * TclWinNoBackslash(char *path); -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces_TCL_DECLARED -#define TclWinSetInterfaces_TCL_DECLARED -/* 26 */ -EXTERN void TclWinSetInterfaces(int wide); -#endif -#ifndef TclWinFlushDirtyChannels_TCL_DECLARED -#define TclWinFlushDirtyChannels_TCL_DECLARED -/* 27 */ -EXTERN void TclWinFlushDirtyChannels(void); -#endif -#ifndef TclWinResetInterfaces_TCL_DECLARED -#define TclWinResetInterfaces_TCL_DECLARED -/* 28 */ -EXTERN void TclWinResetInterfaces(void); -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED -/* 30 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); -#endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED -/* 31 */ -EXTERN int TclpCloseFile(TclFile file); -#endif -#ifndef TclpCreateCommandChannel_TCL_DECLARED -#define TclpCreateCommandChannel_TCL_DECLARED -/* 32 */ -EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, - int numPids, Tcl_Pid *pidPtr); -#endif -#ifndef TclpCreatePipe_TCL_DECLARED -#define TclpCreatePipe_TCL_DECLARED -/* 33 */ -EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); -#endif -#ifndef TclpCreateProcess_TCL_DECLARED -#define TclpCreateProcess_TCL_DECLARED -/* 34 */ -EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, - CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr); -#endif -#ifndef TclpInetNtoa_TCL_DECLARED -#define TclpInetNtoa_TCL_DECLARED -/* 35 */ -EXTERN char * TclpInetNtoa(struct in_addr addr); -#endif -#ifndef TclpMakeFile_TCL_DECLARED -#define TclpMakeFile_TCL_DECLARED -/* 36 */ -EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); -#endif -#ifndef TclpOpenFile_TCL_DECLARED -#define TclpOpenFile_TCL_DECLARED -/* 37 */ -EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); -#endif -#ifndef TclUnixWaitForFile_TCL_DECLARED -#define TclUnixWaitForFile_TCL_DECLARED -/* 38 */ -EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); -#endif #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef TclWinConvertError_TCL_DECLARED #define TclWinConvertError_TCL_DECLARED /* 0 */ @@ -254,11 +169,15 @@ EXTERN int TclWinGetSockOpt(SOCKET s, int level, int optname, /* 4 */ EXTERN HINSTANCE TclWinGetTclInstance(void); #endif -/* Slot 5 is reserved */ +#ifndef TclUnixWaitForFile_TCL_DECLARED +#define TclUnixWaitForFile_TCL_DECLARED +/* 5 */ +EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); +#endif #ifndef TclWinNToHS_TCL_DECLARED #define TclWinNToHS_TCL_DECLARED /* 6 */ -EXTERN u_short TclWinNToHS(u_short ns); +EXTERN unsigned short TclWinNToHS(unsigned short ns); #endif #ifndef TclWinSetSockOpt_TCL_DECLARED #define TclWinSetSockOpt_TCL_DECLARED @@ -276,7 +195,11 @@ EXTERN int TclpGetPid(Tcl_Pid pid); /* 9 */ EXTERN int TclWinGetPlatformId(void); #endif -/* Slot 10 is reserved */ +#ifndef TclpReaddir_TCL_DECLARED +#define TclpReaddir_TCL_DECLARED +/* 10 */ +EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); +#endif #ifndef TclGetAndDetachPids_TCL_DECLARED #define TclGetAndDetachPids_TCL_DECLARED /* 11 */ @@ -325,7 +248,11 @@ EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); /* 20 */ EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id); #endif -/* Slot 21 is reserved */ +#ifndef TclpInetNtoa_TCL_DECLARED +#define TclpInetNtoa_TCL_DECLARED +/* 21 */ +EXTERN char * TclpInetNtoa(struct in_addr addr); +#endif #ifndef TclpCreateTempFile_TCL_DECLARED #define TclpCreateTempFile_TCL_DECLARED /* 22 */ @@ -364,54 +291,57 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclWinConvertError_TCL_DECLARED -#define TclWinConvertError_TCL_DECLARED +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError(unsigned int errCode); +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); #endif -#ifndef TclWinConvertWSAError_TCL_DECLARED -#define TclWinConvertWSAError_TCL_DECLARED +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError(unsigned int errCode); +EXTERN int TclpCloseFile(TclFile file); #endif -#ifndef TclWinGetServByName_TCL_DECLARED -#define TclWinGetServByName_TCL_DECLARED +#ifndef TclpCreateCommandChannel_TCL_DECLARED +#define TclpCreateCommandChannel_TCL_DECLARED /* 2 */ -EXTERN struct servent * TclWinGetServByName(CONST char *nm, - CONST char *proto); +EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, + TclFile writeFile, TclFile errorFile, + int numPids, Tcl_Pid *pidPtr); #endif -#ifndef TclWinGetSockOpt_TCL_DECLARED -#define TclWinGetSockOpt_TCL_DECLARED +#ifndef TclpCreatePipe_TCL_DECLARED +#define TclpCreatePipe_TCL_DECLARED /* 3 */ -EXTERN int TclWinGetSockOpt(VOID *s, int level, int optname, - char *optval, int *optlen); +EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclWinGetTclInstance_TCL_DECLARED -#define TclWinGetTclInstance_TCL_DECLARED +#ifndef TclpCreateProcess_TCL_DECLARED +#define TclpCreateProcess_TCL_DECLARED /* 4 */ -EXTERN VOID * TclWinGetTclInstance(void); +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 TclWinNToHS_TCL_DECLARED -#define TclWinNToHS_TCL_DECLARED +#ifndef TclpMakeFile_TCL_DECLARED +#define TclpMakeFile_TCL_DECLARED /* 6 */ -EXTERN unsigned short TclWinNToHS(unsigned short ns); +EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); #endif -#ifndef TclWinSetSockOpt_TCL_DECLARED -#define TclWinSetSockOpt_TCL_DECLARED +#ifndef TclpOpenFile_TCL_DECLARED +#define TclpOpenFile_TCL_DECLARED /* 7 */ -EXTERN int TclWinSetSockOpt(VOID *s, int level, int optname, - CONST char *optval, int optlen); +EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); #endif -#ifndef TclpGetPid_TCL_DECLARED -#define TclpGetPid_TCL_DECLARED +#ifndef TclUnixWaitForFile_TCL_DECLARED +#define TclUnixWaitForFile_TCL_DECLARED /* 8 */ -EXTERN int TclpGetPid(Tcl_Pid pid); +EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); #endif -#ifndef TclWinGetPlatformId_TCL_DECLARED -#define TclWinGetPlatformId_TCL_DECLARED +#ifndef TclpCreateTempFile_TCL_DECLARED +#define TclpCreateTempFile_TCL_DECLARED /* 9 */ -EXTERN int TclWinGetPlatformId(void); +EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif #ifndef TclpReaddir_TCL_DECLARED #define TclpReaddir_TCL_DECLARED @@ -421,17 +351,17 @@ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); #ifndef TclpLocaltime_unix_TCL_DECLARED #define TclpLocaltime_unix_TCL_DECLARED /* 11 */ -EXTERN struct tm * TclpLocaltime_unix(CONST time_t *clock); +EXTERN struct tm * TclpLocaltime_unix(TclpTime_t_CONST clock); #endif #ifndef TclpGmtime_unix_TCL_DECLARED #define TclpGmtime_unix_TCL_DECLARED /* 12 */ -EXTERN struct tm * TclpGmtime_unix(CONST time_t *clock); +EXTERN struct tm * TclpGmtime_unix(TclpTime_t_CONST clock); #endif -#ifndef TclIntPlatReserved13_TCL_DECLARED -#define TclIntPlatReserved13_TCL_DECLARED +#ifndef TclpInetNtoa_TCL_DECLARED +#define TclpInetNtoa_TCL_DECLARED /* 13 */ -EXTERN void TclIntPlatReserved13(void); +EXTERN char * TclpInetNtoa(struct in_addr addr); #endif #ifndef TclUnixCopyFile_TCL_DECLARED #define TclUnixCopyFile_TCL_DECLARED @@ -475,154 +405,70 @@ EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, EXTERN void TclMacOSXNotifierAddRunLoopMode( CONST VOID *runLoopMode); #endif -#ifndef TclWinAddProcess_TCL_DECLARED -#define TclWinAddProcess_TCL_DECLARED -/* 20 */ -EXTERN void TclWinAddProcess(VOID *hProcess, unsigned int id); -#endif +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile_TCL_DECLARED -#define TclpCreateTempFile_TCL_DECLARED -/* 22 */ -EXTERN TclFile TclpCreateTempFile(CONST char *contents); -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash_TCL_DECLARED -#define TclWinNoBackslash_TCL_DECLARED -/* 24 */ -EXTERN char * TclWinNoBackslash(char *path); -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces_TCL_DECLARED -#define TclWinSetInterfaces_TCL_DECLARED -/* 26 */ -EXTERN void TclWinSetInterfaces(int wide); -#endif -#ifndef TclWinFlushDirtyChannels_TCL_DECLARED -#define TclWinFlushDirtyChannels_TCL_DECLARED -/* 27 */ -EXTERN void TclWinFlushDirtyChannels(void); -#endif -#ifndef TclWinResetInterfaces_TCL_DECLARED -#define TclWinResetInterfaces_TCL_DECLARED -/* 28 */ -EXTERN void TclWinResetInterfaces(void); -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED -/* 30 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); -#endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED -/* 31 */ -EXTERN int TclpCloseFile(TclFile file); -#endif -#ifndef TclpCreateCommandChannel_TCL_DECLARED -#define TclpCreateCommandChannel_TCL_DECLARED -/* 32 */ -EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, - int numPids, Tcl_Pid *pidPtr); -#endif -#ifndef TclpCreatePipe_TCL_DECLARED -#define TclpCreatePipe_TCL_DECLARED -/* 33 */ -EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); -#endif -#ifndef TclpCreateProcess_TCL_DECLARED -#define TclpCreateProcess_TCL_DECLARED -/* 34 */ -EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, - CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr); -#endif -#ifndef TclpInetNtoa_TCL_DECLARED -#define TclpInetNtoa_TCL_DECLARED -/* 35 */ -EXTERN char * TclpInetNtoa(struct in_addr addr); -#endif -#ifndef TclpMakeFile_TCL_DECLARED -#define TclpMakeFile_TCL_DECLARED -/* 36 */ -EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); -#endif -#ifndef TclpOpenFile_TCL_DECLARED -#define TclpOpenFile_TCL_DECLARED -/* 37 */ -EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); -#endif -#ifndef TclUnixWaitForFile_TCL_DECLARED -#define TclUnixWaitForFile_TCL_DECLARED -/* 38 */ -EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); -#endif #endif /* MACOSX */ typedef struct TclIntPlatStubs { int magic; struct TclIntPlatStubHooks *hooks; -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - void (*tclWinConvertError) (unsigned int errCode); /* 0 */ - void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ - struct servent * (*tclWinGetServByName) (CONST char *nm, CONST char *proto); /* 2 */ - int (*tclWinGetSockOpt) (VOID *s, int level, int optname, char *optval, int *optlen); /* 3 */ - VOID * (*tclWinGetTclInstance) (void); /* 4 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) /* 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 */ + 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; - unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ - int (*tclWinSetSockOpt) (VOID *s, int level, int optname, CONST char *optval, int optlen); /* 7 */ - int (*tclpGetPid) (Tcl_Pid pid); /* 8 */ - int (*tclWinGetPlatformId) (void); /* 9 */ + 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 */ - void (*tclIntPlatReserved13) (void); /* 13 */ + struct tm * (*tclpLocaltime_unix) (TclpTime_t_CONST clock); /* 11 */ + struct tm * (*tclpGmtime_unix) (TclpTime_t_CONST 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 */ + VOID *reserved15; VOID *reserved16; VOID *reserved17; - int (*tclMacOSXMatchType) (Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */ - void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ - void (*tclWinAddProcess) (VOID *hProcess, unsigned int id); /* 20 */ + VOID *reserved18; + VOID *reserved19; + VOID *reserved20; VOID *reserved21; - TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ + VOID *reserved22; VOID *reserved23; - char * (*tclWinNoBackslash) (char *path); /* 24 */ + VOID *reserved24; VOID *reserved25; - void (*tclWinSetInterfaces) (int wide); /* 26 */ - void (*tclWinFlushDirtyChannels) (void); /* 27 */ - void (*tclWinResetInterfaces) (void); /* 28 */ + VOID *reserved26; + VOID *reserved27; + VOID *reserved28; int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ - int (*tclpCloseFile) (TclFile file); /* 31 */ - Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 32 */ - int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 33 */ - int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 34 */ - char * (*tclpInetNtoa) (struct in_addr addr); /* 35 */ - TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 36 */ - TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 37 */ - int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 38 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ void (*tclWinConvertError) (DWORD errCode); /* 0 */ void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */ struct servent * (*tclWinGetServByName) (CONST char *nm, CONST char *proto); /* 2 */ int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char *optval, int *optlen); /* 3 */ HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */ - VOID *reserved5; - u_short (*tclWinNToHS) (u_short ns); /* 6 */ + int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */ + unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, CONST char *optval, int optlen); /* 7 */ int (*tclpGetPid) (Tcl_Pid pid); /* 8 */ int (*tclWinGetPlatformId) (void); /* 9 */ - VOID *reserved10; + Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */ int (*tclpCloseFile) (TclFile file); /* 12 */ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */ @@ -633,7 +479,7 @@ typedef struct TclIntPlatStubs { TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */ TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 19 */ void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */ - VOID *reserved21; + char * (*tclpInetNtoa) (struct in_addr addr); /* 21 */ TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ char * (*tclpGetTZName) (int isdst); /* 23 */ char * (*tclWinNoBackslash) (char *path); /* 24 */ @@ -644,45 +490,36 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - void (*tclWinConvertError) (unsigned int errCode); /* 0 */ - void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ - struct servent * (*tclWinGetServByName) (CONST char *nm, CONST char *proto); /* 2 */ - int (*tclWinGetSockOpt) (VOID *s, int level, int optname, char *optval, int *optlen); /* 3 */ - VOID * (*tclWinGetTclInstance) (void); /* 4 */ + 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; - unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ - int (*tclWinSetSockOpt) (VOID *s, int level, int optname, CONST char *optval, int optlen); /* 7 */ - int (*tclpGetPid) (Tcl_Pid pid); /* 8 */ - int (*tclWinGetPlatformId) (void); /* 9 */ + 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 */ - void (*tclIntPlatReserved13) (void); /* 13 */ + struct tm * (*tclpLocaltime_unix) (TclpTime_t_CONST clock); /* 11 */ + struct tm * (*tclpGmtime_unix) (TclpTime_t_CONST 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 */ void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ - void (*tclWinAddProcess) (VOID *hProcess, unsigned int id); /* 20 */ + VOID *reserved20; VOID *reserved21; - TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ + VOID *reserved22; VOID *reserved23; - char * (*tclWinNoBackslash) (char *path); /* 24 */ + VOID *reserved24; VOID *reserved25; - void (*tclWinSetInterfaces) (int wide); /* 26 */ - void (*tclWinFlushDirtyChannels) (void); /* 27 */ - void (*tclWinResetInterfaces) (void); /* 28 */ + VOID *reserved26; + VOID *reserved27; + VOID *reserved28; int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ - int (*tclpCloseFile) (TclFile file); /* 31 */ - Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 32 */ - int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 33 */ - int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 34 */ - char * (*tclpInetNtoa) (struct in_addr addr); /* 35 */ - TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 36 */ - TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 37 */ - int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 38 */ #endif /* MACOSX */ } TclIntPlatStubs; @@ -700,43 +537,43 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; * Inline function declarations: */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclWinConvertError -#define TclWinConvertError \ - (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) /* UNIX */ +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ #endif -#ifndef TclWinConvertWSAError -#define TclWinConvertWSAError \ - (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ #endif -#ifndef TclWinGetServByName -#define TclWinGetServByName \ - (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */ +#ifndef TclpCreateCommandChannel +#define TclpCreateCommandChannel \ + (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */ #endif -#ifndef TclWinGetSockOpt -#define TclWinGetSockOpt \ - (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */ +#ifndef TclpCreatePipe +#define TclpCreatePipe \ + (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclWinGetTclInstance -#define TclWinGetTclInstance \ - (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS -#define TclWinNToHS \ - (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ #endif -#ifndef TclWinSetSockOpt -#define TclWinSetSockOpt \ - (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ #endif -#ifndef TclpGetPid -#define TclpGetPid \ - (tclIntPlatStubsPtr->tclpGetPid) /* 8 */ +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ #endif -#ifndef TclWinGetPlatformId -#define TclWinGetPlatformId \ - (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ +#ifndef TclpCreateTempFile +#define TclpCreateTempFile \ + (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #endif #ifndef TclpReaddir #define TclpReaddir \ @@ -750,97 +587,34 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpGmtime_unix \ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #endif -#ifndef TclIntPlatReserved13 -#define TclIntPlatReserved13 \ - (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #endif #ifndef TclUnixCopyFile #define TclUnixCopyFile \ (tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */ #endif -#ifndef TclMacOSXGetFileAttribute -#define TclMacOSXGetFileAttribute \ - (tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */ -#endif +/* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ -#ifndef TclMacOSXMatchType -#define TclMacOSXMatchType \ - (tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */ -#endif -#ifndef TclMacOSXNotifierAddRunLoopMode -#define TclMacOSXNotifierAddRunLoopMode \ - (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ -#endif -#ifndef TclWinAddProcess -#define TclWinAddProcess \ - (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ -#endif +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile -#define TclpCreateTempFile \ - (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash -#define TclWinNoBackslash \ - (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces -#define TclWinSetInterfaces \ - (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ -#endif -#ifndef TclWinFlushDirtyChannels -#define TclWinFlushDirtyChannels \ - (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ -#endif -#ifndef TclWinResetInterfaces -#define TclWinResetInterfaces \ - (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ -#endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ -#endif -#ifndef TclpCreateCommandChannel -#define TclpCreateCommandChannel \ - (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */ -#endif -#ifndef TclpCreatePipe -#define TclpCreatePipe \ - (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */ -#endif -#ifndef TclpCreateProcess -#define TclpCreateProcess \ - (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ -#endif -#ifndef TclpInetNtoa -#define TclpInetNtoa \ - (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */ -#endif -#ifndef TclpMakeFile -#define TclpMakeFile \ - (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ -#endif -#ifndef TclpOpenFile -#define TclpOpenFile \ - (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */ -#endif -#ifndef TclUnixWaitForFile -#define TclUnixWaitForFile \ - (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */ -#endif #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ #ifndef TclWinConvertError #define TclWinConvertError \ (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ @@ -861,7 +635,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinGetTclInstance \ (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ #endif -/* Slot 5 is reserved */ +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 5 */ +#endif #ifndef TclWinNToHS #define TclWinNToHS \ (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ @@ -878,7 +655,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinGetPlatformId \ (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ #endif -/* Slot 10 is reserved */ +#ifndef TclpReaddir +#define TclpReaddir \ + (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ +#endif #ifndef TclGetAndDetachPids #define TclGetAndDetachPids \ (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */ @@ -913,7 +693,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinAddProcess \ (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ #endif -/* Slot 21 is reserved */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 21 */ +#endif #ifndef TclpCreateTempFile #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ @@ -945,42 +728,42 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclWinConvertError -#define TclWinConvertError \ - (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ #endif -#ifndef TclWinConvertWSAError -#define TclWinConvertWSAError \ - (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ #endif -#ifndef TclWinGetServByName -#define TclWinGetServByName \ - (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */ +#ifndef TclpCreateCommandChannel +#define TclpCreateCommandChannel \ + (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */ #endif -#ifndef TclWinGetSockOpt -#define TclWinGetSockOpt \ - (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */ +#ifndef TclpCreatePipe +#define TclpCreatePipe \ + (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclWinGetTclInstance -#define TclWinGetTclInstance \ - (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclWinNToHS -#define TclWinNToHS \ - (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ #endif -#ifndef TclWinSetSockOpt -#define TclWinSetSockOpt \ - (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ #endif -#ifndef TclpGetPid -#define TclpGetPid \ - (tclIntPlatStubsPtr->tclpGetPid) /* 8 */ +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ #endif -#ifndef TclWinGetPlatformId -#define TclWinGetPlatformId \ - (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ +#ifndef TclpCreateTempFile +#define TclpCreateTempFile \ + (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #endif #ifndef TclpReaddir #define TclpReaddir \ @@ -994,9 +777,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpGmtime_unix \ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #endif -#ifndef TclIntPlatReserved13 -#define TclIntPlatReserved13 \ - (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #endif #ifndef TclUnixCopyFile #define TclUnixCopyFile \ @@ -1022,73 +805,19 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclMacOSXNotifierAddRunLoopMode \ (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ #endif -#ifndef TclWinAddProcess -#define TclWinAddProcess \ - (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ -#endif +/* Slot 20 is reserved */ /* Slot 21 is reserved */ -#ifndef TclpCreateTempFile -#define TclpCreateTempFile \ - (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ -#endif +/* Slot 22 is reserved */ /* Slot 23 is reserved */ -#ifndef TclWinNoBackslash -#define TclWinNoBackslash \ - (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ -#endif +/* Slot 24 is reserved */ /* Slot 25 is reserved */ -#ifndef TclWinSetInterfaces -#define TclWinSetInterfaces \ - (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ -#endif -#ifndef TclWinFlushDirtyChannels -#define TclWinFlushDirtyChannels \ - (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ -#endif -#ifndef TclWinResetInterfaces -#define TclWinResetInterfaces \ - (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ -#endif +/* Slot 26 is reserved */ +/* Slot 27 is reserved */ +/* Slot 28 is reserved */ #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ -#endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ -#endif -#ifndef TclpCreateCommandChannel -#define TclpCreateCommandChannel \ - (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */ -#endif -#ifndef TclpCreatePipe -#define TclpCreatePipe \ - (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */ -#endif -#ifndef TclpCreateProcess -#define TclpCreateProcess \ - (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ -#endif -#ifndef TclpInetNtoa -#define TclpInetNtoa \ - (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */ -#endif -#ifndef TclpMakeFile -#define TclpMakeFile \ - (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ -#endif -#ifndef TclpOpenFile -#define TclpOpenFile \ - (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */ -#endif -#ifndef TclUnixWaitForFile -#define TclUnixWaitForFile \ - (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */ -#endif #endif /* MACOSX */ #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ @@ -1099,59 +828,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TCL_STORAGE_CLASS DLLIMPORT #undef TclpLocaltime_unix #undef TclpGmtime_unix -#undef TclIntPlatReserved13 - -#if !defined(__WIN32__) -# undef TclpGetPid -# define TclpGetPid(pid) ((unsigned long) (pid)) - -# if defined(USE_TCL_STUBS) -# undef TclpCreateProcess -# undef TclpMakeFile -# undef TclpOpenFile -# undef TclpCreateCommandChannel -# ifdef __CYGWIN__ -# define TclpCreateProcess ((int (*) (Tcl_Interp *, int, \ - CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *)) \ - tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) -# define TclpMakeFile ((TclFile (*) (Tcl_Channel channel, \ - int direction)) tclIntPlatStubsPtr->tclMacOSXMatchType) -# define TclpOpenFile ((TclFile (*) (CONST char *, int)) \ - tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) -# define TclpCreateCommandChannel ((Tcl_Channel (*) (TclFile, TclFile, \ - TclFile, int, Tcl_Pid *)) tclIntPlatStubsPtr->tclIntPlatReserved13) -# else -# define TclpCreateProcess ((int (*) (Tcl_Interp *, int, \ - CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *)) \ - tclIntPlatStubsPtr->tclWinGetTclInstance) -# define TclpMakeFile ((TclFile (*) (Tcl_Channel channel, \ - int direction)) tclIntPlatStubsPtr->tclWinNToHS) -# define TclpOpenFile ((TclFile (*) (CONST char *, int)) \ - tclIntPlatStubsPtr->tclWinSetSockOpt) -# define TclpCreateCommandChannel ((Tcl_Channel (*) (TclFile, TclFile, \ - TclFile, int, Tcl_Pid *)) tclIntPlatStubsPtr->tclWinGetServByName) - -# undef TclpCreateTempFile -# undef TclGetAndDetachPids -# undef TclpCloseFile -# undef TclpCreatePipe -# undef TclpInetNtoa -# undef TclUnixWaitForFile -# define TclpCreateTempFile ((TclFile (*) (CONST char *)) \ - tclIntPlatStubsPtr->tclWinGetPlatformId) -# define TclGetAndDetachPids ((void (*) (Tcl_Interp *, Tcl_Channel)) \ - tclIntPlatStubsPtr->tclWinConvertError) -# define TclpCloseFile ((int (*) (TclFile)) \ - tclIntPlatStubsPtr->tclWinConvertWSAError) -# define TclpCreatePipe ((int (*) (TclFile *, TclFile *)) \ - tclIntPlatStubsPtr->tclWinGetSockOpt) -# define TclpInetNtoa ((char *(*) (struct in_addr addr)) \ - tclIntPlatStubsPtr->tclIntPlatReserved13) -# define TclUnixWaitForFile (int (*) (int, int, int)) \ - tclIntPlatStubsPtr->tclpGetPid) -# endif -# endif +#if !defined(__WIN32__) && !defined(__CYGWIN__) +# undef TclpGetPid +# define TclpGetPid(pid) ((unsigned long) (pid)) #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 4b09f37..5fa6f0a 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -75,26 +75,19 @@ MODULE_SCOPE TclPlatStubs tclPlatStubs; MODULE_SCOPE TclStubs tclStubs; MODULE_SCOPE TclTomMathStubs tclTomMathStubs; -#ifdef __CYGWIN__ -#define TclWinGetPlatformId winGetPlatformId -#define Tcl_WinUtfToTChar winUtfToTChar -#define Tcl_WinTCharToUtf winTCharToUtf -#define TclWinGetTclInstance winGetTclInstance -#define TclWinNToHS winNToHS -#define TclWinSetSockOpt winSetSockOpt -#define TclWinGetSockOpt winGetSockOpt -#define TclWinGetServByName winGetServByName -#define TclWinNoBackslash winNoBackslash -#define TclWinSetInterfaces (void (*) (int)) doNothing -#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing -#define TclIntPlatReserved13 (void (*) ()) TclpCreateCommandChannel -#define TclWinFlushDirtyChannels doNothing -#define TclWinResetInterfaces doNothing -#define TclpGetPid getPid +#ifdef __WIN32__ +# define TclUnixWaitForFile 0 +# define TclpReaddir 0 +#elif defined(__CYGWIN__) +# define TclWinSetInterfaces (void (*) (int)) doNothing +# define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing +# define TclWinFlushDirtyChannels doNothing +# define TclWinResetInterfaces doNothing +# define TclpGetTZName 0 static Tcl_Encoding winTCharEncoding; -static int +int TclWinGetPlatformId() { /* Don't bother to determine the real platform on cygwin, @@ -102,7 +95,7 @@ TclWinGetPlatformId() return 2; /* VER_PLATFORM_WIN32_NT */; } -static void *TclWinGetTclInstance() +void *TclWinGetTclInstance() { void *hInstance = NULL; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, @@ -110,21 +103,21 @@ static void *TclWinGetTclInstance() return hInstance; } -static unsigned short +unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } -static int -TclWinSetSockOpt(void *s, int level, int optname, +int +TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, int optlen) { return setsockopt((int) s, level, optname, optval, optlen); } -static int -TclWinGetSockOpt(void *s, int level, int optname, +int +TclWinGetSockOpt(SOCKET s, int level, int optname, char *optval, int *optlen) { return getsockopt((int) s, level, optname, optval, optlen); @@ -136,7 +129,7 @@ TclWinGetServByName(const char *name, const char *proto) return getservbyname(name, proto); } -static char * +char * TclWinNoBackslash(char *path) { char *p; @@ -149,7 +142,7 @@ TclWinNoBackslash(char *path) return path; } -static int +int TclpGetPid(Tcl_Pid pid) { return (int) (size_t) pid; @@ -161,11 +154,11 @@ doNothing(void) /* dummy implementation, no need to do anything */ } -static char * -Tcl_WinUtfToTChar(string, len, dsPtr) - const char *string; - int len; - Tcl_DString *dsPtr; +char * +Tcl_WinUtfToTChar( + const char *string, + int len, + Tcl_DString *dsPtr) { if (!winTCharEncoding) { winTCharEncoding = Tcl_GetEncoding(0, "unicode"); @@ -174,7 +167,7 @@ Tcl_WinUtfToTChar(string, len, dsPtr) string, len, dsPtr); } -static char * +char * Tcl_WinTCharToUtf( const char *string, int len, @@ -187,37 +180,7 @@ Tcl_WinTCharToUtf( string, len, dsPtr); } -#define TclMacOSXGetFileAttribute (int (*) (Tcl_Interp *, \ - int, Tcl_Obj *, Tcl_Obj **)) TclpCreateProcess -#define TclMacOSXMatchType (int (*) (Tcl_Interp *, const char *, \ - const char *, Tcl_StatBuf *, Tcl_GlobTypeData *)) TclpMakeFile -#define TclMacOSXNotifierAddRunLoopMode (void (*) (const void *)) TclpOpenFile -#define TclpLocaltime_unix (struct tm *(*) (const time_t *)) TclGetAndDetachPids -#define TclpGmtime_unix (struct tm *(*) (const time_t *)) TclpCloseFile - -#elif !defined(__WIN32__) /* UNIX and MAC */ -# define TclWinConvertError (void (*) (unsigned int)) TclGetAndDetachPids -# define TclWinConvertWSAError (void (*) (unsigned int)) TclpCloseFile -# define TclWinGetPlatformId (int (*)()) TclpCreateTempFile -# define TclWinGetTclInstance (void *(*)()) TclpCreateProcess -# define TclWinNToHS (unsigned short (*) (unsigned short ns)) TclpMakeFile -# define TclWinSetSockOpt (int (*) (void *, int, int, const char *, int)) TclpOpenFile -# define TclWinGetSockOpt (int (*) (void *, int, int, char *, int *)) TclpCreatePipe -# define TclWinGetServByName (struct servent *(*) (const char *nm, const char *proto)) TclpCreateCommandChannel -# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa -# define TclWinAddProcess 0 -# define TclWinNoBackslash 0 -# define TclWinSetInterfaces 0 -# define TclWinFlushDirtyChannels 0 -# define TclWinResetInterfaces 0 -# define TclpGetPid 0 -# ifndef MAC_OSX_TCL -# define TclMacOSXMatchType 0 -# define TclMacOSXNotifierAddRunLoopMode 0 -# define TclMacOSXGetFileAttribute 0 -# define Tcl_MacOSXOpenBundleResources 0 -# define Tcl_MacOSXOpenVersionedBundleResources 0 -# endif +#else /* UNIX and MAC */ # define TclpLocaltime_unix TclpLocaltime # define TclpGmtime_unix TclpGmtime #endif @@ -488,59 +451,50 @@ TclIntStubs tclIntStubs = { TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - TclWinConvertError, /* 0 */ - TclWinConvertWSAError, /* 1 */ - TclWinGetServByName, /* 2 */ - TclWinGetSockOpt, /* 3 */ - TclWinGetTclInstance, /* 4 */ +#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) /* UNIX */ + TclGetAndDetachPids, /* 0 */ + TclpCloseFile, /* 1 */ + TclpCreateCommandChannel, /* 2 */ + TclpCreatePipe, /* 3 */ + TclpCreateProcess, /* 4 */ NULL, /* 5 */ - TclWinNToHS, /* 6 */ - TclWinSetSockOpt, /* 7 */ - TclpGetPid, /* 8 */ - TclWinGetPlatformId, /* 9 */ + TclpMakeFile, /* 6 */ + TclpOpenFile, /* 7 */ + TclUnixWaitForFile, /* 8 */ + TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ - TclIntPlatReserved13, /* 13 */ + TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ - TclMacOSXGetFileAttribute, /* 15 */ + NULL, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ - TclMacOSXMatchType, /* 18 */ - TclMacOSXNotifierAddRunLoopMode, /* 19 */ - TclWinAddProcess, /* 20 */ + NULL, /* 18 */ + NULL, /* 19 */ + NULL, /* 20 */ NULL, /* 21 */ - TclpCreateTempFile, /* 22 */ + NULL, /* 22 */ NULL, /* 23 */ - TclWinNoBackslash, /* 24 */ + NULL, /* 24 */ NULL, /* 25 */ - TclWinSetInterfaces, /* 26 */ - TclWinFlushDirtyChannels, /* 27 */ - TclWinResetInterfaces, /* 28 */ + NULL, /* 26 */ + NULL, /* 27 */ + NULL, /* 28 */ TclWinCPUID, /* 29 */ - TclGetAndDetachPids, /* 30 */ - TclpCloseFile, /* 31 */ - TclpCreateCommandChannel, /* 32 */ - TclpCreatePipe, /* 33 */ - TclpCreateProcess, /* 34 */ - TclpInetNtoa, /* 35 */ - TclpMakeFile, /* 36 */ - TclpOpenFile, /* 37 */ - TclUnixWaitForFile, /* 38 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ TclWinGetServByName, /* 2 */ TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ - NULL, /* 5 */ + TclUnixWaitForFile, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ - NULL, /* 10 */ + TclpReaddir, /* 10 */ TclGetAndDetachPids, /* 11 */ TclpCloseFile, /* 12 */ TclpCreateCommandChannel, /* 13 */ @@ -551,7 +505,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclpMakeFile, /* 18 */ TclpOpenFile, /* 19 */ TclWinAddProcess, /* 20 */ - NULL, /* 21 */ + TclpInetNtoa, /* 21 */ TclpCreateTempFile, /* 22 */ TclpGetTZName, /* 23 */ TclWinNoBackslash, /* 24 */ @@ -562,45 +516,36 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - TclWinConvertError, /* 0 */ - TclWinConvertWSAError, /* 1 */ - TclWinGetServByName, /* 2 */ - TclWinGetSockOpt, /* 3 */ - TclWinGetTclInstance, /* 4 */ + TclGetAndDetachPids, /* 0 */ + TclpCloseFile, /* 1 */ + TclpCreateCommandChannel, /* 2 */ + TclpCreatePipe, /* 3 */ + TclpCreateProcess, /* 4 */ NULL, /* 5 */ - TclWinNToHS, /* 6 */ - TclWinSetSockOpt, /* 7 */ - TclpGetPid, /* 8 */ - TclWinGetPlatformId, /* 9 */ + TclpMakeFile, /* 6 */ + TclpOpenFile, /* 7 */ + TclUnixWaitForFile, /* 8 */ + TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ - TclIntPlatReserved13, /* 13 */ + TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ TclMacOSXSetFileAttribute, /* 16 */ TclMacOSXCopyFileAttributes, /* 17 */ TclMacOSXMatchType, /* 18 */ TclMacOSXNotifierAddRunLoopMode, /* 19 */ - TclWinAddProcess, /* 20 */ + NULL, /* 20 */ NULL, /* 21 */ - TclpCreateTempFile, /* 22 */ + NULL, /* 22 */ NULL, /* 23 */ - TclWinNoBackslash, /* 24 */ + NULL, /* 24 */ NULL, /* 25 */ - TclWinSetInterfaces, /* 26 */ - TclWinFlushDirtyChannels, /* 27 */ - TclWinResetInterfaces, /* 28 */ + NULL, /* 26 */ + NULL, /* 27 */ + NULL, /* 28 */ TclWinCPUID, /* 29 */ - TclGetAndDetachPids, /* 30 */ - TclpCloseFile, /* 31 */ - TclpCreateCommandChannel, /* 32 */ - TclpCreatePipe, /* 33 */ - TclpCreateProcess, /* 34 */ - TclpInetNtoa, /* 35 */ - TclpMakeFile, /* 36 */ - TclpOpenFile, /* 37 */ - TclUnixWaitForFile, /* 38 */ #endif /* MACOSX */ }; @@ -704,19 +649,19 @@ TclStubs tclStubs = { Tcl_DbCkalloc, /* 6 */ Tcl_DbCkfree, /* 7 */ Tcl_DbCkrealloc, /* 8 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ Tcl_CreateFileHandler, /* 9 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ NULL, /* 9 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ Tcl_CreateFileHandler, /* 9 */ #endif /* MACOSX */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ Tcl_DeleteFileHandler, /* 10 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ NULL, /* 10 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -878,10 +823,10 @@ TclStubs tclStubs = { Tcl_GetMaster, /* 164 */ Tcl_GetNameOfExecutable, /* 165 */ Tcl_GetObjResult, /* 166 */ -#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TK) /* UNIX */ Tcl_GetOpenFile, /* 167 */ #endif /* UNIX */ -#ifdef __WIN32__ /* WIN */ +#if defined(__WIN32__) /* WIN */ NULL, /* 167 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 93a3669..2deef9c 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -33,6 +33,22 @@ namespace eval genStubs { variable curName "UNKNOWN" + # scspec -- + # + # Storage class specifier for external function declarations. + # Normally "EXTERN", may be set to something like XYZAPI + # + variable scspec "EXTERN" + + # epoch, revision -- + # + # The epoch and revision numbers of the interface currently being defined. + # (@@@TODO: should be an array mapping interface names -> numbers) + # + + variable epoch {} + variable revision 0 + # hooks -- # # An array indexed by interface name that contains the set of @@ -94,6 +110,27 @@ proc genStubs::interface {name} { return } +# genStubs::scspec -- +# +# Define the storage class macro used for external function declarations. +# Typically, this will be a macro like XYZAPI or EXTERN that +# expands to either DLLIMPORT or DLLEXPORT, depending on whether +# -DBUILD_XYZ has been set. +# +proc genStubs::scspec {value} { + variable scspec $value +} + +# genStubs::epoch -- +# +# Define the epoch number for this library. The epoch +# should be incrememented when a release is made that +# contains incompatible changes to the public API. +# +proc genStubs::epoch {value} { + variable epoch $value +} + # genStubs::hooks -- # # This function defines the subinterface hooks for the current @@ -132,7 +169,9 @@ proc genStubs::hooks {names} { proc genStubs::declare {args} { variable stubs variable curName + variable revision + incr revision if {[llength $args] == 2} { lassign $args index decl set platformList generic @@ -246,14 +285,14 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { set text "" switch $plat { win { - append text "#ifdef __WIN32__ /* WIN */\n${iftxt}" + append text "#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* WIN */\n${eltxt}" } append text "#endif /* WIN */\n" } unix { - append text "#if !defined(__WIN32__) && !defined(MAC_OSX_TCL)\ + append text "#if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK)\ /* UNIX */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* UNIX */\n${eltxt}" @@ -275,7 +314,7 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { append text "#endif /* AQUA */\n" } x11 { - append text "#if !(defined(__WIN32__) || defined(MAC_OSX_TK))\ + append text "#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK))\ /* X11 */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* X11 */\n${eltxt}" @@ -407,13 +446,14 @@ proc genStubs::parseArg {arg} { # Returns the formatted declaration string. proc genStubs::makeDecl {name decl index} { + variable scspec lassign $decl rtype fname args append text "/* $index */\n" if {$rtype != "void"} { regsub -all void $rtype VOID rtype } - set line "EXTERN $rtype" + set line "$scspec $rtype" set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] set pad [expr {24 - [string length $line]}] @@ -421,6 +461,12 @@ proc genStubs::makeDecl {name decl index} { append line " " set pad 0 } + if {$args eq ""} { + append line $fname + append text $line + append text ";\n" + return $text + } if {$args == ""} { append line $fname append text $line @@ -926,10 +972,19 @@ proc genStubs::emitMacros {name textVar} { proc genStubs::emitHeader {name} { variable outDir variable hooks + variable epoch + variable revision set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] + if {$epoch != ""} { + set CAPName [string toupper $name] + append text "\n" + append text "#define ${CAPName}_STUBS_EPOCH $epoch\n" + append text "#define ${CAPName}_STUBS_REVISION $revision\n" + } + emitDeclarations $name text if {[info exists hooks($name)]} { @@ -943,6 +998,10 @@ proc genStubs::emitHeader {name} { } append text "\ntypedef struct ${capName}Stubs {\n" append text " int magic;\n" + if {$epoch != ""} { + append text " int epoch;\n" + append text " int revision;\n" + } append text " struct ${capName}StubHooks *hooks;\n\n" emitSlots $name text @@ -972,6 +1031,7 @@ proc genStubs::emitHeader {name} { proc genStubs::emitInit {name textVar} { variable hooks + variable epoch upvar $textVar text set capName [string toupper [string index $name 0]] @@ -988,6 +1048,11 @@ proc genStubs::emitInit {name textVar} { } append text "\n${capName}Stubs ${name}Stubs = \{\n" append text " TCL_STUB_MAGIC,\n" + if {$epoch != ""} { + set CAPName [string toupper $name] + append text " ${CAPName}_STUBS_EPOCH,\n" + append text " ${CAPName}_STUBS_REVISION,\n" + } if {[info exists hooks($name)]} { append text " &${name}StubHooks,\n" } else { diff --git a/win/Makefile.in b/win/Makefile.in index d3c9c80..1b7d21f 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -558,7 +558,7 @@ install-binaries: binaries else true; \ fi; \ done; - @for i in dde1.3 reg1.2; \ + @for i in dde$(DDEDOTVER) reg$(REGDOTVER); \ do \ if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \ echo "Making directory $(LIB_INSTALL_DIR)/$$i"; \ @@ -582,23 +582,23 @@ install-binaries: binaries done @if [ -f $(DDE_DLL_FILE) ]; then \ echo installing $(DDE_DLL_FILE); \ - $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde1.3; \ + $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \ $(COPY) $(ROOT_DIR)/library/dde/pkgIndex.tcl \ - $(LIB_INSTALL_DIR)/dde1.3; \ + $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \ fi @if [ -f $(DDE_LIB_FILE) ]; then \ echo installing $(DDE_LIB_FILE); \ - $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde1.3; \ + $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \ fi @if [ -f $(REG_DLL_FILE) ]; then \ echo installing $(REG_DLL_FILE); \ - $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg1.2; \ + $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \ $(COPY) $(ROOT_DIR)/library/reg/pkgIndex.tcl \ - $(LIB_INSTALL_DIR)/reg1.2; \ + $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \ fi @if [ -f $(REG_LIB_FILE) ]; then \ echo installing $(REG_LIB_FILE); \ - $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg1.2; \ + $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \ fi install-libraries: libraries install-tzdata install-msgs diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 019d8e9..9591163 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1129,7 +1129,7 @@ CreateSocketAddress( ZeroMemory(sockaddrPtr, sizeof(SOCKADDR_IN)); sockaddrPtr->sin_family = AF_INET; - sockaddrPtr->sin_port = htons((u_short) (port & 0xFFFF)); + sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF)); if (host == NULL) { addr.s_addr = INADDR_ANY; } else { @@ -2512,9 +2512,25 @@ TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, return setsockopt(s, level, optname, optval, optlen); } -u_short -TclWinNToHS( - u_short netshort) +unsigned short +TclWinNToHS(unsigned short netshort) +{ + /* + * Check that WinSock is initialized; do not call it if not, to + * prevent system crashes. This can happen at exit time if the exit + * handler for WinSock ran before other exit handlers that want to + * use sockets. + */ + + if (!SocketsEnabled()) { + return (unsigned short) -1; + } + + return ntohs(netshort); +} + +char * +TclpInetNtoa(struct in_addr addr) { /* * Check that WinSock is initialized; do not call it if not, to prevent @@ -2523,10 +2539,10 @@ TclWinNToHS( */ if (!SocketsEnabled()) { - return (u_short) -1; + return NULL; } - return ntohs(netshort); + return inet_ntoa(addr); } struct servent * |