From 419c3d6fdeeb360291ac310777d2c094c3eb1285 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Apr 2012 14:50:05 +0000 Subject: implement TclpGetPid for Cygwin --- generic/tclInt.decls | 28 ++++++++++++++++-- generic/tclIntPlatDecls.h | 74 ++++++++++++++++++++++++++++++++++++----------- generic/tclStubInit.c | 18 +++++++++++- mac/tclMacPort.h | 1 - unix/tclUnixFile.c | 38 ++++++++++++++++++++---- unix/tclUnixPort.h | 1 - win/tcl.m4 | 3 ++ 7 files changed, 136 insertions(+), 27 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index d380270..b7c7ee4 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -978,8 +978,9 @@ declare 7 unix { int TclWinSetSockOpt(void *s, int level, int optname, const char *optval, int optlen) } +# On non-cygwin, this is actually a reference to TclUnixWaitForFile declare 8 unix { - int TclUnixWaitForFile(int fd, int mask, int timeout) + unsigned long TclpGetPid(Tcl_Pid pid) } # Added in 8.1: @@ -1049,7 +1050,30 @@ declare 30 unix { 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 7ce711d..50c546c 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -13,16 +13,6 @@ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, - int argc, CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); -EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, - int direction)); -EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname, - int mode)); -#endif - /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made @@ -58,8 +48,7 @@ EXTERN unsigned short TclWinNToHS _ANSI_ARGS_((unsigned short ns)); EXTERN int TclWinSetSockOpt _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 8 */ -EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, - int timeout)); +EXTERN unsigned long TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* 10 */ @@ -110,6 +99,23 @@ EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 31 */ EXTERN int TclpCloseFile _ANSI_ARGS_((TclFile file)); +/* Slot 32 is reserved */ +/* Slot 33 is reserved */ +/* 34 */ +EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, + int argc, CONST char **argv, + TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr)); +/* Slot 35 is reserved */ +/* 36 */ +EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, + int direction)); +/* 37 */ +EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname, + int mode)); +/* 38 */ +EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, + int timeout)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -267,7 +273,7 @@ typedef struct TclIntPlatStubs { VOID *reserved5; unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */ int (*tclWinSetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 7 */ - int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */ + unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */ Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */ struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */ @@ -291,6 +297,13 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */ void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */ int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */ + VOID *reserved32; + VOID *reserved33; + int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */ + VOID *reserved35; + TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 36 */ + TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char *fname, int mode)); /* 37 */ + int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */ @@ -399,9 +412,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinSetSockOpt \ (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ #endif -#ifndef TclUnixWaitForFile -#define TclUnixWaitForFile \ - (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ +#ifndef TclpGetPid +#define TclpGetPid \ + (tclIntPlatStubsPtr->tclpGetPid) /* 8 */ #endif #ifndef TclWinGetPlatformId #define TclWinGetPlatformId \ @@ -477,6 +490,25 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCloseFile \ (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ #endif +/* Slot 32 is reserved */ +/* Slot 33 is reserved */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ +#endif +/* Slot 35 is reserved */ +#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__ #ifndef TclWinConvertError @@ -703,7 +735,14 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix -#if !defined(__WIN32__) && !defined(MAC_TCL) && defined(USE_TCL_STUBS) +#if !defined(__WIN32__) && !defined(MAC_TCL) +# undef TclpGetPid +# define TclpGetPid(pid) ((unsigned long) (pid)) + +# if defined(USE_TCL_STUBS) +# undef TclpCreateProcess +# undef TclpMakeFile +# undef TclpOpenFile # ifdef __CYGWIN__ # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -732,6 +771,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ tclIntPlatStubsPtr->tclWinConvertWSAError) # endif +# endif #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index cbb89a2..50fc9eb 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -31,6 +31,7 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry +#undef TclpGetPid /* * Keep a record of the original Notifier procedures, created in the @@ -85,6 +86,7 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); #define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing #define TclWinFlushDirtyChannels doNothing #define TclWinResetInterfaces doNothing +#define TclpGetPid getPid static Tcl_Encoding winTCharEncoding; @@ -130,6 +132,12 @@ TclWinNoBackslash(char *path) return path; } +static unsigned long +TclpGetPid(Tcl_Pid pid) +{ + return (unsigned long) (size_t) pid; +} + static void doNothing(void) { @@ -186,6 +194,7 @@ Tcl_WinTCharToUtf( # define TclWinSetInterfaces 0 # define TclWinFlushDirtyChannels 0 # define TclWinResetInterfaces 0 +# define TclpGetPid 0 # define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */ # define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */ # define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */ @@ -454,7 +463,7 @@ TclIntPlatStubs tclIntPlatStubs = { NULL, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ - TclUnixWaitForFile, /* 8 */ + TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ @@ -478,6 +487,13 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ TclGetAndDetachPids, /* 30 */ TclpCloseFile, /* 31 */ + NULL, /* 32 */ + NULL, /* 33 */ + TclpCreateProcess, /* 34 */ + NULL, /* 35 */ + TclpMakeFile, /* 36 */ + TclpOpenFile, /* 37 */ + TclUnixWaitForFile, /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index f427899..c5c1743 100644 --- a/mac/tclMacPort.h +++ b/mac/tclMacPort.h @@ -215,7 +215,6 @@ extern char **environ; * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclSetSystemEnv(a,b) #define tzset() diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 5eac978..4ba2e47 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -22,7 +22,8 @@ static int NativeMatchType(CONST char* nativeName, Tcl_GlobTypeData *types); * TclpFindExecutable -- * * This procedure computes the absolute path name of the current - * application, given its argv[0] value. + * application, given its argv[0] value. For Cygwin, argv[0] is + * ignored and the path is determined the same as under win32. * * Results: * A dirty UTF string that is the path to the executable. At this @@ -45,18 +46,44 @@ TclpFindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { + int length; +#ifdef __CYGWIN__ + char buf[PATH_MAX * TCL_UTF_MAX + 1]; + char name[PATH_MAX * TCL_UTF_MAX + 1]; +#else CONST char *name, *p; Tcl_StatBuf statBuf; - int length; Tcl_DString buffer, nameString; +#endif - if (argv0 == NULL) { - return NULL; - } if (tclNativeExecutableName != NULL) { return tclNativeExecutableName; } +#ifdef __CYGWIN__ + + /* Make some symbols available without including */ +# define CP_UTF8 65001 + extern int cygwin_conv_to_full_posix_path(const char *, char *); + extern __stdcall int GetModuleFileNameW(void *, const char *, int); + extern __stdcall int WideCharToMultiByte(int, int, const char *, int, + const char *, int, const char *, const char *); + + GetModuleFileNameW(NULL, name, PATH_MAX); + WideCharToMultiByte(CP_UTF8, 0, name, -1, buf, PATH_MAX, NULL, NULL); + cygwin_conv_to_full_posix_path(buf, name); + length = strlen(name); + if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { + /* Strip '.exe' part. */ + length -= 4; + } + tclNativeExecutableName = (char *) ckalloc(length + 1); + memcpy(tclNativeExecutableName, name, length); + buf[length] = '\0'; +#else + if (argv0 == NULL) { + return NULL; + } Tcl_DStringInit(&buffer); name = argv0; @@ -174,6 +201,7 @@ gotName: done: Tcl_DStringFree(&buffer); +#endif return tclNativeExecutableName; } diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index c0bf77d8..a26922c 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -658,7 +658,6 @@ extern int copyfile(const char *from, const char *to, void *state, * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclpReleaseFile(file) /* Nothing. */ /* diff --git a/win/tcl.m4 b/win/tcl.m4 index 752f022..ff39c38 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -27,6 +27,9 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ else TCL_BIN_DIR_DEFAULT=../../tcl/win fi + if test ! -f $TCL_BIN_DIR_DEFAULT/tclConfig.sh; then + TCL_BIN_DIR_DEFAULT="${TCL_BIN_DIR_DEFAULT}/../unix" + fi AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`) -- cgit v0.12 From 9c1fd5ba32ec843d20e2859de560e1b36a50d501 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 Apr 2012 23:33:46 +0000 Subject: tclpGetPid signature change (stub entry only, not for macro), for win64 compatibility with future cygwin64 correctly use win32 as default when cross-compiling under cygwin --- ChangeLog | 0 generic/tcl.decls | 0 generic/tcl.h | 0 generic/tclCmdAH.c | 0 generic/tclEnv.c | 0 generic/tclFCmd.c | 0 generic/tclFileName.c | 0 generic/tclIOSock.c | 0 generic/tclInt.decls | 4 ++-- generic/tclIntPlatDecls.h | 8 ++++---- generic/tclPipe.c | 2 +- generic/tclStubInit.c | 4 ++-- mac/tclMacPort.h | 0 tools/genStubs.tcl | 0 unix/Makefile.in | 0 unix/configure.in | 0 unix/tcl.m4 | 0 unix/tclUnixFile.c | 0 unix/tclUnixPort.h | 0 win/configure | 14 +++++++------- win/configure.in | 0 win/tcl.m4 | 23 ++++++++++++----------- win/tclWinError.c | 0 win/tclWinFile.c | 0 win/tclWinPipe.c | 2 +- win/tclWinPort.h | 0 win/tclWinSock.c | 0 27 files changed, 29 insertions(+), 28 deletions(-) mode change 100644 => 100755 ChangeLog mode change 100644 => 100755 generic/tcl.decls mode change 100644 => 100755 generic/tcl.h mode change 100644 => 100755 generic/tclCmdAH.c mode change 100644 => 100755 generic/tclEnv.c mode change 100644 => 100755 generic/tclFCmd.c mode change 100644 => 100755 generic/tclFileName.c mode change 100644 => 100755 generic/tclIOSock.c mode change 100644 => 100755 generic/tclInt.decls mode change 100644 => 100755 generic/tclPipe.c mode change 100644 => 100755 mac/tclMacPort.h mode change 100644 => 100755 tools/genStubs.tcl mode change 100644 => 100755 unix/Makefile.in mode change 100644 => 100755 unix/configure.in mode change 100644 => 100755 unix/tcl.m4 mode change 100644 => 100755 unix/tclUnixFile.c mode change 100644 => 100755 unix/tclUnixPort.h mode change 100644 => 100755 win/configure.in mode change 100644 => 100755 win/tcl.m4 mode change 100644 => 100755 win/tclWinError.c mode change 100644 => 100755 win/tclWinFile.c mode change 100644 => 100755 win/tclWinPipe.c mode change 100644 => 100755 win/tclWinPort.h mode change 100644 => 100755 win/tclWinSock.c diff --git a/ChangeLog b/ChangeLog old mode 100644 new mode 100755 diff --git a/generic/tcl.decls b/generic/tcl.decls old mode 100644 new mode 100755 diff --git a/generic/tcl.h b/generic/tcl.h old mode 100644 new mode 100755 diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c old mode 100644 new mode 100755 diff --git a/generic/tclEnv.c b/generic/tclEnv.c old mode 100644 new mode 100755 diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c old mode 100644 new mode 100755 diff --git a/generic/tclFileName.c b/generic/tclFileName.c old mode 100644 new mode 100755 diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c old mode 100644 new mode 100755 diff --git a/generic/tclInt.decls b/generic/tclInt.decls old mode 100644 new mode 100755 index b7c7ee4..e438588 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -856,7 +856,7 @@ declare 7 win { const char *optval, int optlen) } declare 8 win { - unsigned long TclpGetPid(Tcl_Pid pid) + int TclpGetPid(Tcl_Pid pid) } declare 9 win { int TclWinGetPlatformId(void) @@ -980,7 +980,7 @@ declare 7 unix { } # On non-cygwin, this is actually a reference to TclUnixWaitForFile declare 8 unix { - unsigned long TclpGetPid(Tcl_Pid pid) + int TclpGetPid(Tcl_Pid pid) } # Added in 8.1: diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 50c546c..6d3ed94 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -48,7 +48,7 @@ EXTERN unsigned short TclWinNToHS _ANSI_ARGS_((unsigned short ns)); EXTERN int TclWinSetSockOpt _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 8 */ -EXTERN unsigned long TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* 10 */ @@ -137,7 +137,7 @@ EXTERN u_short TclWinNToHS _ANSI_ARGS_((u_short ns)); EXTERN int TclWinSetSockOpt _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char *optval, int optlen)); /* 8 */ -EXTERN unsigned long TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* Slot 10 is reserved */ @@ -273,7 +273,7 @@ typedef struct TclIntPlatStubs { VOID *reserved5; unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */ int (*tclWinSetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 7 */ - unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ + int (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */ Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */ struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */ @@ -314,7 +314,7 @@ typedef struct TclIntPlatStubs { VOID *reserved5; u_short (*tclWinNToHS) _ANSI_ARGS_((u_short ns)); /* 6 */ int (*tclWinSetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char *optval, int optlen)); /* 7 */ - unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ + int (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */ VOID *reserved10; void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 11 */ diff --git a/generic/tclPipe.c b/generic/tclPipe.c old mode 100644 new mode 100755 index 1042e09..6e7029e --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -283,7 +283,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan) for (i = 0; i < numPids; i++) { /* * We need to get the resolved pid before we wait on it as - * the windows implimentation of Tcl_WaitPid deletes the + * the windows implementation of Tcl_WaitPid deletes the * information such that any following calls to TclpGetPid * fail. */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 71c6ab4..7d24d69 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -133,10 +133,10 @@ TclWinNoBackslash(char *path) return path; } -static unsigned long +static int TclpGetPid(Tcl_Pid pid) { - return (unsigned long) (size_t) pid; + return (int) (size_t) pid; } static void diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h old mode 100644 new mode 100755 diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl old mode 100644 new mode 100755 diff --git a/unix/Makefile.in b/unix/Makefile.in old mode 100644 new mode 100755 diff --git a/unix/configure.in b/unix/configure.in old mode 100644 new mode 100755 diff --git a/unix/tcl.m4 b/unix/tcl.m4 old mode 100644 new mode 100755 diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c old mode 100644 new mode 100755 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h old mode 100644 new mode 100755 diff --git a/win/configure b/win/configure index ae7ad50..29b1245 100755 --- a/win/configure +++ b/win/configure @@ -1232,7 +1232,7 @@ else #line 1233 "configure" #include "confdefs.h" - #ifdef __WIN32__ + #ifndef __WIN32__ #error cross-compiler #endif @@ -1242,12 +1242,12 @@ int main() { EOF if { (eval echo configure:1244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_cross=yes + ac_cv_cross=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_cross=no + ac_cv_cross=yes fi rm -f conftest* @@ -1449,8 +1449,8 @@ echo "configure:1351: checking compiler flags" >&5 #line 1450 "configure" #include "confdefs.h" - #ifdef _WIN64 - #error 64-bit + #ifndef _WIN64 + #error 32-bit #endif int main() { @@ -1459,12 +1459,12 @@ int main() { EOF if { (eval echo configure:1461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - tcl_win_64bit=no + tcl_win_64bit=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - tcl_win_64bit=yes + tcl_win_64bit=no fi rm -f conftest* diff --git a/win/configure.in b/win/configure.in old mode 100644 new mode 100755 diff --git a/win/tcl.m4 b/win/tcl.m4 old mode 100644 new mode 100755 index ff39c38..ab47afc --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -27,9 +27,6 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ else TCL_BIN_DIR_DEFAULT=../../tcl/win fi - if test ! -f $TCL_BIN_DIR_DEFAULT/tclConfig.sh; then - TCL_BIN_DIR_DEFAULT="${TCL_BIN_DIR_DEFAULT}/../unix" - fi AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`) @@ -37,7 +34,11 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) fi if test ! -f $TCL_BIN_DIR/tclConfig.sh; then - AC_MSG_ERROR(There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) + if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then + AC_MSG_ERROR(There is no tclConfig.sh in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) + fi + TCL_BIN_DIR=`cd ${TCL_BIN_DIR}/../unix; pwd` + CFLAGS="$CFLAGS -mwin32" fi AC_MSG_RESULT($TCL_BIN_DIR/tclConfig.sh) ]) @@ -416,12 +417,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK(for cross-compile version of gcc, ac_cv_cross, AC_TRY_COMPILE([ - #ifdef __WIN32__ + #ifndef __WIN32__ #error cross-compiler #endif ], [], - ac_cv_cross=yes, - ac_cv_cross=no) + ac_cv_cross=no, + ac_cv_cross=yes) ) if test "$ac_cv_cross" = "yes"; then @@ -592,12 +593,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ;; *) AC_TRY_COMPILE([ - #ifdef _WIN64 - #error 64-bit + #ifndef _WIN64 + #error 32-bit #endif ], [], - tcl_win_64bit=no, - tcl_win_64bit=yes + tcl_win_64bit=yes, + tcl_win_64bit=no ) if test "$tcl_win_64bit" = "yes" ; then do64bit=amd64 diff --git a/win/tclWinError.c b/win/tclWinError.c old mode 100644 new mode 100755 diff --git a/win/tclWinFile.c b/win/tclWinFile.c old mode 100644 new mode 100755 diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c old mode 100644 new mode 100755 index f15daa5..a661343 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -871,7 +871,7 @@ TclpCloseFile( *-------------------------------------------------------------------------- */ -unsigned long +int TclpGetPid( Tcl_Pid pid) /* The HANDLE of the child process. */ { diff --git a/win/tclWinPort.h b/win/tclWinPort.h old mode 100644 new mode 100755 diff --git a/win/tclWinSock.c b/win/tclWinSock.c old mode 100644 new mode 100755 -- cgit v0.12 From b2171aae67fecadef5016886808249be0cef1d01 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 13 Apr 2012 22:18:46 +0000 Subject: sync win/rules.vc with Tk version --- win/rules.vc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 0cc9ffb..4efbad7 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -422,18 +422,21 @@ OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif -!if $(DEBUG) -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG -!elseif $(OPTIMIZING) +!if !$(DEBUG) +OPTDEFINES = $(OPTDEFINES) -DNDEBUG +!if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !endif +!endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif - +!if $(VCVERSION) < 1300 +OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 +!endif #---------------------------------------------------------- # Get common info used when building extensions. -- cgit v0.12 From 65d363f1164ad1961d836ed912ddc9858dfd4d8b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Apr 2012 12:55:42 +0000 Subject: implement TclWinGetSockOpt and TclWinGetServByName for cygwi (should work, but not yet tested on UNIX) --- generic/tclInt.decls | 38 ++++++++++++--------- generic/tclIntPlatDecls.h | 87 +++++++++++++++++++++++++++++++---------------- generic/tclStubInit.c | 31 +++++++++++++---- unix/tclUnixPort.h | 1 - 4 files changed, 104 insertions(+), 53 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index e438588..ef2f6df 100755 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -953,12 +953,14 @@ declare 0 unix { declare 1 unix { void TclWinConvertWSAError(unsigned int errCode) } +# On non-cygwin, this is actually a reference to TclpCreateCommandChannel declare 2 unix { - Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) + struct servent *TclWinGetServByName(const char *nm, const char *proto) } +# On non-cygwin, this is actually a reference to TclpCreatePipe declare 3 unix { - int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) + int TclWinGetSockOpt(void *s, int level, int optname, + char *optval, int *optlen) } # On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { @@ -1005,8 +1007,10 @@ declare 11 unix { declare 12 unix { 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 { - char *TclpInetNtoa(struct in_addr addr) + void TclIntPlatReserved13(void) } #On cygwin, TclpCreateProcess is here declare 15 unix { @@ -1050,26 +1054,26 @@ declare 30 unix { 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 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 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 35 unix { + char *TclpInetNtoa(struct in_addr addr) +} declare 36 unix { - TclFile TclpMakeFile (Tcl_Channel channel, int direction) + TclFile TclpMakeFile(Tcl_Channel channel, int direction) } declare 37 unix { - TclFile TclpOpenFile (const char *fname, int mode) + TclFile TclpOpenFile(const char *fname, int mode) } declare 38 unix { int TclUnixWaitForFile(int fd, int mask, int timeout) diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 6d3ed94..63f9fe6 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -32,13 +32,11 @@ EXTERN void TclWinConvertError _ANSI_ARGS_((unsigned int errCode)); EXTERN void TclWinConvertWSAError _ANSI_ARGS_(( unsigned int errCode)); /* 2 */ -EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( - TclFile readFile, TclFile writeFile, - TclFile errorFile, int numPids, - Tcl_Pid *pidPtr)); +EXTERN struct servent * TclWinGetServByName _ANSI_ARGS_((CONST char *nm, + CONST char *proto)); /* 3 */ -EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, - TclFile *writePipe)); +EXTERN int TclWinGetSockOpt _ANSI_ARGS_((VOID *s, int level, + int optname, char *optval, int *optlen)); /* 4 */ EXTERN VOID * TclWinGetTclInstance _ANSI_ARGS_((void)); /* Slot 5 is reserved */ @@ -59,7 +57,7 @@ EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_(( /* 12 */ EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 13 */ -EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); +EXTERN void TclIntPlatReserved13 _ANSI_ARGS_((void)); /* Slot 14 is reserved */ /* 15 */ EXTERN int TclMacOSXGetFileAttribute _ANSI_ARGS_(( @@ -99,14 +97,21 @@ EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 31 */ EXTERN int TclpCloseFile _ANSI_ARGS_((TclFile file)); -/* Slot 32 is reserved */ -/* Slot 33 is reserved */ +/* 32 */ +EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( + TclFile readFile, TclFile writeFile, + TclFile errorFile, int numPids, + Tcl_Pid *pidPtr)); +/* 33 */ +EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, + TclFile *writePipe)); /* 34 */ EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); -/* Slot 35 is reserved */ +/* 35 */ +EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); /* 36 */ EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, int direction)); @@ -267,8 +272,8 @@ typedef struct TclIntPlatStubs { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ void (*tclWinConvertError) _ANSI_ARGS_((unsigned int errCode)); /* 0 */ void (*tclWinConvertWSAError) _ANSI_ARGS_((unsigned int errCode)); /* 1 */ - Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 2 */ - int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 3 */ + struct servent * (*tclWinGetServByName) _ANSI_ARGS_((CONST char *nm, CONST char *proto)); /* 2 */ + int (*tclWinGetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, char *optval, int *optlen)); /* 3 */ VOID * (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */ VOID *reserved5; unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */ @@ -278,7 +283,7 @@ typedef struct TclIntPlatStubs { Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR *dir)); /* 10 */ struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */ struct tm * (*tclpGmtime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 12 */ - char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 13 */ + void (*tclIntPlatReserved13) _ANSI_ARGS_((void)); /* 13 */ VOID *reserved14; int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */ VOID *reserved16; @@ -297,10 +302,10 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */ void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */ int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */ - VOID *reserved32; - VOID *reserved33; + Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 32 */ + int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 33 */ int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */ - VOID *reserved35; + char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 35 */ TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 36 */ TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char *fname, int mode)); /* 37 */ int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 38 */ @@ -391,13 +396,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinConvertWSAError \ (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ #endif -#ifndef TclpCreateCommandChannel -#define TclpCreateCommandChannel \ - (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */ +#ifndef TclWinGetServByName +#define TclWinGetServByName \ + (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */ #endif -#ifndef TclpCreatePipe -#define TclpCreatePipe \ - (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ +#ifndef TclWinGetSockOpt +#define TclWinGetSockOpt \ + (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */ #endif #ifndef TclWinGetTclInstance #define TclWinGetTclInstance \ @@ -432,9 +437,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpGmtime_unix \ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #endif -#ifndef TclpInetNtoa -#define TclpInetNtoa \ - (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ +#ifndef TclIntPlatReserved13 +#define TclIntPlatReserved13 \ + (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */ #endif /* Slot 14 is reserved */ #ifndef TclMacOSXGetFileAttribute @@ -490,13 +495,22 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCloseFile \ (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ #endif -/* Slot 32 is reserved */ -/* Slot 33 is reserved */ +#ifndef TclpCreateCommandChannel +#define TclpCreateCommandChannel \ + (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */ +#endif +#ifndef TclpCreatePipe +#define TclpCreatePipe \ + (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */ +#endif #ifndef TclpCreateProcess #define TclpCreateProcess \ (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ #endif -/* Slot 35 is reserved */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */ +#endif #ifndef TclpMakeFile #define TclpMakeFile \ (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ @@ -734,6 +748,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix +#undef TclIntPlatReserved13 #if !defined(__WIN32__) && !defined(MAC_TCL) # undef TclpGetPid @@ -743,6 +758,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # undef TclpCreateProcess # undef TclpMakeFile # undef TclpOpenFile +# undef TclpCreateCommandChannel # ifdef __CYGWIN__ # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -751,6 +767,8 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; int direction))) tclIntPlatStubsPtr->tclMacOSXMatchType) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclIntPlatReserved13) # else # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -758,11 +776,16 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \ int direction))) tclIntPlatStubsPtr->tclWinNToHS) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ - tclIntPlatStubsPtr->tclWinNToHS) + tclIntPlatStubsPtr->tclWinSetSockOpt) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclWinGetServByName) # undef TclpCreateTempFile # undef TclGetAndDetachPids # undef TclpCloseFile +# undef TclpCreatePipe +# undef TclpInetNtoa +# undef TclUnixWaitForFile # define TclpCreateTempFile ((TclFile (*) _ANSI_ARGS_((CONST char *))) \ tclIntPlatStubsPtr->tclWinGetPlatformId) @@ -770,6 +793,12 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; tclIntPlatStubsPtr->tclWinConvertError) # define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ tclIntPlatStubsPtr->tclWinConvertWSAError) +# define TclpCreatePipe ((int (*)_ANSI_ARGS_((TclFile *, TclFile *))) \ + tclIntPlatStubsPtr->tclWinGetSockOpt) +# define TclpInetNtoa ((char *(*) _ANSI_ARGS_((struct in_addr addr))) \ + tclIntPlatStubsPtr->tclIntPlatReserved13) +# define TclUnixWaitForFile (int (*) _ANSI_ARGS_((int, int, int))) \ + tclIntPlatStubsPtr->tclpGetPid) # endif # endif #endif diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index bd3dd05..fedce5e 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -82,9 +82,12 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); #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 @@ -120,6 +123,19 @@ TclWinSetSockOpt(void *s, int level, int optname, return setsockopt((int) s, level, optname, optval, optlen); } +static int +TclWinGetSockOpt(void *s, int level, int optname, + char *optval, int optlen) +{ + return getsockopt((int) s, level, optname, optval, optlen); +} + +struct servent * +TclWinGetServByName(const char *name, const char *proto) +{ + return getservbyname(name, proto); +} + static char * TclWinNoBackslash(char *path) { @@ -190,6 +206,9 @@ Tcl_WinTCharToUtf( # define TclWinGetTclInstance (void *(*)()) TclpCreateProcess # define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile # define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, CONST char *, int))) TclpOpenFile +# define TclWinGetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, char *, int))) TclpCreatePipe +# define TclWinGetServByName (struct servent *(*) _ANSI_ARGS_((const char *nm, const char *proto))) TclpCreateCommandChannel +# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa # define TclWinAddProcess 0 # define TclWinNoBackslash 0 # define TclWinSetInterfaces 0 @@ -458,8 +477,8 @@ TclIntPlatStubs tclIntPlatStubs = { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ - TclpCreateCommandChannel, /* 2 */ - TclpCreatePipe, /* 3 */ + TclWinGetServByName, /* 2 */ + TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ TclWinNToHS, /* 6 */ @@ -469,7 +488,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ - TclpInetNtoa, /* 13 */ + TclIntPlatReserved13, /* 13 */ NULL, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ NULL, /* 16 */ @@ -488,10 +507,10 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ TclGetAndDetachPids, /* 30 */ TclpCloseFile, /* 31 */ - NULL, /* 32 */ - NULL, /* 33 */ + TclpCreateCommandChannel, /* 32 */ + TclpCreatePipe, /* 33 */ TclpCreateProcess, /* 34 */ - NULL, /* 35 */ + TclpInetNtoa, /* 35 */ TclpMakeFile, /* 36 */ TclpOpenFile, /* 37 */ TclUnixWaitForFile, /* 38 */ diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index a26922c..9426697 100755 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -698,7 +698,6 @@ EXTERN struct tm * TclpLocaltime(TclpTime_t_CONST); #ifndef TclpGmtime EXTERN struct tm * TclpGmtime(TclpTime_t_CONST); #endif -EXTERN char * TclpInetNtoa(struct in_addr); #define inet_ntoa(x) TclpInetNtoa(x) #else typedef int TclpMutex; -- cgit v0.12 From fd1b8fed98693958cd2b9a83f83e71f8afdbe3e3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Apr 2012 13:10:04 +0000 Subject: oops, wrong signature --- generic/tclStubInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index fedce5e..8b6e22b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -125,7 +125,7 @@ TclWinSetSockOpt(void *s, int level, int optname, static int TclWinGetSockOpt(void *s, int level, int optname, - char *optval, int optlen) + char *optval, int *optlen) { return getsockopt((int) s, level, optname, optval, optlen); } -- cgit v0.12